-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add guild.xyz integration #364
Conversation
db8cbae
to
7619b52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments but this is looking really good
3020336
to
ec46dd3
Compare
# Conflicts: # apps/protocol-api/src/main.ts # libs/protocol-client/src/lib/client/guild.ts # libs/protocol-client/src/lib/client/user.ts # libs/protocol-client/src/lib/graphql/queries.graphql # libs/protocol-client/src/lib/protocol-types.ts
Adding an `update` method to the `GuildImport` client to update the import status
Instead of passing the membership status id directly.
09d7cdd
to
e308e58
Compare
# Conflicts: # apps/protocol-api/src/main.ts # libs/protocol-client/src/lib/client/guild.ts # libs/protocol-client/src/lib/graphql/queries.graphql # libs/protocol-client/src/lib/protocol-types.ts
I noticed an unexpected behavior where null values in roles are included within the guild response. This why I filtered it. |
# Conflicts: # libs/protocol-client/src/lib/client/user.ts
still unable to retrieve messages, I have provided additional details about the stream to facilitate further debugging.
|
These changes 556f146 to - const msgs = await js.fetch(stream, durable, {
- batch: batch,
- expires: expires,
- });
+ const subscription = await js.pullSubscribe(`${stream}.row`, {
+ mack: true,
+ config: {
+ durable_name: durable,
+ ack_policy: AckPolicy.Explicit,
+ ack_wait: nanos(4000),
+ },
+ });
const done = (async () => {
+ await subscription.pull({ no_wait: true, batch, expires });
for await (const m of subscription) {
console.log(`Received message ${m.data}`);
await callback(nc, m);
m.ack();
}
})(); |
# Conflicts: # apps/protocol-api/src/permissions/index.ts # libs/protocol-client/src/lib/client/user.ts # libs/protocol-client/src/lib/protocol-types.ts # workspace.json
console.log(`:: PULLING MESSAGES FROM ${stream} WITH DURABLE ${durable}`); | ||
const js = nc.jetstream(); | ||
|
||
const subscription = await js.pullSubscribe(`${stream}.row`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give more feedback about consumer
}); | ||
|
||
const done = (async () => { | ||
await subscription.pull({ no_wait: true, batch, expires }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look more closely
# Conflicts: # libs/protocol-client/src/lib/protocol-types.ts
Linear Ticket
PRO-692 - Guild Integration Consumer
Description
Main Changes:
helpers/nats.ts
for more documentations.helpers/db.ts
file for used calls.Caveat
In order to a guild import history record to the database, guild id is needed. Consequenlty, If failed to fetch any data from guild's sdk, there will be no record for a failed guild import to show in import history table.
API examples
Required .env values
Testing & Debugging
To fetch a guild named
our-guild
from the NATS server stream namedguild-import-job
, follow these steps:nats-server
locally via a Package Manager.yarn nx run protocol-api:serve
.nats-server --jetstream
guild-import-job
. You can acheive that using one of two ways:nats -s nats://localhost:4222 publish "guild-import-job.row" "our-guild"
. It is recommended to complete step 7 at least once before running this command.writeMessages()
utility function from/helpers/nats.ts
after you successfully establish a connection.nats stream report
. To view messages:nats stream view
yarn nx run guild-import-job:serve
.Unfortunately,
nats-server
doesn't include a built-in logging or debugging mode. However, nats CLI provide a convenient ways to interact with the server's state usingnats stream help
, accessing various functionalities and insights about nats server.Here's a Loom screencast to prepare nats-server for testing:
https://www.loom.com/share/18fad924307f4c14a87fdd0b0ef1458c