From dde9cef62fbd0cd0483b30cd8ab15817eab5614b Mon Sep 17 00:00:00 2001 From: Danny Browning Date: Fri, 2 Feb 2024 15:12:36 -0700 Subject: [PATCH 1/2] fix: unique metadata is not properly typed as a Uint8Array --- packages/common/src/utils/stream-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/common/src/utils/stream-utils.ts b/packages/common/src/utils/stream-utils.ts index bf54f8ba3e..439d1085e5 100644 --- a/packages/common/src/utils/stream-utils.ts +++ b/packages/common/src/utils/stream-utils.ts @@ -146,7 +146,7 @@ export class StreamUtils { cloned.next.metadata.model = state.next.metadata.model.toString() } if (state.metadata?.unique && state.type != TILE_TYPE_ID) { - cloned.metadata.unique = uint8arrays.toString(cloned.metadata.unique, 'base64') + cloned.metadata.unique = uint8arrays.toString(Uint8Array.from(state.metadata.unique), 'base64') } cloned.doctype = StreamType.nameByCode(cloned.type) From bcd9786e1f0abe41e53ac64c4b5cc8e63d908e9a Mon Sep 17 00:00:00 2001 From: Danny Browning Date: Fri, 2 Feb 2024 16:34:10 -0700 Subject: [PATCH 2/2] chore: lint --- packages/common/src/utils/stream-utils.ts | 5 ++++- packages/core/src/dispatcher.ts | 5 +---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/common/src/utils/stream-utils.ts b/packages/common/src/utils/stream-utils.ts index 439d1085e5..06b77657bc 100644 --- a/packages/common/src/utils/stream-utils.ts +++ b/packages/common/src/utils/stream-utils.ts @@ -146,7 +146,10 @@ export class StreamUtils { cloned.next.metadata.model = state.next.metadata.model.toString() } if (state.metadata?.unique && state.type != TILE_TYPE_ID) { - cloned.metadata.unique = uint8arrays.toString(Uint8Array.from(state.metadata.unique), 'base64') + cloned.metadata.unique = uint8arrays.toString( + Uint8Array.from(state.metadata.unique), + 'base64' + ) } cloned.doctype = StreamType.nameByCode(cloned.type) diff --git a/packages/core/src/dispatcher.ts b/packages/core/src/dispatcher.ts index f3157f0e9a..07cef6bfb3 100644 --- a/packages/core/src/dispatcher.ts +++ b/packages/core/src/dispatcher.ts @@ -426,10 +426,7 @@ export class Dispatcher { * @param tip - Commit CID */ publishTip(streamId: StreamID, tip: CID, model?: StreamID): Subscription { - if ( - process.env.CERAMIC_DISABLE_PUBSUB_UPDATES == 'true' || - process.env.CERAMIC_RECON_MODE - ) { + if (process.env.CERAMIC_DISABLE_PUBSUB_UPDATES == 'true' || process.env.CERAMIC_RECON_MODE) { return empty().subscribe() }