litedbmodel 2.0.2 → 2.2.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 (193) hide show
  1. package/README.md +7 -0
  2. package/dist/DBConditions.d.ts.map +1 -1
  3. package/dist/DBConditions.js +16 -1
  4. package/dist/DBConditions.js.map +1 -1
  5. package/dist/DBHandler.d.ts.map +1 -1
  6. package/dist/DBHandler.js +6 -0
  7. package/dist/DBHandler.js.map +1 -1
  8. package/dist/DBModel.d.ts +84 -2
  9. package/dist/DBModel.d.ts.map +1 -1
  10. package/dist/DBModel.js +312 -29
  11. package/dist/DBModel.js.map +1 -1
  12. package/dist/decorators.d.ts +52 -0
  13. package/dist/decorators.d.ts.map +1 -1
  14. package/dist/decorators.js +127 -24
  15. package/dist/decorators.js.map +1 -1
  16. package/dist/drivers/mysql.d.ts.map +1 -1
  17. package/dist/drivers/mysql.js +12 -2
  18. package/dist/drivers/mysql.js.map +1 -1
  19. package/dist/drivers/postgres.d.ts.map +1 -1
  20. package/dist/drivers/postgres.js +13 -2
  21. package/dist/drivers/postgres.js.map +1 -1
  22. package/dist/drivers/sqlite.d.ts +2 -0
  23. package/dist/drivers/sqlite.d.ts.map +1 -1
  24. package/dist/drivers/sqlite.js +49 -4
  25. package/dist/drivers/sqlite.js.map +1 -1
  26. package/dist/index.cjs +10741 -0
  27. package/dist/index.d.cts +1 -0
  28. package/dist/scp/coltype.d.ts +108 -0
  29. package/dist/scp/coltype.d.ts.map +1 -1
  30. package/dist/scp/coltype.js +293 -6
  31. package/dist/scp/coltype.js.map +1 -1
  32. package/dist/scp/connection-routing.d.ts +312 -0
  33. package/dist/scp/connection-routing.d.ts.map +1 -0
  34. package/dist/scp/connection-routing.js +394 -0
  35. package/dist/scp/connection-routing.js.map +1 -0
  36. package/dist/scp/dbmodel-runtime.d.ts +101 -0
  37. package/dist/scp/dbmodel-runtime.d.ts.map +1 -0
  38. package/dist/scp/dbmodel-runtime.js +174 -0
  39. package/dist/scp/dbmodel-runtime.js.map +1 -0
  40. package/dist/scp/decorator-adapter.d.ts +196 -0
  41. package/dist/scp/decorator-adapter.d.ts.map +1 -0
  42. package/dist/scp/decorator-adapter.js +286 -0
  43. package/dist/scp/decorator-adapter.js.map +1 -0
  44. package/dist/scp/emit/emitter.d.ts +108 -0
  45. package/dist/scp/emit/emitter.d.ts.map +1 -0
  46. package/dist/scp/emit/emitter.js +782 -0
  47. package/dist/scp/emit/emitter.js.map +1 -0
  48. package/dist/scp/emit/endpoint.d.ts +248 -0
  49. package/dist/scp/emit/endpoint.d.ts.map +1 -0
  50. package/dist/scp/emit/endpoint.js +20 -0
  51. package/dist/scp/emit/endpoint.js.map +1 -0
  52. package/dist/scp/emit/index.d.ts +11 -0
  53. package/dist/scp/emit/index.d.ts.map +1 -0
  54. package/dist/scp/emit/index.js +13 -0
  55. package/dist/scp/emit/index.js.map +1 -0
  56. package/dist/scp/errors.d.ts +45 -1
  57. package/dist/scp/errors.d.ts.map +1 -1
  58. package/dist/scp/errors.js +47 -1
  59. package/dist/scp/errors.js.map +1 -1
  60. package/dist/scp/exec-context.d.ts +390 -0
  61. package/dist/scp/exec-context.d.ts.map +1 -0
  62. package/dist/scp/exec-context.js +540 -0
  63. package/dist/scp/exec-context.js.map +1 -0
  64. package/dist/scp/grouping.d.ts +32 -0
  65. package/dist/scp/grouping.d.ts.map +1 -0
  66. package/dist/scp/grouping.js +0 -0
  67. package/dist/scp/grouping.js.map +1 -0
  68. package/dist/scp/index.cjs +6432 -17579
  69. package/dist/scp/index.d.cts +1 -0
  70. package/dist/scp/index.d.mts +1 -0
  71. package/dist/scp/index.d.ts +51 -52
  72. package/dist/scp/index.d.ts.map +1 -1
  73. package/dist/scp/index.js +189 -152
  74. package/dist/scp/index.js.map +1 -1
  75. package/dist/scp/index.mjs +6067 -3659
  76. package/dist/scp/leaf-transport.d.ts +50 -0
  77. package/dist/scp/leaf-transport.d.ts.map +1 -0
  78. package/dist/scp/leaf-transport.js +92 -0
  79. package/dist/scp/leaf-transport.js.map +1 -0
  80. package/dist/scp/leaves.d.ts +174 -0
  81. package/dist/scp/leaves.d.ts.map +1 -0
  82. package/dist/scp/leaves.js +287 -0
  83. package/dist/scp/leaves.js.map +1 -0
  84. package/dist/scp/limit-config.d.ts +118 -0
  85. package/dist/scp/limit-config.d.ts.map +1 -0
  86. package/dist/scp/limit-config.js +126 -0
  87. package/dist/scp/limit-config.js.map +1 -0
  88. package/dist/scp/makesql/compile-relation.d.ts +49 -23
  89. package/dist/scp/makesql/compile-relation.d.ts.map +1 -1
  90. package/dist/scp/makesql/compile-relation.js +101 -76
  91. package/dist/scp/makesql/compile-relation.js.map +1 -1
  92. package/dist/scp/makesql/compile-select.d.ts +45 -10
  93. package/dist/scp/makesql/compile-select.d.ts.map +1 -1
  94. package/dist/scp/makesql/compile-select.js +50 -10
  95. package/dist/scp/makesql/compile-select.js.map +1 -1
  96. package/dist/scp/makesql/handler.d.ts +1 -1
  97. package/dist/scp/makesql/handler.d.ts.map +1 -1
  98. package/dist/scp/makesql/index.d.ts +7 -10
  99. package/dist/scp/makesql/index.d.ts.map +1 -1
  100. package/dist/scp/makesql/index.js +19 -30
  101. package/dist/scp/makesql/index.js.map +1 -1
  102. package/dist/scp/makesql/json-array.d.ts +65 -0
  103. package/dist/scp/makesql/json-array.d.ts.map +1 -1
  104. package/dist/scp/makesql/json-array.js +99 -10
  105. package/dist/scp/makesql/json-array.js.map +1 -1
  106. package/dist/scp/makesql/json-batch.d.ts.map +1 -1
  107. package/dist/scp/makesql/json-batch.js +21 -19
  108. package/dist/scp/makesql/json-batch.js.map +1 -1
  109. package/dist/scp/makesql/makesql.d.ts +1 -1
  110. package/dist/scp/makesql/makesql.d.ts.map +1 -1
  111. package/dist/scp/makesql/mysql-returning.d.ts +93 -0
  112. package/dist/scp/makesql/mysql-returning.d.ts.map +1 -0
  113. package/dist/scp/makesql/mysql-returning.js +215 -0
  114. package/dist/scp/makesql/mysql-returning.js.map +1 -0
  115. package/dist/scp/makesql/outtype.d.ts +75 -34
  116. package/dist/scp/makesql/outtype.d.ts.map +1 -1
  117. package/dist/scp/makesql/outtype.js +91 -118
  118. package/dist/scp/makesql/outtype.js.map +1 -1
  119. package/dist/scp/makesql/pool-executor.d.ts +135 -13
  120. package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
  121. package/dist/scp/makesql/pool-executor.js +229 -21
  122. package/dist/scp/makesql/pool-executor.js.map +1 -1
  123. package/dist/scp/makesql/tx.d.ts +107 -22
  124. package/dist/scp/makesql/tx.d.ts.map +1 -1
  125. package/dist/scp/makesql/tx.js +451 -97
  126. package/dist/scp/makesql/tx.js.map +1 -1
  127. package/dist/scp/makesql/writeouttype.d.ts +7 -8
  128. package/dist/scp/makesql/writeouttype.d.ts.map +1 -1
  129. package/dist/scp/makesql/writeouttype.js +8 -7
  130. package/dist/scp/makesql/writeouttype.js.map +1 -1
  131. package/dist/scp/middleware.d.ts +287 -0
  132. package/dist/scp/middleware.d.ts.map +1 -0
  133. package/dist/scp/middleware.js +358 -0
  134. package/dist/scp/middleware.js.map +1 -0
  135. package/dist/scp/relation.d.ts +80 -9
  136. package/dist/scp/relation.d.ts.map +1 -1
  137. package/dist/scp/relation.js +198 -78
  138. package/dist/scp/relation.js.map +1 -1
  139. package/dist/scp/tx-options.d.ts +136 -0
  140. package/dist/scp/tx-options.d.ts.map +1 -0
  141. package/dist/scp/tx-options.js +184 -0
  142. package/dist/scp/tx-options.js.map +1 -0
  143. package/dist/scp/write-bundle.d.ts +131 -0
  144. package/dist/scp/write-bundle.d.ts.map +1 -0
  145. package/dist/scp/write-bundle.js +160 -0
  146. package/dist/scp/write-bundle.js.map +1 -0
  147. package/dist/types.d.ts +7 -0
  148. package/dist/types.d.ts.map +1 -1
  149. package/dist/types.js.map +1 -1
  150. package/docs/BENCHMARK.md +58 -56
  151. package/docs/benchmark-chart.svg +166 -166
  152. package/docs/design/phase-a-execution-context.md +139 -0
  153. package/package.json +16 -9
  154. package/dist/scp/authoring-sql.d.ts +0 -134
  155. package/dist/scp/authoring-sql.d.ts.map +0 -1
  156. package/dist/scp/authoring-sql.js +0 -191
  157. package/dist/scp/authoring-sql.js.map +0 -1
  158. package/dist/scp/authoring.d.ts +0 -155
  159. package/dist/scp/authoring.d.ts.map +0 -1
  160. package/dist/scp/authoring.js +0 -162
  161. package/dist/scp/authoring.js.map +0 -1
  162. package/dist/scp/catalog.d.ts +0 -94
  163. package/dist/scp/catalog.d.ts.map +0 -1
  164. package/dist/scp/catalog.js +0 -234
  165. package/dist/scp/catalog.js.map +0 -1
  166. package/dist/scp/codegen.d.ts +0 -189
  167. package/dist/scp/codegen.d.ts.map +0 -1
  168. package/dist/scp/codegen.js +0 -421
  169. package/dist/scp/codegen.js.map +0 -1
  170. package/dist/scp/find-filter-guard.d.ts +0 -68
  171. package/dist/scp/find-filter-guard.d.ts.map +0 -1
  172. package/dist/scp/find-filter-guard.js +0 -88
  173. package/dist/scp/find-filter-guard.js.map +0 -1
  174. package/dist/scp/guard.d.ts +0 -43
  175. package/dist/scp/guard.d.ts.map +0 -1
  176. package/dist/scp/guard.js +0 -134
  177. package/dist/scp/guard.js.map +0 -1
  178. package/dist/scp/makesql/authoring-compile.d.ts +0 -90
  179. package/dist/scp/makesql/authoring-compile.d.ts.map +0 -1
  180. package/dist/scp/makesql/authoring-compile.js +0 -494
  181. package/dist/scp/makesql/authoring-compile.js.map +0 -1
  182. package/dist/scp/makesql/ir.d.ts +0 -42
  183. package/dist/scp/makesql/ir.d.ts.map +0 -1
  184. package/dist/scp/makesql/ir.js +0 -66
  185. package/dist/scp/makesql/ir.js.map +0 -1
  186. package/dist/scp/makesql/static-bundle.d.ts +0 -187
  187. package/dist/scp/makesql/static-bundle.d.ts.map +0 -1
  188. package/dist/scp/makesql/static-bundle.js +0 -1113
  189. package/dist/scp/makesql/static-bundle.js.map +0 -1
  190. package/dist/scp/runtime.d.ts +0 -242
  191. package/dist/scp/runtime.d.ts.map +0 -1
  192. package/dist/scp/runtime.js +0 -400
  193. package/dist/scp/runtime.js.map +0 -1
@@ -16,6 +16,12 @@
16
16
  * MySQL/SQLite `SELECT … FROM t WHERE (k1, k2) IN ((?, ?), …)`
17
17
  * composite-key, per-parent limit: PG LATERAL composite / others ROW_NUMBER composite.
18
18
  *
19
+ * The STATIC composite forms ({@link compileCompositeKeyStaticUnlimited} /
20
+ * {@link compileCompositeKeyStaticLimited}) deviate from those v1 texts on EVERY dialect: they bind
21
+ * the key set as ONE array-of-tuples param (RESULT parity, not byte-identity) so a composite batch
22
+ * rides the same three-leaf transport as everything else. The v1 texts stay proven by the
23
+ * value-expanding builders below.
24
+ *
19
25
  * The PG type text (`?::type[]`) comes from the ORIGINAL `inferPgArrayType` (sqlCast
20
26
  * wins, else element-type inference). The .rs regressions are NOT reproduced: PG
21
27
  * per-parent-limit is LATERAL (not ROW_NUMBER), and PG types are sqlCast-driven (not
@@ -26,6 +32,7 @@
26
32
  */
27
33
  Object.defineProperty(exports, "__esModule", { value: true });
28
34
  exports.PG_ARRAY_CAST_TOKEN = void 0;
35
+ exports.inferPgElementType = inferPgElementType;
29
36
  exports.inferPgArrayType = inferPgArrayType;
30
37
  exports.resolvePgArrayCast = resolvePgArrayCast;
31
38
  exports.compileCompositeKeyStaticUnlimited = compileCompositeKeyStaticUnlimited;
@@ -35,30 +42,40 @@ exports.compileCompositeKeyUnlimited = compileCompositeKeyUnlimited;
35
42
  exports.compileCompositeKeyLimited = compileCompositeKeyLimited;
36
43
  exports.compileCompositeKeyStaticLimited = compileCompositeKeyStaticLimited;
37
44
  const DBConditions_1 = require("../../DBConditions");
45
+ const json_array_1 = require("./json-array");
38
46
  const compile_select_1 = require("./compile-select");
39
47
  /**
40
- * Reproduce the ORIGINAL `LazyRelation.inferPgArrayType`: sqlCast wins (`<cast>[]`);
41
- * otherwise infer the element type from the sample values. Byte-identical to the
42
- * original (which is the PG anchor — NOT the .rs coarse text-folding).
48
+ * The PG ELEMENT type of a value set — the ONE type inference every PG cast in this module is built
49
+ * on ({@link inferPgArrayType} appends `[]`; the composite key-row expansion casts each key column
50
+ * with it). Reproduces the ORIGINAL `LazyRelation.inferPgArrayType`'s element decision (the PG
51
+ * anchor — NOT the .rs coarse text-folding).
43
52
  */
44
- function inferPgArrayType(values, sqlCast) {
45
- if (sqlCast)
46
- return `${sqlCast}[]`;
53
+ function inferPgElementType(values) {
47
54
  if (values.length === 0)
48
- return 'text[]';
55
+ return 'text';
49
56
  const sample = values[0];
50
57
  if (typeof sample === 'number') {
51
58
  if (values.every((v) => Number.isInteger(v)))
52
- return 'int[]';
53
- return 'numeric[]';
59
+ return 'int';
60
+ return 'numeric';
54
61
  }
55
62
  if (typeof sample === 'bigint')
56
- return 'bigint[]';
63
+ return 'bigint';
57
64
  if (typeof sample === 'boolean')
58
- return 'boolean[]';
65
+ return 'boolean';
59
66
  if (sample instanceof Date)
60
- return 'timestamp[]';
61
- return 'text[]';
67
+ return 'timestamp';
68
+ return 'text';
69
+ }
70
+ /**
71
+ * Reproduce the ORIGINAL `LazyRelation.inferPgArrayType`: sqlCast wins (`<cast>[]`);
72
+ * otherwise infer the element type from the sample values. Byte-identical to the
73
+ * original (which is the PG anchor — NOT the .rs coarse text-folding).
74
+ */
75
+ function inferPgArrayType(values, sqlCast) {
76
+ if (sqlCast)
77
+ return `${sqlCast}[]`;
78
+ return `${inferPgElementType(values)}[]`;
62
79
  }
63
80
  /**
64
81
  * The DEFERRED PG array-cast token (#46): a placeholder emitted in the STATIC SQL text where
@@ -97,15 +114,50 @@ function pgArrayCastType(values, sqlCast, defer) {
97
114
  return exports.PG_ARRAY_CAST_TOKEN;
98
115
  return inferPgArrayType(values);
99
116
  }
117
+ /** The alias the PG composite key rows carry (`_keys.key0`, `_keys.key1`, … — one per key column). */
118
+ const PG_KEYS_ALIAS = '_keys';
119
+ /**
120
+ * The compile-time stand-in for the ONE array-of-tuples key param: the STATIC composite text is
121
+ * value-length-independent, so a single one-cell tuple fixes the param ARITY (1) and nothing else.
122
+ * The real deduped key tuples are bound at execute time against the same text.
123
+ */
124
+ const PLACEHOLDER_TUPLES = [[null]];
125
+ /**
126
+ * The PG composite key-set DERIVED TABLE: the ONE JSON array-of-tuples param (exactly what the
127
+ * `pluck` leaf yields, and exactly what MySQL/SQLite already bind) expanded SERVER-side into one
128
+ * typed row per key tuple — `key0 … keyN-1`, in `targetKeys` order.
129
+ *
130
+ * ONE `?`, fixed text, no per-column params: that is what lets a COMPOSITE relation ride the same
131
+ * three-leaf transport as every other statement (`pluck` → `executeSQL` → `group`) — the per-column
132
+ * `unnest(?::t1[], ?::t2[])` form needed a key-tuple TRANSPOSE that no composition of the three
133
+ * leaves can express (#159). `->>` yields text and the declared per-column cast normalizes it, so a
134
+ * key bound as a JSON number and one bound as a JSON string (a BIGINT read arrives as a string) both
135
+ * compare equal to the child column.
136
+ *
137
+ * The SINGLE spelling of the expansion — both static composite forms (unlimited JOIN + per-parent
138
+ * LATERAL) consume it, so their key rows cannot drift apart.
139
+ */
140
+ function pgCompositeKeyRows(opts) {
141
+ const cols = opts.targetKeys.map((key, i) => {
142
+ const type = opts.pgKeyTypes?.[i];
143
+ if (type === undefined || type === '') {
144
+ throw new Error(`relation batch on postgres: the composite key column '${opts.tableName}.${key}' has no declared type — ` +
145
+ `the key rows must be cast to the child column's type (pass the model's ColumnTypeResolver to compileRelationOp)`);
146
+ }
147
+ return `(_t->>${i})::${type} AS key${i}`;
148
+ });
149
+ return `(SELECT ${cols.join(', ')} FROM json_array_elements(?::json) AS _t) AS ${PG_KEYS_ALIAS}`;
150
+ }
100
151
  /**
101
152
  * The STATIC composite-key batch forms (#47 item 1) — length-INDEPENDENT so the compiled `op.sql`
102
- * is fixed (one param per column on PG; ONE JSON param on MySQL/SQLite), the SAME static-op
103
- * property the single-key relation forms have. PG stays byte-identical to v1's `unnest`-JOIN
104
- * (`batchLoadWithUnnestJoin`), with the element-type cast DEFERRED (#46) to render from the real
105
- * keys. MySQL/SQLite use the single-JSON tuple form (the owner-approved deviation the single-key
106
- * IN-list and the batch UPDATE composite already use — RESULT parity, NOT byte-identity): a
107
- * `JSON_TABLE`/`json_each` subquery over one JSON array-of-tuples param. The v1 literal
108
- * `(k1,k2) IN ((?,?),…)` byte-form stays proven by the golden `compileCompositeKeyUnlimited`.
153
+ * is fixed (ONE JSON array-of-tuples param on EVERY dialect), the SAME static-op property the
154
+ * single-key relation forms have. Every dialect now consumes the SAME single key param the relation
155
+ * key set is produced as (`pluck` — one array of key TUPLES): MySQL/SQLite expand it with
156
+ * `JSON_TABLE`/`json_each`, PostgreSQL with {@link pgCompositeKeyRows} (#159). This is the
157
+ * owner-approved deviation the single-key IN-list and the batch UPDATE composite already use —
158
+ * RESULT parity, NOT byte-identity with v1; the v1 literal `(k1,k2) IN ((?,?),…)` /
159
+ * `unnest(?::t1[], ?::t2[])` byte-forms stay proven by the goldens
160
+ * {@link compileCompositeKeyUnlimited} / {@link compileCompositeKeyLimited}.
109
161
  *
110
162
  * The JSON tuple param is `[[k1a,k2a],[k1b,k2b],…]` (positional element arrays), read back by
111
163
  * ordinal path (`$[0]`, `$[1]`, …) so no per-column JSON key names are needed.
@@ -113,31 +165,22 @@ function pgArrayCastType(values, sqlCast, defer) {
113
165
  function compileCompositeKeyStaticUnlimited(opts) {
114
166
  const { tableName, targetKeys } = opts;
115
167
  if (opts.dialect === 'postgres') {
116
- // PG unnest-JOIN — ONE array param per key column (length-independent). Deferred cast (#46):
117
- // the element type is resolved at render from the real per-column key arrays.
118
- const unnestParams = targetKeys
119
- .map((k) => `?::${pgArrayCastType([], opts.sqlCastMap?.get(k), opts.deferPgArrayCast)}`)
120
- .join(', ');
121
- const unnestAlias = `_unnest_${tableName}`;
122
- const columnAliases = targetKeys.map((k) => `_unnest_${tableName}_${k}`).join(', ');
123
- const joinConditions = targetKeys
124
- .map((key) => `${tableName}.${key} = ${unnestAlias}._unnest_${tableName}_${key}`)
125
- .join(' AND ');
126
- const joinClause = `JOIN unnest(${unnestParams}) AS ${unnestAlias}(${columnAliases}) ON ${joinConditions}`;
127
- // One placeholder array PER column fixes the arity of the JOIN params (each binds one array).
168
+ // PG: JOIN the child table to the typed key rows the ONE JSON tuple param expands to.
169
+ const joinConditions = targetKeys.map((key, i) => `${tableName}.${key} = ${PG_KEYS_ALIAS}.key${i}`).join(' AND ');
170
+ const joinClause = `JOIN ${pgCompositeKeyRows(opts)} ON ${joinConditions}`;
128
171
  return (0, compile_select_1.compileSelect)({
129
172
  dialect: opts.dialect,
130
173
  tableName,
131
174
  select: opts.select,
132
175
  join: joinClause,
133
- joinParams: targetKeys.map(() => [null]),
176
+ joinParams: [PLACEHOLDER_TUPLES],
134
177
  conditions: opts.conditions,
135
178
  order: opts.order,
136
179
  });
137
180
  }
138
181
  // MySQL/SQLite: composite membership via ONE JSON array-of-tuples param, read by ORDINAL path.
139
182
  const jsonSubquery = compositeJsonMembership(opts.dialect, tableName, targetKeys);
140
- const conditions = { ...opts.conditions, __raw__: [jsonSubquery, [[null]]] };
183
+ const conditions = { ...opts.conditions, __raw__: [jsonSubquery, PLACEHOLDER_TUPLES] };
141
184
  return (0, compile_select_1.compileSelect)({
142
185
  dialect: opts.dialect,
143
186
  tableName,
@@ -147,25 +190,12 @@ function compileCompositeKeyStaticUnlimited(opts) {
147
190
  });
148
191
  }
149
192
  /**
150
- * The MySQL/SQLite composite-membership predicate over ONE JSON array-of-tuples param (ordinal
151
- * paths). MySQL: `(k1,k2) IN (SELECT c0, c1 FROM JSON_TABLE(?, '$[*]' COLUMNS(c0 JSON PATH '$[0]',
152
- * …)))` — an IN-subquery so it inherits the SAME per-column type coercion `(k1,k2) IN ((?,?),…)`
153
- * would (the single-key rationale). SQLite: `EXISTS (SELECT 1 FROM json_each(?) je WHERE
154
- * json_extract(je.value,'$[0]') = t.k1 AND …)` — the composite json_each form the batch UPDATE uses.
193
+ * The MySQL/SQLite composite-membership predicate over ONE JSON array-of-tuples param — the SAME text
194
+ * a declared composite `tupleIn` WHERE emits, so it lives with the other static membership predicates
195
+ * ({@link import('./json-array').tupleInPredicate}) and is consumed here, never re-spelled.
155
196
  */
156
197
  function compositeJsonMembership(dialect, tableName, targetKeys) {
157
- if (dialect === 'mysql') {
158
- const cols = targetKeys.map((_, i) => `c${i}`);
159
- const jtCols = cols.map((c, i) => `${c} JSON PATH '$[${i}]'`).join(', ');
160
- const selectCols = cols.map((c) => `JSON_UNQUOTE(${c})`).join(', ');
161
- const keyTuple = targetKeys.map((k) => `${tableName}.${k}`).join(', ');
162
- return `(${keyTuple}) IN (SELECT ${selectCols} FROM JSON_TABLE(?, '$[*]' COLUMNS(${jtCols})) jt)`;
163
- }
164
- // SQLite: EXISTS over json_each, matching every key column by ordinal element.
165
- const match = targetKeys
166
- .map((k, i) => `json_extract(je.value, '$[${i}]') = ${tableName}.${k}`)
167
- .join(' AND ');
168
- return `EXISTS (SELECT 1 FROM json_each(?) je WHERE ${match})`;
198
+ return (0, json_array_1.tupleInPredicate)(dialect, tableName, targetKeys);
169
199
  }
170
200
  // ============================================================================
171
201
  // Single-key, unlimited.
@@ -357,36 +387,32 @@ function compileCompositeKeyLimited(opts) {
357
387
  /**
358
388
  * The STATIC composite-key per-parent-LIMIT batch form (#47 last completeness gap) — the
359
389
  * length-INDEPENDENT sibling of {@link compileCompositeKeyLimited}, so the compiled `op.sql` is
360
- * FIXED (one array param per key column on PG; ONE JSON array-of-tuples param on MySQL/SQLite) and
361
- * can be a STATIC bundle op — exactly the property {@link compileSingleKeyLimited} and
362
- * {@link compileCompositeKeyStaticUnlimited} already have.
390
+ * FIXED (ONE JSON array-of-tuples param on every dialect) and can be a STATIC bundle op — exactly
391
+ * the property {@link compileSingleKeyLimited} and {@link compileCompositeKeyStaticUnlimited}
392
+ * already have.
363
393
  *
364
- * The per-parent window is IDENTICAL to the single-key-limited path:
365
- * - **PG**: `CROSS JOIN LATERAL` over `unnest(?::t1[], ?::t2[])` — BYTE-identical to v1's
366
- * `batchLoadWithLateralComposite` (the composite LATERAL is already structurally
367
- * length-independent; only the element-type cast was value-derived, and that is DEFERRED (#46)
368
- * to render from the real keys via {@link PG_ARRAY_CAST_TOKEN}). No deviation on PG.
394
+ * The per-parent window is IDENTICAL to the single-key-limited path, over the SAME single key param:
395
+ * - **PG**: `CROSS JOIN LATERAL` over the typed key rows of {@link pgCompositeKeyRows} — v1's
396
+ * `batchLoadWithLateralComposite` window verbatim, with its per-column `unnest(?::t1[], ?::t2[])`
397
+ * key source replaced by the single-JSON-tuple expansion (#159), so the key set binds as the ONE
398
+ * array `pluck` yields.
369
399
  * - **MySQL/SQLite**: the SAME `ROW_NUMBER() OVER (PARTITION BY <keys> ORDER BY <order>)` CTE +
370
400
  * `_rn <= limit` filter v1's `batchLoadWithRowNumberComposite` emits — but the CTE membership
371
401
  * WHERE is the STATIC JSON-tuple predicate ({@link compositeJsonMembership}) instead of v1's
372
- * value-dependent `(k1,k2) IN ((?,?),…)`. This is the owner-sanctioned static deviation the
373
- * composite UNLIMITED form ({@link compileCompositeKeyStaticUnlimited}) and the single-key
374
- * IN-list already use: the JSON subquery selects the SAME child rows the tuple-IN would, the
375
- * window partitions/orders identically, so it is RESULT-parity to v1 (proven live). The v1
376
- * literal `(k1,k2) IN ((?,?),…)` byte-form stays proven by the golden
377
- * {@link compileCompositeKeyLimited}.
402
+ * value-dependent `(k1,k2) IN ((?,?),…)`.
403
+ *
404
+ * Both are the owner-sanctioned static deviation the composite UNLIMITED form
405
+ * ({@link compileCompositeKeyStaticUnlimited}) and the single-key IN-list already use: the key rows
406
+ * select the SAME child rows the value-expanded form would and the window partitions/orders
407
+ * identically, so it is RESULT-parity to v1 (proven live). The v1 byte-forms stay proven by the
408
+ * golden {@link compileCompositeKeyLimited}.
378
409
  */
379
410
  function compileCompositeKeyStaticLimited(opts) {
380
411
  const { tableName, targetKeys, limit } = opts;
381
412
  if (opts.dialect === 'postgres') {
382
- // PG LATERAL composite — ONE array param per key column (length-independent). Deferred cast
383
- // (#46): each element type resolved at render from that column's real key array.
384
- const unnestParams = targetKeys
385
- .map((k) => `?::${pgArrayCastType([], opts.sqlCastMap?.get(k), opts.deferPgArrayCast)}`)
386
- .join(', ');
387
- const keyAliases = targetKeys.map((_, i) => `key${i}`).join(', ');
413
+ // PG LATERAL composite — the per-parent window over the ONE JSON tuple param's typed key rows.
388
414
  const keyConditions = targetKeys
389
- .map((key, i) => `${tableName}.${key} = _keys.key${i}`)
415
+ .map((key, i) => `${tableName}.${key} = ${PG_KEYS_ALIAS}.key${i}`)
390
416
  .join(' AND ');
391
417
  const lateralConditions = { __raw__: keyConditions, ...opts.conditions };
392
418
  const inner = (0, compile_select_1.compileSelect)({
@@ -396,17 +422,16 @@ function compileCompositeKeyStaticLimited(opts) {
396
422
  order: opts.order,
397
423
  limit,
398
424
  });
399
- const sql = `SELECT ${tableName}.* FROM unnest(${unnestParams}) AS _keys(${keyAliases}) ` +
425
+ const sql = `SELECT ${tableName}.* FROM ${pgCompositeKeyRows(opts)} ` +
400
426
  `CROSS JOIN LATERAL (${inner.sql}) ${tableName}`;
401
- // One placeholder array PER column fixes the arity (each binds one array param at execute time).
402
- return { sql, params: [...targetKeys.map(() => [null]), ...inner.params] };
427
+ return { sql, params: [PLACEHOLDER_TUPLES, ...inner.params] };
403
428
  }
404
429
  // MySQL/SQLite: the SAME ROW_NUMBER composite CTE + `_rn <= limit` as v1, but with the STATIC
405
430
  // JSON-membership WHERE (one JSON array-of-tuples param) in place of v1's `(k1,k2) IN ((?,?),…)`.
406
431
  const orderBy = opts.order || targetKeys.join(', ');
407
432
  const partitionBy = targetKeys.join(', ');
408
433
  const jsonSubquery = compositeJsonMembership(opts.dialect, tableName, targetKeys);
409
- const cteConditions = { __raw__: [jsonSubquery, [[null]]], ...opts.conditions };
434
+ const cteConditions = { __raw__: [jsonSubquery, PLACEHOLDER_TUPLES], ...opts.conditions };
410
435
  const cte = (0, compile_select_1.compileSelect)({
411
436
  dialect: opts.dialect,
412
437
  tableName,
@@ -1 +1 @@
1
- {"version":3,"file":"compile-relation.js","sourceRoot":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,WAAW,aAAa,OAAO,UAAU;QACvF,UAAU,EAAE,aAAa;KAC1B,CAAC,CAAC;IACH,OAAO,IAAA,8BAAa,EAAC;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,EAAE,OAAO,EAAE,UAAU,KAAK,EAAE,EAAE;QAC1C,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;KAC1D,CAAC,CAAC;AACL,CAAC;AAED,6FAA6F;AAC7F,KAAK,2BAAY,CAAC"}
@@ -3,21 +3,57 @@
3
3
  * `DBModel._buildSelectSQL` text byte-for-byte (the internal builder `find()` uses):
4
4
  *
5
5
  * [WITH <cte> AS (…) ]SELECT <cols> FROM <t>[ <join>][ WHERE <cond>]
6
- * [ GROUP BY <group>][ ORDER BY <order>][ LIMIT <n>][ OFFSET <n>][ FOR UPDATE][ <append>]
6
+ * [ GROUP BY <group>][ ORDER BY <order>][ LIMIT <n>][ OFFSET <n>][ <row lock>][ <append>]
7
7
  *
8
- * LIMIT/OFFSET are INLINE literals (`LIMIT 10`), NOT parameters — the original inlines
9
- * them (`sql += \` LIMIT ${options.limit}\``); reproduced here. FOR UPDATE / GROUP BY /
10
- * raw `append` tail are the original's exact text. HAVING is carried through `append`
11
- * (v1 core has no dedicated HAVING; the .rs-only HAVING is not the PG anchor).
8
+ * A STATIC LIMIT/OFFSET is an INLINE literal (`LIMIT 10`), NOT a parameter — the original
9
+ * inlines it (`sql += \` LIMIT ${options.limit}\``); reproduced here byte-for-byte. A page
10
+ * whose POSITION is a runtime value binds instead ({@link BoundCount} → `LIMIT ?`), which is
11
+ * the same `{sql, params}` bundle with one more `?`. The row-lock tail ({@link lockTail} —
12
+ * ` FOR UPDATE` / ` FOR SHARE`), GROUP BY and the raw `append` tail are the original's exact
13
+ * text. HAVING is carried through `append` (v1 core has no dedicated HAVING; the .rs-only
14
+ * HAVING is not the PG anchor).
12
15
  *
13
- * Param order matches the original exactly: CTE params → JOIN params → WHERE params.
16
+ * Param order matches the original exactly: CTE params → JOIN params → WHERE params, then
17
+ * the tail's own bound counts (LIMIT then OFFSET) — the order their `?`s occupy in the text.
14
18
  */
15
19
  import type { ConditionObject } from '../../DBConditions';
16
20
  import type { OrderSpec } from '../../Column';
17
21
  import type { MakeSQL } from './makesql';
18
22
  import type { Dialect } from './handler';
23
+ /**
24
+ * A LIMIT / OFFSET count BOUND as a parameter (` LIMIT ?`) instead of inlined (` LIMIT 10`).
25
+ *
26
+ * `bind` is the value that fills the placeholder — it joins the bundle's own `params` list at the
27
+ * slot its `?` occupies, exactly like every WHERE value, so the tail needs no vocabulary of its own.
28
+ * A caller that has no VALUE yet (the emitter, which binds a method PARAMETER) passes its parameter
29
+ * sentinel here and reads it back out of `params`.
30
+ */
31
+ export interface BoundCount {
32
+ bind: unknown;
33
+ }
34
+ /** The row-lock request a SELECT carries: an EXCLUSIVE (`FOR UPDATE`) or a SHARED (`FOR SHARE`) lock. */
35
+ export interface RowLockOptions {
36
+ /** Lock the selected rows EXCLUSIVELY — no other tx may read-for-update or write them. */
37
+ forUpdate?: boolean;
38
+ /** Lock the selected rows for SHARE — concurrent readers may share the lock, writers block. */
39
+ forShare?: boolean;
40
+ }
41
+ /**
42
+ * The row-lock tail (` FOR UPDATE` / ` FOR SHARE`, or `''`) — the SINGLE aggregation point both the
43
+ * v1 imperative builder (`DBModel._buildSelectSQL`) and {@link compileSelect} render their locking
44
+ * clause from, so the two texts cannot drift.
45
+ *
46
+ * The two modes are MUTUALLY EXCLUSIVE: SQL has no "lock the same rows both exclusively and shared"
47
+ * form, so requesting both is a hard error rather than a silent precedence (fail-closed — a caller
48
+ * that asked for a share lock must never silently get an exclusive one, or vice versa).
49
+ *
50
+ * SQLite parses NEITHER clause (they are the PG / MySQL locking clauses; SQLite serializes writers
51
+ * at the connection level instead), so a locking read is a PG / MySQL feature — the same split the
52
+ * ` FOR UPDATE` tail has always had, and the reason the SQLite conformance twin omits it.
53
+ */
54
+ export declare function lockTail(opts: RowLockOptions): string;
19
55
  /** SELECT descriptor — mirrors the fields `_buildSelectSQL` reads from `SelectOptions`. */
20
- export interface SelectDesc {
56
+ export interface SelectDesc extends RowLockOptions {
21
57
  dialect: Dialect;
22
58
  tableName: string;
23
59
  /** SELECT column list (an explicit `options.select`). Empty/absent → falls back to {@link selectColumn}. */
@@ -39,9 +75,8 @@ export interface SelectDesc {
39
75
  };
40
76
  group?: string;
41
77
  order?: OrderSpec | string;
42
- limit?: number;
43
- offset?: number;
44
- forUpdate?: boolean;
78
+ limit?: number | BoundCount;
79
+ offset?: number | BoundCount;
45
80
  append?: string;
46
81
  }
47
82
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"compile-select.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/compile-select.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,2FAA2F;AAC3F,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,4GAA4G;IAC5G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QA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B,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;IACvB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAoCvD"}
@@ -4,20 +4,53 @@
4
4
  * `DBModel._buildSelectSQL` text byte-for-byte (the internal builder `find()` uses):
5
5
  *
6
6
  * [WITH <cte> AS (…) ]SELECT <cols> FROM <t>[ <join>][ WHERE <cond>]
7
- * [ GROUP BY <group>][ ORDER BY <order>][ LIMIT <n>][ OFFSET <n>][ FOR UPDATE][ <append>]
7
+ * [ GROUP BY <group>][ ORDER BY <order>][ LIMIT <n>][ OFFSET <n>][ <row lock>][ <append>]
8
8
  *
9
- * LIMIT/OFFSET are INLINE literals (`LIMIT 10`), NOT parameters — the original inlines
10
- * them (`sql += \` LIMIT ${options.limit}\``); reproduced here. FOR UPDATE / GROUP BY /
11
- * raw `append` tail are the original's exact text. HAVING is carried through `append`
12
- * (v1 core has no dedicated HAVING; the .rs-only HAVING is not the PG anchor).
9
+ * A STATIC LIMIT/OFFSET is an INLINE literal (`LIMIT 10`), NOT a parameter — the original
10
+ * inlines it (`sql += \` LIMIT ${options.limit}\``); reproduced here byte-for-byte. A page
11
+ * whose POSITION is a runtime value binds instead ({@link BoundCount} → `LIMIT ?`), which is
12
+ * the same `{sql, params}` bundle with one more `?`. The row-lock tail ({@link lockTail} —
13
+ * ` FOR UPDATE` / ` FOR SHARE`), GROUP BY and the raw `append` tail are the original's exact
14
+ * text. HAVING is carried through `append` (v1 core has no dedicated HAVING; the .rs-only
15
+ * HAVING is not the PG anchor).
13
16
  *
14
- * Param order matches the original exactly: CTE params → JOIN params → WHERE params.
17
+ * Param order matches the original exactly: CTE params → JOIN params → WHERE params, then
18
+ * the tail's own bound counts (LIMIT then OFFSET) — the order their `?`s occupy in the text.
15
19
  */
16
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.lockTail = lockTail;
17
22
  exports.compileSelect = compileSelect;
18
23
  const Column_1 = require("../../Column");
19
24
  const compile_1 = require("./compile");
20
25
  const json_array_1 = require("./json-array");
26
+ /** Structural guard: a bound count is the `{bind}` wrapper; a static one is a plain number. */
27
+ function isBoundCount(c) {
28
+ return typeof c === 'object' && c !== null && 'bind' in c;
29
+ }
30
+ /**
31
+ * The row-lock tail (` FOR UPDATE` / ` FOR SHARE`, or `''`) — the SINGLE aggregation point both the
32
+ * v1 imperative builder (`DBModel._buildSelectSQL`) and {@link compileSelect} render their locking
33
+ * clause from, so the two texts cannot drift.
34
+ *
35
+ * The two modes are MUTUALLY EXCLUSIVE: SQL has no "lock the same rows both exclusively and shared"
36
+ * form, so requesting both is a hard error rather than a silent precedence (fail-closed — a caller
37
+ * that asked for a share lock must never silently get an exclusive one, or vice versa).
38
+ *
39
+ * SQLite parses NEITHER clause (they are the PG / MySQL locking clauses; SQLite serializes writers
40
+ * at the connection level instead), so a locking read is a PG / MySQL feature — the same split the
41
+ * ` FOR UPDATE` tail has always had, and the reason the SQLite conformance twin omits it.
42
+ */
43
+ function lockTail(opts) {
44
+ if (opts.forUpdate && opts.forShare) {
45
+ throw new Error(`scp select: 'forUpdate' and 'forShare' are mutually exclusive row locks — a SELECT locks its ` +
46
+ `rows either EXCLUSIVELY (FOR UPDATE) or SHARED (FOR SHARE), never both. Pick one.`);
47
+ }
48
+ if (opts.forUpdate)
49
+ return ' FOR UPDATE';
50
+ if (opts.forShare)
51
+ return ' FOR SHARE';
52
+ return '';
53
+ }
21
54
  /**
22
55
  * Compile a SELECT to a `makeSQL` bundle, byte-identical to `_buildSelectSQL`.
23
56
  * Empty WHERE ⇒ no ` WHERE` (matches the original's `if (whereClause)` guard).
@@ -45,12 +78,19 @@ function compileSelect(desc) {
45
78
  const orderClause = typeof desc.order === 'string' ? desc.order : (0, Column_1.orderToString)(desc.order);
46
79
  if (orderClause)
47
80
  sql += ` ORDER BY ${orderClause}`;
81
+ // The page tail: a static count is the original's inline literal; a bound one emits `?` and joins
82
+ // the value list HERE, after the WHERE params — the order the `?`s occupy in the finished text.
83
+ const count = (c) => {
84
+ if (!isBoundCount(c))
85
+ return String(c);
86
+ params.push(c.bind);
87
+ return '?';
88
+ };
48
89
  if (desc.limit !== undefined)
49
- sql += ` LIMIT ${desc.limit}`;
90
+ sql += ` LIMIT ${count(desc.limit)}`;
50
91
  if (desc.offset !== undefined)
51
- sql += ` OFFSET ${desc.offset}`;
52
- if (desc.forUpdate)
53
- sql += ' FOR UPDATE';
92
+ sql += ` OFFSET ${count(desc.offset)}`;
93
+ sql += lockTail(desc);
54
94
  if (desc.append)
55
95
  sql += ` ${desc.append}`;
56
96
  return { sql, params };
@@ -1 +1 @@
1
- {"version":3,"file":"compile-select.js","sourceRoot":"","sources":["../../../src/scp/makesql/compile-select.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAuCH,sCA6BC;AAjED,yCAA6C;AAG7C,uCAAyC;AACzC,6CAA6C;AA4B7C;;;GAGG;AACH,SAAgB,aAAa,CAAC,IAAgB;IAC5C,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAA,sBAAY,EAAC,IAAI,CAAC,OAAO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E,GAAG,IAAI,aAAa,WAAW,EAAE,CAAC;IAEnD,kGAAkG;IAClG,gGAAgG;IAChG,MAAM,KAAK,GAAG,CAAC,CAAsB,EAAU,EAAE;QAC/C,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;YAAE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IACF,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,IAAI,UAAU,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;IACnE,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,GAAG,IAAI,WAAW,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACtE,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtB,IAAI,IAAI,CAAC,MAAM;QAAE,GAAG,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAE1C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC;AACzB,CAAC"}
@@ -11,7 +11,7 @@
11
11
  * bc supplies composition / value-eval / envelope / plan; litedbmodel supplies only
12
12
  * this handler + the compile that emits the SQL text.
13
13
  */
14
- import type { Handler, HandlerCtx, Value } from 'behavior-contracts';
14
+ import type { Handler, HandlerCtx, Value } from 'behavior-contracts/runtime';
15
15
  import { type AssembledSql } from './makesql';
16
16
  /** A driver seam: run an already-rendered `{ sql, params }` and return result rows. */
17
17
  export type SqlExecutor = (sql: string, params: unknown[]) => Promise<Record<string, unknown>[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAo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WAAW,CAAC;AAE7E,uFAAuF;AACvF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;AACjG,qFAAqF;AACrF,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;AAE5F,iFAAiF;AACjF,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAoBxE;AAgBD,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,YAAY,CAIxF;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,IAClD,OAAO,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,UAAU;QACH,KAAK;GAK/D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAOnF"}
@@ -19,15 +19,12 @@ export { builderFor, compileInsert, compileInsertMany, compileUpdateMany, compil
19
19
  export type { InsertManyBuildOptions } from './compile-crud';
20
20
  export { inferPgArrayType, resolvePgArrayCast, PG_ARRAY_CAST_TOKEN, compileSingleKeyUnlimited, compileSingleKeyLimited, compileCompositeKeyUnlimited, compileCompositeKeyStaticUnlimited, compileCompositeKeyLimited, compileCompositeKeyStaticLimited, } from './compile-relation';
21
21
  export type { RelationCompileBase } from './compile-relation';
22
- export { inListJson, JsonArrayConditions, conditionsFor } from './json-array';
22
+ export { inListJson, inListPredicate, encodeJsonArrayParam, JsonArrayConditions, conditionsFor } from './json-array';
23
23
  export { mysqlInsertJson, sqliteInsertJson, mysqlUpdateManyJson, sqliteUpdateManyJson, mysqlJsonTableColumn, rowsHaveDbToken, } from './json-batch';
24
- export { makeSqlComponentIR, makeSqlInput } from './ir';
25
- export { deriveTransactionPlan, deriveBatchPlan, literalize, mysqlPkHint, stripMysqlPkHint, executeTransaction, countingDriver, renderTxStatement, compileWriteNode, IN_SENTINEL, } from './tx';
26
- export type { TxExpr, TxOp, StatementRole, GateRule, TxStatement, IdempotentHitPolicy, TransactionPlan, BaseWrite, SqliteDb, ShortCircuitReason, TransactionResult, } from './tx';
27
- export { compileAuthoredBehavior, compileAuthoredNode, compileRelationMap, } from './authoring-compile';
28
- export type { AuthoredMakeSQL, RelationMapInput } from './authoring-compile';
29
- export { compileStaticBundle, compileSelectNode, executeStaticBundle, executeStaticWrite, executeReadBehavior, compileReadGraph, executeReadGraph, executeReadGraphAsync, renderReadPrimary, } from './static-bundle';
30
- export type { StaticBundle, StaticStatement, ValueSpec, ReadGraph, SqlExecutorAsync } from './static-bundle';
31
- export { pgPoolExecutor, mysqlPoolExecutor } from './pool-executor';
32
- export type { PgPoolLike, MysqlPoolLike } from './pool-executor';
24
+ export { deriveTransactionPlan, deriveBatchPlan, literalize, executeTransaction, executeTransactionAsync, countingDriver, renderTxStatement, compileWriteNode, pgTypeSpecimen, IN_SENTINEL, } from './tx';
25
+ export { mysqlPkHint, stripMysqlPkHint, buildMysqlReselect, bindReselect } from './mysql-returning';
26
+ export type { MysqlReselect, ReselectBind } from './mysql-returning';
27
+ export type { TxExpr, TxOp, StatementRole, GateRule, TxStatement, IdempotentHitPolicy, TransactionPlan, BaseWrite, SqliteDb, ShortCircuitReason, TransactionResult, WriteExecOptions, } from './tx';
28
+ export { configurePgDeboxTypeParsers, mysqlDeboxPoolOptions, pgConnectionPool, mysqlConnectionPool, pgPoolFactory, mysqlPoolFactory } from './pool-executor';
29
+ export type { PgPoolLike, MysqlPoolLike, PgTypesLike, PgModuleLike, Mysql2ModuleLike, PgOwnedPoolLike, PgPoolClientLike, MysqlOwnedPoolLike, MysqlPoolConnLike, PgOwnedPoolWithEnd, MysqlOwnedPoolWithEnd, PgFactoryModuleLike } from './pool-executor';
33
30
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,2BAA2B,EAC3B,SAAS,EACT,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGvE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,E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iB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,2BAA2B,EAC3B,SAAS,EACT,eAAe,EACf,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,kBAAkB,GACnB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGvE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EACL,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAG7D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EAClC,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrH,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EAC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