Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/docs/protocol/kernel/realtime-protocol.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ They are camelCase, and the record body travels **inside `payload`**, never at t
and `payload`, so a client written from the old fences reads `msg.subscription_id` and `msg.data`
and gets `undefined` on both. `changes` is real but sits **one level down**, on the `DataEvent`
inside `payload`, and it carries the write's own patch — a flat `{ field: newValue }` map
(`publishDataEvent`, `packages/objectql/src/engine.ts`), not the `old` / `new` pairs this page
(`publishDataEvent`, `packages/objectql/src/engine-realtime-publish.ts`), not the `old` / `new` pairs this page
used to show; read the post-state from `payload.after`. `reason` is declared nowhere in the
protocol at all — see **Subscribe to Query Results** below.
</Callout>
Expand Down
9 changes: 5 additions & 4 deletions packages/objectql/src/engine-data-events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1009,11 +1009,12 @@ describe('#15225 / #15813 — a published BulkDataEvent names the organization t
// emitted INSIDE the `parse` call — a stamp added onto the envelope after
// validation would pass every pin above while bypassing the contract.
const testPath = expect.getState().testPath;
if (!testPath) throw new Error('vitest did not report a testPath — cannot locate engine.ts');
const src = readFileSync(join(dirname(testPath), 'engine.ts'), 'utf8');
const start = src.indexOf('private async publishBulkDataEvent(');
if (!testPath) throw new Error('vitest did not report a testPath — cannot locate engine-realtime-publish.ts');
// [#25522 cut 4] The body and the resolver moved out of `engine.ts`, whole.
const src = readFileSync(join(dirname(testPath), 'engine-realtime-publish.ts'), 'utf8');
const start = src.indexOf('export async function publishBulkDataEvent(');
expect(start).toBeGreaterThan(-1);
const body = src.slice(start, src.indexOf('\n }\n', start));
const body = src.slice(start, src.indexOf('\n}\n', start));
const parseCalls = body.match(/BulkDataEventSchema\.parse\(\{[\s\S]*?\n\s*\}\);/g) ?? [];
expect(parseCalls).toHaveLength(1);
expect(parseCalls[0]).toContain('organizationId');
Expand Down
Loading
Loading