@jam-overture/loom 0.1.0 → 0.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 +3 -1
- package/dist/application/application.d.ts +109 -0
- package/dist/application/application.js +97 -0
- package/dist/application/memory.d.ts +20 -0
- package/dist/application/memory.js +79 -0
- package/dist/application/store.d.ts +101 -0
- package/dist/application/store.js +25 -0
- package/dist/audience/audience.d.ts +36 -0
- package/dist/audience/audience.js +41 -0
- package/dist/cli/templates.js +19 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +23 -1
- package/dist/data/resolve.d.ts +30 -3
- package/dist/data/resolve.js +11 -3
- package/dist/ids.d.ts +10 -0
- package/dist/ids.js +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/patch.d.ts +54 -0
- package/dist/patch.js +44 -0
- package/dist/project/closing.d.ts +51 -0
- package/dist/project/closing.js +53 -0
- package/dist/project/memory.d.ts +20 -0
- package/dist/project/memory.js +97 -0
- package/dist/project/project.d.ts +90 -0
- package/dist/project/project.js +91 -0
- package/dist/project/store.d.ts +135 -0
- package/dist/project/store.js +41 -0
- package/dist/registered.d.ts +64 -0
- package/dist/registered.js +118 -0
- package/dist/render/behaviour-adjust.d.ts +11 -19
- package/dist/render/behaviour-adjust.js +75 -21
- package/dist/render/behaviour-present.d.ts +8 -0
- package/dist/render/behaviour-present.js +57 -6
- package/dist/render/behaviour.d.ts +98 -17
- package/dist/render/behaviour.js +91 -26
- package/dist/render/control-name.d.ts +68 -0
- package/dist/render/control-name.js +37 -0
- package/dist/render/diagnostics.d.ts +72 -0
- package/dist/render/diagnostics.js +7 -0
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.js +2 -0
- package/dist/render/reads.d.ts +11 -0
- package/dist/render/reads.js +12 -1
- package/dist/render/render.js +102 -7
- package/dist/render/slots.d.ts +52 -0
- package/dist/render/slots.js +24 -0
- package/dist/render/theme.d.ts +54 -1
- package/dist/render/theme.js +23 -1
- package/dist/render/unshown.d.ts +152 -0
- package/dist/render/unshown.js +80 -0
- package/dist/runtime/analysis.d.ts +94 -9
- package/dist/runtime/analysis.js +54 -9
- package/dist/runtime/assessment.d.ts +36 -2
- package/dist/runtime/assessment.js +27 -2
- package/dist/runtime/checks.d.ts +148 -0
- package/dist/runtime/checks.js +112 -0
- package/dist/runtime/disposition.d.ts +96 -0
- package/dist/runtime/disposition.js +46 -0
- package/dist/runtime/gate.js +22 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.js +3 -0
- package/dist/runtime/irreversibility.d.ts +64 -0
- package/dist/runtime/irreversibility.js +45 -0
- package/dist/runtime/pipeline.d.ts +43 -0
- package/dist/runtime/pipeline.js +10 -2
- package/dist/runtime/policy-change.d.ts +93 -0
- package/dist/runtime/policy-change.js +299 -0
- package/dist/runtime/policy-log.d.ts +406 -0
- package/dist/runtime/policy-log.js +285 -0
- package/dist/runtime/reversibility.d.ts +11 -9
- package/dist/runtime/stakes.d.ts +129 -1
- package/dist/runtime/stakes.js +240 -26
- package/dist/runtime/vocabulary.d.ts +164 -7
- package/dist/runtime/vocabulary.js +181 -8
- package/dist/sdk/audit.d.ts +174 -3
- package/dist/sdk/audit.js +176 -17
- package/dist/sdk/catalogue.d.ts +9 -1
- package/dist/sdk/conformance.d.ts +37 -3
- package/dist/sdk/conformance.js +25 -4
- package/dist/sdk/definition.d.ts +65 -0
- package/dist/sdk/definition.js +22 -0
- package/dist/sdk/registry.d.ts +29 -2
- package/dist/sdk/registry.js +63 -1
- package/dist/signals/action-change.d.ts +507 -0
- package/dist/signals/action-change.js +265 -0
- package/dist/signals/action.d.ts +331 -0
- package/dist/signals/action.js +182 -0
- package/dist/signals/applied-window.contract.d.ts +23 -0
- package/dist/signals/applied-window.contract.js +160 -0
- package/dist/signals/arriving.d.ts +210 -0
- package/dist/signals/arriving.js +133 -0
- package/dist/signals/audiences.d.ts +528 -0
- package/dist/signals/audiences.js +255 -0
- package/dist/signals/broadcast.d.ts +8 -2
- package/dist/signals/broadcast.js +58 -8
- package/dist/signals/change.d.ts +378 -0
- package/dist/signals/change.js +327 -0
- package/dist/signals/collect.d.ts +41 -0
- package/dist/signals/collect.js +88 -7
- package/dist/signals/copy-change.d.ts +553 -0
- package/dist/signals/copy-change.js +377 -0
- package/dist/signals/copy.d.ts +337 -0
- package/dist/signals/copy.js +211 -0
- package/dist/signals/counters.d.ts +46 -0
- package/dist/signals/counters.js +102 -0
- package/dist/signals/deliver.d.ts +23 -4
- package/dist/signals/deliver.js +34 -6
- package/dist/signals/deployment-change.d.ts +371 -0
- package/dist/signals/deployment-change.js +268 -0
- package/dist/signals/deployment.d.ts +265 -0
- package/dist/signals/deployment.js +152 -0
- package/dist/signals/door.d.ts +92 -0
- package/dist/signals/door.js +53 -0
- package/dist/signals/fold.d.ts +10 -0
- package/dist/signals/fold.js +5 -1
- package/dist/signals/form-action.d.ts +302 -0
- package/dist/signals/form-action.js +169 -0
- package/dist/signals/form-copy.d.ts +523 -0
- package/dist/signals/form-copy.js +346 -0
- package/dist/signals/forms.d.ts +247 -0
- package/dist/signals/forms.js +147 -0
- package/dist/signals/funnel-change.d.ts +548 -0
- package/dist/signals/funnel-change.js +361 -0
- package/dist/signals/funnel.d.ts +532 -0
- package/dist/signals/funnel.js +216 -0
- package/dist/signals/health.d.ts +497 -0
- package/dist/signals/health.js +361 -0
- package/dist/signals/index.d.ts +41 -0
- package/dist/signals/index.js +41 -0
- package/dist/signals/ingest.d.ts +56 -1
- package/dist/signals/ingest.js +91 -1
- package/dist/signals/journal.d.ts +11 -0
- package/dist/signals/kinds.d.ts +8 -6
- package/dist/signals/kinds.js +14 -6
- package/dist/signals/library-action.d.ts +430 -0
- package/dist/signals/library-action.js +336 -0
- package/dist/signals/library-change.d.ts +477 -0
- package/dist/signals/library-change.js +335 -0
- package/dist/signals/library-copy-change.d.ts +498 -0
- package/dist/signals/library-copy-change.js +476 -0
- package/dist/signals/library-pace.d.ts +319 -0
- package/dist/signals/library-pace.js +305 -0
- package/dist/signals/library-reach-change.d.ts +636 -0
- package/dist/signals/library-reach-change.js +534 -0
- package/dist/signals/library-reach.d.ts +377 -0
- package/dist/signals/library-reach.js +227 -0
- package/dist/signals/library-word-reach-change.d.ts +567 -0
- package/dist/signals/library-word-reach-change.js +568 -0
- package/dist/signals/library.d.ts +306 -0
- package/dist/signals/library.js +178 -0
- package/dist/signals/memory.d.ts +9 -0
- package/dist/signals/memory.js +105 -14
- package/dist/signals/migrate.d.ts +17 -2
- package/dist/signals/migrate.js +122 -5
- package/dist/signals/notice.d.ts +334 -0
- package/dist/signals/notice.js +228 -0
- package/dist/signals/pace-change.d.ts +501 -0
- package/dist/signals/pace-change.js +310 -0
- package/dist/signals/pace.d.ts +296 -0
- package/dist/signals/pace.js +291 -0
- package/dist/signals/page-views.d.ts +365 -0
- package/dist/signals/page-views.js +218 -0
- package/dist/signals/parts.d.ts +344 -0
- package/dist/signals/parts.js +273 -0
- package/dist/signals/postgres.d.ts +16 -2
- package/dist/signals/postgres.js +390 -87
- package/dist/signals/progress.d.ts +212 -0
- package/dist/signals/progress.js +150 -0
- package/dist/signals/ratios.d.ts +108 -0
- package/dist/signals/ratios.js +40 -0
- package/dist/signals/reach.d.ts +309 -0
- package/dist/signals/reach.js +93 -0
- package/dist/signals/readable.d.ts +34 -0
- package/dist/signals/readable.js +34 -0
- package/dist/signals/readership.d.ts +381 -0
- package/dist/signals/readership.js +308 -0
- package/dist/signals/region-pages.d.ts +173 -0
- package/dist/signals/region-pages.js +62 -0
- package/dist/signals/region.d.ts +287 -0
- package/dist/signals/region.js +198 -0
- package/dist/signals/retention.d.ts +141 -0
- package/dist/signals/retention.js +58 -0
- package/dist/signals/rollup.d.ts +67 -3
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +432 -1
- package/dist/signals/schema.js +157 -3
- package/dist/signals/signal.d.ts +237 -11
- package/dist/signals/signal.js +70 -10
- package/dist/signals/silence-census.d.ts +205 -0
- package/dist/signals/silence-census.js +87 -0
- package/dist/signals/silences.d.ts +848 -0
- package/dist/signals/silences.js +753 -0
- package/dist/signals/tally.d.ts +140 -11
- package/dist/signals/window-figures.d.ts +148 -0
- package/dist/signals/window-figures.js +42 -0
- package/dist/signals/window.d.ts +866 -0
- package/dist/signals/window.js +693 -0
- package/dist/signals/words.d.ts +24 -0
- package/dist/signals/words.js +24 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.js +19 -0
- package/dist/store/memory.d.ts +2 -1
- package/dist/store/memory.js +48 -12
- package/dist/store/migrate.d.ts +80 -0
- package/dist/store/migrate.js +259 -7
- package/dist/store/postgres-applications.d.ts +4 -0
- package/dist/store/postgres-applications.js +197 -0
- package/dist/store/postgres-holds.d.ts +10 -1
- package/dist/store/postgres-holds.js +116 -101
- package/dist/store/postgres-policy-log.d.ts +14 -0
- package/dist/store/postgres-policy-log.js +240 -0
- package/dist/store/postgres-projects.d.ts +4 -0
- package/dist/store/postgres-projects.js +217 -0
- package/dist/store/postgres.d.ts +16 -1
- package/dist/store/postgres.js +59 -9
- package/dist/store/replay.d.ts +102 -1
- package/dist/store/replay.js +190 -19
- package/dist/store/reseed.d.ts +238 -0
- package/dist/store/reseed.js +308 -0
- package/dist/store/schema.d.ts +450 -2
- package/dist/store/schema.js +141 -5
- package/dist/store/store.d.ts +29 -6
- package/dist/submit/resolve.js +2 -1
- package/dist/telemetry/calibration.d.ts +25 -0
- package/dist/telemetry/calibration.js +27 -1
- package/dist/telemetry/event.d.ts +391 -33
- package/dist/telemetry/event.js +84 -20
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/journal.d.ts +72 -3
- package/dist/telemetry/journal.js +9 -0
- package/dist/telemetry/lookup.d.ts +27 -0
- package/dist/telemetry/lookup.js +18 -0
- package/dist/telemetry/memory.js +23 -0
- package/dist/telemetry/migrate.js +22 -1
- package/dist/telemetry/postgres.d.ts +10 -1
- package/dist/telemetry/postgres.js +172 -90
- package/dist/telemetry/remeasure.d.ts +78 -0
- package/dist/telemetry/remeasure.js +83 -0
- package/dist/telemetry/retention.d.ts +2 -2
- package/dist/telemetry/schema.d.ts +17 -0
- package/dist/telemetry/schema.js +27 -1
- package/dist/telemetry/sink.d.ts +2 -2
- package/dist/testing/application-contract.d.ts +14 -0
- package/dist/testing/application-contract.js +270 -0
- package/dist/testing/contracts.d.ts +12 -7
- package/dist/testing/contracts.js +12 -7
- package/dist/testing/definitions.d.ts +78 -0
- package/dist/testing/definitions.js +134 -9
- package/dist/testing/doubles.d.ts +103 -0
- package/dist/testing/doubles.js +143 -0
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/journal-contract.js +140 -2
- package/dist/testing/model-contract.d.ts +110 -0
- package/dist/testing/model-contract.js +150 -0
- package/dist/testing/policy-log-contract.d.ts +26 -0
- package/dist/testing/policy-log-contract.js +344 -0
- package/dist/testing/project-contract.d.ts +14 -0
- package/dist/testing/project-contract.js +266 -0
- package/dist/testing/reader-signal-contract.d.ts +27 -2
- package/dist/testing/reader-signal-contract.js +475 -5
- package/dist/testing/store-contract.d.ts +7 -1
- package/dist/testing/store-contract.js +84 -3
- package/dist/theme/apply.d.ts +20 -1
- package/dist/theme/apply.js +5 -3
- package/dist/theme/derive.d.ts +22 -0
- package/dist/theme/derive.js +54 -1
- package/dist/theme/library.js +1 -1
- package/dist/theme/measure.d.ts +34 -0
- package/dist/theme/measure.js +30 -1
- package/dist/theme/palettes.js +7 -7
- package/dist/theme/ramp.d.ts +64 -0
- package/dist/theme/ramp.js +114 -0
- package/dist/theme/registry.d.ts +9 -0
- package/dist/theme/registry.js +11 -1
- package/dist/theme/separation.d.ts +97 -3
- package/dist/theme/separation.js +75 -0
- package/dist/tree/compare.d.ts +9 -0
- package/dist/tree/compare.js +18 -0
- package/dist/write/computed.d.ts +60 -0
- package/dist/write/computed.js +61 -0
- package/dist/write/held.d.ts +59 -0
- package/dist/write/index.d.ts +5 -2
- package/dist/write/index.js +5 -2
- package/dist/write/reseed.d.ts +151 -0
- package/dist/write/reseed.js +184 -0
- package/dist/write/revert.js +2 -16
- package/package.json +98 -19
package/dist/store/schema.d.ts
CHANGED
|
@@ -15,6 +15,23 @@ export declare const loomTrees: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
15
15
|
name: "loom_trees";
|
|
16
16
|
schema: undefined;
|
|
17
17
|
columns: {
|
|
18
|
+
applicationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
19
|
+
name: "application_id";
|
|
20
|
+
tableName: "loom_trees";
|
|
21
|
+
dataType: "string";
|
|
22
|
+
columnType: "PgText";
|
|
23
|
+
data: string;
|
|
24
|
+
driverParam: string;
|
|
25
|
+
notNull: true;
|
|
26
|
+
hasDefault: true;
|
|
27
|
+
isPrimaryKey: false;
|
|
28
|
+
isAutoincrement: false;
|
|
29
|
+
hasRuntimeDefault: false;
|
|
30
|
+
enumValues: [string, ...string[]];
|
|
31
|
+
baseColumn: never;
|
|
32
|
+
identity: undefined;
|
|
33
|
+
generated: undefined;
|
|
34
|
+
}, {}, {}>;
|
|
18
35
|
treeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
19
36
|
name: "tree_id";
|
|
20
37
|
tableName: "loom_trees";
|
|
@@ -24,7 +41,7 @@ export declare const loomTrees: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
24
41
|
driverParam: string;
|
|
25
42
|
notNull: true;
|
|
26
43
|
hasDefault: false;
|
|
27
|
-
isPrimaryKey:
|
|
44
|
+
isPrimaryKey: false;
|
|
28
45
|
isAutoincrement: false;
|
|
29
46
|
hasRuntimeDefault: false;
|
|
30
47
|
enumValues: [string, ...string[]];
|
|
@@ -100,6 +117,23 @@ export declare const loomRevisions: import("drizzle-orm/pg-core").PgTableWithCol
|
|
|
100
117
|
name: "loom_revisions";
|
|
101
118
|
schema: undefined;
|
|
102
119
|
columns: {
|
|
120
|
+
applicationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
121
|
+
name: "application_id";
|
|
122
|
+
tableName: "loom_revisions";
|
|
123
|
+
dataType: "string";
|
|
124
|
+
columnType: "PgText";
|
|
125
|
+
data: string;
|
|
126
|
+
driverParam: string;
|
|
127
|
+
notNull: true;
|
|
128
|
+
hasDefault: true;
|
|
129
|
+
isPrimaryKey: false;
|
|
130
|
+
isAutoincrement: false;
|
|
131
|
+
hasRuntimeDefault: false;
|
|
132
|
+
enumValues: [string, ...string[]];
|
|
133
|
+
baseColumn: never;
|
|
134
|
+
identity: undefined;
|
|
135
|
+
generated: undefined;
|
|
136
|
+
}, {}, {}>;
|
|
103
137
|
treeId: import("drizzle-orm/pg-core").PgColumn<{
|
|
104
138
|
name: "tree_id";
|
|
105
139
|
tableName: "loom_revisions";
|
|
@@ -246,6 +280,23 @@ export declare const loomHolds: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
246
280
|
name: "loom_holds";
|
|
247
281
|
schema: undefined;
|
|
248
282
|
columns: {
|
|
283
|
+
applicationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
284
|
+
name: "application_id";
|
|
285
|
+
tableName: "loom_holds";
|
|
286
|
+
dataType: "string";
|
|
287
|
+
columnType: "PgText";
|
|
288
|
+
data: string;
|
|
289
|
+
driverParam: string;
|
|
290
|
+
notNull: true;
|
|
291
|
+
hasDefault: true;
|
|
292
|
+
isPrimaryKey: false;
|
|
293
|
+
isAutoincrement: false;
|
|
294
|
+
hasRuntimeDefault: false;
|
|
295
|
+
enumValues: [string, ...string[]];
|
|
296
|
+
baseColumn: never;
|
|
297
|
+
identity: undefined;
|
|
298
|
+
generated: undefined;
|
|
299
|
+
}, {}, {}>;
|
|
249
300
|
proposalId: import("drizzle-orm/pg-core").PgColumn<{
|
|
250
301
|
name: "proposal_id";
|
|
251
302
|
tableName: "loom_holds";
|
|
@@ -255,7 +306,7 @@ export declare const loomHolds: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
255
306
|
driverParam: string;
|
|
256
307
|
notNull: true;
|
|
257
308
|
hasDefault: false;
|
|
258
|
-
isPrimaryKey:
|
|
309
|
+
isPrimaryKey: false;
|
|
259
310
|
isAutoincrement: false;
|
|
260
311
|
hasRuntimeDefault: false;
|
|
261
312
|
enumValues: [string, ...string[]];
|
|
@@ -368,4 +419,401 @@ export declare const loomHolds: import("drizzle-orm/pg-core").PgTableWithColumns
|
|
|
368
419
|
};
|
|
369
420
|
dialect: "pg";
|
|
370
421
|
}>;
|
|
422
|
+
/**
|
|
423
|
+
* The policy's own log.
|
|
424
|
+
*
|
|
425
|
+
* A fourth table rather than a column anywhere, because a policy revision is not
|
|
426
|
+
* a tree revision: it is not keyed by a tree, it does not advance one, and the
|
|
427
|
+
* same revision of one policy judges changes to every tree a deployment holds.
|
|
428
|
+
* `policy-log.ts` says the same thing from the other side.
|
|
429
|
+
*
|
|
430
|
+
* `policy` is the whole `GatePolicy` as JSON, for the reason
|
|
431
|
+
* `loom_revisions.delta` is: it is a Zod-validated shape owned by §2, and
|
|
432
|
+
* columns would duplicate that definition and drift from it. A knob added to the
|
|
433
|
+
* policy would otherwise be a migration away from a log that quietly stops
|
|
434
|
+
* recording it.
|
|
435
|
+
*
|
|
436
|
+
* `fingerprint` is the one denormalised value in this schema, and it is a column
|
|
437
|
+
* rather than a JSON path because of the query it exists for: a `Disposition`
|
|
438
|
+
* carries a fingerprint, and finding the revision it names has to be a seek. The
|
|
439
|
+
* runtime computes it from the policy beside it on the way in and never accepts
|
|
440
|
+
* one from a caller, so the two cannot disagree.
|
|
441
|
+
*
|
|
442
|
+
* The composite primary key is load-bearing exactly as `loom_revisions`' is: it
|
|
443
|
+
* makes the database enforce the revision sequence, so two writers racing at the
|
|
444
|
+
* same head cannot both commit even if both read the head before either wrote.
|
|
445
|
+
*
|
|
446
|
+
* `recorded_at` is text rather than a timestamp to match
|
|
447
|
+
* `loom_revisions.applied_at` and `loom_holds.held_at` — an ISO-8601 UTC instant
|
|
448
|
+
* orders lexicographically exactly as it orders in time, and what the runtime
|
|
449
|
+
* holds above this boundary is a string.
|
|
450
|
+
*/
|
|
451
|
+
export declare const loomPolicyRevisions: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
452
|
+
name: "loom_policy_revisions";
|
|
453
|
+
schema: undefined;
|
|
454
|
+
columns: {
|
|
455
|
+
applicationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
456
|
+
name: "application_id";
|
|
457
|
+
tableName: "loom_policy_revisions";
|
|
458
|
+
dataType: "string";
|
|
459
|
+
columnType: "PgText";
|
|
460
|
+
data: string;
|
|
461
|
+
driverParam: string;
|
|
462
|
+
notNull: true;
|
|
463
|
+
hasDefault: true;
|
|
464
|
+
isPrimaryKey: false;
|
|
465
|
+
isAutoincrement: false;
|
|
466
|
+
hasRuntimeDefault: false;
|
|
467
|
+
enumValues: [string, ...string[]];
|
|
468
|
+
baseColumn: never;
|
|
469
|
+
identity: undefined;
|
|
470
|
+
generated: undefined;
|
|
471
|
+
}, {}, {}>;
|
|
472
|
+
policyId: import("drizzle-orm/pg-core").PgColumn<{
|
|
473
|
+
name: "policy_id";
|
|
474
|
+
tableName: "loom_policy_revisions";
|
|
475
|
+
dataType: "string";
|
|
476
|
+
columnType: "PgText";
|
|
477
|
+
data: string;
|
|
478
|
+
driverParam: string;
|
|
479
|
+
notNull: true;
|
|
480
|
+
hasDefault: false;
|
|
481
|
+
isPrimaryKey: false;
|
|
482
|
+
isAutoincrement: false;
|
|
483
|
+
hasRuntimeDefault: false;
|
|
484
|
+
enumValues: [string, ...string[]];
|
|
485
|
+
baseColumn: never;
|
|
486
|
+
identity: undefined;
|
|
487
|
+
generated: undefined;
|
|
488
|
+
}, {}, {}>;
|
|
489
|
+
revision: import("drizzle-orm/pg-core").PgColumn<{
|
|
490
|
+
name: "revision";
|
|
491
|
+
tableName: "loom_policy_revisions";
|
|
492
|
+
dataType: "number";
|
|
493
|
+
columnType: "PgInteger";
|
|
494
|
+
data: number;
|
|
495
|
+
driverParam: string | number;
|
|
496
|
+
notNull: true;
|
|
497
|
+
hasDefault: false;
|
|
498
|
+
isPrimaryKey: false;
|
|
499
|
+
isAutoincrement: false;
|
|
500
|
+
hasRuntimeDefault: false;
|
|
501
|
+
enumValues: undefined;
|
|
502
|
+
baseColumn: never;
|
|
503
|
+
identity: undefined;
|
|
504
|
+
generated: undefined;
|
|
505
|
+
}, {}, {}>;
|
|
506
|
+
fingerprint: import("drizzle-orm/pg-core").PgColumn<{
|
|
507
|
+
name: "fingerprint";
|
|
508
|
+
tableName: "loom_policy_revisions";
|
|
509
|
+
dataType: "string";
|
|
510
|
+
columnType: "PgText";
|
|
511
|
+
data: string;
|
|
512
|
+
driverParam: string;
|
|
513
|
+
notNull: true;
|
|
514
|
+
hasDefault: false;
|
|
515
|
+
isPrimaryKey: false;
|
|
516
|
+
isAutoincrement: false;
|
|
517
|
+
hasRuntimeDefault: false;
|
|
518
|
+
enumValues: [string, ...string[]];
|
|
519
|
+
baseColumn: never;
|
|
520
|
+
identity: undefined;
|
|
521
|
+
generated: undefined;
|
|
522
|
+
}, {}, {}>;
|
|
523
|
+
policy: import("drizzle-orm/pg-core").PgColumn<{
|
|
524
|
+
name: "policy";
|
|
525
|
+
tableName: "loom_policy_revisions";
|
|
526
|
+
dataType: "json";
|
|
527
|
+
columnType: "PgJsonb";
|
|
528
|
+
data: unknown;
|
|
529
|
+
driverParam: unknown;
|
|
530
|
+
notNull: true;
|
|
531
|
+
hasDefault: false;
|
|
532
|
+
isPrimaryKey: false;
|
|
533
|
+
isAutoincrement: false;
|
|
534
|
+
hasRuntimeDefault: false;
|
|
535
|
+
enumValues: undefined;
|
|
536
|
+
baseColumn: never;
|
|
537
|
+
identity: undefined;
|
|
538
|
+
generated: undefined;
|
|
539
|
+
}, {}, {}>;
|
|
540
|
+
actor: import("drizzle-orm/pg-core").PgColumn<{
|
|
541
|
+
name: "actor";
|
|
542
|
+
tableName: "loom_policy_revisions";
|
|
543
|
+
dataType: "string";
|
|
544
|
+
columnType: "PgText";
|
|
545
|
+
data: string;
|
|
546
|
+
driverParam: string;
|
|
547
|
+
notNull: true;
|
|
548
|
+
hasDefault: false;
|
|
549
|
+
isPrimaryKey: false;
|
|
550
|
+
isAutoincrement: false;
|
|
551
|
+
hasRuntimeDefault: false;
|
|
552
|
+
enumValues: [string, ...string[]];
|
|
553
|
+
baseColumn: never;
|
|
554
|
+
identity: undefined;
|
|
555
|
+
generated: undefined;
|
|
556
|
+
}, {}, {}>;
|
|
557
|
+
recordedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
558
|
+
name: "recorded_at";
|
|
559
|
+
tableName: "loom_policy_revisions";
|
|
560
|
+
dataType: "string";
|
|
561
|
+
columnType: "PgText";
|
|
562
|
+
data: string;
|
|
563
|
+
driverParam: string;
|
|
564
|
+
notNull: true;
|
|
565
|
+
hasDefault: false;
|
|
566
|
+
isPrimaryKey: false;
|
|
567
|
+
isAutoincrement: false;
|
|
568
|
+
hasRuntimeDefault: false;
|
|
569
|
+
enumValues: [string, ...string[]];
|
|
570
|
+
baseColumn: never;
|
|
571
|
+
identity: undefined;
|
|
572
|
+
generated: undefined;
|
|
573
|
+
}, {}, {}>;
|
|
574
|
+
note: import("drizzle-orm/pg-core").PgColumn<{
|
|
575
|
+
name: "note";
|
|
576
|
+
tableName: "loom_policy_revisions";
|
|
577
|
+
dataType: "string";
|
|
578
|
+
columnType: "PgText";
|
|
579
|
+
data: string;
|
|
580
|
+
driverParam: string;
|
|
581
|
+
notNull: false;
|
|
582
|
+
hasDefault: false;
|
|
583
|
+
isPrimaryKey: false;
|
|
584
|
+
isAutoincrement: false;
|
|
585
|
+
hasRuntimeDefault: false;
|
|
586
|
+
enumValues: [string, ...string[]];
|
|
587
|
+
baseColumn: never;
|
|
588
|
+
identity: undefined;
|
|
589
|
+
generated: undefined;
|
|
590
|
+
}, {}, {}>;
|
|
591
|
+
};
|
|
592
|
+
dialect: "pg";
|
|
593
|
+
}>;
|
|
594
|
+
/**
|
|
595
|
+
* The applications a deployment governs.
|
|
596
|
+
*
|
|
597
|
+
* The unit everything else is stored under: five tables carry `application_id`
|
|
598
|
+
* and none of them could say what that id named until this existed — the column
|
|
599
|
+
* was a foreign key to nothing.
|
|
600
|
+
*
|
|
601
|
+
* It carried the name *project* until 12 October, when the maintainer settled
|
|
602
|
+
* the hierarchy as **account > project > application** and the thing with the
|
|
603
|
+
* pages turned out to be the third of those rather than the second.
|
|
604
|
+
*
|
|
605
|
+
* `created_at` is text rather than `timestamptz` to match `applicationSchema`,
|
|
606
|
+
* which takes an ISO string — the same choice `loom_revisions.applied_at`
|
|
607
|
+
* makes, and for the same reason: what the row holds is what the type holds,
|
|
608
|
+
* so nothing has to agree about how a driver renders a timestamp.
|
|
609
|
+
*/
|
|
610
|
+
export declare const loomApplications: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
611
|
+
name: "loom_applications";
|
|
612
|
+
schema: undefined;
|
|
613
|
+
columns: {
|
|
614
|
+
applicationId: import("drizzle-orm/pg-core").PgColumn<{
|
|
615
|
+
name: "application_id";
|
|
616
|
+
tableName: "loom_applications";
|
|
617
|
+
dataType: "string";
|
|
618
|
+
columnType: "PgText";
|
|
619
|
+
data: string;
|
|
620
|
+
driverParam: string;
|
|
621
|
+
notNull: true;
|
|
622
|
+
hasDefault: false;
|
|
623
|
+
isPrimaryKey: true;
|
|
624
|
+
isAutoincrement: false;
|
|
625
|
+
hasRuntimeDefault: false;
|
|
626
|
+
enumValues: [string, ...string[]];
|
|
627
|
+
baseColumn: never;
|
|
628
|
+
identity: undefined;
|
|
629
|
+
generated: undefined;
|
|
630
|
+
}, {}, {}>;
|
|
631
|
+
projectId: import("drizzle-orm/pg-core").PgColumn<{
|
|
632
|
+
name: "project_id";
|
|
633
|
+
tableName: "loom_applications";
|
|
634
|
+
dataType: "string";
|
|
635
|
+
columnType: "PgText";
|
|
636
|
+
data: string;
|
|
637
|
+
driverParam: string;
|
|
638
|
+
notNull: true;
|
|
639
|
+
hasDefault: true;
|
|
640
|
+
isPrimaryKey: false;
|
|
641
|
+
isAutoincrement: false;
|
|
642
|
+
hasRuntimeDefault: false;
|
|
643
|
+
enumValues: [string, ...string[]];
|
|
644
|
+
baseColumn: never;
|
|
645
|
+
identity: undefined;
|
|
646
|
+
generated: undefined;
|
|
647
|
+
}, {}, {}>;
|
|
648
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
649
|
+
name: "name";
|
|
650
|
+
tableName: "loom_applications";
|
|
651
|
+
dataType: "string";
|
|
652
|
+
columnType: "PgText";
|
|
653
|
+
data: string;
|
|
654
|
+
driverParam: string;
|
|
655
|
+
notNull: true;
|
|
656
|
+
hasDefault: false;
|
|
657
|
+
isPrimaryKey: false;
|
|
658
|
+
isAutoincrement: false;
|
|
659
|
+
hasRuntimeDefault: false;
|
|
660
|
+
enumValues: [string, ...string[]];
|
|
661
|
+
baseColumn: never;
|
|
662
|
+
identity: undefined;
|
|
663
|
+
generated: undefined;
|
|
664
|
+
}, {}, {}>;
|
|
665
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
666
|
+
name: "created_at";
|
|
667
|
+
tableName: "loom_applications";
|
|
668
|
+
dataType: "string";
|
|
669
|
+
columnType: "PgText";
|
|
670
|
+
data: string;
|
|
671
|
+
driverParam: string;
|
|
672
|
+
notNull: true;
|
|
673
|
+
hasDefault: false;
|
|
674
|
+
isPrimaryKey: false;
|
|
675
|
+
isAutoincrement: false;
|
|
676
|
+
hasRuntimeDefault: false;
|
|
677
|
+
enumValues: [string, ...string[]];
|
|
678
|
+
baseColumn: never;
|
|
679
|
+
identity: undefined;
|
|
680
|
+
generated: undefined;
|
|
681
|
+
}, {}, {}>;
|
|
682
|
+
host: import("drizzle-orm/pg-core").PgColumn<{
|
|
683
|
+
name: "host";
|
|
684
|
+
tableName: "loom_applications";
|
|
685
|
+
dataType: "string";
|
|
686
|
+
columnType: "PgText";
|
|
687
|
+
data: string;
|
|
688
|
+
driverParam: string;
|
|
689
|
+
notNull: false;
|
|
690
|
+
hasDefault: false;
|
|
691
|
+
isPrimaryKey: false;
|
|
692
|
+
isAutoincrement: false;
|
|
693
|
+
hasRuntimeDefault: false;
|
|
694
|
+
enumValues: [string, ...string[]];
|
|
695
|
+
baseColumn: never;
|
|
696
|
+
identity: undefined;
|
|
697
|
+
generated: undefined;
|
|
698
|
+
}, {}, {}>;
|
|
699
|
+
closedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
700
|
+
name: "closed_at";
|
|
701
|
+
tableName: "loom_applications";
|
|
702
|
+
dataType: "string";
|
|
703
|
+
columnType: "PgText";
|
|
704
|
+
data: string;
|
|
705
|
+
driverParam: string;
|
|
706
|
+
notNull: false;
|
|
707
|
+
hasDefault: false;
|
|
708
|
+
isPrimaryKey: false;
|
|
709
|
+
isAutoincrement: false;
|
|
710
|
+
hasRuntimeDefault: false;
|
|
711
|
+
enumValues: [string, ...string[]];
|
|
712
|
+
baseColumn: never;
|
|
713
|
+
identity: undefined;
|
|
714
|
+
generated: undefined;
|
|
715
|
+
}, {}, {}>;
|
|
716
|
+
};
|
|
717
|
+
dialect: "pg";
|
|
718
|
+
}>;
|
|
719
|
+
/**
|
|
720
|
+
* The projects a deployment has, which group the applications above.
|
|
721
|
+
*
|
|
722
|
+
* Three columns, because the grouping is organisational and owns nothing yet.
|
|
723
|
+
* No row anywhere is scoped by a project: the five scoped tables name their
|
|
724
|
+
* application and the application names its project, so there is one place a
|
|
725
|
+
* thing's project is recorded and nothing to disagree with.
|
|
726
|
+
*/
|
|
727
|
+
export declare const loomProjects: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
728
|
+
name: "loom_projects";
|
|
729
|
+
schema: undefined;
|
|
730
|
+
columns: {
|
|
731
|
+
projectId: import("drizzle-orm/pg-core").PgColumn<{
|
|
732
|
+
name: "project_id";
|
|
733
|
+
tableName: "loom_projects";
|
|
734
|
+
dataType: "string";
|
|
735
|
+
columnType: "PgText";
|
|
736
|
+
data: string;
|
|
737
|
+
driverParam: string;
|
|
738
|
+
notNull: true;
|
|
739
|
+
hasDefault: false;
|
|
740
|
+
isPrimaryKey: true;
|
|
741
|
+
isAutoincrement: false;
|
|
742
|
+
hasRuntimeDefault: false;
|
|
743
|
+
enumValues: [string, ...string[]];
|
|
744
|
+
baseColumn: never;
|
|
745
|
+
identity: undefined;
|
|
746
|
+
generated: undefined;
|
|
747
|
+
}, {}, {}>;
|
|
748
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
749
|
+
name: "name";
|
|
750
|
+
tableName: "loom_projects";
|
|
751
|
+
dataType: "string";
|
|
752
|
+
columnType: "PgText";
|
|
753
|
+
data: string;
|
|
754
|
+
driverParam: string;
|
|
755
|
+
notNull: true;
|
|
756
|
+
hasDefault: false;
|
|
757
|
+
isPrimaryKey: false;
|
|
758
|
+
isAutoincrement: false;
|
|
759
|
+
hasRuntimeDefault: false;
|
|
760
|
+
enumValues: [string, ...string[]];
|
|
761
|
+
baseColumn: never;
|
|
762
|
+
identity: undefined;
|
|
763
|
+
generated: undefined;
|
|
764
|
+
}, {}, {}>;
|
|
765
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
766
|
+
name: "created_at";
|
|
767
|
+
tableName: "loom_projects";
|
|
768
|
+
dataType: "string";
|
|
769
|
+
columnType: "PgText";
|
|
770
|
+
data: string;
|
|
771
|
+
driverParam: string;
|
|
772
|
+
notNull: true;
|
|
773
|
+
hasDefault: false;
|
|
774
|
+
isPrimaryKey: false;
|
|
775
|
+
isAutoincrement: false;
|
|
776
|
+
hasRuntimeDefault: false;
|
|
777
|
+
enumValues: [string, ...string[]];
|
|
778
|
+
baseColumn: never;
|
|
779
|
+
identity: undefined;
|
|
780
|
+
generated: undefined;
|
|
781
|
+
}, {}, {}>;
|
|
782
|
+
repository: import("drizzle-orm/pg-core").PgColumn<{
|
|
783
|
+
name: "repository";
|
|
784
|
+
tableName: "loom_projects";
|
|
785
|
+
dataType: "string";
|
|
786
|
+
columnType: "PgText";
|
|
787
|
+
data: string;
|
|
788
|
+
driverParam: string;
|
|
789
|
+
notNull: false;
|
|
790
|
+
hasDefault: false;
|
|
791
|
+
isPrimaryKey: false;
|
|
792
|
+
isAutoincrement: false;
|
|
793
|
+
hasRuntimeDefault: false;
|
|
794
|
+
enumValues: [string, ...string[]];
|
|
795
|
+
baseColumn: never;
|
|
796
|
+
identity: undefined;
|
|
797
|
+
generated: undefined;
|
|
798
|
+
}, {}, {}>;
|
|
799
|
+
closedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
800
|
+
name: "closed_at";
|
|
801
|
+
tableName: "loom_projects";
|
|
802
|
+
dataType: "string";
|
|
803
|
+
columnType: "PgText";
|
|
804
|
+
data: string;
|
|
805
|
+
driverParam: string;
|
|
806
|
+
notNull: false;
|
|
807
|
+
hasDefault: false;
|
|
808
|
+
isPrimaryKey: false;
|
|
809
|
+
isAutoincrement: false;
|
|
810
|
+
hasRuntimeDefault: false;
|
|
811
|
+
enumValues: [string, ...string[]];
|
|
812
|
+
baseColumn: never;
|
|
813
|
+
identity: undefined;
|
|
814
|
+
generated: undefined;
|
|
815
|
+
}, {}, {}>;
|
|
816
|
+
};
|
|
817
|
+
dialect: "pg";
|
|
818
|
+
}>;
|
|
371
819
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/store/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sql } from "drizzle-orm";
|
|
2
|
-
import { integer, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
|
|
2
|
+
import { index, integer, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-orm/pg-core";
|
|
3
3
|
/**
|
|
4
4
|
* Two tables: the log, and the snapshot it produces.
|
|
5
5
|
*
|
|
@@ -14,13 +14,24 @@ import { integer, jsonb, pgTable, primaryKey, text, timestamp } from "drizzle-or
|
|
|
14
14
|
* that shredded it would have to be migrated every time §1 changes the AST.
|
|
15
15
|
*/
|
|
16
16
|
export const loomTrees = pgTable("loom_trees", {
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The project the tree belongs to (0260). First in the key rather than
|
|
19
|
+
* beside it: every read this store performs is already inside one project,
|
|
20
|
+
* so a composite key led by the project is the index those reads want, and
|
|
21
|
+
* a tree id only has to be unique within its own project.
|
|
22
|
+
*
|
|
23
|
+
* Defaulted so a database written before projects existed keeps answering.
|
|
24
|
+
* `DEFAULT_APPLICATION_ID` is the value, spelled out here because DDL cannot
|
|
25
|
+
* import it — `project.test.ts` holds the two together.
|
|
26
|
+
*/
|
|
27
|
+
applicationId: text("application_id").notNull().default("app_default"),
|
|
28
|
+
treeId: text("tree_id").notNull(),
|
|
18
29
|
revision: integer("revision").notNull(),
|
|
19
30
|
document: jsonb("document").notNull(),
|
|
20
31
|
updatedAt: timestamp("updated_at", { withTimezone: true })
|
|
21
32
|
.notNull()
|
|
22
33
|
.default(sql `now()`),
|
|
23
|
-
});
|
|
34
|
+
}, (table) => [primaryKey({ columns: [table.applicationId, table.treeId] })]);
|
|
24
35
|
/**
|
|
25
36
|
* The log. The composite primary key is load-bearing rather than incidental: it
|
|
26
37
|
* makes the *database* enforce the revision sequence, so two writers racing at
|
|
@@ -32,6 +43,8 @@ export const loomTrees = pgTable("loom_trees", {
|
|
|
32
43
|
* by §1 and §2. Columns would duplicate those definitions and drift from them.
|
|
33
44
|
*/
|
|
34
45
|
export const loomRevisions = pgTable("loom_revisions", {
|
|
46
|
+
/** See `loomTrees.applicationId`. */
|
|
47
|
+
applicationId: text("application_id").notNull().default("app_default"),
|
|
35
48
|
treeId: text("tree_id").notNull(),
|
|
36
49
|
revision: integer("revision").notNull(),
|
|
37
50
|
proposalId: text("proposal_id").notNull(),
|
|
@@ -45,7 +58,7 @@ export const loomRevisions = pgTable("loom_revisions", {
|
|
|
45
58
|
* nobody observed stays unrecorded rather than being invented.
|
|
46
59
|
*/
|
|
47
60
|
answeredBy: text("answered_by"),
|
|
48
|
-
}, (table) => [primaryKey({ columns: [table.treeId, table.revision] })]);
|
|
61
|
+
}, (table) => [primaryKey({ columns: [table.applicationId, table.treeId, table.revision] })]);
|
|
49
62
|
/**
|
|
50
63
|
* The custody of what the Gate held back.
|
|
51
64
|
*
|
|
@@ -67,12 +80,135 @@ export const loomRevisions = pgTable("loom_revisions", {
|
|
|
67
80
|
* than by two that happen to agree.
|
|
68
81
|
*/
|
|
69
82
|
export const loomHolds = pgTable("loom_holds", {
|
|
70
|
-
|
|
83
|
+
/**
|
|
84
|
+
* The project the hold belongs to (0260). First in the key, as it is on
|
|
85
|
+
* the two tables above, because every read of this table is already inside
|
|
86
|
+
* one project.
|
|
87
|
+
*
|
|
88
|
+
* Widening the key does not weaken what it was doing. The note on `hold`
|
|
89
|
+
* in `postgres-holds.ts` is that the key is what makes *already held* a
|
|
90
|
+
* fact the database establishes rather than a check the code races
|
|
91
|
+
* against; within a project that is unchanged, and across projects two
|
|
92
|
+
* proposals that happen to share an id were never the same proposal.
|
|
93
|
+
*/
|
|
94
|
+
applicationId: text("application_id").notNull().default("app_default"),
|
|
95
|
+
proposalId: text("proposal_id").notNull(),
|
|
71
96
|
treeId: text("tree_id").notNull(),
|
|
72
97
|
baseRevision: integer("base_revision").notNull(),
|
|
73
98
|
intent: jsonb("intent").notNull(),
|
|
74
99
|
proposal: jsonb("proposal").notNull(),
|
|
75
100
|
disposition: jsonb("disposition").notNull(),
|
|
76
101
|
heldAt: text("held_at").notNull(),
|
|
102
|
+
}, (table) => [primaryKey({ columns: [table.applicationId, table.proposalId] })]);
|
|
103
|
+
/**
|
|
104
|
+
* The policy's own log.
|
|
105
|
+
*
|
|
106
|
+
* A fourth table rather than a column anywhere, because a policy revision is not
|
|
107
|
+
* a tree revision: it is not keyed by a tree, it does not advance one, and the
|
|
108
|
+
* same revision of one policy judges changes to every tree a deployment holds.
|
|
109
|
+
* `policy-log.ts` says the same thing from the other side.
|
|
110
|
+
*
|
|
111
|
+
* `policy` is the whole `GatePolicy` as JSON, for the reason
|
|
112
|
+
* `loom_revisions.delta` is: it is a Zod-validated shape owned by §2, and
|
|
113
|
+
* columns would duplicate that definition and drift from it. A knob added to the
|
|
114
|
+
* policy would otherwise be a migration away from a log that quietly stops
|
|
115
|
+
* recording it.
|
|
116
|
+
*
|
|
117
|
+
* `fingerprint` is the one denormalised value in this schema, and it is a column
|
|
118
|
+
* rather than a JSON path because of the query it exists for: a `Disposition`
|
|
119
|
+
* carries a fingerprint, and finding the revision it names has to be a seek. The
|
|
120
|
+
* runtime computes it from the policy beside it on the way in and never accepts
|
|
121
|
+
* one from a caller, so the two cannot disagree.
|
|
122
|
+
*
|
|
123
|
+
* The composite primary key is load-bearing exactly as `loom_revisions`' is: it
|
|
124
|
+
* makes the database enforce the revision sequence, so two writers racing at the
|
|
125
|
+
* same head cannot both commit even if both read the head before either wrote.
|
|
126
|
+
*
|
|
127
|
+
* `recorded_at` is text rather than a timestamp to match
|
|
128
|
+
* `loom_revisions.applied_at` and `loom_holds.held_at` — an ISO-8601 UTC instant
|
|
129
|
+
* orders lexicographically exactly as it orders in time, and what the runtime
|
|
130
|
+
* holds above this boundary is a string.
|
|
131
|
+
*/
|
|
132
|
+
export const loomPolicyRevisions = pgTable("loom_policy_revisions", {
|
|
133
|
+
/** The project whose policy this is (0260). See `loomTrees.applicationId`. */
|
|
134
|
+
applicationId: text("application_id").notNull().default("app_default"),
|
|
135
|
+
policyId: text("policy_id").notNull(),
|
|
136
|
+
revision: integer("revision").notNull(),
|
|
137
|
+
fingerprint: text("fingerprint").notNull(),
|
|
138
|
+
policy: jsonb("policy").notNull(),
|
|
139
|
+
/**
|
|
140
|
+
* Who made this the policy (0200). Never null: a revision nobody can be named
|
|
141
|
+
* for is not a record of a decision.
|
|
142
|
+
*/
|
|
143
|
+
actor: text("actor").notNull(),
|
|
144
|
+
recordedAt: text("recorded_at").notNull(),
|
|
145
|
+
note: text("note"),
|
|
146
|
+
}, (table) => [
|
|
147
|
+
primaryKey({ columns: [table.applicationId, table.policyId, table.revision] }),
|
|
148
|
+
/**
|
|
149
|
+
* The join `judgedUnder` is. Without it, resolving the fingerprint on a
|
|
150
|
+
* disposition is a scan of every policy revision the deployment has ever
|
|
151
|
+
* recorded — which is small today and is on the path of a screen that reads
|
|
152
|
+
* it once per record on the page.
|
|
153
|
+
*/
|
|
154
|
+
index("loom_policy_revisions_fingerprint_idx").on(table.applicationId, table.policyId, table.fingerprint),
|
|
155
|
+
]);
|
|
156
|
+
/**
|
|
157
|
+
* The applications a deployment governs.
|
|
158
|
+
*
|
|
159
|
+
* The unit everything else is stored under: five tables carry `application_id`
|
|
160
|
+
* and none of them could say what that id named until this existed — the column
|
|
161
|
+
* was a foreign key to nothing.
|
|
162
|
+
*
|
|
163
|
+
* It carried the name *project* until 12 October, when the maintainer settled
|
|
164
|
+
* the hierarchy as **account > project > application** and the thing with the
|
|
165
|
+
* pages turned out to be the third of those rather than the second.
|
|
166
|
+
*
|
|
167
|
+
* `created_at` is text rather than `timestamptz` to match `applicationSchema`,
|
|
168
|
+
* which takes an ISO string — the same choice `loom_revisions.applied_at`
|
|
169
|
+
* makes, and for the same reason: what the row holds is what the type holds,
|
|
170
|
+
* so nothing has to agree about how a driver renders a timestamp.
|
|
171
|
+
*/
|
|
172
|
+
export const loomApplications = pgTable("loom_applications", {
|
|
173
|
+
applicationId: text("application_id").primaryKey(),
|
|
174
|
+
/**
|
|
175
|
+
* The project it is grouped under. Not null and not defaulted in the type,
|
|
176
|
+
* but defaulted in the DDL so a database written before projects existed
|
|
177
|
+
* keeps answering — the same device every scoped column here uses.
|
|
178
|
+
*/
|
|
179
|
+
projectId: text("project_id").notNull().default("prj_default"),
|
|
180
|
+
name: text("name").notNull(),
|
|
181
|
+
createdAt: text("created_at").notNull(),
|
|
182
|
+
/** Absent until the application says where it lives. */
|
|
183
|
+
host: text("host"),
|
|
184
|
+
/** When it was closed, absent while it is open (0289). See `loomProjects.closedAt`. */
|
|
185
|
+
closedAt: text("closed_at"),
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* The projects a deployment has, which group the applications above.
|
|
189
|
+
*
|
|
190
|
+
* Three columns, because the grouping is organisational and owns nothing yet.
|
|
191
|
+
* No row anywhere is scoped by a project: the five scoped tables name their
|
|
192
|
+
* application and the application names its project, so there is one place a
|
|
193
|
+
* thing's project is recorded and nothing to disagree with.
|
|
194
|
+
*/
|
|
195
|
+
export const loomProjects = pgTable("loom_projects", {
|
|
196
|
+
projectId: text("project_id").primaryKey(),
|
|
197
|
+
name: text("name").notNull(),
|
|
198
|
+
createdAt: text("created_at").notNull(),
|
|
199
|
+
/**
|
|
200
|
+
* The repository this project's pages live in, absent while it has none
|
|
201
|
+
* (0292). Unique where present, because a repository belongs to at most one
|
|
202
|
+
* project and two claiming it is a race rather than a typo.
|
|
203
|
+
*/
|
|
204
|
+
repository: text("repository"),
|
|
205
|
+
/**
|
|
206
|
+
* When it was closed, absent while it is open (0289).
|
|
207
|
+
*
|
|
208
|
+
* This store has no delete and this is what it has instead. Nullable and
|
|
209
|
+
* undefaulted, which is the honest value for every row written before closing
|
|
210
|
+
* existed: they were open, and they still are.
|
|
211
|
+
*/
|
|
212
|
+
closedAt: text("closed_at"),
|
|
77
213
|
});
|
|
78
214
|
//# sourceMappingURL=schema.js.map
|