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
@@ -1,234 +0,0 @@
1
- "use strict";
2
- /**
3
- * litedbmodel v2 SCP catalog — WS1 (#21).
4
- *
5
- * `LITEDBMODEL_CATALOG` is the behavior-contracts–typed `Catalog` that IS the whole
6
- * per-DSL difference litedbmodel supplies as a SQL-backend consumer (bc C2: "the only
7
- * per-DSL difference is the catalog"). It mirrors the SHAPE of graphddb's
8
- * `GRAPHDDB_CATALOG` (`src/spec/catalog.ts`) exactly: compact `PortSchema` constructors,
9
- * an `entry()` helper, per-primitive `inputPorts`, an `output.shape`, and a
10
- * `portableToIR` flag. The effect implementation (SQL execution + row→model assembly) is
11
- * bound separately in the handler registry (WS3, C4 — catalog declares, registry binds).
12
- *
13
- * ## Catalog names (spec §1 / §11 item 1)
14
- *
15
- * `Select` / `Insert` / `Update` / `Delete` are the CRUD leaf components. `Fragment` is
16
- * the dynamic WHERE/SET fragment-tree component (SKIP → fragment existence rules, §8);
17
- * `Tx` is the multi-statement transaction envelope. As in graphddb, the transaction
18
- * envelope (`Tx`) is `portableToIR: false` — a transaction is emitted as a Component
19
- * whose body references the per-statement CRUD primitives; the atomic BEGIN/COMMIT
20
- * envelope is the runtime's execution concern (WS3), never a portable-IR node.
21
- *
22
- * ## Port schema conventions
23
- *
24
- * A `CatalogEntry.inputPorts` names the STATIC ports of the emitted wiring. Two families
25
- * are dynamic by construction and are validated by {@link assertComponentsInCatalog}
26
- * against documented patterns instead of being statically enumerable:
27
- *
28
- * - **`where`/`set`/`values` records**: one port per model field, flattened one-port-
29
- * per-field under a `<group>.<field>` key ({@link WRITE_PORT_FAMILIES}). These carry
30
- * Expression IR (the field's value/condition), from the closed operator set only.
31
- *
32
- * The CRUD entries carry `additionalPorts: true` (bc#26) so bc's shared port check
33
- * (`checkPortNames` / `buildComponentDefinition`) accepts the dynamic families; every
34
- * DECLARED port keeps bc's required/type checks regardless of the opt-in. `Tx`'s single
35
- * port is static, so it keeps bc's fail-closed default.
36
- */
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.WRITE_PORT_FAMILIES = exports.WRITE_CATALOG_NAMES = exports.CATALOG_NAMES = exports.LITEDBMODEL_CATALOG = void 0;
39
- exports.catalogEntry = catalogEntry;
40
- exports.assertComponentsInCatalog = assertComponentsInCatalog;
41
- exports.deriveContractEffect = deriveContractEffect;
42
- const behavior_contracts_1 = require("behavior-contracts");
43
- // Compact schema constructors (the IR bundle is size-budgeted — graphddb convention).
44
- const P = (type, required) => (required ? { type, required } : { type });
45
- /**
46
- * The shared read-port surface for `Select`: `table` always; the optional
47
- * `where` (a fragment-tree reference — see `Fragment`), `order`, `limit`, `offset`,
48
- * `group` wiring, and the always-emitted `select` projection.
49
- *
50
- * `where` is typed `fragment` (not `expr`): a Select's dynamic WHERE is a fragment tree
51
- * (§8), NOT a single Expression — the SKIP existence rules live on the tree, outside the
52
- * Expression IR vocabulary (bc `expression-ir.md` §4: SKIP is OUTSIDE Expression IR).
53
- * `limit` / `offset` are `expr` (they may be an input-ref or a `coalesce` default, §8).
54
- */
55
- const SELECT_PORTS = {
56
- table: P('string', true),
57
- select: P('string[]', true),
58
- where: P('fragment'),
59
- order: P('string'),
60
- limit: P('expr'),
61
- offset: P('expr'),
62
- group: P('string'),
63
- // Additive read-tail/head ports (V0 R3/R4/R5/R6). SQL is v1-sourced from the matching
64
- // `SelectDesc` fields via `compileSelect` (`_buildSelectSQL`), wired in `compileSelectNode`:
65
- // - `forUpdate` (R3): a literal `'true'` string toggles the ` FOR UPDATE` tail.
66
- // - `join`/`joinParams` (R5): a literal JOIN clause text (`JOIN t ON …`) + its bound
67
- // value-specs (`expr[]`), spliced after `FROM <t>` (v1 `_buildSelectSQL` JOIN position).
68
- // - `cte`/`cteParams` (R4): a WITH-CTE `{name, sql}` literal + its bound value-specs,
69
- // prefixed as `WITH <name> AS (<sql>) ` (v1 WITH-wrap). `cteParams` bind FIRST (v1 param
70
- // order: CTE → JOIN → WHERE).
71
- // - `append` (R6): a raw trailing clause text (e.g. `HAVING …`) appended verbatim.
72
- forUpdate: P('string'),
73
- join: P('string'),
74
- joinParams: P('expr[]'),
75
- cte: P('map'),
76
- cteParams: P('expr[]'),
77
- append: P('string'),
78
- };
79
- /**
80
- * The shared write-port surface for `Insert`/`Update`/`Delete`: `table` always;
81
- * `where` (fragment tree — required existence enforced by the compiler, not here, since a
82
- * Select may legitimately omit it); `returning` projection; `onConflict` wiring for
83
- * Insert. The per-field value/set ports (`values.<field>` / `set.<field>`) are dynamic
84
- * ({@link WRITE_PORT_FAMILIES}) and each carries an Expression IR value.
85
- */
86
- const WRITE_PORTS = {
87
- table: P('string', true),
88
- where: P('fragment'),
89
- returning: P('string'),
90
- onConflict: P('string'),
91
- onConflictAction: P('string'),
92
- // PRIMARY KEY descriptor for the MySQL RETURNING emulation (INSERT…RETURNING): `pk` is a
93
- // comma-separated PK column list, `autoInc` names the single AUTO_INCREMENT column (absent for a
94
- // client-supplied PK). Consumed by compileWriteNode → mysqlPkHint so the emulation re-selects by
95
- // the REAL PK. Inert on PG/SQLite (native RETURNING).
96
- pk: P('string'),
97
- autoInc: P('string'),
98
- };
99
- const entry = (name, inputPorts, shape, portableToIR) => ({
100
- name,
101
- inputPorts,
102
- output: { shape },
103
- portableToIR,
104
- // Dynamic port families (where/set/values record ports) are validated by
105
- // assertComponentsInCatalog, not statically enumerable. Tx overrides back to
106
- // fail-closed (its one port is static).
107
- additionalPorts: true,
108
- });
109
- /**
110
- * litedbmodel's specific-component catalog (spec §11 item 1) — the behavior-contracts
111
- * `Catalog`-typed source of truth. Each entry declares the Port schema of one SQL
112
- * primitive AS THE BACKEND COMPILE WIRES IT; the effect implementation is bound
113
- * separately in the handler registry (WS3, C4). All entries except `Tx` may appear in
114
- * the portable IR.
115
- */
116
- exports.LITEDBMODEL_CATALOG = {
117
- // Read: `items` (a Select root yields a row list; per-row collapse to `item` is the
118
- // consumer's cardinality concern, mirrored from graphddb Query's `cardinality` port).
119
- Select: entry('Select', { ...SELECT_PORTS, cardinality: P('string') }, 'items', true),
120
- // COUNT(*) aggregate read (v1 `DBModel._count`): `SELECT COUNT(*) as count FROM t[ WHERE …]`.
121
- // Only `table` (required) + the optional `where` fragment tree — v1's count carries no
122
- // projection/order/limit/offset (it counts the filtered rows). Output is a one-row `[{count}]`
123
- // list (the `items` shape, like every read); the consumer reads `count` — v1's `parseInt(count)`.
124
- Count: entry('Count', { table: P('string', true), where: P('fragment') }, 'items', true),
125
- // Writes yield the RETURNING row list (`items`); a single-row write collapses at the
126
- // consumer boundary, same as reads.
127
- Insert: entry('Insert', WRITE_PORTS, 'items', true),
128
- Update: entry('Update', WRITE_PORTS, 'items', true),
129
- Delete: entry('Delete', WRITE_PORTS, 'items', true),
130
- // The dynamic WHERE/SET fragment-tree component (§8). Its ports carry the fragment
131
- // tree; the compiler resolves SKIP/AND-OR structure to fragment existence rules.
132
- Fragment: entry('Fragment', { tree: P('fragment', true) }, 'item', true),
133
- // The runtime-side atomic envelope: never referenced by the portable IR (a transaction
134
- // IS a component over the CRUD primitives) — runtime-only. Its single port is static,
135
- // so it keeps bc's fail-closed default (no additionalPorts opt-in).
136
- Tx: {
137
- ...entry('Tx', { statements: P('map[]', true) }, 'item', false),
138
- additionalPorts: false,
139
- },
140
- };
141
- /** Look up a catalog entry by name (undefined for an unknown primitive). */
142
- function catalogEntry(name) {
143
- return exports.LITEDBMODEL_CATALOG[name];
144
- }
145
- /** The catalog names litedbmodel declares (the C2 per-DSL surface). */
146
- exports.CATALOG_NAMES = [
147
- 'Select',
148
- 'Count',
149
- 'Insert',
150
- 'Update',
151
- 'Delete',
152
- 'Fragment',
153
- 'Tx',
154
- ];
155
- /**
156
- * The CQRS write catalog: the names whose presence in a component body makes the
157
- * component a COMMAND (spec §2.4 — effect is derived from the graph, not authored).
158
- * `Select`/`Fragment` are read-side; `Insert`/`Update`/`Delete`/`Tx` are write-side.
159
- */
160
- exports.WRITE_CATALOG_NAMES = [
161
- 'Insert',
162
- 'Update',
163
- 'Delete',
164
- 'Tx',
165
- ];
166
- const WRITE_SET = new Set(exports.WRITE_CATALOG_NAMES);
167
- /**
168
- * The dynamic per-field write-port families (`<group>.<field>` — the flattened record
169
- * convention; longest-prefix wins). A `values.<field>` (Insert) or `set.<field>`
170
- * (Update) port carries the field's Expression IR value; a `sqlCast.<field>` port carries
171
- * the field's PostgreSQL cast type (a literal string, e.g. `jsonb`/`uuid`/`int[]`) that drives
172
- * the v1 per-column `?::<sqlCast>` on Postgres (`DBModel._insert`/`_update`). `sqlCast.` ports are
173
- * INERT on MySQL/SQLite (v1's dialect-aware cast formatter is identity there).
174
- */
175
- exports.WRITE_PORT_FAMILIES = [
176
- 'values.',
177
- 'set.',
178
- 'sqlCast.',
179
- ];
180
- /**
181
- * The emitter's catalog validation (loud; a violation is a BUILD error), mirrored from
182
- * graphddb's `assertComponentsInCatalog`. Every `componentRef` / `map` body node of every
183
- * emitted component must:
184
- *
185
- * 1. reference a declared catalog name;
186
- * 2. wire every `required` port of that entry;
187
- * 3. wire ONLY declared ports — a port is declared if it is a static `inputPorts` name or
188
- * a write record-family port ({@link WRITE_PORT_FAMILIES}, write entries only).
189
- *
190
- * All violations are collected and thrown as one error. `cond` nodes carry no component
191
- * reference and are skipped.
192
- */
193
- function assertComponentsInCatalog(components) {
194
- const errs = [];
195
- for (const c of components) {
196
- for (const n of c.body) {
197
- if ('cond' in n)
198
- continue;
199
- const ref = 'map' in n ? n.map : n;
200
- const entryDef = exports.LITEDBMODEL_CATALOG[ref.component];
201
- if (entryDef === undefined) {
202
- errs.push(`${c.name}/${n.id}: references '${ref.component}', not a LITEDBMODEL_CATALOG entry (known: ${exports.CATALOG_NAMES.join(', ')})`);
203
- continue;
204
- }
205
- const ports = ref.ports;
206
- for (const [p, s] of Object.entries(entryDef.inputPorts)) {
207
- if (s.required === true && !(p in ports)) {
208
- errs.push(`${c.name}/${n.id} (${ref.component}): required port '${p}' is not wired`);
209
- }
210
- }
211
- const isWriteItem = WRITE_SET.has(ref.component);
212
- for (const p of Object.keys(ports)) {
213
- if (p in entryDef.inputPorts)
214
- continue;
215
- if (isWriteItem && exports.WRITE_PORT_FAMILIES.some((f) => p.startsWith(f)))
216
- continue;
217
- errs.push(`${c.name}/${n.id} (${ref.component}): port '${p}' is not declared by the catalog entry (nor a write record-family port)`);
218
- }
219
- }
220
- }
221
- if (errs.length > 0) {
222
- throw new Error(`litedbmodel catalog validation failed (${errs.length} violation${errs.length === 1 ? '' : 's'}):\n - ${errs.join('\n - ')}`);
223
- }
224
- }
225
- /**
226
- * Derive one component's Query/Command classification FROM THE GRAPH: behavior-contracts'
227
- * `classifyBehaviorEffect` over {@link WRITE_CATALOG_NAMES} — a component is a `'command'`
228
- * iff its body references a write-catalog primitive, else a `'query'` (spec §2.4: effect
229
- * is derived, never authored).
230
- */
231
- function deriveContractEffect(component) {
232
- return (0, behavior_contracts_1.classifyBehaviorEffect)(component, exports.WRITE_CATALOG_NAMES) === 'writing' ? 'command' : 'query';
233
- }
234
- //# sourceMappingURL=catalog.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/scp/catalog.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AA2HH,oCAEC;AAsDD,8DA4BC;AAYD,oDAEC;AA3ND,2DAA8H;AAiB9H,sFAAsF;AACtF,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,QAAe,EAAc,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;AAEpG;;;;;;;;;GASG;AACH,MAAM,YAAY,GAA+B;IAC/C,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC;IAC3B,KAAK,EAAE,CAAC,CAAC,UAA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,CAAC;AACpG,CAAC"}
@@ -1,189 +0,0 @@
1
- /**
2
- * litedbmodel v2 SCP — mode-3 codegen (WS7f, #35; spec §9 exec-mode 3 / §10 / §11; makeSQL flip,
3
- * epic #43/#45 Phase B; #60 milestone 1 — typed-NATIVE READ codegen, bc#77/#90).
4
- *
5
- * The static-codegen execution mode ("Codegen・静的(全言語)— IR → 各言語ソース生成 runtime≈0,
6
- * 入力は可搬IRのみ, bc#13 共有 generator に SQL catalog を供給" — spec §9). It takes a §8 STATIC
7
- * makeSQL {@link SqlBundle} and, per target language, emits:
8
- *
9
- * 1. **Behavior module** — bc's SHARED generator run over the bundle's portable IR through bc's
10
- * de-interpreted, RUNTIME-FREE emitter. For a READ bundle covered by bc's typed-NATIVE
11
- * endpoint (`rust-typed-native` / `go-typed-native`, bc#77/#90 — the 1.0 read de-box: fully
12
- * concrete `HandlerNR<Comp>`/`InNR<Comp>`/`PortsNR<Comp><node>`/`RawRowNR<Comp><node>` structs,
13
- * ZERO boxed `Value`/`RawValue`, ZERO IR baked into the module), the CODEGEN-ONLY lowering
14
- * below ({@link lowerReadGraphForTypedNative}) makes the read's shape structurally ELIGIBLE
15
- * (splits the surrogate `__scope` boxed-obj port into individual scalar ref ports + types the
16
- * component's `inputPorts` from the schema) before handing it to bc. For a WRITE bundle, or a
17
- * READ shape typed-native does not (yet) cover, codegen uses bc's existing de-interpreted
18
- * STRAIGHT-LINE endpoint (`<lang>-straightline`, bc#75) — see {@link typedEmitterFor}.
19
- * 2. **SQL catalog companion** — the pure-JSON STATIC makeSQL catalog (per-node statement
20
- * templates / relations / transaction). A codegen consumer's thin SQL layer reads it to
21
- * evaluate skip + value-specs → assemble → render → execute (identically to the mode-2 runtime).
22
- *
23
- * ## #60 milestone 1 scope (CODEGEN-PATH ONLY)
24
- *
25
- * This lowering exists SOLELY for the codegen emitter call — it builds a NEW, separate
26
- * `ComponentGraphIR` from the bundle's `readGraph`; it never mutates `SqlBundle`/`ReadGraph` and
27
- * never touches the shared `readGraph`/`executeReadGraph` the ir/interpret exec surface (and the
28
- * frozen conformance corpus) depend on. Those keep consuming the ORIGINAL boxed-`__scope`-port
29
- * surrogate IR ({@link bundleToPortableIR}), completely unaffected by anything in this file.
30
- *
31
- * ## Behavior-identical to the thin-runtime (mode-2), by construction
32
- *
33
- * The generated module is observationally equivalent to `runBehavior` (same values, same emitted
34
- * op sequence, same Failure code/message), and the companion IS the bundle, so a codegen runtime
35
- * that drives it follows the IDENTICAL static-makeSQL render/execute path {@link executeBundle}
36
- * uses — SQL text (all dialects) and results are identical, not approximately equal. The TS leg
37
- * PROVES this by executing via the artifact and asserting exact equality vs {@link executeBundle}
38
- * (see {@link codegenExecuteBundleForTest}).
39
- *
40
- * ## No literal-bake / no boxed fallback
41
- *
42
- * typed-native fails CLOSED on an uncovered shape (a `map`/`cond` relation kind it does not cover,
43
- * or an input head that cannot lower to a native scalar — e.g. an IN-list's array-typed head).
44
- * Such a shape is NOT silently regenerated on the boxed `-typed`/`-typed-raw` emitter — it THROWS,
45
- * naming the exact gap, so it can be tracked as a bc coverage gap (bc#86) rather than masked.
46
- */
47
- import { type ComponentGraphIR, type GeneratedModule, type Scope, type Value } from 'behavior-contracts';
48
- import type { SqlBundle, SqliteDb } from './runtime';
49
- import type { DialectName } from './dialect';
50
- import type { RelationOp } from './relation';
51
- import type { ReadGraph } from './makesql/static-bundle';
52
- import type { TransactionPlan } from './makesql/tx';
53
- import { type ColumnTypeResolver } from './coltype';
54
- /**
55
- * The languages litedbmodel mode-3 codegen supports — exactly the set bc's shared generator
56
- * registers (bc#13 SP1 typescript/python + SP2 go/rust/php). {@link codegenEmitterFor}
57
- * verifies against the LIVE registry so a bc capability drift is caught loudly.
58
- */
59
- export declare const CODEGEN_LANGUAGES: readonly ["typescript", "python", "go", "rust", "php"];
60
- export type CodegenLanguage = (typeof CODEGEN_LANGUAGES)[number];
61
- /**
62
- * The bc READ emitter litedbmodel drives for each codegen target (#60 milestone 1): the
63
- * **de-interpreted, RUNTIME-FREE typed-NATIVE** endpoint (bc#77/#90) for go/rust — ZERO boxed
64
- * `Value`/`RawValue`, ZERO IR baked into the module, concrete `HandlerNR`/`InNR`/`PortsNR`/
65
- * `RawRowNR` structs. There is **NO literal / straight-line / boxed-typed fallback** for a read: an
66
- * unspec'd fallback is INVALID (it silently swallows the "this shape can't be natively codegen'd"
67
- * signal) — a read shape typed-native does not cover MUST fail loudly at generation, naming the gap
68
- * (report it as a bc#86 coverage gap), never silently regenerate on `-typed`/`-typed-raw`.
69
- *
70
- * `-typed-raw` (bc#76, the boxed-wire intermediate) and `-typed` (the boxed-Value intermediate) are
71
- * RETIRED from litedbmodel's codegen surface entirely (#60 milestone 1) — typed-native supersedes
72
- * both for every read shape it covers (bc#77/#90: single-componentRef reads AND the `map`
73
- * relationKind:single|connection shape, bc#86 part 2).
74
- *
75
- * - ts: **no typed-native endpoint registered yet** (bc has not shipped `typescript-typed-native`).
76
- * TS stays on its existing `typescript-typed` (boxed) endpoint until bc adds one — a DECLARED,
77
- * reported gap (not silently mirrored to go/rust's retirement), tracked as a bc#77 TS follow-up.
78
- * - **python/php: NOT present.** bc registers no de-boxed typed endpoint for them (capability limit).
79
- * litedbmodel does NOT substitute the literal (≈ir) emitter — that would be an unspec'd fallback.
80
- * Codegen for py/php is a bc capability gap that ERRORS (ESCALATE to bc), never a silent literal.
81
- *
82
- * WRITES (batchInsert / gate-first tx) are NOT reads — they are NOT routed through this table at
83
- * all (#60 milestone 1): a write bundle stays on the existing write/tx execution path
84
- * (`executeTransactionBundle` / the native adapter's hand-written tx mirror), never a codegen
85
- * module, boxed or typed-raw. {@link generateCodegenArtifact} throws if asked to codegen a write.
86
- */
87
- export declare const CODEGEN_EMITTER: Partial<Record<CodegenLanguage, string>>;
88
- /**
89
- * The SQL catalog companion (spec §9): the STATIC makeSQL bundle fields the codegen consumer's
90
- * thin SQL layer reads to evaluate + render + execute. Pure JSON — round-trips losslessly.
91
- */
92
- export interface SqlCatalogCompanion {
93
- /** Target SQL dialect (`sqlite`/`postgres`/`mysql`) — compiled once, TS-side (spec §10). */
94
- readonly dialect: DialectName;
95
- /** READ bundles: the portable read graph (surrogate IR + per-node makeSQL statements). */
96
- readonly readGraph?: ReadGraph;
97
- /** WRITE bundles: the single base-write makeSQL statement template. */
98
- readonly statement?: {
99
- readonly sql: string;
100
- readonly params: readonly unknown[];
101
- readonly skip?: unknown;
102
- };
103
- /** Input heads normalized to present-as-null (absent-key SKIP) — mirrors the bundle. */
104
- readonly optionalHeads: readonly string[];
105
- /** Pre-compiled STATIC read-relation batch ops (spec §5/§8), keyed by relation name. */
106
- readonly relations: Record<string, RelationOp>;
107
- /** Derived gate-first write-time-relations transaction plan (spec §6/§8), for a Command bundle. */
108
- readonly transaction?: TransactionPlan;
109
- /**
110
- * WRITE bundles: the codegen typed-de-box `outputType` (the TransactionResult typed shape). Rides
111
- * the companion so a codegen consumer that reassembles the bundle from the artifact round-trips it
112
- * losslessly (the read de-box carries its outType/outputType inside `readGraph.ir` instead).
113
- */
114
- readonly outputType?: unknown;
115
- }
116
- /** The full codegen artifact for one bundle × one language. */
117
- export interface CodegenArtifact {
118
- /** The target language. */
119
- readonly language: CodegenLanguage;
120
- /** The generated behavior module (bc's SHARED STRAIGHT-LINE generator output — real static code). */
121
- readonly module: GeneratedModule;
122
- /** The SQL catalog companion sidecar (the STATIC makeSQL execution catalog). */
123
- readonly companion: SqlCatalogCompanion;
124
- /** The originating bundle (so the equivalence leg re-executes the SAME static bundle). */
125
- readonly bundle: SqlBundle;
126
- }
127
- /**
128
- * The portable {@link ComponentGraphIR} view of a §8 bundle: a read bundle's surrogate IR (each
129
- * SQL node → a `makeSQL` node), or the single `makeSQL` component IR for a write. This is the
130
- * ORIGINAL boxed-`__scope`-port form the ir/interpret exec surface's `executeReadGraph` also
131
- * consumes (via `bundle.readGraph.ir` directly) — {@link generateCodegenArtifact} does NOT use
132
- * this for a READ bundle (it uses the codegen-only lowered form, {@link lowerReadGraphForTypedNative});
133
- * this function is kept for callers that want the untouched portable IR (e.g. diagnostics, the
134
- * write path, or a future straight-line fallback caller).
135
- */
136
- export declare function bundleToPortableIR(bundle: SqlBundle): ComponentGraphIR;
137
- /** A head could not be typed for typed-native codegen — the read is NOT typed-native-coverable. */
138
- export declare class TypedNativeCoverageError extends Error {
139
- readonly component: string;
140
- readonly reasons: readonly string[];
141
- constructor(component: string, reasons: readonly string[]);
142
- }
143
- /**
144
- * Lower a read bundle's surrogate `ComponentGraphIR` into a NEW, CODEGEN-ONLY IR eligible for bc's
145
- * typed-native endpoint (#60 milestone 1): split the single `__scope: {obj:{...}}` boxed port into
146
- * individual scalar `{ref:[head]}` ports, and type the component's `inputPorts` from the schema
147
- * (via {@link deriveHeadTypesFromStatements}). Throws {@link TypedNativeCoverageError} if any
148
- * referenced head cannot be natively typed (e.g. an IN-list's array head) — NO silent `unknown`
149
- * port, NO fallback. Does NOT mutate `bundle`/`bundle.readGraph` (a fresh IR object is returned);
150
- * the ir/interpret exec surface's `executeReadGraph` keeps consuming the ORIGINAL `readGraph.ir`.
151
- *
152
- * Scope: bc's typed-native predicate itself still governs `map`/`cond`/relationKind/policy
153
- * coverage (this lowering does not special-case those — `generateModule` fails closed on them with
154
- * its own detailed diagnostic, which this function does not need to duplicate).
155
- */
156
- export declare function lowerReadGraphForTypedNative(readGraph: ReadGraph, resolveColumnType: ColumnTypeResolver): ComponentGraphIR;
157
- /**
158
- * Resolve the READ codegen emitter for a target language, or throw. No fallback: a language
159
- * without a registered endpoint is a bc capability gap that fails LOUDLY (never a silent
160
- * substitution of the literal/interpreter/boxed emitter — an unspec'd fallback is invalid).
161
- */
162
- export declare function typedEmitterFor(language: string, registered: readonly string[]): string;
163
- /**
164
- * Shape-INDEPENDENT emitter resolution — identical to {@link typedEmitterFor} now that there is
165
- * exactly one READ endpoint per language (kept as a distinct export for callers that historically
166
- * used the shape-independent form; both resolve the SAME table).
167
- */
168
- export declare function codegenEmitterFor(language: string, registered: readonly string[]): string;
169
- /**
170
- * Generate the mode-3 READ codegen artifact for ONE §8 READ bundle in ONE target language. For a
171
- * typed-NATIVE target (go/rust, bc#77/#90), lowers the bundle's surrogate read graph into the
172
- * typed-native-eligible IR ({@link lowerReadGraphForTypedNative}) first — REAL static native
173
- * source, RUNTIME-FREE, no baked-IR interpret path. For any OTHER registered endpoint (currently
174
- * only TS's boxed `typescript-typed`, which has no typed-native counterpart yet), the ORIGINAL
175
- * portable IR ({@link bundleToPortableIR}) is used unchanged — the lowering is typed-native-only
176
- * and would needlessly narrow a boxed endpoint's existing coverage. litedbmodel supplies the
177
- * input (portable IR + catalog); bc owns the emitter.
178
- *
179
- * WRITE bundles are OUT OF SCOPE (#60 milestone 1: writes stay on the existing write/tx execution
180
- * path, never a codegen module) — throws if `bundle.readGraph` is absent.
181
- */
182
- export declare function generateCodegenArtifact(bundle: SqlBundle, language: string, registeredLanguages: readonly string[], resolveColumnType: ColumnTypeResolver, runtimeImport?: string): CodegenArtifact;
183
- /**
184
- * The TS codegen EXECUTION path used to PROVE behavior-identity: a codegen runtime reads the SQL
185
- * catalog companion (the STATIC makeSQL bundle) and evaluates skip + value-specs → assemble →
186
- * render → execute — which is EXACTLY {@link executeBundle} over the SAME bundle.
187
- */
188
- export declare function codegenExecuteBundleForTest(artifact: CodegenArtifact, input: Scope, db: SqliteDb): Value;
189
- //# sourceMappingURL=codegen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../../src/scp/codegen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAkC,KAAK,gBAAgB,EAAE,KAAK,eAAe,EAAE,KAAK,KAAK,EAAE,KAAK,KAAK,EAAmB,MAAM,oBAAoB,CAAC;AAC1J,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WA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