@pgxsinkit/client 0.5.0 → 0.5.2

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.
@@ -54,7 +54,7 @@ export interface BootReport {
54
54
  /** Boot start → `onInitialSync` (all eager groups caught up). */
55
55
  totalMs: number;
56
56
  /**
57
- * Boot start → `localReadReady` resolved (ADR-0041): PGlite open, durable schema compatible, store-version
57
+ * Boot start → `localReadReady` resolved (ADR-0041): pgwasm open, durable schema compatible, store-version
58
58
  * reconcile complete, and the drizzle read facade built — cached reads are safe with ZERO network. `null`
59
59
  * when the boot rejected before the stage. Additive field; `reportVersion` stays `1`.
60
60
  */
@@ -178,7 +178,7 @@ export interface BootReportBuilder extends BootStampCollector {
178
178
  * a prepare hook (folded into the optional `prepareMs`).
179
179
  */
180
180
  phase: <T>(key: PhaseKey | "prepare", event: string, fn: () => Promise<T>, data?: Record<string, unknown>) => Promise<T>;
181
- setPgliteCreateMs: (ms: number | null) => void;
181
+ setPgwasmCreateMs: (ms: number | null) => void;
182
182
  setProvision: (provision: BootReport["provision"]) => void;
183
183
  /**
184
184
  * Stamp `storageBackend` (ADR-0049 decision 12) at the client-owned mint seam, derived from the resolved dataDir
@@ -21,7 +21,7 @@ export interface DiagnosticExportResult {
21
21
  /** The dependencies {@link performDiagnosticExport} needs from the owning client — narrow, so it is unit-testable. */
22
22
  export interface DiagnosticExportDeps {
23
23
  /** The live store to checkpoint and dump (the clone source; the live engine is never suspended). */
24
- pglite: Pick<PgwasmClient, "exec" | "dumpDataDir">;
24
+ pgwasm: Pick<PgwasmClient, "exec" | "dumpDataDir">;
25
25
  /** The Mutation diagnostics seam (`client.diagnostics().mutation` / `readMutationStats`). */
26
26
  readMutationStats: () => Promise<MutationDiagnostics>;
27
27
  /**
@@ -52,7 +52,7 @@ export interface CloneDumpPhases {
52
52
  }
53
53
  /** The raw SQL bytes plus the pipeline phase walls — {@link runThrowawayCloneDump}'s result. */
54
54
  export interface CloneDumpResult {
55
- /** The `pg_dump` output bytes (unwrapped from pglite-tools' `File` polyfill). */
55
+ /** The `pg_dump` output bytes (unwrapped from the `File` `pgDump` returns). */
56
56
  sqlBytes: Uint8Array<ArrayBuffer>;
57
57
  /** The pipeline phase timings, all offset from the caller's `startPerf` anchor. */
58
58
  phases: CloneDumpPhases;
@@ -81,7 +81,7 @@ export interface CloneDumpOptions {
81
81
  */
82
82
  prepareClone?: (clone: Pgwasm) => Promise<void>;
83
83
  }
84
- export declare function runThrowawayCloneDump(pglite: Pick<PgwasmClient, "exec" | "dumpDataDir">, startPerf: number, options?: CloneDumpOptions): Promise<CloneDumpResult>;
84
+ export declare function runThrowawayCloneDump(pgwasm: Pick<PgwasmClient, "exec" | "dumpDataDir">, startPerf: number, options?: CloneDumpOptions): Promise<CloneDumpResult>;
85
85
  /**
86
86
  * Run a diagnostic dump (ADR-0035): live datadir dump → memory-backed throwaway clone → `pg_dump` → discard
87
87
  * the clone → assemble the report. The caller (`createSyncClient`) awaits engine-ready and enters the
@@ -1 +1 @@
1
- {"version":3,"file":"export-dump.d.ts","sourceRoot":"","sources":["../src/export-dump.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAoB,KAAK,oBAAoB,EAA4C,MAAM,gBAAgB,CAAC;AACvH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,oGAAoG;IACpG,IAAI,EAAE,IAAI,CAAC;IACX,sDAAsD;IACtD,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,sHAAsH;AACtH,MAAM,WAAW,oBAAoB;IACnC,oGAAoG;IACpG,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC;IACnD,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,8GAA8G;AAC9G,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,eAAe,EAAE,MAAM,CAAC;IACxB,qHAAqH;IACrH,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sGAAsG;IACtG,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAe;IAC9B,iFAAiF;IACjF,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAClC,mFAAmF;IACnF,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAAC,EAClD,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAuE1B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,oBAAoB,EAC1B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CA+BjC"}
1
+ {"version":3,"file":"export-dump.d.ts","sourceRoot":"","sources":["../src/export-dump.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAoB,KAAK,oBAAoB,EAA4C,MAAM,gBAAgB,CAAC;AACvH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,wDAAwD;AACxD,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,oGAAoG;IACpG,IAAI,EAAE,IAAI,CAAC;IACX,sDAAsD;IACtD,MAAM,EAAE,oBAAoB,CAAC;CAC9B;AAED,sHAAsH;AACtH,MAAM,WAAW,oBAAoB;IACnC,oGAAoG;IACpG,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC;IACnD,6FAA6F;IAC7F,iBAAiB,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACtD;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,8GAA8G;AAC9G,MAAM,WAAW,eAAe;IAC9B,0FAA0F;IAC1F,eAAe,EAAE,MAAM,CAAC;IACxB,qHAAqH;IACrH,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sGAAsG;IACtG,YAAY,EAAE,MAAM,CAAC;IACrB,iGAAiG;IACjG,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oFAAoF;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gGAAgG;AAChG,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;IAClC,mFAAmF;IACnF,MAAM,EAAE,eAAe,CAAC;CACzB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,wGAAwG;IACxG,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACjD;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,CAAC,EAClD,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAuE1B;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,oBAAoB,EAC1B,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CA+BjC"}
@@ -180,11 +180,11 @@ export declare const compactTimestamp: () => string;
180
180
  * (the caller's export-start monotonic anchor) so the timings compose into either report.
181
181
  *
182
182
  * The `CHECKPOINT` is a utility statement — Drizzle has no builder for it, so a raw `exec` is the justified
183
- * tier-③ form here. Running it via `pglite.exec` serialises it behind any in-flight engine work on pgwasm's
183
+ * tier-③ form here. Running it via `pgwasm.exec` serialises it behind any in-flight engine work on pgwasm's
184
184
  * single connection, flushing dirty buffers to the datadir the dump then reads — so the tarball reflects
185
185
  * committed state, not a torn mid-write datadir.
186
186
  */
187
- export declare function performDatadirDump(pglite: Pick<PgwasmClient, "exec" | "dumpDataDir">, compression: "auto" | "gzip" | "none", startPerf: number): Promise<{
187
+ export declare function performDatadirDump(pgwasm: Pick<PgwasmClient, "exec" | "dumpDataDir">, compression: "auto" | "gzip" | "none", startPerf: number): Promise<{
188
188
  dumped: Awaited<ReturnType<PgwasmClient["dumpDataDir"]>>;
189
189
  checkpointStartedAtMs: number;
190
190
  checkpointMs: number;
@@ -194,7 +194,7 @@ export declare function performDatadirDump(pglite: Pick<PgwasmClient, "exec" | "
194
194
  /** The dependencies {@link performStoreExport} needs from the owning client — narrow, so it is unit-testable. */
195
195
  export interface StoreExportDeps {
196
196
  /** The live store to checkpoint and dump. */
197
- pglite: Pick<PgwasmClient, "exec" | "dumpDataDir">;
197
+ pgwasm: Pick<PgwasmClient, "exec" | "dumpDataDir">;
198
198
  /** The Mutation diagnostics seam (`client.diagnostics().mutation` / `readMutationStats`). */
199
199
  readMutationStats: () => Promise<MutationDiagnostics>;
200
200
  /**
package/dist/index.d.ts CHANGED
@@ -364,15 +364,15 @@ export interface CreateSyncClientOptions<TRegistry extends SyncTableRegistry> {
364
364
  */
365
365
  build?: PostgresBuild;
366
366
  resetSubscriptionKeys?: string[];
367
- prepareLocalDbBeforeSchema?: (pglite: PgwasmClient) => Promise<void>;
368
- prepareLocalDbAfterSchema?: (pglite: PgwasmClient) => Promise<void>;
367
+ prepareLocalDbBeforeSchema?: (pgwasm: PgwasmClient) => Promise<void>;
368
+ prepareLocalDbAfterSchema?: (pgwasm: PgwasmClient) => Promise<void>;
369
369
  onStatusChange?: (status: SyncRuntimeStatus) => void;
370
370
  onTableInitialSync?: (tableKey: string) => void;
371
371
  /**
372
372
  * A fully-provisioned pgwasm instance the CALLER owns end-to-end. The client runs NONE of its
373
373
  * post-create boot steps against it — no schema exec, prepare hooks, or registry reconciliation
374
374
  * (journal recovery still runs, as it does on every path). Use it only when the caller has already
375
- * applied the registry schema itself. Contrast the three PGlite-provenance seams:
375
+ * applied the registry schema itself. Contrast the three store-provenance seams:
376
376
  * - {@link storePath} (default) — the client creates the store AND runs every post-create step.
377
377
  * - {@link precreatedPgwasm} — the caller creates the raw store (via {@link createPgwasmClient}), but
378
378
  * the client still runs every post-create step (schema, prepare hooks, and reconciliation), exactly as
@@ -647,7 +647,7 @@ export interface PrepareQueryInput<TRegistry extends SyncTableRegistry> {
647
647
  * The narrow live-rows seam (ADR-0032 S2 §4) both client modes implement so the `@pgxsinkit/react` hooks
648
648
  * work against either. Input for a reactive subscription: the compiled SQL + params (from a Drizzle
649
649
  * builder's `.toSQL()` or a raw string) and the result's `pkColumns` (drives worker-side diff keying;
650
- * omit for a keyless query). The in-process client runs it directly over `pglite.live`; the worker-attached
650
+ * omit for a keyless query). The in-process client runs it directly over `pgwasm.live`; the worker-attached
651
651
  * client runs the live query in the worker and streams DIFFs across the bridge.
652
652
  */
653
653
  export interface SubscribeLiveRowsInput {
@@ -759,7 +759,7 @@ export interface SyncClient<TRegistry extends SyncTableRegistry> {
759
759
  * scheduling) without awaiting. Idempotent. The first action of every teardown path — stop()/destroy() call it,
760
760
  * and the SharedWorker host calls it before draining subscribes / disposing live queries so no teardown step
761
761
  * races a still-live engine. Not a substitute for stop()/destroy(): the awaited teardown (unsubscribe, dispose,
762
- * pglite.close) still follows. Callers rarely invoke it directly.
762
+ * pgwasm.close) still follows. Callers rarely invoke it directly.
763
763
  */
764
764
  haltActivity: () => void;
765
765
  stop: () => Promise<void>;
@@ -1066,9 +1066,9 @@ export interface SyncClient<TRegistry extends SyncTableRegistry> {
1066
1066
  }) => readonly string[];
1067
1067
  /**
1068
1068
  * The live-rows seam (ADR-0032 S2 §4): register a reactive query and receive its initial ordered
1069
- * snapshot plus subsequent updates via `onRows`. The React live hooks consume THIS (not `pglite.live`
1069
+ * snapshot plus subsequent updates via `onRows`. The React live hooks consume THIS (not `pgwasm.live`
1070
1070
  * directly), so they run unchanged against both the in-process client (which implements it over
1071
- * `pglite.live`) and the worker-attached client (which implements it over the bridge). Prefer the
1071
+ * `pgwasm.live`) and the worker-attached client (which implements it over the bridge). Prefer the
1072
1072
  * higher-level `@pgxsinkit/react` hooks; this is the lower-level primitive they build on.
1073
1073
  */
1074
1074
  subscribeLiveRows: <TRow extends Record<string, unknown> = Record<string, unknown>>(input: SubscribeLiveRowsInput, onRows: (rows: TRow[]) => void) => Promise<LiveRowsSubscription<TRow>>;
package/dist/index.js CHANGED
@@ -129,7 +129,7 @@ function createBootReportBuilder(init) {
129
129
  durations.set(key, ms);
130
130
  }
131
131
  },
132
- setPgliteCreateMs: (ms) => {
132
+ setPgwasmCreateMs: (ms) => {
133
133
  pgwasmCreateMs = ms;
134
134
  },
135
135
  setProvision: (value) => {
@@ -3843,14 +3843,14 @@ function deriveStoreId(storePath) {
3843
3843
  const safe = lastSegment.replace(/[^A-Za-z0-9._-]/g, "-").replace(/^-+|-+$/g, "");
3844
3844
  return safe.length > 0 ? safe : "pgxsinkit-store";
3845
3845
  }
3846
- async function performDatadirDump(pglite, compression, startPerf) {
3846
+ async function performDatadirDump(pgwasm, compression, startPerf) {
3847
3847
  const checkpointStartedAtMs = nowMs2() - startPerf;
3848
3848
  const checkpointStartPerf = nowMs2();
3849
- await pglite.exec("CHECKPOINT");
3849
+ await pgwasm.exec("CHECKPOINT");
3850
3850
  const checkpointMs = nowMs2() - checkpointStartPerf;
3851
3851
  const dumpStartedAtMs = nowMs2() - startPerf;
3852
3852
  const dumpStartPerf = nowMs2();
3853
- const dumped = await pglite.dumpDataDir(compression);
3853
+ const dumped = await pgwasm.dumpDataDir(compression);
3854
3854
  const dumpMs = nowMs2() - dumpStartPerf;
3855
3855
  return { dumped, checkpointStartedAtMs, checkpointMs, dumpStartedAtMs, dumpMs };
3856
3856
  }
@@ -3858,7 +3858,7 @@ async function performStoreExport(deps, options = {}) {
3858
3858
  const startedAt = Date.now();
3859
3859
  const startPerf = nowMs2();
3860
3860
  const compression = options.compression ?? "auto";
3861
- const { dumped, checkpointStartedAtMs, checkpointMs, dumpStartedAtMs, dumpMs } = await performDatadirDump(deps.pglite, compression, startPerf);
3861
+ const { dumped, checkpointStartedAtMs, checkpointMs, dumpStartedAtMs, dumpMs } = await performDatadirDump(deps.pgwasm, compression, startPerf);
3862
3862
  const dumpedName = dumped instanceof File ? dumped.name : "";
3863
3863
  const gzipped = dumpedName.endsWith(".gz") || dumped.type.includes("gzip");
3864
3864
  const appliedCompression = gzipped ? "gzip" : "none";
@@ -4025,8 +4025,8 @@ var init_store_path = __esm(() => {
4025
4025
  // packages/client/src/export-dump.ts
4026
4026
  import { createPgwasm } from "@pgxsinkit/pgwasm";
4027
4027
  import { cBuild } from "@pgxsinkit/pgwasm-c";
4028
- async function runThrowawayCloneDump(pglite, startPerf, options = {}) {
4029
- const { dumped, checkpointStartedAtMs, checkpointMs, dumpStartedAtMs, dumpMs } = await performDatadirDump(pglite, "none", startPerf);
4028
+ async function runThrowawayCloneDump(pgwasm, startPerf, options = {}) {
4029
+ const { dumped, checkpointStartedAtMs, checkpointMs, dumpStartedAtMs, dumpMs } = await performDatadirDump(pgwasm, "none", startPerf);
4030
4030
  const cloneDataDir = resolveStoreDataDir(nextCloneStorePath(), "memory");
4031
4031
  const cloneBootStartedAtMs = nowMs2() - startPerf;
4032
4032
  const cloneBootStartPerf = nowMs2();
@@ -4074,7 +4074,7 @@ async function runThrowawayCloneDump(pglite, startPerf, options = {}) {
4074
4074
  async function performDiagnosticExport(deps, options = {}) {
4075
4075
  const startedAt = Date.now();
4076
4076
  const startPerf = nowMs2();
4077
- const { sqlBytes, phases } = await runThrowawayCloneDump(deps.pglite, startPerf);
4077
+ const { sqlBytes, phases } = await runThrowawayCloneDump(deps.pgwasm, startPerf);
4078
4078
  const storeId = deriveStoreId(deps.storePath);
4079
4079
  const fileName = options.fileName ?? `${storeId}-${compactTimestamp()}-diagnostics.sql`;
4080
4080
  const file = new File([sqlBytes], fileName, { type: "application/sql" });
@@ -7276,7 +7276,7 @@ function assertLiveQueryParamsSafe(sql, params) {
7276
7276
  if (safe)
7277
7277
  return;
7278
7278
  const found = numbers.length === 0 ? "(none)" : numbers.map((n) => `$${n}`).join(", ");
7279
- throw new Error(`[pgxsinkit] live query hits PGlite bug #1055 ` + `(https://github.com/electric-sql/pglite/issues/1055): its live-query param inlining binds $N ` + `placeholders SEQUENTIALLY (in textual order), not positionally, so anything but a strictly ` + `ascending $1..$n each used once silently mis-binds or throws. Found placeholders [${found}] for ` + `${expected} param${expected === 1 ? "" : "s"}, expected exactly [$1..$${expected}]. Renumber the ` + `placeholders to a strictly sequential $1..$${expected}, each used once \u2014 or pass the query as a ` + `Drizzle builder, which always compiles to that shape.`);
7279
+ throw new Error(`[pgxsinkit] live query hits upstream bug #1055 ` + `(https://github.com/electric-sql/pglite/issues/1055): its live-query param inlining binds $N ` + `placeholders SEQUENTIALLY (in textual order), not positionally, so anything but a strictly ` + `ascending $1..$n each used once silently mis-binds or throws. Found placeholders [${found}] for ` + `${expected} param${expected === 1 ? "" : "s"}, expected exactly [$1..$${expected}]. Renumber the ` + `placeholders to a strictly sequential $1..$${expected}, each used once \u2014 or pass the query as a ` + `Drizzle builder, which always compiles to that shape.`);
7280
7280
  }
7281
7281
 
7282
7282
  // packages/client/src/worker/live-query-manager.ts
@@ -8199,7 +8199,7 @@ function defineSyncWorker(options) {
8199
8199
  };
8200
8200
  const currentDurability = () => engineStorage?.durability ?? getSyncRegistryStorage(options.registry)?.durability ?? "relaxed";
8201
8201
  const currentBuild = () => engineStorage?.build ?? getSyncRegistryStorage(options.registry)?.build ?? "c";
8202
- const builtInCreatePglite = options.createStore ?? ((storePath, backendOverride) => createPgwasmClient(storePath, {
8202
+ const builtInCreateStore = options.createStore ?? ((storePath, backendOverride) => createPgwasmClient(storePath, {
8203
8203
  ...backendOverride ? { backendOverride } : {},
8204
8204
  ...options.build ? { build: options.build } : {},
8205
8205
  declaredBuild: currentBuild(),
@@ -8212,7 +8212,7 @@ function defineSyncWorker(options) {
8212
8212
  const declaredEngine = engineStorage?.engine?.module;
8213
8213
  let store;
8214
8214
  if (declaredEngine === undefined) {
8215
- store = await builtInCreatePglite(storePath, backendOverride);
8215
+ store = await builtInCreateStore(storePath, backendOverride);
8216
8216
  } else {
8217
8217
  const factory = await resolveStoreEngine(declaredEngine);
8218
8218
  syncDebug("worker store engine declared", { storePath, module: declaredEngine });
@@ -8434,7 +8434,7 @@ function defineSyncWorker(options) {
8434
8434
  const testMarker = backendOverride === "memory" ? "memory" : workerTestMarker;
8435
8435
  const restoreFrom = attach.restore ? new Blob([attach.restore.buffer], { type: attach.restore.mimeType }) : undefined;
8436
8436
  const adoptingProvisioned = restoreFrom == null && provisioned != null && provisioned.storePath === storePath;
8437
- const precreatedPgwasm = adoptingProvisioned ? provisioned.pglite : restoreFrom ? undefined : options.precreatedPgwasm;
8437
+ const precreatedPgwasm = adoptingProvisioned ? provisioned.pgwasm : restoreFrom ? undefined : options.precreatedPgwasm;
8438
8438
  const provisionStamp = adoptingProvisioned ? provisioned.stamp : undefined;
8439
8439
  if (adoptingProvisioned) {
8440
8440
  syncDebug("worker adopting provisioned store", { storePath });
@@ -8721,20 +8721,20 @@ function defineSyncWorker(options) {
8721
8721
  await writeStoreMetaRecord(storePath, { phase: "opfs-candidate", updatedAt: Date.now() });
8722
8722
  }
8723
8723
  const provisionStartedAt = nowStamp();
8724
- const pglite = Promise.resolve().then(() => createStore(storePath, backendOverride));
8725
- const stamp = pglite.then(() => {
8724
+ const pgwasm = Promise.resolve().then(() => createStore(storePath, backendOverride));
8725
+ const stamp = pgwasm.then(() => {
8726
8726
  const readyAt = nowStamp();
8727
8727
  return { initdbMs: readyAt - provisionStartedAt, provisionReadyAt: readyAt };
8728
8728
  });
8729
- provisioned = { storePath, pglite, stamp };
8730
- pglite.catch(() => {
8729
+ provisioned = { storePath, pgwasm, stamp };
8730
+ pgwasm.catch(() => {
8731
8731
  return;
8732
8732
  });
8733
8733
  stamp.catch(() => {
8734
8734
  return;
8735
8735
  });
8736
8736
  syncDebug("worker store provisioned", { storePath });
8737
- await pglite;
8737
+ await pgwasm;
8738
8738
  });
8739
8739
  provisionAttempt = attempt;
8740
8740
  const attemptStartedAt = nowStamp();
@@ -10822,7 +10822,7 @@ async function attachSyncClient(options) {
10822
10822
  throw new Error(`[pgxsinkit] ${name} is not available on a worker-attached client: the tab holds no local pgwasm. ` + `Direct store access (client.pgwasm) and store-lifecycle ops (destroy/dropReadCache) have no tab-local ` + `implementation. One-shot Drizzle reads (query/queryRow/queryRaw/queryRawRow), lazy activation ` + `(ensureSynced), and the write API ARE proxied to the worker.`);
10823
10823
  };
10824
10824
  const noBridgeTransaction = () => {
10825
- throw new Error("[pgxsinkit] client.drizzle.transaction() is not available on a worker-attached client: a read " + "transaction needs a local PGlite the tab does not have. Use one-shot reads (client.query) instead.");
10825
+ throw new Error("[pgxsinkit] client.drizzle.transaction() is not available on a worker-attached client: a read " + "transaction needs a local store the tab does not have. Use one-shot reads (client.query) instead.");
10826
10826
  };
10827
10827
  const guardedQueryArgs = (sql, params, rowMode, use) => {
10828
10828
  const options = rowMode ? { rowMode } : {};
@@ -11347,7 +11347,7 @@ async function createPgwasmClient(store, options) {
11347
11347
  const relaxedDurability = (options?.durability ?? "relaxed") !== "strict";
11348
11348
  await build.prepare?.();
11349
11349
  if (dataDir.startsWith("opfs://")) {
11350
- const opfsPglite = await timeAsync("boot pgwasm.create", async () => {
11350
+ const opfsPgwasm = await timeAsync("boot pgwasm.create", async () => {
11351
11351
  const createOpfsStore = options?.opfsFactories?.createOpfsPgwasm ?? (await import("@pgxsinkit/pgwasm/opfs")).createOpfsPgwasm;
11352
11352
  syncDebug("boot pgwasm.create phase", { phase: "module-loaded" });
11353
11353
  const getStoreDirectoryHandle = options?.opfsFactories?.getStoreDirectoryHandle ?? (() => createOpfsEffects(storePath).getStoreDirectoryHandle());
@@ -11373,9 +11373,9 @@ async function createPgwasmClient(store, options) {
11373
11373
  }
11374
11374
  return holdOwnershipUntilClosed(opened, releaseOwnership);
11375
11375
  }, { ...dataDirScheme ? { dataDir: dataDirScheme } : {}, relaxedDurability });
11376
- return opfsPglite;
11376
+ return opfsPgwasm;
11377
11377
  }
11378
- const pglite = await timeAsync("boot pgwasm.create", () => {
11378
+ const pgwasm = await timeAsync("boot pgwasm.create", () => {
11379
11379
  const createOptions = {
11380
11380
  build,
11381
11381
  dataDir,
@@ -11387,7 +11387,7 @@ async function createPgwasmClient(store, options) {
11387
11387
  };
11388
11388
  return createPgwasm2(createOptions);
11389
11389
  }, { ...dataDirScheme ? { dataDir: dataDirScheme } : {}, relaxedDurability });
11390
- return pglite;
11390
+ return pgwasm;
11391
11391
  }
11392
11392
  function storageBackendFromDataDir(dataDir) {
11393
11393
  if (dataDir == null)
@@ -11453,11 +11453,11 @@ async function resolveFreshBoot(storePath, hasOpfsSyncAccess, backendOverride, s
11453
11453
  needsCommitmentBarrier
11454
11454
  };
11455
11455
  }
11456
- function resolveEngineStrictSync(pglite) {
11457
- if (!isOpfsRepackedStore(pglite)) {
11456
+ function resolveEngineStrictSync(pgwasm) {
11457
+ if (!isOpfsRepackedStore(pgwasm)) {
11458
11458
  throw new Error("[pgxsinkit] fresh commitment: the store is not on the OPFS-repacked filesystem, so it has no strict " + "sync \u2014 the commitment barrier requires an OPFS-repacked engine (data-before-authority, invariant 3).");
11459
11459
  }
11460
- return async () => (await import("@pgxsinkit/pgwasm/opfs")).strictSync(pglite);
11460
+ return async () => (await import("@pgxsinkit/pgwasm/opfs")).strictSync(pgwasm);
11461
11461
  }
11462
11462
  async function runFreshCommitmentBarrier(storePath, strictSyncReturns, seams) {
11463
11463
  const opfs = createOpfsEffects(storePath, seams?.opfs);
@@ -11497,7 +11497,7 @@ async function fallbackVirginCandidateToIdb(storePath, openError, seams) {
11497
11497
  (seams?.log ?? ((message, data) => syncDebug(message, data)))("boot fresh commitment: opfs candidate uncreatable after bounded retries \u2014 session idbfs fallback", { storePath, reason });
11498
11498
  return reason;
11499
11499
  }
11500
- function toPgliteQueryOptions(options, statementBlob) {
11500
+ function toPgwasmQueryOptions(options, statementBlob) {
11501
11501
  const bytes = statementBlob ?? options?.blob;
11502
11502
  const rest = withoutCopyBlob(options);
11503
11503
  if (bytes === undefined)
@@ -11624,7 +11624,7 @@ async function createSyncClient(options) {
11624
11624
  openedStorageBackend = mintedBackend;
11625
11625
  bootReportBuilder.setStorageBackend(mintedBackend);
11626
11626
  }
11627
- bootReportBuilder.setPgliteCreateMs(performance.now() - startedAt);
11627
+ bootReportBuilder.setPgwasmCreateMs(performance.now() - startedAt);
11628
11628
  return created;
11629
11629
  };
11630
11630
  const refuseIfNonPersistent = (instance) => {
@@ -11659,27 +11659,27 @@ async function createSyncClient(options) {
11659
11659
  }
11660
11660
  return timedCreate();
11661
11661
  };
11662
- let pglite;
11662
+ let pgwasm;
11663
11663
  let adoptedPrecreated = false;
11664
11664
  if (options.pgwasmInstance) {
11665
11665
  refuseIfNonPersistent(options.pgwasmInstance);
11666
11666
  assertStoreBuild(declaredBuild, options.pgwasmInstance.build, "pgwasmInstance");
11667
- pglite = options.pgwasmInstance;
11667
+ pgwasm = options.pgwasmInstance;
11668
11668
  } else if (options.precreatedPgwasm) {
11669
11669
  const outcome = await options.precreatedPgwasm.then((instance) => ({ ok: true, instance }), (error) => ({ ok: false, error }));
11670
11670
  if (outcome.ok) {
11671
11671
  refuseIfNonPersistent(outcome.instance);
11672
11672
  assertStoreBuild(declaredBuild, outcome.instance.build, "precreatedPgwasm");
11673
- pglite = outcome.instance;
11673
+ pgwasm = outcome.instance;
11674
11674
  adoptedPrecreated = true;
11675
11675
  } else {
11676
- syncDebug("boot precreated pglite rejected \u2014 falling back to storePath create", {
11676
+ syncDebug("boot precreated pgwasm rejected \u2014 falling back to storePath create", {
11677
11677
  error: outcome.error instanceof Error ? outcome.error.message : String(outcome.error)
11678
11678
  });
11679
- pglite = await openOwnedStore();
11679
+ pgwasm = await openOwnedStore();
11680
11680
  }
11681
11681
  } else {
11682
- pglite = await openOwnedStore();
11682
+ pgwasm = await openOwnedStore();
11683
11683
  }
11684
11684
  if (probeGranted && !bootHasOpfsSyncAccess && backendOverride !== "memory" && storageFallbackReason != null) {
11685
11685
  bootReportBuilder.setStorageFallbackReason(storageFallbackReason);
@@ -11688,13 +11688,13 @@ async function createSyncClient(options) {
11688
11688
  bootReportBuilder.setStorageFallbackReason(options.storageFallbackReason);
11689
11689
  }
11690
11690
  if (options.pgwasmInstance != null || adoptedPrecreated) {
11691
- const byoBackend = storageBackendFromStorage(pglite.storage);
11691
+ const byoBackend = storageBackendFromStorage(pgwasm.storage);
11692
11692
  if (byoBackend) {
11693
11693
  openedStorageBackend = byoBackend;
11694
11694
  bootReportBuilder.setStorageBackend(byoBackend);
11695
11695
  }
11696
11696
  }
11697
- const adoptedCommitmentGate = (options.pgwasmInstance != null || adoptedPrecreated) && backendOverride !== "memory" && isOpfsRepackedStore(pglite) ? resolveAdoptedCommitmentBarrier(fallbackStorePath) : null;
11697
+ const adoptedCommitmentGate = (options.pgwasmInstance != null || adoptedPrecreated) && backendOverride !== "memory" && isOpfsRepackedStore(pgwasm) ? resolveAdoptedCommitmentBarrier(fallbackStorePath) : null;
11698
11698
  if (adoptedCommitmentGate)
11699
11699
  adoptedCommitmentGate.catch(() => {
11700
11700
  return;
@@ -11740,7 +11740,7 @@ async function createSyncClient(options) {
11740
11740
  headers["Authorization"] = `Bearer ${token}`;
11741
11741
  return headers;
11742
11742
  };
11743
- const startSyncRuntime = (promotedGroups) => startCircuitsSync(pglite, {
11743
+ const startSyncRuntime = (promotedGroups) => startCircuitsSync(pgwasm, {
11744
11744
  registry: options.registry,
11745
11745
  controlPlaneUrl: readTransport.controlPlaneUrl,
11746
11746
  streamBaseUrl: readTransport.streamBaseUrl,
@@ -11808,18 +11808,18 @@ async function createSyncClient(options) {
11808
11808
  armReadSilenceWatchdog();
11809
11809
  },
11810
11810
  onLazyActivated: (groupKey) => {
11811
- writeLazyGroupActivation(pglite, options.registry, groupKey);
11811
+ writeLazyGroupActivation(pgwasm, options.registry, groupKey);
11812
11812
  }
11813
11813
  });
11814
11814
  if (!options.pgwasmInstance) {
11815
11815
  if (options.prepareLocalDbBeforeSchema) {
11816
11816
  const prepareBeforeSchema = options.prepareLocalDbBeforeSchema;
11817
- await bootReportBuilder.phase("prepare", "boot prepare(before-schema)", () => prepareBeforeSchema(pglite));
11817
+ await bootReportBuilder.phase("prepare", "boot prepare(before-schema)", () => prepareBeforeSchema(pgwasm));
11818
11818
  }
11819
11819
  await bootReportBuilder.phase("schemaExec", "boot local schema", async () => {
11820
- await pglite.exec(buildLocalMetaBootstrapSql(options.registry));
11820
+ await pgwasm.exec(buildLocalMetaBootstrapSql(options.registry));
11821
11821
  const currentFingerprint = computeLocalSchemaFingerprint(options.registry);
11822
- const storedFingerprint = await readStoredLocalSchemaFingerprint(pglite, options.registry);
11822
+ const storedFingerprint = await readStoredLocalSchemaFingerprint(pgwasm, options.registry);
11823
11823
  if (storedFingerprint === currentFingerprint) {
11824
11824
  syncDebug("boot local schema fingerprint match \u2014 durable exec skipped");
11825
11825
  bootReportBuilder.setSchemaFastPath({ skipped: true, fingerprintMatch: true });
@@ -11827,24 +11827,24 @@ async function createSyncClient(options) {
11827
11827
  syncDebug("boot local schema fingerprint mismatch \u2014 replaying durable schema", {
11828
11828
  hadStored: storedFingerprint != null
11829
11829
  });
11830
- await pglite.exec(generateDurableLocalSchemaSql(options.registry));
11831
- await writeStoredLocalSchemaFingerprint(pglite, options.registry, currentFingerprint);
11830
+ await pgwasm.exec(generateDurableLocalSchemaSql(options.registry));
11831
+ await writeStoredLocalSchemaFingerprint(pgwasm, options.registry, currentFingerprint);
11832
11832
  bootReportBuilder.setSchemaFastPath({ skipped: false, fingerprintMatch: false });
11833
11833
  }
11834
11834
  const ephemeralSql = generateEphemeralLocalSchemaSql(options.registry);
11835
11835
  if (ephemeralSql.length > 0) {
11836
- await pglite.exec(ephemeralSql);
11836
+ await pgwasm.exec(ephemeralSql);
11837
11837
  }
11838
11838
  });
11839
11839
  if (options.prepareLocalDbAfterSchema) {
11840
11840
  const prepareLocalDbAfterSchema = options.prepareLocalDbAfterSchema;
11841
- await bootReportBuilder.phase("prepare", "boot prepare(local-db)", () => prepareLocalDbAfterSchema(pglite));
11841
+ await bootReportBuilder.phase("prepare", "boot prepare(local-db)", () => prepareLocalDbAfterSchema(pgwasm));
11842
11842
  }
11843
11843
  }
11844
11844
  const writePathHeaders = options.requestHeaders || options.writeRequestHeaders ? { ...options.requestHeaders ?? {}, ...options.writeRequestHeaders ?? {} } : undefined;
11845
11845
  let activateOrdinaryWriteTables = null;
11846
11846
  const mutationRuntime = createMutationRuntime({
11847
- db: pglite,
11847
+ db: pgwasm,
11848
11848
  registry: options.registry,
11849
11849
  batchWriteUrl: options.batchWriteUrl,
11850
11850
  ownsMetaTable: !options.pgwasmInstance,
@@ -11858,7 +11858,7 @@ async function createSyncClient(options) {
11858
11858
  });
11859
11859
  const eventLaneUrl = options.batchEventUrl ?? deriveBatchEventUrl(options.batchWriteUrl);
11860
11860
  const eventLane = eventLaneUrl != null && !options.pgwasmInstance ? createEventLaneRuntime({
11861
- db: pglite,
11861
+ db: pgwasm,
11862
11862
  registry: options.registry,
11863
11863
  batchEventUrl: eventLaneUrl,
11864
11864
  ...options.getAuthToken ? { getAuthToken: options.getAuthToken } : {},
@@ -11880,7 +11880,7 @@ async function createSyncClient(options) {
11880
11880
  if (options.pgwasmInstance)
11881
11881
  return;
11882
11882
  versionEvent = await bootReportBuilder.phase("storeVersionReconcile", "boot store-version reconcile", () => reconcileLocalStoreVersion({
11883
- db: pglite,
11883
+ db: pgwasm,
11884
11884
  registry: options.registry,
11885
11885
  runtime: mutationRuntime,
11886
11886
  ...options.onSchemaChange ? { onSchemaChange: options.onSchemaChange } : {}
@@ -11899,7 +11899,7 @@ async function createSyncClient(options) {
11899
11899
  } else {
11900
11900
  await runReconcileStage();
11901
11901
  }
11902
- const drizzleDb = createDrizzleDatabase(pglite, buildSchema(options.registry));
11902
+ const drizzleDb = createDrizzleDatabase(pgwasm, buildSchema(options.registry));
11903
11903
  const lazyGuardIndex = buildLazyGuardIndex(options.registry);
11904
11904
  let sync = null;
11905
11905
  let convergenceDriver = null;
@@ -11950,18 +11950,18 @@ async function createSyncClient(options) {
11950
11950
  if (disposed)
11951
11951
  return;
11952
11952
  status.isRunning = true;
11953
- await migrateSubscriptionMetadataTables({ pg: pglite, metadataSchema: DEFAULT_METADATA_SCHEMA });
11953
+ await migrateSubscriptionMetadataTables({ pg: pgwasm, metadataSchema: DEFAULT_METADATA_SCHEMA });
11954
11954
  if (disposed)
11955
11955
  return;
11956
11956
  if (syncEnabled) {
11957
11957
  {
11958
11958
  const resetKeys = versionEvent?.status === "rebuilt" ? [...options.resetSubscriptionKeys ?? [], ...allGroupSubscriptionKeys(options.registry)] : options.resetSubscriptionKeys;
11959
- await resetSubscriptionsIfRequested(pglite, resetKeys);
11959
+ await resetSubscriptionsIfRequested(pgwasm, resetKeys);
11960
11960
  if (disposed)
11961
11961
  return;
11962
11962
  status.phase = "syncing";
11963
11963
  options.onStatusChange?.(status);
11964
- const promotedGroups = await readActivatedLazyGroups(pglite, options.registry);
11964
+ const promotedGroups = await readActivatedLazyGroups(pgwasm, options.registry);
11965
11965
  if (disposed)
11966
11966
  return;
11967
11967
  sync = await bootReportBuilder.phase("syncStart", "boot sync start", () => startSyncRuntime(promotedGroups));
@@ -12172,11 +12172,11 @@ async function createSyncClient(options) {
12172
12172
  if (activeSync != null && groupKey != null)
12173
12173
  activeSync.stopGroup(groupKey);
12174
12174
  if (groupKey != null)
12175
- await clearLazyGroupActivation(pglite, options.registry, groupKey);
12175
+ await clearLazyGroupActivation(pgwasm, options.registry, groupKey);
12176
12176
  if (groupKey != null)
12177
- await resetSubscriptionsIfRequested(pglite, [groupKey]);
12177
+ await resetSubscriptionsIfRequested(pgwasm, [groupKey]);
12178
12178
  for (const member of groupTableKeys) {
12179
- await pglite.exec(buildDesyncTableSql(options.registry, member));
12179
+ await pgwasm.exec(buildDesyncTableSql(options.registry, member));
12180
12180
  }
12181
12181
  };
12182
12182
  const desync = async (key) => {
@@ -12268,15 +12268,15 @@ async function createSyncClient(options) {
12268
12268
  };
12269
12269
  const guardedRawQuery = async (sql, params, options, use) => {
12270
12270
  await gateAndGuardRead(sql, use);
12271
- return pglite.query(sql, params, options);
12271
+ return pgwasm.query(sql, params, options);
12272
12272
  };
12273
12273
  const liveManager = createLiveQueryManager({
12274
- live: pglite.live,
12274
+ live: pgwasm.live,
12275
12275
  ...options.liveQueries ? { policy: options.liveQueries } : {}
12276
12276
  });
12277
12277
  const client = {
12278
12278
  drizzle: drizzleDb,
12279
- pgwasm: pglite,
12279
+ pgwasm,
12280
12280
  views: buildViews(options.registry),
12281
12281
  tables: Object.fromEntries(Object.keys(options.registry).map((tableKey) => [
12282
12282
  tableKey,
@@ -12307,7 +12307,7 @@ async function createSyncClient(options) {
12307
12307
  options.onStatusChange?.(status);
12308
12308
  sync?.unsubscribe();
12309
12309
  await liveManager.dispose();
12310
- await pglite.close();
12310
+ await pgwasm.close();
12311
12311
  },
12312
12312
  destroy: (destroyOptions) => lifecycleSlot.run("destroy", async () => {
12313
12313
  haltActivity();
@@ -12327,10 +12327,10 @@ async function createSyncClient(options) {
12327
12327
  sync?.unsubscribe();
12328
12328
  status.isRunning = false;
12329
12329
  options.onStatusChange?.(status);
12330
- await pglite.exec(buildWipeLocalStoreSql(options.registry));
12330
+ await pgwasm.exec(buildWipeLocalStoreSql(options.registry));
12331
12331
  sync?.unsubscribe();
12332
12332
  await liveManager.dispose();
12333
- await pglite.close();
12333
+ await pgwasm.close();
12334
12334
  await Promise.resolve().then(() => init_store_meta());
12335
12335
  const metaResult = await readStoreMetaRecord(fallbackStorePath);
12336
12336
  if (typeof metaResult === "object" && metaResult !== null || ownsStoreLifecycle && openedStorageBackend === "idbfs") {
@@ -12341,10 +12341,10 @@ async function createSyncClient(options) {
12341
12341
  dropReadCache: async () => {
12342
12342
  await bootSettled;
12343
12343
  return lifecycleSlot.run("dropReadCache", async () => {
12344
- await pglite.exec(buildDropReadCacheSql(options.registry));
12345
- await pglite.exec(generateLocalSchemaSql(options.registry));
12346
- await writeStoredLocalSchemaFingerprint(pglite, options.registry, computeLocalSchemaFingerprint(options.registry));
12347
- await resetSubscriptionsIfRequested(pglite, allGroupSubscriptionKeys(options.registry));
12344
+ await pgwasm.exec(buildDropReadCacheSql(options.registry));
12345
+ await pgwasm.exec(generateLocalSchemaSql(options.registry));
12346
+ await writeStoredLocalSchemaFingerprint(pgwasm, options.registry, computeLocalSchemaFingerprint(options.registry));
12347
+ await resetSubscriptionsIfRequested(pgwasm, allGroupSubscriptionKeys(options.registry));
12348
12348
  });
12349
12349
  },
12350
12350
  appendEvent: async (stream, payload) => {
@@ -12397,16 +12397,16 @@ async function createSyncClient(options) {
12397
12397
  ...eventLane ? { outbox: await eventLane.outboxStatus() } : {}
12398
12398
  }),
12399
12399
  mutations: undefined,
12400
- rawQuery: (sql, params, options) => pglite.query(sql, params, toPgliteQueryOptions(options)),
12401
- rawExec: (sql, options) => pglite.exec(sql, withoutCopyBlob(options)),
12400
+ rawQuery: (sql, params, options) => pgwasm.query(sql, params, toPgwasmQueryOptions(options)),
12401
+ rawExec: (sql, options) => pgwasm.exec(sql, withoutCopyBlob(options)),
12402
12402
  rawTransaction: async (statements, options) => {
12403
12403
  if (statements.length === 0) {
12404
12404
  return [];
12405
12405
  }
12406
- return pglite.transaction(async (tx) => {
12406
+ return pgwasm.transaction(async (tx) => {
12407
12407
  const results = [];
12408
12408
  for (const statement of statements) {
12409
- results.push(await tx.query(statement.sql, statement.params, toPgliteQueryOptions(options, statement.blob)));
12409
+ results.push(await tx.query(statement.sql, statement.params, toPgwasmQueryOptions(options, statement.blob)));
12410
12410
  }
12411
12411
  return results;
12412
12412
  });
@@ -12470,7 +12470,7 @@ async function createSyncClient(options) {
12470
12470
  exportStore: async (exportOptions) => {
12471
12471
  await ready;
12472
12472
  return lifecycleSlot.run("exportStore", () => performStoreExport({
12473
- pglite,
12473
+ pgwasm,
12474
12474
  readMutationStats: () => mutationRuntime.readMutationStats(),
12475
12475
  ...options.storePath != null ? { storePath: options.storePath } : {}
12476
12476
  }, exportOptions));
@@ -12478,7 +12478,7 @@ async function createSyncClient(options) {
12478
12478
  exportDiagnostics: async (exportOptions) => {
12479
12479
  await ready;
12480
12480
  return lifecycleSlot.run("exportDiagnostics", () => performDiagnosticExport({
12481
- pglite,
12481
+ pgwasm,
12482
12482
  readMutationStats: () => mutationRuntime.readMutationStats(),
12483
12483
  ...options.storePath != null ? { storePath: options.storePath } : {}
12484
12484
  }, exportOptions));
@@ -12486,7 +12486,7 @@ async function createSyncClient(options) {
12486
12486
  exportData: async (exportOptions) => {
12487
12487
  await ready;
12488
12488
  return lifecycleSlot.run("exportData", () => performDataExport({
12489
- pgwasm: pglite,
12489
+ pgwasm,
12490
12490
  readMutationStats: () => mutationRuntime.readMutationStats(),
12491
12491
  flush: () => mutationRuntime.flush(),
12492
12492
  syncedTableNames: collectDataExportSyncedTableNames(options.registry),
@@ -12499,12 +12499,12 @@ async function createSyncClient(options) {
12499
12499
  client.mutations = createMutationsApi({
12500
12500
  registry: options.registry,
12501
12501
  subscribeLiveRows: client.subscribeLiveRows,
12502
- query: (sql, params) => pglite.query(sql, params)
12502
+ query: (sql, params) => pgwasm.query(sql, params)
12503
12503
  });
12504
12504
  if (adoptedCommitmentGate)
12505
12505
  commitmentBarrierPending = await adoptedCommitmentGate;
12506
12506
  if (commitmentBarrierPending) {
12507
- await runFreshCommitmentBarrier(fallbackStorePath, resolveEngineStrictSync(pglite));
12507
+ await runFreshCommitmentBarrier(fallbackStorePath, resolveEngineStrictSync(pgwasm));
12508
12508
  }
12509
12509
  bootReportBuilder.setLocalReadReadyMs(performance.now() - bootReportBuilder.bootStartPerf);
12510
12510
  resolveLocalReadReady();
@@ -12545,7 +12545,7 @@ function allGroupSubscriptionKeys(registry) {
12545
12545
  const keys = Object.values(registry).filter((entry) => typeof entry.shape?.shapeKey === "string" && entry.shape.shapeKey.length > 0).map((entry) => entry.consistencyGroup ?? entry.shape.shapeKey);
12546
12546
  return [...new Set(keys)];
12547
12547
  }
12548
- async function resetSubscriptionsIfRequested(pglite, keys) {
12548
+ async function resetSubscriptionsIfRequested(pgwasm, keys) {
12549
12549
  if (!keys || keys.length === 0) {
12550
12550
  return;
12551
12551
  }
@@ -12553,7 +12553,7 @@ async function resetSubscriptionsIfRequested(pglite, keys) {
12553
12553
  if (uniqueKeys.length === 0) {
12554
12554
  return;
12555
12555
  }
12556
- await Promise.all(uniqueKeys.map((key) => deleteSubscriptionState({ pg: pglite, metadataSchema: DEFAULT_METADATA_SCHEMA, subscriptionKey: key })));
12556
+ await Promise.all(uniqueKeys.map((key) => deleteSubscriptionState({ pg: pgwasm, metadataSchema: DEFAULT_METADATA_SCHEMA, subscriptionKey: key })));
12557
12557
  }
12558
12558
  function createDrizzleDatabase(client, schema) {
12559
12559
  const relations = defineRelations(schema);
@@ -12760,4 +12760,4 @@ export {
12760
12760
  wrapLiveQueryForMaterialization
12761
12761
  };
12762
12762
 
12763
- //# debugId=5E51EF959498DEE164756E2164756E21
12763
+ //# debugId=E3BAB3EDFFA8367464756E2164756E21