@polintpro/proposit-core 0.5.3 → 0.5.8
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 +172 -1
- package/dist/cli/commands/arguments.d.ts.map +1 -1
- package/dist/cli/commands/arguments.js +33 -5
- package/dist/cli/commands/arguments.js.map +1 -1
- package/dist/cli/commands/claims.d.ts +3 -0
- package/dist/cli/commands/claims.d.ts.map +1 -0
- package/dist/cli/commands/claims.js +120 -0
- package/dist/cli/commands/claims.js.map +1 -0
- package/dist/cli/commands/parse.d.ts +3 -0
- package/dist/cli/commands/parse.d.ts.map +1 -0
- package/dist/cli/commands/parse.js +159 -0
- package/dist/cli/commands/parse.js.map +1 -0
- package/dist/cli/commands/render.d.ts.map +1 -1
- package/dist/cli/commands/render.js +77 -4
- package/dist/cli/commands/render.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +1 -1
- package/dist/cli/commands/sources.d.ts.map +1 -1
- package/dist/cli/commands/sources.js +83 -45
- package/dist/cli/commands/sources.js.map +1 -1
- package/dist/cli/config.d.ts +1 -0
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +3 -0
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/engine.d.ts +14 -1
- package/dist/cli/engine.d.ts.map +1 -1
- package/dist/cli/engine.js +45 -2
- package/dist/cli/engine.js.map +1 -1
- package/dist/cli/import.d.ts +9 -1
- package/dist/cli/import.d.ts.map +1 -1
- package/dist/cli/import.js +22 -4
- package/dist/cli/import.js.map +1 -1
- package/dist/cli/llm/index.d.ts +6 -0
- package/dist/cli/llm/index.d.ts.map +1 -0
- package/dist/cli/llm/index.js +26 -0
- package/dist/cli/llm/index.js.map +1 -0
- package/dist/cli/llm/openai.d.ts +4 -0
- package/dist/cli/llm/openai.d.ts.map +1 -0
- package/dist/cli/llm/openai.js +44 -0
- package/dist/cli/llm/openai.js.map +1 -0
- package/dist/cli/llm/types.d.ts +14 -0
- package/dist/cli/llm/types.d.ts.map +1 -0
- package/dist/cli/llm/types.js +2 -0
- package/dist/cli/llm/types.js.map +1 -0
- package/dist/cli/logging.d.ts +8 -0
- package/dist/cli/logging.d.ts.map +1 -0
- package/dist/cli/logging.js +23 -0
- package/dist/cli/logging.js.map +1 -0
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +2 -0
- package/dist/cli/router.js.map +1 -1
- package/dist/cli/storage/libraries.d.ts +11 -0
- package/dist/cli/storage/libraries.d.ts.map +1 -0
- package/dist/cli/storage/libraries.js +61 -0
- package/dist/cli/storage/libraries.js.map +1 -0
- package/dist/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/extensions/basics/argument-parser.d.ts +12 -0
- package/dist/extensions/basics/argument-parser.d.ts.map +1 -0
- package/dist/extensions/basics/argument-parser.js +27 -0
- package/dist/extensions/basics/argument-parser.js.map +1 -0
- package/dist/extensions/basics/index.d.ts +4 -0
- package/dist/extensions/basics/index.d.ts.map +1 -0
- package/dist/extensions/basics/index.js +3 -0
- package/dist/extensions/basics/index.js.map +1 -0
- package/dist/extensions/basics/schemata.d.ts +31 -0
- package/dist/extensions/basics/schemata.d.ts.map +1 -0
- package/dist/extensions/basics/schemata.js +55 -0
- package/dist/extensions/basics/schemata.js.map +1 -0
- package/dist/lib/core/argument-engine.d.ts +5 -2
- package/dist/lib/core/argument-engine.d.ts.map +1 -1
- package/dist/lib/core/argument-engine.js +20 -24
- package/dist/lib/core/argument-engine.js.map +1 -1
- package/dist/lib/core/claim-library.d.ts +2 -2
- package/dist/lib/core/claim-library.d.ts.map +1 -1
- package/dist/lib/core/claim-source-library.d.ts +2 -2
- package/dist/lib/core/claim-source-library.d.ts.map +1 -1
- package/dist/lib/core/expression-manager.d.ts +25 -2
- package/dist/lib/core/expression-manager.d.ts.map +1 -1
- package/dist/lib/core/expression-manager.js +211 -4
- package/dist/lib/core/expression-manager.js.map +1 -1
- package/dist/lib/core/interfaces/index.d.ts +1 -1
- package/dist/lib/core/interfaces/index.d.ts.map +1 -1
- package/dist/lib/core/interfaces/library.interfaces.d.ts +243 -14
- package/dist/lib/core/interfaces/library.interfaces.d.ts.map +1 -1
- package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts +38 -0
- package/dist/lib/core/interfaces/premise-engine.interfaces.d.ts.map +1 -1
- package/dist/lib/core/parser/formula-gen.js +120 -47
- package/dist/lib/core/premise-engine.d.ts +8 -1
- package/dist/lib/core/premise-engine.d.ts.map +1 -1
- package/dist/lib/core/premise-engine.js +90 -21
- package/dist/lib/core/premise-engine.js.map +1 -1
- package/dist/lib/core/source-library.d.ts +2 -2
- package/dist/lib/core/source-library.d.ts.map +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +2 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/parsing/argument-parser.d.ts +47 -0
- package/dist/lib/parsing/argument-parser.d.ts.map +1 -0
- package/dist/lib/parsing/argument-parser.js +307 -0
- package/dist/lib/parsing/argument-parser.js.map +1 -0
- package/dist/lib/parsing/index.d.ts +7 -0
- package/dist/lib/parsing/index.d.ts.map +1 -0
- package/dist/lib/parsing/index.js +4 -0
- package/dist/lib/parsing/index.js.map +1 -0
- package/dist/lib/parsing/prompt-builder.d.ts +11 -0
- package/dist/lib/parsing/prompt-builder.d.ts.map +1 -0
- package/dist/lib/parsing/prompt-builder.js +192 -0
- package/dist/lib/parsing/prompt-builder.js.map +1 -0
- package/dist/lib/parsing/schemata.d.ts +77 -0
- package/dist/lib/parsing/schemata.d.ts.map +1 -0
- package/dist/lib/parsing/schemata.js +88 -0
- package/dist/lib/parsing/schemata.js.map +1 -0
- package/dist/lib/parsing/types.d.ts +13 -0
- package/dist/lib/parsing/types.d.ts.map +1 -0
- package/dist/lib/parsing/types.js +2 -0
- package/dist/lib/parsing/types.js.map +1 -0
- package/dist/lib/types/grammar.d.ts +31 -0
- package/dist/lib/types/grammar.d.ts.map +1 -0
- package/dist/lib/types/grammar.js +11 -0
- package/dist/lib/types/grammar.js.map +1 -0
- package/package.json +5 -1
- package/dist/cli/storage/sources.d.ts +0 -4
- package/dist/cli/storage/sources.d.ts.map +0 -1
- package/dist/cli/storage/sources.js +0 -22
- package/dist/cli/storage/sources.js.map +0 -1
|
@@ -1,36 +1,265 @@
|
|
|
1
1
|
import type { TCoreClaim } from "../../schemata/claim.js";
|
|
2
2
|
import type { TCoreClaimSourceAssociation, TCoreSource } from "../../schemata/source.js";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Narrow read-only interface for claim lookups. Used by `ArgumentEngine` for
|
|
5
|
+
* variable validation — callers that only need to verify claim existence
|
|
6
|
+
* should depend on this rather than the full `ClaimLibrary`.
|
|
7
|
+
*/
|
|
4
8
|
export interface TClaimLookup<TClaim extends TCoreClaim = TCoreClaim> {
|
|
9
|
+
/**
|
|
10
|
+
* Returns a claim by ID and version, or `undefined` if not found.
|
|
11
|
+
*
|
|
12
|
+
* @param id - The claim ID.
|
|
13
|
+
* @param version - The claim version number.
|
|
14
|
+
* @returns The claim entity, or `undefined`.
|
|
15
|
+
*/
|
|
5
16
|
get(id: string, version: number): TClaim | undefined;
|
|
6
17
|
}
|
|
7
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Narrow read-only interface for source lookups. Used by `ArgumentEngine` for
|
|
20
|
+
* validation — callers that only need to verify source existence should depend
|
|
21
|
+
* on this rather than the full `SourceLibrary`.
|
|
22
|
+
*/
|
|
8
23
|
export interface TSourceLookup<TSource extends TCoreSource = TCoreSource> {
|
|
24
|
+
/**
|
|
25
|
+
* Returns a source by ID and version, or `undefined` if not found.
|
|
26
|
+
*
|
|
27
|
+
* @param id - The source ID.
|
|
28
|
+
* @param version - The source version number.
|
|
29
|
+
* @returns The source entity, or `undefined`.
|
|
30
|
+
*/
|
|
9
31
|
get(id: string, version: number): TSource | undefined;
|
|
10
32
|
}
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Full management interface for a versioned claim library. Extends
|
|
35
|
+
* `TClaimLookup` with mutation, query, and snapshot methods.
|
|
36
|
+
*/
|
|
37
|
+
export interface TClaimLibraryManagement<TClaim extends TCoreClaim = TCoreClaim> extends TClaimLookup<TClaim> {
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new claim at version 0. The `version`, `frozen`, and
|
|
40
|
+
* `checksum` fields are assigned automatically.
|
|
41
|
+
*
|
|
42
|
+
* @param claim - The claim data without system-managed fields.
|
|
43
|
+
* @returns The created claim entity with all fields populated.
|
|
44
|
+
* @throws If a claim with the same ID already exists.
|
|
45
|
+
*/
|
|
46
|
+
create(claim: Omit<TClaim, "version" | "frozen" | "checksum">): TClaim;
|
|
47
|
+
/**
|
|
48
|
+
* Updates mutable fields on the current (latest, unfrozen) version of a
|
|
49
|
+
* claim. System-managed fields (`id`, `version`, `frozen`, `checksum`)
|
|
50
|
+
* cannot be updated.
|
|
51
|
+
*
|
|
52
|
+
* @param id - The claim ID.
|
|
53
|
+
* @param updates - The fields to update.
|
|
54
|
+
* @returns The updated claim entity.
|
|
55
|
+
* @throws If the claim does not exist.
|
|
56
|
+
* @throws If the current version is frozen.
|
|
57
|
+
*/
|
|
58
|
+
update(id: string, updates: Partial<Omit<TClaim, "id" | "version" | "frozen" | "checksum">>): TClaim;
|
|
59
|
+
/**
|
|
60
|
+
* Freezes the current version of a claim (marking it immutable) and
|
|
61
|
+
* creates a new mutable version at `version + 1`.
|
|
62
|
+
*
|
|
63
|
+
* @param id - The claim ID.
|
|
64
|
+
* @returns An object containing the `frozen` version and the new
|
|
65
|
+
* `current` (mutable) version.
|
|
66
|
+
* @throws If the claim does not exist.
|
|
67
|
+
* @throws If the current version is already frozen.
|
|
68
|
+
*/
|
|
69
|
+
freeze(id: string): {
|
|
70
|
+
frozen: TClaim;
|
|
71
|
+
current: TClaim;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Returns the latest version of a claim, or `undefined` if not found.
|
|
75
|
+
*
|
|
76
|
+
* @param id - The claim ID.
|
|
77
|
+
* @returns The latest claim entity, or `undefined`.
|
|
78
|
+
*/
|
|
79
|
+
getCurrent(id: string): TClaim | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Returns all claim entities across all IDs and versions.
|
|
82
|
+
*
|
|
83
|
+
* @returns An array of all claim entities.
|
|
84
|
+
*/
|
|
85
|
+
getAll(): TClaim[];
|
|
86
|
+
/**
|
|
87
|
+
* Returns all versions of a claim sorted by version number ascending.
|
|
88
|
+
*
|
|
89
|
+
* @param id - The claim ID.
|
|
90
|
+
* @returns An array of claim entities, or an empty array if the ID does
|
|
91
|
+
* not exist.
|
|
92
|
+
*/
|
|
93
|
+
getVersions(id: string): TClaim[];
|
|
94
|
+
/**
|
|
95
|
+
* Returns a serializable snapshot of all claims in the library.
|
|
96
|
+
*
|
|
97
|
+
* @returns The claim library snapshot.
|
|
98
|
+
*/
|
|
99
|
+
snapshot(): TClaimLibrarySnapshot<TClaim>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Full management interface for a versioned source library. Extends
|
|
103
|
+
* `TSourceLookup` with mutation, query, and snapshot methods.
|
|
104
|
+
*/
|
|
105
|
+
export interface TSourceLibraryManagement<TSource extends TCoreSource = TCoreSource> extends TSourceLookup<TSource> {
|
|
106
|
+
/**
|
|
107
|
+
* Creates a new source at version 0. The `version`, `frozen`, and
|
|
108
|
+
* `checksum` fields are assigned automatically.
|
|
109
|
+
*
|
|
110
|
+
* @param source - The source data without system-managed fields.
|
|
111
|
+
* @returns The created source entity with all fields populated.
|
|
112
|
+
* @throws If a source with the same ID already exists.
|
|
113
|
+
*/
|
|
114
|
+
create(source: Omit<TSource, "version" | "frozen" | "checksum">): TSource;
|
|
115
|
+
/**
|
|
116
|
+
* Updates mutable fields on the current (latest, unfrozen) version of a
|
|
117
|
+
* source. System-managed fields (`id`, `version`, `frozen`, `checksum`)
|
|
118
|
+
* cannot be updated.
|
|
119
|
+
*
|
|
120
|
+
* @param id - The source ID.
|
|
121
|
+
* @param updates - The fields to update.
|
|
122
|
+
* @returns The updated source entity.
|
|
123
|
+
* @throws If the source does not exist.
|
|
124
|
+
* @throws If the current version is frozen.
|
|
125
|
+
*/
|
|
126
|
+
update(id: string, updates: Partial<Omit<TSource, "id" | "version" | "frozen" | "checksum">>): TSource;
|
|
127
|
+
/**
|
|
128
|
+
* Freezes the current version of a source (marking it immutable) and
|
|
129
|
+
* creates a new mutable version at `version + 1`.
|
|
130
|
+
*
|
|
131
|
+
* @param id - The source ID.
|
|
132
|
+
* @returns An object containing the `frozen` version and the new
|
|
133
|
+
* `current` (mutable) version.
|
|
134
|
+
* @throws If the source does not exist.
|
|
135
|
+
* @throws If the current version is already frozen.
|
|
136
|
+
*/
|
|
137
|
+
freeze(id: string): {
|
|
138
|
+
frozen: TSource;
|
|
139
|
+
current: TSource;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Returns the latest version of a source, or `undefined` if not found.
|
|
143
|
+
*
|
|
144
|
+
* @param id - The source ID.
|
|
145
|
+
* @returns The latest source entity, or `undefined`.
|
|
146
|
+
*/
|
|
147
|
+
getCurrent(id: string): TSource | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Returns all source entities across all IDs and versions.
|
|
150
|
+
*
|
|
151
|
+
* @returns An array of all source entities.
|
|
152
|
+
*/
|
|
153
|
+
getAll(): TSource[];
|
|
154
|
+
/**
|
|
155
|
+
* Returns all versions of a source sorted by version number ascending.
|
|
156
|
+
*
|
|
157
|
+
* @param id - The source ID.
|
|
158
|
+
* @returns An array of source entities, or an empty array if the ID does
|
|
159
|
+
* not exist.
|
|
160
|
+
*/
|
|
161
|
+
getVersions(id: string): TSource[];
|
|
162
|
+
/**
|
|
163
|
+
* Returns a serializable snapshot of all sources in the library.
|
|
164
|
+
*
|
|
165
|
+
* @returns The source library snapshot.
|
|
166
|
+
*/
|
|
167
|
+
snapshot(): TSourceLibrarySnapshot<TSource>;
|
|
168
|
+
}
|
|
19
169
|
/**
|
|
20
170
|
* Narrow read-only interface for claim-source association lookups.
|
|
21
171
|
* Implemented by `ClaimSourceLibrary`. Passed to `ArgumentEngine` as the
|
|
22
172
|
* fourth constructor parameter.
|
|
23
173
|
*/
|
|
24
174
|
export interface TClaimSourceLookup<TAssoc extends TCoreClaimSourceAssociation = TCoreClaimSourceAssociation> {
|
|
25
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Returns all associations for the given claim ID.
|
|
177
|
+
*
|
|
178
|
+
* @param claimId - The claim ID to filter by.
|
|
179
|
+
* @returns An array of matching associations.
|
|
180
|
+
*/
|
|
26
181
|
getForClaim(claimId: string): TAssoc[];
|
|
27
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Returns all associations for the given source ID.
|
|
184
|
+
*
|
|
185
|
+
* @param sourceId - The source ID to filter by.
|
|
186
|
+
* @returns An array of matching associations.
|
|
187
|
+
*/
|
|
28
188
|
getForSource(sourceId: string): TAssoc[];
|
|
29
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Returns an association by ID, or `undefined` if not found.
|
|
191
|
+
*
|
|
192
|
+
* @param id - The association ID.
|
|
193
|
+
* @returns The association entity, or `undefined`.
|
|
194
|
+
*/
|
|
30
195
|
get(id: string): TAssoc | undefined;
|
|
31
196
|
}
|
|
32
|
-
/**
|
|
197
|
+
/**
|
|
198
|
+
* Full management interface for a claim-source association library. Extends
|
|
199
|
+
* `TClaimSourceLookup` with mutation, query, and snapshot methods.
|
|
200
|
+
* Associations are create-or-delete only — no update path.
|
|
201
|
+
*/
|
|
202
|
+
export interface TClaimSourceLibraryManagement<TAssoc extends TCoreClaimSourceAssociation = TCoreClaimSourceAssociation> extends TClaimSourceLookup<TAssoc> {
|
|
203
|
+
/**
|
|
204
|
+
* Creates a claim-source association. Validates that the referenced claim
|
|
205
|
+
* and source exist in their respective libraries.
|
|
206
|
+
*
|
|
207
|
+
* @param assoc - The association data without the `checksum` field.
|
|
208
|
+
* @returns The created association with checksum populated.
|
|
209
|
+
* @throws If an association with the same ID already exists.
|
|
210
|
+
* @throws If the referenced claim or source does not exist.
|
|
211
|
+
*/
|
|
212
|
+
add(assoc: Omit<TAssoc, "checksum">): TAssoc;
|
|
213
|
+
/**
|
|
214
|
+
* Removes a claim-source association by ID.
|
|
215
|
+
*
|
|
216
|
+
* @param id - The association ID to remove.
|
|
217
|
+
* @returns The removed association entity.
|
|
218
|
+
* @throws If the association does not exist.
|
|
219
|
+
*/
|
|
220
|
+
remove(id: string): TAssoc;
|
|
221
|
+
/**
|
|
222
|
+
* Returns all associations in the library.
|
|
223
|
+
*
|
|
224
|
+
* @returns An array of all association entities.
|
|
225
|
+
*/
|
|
226
|
+
getAll(): TAssoc[];
|
|
227
|
+
/**
|
|
228
|
+
* Returns all associations matching the predicate.
|
|
229
|
+
*
|
|
230
|
+
* @param predicate - A filter function applied to each association.
|
|
231
|
+
* @returns An array of matching associations.
|
|
232
|
+
*/
|
|
233
|
+
filter(predicate: (a: TAssoc) => boolean): TAssoc[];
|
|
234
|
+
/**
|
|
235
|
+
* Returns a serializable snapshot of all associations in the library.
|
|
236
|
+
*
|
|
237
|
+
* @returns The claim-source library snapshot.
|
|
238
|
+
*/
|
|
239
|
+
snapshot(): TClaimSourceLibrarySnapshot<TAssoc>;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Serializable snapshot of a `ClaimLibrary`. Contains all claim entities
|
|
243
|
+
* across all IDs and versions.
|
|
244
|
+
*/
|
|
245
|
+
export type TClaimLibrarySnapshot<TClaim extends TCoreClaim = TCoreClaim> = {
|
|
246
|
+
/** All claim entities in the library. */
|
|
247
|
+
claims: TClaim[];
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Serializable snapshot of a `SourceLibrary`. Contains all source entities
|
|
251
|
+
* across all IDs and versions.
|
|
252
|
+
*/
|
|
253
|
+
export type TSourceLibrarySnapshot<TSource extends TCoreSource = TCoreSource> = {
|
|
254
|
+
/** All source entities in the library. */
|
|
255
|
+
sources: TSource[];
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Serializable snapshot of a `ClaimSourceLibrary`. Contains all association
|
|
259
|
+
* entities.
|
|
260
|
+
*/
|
|
33
261
|
export type TClaimSourceLibrarySnapshot<TAssoc extends TCoreClaimSourceAssociation = TCoreClaimSourceAssociation> = {
|
|
262
|
+
/** All claim-source association entities in the library. */
|
|
34
263
|
claimSourceAssociations: TAssoc[];
|
|
35
264
|
};
|
|
36
265
|
//# sourceMappingURL=library.interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/library.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EACR,2BAA2B,EAC3B,WAAW,EACd,MAAM,0BAA0B,CAAA;AAEjC
|
|
1
|
+
{"version":3,"file":"library.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/library.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,EACR,2BAA2B,EAC3B,WAAW,EACd,MAAM,0BAA0B,CAAA;AAEjC;;;;GAIG;AACH,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU;IAChE;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW;IACpE;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,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AAE,MAAM,KAAK,OAAO,GAAG,MAAM,EAAE,CAAA;IAEnD;;;;OAIG;IACH,QAAQ,IAAI,2BAA2B,CAAC,MAAM,CAAC,CAAA;CAClD;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,MAAM,SAAS,UAAU,GAAG,UAAU,IAAI;IACxE,yCAAyC;IACzC,MAAM,EAAE,MAAM,EAAE,CAAA;CACnB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,CAAC,OAAO,SAAS,WAAW,GAAG,WAAW,IACxE;IACI,0CAA0C;IAC1C,OAAO,EAAE,OAAO,EAAE,CAAA;CACrB,CAAA;AAEL;;;GAGG;AACH,MAAM,MAAM,2BAA2B,CACnC,MAAM,SAAS,2BAA2B,GAAG,2BAA2B,IACxE;IACA,4DAA4D;IAC5D,uBAAuB,EAAE,MAAM,EAAE,CAAA;CACpC,CAAA"}
|
|
@@ -14,6 +14,13 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
14
14
|
* root is permitted per premise. All structural rules (`implies`/`iff`
|
|
15
15
|
* root-only, child limits, position uniqueness) are enforced.
|
|
16
16
|
*
|
|
17
|
+
* When `grammarConfig.autoNormalize` is `true`, operator nesting
|
|
18
|
+
* violations are auto-corrected by inserting a `formula` buffer between
|
|
19
|
+
* the parent operator and the non-`not` operator child, rather than
|
|
20
|
+
* throwing. Auto-normalize is only active for `addExpression`; compound
|
|
21
|
+
* operations (`insertExpression`, `wrapExpression`) and `removeExpression`
|
|
22
|
+
* always throw on violations regardless of this flag.
|
|
23
|
+
*
|
|
17
24
|
* @param expression - The expression to add, including position and
|
|
18
25
|
* parent assignment.
|
|
19
26
|
* @returns The added expression (with checksum) and changeset.
|
|
@@ -22,6 +29,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
22
29
|
* @throws If the expression's parent does not exist in this premise.
|
|
23
30
|
* @throws If the expression is a variable reference and the variable
|
|
24
31
|
* has not been registered.
|
|
32
|
+
* @throws If a non-not operator would become a direct child of another
|
|
33
|
+
* operator expression (when `autoNormalize` is `false`).
|
|
25
34
|
*/
|
|
26
35
|
addExpression(expression: TExpressionInput<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
27
36
|
/**
|
|
@@ -35,6 +44,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
35
44
|
* @throws If the premise already has a root and `parentId` is `null`.
|
|
36
45
|
* @throws If the expression is a variable reference and the variable
|
|
37
46
|
* has not been registered.
|
|
47
|
+
* @throws If a non-not operator would become a direct child of another
|
|
48
|
+
* operator expression.
|
|
38
49
|
*/
|
|
39
50
|
appendExpression(parentId: string | null, expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
40
51
|
/**
|
|
@@ -49,6 +60,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
49
60
|
* @throws If the sibling does not exist in this premise.
|
|
50
61
|
* @throws If the expression is a variable reference and the variable
|
|
51
62
|
* has not been registered.
|
|
63
|
+
* @throws If a non-not operator would become a direct child of another
|
|
64
|
+
* operator expression.
|
|
52
65
|
*/
|
|
53
66
|
addExpressionRelative(siblingId: string, relativePosition: "before" | "after", expression: TExpressionWithoutPosition<TExpr>): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
54
67
|
/**
|
|
@@ -69,6 +82,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
69
82
|
* @param expressionId - The ID of the expression to remove.
|
|
70
83
|
* @param deleteSubtree - Whether to remove all descendants as well.
|
|
71
84
|
* @returns The removed root expression, or `undefined` if not found.
|
|
85
|
+
* @throws If removal would promote a non-not operator as a direct
|
|
86
|
+
* child of another operator expression.
|
|
72
87
|
*/
|
|
73
88
|
removeExpression(expressionId: string, deleteSubtree: boolean): TCoreMutationResult<TExpr | undefined, TExpr, TVar, TPremise, TArg>;
|
|
74
89
|
/**
|
|
@@ -85,6 +100,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
85
100
|
* @returns The inserted expression (with checksum) and changeset.
|
|
86
101
|
* @throws If the expression is a variable reference and the variable
|
|
87
102
|
* has not been registered.
|
|
103
|
+
* @throws If a non-not operator would become a direct child of another
|
|
104
|
+
* operator expression.
|
|
88
105
|
*/
|
|
89
106
|
insertExpression(expression: TExpressionInput<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
90
107
|
/**
|
|
@@ -104,6 +121,8 @@ export interface TExpressionMutations<TArg extends TCoreArgument = TCoreArgument
|
|
|
104
121
|
* @returns The inserted operator (with checksum) and changeset.
|
|
105
122
|
* @throws If the new sibling is a variable reference and the variable
|
|
106
123
|
* has not been registered.
|
|
124
|
+
* @throws If a non-not operator would become a direct child of another
|
|
125
|
+
* operator expression.
|
|
107
126
|
*/
|
|
108
127
|
wrapExpression(operator: TExpressionWithoutPosition<TExpr>, newSibling: TExpressionWithoutPosition<TExpr>, leftNodeId?: string, rightNodeId?: string): TCoreMutationResult<TExpr, TExpr, TVar, TPremise, TArg>;
|
|
109
128
|
/**
|
|
@@ -261,6 +280,25 @@ export interface TPremiseLifecycle<TPremise extends TCorePremise = TCorePremise,
|
|
|
261
280
|
* @param callback - The mutation callback, or `undefined` to remove.
|
|
262
281
|
*/
|
|
263
282
|
setOnMutate(callback: (() => void) | undefined): void;
|
|
283
|
+
/**
|
|
284
|
+
* Sets a callback that checks whether adding a variable-expression to a
|
|
285
|
+
* premise would create a circular binding. Injected by `ArgumentEngine`
|
|
286
|
+
* to enable cross-premise cycle detection. If not set, only the direct
|
|
287
|
+
* check (within the premise itself) runs.
|
|
288
|
+
*
|
|
289
|
+
* @param check - A function that returns `true` if adding the variable
|
|
290
|
+
* to the premise would create a cycle, or `undefined` to clear.
|
|
291
|
+
*/
|
|
292
|
+
setCircularityCheck(check: ((variableId: string, premiseId: string) => boolean) | undefined): void;
|
|
293
|
+
/**
|
|
294
|
+
* Sets a callback that checks whether a premise-bound variable's target
|
|
295
|
+
* premise has an empty expression tree. Injected by `ArgumentEngine` to
|
|
296
|
+
* enable cross-premise validation. Used during `validateEvaluability`.
|
|
297
|
+
*
|
|
298
|
+
* @param check - A function that returns `true` if the variable's bound
|
|
299
|
+
* premise has no root expression, or `undefined` to clear.
|
|
300
|
+
*/
|
|
301
|
+
setEmptyBoundPremiseCheck(check: ((variableId: string) => boolean) | undefined): void;
|
|
264
302
|
/**
|
|
265
303
|
* Invalidates the cached checksum so the next call recomputes it.
|
|
266
304
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"premise-engine.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/premise-engine.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,4BAA4B,EAC5B,0BAA0B,EAC7B,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EACR,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACxB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAClE,OAAO,KAAK,EACR,gBAAgB,EAChB,0BAA0B,EAC1B,iBAAiB,EACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,oBAAoB,CACjC,IAAI,SAAS,aAAa,GAAG,aAAa,EAC1C,QAAQ,SAAS,YAAY,GAAG,YAAY,EAC5C,KAAK,SAAS,4BAA4B,GAAG,4BAA4B,EACzE,IAAI,SAAS,0BAA0B,GAAG,0BAA0B;IAEpE
|
|
1
|
+
{"version":3,"file":"premise-engine.interfaces.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/interfaces/premise-engine.inter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