@openmbee/opensysml 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.
- package/README.md +355 -33
- package/dist/browser/index.d.ts +9 -0
- package/dist/browser/index.js +16 -0
- package/dist/browser/wasm-worker.d.ts +1 -0
- package/dist/browser/wasm-worker.js +2 -0
- package/dist/browser/wasm.d.ts +17 -0
- package/dist/browser/wasm.js +94 -0
- package/dist/core/arguments.d.ts +4 -0
- package/dist/core/arguments.js +19 -0
- package/dist/core/capabilities.d.ts +90 -9
- package/dist/core/capabilities.js +111 -10
- package/dist/core/connection.d.ts +203 -2
- package/dist/core/connection.js +810 -17
- package/dist/core/conversion.d.ts +153 -0
- package/dist/core/conversion.js +191 -0
- package/dist/core/document.d.ts +188 -0
- package/dist/core/document.js +457 -0
- package/dist/core/edit.d.ts +446 -0
- package/dist/core/edit.js +1994 -0
- package/dist/core/engines.d.ts +64 -0
- package/dist/core/engines.js +74 -0
- package/dist/core/errors.d.ts +164 -2
- package/dist/core/errors.js +209 -3
- package/dist/core/exploration.d.ts +71 -0
- package/dist/core/exploration.js +116 -0
- package/dist/core/graphs.d.ts +15 -0
- package/dist/core/graphs.js +3 -0
- package/dist/core/index.d.ts +30 -9
- package/dist/core/index.js +14 -5
- package/dist/core/model.d.ts +168 -8
- package/dist/core/model.js +258 -31
- package/dist/core/package.d.ts +2 -0
- package/dist/core/package.js +2 -0
- package/dist/core/query.d.ts +50 -0
- package/dist/core/query.js +197 -0
- package/dist/core/render-view.d.ts +97 -0
- package/dist/core/render-view.js +120 -0
- package/dist/core/sources.d.ts +34 -0
- package/dist/core/sources.js +134 -0
- package/dist/core/status.d.ts +9 -2
- package/dist/core/status.js +24 -8
- package/dist/core/typed.d.ts +71 -0
- package/dist/core/typed.js +245 -0
- package/dist/core/values.d.ts +127 -8
- package/dist/core/values.js +536 -30
- package/dist/core/verdict.d.ts +271 -0
- package/dist/core/verdict.js +567 -0
- package/dist/core/wasm.d.ts +114 -0
- package/dist/core/wasm.js +514 -0
- package/dist/generated/sysml_pb.d.ts +1080 -22
- package/dist/generated/sysml_pb.js +200 -100
- package/dist/node/binary.d.ts +2 -0
- package/dist/node/binary.js +8 -6
- package/dist/node/generate-cli.d.ts +2 -0
- package/dist/node/generate-cli.js +10 -0
- package/dist/node/generate.d.ts +99 -0
- package/dist/node/generate.js +757 -0
- package/dist/node/index.d.ts +29 -2
- package/dist/node/index.js +211 -10
- package/dist/node/service.d.ts +5 -3
- package/dist/node/service.js +32 -26
- package/dist/node/wasm-source.d.ts +18 -0
- package/dist/node/wasm-source.js +103 -0
- package/dist/node/wasm-worker.d.ts +1 -0
- package/dist/node/wasm-worker.js +10 -0
- package/dist/node/wasm.d.ts +17 -0
- package/dist/node/wasm.js +63 -0
- package/package.json +19 -7
- package/release-digests.json +105 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import type { CaseEvaluation as PbCaseEvaluation, RunAnalysisResponse, RunSweepResponse, ValidateInstanceResponse, Value, Verdict as PbVerdict, VerificationVerdict as PbVerificationVerdict } from "../generated/sysml_pb.js";
|
|
2
|
+
import { FailureReason } from "../generated/sysml_pb.js";
|
|
3
|
+
import { UnsupportedValueError, type ModelDiagnostic } from "./errors.js";
|
|
4
|
+
import type { Instance } from "./model.js";
|
|
5
|
+
import { type EngineBound, type Standing } from "./engines.js";
|
|
6
|
+
import { type SysMLValue, type SysMLVerdict, type VerificationVerdict } from "./values.js";
|
|
7
|
+
/** Verdict kinds, as the service reports them. */
|
|
8
|
+
export declare const KIND_CONSTRAINT = "constraint";
|
|
9
|
+
export declare const KIND_REQUIREMENT = "requirement";
|
|
10
|
+
export declare const KIND_SATISFY = "satisfy";
|
|
11
|
+
export declare const KIND_OBJECTIVE = "objective";
|
|
12
|
+
export declare const KIND_ASSERTION = "assertion";
|
|
13
|
+
export declare const KIND_OBJECT = "object";
|
|
14
|
+
/** VerdictKind values a verification case's body produces. */
|
|
15
|
+
export declare const VERDICT_PASS = "pass";
|
|
16
|
+
export declare const VERDICT_FAIL = "fail";
|
|
17
|
+
export declare const VERDICT_INCONCLUSIVE = "inconclusive";
|
|
18
|
+
export declare const VERDICT_ERROR = "error";
|
|
19
|
+
/** The questions a verification answers. */
|
|
20
|
+
export declare const QUESTION_EVALUATE = "evaluate";
|
|
21
|
+
export declare const QUESTION_HOLDS = "holds";
|
|
22
|
+
export declare const QUESTION_SATISFIABLE = "satisfiable";
|
|
23
|
+
/** The statuses a verdict reports, as the service spells them. */
|
|
24
|
+
export declare const STATUS_HOLDS = "holds";
|
|
25
|
+
export declare const STATUS_VIOLATED = "violated";
|
|
26
|
+
export declare const STATUS_UNDECIDED = "undecided";
|
|
27
|
+
export declare const STATUS_SATISFIABLE = "satisfiable";
|
|
28
|
+
export declare const STATUS_UNSATISFIABLE = "unsatisfiable";
|
|
29
|
+
export type { SysMLVerdict, VerificationVerdict };
|
|
30
|
+
export type { WitnessAssignment } from "./values.js";
|
|
31
|
+
/** A value, or the error decoding it raised. */
|
|
32
|
+
export type ValueOrError = SysMLValue | UnsupportedValueError;
|
|
33
|
+
/** Whether a verdict's condition holds: the arm it decoded to. */
|
|
34
|
+
export declare function verdictHolds(verdict: SysMLVerdict): boolean;
|
|
35
|
+
/** Whether the verdict is an answer about the model at all: not undecided. */
|
|
36
|
+
export declare function verdictEvaluated(verdict: SysMLVerdict): boolean;
|
|
37
|
+
/** Raise an {@link ExecutionError} when the verdict is undecided; else return it. */
|
|
38
|
+
export declare function raiseVerdictError(verdict: SysMLVerdict): SysMLVerdict;
|
|
39
|
+
/** One line saying what the verdict is and why, then its standing when reported. */
|
|
40
|
+
export declare function explainVerdict(verdict: SysMLVerdict): string;
|
|
41
|
+
/** One line saying what a verification case's body answered and why. */
|
|
42
|
+
export declare function explainVerificationVerdict(verdict: VerificationVerdict): string;
|
|
43
|
+
/** Whether a verification-case verdict is a pass. */
|
|
44
|
+
export declare function verificationPassed(verdict: VerificationVerdict): boolean;
|
|
45
|
+
/** Read a wire `VerificationVerdict`. */
|
|
46
|
+
export declare function decodeVerificationVerdict(pb: PbVerificationVerdict): VerificationVerdict;
|
|
47
|
+
/**
|
|
48
|
+
* A verdict as the response reported it: the union of values.ts plus the
|
|
49
|
+
* instances and diagnostics its response carried. A verification's verdict is
|
|
50
|
+
* the answer it gave, never an exception; an undecided arm is an answer too —
|
|
51
|
+
* a failure to evaluate, reported as `error`.
|
|
52
|
+
*/
|
|
53
|
+
export interface Verdict {
|
|
54
|
+
readonly verdict: SysMLVerdict;
|
|
55
|
+
/** The objects the call reported: the one this verdict is about and those reachable from it. */
|
|
56
|
+
readonly instances: readonly Instance[];
|
|
57
|
+
/** Diagnostics the service reported. */
|
|
58
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
59
|
+
}
|
|
60
|
+
/** The arm of a `Verdict`, for callers that switch on it directly. */
|
|
61
|
+
export declare function armOf(verdict: Verdict): SysMLVerdict;
|
|
62
|
+
/** Whether the verdict's condition holds. */
|
|
63
|
+
export declare function holds(verdict: Verdict): boolean;
|
|
64
|
+
/** Raise when the verdict reports the named element is of another kind. */
|
|
65
|
+
export declare function raiseWrongKind(pbVerdict: PbVerdict | undefined, diagnostics: readonly ModelDiagnostic[]): void;
|
|
66
|
+
/** Raise the error a failure the service classified: wrong kind, else a run failure. */
|
|
67
|
+
export declare function raiseFailure(message: string, failureReason: FailureReason, diagnostics: readonly ModelDiagnostic[]): never;
|
|
68
|
+
/** Read the error-or-result of an outputs map: undecodable values stay errors in place. */
|
|
69
|
+
export declare function valuesMap(entries: Iterable<[string, Value | undefined]>): Map<string, ValueOrError>;
|
|
70
|
+
/** The verifications the requirement of `pbVerdict` was reported for. */
|
|
71
|
+
export declare function verificationsFor(verifications: readonly VerificationVerdict[], pbVerdict: PbVerdict): VerificationVerdict[];
|
|
72
|
+
/** Wrap a wire verdict with the instances and diagnostics its response carried,
|
|
73
|
+
* attaching the verifications of its own requirement — every one the response
|
|
74
|
+
* carried when `attachAll` is set, as a single-verdict response asks for. */
|
|
75
|
+
export declare function verdictOf(pbVerdict: PbVerdict, instances: readonly Instance[], diagnostics: readonly ModelDiagnostic[], verifications: readonly VerificationVerdict[], attachAll?: boolean): Verdict;
|
|
76
|
+
/** The outputs an invocation computed, or the features a calc usage wrote. */
|
|
77
|
+
export declare class CalcResult {
|
|
78
|
+
/** The value an invocation returned; undefined when `outputs` carries the answer. */
|
|
79
|
+
readonly value: ValueOrError | undefined;
|
|
80
|
+
/** Output features a calc usage computed. */
|
|
81
|
+
readonly outputs: ReadonlyMap<string, ValueOrError>;
|
|
82
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
83
|
+
readonly standing: Standing;
|
|
84
|
+
constructor(init: {
|
|
85
|
+
value?: ValueOrError;
|
|
86
|
+
outputs: ReadonlyMap<string, ValueOrError>;
|
|
87
|
+
diagnostics?: readonly ModelDiagnostic[];
|
|
88
|
+
standing?: Standing;
|
|
89
|
+
});
|
|
90
|
+
get engine(): string;
|
|
91
|
+
/** Strength of the evidence the answer rests on; empty when unreported. */
|
|
92
|
+
get strength(): string;
|
|
93
|
+
/** The bounds the engine ran under. */
|
|
94
|
+
get bounds(): readonly EngineBound[];
|
|
95
|
+
toString(): string;
|
|
96
|
+
}
|
|
97
|
+
/** One application an analysis case made of one of its own calcs as a value. */
|
|
98
|
+
export declare class CaseEvaluation {
|
|
99
|
+
/** FQN of the calc applied. */
|
|
100
|
+
readonly functionId: string;
|
|
101
|
+
/** What it was applied to; an alternative is the instance it is. */
|
|
102
|
+
readonly arguments: readonly ValueOrError[];
|
|
103
|
+
/** What it computed; undefined when `error` says why nothing was. */
|
|
104
|
+
readonly result: ValueOrError | undefined;
|
|
105
|
+
/** Why the evaluation computed nothing; empty when it did. */
|
|
106
|
+
readonly error: string;
|
|
107
|
+
/** Whether the case returned this evaluation's argument: a trade study's selection. */
|
|
108
|
+
readonly selected: boolean;
|
|
109
|
+
/** Whether it computed what the selected one did without being selected. */
|
|
110
|
+
readonly tied: boolean;
|
|
111
|
+
constructor(init: {
|
|
112
|
+
functionId: string;
|
|
113
|
+
arguments: readonly ValueOrError[];
|
|
114
|
+
result?: ValueOrError;
|
|
115
|
+
error?: string;
|
|
116
|
+
selected?: boolean;
|
|
117
|
+
tied?: boolean;
|
|
118
|
+
});
|
|
119
|
+
/** Whether the evaluation computed a result. */
|
|
120
|
+
get evaluated(): boolean;
|
|
121
|
+
/** One line saying what was evaluated, what it gave, and whether it was selected. */
|
|
122
|
+
explain(): string;
|
|
123
|
+
toString(): string;
|
|
124
|
+
}
|
|
125
|
+
/** What an analysis case computed and decided. */
|
|
126
|
+
export declare class AnalysisResult {
|
|
127
|
+
/** Output features the case computed, by name. */
|
|
128
|
+
readonly outputs: ReadonlyMap<string, ValueOrError>;
|
|
129
|
+
/** The objective and assertion verdicts, in the order the case states them. */
|
|
130
|
+
readonly verdicts: readonly Verdict[];
|
|
131
|
+
/** The subject the case ran on and the objects reachable from it. */
|
|
132
|
+
readonly instances: readonly Instance[];
|
|
133
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
134
|
+
/** For a verification case, what its body answered and each subcase's. */
|
|
135
|
+
readonly verifications: readonly VerificationVerdict[];
|
|
136
|
+
/** Each application the run made of one of the case's calcs as a value. */
|
|
137
|
+
readonly evaluations: readonly CaseEvaluation[];
|
|
138
|
+
readonly standing: Standing;
|
|
139
|
+
constructor(init: {
|
|
140
|
+
outputs: ReadonlyMap<string, ValueOrError>;
|
|
141
|
+
verdicts: readonly Verdict[];
|
|
142
|
+
instances?: readonly Instance[];
|
|
143
|
+
diagnostics?: readonly ModelDiagnostic[];
|
|
144
|
+
verifications?: readonly VerificationVerdict[];
|
|
145
|
+
evaluations?: readonly CaseEvaluation[];
|
|
146
|
+
standing?: Standing;
|
|
147
|
+
});
|
|
148
|
+
get engine(): string;
|
|
149
|
+
/** Strength of the evidence the answer rests on; empty when unreported. */
|
|
150
|
+
get strength(): string;
|
|
151
|
+
/** The bounds the engine ran under. */
|
|
152
|
+
get bounds(): readonly EngineBound[];
|
|
153
|
+
/** The evaluations of the alternatives the case selected; one for a trade study. */
|
|
154
|
+
get selected(): CaseEvaluation[];
|
|
155
|
+
/** Whether every objective and assertion holds; a case stating none is satisfied. */
|
|
156
|
+
get satisfied(): boolean;
|
|
157
|
+
toString(): string;
|
|
158
|
+
}
|
|
159
|
+
/** Every assertion about one object and the objects it holds, answered. */
|
|
160
|
+
export declare class Validation {
|
|
161
|
+
/** One per assertion, root first then each held object in traversal order. */
|
|
162
|
+
readonly verdicts: readonly Verdict[];
|
|
163
|
+
/** The object's own verdict, of kind 'object'; undefined when the service sent none. */
|
|
164
|
+
readonly summary: Verdict | undefined;
|
|
165
|
+
/** The object validated and every object reachable from it. */
|
|
166
|
+
readonly instances: readonly Instance[];
|
|
167
|
+
/** Whether traversal stopped at its bound before reaching every held object. */
|
|
168
|
+
readonly bounded: boolean;
|
|
169
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
170
|
+
/** What the bodies of the verification cases of the requirements met answered. */
|
|
171
|
+
readonly verifications: readonly VerificationVerdict[];
|
|
172
|
+
constructor(init: {
|
|
173
|
+
verdicts: readonly Verdict[];
|
|
174
|
+
summary?: Verdict;
|
|
175
|
+
instances?: readonly Instance[];
|
|
176
|
+
bounded?: boolean;
|
|
177
|
+
diagnostics?: readonly ModelDiagnostic[];
|
|
178
|
+
verifications?: readonly VerificationVerdict[];
|
|
179
|
+
});
|
|
180
|
+
/** The standing of the summary's engine; unreported when the service sent none. */
|
|
181
|
+
get standing(): Standing;
|
|
182
|
+
get engine(): string;
|
|
183
|
+
/** Strength of the evidence the answer rests on; empty when unreported. */
|
|
184
|
+
get strength(): string;
|
|
185
|
+
/** The bounds the engine ran under. */
|
|
186
|
+
get bounds(): readonly EngineBound[];
|
|
187
|
+
/** Whether the object is shown valid: at least one assertion, every one holding, all reached. */
|
|
188
|
+
get valid(): boolean;
|
|
189
|
+
/** The verdicts the model answered false, as opposed to undecided ones. */
|
|
190
|
+
get violated(): Verdict[];
|
|
191
|
+
/** The verdicts whose condition could not be evaluated. */
|
|
192
|
+
get undecided(): Verdict[];
|
|
193
|
+
/** Raise an {@link ExecutionError} if any assertion could not be decided. */
|
|
194
|
+
raiseForError(): this;
|
|
195
|
+
get length(): number;
|
|
196
|
+
[Symbol.iterator](): Iterator<Verdict>;
|
|
197
|
+
toString(): string;
|
|
198
|
+
}
|
|
199
|
+
/** One run of a sweep: what it bound, what it produced, and how long it took. */
|
|
200
|
+
export declare class SweepRow {
|
|
201
|
+
/** The swept parameters as this run bound them, by name. */
|
|
202
|
+
readonly inputs: ReadonlyMap<string, ValueOrError>;
|
|
203
|
+
/** What the run produced, by name; a calc's return is named "result". */
|
|
204
|
+
readonly outputs: ReadonlyMap<string, ValueOrError>;
|
|
205
|
+
/** The objective and assertion verdicts of an analysis case; empty for a calc. */
|
|
206
|
+
readonly verdicts: readonly Verdict[];
|
|
207
|
+
/** Wall time of this run, in seconds. */
|
|
208
|
+
readonly seconds: number;
|
|
209
|
+
/** Why this run failed; empty when it did not. */
|
|
210
|
+
readonly error: string;
|
|
211
|
+
/** Each application this run made of one of the case's calcs as a value. */
|
|
212
|
+
readonly evaluations: readonly CaseEvaluation[];
|
|
213
|
+
constructor(init: {
|
|
214
|
+
inputs: ReadonlyMap<string, ValueOrError>;
|
|
215
|
+
outputs: ReadonlyMap<string, ValueOrError>;
|
|
216
|
+
verdicts: readonly Verdict[];
|
|
217
|
+
seconds: number;
|
|
218
|
+
error?: string;
|
|
219
|
+
evaluations?: readonly CaseEvaluation[];
|
|
220
|
+
});
|
|
221
|
+
/** The evaluations of the alternatives this run selected; one for a trade study. */
|
|
222
|
+
get selected(): CaseEvaluation[];
|
|
223
|
+
/** Whether this run failed rather than producing outputs. */
|
|
224
|
+
get failed(): boolean;
|
|
225
|
+
toString(): string;
|
|
226
|
+
}
|
|
227
|
+
/** Every run of one sweep, in the order the runs were made. */
|
|
228
|
+
export declare class SweepTable {
|
|
229
|
+
/** One row per run. */
|
|
230
|
+
readonly rows: readonly SweepRow[];
|
|
231
|
+
/** The swept parameters, in the order their ranges were given. */
|
|
232
|
+
readonly parameters: readonly string[];
|
|
233
|
+
/** Whether the rows were drawn rather than stepped through. */
|
|
234
|
+
readonly sampled: boolean;
|
|
235
|
+
/** The seed the rows were drawn from; 0 for a swept table. */
|
|
236
|
+
readonly seed: bigint;
|
|
237
|
+
/** The subjects the runs were about and the objects reachable from them. */
|
|
238
|
+
readonly instances: readonly Instance[];
|
|
239
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
240
|
+
readonly standing: Standing;
|
|
241
|
+
constructor(init: {
|
|
242
|
+
rows: readonly SweepRow[];
|
|
243
|
+
parameters: readonly string[];
|
|
244
|
+
sampled?: boolean;
|
|
245
|
+
seed?: bigint;
|
|
246
|
+
instances?: readonly Instance[];
|
|
247
|
+
diagnostics?: readonly ModelDiagnostic[];
|
|
248
|
+
standing?: Standing;
|
|
249
|
+
});
|
|
250
|
+
get engine(): string;
|
|
251
|
+
/** Strength of the evidence the answer rests on; empty when unreported. */
|
|
252
|
+
get strength(): string;
|
|
253
|
+
/** The bounds the engine ran under. */
|
|
254
|
+
get bounds(): readonly EngineBound[];
|
|
255
|
+
/** The runs that failed. */
|
|
256
|
+
get failures(): SweepRow[];
|
|
257
|
+
get length(): number;
|
|
258
|
+
[Symbol.iterator](): Iterator<SweepRow>;
|
|
259
|
+
row(index: number): SweepRow;
|
|
260
|
+
toString(): string;
|
|
261
|
+
}
|
|
262
|
+
/** Read the case evaluations of a response, undecodable values kept as errors. */
|
|
263
|
+
export declare function evaluationsOf(evals: readonly PbCaseEvaluation[]): CaseEvaluation[];
|
|
264
|
+
/** Decode one wire `Value`, keeping a decode failure as the error it raised. */
|
|
265
|
+
export declare function valueOrError(pb: Value | undefined): ValueOrError;
|
|
266
|
+
/** Read the verdicts a validation response carries, and its summary. */
|
|
267
|
+
export declare function validationOf(response: ValidateInstanceResponse, instances: readonly Instance[], diagnostics: readonly ModelDiagnostic[]): Validation;
|
|
268
|
+
/** Read a RunAnalysis response, or raise its failure. */
|
|
269
|
+
export declare function analysisResultOf(response: RunAnalysisResponse, instances: readonly Instance[], diagnostics: readonly ModelDiagnostic[]): AnalysisResult;
|
|
270
|
+
/** Read a RunSweep response into a SweepTable. */
|
|
271
|
+
export declare function sweepTableOf(response: RunSweepResponse, instances: readonly Instance[], diagnostics: readonly ModelDiagnostic[]): SweepTable;
|