litedbmodel 2.1.0 → 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.
- package/README.md +7 -0
- package/dist/DBConditions.d.ts.map +1 -1
- package/dist/DBConditions.js +16 -1
- package/dist/DBConditions.js.map +1 -1
- package/dist/DBHandler.d.ts.map +1 -1
- package/dist/DBHandler.js +6 -0
- package/dist/DBHandler.js.map +1 -1
- package/dist/DBModel.d.ts +84 -2
- package/dist/DBModel.d.ts.map +1 -1
- package/dist/DBModel.js +312 -29
- package/dist/DBModel.js.map +1 -1
- package/dist/decorators.d.ts +52 -0
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +83 -0
- package/dist/decorators.js.map +1 -1
- package/dist/drivers/mysql.d.ts.map +1 -1
- package/dist/drivers/mysql.js +6 -2
- package/dist/drivers/mysql.js.map +1 -1
- package/dist/drivers/postgres.d.ts.map +1 -1
- package/dist/drivers/postgres.js +6 -2
- package/dist/drivers/postgres.js.map +1 -1
- package/dist/drivers/sqlite.d.ts.map +1 -1
- package/dist/drivers/sqlite.js +12 -2
- package/dist/drivers/sqlite.js.map +1 -1
- package/dist/index.cjs +10741 -0
- package/dist/index.d.cts +1 -0
- package/dist/scp/coltype.d.ts +26 -1
- package/dist/scp/coltype.d.ts.map +1 -1
- package/dist/scp/coltype.js +82 -15
- package/dist/scp/coltype.js.map +1 -1
- package/dist/scp/connection-routing.d.ts +312 -0
- package/dist/scp/connection-routing.d.ts.map +1 -0
- package/dist/scp/connection-routing.js +394 -0
- package/dist/scp/connection-routing.js.map +1 -0
- package/dist/scp/dbmodel-runtime.d.ts +101 -0
- package/dist/scp/dbmodel-runtime.d.ts.map +1 -0
- package/dist/scp/dbmodel-runtime.js +174 -0
- package/dist/scp/dbmodel-runtime.js.map +1 -0
- package/dist/scp/decorator-adapter.d.ts +196 -0
- package/dist/scp/decorator-adapter.d.ts.map +1 -0
- package/dist/scp/decorator-adapter.js +286 -0
- package/dist/scp/decorator-adapter.js.map +1 -0
- package/dist/scp/emit/emitter.d.ts +108 -0
- package/dist/scp/emit/emitter.d.ts.map +1 -0
- package/dist/scp/emit/emitter.js +782 -0
- package/dist/scp/emit/emitter.js.map +1 -0
- package/dist/scp/emit/endpoint.d.ts +248 -0
- package/dist/scp/emit/endpoint.d.ts.map +1 -0
- package/dist/scp/emit/endpoint.js +20 -0
- package/dist/scp/emit/endpoint.js.map +1 -0
- package/dist/scp/emit/index.d.ts +11 -0
- package/dist/scp/emit/index.d.ts.map +1 -0
- package/dist/scp/emit/index.js +13 -0
- package/dist/scp/emit/index.js.map +1 -0
- package/dist/scp/errors.d.ts +45 -1
- package/dist/scp/errors.d.ts.map +1 -1
- package/dist/scp/errors.js +47 -1
- package/dist/scp/errors.js.map +1 -1
- package/dist/scp/exec-context.d.ts +390 -0
- package/dist/scp/exec-context.d.ts.map +1 -0
- package/dist/scp/exec-context.js +540 -0
- package/dist/scp/exec-context.js.map +1 -0
- package/dist/scp/grouping.d.ts +32 -0
- package/dist/scp/grouping.d.ts.map +1 -0
- package/dist/scp/grouping.js +0 -0
- package/dist/scp/grouping.js.map +1 -0
- package/dist/scp/index.cjs +6814 -15731
- package/dist/scp/index.d.cts +1 -0
- package/dist/scp/index.d.mts +1 -0
- package/dist/scp/index.d.ts +47 -49
- package/dist/scp/index.d.ts.map +1 -1
- package/dist/scp/index.js +174 -152
- package/dist/scp/index.js.map +1 -1
- package/dist/scp/index.mjs +5561 -3704
- package/dist/scp/leaf-transport.d.ts +50 -0
- package/dist/scp/leaf-transport.d.ts.map +1 -0
- package/dist/scp/leaf-transport.js +92 -0
- package/dist/scp/leaf-transport.js.map +1 -0
- package/dist/scp/leaves.d.ts +174 -0
- package/dist/scp/leaves.d.ts.map +1 -0
- package/dist/scp/leaves.js +287 -0
- package/dist/scp/leaves.js.map +1 -0
- package/dist/scp/limit-config.d.ts +118 -0
- package/dist/scp/limit-config.d.ts.map +1 -0
- package/dist/scp/limit-config.js +126 -0
- package/dist/scp/limit-config.js.map +1 -0
- package/dist/scp/makesql/compile-relation.d.ts +49 -23
- package/dist/scp/makesql/compile-relation.d.ts.map +1 -1
- package/dist/scp/makesql/compile-relation.js +101 -76
- package/dist/scp/makesql/compile-relation.js.map +1 -1
- package/dist/scp/makesql/compile-select.d.ts +45 -10
- package/dist/scp/makesql/compile-select.d.ts.map +1 -1
- package/dist/scp/makesql/compile-select.js +50 -10
- package/dist/scp/makesql/compile-select.js.map +1 -1
- package/dist/scp/makesql/handler.d.ts +1 -1
- package/dist/scp/makesql/handler.d.ts.map +1 -1
- package/dist/scp/makesql/index.d.ts +7 -9
- package/dist/scp/makesql/index.d.ts.map +1 -1
- package/dist/scp/makesql/index.js +17 -28
- package/dist/scp/makesql/index.js.map +1 -1
- package/dist/scp/makesql/json-array.d.ts +65 -0
- package/dist/scp/makesql/json-array.d.ts.map +1 -1
- package/dist/scp/makesql/json-array.js +99 -10
- package/dist/scp/makesql/json-array.js.map +1 -1
- package/dist/scp/makesql/json-batch.d.ts.map +1 -1
- package/dist/scp/makesql/json-batch.js +15 -18
- package/dist/scp/makesql/json-batch.js.map +1 -1
- package/dist/scp/makesql/makesql.d.ts +1 -1
- package/dist/scp/makesql/makesql.d.ts.map +1 -1
- package/dist/scp/makesql/mysql-returning.d.ts +93 -0
- package/dist/scp/makesql/mysql-returning.d.ts.map +1 -0
- package/dist/scp/makesql/mysql-returning.js +215 -0
- package/dist/scp/makesql/mysql-returning.js.map +1 -0
- package/dist/scp/makesql/outtype.d.ts +40 -54
- package/dist/scp/makesql/outtype.d.ts.map +1 -1
- package/dist/scp/makesql/outtype.js +46 -204
- package/dist/scp/makesql/outtype.js.map +1 -1
- package/dist/scp/makesql/pool-executor.d.ts +86 -34
- package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
- package/dist/scp/makesql/pool-executor.js +179 -39
- package/dist/scp/makesql/pool-executor.js.map +1 -1
- package/dist/scp/makesql/tx.d.ts +107 -22
- package/dist/scp/makesql/tx.d.ts.map +1 -1
- package/dist/scp/makesql/tx.js +451 -97
- package/dist/scp/makesql/tx.js.map +1 -1
- package/dist/scp/makesql/writeouttype.d.ts +4 -4
- package/dist/scp/makesql/writeouttype.d.ts.map +1 -1
- package/dist/scp/makesql/writeouttype.js +5 -3
- package/dist/scp/makesql/writeouttype.js.map +1 -1
- package/dist/scp/middleware.d.ts +287 -0
- package/dist/scp/middleware.d.ts.map +1 -0
- package/dist/scp/middleware.js +358 -0
- package/dist/scp/middleware.js.map +1 -0
- package/dist/scp/relation.d.ts +65 -8
- package/dist/scp/relation.d.ts.map +1 -1
- package/dist/scp/relation.js +154 -93
- package/dist/scp/relation.js.map +1 -1
- package/dist/scp/tx-options.d.ts +136 -0
- package/dist/scp/tx-options.d.ts.map +1 -0
- package/dist/scp/tx-options.js +184 -0
- package/dist/scp/tx-options.js.map +1 -0
- package/dist/scp/write-bundle.d.ts +131 -0
- package/dist/scp/write-bundle.d.ts.map +1 -0
- package/dist/scp/write-bundle.js +160 -0
- package/dist/scp/write-bundle.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/docs/design/phase-a-execution-context.md +139 -0
- package/package.json +14 -13
- package/dist/scp/authoring-sql.d.ts +0 -134
- package/dist/scp/authoring-sql.d.ts.map +0 -1
- package/dist/scp/authoring-sql.js +0 -191
- package/dist/scp/authoring-sql.js.map +0 -1
- package/dist/scp/authoring.d.ts +0 -218
- package/dist/scp/authoring.d.ts.map +0 -1
- package/dist/scp/authoring.js +0 -351
- package/dist/scp/authoring.js.map +0 -1
- package/dist/scp/catalog.d.ts +0 -95
- package/dist/scp/catalog.d.ts.map +0 -1
- package/dist/scp/catalog.js +0 -245
- package/dist/scp/catalog.js.map +0 -1
- package/dist/scp/codegen.d.ts +0 -201
- package/dist/scp/codegen.d.ts.map +0 -1
- package/dist/scp/codegen.js +0 -605
- package/dist/scp/codegen.js.map +0 -1
- package/dist/scp/find-filter-guard.d.ts +0 -68
- package/dist/scp/find-filter-guard.d.ts.map +0 -1
- package/dist/scp/find-filter-guard.js +0 -88
- package/dist/scp/find-filter-guard.js.map +0 -1
- package/dist/scp/guard.d.ts +0 -43
- package/dist/scp/guard.d.ts.map +0 -1
- package/dist/scp/guard.js +0 -140
- package/dist/scp/guard.js.map +0 -1
- package/dist/scp/makesql/authoring-compile.d.ts +0 -90
- package/dist/scp/makesql/authoring-compile.d.ts.map +0 -1
- package/dist/scp/makesql/authoring-compile.js +0 -505
- package/dist/scp/makesql/authoring-compile.js.map +0 -1
- package/dist/scp/makesql/static-bundle.d.ts +0 -196
- package/dist/scp/makesql/static-bundle.d.ts.map +0 -1
- package/dist/scp/makesql/static-bundle.js +0 -1244
- package/dist/scp/makesql/static-bundle.js.map +0 -1
- package/dist/scp/runtime.d.ts +0 -243
- package/dist/scp/runtime.d.ts.map +0 -1
- package/dist/scp/runtime.js +0 -422
- package/dist/scp/runtime.js.map +0 -1
package/dist/scp/authoring.d.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* litedbmodel v2 SCP — Authoring Parse (WS2, #22).
|
|
3
|
-
*
|
|
4
|
-
* The litedbmodel authoring surface (spec §2.4 / §7) and the SINGLE compile path
|
|
5
|
-
* (spec §9) that lowers BOTH the SCP declaration blocks and the eager public API into
|
|
6
|
-
* ONE internal Component-graph IR (behavior-contracts' portable JSON). This module is a
|
|
7
|
-
* thin SQL-backend consumer over bc's shared authoring layer (`SemanticBehavior` /
|
|
8
|
-
* `compileBehaviors` / `catalogComponents` — bc#24): litedbmodel supplies ONLY the
|
|
9
|
-
* Catalog ({@link LITEDBMODEL_CATALOG}) and the CQRS effect derivation; bc owns all
|
|
10
|
-
* composition, `$`-wiring, structured control (`when` / `.map`), expression lowering,
|
|
11
|
-
* plan derivation and the portability self-check (C2: "the difference is the catalog
|
|
12
|
-
* only"). It mirrors graphddb's `publishBehaviors` precedent exactly.
|
|
13
|
-
*
|
|
14
|
-
* ## Authoring surface (spec §2.4)
|
|
15
|
-
*
|
|
16
|
-
* - **Root = class**: a `SemanticBehavior` subclass (default) or an `@behavior`-marked
|
|
17
|
-
* class; each PUBLIC method is one root Behavior (= one component; name = method name).
|
|
18
|
-
* `#`-private / `_`-prefixed members are helpers and are not published. The marker is
|
|
19
|
-
* one-per-class and effect-agnostic — there is NO query/command vocabulary to author.
|
|
20
|
-
* - **Input Port** = the method's `$: In<...>` argument; **Output Port** = its return
|
|
21
|
-
* value; the internal DAG is derived from `$`-refs, `.map` and `when` wiring.
|
|
22
|
-
* - **Leaf vocabulary** = the Catalog only ({@link components} = `catalogComponents(
|
|
23
|
-
* LITEDBMODEL_CATALOG)` — `Select` / `Insert` / `Update` / `Delete` / `Fragment`). There
|
|
24
|
-
* is NO litedbmodel-local authoring vocabulary beyond the Catalog. Conditions/values are
|
|
25
|
-
* written with bc's expression builders (`eq` / `ne` / `coalesce` / …); `cond ? [...] :
|
|
26
|
-
* SKIP` is written as `when(cond, () => <fragment>)` — in a `where` port it lowers to a
|
|
27
|
-
* pure `{cond:[c, <frag>, null]}` Expression IR node (SKIP is the ABSENCE of the
|
|
28
|
-
* fragment when `c` is false — spec §7, WS1 render), NOT a new opcode. Native `?:` / `??`
|
|
29
|
-
* / `&&` are rejected by bc's source scan; use `when` / `coalesce` / `and`.
|
|
30
|
-
*
|
|
31
|
-
* ## CQRS effect (spec §2.4 — derived, never authored)
|
|
32
|
-
*
|
|
33
|
-
* Query vs Command is DERIVED from whether a lowered component references a write-Catalog
|
|
34
|
-
* primitive (`Insert` / `Update` / `Delete` / `Tx`), via {@link deriveContractEffect}
|
|
35
|
-
* (bc `classifyBehaviorEffect` over {@link WRITE_CATALOG_NAMES}). Class names carry no
|
|
36
|
-
* meaning.
|
|
37
|
-
*
|
|
38
|
-
* ## Single compile path (spec §9 — a real invariant)
|
|
39
|
-
*
|
|
40
|
-
* The eager public API ({@link compileEager}) does NOT interpret model metadata on a
|
|
41
|
-
* separate path. It synthesizes the SAME authoring (a one-method `SemanticBehavior`
|
|
42
|
-
* subclass) and runs it through the SAME {@link compileBehaviors}. `test/scp` pins that
|
|
43
|
-
* the eager path and the declaration path for an equivalent query produce byte-identical
|
|
44
|
-
* component IR.
|
|
45
|
-
*/
|
|
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>;
|
|
63
|
-
import { type CatalogName, type ContractEffect } from './catalog';
|
|
64
|
-
import { type MaterializeResolver, type ColumnTypeResolver } from './coltype';
|
|
65
|
-
/**
|
|
66
|
-
* The litedbmodel leaf-component functions for the shared authoring surface —
|
|
67
|
-
* `catalogComponents(LITEDBMODEL_CATALOG)` bound once, lazily (so importing this module
|
|
68
|
-
* does not pay for the binding until authoring actually runs). Invoke them inside
|
|
69
|
-
* `SemanticBehavior` method bodies:
|
|
70
|
-
*
|
|
71
|
-
* ```ts
|
|
72
|
-
* const L = components();
|
|
73
|
-
* class PostBehaviors extends SemanticBehavior {
|
|
74
|
-
* PostSearch($: In<{ authorId: number; status?: string; since: string }>) {
|
|
75
|
-
* const posts = L.Select({ table: 'posts', select: ['id', 'author_id', 'title'],
|
|
76
|
-
* where: [ eq($.authorId, $.authorId),
|
|
77
|
-
* when(ne($.status, null), () => eq($.status, $.status)), // SKIP-optional
|
|
78
|
-
* ge($.since, $.since) ] });
|
|
79
|
-
* const authors = posts.map(($p: Recorded) =>
|
|
80
|
-
* L.Select({ table: 'users', select: ['id', 'name'], where: [ eq($p.author_id, $p.author_id) ] }));
|
|
81
|
-
* return { posts, authors };
|
|
82
|
-
* }
|
|
83
|
-
* }
|
|
84
|
-
* ```
|
|
85
|
-
*
|
|
86
|
-
* `Tx` is in the map but is `portableToIR: false`, so wiring it is rejected at record
|
|
87
|
-
* time — the atomic transaction envelope is a WS3 runtime concern, never authored.
|
|
88
|
-
*/
|
|
89
|
-
export type ComponentFns = Record<CatalogName, (ports: Record<string, unknown>) => Recorded>;
|
|
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
|
-
*/
|
|
95
|
-
export declare function components(): ComponentFns;
|
|
96
|
-
/**
|
|
97
|
-
* One published behavior method: the bc-lowered component (name = the method name) plus
|
|
98
|
-
* its graph-DERIVED CQRS effect (spec §2.4 — the classification source of truth is the
|
|
99
|
-
* component graph; there is no query/command vocabulary for the author to declare).
|
|
100
|
-
*/
|
|
101
|
-
export interface BehaviorMethodSpec {
|
|
102
|
-
/** The method (= root Behavior = component) name. */
|
|
103
|
-
readonly name: string;
|
|
104
|
-
/** Graph-derived Query/Command classification (never author-declared). */
|
|
105
|
-
readonly effect: ContractEffect;
|
|
106
|
-
/** The lowered portable component (bc `compileBehaviors` output). */
|
|
107
|
-
readonly component: Component;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* A resolved behavior contract — {@link publishBehaviors} output. Carries the whole
|
|
111
|
-
* bc-lowered {@link ComponentGraphIR} (directly consumable by WS3's runtime + WS1's
|
|
112
|
-
* backend-compile) and the per-method specs with their derived effects.
|
|
113
|
-
*/
|
|
114
|
-
export interface BehaviorModelContract {
|
|
115
|
-
/** The authored class name (diagnostics only). */
|
|
116
|
-
readonly className: string;
|
|
117
|
-
/** The bc-lowered portable IR (all methods; the shared internal IR — spec §9). */
|
|
118
|
-
readonly ir: ComponentGraphIR;
|
|
119
|
-
/** The lowered components (`ir.components`, one per public method). */
|
|
120
|
-
readonly components: readonly Component[];
|
|
121
|
-
/** Method name → lowered component + derived effect. */
|
|
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;
|
|
158
|
-
}
|
|
159
|
-
/** Options passed through to bc `compileBehaviors` (additive; all optional). */
|
|
160
|
-
export interface PublishBehaviorsOptions {
|
|
161
|
-
/**
|
|
162
|
-
* Input Port schema overrides (method → port → schema): build-time evaluation derives
|
|
163
|
-
* port NAMES from `$` accesses, but TS types (`In<...>`) are erased at runtime, so a
|
|
164
|
-
* consumer that wants the IR to carry the declared type strings supplies them here.
|
|
165
|
-
*/
|
|
166
|
-
readonly inputPorts?: Record<string, Record<string, PortSchema>>;
|
|
167
|
-
/** Plan concurrency recorded on the lowered components (bc default: 16). */
|
|
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;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
|
|
180
|
-
* public methods are the root Behaviors (spec §2.4). Lowers through the single compile
|
|
181
|
-
* path ({@link lowerBehaviorClass}).
|
|
182
|
-
*
|
|
183
|
-
* @throws bc `AuthoringFailure` for a non-declarative body (native control syntax,
|
|
184
|
-
* coercion, unknown/missing ports, …); an `Error` from the catalog validation for an
|
|
185
|
-
* undeclared dynamic port; a `PortabilityError` for a non-portable expression.
|
|
186
|
-
*/
|
|
187
|
-
export declare function publishBehaviors(cls: BehaviorClass, options?: PublishBehaviorsOptions): BehaviorModelContract;
|
|
188
|
-
/**
|
|
189
|
-
* An eager authoring body: the composition a public-API call (`find` / `create` / …)
|
|
190
|
-
* would run, expressed in the SAME authoring vocabulary as a declaration-block method.
|
|
191
|
-
* `$` is the recorder Input Port and `L` is the litedbmodel leaf-component map
|
|
192
|
-
* ({@link components}); it returns the Output Port. Expression builders (`eq` /
|
|
193
|
-
* `coalesce` / …) and `when` MUST be used over `$` (they only work inside the recording
|
|
194
|
-
* frame) — never native `?:` / `??` / `&&`.
|
|
195
|
-
*
|
|
196
|
-
* The public API funnels here so its lowering shares one compiler with the declaration
|
|
197
|
-
* path (spec §9). It is installed AS the class method (below), so bc's source scan covers
|
|
198
|
-
* it in full — the eager path has the same fail-closed coverage as the declaration path.
|
|
199
|
-
*/
|
|
200
|
-
export type EagerBehavior = ($: Recorded, L: ComponentFns) => unknown;
|
|
201
|
-
/**
|
|
202
|
-
* Compile an eager public-API call through the SINGLE compile path (spec §9). It does NOT
|
|
203
|
-
* interpret model metadata on a separate path: it synthesizes a one-method
|
|
204
|
-
* `SemanticBehavior` subclass whose single public method IS `fn` (with `L` bound), and
|
|
205
|
-
* runs it through the SAME {@link compileBehaviors} the declaration path uses.
|
|
206
|
-
* Consequently the eager path and an equivalent declaration method produce byte-identical
|
|
207
|
-
* component IR (pinned by the single-compile-path equivalence test in `test/scp/authoring.test.ts`).
|
|
208
|
-
*
|
|
209
|
-
* Because `fn` is installed AS the class method (not delegated to via a closure), bc's
|
|
210
|
-
* source scan runs over `fn`'s own source — native control syntax inside `fn` is rejected
|
|
211
|
-
* fail-closed exactly as in a declaration block (no unscanned-thunk residual). The
|
|
212
|
-
* synthesized method is named `name` so the emitted component name matches a
|
|
213
|
-
* declaration-block method of the same name (byte-identity requires equal names).
|
|
214
|
-
*
|
|
215
|
-
* @throws the same failures as {@link publishBehaviors} (single path, single guard).
|
|
216
|
-
*/
|
|
217
|
-
export declare function compileEager(name: string, fn: EagerBehavior, options?: PublishBehaviorsOptions): BehaviorModelContract;
|
|
218
|
-
//# sourceMappingURL=authoring.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.d.ts","sourceRoot":"","sources":["../../src/scp/authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAU5B,6GAA6G;AAC7G,MAAM,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AACnD,sEAAsE;AACtE,MAAM,MAAM,SAAS,GAAG,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAClE,6CAA6C;AAC7C,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AACjD,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE;IAAE,GAAG,EAAE,OAAO,CAA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litedbmodel v2 SCP — Authoring Parse (WS2, #22).
|
|
4
|
-
*
|
|
5
|
-
* The litedbmodel authoring surface (spec §2.4 / §7) and the SINGLE compile path
|
|
6
|
-
* (spec §9) that lowers BOTH the SCP declaration blocks and the eager public API into
|
|
7
|
-
* ONE internal Component-graph IR (behavior-contracts' portable JSON). This module is a
|
|
8
|
-
* thin SQL-backend consumer over bc's shared authoring layer (`SemanticBehavior` /
|
|
9
|
-
* `compileBehaviors` / `catalogComponents` — bc#24): litedbmodel supplies ONLY the
|
|
10
|
-
* Catalog ({@link LITEDBMODEL_CATALOG}) and the CQRS effect derivation; bc owns all
|
|
11
|
-
* composition, `$`-wiring, structured control (`when` / `.map`), expression lowering,
|
|
12
|
-
* plan derivation and the portability self-check (C2: "the difference is the catalog
|
|
13
|
-
* only"). It mirrors graphddb's `publishBehaviors` precedent exactly.
|
|
14
|
-
*
|
|
15
|
-
* ## Authoring surface (spec §2.4)
|
|
16
|
-
*
|
|
17
|
-
* - **Root = class**: a `SemanticBehavior` subclass (default) or an `@behavior`-marked
|
|
18
|
-
* class; each PUBLIC method is one root Behavior (= one component; name = method name).
|
|
19
|
-
* `#`-private / `_`-prefixed members are helpers and are not published. The marker is
|
|
20
|
-
* one-per-class and effect-agnostic — there is NO query/command vocabulary to author.
|
|
21
|
-
* - **Input Port** = the method's `$: In<...>` argument; **Output Port** = its return
|
|
22
|
-
* value; the internal DAG is derived from `$`-refs, `.map` and `when` wiring.
|
|
23
|
-
* - **Leaf vocabulary** = the Catalog only ({@link components} = `catalogComponents(
|
|
24
|
-
* LITEDBMODEL_CATALOG)` — `Select` / `Insert` / `Update` / `Delete` / `Fragment`). There
|
|
25
|
-
* is NO litedbmodel-local authoring vocabulary beyond the Catalog. Conditions/values are
|
|
26
|
-
* written with bc's expression builders (`eq` / `ne` / `coalesce` / …); `cond ? [...] :
|
|
27
|
-
* SKIP` is written as `when(cond, () => <fragment>)` — in a `where` port it lowers to a
|
|
28
|
-
* pure `{cond:[c, <frag>, null]}` Expression IR node (SKIP is the ABSENCE of the
|
|
29
|
-
* fragment when `c` is false — spec §7, WS1 render), NOT a new opcode. Native `?:` / `??`
|
|
30
|
-
* / `&&` are rejected by bc's source scan; use `when` / `coalesce` / `and`.
|
|
31
|
-
*
|
|
32
|
-
* ## CQRS effect (spec §2.4 — derived, never authored)
|
|
33
|
-
*
|
|
34
|
-
* Query vs Command is DERIVED from whether a lowered component references a write-Catalog
|
|
35
|
-
* primitive (`Insert` / `Update` / `Delete` / `Tx`), via {@link deriveContractEffect}
|
|
36
|
-
* (bc `classifyBehaviorEffect` over {@link WRITE_CATALOG_NAMES}). Class names carry no
|
|
37
|
-
* meaning.
|
|
38
|
-
*
|
|
39
|
-
* ## Single compile path (spec §9 — a real invariant)
|
|
40
|
-
*
|
|
41
|
-
* The eager public API ({@link compileEager}) does NOT interpret model metadata on a
|
|
42
|
-
* separate path. It synthesizes the SAME authoring (a one-method `SemanticBehavior`
|
|
43
|
-
* subclass) and runs it through the SAME {@link compileBehaviors}. `test/scp` pins that
|
|
44
|
-
* the eager path and the declaration path for an equivalent query produce byte-identical
|
|
45
|
-
* component IR.
|
|
46
|
-
*/
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
exports.components = components;
|
|
49
|
-
exports.publishBehaviors = publishBehaviors;
|
|
50
|
-
exports.compileEager = compileEager;
|
|
51
|
-
const behavior_contracts_1 = require("behavior-contracts");
|
|
52
|
-
const catalog_1 = require("./catalog");
|
|
53
|
-
const guard_1 = require("./guard");
|
|
54
|
-
const coltype_1 = require("./coltype");
|
|
55
|
-
const outtype_1 = require("./makesql/outtype");
|
|
56
|
-
let boundRaw;
|
|
57
|
-
let boundComponents;
|
|
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
|
-
*/
|
|
128
|
-
function components() {
|
|
129
|
-
if (boundComponents === undefined) {
|
|
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;
|
|
135
|
-
}
|
|
136
|
-
return boundComponents;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* The single lowering core (spec §9): bc `compileBehaviors` → litedbmodel catalog check →
|
|
140
|
-
* litedbmodel portability guard → CQRS effect derivation. BOTH {@link publishBehaviors}
|
|
141
|
-
* (declaration path) and {@link compileEager} (eager public-API path) call this so there
|
|
142
|
-
* is exactly one compile path and one guard application.
|
|
143
|
-
*
|
|
144
|
-
* Pipeline (all loud, nothing dropped):
|
|
145
|
-
* 1. bc `compileBehaviors(cls)` lowers every public method into one portable component
|
|
146
|
-
* (bc owns ALL composition/lowering and runs its own `assertPortableComponentGraph`);
|
|
147
|
-
* 2. {@link assertComponentsInCatalog} validates every lowered component against
|
|
148
|
-
* `LITEDBMODEL_CATALOG` — the SAME check the WS1 emitter path uses (covers the
|
|
149
|
-
* dynamic `values.<field>` / `set.<field>` write families bc's static schema check
|
|
150
|
-
* cannot enumerate);
|
|
151
|
-
* 3. {@link assertComponentGraphPortable} AUTO-APPLIES litedbmodel's portability guard
|
|
152
|
-
* over every port Expression IR node (WS2 AC — the lower path rejects any opcode
|
|
153
|
-
* outside bc's closed set fail-closed, independently of bc's own self-check);
|
|
154
|
-
* 4. the CQRS effect of every method is DERIVED from its graph
|
|
155
|
-
* ({@link deriveContractEffect}); the author never declares it.
|
|
156
|
-
*/
|
|
157
|
-
function lowerBehaviorClass(cls, options) {
|
|
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, {
|
|
174
|
-
...(options.inputPorts !== undefined ? { inputPorts: options.inputPorts } : {}),
|
|
175
|
-
...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),
|
|
176
|
-
}));
|
|
177
|
-
(0, catalog_1.assertComponentsInCatalog)(ir.components);
|
|
178
|
-
(0, guard_1.assertComponentGraphPortable)(ir);
|
|
179
|
-
const methods = {};
|
|
180
|
-
for (const component of ir.components) {
|
|
181
|
-
methods[component.name] = {
|
|
182
|
-
name: component.name,
|
|
183
|
-
effect: (0, catalog_1.deriveContractEffect)(component),
|
|
184
|
-
component,
|
|
185
|
-
};
|
|
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);
|
|
193
|
-
return {
|
|
194
|
-
className,
|
|
195
|
-
ir,
|
|
196
|
-
components: ir.components,
|
|
197
|
-
methods,
|
|
198
|
-
...(materializeResolver !== undefined ? { materializeResolver } : {}),
|
|
199
|
-
...(resolveColumnType !== undefined ? { resolveColumnType } : {}),
|
|
200
|
-
};
|
|
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
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
|
|
291
|
-
* public methods are the root Behaviors (spec §2.4). Lowers through the single compile
|
|
292
|
-
* path ({@link lowerBehaviorClass}).
|
|
293
|
-
*
|
|
294
|
-
* @throws bc `AuthoringFailure` for a non-declarative body (native control syntax,
|
|
295
|
-
* coercion, unknown/missing ports, …); an `Error` from the catalog validation for an
|
|
296
|
-
* undeclared dynamic port; a `PortabilityError` for a non-portable expression.
|
|
297
|
-
*/
|
|
298
|
-
function publishBehaviors(cls, options = {}) {
|
|
299
|
-
return lowerBehaviorClass(cls, options);
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* Compile an eager public-API call through the SINGLE compile path (spec §9). It does NOT
|
|
303
|
-
* interpret model metadata on a separate path: it synthesizes a one-method
|
|
304
|
-
* `SemanticBehavior` subclass whose single public method IS `fn` (with `L` bound), and
|
|
305
|
-
* runs it through the SAME {@link compileBehaviors} the declaration path uses.
|
|
306
|
-
* Consequently the eager path and an equivalent declaration method produce byte-identical
|
|
307
|
-
* component IR (pinned by the single-compile-path equivalence test in `test/scp/authoring.test.ts`).
|
|
308
|
-
*
|
|
309
|
-
* Because `fn` is installed AS the class method (not delegated to via a closure), bc's
|
|
310
|
-
* source scan runs over `fn`'s own source — native control syntax inside `fn` is rejected
|
|
311
|
-
* fail-closed exactly as in a declaration block (no unscanned-thunk residual). The
|
|
312
|
-
* synthesized method is named `name` so the emitted component name matches a
|
|
313
|
-
* declaration-block method of the same name (byte-identity requires equal names).
|
|
314
|
-
*
|
|
315
|
-
* @throws the same failures as {@link publishBehaviors} (single path, single guard).
|
|
316
|
-
*/
|
|
317
|
-
function compileEager(name, fn, options = {}) {
|
|
318
|
-
const cls = makeEagerClass(name, fn);
|
|
319
|
-
return lowerBehaviorClass(cls, options);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Build a one-method `SemanticBehavior` subclass whose PUBLIC method is named `name` and
|
|
323
|
-
* IS `fn` bound to the litedbmodel leaf map. bc records the method with a recorder `$`;
|
|
324
|
-
* `fn`'s source is what bc scans for native control syntax (full fail-closed coverage).
|
|
325
|
-
*/
|
|
326
|
-
function makeEagerClass(name, fn) {
|
|
327
|
-
const L = components();
|
|
328
|
-
const cls = class extends behavior_contracts_1.SemanticBehavior {
|
|
329
|
-
};
|
|
330
|
-
// The method's source that bc scans is `fn.toString()` (via `method`), so native control
|
|
331
|
-
// syntax inside `fn` is rejected. `L` is bound by partial application, NOT closed over
|
|
332
|
-
// inside `fn`'s scanned body.
|
|
333
|
-
const method = function ($) {
|
|
334
|
-
return fn($, L);
|
|
335
|
-
};
|
|
336
|
-
// Make bc scan `fn`'s source (the authored body), not the trivial wrapper: expose `fn`'s
|
|
337
|
-
// source as the method's `toString`. bc's scanNativeControlSyntax reads `method.toString()`.
|
|
338
|
-
Object.defineProperty(method, 'toString', { value: () => fn.toString(), configurable: true });
|
|
339
|
-
Object.defineProperty(cls.prototype, name, {
|
|
340
|
-
value: method,
|
|
341
|
-
writable: true,
|
|
342
|
-
enumerable: false,
|
|
343
|
-
configurable: true,
|
|
344
|
-
});
|
|
345
|
-
Object.defineProperty(cls, 'name', { value: name, configurable: true });
|
|
346
|
-
return cls;
|
|
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`).
|
|
351
|
-
//# sourceMappingURL=authoring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.js","sourceRoot":"","sources":["../../src/scp/authoring.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;;AAiJH,gCAQC;AA0QD,4CAKC;AAkCD,oCAOC;AA/cD,2DAQ4B;AAoB5B,uCAMmB;AACnB,mCAAuD;AACvD,uCAA2J;AAC3J,+CAA0E;AA4B1E,IAAI,QAAkC,CAAC;AACvC,IAAI,eAAyC,CAAC;AAE9C;;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