Skip to content

Commit

Permalink
Upgrade bindings (#795)
Browse files Browse the repository at this point in the history
* Upgrade bindings

* Update node SDK tests

* Update browser SDK tests

* Create little-needles-peel.md
  • Loading branch information
rygine authored Jan 21, 2025
1 parent 0f0ae21 commit 626d420
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .changeset/little-needles-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@xmtp/browser-sdk": patch
"@xmtp/node-sdk": patch
---

Upgrade bindings
2 changes: 1 addition & 1 deletion sdks/browser-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
23 changes: 23 additions & 0 deletions sdks/browser-sdk/test/Conversations.test.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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);
});
});
2 changes: 1 addition & 1 deletion sdks/node-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions sdks/node-sdk/test/Conversation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ describe.concurrent("Conversation", () => {
updateGroupDescriptionPolicy: 0,
updateGroupImageUrlSquarePolicy: 0,
updateGroupPinnedFrameUrlPolicy: 0,
updateMessageExpirationMsPolicy: 2,
});

await conversation.updatePermission(
Expand Down Expand Up @@ -506,6 +507,7 @@ describe.concurrent("Conversation", () => {
updateGroupDescriptionPolicy: 2,
updateGroupImageUrlSquarePolicy: 2,
updateGroupPinnedFrameUrlPolicy: 2,
updateMessageExpirationMsPolicy: 2,
});
});
});
30 changes: 29 additions & 1 deletion sdks/node-sdk/test/Conversations.test.ts
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -228,6 +231,7 @@ describe.concurrent("Conversations", () => {
updateGroupDescriptionPolicy: 2,
updateGroupImageUrlSquarePolicy: 2,
updateGroupPinnedFrameUrlPolicy: 2,
updateMessageExpirationMsPolicy: 2,
});

const groupWithDescription = await client1.conversations.newGroup(
Expand Down Expand Up @@ -272,6 +276,7 @@ describe.concurrent("Conversations", () => {
updateGroupDescriptionPolicy: 1,
updateGroupImageUrlSquarePolicy: 1,
updateGroupPinnedFrameUrlPolicy: 1,
updateMessageExpirationMsPolicy: 2,
},
},
);
Expand All @@ -288,6 +293,7 @@ describe.concurrent("Conversations", () => {
updateGroupDescriptionPolicy: 1,
updateGroupImageUrlSquarePolicy: 1,
updateGroupPinnedFrameUrlPolicy: 1,
updateMessageExpirationMsPolicy: 2,
});
});

Expand Down Expand Up @@ -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);
});
});
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 626d420

Please sign in to comment.