turbine-orm 0.50.0 → 0.51.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 (186) hide show
  1. package/README.md +66 -66
  2. package/dist/adapters/cockroachdb.d.ts +5 -5
  3. package/dist/adapters/cockroachdb.js +10 -10
  4. package/dist/adapters/index.d.ts +5 -5
  5. package/dist/adapters/index.js +7 -7
  6. package/dist/adapters/yugabytedb.d.ts +7 -7
  7. package/dist/adapters/yugabytedb.js +10 -10
  8. package/dist/cjs/adapters/cockroachdb.d.ts +5 -5
  9. package/dist/cjs/adapters/cockroachdb.js +10 -10
  10. package/dist/cjs/adapters/index.d.ts +5 -5
  11. package/dist/cjs/adapters/index.js +7 -7
  12. package/dist/cjs/adapters/yugabytedb.d.ts +7 -7
  13. package/dist/cjs/adapters/yugabytedb.js +10 -10
  14. package/dist/cjs/cli/config.d.ts +13 -2
  15. package/dist/cjs/cli/config.js +3 -2
  16. package/dist/cjs/cli/destructive.d.ts +1 -1
  17. package/dist/cjs/cli/destructive.js +1 -1
  18. package/dist/cjs/cli/index.d.ts +10 -10
  19. package/dist/cjs/cli/index.js +49 -45
  20. package/dist/cjs/cli/loader.d.ts +7 -7
  21. package/dist/cjs/cli/loader.js +9 -9
  22. package/dist/cjs/cli/mcp.js +4 -4
  23. package/dist/cjs/cli/migrate.d.ts +5 -5
  24. package/dist/cjs/cli/migrate.js +11 -11
  25. package/dist/cjs/cli/studio-ui.generated.js +1 -1
  26. package/dist/cjs/cli/ui.d.ts +2 -2
  27. package/dist/cjs/cli/ui.js +2 -2
  28. package/dist/cjs/client.d.ts +49 -38
  29. package/dist/cjs/client.js +57 -56
  30. package/dist/cjs/dialect.d.ts +62 -18
  31. package/dist/cjs/dialect.js +40 -2
  32. package/dist/cjs/errors.d.ts +5 -5
  33. package/dist/cjs/errors.js +11 -11
  34. package/dist/cjs/generate.d.ts +6 -6
  35. package/dist/cjs/generate.js +31 -29
  36. package/dist/cjs/index-advisor.d.ts +5 -5
  37. package/dist/cjs/index-advisor.js +0 -0
  38. package/dist/cjs/index.d.ts +1 -1
  39. package/dist/cjs/index.js +7 -7
  40. package/dist/cjs/introspect.d.ts +35 -9
  41. package/dist/cjs/introspect.js +83 -32
  42. package/dist/cjs/mssql.d.ts +11 -11
  43. package/dist/cjs/mssql.js +64 -29
  44. package/dist/cjs/mysql.d.ts +8 -8
  45. package/dist/cjs/mysql.js +61 -23
  46. package/dist/cjs/nested-write.d.ts +21 -2
  47. package/dist/cjs/nested-write.js +51 -14
  48. package/dist/cjs/optional-peer-import.cjs +7 -7
  49. package/dist/cjs/optional-peer-import.d.cts +7 -7
  50. package/dist/cjs/pipeline-submittable.d.ts +2 -2
  51. package/dist/cjs/pipeline-submittable.js +6 -6
  52. package/dist/cjs/pipeline.d.ts +1 -1
  53. package/dist/cjs/pipeline.js +4 -4
  54. package/dist/cjs/powdb-introspect.d.ts +1 -1
  55. package/dist/cjs/powdb-introspect.js +1 -1
  56. package/dist/cjs/powdb.d.ts +28 -28
  57. package/dist/cjs/powdb.js +66 -66
  58. package/dist/cjs/powql.d.ts +27 -27
  59. package/dist/cjs/powql.js +73 -52
  60. package/dist/cjs/query/aggregates.d.ts +1 -1
  61. package/dist/cjs/query/aggregates.js +5 -5
  62. package/dist/cjs/query/batched-loader.d.ts +11 -11
  63. package/dist/cjs/query/batched-loader.js +24 -24
  64. package/dist/cjs/query/builder.d.ts +39 -21
  65. package/dist/cjs/query/builder.js +99 -57
  66. package/dist/cjs/query/compound-unique.d.ts +1 -1
  67. package/dist/cjs/query/compound-unique.js +0 -0
  68. package/dist/cjs/query/deferred.d.ts +12 -6
  69. package/dist/cjs/query/deferred.js +1 -1
  70. package/dist/cjs/query/filters.d.ts +31 -11
  71. package/dist/cjs/query/filters.js +67 -14
  72. package/dist/cjs/query/index.d.ts +1 -1
  73. package/dist/cjs/query/index.js +1 -1
  74. package/dist/cjs/query/relations.d.ts +9 -9
  75. package/dist/cjs/query/relations.js +164 -57
  76. package/dist/cjs/query/types.d.ts +86 -35
  77. package/dist/cjs/query/types.js +1 -1
  78. package/dist/cjs/query/utils.d.ts +27 -10
  79. package/dist/cjs/query/utils.js +86 -14
  80. package/dist/cjs/query/where.d.ts +47 -28
  81. package/dist/cjs/query/where.js +130 -31
  82. package/dist/cjs/query/writes.d.ts +24 -5
  83. package/dist/cjs/query/writes.js +102 -13
  84. package/dist/cjs/realtime.d.ts +7 -7
  85. package/dist/cjs/realtime.js +9 -9
  86. package/dist/cjs/schema-builder.d.ts +18 -7
  87. package/dist/cjs/schema-builder.js +17 -10
  88. package/dist/cjs/schema-metadata.d.ts +3 -3
  89. package/dist/cjs/schema-metadata.js +9 -9
  90. package/dist/cjs/schema-sql.d.ts +9 -9
  91. package/dist/cjs/schema-sql.js +20 -20
  92. package/dist/cjs/schema.d.ts +19 -9
  93. package/dist/cjs/schema.js +6 -6
  94. package/dist/cjs/serverless.d.ts +15 -15
  95. package/dist/cjs/serverless.js +16 -16
  96. package/dist/cjs/sqlite.d.ts +8 -8
  97. package/dist/cjs/sqlite.js +53 -22
  98. package/dist/cjs/typed-sql.d.ts +4 -4
  99. package/dist/cjs/typed-sql.js +5 -5
  100. package/dist/cli/config.d.ts +13 -2
  101. package/dist/cli/config.js +3 -2
  102. package/dist/cli/destructive.d.ts +1 -1
  103. package/dist/cli/destructive.js +1 -1
  104. package/dist/cli/index.d.ts +10 -10
  105. package/dist/cli/index.js +49 -45
  106. package/dist/cli/loader.d.ts +7 -7
  107. package/dist/cli/loader.js +9 -9
  108. package/dist/cli/mcp.js +4 -4
  109. package/dist/cli/migrate.d.ts +5 -5
  110. package/dist/cli/migrate.js +11 -11
  111. package/dist/cli/studio-ui.generated.js +1 -1
  112. package/dist/cli/ui.d.ts +2 -2
  113. package/dist/cli/ui.js +2 -2
  114. package/dist/client.d.ts +49 -38
  115. package/dist/client.js +57 -56
  116. package/dist/dialect.d.ts +62 -18
  117. package/dist/dialect.js +40 -2
  118. package/dist/errors.d.ts +5 -5
  119. package/dist/errors.js +11 -11
  120. package/dist/generate.d.ts +6 -6
  121. package/dist/generate.js +31 -29
  122. package/dist/index-advisor.d.ts +5 -5
  123. package/dist/index-advisor.js +0 -0
  124. package/dist/index.d.ts +1 -1
  125. package/dist/index.js +7 -7
  126. package/dist/introspect.d.ts +35 -9
  127. package/dist/introspect.js +82 -32
  128. package/dist/mssql.d.ts +11 -11
  129. package/dist/mssql.js +64 -29
  130. package/dist/mysql.d.ts +8 -8
  131. package/dist/mysql.js +61 -23
  132. package/dist/nested-write.d.ts +21 -2
  133. package/dist/nested-write.js +51 -14
  134. package/dist/optional-peer-import.cjs +7 -7
  135. package/dist/optional-peer-import.d.cts +7 -7
  136. package/dist/pipeline-submittable.d.ts +2 -2
  137. package/dist/pipeline-submittable.js +6 -6
  138. package/dist/pipeline.d.ts +1 -1
  139. package/dist/pipeline.js +4 -4
  140. package/dist/powdb-introspect.d.ts +1 -1
  141. package/dist/powdb-introspect.js +1 -1
  142. package/dist/powdb.d.ts +28 -28
  143. package/dist/powdb.js +66 -66
  144. package/dist/powql.d.ts +27 -27
  145. package/dist/powql.js +73 -52
  146. package/dist/query/aggregates.d.ts +1 -1
  147. package/dist/query/aggregates.js +5 -5
  148. package/dist/query/batched-loader.d.ts +11 -11
  149. package/dist/query/batched-loader.js +24 -24
  150. package/dist/query/builder.d.ts +39 -21
  151. package/dist/query/builder.js +100 -58
  152. package/dist/query/compound-unique.d.ts +1 -1
  153. package/dist/query/compound-unique.js +0 -0
  154. package/dist/query/deferred.d.ts +12 -6
  155. package/dist/query/deferred.js +1 -1
  156. package/dist/query/filters.d.ts +31 -11
  157. package/dist/query/filters.js +66 -13
  158. package/dist/query/index.d.ts +1 -1
  159. package/dist/query/index.js +1 -1
  160. package/dist/query/relations.d.ts +9 -9
  161. package/dist/query/relations.js +165 -58
  162. package/dist/query/types.d.ts +86 -35
  163. package/dist/query/types.js +1 -1
  164. package/dist/query/utils.d.ts +27 -10
  165. package/dist/query/utils.js +84 -14
  166. package/dist/query/where.d.ts +47 -28
  167. package/dist/query/where.js +129 -32
  168. package/dist/query/writes.d.ts +24 -5
  169. package/dist/query/writes.js +101 -13
  170. package/dist/realtime.d.ts +7 -7
  171. package/dist/realtime.js +9 -9
  172. package/dist/schema-builder.d.ts +18 -7
  173. package/dist/schema-builder.js +17 -10
  174. package/dist/schema-metadata.d.ts +3 -3
  175. package/dist/schema-metadata.js +9 -9
  176. package/dist/schema-sql.d.ts +9 -9
  177. package/dist/schema-sql.js +20 -20
  178. package/dist/schema.d.ts +19 -9
  179. package/dist/schema.js +6 -6
  180. package/dist/serverless.d.ts +15 -15
  181. package/dist/serverless.js +16 -16
  182. package/dist/sqlite.d.ts +8 -8
  183. package/dist/sqlite.js +53 -22
  184. package/dist/typed-sql.d.ts +4 -4
  185. package/dist/typed-sql.js +5 -5
  186. package/package.json +2 -2
package/dist/sqlite.js CHANGED
@@ -1,16 +1,16 @@
1
1
  /**
2
- * turbine-orm/sqlite — zero-dependency SQLite engine
2
+ * turbine-orm/sqlite, zero-dependency SQLite engine
3
3
  *
4
4
  * Binds Turbine to SQLite via Node's built-in `node:sqlite` driver
5
5
  * (`DatabaseSync`), so SQLite is a **zero new dependency** engine: the root
6
6
  * package's runtime dependency stays exactly `pg`. This is the in-process
7
- * test / edge / "try it in 10 seconds" engine — `:memory:` databases run
7
+ * test / edge / "try it in 10 seconds" engine, `:memory:` databases run
8
8
  * entirely in-process with no service container.
9
9
  *
10
10
  * ## Driver
11
11
  *
12
12
  * - **Primary:** `node:sqlite` `DatabaseSync` (Node ≥ 22.5, experimental). Emits
13
- * an `ExperimentalWarning` — harmless. No native build, no extra dependency.
13
+ * an `ExperimentalWarning`, harmless. No native build, no extra dependency.
14
14
  * - **Fallback:** `better-sqlite3` for Node < 22.5. Not bundled and not required;
15
15
  * wrap a `better-sqlite3` handle in the same `PgCompatPool` shape if needed.
16
16
  *
@@ -24,7 +24,7 @@
24
24
  * WAL` is enabled for file databases to allow concurrent readers.
25
25
  * - **Unsupported (throw `UnsupportedFeatureError`):** pgvector distance ops,
26
26
  * LISTEN/NOTIFY (`$listen` / `$notify`), RLS `sessionContext`. Advisory-lock
27
- * migration locking is unavailable — SQLite is single-writer, so migrations
27
+ * migration locking is unavailable, SQLite is single-writer, so migrations
28
28
  * serialize naturally.
29
29
  * - **Type affinity caveats:** SQLite has no native `BOOLEAN` (0/1 integers) or
30
30
  * `DATE` (TEXT/INTEGER). Booleans bind as 1/0; `Date` values bind as ISO-8601
@@ -34,7 +34,7 @@
34
34
  * - **Case-insensitive matching** uses `COLLATE NOCASE`, which is **ASCII-only**
35
35
  * (no Unicode case folding).
36
36
  *
37
- * ## Example — `:memory:` database
37
+ * ## Example, `:memory:` database
38
38
  *
39
39
  * ```ts
40
40
  * import { turbineSqlite } from 'turbine-orm/sqlite';
@@ -56,8 +56,8 @@ let cachedDatabaseSync;
56
56
  * Lazily load `node:sqlite`'s `DatabaseSync` constructor.
57
57
  *
58
58
  * `node:sqlite` is a built-in only on Node >= 22.5, so importing it at module
59
- * top-level would make `import 'turbine-orm/sqlite'` — and any module that
60
- * merely re-exports `sqliteDialect` (e.g. the dialect test suite) — throw
59
+ * top-level would make `import 'turbine-orm/sqlite'`, and any module that
60
+ * merely re-exports `sqliteDialect` (e.g. the dialect test suite), throw
61
61
  * `ERR_UNKNOWN_BUILTIN_MODULE` on Node 20. Deferring the require to the moment a
62
62
  * connection is actually opened keeps the dialect (pure SQL generation) usable
63
63
  * everywhere and scopes the Node-version requirement to `turbineSqlite()`.
@@ -79,7 +79,7 @@ function loadDatabaseSync() {
79
79
  `Upgrade Node to >= 22.5, or pass an already-open better-sqlite3-compatible handle. (${err.message})`);
80
80
  }
81
81
  if (typeof ctor !== 'function') {
82
- throw new ConnectionError("[turbine] 'node:sqlite' loaded but did not export a DatabaseSync constructor — this Node build may lack SQLite support.");
82
+ throw new ConnectionError("[turbine] 'node:sqlite' loaded but did not export a DatabaseSync constructor, this Node build may lack SQLite support.");
83
83
  }
84
84
  cachedDatabaseSync = ctor;
85
85
  return cachedDatabaseSync;
@@ -112,7 +112,7 @@ function toSqliteParam(value) {
112
112
  /**
113
113
  * Normalize a single column value read from SQLite. With `setReadBigInts(true)`
114
114
  * every integer column comes back as a `bigint`; apply the same safe-integer
115
- * policy Turbine uses for Postgres `int8` — number when it fits in a JS safe
115
+ * policy Turbine uses for Postgres `int8`, number when it fits in a JS safe
116
116
  * integer, otherwise the decimal string to avoid precision loss. Never mutates
117
117
  * any global parser state (the policy lives entirely in this shim).
118
118
  */
@@ -153,7 +153,7 @@ function statementReturnsRows(sql) {
153
153
  * recognizable SQLite error.
154
154
  *
155
155
  * `wrapPgError` is invoked downstream (in the query executor and the
156
- * transaction proxy), so we only annotate here — we never throw a `new`
156
+ * transaction proxy), so we only annotate here, we never throw a `new`
157
157
  * Turbine error from the driver itself.
158
158
  */
159
159
  function augmentSqliteError(err) {
@@ -221,7 +221,7 @@ function normalizeQueryArgs(arg, values) {
221
221
  /**
222
222
  * Bind the positional `params[]` (in 1-indexed generation order) to the named
223
223
  * `:p1`, `:p2`, … placeholders the dialect emits. Mapping by NAME makes binding
224
- * independent of where each placeholder lands in the SQL text — the same
224
+ * independent of where each placeholder lands in the SQL text, the same
225
225
  * guarantee Postgres' numbered `$N` gives. Returns `undefined` when there are no
226
226
  * params so parameter-less statements (BEGIN/COMMIT/DDL) bind nothing.
227
227
  */
@@ -261,12 +261,12 @@ function runStatement(db, sql, values) {
261
261
  /**
262
262
  * A `PgCompatPool` backed by a single `node:sqlite` `DatabaseSync` connection.
263
263
  * SQLite is single-connection by nature (a `:memory:` database is per-handle),
264
- * so `connect()` hands back a client over the **same** handle — transactions
264
+ * so `connect()` hands back a client over the **same** handle, transactions
265
265
  * (`BEGIN`/`COMMIT`/`ROLLBACK`, `SAVEPOINT` nesting) just run on it. Queries are
266
266
  * serialized; this is the documented single-writer model.
267
267
  */
268
268
  export class SqlitePool {
269
- /** The underlying `node:sqlite` handle — exposed as an escape hatch (seed/DDL). */
269
+ /** The underlying `node:sqlite` handle, exposed as an escape hatch (seed/DDL). */
270
270
  db;
271
271
  closed = false;
272
272
  constructor(db) {
@@ -286,7 +286,7 @@ export class SqlitePool {
286
286
  return runStatement(db, sql, params);
287
287
  },
288
288
  release: () => {
289
- // Single shared connection — nothing to return to a pool.
289
+ // Single shared connection, nothing to return to a pool.
290
290
  },
291
291
  };
292
292
  }
@@ -349,7 +349,7 @@ function sqliteColumnAffinity(type) {
349
349
  return 'TEXT';
350
350
  }
351
351
  // ---------------------------------------------------------------------------
352
- // sqliteDialect — the full Dialect contract for SQLite
352
+ // sqliteDialect, the full Dialect contract for SQLite
353
353
  // ---------------------------------------------------------------------------
354
354
  /**
355
355
  * SQLite implementation of the {@link Dialect} contract. Standardizes on `"…"`
@@ -386,7 +386,7 @@ export const sqliteDialect = {
386
386
  jsonPathSupport: 'function',
387
387
  emptyJsonArrayLiteral: "json('[]')",
388
388
  nullJsonLiteral: 'NULL',
389
- // Named placeholders (`:p1`, `:p2`, …) — NOT positional `?`. Turbine pushes
389
+ // Named placeholders (`:p1`, `:p2`, …), NOT positional `?`. Turbine pushes
390
390
  // params in 1-indexed generation order but may EMIT them in a different SQL
391
391
  // text position (e.g. a `with`-relation LIMIT lands in the SELECT list, ahead
392
392
  // of the outer WHERE). Postgres reconciles this via numbered `$N`; positional
@@ -418,6 +418,37 @@ export const sqliteDialect = {
418
418
  wrapJsonSubresult(subquery, fallback) {
419
419
  return `COALESCE(json((${subquery})), ${fallback})`;
420
420
  },
421
+ jsonWireRule(columnType) {
422
+ // SQLite's storage classes, as introspection records them.
423
+ const t = columnType.toUpperCase();
424
+ // INTEGER is 64-bit, and `json_object` renders it as a JSON number, which
425
+ // is an IEEE double: 9007199254740993 came back through a `with` join as
426
+ // …992 while a top-level read and the batched loader both returned the
427
+ // exact decimal string. Carry the text and re-apply the SAME safe-integer
428
+ // policy `normalizeValue` applies to the driver's bigint, so all three
429
+ // paths agree for both small and large values.
430
+ if (t.includes('INT')) {
431
+ return {
432
+ sql: (ref) => `CAST(${ref} AS TEXT)`,
433
+ decode: (value) => {
434
+ if (typeof value !== 'string' || !/^-?\d+$/.test(value))
435
+ return value;
436
+ const asNumber = Number(value);
437
+ return Number.isSafeInteger(asNumber) ? asNumber : value;
438
+ },
439
+ };
440
+ }
441
+ // A BLOB cannot go into JSON at all: SQLite raises "JSON cannot hold BLOB
442
+ // values" and the whole query fails with a raw SQL logic error, where the
443
+ // batched loader returns the row fine. Carry hex and rebuild the bytes.
444
+ if (t.includes('BLOB')) {
445
+ return {
446
+ sql: (ref) => `hex(${ref})`,
447
+ decode: (value) => (typeof value === 'string' ? Uint8Array.from(Buffer.from(value, 'hex')) : value),
448
+ };
449
+ }
450
+ return undefined;
451
+ },
421
452
  castAggregate(expr, target) {
422
453
  return `CAST(${expr} AS ${target === 'int' ? 'INTEGER' : 'REAL'})`;
423
454
  },
@@ -438,7 +469,7 @@ export const sqliteDialect = {
438
469
  `VALUES (${input.valuePlaceholders.join(', ')})${this.buildReturningClause(input.returning)}`);
439
470
  },
440
471
  buildBulkInsertStatement(input) {
441
- // No UNNEST in SQLite — emit multi-row VALUES with flattened, named
472
+ // No UNNEST in SQLite, emit multi-row VALUES with flattened, named
442
473
  // placeholders (`:p1`, `:p2`, …) matching the flat param order.
443
474
  let n = 0;
444
475
  const placeholders = input.rowValues
@@ -461,12 +492,12 @@ export const sqliteDialect = {
461
492
  this.buildReturningClause(input.returning));
462
493
  },
463
494
  buildInsensitiveLike(column, paramRef) {
464
- // COLLATE NOCASE is ASCII-only (no Unicode case folding) — documented limit.
495
+ // COLLATE NOCASE is ASCII-only (no Unicode case folding), documented limit.
465
496
  return `${column} LIKE ${paramRef} COLLATE NOCASE`;
466
497
  },
467
498
  buildJsonContains(column, paramRef) {
468
499
  // Emulated containment: true when any top-level JSON value equals the param.
469
- // Limited vs Postgres `@>` (no deep/object containment) — jsonPathSupport='function'.
500
+ // Limited vs Postgres `@>` (no deep/object containment), jsonPathSupport='function'.
470
501
  return `EXISTS (SELECT 1 FROM json_each(${column}) WHERE json_each.value = ${paramRef})`;
471
502
  },
472
503
  buildJsonPathExtract(column, pathParamRef) {
@@ -547,7 +578,7 @@ export const sqliteDialect = {
547
578
  },
548
579
  };
549
580
  function pragma(db, sql) {
550
- // PRAGMA / SELECT against sqlite_master — read-only, identifiers are SQLite
581
+ // PRAGMA / SELECT against sqlite_master, read-only, identifiers are SQLite
551
582
  // catalog names (never user input here), values normalized for safe ints.
552
583
  return db.prepare(sql).all().map(normalizeRow);
553
584
  }
@@ -650,7 +681,7 @@ export function introspectSqliteDatabase(db, options = {}) {
650
681
  // ----- Build relations from foreign keys (belongsTo + hasMany + m2m) -----
651
682
  // Delegated to the SHARED introspection pipeline (introspect.ts) so SQLite
652
683
  // derives IDENTICAL relation names to the Postgres introspector for the
653
- // same logical schema — legacy-first naming, per-column disambiguation,
684
+ // same logical schema, legacy-first naming, per-column disambiguation,
654
685
  // collision resolution against scalar column fields, and the conservative
655
686
  // pure-junction manyToMany auto-detection included.
656
687
  const relationsByTable = deriveEngineRelations(tableNames, foreignKeys, pkByTable, columnsByTable);
@@ -732,7 +763,7 @@ function openSqliteDatabase(target, options) {
732
763
  db.exec('PRAGMA journal_mode = WAL');
733
764
  }
734
765
  catch {
735
- // Some filesystems (network mounts) reject WAL — fall back silently.
766
+ // Some filesystems (network mounts) reject WAL, fall back silently.
736
767
  }
737
768
  }
738
769
  return db;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * turbine-orm — Typed raw SQL (Turbine's answer to Prisma's TypedSQL)
2
+ * turbine-orm, Typed raw SQL (Turbine's answer to Prisma's TypedSQL)
3
3
  *
4
4
  * `client.raw()` returns untyped rows. This module adds a *typed* escape hatch:
5
5
  * a generic tagged template where the caller supplies the row shape, and the
@@ -9,13 +9,13 @@
9
9
  * Design goals & guarantees:
10
10
  *
11
11
  * 1. **Compile-time only types.** `T` is supplied by the caller and never
12
- * validated at runtime — exactly like Prisma's TypedSQL and the existing
12
+ * validated at runtime, exactly like Prisma's TypedSQL and the existing
13
13
  * `raw<T>()`. Postgres still returns whatever the SQL selects; the generic
14
14
  * is a convenience for autocomplete and downstream type-checking.
15
15
  *
16
16
  * 2. **Mandatory parameterization.** Only the *static* string segments of the
17
17
  * template literal ever reach the SQL text. Every interpolated `${value}`
18
- * becomes a `$N` placeholder and is passed in the params array — it is
18
+ * becomes a `$N` placeholder and is passed in the params array, it is
19
19
  * impossible to string-concatenate a value into the query through this API.
20
20
  * This is the whole point of the tagged-template shape: the literal segments
21
21
  * are frozen by the compiler (`TemplateStringsArray`), and the only way to
@@ -69,7 +69,7 @@ export declare function buildTypedSql(strings: TemplateStringsArray, values: rea
69
69
  * `await`ed directly to get `T[]`, or refined via `.one()` / `.scalar()` first.
70
70
  *
71
71
  * The query is executed lazily and exactly once per terminal call (`then`,
72
- * `one`, `scalar`). Each terminal method runs the query independently — this is
72
+ * `one`, `scalar`). Each terminal method runs the query independently, this is
73
73
  * an escape hatch, not a cached query object, so don't call two terminals on
74
74
  * the same builder expecting a single round-trip; build a fresh template each
75
75
  * time (the common pattern is `await db.sql\`...\`` inline).
package/dist/typed-sql.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * turbine-orm — Typed raw SQL (Turbine's answer to Prisma's TypedSQL)
2
+ * turbine-orm, Typed raw SQL (Turbine's answer to Prisma's TypedSQL)
3
3
  *
4
4
  * `client.raw()` returns untyped rows. This module adds a *typed* escape hatch:
5
5
  * a generic tagged template where the caller supplies the row shape, and the
@@ -9,13 +9,13 @@
9
9
  * Design goals & guarantees:
10
10
  *
11
11
  * 1. **Compile-time only types.** `T` is supplied by the caller and never
12
- * validated at runtime — exactly like Prisma's TypedSQL and the existing
12
+ * validated at runtime, exactly like Prisma's TypedSQL and the existing
13
13
  * `raw<T>()`. Postgres still returns whatever the SQL selects; the generic
14
14
  * is a convenience for autocomplete and downstream type-checking.
15
15
  *
16
16
  * 2. **Mandatory parameterization.** Only the *static* string segments of the
17
17
  * template literal ever reach the SQL text. Every interpolated `${value}`
18
- * becomes a `$N` placeholder and is passed in the params array — it is
18
+ * becomes a `$N` placeholder and is passed in the params array, it is
19
19
  * impossible to string-concatenate a value into the query through this API.
20
20
  * This is the whole point of the tagged-template shape: the literal segments
21
21
  * are frozen by the compiler (`TemplateStringsArray`), and the only way to
@@ -82,7 +82,7 @@ export function buildTypedSql(strings, values, dialect = postgresDialect) {
82
82
  * `await`ed directly to get `T[]`, or refined via `.one()` / `.scalar()` first.
83
83
  *
84
84
  * The query is executed lazily and exactly once per terminal call (`then`,
85
- * `one`, `scalar`). Each terminal method runs the query independently — this is
85
+ * `one`, `scalar`). Each terminal method runs the query independently, this is
86
86
  * an escape hatch, not a cached query object, so don't call two terminals on
87
87
  * the same builder expecting a single round-trip; build a fresh template each
88
88
  * time (the common pattern is `await db.sql\`...\`` inline).
@@ -114,7 +114,7 @@ export class TypedSqlQuery {
114
114
  /**
115
115
  * PromiseLike implementation: `await db.sql<T>\`...\`` resolves to `T[]`.
116
116
  */
117
- // biome-ignore lint/suspicious/noThenProperty: intentional thenable — this IS the PromiseLike contract that makes `await db.sql\`...\`` resolve to rows
117
+ // biome-ignore lint/suspicious/noThenProperty: intentional thenable, this IS the PromiseLike contract that makes `await db.sql\`...\`` resolve to rows
118
118
  then(onfulfilled, onrejected) {
119
119
  return this.run().then(onfulfilled, onrejected);
120
120
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "turbine-orm",
3
- "version": "0.50.0",
4
- "description": "Postgres-native TypeScript ORM — runs on Neon, Vercel Postgres, Cloudflare, Supabase. Streaming cursors, typed errors, single-query nested relations. One dependency, no WASM engine",
3
+ "version": "0.51.0",
4
+ "description": "Postgres-native TypeScript ORM, runs on Neon, Vercel Postgres, Cloudflare, Supabase. Streaming cursors, typed errors, single-query nested relations. One dependency, no WASM engine",
5
5
  "type": "module",
6
6
  "//exports": "Each subpath declares its types PER CONDITION. A single shared top-level \"types\" resolves to the ESM declarations for `require` too, which is TS1479 (\"is an ES module ... cannot be require()d\") for any CJS consumer on moduleResolution node16/nodenext. The require condition points at dist/cjs, which ships its own {\"type\":\"commonjs\"} package.json, so those declarations are CJS declarations. Gated in CI by publint + @arethetypeswrong/cli + a real .cts consumer typecheck (see the package-types job in ci.yml).",
7
7
  "exports": {