@empressaio/atom-contract 1.22.0 → 1.24.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/absence/absence-verdict.d.ts +32 -0
  3. package/dist/absence/absence-verdict.d.ts.map +1 -0
  4. package/dist/absence/absence-verdict.js +55 -0
  5. package/dist/absence/absence-verdict.js.map +1 -0
  6. package/dist/absence/index.d.ts +3 -0
  7. package/dist/absence/index.d.ts.map +1 -0
  8. package/dist/absence/index.js +2 -0
  9. package/dist/absence/index.js.map +1 -0
  10. package/dist/access/access-pair.d.ts +29 -0
  11. package/dist/access/access-pair.d.ts.map +1 -0
  12. package/dist/access/access-pair.js +106 -0
  13. package/dist/access/access-pair.js.map +1 -0
  14. package/dist/access/index.d.ts +3 -0
  15. package/dist/access/index.d.ts.map +1 -0
  16. package/dist/access/index.js +2 -0
  17. package/dist/access/index.js.map +1 -0
  18. package/dist/conformance/index.d.ts +2 -0
  19. package/dist/conformance/index.d.ts.map +1 -1
  20. package/dist/conformance/index.js +2 -0
  21. package/dist/conformance/index.js.map +1 -1
  22. package/dist/conformance/track2-absence.d.ts +8 -0
  23. package/dist/conformance/track2-absence.d.ts.map +1 -0
  24. package/dist/conformance/track2-absence.js +19 -0
  25. package/dist/conformance/track2-absence.js.map +1 -0
  26. package/dist/conformance/track2-access.d.ts +6 -0
  27. package/dist/conformance/track2-access.d.ts.map +1 -0
  28. package/dist/conformance/track2-access.js +10 -0
  29. package/dist/conformance/track2-access.js.map +1 -0
  30. package/dist/conformance/track2-alias.d.ts +7 -0
  31. package/dist/conformance/track2-alias.d.ts.map +1 -0
  32. package/dist/conformance/track2-alias.js +21 -0
  33. package/dist/conformance/track2-alias.js.map +1 -0
  34. package/dist/conformance/track2-derivation.d.ts +6 -0
  35. package/dist/conformance/track2-derivation.d.ts.map +1 -0
  36. package/dist/conformance/track2-derivation.js +15 -0
  37. package/dist/conformance/track2-derivation.js.map +1 -0
  38. package/dist/conformance/track2-node-id.d.ts +7 -0
  39. package/dist/conformance/track2-node-id.d.ts.map +1 -0
  40. package/dist/conformance/track2-node-id.js +9 -0
  41. package/dist/conformance/track2-node-id.js.map +1 -0
  42. package/dist/conformance/track2-provenance.d.ts +11 -0
  43. package/dist/conformance/track2-provenance.d.ts.map +1 -0
  44. package/dist/conformance/track2-provenance.js +39 -0
  45. package/dist/conformance/track2-provenance.js.map +1 -0
  46. package/dist/conformance/track2-selector.d.ts +12 -0
  47. package/dist/conformance/track2-selector.d.ts.map +1 -0
  48. package/dist/conformance/track2-selector.js +12 -0
  49. package/dist/conformance/track2-selector.js.map +1 -0
  50. package/dist/conformance/track2-supersession.d.ts +6 -0
  51. package/dist/conformance/track2-supersession.d.ts.map +1 -0
  52. package/dist/conformance/track2-supersession.js +12 -0
  53. package/dist/conformance/track2-supersession.js.map +1 -0
  54. package/dist/derivation/derivation.d.ts +30 -0
  55. package/dist/derivation/derivation.d.ts.map +1 -0
  56. package/dist/derivation/derivation.js +61 -0
  57. package/dist/derivation/derivation.js.map +1 -0
  58. package/dist/derivation/index.d.ts +3 -0
  59. package/dist/derivation/index.d.ts.map +1 -0
  60. package/dist/derivation/index.js +2 -0
  61. package/dist/derivation/index.js.map +1 -0
  62. package/dist/identity/alias.d.ts +53 -0
  63. package/dist/identity/alias.d.ts.map +1 -0
  64. package/dist/identity/alias.js +99 -0
  65. package/dist/identity/alias.js.map +1 -0
  66. package/dist/identity/index.d.ts +8 -0
  67. package/dist/identity/index.d.ts.map +1 -0
  68. package/dist/identity/index.js +8 -0
  69. package/dist/identity/index.js.map +1 -0
  70. package/dist/identity/node-id.d.ts +56 -0
  71. package/dist/identity/node-id.d.ts.map +1 -0
  72. package/dist/identity/node-id.js +82 -0
  73. package/dist/identity/node-id.js.map +1 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +2 -0
  77. package/dist/index.js.map +1 -1
  78. package/dist/lineage/index.d.ts +3 -0
  79. package/dist/lineage/index.d.ts.map +1 -0
  80. package/dist/lineage/index.js +2 -0
  81. package/dist/lineage/index.js.map +1 -0
  82. package/dist/lineage/supersession.d.ts +34 -0
  83. package/dist/lineage/supersession.d.ts.map +1 -0
  84. package/dist/lineage/supersession.js +48 -0
  85. package/dist/lineage/supersession.js.map +1 -0
  86. package/dist/property/buildable-envelope.d.ts +20 -20
  87. package/dist/property/building-footprint.d.ts +20 -20
  88. package/dist/property/cad-parcel-roll.d.ts +20 -20
  89. package/dist/property/common.d.ts +12 -12
  90. package/dist/property/flood-hazard-fact.d.ts +24 -24
  91. package/dist/property/land-use-fact.d.ts +20 -20
  92. package/dist/property/owner-fact.d.ts +20 -20
  93. package/dist/property/parcel-node.d.ts +20 -20
  94. package/dist/property/parcel-terrain-model.d.ts +20 -20
  95. package/dist/property/rail-corridor-fact.d.ts +20 -20
  96. package/dist/property/road-node.d.ts +16 -16
  97. package/dist/property/rrc-pipeline-fact.d.ts +20 -20
  98. package/dist/property/setback-rule.d.ts +20 -20
  99. package/dist/property/special-district-fact.d.ts +20 -20
  100. package/dist/property/utility-easement.d.ts +20 -20
  101. package/dist/property/well-fact.d.ts +20 -20
  102. package/dist/property/zoning-fact.d.ts +20 -20
  103. package/dist/provenance/index.d.ts +3 -0
  104. package/dist/provenance/index.d.ts.map +1 -0
  105. package/dist/provenance/index.js +2 -0
  106. package/dist/provenance/index.js.map +1 -0
  107. package/dist/provenance/provenance-class.d.ts +52 -0
  108. package/dist/provenance/provenance-class.d.ts.map +1 -0
  109. package/dist/provenance/provenance-class.js +91 -0
  110. package/dist/provenance/provenance-class.js.map +1 -0
  111. package/dist/read-contract/reasoning-axes.d.ts +28 -28
  112. package/dist/selector/index.d.ts +3 -0
  113. package/dist/selector/index.d.ts.map +1 -0
  114. package/dist/selector/index.js +2 -0
  115. package/dist/selector/index.js.map +1 -0
  116. package/dist/selector/selector-predicate.d.ts +101 -0
  117. package/dist/selector/selector-predicate.d.ts.map +1 -0
  118. package/dist/selector/selector-predicate.js +104 -0
  119. package/dist/selector/selector-predicate.js.map +1 -0
  120. package/package.json +5 -1
@@ -89,15 +89,15 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
89
89
  assertedAt: z.ZodString;
90
90
  auditRef: z.ZodOptional<z.ZodString>;
91
91
  }, "strip", z.ZodTypeAny, {
92
+ kind: "property-risk";
92
93
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
93
94
  assertedAt: string;
94
- kind: "property-risk";
95
95
  basis: string;
96
96
  auditRef?: string | undefined;
97
97
  }, {
98
+ kind: "property-risk";
98
99
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
99
100
  assertedAt: string;
100
- kind: "property-risk";
101
101
  basis: string;
102
102
  auditRef?: string | undefined;
103
103
  }>, z.ZodObject<{
@@ -105,12 +105,12 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
105
105
  reason: z.ZodString;
106
106
  assertedAt: z.ZodString;
107
107
  }, "strip", z.ZodTypeAny, {
108
- assertedAt: string;
109
108
  kind: "not-applicable";
109
+ assertedAt: string;
110
110
  reason: string;
111
111
  }, {
112
- assertedAt: string;
113
112
  kind: "not-applicable";
113
+ assertedAt: string;
114
114
  reason: string;
115
115
  }>]>;
116
116
  }, "strip", z.ZodTypeAny, {
@@ -127,14 +127,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
127
127
  provenance: "asserted" | "backtest" | "seed" | "live";
128
128
  }>;
129
129
  consequence: {
130
+ kind: "property-risk";
130
131
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
131
132
  assertedAt: string;
132
- kind: "property-risk";
133
133
  basis: string;
134
134
  auditRef?: string | undefined;
135
135
  } | {
136
- assertedAt: string;
137
136
  kind: "not-applicable";
137
+ assertedAt: string;
138
138
  reason: string;
139
139
  };
140
140
  }, {
@@ -151,14 +151,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
151
151
  provenance: "asserted" | "backtest" | "seed" | "live";
152
152
  }>;
153
153
  consequence: {
154
+ kind: "property-risk";
154
155
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
155
156
  assertedAt: string;
156
- kind: "property-risk";
157
157
  basis: string;
158
158
  auditRef?: string | undefined;
159
159
  } | {
160
- assertedAt: string;
161
160
  kind: "not-applicable";
161
+ assertedAt: string;
162
162
  reason: string;
163
163
  };
164
164
  }>>;
@@ -225,14 +225,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
225
225
  provenance: "asserted" | "backtest" | "seed" | "live";
226
226
  }>;
227
227
  consequence: {
228
+ kind: "property-risk";
228
229
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
229
230
  assertedAt: string;
230
- kind: "property-risk";
231
231
  basis: string;
232
232
  auditRef?: string | undefined;
233
233
  } | {
234
- assertedAt: string;
235
234
  kind: "not-applicable";
235
+ assertedAt: string;
236
236
  reason: string;
237
237
  };
238
238
  }>;
@@ -265,14 +265,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
265
265
  provenance: "asserted" | "backtest" | "seed" | "live";
266
266
  }>;
267
267
  consequence: {
268
+ kind: "property-risk";
268
269
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
269
270
  assertedAt: string;
270
- kind: "property-risk";
271
271
  basis: string;
272
272
  auditRef?: string | undefined;
273
273
  } | {
274
- assertedAt: string;
275
274
  kind: "not-applicable";
275
+ assertedAt: string;
276
276
  reason: string;
277
277
  };
278
278
  }>;
@@ -381,14 +381,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
381
381
  provenance: "asserted" | "backtest" | "seed" | "live";
382
382
  }>;
383
383
  consequence: {
384
+ kind: "property-risk";
384
385
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
385
386
  assertedAt: string;
386
- kind: "property-risk";
387
387
  basis: string;
388
388
  auditRef?: string | undefined;
389
389
  } | {
390
- assertedAt: string;
391
390
  kind: "not-applicable";
391
+ assertedAt: string;
392
392
  reason: string;
393
393
  };
394
394
  }>;
@@ -460,14 +460,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
460
460
  provenance: "asserted" | "backtest" | "seed" | "live";
461
461
  }>;
462
462
  consequence: {
463
+ kind: "property-risk";
463
464
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
464
465
  assertedAt: string;
465
- kind: "property-risk";
466
466
  basis: string;
467
467
  auditRef?: string | undefined;
468
468
  } | {
469
- assertedAt: string;
470
469
  kind: "not-applicable";
470
+ assertedAt: string;
471
471
  reason: string;
472
472
  };
473
473
  }>;
@@ -539,14 +539,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
539
539
  provenance: "asserted" | "backtest" | "seed" | "live";
540
540
  }>;
541
541
  consequence: {
542
+ kind: "property-risk";
542
543
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
543
544
  assertedAt: string;
544
- kind: "property-risk";
545
545
  basis: string;
546
546
  auditRef?: string | undefined;
547
547
  } | {
548
- assertedAt: string;
549
548
  kind: "not-applicable";
549
+ assertedAt: string;
550
550
  reason: string;
551
551
  };
552
552
  }>;
@@ -618,14 +618,14 @@ export declare const WELL_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
618
618
  provenance: "asserted" | "backtest" | "seed" | "live";
619
619
  }>;
620
620
  consequence: {
621
+ kind: "property-risk";
621
622
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
622
623
  assertedAt: string;
623
- kind: "property-risk";
624
624
  basis: string;
625
625
  auditRef?: string | undefined;
626
626
  } | {
627
- assertedAt: string;
628
627
  kind: "not-applicable";
628
+ assertedAt: string;
629
629
  reason: string;
630
630
  };
631
631
  }>;
@@ -74,15 +74,15 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
74
74
  assertedAt: z.ZodString;
75
75
  auditRef: z.ZodOptional<z.ZodString>;
76
76
  }, "strip", z.ZodTypeAny, {
77
+ kind: "property-risk";
77
78
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
78
79
  assertedAt: string;
79
- kind: "property-risk";
80
80
  basis: string;
81
81
  auditRef?: string | undefined;
82
82
  }, {
83
+ kind: "property-risk";
83
84
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
84
85
  assertedAt: string;
85
- kind: "property-risk";
86
86
  basis: string;
87
87
  auditRef?: string | undefined;
88
88
  }>, z.ZodObject<{
@@ -90,12 +90,12 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
90
90
  reason: z.ZodString;
91
91
  assertedAt: z.ZodString;
92
92
  }, "strip", z.ZodTypeAny, {
93
- assertedAt: string;
94
93
  kind: "not-applicable";
94
+ assertedAt: string;
95
95
  reason: string;
96
96
  }, {
97
- assertedAt: string;
98
97
  kind: "not-applicable";
98
+ assertedAt: string;
99
99
  reason: string;
100
100
  }>]>;
101
101
  }, "strip", z.ZodTypeAny, {
@@ -112,14 +112,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
112
112
  provenance: "asserted" | "backtest" | "seed" | "live";
113
113
  }>;
114
114
  consequence: {
115
+ kind: "property-risk";
115
116
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
116
117
  assertedAt: string;
117
- kind: "property-risk";
118
118
  basis: string;
119
119
  auditRef?: string | undefined;
120
120
  } | {
121
- assertedAt: string;
122
121
  kind: "not-applicable";
122
+ assertedAt: string;
123
123
  reason: string;
124
124
  };
125
125
  }, {
@@ -136,14 +136,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
136
136
  provenance: "asserted" | "backtest" | "seed" | "live";
137
137
  }>;
138
138
  consequence: {
139
+ kind: "property-risk";
139
140
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
140
141
  assertedAt: string;
141
- kind: "property-risk";
142
142
  basis: string;
143
143
  auditRef?: string | undefined;
144
144
  } | {
145
- assertedAt: string;
146
145
  kind: "not-applicable";
146
+ assertedAt: string;
147
147
  reason: string;
148
148
  };
149
149
  }>>;
@@ -210,14 +210,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
210
210
  provenance: "asserted" | "backtest" | "seed" | "live";
211
211
  }>;
212
212
  consequence: {
213
+ kind: "property-risk";
213
214
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
214
215
  assertedAt: string;
215
- kind: "property-risk";
216
216
  basis: string;
217
217
  auditRef?: string | undefined;
218
218
  } | {
219
- assertedAt: string;
220
219
  kind: "not-applicable";
220
+ assertedAt: string;
221
221
  reason: string;
222
222
  };
223
223
  }>;
@@ -250,14 +250,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
250
250
  provenance: "asserted" | "backtest" | "seed" | "live";
251
251
  }>;
252
252
  consequence: {
253
+ kind: "property-risk";
253
254
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
254
255
  assertedAt: string;
255
- kind: "property-risk";
256
256
  basis: string;
257
257
  auditRef?: string | undefined;
258
258
  } | {
259
- assertedAt: string;
260
259
  kind: "not-applicable";
260
+ assertedAt: string;
261
261
  reason: string;
262
262
  };
263
263
  }>;
@@ -328,14 +328,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
328
328
  provenance: "asserted" | "backtest" | "seed" | "live";
329
329
  }>;
330
330
  consequence: {
331
+ kind: "property-risk";
331
332
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
332
333
  assertedAt: string;
333
- kind: "property-risk";
334
334
  basis: string;
335
335
  auditRef?: string | undefined;
336
336
  } | {
337
- assertedAt: string;
338
337
  kind: "not-applicable";
338
+ assertedAt: string;
339
339
  reason: string;
340
340
  };
341
341
  }>;
@@ -386,14 +386,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
386
386
  provenance: "asserted" | "backtest" | "seed" | "live";
387
387
  }>;
388
388
  consequence: {
389
+ kind: "property-risk";
389
390
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
390
391
  assertedAt: string;
391
- kind: "property-risk";
392
392
  basis: string;
393
393
  auditRef?: string | undefined;
394
394
  } | {
395
- assertedAt: string;
396
395
  kind: "not-applicable";
396
+ assertedAt: string;
397
397
  reason: string;
398
398
  };
399
399
  }>;
@@ -444,14 +444,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
444
444
  provenance: "asserted" | "backtest" | "seed" | "live";
445
445
  }>;
446
446
  consequence: {
447
+ kind: "property-risk";
447
448
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
448
449
  assertedAt: string;
449
- kind: "property-risk";
450
450
  basis: string;
451
451
  auditRef?: string | undefined;
452
452
  } | {
453
- assertedAt: string;
454
453
  kind: "not-applicable";
454
+ assertedAt: string;
455
455
  reason: string;
456
456
  };
457
457
  }>;
@@ -502,14 +502,14 @@ export declare const ZONING_FACT_SCHEMA: z.ZodEffects<z.ZodObject<{
502
502
  provenance: "asserted" | "backtest" | "seed" | "live";
503
503
  }>;
504
504
  consequence: {
505
+ kind: "property-risk";
505
506
  stratum: import("../read-contract/reasoning-axes.js").PropertyRiskStratum;
506
507
  assertedAt: string;
507
- kind: "property-risk";
508
508
  basis: string;
509
509
  auditRef?: string | undefined;
510
510
  } | {
511
- assertedAt: string;
512
511
  kind: "not-applicable";
512
+ assertedAt: string;
513
513
  reason: string;
514
514
  };
515
515
  }>;
@@ -0,0 +1,3 @@
1
+ export { PROVENANCE_CLASSES, ProvenanceClass, ProvenanceParseError, parseProvenance, } from "./provenance-class.js";
2
+ export type { ProvenanceAbsence, ProvenanceAssertion, ProvenanceClassName, ProvenanceDerivation, ProvenanceObservation, ProvenanceRecord, ProvenanceSynthesis, } from "./provenance-class.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provenance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { PROVENANCE_CLASSES, ProvenanceClass, ProvenanceParseError, parseProvenance, } from "./provenance-class.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/provenance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Provenance class as a discriminated union — instrument contract item 2.2.
3
+ *
4
+ * Factory shim four: Record, Derivation, Assertion, Absence.
5
+ * Model (19) adds Observation and Synthesis. Attention and Judgment are
6
+ * reserved and are not constructible here.
7
+ */
8
+ import type { AbsenceVerdict } from "../absence/absence-verdict.js";
9
+ import type { DerivesFrom } from "../derivation/derivation.js";
10
+ export declare const PROVENANCE_CLASSES: readonly ["Record", "Derivation", "Assertion", "Absence", "Observation", "Synthesis"];
11
+ export type ProvenanceClassName = (typeof PROVENANCE_CLASSES)[number];
12
+ export type ProvenanceRecord = {
13
+ readonly class: "Record";
14
+ readonly sourceId: string;
15
+ readonly fetchRef: string;
16
+ readonly derivesFrom?: never;
17
+ };
18
+ export type ProvenanceDerivation = {
19
+ readonly class: "Derivation";
20
+ readonly formula: string;
21
+ readonly inputs: readonly string[];
22
+ readonly derivesFrom: DerivesFrom;
23
+ };
24
+ export type ProvenanceAssertion = {
25
+ readonly class: "Assertion";
26
+ readonly asserter: string;
27
+ };
28
+ export type ProvenanceAbsence = {
29
+ readonly class: "Absence";
30
+ readonly verdict: AbsenceVerdict;
31
+ };
32
+ export type ProvenanceObservation = {
33
+ readonly class: "Observation";
34
+ readonly measurement: string;
35
+ };
36
+ export type ProvenanceSynthesis = {
37
+ readonly class: "Synthesis";
38
+ readonly citations: readonly string[];
39
+ };
40
+ export type ProvenanceClass = ProvenanceRecord | ProvenanceDerivation | ProvenanceAssertion | ProvenanceAbsence | ProvenanceObservation | ProvenanceSynthesis;
41
+ export declare class ProvenanceParseError extends Error {
42
+ readonly input: unknown;
43
+ readonly code: string;
44
+ constructor(message: string, input: unknown, code?: string);
45
+ }
46
+ export declare function parseProvenance(input: unknown): ProvenanceClass;
47
+ /** Runtime export so the Factory shim check observes `ProvenanceClass` on the module. */
48
+ export declare const ProvenanceClass: Readonly<{
49
+ names: readonly ["Record", "Derivation", "Assertion", "Absence", "Observation", "Synthesis"];
50
+ parse: typeof parseProvenance;
51
+ }>;
52
+ //# sourceMappingURL=provenance-class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance-class.d.ts","sourceRoot":"","sources":["../../src/provenance/provenance-class.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D,eAAO,MAAM,kBAAkB,uFAOrB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,E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AAED,yFAAyF;AACzF,eAAO,MAAM,eAAe;;;EAG1B,CAAC"}
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Provenance class as a discriminated union — instrument contract item 2.2.
3
+ *
4
+ * Factory shim four: Record, Derivation, Assertion, Absence.
5
+ * Model (19) adds Observation and Synthesis. Attention and Judgment are
6
+ * reserved and are not constructible here.
7
+ */
8
+ import { parseAbsenceVerdict } from "../absence/absence-verdict.js";
9
+ import { parseDerivesFrom } from "../derivation/derivation.js";
10
+ export const PROVENANCE_CLASSES = [
11
+ "Record",
12
+ "Derivation",
13
+ "Assertion",
14
+ "Absence",
15
+ "Observation",
16
+ "Synthesis",
17
+ ];
18
+ export class ProvenanceParseError extends Error {
19
+ input;
20
+ code;
21
+ constructor(message, input, code = "PROVENANCE_FIELD") {
22
+ super(message);
23
+ this.input = input;
24
+ this.name = "ProvenanceParseError";
25
+ this.code = code;
26
+ }
27
+ }
28
+ function asRecord(input) {
29
+ if (!input || typeof input !== "object") {
30
+ throw new ProvenanceParseError("provenance class required", input, "PROVENANCE_REQUIRED");
31
+ }
32
+ return input;
33
+ }
34
+ export function parseProvenance(input) {
35
+ const row = asRecord(input);
36
+ const cls = row.class;
37
+ if (cls === "Record") {
38
+ if (row.derivesFrom != null) {
39
+ throw new ProvenanceParseError("Record must not carry derivesFrom", input, "DERIVES_FROM_ON_RECORD");
40
+ }
41
+ if (typeof row.sourceId !== "string" || row.sourceId.length === 0) {
42
+ throw new ProvenanceParseError("Record requires sourceId", input);
43
+ }
44
+ if (typeof row.fetchRef !== "string" || row.fetchRef.length === 0) {
45
+ throw new ProvenanceParseError("Record requires fetchRef", input);
46
+ }
47
+ return { class: "Record", sourceId: row.sourceId, fetchRef: row.fetchRef };
48
+ }
49
+ if (cls === "Derivation") {
50
+ if (typeof row.formula !== "string" || row.formula.length === 0) {
51
+ throw new ProvenanceParseError("Derivation requires formula", input);
52
+ }
53
+ if (!Array.isArray(row.inputs)) {
54
+ throw new ProvenanceParseError("Derivation requires inputs", input);
55
+ }
56
+ return {
57
+ class: "Derivation",
58
+ formula: row.formula,
59
+ inputs: row.inputs.map(String),
60
+ derivesFrom: parseDerivesFrom(row.derivesFrom),
61
+ };
62
+ }
63
+ if (cls === "Assertion") {
64
+ if (typeof row.asserter !== "string" || row.asserter.length === 0) {
65
+ throw new ProvenanceParseError("Assertion requires asserter", input);
66
+ }
67
+ return { class: "Assertion", asserter: row.asserter };
68
+ }
69
+ if (cls === "Absence") {
70
+ return { class: "Absence", verdict: parseAbsenceVerdict(row) };
71
+ }
72
+ if (cls === "Observation") {
73
+ if (typeof row.measurement !== "string" || row.measurement.length === 0) {
74
+ throw new ProvenanceParseError("Observation requires measurement", input);
75
+ }
76
+ return { class: "Observation", measurement: row.measurement };
77
+ }
78
+ if (cls === "Synthesis") {
79
+ if (!Array.isArray(row.citations) || row.citations.length === 0) {
80
+ throw new ProvenanceParseError("Synthesis requires citations", input);
81
+ }
82
+ return { class: "Synthesis", citations: row.citations.map(String) };
83
+ }
84
+ throw new ProvenanceParseError(`unknown provenance class ${String(cls)}`, input, "PROVENANCE_CLASS");
85
+ }
86
+ /** Runtime export so the Factory shim check observes `ProvenanceClass` on the module. */
87
+ export const ProvenanceClass = Object.freeze({
88
+ names: PROVENANCE_CLASSES,
89
+ parse: parseProvenance,
90
+ });
91
+ //# sourceMappingURL=provenance-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provenance-class.js","sourceRoot":"","sources":["../../src/provenance/provenance-class.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,QAAQ;IACR,YAAY;IACZ,WAAW;IACX,SAAS;IACT,aAAa;IACb,WAAW;CACH,CAAC;AA8CX,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAKlC;IAJ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