From e4460b08f19f6a81b4a4e246ce8f63693aea96e7 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 21 Jan 2025 10:26:34 -0500 Subject: [PATCH 1/4] Upgrade bindings --- sdks/browser-sdk/package.json | 2 +- sdks/node-sdk/package.json | 2 +- yarn.lock | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sdks/browser-sdk/package.json b/sdks/browser-sdk/package.json index bc2b175e..430b70cb 100644 --- a/sdks/browser-sdk/package.json +++ b/sdks/browser-sdk/package.json @@ -64,7 +64,7 @@ "@xmtp/content-type-primitives": "^2.0.0", "@xmtp/content-type-text": "^2.0.0", "@xmtp/proto": "^3.72.3", - "@xmtp/wasm-bindings": "^0.0.12", + "@xmtp/wasm-bindings": "^0.0.13", "uuid": "^11.0.3" }, "devDependencies": { diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index fc2eaa28..f8888135 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -51,7 +51,7 @@ "@xmtp/content-type-group-updated": "^2.0.0", "@xmtp/content-type-primitives": "^2.0.0", "@xmtp/content-type-text": "^2.0.0", - "@xmtp/node-bindings": "^0.0.33", + "@xmtp/node-bindings": "^0.0.34", "@xmtp/proto": "^3.72.3" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index 943493d9..9fde1417 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4696,7 +4696,7 @@ __metadata: "@xmtp/content-type-primitives": "npm:^2.0.0" "@xmtp/content-type-text": "npm:^2.0.0" "@xmtp/proto": "npm:^3.72.3" - "@xmtp/wasm-bindings": "npm:^0.0.12" + "@xmtp/wasm-bindings": "npm:^0.0.13" playwright: "npm:^1.49.1" rollup: "npm:^4.30.1" rollup-plugin-dts: "npm:^6.1.1" @@ -5001,10 +5001,10 @@ __metadata: languageName: node linkType: hard -"@xmtp/node-bindings@npm:^0.0.33": - version: 0.0.33 - resolution: "@xmtp/node-bindings@npm:0.0.33" - checksum: 10/ba4e9b16fc261fa5ec3dc8b934074347e28e75590e85d113c339579c9eebc58b8cb2114f113106ab111347793d739aa41efa855013a5a7919240344869a58a75 +"@xmtp/node-bindings@npm:^0.0.34": + version: 0.0.34 + resolution: "@xmtp/node-bindings@npm:0.0.34" + checksum: 10/4f5314d40dc1f07e303e52a4be1d4517f1199089b4ac1677fabb11f64a6b4f57a989b25849b31036d6d228e9de494a8326d2b53386067146ee47e28691bba999 languageName: node linkType: hard @@ -5032,7 +5032,7 @@ __metadata: "@xmtp/content-type-group-updated": "npm:^2.0.0" "@xmtp/content-type-primitives": "npm:^2.0.0" "@xmtp/content-type-text": "npm:^2.0.0" - "@xmtp/node-bindings": "npm:^0.0.33" + "@xmtp/node-bindings": "npm:^0.0.34" "@xmtp/proto": "npm:^3.72.3" "@xmtp/xmtp-js": "workspace:^" fast-glob: "npm:^3.3.3" @@ -5119,10 +5119,10 @@ __metadata: languageName: node linkType: hard -"@xmtp/wasm-bindings@npm:^0.0.12": - version: 0.0.12 - resolution: "@xmtp/wasm-bindings@npm:0.0.12" - checksum: 10/95394403d7c6cac58a559c71866d26473a2a18d55e6b9f759d2158d817142ac2965ff4bfc147406c1df407ae6d0a90fb36039d97254ca27b7aea3ae462aa62ce +"@xmtp/wasm-bindings@npm:^0.0.13": + version: 0.0.13 + resolution: "@xmtp/wasm-bindings@npm:0.0.13" + checksum: 10/7d5a076caf8e835fb5fedac0bb95cd0e357cdb12da461359299a3bbef63c254d3b1ffa423a78c94cf4c0a6d7f8dd81b993703e34e38eff6669bfe3e3bbfd2dd1 languageName: node linkType: hard From da2f5e4a88c7062613190a0630a3fe13f1f5f2f4 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 21 Jan 2025 10:26:53 -0500 Subject: [PATCH 2/4] Update node SDK tests --- sdks/node-sdk/test/Conversation.test.ts | 2 ++ sdks/node-sdk/test/Conversations.test.ts | 30 +++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/sdks/node-sdk/test/Conversation.test.ts b/sdks/node-sdk/test/Conversation.test.ts index 1bfa5a3d..dd5adcc5 100644 --- a/sdks/node-sdk/test/Conversation.test.ts +++ b/sdks/node-sdk/test/Conversation.test.ts @@ -451,6 +451,7 @@ describe.concurrent("Conversation", () => { updateGroupDescriptionPolicy: 0, updateGroupImageUrlSquarePolicy: 0, updateGroupPinnedFrameUrlPolicy: 0, + updateMessageExpirationMsPolicy: 2, }); await conversation.updatePermission( @@ -506,6 +507,7 @@ describe.concurrent("Conversation", () => { updateGroupDescriptionPolicy: 2, updateGroupImageUrlSquarePolicy: 2, updateGroupPinnedFrameUrlPolicy: 2, + updateMessageExpirationMsPolicy: 2, }); }); }); diff --git a/sdks/node-sdk/test/Conversations.test.ts b/sdks/node-sdk/test/Conversations.test.ts index 47b63fa8..ada61d3e 100644 --- a/sdks/node-sdk/test/Conversations.test.ts +++ b/sdks/node-sdk/test/Conversations.test.ts @@ -1,4 +1,5 @@ import { ConsentState, GroupPermissionsOptions } from "@xmtp/node-bindings"; +import { v4 } from "uuid"; import { describe, expect, it } from "vitest"; import { createRegisteredClient, createUser } from "@test/helpers"; @@ -30,7 +31,7 @@ describe.concurrent("Conversations", () => { expect(conversation.isActive).toBe(true); expect(conversation.name).toBe(""); expect(conversation.permissions.policyType).toBe( - GroupPermissionsOptions.AllMembers, + GroupPermissionsOptions.Default, ); expect(conversation.permissions.policySet).toEqual({ addMemberPolicy: 0, @@ -41,6 +42,7 @@ describe.concurrent("Conversations", () => { updateGroupDescriptionPolicy: 0, updateGroupImageUrlSquarePolicy: 0, updateGroupPinnedFrameUrlPolicy: 0, + updateMessageExpirationMsPolicy: 2, }); expect(conversation.addedByInboxId).toBe(client1.inboxId); expect((await conversation.messages()).length).toBe(1); @@ -95,6 +97,7 @@ describe.concurrent("Conversations", () => { updateGroupImageUrlSquarePolicy: 0, updateGroupNamePolicy: 0, updateGroupPinnedFrameUrlPolicy: 0, + updateMessageExpirationMsPolicy: 0, }); expect(group.addedByInboxId).toBe(client1.inboxId); expect((await group.messages()).length).toBe(0); @@ -228,6 +231,7 @@ describe.concurrent("Conversations", () => { updateGroupDescriptionPolicy: 2, updateGroupImageUrlSquarePolicy: 2, updateGroupPinnedFrameUrlPolicy: 2, + updateMessageExpirationMsPolicy: 2, }); const groupWithDescription = await client1.conversations.newGroup( @@ -272,6 +276,7 @@ describe.concurrent("Conversations", () => { updateGroupDescriptionPolicy: 1, updateGroupImageUrlSquarePolicy: 1, updateGroupPinnedFrameUrlPolicy: 1, + updateMessageExpirationMsPolicy: 2, }, }, ); @@ -288,6 +293,7 @@ describe.concurrent("Conversations", () => { updateGroupDescriptionPolicy: 1, updateGroupImageUrlSquarePolicy: 1, updateGroupPinnedFrameUrlPolicy: 1, + updateMessageExpirationMsPolicy: 2, }); }); @@ -529,4 +535,26 @@ describe.concurrent("Conversations", () => { } } }); + + it("should sync groups across installations", async () => { + const user = createUser(); + const client = await createRegisteredClient(user); + user.uuid = v4(); + const client2 = await createRegisteredClient(user); + const user2 = createUser(); + await createRegisteredClient(user2); + + const group = await client.conversations.newGroup([user2.account.address]); + await client2.conversations.sync(); + const convos = client2.conversations.list(); + expect(convos.length).toBe(1); + expect(convos[0].id).toBe(group.id); + + const group2 = await client.conversations.newDm(user2.account.address); + await client2.conversations.sync(); + const convos2 = client2.conversations.list(); + expect(convos2.length).toBe(2); + expect(convos2[0].id).toBe(group.id); + expect(convos2[1].id).toBe(group2.id); + }); }); From 7abb99003bc87a396296d27d65a29ddde6e4c913 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 21 Jan 2025 10:27:05 -0500 Subject: [PATCH 3/4] Update browser SDK tests --- sdks/browser-sdk/test/Conversations.test.ts | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sdks/browser-sdk/test/Conversations.test.ts b/sdks/browser-sdk/test/Conversations.test.ts index 15eac7ef..fe5a3913 100644 --- a/sdks/browser-sdk/test/Conversations.test.ts +++ b/sdks/browser-sdk/test/Conversations.test.ts @@ -1,4 +1,5 @@ import { ConsentState, GroupPermissionsOptions } from "@xmtp/wasm-bindings"; +import { v4 } from "uuid"; import { describe, expect, it } from "vitest"; import { createRegisteredClient, createUser } from "@test/helpers"; @@ -336,4 +337,26 @@ describe.concurrent("Conversations", () => { }); }); }); + + it("should sync groups across installations", async () => { + const user = createUser(); + const client = await createRegisteredClient(user); + user.uuid = v4(); + const client2 = await createRegisteredClient(user); + const user2 = createUser(); + await createRegisteredClient(user2); + + const group = await client.conversations.newGroup([user2.account.address]); + await client2.conversations.sync(); + const convos = await client2.conversations.list(); + expect(convos.length).toBe(1); + expect(convos[0].id).toBe(group.id); + + const group2 = await client.conversations.newDm(user2.account.address); + await client2.conversations.sync(); + const convos2 = await client2.conversations.list(); + expect(convos2.length).toBe(2); + expect(convos2[0].id).toBe(group.id); + expect(convos2[1].id).toBe(group2.id); + }); }); From eba99ad16b12e3605a3ee9f5ada9960c144ef560 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Tue, 21 Jan 2025 10:44:16 -0500 Subject: [PATCH 4/4] Create little-needles-peel.md --- .changeset/little-needles-peel.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/little-needles-peel.md diff --git a/.changeset/little-needles-peel.md b/.changeset/little-needles-peel.md new file mode 100644 index 00000000..65353274 --- /dev/null +++ b/.changeset/little-needles-peel.md @@ -0,0 +1,6 @@ +--- +"@xmtp/browser-sdk": patch +"@xmtp/node-sdk": patch +--- + +Upgrade bindings