fix: replace MetadataEvent double cast with proper EventStreamMetadataEvent type

The broadcaster produces a simpler shape than the workspace-migration
MetadataEvent discriminated union, and includes updatedCollectionHash
which MetadataEvent lacks. Define EventStreamMetadataEvent to match
what the broadcaster actually produces, removing the as unknown as cast.

https://claude.ai/code/session_01EcJHCeJy44AKw2rafgQcnu
This commit is contained in:
Claude
2026-04-02 06:35:08 +00:00
parent 63580fa1b6
commit d8622dfd54
2 changed files with 15 additions and 3 deletions
@@ -1,10 +1,22 @@
import { type ObjectRecordSubscriptionEvent } from 'src/engine/subscriptions/types/object-record-subscription-event.type';
import { type MetadataEvent } from 'src/engine/workspace-manager/workspace-migration/workspace-migration-runner/types/metadata-event';
export type EventStreamMetadataEvent = {
metadataName: string;
type: 'created' | 'updated' | 'deleted';
recordId: string;
properties: {
updatedFields?: string[];
before?: Record<string, unknown>;
after?: Record<string, unknown>;
diff?: Record<string, unknown>;
};
updatedCollectionHash?: string;
};
export type EventStreamPayload = {
objectRecordEventsWithQueryIds: {
queryIds: string[];
objectRecordEvent: ObjectRecordSubscriptionEvent;
}[];
metadataEvents: MetadataEvent[];
metadataEvents: EventStreamMetadataEvent[];
};
@@ -49,7 +49,7 @@ export class WorkspaceEventBroadcaster {
recordId: event.recordId,
properties: event.properties,
updatedCollectionHash,
})) as unknown as EventStreamPayload['metadataEvents'],
})),
};
for (const [streamChannelId, streamData] of streamsData) {