feat(sync): replay durable projections from Rust
req: ms/001 req: ms/002 req: ms/003
This commit is contained in:
@@ -503,13 +503,16 @@
|
||||
} else if (op.kind === "emit") {
|
||||
let payload = op.payload;
|
||||
if (currentOperationId && op.name === "hemx:sync-patch") {
|
||||
const patch = JSON.parse(payload);
|
||||
const event = JSON.parse(payload);
|
||||
const patch = event && Object.getPrototypeOf(event) === Object.prototype && "patch" in event
|
||||
? event.patch
|
||||
: event;
|
||||
if (patch.idempotencyKey !== "$hemx-interaction" || patch.operationId !== "$hemx-interaction") {
|
||||
throw new Error("hemx sync patch is missing its interaction identity");
|
||||
}
|
||||
patch.idempotencyKey = currentOperationId;
|
||||
patch.operationId = currentOperationId;
|
||||
payload = JSON.stringify(patch);
|
||||
payload = JSON.stringify(event);
|
||||
}
|
||||
handleRuntimeEvent(scope, op.name, payload);
|
||||
emit(scope, op.name, payload);
|
||||
|
||||
Reference in New Issue
Block a user