From 42aec0e4c515fe3740defc596c869a12bb916a76 Mon Sep 17 00:00:00 2001 From: Victor Korzunin <5180700+floydspace@users.noreply.github.com> Date: Sat, 13 Jul 2024 09:49:23 +0200 Subject: [PATCH] fix: typo in DurableExecutionJournal.ts (#3174) --- .changeset/thirty-pets-switch.md | 5 +++++ .../cluster-workflow/src/DurableExecutionJournal.ts | 10 +++++++--- .../src/DurableExecutionJournalInMemory.ts | 6 ++++-- 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 .changeset/thirty-pets-switch.md diff --git a/.changeset/thirty-pets-switch.md b/.changeset/thirty-pets-switch.md new file mode 100644 index 0000000000..8502087a78 --- /dev/null +++ b/.changeset/thirty-pets-switch.md @@ -0,0 +1,5 @@ +--- +"@effect/cluster-workflow": patch +--- + +fix DurableExecutionJournalTypeId type and discriminate the DurableExecutionJournal interface diff --git a/packages/cluster-workflow/src/DurableExecutionJournal.ts b/packages/cluster-workflow/src/DurableExecutionJournal.ts index 66219f15b7..8781dd7eae 100644 --- a/packages/cluster-workflow/src/DurableExecutionJournal.ts +++ b/packages/cluster-workflow/src/DurableExecutionJournal.ts @@ -21,12 +21,13 @@ export const DurableExecutionJournalTypeId: unique symbol = Symbol.for(SymbolKey * @since 1.0.0 * @category symbols */ -export type DurableExecutionJournalTypeId = typeof DurableExecutionJournal +export type DurableExecutionJournalTypeId = typeof DurableExecutionJournalTypeId /** * @since 1.0.0 */ export interface DurableExecutionJournal { + readonly [DurableExecutionJournalTypeId]: DurableExecutionJournalTypeId read( persistenceId: string, success: Schema.Schema, @@ -158,10 +159,13 @@ export const make = ({ table }: DurableExecutionJournal.MakeOptions) => ) } - return { + const self: DurableExecutionJournal = { + [DurableExecutionJournalTypeId]: DurableExecutionJournalTypeId, append, read - } as const + } + + return self }) /** diff --git a/packages/cluster-workflow/src/DurableExecutionJournalInMemory.ts b/packages/cluster-workflow/src/DurableExecutionJournalInMemory.ts index d38e534382..a6543be9dd 100644 --- a/packages/cluster-workflow/src/DurableExecutionJournalInMemory.ts +++ b/packages/cluster-workflow/src/DurableExecutionJournalInMemory.ts @@ -23,7 +23,8 @@ export const activityJournalInMemory = Layer.effect( DurableExecutionJournal.DurableExecutionJournal, Effect.gen(function*(_) { const memory = yield* _(Ref.make>([])) - return ({ + const self: DurableExecutionJournal.DurableExecutionJournal = { + [DurableExecutionJournal.DurableExecutionJournalTypeId]: DurableExecutionJournal.DurableExecutionJournalTypeId, append: (persistenceId, _, __, event) => pipe( Ref.update(memory, (_) => _.concat([new JournalEntry({ persistenceId, event })])) @@ -36,6 +37,7 @@ export const activityJournalInMemory = Layer.effect( Stream.filter((_) => _.persistenceId === persistenceId), Stream.map((_) => _.event) ) - }) + } + return self }) )