litedbmodel 2.0.0 → 2.0.2

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 (163) hide show
  1. package/dist/scp/authoring-sql.d.ts +78 -0
  2. package/dist/scp/authoring-sql.d.ts.map +1 -1
  3. package/dist/scp/authoring-sql.js +110 -2
  4. package/dist/scp/authoring-sql.js.map +1 -1
  5. package/dist/scp/catalog.d.ts +5 -2
  6. package/dist/scp/catalog.d.ts.map +1 -1
  7. package/dist/scp/catalog.js +32 -1
  8. package/dist/scp/catalog.js.map +1 -1
  9. package/dist/scp/codegen.d.ts +143 -85
  10. package/dist/scp/codegen.d.ts.map +1 -1
  11. package/dist/scp/codegen.js +374 -90
  12. package/dist/scp/codegen.js.map +1 -1
  13. package/dist/scp/coltype.d.ts +41 -0
  14. package/dist/scp/coltype.d.ts.map +1 -0
  15. package/dist/scp/coltype.js +188 -0
  16. package/dist/scp/coltype.js.map +1 -0
  17. package/dist/scp/dialect.d.ts +12 -3
  18. package/dist/scp/dialect.d.ts.map +1 -1
  19. package/dist/scp/dialect.js +12 -3
  20. package/dist/scp/dialect.js.map +1 -1
  21. package/dist/scp/find-filter-guard.d.ts +68 -0
  22. package/dist/scp/find-filter-guard.d.ts.map +1 -0
  23. package/dist/scp/find-filter-guard.js +88 -0
  24. package/dist/scp/find-filter-guard.js.map +1 -0
  25. package/dist/scp/fragment/assemble.d.ts +61 -0
  26. package/dist/scp/fragment/assemble.d.ts.map +1 -0
  27. package/dist/scp/fragment/assemble.js +156 -0
  28. package/dist/scp/fragment/assemble.js.map +1 -0
  29. package/dist/scp/fragment/compile-pg.d.ts +107 -0
  30. package/dist/scp/fragment/compile-pg.d.ts.map +1 -0
  31. package/dist/scp/fragment/compile-pg.js +142 -0
  32. package/dist/scp/fragment/compile-pg.js.map +1 -0
  33. package/dist/scp/fragment/index.d.ts +16 -0
  34. package/dist/scp/fragment/index.d.ts.map +1 -0
  35. package/dist/scp/fragment/index.js +34 -0
  36. package/dist/scp/fragment/index.js.map +1 -0
  37. package/dist/scp/fragment/model.d.ts +119 -0
  38. package/dist/scp/fragment/model.d.ts.map +1 -0
  39. package/dist/scp/fragment/model.js +66 -0
  40. package/dist/scp/fragment/model.js.map +1 -0
  41. package/dist/scp/fragment/pg-array-type.d.ts +13 -0
  42. package/dist/scp/fragment/pg-array-type.d.ts.map +1 -0
  43. package/dist/scp/fragment/pg-array-type.js +34 -0
  44. package/dist/scp/fragment/pg-array-type.js.map +1 -0
  45. package/dist/scp/guard.d.ts +2 -6
  46. package/dist/scp/guard.d.ts.map +1 -1
  47. package/dist/scp/guard.js +19 -22
  48. package/dist/scp/guard.js.map +1 -1
  49. package/dist/scp/index.cjs +18695 -3921
  50. package/dist/scp/index.d.ts +41 -24
  51. package/dist/scp/index.d.ts.map +1 -1
  52. package/dist/scp/index.js +134 -49
  53. package/dist/scp/index.js.map +1 -1
  54. package/dist/scp/index.mjs +4830 -1432
  55. package/dist/scp/makesql/authoring-compile.d.ts +90 -0
  56. package/dist/scp/makesql/authoring-compile.d.ts.map +1 -0
  57. package/dist/scp/makesql/authoring-compile.js +494 -0
  58. package/dist/scp/makesql/authoring-compile.js.map +1 -0
  59. package/dist/scp/makesql/compile-crud.d.ts +133 -0
  60. package/dist/scp/makesql/compile-crud.d.ts.map +1 -0
  61. package/dist/scp/makesql/compile-crud.js +288 -0
  62. package/dist/scp/makesql/compile-crud.js.map +1 -0
  63. package/dist/scp/makesql/compile-relation.d.ts +157 -0
  64. package/dist/scp/makesql/compile-relation.d.ts.map +1 -0
  65. package/dist/scp/makesql/compile-relation.js +425 -0
  66. package/dist/scp/makesql/compile-relation.js.map +1 -0
  67. package/dist/scp/makesql/compile-select.d.ts +52 -0
  68. package/dist/scp/makesql/compile-select.d.ts.map +1 -0
  69. package/dist/scp/makesql/compile-select.js +58 -0
  70. package/dist/scp/makesql/compile-select.js.map +1 -0
  71. package/dist/scp/makesql/compile.d.ts +63 -0
  72. package/dist/scp/makesql/compile.d.ts.map +1 -0
  73. package/dist/scp/makesql/compile.js +99 -0
  74. package/dist/scp/makesql/compile.js.map +1 -0
  75. package/dist/scp/makesql/handler.d.ts +58 -0
  76. package/dist/scp/makesql/handler.d.ts.map +1 -0
  77. package/dist/scp/makesql/handler.js +113 -0
  78. package/dist/scp/makesql/handler.js.map +1 -0
  79. package/dist/scp/makesql/index.d.ts +33 -0
  80. package/dist/scp/makesql/index.d.ts.map +1 -0
  81. package/dist/scp/makesql/index.js +114 -0
  82. package/dist/scp/makesql/index.js.map +1 -0
  83. package/dist/scp/makesql/ir.d.ts +42 -0
  84. package/dist/scp/makesql/ir.d.ts.map +1 -0
  85. package/dist/scp/makesql/ir.js +66 -0
  86. package/dist/scp/makesql/ir.js.map +1 -0
  87. package/dist/scp/makesql/json-array.d.ts +84 -0
  88. package/dist/scp/makesql/json-array.d.ts.map +1 -0
  89. package/dist/scp/makesql/json-array.js +118 -0
  90. package/dist/scp/makesql/json-array.js.map +1 -0
  91. package/dist/scp/makesql/json-batch.d.ts +102 -0
  92. package/dist/scp/makesql/json-batch.d.ts.map +1 -0
  93. package/dist/scp/makesql/json-batch.js +269 -0
  94. package/dist/scp/makesql/json-batch.js.map +1 -0
  95. package/dist/scp/makesql/makesql.d.ts +99 -0
  96. package/dist/scp/makesql/makesql.d.ts.map +1 -0
  97. package/dist/scp/makesql/makesql.js +122 -0
  98. package/dist/scp/makesql/makesql.js.map +1 -0
  99. package/dist/scp/makesql/outtype.d.ts +44 -0
  100. package/dist/scp/makesql/outtype.d.ts.map +1 -0
  101. package/dist/scp/makesql/outtype.js +197 -0
  102. package/dist/scp/makesql/outtype.js.map +1 -0
  103. package/dist/scp/makesql/pool-executor.d.ts +47 -0
  104. package/dist/scp/makesql/pool-executor.d.ts.map +1 -0
  105. package/dist/scp/makesql/pool-executor.js +50 -0
  106. package/dist/scp/makesql/pool-executor.js.map +1 -0
  107. package/dist/scp/makesql/static-bundle.d.ts +187 -0
  108. package/dist/scp/makesql/static-bundle.d.ts.map +1 -0
  109. package/dist/scp/makesql/static-bundle.js +1113 -0
  110. package/dist/scp/makesql/static-bundle.js.map +1 -0
  111. package/dist/scp/makesql/tx.d.ts +216 -0
  112. package/dist/scp/makesql/tx.d.ts.map +1 -0
  113. package/dist/scp/makesql/tx.js +788 -0
  114. package/dist/scp/makesql/tx.js.map +1 -0
  115. package/dist/scp/makesql/writeouttype.d.ts +66 -0
  116. package/dist/scp/makesql/writeouttype.d.ts.map +1 -0
  117. package/dist/scp/makesql/writeouttype.js +195 -0
  118. package/dist/scp/makesql/writeouttype.js.map +1 -0
  119. package/dist/scp/relation.d.ts +86 -74
  120. package/dist/scp/relation.d.ts.map +1 -1
  121. package/dist/scp/relation.js +186 -120
  122. package/dist/scp/relation.js.map +1 -1
  123. package/dist/scp/runtime.d.ts +158 -211
  124. package/dist/scp/runtime.d.ts.map +1 -1
  125. package/dist/scp/runtime.js +250 -515
  126. package/dist/scp/runtime.js.map +1 -1
  127. package/dist/scp/typed-object.d.ts +12 -1
  128. package/dist/scp/typed-object.d.ts.map +1 -1
  129. package/dist/scp/typed-object.js +25 -4
  130. package/dist/scp/typed-object.js.map +1 -1
  131. package/docs/proposal/litedbmodel-v2-scp-architecture.md +51 -0
  132. package/docs/proposal/v0-coverage-matrix.md +157 -0
  133. package/docs/proposal/v2-completeness-plan.md +90 -0
  134. package/docs/proposal/v2-sql-parity-checklist.md +162 -0
  135. package/package.json +3 -3
  136. package/dist/scp/bridge.d.ts +0 -64
  137. package/dist/scp/bridge.d.ts.map +0 -1
  138. package/dist/scp/bridge.js +0 -329
  139. package/dist/scp/bridge.js.map +0 -1
  140. package/dist/scp/compile-dialect.d.ts +0 -39
  141. package/dist/scp/compile-dialect.d.ts.map +0 -1
  142. package/dist/scp/compile-dialect.js +0 -62
  143. package/dist/scp/compile-dialect.js.map +0 -1
  144. package/dist/scp/compile-sqlite.d.ts +0 -114
  145. package/dist/scp/compile-sqlite.d.ts.map +0 -1
  146. package/dist/scp/compile-sqlite.js +0 -149
  147. package/dist/scp/compile-sqlite.js.map +0 -1
  148. package/dist/scp/ir.d.ts +0 -92
  149. package/dist/scp/ir.d.ts.map +0 -1
  150. package/dist/scp/ir.js +0 -28
  151. package/dist/scp/ir.js.map +0 -1
  152. package/dist/scp/render.d.ts +0 -40
  153. package/dist/scp/render.d.ts.map +0 -1
  154. package/dist/scp/render.js +0 -170
  155. package/dist/scp/render.js.map +0 -1
  156. package/dist/scp/write-plan.d.ts +0 -161
  157. package/dist/scp/write-plan.d.ts.map +0 -1
  158. package/dist/scp/write-plan.js +0 -528
  159. package/dist/scp/write-plan.js.map +0 -1
  160. package/dist/scp/write-runtime.d.ts +0 -80
  161. package/dist/scp/write-runtime.d.ts.map +0 -1
  162. package/dist/scp/write-runtime.js +0 -167
  163. package/dist/scp/write-runtime.js.map +0 -1
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /**
3
+ * litedbmodel v2 SCP — the COMPILE step (build time, TS). Emits the tuned dialect SQL
4
+ * TEXT for every surface as `makeSQL` port bundles, by REUSING the ORIGINAL tuned
5
+ * builders (`DBConditions`/`DBValues`, `LazyRelationContext`, `Postgres/Mysql/Sqlite
6
+ * SqlBuilder`, `DBModel.buildSelectSQL` + single INSERT/UPDATE/DELETE). Because each
7
+ * bundle's `sql`/`params` come from driving the original, the assembled + rendered
8
+ * output is byte-identical to what the original library sends over the wire.
9
+ *
10
+ * There is NO abstract IR here and NO reduced form. The produced artifact is ONLY
11
+ * `makeSQL` port bundles (`{ sql, params, skip? }`) — SQL structure (`= ANY`,
12
+ * `CROSS JOIN LATERAL`, `UNNEST`, cast, subquery, batch shapes) is TEXT inside `sql`.
13
+ *
14
+ * The three dialects share this compile: PG compiled text is the anchor and stays
15
+ * byte-identical to v1 (`= ANY(?::t[])` / `UNNEST` / LATERAL). MySQL/SQLite array &
16
+ * batch surfaces INTENTIONALLY DEVIATE from v1 (epic #43/#45): instead of v1's
17
+ * N-placeholder `IN (?, …)` / multi-VALUES / `VALUES ROW` / `CASE WHEN`, they now emit a
18
+ * SINGLE JSON param expanded server-side (`MEMBER OF` / `JSON_TABLE` / `json_each`; see
19
+ * `json-array.ts` / `json-batch.ts`). Result parity with v1 is proven on real MySQL 8 +
20
+ * SQLite (`test/scp/json-array-parity.test.ts`). Everything else stays v1 byte-match.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.noCastFormatter = exports.pgCastFormatter = void 0;
24
+ exports.formatterFor = formatterFor;
25
+ exports.compileWhere = compileWhere;
26
+ exports.whereClause = whereClause;
27
+ exports.andTrailing = andTrailing;
28
+ const json_array_1 = require("./json-array");
29
+ // ============================================================================
30
+ // Per-dialect cast formatter (drives DBConditions/DBValues casting text).
31
+ // PG applies `?::type`; MySQL/SQLite leave the placeholder unchanged (dialect-gated —
32
+ // the .rs bug of leaking `::uuid` to MySQL/SQLite is NOT reproduced; v1's dialect-aware
33
+ // SqlCastFormatter is the anchor).
34
+ // ============================================================================
35
+ /** PostgreSQL cast formatter: `?` → `?::type` (matches `DBValues` default formatter). */
36
+ const pgCastFormatter = (placeholder, sqlType) => `${placeholder}::${sqlType}`;
37
+ exports.pgCastFormatter = pgCastFormatter;
38
+ /** MySQL/SQLite cast formatter: no cast (placeholder unchanged). */
39
+ const noCastFormatter = (placeholder) => placeholder;
40
+ exports.noCastFormatter = noCastFormatter;
41
+ /** The cast formatter the original builders use for a given dialect. */
42
+ function formatterFor(dialect) {
43
+ return dialect === 'postgres' ? exports.pgCastFormatter : exports.noCastFormatter;
44
+ }
45
+ // ============================================================================
46
+ // WHERE / conditions / values — compiled by the ORIGINAL DBConditions.
47
+ // ============================================================================
48
+ /**
49
+ * Compile a WHERE clause (bare, without the `WHERE` keyword) from a condition object
50
+ * to a `makeSQL` bundle. The text + params come STRAIGHT from the original
51
+ * `DBConditions.compile(params, formatter)`, so every construct it supports —
52
+ * eq/ne/cmp (custom-op key), IN-list, empty-IN (`1 = 0`), IS NULL, IS NOT NULL
53
+ * (`dbNotNull`), boolean literal (`= TRUE`), LIKE/ILIKE/BETWEEN (custom-op/raw),
54
+ * IN/NOT IN subquery (`DBSubquery`), EXISTS/NOT EXISTS (`DBExists`), correlated
55
+ * parentRef, raw (`__raw__`), AND/OR grouping with parens (`__or__` / nested
56
+ * DBConditions), cast (`dbCast`/`dbCastIn`, dialect-gated), immediate inline
57
+ * (`dbImmediate`/`dbRaw`), dynamic (`dbDynamic`), tuple/composite IN (`dbTupleIn`) —
58
+ * is reproduced byte-for-byte.
59
+ *
60
+ * Empty clause → `{ sql: '', params: [] }` (the original returns `''` when no part is
61
+ * present; folded here into an empty bundle so composition drops it).
62
+ */
63
+ function compileWhere(conditions, dialect) {
64
+ const params = [];
65
+ const formatter = formatterFor(dialect);
66
+ const core = (0, json_array_1.conditionsFor)(conditions, dialect).compile(params, formatter);
67
+ return { sql: core, params };
68
+ }
69
+ // ============================================================================
70
+ // Composition helpers: prefix a bare WHERE with the connector text the original uses.
71
+ // ============================================================================
72
+ /**
73
+ * Wrap a bare WHERE core (from {@link compileWhere}) as the ` WHERE <core>` clause a
74
+ * SELECT/UPDATE/DELETE appends — byte-identical to the originals which do
75
+ * `sql += \` WHERE ${whereClause}\`` only when `whereClause` is non-empty. An empty
76
+ * core yields an empty bundle (no ` WHERE`).
77
+ */
78
+ function whereClause(where) {
79
+ if (where.sql === '')
80
+ return { sql: '', params: [] };
81
+ return { sql: ` WHERE ${where.sql}`, params: where.params };
82
+ }
83
+ /**
84
+ * Compose a leading condition with an ordered list of optional (SKIP-guarded) trailing
85
+ * conditions joined by ` AND `, exactly as the original relation/select path appends
86
+ * `config.conditions` after a mandatory key predicate. Each optional member carries
87
+ * its own connector (` AND <core>`), so a skipped member drops its connector too.
88
+ *
89
+ * Returns the list of `makeSQL` components (head + guarded tails); the caller composes.
90
+ */
91
+ function andTrailing(head, tails) {
92
+ const guardedTails = tails.map((t) => ({
93
+ sql: ` AND ${t.sql}`,
94
+ params: t.params,
95
+ ...(t.skip !== undefined ? { skip: t.skip } : {}),
96
+ }));
97
+ return [head, ...guardedTails];
98
+ }
99
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/scp/makesql/compile.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAqBH,oCAEC;AAqBD,oCAKC;AAYD,kCAGC;AAUD,kCAOC;AA5ED,6CAA6C;AAG7C,+EAA+E;AAC/E,0EAA0E;AAC1E,sFAAsF;AACtF,wFAAwF;AACxF,mCAAmC;AACnC,+EAA+E;AAE/E,yFAAyF;AAClF,MAAM,eAAe,GAAqB,CAAC,WAAW,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,WAAW,KAAK,OAAO,EAAE,CAAC;AAA3F,QAAA,eAAe,mBAA4E;AACxG,oEAAoE;AAC7D,MAAM,eAAe,GAAqB,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC;AAAjE,QAAA,eAAe,mBAAkD;AAE9E,wEAAwE;AACxE,SAAgB,YAAY,CAAC,OAAgB;IAC3C,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,uBAAe,CAAC,CAAC,CAAC,uBAAe,CAAC;AACpE,CAAC;AAED,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAE/E;;;;;;;;;;;;;;GAcG;AACH,SAAgB,YAAY,CAAC,UAA2B,EAAE,OAAgB;IACxE,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,IAAA,0BAAa,EAAC,UAAU,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC3E,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC;AAED,+EAA+E;AAC/E,sFAAsF;AACtF,+EAA+E;AAE/E;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAc;IACxC,IAAI,KAAK,CAAC,GAAG,KAAK,EAAE;QAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;IACrD,OAAO,EAAE,GAAG,EAAE,UAAU,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,IAAa,EAAE,KAAgB;IACzD,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACrC,GAAG,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE;QACpB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC,CAAC,CAAC;IACJ,OAAO,CAAC,IAAI,EAAE,GAAG,YAAY,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * litedbmodel v2 SCP — the `makeSQL` HANDLER + dialect placeholder render.
3
+ *
4
+ * The handler is the ONE consumer implementation point behind the `makeSQL` catalog
5
+ * leaf (spec §11 item 4): it receives the evaluated `{ sql, params, skip }` port
6
+ * bundle from bc's `runBehavior`, assembles it (drop-on-skip, splice nested makeSQL),
7
+ * renders the dialect placeholder form, binds params, and executes the SQL. Side
8
+ * effects / driver / connection live entirely here (C4 — the IR carries no
9
+ * implementation).
10
+ *
11
+ * bc supplies composition / value-eval / envelope / plan; litedbmodel supplies only
12
+ * this handler + the compile that emits the SQL text.
13
+ */
14
+ import type { Handler, HandlerCtx, Value } from 'behavior-contracts';
15
+ import { type AssembledSql } from './makesql';
16
+ /** A driver seam: run an already-rendered `{ sql, params }` and return result rows. */
17
+ export type SqlExecutor = (sql: string, params: unknown[]) => Promise<Record<string, unknown>[]>;
18
+ /** Synchronous driver seam (e.g. better-sqlite3) for the sync `runBehavior` path. */
19
+ export type SqlExecutorSync = (sql: string, params: unknown[]) => Record<string, unknown>[];
20
+ /** The dialect placeholder form: PostgreSQL uses `$N`, MySQL/SQLite keep `?`. */
21
+ export type Dialect = 'postgres' | 'mysql' | 'sqlite';
22
+ /**
23
+ * Render `?` placeholders into the dialect form.
24
+ *
25
+ * - PostgreSQL: `?` → `$1, $2, …` left-to-right, **quote-aware** — a `?` inside a
26
+ * single-quoted SQL string literal is NOT a placeholder and is left untouched (mirrors
27
+ * `litedbmodel.rs` `rewrite_placeholders`, #42). For SQL with no literal `?` (all
28
+ * compiled forms today) this is byte-identical to the original naive
29
+ * `src/drivers/postgres.ts` `convertPlaceholders`; it only diverges — correctly — when a
30
+ * string literal contains a `?` (e.g. a Raw-SQL escape hatch), which the naive form would
31
+ * mis-number.
32
+ * - MySQL / SQLite: `?` unchanged.
33
+ *
34
+ * There is NO array placeholder-count-expansion for ANY dialect (epic #43/#45): every
35
+ * array/batch surface now binds the whole array/rows as ONE param against STATIC SQL
36
+ * text — PG via `= ANY(?::t[])` / `UNNEST`, MySQL/SQLite via a single JSON param expanded
37
+ * server-side (`MEMBER OF` / `JSON_TABLE` / `json_each`; see `json-array.ts`/`json-batch.ts`).
38
+ * So `renderPlaceholders` is a pure `?`→`$N` mapping with a fixed placeholder count.
39
+ */
40
+ export declare function renderPlaceholders(sql: string, dialect: Dialect): string;
41
+ /** Assemble the evaluated ports (drop-on-skip, splice nested) and render the dialect form. */
42
+ export declare function renderPorts(ports: Record<string, Value>, dialect: Dialect): AssembledSql;
43
+ /**
44
+ * Build the async `makeSQL` handler bound to a driver + dialect. This is what a
45
+ * consumer registers under the catalog name `makeSQL` for `runBehaviorAsync`.
46
+ *
47
+ * A skipped component contributes nothing and never touches the driver — it returns
48
+ * the empty result (`[]`) so downstream wiring reading its result sees "no rows".
49
+ */
50
+ export declare function makeSqlHandler(exec: SqlExecutor, dialect: Dialect): (ports: Record<string, Value>, _ctx: HandlerCtx) => Promise<{
51
+ ok: Value;
52
+ }>;
53
+ /**
54
+ * Build the synchronous `makeSQL` handler (for `runBehavior` + a sync driver such as
55
+ * better-sqlite3). Returns a bc {@link Handler}.
56
+ */
57
+ export declare function makeSqlHandlerSync(exec: SqlExecutorSync, dialect: Dialect): Handler;
58
+ //# sourceMappingURL=handler.d.ts.map
@@ -0,0 +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,oBAAoB,CAAC;AACrE,OAAO,EAAiC,KAAK,YAAY,EAAE,MAAM,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"}
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ /**
3
+ * litedbmodel v2 SCP — the `makeSQL` HANDLER + dialect placeholder render.
4
+ *
5
+ * The handler is the ONE consumer implementation point behind the `makeSQL` catalog
6
+ * leaf (spec §11 item 4): it receives the evaluated `{ sql, params, skip }` port
7
+ * bundle from bc's `runBehavior`, assembles it (drop-on-skip, splice nested makeSQL),
8
+ * renders the dialect placeholder form, binds params, and executes the SQL. Side
9
+ * effects / driver / connection live entirely here (C4 — the IR carries no
10
+ * implementation).
11
+ *
12
+ * bc supplies composition / value-eval / envelope / plan; litedbmodel supplies only
13
+ * this handler + the compile that emits the SQL text.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.renderPlaceholders = renderPlaceholders;
17
+ exports.renderPorts = renderPorts;
18
+ exports.makeSqlHandler = makeSqlHandler;
19
+ exports.makeSqlHandlerSync = makeSqlHandlerSync;
20
+ const makesql_1 = require("./makesql");
21
+ /**
22
+ * Render `?` placeholders into the dialect form.
23
+ *
24
+ * - PostgreSQL: `?` → `$1, $2, …` left-to-right, **quote-aware** — a `?` inside a
25
+ * single-quoted SQL string literal is NOT a placeholder and is left untouched (mirrors
26
+ * `litedbmodel.rs` `rewrite_placeholders`, #42). For SQL with no literal `?` (all
27
+ * compiled forms today) this is byte-identical to the original naive
28
+ * `src/drivers/postgres.ts` `convertPlaceholders`; it only diverges — correctly — when a
29
+ * string literal contains a `?` (e.g. a Raw-SQL escape hatch), which the naive form would
30
+ * mis-number.
31
+ * - MySQL / SQLite: `?` unchanged.
32
+ *
33
+ * There is NO array placeholder-count-expansion for ANY dialect (epic #43/#45): every
34
+ * array/batch surface now binds the whole array/rows as ONE param against STATIC SQL
35
+ * text — PG via `= ANY(?::t[])` / `UNNEST`, MySQL/SQLite via a single JSON param expanded
36
+ * server-side (`MEMBER OF` / `JSON_TABLE` / `json_each`; see `json-array.ts`/`json-batch.ts`).
37
+ * So `renderPlaceholders` is a pure `?`→`$N` mapping with a fixed placeholder count.
38
+ */
39
+ function renderPlaceholders(sql, dialect) {
40
+ if (dialect !== 'postgres')
41
+ return sql;
42
+ let out = '';
43
+ let index = 0;
44
+ let inString = false;
45
+ for (let i = 0; i < sql.length; i++) {
46
+ const ch = sql[i];
47
+ if (inString) {
48
+ out += ch;
49
+ if (ch === "'")
50
+ inString = false; // end of string literal (SQL '' escape re-opens on the next ')
51
+ }
52
+ else if (ch === "'") {
53
+ out += ch;
54
+ inString = true;
55
+ }
56
+ else if (ch === '?') {
57
+ out += `$${++index}`;
58
+ }
59
+ else {
60
+ out += ch;
61
+ }
62
+ }
63
+ return out;
64
+ }
65
+ /**
66
+ * Coerce the evaluated `params` port back to a `MakeSQL['params']` list. bc evaluates
67
+ * each port value; a nested `makeSQL` param arrives as an object `{ sql, params, skip? }`
68
+ * and a bound value arrives as its opaque value. Nothing to transform — the handler
69
+ * treats them structurally in {@link assembleMakeSQL}.
70
+ */
71
+ function toMakeSQL(ports) {
72
+ return {
73
+ sql: ports.sql,
74
+ params: ports.params ?? [],
75
+ skip: ports.skip === true,
76
+ };
77
+ }
78
+ /** Assemble the evaluated ports (drop-on-skip, splice nested) and render the dialect form. */
79
+ function renderPorts(ports, dialect) {
80
+ const node = toMakeSQL(ports);
81
+ const assembled = (0, makesql_1.assembleMakeSQL)(node);
82
+ return { sql: renderPlaceholders(assembled.sql, dialect), params: assembled.params };
83
+ }
84
+ /**
85
+ * Build the async `makeSQL` handler bound to a driver + dialect. This is what a
86
+ * consumer registers under the catalog name `makeSQL` for `runBehaviorAsync`.
87
+ *
88
+ * A skipped component contributes nothing and never touches the driver — it returns
89
+ * the empty result (`[]`) so downstream wiring reading its result sees "no rows".
90
+ */
91
+ function makeSqlHandler(exec, dialect) {
92
+ return async (ports, _ctx) => {
93
+ if (ports.skip === true)
94
+ return { ok: [] };
95
+ const { sql, params } = renderPorts(ports, dialect);
96
+ const rows = await exec(sql, params);
97
+ return { ok: rows };
98
+ };
99
+ }
100
+ /**
101
+ * Build the synchronous `makeSQL` handler (for `runBehavior` + a sync driver such as
102
+ * better-sqlite3). Returns a bc {@link Handler}.
103
+ */
104
+ function makeSqlHandlerSync(exec, dialect) {
105
+ return (ports, _ctx) => {
106
+ if (ports.skip === true)
107
+ return { ok: [] };
108
+ const { sql, params } = renderPorts(ports, dialect);
109
+ const rows = exec(sql, params);
110
+ return { ok: rows };
111
+ };
112
+ }
113
+ //# sourceMappingURL=handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler.js","sourceRoot":"","sources":["../../../src/scp/makesql/handler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AA+BH,gDAoBC;AAiBD,kCAIC;AASD,wCAOC;AAMD,gDAOC;AAlGD,uCAA6E;AAU7E;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kBAAkB,CAAC,GAAW,EAAE,OAAgB;IAC9D,IAAI,OAAO,KAAK,UAAU;QAAE,OAAO,GAAG,CAAC;IACvC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,QAAQ,EAAE,CAAC;YACb,GAAG,IAAI,EAAE,CAAC;YACV,IAAI,EAAE,KAAK,GAAG;gBAAE,QAAQ,G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CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACrC,OAAO,EAAE,EAAE,EAAE,IAAwB,EAAE,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,kBAAkB,CAAC,IAAqB,EAAE,OAAgB;IACxE,OAAO,CAAC,KAA4B,EAAE,IAAgB,EAAE,EAAE;QACxD,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;YAAE,OAAO,EAAE,EAAE,EAAE,EAAsB,EAAE,CAAC;QAC/D,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,EAAE,EAAE,EAAE,IAAwB,EAAE,CAAC;IAC1C,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * litedbmodel v2 SCP — the LOCKED `makeSQL` surface (epic #43 / design #45).
3
+ *
4
+ * ONE bc catalog component `makeSQL(sql, params, skip?)` + its handler + the compile
5
+ * that emits tuned dialect SQL text (by reusing the original builders). A query is a
6
+ * composition of `makeSQL` components; a subquery is a nested `makeSQL` in a param
7
+ * slot. Everything (`= ANY`, LATERAL, UNNEST, cast, batch shapes) is TEXT inside `sql`.
8
+ * bc supplies composition / value-eval / envelope / plan; litedbmodel supplies the
9
+ * catalog leaf + handler + compile. Pure-JSON bundle, multi-language ready.
10
+ */
11
+ export { MAKESQL, makeSqlCatalogEntry, LITEDBMODEL_MAKESQL_CATALOG, isMakeSQL, assembleMakeSQL, composeMakeSQL, } from './makesql';
12
+ export type { MakeSQL, SqlParam, AssembledSql } from './makesql';
13
+ export { renderPlaceholders, renderPorts, makeSqlHandler, makeSqlHandlerSync, } from './handler';
14
+ export type { Dialect, SqlExecutor, SqlExecutorSync } from './handler';
15
+ export { compileWhere, whereClause, andTrailing, formatterFor, pgCastFormatter, noCastFormatter, } from './compile';
16
+ export { compileSelect } from './compile-select';
17
+ export type { SelectDesc } from './compile-select';
18
+ export { builderFor, compileInsert, compileInsertMany, compileUpdateMany, compileUpdateSingle, compileDelete, compileDeleteMany, } from './compile-crud';
19
+ export type { InsertManyBuildOptions } from './compile-crud';
20
+ export { inferPgArrayType, resolvePgArrayCast, PG_ARRAY_CAST_TOKEN, compileSingleKeyUnlimited, compileSingleKeyLimited, compileCompositeKeyUnlimited, compileCompositeKeyStaticUnlimited, compileCompositeKeyLimited, compileCompositeKeyStaticLimited, } from './compile-relation';
21
+ export type { RelationCompileBase } from './compile-relation';
22
+ export { inListJson, JsonArrayConditions, conditionsFor } from './json-array';
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';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.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,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAGxD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,GACZ,MAAM,MAAM,CAAC;AACd,YAAY,EACV,MAAM,EACN,IAAI,EACJ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,MAAM,CAAC;AAKd,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK7E,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAI7G,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ /**
3
+ * litedbmodel v2 SCP — the LOCKED `makeSQL` surface (epic #43 / design #45).
4
+ *
5
+ * ONE bc catalog component `makeSQL(sql, params, skip?)` + its handler + the compile
6
+ * that emits tuned dialect SQL text (by reusing the original builders). A query is a
7
+ * composition of `makeSQL` components; a subquery is a nested `makeSQL` in a param
8
+ * slot. Everything (`= ANY`, LATERAL, UNNEST, cast, batch shapes) is TEXT inside `sql`.
9
+ * bc supplies composition / value-eval / envelope / plan; litedbmodel supplies the
10
+ * catalog leaf + handler + compile. Pure-JSON bundle, multi-language ready.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.executeTransaction = exports.stripMysqlPkHint = exports.mysqlPkHint = exports.literalize = exports.deriveBatchPlan = exports.deriveTransactionPlan = exports.makeSqlInput = exports.makeSqlComponentIR = exports.rowsHaveDbToken = exports.mysqlJsonTableColumn = exports.sqliteUpdateManyJson = exports.mysqlUpdateManyJson = exports.sqliteInsertJson = exports.mysqlInsertJson = exports.conditionsFor = exports.JsonArrayConditions = exports.inListJson = exports.compileCompositeKeyStaticLimited = exports.compileCompositeKeyLimited = exports.compileCompositeKeyStaticUnlimited = exports.compileCompositeKeyUnlimited = exports.compileSingleKeyLimited = exports.compileSingleKeyUnlimited = exports.PG_ARRAY_CAST_TOKEN = exports.resolvePgArrayCast = exports.inferPgArrayType = exports.compileDeleteMany = exports.compileDelete = exports.compileUpdateSingle = exports.compileUpdateMany = exports.compileInsertMany = exports.compileInsert = exports.builderFor = exports.compileSelect = exports.noCastFormatter = exports.pgCastFormatter = exports.formatterFor = exports.andTrailing = exports.whereClause = exports.compileWhere = exports.makeSqlHandlerSync = exports.makeSqlHandler = exports.renderPorts = exports.renderPlaceholders = exports.composeMakeSQL = exports.assembleMakeSQL = exports.isMakeSQL = exports.LITEDBMODEL_MAKESQL_CATALOG = exports.makeSqlCatalogEntry = exports.MAKESQL = void 0;
14
+ exports.mysqlPoolExecutor = exports.pgPoolExecutor = exports.renderReadPrimary = exports.executeReadGraphAsync = exports.executeReadGraph = exports.compileReadGraph = exports.executeReadBehavior = exports.executeStaticWrite = exports.executeStaticBundle = exports.compileSelectNode = exports.compileStaticBundle = exports.compileRelationMap = exports.compileAuthoredNode = exports.compileAuthoredBehavior = exports.IN_SENTINEL = exports.compileWriteNode = exports.renderTxStatement = exports.countingDriver = void 0;
15
+ // Catalog leaf + assembly core.
16
+ var makesql_1 = require("./makesql");
17
+ Object.defineProperty(exports, "MAKESQL", { enumerable: true, get: function () { return makesql_1.MAKESQL; } });
18
+ Object.defineProperty(exports, "makeSqlCatalogEntry", { enumerable: true, get: function () { return makesql_1.makeSqlCatalogEntry; } });
19
+ Object.defineProperty(exports, "LITEDBMODEL_MAKESQL_CATALOG", { enumerable: true, get: function () { return makesql_1.LITEDBMODEL_MAKESQL_CATALOG; } });
20
+ Object.defineProperty(exports, "isMakeSQL", { enumerable: true, get: function () { return makesql_1.isMakeSQL; } });
21
+ Object.defineProperty(exports, "assembleMakeSQL", { enumerable: true, get: function () { return makesql_1.assembleMakeSQL; } });
22
+ Object.defineProperty(exports, "composeMakeSQL", { enumerable: true, get: function () { return makesql_1.composeMakeSQL; } });
23
+ // Handler + dialect placeholder render.
24
+ var handler_1 = require("./handler");
25
+ Object.defineProperty(exports, "renderPlaceholders", { enumerable: true, get: function () { return handler_1.renderPlaceholders; } });
26
+ Object.defineProperty(exports, "renderPorts", { enumerable: true, get: function () { return handler_1.renderPorts; } });
27
+ Object.defineProperty(exports, "makeSqlHandler", { enumerable: true, get: function () { return handler_1.makeSqlHandler; } });
28
+ Object.defineProperty(exports, "makeSqlHandlerSync", { enumerable: true, get: function () { return handler_1.makeSqlHandlerSync; } });
29
+ // Compile (WHERE / conditions / values).
30
+ var compile_1 = require("./compile");
31
+ Object.defineProperty(exports, "compileWhere", { enumerable: true, get: function () { return compile_1.compileWhere; } });
32
+ Object.defineProperty(exports, "whereClause", { enumerable: true, get: function () { return compile_1.whereClause; } });
33
+ Object.defineProperty(exports, "andTrailing", { enumerable: true, get: function () { return compile_1.andTrailing; } });
34
+ Object.defineProperty(exports, "formatterFor", { enumerable: true, get: function () { return compile_1.formatterFor; } });
35
+ Object.defineProperty(exports, "pgCastFormatter", { enumerable: true, get: function () { return compile_1.pgCastFormatter; } });
36
+ Object.defineProperty(exports, "noCastFormatter", { enumerable: true, get: function () { return compile_1.noCastFormatter; } });
37
+ // Compile (SELECT tail).
38
+ var compile_select_1 = require("./compile-select");
39
+ Object.defineProperty(exports, "compileSelect", { enumerable: true, get: function () { return compile_select_1.compileSelect; } });
40
+ // Compile (CRUD).
41
+ var compile_crud_1 = require("./compile-crud");
42
+ Object.defineProperty(exports, "builderFor", { enumerable: true, get: function () { return compile_crud_1.builderFor; } });
43
+ Object.defineProperty(exports, "compileInsert", { enumerable: true, get: function () { return compile_crud_1.compileInsert; } });
44
+ Object.defineProperty(exports, "compileInsertMany", { enumerable: true, get: function () { return compile_crud_1.compileInsertMany; } });
45
+ Object.defineProperty(exports, "compileUpdateMany", { enumerable: true, get: function () { return compile_crud_1.compileUpdateMany; } });
46
+ Object.defineProperty(exports, "compileUpdateSingle", { enumerable: true, get: function () { return compile_crud_1.compileUpdateSingle; } });
47
+ Object.defineProperty(exports, "compileDelete", { enumerable: true, get: function () { return compile_crud_1.compileDelete; } });
48
+ Object.defineProperty(exports, "compileDeleteMany", { enumerable: true, get: function () { return compile_crud_1.compileDeleteMany; } });
49
+ // Compile (relations).
50
+ var compile_relation_1 = require("./compile-relation");
51
+ Object.defineProperty(exports, "inferPgArrayType", { enumerable: true, get: function () { return compile_relation_1.inferPgArrayType; } });
52
+ Object.defineProperty(exports, "resolvePgArrayCast", { enumerable: true, get: function () { return compile_relation_1.resolvePgArrayCast; } });
53
+ Object.defineProperty(exports, "PG_ARRAY_CAST_TOKEN", { enumerable: true, get: function () { return compile_relation_1.PG_ARRAY_CAST_TOKEN; } });
54
+ Object.defineProperty(exports, "compileSingleKeyUnlimited", { enumerable: true, get: function () { return compile_relation_1.compileSingleKeyUnlimited; } });
55
+ Object.defineProperty(exports, "compileSingleKeyLimited", { enumerable: true, get: function () { return compile_relation_1.compileSingleKeyLimited; } });
56
+ Object.defineProperty(exports, "compileCompositeKeyUnlimited", { enumerable: true, get: function () { return compile_relation_1.compileCompositeKeyUnlimited; } });
57
+ Object.defineProperty(exports, "compileCompositeKeyStaticUnlimited", { enumerable: true, get: function () { return compile_relation_1.compileCompositeKeyStaticUnlimited; } });
58
+ Object.defineProperty(exports, "compileCompositeKeyLimited", { enumerable: true, get: function () { return compile_relation_1.compileCompositeKeyLimited; } });
59
+ Object.defineProperty(exports, "compileCompositeKeyStaticLimited", { enumerable: true, get: function () { return compile_relation_1.compileCompositeKeyStaticLimited; } });
60
+ // Single-JSON-param array/batch forms for MySQL 8 + SQLite (epic #43/#45) — the
61
+ // intentional deviation from v1's N-placeholder expansion (server-side JSON expansion).
62
+ var json_array_1 = require("./json-array");
63
+ Object.defineProperty(exports, "inListJson", { enumerable: true, get: function () { return json_array_1.inListJson; } });
64
+ Object.defineProperty(exports, "JsonArrayConditions", { enumerable: true, get: function () { return json_array_1.JsonArrayConditions; } });
65
+ Object.defineProperty(exports, "conditionsFor", { enumerable: true, get: function () { return json_array_1.conditionsFor; } });
66
+ var json_batch_1 = require("./json-batch");
67
+ Object.defineProperty(exports, "mysqlInsertJson", { enumerable: true, get: function () { return json_batch_1.mysqlInsertJson; } });
68
+ Object.defineProperty(exports, "sqliteInsertJson", { enumerable: true, get: function () { return json_batch_1.sqliteInsertJson; } });
69
+ Object.defineProperty(exports, "mysqlUpdateManyJson", { enumerable: true, get: function () { return json_batch_1.mysqlUpdateManyJson; } });
70
+ Object.defineProperty(exports, "sqliteUpdateManyJson", { enumerable: true, get: function () { return json_batch_1.sqliteUpdateManyJson; } });
71
+ Object.defineProperty(exports, "mysqlJsonTableColumn", { enumerable: true, get: function () { return json_batch_1.mysqlJsonTableColumn; } });
72
+ Object.defineProperty(exports, "rowsHaveDbToken", { enumerable: true, get: function () { return json_batch_1.rowsHaveDbToken; } });
73
+ // bc IR wiring (a query rides runBehavior as a makeSQL component).
74
+ var ir_1 = require("./ir");
75
+ Object.defineProperty(exports, "makeSqlComponentIR", { enumerable: true, get: function () { return ir_1.makeSqlComponentIR; } });
76
+ Object.defineProperty(exports, "makeSqlInput", { enumerable: true, get: function () { return ir_1.makeSqlInput; } });
77
+ // Write-time relations → makeSQL transaction plan + 1-tx runtime (epic #43/#45 Phase B).
78
+ var tx_1 = require("./tx");
79
+ Object.defineProperty(exports, "deriveTransactionPlan", { enumerable: true, get: function () { return tx_1.deriveTransactionPlan; } });
80
+ Object.defineProperty(exports, "deriveBatchPlan", { enumerable: true, get: function () { return tx_1.deriveBatchPlan; } });
81
+ Object.defineProperty(exports, "literalize", { enumerable: true, get: function () { return tx_1.literalize; } });
82
+ Object.defineProperty(exports, "mysqlPkHint", { enumerable: true, get: function () { return tx_1.mysqlPkHint; } });
83
+ Object.defineProperty(exports, "stripMysqlPkHint", { enumerable: true, get: function () { return tx_1.stripMysqlPkHint; } });
84
+ Object.defineProperty(exports, "executeTransaction", { enumerable: true, get: function () { return tx_1.executeTransaction; } });
85
+ Object.defineProperty(exports, "countingDriver", { enumerable: true, get: function () { return tx_1.countingDriver; } });
86
+ Object.defineProperty(exports, "renderTxStatement", { enumerable: true, get: function () { return tx_1.renderTxStatement; } });
87
+ Object.defineProperty(exports, "compileWriteNode", { enumerable: true, get: function () { return tx_1.compileWriteNode; } });
88
+ Object.defineProperty(exports, "IN_SENTINEL", { enumerable: true, get: function () { return tx_1.IN_SENTINEL; } });
89
+ // Authoring → makeSQL bundle (Phase A, epic #43/#45): the ADDITIVE producer that routes an
90
+ // authored behavior's declared/eager query (WS2 `../authoring.ts` component IR) through the
91
+ // makeSQL compile* — preserving the single-compile-path invariant (declaration ≡ eager).
92
+ var authoring_compile_1 = require("./authoring-compile");
93
+ Object.defineProperty(exports, "compileAuthoredBehavior", { enumerable: true, get: function () { return authoring_compile_1.compileAuthoredBehavior; } });
94
+ Object.defineProperty(exports, "compileAuthoredNode", { enumerable: true, get: function () { return authoring_compile_1.compileAuthoredNode; } });
95
+ Object.defineProperty(exports, "compileRelationMap", { enumerable: true, get: function () { return authoring_compile_1.compileRelationMap; } });
96
+ // The STATIC, portable makeSQL bundle + runtime (design #45 owner-confirmed static-bundle):
97
+ // symbolic compile (no concrete input) → deferred value-specs + skip expression, bc-evaluated
98
+ // per-input at runtime. The SOLE makeSQL read/compile path (epic #43/#45 Phase B).
99
+ var static_bundle_1 = require("./static-bundle");
100
+ Object.defineProperty(exports, "compileStaticBundle", { enumerable: true, get: function () { return static_bundle_1.compileStaticBundle; } });
101
+ Object.defineProperty(exports, "compileSelectNode", { enumerable: true, get: function () { return static_bundle_1.compileSelectNode; } });
102
+ Object.defineProperty(exports, "executeStaticBundle", { enumerable: true, get: function () { return static_bundle_1.executeStaticBundle; } });
103
+ Object.defineProperty(exports, "executeStaticWrite", { enumerable: true, get: function () { return static_bundle_1.executeStaticWrite; } });
104
+ Object.defineProperty(exports, "executeReadBehavior", { enumerable: true, get: function () { return static_bundle_1.executeReadBehavior; } });
105
+ Object.defineProperty(exports, "compileReadGraph", { enumerable: true, get: function () { return static_bundle_1.compileReadGraph; } });
106
+ Object.defineProperty(exports, "executeReadGraph", { enumerable: true, get: function () { return static_bundle_1.executeReadGraph; } });
107
+ Object.defineProperty(exports, "executeReadGraphAsync", { enumerable: true, get: function () { return static_bundle_1.executeReadGraphAsync; } });
108
+ Object.defineProperty(exports, "renderReadPrimary", { enumerable: true, get: function () { return static_bundle_1.renderReadPrimary; } });
109
+ // Pooled async executor factories (PG / MySQL) that turn the plan's concurrency into real parallel
110
+ // read-relation DB I/O behind the async seam (#40).
111
+ var pool_executor_1 = require("./pool-executor");
112
+ Object.defineProperty(exports, "pgPoolExecutor", { enumerable: true, get: function () { return pool_executor_1.pgPoolExecutor; } });
113
+ Object.defineProperty(exports, "mysqlPoolExecutor", { enumerable: true, get: function () { return pool_executor_1.mysqlPoolExecutor; } });
114
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/scp/makesql/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;AAEH,gCAAgC;AAChC,qCAOmB;AANjB,kGAAA,OAAO,OAAA;AACP,8GAAA,mBAAmB,OAAA;AACnB,sHAAA,2BAA2B,OAAA;AAC3B,oGAAA,SA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mE;AACnE,2BAAwD;AAA/C,wGAAA,kBAAkB,OAAA;AAAE,kGAAA,YAAY,OAAA;AAEzC,yFAAyF;AACzF,2BAWc;AAVZ,2GAAA,qBAAqB,OAAA;AACrB,qGAAA,eAAe,OAAA;AACf,gGAAA,UAAU,OAAA;AACV,iGAAA,WAAW,OAAA;AACX,sGAAA,gBAAgB,OAAA;AAChB,wGAAA,kBAAkB,OAAA;AAClB,oGAAA,cAAc,OAAA;AACd,uGAAA,iBAAiB,OAAA;AACjB,sGAAA,gBAAgB,OAAA;AAChB,iGAAA,WAAW,OAAA;AAgBb,2FAA2F;AAC3F,4FAA4F;AAC5F,yFAAyF;AACzF,yDAI6B;AAH3B,4HAAA,uBAAuB,OAAA;AACvB,wHAAA,mBAAmB,OAAA;AACnB,uHAAA,kBAAkB,OAAA;AAIpB,4FAA4F;AAC5F,8FAA8F;AAC9F,mFAAmF;AACnF,iDAUyB;AATvB,oHAAA,mBAAmB,OAAA;AACnB,kHAAA,iBAAiB,OAAA;AACjB,oHAAA,mBAAmB,OAAA;AACnB,mHAAA,kBAAkB,OAAA;AAClB,oHAAA,mBAAmB,OAAA;AACnB,iHAAA,gBAAgB,OAAA;AAChB,iHAAA,gBAAgB,OAAA;AAChB,sHAAA,qBAAqB,OAAA;AACrB,kHAAA,iBAAiB,OAAA;AAInB,mGAAmG;AACnG,oDAAoD;AACpD,iDAAoE;AAA3D,+GAAA,cAAc,OAAA;AAAE,kHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * litedbmodel v2 SCP — build a bc `ComponentGraphIR` whose single body node is a
3
+ * `makeSQL` componentRef, so a query rides bc's `runBehavior` (composition / value-eval
4
+ * / plan / envelope come free). The `makeSQL` ports are bc Expression IR: `sql` and
5
+ * `skip` are simple literals/refs; `params` is an `{ arr: [...] }` of Expression IR
6
+ * nodes (each a bound-value literal, an input ref, or a nested-`makeSQL` `{ obj: … }`).
7
+ *
8
+ * The bundle is pure JSON (multi-language ready). The handler (see `handler.ts`)
9
+ * assembles + binds + executes. bc validates the envelope and evaluates the ports.
10
+ */
11
+ import type { ComponentGraphIR } from 'behavior-contracts';
12
+ import { type MakeSQL, type SqlParam, isMakeSQL } from './makesql';
13
+ /** Wrap a bound SQL value as a bc Expression IR literal node.
14
+ *
15
+ * bc's Expression IR represents ints as `{int:"…"}` and rejects bare `Date`/arrays.
16
+ * SQL bound values are opaque to bc, so we pass them as an inert `{lit}` marker that
17
+ * the handler unwraps — but since bc has no `lit` op, we instead carry the raw params
18
+ * OUT-OF-BAND: the IR references `input.params` by ref and the caller supplies the
19
+ * assembled params in the input scope. This keeps values byte-exact (no bc coercion).
20
+ */
21
+ /**
22
+ * Build the single-`makeSQL` component IR + the input scope for a pre-assembled query.
23
+ *
24
+ * We keep SQL bound values OUT of bc's numeric/format coercion by binding them through
25
+ * the input scope: the `params` port is `{ ref: ["__sqlParams"] }` and the caller
26
+ * passes `{ __sqlParams: <the params array>, __sql: <text>, __skip: <bool> }` as input.
27
+ * bc evaluates the refs (returning the values verbatim), then hands them to the
28
+ * `makeSQL` handler, which assembles + binds + executes.
29
+ */
30
+ export declare function makeSqlComponentIR(entry?: string): ComponentGraphIR;
31
+ /** The input scope for {@link makeSqlComponentIR}, from a compiled `makeSQL` bundle. */
32
+ export declare function makeSqlInput(node: MakeSQL): Record<string, unknown>;
33
+ /**
34
+ * bc's `evaluateExpression` rejects bare arrays / non-plain values as expressions, and
35
+ * the input scope is validated loosely (refs just read it). Because our params ride the
36
+ * scope as a plain `ref`, bc returns them verbatim (arrays, Dates, nested makeSQL
37
+ * objects) with NO coercion — exactly what the handler needs. `isMakeSQL` /
38
+ * `SqlParam` re-exported for callers building nested params.
39
+ */
40
+ export { isMakeSQL };
41
+ export type { SqlParam };
42
+ //# sourceMappingURL=ir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../../src/scp/makesql/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAW,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE5E;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAU,GAAG,gBAAgB,CAsBpE;AAED,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAMnE;AAED;;;;;;GAMG;AACH,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * litedbmodel v2 SCP — build a bc `ComponentGraphIR` whose single body node is a
4
+ * `makeSQL` componentRef, so a query rides bc's `runBehavior` (composition / value-eval
5
+ * / plan / envelope come free). The `makeSQL` ports are bc Expression IR: `sql` and
6
+ * `skip` are simple literals/refs; `params` is an `{ arr: [...] }` of Expression IR
7
+ * nodes (each a bound-value literal, an input ref, or a nested-`makeSQL` `{ obj: … }`).
8
+ *
9
+ * The bundle is pure JSON (multi-language ready). The handler (see `handler.ts`)
10
+ * assembles + binds + executes. bc validates the envelope and evaluates the ports.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.isMakeSQL = void 0;
14
+ exports.makeSqlComponentIR = makeSqlComponentIR;
15
+ exports.makeSqlInput = makeSqlInput;
16
+ const makesql_1 = require("./makesql");
17
+ Object.defineProperty(exports, "isMakeSQL", { enumerable: true, get: function () { return makesql_1.isMakeSQL; } });
18
+ /** Wrap a bound SQL value as a bc Expression IR literal node.
19
+ *
20
+ * bc's Expression IR represents ints as `{int:"…"}` and rejects bare `Date`/arrays.
21
+ * SQL bound values are opaque to bc, so we pass them as an inert `{lit}` marker that
22
+ * the handler unwraps — but since bc has no `lit` op, we instead carry the raw params
23
+ * OUT-OF-BAND: the IR references `input.params` by ref and the caller supplies the
24
+ * assembled params in the input scope. This keeps values byte-exact (no bc coercion).
25
+ */
26
+ /**
27
+ * Build the single-`makeSQL` component IR + the input scope for a pre-assembled query.
28
+ *
29
+ * We keep SQL bound values OUT of bc's numeric/format coercion by binding them through
30
+ * the input scope: the `params` port is `{ ref: ["__sqlParams"] }` and the caller
31
+ * passes `{ __sqlParams: <the params array>, __sql: <text>, __skip: <bool> }` as input.
32
+ * bc evaluates the refs (returning the values verbatim), then hands them to the
33
+ * `makeSQL` handler, which assembles + binds + executes.
34
+ */
35
+ function makeSqlComponentIR(entry = 'Query') {
36
+ const component = {
37
+ name: entry,
38
+ inputPorts: {
39
+ __sql: { type: 'string', required: true },
40
+ __sqlParams: { type: 'arr' },
41
+ __skip: { type: 'bool' },
42
+ },
43
+ body: [
44
+ {
45
+ id: 'q',
46
+ component: makesql_1.MAKESQL,
47
+ ports: {
48
+ sql: { ref: ['__sql'] },
49
+ params: { ref: ['__sqlParams'] },
50
+ skip: { ref: ['__skip'] },
51
+ },
52
+ },
53
+ ],
54
+ output: { ref: ['q'] },
55
+ };
56
+ return { irVersion: 1, exprVersion: 2, components: [component] };
57
+ }
58
+ /** The input scope for {@link makeSqlComponentIR}, from a compiled `makeSQL` bundle. */
59
+ function makeSqlInput(node) {
60
+ return {
61
+ __sql: node.sql,
62
+ __sqlParams: node.params,
63
+ __skip: node.skip === true,
64
+ };
65
+ }
66
+ //# sourceMappingURL=ir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.js","sourceRoot":"","sources":["../../../src/scp/makesql/ir.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAuBH,gDAsBC;AAGD,oCAMC;AAnDD,uCAA4E;AA4DnE,0FA5DsC,mBAAS,OA4DtC;AA1DlB;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,KAAK,GAAG,OAAO;IAChD,MAAM,S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