graphddb 0.7.10 → 0.8.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.
Files changed (46) hide show
  1. package/README.md +6 -6
  2. package/dist/cdc/index.d.ts +389 -5
  3. package/dist/cdc/index.js +4 -4
  4. package/dist/{chunk-AD6ZQTTE.js → chunk-GS4C5VGO.js} +2 -6
  5. package/dist/{chunk-DFUKGU2Q.js → chunk-HNY2EJPV.js} +216 -229
  6. package/dist/{chunk-3ZU2VW3L.js → chunk-L2NEDS7U.js} +582 -781
  7. package/dist/chunk-L4QRCHRQ.js +278 -0
  8. package/dist/chunk-LAT64YCZ.js +1987 -0
  9. package/dist/chunk-S2NI4PBW.js +187 -0
  10. package/dist/{chunk-EOJDN3SA.js → chunk-T44OB5GU.js} +3757 -6138
  11. package/dist/{chunk-PDUVTYC5.js → chunk-XTWXMOHD.js} +0 -1
  12. package/dist/cli.js +63 -254
  13. package/dist/index.d.ts +23 -1550
  14. package/dist/index.js +94 -1850
  15. package/dist/internal/index.d.ts +84 -0
  16. package/dist/internal/index.js +701 -0
  17. package/dist/{maintenance-view-adapter-BAZ9uBGe.d.ts → key-DZtjAQDh.d.ts} +573 -1817
  18. package/dist/linter/index.d.ts +39 -7
  19. package/dist/linter/index.js +22 -4
  20. package/dist/{registry-LWE54Sdc.d.ts → linter-DQY7gUEk.d.ts} +22 -22
  21. package/dist/prepared-artifact-HFealr1q.d.ts +281 -0
  22. package/dist/spec/index.d.ts +506 -5
  23. package/dist/spec/index.js +22 -18
  24. package/dist/testing/index.d.ts +2 -3
  25. package/dist/testing/index.js +4 -4
  26. package/dist/transform/index.d.ts +1 -1
  27. package/dist/transform/index.js +4 -4
  28. package/dist/{types-BQLzTEqh.d.ts → types-2PMXEn5x.d.ts} +8 -10
  29. package/dist/types-DW__-Icc.d.ts +450 -0
  30. package/docs/cdc-projection.md +5 -5
  31. package/docs/class-hydration.md +1 -1
  32. package/docs/cqrs-contract.md +79 -20
  33. package/docs/design-patterns.md +5 -5
  34. package/docs/docs-generation.md +6 -6
  35. package/docs/middleware.md +15 -15
  36. package/docs/mutation-command-derivation.md +52 -42
  37. package/docs/prepared-statements.md +14 -14
  38. package/docs/python-bridge.md +96 -65
  39. package/docs/spec.md +153 -124
  40. package/docs/testing.md +9 -8
  41. package/package.json +14 -4
  42. package/dist/chunk-3UD3XIF2.js +0 -860
  43. package/dist/chunk-MMVHOUM4.js +0 -24
  44. package/dist/from-change-Ty95KA8C.d.ts +0 -327
  45. package/dist/index-Dc7d8mWI.d.ts +0 -1089
  46. package/dist/relation-depth-BRS513Tq.d.ts +0 -36
@@ -0,0 +1,84 @@
1
+ import { P as PreparedWriteOpSpec, a as PreparedPlanDocument } from '../prepared-artifact-HFealr1q.js';
2
+ export { b as PreparedBindSpec, c as PreparedPlanSpec, d as PreparedReadRouteSpec } from '../prepared-artifact-HFealr1q.js';
3
+ import { M as Manifest } from '../types-2PMXEn5x.js';
4
+ import { M as ModelStatic, D as DDBModel, S as Slot, P as PreparedWriteExecOptions, C as CommandReturn, a as ParallelOpResult, b as PreparedBody, c as PreparedStatement } from '../key-DZtjAQDh.js';
5
+ import '../types-DW__-Icc.js';
6
+
7
+ /**
8
+ * Static prepared-plan LOADER (issue #208) — the runtime half of the AOT
9
+ * pipeline. `graphddb transform prepared --aot` compiles every verified
10
+ * `DDBModel.prepare` body at BUILD time into a {@link PreparedPlanDocument}
11
+ * (`src/spec/prepared.ts`) and rewrites the call site to
12
+ *
13
+ * ```ts
14
+ * (__gddbPrepared1 ??= loadPreparedPlan(__gddbPreparedPlans, '<id>', ($) => ({…})))
15
+ * ```
16
+ *
17
+ * This module loads that artifact: it re-binds each plan's entity NAMES against
18
+ * the live {@link MetadataRegistry}, verifies the plan is not stale, and returns
19
+ * a handle whose `execute` runs the very same execution cores the runtime
20
+ * `prepare` uses — with **zero plan construction / compilation per op, including
21
+ * the first call**:
22
+ *
23
+ * - a **read** plan binds into the SAME {@link PreparedReadStatement} the
24
+ * runtime `prepare` returns (identical semantics by construction — reads never
25
+ * had an expensive compile; what `prepare` computes once, the artifact
26
+ * carries);
27
+ * - a **write** plan's mutation compile (lifecycle resolution + derived-effect
28
+ * derivation — the expensive half) happened at BUILD time; `execute` renders
29
+ * the serialized templates and runs {@link executeLogicalWriteOps} /
30
+ * {@link executeLogicalParallelWrites} — the same W1–W5 / fast-path / atomic
31
+ * commit / read-back pipeline as the compiled core, so effects are identical.
32
+ *
33
+ * ## Stale plans are a LOUD reject
34
+ *
35
+ * Each plan records a fingerprint of every entity's canonical manifest entry at
36
+ * build time. On first use the loader recomputes the fingerprints from the live
37
+ * registry: a mismatch (the model declarations — key/GSI templates, fields,
38
+ * relations, table mapping — changed since the artifact was generated) throws
39
+ * with a regeneration hint. A stale static plan NEVER executes. Version-skewed
40
+ * artifacts (format / spec IR version) reject the same way.
41
+ *
42
+ * ## Laziness
43
+ *
44
+ * Binding is deferred to the FIRST `execute` (not the `loadPreparedPlan` call):
45
+ * a module-scope `const p = loadPreparedPlan(…)` must not touch the registry at
46
+ * module-init time (the target models may be declared later in the same module —
47
+ * the same TDZ hazard the #206 lazy slot solves). Binding is memoized per
48
+ * `(document, planId)`; it performs registry lookups + fingerprint hashing only,
49
+ * never plan compilation.
50
+ */
51
+
52
+ interface BoundWriteOp {
53
+ readonly alias: string;
54
+ readonly spec: PreparedWriteOpSpec;
55
+ readonly modelClass: Function;
56
+ readonly modelStatic: ModelStatic<DDBModel>;
57
+ readonly keySlots: Readonly<Record<string, Slot>>;
58
+ readonly inputSlots: Readonly<Record<string, Slot>>;
59
+ readonly conditionSlots?: Readonly<Record<string, Slot>>;
60
+ readonly manifest: Manifest;
61
+ }
62
+ /** A prepared WRITE handle bound from a static plan (#208). `execute(params)`
63
+ * mirrors {@link import('./prepared.js').PreparedWriteStatement.execute}. */
64
+ declare class AotPreparedWriteStatement {
65
+ private readonly ops;
66
+ /** @internal */
67
+ constructor(ops: readonly BoundWriteOp[]);
68
+ execute(params?: Record<string, unknown>, options?: PreparedWriteExecOptions): Promise<Record<string, CommandReturn | undefined> | Record<string, ParallelOpResult | ParallelOpResult[]>>;
69
+ }
70
+ /**
71
+ * Load one statically-compiled prepared plan (issue #208). The rewritten call
72
+ * site passes the artifact document, the stable plan id, and the ORIGINAL
73
+ * prepare body — the body is retained in source as the plan's compile source
74
+ * (drift regeneration + type inference + the untransformed-build fallback) and
75
+ * is NEVER evaluated here: execution consumes the static artifact only.
76
+ *
77
+ * Per-op plan construction / compilation is ZERO, including the first call —
78
+ * the first `execute` performs registry binding + stale-fingerprint
79
+ * verification only (memoized per `(document, planId)`), then every call binds
80
+ * params into the frozen plan and runs the shared execution cores.
81
+ */
82
+ declare function loadPreparedPlan(doc: PreparedPlanDocument, planId: string, body?: PreparedBody): PreparedStatement;
83
+
84
+ export { AotPreparedWriteStatement, PreparedPlanDocument, PreparedWriteOpSpec, loadPreparedPlan };