turbine-orm 0.76.0 → 0.77.0

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 (87) hide show
  1. package/dist/cjs/cli/index.js +2 -2
  2. package/dist/cjs/cli/migrate.js +8 -8
  3. package/dist/cjs/cli/studio.js +6 -3
  4. package/dist/cjs/client.js +10 -10
  5. package/dist/cjs/dialect.js +1 -1
  6. package/dist/cjs/errors.d.ts +2 -2
  7. package/dist/cjs/errors.js +21 -25
  8. package/dist/cjs/generate.js +1 -1
  9. package/dist/cjs/introspect.js +5 -5
  10. package/dist/cjs/mssql.js +12 -12
  11. package/dist/cjs/mysql.js +5 -5
  12. package/dist/cjs/nested-write.js +31 -31
  13. package/dist/cjs/observe.js +1 -1
  14. package/dist/cjs/pipeline-submittable.js +5 -1
  15. package/dist/cjs/pipeline.js +8 -0
  16. package/dist/cjs/powdb-introspect.d.ts +1 -1
  17. package/dist/cjs/powdb-introspect.js +4 -4
  18. package/dist/cjs/powdb-shared.d.ts +348 -0
  19. package/dist/cjs/powdb-shared.js +587 -0
  20. package/dist/cjs/powdb.d.ts +12 -299
  21. package/dist/cjs/powdb.js +106 -567
  22. package/dist/cjs/powql.d.ts +1 -1
  23. package/dist/cjs/powql.js +89 -89
  24. package/dist/cjs/prisma-compat.js +16 -16
  25. package/dist/cjs/query/aggregates.js +19 -20
  26. package/dist/cjs/query/batched-loader.js +8 -8
  27. package/dist/cjs/query/builder.js +8 -8
  28. package/dist/cjs/query/compound-unique.js +2 -2
  29. package/dist/cjs/query/filters.js +1 -1
  30. package/dist/cjs/query/relations.js +60 -48
  31. package/dist/cjs/query/types.js +4 -4
  32. package/dist/cjs/query/utils.js +5 -5
  33. package/dist/cjs/query/warn-registry.d.ts +7 -0
  34. package/dist/cjs/query/warn-registry.js +7 -0
  35. package/dist/cjs/query/where-compile.js +1 -1
  36. package/dist/cjs/query/where.js +30 -31
  37. package/dist/cjs/query/writes.js +7 -7
  38. package/dist/cjs/realtime.js +4 -4
  39. package/dist/cjs/schema-metadata.js +1 -1
  40. package/dist/cjs/schema-sql.js +3 -3
  41. package/dist/cjs/seed.js +1 -1
  42. package/dist/cjs/sqlite.js +7 -7
  43. package/dist/cjs/typed-sql.js +1 -1
  44. package/dist/cli/index.js +2 -2
  45. package/dist/cli/migrate.js +8 -8
  46. package/dist/cli/studio.js +6 -3
  47. package/dist/client.js +10 -10
  48. package/dist/dialect.js +1 -1
  49. package/dist/errors.d.ts +2 -2
  50. package/dist/errors.js +21 -25
  51. package/dist/generate.js +1 -1
  52. package/dist/introspect.js +5 -5
  53. package/dist/mssql.js +12 -12
  54. package/dist/mysql.js +5 -5
  55. package/dist/nested-write.js +31 -31
  56. package/dist/observe.js +1 -1
  57. package/dist/pipeline-submittable.js +6 -2
  58. package/dist/pipeline.js +9 -1
  59. package/dist/powdb-introspect.d.ts +1 -1
  60. package/dist/powdb-introspect.js +2 -2
  61. package/dist/powdb-shared.d.ts +348 -0
  62. package/dist/powdb-shared.js +570 -0
  63. package/dist/powdb.d.ts +12 -299
  64. package/dist/powdb.js +71 -534
  65. package/dist/powql.d.ts +1 -1
  66. package/dist/powql.js +43 -43
  67. package/dist/prisma-compat.js +16 -16
  68. package/dist/query/aggregates.js +19 -20
  69. package/dist/query/batched-loader.js +8 -8
  70. package/dist/query/builder.js +8 -8
  71. package/dist/query/compound-unique.js +2 -2
  72. package/dist/query/filters.js +1 -1
  73. package/dist/query/relations.js +60 -48
  74. package/dist/query/types.js +4 -4
  75. package/dist/query/utils.js +5 -5
  76. package/dist/query/warn-registry.d.ts +7 -0
  77. package/dist/query/warn-registry.js +7 -0
  78. package/dist/query/where-compile.js +1 -1
  79. package/dist/query/where.js +30 -31
  80. package/dist/query/writes.js +7 -7
  81. package/dist/realtime.js +4 -4
  82. package/dist/schema-metadata.js +1 -1
  83. package/dist/schema-sql.js +3 -3
  84. package/dist/seed.js +1 -1
  85. package/dist/sqlite.js +7 -7
  86. package/dist/typed-sql.js +1 -1
  87. package/package.json +15 -7
@@ -56,7 +56,9 @@ import { type PgCompatPool, type PgCompatPoolClient, TurbineClient, type Turbine
56
56
  import { type Dialect } from './dialect.js';
57
57
  import type { EngineClientConfig } from './engine-config.js';
58
58
  import type { PowdbExec } from './powdb-introspect.js';
59
- import { type ColumnMetadata, type SchemaMetadata, type TableMetadata } from './schema.js';
59
+ import { type PowdbCapabilities } from './powdb-shared.js';
60
+ import { type SchemaMetadata } from './schema.js';
61
+ export { ALL_POWDB_CAPABILITIES, coerceNativeValue, coerceValue, isJsonColumn, isPowdbDatetimeColumn, isStaleFramePowdbError, POWQL_KEYWORDS, type PowdbCapabilities, PowdbFloatParam, PowdbJsonParam, type PowqlType, powqlColumnType, quotePowqlDotted, quotePowqlIdent, requireCapability, rowToEntity, } from './powdb-shared.js';
60
62
  /**
61
63
  * Capability descriptor for PowDB. PowQL generation is owned by
62
64
  * {@link PowqlInterface} (not the SQL `Dialect`), so this dialect exists only to
@@ -82,33 +84,6 @@ import { type ColumnMetadata, type SchemaMetadata, type TableMetadata } from './
82
84
  export declare const powdbDialect: Dialect;
83
85
  /** A single value PowDB accepts as a positional `$N` parameter. */
84
86
  type PowdbParam = string | number | bigint | boolean | null;
85
- /**
86
- * Marker wrapper for a value bound to a `float` column. The networked driver
87
- * unwraps it to the plain number (the wire param is unchanged), but the
88
- * *embedded* literal encoder reads it to emit a float-form PowQL literal (`42`
89
- * → `42.0`) so an integer-valued float column stays unambiguously a float.
90
- * Constructed in {@link PowqlInterface.param}.
91
- */
92
- export declare class PowdbFloatParam {
93
- readonly value: number;
94
- constructor(value: number);
95
- }
96
- /**
97
- * Marker wrapper for a JS object/array bound to a `json` document column. Both
98
- * transports serialize `value` with `JSON.stringify` and send the text as a
99
- * `str` param / string literal, exactly how the PowDB docs insert a json
100
- * document (the engine validates it as JSON text and stores the canonical
101
- * binary form). Constructed in {@link PowqlInterface.param} when the target
102
- * column is `json` and the value is a non-null object/array; a JS string
103
- * written to a json column passes through RAW (same contract as pg jsonb,
104
- * pass `'"x"'` to store the JSON string `"x"`), and `null` stays `null`.
105
- */
106
- export declare class PowdbJsonParam {
107
- readonly value: unknown;
108
- readonly column?: string | undefined;
109
- /** `column` is diagnostic only: it names the target column when serialization fails. */
110
- constructor(value: unknown, column?: string | undefined);
111
- }
112
87
  /** The four shapes a PowQL result takes over the legacy string wire. */
113
88
  type PowdbResult = {
114
89
  kind: 'rows';
@@ -239,92 +214,6 @@ export declare function parsePowdbUrl(connectionString: string): PowdbConnOption
239
214
  * prove it is too old).
240
215
  */
241
216
  export declare function assertSupportedPowdbVersion(version: string | undefined): void;
242
- /**
243
- * Feature capabilities of a bound PowDB connection. Resolved once (from the
244
- * probed server version on the networked transport, or the addon package
245
- * version on embedded) and carried on the pool so {@link PowqlInterface} can
246
- * gate PowQL features that only exist on newer engines, an old engine gets a
247
- * typed {@link UnsupportedFeatureError} (E017) with a version hint instead of a
248
- * raw PowQL parse error.
249
- */
250
- export interface PowdbCapabilities {
251
- /** Best-known engine version (e.g. `'0.13.0'`), or `null` when unknowable. */
252
- engineVersion: string | null;
253
- /** ≥ 0.12: `json` column type, `->` path filters / ordering / grouping. */
254
- jsonDocs: boolean;
255
- /** ≥ 0.13: `alter T add index (.col->seg)` expression indexes. */
256
- docFieldIndexes: boolean;
257
- /** ≥ 0.10: `schema` / `describe` introspection statements. */
258
- introspection: boolean;
259
- /** ≥ 0.13: server-side joins, hash-accelerated and bounded. */
260
- serverJoins: boolean;
261
- /**
262
- * ≥ 0.18: nested projections (shaped results), a projection field may be a
263
- * whole correlated child query returning a per-parent JSON array. When set,
264
- * eligible `with` clauses compile into the parent statement instead of the
265
- * batched loaders.
266
- */
267
- nestedProjections: boolean;
268
- /**
269
- * ≥ 0.19: entity links (`link` DDL, scalar/block traversal). Capability is
270
- * recognized (probe-only), but query generation deliberately does NOT consume
271
- * links yet: turbine keeps composing its own nested projections (see the
272
- * PowDB engine page for the rationale). Declaring a link permanently upgrades
273
- * the on-disk catalog to v7, so this stays FALSE in ALL_POWDB_CAPABILITIES.
274
- */
275
- entityLinks: boolean;
276
- /**
277
- * ≥ 0.19.1: link INTROSPECTION, the `schema links` listing statement and the
278
- * appended link rows in `describe <T>`. Only meaningful when probed (there is
279
- * no query-generation flip behind it), so it stays FALSE in
280
- * ALL_POWDB_CAPABILITIES like the other probe-only gates. Floored at the PATCH
281
- * 0.19.1: the listing statement shipped there, not in 0.19.0.
282
- */
283
- linkIntrospection: boolean;
284
- /**
285
- * ≥ 0.19.1: scalar to-one link PATHS in query generation. Floored at the PATCH
286
- * 0.19.1 (never 0.19.0) because 0.19.0 had silent-wrong-results link bugs
287
- * (bare-dotted-path split, wrong aggregates over links) that make traversal
288
- * unsafe; 0.19.1 turned those into hard errors. This flag flips real query
289
- * generation (a to-one `with` whose child carries bigint/bytes compiles to
290
- * link-path projections instead of a loader), so it stays FALSE in
291
- * ALL_POWDB_CAPABILITIES: it must only light up behind a real version probe.
292
- */
293
- linkPaths: boolean;
294
- /**
295
- * ≥ 0.20: a comparison between a `datetime` column and an integer timestamp
296
- * literal evaluates as microseconds. Below 0.20 that pairing was unhandled and
297
- * fell back to comparing TYPE TAGS (every DateTime sorted above every Int), so
298
- * `>` matched every non-null row, `=` and `<` matched none, and the answer
299
- * additionally depended on whether the column carried an index. Turbine binds
300
- * a JS `Date` as int micros, so that is exactly the shape it emits: every
301
- * datetime predicate was silently wrong on an older engine.
302
- *
303
- * The `in` / `not in` LIST form is a separate, still-open engine bug that 0.20
304
- * did NOT fix, so this flag does not unlock it: a datetime `in` list is
305
- * COMPILED AWAY into the equality chain the engine does answer correctly (see
306
- * `PowqlInterface.buildInList`). That expansion needs working binary
307
- * comparisons, so it too sits behind this flag.
308
- *
309
- * Predominantly a refusal gate, but the `in` rewrite makes it a (bounded)
310
- * generation flip as well. It stays ON in {@link ALL_POWDB_CAPABILITIES}
311
- * anyway: with the flag OFF the datetime paths do not fall back to some other
312
- * SQL, they refuse outright, so a hand-constructed pool defaulting to OFF
313
- * would break datetime queries that work rather than protect anything.
314
- */
315
- datetimeCompare: boolean;
316
- /**
317
- * ≥ 0.20: `count(T { .col })` counts non-null values of `.col` (SQL's
318
- * `COUNT(col)`), which is what Turbine's per-field `_count` means. Below 0.20
319
- * both frontends ignored the projection and returned the ROW count, so
320
- * `aggregate({ _count: { field: true } })` silently disagreed with every SQL
321
- * engine on a nullable column. `count(T)` / `_count: true` is unaffected on
322
- * every version. Refusal-only gate (the emitted PowQL does not change).
323
- */
324
- projectedCountNonNull: boolean;
325
- /** Networked only: server ≥ 0.13 AND the client exposes `queryNativeRaw`. */
326
- nativeRaw: boolean;
327
- }
328
217
  /**
329
218
  * PowQL's parser bounds the SHAPE of the AST it produces, not just its own
330
219
  * recursion: an `and` / `or` chain is parsed iteratively but re-wraps its
@@ -353,35 +242,6 @@ export interface PowdbCapabilities {
353
242
  * powql.ts.
354
243
  */
355
244
  export declare const POWQL_MAX_NESTING_DEPTH = 64;
356
- /** The feature-gate capability keys (everything except the version/nativeRaw metadata). */
357
- type PowdbFeatureKey = 'jsonDocs' | 'docFieldIndexes' | 'introspection' | 'serverJoins' | 'nestedProjections' | 'entityLinks' | 'linkIntrospection' | 'linkPaths' | 'datetimeCompare' | 'projectedCountNonNull';
358
- /**
359
- * Trusted-caller default: every FEATURE gate on, engine version unknown. Used
360
- * for a directly-constructed {@link PowdbPool} / {@link PowdbEmbeddedPool} that
361
- * did not go through {@link turbinePowDB}'s version probe (e.g. an injected
362
- * pool, or a unit-test pool). `nativeRaw` stays OFF here because it flips the
363
- * actual wire path and must only be enabled after a real server-version probe,
364
- * never inferred from a bare construction. `nestedProjections` stays OFF for
365
- * the same reason: it changes the generated PowQL for every `with` query, and
366
- * an unprobed engine below 0.18 would reject the syntax outright.
367
- * `entityLinks` stays OFF for a stronger reason still: declaring a link
368
- * one-way-upgrades the on-disk catalog to v7 and locks out pre-0.19 binaries,
369
- * so it must only ever light up behind a real version probe.
370
- * `linkIntrospection` / `linkPaths` stay OFF for the same probe-only discipline:
371
- * `linkPaths` flips real query generation (a to-one `with` compiling to link
372
- * projections), and `linkIntrospection` is only meaningful once genuinely
373
- * probed, so both must come from a real version resolution, never a bare
374
- * construction.
375
- * `datetimeCompare` / `projectedCountNonNull` stay ON here for the same
376
- * trusted-caller reason as `jsonDocs` and `serverJoins`. Neither is a fallback
377
- * gate: with the flag OFF the affected query is REFUSED, not served by some
378
- * other statement, so defaulting them off would break working queries rather
379
- * than protect anything. Every path that can learn the engine version
380
- * (`turbinePowDB`, embedded or networked) resolves them from a real probe; this
381
- * fallback only covers a hand-constructed or injected pool, whose owner is
382
- * asserting the engine is current.
383
- */
384
- export declare const ALL_POWDB_CAPABILITIES: PowdbCapabilities;
385
245
  /**
386
246
  * Derive {@link PowdbCapabilities} from an engine version string. A non-semver /
387
247
  * unknown version turns every gate OFF (the E017 hint then tells the caller to
@@ -391,117 +251,6 @@ export declare const ALL_POWDB_CAPABILITIES: PowdbCapabilities;
391
251
  export declare function capabilitiesFromVersion(version: string | undefined | null, opts?: {
392
252
  hasNativeRaw?: boolean;
393
253
  }): PowdbCapabilities;
394
- /**
395
- * Throw a version-hinting {@link UnsupportedFeatureError} (E017) when a gated
396
- * PowQL feature is used on an engine that does not support it. Keeps old engines
397
- * getting clean typed errors instead of raw PowQL parse failures.
398
- *
399
- * The error's first sentence already names the feature (`<feature> is
400
- * unsupported on "PowDB".`), so the hint says "Requires PowDB >= x" rather than
401
- * repeating the label: a long feature description read twice in one message
402
- * (`per-field \`_count\` … is unsupported … per-field \`_count\` … requires …`)
403
- * buries the version floor that is the actionable part.
404
- *
405
- * `extra` appends one more sentence for gates that have a workaround worth
406
- * naming (e.g. the read path that answers the same query without the gated
407
- * comparison).
408
- */
409
- export declare function requireCapability(caps: PowdbCapabilities, key: PowdbFeatureKey, feature: string, extra?: string): void;
410
- /**
411
- * PowQL column types Turbine emits: the four writable scalars plus PowDB's
412
- * native `json` document type (added to the map in the 0.12/0.13 parity round,
413
- * see {@link isJsonColumn}). A `json` column stores a canonical binary document
414
- * (sorted keys, int/float distinction preserved) that Turbine writes as a JSON
415
- * string literal and reads back by parsing the canonical JSON text.
416
- */
417
- export type PowqlType = 'str' | 'int' | 'float' | 'bool' | 'json';
418
- /**
419
- * Does this column map to PowDB's native `json` document type? A Postgres
420
- * `json`/`jsonb` type (via `dialectType`/`pgType`) is authoritative; otherwise
421
- * the tsType heuristic (`Record<…>`, `object`, `unknown`, an object/array
422
- * literal) that the four scalar branches do not claim. Array columns never map
423
- * to json, a PowDB array only exists INSIDE a json document, so a Postgres
424
- * array column has no PowDB shape and still throws in {@link powqlColumnType}.
425
- */
426
- export declare function isJsonColumn(col: ColumnMetadata): boolean;
427
- /**
428
- * Map a Turbine column to the PowQL DDL type used in `defineSchema` →
429
- * `type T { … }`. Turbine never emits PowDB's `uuid`/`datetime`/`bytes` types,
430
- * which cannot hold client-supplied values on the wire (no literal, no cast):
431
- * - `Date` → `int` (epoch micros) - `boolean` → `bool`
432
- * - integral `number`/`bigint` → `int` - fractional `number` → `float`
433
- * - JSON / object columns → `json` (native PowDB document type, ≥ 0.12)
434
- * - everything else (incl. UUID/PK strings) → `str`
435
- * Array (non-json) and bytes columns throw, they have no PowDB equivalent.
436
- */
437
- export declare function powqlColumnType(col: ColumnMetadata): PowqlType;
438
- /**
439
- * Is this column stored in PowDB's NATIVE `datetime` type (as opposed to the
440
- * `int` epoch micros Turbine's own DDL emits for a `Date` column)?
441
- *
442
- * Only the literal PowQL type name counts. `powqlColumnType` never returns
443
- * `datetime`, so a Turbine-provisioned table can never have one; the shapes that
444
- * do are a table created outside Turbine and read back through
445
- * `introspectPowdbDatabase` (which maps `datetime` → `{ tsType: 'Date',
446
- * dialectType: 'datetime' }`), or hand-written metadata declaring it. Deliberately
447
- * strict: a Postgres-sourced `timestamptz` column is DDL'd as PowQL `int`, so it
448
- * is NOT a PowDB datetime and must not be caught here.
449
- *
450
- * Matters because comparing a datetime column against the integer timestamp
451
- * literal Turbine binds was silently wrong below engine 0.20 (see
452
- * {@link PowdbCapabilities.datetimeCompare}).
453
- */
454
- export declare function isPowdbDatetimeColumn(col: ColumnMetadata): boolean;
455
- /**
456
- * Generate PowQL DDL (`type T { … }`) for every table in a schema. Used to
457
- * provision a PowDB database from a code-first `defineSchema`/`SchemaMetadata`
458
- * (PowDB has no migration runner yet). The primary key column is declared
459
- * `required unique`; non-nullable columns are `required`. A server-generated
460
- * column ({@link ColumnMetadata.isGenerated}) that maps to PowQL `int` gets the
461
- * `auto` modifier, so PowDB assigns a monotonic id on insert and Turbine stops
462
- * synthesizing a client-side value for it.
463
- */
464
- /**
465
- * PowQL reserved words, the v0.10 lexer keyword table from POWQL.md's
466
- * "Reserved Words and Quoting" section, including the v0.10 additions
467
- * `schema` and `describe`. Keyword matching is case-sensitive in the lexer,
468
- * so only the exact lowercase form collides.
469
- */
470
- export declare const POWQL_KEYWORDS: ReadonlySet<string>;
471
- /**
472
- * Backtick-quote an identifier when PowQL would otherwise lex it as a keyword
473
- * (or when it contains characters outside the bare-identifier grammar).
474
- * Applied only in bare-identifier positions, DDL type/field names, index DDL,
475
- * and `insert`/`update`/`upsert` assignment targets. Dotted references
476
- * (`.col` in filters/projections/ordering) bypass keyword lookup on every
477
- * engine version and deliberately stay bare for ≤0.9 compatibility. Backticks
478
- * parse on PowDB ≥ 0.10; on older engines these names were already parse
479
- * errors when emitted bare, so quoting is strictly an improvement.
480
- */
481
- export declare function quotePowqlIdent(name: string): string;
482
- /**
483
- * The DOTTED-position spelling of {@link quotePowqlIdent}: quote a name that
484
- * falls outside the bare-identifier grammar, and only that.
485
- *
486
- * A dotted reference (`.col` in a filter, projection, `order`, `group`, or an
487
- * `upsert on`) bypasses keyword lookup, so `.order` parses on every engine
488
- * version and stays bare here, which is the ≤0.9 compatibility decision
489
- * {@link quotePowqlIdent} documents and which this must not undo.
490
- *
491
- * What it does NOT excuse is interpolating the name RAW, which is what these
492
- * sites used to do. Keyword-ness is a parsing question; a name outside
493
- * `POWQL_BARE_IDENT` is a statement-integrity one, and that name is the only
494
- * thing that can carry PowQL syntax into a statement whose values are all bound
495
- * as `$N` params. Reaching it needs a hostile column name (an introspected
496
- * database, a generator, a migration authored elsewhere) since names come from
497
- * schema metadata, but "the names are trusted" is not the invariant the rest of
498
- * this engine is written to. So: bare when the grammar allows it (byte-identical
499
- * output for every ordinary and every keyword name), quoted when it does not,
500
- * where the bare form was a parse error anyway. Verified against the engine that
501
- * a quoted dotted reference parses everywhere the bare one does and yields the
502
- * same result-column name.
503
- */
504
- export declare function quotePowqlDotted(name: string): string;
505
254
  /**
506
255
  * Options for {@link powqlSchemaDDL}. Additive: with no options the DDL is
507
256
  * emitted unconditionally (pure-function callers / tests); pass `capabilities`
@@ -561,6 +310,15 @@ export interface PowdbDesiredLink {
561
310
  export declare function deriveDesiredLinks(schema: SchemaMetadata, onCollision?: (owner: string, name: string) => void): PowdbDesiredLink[];
562
311
  /** Render one {@link PowdbDesiredLink} as its create-only `link ...` DDL statement. */
563
312
  export declare function powdbLinkStatement(link: PowdbDesiredLink): string;
313
+ /**
314
+ * Generate PowQL DDL (`type T { … }`) for every table in a schema. Used to
315
+ * provision a PowDB database from a code-first `defineSchema`/`SchemaMetadata`
316
+ * (PowDB has no migration runner yet). The primary key column is declared
317
+ * `required unique`; non-nullable columns are `required`. A server-generated
318
+ * column ({@link ColumnMetadata.isGenerated}) that maps to PowQL `int` gets the
319
+ * `auto` modifier, so PowDB assigns a monotonic id on insert and Turbine stops
320
+ * synthesizing a client-side value for it.
321
+ */
564
322
  export declare function powqlSchemaDDL(schema: SchemaMetadata, opts?: PowqlSchemaDDLOptions): string[];
565
323
  /**
566
324
  * Existence-checked apply of entity-link DDL against a LIVE PowDB database.
@@ -583,41 +341,6 @@ export declare function powqlSchemaDDL(schema: SchemaMetadata, opts?: PowqlSchem
583
341
  export declare function applyPowdbLinks(exec: PowdbExec, schema: SchemaMetadata, options?: {
584
342
  capabilities?: PowdbCapabilities;
585
343
  }): Promise<string[]>;
586
- /**
587
- * Coerce a single PowDB wire string into the JS value its column type implies.
588
- * Every PowDB value arrives as a string; NULL arrives as the bareword `"null"`.
589
- * Metadata resolves the `"null"` ambiguity for nullable non-string columns.
590
- */
591
- export declare function coerceValue(raw: string, col: ColumnMetadata): unknown;
592
- /**
593
- * Coerce a single cell that arrived over the NATIVE typed wire (decoded from a
594
- * {@link PowdbWireValue}, so already a JS `bigint`/`number`/`boolean`/`string`/
595
- * `NativeJson`/`Uint8Array`/`null`, never a bare `"null"` string). Unlike
596
- * {@link coerceValue} this NEVER collapses the string `"null"` to `null`: an
597
- * absent value already decoded to `null` (from the `empty` cell), so a genuine
598
- * str `"null"` stays the string `"null"` (fixes the legacy-wire wart on the
599
- * native transport). `datetime`-shaped cells (int micros) become `Date`; a
600
- * bigint on a `number` column follows the int8 safe-integer policy.
601
- *
602
- * A date cell can also arrive as a DIGIT STRING: a nested-projection block's
603
- * children ride a JSON array, and micros exceed `Number.MAX_SAFE_INTEGER`'s
604
- * decimal comfort, so the engine renders them as a JSON string. Before that
605
- * string was parsed here, a nested `with` handed back the raw micros text while
606
- * the batched loader and the native join both handed back a `Date` (the same
607
- * relation, three answers). Only an all-digit string is parsed; any other text
608
- * on a date column passes through untouched.
609
- */
610
- export declare function coerceNativeValue(value: unknown, col: ColumnMetadata): unknown;
611
- /**
612
- * Map one raw PowDB row into a typed entity (camelCase fields, coerced values).
613
- * Only the columns present in `raw` are emitted, so partial `select`
614
- * projections round-trip unchanged. `native` selects the coercion policy: the
615
- * default `false` handles the legacy string wire (every cell is a string, via
616
- * {@link coerceValue}); `true` handles the native typed wire, where non-string
617
- * cells arrive pre-typed and go through {@link coerceNativeValue} (see F3).
618
- * Callers on the native transport pass `this.pool.capabilities.nativeRaw`.
619
- */
620
- export declare function rowToEntity(raw: Record<string, unknown>, meta: TableMetadata, native?: boolean): Record<string, unknown>;
621
344
  /**
622
345
  * Translate a PowDB error into a typed Turbine error. Handles BOTH transports,
623
346
  * whose error shapes differ:
@@ -635,16 +358,6 @@ export declare function rowToEntity(raw: Record<string, unknown>, meta: TableMet
635
358
  * then fall through to the networked `.code` switch.
636
359
  */
637
360
  export declare function wrapPowdbError(err: unknown): Error;
638
- /**
639
- * True when `err` is the stale-wire-frame {@link ConnectionError} produced by
640
- * {@link wrapPowdbError} (its `.cause` is a `protocol_error` PowDBError, or the
641
- * message carries the invalid-state signature). The opt-in read retry
642
- * (`retryStaleReads`, evaluated in {@link PowqlInterface}'s exec seam) uses this
643
- * to decide whether a first-statement READ may be replayed once on a fresh
644
- * connection; writes are NEVER retried (an ambiguous mutation reply is unsafe
645
- * to replay, matching the client's own native-path policy).
646
- */
647
- export declare function isStaleFramePowdbError(err: unknown): boolean;
648
361
  type QueryArg = string | {
649
362
  name?: string;
650
363
  text: string;