From f3d57da4d05e4ff81f509703e61a2e693e67dd66 Mon Sep 17 00:00:00 2001 From: Ry Racherbaumer Date: Mon, 28 Oct 2024 15:55:03 -0500 Subject: [PATCH] Use official group updated content type --- sdks/node-sdk/package.json | 1 + sdks/node-sdk/rollup.config.js | 3 +- sdks/node-sdk/src/Client.ts | 8 ++-- sdks/node-sdk/src/codecs/GroupUpdatedCodec.ts | 41 ------------------- sdks/node-sdk/src/index.ts | 4 -- yarn.lock | 1 + 6 files changed, 8 insertions(+), 50 deletions(-) delete mode 100644 sdks/node-sdk/src/codecs/GroupUpdatedCodec.ts diff --git a/sdks/node-sdk/package.json b/sdks/node-sdk/package.json index b1a4bf387..0e7283787 100644 --- a/sdks/node-sdk/package.json +++ b/sdks/node-sdk/package.json @@ -48,6 +48,7 @@ "typecheck": "tsc" }, "dependencies": { + "@xmtp/content-type-group-updated": "^1.0.0", "@xmtp/content-type-primitives": "^1.0.2", "@xmtp/content-type-text": "^1.0.0", "@xmtp/node-bindings": "^0.0.14", diff --git a/sdks/node-sdk/rollup.config.js b/sdks/node-sdk/rollup.config.js index 39aff655a..660feb54d 100644 --- a/sdks/node-sdk/rollup.config.js +++ b/sdks/node-sdk/rollup.config.js @@ -8,8 +8,9 @@ import tsConfigPaths from "rollup-plugin-tsconfig-paths"; const external = [ "node:path", "node:process", - "@xmtp/content-type-text", + "@xmtp/content-type-group-updated", "@xmtp/content-type-primitives", + "@xmtp/content-type-text", "@xmtp/node-bindings", "@xmtp/proto", "@xmtp/xmtp-js", diff --git a/sdks/node-sdk/src/Client.ts b/sdks/node-sdk/src/Client.ts index 3a3065e98..5a645c287 100644 --- a/sdks/node-sdk/src/Client.ts +++ b/sdks/node-sdk/src/Client.ts @@ -1,5 +1,9 @@ import { join } from "node:path"; import process from "node:process"; +import { + ContentTypeGroupUpdated, + GroupUpdatedCodec, +} from "@xmtp/content-type-group-updated"; import type { ContentCodec, ContentTypeId, @@ -15,10 +19,6 @@ import { type NapiClient, type NapiMessage, } from "@xmtp/node-bindings"; -import { - ContentTypeGroupUpdated, - GroupUpdatedCodec, -} from "@/codecs/GroupUpdatedCodec"; import { Conversations } from "@/Conversations"; export const ApiUrls = { diff --git a/sdks/node-sdk/src/codecs/GroupUpdatedCodec.ts b/sdks/node-sdk/src/codecs/GroupUpdatedCodec.ts deleted file mode 100644 index 73b3585d3..000000000 --- a/sdks/node-sdk/src/codecs/GroupUpdatedCodec.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { - ContentTypeId, - type ContentCodec, - type EncodedContent, -} from "@xmtp/content-type-primitives"; -import { mlsTranscriptMessages } from "@xmtp/proto"; - -export const ContentTypeGroupUpdated = new ContentTypeId({ - authorityId: "xmtp.org", - typeId: "group_updated", - versionMajor: 1, - versionMinor: 0, -}); - -export class GroupUpdatedCodec - implements ContentCodec -{ - get contentType(): ContentTypeId { - return ContentTypeGroupUpdated; - } - - encode(content: mlsTranscriptMessages.GroupUpdated): EncodedContent { - return { - type: this.contentType, - parameters: {}, - content: mlsTranscriptMessages.GroupUpdated.encode(content).finish(), - }; - } - - decode(content: EncodedContent): mlsTranscriptMessages.GroupUpdated { - return mlsTranscriptMessages.GroupUpdated.decode(content.content); - } - - fallback(): undefined { - return undefined; - } - - shouldPush() { - return false; - } -} diff --git a/sdks/node-sdk/src/index.ts b/sdks/node-sdk/src/index.ts index 1093c0bf1..ae43e6918 100644 --- a/sdks/node-sdk/src/index.ts +++ b/sdks/node-sdk/src/index.ts @@ -9,9 +9,5 @@ export { Client, ApiUrls } from "./Client"; export { Conversation } from "./Conversation"; export { Conversations } from "./Conversations"; export { DecodedMessage } from "./DecodedMessage"; -export { - ContentTypeGroupUpdated, - GroupUpdatedCodec, -} from "./codecs/GroupUpdatedCodec"; export type { StreamCallback } from "./AsyncStream"; export type * from "@xmtp/node-bindings"; diff --git a/yarn.lock b/yarn.lock index 975d12bed..8eb78cdd4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4847,6 +4847,7 @@ __metadata: "@rollup/plugin-typescript": "npm:^12.1.1" "@types/node": "npm:^20.16.12" "@vitest/coverage-v8": "npm:^2.1.3" + "@xmtp/content-type-group-updated": "npm:^1.0.0" "@xmtp/content-type-primitives": "npm:^1.0.2" "@xmtp/content-type-text": "npm:^1.0.0" "@xmtp/node-bindings": "npm:^0.0.14"