litedbmodel 2.0.2 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +127 -24
- package/dist/decorators.js.map +1 -1
- package/dist/drivers/mysql.d.ts.map +1 -1
- package/dist/drivers/mysql.js +12 -2
- package/dist/drivers/mysql.js.map +1 -1
- package/dist/drivers/postgres.d.ts.map +1 -1
- package/dist/drivers/postgres.js +13 -2
- package/dist/drivers/postgres.js.map +1 -1
- package/dist/drivers/sqlite.d.ts +2 -0
- package/dist/drivers/sqlite.d.ts.map +1 -1
- package/dist/drivers/sqlite.js +49 -4
- 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 +108 -0
- package/dist/scp/coltype.d.ts.map +1 -1
- package/dist/scp/coltype.js +293 -6
- 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 +6432 -17579
- package/dist/scp/index.d.cts +1 -0
- package/dist/scp/index.d.mts +1 -0
- package/dist/scp/index.d.ts +51 -52
- package/dist/scp/index.d.ts.map +1 -1
- package/dist/scp/index.js +189 -152
- package/dist/scp/index.js.map +1 -1
- package/dist/scp/index.mjs +6067 -3659
- 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 -10
- package/dist/scp/makesql/index.d.ts.map +1 -1
- package/dist/scp/makesql/index.js +19 -30
- 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 +21 -19
- 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 +75 -34
- package/dist/scp/makesql/outtype.d.ts.map +1 -1
- package/dist/scp/makesql/outtype.js +91 -118
- package/dist/scp/makesql/outtype.js.map +1 -1
- package/dist/scp/makesql/pool-executor.d.ts +135 -13
- package/dist/scp/makesql/pool-executor.d.ts.map +1 -1
- package/dist/scp/makesql/pool-executor.js +229 -21
- 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 +7 -8
- package/dist/scp/makesql/writeouttype.d.ts.map +1 -1
- package/dist/scp/makesql/writeouttype.js +8 -7
- 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 +80 -9
- package/dist/scp/relation.d.ts.map +1 -1
- package/dist/scp/relation.js +198 -78
- 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/BENCHMARK.md +58 -56
- package/docs/benchmark-chart.svg +166 -166
- package/docs/design/phase-a-execution-context.md +139 -0
- package/package.json +16 -9
- 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 -155
- package/dist/scp/authoring.d.ts.map +0 -1
- package/dist/scp/authoring.js +0 -162
- package/dist/scp/authoring.js.map +0 -1
- package/dist/scp/catalog.d.ts +0 -94
- package/dist/scp/catalog.d.ts.map +0 -1
- package/dist/scp/catalog.js +0 -234
- package/dist/scp/catalog.js.map +0 -1
- package/dist/scp/codegen.d.ts +0 -189
- package/dist/scp/codegen.d.ts.map +0 -1
- package/dist/scp/codegen.js +0 -421
- 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 -134
- 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 -494
- package/dist/scp/makesql/authoring-compile.js.map +0 -1
- package/dist/scp/makesql/ir.d.ts +0 -42
- package/dist/scp/makesql/ir.d.ts.map +0 -1
- package/dist/scp/makesql/ir.js +0 -66
- package/dist/scp/makesql/ir.js.map +0 -1
- package/dist/scp/makesql/static-bundle.d.ts +0 -187
- package/dist/scp/makesql/static-bundle.d.ts.map +0 -1
- package/dist/scp/makesql/static-bundle.js +0 -1113
- package/dist/scp/makesql/static-bundle.js.map +0 -1
- package/dist/scp/runtime.d.ts +0 -242
- package/dist/scp/runtime.d.ts.map +0 -1
- package/dist/scp/runtime.js +0 -400
- package/dist/scp/runtime.js.map +0 -1
package/dist/scp/authoring.d.ts
DELETED
|
@@ -1,155 +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 Component, type ComponentGraphIR, type MapNode, type ComponentRefNode, type PortSchema, type Recorded } from 'behavior-contracts';
|
|
47
|
-
import { type CatalogName, type ContractEffect } from './catalog';
|
|
48
|
-
/**
|
|
49
|
-
* The litedbmodel leaf-component functions for the shared authoring surface —
|
|
50
|
-
* `catalogComponents(LITEDBMODEL_CATALOG)` bound once, lazily (so importing this module
|
|
51
|
-
* does not pay for the binding until authoring actually runs). Invoke them inside
|
|
52
|
-
* `SemanticBehavior` method bodies:
|
|
53
|
-
*
|
|
54
|
-
* ```ts
|
|
55
|
-
* const L = components();
|
|
56
|
-
* class PostBehaviors extends SemanticBehavior {
|
|
57
|
-
* PostSearch($: In<{ authorId: number; status?: string; since: string }>) {
|
|
58
|
-
* const posts = L.Select({ table: 'posts', select: ['id', 'author_id', 'title'],
|
|
59
|
-
* where: [ eq($.authorId, $.authorId),
|
|
60
|
-
* when(ne($.status, null), () => eq($.status, $.status)), // SKIP-optional
|
|
61
|
-
* ge($.since, $.since) ] });
|
|
62
|
-
* const authors = posts.map(($p: Recorded) =>
|
|
63
|
-
* L.Select({ table: 'users', select: ['id', 'name'], where: [ eq($p.author_id, $p.author_id) ] }));
|
|
64
|
-
* return { posts, authors };
|
|
65
|
-
* }
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* `Tx` is in the map but is `portableToIR: false`, so wiring it is rejected at record
|
|
70
|
-
* time — the atomic transaction envelope is a WS3 runtime concern, never authored.
|
|
71
|
-
*/
|
|
72
|
-
export type ComponentFns = Record<CatalogName, (ports: Record<string, unknown>) => Recorded>;
|
|
73
|
-
/** The `catalogComponents(LITEDBMODEL_CATALOG)` leaf-function map (typed, memoized). */
|
|
74
|
-
export declare function components(): ComponentFns;
|
|
75
|
-
/**
|
|
76
|
-
* One published behavior method: the bc-lowered component (name = the method name) plus
|
|
77
|
-
* its graph-DERIVED CQRS effect (spec §2.4 — the classification source of truth is the
|
|
78
|
-
* component graph; there is no query/command vocabulary for the author to declare).
|
|
79
|
-
*/
|
|
80
|
-
export interface BehaviorMethodSpec {
|
|
81
|
-
/** The method (= root Behavior = component) name. */
|
|
82
|
-
readonly name: string;
|
|
83
|
-
/** Graph-derived Query/Command classification (never author-declared). */
|
|
84
|
-
readonly effect: ContractEffect;
|
|
85
|
-
/** The lowered portable component (bc `compileBehaviors` output). */
|
|
86
|
-
readonly component: Component;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* A resolved behavior contract — {@link publishBehaviors} output. Carries the whole
|
|
90
|
-
* bc-lowered {@link ComponentGraphIR} (directly consumable by WS3's runtime + WS1's
|
|
91
|
-
* backend-compile) and the per-method specs with their derived effects.
|
|
92
|
-
*/
|
|
93
|
-
export interface BehaviorModelContract {
|
|
94
|
-
/** The authored class name (diagnostics only). */
|
|
95
|
-
readonly className: string;
|
|
96
|
-
/** The bc-lowered portable IR (all methods; the shared internal IR — spec §9). */
|
|
97
|
-
readonly ir: ComponentGraphIR;
|
|
98
|
-
/** The lowered components (`ir.components`, one per public method). */
|
|
99
|
-
readonly components: readonly Component[];
|
|
100
|
-
/** Method name → lowered component + derived effect. */
|
|
101
|
-
readonly methods: Readonly<Record<string, BehaviorMethodSpec>>;
|
|
102
|
-
}
|
|
103
|
-
/** Options passed through to bc `compileBehaviors` (additive; all optional). */
|
|
104
|
-
export interface PublishBehaviorsOptions {
|
|
105
|
-
/**
|
|
106
|
-
* Input Port schema overrides (method → port → schema): build-time evaluation derives
|
|
107
|
-
* port NAMES from `$` accesses, but TS types (`In<...>`) are erased at runtime, so a
|
|
108
|
-
* consumer that wants the IR to carry the declared type strings supplies them here.
|
|
109
|
-
*/
|
|
110
|
-
readonly inputPorts?: Record<string, Record<string, PortSchema>>;
|
|
111
|
-
/** Plan concurrency recorded on the lowered components (bc default: 16). */
|
|
112
|
-
readonly concurrency?: number;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
|
|
116
|
-
* public methods are the root Behaviors (spec §2.4). Lowers through the single compile
|
|
117
|
-
* path ({@link lowerBehaviorClass}).
|
|
118
|
-
*
|
|
119
|
-
* @throws bc `AuthoringFailure` for a non-declarative body (native control syntax,
|
|
120
|
-
* coercion, unknown/missing ports, …); an `Error` from the catalog validation for an
|
|
121
|
-
* undeclared dynamic port; a `PortabilityError` for a non-portable expression.
|
|
122
|
-
*/
|
|
123
|
-
export declare function publishBehaviors(cls: BehaviorClass, options?: PublishBehaviorsOptions): BehaviorModelContract;
|
|
124
|
-
/**
|
|
125
|
-
* An eager authoring body: the composition a public-API call (`find` / `create` / …)
|
|
126
|
-
* would run, expressed in the SAME authoring vocabulary as a declaration-block method.
|
|
127
|
-
* `$` is the recorder Input Port and `L` is the litedbmodel leaf-component map
|
|
128
|
-
* ({@link components}); it returns the Output Port. Expression builders (`eq` /
|
|
129
|
-
* `coalesce` / …) and `when` MUST be used over `$` (they only work inside the recording
|
|
130
|
-
* frame) — never native `?:` / `??` / `&&`.
|
|
131
|
-
*
|
|
132
|
-
* The public API funnels here so its lowering shares one compiler with the declaration
|
|
133
|
-
* path (spec §9). It is installed AS the class method (below), so bc's source scan covers
|
|
134
|
-
* it in full — the eager path has the same fail-closed coverage as the declaration path.
|
|
135
|
-
*/
|
|
136
|
-
export type EagerBehavior = ($: Recorded, L: ComponentFns) => unknown;
|
|
137
|
-
/**
|
|
138
|
-
* Compile an eager public-API call through the SINGLE compile path (spec §9). It does NOT
|
|
139
|
-
* interpret model metadata on a separate path: it synthesizes a one-method
|
|
140
|
-
* `SemanticBehavior` subclass whose single public method IS `fn` (with `L` bound), and
|
|
141
|
-
* runs it through the SAME {@link compileBehaviors} the declaration path uses.
|
|
142
|
-
* Consequently the eager path and an equivalent declaration method produce byte-identical
|
|
143
|
-
* component IR (pinned by the single-compile-path equivalence test in `test/scp/authoring.test.ts`).
|
|
144
|
-
*
|
|
145
|
-
* Because `fn` is installed AS the class method (not delegated to via a closure), bc's
|
|
146
|
-
* source scan runs over `fn`'s own source — native control syntax inside `fn` is rejected
|
|
147
|
-
* fail-closed exactly as in a declaration block (no unscanned-thunk residual). The
|
|
148
|
-
* synthesized method is named `name` so the emitted component name matches a
|
|
149
|
-
* declaration-block method of the same name (byte-identity requires equal names).
|
|
150
|
-
*
|
|
151
|
-
* @throws the same failures as {@link publishBehaviors} (single path, single guard).
|
|
152
|
-
*/
|
|
153
|
-
export declare function compileEager(name: string, fn: EagerBehavior, options?: PublishBehaviorsOptions): BehaviorModelContract;
|
|
154
|
-
export type { Component, ComponentGraphIR, MapNode, ComponentRefNode };
|
|
155
|
-
//# 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,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAGnB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAI7F,wFAAwF;AACxF,wBAAgB,UAAU,IAAI,YAAY,CAKzC;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,kDAAkD;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,EAAE,gBAAgB,CAAC;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;CAChE;AAED,gFAAgF;AAChF,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACjE,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AA+CD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,OAAO,GAAE,uBAA4B,GACpC,qBAAqB,CAEvB;AAID;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,KAAK,OAAO,CAAC;AAEtE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,aAAa,EACjB,OAAO,GAAE,uBAA4B,GACpC,qBAAqB,CAGvB;AA+BD,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/scp/authoring.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* 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
|
-
let boundComponents;
|
|
55
|
-
/** The `catalogComponents(LITEDBMODEL_CATALOG)` leaf-function map (typed, memoized). */
|
|
56
|
-
function components() {
|
|
57
|
-
if (boundComponents === undefined) {
|
|
58
|
-
boundComponents = (0, behavior_contracts_1.catalogComponents)(catalog_1.LITEDBMODEL_CATALOG);
|
|
59
|
-
}
|
|
60
|
-
return boundComponents;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* The single lowering core (spec §9): bc `compileBehaviors` → litedbmodel catalog check →
|
|
64
|
-
* litedbmodel portability guard → CQRS effect derivation. BOTH {@link publishBehaviors}
|
|
65
|
-
* (declaration path) and {@link compileEager} (eager public-API path) call this so there
|
|
66
|
-
* is exactly one compile path and one guard application.
|
|
67
|
-
*
|
|
68
|
-
* Pipeline (all loud, nothing dropped):
|
|
69
|
-
* 1. bc `compileBehaviors(cls)` lowers every public method into one portable component
|
|
70
|
-
* (bc owns ALL composition/lowering and runs its own `assertPortableComponentGraph`);
|
|
71
|
-
* 2. {@link assertComponentsInCatalog} validates every lowered component against
|
|
72
|
-
* `LITEDBMODEL_CATALOG` — the SAME check the WS1 emitter path uses (covers the
|
|
73
|
-
* dynamic `values.<field>` / `set.<field>` write families bc's static schema check
|
|
74
|
-
* cannot enumerate);
|
|
75
|
-
* 3. {@link assertComponentGraphPortable} AUTO-APPLIES litedbmodel's portability guard
|
|
76
|
-
* over every port Expression IR node (WS2 AC — the lower path rejects any opcode
|
|
77
|
-
* outside bc's closed set fail-closed, independently of bc's own self-check);
|
|
78
|
-
* 4. the CQRS effect of every method is DERIVED from its graph
|
|
79
|
-
* ({@link deriveContractEffect}); the author never declares it.
|
|
80
|
-
*/
|
|
81
|
-
function lowerBehaviorClass(cls, options) {
|
|
82
|
-
const ir = (0, behavior_contracts_1.compileBehaviors)(cls, {
|
|
83
|
-
...(options.inputPorts !== undefined ? { inputPorts: options.inputPorts } : {}),
|
|
84
|
-
...(options.concurrency !== undefined ? { concurrency: options.concurrency } : {}),
|
|
85
|
-
});
|
|
86
|
-
(0, catalog_1.assertComponentsInCatalog)(ir.components);
|
|
87
|
-
(0, guard_1.assertComponentGraphPortable)(ir);
|
|
88
|
-
const methods = {};
|
|
89
|
-
for (const component of ir.components) {
|
|
90
|
-
methods[component.name] = {
|
|
91
|
-
name: component.name,
|
|
92
|
-
effect: (0, catalog_1.deriveContractEffect)(component),
|
|
93
|
-
component,
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
className: cls.name ?? '<anonymous>',
|
|
98
|
-
ir,
|
|
99
|
-
components: ir.components,
|
|
100
|
-
methods,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Publish an SCP declaration block: a `SemanticBehavior` (or `@behavior`) class whose
|
|
105
|
-
* public methods are the root Behaviors (spec §2.4). Lowers through the single compile
|
|
106
|
-
* path ({@link lowerBehaviorClass}).
|
|
107
|
-
*
|
|
108
|
-
* @throws bc `AuthoringFailure` for a non-declarative body (native control syntax,
|
|
109
|
-
* coercion, unknown/missing ports, …); an `Error` from the catalog validation for an
|
|
110
|
-
* undeclared dynamic port; a `PortabilityError` for a non-portable expression.
|
|
111
|
-
*/
|
|
112
|
-
function publishBehaviors(cls, options = {}) {
|
|
113
|
-
return lowerBehaviorClass(cls, options);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Compile an eager public-API call through the SINGLE compile path (spec §9). It does NOT
|
|
117
|
-
* interpret model metadata on a separate path: it synthesizes a one-method
|
|
118
|
-
* `SemanticBehavior` subclass whose single public method IS `fn` (with `L` bound), and
|
|
119
|
-
* runs it through the SAME {@link compileBehaviors} the declaration path uses.
|
|
120
|
-
* Consequently the eager path and an equivalent declaration method produce byte-identical
|
|
121
|
-
* component IR (pinned by the single-compile-path equivalence test in `test/scp/authoring.test.ts`).
|
|
122
|
-
*
|
|
123
|
-
* Because `fn` is installed AS the class method (not delegated to via a closure), bc's
|
|
124
|
-
* source scan runs over `fn`'s own source — native control syntax inside `fn` is rejected
|
|
125
|
-
* fail-closed exactly as in a declaration block (no unscanned-thunk residual). The
|
|
126
|
-
* synthesized method is named `name` so the emitted component name matches a
|
|
127
|
-
* declaration-block method of the same name (byte-identity requires equal names).
|
|
128
|
-
*
|
|
129
|
-
* @throws the same failures as {@link publishBehaviors} (single path, single guard).
|
|
130
|
-
*/
|
|
131
|
-
function compileEager(name, fn, options = {}) {
|
|
132
|
-
const cls = makeEagerClass(name, fn);
|
|
133
|
-
return lowerBehaviorClass(cls, options);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Build a one-method `SemanticBehavior` subclass whose PUBLIC method is named `name` and
|
|
137
|
-
* IS `fn` bound to the litedbmodel leaf map. bc records the method with a recorder `$`;
|
|
138
|
-
* `fn`'s source is what bc scans for native control syntax (full fail-closed coverage).
|
|
139
|
-
*/
|
|
140
|
-
function makeEagerClass(name, fn) {
|
|
141
|
-
const L = components();
|
|
142
|
-
const cls = class extends behavior_contracts_1.SemanticBehavior {
|
|
143
|
-
};
|
|
144
|
-
// The method's source that bc scans is `fn.toString()` (via `method`), so native control
|
|
145
|
-
// syntax inside `fn` is rejected. `L` is bound by partial application, NOT closed over
|
|
146
|
-
// inside `fn`'s scanned body.
|
|
147
|
-
const method = function ($) {
|
|
148
|
-
return fn($, L);
|
|
149
|
-
};
|
|
150
|
-
// Make bc scan `fn`'s source (the authored body), not the trivial wrapper: expose `fn`'s
|
|
151
|
-
// source as the method's `toString`. bc's scanNativeControlSyntax reads `method.toString()`.
|
|
152
|
-
Object.defineProperty(method, 'toString', { value: () => fn.toString(), configurable: true });
|
|
153
|
-
Object.defineProperty(cls.prototype, name, {
|
|
154
|
-
value: method,
|
|
155
|
-
writable: true,
|
|
156
|
-
enumerable: false,
|
|
157
|
-
configurable: true,
|
|
158
|
-
});
|
|
159
|
-
Object.defineProperty(cls, 'name', { value: name, configurable: true });
|
|
160
|
-
return cls;
|
|
161
|
-
}
|
|
162
|
-
//# sourceMappingURL=authoring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authoring.js","sourceRoot":"","sources":["../../src/scp/authoring.ts"],"names":[],"mappings":"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"}
|
package/dist/scp/catalog.d.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* litedbmodel v2 SCP catalog — WS1 (#21).
|
|
3
|
-
*
|
|
4
|
-
* `LITEDBMODEL_CATALOG` is the behavior-contracts–typed `Catalog` that IS the whole
|
|
5
|
-
* per-DSL difference litedbmodel supplies as a SQL-backend consumer (bc C2: "the only
|
|
6
|
-
* per-DSL difference is the catalog"). It mirrors the SHAPE of graphddb's
|
|
7
|
-
* `GRAPHDDB_CATALOG` (`src/spec/catalog.ts`) exactly: compact `PortSchema` constructors,
|
|
8
|
-
* an `entry()` helper, per-primitive `inputPorts`, an `output.shape`, and a
|
|
9
|
-
* `portableToIR` flag. The effect implementation (SQL execution + row→model assembly) is
|
|
10
|
-
* bound separately in the handler registry (WS3, C4 — catalog declares, registry binds).
|
|
11
|
-
*
|
|
12
|
-
* ## Catalog names (spec §1 / §11 item 1)
|
|
13
|
-
*
|
|
14
|
-
* `Select` / `Insert` / `Update` / `Delete` are the CRUD leaf components. `Fragment` is
|
|
15
|
-
* the dynamic WHERE/SET fragment-tree component (SKIP → fragment existence rules, §8);
|
|
16
|
-
* `Tx` is the multi-statement transaction envelope. As in graphddb, the transaction
|
|
17
|
-
* envelope (`Tx`) is `portableToIR: false` — a transaction is emitted as a Component
|
|
18
|
-
* whose body references the per-statement CRUD primitives; the atomic BEGIN/COMMIT
|
|
19
|
-
* envelope is the runtime's execution concern (WS3), never a portable-IR node.
|
|
20
|
-
*
|
|
21
|
-
* ## Port schema conventions
|
|
22
|
-
*
|
|
23
|
-
* A `CatalogEntry.inputPorts` names the STATIC ports of the emitted wiring. Two families
|
|
24
|
-
* are dynamic by construction and are validated by {@link assertComponentsInCatalog}
|
|
25
|
-
* against documented patterns instead of being statically enumerable:
|
|
26
|
-
*
|
|
27
|
-
* - **`where`/`set`/`values` records**: one port per model field, flattened one-port-
|
|
28
|
-
* per-field under a `<group>.<field>` key ({@link WRITE_PORT_FAMILIES}). These carry
|
|
29
|
-
* Expression IR (the field's value/condition), from the closed operator set only.
|
|
30
|
-
*
|
|
31
|
-
* The CRUD entries carry `additionalPorts: true` (bc#26) so bc's shared port check
|
|
32
|
-
* (`checkPortNames` / `buildComponentDefinition`) accepts the dynamic families; every
|
|
33
|
-
* DECLARED port keeps bc's required/type checks regardless of the opt-in. `Tx`'s single
|
|
34
|
-
* port is static, so it keeps bc's fail-closed default.
|
|
35
|
-
*/
|
|
36
|
-
import { type Catalog, type CatalogEntry, type Component } from 'behavior-contracts';
|
|
37
|
-
/**
|
|
38
|
-
* The catalog-name literal union — one entry per SQL primitive litedbmodel declares:
|
|
39
|
-
* the CRUD leaves (`Select` / `Insert` / `Update` / `Delete`), the dynamic WHERE/SET
|
|
40
|
-
* fragment-tree component (`Fragment`), and the multi-statement transaction envelope
|
|
41
|
-
* (`Tx`).
|
|
42
|
-
*/
|
|
43
|
-
export type CatalogName = 'Select' | 'Count' | 'Insert' | 'Update' | 'Delete' | 'Fragment' | 'Tx';
|
|
44
|
-
/**
|
|
45
|
-
* litedbmodel's specific-component catalog (spec §11 item 1) — the behavior-contracts
|
|
46
|
-
* `Catalog`-typed source of truth. Each entry declares the Port schema of one SQL
|
|
47
|
-
* primitive AS THE BACKEND COMPILE WIRES IT; the effect implementation is bound
|
|
48
|
-
* separately in the handler registry (WS3, C4). All entries except `Tx` may appear in
|
|
49
|
-
* the portable IR.
|
|
50
|
-
*/
|
|
51
|
-
export declare const LITEDBMODEL_CATALOG: Catalog;
|
|
52
|
-
/** Look up a catalog entry by name (undefined for an unknown primitive). */
|
|
53
|
-
export declare function catalogEntry(name: string): CatalogEntry | undefined;
|
|
54
|
-
/** The catalog names litedbmodel declares (the C2 per-DSL surface). */
|
|
55
|
-
export declare const CATALOG_NAMES: readonly CatalogName[];
|
|
56
|
-
/**
|
|
57
|
-
* The CQRS write catalog: the names whose presence in a component body makes the
|
|
58
|
-
* component a COMMAND (spec §2.4 — effect is derived from the graph, not authored).
|
|
59
|
-
* `Select`/`Fragment` are read-side; `Insert`/`Update`/`Delete`/`Tx` are write-side.
|
|
60
|
-
*/
|
|
61
|
-
export declare const WRITE_CATALOG_NAMES: readonly CatalogName[];
|
|
62
|
-
/**
|
|
63
|
-
* The dynamic per-field write-port families (`<group>.<field>` — the flattened record
|
|
64
|
-
* convention; longest-prefix wins). A `values.<field>` (Insert) or `set.<field>`
|
|
65
|
-
* (Update) port carries the field's Expression IR value; a `sqlCast.<field>` port carries
|
|
66
|
-
* the field's PostgreSQL cast type (a literal string, e.g. `jsonb`/`uuid`/`int[]`) that drives
|
|
67
|
-
* the v1 per-column `?::<sqlCast>` on Postgres (`DBModel._insert`/`_update`). `sqlCast.` ports are
|
|
68
|
-
* INERT on MySQL/SQLite (v1's dialect-aware cast formatter is identity there).
|
|
69
|
-
*/
|
|
70
|
-
export declare const WRITE_PORT_FAMILIES: readonly string[];
|
|
71
|
-
/**
|
|
72
|
-
* The emitter's catalog validation (loud; a violation is a BUILD error), mirrored from
|
|
73
|
-
* graphddb's `assertComponentsInCatalog`. Every `componentRef` / `map` body node of every
|
|
74
|
-
* emitted component must:
|
|
75
|
-
*
|
|
76
|
-
* 1. reference a declared catalog name;
|
|
77
|
-
* 2. wire every `required` port of that entry;
|
|
78
|
-
* 3. wire ONLY declared ports — a port is declared if it is a static `inputPorts` name or
|
|
79
|
-
* a write record-family port ({@link WRITE_PORT_FAMILIES}, write entries only).
|
|
80
|
-
*
|
|
81
|
-
* All violations are collected and thrown as one error. `cond` nodes carry no component
|
|
82
|
-
* reference and are skipped.
|
|
83
|
-
*/
|
|
84
|
-
export declare function assertComponentsInCatalog(components: readonly Component[]): void;
|
|
85
|
-
/** litedbmodel's CQRS effect vocabulary, mapped 1:1 from bc's `BehaviorEffect`. */
|
|
86
|
-
export type ContractEffect = 'query' | 'command';
|
|
87
|
-
/**
|
|
88
|
-
* Derive one component's Query/Command classification FROM THE GRAPH: behavior-contracts'
|
|
89
|
-
* `classifyBehaviorEffect` over {@link WRITE_CATALOG_NAMES} — a component is a `'command'`
|
|
90
|
-
* iff its body references a write-catalog primitive, else a `'query'` (spec §2.4: effect
|
|
91
|
-
* is derived, never authored).
|
|
92
|
-
*/
|
|
93
|
-
export declare function deriveContractEffect(component: Component): ContractEffect;
|
|
94
|
-
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/scp/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,EAA0B,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAmB,MAAM,oBAAoB,CAAC;AAE9H;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,IAAI,CAAC;AAwET;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAwBjC,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAEnE;AAED,uEAAuE;AACvE,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQ/C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,WAAW,EAKrD,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAIhD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CA4BhF;AAGD,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,cAAc,CAEzE"}
|