diff --git a/content-types/content-type-group-updated/package.json b/content-types/content-type-group-updated/package.json index dfe9f7823..309e620e1 100644 --- a/content-types/content-type-group-updated/package.json +++ b/content-types/content-type-group-updated/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-primitives/package.json b/content-types/content-type-primitives/package.json index ab40fb0dc..b37db9052 100644 --- a/content-types/content-type-primitives/package.json +++ b/content-types/content-type-primitives/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reaction/package.json b/content-types/content-type-reaction/package.json index b862c90d1..858b28c1c 100644 --- a/content-types/content-type-reaction/package.json +++ b/content-types/content-type-reaction/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-read-receipt/package.json b/content-types/content-type-read-receipt/package.json index 68a95c94c..b86367e22 100644 --- a/content-types/content-type-read-receipt/package.json +++ b/content-types/content-type-read-receipt/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-remote-attachment/package.json b/content-types/content-type-remote-attachment/package.json index 8b44b4f5f..0027bbcba 100644 --- a/content-types/content-type-remote-attachment/package.json +++ b/content-types/content-type-remote-attachment/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-reply/package.json b/content-types/content-type-reply/package.json index 1cab69ce4..7d7ea876a 100644 --- a/content-types/content-type-reply/package.json +++ b/content-types/content-type-reply/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-text/package.json b/content-types/content-type-text/package.json index 69b473db3..2912aacd2 100644 --- a/content-types/content-type-text/package.json +++ b/content-types/content-type-text/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/content-types/content-type-transaction-reference/package.json b/content-types/content-type-transaction-reference/package.json index b703a4e53..472f77c6e 100644 --- a/content-types/content-type-transaction-reference/package.json +++ b/content-types/content-type-transaction-reference/package.json @@ -31,14 +31,17 @@ "browser": "./dist/browser/index.js", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "browser": "dist/browser/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/examples/react-vite-browser-sdk/vite.config.ts b/examples/react-vite-browser-sdk/vite.config.ts index 3d7f96fe2..675f09667 100644 --- a/examples/react-vite-browser-sdk/vite.config.ts +++ b/examples/react-vite-browser-sdk/vite.config.ts @@ -5,7 +5,8 @@ import { defineConfig } from "vite"; export default defineConfig({ plugins: [react()], optimizeDeps: { - exclude: ["@xmtp/wasm-bindings"], + exclude: ["@xmtp/browser-sdk"], + include: ["@xmtp/proto"], }, server: { headers: { diff --git a/packages/consent-proof-signature/package.json b/packages/consent-proof-signature/package.json index 7c4e12cde..e18cc73c6 100644 --- a/packages/consent-proof-signature/package.json +++ b/packages/consent-proof-signature/package.json @@ -29,7 +29,8 @@ "types": "./dist/index.d.ts", "require": "./dist/index.cjs", "import": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", @@ -38,8 +39,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/frames-client/package.json b/packages/frames-client/package.json index 280227493..533889cde 100644 --- a/packages/frames-client/package.json +++ b/packages/frames-client/package.json @@ -28,7 +28,8 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "module": "dist/index.js", "browser": "dist/index.js", @@ -36,8 +37,7 @@ "files": [ "dist", "src", - "!src/**/*.test.*", - "tsconfig.json" + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/packages/frames-validator/package.json b/packages/frames-validator/package.json index 1680877bf..f5bb07a64 100644 --- a/packages/frames-validator/package.json +++ b/packages/frames-validator/package.json @@ -14,13 +14,16 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", "types": "dist/index.d.ts", "files": [ - "dist" + "dist", + "src", + "!src/**/*.test.*" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/sdks/browser-sdk/README.md b/sdks/browser-sdk/README.md index 25de3133f..dbaacafa9 100644 --- a/sdks/browser-sdk/README.md +++ b/sdks/browser-sdk/README.md @@ -68,7 +68,7 @@ export default nextConfig; ### Bundlers -This SDK uses a WebAssembly (WASM) module and some bundlers must be configured properly to handle it. +This SDK and some of its dependencies use `import.meta.url`. Some bundlers must be configured to account for this during development. #### Vite @@ -79,7 +79,8 @@ import { defineConfig } from "vite"; export default defineConfig({ optimizeDeps: { - exclude: ["@xmtp/wasm-bindings"], + exclude: ["@xmtp/browser-sdk"], + include: ["@xmtp/proto"], }, }); ``` diff --git a/sdks/browser-sdk/package.json b/sdks/browser-sdk/package.json index 5613fd61e..e83c5b8e8 100644 --- a/sdks/browser-sdk/package.json +++ b/sdks/browser-sdk/package.json @@ -29,15 +29,15 @@ ".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" - } + }, + "./package.json": "./package.json" }, "module": "dist/index.js", "browser": "dist/index.js", "types": "dist/index.d.ts", "files": [ "dist", - "src", - "tsconfig.json" + "src" ], "scripts": { "build": "yarn clean:dist && yarn rollup -c", diff --git a/sdks/js-sdk/package.json b/sdks/js-sdk/package.json index d434d82d8..41f2c2af6 100644 --- a/sdks/js-sdk/package.json +++ b/sdks/js-sdk/package.json @@ -59,8 +59,7 @@ "types": "dist/index.d.ts", "files": [ "dist", - "src", - "tsconfig.json" + "src" ], "scripts": { "bench": "yarn build:bench && node dist/bench/index.cjs", diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index 9fbcb9145..d6e5bebe5 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -28,7 +28,8 @@ "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": "./dist/index.cjs" - } + }, + "./package.json": "./package.json" }, "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/sdks/node-sdk/src/Conversations.ts b/sdks/node-sdk/src/Conversations.ts index 6312cd332..15c508d02 100644 --- a/sdks/node-sdk/src/Conversations.ts +++ b/sdks/node-sdk/src/Conversations.ts @@ -47,10 +47,7 @@ export class Conversations { } } - async newConversation( - accountAddresses: string[], - options?: CreateGroupOptions, - ) { + async newGroup(accountAddresses: string[], options?: CreateGroupOptions) { const group = await this.#conversations.createGroup( accountAddresses, options, diff --git a/sdks/node-sdk/test/Client.test.ts b/sdks/node-sdk/test/Client.test.ts index 2514c36da..5beff1d26 100644 --- a/sdks/node-sdk/test/Client.test.ts +++ b/sdks/node-sdk/test/Client.test.ts @@ -164,9 +164,7 @@ describe("Client", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); await client2.conversations.sync(); const group2 = client2.conversations.getConversationById(group.id); diff --git a/sdks/node-sdk/test/Conversation.test.ts b/sdks/node-sdk/test/Conversation.test.ts index 0002e2319..63f8c3b90 100644 --- a/sdks/node-sdk/test/Conversation.test.ts +++ b/sdks/node-sdk/test/Conversation.test.ts @@ -13,7 +13,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const newName = "foo"; @@ -39,7 +39,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const imageUrl = "https://foo/bar.jpg"; @@ -65,7 +65,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const newDescription = "foo"; @@ -91,7 +91,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); const pinnedFrameUrl = "https://foo/bar"; @@ -119,7 +119,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -158,7 +158,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -194,7 +194,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -226,7 +226,7 @@ describe("Conversation", () => { codecs: [new TestCodec()], }); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -242,7 +242,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -281,7 +281,7 @@ describe("Conversation", () => { codecs: [new TestCodec()], }); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -297,7 +297,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -311,7 +311,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -350,7 +350,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -376,7 +376,7 @@ describe("Conversation", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); @@ -404,9 +404,7 @@ describe("Conversation", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); expect(group).toBeDefined(); const dmGroup = await client1.conversations.newDm(user3.account.address); expect(dmGroup).toBeDefined(); diff --git a/sdks/node-sdk/test/Conversations.test.ts b/sdks/node-sdk/test/Conversations.test.ts index a6dc93df7..e70215b2b 100644 --- a/sdks/node-sdk/test/Conversations.test.ts +++ b/sdks/node-sdk/test/Conversations.test.ts @@ -12,12 +12,12 @@ describe("Conversations", () => { expect((await client.conversations.listGroups()).length).toBe(0); }); - it("should create a new conversation", async () => { + it("should create a group", async () => { const user1 = createUser(); const user2 = createUser(); const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); - const conversation = await client1.conversations.newConversation([ + const conversation = await client1.conversations.newGroup([ user2.account.address, ]); expect(conversation).toBeDefined(); @@ -71,7 +71,7 @@ describe("Conversations", () => { expect((await client2.conversations.listGroups()).length).toBe(1); }); - it("should create a dm group", async () => { + it("should create a dm", async () => { const user1 = createUser(); const user2 = createUser(); const client1 = await createRegisteredClient(user1); @@ -142,9 +142,7 @@ describe("Conversations", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); expect(group).toBeDefined(); expect(group.id).toBeDefined(); const foundGroup = client1.conversations.getConversationById(group.id); @@ -157,9 +155,7 @@ describe("Conversations", () => { const user2 = createUser(); const client1 = await createRegisteredClient(user1); await createRegisteredClient(user2); - const group = await client1.conversations.newConversation([ - user2.account.address, - ]); + const group = await client1.conversations.newGroup([user2.account.address]); const messageId = await group.send("gm!"); expect(messageId).toBeDefined(); @@ -168,7 +164,7 @@ describe("Conversations", () => { expect(message!.id).toBe(messageId); }); - it("should create a new conversation with options", async () => { + it("should create a group with options", async () => { const user1 = createUser(); const user2 = createUser(); const user3 = createUser(); @@ -179,7 +175,7 @@ describe("Conversations", () => { await createRegisteredClient(user3); await createRegisteredClient(user4); await createRegisteredClient(user5); - const groupWithName = await client1.conversations.newConversation( + const groupWithName = await client1.conversations.newGroup( [user2.account.address], { groupName: "foo", @@ -189,7 +185,7 @@ describe("Conversations", () => { expect(groupWithName.name).toBe("foo"); expect(groupWithName.imageUrl).toBe(""); - const groupWithImageUrl = await client1.conversations.newConversation( + const groupWithImageUrl = await client1.conversations.newGroup( [user3.account.address], { groupImageUrlSquare: "https://foo/bar.png", @@ -199,16 +195,18 @@ describe("Conversations", () => { expect(groupWithImageUrl.name).toBe(""); expect(groupWithImageUrl.imageUrl).toBe("https://foo/bar.png"); - const groupWithNameAndImageUrl = - await client1.conversations.newConversation([user4.account.address], { + const groupWithNameAndImageUrl = await client1.conversations.newGroup( + [user4.account.address], + { groupImageUrlSquare: "https://foo/bar.png", groupName: "foo", - }); + }, + ); expect(groupWithNameAndImageUrl).toBeDefined(); expect(groupWithNameAndImageUrl.name).toBe("foo"); expect(groupWithNameAndImageUrl.imageUrl).toBe("https://foo/bar.png"); - const groupWithPermissions = await client1.conversations.newConversation( + const groupWithPermissions = await client1.conversations.newGroup( [user4.account.address], { permissions: GroupPermissionsOptions.AdminOnly, @@ -232,7 +230,7 @@ describe("Conversations", () => { updateGroupPinnedFrameUrlPolicy: 2, }); - const groupWithDescription = await client1.conversations.newConversation( + const groupWithDescription = await client1.conversations.newGroup( [user2.account.address], { groupDescription: "foo", @@ -243,7 +241,7 @@ describe("Conversations", () => { expect(groupWithDescription.imageUrl).toBe(""); expect(groupWithDescription.description).toBe("foo"); - const groupWithPinnedFrameUrl = await client1.conversations.newConversation( + const groupWithPinnedFrameUrl = await client1.conversations.newGroup( [user2.account.address], { groupPinnedFrameUrl: "https://foo/bar", @@ -264,10 +262,10 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const stream = client3.conversations.stream(); - const conversation1 = await client1.conversations.newConversation([ + const conversation1 = await client1.conversations.newGroup([ user3.account.address, ]); - const conversation2 = await client2.conversations.newConversation([ + const conversation2 = await client2.conversations.newGroup([ user3.account.address, ]); let count = 0; @@ -301,10 +299,10 @@ describe("Conversations", () => { const client4 = await createRegisteredClient(user4); const stream = client3.conversations.streamGroups(); await client4.conversations.newDm(user3.account.address); - const group1 = await client1.conversations.newConversation([ + const group1 = await client1.conversations.newGroup([ user3.account.address, ]); - const group2 = await client2.conversations.newConversation([ + const group2 = await client2.conversations.newGroup([ user3.account.address, ]); let count = 0; @@ -331,8 +329,8 @@ describe("Conversations", () => { const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); const stream = client3.conversations.streamDms(); - await client1.conversations.newConversation([user3.account.address]); - await client2.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user3.account.address]); + await client2.conversations.newGroup([user3.account.address]); const group3 = await client4.conversations.newDm(user3.account.address); let count = 0; for await (const convo of stream) { @@ -353,8 +351,8 @@ describe("Conversations", () => { const client1 = await createRegisteredClient(user1); const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); const stream = await client1.conversations.streamAllMessages(); @@ -391,8 +389,8 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); await client1.conversations.newDm(user4.account.address); const stream = await client1.conversations.streamAllGroupMessages(); @@ -437,8 +435,8 @@ describe("Conversations", () => { const client2 = await createRegisteredClient(user2); const client3 = await createRegisteredClient(user3); const client4 = await createRegisteredClient(user4); - await client1.conversations.newConversation([user2.account.address]); - await client1.conversations.newConversation([user3.account.address]); + await client1.conversations.newGroup([user2.account.address]); + await client1.conversations.newGroup([user3.account.address]); await client1.conversations.newDm(user4.account.address); const stream = await client1.conversations.streamAllDmMessages();