@proposit/proposit-core 0.9.1 → 0.10.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 (153) hide show
  1. package/README.md +59 -26
  2. package/dist/cli/commands/arguments.d.ts.map +1 -1
  3. package/dist/cli/commands/arguments.js +8 -16
  4. package/dist/cli/commands/arguments.js.map +1 -1
  5. package/dist/cli/commands/citations.d.ts +3 -0
  6. package/dist/cli/commands/citations.d.ts.map +1 -0
  7. package/dist/cli/commands/citations.js +89 -0
  8. package/dist/cli/commands/citations.js.map +1 -0
  9. package/dist/cli/commands/claims.d.ts.map +1 -1
  10. package/dist/cli/commands/claims.js +10 -2
  11. package/dist/cli/commands/claims.js.map +1 -1
  12. package/dist/cli/commands/parse.d.ts.map +1 -1
  13. package/dist/cli/commands/parse.js +9 -17
  14. package/dist/cli/commands/parse.js.map +1 -1
  15. package/dist/cli/commands/render.d.ts.map +1 -1
  16. package/dist/cli/commands/render.js +44 -18
  17. package/dist/cli/commands/render.js.map +1 -1
  18. package/dist/cli/commands/variables.d.ts.map +1 -1
  19. package/dist/cli/commands/variables.js +1 -0
  20. package/dist/cli/commands/variables.js.map +1 -1
  21. package/dist/cli/engine.d.ts.map +1 -1
  22. package/dist/cli/engine.js +12 -9
  23. package/dist/cli/engine.js.map +1 -1
  24. package/dist/cli/import.d.ts +2 -4
  25. package/dist/cli/import.d.ts.map +1 -1
  26. package/dist/cli/import.js +8 -7
  27. package/dist/cli/import.js.map +1 -1
  28. package/dist/cli/router.js +1 -1
  29. package/dist/cli/router.js.map +1 -1
  30. package/dist/cli/storage/libraries.d.ts +4 -7
  31. package/dist/cli/storage/libraries.d.ts.map +1 -1
  32. package/dist/cli/storage/libraries.js +9 -28
  33. package/dist/cli/storage/libraries.js.map +1 -1
  34. package/dist/cli/storage/migrate-v0.10.d.ts +10 -0
  35. package/dist/cli/storage/migrate-v0.10.d.ts.map +1 -0
  36. package/dist/cli/storage/migrate-v0.10.js +213 -0
  37. package/dist/cli/storage/migrate-v0.10.js.map +1 -0
  38. package/dist/cli.js +2 -2
  39. package/dist/cli.js.map +1 -1
  40. package/dist/extensions/basics/argument-parser.d.ts +1 -2
  41. package/dist/extensions/basics/argument-parser.d.ts.map +1 -1
  42. package/dist/extensions/basics/argument-parser.js.map +1 -1
  43. package/dist/extensions/basics/schemata.d.ts +1 -0
  44. package/dist/extensions/basics/schemata.d.ts.map +1 -1
  45. package/dist/extensions/ieee/{source.d.ts → citation-claim.d.ts} +5 -3
  46. package/dist/extensions/ieee/citation-claim.d.ts.map +1 -0
  47. package/dist/extensions/ieee/{source.js → citation-claim.js} +5 -4
  48. package/dist/extensions/ieee/citation-claim.js.map +1 -0
  49. package/dist/extensions/ieee/index.d.ts +1 -1
  50. package/dist/extensions/ieee/index.d.ts.map +1 -1
  51. package/dist/extensions/ieee/index.js +1 -1
  52. package/dist/extensions/ieee/index.js.map +1 -1
  53. package/dist/lib/consts.d.ts.map +1 -1
  54. package/dist/lib/consts.js +9 -13
  55. package/dist/lib/consts.js.map +1 -1
  56. package/dist/lib/core/argument-engine.d.ts +8 -8
  57. package/dist/lib/core/argument-engine.d.ts.map +1 -1
  58. package/dist/lib/core/argument-engine.js +7 -9
  59. package/dist/lib/core/argument-engine.js.map +1 -1
  60. package/dist/lib/core/argument-library.d.ts +13 -15
  61. package/dist/lib/core/argument-library.d.ts.map +1 -1
  62. package/dist/lib/core/argument-library.js +23 -9
  63. package/dist/lib/core/argument-library.js.map +1 -1
  64. package/dist/lib/core/claim-citation-library.d.ts +44 -0
  65. package/dist/lib/core/claim-citation-library.d.ts.map +1 -0
  66. package/dist/lib/core/claim-citation-library.js +336 -0
  67. package/dist/lib/core/claim-citation-library.js.map +1 -0
  68. package/dist/lib/core/claim-library.d.ts +33 -1
  69. package/dist/lib/core/claim-library.d.ts.map +1 -1
  70. package/dist/lib/core/claim-library.js +71 -3
  71. package/dist/lib/core/claim-library.js.map +1 -1
  72. package/dist/lib/core/fork-library.d.ts +19 -10
  73. package/dist/lib/core/fork-library.d.ts.map +1 -1
  74. package/dist/lib/core/fork-library.js +16 -13
  75. package/dist/lib/core/fork-library.js.map +1 -1
  76. package/dist/lib/core/fork.d.ts +6 -7
  77. package/dist/lib/core/fork.d.ts.map +1 -1
  78. package/dist/lib/core/fork.js +8 -3
  79. package/dist/lib/core/fork.js.map +1 -1
  80. package/dist/lib/core/interfaces/index.d.ts +1 -1
  81. package/dist/lib/core/interfaces/index.d.ts.map +1 -1
  82. package/dist/lib/core/interfaces/library.interfaces.d.ts +66 -160
  83. package/dist/lib/core/interfaces/library.interfaces.d.ts.map +1 -1
  84. package/dist/lib/core/proposit-core.d.ts +30 -32
  85. package/dist/lib/core/proposit-core.d.ts.map +1 -1
  86. package/dist/lib/core/proposit-core.js +68 -89
  87. package/dist/lib/core/proposit-core.js.map +1 -1
  88. package/dist/lib/index.d.ts +2 -3
  89. package/dist/lib/index.d.ts.map +1 -1
  90. package/dist/lib/index.js +2 -3
  91. package/dist/lib/index.js.map +1 -1
  92. package/dist/lib/parsing/argument-parser.d.ts +9 -12
  93. package/dist/lib/parsing/argument-parser.d.ts.map +1 -1
  94. package/dist/lib/parsing/argument-parser.js +27 -45
  95. package/dist/lib/parsing/argument-parser.js.map +1 -1
  96. package/dist/lib/parsing/index.d.ts +2 -2
  97. package/dist/lib/parsing/index.d.ts.map +1 -1
  98. package/dist/lib/parsing/index.js +1 -1
  99. package/dist/lib/parsing/index.js.map +1 -1
  100. package/dist/lib/parsing/prompt-builder.d.ts.map +1 -1
  101. package/dist/lib/parsing/prompt-builder.js +31 -24
  102. package/dist/lib/parsing/prompt-builder.js.map +1 -1
  103. package/dist/lib/parsing/schemata.d.ts +7 -19
  104. package/dist/lib/parsing/schemata.d.ts.map +1 -1
  105. package/dist/lib/parsing/schemata.js +7 -14
  106. package/dist/lib/parsing/schemata.js.map +1 -1
  107. package/dist/lib/parsing/types.d.ts +1 -2
  108. package/dist/lib/parsing/types.d.ts.map +1 -1
  109. package/dist/lib/schemata/claim-citation.d.ts +11 -0
  110. package/dist/lib/schemata/claim-citation.d.ts.map +1 -0
  111. package/dist/lib/schemata/claim-citation.js +25 -0
  112. package/dist/lib/schemata/claim-citation.js.map +1 -0
  113. package/dist/lib/schemata/claim.d.ts +1 -0
  114. package/dist/lib/schemata/claim.d.ts.map +1 -1
  115. package/dist/lib/schemata/claim.js +3 -0
  116. package/dist/lib/schemata/claim.js.map +1 -1
  117. package/dist/lib/schemata/fork.d.ts +0 -11
  118. package/dist/lib/schemata/fork.d.ts.map +1 -1
  119. package/dist/lib/schemata/fork.js +0 -10
  120. package/dist/lib/schemata/fork.js.map +1 -1
  121. package/dist/lib/schemata/index.d.ts +1 -1
  122. package/dist/lib/schemata/index.d.ts.map +1 -1
  123. package/dist/lib/schemata/index.js +1 -1
  124. package/dist/lib/schemata/index.js.map +1 -1
  125. package/dist/lib/types/checksum.d.ts +3 -5
  126. package/dist/lib/types/checksum.d.ts.map +1 -1
  127. package/dist/lib/types/validation.d.ts +9 -7
  128. package/dist/lib/types/validation.d.ts.map +1 -1
  129. package/dist/lib/types/validation.js +10 -8
  130. package/dist/lib/types/validation.js.map +1 -1
  131. package/dist/lib/utils/lookup.d.ts +7 -15
  132. package/dist/lib/utils/lookup.d.ts.map +1 -1
  133. package/dist/lib/utils/lookup.js +8 -18
  134. package/dist/lib/utils/lookup.js.map +1 -1
  135. package/package.json +1 -1
  136. package/dist/cli/commands/sources.d.ts +0 -3
  137. package/dist/cli/commands/sources.d.ts.map +0 -1
  138. package/dist/cli/commands/sources.js +0 -103
  139. package/dist/cli/commands/sources.js.map +0 -1
  140. package/dist/extensions/ieee/source.d.ts.map +0 -1
  141. package/dist/extensions/ieee/source.js.map +0 -1
  142. package/dist/lib/core/claim-source-library.d.ts +0 -32
  143. package/dist/lib/core/claim-source-library.d.ts.map +0 -1
  144. package/dist/lib/core/claim-source-library.js +0 -193
  145. package/dist/lib/core/claim-source-library.js.map +0 -1
  146. package/dist/lib/core/source-library.d.ts +0 -23
  147. package/dist/lib/core/source-library.d.ts.map +0 -1
  148. package/dist/lib/core/source-library.js +0 -21
  149. package/dist/lib/core/source-library.js.map +0 -1
  150. package/dist/lib/schemata/source.d.ts +0 -18
  151. package/dist/lib/schemata/source.d.ts.map +0 -1
  152. package/dist/lib/schemata/source.js +0 -35
  153. package/dist/lib/schemata/source.js.map +0 -1
@@ -1,193 +0,0 @@
1
- import { Value } from "typebox/value";
2
- import { CoreClaimSourceAssociationSchema } from "../schemata/source.js";
3
- import { DEFAULT_CHECKSUM_CONFIG } from "../consts.js";
4
- import { entityChecksum } from "./checksum.js";
5
- import { ASSOC_SCHEMA_INVALID, ASSOC_CLAIM_REF_NOT_FOUND, ASSOC_SOURCE_REF_NOT_FOUND, } from "../types/validation.js";
6
- import { InvariantViolationError } from "./invariant-violation-error.js";
7
- export class ClaimSourceLibrary {
8
- associations;
9
- claimToAssociations;
10
- sourceToAssociations;
11
- claimLookup;
12
- sourceLookup;
13
- checksumConfig;
14
- constructor(claimLookup, sourceLookup, options) {
15
- this.associations = new Map();
16
- this.claimToAssociations = new Map();
17
- this.sourceToAssociations = new Map();
18
- this.claimLookup = claimLookup;
19
- this.sourceLookup = sourceLookup;
20
- this.checksumConfig = options?.checksumConfig;
21
- }
22
- restoreFromSnapshot(snap) {
23
- this.associations = new Map();
24
- this.claimToAssociations = new Map();
25
- this.sourceToAssociations = new Map();
26
- for (const assoc of snap.claimSourceAssociations) {
27
- this.associations.set(assoc.id, assoc);
28
- }
29
- for (const [id, assoc] of this.associations) {
30
- const claimKey = assoc.claimId;
31
- if (!this.claimToAssociations.has(claimKey)) {
32
- this.claimToAssociations.set(claimKey, new Set());
33
- }
34
- this.claimToAssociations.get(claimKey).add(id);
35
- const sourceKey = assoc.sourceId;
36
- if (!this.sourceToAssociations.has(sourceKey)) {
37
- this.sourceToAssociations.set(sourceKey, new Set());
38
- }
39
- this.sourceToAssociations.get(sourceKey).add(id);
40
- }
41
- }
42
- withValidation(fn) {
43
- const snap = this.snapshot();
44
- try {
45
- const result = fn();
46
- const validation = this.validate();
47
- if (!validation.ok) {
48
- this.restoreFromSnapshot(snap);
49
- throw new InvariantViolationError(validation.violations);
50
- }
51
- return result;
52
- }
53
- catch (e) {
54
- if (!(e instanceof InvariantViolationError)) {
55
- this.restoreFromSnapshot(snap);
56
- }
57
- throw e;
58
- }
59
- }
60
- add(assoc) {
61
- return this.withValidation(() => {
62
- if (this.associations.has(assoc.id)) {
63
- throw new Error(`ClaimSourceAssociation with ID "${assoc.id}" already exists.`);
64
- }
65
- const claim = this.claimLookup.get(assoc.claimId, assoc.claimVersion);
66
- if (!claim) {
67
- throw new Error(`Claim "${assoc.claimId}" version ${assoc.claimVersion} not found in claim lookup.`);
68
- }
69
- const source = this.sourceLookup.get(assoc.sourceId, assoc.sourceVersion);
70
- if (!source) {
71
- throw new Error(`Source "${assoc.sourceId}" version ${assoc.sourceVersion} not found in source lookup.`);
72
- }
73
- const full = { ...assoc, checksum: "" };
74
- full.checksum = this.computeChecksum(full);
75
- this.associations.set(full.id, full);
76
- let claimSet = this.claimToAssociations.get(full.claimId);
77
- if (!claimSet) {
78
- claimSet = new Set();
79
- this.claimToAssociations.set(full.claimId, claimSet);
80
- }
81
- claimSet.add(full.id);
82
- let sourceSet = this.sourceToAssociations.get(full.sourceId);
83
- if (!sourceSet) {
84
- sourceSet = new Set();
85
- this.sourceToAssociations.set(full.sourceId, sourceSet);
86
- }
87
- sourceSet.add(full.id);
88
- return full;
89
- });
90
- }
91
- remove(id) {
92
- return this.withValidation(() => {
93
- const assoc = this.associations.get(id);
94
- if (!assoc) {
95
- throw new Error(`ClaimSourceAssociation "${id}" not found.`);
96
- }
97
- this.associations.delete(id);
98
- const claimSet = this.claimToAssociations.get(assoc.claimId);
99
- if (claimSet) {
100
- claimSet.delete(id);
101
- }
102
- const sourceSet = this.sourceToAssociations.get(assoc.sourceId);
103
- if (sourceSet) {
104
- sourceSet.delete(id);
105
- }
106
- return assoc;
107
- });
108
- }
109
- getForClaim(claimId) {
110
- const ids = this.claimToAssociations.get(claimId);
111
- if (!ids)
112
- return [];
113
- return Array.from(ids)
114
- .map((id) => this.associations.get(id))
115
- .filter(Boolean);
116
- }
117
- getForSource(sourceId) {
118
- const ids = this.sourceToAssociations.get(sourceId);
119
- if (!ids)
120
- return [];
121
- return Array.from(ids)
122
- .map((id) => this.associations.get(id))
123
- .filter(Boolean);
124
- }
125
- get(id) {
126
- return this.associations.get(id);
127
- }
128
- getAll() {
129
- return Array.from(this.associations.values());
130
- }
131
- filter(predicate) {
132
- return this.getAll().filter(predicate);
133
- }
134
- snapshot() {
135
- return { claimSourceAssociations: this.getAll() };
136
- }
137
- /** Restores a claim-source library from a snapshot, re-indexing all associations. */
138
- static fromSnapshot(snapshot, claimLookup, sourceLookup, options) {
139
- const lib = new ClaimSourceLibrary(claimLookup, sourceLookup, options);
140
- for (const assoc of snapshot.claimSourceAssociations) {
141
- lib.associations.set(assoc.id, assoc);
142
- let claimSet = lib.claimToAssociations.get(assoc.claimId);
143
- if (!claimSet) {
144
- claimSet = new Set();
145
- lib.claimToAssociations.set(assoc.claimId, claimSet);
146
- }
147
- claimSet.add(assoc.id);
148
- let sourceSet = lib.sourceToAssociations.get(assoc.sourceId);
149
- if (!sourceSet) {
150
- sourceSet = new Set();
151
- lib.sourceToAssociations.set(assoc.sourceId, sourceSet);
152
- }
153
- sourceSet.add(assoc.id);
154
- }
155
- return lib;
156
- }
157
- validate() {
158
- const violations = [];
159
- for (const [id, assoc] of this.associations) {
160
- if (!Value.Check(CoreClaimSourceAssociationSchema, assoc)) {
161
- violations.push({
162
- code: ASSOC_SCHEMA_INVALID,
163
- message: `Association "${id}" does not conform to schema`,
164
- entityType: "association",
165
- entityId: id,
166
- });
167
- }
168
- if (!this.claimLookup.get(assoc.claimId, assoc.claimVersion)) {
169
- violations.push({
170
- code: ASSOC_CLAIM_REF_NOT_FOUND,
171
- message: `Association "${id}" references non-existent claim "${assoc.claimId}" version ${assoc.claimVersion}`,
172
- entityType: "association",
173
- entityId: id,
174
- });
175
- }
176
- if (!this.sourceLookup.get(assoc.sourceId, assoc.sourceVersion)) {
177
- violations.push({
178
- code: ASSOC_SOURCE_REF_NOT_FOUND,
179
- message: `Association "${id}" references non-existent source "${assoc.sourceId}" version ${assoc.sourceVersion}`,
180
- entityType: "association",
181
- entityId: id,
182
- });
183
- }
184
- }
185
- return { ok: violations.length === 0, violations };
186
- }
187
- computeChecksum(assoc) {
188
- const fields = this.checksumConfig?.claimSourceAssociationFields ??
189
- DEFAULT_CHECKSUM_CONFIG.claimSourceAssociationFields;
190
- return entityChecksum(assoc, fields);
191
- }
192
- }
193
- //# sourceMappingURL=claim-source-library.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"claim-source-library.js","sourceRoot":"","sources":["../../../src/lib/core/claim-source-library.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAA;AAExE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAW9C,OAAO,EACH,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,GAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AAExE,MAAM,OAAO,kBAAkB;IAGnB,YAAY,CAAqB;IACjC,mBAAmB,CAA0B;IAC7C,oBAAoB,CAA0B;IAC9C,WAAW,CAAc;IACzB,YAAY,CAAe;IAC3B,cAAc,CAAsB;IAE5C,YACI,WAAyB,EACzB,YAA2B,EAC3B,OAAkD;QAElD,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAA;QAC7B,IAAI,CAAC,mBAAmB,GAAG,IAAI,GAAG,EAAE,CAAA;QACpC,IAAI,CAAC,oBAAoB,GAAG,IAAI,GAAG,EA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AC;gBAC9D,UAAU,CAAC,IAAI,CAAC;oBACZ,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,gBAAgB,EAAE,qCAAqC,KAAK,CAAC,QAAQ,aAAa,KAAK,CAAC,aAAa,EAAE;oBAChH,UAAU,EAAE,aAAa;oBACzB,QAAQ,EAAE,EAAE;iBACf,CAAC,CAAA;YACN,CAAC;QACL,CAAC;QACD,OAAO,EAAE,EAAE,EAAE,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,UAAU,EAAE,CAAA;IACtD,CAAC;IAEO,eAAe,CAAC,KAAa;QACjC,MAAM,MAAM,GACR,IAAI,CAAC,cAAc,EAAE,4BAA4B;YACjD,uBAAuB,CAAC,4BAA6B,CAAA;QACzD,OAAO,cAAc,CACjB,KAA2C,EAC3C,MAAM,CACT,CAAA;IACL,CAAC;CACJ"}
@@ -1,23 +0,0 @@
1
- import type { TCoreSource } from "../schemata/source.js";
2
- import type { TCoreChecksumConfig } from "../types/checksum.js";
3
- import type { TSourceLibraryManagement, TSourceLibrarySnapshot } from "./interfaces/library.interfaces.js";
4
- import { VersionedLibrary } from "./versioned-library.js";
5
- export declare class SourceLibrary<TSource extends TCoreSource = TCoreSource> extends VersionedLibrary<TSource> implements TSourceLibraryManagement<TSource> {
6
- protected readonly entityLabel = "Source";
7
- protected readonly entityType: "source";
8
- protected readonly schema: import("typebox").TObject<{
9
- id: import("typebox").TString;
10
- version: import("typebox").TNumber;
11
- frozen: import("typebox").TBoolean;
12
- checksum: import("typebox").TString;
13
- }>;
14
- protected readonly checksumFieldsKey: "sourceFields";
15
- protected readonly schemaInvalidCode = "SOURCE_SCHEMA_INVALID";
16
- protected readonly frozenSuccessorCode = "SOURCE_FROZEN_NO_SUCCESSOR";
17
- snapshot(): TSourceLibrarySnapshot<TSource>;
18
- /** Restores a source library from a previously captured snapshot. */
19
- static fromSnapshot<TSource extends TCoreSource = TCoreSource>(snapshot: TSourceLibrarySnapshot<TSource>, options?: {
20
- checksumConfig?: TCoreChecksumConfig;
21
- }): SourceLibrary<TSource>;
22
- }
23
- //# sourceMappingURL=source-library.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-library.d.ts","sourceRoot":"","sources":["../../../src/lib/core/source-library.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,KAAK,EACR,wBAAwB,EACxB,sBAAsB,EACzB,MAAM,oCAAoC,CAAA;AAK3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,qBAAa,aAAa,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,CAChE,SAAQ,gBAAgB,CAAC,OAAO,CAChC,YAAW,wBAAwB,CAAC,OAAO,CAAC;IAE5C,SAAS,CAAC,QAAQ,CAAC,WAAW,YAAW;IACzC,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAG,QAAQ,CAAS;IACjD,SAAS,CAAC,QAAQ,CAAC,MAAM;;;;;OAAmB;IAC5C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAG,cAAc,CAAS;IAC9D,SAAS,CAAC,QAAQ,CAAC,iBAAiB,2BAAwB;IAC5D,SAAS,CAAC,QAAQ,CAAC,mBAAmB,gCAA6B;IAE5D,QAAQ,IAAI,sBAAsB,CAAC,OAAO,CAAC;IAIlD,qEAAqE;WACvD,YAAY,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,EAChE,QAAQ,EAAE,sBAAsB,CAAC,OAAO,CAAC,EACzC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,mBAAmB,CAAA;KAAE,GACnD,aAAa,CAAC,OAAO,CAAC;CAK5B"}
@@ -1,21 +0,0 @@
1
- import { CoreSourceSchema } from "../schemata/source.js";
2
- import { SOURCE_SCHEMA_INVALID, SOURCE_FROZEN_NO_SUCCESSOR, } from "../types/validation.js";
3
- import { VersionedLibrary } from "./versioned-library.js";
4
- export class SourceLibrary extends VersionedLibrary {
5
- entityLabel = "Source";
6
- entityType = "source";
7
- schema = CoreSourceSchema;
8
- checksumFieldsKey = "sourceFields";
9
- schemaInvalidCode = SOURCE_SCHEMA_INVALID;
10
- frozenSuccessorCode = SOURCE_FROZEN_NO_SUCCESSOR;
11
- snapshot() {
12
- return { sources: this.getAll() };
13
- }
14
- /** Restores a source library from a previously captured snapshot. */
15
- static fromSnapshot(snapshot, options) {
16
- const lib = new SourceLibrary(options);
17
- lib.restoreFromEntities(snapshot.sources);
18
- return lib;
19
- }
20
- }
21
- //# sourceMappingURL=source-library.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-library.js","sourceRoot":"","sources":["../../../src/lib/core/source-library.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAMxD,OAAO,EACH,qBAAqB,EACrB,0BAA0B,GAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,MAAM,OAAO,aACT,SAAQ,gBAAyB;IAGd,WAAW,GAAG,QAAQ,CAAA;IACtB,UAAU,GAAG,QAAiB,CAAA;IAC9B,MAAM,GAAG,gBAAgB,CAAA;IACzB,iBAAiB,GAAG,cAAuB,CAAA;IAC3C,iBAAiB,GAAG,qBAAqB,CAAA;IACzC,mBAAmB,GAAG,0BAA0B,CAAA;IAE5D,QAAQ;QACX,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAA;IACrC,CAAC;IAED,qEAAqE;IAC9D,MAAM,CAAC,YAAY,CACtB,QAAyC,EACzC,OAAkD;QAElD,MAAM,GAAG,GAAG,IAAI,aAAa,CAAU,OAAO,CAAC,CAAA;QAC/C,GAAG,CAAC,mBAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACzC,OAAO,GAAG,CAAA;IACd,CAAC;CACJ"}
@@ -1,18 +0,0 @@
1
- import Type, { type Static } from "typebox";
2
- export declare const CoreSourceSchema: Type.TObject<{
3
- id: Type.TString;
4
- version: Type.TNumber;
5
- frozen: Type.TBoolean;
6
- checksum: Type.TString;
7
- }>;
8
- export type TCoreSource = Static<typeof CoreSourceSchema>;
9
- export declare const CoreClaimSourceAssociationSchema: Type.TObject<{
10
- id: Type.TString;
11
- claimId: Type.TString;
12
- claimVersion: Type.TNumber;
13
- sourceId: Type.TString;
14
- sourceVersion: Type.TNumber;
15
- checksum: Type.TString;
16
- }>;
17
- export type TCoreClaimSourceAssociation = Static<typeof CoreClaimSourceAssociationSchema>;
18
- //# sourceMappingURL=source.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/lib/schemata/source.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAA;AAG3C,eAAO,MAAM,gBAAgB;;;;;EAmB5B,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,gCAAgC;;;;;;;EAoB5C,CAAA;AACD,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAC5C,OAAO,gCAAgC,CAC1C,CAAA"}
@@ -1,35 +0,0 @@
1
- import Type, {} from "typebox";
2
- import { UUID } from "./shared.js";
3
- export const CoreSourceSchema = Type.Object({
4
- id: UUID,
5
- version: Type.Number({
6
- description: "Source version number. Starts at 0.",
7
- }),
8
- frozen: Type.Boolean({
9
- description: "Whether this version is frozen (immutable). Frozen versions cannot be updated.",
10
- }),
11
- checksum: Type.String({
12
- description: "Source-level checksum for sync detection.",
13
- }),
14
- }, {
15
- additionalProperties: true,
16
- description: "A global source entity providing evidentiary support for variables or expressions.",
17
- });
18
- export const CoreClaimSourceAssociationSchema = Type.Object({
19
- id: UUID,
20
- claimId: UUID,
21
- claimVersion: Type.Number({
22
- description: "The version of the claim this association pins to.",
23
- }),
24
- sourceId: UUID,
25
- sourceVersion: Type.Number({
26
- description: "The version of the source this association pins to.",
27
- }),
28
- checksum: Type.String({
29
- description: "Association checksum for sync detection.",
30
- }),
31
- }, {
32
- additionalProperties: true,
33
- description: "An association between a claim and a source. Extended via generics for additional fields (e.g., createdBy).",
34
- });
35
- //# sourceMappingURL=source.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"source.js","sourceRoot":"","sources":["../../../src/lib/schemata/source.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAe,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CACvC;IACI,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE,qCAAqC;KACrD,CAAC;IACF,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;QACjB,WAAW,EACP,gFAAgF;KACvF,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,2CAA2C;KAC3D,CAAC;CACL,EACD;IACI,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACP,oFAAoF;CAC3F,CACJ,CAAA;AAGD,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,CAAC,MAAM,CACvD;IACI,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC;QACtB,WAAW,EAAE,oDAAoD;KACpE,CAAC;IACF,QAAQ,EAAE,IAAI;IACd,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE,qDAAqD;KACrE,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QAClB,WAAW,EAAE,0CAA0C;KAC1D,CAAC;CACL,EACD;IACI,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EACP,6GAA6G;CACpH,CACJ,CAAA"}