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:
@@ -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[];
|
||||
};
|
||||
|
||||
+1
-1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user