graphddb 0.8.1 → 0.9.1
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/dist/behaviors-DDltNivc.d.ts +217 -0
- package/dist/cdc/index.d.ts +5 -4
- package/dist/cdc/index.js +3 -3
- package/dist/{chunk-HNY2EJPV.js → chunk-7OCXY4R6.js} +1 -1
- package/dist/{chunk-L2NEDS7U.js → chunk-GWWRXIHF.js} +260 -12
- package/dist/{chunk-T44OB5GU.js → chunk-HLFNCKFV.js} +105 -11
- package/dist/{chunk-LAT64YCZ.js → chunk-MBJ4JVRM.js} +680 -25
- package/dist/{chunk-S2NI4PBW.js → chunk-PHXUFAY2.js} +7 -5
- package/dist/{chunk-GS4C5VGO.js → chunk-VECUS35D.js} +2 -2
- package/dist/{chunk-L4QRCHRQ.js → chunk-WOFRHRXY.js} +6 -25
- package/dist/cli.js +366 -80
- package/dist/index.d.ts +131 -5
- package/dist/index.js +121 -5
- package/dist/internal/index.d.ts +6 -5
- package/dist/internal/index.js +7 -7
- package/dist/{key-DZtjAQDh.d.ts → key-CWytoEaE.d.ts} +93 -5
- package/dist/linter/index.d.ts +6 -5
- package/dist/{linter-DQY7gUEk.d.ts → linter-jEwmZotm.d.ts} +1 -1
- package/dist/{prepared-artifact-HFealr1q.d.ts → prepared-artifact-CwH5ezFq.d.ts} +4 -4
- package/dist/spec/index.d.ts +225 -24
- package/dist/spec/index.js +17 -9
- package/dist/testing/index.d.ts +3 -2
- package/dist/testing/index.js +32 -5
- package/dist/transform/index.d.ts +2 -1
- package/dist/transform/index.js +2 -2
- package/dist/{types-2PMXEn5x.d.ts → types-CgXS-4Ox.d.ts} +299 -28
- package/dist/{types-DW__-Icc.d.ts → types-nk5okD7d.d.ts} +1 -1
- package/docs/python-bridge.md +33 -49
- package/package.json +11 -3
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { $ as AnyOperationDefinition, a0 as TransactionDefinition, b as PreparedBody } from '../key-
|
|
2
|
-
export { a1 as CompiledFragment, a2 as CompiledMutationPlan, a3 as DerivedConditionCheck, a4 as DerivedEdgeWrite, a5 as DerivedIdempotencyGuard, a6 as DerivedMaintainOutbox, a7 as DerivedMaintainWrite, a8 as DerivedOutboxEvent, a9 as DerivedUniqueGuard, aa as DerivedUpdate, ab as EntityRefResolver, ac as MAX_TRANSACT_COMPOSE_ITEMS, ad as assertNoCrossFragmentMaintainCollision, ae as compileFragment, af as compileMutationPlan, ag as compileSingleFragmentPlan, ah as resetMaintenanceGraphCache, ai as resolveLifecycle, aj as resolveMaintainers } from '../key-
|
|
3
|
-
import { M as MetadataRegistry } from '../linter-
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
import '../types-
|
|
1
|
+
import { $ as AnyOperationDefinition, a0 as TransactionDefinition, b as PreparedBody } from '../key-CWytoEaE.js';
|
|
2
|
+
export { a1 as CompiledFragment, a2 as CompiledMutationPlan, a3 as DerivedConditionCheck, a4 as DerivedEdgeWrite, a5 as DerivedIdempotencyGuard, a6 as DerivedMaintainOutbox, a7 as DerivedMaintainWrite, a8 as DerivedOutboxEvent, a9 as DerivedUniqueGuard, aa as DerivedUpdate, ab as EntityRefResolver, ac as MAX_TRANSACT_COMPOSE_ITEMS, ad as assertNoCrossFragmentMaintainCollision, ae as compileFragment, af as compileMutationPlan, ag as compileSingleFragmentPlan, ah as resetMaintenanceGraphCache, ai as resolveLifecycle, aj as resolveMaintainers } from '../key-CWytoEaE.js';
|
|
3
|
+
import { M as MetadataRegistry } from '../linter-jEwmZotm.js';
|
|
4
|
+
import { B as BehaviorModelContract } from '../behaviors-DDltNivc.js';
|
|
5
|
+
export { a as BehaviorMethodSpec } from '../behaviors-DDltNivc.js';
|
|
6
|
+
import { C as ContractMap, e as ContextOwnershipMap, c as PreparedPlanSpec, a as PreparedPlanDocument } from '../prepared-artifact-CwH5ezFq.js';
|
|
7
|
+
export { A as AnyModelContract, B as BuiltContracts, f as ContextOwnership, g as PREPARED_FORMAT_VERSION, h as PreparedBindMap, b as PreparedBindSpec, d as PreparedReadRouteSpec, P as PreparedWriteOpSpec, i as buildContexts, j as buildContracts, k as canonicalJson, l as entityFingerprint, p as planFingerprint } from '../prepared-artifact-CwH5ezFq.js';
|
|
8
|
+
import { O as OperationsDocument, Q as QuerySpec, M as Manifest, T as TransactionSpec, C as ContractSpec, B as BridgeBundle, c as ConditionSpec, E as ExpressionSpec, a as CommandSpec, d as SpecVersion } from '../types-CgXS-4Ox.js';
|
|
9
|
+
export { e as CommandContractMethodSpec, f as CommandResolutionTarget, g as ComposeSpec, h as CompositionPlanSpec, b as ContextSpec, i as ContractCardinality, j as ContractCommandResult, k as ContractInputArity, l as ContractKeySpec, m as ContractKind, n as ContractResolution, o as EXPR_VERSION, p as ExecutionPlanSpec, q as ExpressionArrNode, r as ExpressionFloatNode, s as ExpressionIntNode, t as ExpressionNode, u as ExpressionObjNode, v as ExpressionOpNode, w as ExpressionOperator, x as ExpressionRefNode, y as ExpressionRefOptNode, z as ExpressionScalar, F as FilterSpec, A as ManifestEntity, D as ManifestField, G as ManifestFieldType, H as ManifestGsi, I as ManifestKey, J as ManifestRelation, K as ManifestTable, L as OperationSpec, P as ParamSpec, N as QueryContractMethodSpec, R as RangeConditionSpec, U as ReadOperationType, V as SPEC_VERSION, S as SPEC_VERSION_KEY_EXPR, W as SPEC_VERSION_SCP, X as SPEC_VERSION_SUPPORTED, Y as TransactionItemSpec, Z as TransactionItemType, _ as WhenSpec, $ as WriteOperationType } from '../types-CgXS-4Ox.js';
|
|
10
|
+
import { Component, ComponentGraphIR } from 'behavior-contracts';
|
|
11
|
+
import '../types-nk5okD7d.js';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Static parameterized operation-spec generation (issue #42, Phase 0b).
|
|
@@ -33,6 +36,16 @@ interface ContractInputs {
|
|
|
33
36
|
readonly contracts?: ContractMap;
|
|
34
37
|
/** Context-ownership declarations (context → member models / contracts). */
|
|
35
38
|
readonly contexts?: ContextOwnershipMap;
|
|
39
|
+
/**
|
|
40
|
+
* Resolved behavior contracts (`publishBehaviors` output, #297 SP3) — the
|
|
41
|
+
* shared-authoring surface registrations. ADDITIVE: each contract's bc-lowered
|
|
42
|
+
* components register into the emitted `components[]` as
|
|
43
|
+
* `<RegistrationKey>__<method>` alongside the publish* output; nothing else
|
|
44
|
+
* in the document changes, and an absent/empty map reproduces the previous
|
|
45
|
+
* bytes exactly. Their CQRS effect is purely graph-derived (there is no
|
|
46
|
+
* declared side to verify — see `assertPublishSplitMatchesDerived`).
|
|
47
|
+
*/
|
|
48
|
+
readonly behaviors?: Readonly<Record<string, BehaviorModelContract>>;
|
|
36
49
|
}
|
|
37
50
|
/**
|
|
38
51
|
* Build the operations document from grouped read (`queries`) and write
|
|
@@ -46,6 +59,10 @@ interface ContractInputs {
|
|
|
46
59
|
* contract-free input (`contractInputs` empty / absent) reproduces the pre-#59
|
|
47
60
|
* document byte-for-byte — no `contracts` / `contexts` keys appear.
|
|
48
61
|
*
|
|
62
|
+
* The shared-authoring layer (#297 SP3) is likewise additive: each
|
|
63
|
+
* `contractInputs.behaviors` registration appends its bc-lowered components to
|
|
64
|
+
* `components[]` (as `<Key>__<method>`); an absent/empty map changes nothing.
|
|
65
|
+
*
|
|
49
66
|
* @throws if a command carries a write condition outside the supported subset
|
|
50
67
|
* (`{ notExists }` or pure equality) — the bridge guard; or if a contract op
|
|
51
68
|
* name collides with a hand-written definition.
|
|
@@ -70,6 +87,192 @@ declare function buildOperations(queries?: Record<string, AnyOperationDefinition
|
|
|
70
87
|
*/
|
|
71
88
|
declare function buildManifest(registry?: typeof MetadataRegistry): Manifest;
|
|
72
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Universal component-graph IR emitter (SCP IR Phase 3, issue #290 — sub-pass 1b,
|
|
92
|
+
* DUAL-EMIT, behavior-contracts vocabulary v2).
|
|
93
|
+
*
|
|
94
|
+
* This module additively lifts the graphddb-specific operation IR
|
|
95
|
+
* (`QuerySpec.operations[]` / `TransactionSpec.items[]`, wired by `resultPath` /
|
|
96
|
+
* `sourceField` / `sourceList` / `{item.*}`) into the **universal SCP
|
|
97
|
+
* component-graph** form behavior-contracts defines
|
|
98
|
+
* (`scp-ir-architecture.md` §5/§5.1, `ts/src/behavior.ts`): a `Component{ name,
|
|
99
|
+
* inputPorts, body[], output, plan }` whose `body` nodes are `componentRef` /
|
|
100
|
+
* `map` referencing the graphddb catalog (`GetItem` / `Query` / `BatchGetItem` /
|
|
101
|
+
* `PutItem` / `UpdateItem` / `DeleteItem` / `ConditionCheck`) and whose Port
|
|
102
|
+
* wiring is Expression IR.
|
|
103
|
+
*
|
|
104
|
+
* ## SP5 ownership split (#297 / bc#26)
|
|
105
|
+
*
|
|
106
|
+
* Since #297 SP5 this module EXTRACTS but does not ASSEMBLE: every derived
|
|
107
|
+
* graph (node ids, ports, map/into/batched decisions, relationKind, plan) is
|
|
108
|
+
* handed to behavior-contracts' data-registration builder
|
|
109
|
+
* (`buildComponentDefinition`, validated against `GRAPHDDB_CATALOG`), which
|
|
110
|
+
* owns the IR shape — structural/catalog/plan validation, reference-root
|
|
111
|
+
* existence, and the deterministic code-point key-sorted canonicalization of
|
|
112
|
+
* the final `Component`. graphddb's `assertComponentsInCatalog` stays as the
|
|
113
|
+
* stricter consumer-side gate on top (its dynamic-family whitelist is tighter
|
|
114
|
+
* than the builder's `additionalPorts` acceptance — belt-and-suspenders by
|
|
115
|
+
* design).
|
|
116
|
+
*
|
|
117
|
+
* ## Dual-emit (this sub-pass only)
|
|
118
|
+
*
|
|
119
|
+
* The emitted `components[]` sits ALONGSIDE the existing
|
|
120
|
+
* `queries`/`commands`/`transactions` — nothing here removes or rewrites the old
|
|
121
|
+
* wiring. The 4 spec-consumer runtimes (py/php/rust/go) keep reading the OLD path
|
|
122
|
+
* (`queries` etc.); `components[]` is a new top-level field they tolerate (they
|
|
123
|
+
* read only the keys they know, and `validateEnvelope` checks only `version`).
|
|
124
|
+
* The purpose of the additive emit is to PROVE, via behavior-contracts
|
|
125
|
+
* `assertPortableComponentGraph` + `runBehavior`, that the universal form is
|
|
126
|
+
* well-formed and semantically reproduces the query — de-risking the later
|
|
127
|
+
* sub-passes that migrate the runtimes onto it.
|
|
128
|
+
*
|
|
129
|
+
* ## Vocabulary v2 (bc#22, behaviorVersion 2) — the sub-pass-2a gap closures
|
|
130
|
+
*
|
|
131
|
+
* The 2a escalation proved 6 constructs the sub-pass-1 emission could not carry;
|
|
132
|
+
* this emitter closes them on the v2 map vocabulary:
|
|
133
|
+
*
|
|
134
|
+
* 1. **Depth-2+ relations** (`$.groups.items.group[.permissions.items]`): a
|
|
135
|
+
* relation whose producer is a CONNECTION is emitted as a `map` over the
|
|
136
|
+
* parent connection's `items` with `into: <relationProp>` (zip-attach onto the
|
|
137
|
+
* per-element membership row); deeper levels CHAIN over the previous map's
|
|
138
|
+
* augmented list (`over: {ref:[<prevMapId>]}`), reading the parent body
|
|
139
|
+
* through the attach key (`{ref:["$el","group",…]}`). The attach is FLAT on
|
|
140
|
+
* the element (v2 `into` semantics — the canonical bc depth-2 vector shape);
|
|
141
|
+
* the node id carries the full `resultPath`-derived path
|
|
142
|
+
* (`groups.items.group.permissions.items`), so re-nesting the flat key into
|
|
143
|
+
* the old assembled placement (`item.group.permissions`) is a mechanical,
|
|
144
|
+
* id-driven fold in the consuming runtime.
|
|
145
|
+
* 2. **Per-element transaction guards**: the legacy `when:{op,left,right}`
|
|
146
|
+
* comparison AND the #267/#268 `guard` Expression IR both lower to `map.when`
|
|
147
|
+
* (evaluated under the `$item` element binding; strict-bool, fail-closed).
|
|
148
|
+
* 3. **Write-condition / write-item ports completeness**: every transaction
|
|
149
|
+
* item's `entity`, `condition` (all kinds), `literalKey` and `maintain`
|
|
150
|
+
* payload are carried as ports, so a handler builds the exact TransactWrite
|
|
151
|
+
* item from the evaluated ports alone (plus its injected manifest/config —
|
|
152
|
+
* the C4 boundary; no node-identity join needed).
|
|
153
|
+
* 4. **Relation filters**: an op's `filter.declarative` tree rides in the read
|
|
154
|
+
* ports (JSON-encoded — see below).
|
|
155
|
+
* 5. **Implicit-strip marker**: a `refs` fan-out whose driver list was projected
|
|
156
|
+
* only implicitly (`sourceList.implicit`) emits `implicitSourceField` in its
|
|
157
|
+
* map ports, so the post-assembly strip of the driver field from the parent
|
|
158
|
+
* is expressible without the old `sourceList`.
|
|
159
|
+
* 6. **Batched fan-out**: fan-outs the old path serves with ONE deduped/chunked
|
|
160
|
+
* `BatchGetItem` (a `sourceList` refs fan-out; a belongsTo child of a
|
|
161
|
+
* connection) emit `batched: true` — the handler receives `{items:[…]}` once
|
|
162
|
+
* and owns dedupe/chunk/retry (CONSUMER), returning a list aligned to
|
|
163
|
+
* `items`. Per-element `GetItem`/`Query` maps stay unbatched.
|
|
164
|
+
*
|
|
165
|
+
* ## Opaque-JSON ports (declarative trees)
|
|
166
|
+
*
|
|
167
|
+
* A port VALUE is Expression IR: `assertPortableComponentGraph` walks every port
|
|
168
|
+
* value through the closed operator set, so a declarative operator tree
|
|
169
|
+
* (`filter.declarative`, `condition.declarative`, `condition.names`, `maintain`)
|
|
170
|
+
* — whose single-key nodes (`{and:…}`, `{name:…}`) would be mis-read as
|
|
171
|
+
* unknown operators — is carried as a **canonical JSON string literal**
|
|
172
|
+
* (deterministically key-sorted), which the handler parses. Caller-param leaves
|
|
173
|
+
* (`{$param}`) that such a tree binds at execution time are lifted OUT into
|
|
174
|
+
* companion `condition.params.<name>` / `condition.values.<slot>` ports whose
|
|
175
|
+
* values are `{ref:[<param>]}` — evaluated by the executor, so the handler gets
|
|
176
|
+
* the bound values without reaching into graphddb scope internals.
|
|
177
|
+
*
|
|
178
|
+
* ## Scope convention (`runBehavior`-native)
|
|
179
|
+
*
|
|
180
|
+
* The graphddb Phase-2 key wiring roots its Expression IR references at
|
|
181
|
+
* `input.<param>` / `result.<field>` (and guards at `item.<field>`). The
|
|
182
|
+
* universal `runBehavior` executor evaluates ports against a FLAT scope
|
|
183
|
+
* `{ ...input, ...nodeResultsById, [<as>]: element }`, so this emitter REMAPS
|
|
184
|
+
* the scope roots when lowering:
|
|
185
|
+
*
|
|
186
|
+
* - `["input", p]` → `[p]` — a param at the top-level scope.
|
|
187
|
+
* - `["result", f]` → `[<parentNodeId>, f]` — the parent node result, or
|
|
188
|
+
* `["$el"(…attach segs), f]` inside a relation map, or `[<as>, f]` inside a
|
|
189
|
+
* refs fan-out map.
|
|
190
|
+
* - `["item", f]` → `["$item", f]` — a forEach guard's element field.
|
|
191
|
+
*
|
|
192
|
+
* The remap is a pure rename of the reference ROOTS; the literal/`concat`
|
|
193
|
+
* structure the Phase-2 lowerer produced is reused verbatim.
|
|
194
|
+
*
|
|
195
|
+
* ## Cardinality-one root collapse
|
|
196
|
+
*
|
|
197
|
+
* A cardinality-`'one'` query whose root is a `Query` (unique-GSI lookup)
|
|
198
|
+
* assembles, on the old path, a SINGLE entity (first matched item) that child
|
|
199
|
+
* relations key off (`{result.userId}`). Expression IR has no list indexing, so
|
|
200
|
+
* the collapse is carried as a root port `cardinality: 'one'` — the catalog
|
|
201
|
+
* `Query` handler returns the first matched item (or null) instead of a
|
|
202
|
+
* connection, exactly the old runtime's root shaping.
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Lower one {@link QuerySpec} into a universal SCP {@link Component}. Each read
|
|
207
|
+
* {@link OperationSpec} becomes a body node:
|
|
208
|
+
*
|
|
209
|
+
* - the root op (`resultPath === '$'`) → a `componentRef` whose ports carry the
|
|
210
|
+
* remapped `keyExpr` (rooted at the params) and `projection`; a
|
|
211
|
+
* cardinality-one Query root adds the `cardinality: 'one'` collapse port;
|
|
212
|
+
* - a `refs` fan-out op (carrying `sourceList`) → a **batched** `map` node
|
|
213
|
+
* iterating the parent list attribute (`sourceList.over`), the per-element key
|
|
214
|
+
* bound through the `sourceList.as` element binding, with the
|
|
215
|
+
* `implicitSourceField` strip marker when the driver list was implicit;
|
|
216
|
+
* - a relation whose producer is a CONNECTION (or a deeper link of such a
|
|
217
|
+
* chain) → a `map` over the connection's items / the previous map's augmented
|
|
218
|
+
* list, `into: <relationProp>` (zip-attach; `batched` when the old path served
|
|
219
|
+
* it with one BatchGetItem);
|
|
220
|
+
* - a root-level `hasMany` / `belongsTo` relation → a `componentRef` with
|
|
221
|
+
* `parent`, `bindField` (the source field for null-binding skip), and
|
|
222
|
+
* `relationKind`.
|
|
223
|
+
*
|
|
224
|
+
* The component's `output` is the Φ merge: the root node result with each
|
|
225
|
+
* ROOT-LEVEL relation attached under its property; a chained connection exposes
|
|
226
|
+
* `{obj:{cursor:<connection cursor>, items:<final augmented list>}}`. The `plan`
|
|
227
|
+
* is re-derived from the emitted parent wiring (identical `{groups,
|
|
228
|
+
* concurrency}` shape; equal to the query's plan wherever chaining introduced no
|
|
229
|
+
* new dependency), or absent for a single-node read.
|
|
230
|
+
*/
|
|
231
|
+
declare function buildQueryComponent(name: string, query: QuerySpec): Component;
|
|
232
|
+
/**
|
|
233
|
+
* Lower one {@link TransactionSpec} into a universal SCP {@link Component}. A
|
|
234
|
+
* transaction is a single-stage batched write; each item becomes a body node:
|
|
235
|
+
*
|
|
236
|
+
* - a `forEach` item (expanded once per element of the named array param) → an
|
|
237
|
+
* SCP `map` over that array param (`over: {ref:[<source>]}`, `as: "$item"`),
|
|
238
|
+
* its `{item.<field>}` template tokens lowered to `["$item", field]` refs and
|
|
239
|
+
* its `when`/`guard` lowered to `map.when` (gap 2 — a falsy element is
|
|
240
|
+
* skipped: handler not called, excluded from the result, order preserved);
|
|
241
|
+
* - a plain item with an input-scope `guard` → a MAP OF ONE with `when`
|
|
242
|
+
* (`over: {arr:[true]}`), reproducing the old kept/skipped expansion;
|
|
243
|
+
* - a plain item → a `componentRef` against the params.
|
|
244
|
+
*
|
|
245
|
+
* The `component` name is the DynamoDB write catalog entry (`Put` → `PutItem`,
|
|
246
|
+
* `Update` → `UpdateItem`, `Delete` → `DeleteItem`, `ConditionCheck` →
|
|
247
|
+
* `ConditionCheck`). The output is the array of every item node's result (a
|
|
248
|
+
* transaction returns no per-item image, so this is descriptive of the writes).
|
|
249
|
+
*/
|
|
250
|
+
declare function buildTransactionComponent(name: string, tx: TransactionSpec): Component;
|
|
251
|
+
/**
|
|
252
|
+
* Build the universal `components[]` for a whole operations document (dual-emit,
|
|
253
|
+
* issue #290 sub-pass 1b). Every query and every transaction is lifted into one
|
|
254
|
+
* {@link Component}; commands (single writes) are represented via the query
|
|
255
|
+
* readbacks / transactions already present, so this sub-pass lifts the two
|
|
256
|
+
* multi-node forms (queries, transactions) that exercise the universal `map` /
|
|
257
|
+
* `componentRef` / plan vocabulary. Deterministic: queries then transactions,
|
|
258
|
+
* each in sorted-name order.
|
|
259
|
+
*
|
|
260
|
+
* Every emitted component is validated against {@link GRAPHDDB_CATALOG}
|
|
261
|
+
* (#297 SP1c — names, required ports, declared-port families); a mismatch
|
|
262
|
+
* throws, so an emitter drift from the catalog is a BUILD error, never a
|
|
263
|
+
* silently-shipped document.
|
|
264
|
+
*/
|
|
265
|
+
declare function buildComponents(queries: Readonly<Record<string, QuerySpec>>, transactions: Readonly<Record<string, TransactionSpec>>): Component[];
|
|
266
|
+
/**
|
|
267
|
+
* Wrap emitted `components[]` into the portable component-graph IR document
|
|
268
|
+
* (`{irVersion, exprVersion, components}` — scp-ir-architecture.md §5): the
|
|
269
|
+
* ONLY input shape behavior-contracts' common Generator accepts (issue #257 —
|
|
270
|
+
* `generateModule` loudly rejects the raw operations bundle / internal IR).
|
|
271
|
+
* graphddb adds no generation logic: this envelope is the entire consumer-side
|
|
272
|
+
* input contract of the upstream codegen-static endpoint (§7.3 endpoint 3).
|
|
273
|
+
*/
|
|
274
|
+
declare function portableIrDocument(components: readonly Component[]): ComponentGraphIR;
|
|
275
|
+
|
|
73
276
|
/**
|
|
74
277
|
* N+1 static checker for the CQRS Contract layer (issue #60, Epic #57; proposal
|
|
75
278
|
* `docs/cqrs-contract.md`, "N+1 Safety (Static Restriction)").
|
|
@@ -394,24 +597,22 @@ declare function assertBundleSerializable(bundle: BridgeBundle): void;
|
|
|
394
597
|
*/
|
|
395
598
|
declare function canonicalizeExpressionSpec(input: unknown, context: string): ExpressionSpec;
|
|
396
599
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
600
|
+
* The spec version to stamp on an operations document. **SCP IR Phase 2 (#289):
|
|
601
|
+
* always `2.0`.** The read-op key wiring moved from `{param}` string templates to
|
|
602
|
+
* the portable Expression IR (`keyExpr` / `valueExpr`), a MAJOR IR serialization
|
|
603
|
+
* change — so the whole operations IR moves to `2.0` at once (migration plan §4).
|
|
604
|
+
* A pre-#289 runtime (supported `1.2`) `validateEnvelope`-rejects a `2.0`
|
|
605
|
+
* document, the intended breaking cut. The former conditional `1.1`/`1.2`
|
|
606
|
+
* presence-scan stamping (issue #261, `operationsContainScpNodes`) was removed
|
|
607
|
+
* in the final #290 sub-pass: every `2.0` document is a superset (guard/scpExpr
|
|
608
|
+
* nodes still validate under exprVersion 2), so a single unconditional `2.0`
|
|
609
|
+
* stamp is correct now that the read-op key wiring is unconditionally Expression
|
|
610
|
+
* IR.
|
|
403
611
|
*/
|
|
404
|
-
declare function
|
|
612
|
+
declare function operationsSpecVersion(_doc: {
|
|
405
613
|
readonly commands: Readonly<Record<string, CommandSpec>>;
|
|
406
|
-
readonly transactions?: Readonly<Record<string, TransactionSpec>>;
|
|
407
614
|
readonly contracts?: Readonly<Record<string, ContractSpec>>;
|
|
408
|
-
}):
|
|
409
|
-
/**
|
|
410
|
-
* The spec version to stamp on an operations document: `1.2` iff it actually
|
|
411
|
-
* contains an SCP node ({@link operationsContainScpNodes}), else the base
|
|
412
|
-
* `1.1` — so every pre-#261 bundle serializes byte-identically.
|
|
413
|
-
*/
|
|
414
|
-
declare function operationsSpecVersion(doc: Parameters<typeof operationsContainScpNodes>[0]): SpecVersion;
|
|
615
|
+
}): SpecVersion;
|
|
415
616
|
|
|
416
617
|
/**
|
|
417
618
|
* Static prepared-plan artifact — the **build-time** (AOT) compilation of
|
|
@@ -503,4 +704,4 @@ declare function buildPreparedPlanDocument(plans: Readonly<Record<string, Prepar
|
|
|
503
704
|
*/
|
|
504
705
|
declare function buildBridgeBundle(queries?: Record<string, AnyOperationDefinition>, commands?: Record<string, AnyOperationDefinition>, registry?: typeof MetadataRegistry, transactions?: Record<string, TransactionDefinition>, contractInputs?: ContractInputs): BridgeBundle;
|
|
505
706
|
|
|
506
|
-
export { BridgeBundle, CommandSpec, ConditionSpec, ContextOwnershipMap, type ContractBoundaryViolation, type ContractInputs, ContractMap, type ContractN1Violation, ContractSpec, ExpressionSpec, Manifest, OperationsDocument, PreparedPlanDocument, PreparedPlanSpec, QuerySpec, SpecVersion, TransactionSpec, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, buildBridgeBundle, buildManifest, buildOperations, buildPreparedPlanDocument, buildQuerySpec, buildTransactionSpec, buildTransactions, canonicalizeExpressionSpec, collectContractBoundaryViolations, collectContractN1Violations, compilePreparedPlan,
|
|
707
|
+
export { BehaviorModelContract, BridgeBundle, CommandSpec, ConditionSpec, ContextOwnershipMap, type ContractBoundaryViolation, type ContractInputs, ContractMap, type ContractN1Violation, ContractSpec, ExpressionSpec, Manifest, OperationsDocument, PreparedPlanDocument, PreparedPlanSpec, QuerySpec, SpecVersion, TransactionSpec, assertBundleSerializable, assertContractBoundaries, assertContractN1Safe, assertJsonSerializable, assertSupportedCondition, buildBridgeBundle, buildComponents, buildManifest, buildOperations, buildPreparedPlanDocument, buildQueryComponent, buildQuerySpec, buildTransactionComponent, buildTransactionSpec, buildTransactions, canonicalizeExpressionSpec, collectContractBoundaryViolations, collectContractN1Violations, compilePreparedPlan, operationsSpecVersion, portableIrDocument };
|
package/dist/spec/index.js
CHANGED
|
@@ -2,22 +2,26 @@ import {
|
|
|
2
2
|
assertContractBoundaries,
|
|
3
3
|
assertContractN1Safe,
|
|
4
4
|
buildBridgeBundle,
|
|
5
|
+
buildComponents,
|
|
5
6
|
buildContexts,
|
|
6
7
|
buildContracts,
|
|
7
8
|
buildOperations,
|
|
8
9
|
buildPreparedPlanDocument,
|
|
10
|
+
buildQueryComponent,
|
|
9
11
|
buildQuerySpec,
|
|
12
|
+
buildTransactionComponent,
|
|
10
13
|
collectContractBoundaryViolations,
|
|
11
14
|
collectContractN1Violations,
|
|
12
|
-
compilePreparedPlan
|
|
13
|
-
|
|
15
|
+
compilePreparedPlan,
|
|
16
|
+
portableIrDocument
|
|
17
|
+
} from "../chunk-MBJ4JVRM.js";
|
|
14
18
|
import {
|
|
15
19
|
PREPARED_FORMAT_VERSION,
|
|
16
20
|
buildManifest,
|
|
17
21
|
canonicalJson,
|
|
18
22
|
entityFingerprint,
|
|
19
23
|
planFingerprint
|
|
20
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-PHXUFAY2.js";
|
|
21
25
|
import {
|
|
22
26
|
MAX_TRANSACT_COMPOSE_ITEMS,
|
|
23
27
|
assertBundleSerializable,
|
|
@@ -32,24 +36,25 @@ import {
|
|
|
32
36
|
resetMaintenanceGraphCache,
|
|
33
37
|
resolveLifecycle,
|
|
34
38
|
resolveMaintainers
|
|
35
|
-
} from "../chunk-
|
|
36
|
-
import "../chunk-
|
|
39
|
+
} from "../chunk-HLFNCKFV.js";
|
|
40
|
+
import "../chunk-7OCXY4R6.js";
|
|
37
41
|
import {
|
|
38
42
|
EXPR_VERSION,
|
|
39
43
|
SPEC_VERSION,
|
|
44
|
+
SPEC_VERSION_KEY_EXPR,
|
|
40
45
|
SPEC_VERSION_SCP,
|
|
41
46
|
SPEC_VERSION_SUPPORTED,
|
|
42
47
|
canonicalizeExpressionSpec,
|
|
43
|
-
operationsContainScpNodes,
|
|
44
48
|
operationsSpecVersion
|
|
45
|
-
} from "../chunk-
|
|
46
|
-
import "../chunk-
|
|
49
|
+
} from "../chunk-WOFRHRXY.js";
|
|
50
|
+
import "../chunk-GWWRXIHF.js";
|
|
47
51
|
import "../chunk-XTWXMOHD.js";
|
|
48
52
|
export {
|
|
49
53
|
EXPR_VERSION,
|
|
50
54
|
MAX_TRANSACT_COMPOSE_ITEMS,
|
|
51
55
|
PREPARED_FORMAT_VERSION,
|
|
52
56
|
SPEC_VERSION,
|
|
57
|
+
SPEC_VERSION_KEY_EXPR,
|
|
53
58
|
SPEC_VERSION_SCP,
|
|
54
59
|
SPEC_VERSION_SUPPORTED,
|
|
55
60
|
assertBundleSerializable,
|
|
@@ -59,12 +64,15 @@ export {
|
|
|
59
64
|
assertNoCrossFragmentMaintainCollision,
|
|
60
65
|
assertSupportedCondition,
|
|
61
66
|
buildBridgeBundle,
|
|
67
|
+
buildComponents,
|
|
62
68
|
buildContexts,
|
|
63
69
|
buildContracts,
|
|
64
70
|
buildManifest,
|
|
65
71
|
buildOperations,
|
|
66
72
|
buildPreparedPlanDocument,
|
|
73
|
+
buildQueryComponent,
|
|
67
74
|
buildQuerySpec,
|
|
75
|
+
buildTransactionComponent,
|
|
68
76
|
buildTransactionSpec,
|
|
69
77
|
buildTransactions,
|
|
70
78
|
canonicalJson,
|
|
@@ -76,9 +84,9 @@ export {
|
|
|
76
84
|
compilePreparedPlan,
|
|
77
85
|
compileSingleFragmentPlan,
|
|
78
86
|
entityFingerprint,
|
|
79
|
-
operationsContainScpNodes,
|
|
80
87
|
operationsSpecVersion,
|
|
81
88
|
planFingerprint,
|
|
89
|
+
portableIrDocument,
|
|
82
90
|
resetMaintenanceGraphCache,
|
|
83
91
|
resolveLifecycle,
|
|
84
92
|
resolveMaintainers
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { n as Executor, o as DynamoDBOperation, R as ReadExecOptions, p as ExecutorResult, B as BatchGetExecInput, q as PutInput, W as WriteExecOptions, r as WriteResult, U as UpdateInput, s as DeleteInput, t as BatchWriteExecItem, u as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, D as DDBModel, v as ChangeEvent } from '../key-
|
|
2
|
-
import '../types-
|
|
1
|
+
import { n as Executor, o as DynamoDBOperation, R as ReadExecOptions, p as ExecutorResult, B as BatchGetExecInput, q as PutInput, W as WriteExecOptions, r as WriteResult, U as UpdateInput, s as DeleteInput, t as BatchWriteExecItem, u as BatchExecOptions, T as TransactWriteExecItem, M as ModelStatic, D as DDBModel, v as ChangeEvent } from '../key-CWytoEaE.js';
|
|
2
|
+
import '../types-CgXS-4Ox.js';
|
|
3
|
+
import 'behavior-contracts';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* In-process physical store backing the GraphDDB Memory Test Adapter
|
package/dist/testing/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCdcEmulator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-VECUS35D.js";
|
|
4
|
+
import "../chunk-7OCXY4R6.js";
|
|
5
5
|
import {
|
|
6
6
|
ClientManager,
|
|
7
7
|
MetadataRegistry,
|
|
8
8
|
resolveModelClass
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-GWWRXIHF.js";
|
|
10
10
|
import {
|
|
11
11
|
TableMapping
|
|
12
12
|
} from "../chunk-XTWXMOHD.js";
|
|
@@ -470,8 +470,9 @@ function removePath(target, segments) {
|
|
|
470
470
|
delete cursor[segments[segments.length - 1]];
|
|
471
471
|
}
|
|
472
472
|
function applyUpdateExpression(item, expression, clauses) {
|
|
473
|
-
const setMatch = /SET\s+(.*?)(?:\s+REMOVE\s+|$)/.exec(expression);
|
|
474
|
-
const removeMatch = /REMOVE\s+(
|
|
473
|
+
const setMatch = /SET\s+(.*?)(?:\s+REMOVE\s+|\s+ADD\s+|$)/.exec(expression);
|
|
474
|
+
const removeMatch = /REMOVE\s+(.*?)(?:\s+ADD\s+|$)/.exec(expression);
|
|
475
|
+
const addMatch = /ADD\s+(.*)$/.exec(expression);
|
|
475
476
|
if (setMatch && setMatch[1].trim().length > 0) {
|
|
476
477
|
const assignments = splitTopLevel(setMatch[1]);
|
|
477
478
|
for (const assignment of assignments) {
|
|
@@ -496,6 +497,32 @@ function applyUpdateExpression(item, expression, clauses) {
|
|
|
496
497
|
removePath(item, resolvePath(trimmed, clauses.names));
|
|
497
498
|
}
|
|
498
499
|
}
|
|
500
|
+
if (addMatch && addMatch[1].trim().length > 0) {
|
|
501
|
+
const clausesList = splitTopLevel(addMatch[1]);
|
|
502
|
+
for (const clause of clausesList) {
|
|
503
|
+
const trimmed = clause.trim();
|
|
504
|
+
if (trimmed.length === 0) continue;
|
|
505
|
+
const sp = trimmed.indexOf(" ");
|
|
506
|
+
if (sp < 0) {
|
|
507
|
+
throw new Error(`memory update: malformed ADD clause '${trimmed}'`);
|
|
508
|
+
}
|
|
509
|
+
const pathExpr = trimmed.slice(0, sp).trim();
|
|
510
|
+
const valueAlias = trimmed.slice(sp + 1).trim();
|
|
511
|
+
if (!(valueAlias in clauses.values)) {
|
|
512
|
+
throw new Error(`memory update: unbound value alias '${valueAlias}'`);
|
|
513
|
+
}
|
|
514
|
+
const delta = clauses.values[valueAlias];
|
|
515
|
+
if (typeof delta !== "number") {
|
|
516
|
+
throw new Error(
|
|
517
|
+
`memory update: ADD delta for '${pathExpr}' is not numeric (${typeof delta})`
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
const segments = resolvePath(pathExpr, clauses.names);
|
|
521
|
+
const current = segments.length === 1 ? item[segments[0]] : void 0;
|
|
522
|
+
const base = typeof current === "number" ? current : 0;
|
|
523
|
+
setPath(item, segments, base + delta);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
499
526
|
}
|
|
500
527
|
function splitTopLevel(clause) {
|
|
501
528
|
const parts = [];
|
package/dist/transform/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
EXPR_VERSION,
|
|
3
3
|
SCP_LOWERED_MARKER,
|
|
4
4
|
canonicalizeExpressionSpec
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-WOFRHRXY.js";
|
|
6
|
+
import "../chunk-GWWRXIHF.js";
|
|
7
7
|
import "../chunk-XTWXMOHD.js";
|
|
8
8
|
|
|
9
9
|
// src/transform/prepared-transform.ts
|