@jam-overture/loom 0.1.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/LICENSE +21 -0
- package/README.md +743 -0
- package/dist/catalogue.d.ts +70 -0
- package/dist/catalogue.js +88 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +83 -0
- package/dist/cli/filesystem.d.ts +15 -0
- package/dist/cli/filesystem.js +31 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +30 -0
- package/dist/cli/namespace.d.ts +40 -0
- package/dist/cli/namespace.js +40 -0
- package/dist/cli/plan.d.ts +84 -0
- package/dist/cli/plan.js +113 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.js +75 -0
- package/dist/cli/templates.d.ts +43 -0
- package/dist/cli/templates.js +134 -0
- package/dist/closed-set.d.ts +34 -0
- package/dist/closed-set.js +34 -0
- package/dist/data/adapter.d.ts +123 -0
- package/dist/data/adapter.js +91 -0
- package/dist/data/binding.d.ts +48 -0
- package/dist/data/binding.js +39 -0
- package/dist/data/catalogue.d.ts +26 -0
- package/dist/data/catalogue.js +6 -0
- package/dist/data/index.d.ts +14 -0
- package/dist/data/index.js +14 -0
- package/dist/data/plan.d.ts +58 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +91 -0
- package/dist/data/resolution.js +96 -0
- package/dist/data/resolve.d.ts +46 -0
- package/dist/data/resolve.js +37 -0
- package/dist/data/source.d.ts +40 -0
- package/dist/data/source.js +45 -0
- package/dist/deadline.d.ts +57 -0
- package/dist/deadline.js +78 -0
- package/dist/frame/catalogue.d.ts +24 -0
- package/dist/frame/catalogue.js +5 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/frame/origin.d.ts +87 -0
- package/dist/frame/origin.js +114 -0
- package/dist/frame/resolution.d.ts +85 -0
- package/dist/frame/resolution.js +79 -0
- package/dist/grammar.d.ts +26 -0
- package/dist/grammar.js +28 -0
- package/dist/ids.d.ts +57 -0
- package/dist/ids.js +104 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/interactivity.d.ts +50 -0
- package/dist/interactivity.js +22 -0
- package/dist/interpretation/anthropic.d.ts +22 -0
- package/dist/interpretation/anthropic.js +76 -0
- package/dist/interpretation/client.d.ts +83 -0
- package/dist/interpretation/client.js +2 -0
- package/dist/interpretation/draft.d.ts +234 -0
- package/dist/interpretation/draft.js +84 -0
- package/dist/interpretation/index.d.ts +15 -0
- package/dist/interpretation/index.js +15 -0
- package/dist/interpretation/interpreter.d.ts +62 -0
- package/dist/interpretation/interpreter.js +151 -0
- package/dist/interpretation/materialize.d.ts +42 -0
- package/dist/interpretation/materialize.js +107 -0
- package/dist/interpretation/prompt.d.ts +229 -0
- package/dist/interpretation/prompt.js +285 -0
- package/dist/interpretation/render.d.ts +76 -0
- package/dist/interpretation/render.js +272 -0
- package/dist/interpretation/schema.d.ts +49 -0
- package/dist/interpretation/schema.js +131 -0
- package/dist/json.d.ts +35 -0
- package/dist/json.js +11 -0
- package/dist/paging.d.ts +60 -0
- package/dist/paging.js +49 -0
- package/dist/primitive-type.d.ts +32 -0
- package/dist/primitive-type.js +39 -0
- package/dist/render/addressing.d.ts +59 -0
- package/dist/render/addressing.js +60 -0
- package/dist/render/anchor.d.ts +105 -0
- package/dist/render/anchor.js +84 -0
- package/dist/render/behaviour-adjust.d.ts +62 -0
- package/dist/render/behaviour-adjust.js +78 -0
- package/dist/render/behaviour-copy.d.ts +53 -0
- package/dist/render/behaviour-copy.js +75 -0
- package/dist/render/behaviour-disclose.d.ts +74 -0
- package/dist/render/behaviour-disclose.js +77 -0
- package/dist/render/behaviour-present.d.ts +123 -0
- package/dist/render/behaviour-present.js +173 -0
- package/dist/render/behaviour.d.ts +243 -0
- package/dist/render/behaviour.js +284 -0
- package/dist/render/control.d.ts +81 -0
- package/dist/render/control.js +80 -0
- package/dist/render/decorative.d.ts +62 -0
- package/dist/render/decorative.js +2 -0
- package/dist/render/diagnostics.d.ts +260 -0
- package/dist/render/diagnostics.js +61 -0
- package/dist/render/disclosed.d.ts +37 -0
- package/dist/render/disclosed.js +37 -0
- package/dist/render/editable.d.ts +34 -0
- package/dist/render/editable.js +35 -0
- package/dist/render/frame.d.ts +42 -0
- package/dist/render/frame.js +31 -0
- package/dist/render/index.d.ts +35 -0
- package/dist/render/index.js +35 -0
- package/dist/render/inline-variables.d.ts +77 -0
- package/dist/render/inline-variables.js +220 -0
- package/dist/render/presented.d.ts +82 -0
- package/dist/render/presented.js +82 -0
- package/dist/render/primitive.d.ts +228 -0
- package/dist/render/primitive.js +36 -0
- package/dist/render/props.d.ts +48 -0
- package/dist/render/props.js +2 -0
- package/dist/render/reads.d.ts +73 -0
- package/dist/render/reads.js +45 -0
- package/dist/render/render.d.ts +164 -0
- package/dist/render/render.js +571 -0
- package/dist/render/request.d.ts +111 -0
- package/dist/render/request.js +60 -0
- package/dist/render/text.d.ts +91 -0
- package/dist/render/text.js +44 -0
- package/dist/render/theme.d.ts +61 -0
- package/dist/render/theme.js +52 -0
- package/dist/reserved-props.d.ts +35 -0
- package/dist/reserved-props.js +45 -0
- package/dist/result.d.ts +27 -0
- package/dist/result.js +30 -0
- package/dist/role.d.ts +71 -0
- package/dist/role.js +22 -0
- package/dist/runtime/analysis.d.ts +149 -0
- package/dist/runtime/analysis.js +187 -0
- package/dist/runtime/assessment.d.ts +35 -0
- package/dist/runtime/assessment.js +13 -0
- package/dist/runtime/disposition.d.ts +102 -0
- package/dist/runtime/disposition.js +59 -0
- package/dist/runtime/events.d.ts +187 -0
- package/dist/runtime/events.js +7 -0
- package/dist/runtime/gate.d.ts +43 -0
- package/dist/runtime/gate.js +169 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/intent.d.ts +60 -0
- package/dist/runtime/intent.js +36 -0
- package/dist/runtime/interpreter.d.ts +117 -0
- package/dist/runtime/interpreter.js +46 -0
- package/dist/runtime/inverse-interpreter.d.ts +90 -0
- package/dist/runtime/inverse-interpreter.js +56 -0
- package/dist/runtime/inverse.d.ts +87 -0
- package/dist/runtime/inverse.js +48 -0
- package/dist/runtime/narration.d.ts +24 -0
- package/dist/runtime/narration.js +36 -0
- package/dist/runtime/nesting.d.ts +31 -0
- package/dist/runtime/nesting.js +46 -0
- package/dist/runtime/pipeline.d.ts +124 -0
- package/dist/runtime/pipeline.js +178 -0
- package/dist/runtime/policy-fingerprint.d.ts +29 -0
- package/dist/runtime/policy-fingerprint.js +119 -0
- package/dist/runtime/policy-source.d.ts +42 -0
- package/dist/runtime/policy-source.js +8 -0
- package/dist/runtime/policy.d.ts +156 -0
- package/dist/runtime/policy.js +107 -0
- package/dist/runtime/proposal.d.ts +423 -0
- package/dist/runtime/proposal.js +109 -0
- package/dist/runtime/redirection.d.ts +53 -0
- package/dist/runtime/redirection.js +38 -0
- package/dist/runtime/repointing.d.ts +71 -0
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +36 -0
- package/dist/runtime/reversibility.js +39 -0
- package/dist/runtime/stake-level.d.ts +33 -0
- package/dist/runtime/stake-level.js +58 -0
- package/dist/runtime/stakes.d.ts +47 -0
- package/dist/runtime/stakes.js +305 -0
- package/dist/runtime/vocabulary.d.ts +122 -0
- package/dist/runtime/vocabulary.js +87 -0
- package/dist/sdk/audit.d.ts +195 -0
- package/dist/sdk/audit.js +128 -0
- package/dist/sdk/catalogue.d.ts +37 -0
- package/dist/sdk/catalogue.js +16 -0
- package/dist/sdk/conformance.d.ts +342 -0
- package/dist/sdk/conformance.js +494 -0
- package/dist/sdk/copy.d.ts +105 -0
- package/dist/sdk/copy.js +90 -0
- package/dist/sdk/definition.d.ts +242 -0
- package/dist/sdk/definition.js +64 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/interactivity.d.ts +29 -0
- package/dist/sdk/interactivity.js +34 -0
- package/dist/sdk/pairings.d.ts +124 -0
- package/dist/sdk/pairings.js +81 -0
- package/dist/sdk/registry.d.ts +162 -0
- package/dist/sdk/registry.js +329 -0
- package/dist/sdk/selection.d.ts +46 -0
- package/dist/sdk/selection.js +24 -0
- package/dist/sdk/text.d.ts +100 -0
- package/dist/sdk/text.js +105 -0
- package/dist/sdk/vocabulary.d.ts +39 -0
- package/dist/sdk/vocabulary.js +36 -0
- package/dist/signals/broadcast.d.ts +134 -0
- package/dist/signals/broadcast.js +451 -0
- package/dist/signals/collect.d.ts +184 -0
- package/dist/signals/collect.js +196 -0
- package/dist/signals/deliver.d.ts +64 -0
- package/dist/signals/deliver.js +85 -0
- package/dist/signals/fold.d.ts +112 -0
- package/dist/signals/fold.js +76 -0
- package/dist/signals/index.d.ts +31 -0
- package/dist/signals/index.js +31 -0
- package/dist/signals/ingest.d.ts +51 -0
- package/dist/signals/ingest.js +70 -0
- package/dist/signals/intake.d.ts +149 -0
- package/dist/signals/intake.js +154 -0
- package/dist/signals/journal.d.ts +94 -0
- package/dist/signals/journal.js +11 -0
- package/dist/signals/kinds.d.ts +22 -0
- package/dist/signals/kinds.js +22 -0
- package/dist/signals/ledger.d.ts +46 -0
- package/dist/signals/ledger.js +81 -0
- package/dist/signals/memory.d.ts +17 -0
- package/dist/signals/memory.js +99 -0
- package/dist/signals/migrate.d.ts +27 -0
- package/dist/signals/migrate.js +78 -0
- package/dist/signals/postgres.d.ts +7 -0
- package/dist/signals/postgres.js +295 -0
- package/dist/signals/rollup.d.ts +142 -0
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +534 -0
- package/dist/signals/schema.js +92 -0
- package/dist/signals/signal.d.ts +381 -0
- package/dist/signals/signal.js +150 -0
- package/dist/signals/tally.d.ts +70 -0
- package/dist/signals/tally.js +2 -0
- package/dist/signals/view.d.ts +51 -0
- package/dist/signals/view.js +54 -0
- package/dist/store/attribution.d.ts +125 -0
- package/dist/store/attribution.js +116 -0
- package/dist/store/database.d.ts +14 -0
- package/dist/store/database.js +2 -0
- package/dist/store/driver.d.ts +29 -0
- package/dist/store/driver.js +39 -0
- package/dist/store/errors.d.ts +56 -0
- package/dist/store/errors.js +37 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.js +16 -0
- package/dist/store/memory.d.ts +3 -0
- package/dist/store/memory.js +115 -0
- package/dist/store/migrate.d.ts +54 -0
- package/dist/store/migrate.js +122 -0
- package/dist/store/postgres-holds.d.ts +4 -0
- package/dist/store/postgres-holds.js +192 -0
- package/dist/store/postgres.d.ts +8 -0
- package/dist/store/postgres.js +262 -0
- package/dist/store/replay.d.ts +94 -0
- package/dist/store/replay.js +82 -0
- package/dist/store/revert.d.ts +116 -0
- package/dist/store/revert.js +243 -0
- package/dist/store/schema.d.ts +371 -0
- package/dist/store/schema.js +78 -0
- package/dist/store/source.d.ts +23 -0
- package/dist/store/source.js +37 -0
- package/dist/store/store.d.ts +231 -0
- package/dist/store/store.js +52 -0
- package/dist/store/undone.d.ts +18 -0
- package/dist/store/undone.js +89 -0
- package/dist/submit/catalogue.d.ts +20 -0
- package/dist/submit/catalogue.js +5 -0
- package/dist/submit/declaration.d.ts +39 -0
- package/dist/submit/declaration.js +30 -0
- package/dist/submit/endpoint.d.ts +131 -0
- package/dist/submit/endpoint.js +160 -0
- package/dist/submit/index.d.ts +13 -0
- package/dist/submit/index.js +13 -0
- package/dist/submit/plan.d.ts +49 -0
- package/dist/submit/plan.js +47 -0
- package/dist/submit/resolution.d.ts +61 -0
- package/dist/submit/resolution.js +64 -0
- package/dist/submit/resolve.d.ts +45 -0
- package/dist/submit/resolve.js +36 -0
- package/dist/telemetry/calibration.d.ts +132 -0
- package/dist/telemetry/calibration.js +151 -0
- package/dist/telemetry/episode.d.ts +140 -0
- package/dist/telemetry/episode.js +272 -0
- package/dist/telemetry/event.d.ts +2310 -0
- package/dist/telemetry/event.js +405 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/journal.d.ts +116 -0
- package/dist/telemetry/journal.js +11 -0
- package/dist/telemetry/memory.d.ts +24 -0
- package/dist/telemetry/memory.js +75 -0
- package/dist/telemetry/migrate.d.ts +26 -0
- package/dist/telemetry/migrate.js +40 -0
- package/dist/telemetry/postgres.d.ts +6 -0
- package/dist/telemetry/postgres.js +139 -0
- package/dist/telemetry/retention.d.ts +131 -0
- package/dist/telemetry/retention.js +217 -0
- package/dist/telemetry/schema.d.ts +113 -0
- package/dist/telemetry/schema.js +33 -0
- package/dist/telemetry/sink.d.ts +42 -0
- package/dist/telemetry/sink.js +61 -0
- package/dist/testing/contracts.d.ts +34 -0
- package/dist/testing/contracts.js +34 -0
- package/dist/testing/definitions.d.ts +15 -0
- package/dist/testing/definitions.js +48 -0
- package/dist/testing/doubles.d.ts +94 -0
- package/dist/testing/doubles.js +141 -0
- package/dist/testing/episode-harness.d.ts +49 -0
- package/dist/testing/episode-harness.js +65 -0
- package/dist/testing/filesystem.d.ts +17 -0
- package/dist/testing/filesystem.js +17 -0
- package/dist/testing/fixtures.d.ts +57 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/hold-contract.d.ts +19 -0
- package/dist/testing/hold-contract.js +374 -0
- package/dist/testing/index.d.ts +41 -0
- package/dist/testing/index.js +41 -0
- package/dist/testing/journal-contract.d.ts +17 -0
- package/dist/testing/journal-contract.js +353 -0
- package/dist/testing/model-replies.d.ts +34 -0
- package/dist/testing/model-replies.js +101 -0
- package/dist/testing/primitives.d.ts +7 -0
- package/dist/testing/primitives.js +29 -0
- package/dist/testing/reader-signal-contract.d.ts +38 -0
- package/dist/testing/reader-signal-contract.js +318 -0
- package/dist/testing/row-security.d.ts +17 -0
- package/dist/testing/row-security.js +21 -0
- package/dist/testing/store-contract.d.ts +25 -0
- package/dist/testing/store-contract.js +500 -0
- package/dist/theme/apply.d.ts +17 -0
- package/dist/theme/apply.js +60 -0
- package/dist/theme/contrast.d.ts +197 -0
- package/dist/theme/contrast.js +259 -0
- package/dist/theme/derive.d.ts +77 -0
- package/dist/theme/derive.js +167 -0
- package/dist/theme/faces.d.ts +73 -0
- package/dist/theme/faces.js +119 -0
- package/dist/theme/font-packs.d.ts +25 -0
- package/dist/theme/font-packs.js +257 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/lab.d.ts +30 -0
- package/dist/theme/lab.js +46 -0
- package/dist/theme/library.d.ts +114 -0
- package/dist/theme/library.js +300 -0
- package/dist/theme/measure.d.ts +144 -0
- package/dist/theme/measure.js +145 -0
- package/dist/theme/palettes.d.ts +64 -0
- package/dist/theme/palettes.js +497 -0
- package/dist/theme/registry.d.ts +59 -0
- package/dist/theme/registry.js +60 -0
- package/dist/theme/separation.d.ts +177 -0
- package/dist/theme/separation.js +203 -0
- package/dist/theme/style-presets.d.ts +60 -0
- package/dist/theme/style-presets.js +124 -0
- package/dist/theme/theme.d.ts +253 -0
- package/dist/theme/theme.js +171 -0
- package/dist/tree/apply.d.ts +16 -0
- package/dist/tree/apply.js +104 -0
- package/dist/tree/builders.d.ts +19 -0
- package/dist/tree/builders.js +20 -0
- package/dist/tree/compare.d.ts +68 -0
- package/dist/tree/compare.js +75 -0
- package/dist/tree/configuration.d.ts +25 -0
- package/dist/tree/configuration.js +108 -0
- package/dist/tree/delta.d.ts +288 -0
- package/dist/tree/delta.js +88 -0
- package/dist/tree/errors.d.ts +69 -0
- package/dist/tree/errors.js +34 -0
- package/dist/tree/identity.d.ts +117 -0
- package/dist/tree/identity.js +145 -0
- package/dist/tree/index.d.ts +21 -0
- package/dist/tree/index.js +21 -0
- package/dist/tree/inverse.d.ts +24 -0
- package/dist/tree/inverse.js +112 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +49 -0
- package/dist/tree/naming.d.ts +4 -0
- package/dist/tree/naming.js +35 -0
- package/dist/tree/navigation.d.ts +38 -0
- package/dist/tree/navigation.js +83 -0
- package/dist/tree/node.d.ts +103 -0
- package/dist/tree/node.js +46 -0
- package/dist/tree/outline.d.ts +28 -0
- package/dist/tree/outline.js +10 -0
- package/dist/tree/tree.d.ts +83 -0
- package/dist/tree/tree.js +62 -0
- package/dist/write/commit.d.ts +124 -0
- package/dist/write/commit.js +234 -0
- package/dist/write/held.d.ts +674 -0
- package/dist/write/held.js +185 -0
- package/dist/write/index.d.ts +11 -0
- package/dist/write/index.js +11 -0
- package/dist/write/liveness.d.ts +132 -0
- package/dist/write/liveness.js +91 -0
- package/dist/write/revert.d.ts +79 -0
- package/dist/write/revert.js +134 -0
- package/package.json +160 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Two tables: the log, and the snapshot it produces.
|
|
3
|
+
*
|
|
4
|
+
* 0016 made the log the truth and the snapshot a materialised view of it, so the
|
|
5
|
+
* shapes here are not symmetric. `loom_revisions` is append-only and is never
|
|
6
|
+
* updated or deleted from; `loom_trees` is overwritten on every append and can be
|
|
7
|
+
* rebuilt from the log at any time.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The snapshot. `document` is the whole `LoomTree`, stored as JSON rather than
|
|
11
|
+
* decomposed into node rows — the tree is read and written whole, and a schema
|
|
12
|
+
* that shredded it would have to be migrated every time §1 changes the AST.
|
|
13
|
+
*/
|
|
14
|
+
export declare const loomTrees: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
15
|
+
name: "loom_trees";
|
|
16
|
+
schema: undefined;
|
|
17
|
+
columns: {
|
|
18
|
+
treeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
19
|
+
name: "tree_id";
|
|
20
|
+
tableName: "loom_trees";
|
|
21
|
+
dataType: "string";
|
|
22
|
+
columnType: "PgText";
|
|
23
|
+
data: string;
|
|
24
|
+
driverParam: string;
|
|
25
|
+
notNull: true;
|
|
26
|
+
hasDefault: false;
|
|
27
|
+
isPrimaryKey: true;
|
|
28
|
+
isAutoincrement: false;
|
|
29
|
+
hasRuntimeDefault: false;
|
|
30
|
+
enumValues: [string, ...string[]];
|
|
31
|
+
baseColumn: never;
|
|
32
|
+
identity: undefined;
|
|
33
|
+
generated: undefined;
|
|
34
|
+
}, {}, {}>;
|
|
35
|
+
revision: import("drizzle-orm/pg-core").PgColumn<{
|
|
36
|
+
name: "revision";
|
|
37
|
+
tableName: "loom_trees";
|
|
38
|
+
dataType: "number";
|
|
39
|
+
columnType: "PgInteger";
|
|
40
|
+
data: number;
|
|
41
|
+
driverParam: string | number;
|
|
42
|
+
notNull: true;
|
|
43
|
+
hasDefault: false;
|
|
44
|
+
isPrimaryKey: false;
|
|
45
|
+
isAutoincrement: false;
|
|
46
|
+
hasRuntimeDefault: false;
|
|
47
|
+
enumValues: undefined;
|
|
48
|
+
baseColumn: never;
|
|
49
|
+
identity: undefined;
|
|
50
|
+
generated: undefined;
|
|
51
|
+
}, {}, {}>;
|
|
52
|
+
document: import("drizzle-orm/pg-core").PgColumn<{
|
|
53
|
+
name: "document";
|
|
54
|
+
tableName: "loom_trees";
|
|
55
|
+
dataType: "json";
|
|
56
|
+
columnType: "PgJsonb";
|
|
57
|
+
data: unknown;
|
|
58
|
+
driverParam: unknown;
|
|
59
|
+
notNull: true;
|
|
60
|
+
hasDefault: false;
|
|
61
|
+
isPrimaryKey: false;
|
|
62
|
+
isAutoincrement: false;
|
|
63
|
+
hasRuntimeDefault: false;
|
|
64
|
+
enumValues: undefined;
|
|
65
|
+
baseColumn: never;
|
|
66
|
+
identity: undefined;
|
|
67
|
+
generated: undefined;
|
|
68
|
+
}, {}, {}>;
|
|
69
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
70
|
+
name: "updated_at";
|
|
71
|
+
tableName: "loom_trees";
|
|
72
|
+
dataType: "date";
|
|
73
|
+
columnType: "PgTimestamp";
|
|
74
|
+
data: Date;
|
|
75
|
+
driverParam: string;
|
|
76
|
+
notNull: true;
|
|
77
|
+
hasDefault: true;
|
|
78
|
+
isPrimaryKey: false;
|
|
79
|
+
isAutoincrement: false;
|
|
80
|
+
hasRuntimeDefault: false;
|
|
81
|
+
enumValues: undefined;
|
|
82
|
+
baseColumn: never;
|
|
83
|
+
identity: undefined;
|
|
84
|
+
generated: undefined;
|
|
85
|
+
}, {}, {}>;
|
|
86
|
+
};
|
|
87
|
+
dialect: "pg";
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* The log. The composite primary key is load-bearing rather than incidental: it
|
|
91
|
+
* makes the *database* enforce the revision sequence, so two writers racing at
|
|
92
|
+
* the same base revision cannot both commit even if both passed the
|
|
93
|
+
* base-revision check before either finished. The in-memory store gets that
|
|
94
|
+
* property from being single-threaded; here it has to come from a constraint.
|
|
95
|
+
*
|
|
96
|
+
* `delta` and `provenance` are JSON because they are Zod-validated shapes owned
|
|
97
|
+
* by §1 and §2. Columns would duplicate those definitions and drift from them.
|
|
98
|
+
*/
|
|
99
|
+
export declare const loomRevisions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
100
|
+
name: "loom_revisions";
|
|
101
|
+
schema: undefined;
|
|
102
|
+
columns: {
|
|
103
|
+
treeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
104
|
+
name: "tree_id";
|
|
105
|
+
tableName: "loom_revisions";
|
|
106
|
+
dataType: "string";
|
|
107
|
+
columnType: "PgText";
|
|
108
|
+
data: string;
|
|
109
|
+
driverParam: string;
|
|
110
|
+
notNull: true;
|
|
111
|
+
hasDefault: false;
|
|
112
|
+
isPrimaryKey: false;
|
|
113
|
+
isAutoincrement: false;
|
|
114
|
+
hasRuntimeDefault: false;
|
|
115
|
+
enumValues: [string, ...string[]];
|
|
116
|
+
baseColumn: never;
|
|
117
|
+
identity: undefined;
|
|
118
|
+
generated: undefined;
|
|
119
|
+
}, {}, {}>;
|
|
120
|
+
revision: import("drizzle-orm/pg-core").PgColumn<{
|
|
121
|
+
name: "revision";
|
|
122
|
+
tableName: "loom_revisions";
|
|
123
|
+
dataType: "number";
|
|
124
|
+
columnType: "PgInteger";
|
|
125
|
+
data: number;
|
|
126
|
+
driverParam: string | number;
|
|
127
|
+
notNull: true;
|
|
128
|
+
hasDefault: false;
|
|
129
|
+
isPrimaryKey: false;
|
|
130
|
+
isAutoincrement: false;
|
|
131
|
+
hasRuntimeDefault: false;
|
|
132
|
+
enumValues: undefined;
|
|
133
|
+
baseColumn: never;
|
|
134
|
+
identity: undefined;
|
|
135
|
+
generated: undefined;
|
|
136
|
+
}, {}, {}>;
|
|
137
|
+
proposalId: import("drizzle-orm/pg-core").PgColumn<{
|
|
138
|
+
name: "proposal_id";
|
|
139
|
+
tableName: "loom_revisions";
|
|
140
|
+
dataType: "string";
|
|
141
|
+
columnType: "PgText";
|
|
142
|
+
data: string;
|
|
143
|
+
driverParam: string;
|
|
144
|
+
notNull: true;
|
|
145
|
+
hasDefault: false;
|
|
146
|
+
isPrimaryKey: false;
|
|
147
|
+
isAutoincrement: false;
|
|
148
|
+
hasRuntimeDefault: false;
|
|
149
|
+
enumValues: [string, ...string[]];
|
|
150
|
+
baseColumn: never;
|
|
151
|
+
identity: undefined;
|
|
152
|
+
generated: undefined;
|
|
153
|
+
}, {}, {}>;
|
|
154
|
+
delta: import("drizzle-orm/pg-core").PgColumn<{
|
|
155
|
+
name: "delta";
|
|
156
|
+
tableName: "loom_revisions";
|
|
157
|
+
dataType: "json";
|
|
158
|
+
columnType: "PgJsonb";
|
|
159
|
+
data: unknown;
|
|
160
|
+
driverParam: unknown;
|
|
161
|
+
notNull: true;
|
|
162
|
+
hasDefault: false;
|
|
163
|
+
isPrimaryKey: false;
|
|
164
|
+
isAutoincrement: false;
|
|
165
|
+
hasRuntimeDefault: false;
|
|
166
|
+
enumValues: undefined;
|
|
167
|
+
baseColumn: never;
|
|
168
|
+
identity: undefined;
|
|
169
|
+
generated: undefined;
|
|
170
|
+
}, {}, {}>;
|
|
171
|
+
provenance: import("drizzle-orm/pg-core").PgColumn<{
|
|
172
|
+
name: "provenance";
|
|
173
|
+
tableName: "loom_revisions";
|
|
174
|
+
dataType: "json";
|
|
175
|
+
columnType: "PgJsonb";
|
|
176
|
+
data: unknown;
|
|
177
|
+
driverParam: unknown;
|
|
178
|
+
notNull: true;
|
|
179
|
+
hasDefault: false;
|
|
180
|
+
isPrimaryKey: false;
|
|
181
|
+
isAutoincrement: false;
|
|
182
|
+
hasRuntimeDefault: false;
|
|
183
|
+
enumValues: undefined;
|
|
184
|
+
baseColumn: never;
|
|
185
|
+
identity: undefined;
|
|
186
|
+
generated: undefined;
|
|
187
|
+
}, {}, {}>;
|
|
188
|
+
appliedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
189
|
+
name: "applied_at";
|
|
190
|
+
tableName: "loom_revisions";
|
|
191
|
+
dataType: "string";
|
|
192
|
+
columnType: "PgText";
|
|
193
|
+
data: string;
|
|
194
|
+
driverParam: string;
|
|
195
|
+
notNull: true;
|
|
196
|
+
hasDefault: false;
|
|
197
|
+
isPrimaryKey: false;
|
|
198
|
+
isAutoincrement: false;
|
|
199
|
+
hasRuntimeDefault: false;
|
|
200
|
+
enumValues: [string, ...string[]];
|
|
201
|
+
baseColumn: never;
|
|
202
|
+
identity: undefined;
|
|
203
|
+
generated: undefined;
|
|
204
|
+
}, {}, {}>;
|
|
205
|
+
answeredBy: import("drizzle-orm/pg-core").PgColumn<{
|
|
206
|
+
name: "answered_by";
|
|
207
|
+
tableName: "loom_revisions";
|
|
208
|
+
dataType: "string";
|
|
209
|
+
columnType: "PgText";
|
|
210
|
+
data: string;
|
|
211
|
+
driverParam: string;
|
|
212
|
+
notNull: false;
|
|
213
|
+
hasDefault: false;
|
|
214
|
+
isPrimaryKey: false;
|
|
215
|
+
isAutoincrement: false;
|
|
216
|
+
hasRuntimeDefault: false;
|
|
217
|
+
enumValues: [string, ...string[]];
|
|
218
|
+
baseColumn: never;
|
|
219
|
+
identity: undefined;
|
|
220
|
+
generated: undefined;
|
|
221
|
+
}, {}, {}>;
|
|
222
|
+
};
|
|
223
|
+
dialect: "pg";
|
|
224
|
+
}>;
|
|
225
|
+
/**
|
|
226
|
+
* The custody of what the Gate held back.
|
|
227
|
+
*
|
|
228
|
+
* A third table rather than a column on either of the two above, because a hold
|
|
229
|
+
* is not a revision: 0016 makes a revision the count of the log's entries, so a
|
|
230
|
+
* row for a change that advanced nothing would break the invariant the snapshot
|
|
231
|
+
* is checked against. `held.ts` says the same thing from the other side.
|
|
232
|
+
*
|
|
233
|
+
* `intent`, `proposal` and `disposition` are stored whole, for the reason
|
|
234
|
+
* `loom_revisions.delta` is: they are Zod-validated shapes owned by §2 and §3,
|
|
235
|
+
* and columns would duplicate those definitions and drift from them. It also
|
|
236
|
+
* keeps the promise the interface makes — a confirmation can be *re-judged*,
|
|
237
|
+
* which needs the proposal as it was, not a reconstruction of it.
|
|
238
|
+
*
|
|
239
|
+
* `held_at` is text rather than a timestamp to match `loom_revisions.applied_at`
|
|
240
|
+
* and, more to the point, to match what the in-memory store sorts on: an
|
|
241
|
+
* ISO-8601 UTC instant orders lexicographically exactly as it orders in time, so
|
|
242
|
+
* both implementations read a queue oldest-first by the same comparison rather
|
|
243
|
+
* than by two that happen to agree.
|
|
244
|
+
*/
|
|
245
|
+
export declare const loomHolds: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
246
|
+
name: "loom_holds";
|
|
247
|
+
schema: undefined;
|
|
248
|
+
columns: {
|
|
249
|
+
proposalId: import("drizzle-orm/pg-core").PgColumn<{
|
|
250
|
+
name: "proposal_id";
|
|
251
|
+
tableName: "loom_holds";
|
|
252
|
+
dataType: "string";
|
|
253
|
+
columnType: "PgText";
|
|
254
|
+
data: string;
|
|
255
|
+
driverParam: string;
|
|
256
|
+
notNull: true;
|
|
257
|
+
hasDefault: false;
|
|
258
|
+
isPrimaryKey: true;
|
|
259
|
+
isAutoincrement: false;
|
|
260
|
+
hasRuntimeDefault: false;
|
|
261
|
+
enumValues: [string, ...string[]];
|
|
262
|
+
baseColumn: never;
|
|
263
|
+
identity: undefined;
|
|
264
|
+
generated: undefined;
|
|
265
|
+
}, {}, {}>;
|
|
266
|
+
treeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
267
|
+
name: "tree_id";
|
|
268
|
+
tableName: "loom_holds";
|
|
269
|
+
dataType: "string";
|
|
270
|
+
columnType: "PgText";
|
|
271
|
+
data: string;
|
|
272
|
+
driverParam: string;
|
|
273
|
+
notNull: true;
|
|
274
|
+
hasDefault: false;
|
|
275
|
+
isPrimaryKey: false;
|
|
276
|
+
isAutoincrement: false;
|
|
277
|
+
hasRuntimeDefault: false;
|
|
278
|
+
enumValues: [string, ...string[]];
|
|
279
|
+
baseColumn: never;
|
|
280
|
+
identity: undefined;
|
|
281
|
+
generated: undefined;
|
|
282
|
+
}, {}, {}>;
|
|
283
|
+
baseRevision: import("drizzle-orm/pg-core").PgColumn<{
|
|
284
|
+
name: "base_revision";
|
|
285
|
+
tableName: "loom_holds";
|
|
286
|
+
dataType: "number";
|
|
287
|
+
columnType: "PgInteger";
|
|
288
|
+
data: number;
|
|
289
|
+
driverParam: string | number;
|
|
290
|
+
notNull: true;
|
|
291
|
+
hasDefault: false;
|
|
292
|
+
isPrimaryKey: false;
|
|
293
|
+
isAutoincrement: false;
|
|
294
|
+
hasRuntimeDefault: false;
|
|
295
|
+
enumValues: undefined;
|
|
296
|
+
baseColumn: never;
|
|
297
|
+
identity: undefined;
|
|
298
|
+
generated: undefined;
|
|
299
|
+
}, {}, {}>;
|
|
300
|
+
intent: import("drizzle-orm/pg-core").PgColumn<{
|
|
301
|
+
name: "intent";
|
|
302
|
+
tableName: "loom_holds";
|
|
303
|
+
dataType: "json";
|
|
304
|
+
columnType: "PgJsonb";
|
|
305
|
+
data: unknown;
|
|
306
|
+
driverParam: unknown;
|
|
307
|
+
notNull: true;
|
|
308
|
+
hasDefault: false;
|
|
309
|
+
isPrimaryKey: false;
|
|
310
|
+
isAutoincrement: false;
|
|
311
|
+
hasRuntimeDefault: false;
|
|
312
|
+
enumValues: undefined;
|
|
313
|
+
baseColumn: never;
|
|
314
|
+
identity: undefined;
|
|
315
|
+
generated: undefined;
|
|
316
|
+
}, {}, {}>;
|
|
317
|
+
proposal: import("drizzle-orm/pg-core").PgColumn<{
|
|
318
|
+
name: "proposal";
|
|
319
|
+
tableName: "loom_holds";
|
|
320
|
+
dataType: "json";
|
|
321
|
+
columnType: "PgJsonb";
|
|
322
|
+
data: unknown;
|
|
323
|
+
driverParam: unknown;
|
|
324
|
+
notNull: true;
|
|
325
|
+
hasDefault: false;
|
|
326
|
+
isPrimaryKey: false;
|
|
327
|
+
isAutoincrement: false;
|
|
328
|
+
hasRuntimeDefault: false;
|
|
329
|
+
enumValues: undefined;
|
|
330
|
+
baseColumn: never;
|
|
331
|
+
identity: undefined;
|
|
332
|
+
generated: undefined;
|
|
333
|
+
}, {}, {}>;
|
|
334
|
+
disposition: import("drizzle-orm/pg-core").PgColumn<{
|
|
335
|
+
name: "disposition";
|
|
336
|
+
tableName: "loom_holds";
|
|
337
|
+
dataType: "json";
|
|
338
|
+
columnType: "PgJsonb";
|
|
339
|
+
data: unknown;
|
|
340
|
+
driverParam: unknown;
|
|
341
|
+
notNull: true;
|
|
342
|
+
hasDefault: false;
|
|
343
|
+
isPrimaryKey: false;
|
|
344
|
+
isAutoincrement: false;
|
|
345
|
+
hasRuntimeDefault: false;
|
|
346
|
+
enumValues: undefined;
|
|
347
|
+
baseColumn: never;
|
|
348
|
+
identity: undefined;
|
|
349
|
+
generated: undefined;
|
|
350
|
+
}, {}, {}>;
|
|
351
|
+
heldAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
352
|
+
name: "held_at";
|
|
353
|
+
tableName: "loom_holds";
|
|
354
|
+
dataType: "string";
|
|
355
|
+
columnType: "PgText";
|
|
356
|
+
data: string;
|
|
357
|
+
driverParam: string;
|
|
358
|
+
notNull: true;
|
|
359
|
+
hasDefault: false;
|
|
360
|
+
isPrimaryKey: false;
|
|
361
|
+
isAutoincrement: false;
|
|
362
|
+
hasRuntimeDefault: false;
|
|
363
|
+
enumValues: [string, ...string[]];
|
|
364
|
+
baseColumn: never;
|
|
365
|
+
identity: undefined;
|
|
366
|
+
generated: undefined;
|
|
367
|
+
}, {}, {}>;
|
|
368
|
+
};
|
|
369
|
+
dialect: "pg";
|
|
370
|
+
}>;
|
|
371
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { integer, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
|
+
/**
|
|
4
|
+
* Two tables: the log, and the snapshot it produces.
|
|
5
|
+
*
|
|
6
|
+
* 0016 made the log the truth and the snapshot a materialised view of it, so the
|
|
7
|
+
* shapes here are not symmetric. `loom_revisions` is append-only and is never
|
|
8
|
+
* updated or deleted from; `loom_trees` is overwritten on every append and can be
|
|
9
|
+
* rebuilt from the log at any time.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* The snapshot. `document` is the whole `LoomTree`, stored as JSON rather than
|
|
13
|
+
* decomposed into node rows — the tree is read and written whole, and a schema
|
|
14
|
+
* that shredded it would have to be migrated every time §1 changes the AST.
|
|
15
|
+
*/
|
|
16
|
+
export const loomTrees = pgTable("loom_trees", {
|
|
17
|
+
treeId: text("tree_id").primaryKey(),
|
|
18
|
+
revision: integer("revision").notNull(),
|
|
19
|
+
document: jsonb("document").notNull(),
|
|
20
|
+
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
21
|
+
.notNull()
|
|
22
|
+
.default(sql `now()`),
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* The log. The composite primary key is load-bearing rather than incidental: it
|
|
26
|
+
* makes the *database* enforce the revision sequence, so two writers racing at
|
|
27
|
+
* the same base revision cannot both commit even if both passed the
|
|
28
|
+
* base-revision check before either finished. The in-memory store gets that
|
|
29
|
+
* property from being single-threaded; here it has to come from a constraint.
|
|
30
|
+
*
|
|
31
|
+
* `delta` and `provenance` are JSON because they are Zod-validated shapes owned
|
|
32
|
+
* by §1 and §2. Columns would duplicate those definitions and drift from them.
|
|
33
|
+
*/
|
|
34
|
+
export const loomRevisions = pgTable("loom_revisions", {
|
|
35
|
+
treeId: text("tree_id").notNull(),
|
|
36
|
+
revision: integer("revision").notNull(),
|
|
37
|
+
proposalId: text("proposal_id").notNull(),
|
|
38
|
+
delta: jsonb("delta").notNull(),
|
|
39
|
+
provenance: jsonb("provenance").notNull(),
|
|
40
|
+
/** When the runtime applied it, which is not when the row was written. */
|
|
41
|
+
appliedAt: text("applied_at").notNull(),
|
|
42
|
+
/**
|
|
43
|
+
* Who allowed it, when a human had to (0029). Nullable, and null on every
|
|
44
|
+
* row written before that record: the log is append-only, so an approver
|
|
45
|
+
* nobody observed stays unrecorded rather than being invented.
|
|
46
|
+
*/
|
|
47
|
+
answeredBy: text("answered_by"),
|
|
48
|
+
}, (table) => [primaryKey({ columns: [table.treeId, table.revision] })]);
|
|
49
|
+
/**
|
|
50
|
+
* The custody of what the Gate held back.
|
|
51
|
+
*
|
|
52
|
+
* A third table rather than a column on either of the two above, because a hold
|
|
53
|
+
* is not a revision: 0016 makes a revision the count of the log's entries, so a
|
|
54
|
+
* row for a change that advanced nothing would break the invariant the snapshot
|
|
55
|
+
* is checked against. `held.ts` says the same thing from the other side.
|
|
56
|
+
*
|
|
57
|
+
* `intent`, `proposal` and `disposition` are stored whole, for the reason
|
|
58
|
+
* `loom_revisions.delta` is: they are Zod-validated shapes owned by §2 and §3,
|
|
59
|
+
* and columns would duplicate those definitions and drift from them. It also
|
|
60
|
+
* keeps the promise the interface makes — a confirmation can be *re-judged*,
|
|
61
|
+
* which needs the proposal as it was, not a reconstruction of it.
|
|
62
|
+
*
|
|
63
|
+
* `held_at` is text rather than a timestamp to match `loom_revisions.applied_at`
|
|
64
|
+
* and, more to the point, to match what the in-memory store sorts on: an
|
|
65
|
+
* ISO-8601 UTC instant orders lexicographically exactly as it orders in time, so
|
|
66
|
+
* both implementations read a queue oldest-first by the same comparison rather
|
|
67
|
+
* than by two that happen to agree.
|
|
68
|
+
*/
|
|
69
|
+
export const loomHolds = pgTable("loom_holds", {
|
|
70
|
+
proposalId: text("proposal_id").primaryKey(),
|
|
71
|
+
treeId: text("tree_id").notNull(),
|
|
72
|
+
baseRevision: integer("base_revision").notNull(),
|
|
73
|
+
intent: jsonb("intent").notNull(),
|
|
74
|
+
proposal: jsonb("proposal").notNull(),
|
|
75
|
+
disposition: jsonb("disposition").notNull(),
|
|
76
|
+
heldAt: text("held_at").notNull(),
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { TreeSource } from "../render/request.js";
|
|
2
|
+
import type { TreeReader } from "./store.js";
|
|
3
|
+
/**
|
|
4
|
+
* The adapter that lets the renderer read from the store.
|
|
5
|
+
*
|
|
6
|
+
* One function, and it is the join between the part of Loom that keeps trees
|
|
7
|
+
* and the part that draws them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The store, as the renderer's `TreeSource`.
|
|
11
|
+
*
|
|
12
|
+
* §3 defined that seam and nothing implemented it, so §2 and §3 have until now
|
|
13
|
+
* been connected only through fixtures. This is the join: a delta accepted by the
|
|
14
|
+
* runtime is appended to the store, and the next request renders the snapshot the
|
|
15
|
+
* append produced.
|
|
16
|
+
*
|
|
17
|
+
* `load` returns `unknown` on purpose (see `render/request.ts`) — the renderer
|
|
18
|
+
* parses what it is handed rather than trusting a source's word about it. Handing
|
|
19
|
+
* it an already-parsed `LoomTree` would satisfy the type and skip the check, so
|
|
20
|
+
* this passes the snapshot through the same boundary any other source would.
|
|
21
|
+
*/
|
|
22
|
+
export declare const treeSourceFromStore: (store: TreeReader) => TreeSource;
|
|
23
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ok } from "../result.js";
|
|
2
|
+
import { describeStoreError } from "./errors.js";
|
|
3
|
+
/**
|
|
4
|
+
* The adapter that lets the renderer read from the store.
|
|
5
|
+
*
|
|
6
|
+
* One function, and it is the join between the part of Loom that keeps trees
|
|
7
|
+
* and the part that draws them.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* The store, as the renderer's `TreeSource`.
|
|
11
|
+
*
|
|
12
|
+
* §3 defined that seam and nothing implemented it, so §2 and §3 have until now
|
|
13
|
+
* been connected only through fixtures. This is the join: a delta accepted by the
|
|
14
|
+
* runtime is appended to the store, and the next request renders the snapshot the
|
|
15
|
+
* append produced.
|
|
16
|
+
*
|
|
17
|
+
* `load` returns `unknown` on purpose (see `render/request.ts`) — the renderer
|
|
18
|
+
* parses what it is handed rather than trusting a source's word about it. Handing
|
|
19
|
+
* it an already-parsed `LoomTree` would satisfy the type and skip the check, so
|
|
20
|
+
* this passes the snapshot through the same boundary any other source would.
|
|
21
|
+
*/
|
|
22
|
+
export const treeSourceFromStore = (store) => ({
|
|
23
|
+
load: async (request) => {
|
|
24
|
+
const head = await store.head(request.treeId);
|
|
25
|
+
if (!head.ok) {
|
|
26
|
+
return {
|
|
27
|
+
ok: false,
|
|
28
|
+
error: {
|
|
29
|
+
code: head.error.code === "not-found" ? "not-found" : "unavailable",
|
|
30
|
+
detail: describeStoreError(head.error),
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return ok(head.value);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=source.js.map
|