@pgxsinkit/client 0.1.50 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/error-chain.d.ts +9 -0
  2. package/dist/error-chain.d.ts.map +1 -0
  3. package/dist/export-dump.d.ts.map +1 -1
  4. package/dist/index.d.ts +66 -13
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +284 -82
  7. package/dist/index.js.map +21 -19
  8. package/dist/local-tables.d.ts +6 -0
  9. package/dist/local-tables.d.ts.map +1 -1
  10. package/dist/schema.d.ts +18 -1
  11. package/dist/schema.d.ts.map +1 -1
  12. package/dist/shape-sync.d.ts +6 -0
  13. package/dist/shape-sync.d.ts.map +1 -1
  14. package/dist/sync/apply.d.ts +12 -1
  15. package/dist/sync/apply.d.ts.map +1 -1
  16. package/dist/sync/index.d.ts +1 -1
  17. package/dist/sync/index.d.ts.map +1 -1
  18. package/dist/sync/metadata-tables.d.ts +16 -0
  19. package/dist/sync/metadata-tables.d.ts.map +1 -1
  20. package/dist/sync/subscription-state.d.ts +10 -2
  21. package/dist/sync/subscription-state.d.ts.map +1 -1
  22. package/dist/sync/tags.d.ts +16 -4
  23. package/dist/sync/tags.d.ts.map +1 -1
  24. package/dist/sync/types.d.ts +12 -0
  25. package/dist/sync/types.d.ts.map +1 -1
  26. package/dist/worker/attach-sync-client.d.ts +4 -1
  27. package/dist/worker/attach-sync-client.d.ts.map +1 -1
  28. package/dist/worker/define-sync-worker.d.ts +41 -0
  29. package/dist/worker/define-sync-worker.d.ts.map +1 -1
  30. package/dist/worker/live-query-manager.d.ts.map +1 -1
  31. package/dist/worker/live-query-params-guard.d.ts +14 -0
  32. package/dist/worker/live-query-params-guard.d.ts.map +1 -0
  33. package/dist/worker/protocol.d.ts +17 -1
  34. package/dist/worker/protocol.d.ts.map +1 -1
  35. package/package.json +2 -2
  36. package/skills/core/SKILL.md +6 -2
  37. package/skills/operating/SKILL.md +28 -5
  38. package/src/error-chain.ts +26 -0
  39. package/src/export-dump.ts +5 -1
  40. package/src/index.ts +175 -41
  41. package/src/local-tables.ts +7 -0
  42. package/src/schema.ts +22 -4
  43. package/src/shape-sync.ts +11 -0
  44. package/src/sync/apply.ts +164 -26
  45. package/src/sync/index.ts +45 -8
  46. package/src/sync/metadata-tables.ts +41 -0
  47. package/src/sync/subscription-state.ts +29 -4
  48. package/src/sync/tags.ts +34 -9
  49. package/src/sync/types.ts +12 -0
  50. package/src/worker/attach-sync-client.ts +119 -20
  51. package/src/worker/define-sync-worker.ts +112 -2
  52. package/src/worker/live-query-manager.ts +6 -0
  53. package/src/worker/live-query-params-guard.ts +57 -0
  54. package/src/worker/protocol.ts +28 -0
@@ -253,10 +253,23 @@ export type RpcOp =
253
253
  | "discardQuarantined"
254
254
  | "desync"
255
255
  | "discardEphemeral"
256
+ // Lazy activation (ADR-0021): start the consistency groups of the given relation keys on the shared engine.
257
+ // Engine-WIDE but additive/idempotent (unlike `desync`), so it is a plain fire-and-await RPC — carries
258
+ // `[keys]`, resolves once the streams are started (catch-up may still be in flight).
259
+ | "ensureSynced"
256
260
  | "readMutationDetails"
257
261
  | "diagnostics"
258
262
  | "rawQuery"
259
263
  | "rawExec"
264
+ // Guarded one-shot Drizzle read (ADR-0032 decision 4): the attach client's Drizzle-over-bridge compiles a
265
+ // read to SQL on the tab and routes it here as the {@link GuardedQueryWireArgs} tuple
266
+ // `[sql, params?, { rowMode? }, use?]`. Unlike `rawQuery` (raw inspection, no guard), the worker runs the
267
+ // engine's `guardedRawQuery` — the ADR-0041 read gate + the ADR-0021 lazy-group guard (activating any lazy
268
+ // relation the SQL/`use` reference) — then returns the full PGlite `Results` over `rpc-result`, so Drizzle's
269
+ // own result mapping runs on the tab. Only `rowMode` crosses in the options: drizzle's `parsers` map is
270
+ // FUNCTIONS (non-serializable) and is stripped tab-side, then re-applied worker-side so the identity-parsed
271
+ // OIDs (drizzle's identity parsers — temporal OIDs + numeric[]) round-trip as raw strings exactly as in-process.
272
+ | "guardedQuery"
260
273
  // Boot observability (ADR-0034): pull the worker engine's most recent completed boot report. Returns the
261
274
  // stored report (or null) regardless of when this tab attached, so a late tab reads a boot predating it.
262
275
  | "bootReport"
@@ -273,6 +286,21 @@ export type RpcOp =
273
286
  // clone → `pg_dump -t` per synced table); the portable SQL crosses back as the same transferred wire.
274
287
  | "exportData";
275
288
 
289
+ /**
290
+ * The positional wire tuple the `guardedQuery` {@link RpcOp} carries: a guarded one-shot Drizzle read compiled
291
+ * to SQL on the tab. Encoded identically by both tab-side senders (`attachSyncClient`'s bridge executor and
292
+ * `guardedRawQuery`) and decoded against this same type worker-side (`defineSyncWorker`'s dispatch), so encoder
293
+ * and decoder share ONE contract. `options` carries only `rowMode` — drizzle's `parsers` map is stripped
294
+ * tab-side (see the `guardedQuery` op above) and re-applied worker-side. The optional trailing `use` lists the
295
+ * raw-fragment lazy relations (ADR-0021) the SQL scan cannot see.
296
+ */
297
+ export type GuardedQueryWireArgs = [
298
+ sql: string,
299
+ params: unknown[] | undefined,
300
+ options: { rowMode?: "array" | "object" },
301
+ use?: readonly string[],
302
+ ];
303
+
276
304
  /** tab → worker: a write/read-of-mutation-state RPC. `id` correlates the matching {@link RpcResultPayload}. */
277
305
  export interface RpcPayload {
278
306
  op: RpcOp;