litedbmodel 2.0.1 → 2.1.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 (97) hide show
  1. package/dist/decorators.d.ts.map +1 -1
  2. package/dist/decorators.js +44 -24
  3. package/dist/decorators.js.map +1 -1
  4. package/dist/drivers/mysql.d.ts.map +1 -1
  5. package/dist/drivers/mysql.js +6 -0
  6. package/dist/drivers/mysql.js.map +1 -1
  7. package/dist/drivers/postgres.d.ts.map +1 -1
  8. package/dist/drivers/postgres.js +7 -0
  9. package/dist/drivers/postgres.js.map +1 -1
  10. package/dist/drivers/sqlite.d.ts +2 -0
  11. package/dist/drivers/sqlite.d.ts.map +1 -1
  12. package/dist/drivers/sqlite.js +37 -2
  13. package/dist/drivers/sqlite.js.map +1 -1
  14. package/dist/scp/authoring.d.ts +66 -3
  15. package/dist/scp/authoring.d.ts.map +1 -1
  16. package/dist/scp/authoring.js +194 -5
  17. package/dist/scp/authoring.js.map +1 -1
  18. package/dist/scp/catalog.d.ts +6 -2
  19. package/dist/scp/catalog.d.ts.map +1 -1
  20. package/dist/scp/catalog.js +17 -2
  21. package/dist/scp/catalog.js.map +1 -1
  22. package/dist/scp/codegen.d.ts +132 -26
  23. package/dist/scp/codegen.d.ts.map +1 -1
  24. package/dist/scp/codegen.js +546 -35
  25. package/dist/scp/codegen.js.map +1 -1
  26. package/dist/scp/coltype.d.ts +124 -0
  27. package/dist/scp/coltype.d.ts.map +1 -0
  28. package/dist/scp/coltype.js +408 -0
  29. package/dist/scp/coltype.js.map +1 -0
  30. package/dist/scp/dialect.d.ts +12 -3
  31. package/dist/scp/dialect.d.ts.map +1 -1
  32. package/dist/scp/dialect.js +12 -3
  33. package/dist/scp/dialect.js.map +1 -1
  34. package/dist/scp/fragment/assemble.d.ts.map +1 -1
  35. package/dist/scp/fragment/assemble.js +10 -2
  36. package/dist/scp/fragment/assemble.js.map +1 -1
  37. package/dist/scp/fragment/compile-pg.js +4 -4
  38. package/dist/scp/guard.d.ts +1 -1
  39. package/dist/scp/guard.d.ts.map +1 -1
  40. package/dist/scp/guard.js +6 -0
  41. package/dist/scp/guard.js.map +1 -1
  42. package/dist/scp/index.cjs +10003 -4917
  43. package/dist/scp/index.d.ts +8 -5
  44. package/dist/scp/index.d.ts.map +1 -1
  45. package/dist/scp/index.js +35 -9
  46. package/dist/scp/index.js.map +1 -1
  47. package/dist/scp/index.mjs +1343 -213
  48. package/dist/scp/makesql/authoring-compile.d.ts.map +1 -1
  49. package/dist/scp/makesql/authoring-compile.js +11 -0
  50. package/dist/scp/makesql/authoring-compile.js.map +1 -1
  51. package/dist/scp/makesql/compile-select.d.ts +8 -1
  52. package/dist/scp/makesql/compile-select.d.ts.map +1 -1
  53. package/dist/scp/makesql/compile-select.js +1 -1
  54. package/dist/scp/makesql/compile-select.js.map +1 -1
  55. package/dist/scp/makesql/index.d.ts +2 -3
  56. package/dist/scp/makesql/index.d.ts.map +1 -1
  57. package/dist/scp/makesql/index.js +6 -6
  58. package/dist/scp/makesql/index.js.map +1 -1
  59. package/dist/scp/makesql/json-batch.d.ts.map +1 -1
  60. package/dist/scp/makesql/json-batch.js +6 -1
  61. package/dist/scp/makesql/json-batch.js.map +1 -1
  62. package/dist/scp/makesql/outtype.d.ts +99 -0
  63. package/dist/scp/makesql/outtype.d.ts.map +1 -0
  64. package/dist/scp/makesql/outtype.js +328 -0
  65. package/dist/scp/makesql/outtype.js.map +1 -0
  66. package/dist/scp/makesql/pool-executor.d.ts +70 -0
  67. package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
  68. package/dist/scp/makesql/pool-executor.js +73 -5
  69. package/dist/scp/makesql/pool-executor.js.map +1 -1
  70. package/dist/scp/makesql/static-bundle.d.ts +41 -30
  71. package/dist/scp/makesql/static-bundle.d.ts.map +1 -1
  72. package/dist/scp/makesql/static-bundle.js +351 -131
  73. package/dist/scp/makesql/static-bundle.js.map +1 -1
  74. package/dist/scp/makesql/tx.d.ts +1 -1
  75. package/dist/scp/makesql/tx.d.ts.map +1 -1
  76. package/dist/scp/makesql/tx.js +48 -3
  77. package/dist/scp/makesql/tx.js.map +1 -1
  78. package/dist/scp/makesql/writeouttype.d.ts +65 -0
  79. package/dist/scp/makesql/writeouttype.d.ts.map +1 -0
  80. package/dist/scp/makesql/writeouttype.js +194 -0
  81. package/dist/scp/makesql/writeouttype.js.map +1 -0
  82. package/dist/scp/relation.d.ts +15 -1
  83. package/dist/scp/relation.d.ts.map +1 -1
  84. package/dist/scp/relation.js +61 -2
  85. package/dist/scp/relation.js.map +1 -1
  86. package/dist/scp/runtime.d.ts +17 -5
  87. package/dist/scp/runtime.d.ts.map +1 -1
  88. package/dist/scp/runtime.js +55 -14
  89. package/dist/scp/runtime.js.map +1 -1
  90. package/docs/BENCHMARK.md +58 -56
  91. package/docs/benchmark-chart.svg +166 -166
  92. package/docs/proposal/litedbmodel-v2-scp-architecture.md +51 -0
  93. package/package.json +8 -2
  94. package/dist/scp/makesql/ir.d.ts +0 -42
  95. package/dist/scp/makesql/ir.d.ts.map +0 -1
  96. package/dist/scp/makesql/ir.js +0 -66
  97. package/dist/scp/makesql/ir.js.map +0 -1
@@ -43,8 +43,25 @@
43
43
  * the eager path and the declaration path for an equivalent query produce byte-identical
44
44
  * component IR.
45
45
  */
46
- import { type BehaviorClass, type Component, type ComponentGraphIR, type MapNode, type ComponentRefNode, type PortSchema, type Recorded } from 'behavior-contracts';
46
+ import { type BehaviorClass, type ComponentGraphIRDoc, type PortSchema, type Recorded } from 'behavior-contracts';
47
+ /** Unbranded whole-IR structural shape (bc `ComponentGraphIRDoc`) — litedbmodel's carried/transformed IR. */
48
+ export type ComponentGraphIR = ComponentGraphIRDoc;
49
+ /** Unbranded component structural shape (`ir.components[number]`). */
50
+ export type Component = ComponentGraphIRDoc['components'][number];
51
+ /** Unbranded body-node structural shapes. */
52
+ export type BodyNode = Component['body'][number];
53
+ export type MapNode = Extract<BodyNode, {
54
+ map: unknown;
55
+ }>;
56
+ export type FanoutNode = Extract<BodyNode, {
57
+ fanout: unknown;
58
+ }>;
59
+ export type CondNode = Extract<BodyNode, {
60
+ cond: unknown;
61
+ }>;
62
+ export type ComponentRefNode = Exclude<BodyNode, MapNode | FanoutNode | CondNode>;
47
63
  import { type CatalogName, type ContractEffect } from './catalog';
64
+ import { type MaterializeResolver, type ColumnTypeResolver } from './coltype';
48
65
  /**
49
66
  * The litedbmodel leaf-component functions for the shared authoring surface —
50
67
  * `catalogComponents(LITEDBMODEL_CATALOG)` bound once, lazily (so importing this module
@@ -70,7 +87,11 @@ import { type CatalogName, type ContractEffect } from './catalog';
70
87
  * time — the atomic transaction envelope is a WS3 runtime concern, never authored.
71
88
  */
72
89
  export type ComponentFns = Record<CatalogName, (ports: Record<string, unknown>) => Recorded>;
73
- /** The `catalogComponents(LITEDBMODEL_CATALOG)` leaf-function map (typed, memoized). */
90
+ /**
91
+ * The litedbmodel leaf-function map (typed, memoized). Each typed-CRUD leaf self-annotates its output
92
+ * `PortableType` via `.as` from the ambient per-compile `static columns` resolver (see
93
+ * {@link currentResolver}); authors call `L.Select({…})` exactly as before — the typing is automatic.
94
+ */
74
95
  export declare function components(): ComponentFns;
75
96
  /**
76
97
  * One published behavior method: the bc-lowered component (name = the method name) plus
@@ -99,6 +120,41 @@ export interface BehaviorModelContract {
99
120
  readonly components: readonly Component[];
100
121
  /** Method name → lowered component + derived effect. */
101
122
  readonly methods: Readonly<Record<string, BehaviorMethodSpec>>;
123
+ /**
124
+ * The STATIC read-path materialize resolver (issue #59), derived ONCE at registration from the
125
+ * model's INLINE typed-column declaration (`static columns` — see {@link ModelColumns}).
126
+ * `(table, column) → MaterializeClass`, pure in-memory map lookups — ZERO per-read DB
127
+ * introspection. The read entry points (`executeBehavior`/`executeBehaviorAsync`/`read`) consult
128
+ * it so INT→number / BIGINT→string / DATE→string / BOOLEAN→boolean de-boxes for every read. Absent
129
+ * only when the model declared no `columns` (a model with no typed reads → raw driver values).
130
+ */
131
+ readonly materializeResolver?: MaterializeResolver;
132
+ /**
133
+ * The STATIC codegen column-type resolver (issue #58/#59), derived from the SAME inline `columns`
134
+ * declaration — `(table, column) → SQL type token`. Feeds `deriveReadOutTypes` so the typed-native
135
+ * codegen `outType` annotations come from the declaration (not an external DDL). Absent when the
136
+ * model declared no `columns`.
137
+ */
138
+ readonly resolveColumnType?: ColumnTypeResolver;
139
+ }
140
+ /**
141
+ * The INLINE typed-column declaration (issue #59): `table → (column → SQL type token)`, declared
142
+ * ONCE per table on the behavior model — the BC-native, consumer-inline column-type SoT (bc never
143
+ * infers types; the author annotates them, exactly as graphddb declares its typed entity columns).
144
+ * A read's projection resolves each column's type from THIS declaration (no external DDL string, no
145
+ * DB introspection). The registration precomputes both the codegen `outType` resolver and the TS
146
+ * read-path materialize resolver from it, so de-box is always-on for every registered model. SQL
147
+ * type tokens are the §4.1 vocabulary (`INTEGER`/`INT`/`BIGINT`/`REAL`/`DOUBLE`/`DECIMAL(…)`/`TEXT`/
148
+ * `VARCHAR(…)`/`BOOLEAN`/`DATE`/`TIMESTAMP`/`JSON`/`JSONB`/`UUID`/…).
149
+ */
150
+ export type ModelColumns = Readonly<Record<string, Readonly<Record<string, string>>>>;
151
+ /**
152
+ * A behavior model class may declare its columns inline via a `static columns` field — the typed
153
+ * catalog the reads project from. `publishBehaviors` reads it at registration to build the de-box
154
+ * resolvers. (Optional per class; a model with no typed reads may omit it.)
155
+ */
156
+ export interface TypedModelClass {
157
+ readonly columns?: ModelColumns;
102
158
  }
103
159
  /** Options passed through to bc `compileBehaviors` (additive; all optional). */
104
160
  export interface PublishBehaviorsOptions {
@@ -110,6 +166,14 @@ export interface PublishBehaviorsOptions {
110
166
  readonly inputPorts?: Record<string, Record<string, PortSchema>>;
111
167
  /** Plan concurrency recorded on the lowered components (bc default: 16). */
112
168
  readonly concurrency?: number;
169
+ /**
170
+ * The model's inline typed-column declaration (issue #59) — see {@link ModelColumns}. Normally
171
+ * declared as a `static columns` field ON the behavior class (the BC-native shape); this option is
172
+ * an alternative for callers that build the class dynamically. When both are present the option
173
+ * takes precedence. Absent from BOTH ⇒ the model has no declared types → reads stay un-materialized
174
+ * (raw driver values; pre-#59 — a model with no typed reads).
175
+ */
176
+ readonly columns?: ModelColumns;
113
177
  }
114
178
  /**
115
179
  * Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
@@ -151,5 +215,4 @@ export type EagerBehavior = ($: Recorded, L: ComponentFns) => unknown;
151
215
  * @throws the same failures as {@link publishBehaviors} (single path, single guard).
152
216
  */
153
217
  export declare function compileEager(name: string, fn: EagerBehavior, options?: PublishBehaviorsOptions): BehaviorModelContract;
154
- export type { Component, ComponentGraphIR, MapNode, ComponentRefNode };
155
218
  //# sourceMappingURL=authoring.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/scp/authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAGnB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAI7F,wFAAwF;AACxF,wBAAgB,UAAU,IAAI,YAAY,CAKzC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,E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;AA0KD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,uBAA4B,GACpC,qBAAqB,CAEvB;AAID;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,aAAa,EACjB,OAAO,GAAE,uBAA4B,GACpC,qBAAqB,CAGvB"}
@@ -51,11 +51,87 @@ exports.compileEager = compileEager;
51
51
  const behavior_contracts_1 = require("behavior-contracts");
52
52
  const catalog_1 = require("./catalog");
53
53
  const guard_1 = require("./guard");
54
+ const coltype_1 = require("./coltype");
55
+ const outtype_1 = require("./makesql/outtype");
56
+ let boundRaw;
54
57
  let boundComponents;
55
- /** The `catalogComponents(LITEDBMODEL_CATALOG)` leaf-function map (typed, memoized). */
58
+ /**
59
+ * The AMBIENT per-compile column-type resolver (bc 0.8.0 SA5 / #12). `lowerBehaviorClass` sets this
60
+ * from the model's inline `static columns` immediately BEFORE `compileBehaviors` and clears it right
61
+ * after (a synchronous window — bc records every method body inside that single call). The typed CRUD
62
+ * leaf wrappers (Select/Insert/Update/Delete) read it to compute each authored node's determined
63
+ * output `PortableType` and stamp it via bc's `.as(t)` recording API, so `compileBehaviors`'
64
+ * all-nodes-typed gate passes. It is the SAME `static columns` SoT the post-compile de-box
65
+ * (`deriveReadOutTypes`) reads — moved to authoring time so the type is fixed at compile (declare-via-BC:
66
+ * column-types-in-authoring, no hand-built IR; SQL stays opaque text on the makeSQL leaf).
67
+ */
68
+ let currentResolver;
69
+ /** Run `fn` with the ambient compile-time column resolver bound (restored on exit — reentrancy-safe). */
70
+ function withColumnResolver(resolve, fn) {
71
+ const prev = currentResolver;
72
+ currentResolver = resolve;
73
+ try {
74
+ return fn();
75
+ }
76
+ finally {
77
+ currentResolver = prev;
78
+ }
79
+ }
80
+ /**
81
+ * Leaves whose authored node's output row shape is per-projection and MUST be typed via `.as` from the
82
+ * model's `static columns` (bc 0.8.0 SA5). A `Select` (read) is de-boxed by the typed read/codegen
83
+ * path, so its row REQUIRES the column-type SoT (fail-closed when absent — mirrors #59's
84
+ * `assertReadColumnsDeclared`). A write (`Insert`/`Update`/`Delete`) is NOT typed-codegen'd — its
85
+ * RETURNING de-box is derived POST-compile from the tuned SQL (`writeouttype.ts`); the write NODE's
86
+ * compile-time outType exists only to satisfy bc's all-nodes-typed gate, so it is typed from the
87
+ * `returning` port WHEN `static columns` is present, else annotated with the determined empty-row list
88
+ * `{arr:{obj:{}}}` (writes stay EXEMPT from a `static columns` requirement, as before #12).
89
+ */
90
+ const READ_TYPED_LEAF = 'Select';
91
+ const WRITE_TYPED_LEAVES = new Set(['Insert', 'Update', 'Delete']);
92
+ /**
93
+ * Wrap one raw `catalogComponents` leaf so a typed-CRUD leaf stamps its authored node's determined
94
+ * output type via bc's `.as(t)` (bc 0.8.0 SA5). `Count` (static `int` via the catalog `elemType`),
95
+ * `Fragment`, and `Tx` pass through unchanged (no per-projection output).
96
+ */
97
+ function wrapLeaf(name, raw) {
98
+ const isRead = name === READ_TYPED_LEAF;
99
+ const isWrite = WRITE_TYPED_LEAVES.has(name);
100
+ if (!isRead && !isWrite)
101
+ return raw;
102
+ return (ports) => {
103
+ const handle = raw(ports);
104
+ // Reads REQUIRE the column-type SoT (typed de-box); writes do not (RETURNING de-box is post-compile).
105
+ if (isRead && currentResolver === undefined) {
106
+ throw new Error(`scp authoring: a Select node needs its output row type at compile time (bc 0.8.0 all-nodes-typed ` +
107
+ `gate), but the model declares NO \`columns\` — a typed read REQUIRES an inline \`static columns\` ` +
108
+ `SoT (or \`options.columns\`). No-assume, no-fallback.`);
109
+ }
110
+ const outType = currentResolver !== undefined
111
+ ? (0, outtype_1.crudNodeAsType)(name, ports, currentResolver, `${name} node`)
112
+ : { arr: { obj: {} } }; // write with no `static columns`: determined empty-row list (gate-only, inert)
113
+ return handle.as(outType);
114
+ };
115
+ }
116
+ /** The raw `catalogComponents(LITEDBMODEL_CATALOG)` leaf map (memoized). */
117
+ function rawComponents() {
118
+ if (boundRaw === undefined) {
119
+ boundRaw = (0, behavior_contracts_1.catalogComponents)(catalog_1.LITEDBMODEL_CATALOG);
120
+ }
121
+ return boundRaw;
122
+ }
123
+ /**
124
+ * The litedbmodel leaf-function map (typed, memoized). Each typed-CRUD leaf self-annotates its output
125
+ * `PortableType` via `.as` from the ambient per-compile `static columns` resolver (see
126
+ * {@link currentResolver}); authors call `L.Select({…})` exactly as before — the typing is automatic.
127
+ */
56
128
  function components() {
57
129
  if (boundComponents === undefined) {
58
- boundComponents = (0, behavior_contracts_1.catalogComponents)(catalog_1.LITEDBMODEL_CATALOG);
130
+ const raw = rawComponents();
131
+ const wrapped = {};
132
+ for (const name of Object.keys(raw))
133
+ wrapped[name] = wrapLeaf(name, raw[name]);
134
+ boundComponents = wrapped;
59
135
  }
60
136
  return boundComponents;
61
137
  }
@@ -79,10 +155,25 @@ function components() {
79
155
  * ({@link deriveContractEffect}); the author never declares it.
80
156
  */
81
157
  function lowerBehaviorClass(cls, options) {
82
- const ir = (0, behavior_contracts_1.compileBehaviors)(cls, {
158
+ // STATIC de-box resolvers (issue #59): the column types come from the model's INLINE declaration
159
+ // (`static columns` on the class, or `options.columns`) — the BC-native, consumer-inline SoT (bc
160
+ // never infers types). Build the `table → (col → SQL type)` map ONCE at registration into BOTH the
161
+ // codegen outType resolver AND the FAIL-CLOSED TS read-path materialize resolver. A read then
162
+ // de-boxes with ZERO DB introspection (litedbmodel's static-resolution core value).
163
+ //
164
+ // bc 0.8.0 (#12 / SA5): the resolver is built BEFORE `compileBehaviors` and bound as the AMBIENT
165
+ // compile-time resolver (`withColumnResolver`) so the typed CRUD leaf wrappers can stamp each
166
+ // authored node's determined output type via `.as` DURING recording — clearing bc's all-nodes-typed
167
+ // gate. Same `static columns` SoT as the post-compile de-box, moved to authoring time.
168
+ const className = cls.name ?? '<anonymous>';
169
+ const declaredColumns = options.columns ?? cls.columns;
170
+ const columnMap = declaredColumns !== undefined ? toColumnMap(declaredColumns) : undefined;
171
+ const materializeResolver = columnMap !== undefined ? (0, coltype_1.failClosedMaterializeResolverFromColumnMap)(columnMap) : undefined;
172
+ const resolveColumnType = columnMap !== undefined ? (0, coltype_1.columnTypeResolverFromColumnMap)(columnMap) : undefined;
173
+ const ir = withColumnResolver(resolveColumnType, () => (0, behavior_contracts_1.compileBehaviors)(cls, {
83
174
  ...(options.inputPorts !== undefined ? { inputPorts: options.inputPorts } : {}),
84
175
  ...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),
85
- });
176
+ }));
86
177
  (0, catalog_1.assertComponentsInCatalog)(ir.components);
87
178
  (0, guard_1.assertComponentGraphPortable)(ir);
88
179
  const methods = {};
@@ -93,13 +184,108 @@ function lowerBehaviorClass(cls, options) {
93
184
  component,
94
185
  };
95
186
  }
187
+ // FAIL-CLOSED coverage-by-construction (issue #59 audit): every column a READ method projects MUST
188
+ // have a declared type. Validate NOW, at registration — a read whose projected columns aren't fully
189
+ // declared cannot be published (so no production read can silently skip de-box and leak a rounded
190
+ // i64). A model with NO `columns` but a read that projects columns fails here too (columns are
191
+ // REQUIRED for a typed read). A write / a read that projects no explicit columns is exempt.
192
+ assertReadColumnsDeclared(className, ir.components, methods, resolveColumnType);
96
193
  return {
97
- className: cls.name ?? '<anonymous>',
194
+ className,
98
195
  ir,
99
196
  components: ir.components,
100
197
  methods,
198
+ ...(materializeResolver !== undefined ? { materializeResolver } : {}),
199
+ ...(resolveColumnType !== undefined ? { resolveColumnType } : {}),
101
200
  };
102
201
  }
202
+ /** Normalize a declared {@link ModelColumns} into the `Map<table, Map<column, sqlType>>` the resolvers use. */
203
+ function toColumnMap(columns) {
204
+ const map = new Map();
205
+ for (const [table, cols] of Object.entries(columns)) {
206
+ const inner = new Map();
207
+ for (const [col, sqlType] of Object.entries(cols))
208
+ inner.set(col, sqlType);
209
+ map.set(table, inner);
210
+ }
211
+ return map;
212
+ }
213
+ /** Read a literal string port of a body node, or `undefined` (not a literal). */
214
+ function literalStringPort(ports, name) {
215
+ const v = ports[name];
216
+ return typeof v === 'string' ? v : undefined;
217
+ }
218
+ /** Read a literal `{arr:[str,…]}` string-list port, or `undefined` (not a literal list). */
219
+ function literalStringArrayPort(ports, name) {
220
+ const v = ports[name];
221
+ if (v !== null && typeof v === 'object' && 'arr' in v && Array.isArray(v.arr)) {
222
+ const arr = v.arr;
223
+ if (arr.every((e) => typeof e === 'string'))
224
+ return arr;
225
+ }
226
+ return undefined;
227
+ }
228
+ /** Extract each `Select` body node's `{ table, columns }` projection (skips Count / non-literal). */
229
+ function selectProjectionsOf(component) {
230
+ const out = [];
231
+ for (const n of component.body) {
232
+ if ('cond' in n)
233
+ continue;
234
+ if ('fanout' in n) {
235
+ // bc 0.7.3+ `FanoutNode`. litedbmodel never emits fanout — reject fail-closed rather
236
+ // than mis-read it as a component ref with no `Select` projection.
237
+ throw new Error(`selectProjectionsOf: component '${component.name}' node '${n.id}' is a fanout node, not supported by litedbmodel (bc FanoutNode)`);
238
+ }
239
+ const ref = 'map' in n ? n.map : n;
240
+ if (ref.component !== 'Select')
241
+ continue; // Count → scalar; no projection
242
+ const ports = ref.ports;
243
+ const table = literalStringPort(ports, 'table');
244
+ const columns = literalStringArrayPort(ports, 'select');
245
+ if (table === undefined || columns === undefined || columns.length === 0)
246
+ continue;
247
+ out.push({ table, columns });
248
+ }
249
+ return out;
250
+ }
251
+ /**
252
+ * FAIL-CLOSED registration guard (issue #59 audit): every column a READ (`query`) method PROJECTS —
253
+ * in ANY shape (bare `col`, qualified `t.col`, aliased `col AS b`) — must resolve to a declared type
254
+ * in the model's inline `columns`. Uses the SHARED {@link parseProjectionColumn} (the SAME projection
255
+ * parser the read-path materializer + codegen outType derivations use), so no projection shape can
256
+ * escape validation. A `*` / computed projection, an undeclared underlying column, or a read with NO
257
+ * `columns` declared at all, THROWS here — a typed read whose projected columns aren't fully declared
258
+ * cannot be registered, so no production read can silently skip de-box and return a rounded i64.
259
+ * Writes are exempt.
260
+ */
261
+ function assertReadColumnsDeclared(className, components, methods, resolveColumnType) {
262
+ for (const component of components) {
263
+ if (methods[component.name]?.effect !== 'query')
264
+ continue; // reads only (writes exempt)
265
+ for (const proj of selectProjectionsOf(component)) {
266
+ const at = `model '${className}' method '${component.name}'`;
267
+ // SHARED parse (all shapes): `*` → throw; computed → no schema column (skip); bare/qualified/
268
+ // aliased schema column → must be declared (against its OWNER table = qualifier ?? base table).
269
+ const schemaCols = proj.columns
270
+ .map((col) => (0, outtype_1.parseProjectionColumn)(col, proj.table, at))
271
+ .filter((e) => e.kind === 'column')
272
+ .map((e) => ({ table: e.qualifier ?? proj.table, column: e.underlying }));
273
+ if (schemaCols.length === 0)
274
+ continue; // only computed projections — nothing to type
275
+ if (resolveColumnType === undefined) {
276
+ // A read projecting schema columns with NO `columns` declared → fail closed (columns REQUIRED).
277
+ throw new Error(`scp publishBehaviors: ${at} reads projecting typed columns ` +
278
+ `[${schemaCols.map((s) => `${s.table}.${s.column}`).join(', ')}] but the model declares NO ` +
279
+ `\`columns\`. A typed read REQUIRES an inline \`static columns\` declaration so the read-path ` +
280
+ `de-box (INT→number / BIGINT→string / DATE→string / BOOLEAN→boolean) is always-on — never a ` +
281
+ `silent raw (rounded i64) result. Declare the model's \`static columns\`.`);
282
+ }
283
+ // resolveColumnType THROWS (naming the table/column) for any undeclared UNDERLYING column.
284
+ for (const s of schemaCols)
285
+ resolveColumnType(s.table, s.column);
286
+ }
287
+ }
288
+ }
103
289
  /**
104
290
  * Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
105
291
  * public methods are the root Behaviors (spec §2.4). Lowers through the single compile
@@ -159,4 +345,7 @@ function makeEagerClass(name, fn) {
159
345
  Object.defineProperty(cls, 'name', { value: name, configurable: true });
160
346
  return cls;
161
347
  }
348
+ // The component-graph node/component/graph types consumers (WS3) narrow the emitted IR with are
349
+ // declared+exported as UNBRANDED structural aliases near the top of this module (bc 0.8.0: the branded
350
+ // compile-seam handle is re-adopted only at `generateModule` via `loadCompiledIR`).
162
351
  //# sourceMappingURL=authoring.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring.js","sourceRoot":"","sources":["../../src/scp/authoring.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;AAoDH,gCAKC;AAkGD,4CAKC;AAkCD,oCAOC;AAvMD,2DAW4B;AAC5B,uCAMmB;AACnB,mCAAuD;AA4BvD,IAAI,eAAyC,CAAC;AAE9C,wFAAwF;AACxF,SAAgB,UAAU;IACxB,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAClC,eAAe,GAAG,IAAA,sCAAiB,EAAC,6BAAmB,CAAiB,CAAC;IAC3E,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AA4CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,kBAAkB,CAAC,GAAkB,EAAE,OAAgC;IAC9E,MAAM,EAAE,GAAG,IAAA,qCAAgB,EAAC,GAAG,EAAE;QAC/B,GAAG,CAAC,OAAO,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/E,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACnF,CAAC,CAAC;IAEH,IAAA,mCAAyB,EAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IACzC,IAAA,oCAA4B,EAAC,EAAE,CAAC,CAAC;IAEjC,MAAM,OAAO,GAAuC,EAAE,CAAC;IACvD,KAAK,MAAM,SAAS,IAAI,EAAE,C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FAAuF;IACvF,8BAA8B;IAC9B,MAAM,MAAM,GAAG,UAAyB,CAAW;QACjD,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,yFAAyF;IACzF,6FAA6F;IAC7F,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9F,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE;QACzC,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,KAAK;QACjB,YAAY,EAAE,IAAI;KACnB,CAAC,CAAC;IACH,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,gGAAgG;AAChG,uGAAuG;AACvG,oFAAoF"}
@@ -33,7 +33,8 @@
33
33
  * DECLARED port keeps bc's required/type checks regardless of the opt-in. `Tx`'s single
34
34
  * port is static, so it keeps bc's fail-closed default.
35
35
  */
36
- import { type Catalog, type CatalogEntry, type Component } from 'behavior-contracts';
36
+ import { type Catalog, type CatalogEntry } from 'behavior-contracts';
37
+ import type { Component } from './authoring';
37
38
  /**
38
39
  * The catalog-name literal union — one entry per SQL primitive litedbmodel declares:
39
40
  * the CRUD leaves (`Select` / `Insert` / `Update` / `Delete`), the dynamic WHERE/SET
@@ -62,7 +63,10 @@ export declare const WRITE_CATALOG_NAMES: readonly CatalogName[];
62
63
  /**
63
64
  * The dynamic per-field write-port families (`<group>.<field>` — the flattened record
64
65
  * convention; longest-prefix wins). A `values.<field>` (Insert) or `set.<field>`
65
- * (Update) port carries the field's Expression IR value.
66
+ * (Update) port carries the field's Expression IR value; a `sqlCast.<field>` port carries
67
+ * the field's PostgreSQL cast type (a literal string, e.g. `jsonb`/`uuid`/`int[]`) that drives
68
+ * the v1 per-column `?::<sqlCast>` on Postgres (`DBModel._insert`/`_update`). `sqlCast.` ports are
69
+ * INERT on MySQL/SQLite (v1's dialect-aware cast formatter is identity there).
66
70
  */
67
71
  export declare const WRITE_PORT_FAMILIES: readonly string[];
68
72
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/scp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAA0B,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAmB,MAAM,oBAAoB,CAAC;AAE9H;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,IAAI,CAAC;AAwET;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAwBjC,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEnE;AAED,uEAAuE;AACvE,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQ/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAKrD,CAAC;AAIF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAGhD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CA4BhF;AAGD,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAEzE"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/scp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAA0B,KAAK,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,oBAAoB,CAAC;AAI9G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,IAAI,CAAC;AAwET;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,OA2BjC,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEnE;AAED,uEAAuE;AACvE,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQ/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAKrD,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAIhD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAoChF;AAGD,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAEzE"}
@@ -121,7 +121,10 @@ exports.LITEDBMODEL_CATALOG = {
121
121
  // Only `table` (required) + the optional `where` fragment tree — v1's count carries no
122
122
  // projection/order/limit/offset (it counts the filtered rows). Output is a one-row `[{count}]`
123
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),
124
+ // bc 0.8.0 (SA5): Count's output element type is STATICALLY determined (`int` — the counted rows),
125
+ // so it declares a catalog `elemType` and needs no per-call `.as` (unlike Select, whose row shape is
126
+ // per-projection). `baseOutTypeFromEntry` bakes node.outType = {arr:'int'} (items shape) at record.
127
+ Count: { ...entry('Count', { table: P('string', true), where: P('fragment') }, 'items', true), elemType: 'int' },
125
128
  // Writes yield the RETURNING row list (`items`); a single-row write collapses at the
126
129
  // consumer boundary, same as reads.
127
130
  Insert: entry('Insert', WRITE_PORTS, 'items', true),
@@ -167,11 +170,15 @@ const WRITE_SET = new Set(exports.WRITE_CATALOG_NAMES);
167
170
  /**
168
171
  * The dynamic per-field write-port families (`<group>.<field>` — the flattened record
169
172
  * convention; longest-prefix wins). A `values.<field>` (Insert) or `set.<field>`
170
- * (Update) port carries the field's Expression IR value.
173
+ * (Update) port carries the field's Expression IR value; a `sqlCast.<field>` port carries
174
+ * the field's PostgreSQL cast type (a literal string, e.g. `jsonb`/`uuid`/`int[]`) that drives
175
+ * the v1 per-column `?::<sqlCast>` on Postgres (`DBModel._insert`/`_update`). `sqlCast.` ports are
176
+ * INERT on MySQL/SQLite (v1's dialect-aware cast formatter is identity there).
171
177
  */
172
178
  exports.WRITE_PORT_FAMILIES = [
173
179
  'values.',
174
180
  'set.',
181
+ 'sqlCast.',
175
182
  ];
176
183
  /**
177
184
  * The emitter's catalog validation (loud; a violation is a BUILD error), mirrored from
@@ -192,6 +199,14 @@ function assertComponentsInCatalog(components) {
192
199
  for (const n of c.body) {
193
200
  if ('cond' in n)
194
201
  continue;
202
+ if ('fanout' in n) {
203
+ // bc 0.7.3+ `FanoutNode` (connection fan-out / batched BatchGet). litedbmodel authors
204
+ // only Select/Count/map/cond via LITEDBMODEL_CATALOG and never emits fanout, so a
205
+ // fanout node here means an unsupported graph reached the emitter — reject fail-closed
206
+ // rather than mis-validate it as a component ref.
207
+ errs.push(`${c.name}/${n.id}: fanout node is not supported by litedbmodel (bc FanoutNode)`);
208
+ continue;
209
+ }
195
210
  const ref = 'map' in n ? n.map : n;
196
211
  const entryDef = exports.LITEDBMODEL_CATALOG[ref.component];
197
212
  if (entryDef === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/scp/catalog.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;;;AA2HH,oCAEC;AAkDD,8DA4BC;AAYD,oDAEC;AAvND,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,UAAU,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;IAClB,sFAAsF;IACtF,6FAA6F;IAC7F,iFAAiF;IACjF,sFAAsF;IACtF,4FAA4F;IAC5F,uFAAuF;IACvF,4FAA4F;IAC5F,iCAAiC;IACjC,oFAAoF;IACpF,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC;IACtB,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC;IACjB,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC;IACvB,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC;IACb,SAAS,EAAE,CAAC,CAAC,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