Skip to content

Commit

Permalink
Merge pull request #727 from xmtp/rygine/node-sdk-update
Browse files Browse the repository at this point in the history
Upgrade node bindings
  • Loading branch information
rygine authored Nov 20, 2024
2 parents 9f27c38 + 7661f78 commit 936245c
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-lamps-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@xmtp/node-sdk": patch
---

Upgrade node bindings
2 changes: 1 addition & 1 deletion content-types/content-type-group-updated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@types/node": "^20.17.6",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-primitives/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.1",
"@types/node": "^20.17.6",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-reaction/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-read-receipt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-remote-attachment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-reply/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion content-types/content-type-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"@xmtp/xmtp-js": "^11.6.3",
"buffer": "^6.0.3",
"ethers": "^6.11.1",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion sdks/browser-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"@vitest/browser": "^2.1.3",
"@vitest/coverage-v8": "^2.0.3",
"@web/rollup-plugin-copy": "^0.5.1",
"playwright": "^1.48.1",
"playwright": "^1.49.0",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
"rollup-plugin-filesize": "^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion sdks/js-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@xmtp/rollup-plugin-resolve-extensions": "1.0.1",
"benny": "^3.7.1",
"ethers": "^5.7.2",
"happy-dom": "^15.7.4",
"happy-dom": "^15.11.6",
"rimraf": "^6.0.1",
"rollup": "^4.27.3",
"rollup-plugin-dts": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion sdks/node-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@xmtp/content-type-group-updated": "^1.0.1",
"@xmtp/content-type-primitives": "^1.0.3",
"@xmtp/content-type-text": "^1.0.1",
"@xmtp/node-bindings": "^0.0.18",
"@xmtp/node-bindings": "^0.0.20",
"@xmtp/proto": "^3.72.0"
},
"devDependencies": {
Expand Down
32 changes: 29 additions & 3 deletions sdks/node-sdk/src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
generateInboxId,
getInboxIdForAddress,
GroupMessageKind,
Level,
LogLevel,
SignatureRequestType,
type Consent,
type ConsentEntityType,
Expand Down Expand Up @@ -78,7 +78,7 @@ export type OtherOptions = {
/**
* Logging level
*/
loggingLevel?: Level;
loggingLevel?: LogLevel;
/**
* Disable automatic registration when creating a client
*/
Expand Down Expand Up @@ -126,7 +126,7 @@ export class Client {

const logOptions: LogOptions = {
structured: options?.structuredLogging ?? false,
level: options?.loggingLevel ?? Level.off,
level: options?.loggingLevel ?? LogLevel.off,
};

const client = new Client(
Expand Down Expand Up @@ -409,4 +409,30 @@ export class Client {
async getConsentState(entityType: ConsentEntityType, entity: string) {
return this.#innerClient.getConsentState(entityType, entity);
}

signWithInstallationKey(signatureText: string) {
return this.#innerClient.signWithInstallationKey(signatureText);
}

verifySignedWithInstallationKey(
signatureText: string,
signatureBytes: Uint8Array,
) {
this.#innerClient.verifySignedWithInstallationKey(
signatureText,
signatureBytes,
);
}

verifySignedWithPublicKey(
signatureText: string,
signatureBytes: Uint8Array,
publicKey: Uint8Array,
) {
this.#innerClient.verifySignedWithPublicKey(
signatureText,
signatureBytes,
publicKey,
);
}
}
4 changes: 4 additions & 0 deletions sdks/node-sdk/src/Conversations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ export class Conversations {
return this.#conversations.sync();
}

async syncAll() {
return this.#conversations.syncAllConversations();
}

stream(callback?: StreamCallback<Conversation>) {
const asyncStream = new AsyncStream<Conversation>();

Expand Down
2 changes: 1 addition & 1 deletion sdks/node-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export {
GroupMetadata,
GroupPermissions,
GroupPermissionsOptions,
Level,
LogLevel,
PermissionLevel,
PermissionPolicy,
PermissionUpdateType,
Expand Down
2 changes: 1 addition & 1 deletion sdks/node-sdk/test/Conversations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe("Conversations", () => {
updateGroupPinnedFrameUrlPolicy: 0,
});
expect(group.addedByInboxId).toBe(client1.inboxId);
expect(group.messages().length).toBe(1);
expect(group.messages().length).toBe(0);
const members = await group.members();
expect(members.length).toBe(2);
const memberInboxIds = members.map((member) => member.inboxId);
Expand Down
56 changes: 28 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4810,7 +4810,7 @@ __metadata:
"@xmtp/content-type-text": "npm:^1.0.1"
"@xmtp/proto": "npm:^3.72.0"
"@xmtp/wasm-bindings": "npm:^0.0.4"
playwright: "npm:^1.48.1"
playwright: "npm:^1.49.0"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
rollup-plugin-filesize: "npm:^10.0.0"
Expand Down Expand Up @@ -4857,7 +4857,7 @@ __metadata:
"@xmtp/proto": "npm:^3.72.0"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4876,7 +4876,7 @@ __metadata:
"@rollup/plugin-typescript": "npm:^12.1.1"
"@types/node": "npm:^20.17.6"
"@xmtp/proto": "npm:^3.72.0"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4898,7 +4898,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4920,7 +4920,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4945,7 +4945,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4969,7 +4969,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -4991,7 +4991,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand All @@ -5013,7 +5013,7 @@ __metadata:
"@xmtp/xmtp-js": "npm:^11.6.3"
buffer: "npm:^6.0.3"
ethers: "npm:^6.11.1"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
rollup-plugin-dts: "npm:^6.1.1"
Expand Down Expand Up @@ -5073,10 +5073,10 @@ __metadata:
languageName: unknown
linkType: soft

"@xmtp/node-bindings@npm:^0.0.18":
version: 0.0.18
resolution: "@xmtp/node-bindings@npm:0.0.18"
checksum: 10/5cca0748f163728c013ff17cf7fba81a64a7a6029a9782c6b568fd1044940c8ae641110f0a187ee2ac7787f303552712ebe1d5c515c5dad4dc0baa31506d8b83
"@xmtp/node-bindings@npm:^0.0.20":
version: 0.0.20
resolution: "@xmtp/node-bindings@npm:0.0.20"
checksum: 10/fbbe2e223a7871e9908cda41161a0360dc61b5b32cbe3342b7471de7039cac65e6b71783faf0827cce03cdbb68ee60fb1394bc76a0749b7ca0d014dae96a3ce9
languageName: node
linkType: hard

Expand All @@ -5091,7 +5091,7 @@ __metadata:
"@xmtp/content-type-group-updated": "npm:^1.0.1"
"@xmtp/content-type-primitives": "npm:^1.0.3"
"@xmtp/content-type-text": "npm:^1.0.1"
"@xmtp/node-bindings": "npm:^0.0.18"
"@xmtp/node-bindings": "npm:^0.0.20"
"@xmtp/proto": "npm:^3.72.0"
"@xmtp/xmtp-js": "workspace:^"
fast-glob: "npm:^3.3.2"
Expand Down Expand Up @@ -5255,7 +5255,7 @@ __metadata:
benny: "npm:^3.7.1"
elliptic: "npm:^6.5.7"
ethers: "npm:^5.7.2"
happy-dom: "npm:^15.7.4"
happy-dom: "npm:^15.11.6"
long: "npm:^5.2.3"
rimraf: "npm:^6.0.1"
rollup: "npm:^4.27.3"
Expand Down Expand Up @@ -7856,14 +7856,14 @@ __metadata:
languageName: node
linkType: hard

"happy-dom@npm:^15.7.4":
version: 15.7.4
resolution: "happy-dom@npm:15.7.4"
"happy-dom@npm:^15.11.6":
version: 15.11.6
resolution: "happy-dom@npm:15.11.6"
dependencies:
entities: "npm:^4.5.0"
webidl-conversions: "npm:^7.0.0"
whatwg-mimetype: "npm:^3.0.0"
checksum: 10/fd5026e8a2d9437f161e4c6d9725ffe68f6d31cd09ac7d729b3cd5dd2207a3833272607171da1caf4b1247839ead8bd01a4381a0e31909589af29d27fa24a0f5
checksum: 10/895a40bda00753f833ea563f64aef80558b6f701a3238e9fe7143265a1246bde57bc5a7a58ed89e77e2bbe309a119dcf956a70c48033fa84893c41206a6b4128
languageName: node
linkType: hard

Expand Down Expand Up @@ -10181,27 +10181,27 @@ __metadata:
languageName: node
linkType: hard

"playwright-core@npm:1.48.1":
version: 1.48.1
resolution: "playwright-core@npm:1.48.1"
"playwright-core@npm:1.49.0":
version: 1.49.0
resolution: "playwright-core@npm:1.49.0"
bin:
playwright-core: cli.js
checksum: 10/81b51d288be78b75898470eb192ef0bc65594eebfb5f7602d83ba2505e1d2163c9923a0d7bae46779d5f3a16e1daf392acfbccde01d9f302cdf90bf2b21b8988
checksum: 10/ef9c708293adab100337ed7fd8e61660be381707fc2b84f07b5f40d1ead44feb6a8e52fef98075e594522229d15a9ad56dd1471689cfa59409bec6447c22944d
languageName: node
linkType: hard

"playwright@npm:^1.48.1":
version: 1.48.1
resolution: "playwright@npm:1.48.1"
"playwright@npm:^1.49.0":
version: 1.49.0
resolution: "playwright@npm:1.49.0"
dependencies:
fsevents: "npm:2.3.2"
playwright-core: "npm:1.48.1"
playwright-core: "npm:1.49.0"
dependenciesMeta:
fsevents:
optional: true
bin:
playwright: cli.js
checksum: 10/39e231af3d9e576ba835813c5319b8773d8536ba54c7e34c7004cf06fadb412b6bbfc91badf4bb5cda3f138e5a8994c314de4c76d06d9424430e415f86fb3dd1
checksum: 10/1fb198d09d388ec46cc2f0fc6b889a8bde8a75066ded82d35f08ba333091ebf3fc4ddf11263a86058a7078c7238ec4f23a86a9f1dc3ebd4f610c9eb07841fb32
languageName: node
linkType: hard

Expand Down

0 comments on commit 936245c

Please sign in to comment.