@lunora/hyperdrive 1.0.0-alpha.22 → 1.0.0-alpha.221

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.
package/dist/global.d.ts CHANGED
@@ -1,47 +1,178 @@
1
- import { DatabaseWriterLike } from '@lunora/do';
2
- import { SqlExec, SqlDialect, SqlCtxDbOptions } from '@lunora/sql-store';
3
- /** Minimal row-returning client (e.g. `@lunora/hyperdrive`'s `fromPostgresJs`/`fromNodePg` result). */
4
- interface RowClient {
5
- query: <Row = Record<string, unknown>>(text: string, params?: ReadonlyArray<unknown>) => Promise<Row[]>;
6
- }
7
- /** Minimal `mysql2/promise` connection/pool surface — `execute` resolves to `[rows | ResultSetHeader, fields]`. */
8
- interface Mysql2Execute {
9
- execute: (text: string, params?: ReadonlyArray<unknown>) => Promise<[unknown, unknown]>;
10
- }
11
1
  /**
12
- * Wrap a Postgres row-client (from `@lunora/hyperdrive`'s `fromPostgresJs` /
13
- * `fromNodePg`) as a {@link SqlExec}. The core already renders `$N` placeholders
14
- * for Postgres, so `all`/`run` forward verbatim. Postgres uses `RETURNING` for
15
- * OCC (read via `all`), so `run` reports no affected-row count.
16
- */
2
+ * `@lunora/hyperdrive/global` — a Postgres/MySQL database reached through
3
+ * Cloudflare Hyperdrive (PlanetScale, Neon, RDS, …) as a **first-class,
4
+ * reactive** `.global()` storage backend for Lunora, alongside D1.
5
+ *
6
+ * Unlike the package's `ctx.sql` surface (an action-only, non-reactive escape
7
+ * hatch for an external DB), this makes Lunora the **owner** of the schema:
8
+ * `.global()` tables get a real column-per-field layout and all writes route
9
+ * through the shared store core (`createSqlCtxDb` from `@lunora/sql-store`) with
10
+ * a Postgres or MySQL {@link postgresDialect}/{@link mysqlDialect} and a
11
+ * Hyperdrive-backed {@link SqlExec}. The returned `DatabaseWriterLike` is
12
+ * injected as `globalDb` into `createShardCtxDb`, whose broadcast hook drives
13
+ * live queries — so subscriptions stay reactive with zero extra wiring,
14
+ * identical to D1.
15
+ *
16
+ * Drivers (`postgres`/`pg`/`mysql2`) are optional peer deps — bring your own,
17
+ * constructed from the `HYPERDRIVE` binding's connection string. The binding is
18
+ * reachable from inside the Durable Object that hosts the writer; cache the
19
+ * driver on the DO instance and rebuild it lazily after hibernation.
20
+ *
21
+ * **MySQL connections must enable `CLIENT_FOUND_ROWS`** (mysql2:
22
+ * `createPool({ flags: ["FOUND_ROWS"] })`) so the affected-rows OCC guard sees
23
+ * matched (not changed) rows — see {@link buildMysqlExec}.
24
+ *
25
+ * **The Hyperdrive config must have query caching disabled**
26
+ * (`wrangler hyperdrive create … --caching-disabled`). Hyperdrive caches reads by
27
+ * default and a write does not invalidate them, so OCC re-reads, change-log polls
28
+ * and live-query re-runs would read rows up to `max_age + stale_while_revalidate`
29
+ * old.
30
+ */
31
+ import { SchemaLike, ImportConflictMode, CdcChange, DatabaseWriterLike } from '@lunora/shard-engine';
32
+ import { SqlExec, SqlDialect, SqlCtxDbOptions, FacetGlobalColumnOptions, GlobalFacetResult, GlobalTableInfo, ReadGlobalTablePageOptions, GlobalTablePage, ExportRow, ImportResult } from '@lunora/sql-store';
33
+ import { M as Mysql2Like, S as SqlClient } from "./packem_shared/types.d-DKB5Qb1Z.js";
34
+ import { VectorMetric, VectorizeIndexLike } from '@lunora/platform';
35
+ /**
36
+ * Minimal row-returning client (e.g. `@lunora/hyperdrive`'s `fromPostgresJs`/`fromNodePg`
37
+ * result). Aliases {@link SqlClient} — the exec-facing name is kept so call sites read
38
+ * intent, but the shape is the single source of truth in `./types` (no drift).
39
+ */
40
+ type RowClient = SqlClient;
41
+ /**
42
+ * Minimal `mysql2/promise` connection/pool surface — `query` resolves to
43
+ * `[rows | ResultSetHeader, fields]`. Aliases {@link Mysql2Like} so the /global
44
+ * entry's driver surface can never drift from the main entry's, widened with the
45
+ * (optional, structural) shape {@link assertFoundRows}'s `CLIENT_FOUND_ROWS`
46
+ * probe reads.
47
+ *
48
+ * A real `mysql2/promise` connection/pool exposes the merged client-flags
49
+ * bitmask synchronously, but at two different depths depending on which one it
50
+ * is, and NEITHER is in `mysql2`'s own `.d.ts` — its `Pool extends Connection`
51
+ * signature claims a top-level `config`, but at runtime a `mysql2/promise`
52
+ * `Pool` has none; the real value lives one level down, on the core pool it
53
+ * wraps:
54
+ *
55
+ * - a single `Connection`/`PoolConnection` → `connection.config.clientFlags`
56
+ * - a `Pool` (the `createPool({ flags: ["FOUND_ROWS"] })` example above) →
57
+ * `pool.pool.config.connectionConfig.clientFlags`
58
+ *
59
+ * Because those paths are undocumented driver internals, `global-dialect.test.ts`
60
+ * pins them against a REAL `mysql2` pool (built without connecting) rather than
61
+ * only against hand-written doubles — if a `mysql2` release relocates them, the
62
+ * probe would otherwise degrade silently to the warn branch and the OCC guard
63
+ * would go unchecked.
64
+ *
65
+ * The probe fields are typed `unknown` publicly: the paths are not in `mysql2`'s
66
+ * typings, so spelling them out made a real `createPool(...)` fail to type-check
67
+ * (TS2345, weak-type mismatch on `config`). {@link readMysqlClientFlags} reads
68
+ * them through the internal `FlagProbeShape` instead, and a minimal test double
69
+ * (only `query`) resolves to "undeterminable" rather than a `TypeError`.
70
+ */
71
+ type Mysql2Client = Mysql2Like & {
72
+ config?: unknown;
73
+ pool?: unknown;
74
+ };
75
+ /**
76
+ * Wrap a Postgres row-client (from `@lunora/hyperdrive`'s `fromPostgresJs` /
77
+ * `fromNodePg`) as a {@link SqlExec}. The core already renders `$N` placeholders
78
+ * for Postgres, so `all`/`run` forward verbatim. Postgres uses `RETURNING` for
79
+ * OCC (read via `all`), so `run` reports no affected-row count.
80
+ *
81
+ * `batch` dispatches every statement concurrently (`Promise.all`) over `client`
82
+ * rather than awaiting each `query` call in turn — `RowClient` only exposes a
83
+ * single-statement `query`, so there is no wire-level multi-statement command
84
+ * to reach for. When `client` is backed by a pool (the common production
85
+ * shape), this genuinely spreads the statements across multiple physical
86
+ * connections instead of serializing one full round trip at a time; against a
87
+ * single connection it still removes the sequential *await*, though the
88
+ * underlying driver may itself queue the sends. Either way it stays
89
+ * non-atomic, at-least-once, and unordered between elements, same as the
90
+ * sequential fallback minus the ordering — safe only for statements whose
91
+ * effects don't depend on each other, which is what every current caller
92
+ * batches (distinct-keyed companion rows).
93
+ *
94
+ * `transaction` is present when `client` has one (`fromPostgresJs`): the
95
+ * store's row + companion writes then run on one reserved connection and
96
+ * commit together.
97
+ */
17
98
  declare const buildPgExec: (client: RowClient) => SqlExec;
18
99
  /**
19
- * Wrap a `mysql2/promise` connection/pool as a {@link SqlExec}. The core already
20
- * renders backtick identifiers and `?` placeholders for MySQL, so `all`/`run`
21
- * forward verbatim. MySQL has no `RETURNING`, so `run` surfaces `affectedRows`
22
- * for the store's affected-rows OCC guard.
23
- *
24
- * **The connection MUST be created with the `CLIENT_FOUND_ROWS` flag**
25
- * (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows`
26
- * counts *changed* rows, so an idempotent `patch`/`replace` that re-writes the
27
- * same values reports 0 and the OCC guard raises a spurious conflict.
28
- */
29
- declare const buildMysqlExec: (connection: Mysql2Execute) => SqlExec;
100
+ * Wrap a `mysql2/promise` connection/pool as a {@link SqlExec}. The core already
101
+ * renders backtick identifiers and `?` placeholders for MySQL, so `all`/`run`
102
+ * forward verbatim. MySQL has no `RETURNING`, so `run` surfaces `affectedRows`
103
+ * for the store's affected-rows OCC guard.
104
+ *
105
+ * Statements go over as text with client-side escaping, so the server must not
106
+ * run with `NO_BACKSLASH_ESCAPES` (see {@link Mysql2Like}).
107
+ *
108
+ * **The connection MUST be created with the `CLIENT_FOUND_ROWS` flag**
109
+ * (mysql2: `createPool({ flags: ["FOUND_ROWS"] })`). Without it, `affectedRows`
110
+ * counts *changed* rows, so an idempotent `patch`/`replace` that re-writes the
111
+ * same values reports 0 and the OCC guard raises a spurious conflict. Verified
112
+ * once here at construction — see {@link assertFoundRows} — never per statement.
113
+ *
114
+ * Given a **pool** (anything with `getConnection`), `transaction` takes one
115
+ * connection for the store's row + companion writes, so they commit together.
116
+ * A single connection gets no `transaction`: other writers' statements would
117
+ * land inside an open one, so its companions commit one statement at a time.
118
+ *
119
+ * `batch` dispatches every statement concurrently (`Promise.all`), same
120
+ * rationale as {@link buildPgExec}'s `batch` — `Mysql2Like` only exposes a
121
+ * single-statement `query`, so this is "spread across a pool's connections"
122
+ * rather than one wire-level multi-statement command; still non-atomic,
123
+ * at-least-once, and unordered between elements, safe only for statements
124
+ * with no cross-effect (what every current caller batches).
125
+ */
126
+ declare const buildMysqlExec: (connection: Mysql2Client) => SqlExec;
30
127
  /**
31
- * **Postgres** dialect. Differs from SQLite only in column types
32
- * (`DOUBLE PRECISION`/`BYTEA`/`BIGSERIAL`), the `information_schema` catalog
33
- * probe, and unique-violation detection (SQLSTATE `23505`).
34
- */
128
+ * **Postgres** dialect. Differs from SQLite only in column types
129
+ * (`DOUBLE PRECISION`/`BYTEA`/`BIGSERIAL`), the `information_schema` catalog
130
+ * probe, and unique-violation detection (SQLSTATE `23505`).
131
+ */
35
132
  declare const postgresDialect: SqlDialect;
36
133
  /**
37
- * **MySQL** dialect. Diverges in: **no `RETURNING`** (the store's OCC falls back
38
- * to affected-rows — which requires the connection's `CLIENT_FOUND_ROWS` flag so
39
- * a no-op update still reports a matched row, see `buildMysqlExec`); bounded
40
- * `VARCHAR` keys (TEXT can't be a primary key / unindexed); a TEXT/BLOB index key
41
- * prefix; and `ER_DUP_ENTRY` (errno 1062) unique violations. (Drizzle's MySQL
42
- * dialect supplies the backtick identifiers + `ON DUPLICATE KEY` upserts.)
43
- */
134
+ * **MySQL** dialect. Diverges in: **no `RETURNING`** (the store's OCC falls back
135
+ * to affected-rows — which requires the connection's `CLIENT_FOUND_ROWS` flag so
136
+ * a no-op update still reports a matched row, see `buildMysqlExec`); bounded
137
+ * `VARCHAR` keys (TEXT can't be a primary key / unindexed); a TEXT/BLOB index key
138
+ * prefix; and `ER_DUP_ENTRY` (errno 1062) unique violations. (Drizzle's MySQL
139
+ * dialect supplies the backtick identifiers + `ON DUPLICATE KEY` upserts.)
140
+ */
44
141
  declare const mysqlDialect: SqlDialect;
142
+ /** Options for {@link createPgVectorIndex}. */
143
+ interface PgVectorIndexOptions {
144
+ /** Postgres client — the same `SqlClient` the Hyperdrive global store takes. */
145
+ client: SqlClient;
146
+ /**
147
+ * Vector width. Must match the embedder's output and the `dimensions` on the
148
+ * schema's `.vectorize(...)`; Postgres enforces it per row, so a mismatch
149
+ * surfaces as a write error rather than silently bad neighbours.
150
+ */
151
+ dimensions: number;
152
+ /** Distance metric. Defaults to `"cosine"`, matching the common embedding case. */
153
+ metric?: VectorMetric;
154
+ /**
155
+ * Names the backing table (`__vec_<name>`), derived rather than configurable —
156
+ * a second name for one index is a way to lose data, not a feature.
157
+ *
158
+ * This is NOT required to equal the key in the shard's `vectors` map, and often
159
+ * cannot: that key mirrors the schema's `.vectorize({ index })`, which may carry
160
+ * hyphens (`"docs-body"`), while this must be a bare SQL identifier. Keep it
161
+ * stable — changing it points the index at a different, empty table.
162
+ */
163
+ name: string;
164
+ }
165
+ /**
166
+ * Build a `pgvector`-backed vector index that satisfies {@link VectorizeIndexLike}.
167
+ *
168
+ * Requires the `vector` extension to be installable by the connecting role
169
+ * (`CREATE EXTENSION IF NOT EXISTS vector`). On a managed Postgres where the
170
+ * role cannot create extensions, install it once out-of-band; the statement is
171
+ * then a no-op.
172
+ * @param options See {@link PgVectorIndexOptions}.
173
+ * @returns An index object the shard's `vectors` map accepts as-is.
174
+ */
175
+ declare const createPgVectorIndex: (options: PgVectorIndexOptions) => VectorizeIndexLike;
45
176
  /** Which engine a Hyperdrive-backed `.global()` store targets. */
46
177
  type HyperdriveEngine = "mysql" | "postgres";
47
178
  /** Options for {@link createHyperdriveGlobalCtxDb}: the store options minus `exec`/`dialect`, plus the engine and a built `SqlExec`. */
@@ -52,18 +183,83 @@ interface CreateHyperdriveGlobalCtxDbOptions extends Omit<SqlCtxDbOptions, "dial
52
183
  exec: SqlExec;
53
184
  }
54
185
  /**
55
- * Build a reactive `.global()` writer backed by a Hyperdrive-reachable
56
- * Postgres/MySQL database. Pass a built {@link SqlExec} (via {@link buildPgExec}/
57
- * {@link buildMysqlExec}) and the matching `engine`; everything else mirrors the
58
- * D1 store options.
59
- */
60
- declare const createHyperdriveGlobalCtxDb: ({
61
- engine,
62
- exec,
63
- ...rest
64
- }: CreateHyperdriveGlobalCtxDbOptions) => DatabaseWriterLike;
186
+ * Build a reactive `.global()` writer backed by a Hyperdrive-reachable
187
+ * Postgres/MySQL database. Pass a built {@link SqlExec} (via {@link buildPgExec}/
188
+ * {@link buildMysqlExec}) and the matching `engine`; everything else mirrors the
189
+ * D1 store options.
190
+ */
191
+ declare const createHyperdriveGlobalCtxDb: ({ engine, exec, ...rest }: CreateHyperdriveGlobalCtxDbOptions) => DatabaseWriterLike;
192
+ /** Options for {@link exportHyperdriveGlobalRows}. */
193
+ interface ExportHyperdriveGlobalRowsOptions {
194
+ engine: HyperdriveEngine;
195
+ exec: SqlExec;
196
+ schema: SchemaLike;
197
+ /** Table allowlist; empty or absent exports every `.global()` table. */
198
+ tables?: ReadonlyArray<string>;
199
+ }
200
+ /**
201
+ * The admin export's global plane on Hyperdrive: yield every requested
202
+ * `.global()` table's rows, keyset-paged. Provisions the schema's tables first,
203
+ * so a table that was never written exports as empty instead of failing.
204
+ */
205
+ declare const exportHyperdriveGlobalRows: ({ engine, exec, schema, tables }: ExportHyperdriveGlobalRowsOptions) => AsyncGenerator<ExportRow, void, undefined>;
206
+ /** Options for {@link importHyperdriveGlobalRows}. */
207
+ interface ImportHyperdriveGlobalRowsOptions {
208
+ /** Append each insert to the global CDC log, like any other write — the app's own `cdc` setting. */
209
+ cdc: boolean;
210
+ /** Validate and report shape errors only; nothing is probed or written. */
211
+ dryRun?: boolean;
212
+ engine: HyperdriveEngine;
213
+ exec: SqlExec;
214
+ /** `"replace"` overwrites a row whose `_id` already exists; `"skip"` (the default) counts it as a conflict. */
215
+ onConflict?: ImportConflictMode;
216
+ rows: ReadonlyArray<ExportRow>;
217
+ schema: SchemaLike;
218
+ startLine?: number;
219
+ }
220
+ /**
221
+ * The admin import's global plane on Hyperdrive: insert snapshot rows through
222
+ * the same store core `.global()` writes use. A row whose `_id` already exists
223
+ * is a conflict left unchanged, unless `onConflict` is `"replace"`.
224
+ */
225
+ declare const importHyperdriveGlobalRows: ({ cdc, dryRun, engine, exec, onConflict, rows, schema, startLine }: ImportHyperdriveGlobalRowsOptions) => Promise<ImportResult>;
65
226
  /** Convenience: a **Postgres** `.global()` writer from a row-client (postgres.js/pg over Hyperdrive). */
66
227
  declare const createPostgresGlobalCtxDb: (client: RowClient, options: Omit<CreateHyperdriveGlobalCtxDbOptions, "engine" | "exec">) => DatabaseWriterLike;
67
228
  /** Convenience: a **MySQL** `.global()` writer from a `mysql2/promise` connection/pool (created with `flags: ["FOUND_ROWS"]`). */
68
- declare const createMysqlGlobalCtxDb: (connection: Mysql2Execute, options: Omit<CreateHyperdriveGlobalCtxDbOptions, "engine" | "exec">) => DatabaseWriterLike;
69
- export { CreateHyperdriveGlobalCtxDbOptions, HyperdriveEngine, type Mysql2Execute, type RowClient, buildMysqlExec, buildPgExec, createHyperdriveGlobalCtxDb, createMysqlGlobalCtxDb, createPostgresGlobalCtxDb, mysqlDialect, postgresDialect };
229
+ declare const createMysqlGlobalCtxDb: (connection: Mysql2Client, options: Omit<CreateHyperdriveGlobalCtxDbOptions, "engine" | "exec">) => DatabaseWriterLike;
230
+ /** The studio's global data browser over a Hyperdrive database — every table in the connection's schema, internal ones hidden. */
231
+ interface HyperdriveGlobalIntrospector {
232
+ facetColumn: (options: FacetGlobalColumnOptions) => Promise<GlobalFacetResult>;
233
+ listTables: () => Promise<GlobalTableInfo[]>;
234
+ readTablePage: (options: ReadGlobalTablePageOptions) => Promise<GlobalTablePage>;
235
+ }
236
+ /** Build the studio's global-browser introspector for a Hyperdrive `.global()` store. */
237
+ declare const createHyperdriveGlobalIntrospector: (engine: HyperdriveEngine, exec: SqlExec, schema: SchemaLike) => HyperdriveGlobalIntrospector;
238
+ /**
239
+ * The admin CDC sync's global plane on Hyperdrive: a page of the global
240
+ * `__cdc_log` past `sinceSeq`. The log only exists once a CDC-enabled writer has
241
+ * run, so its absence is "nothing has changed yet" — an empty page that leaves
242
+ * the cursor where it was — not an error.
243
+ */
244
+ declare const readHyperdriveGlobalCdc: (engine: HyperdriveEngine, exec: SqlExec, request: {
245
+ limit?: number;
246
+ now?: number;
247
+ sinceSeq: number;
248
+ }) => Promise<{
249
+ changes: CdcChange[];
250
+ cursor: number;
251
+ }>;
252
+ /**
253
+ * The admin point-in-time apply's global plane on Hyperdrive: replay CDC changes
254
+ * in order through the store core (insert, falling back to replace). The writer
255
+ * carries the app's `cdc` setting so the replay appends to the global changelog
256
+ * like any other write. Returns the number replayed.
257
+ */
258
+ declare const applyHyperdriveGlobalCdc: (options: {
259
+ cdc: boolean;
260
+ changes: ReadonlyArray<CdcChange>;
261
+ engine: HyperdriveEngine;
262
+ exec: SqlExec;
263
+ schema: SchemaLike;
264
+ }) => Promise<number>;
265
+ export { CreateHyperdriveGlobalCtxDbOptions, ExportHyperdriveGlobalRowsOptions, HyperdriveEngine, HyperdriveGlobalIntrospector, ImportHyperdriveGlobalRowsOptions, type Mysql2Client, type PgVectorIndexOptions, type RowClient, applyHyperdriveGlobalCdc, buildMysqlExec, buildPgExec, createHyperdriveGlobalCtxDb, createHyperdriveGlobalIntrospector, createMysqlGlobalCtxDb, createPgVectorIndex, createPostgresGlobalCtxDb, exportHyperdriveGlobalRows, importHyperdriveGlobalRows, mysqlDialect, postgresDialect, readHyperdriveGlobalCdc };
package/dist/global.mjs CHANGED
@@ -1,9 +1 @@
1
- import { createSqlCtxDb } from '@lunora/sql-store';
2
- import { postgresDialect, mysqlDialect } from './packem_shared/mysqlDialect-oNhZ58s8.mjs';
3
- import { buildMysqlExec, buildPgExec } from './packem_shared/buildMysqlExec-DBbCjyq3.mjs';
4
-
5
- const createHyperdriveGlobalCtxDb = ({ engine, exec, ...rest }) => createSqlCtxDb({ ...rest, dialect: engine === "postgres" ? postgresDialect : mysqlDialect, exec });
6
- const createPostgresGlobalCtxDb = (client, options) => createHyperdriveGlobalCtxDb({ ...options, engine: "postgres", exec: buildPgExec(client) });
7
- const createMysqlGlobalCtxDb = (connection, options) => createHyperdriveGlobalCtxDb({ ...options, engine: "mysql", exec: buildMysqlExec(connection) });
8
-
9
- export { buildMysqlExec, buildPgExec, createHyperdriveGlobalCtxDb, createMysqlGlobalCtxDb, createPostgresGlobalCtxDb, mysqlDialect, postgresDialect };
1
+ import{applyCdcChanges as d,CDC_LOG_TABLE as b}from"@lunora/shard-engine";import{createSqlCtxDb as p,readSqlGlobalTablePage as g,listSqlGlobalTables as m,facetSqlGlobalColumn as y,exportSqlGlobalRows as C,importSqlGlobalRows as G,readSqlCdcChanges as x}from"@lunora/sql-store";import{postgresDialect as q,mysqlDialect as u}from"./packem_shared/mysqlDialect-BS1Sz60B.mjs";import{buildMysqlExec as f,buildPgExec as v}from"./packem_shared/buildMysqlExec-DrnJfCYF.mjs";import{createPgVectorIndex as A}from"./packem_shared/createPgVectorIndex-B2Wbzqns.mjs";const o=e=>e==="postgres"?q:u,c=({engine:e,exec:l,...r})=>p({...r,dialect:o(e),exec:l}),H=({engine:e,exec:l,schema:r,tables:t})=>C(l,r,o(e),t===void 0?{}:{tables:t}),P=({cdc:e,dryRun:l,engine:r,exec:t,onConflict:a,rows:s,schema:n,startLine:i})=>G(c({cdc:e,engine:r,exec:t,schema:n}),n,o(r),{dryRun:l===!0,exec:t,onConflict:a??"skip",rows:s,...i===void 0?{}:{startLine:i}}),R=(e,l)=>c({...l,engine:"postgres",exec:v(e)}),T=(e,l)=>c({...l,engine:"mysql",exec:f(e)}),E=(e,l,r)=>{const t=o(e);return{facetColumn:a=>y(l,r,t,a),listTables:()=>m(l,r,t),readTablePage:a=>g(l,r,t,a)}},I=async(e,l,r)=>{const t=o(e),{params:a,sql:s}=t.render(t.tableExists(b));return(await l.all(s,a)).length===0?{changes:[],cursor:r.sinceSeq}:x(l,r,t)},M=async e=>(await d(c({cdc:e.cdc,engine:e.engine,exec:e.exec,schema:e.schema}),e.changes),e.changes.length);export{M as applyHyperdriveGlobalCdc,f as buildMysqlExec,v as buildPgExec,c as createHyperdriveGlobalCtxDb,E as createHyperdriveGlobalIntrospector,T as createMysqlGlobalCtxDb,A as createPgVectorIndex,R as createPostgresGlobalCtxDb,H as exportHyperdriveGlobalRows,P as importHyperdriveGlobalRows,u as mysqlDialect,q as postgresDialect,I as readHyperdriveGlobalCdc};