@openmbee/opensysml 0.9.2 → 0.10.1

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 (67) hide show
  1. package/README.md +355 -33
  2. package/dist/browser/index.d.ts +9 -0
  3. package/dist/browser/index.js +16 -0
  4. package/dist/browser/wasm-worker.d.ts +1 -0
  5. package/dist/browser/wasm-worker.js +2 -0
  6. package/dist/browser/wasm.d.ts +17 -0
  7. package/dist/browser/wasm.js +97 -0
  8. package/dist/core/arguments.d.ts +4 -0
  9. package/dist/core/arguments.js +19 -0
  10. package/dist/core/capabilities.d.ts +90 -9
  11. package/dist/core/capabilities.js +111 -10
  12. package/dist/core/connection.d.ts +203 -2
  13. package/dist/core/connection.js +810 -17
  14. package/dist/core/conversion.d.ts +153 -0
  15. package/dist/core/conversion.js +191 -0
  16. package/dist/core/document.d.ts +188 -0
  17. package/dist/core/document.js +457 -0
  18. package/dist/core/edit.d.ts +446 -0
  19. package/dist/core/edit.js +1994 -0
  20. package/dist/core/engines.d.ts +64 -0
  21. package/dist/core/engines.js +74 -0
  22. package/dist/core/errors.d.ts +164 -2
  23. package/dist/core/errors.js +209 -3
  24. package/dist/core/exploration.d.ts +71 -0
  25. package/dist/core/exploration.js +116 -0
  26. package/dist/core/graphs.d.ts +15 -0
  27. package/dist/core/graphs.js +3 -0
  28. package/dist/core/index.d.ts +30 -9
  29. package/dist/core/index.js +14 -5
  30. package/dist/core/model.d.ts +168 -8
  31. package/dist/core/model.js +258 -31
  32. package/dist/core/package.d.ts +2 -0
  33. package/dist/core/package.js +2 -0
  34. package/dist/core/query.d.ts +50 -0
  35. package/dist/core/query.js +197 -0
  36. package/dist/core/render-view.d.ts +97 -0
  37. package/dist/core/render-view.js +120 -0
  38. package/dist/core/sources.d.ts +34 -0
  39. package/dist/core/sources.js +134 -0
  40. package/dist/core/status.d.ts +9 -2
  41. package/dist/core/status.js +24 -8
  42. package/dist/core/typed.d.ts +71 -0
  43. package/dist/core/typed.js +245 -0
  44. package/dist/core/values.d.ts +127 -8
  45. package/dist/core/values.js +538 -30
  46. package/dist/core/verdict.d.ts +271 -0
  47. package/dist/core/verdict.js +567 -0
  48. package/dist/core/wasm.d.ts +114 -0
  49. package/dist/core/wasm.js +514 -0
  50. package/dist/generated/sysml_pb.d.ts +1062 -15
  51. package/dist/generated/sysml_pb.js +200 -100
  52. package/dist/node/generate-cli.d.ts +2 -0
  53. package/dist/node/generate-cli.js +10 -0
  54. package/dist/node/generate.d.ts +99 -0
  55. package/dist/node/generate.js +757 -0
  56. package/dist/node/index.d.ts +29 -2
  57. package/dist/node/index.js +211 -10
  58. package/dist/node/service.d.ts +5 -3
  59. package/dist/node/service.js +32 -26
  60. package/dist/node/wasm-source.d.ts +18 -0
  61. package/dist/node/wasm-source.js +103 -0
  62. package/dist/node/wasm-worker.d.ts +1 -0
  63. package/dist/node/wasm-worker.js +10 -0
  64. package/dist/node/wasm.d.ts +17 -0
  65. package/dist/node/wasm.js +63 -0
  66. package/package.json +19 -7
  67. package/release-digests.json +117 -0
@@ -0,0 +1,116 @@
1
+ // What exploring a behavior under the `explore` scheduling policy found: every
2
+ // distinct outcome the runs reached, rather than one run's result.
3
+ import { byCodeUnit } from "./capabilities.js";
4
+ import { ExecutionError } from "./errors.js";
5
+ import { formatValue } from "./values.js";
6
+ /** One distinct outcome an exploration reached. */
7
+ export class Outcome {
8
+ /** The values the behavior holds at the end, by name; empty for a failed run. */
9
+ outputs;
10
+ /** The state a state machine rests in; empty for an action. */
11
+ finalState;
12
+ /** The states a state machine entered, in order. */
13
+ statesVisited;
14
+ /** Why the run failed; empty for a run that completed. */
15
+ error;
16
+ /** How many of the explored orders reached this outcome. */
17
+ linearizations;
18
+ /** Share of the explored orders' likelihood reaching this outcome; a lower bound while incomplete. */
19
+ probability;
20
+ /** The choices one run reaching it made, in run order; empty with no choice point. */
21
+ witness;
22
+ /** What the witness run reported, its choice points among them. */
23
+ diagnostics;
24
+ constructor(init) {
25
+ this.outputs = init.outputs;
26
+ this.finalState = init.finalState;
27
+ this.statesVisited = init.statesVisited;
28
+ this.error = init.error;
29
+ this.linearizations = init.linearizations;
30
+ this.probability = init.probability;
31
+ this.witness = init.witness;
32
+ this.diagnostics = init.diagnostics;
33
+ }
34
+ /** Whether the runs reaching this outcome failed rather than completed. */
35
+ get failed() {
36
+ return this.error !== "";
37
+ }
38
+ /** Raise the run's failure as an {@link ExecutionError}, if it failed. */
39
+ raiseForError() {
40
+ if (this.error !== "") {
41
+ throw new ExecutionError(this.error, "unspecified", this.diagnostics);
42
+ }
43
+ return this;
44
+ }
45
+ toString() {
46
+ if (this.error !== "") {
47
+ return `error: ${this.error}`;
48
+ }
49
+ const parts = [];
50
+ if (this.finalState !== "") {
51
+ parts.push(`finalState ${this.finalState}`);
52
+ }
53
+ if (this.statesVisited.length > 0) {
54
+ parts.push(`visits ${this.statesVisited.join(", ")}`);
55
+ }
56
+ for (const [name, value] of [...this.outputs.entries()].sort(([a], [b]) => byCodeUnit(a, b))) {
57
+ parts.push(`${name} = ${typeof value === "object" && "kind" in value ? formatValue(value) : String(value)}`);
58
+ }
59
+ return parts.length > 0 ? parts.join("; ") : "no outputs";
60
+ }
61
+ }
62
+ /** Every distinct outcome a behavior reached under `explore`, and how the exploration ended. */
63
+ export class Exploration {
64
+ /** The distinct outcomes reached, in the service's canonical order. */
65
+ outcomes;
66
+ /** Whether every linearization within the budget was run. */
67
+ complete;
68
+ /** How many runs were made. */
69
+ runs;
70
+ /** The budgets the exploration ran into; empty when complete. */
71
+ budgetsHit;
72
+ /** The most runs the exploration would make. */
73
+ runsBudget;
74
+ /** The most choice points one run would resolve. */
75
+ depthBudget;
76
+ /** Whether the outcomes' probabilities are lower bounds. */
77
+ probabilitiesLowerBound;
78
+ constructor(init) {
79
+ this.outcomes = init.outcomes;
80
+ this.complete = init.complete;
81
+ this.runs = init.runs;
82
+ this.budgetsHit = init.budgetsHit;
83
+ this.runsBudget = init.runsBudget;
84
+ this.depthBudget = init.depthBudget;
85
+ this.probabilitiesLowerBound = init.probabilitiesLowerBound ?? false;
86
+ }
87
+ get length() {
88
+ return this.outcomes.length;
89
+ }
90
+ [Symbol.iterator]() {
91
+ return this.outcomes[Symbol.iterator]();
92
+ }
93
+ /** How the exploration ended, as `sysml -schedule explore` prints it. */
94
+ get status() {
95
+ if (this.complete) {
96
+ return `complete (${this.runs} runs)`;
97
+ }
98
+ const named = this.budgetsHit
99
+ .map((budget) => `${budget} budget ${budget === "depth" ? this.depthBudget : this.runsBudget}`)
100
+ .join(" and ");
101
+ return `incomplete: ${named} hit after ${this.runs} runs; probabilities are lower bounds`;
102
+ }
103
+ /** Raise an {@link ExecutionError} unless every linearization was run. */
104
+ raiseForIncomplete() {
105
+ if (!this.complete) {
106
+ throw new ExecutionError(this.status);
107
+ }
108
+ return this;
109
+ }
110
+ toString() {
111
+ const lines = this.outcomes.map((outcome) => `${outcome.toString()} (${outcome.linearizations} linearizations; ` +
112
+ `${outcome.witness.join("; ") || "no choice points"})`);
113
+ lines.push(this.status);
114
+ return lines.join("\n");
115
+ }
116
+ }
@@ -0,0 +1,15 @@
1
+ import type { ExportGraphsResponse } from "../generated/sysml_pb.js";
2
+ /**
3
+ * The lowered graph of an action or state machine and of every behavior it
4
+ * performs, in the canonical `graphs:<version>` JSON form an external analysis
5
+ * engine is sent.
6
+ */
7
+ export interface Graphs {
8
+ /** The form as canonical JSON, ending in one newline. */
9
+ content: string;
10
+ /** The version of the form, the `version` field of the JSON. */
11
+ version: number;
12
+ /** The qualified name of the behavior as resolved. */
13
+ subject: string;
14
+ }
15
+ export declare function graphsOf(response: ExportGraphsResponse): Graphs;
@@ -0,0 +1,3 @@
1
+ export function graphsOf(response) {
2
+ return { content: response.content, version: response.version, subject: response.subject };
3
+ }
@@ -1,14 +1,35 @@
1
1
  export { Connection } from "./connection.js";
2
- export type { ConnectionBackend, Encoding, ResponseTap, TransportOptions, } from "./connection.js";
3
- export { Instance, InstanceTree, Model, ModelSymbol } from "./model.js";
4
- export type { AttributeFacts, EvalOptions, FeatureValue, ParseOptions, SpecializationFacts, TypeFacts, } from "./model.js";
5
- export { CAPABILITY_APPLY_EDITS, CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING, CAPABILITY_CASE_EVALUATIONS, CAPABILITY_COMPLEX_VALUES, CAPABILITY_CONVERT, CAPABILITY_DIAGNOSTIC_CODES, CAPABILITY_EDIT_DOCUMENTS, CAPABILITY_ENGINES, CAPABILITY_ENUM_VALUES, CAPABILITY_EVALUATE_SUBJECT, CAPABILITY_FEATURE_VALUES, CAPABILITY_FINAL_TIME, CAPABILITY_FUNCTION_VALUES, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, MissingCapabilityError, ServerInfo, requireCapability, upgradeRemedy, } from "./capabilities.js";
6
- export { ChecksumMismatchError, ClosedConnectionError, DownloadError, EvaluationError, InvalidRequestError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, ServiceError, ServiceStartError, ServiceTimeoutError, SymbolNotFoundError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, } from "./errors.js";
2
+ export type { ConnectionBackend, Encoding, ResponseTap, TransportOptions, VerifyArguments, VerifyOptions, } from "./connection.js";
3
+ export type { WasmHost } from "./wasm.js";
4
+ export { Instance, InstanceTree, Model, ModelSymbol, decodeDiagnostic } from "./model.js";
5
+ export type { AttributeFacts, EvalOptions, FeatureValue, Multiplicity, ParseOptions, SpecializationFacts, TypeFacts, } from "./model.js";
6
+ export { LANGUAGES, SourceDocument, sourceDocuments } from "./sources.js";
7
+ export type { Source } from "./sources.js";
8
+ export { Conversion, EXPERIMENTAL_NOTICE, FORMAT_API_JSON, FORMAT_SYSML, FORMAT_TURTLE, MIGRATED_NOT_CONVERTED, MIGRATION_NOTICE, Migration, MigrationReport, formatOfPath, isExperimental, isV1, migrationReportOf, pathIsV1, } from "./conversion.js";
9
+ export type { MigrateOptions, MigrationEntry } from "./conversion.js";
10
+ export { QueryElement, TYPE_COMPOSITE_CONSTRAINT, TYPE_PRIMITIVE_CONSTRAINT, TYPE_QUERY, buildQuery, } from "./query.js";
11
+ export type { ConstraintPayload, QueryForm, QueryPayload, ScopeEntry } from "./query.js";
12
+ export { DocumentQueryResult, DocumentRow, DocumentEvent, documentEventOf, DocumentState, DocumentVerdict, ElementRef, ObjectRef, buildBindings, } from "./document.js";
13
+ export type { BindingValues, DocumentValue } from "./document.js";
14
+ export type { RenderCanvas, RenderEdge, RenderGeometry, RenderNode, RenderNote, RenderPoint, RenderPort, RenderRow, RenderSpan, RenderStyle, RenderedView, } from "./render-view.js";
15
+ export type { Graphs } from "./graphs.js";
16
+ export { ENGINE_ALL, ENGINE_AUTO, STRENGTH_BOUNDED, STRENGTH_NOT_COVERED, STRENGTH_OBSERVED, STRENGTH_PROVED, STRENGTH_WITNESSED, engineInfoOf, explainEngine, explainStanding, standingOf, standingReached, standingReported, } from "./engines.js";
17
+ export type { EngineBound, EngineInfo, Standing } from "./engines.js";
18
+ export { Exploration, Outcome } from "./exploration.js";
19
+ export type { OutcomeValues } from "./exploration.js";
20
+ export { AppliedEdit, Body, EditedDocument, EditRequestBuilder, EditResult, Editor, editErrorOf, editResultOf, errorForFailure, failureName, referrersOf, } from "./edit.js";
21
+ export type { EditOperationData, EditTarget } from "./edit.js";
22
+ export { AnalysisResult, CalcResult, CaseEvaluation, KIND_ASSERTION, KIND_CONSTRAINT, KIND_OBJECT, KIND_OBJECTIVE, KIND_REQUIREMENT, KIND_SATISFY, QUESTION_EVALUATE, QUESTION_HOLDS, QUESTION_SATISFIABLE, STATUS_HOLDS, STATUS_SATISFIABLE, STATUS_UNDECIDED, STATUS_UNSATISFIABLE, STATUS_VIOLATED, SweepRow, SweepTable, Validation, VERDICT_ERROR, VERDICT_FAIL, VERDICT_INCONCLUSIVE, VERDICT_PASS, explainVerificationVerdict, explainVerdict, raiseVerdictError, verificationPassed, verdictEvaluated, verdictHolds, } from "./verdict.js";
23
+ export type { Verdict } from "./verdict.js";
24
+ export { CAPABILITY_APPLY_EDITS, CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING, CAPABILITY_CASE_EVALUATIONS, CAPABILITY_COMPLEX_VALUES, CAPABILITY_BIG_INT_VALUES, CAPABILITY_RATIONAL_VALUES, CAPABILITY_CONVERT, CAPABILITY_CONVERT_DOCUMENTS, CAPABILITY_CONVERT_COMPACT, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_MIGRATE, CAPABILITY_DIAGNOSTIC_CODES, CAPABILITY_EDIT_DOCUMENTS, CAPABILITY_ENGINES, CAPABILITY_ENUM_VALUES, CAPABILITY_EVALUATE_SUBJECT, CAPABILITY_FEATURE_VALUES, CAPABILITY_FINAL_TIME, CAPABILITY_FUNCTION_VALUES, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, CAPABILITY_AUTHORING, CAPABILITY_COMMENT_AUTHORING, CAPABILITY_CONNECTION_AUTHORING, CAPABILITY_CONSTRAINT_BODY_AUTHORING, CAPABILITY_DOCUMENTATION_AUTHORING, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_IMPLICIT_PARAMETERS, CAPABILITY_IMPORT_AUTHORING, CAPABILITY_MEMBER_MODIFIERS, CAPABILITY_METADATA_AUTHORING, CAPABILITY_METADATA_PREFIX_AUTHORING, CAPABILITY_PARSE_SOURCES, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, } from "./capabilities.js";
25
+ export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, MemberNameTakenError, MigrationError, MoveReferencedError, NoEditsError, OverlappingEditsError, OwnerInsideTargetError, OwnerNotFoundError, OwnerNotNamespaceError, ReferencedElsewhereError, Referrer, RenameReferencedError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, QueryError, ServiceError, ServiceStartError, ServiceTimeoutError, ServiceUnavailableError, StaleServiceError, SymbolNotFoundError, TypeMismatchError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, UnsupportedValueError, WrongKindError, } from "./errors.js";
7
26
  export type { FailureCause, ModelDiagnostic } from "./errors.js";
8
- export { fromHandshakeError, fromRpcError, statusName } from "./status.js";
9
- export type { NotFoundSubject } from "./status.js";
10
- export { decodeValue, decodeVerdict, decodeStanding, encodeValue, formatValue, valuesEqual, } from "./values.js";
11
- export type { ArrayValue, ComplexValue, EnumValue, FunctionValue, Magnitude, MeasurementRefValue, MetaobjectValue, QuantityValue, SysMLValue, SysMLVerdict, VerdictBound, VerdictStanding, TensorQuantityValue, UndeterminedValue, UnitFactor, UnitFactorization, VerdictSubject, } from "./values.js";
27
+ export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
28
+ export type { FeatureDecoder, InstanceResolver, Quantity, TypedObjectClass, } from "./typed.js";
29
+ export { callRpc, fromHandshakeError, fromRpcError, statusName } from "./status.js";
30
+ export type { NotFoundSubject, UnimplementedMapping } from "./status.js";
31
+ export { decodeValue, decodeVerdict, decodeStanding, encodeValue, formatRational, formatValue, rational, rationalOfDouble, rationalToNumber, rationalsAsReals, requireInput, toValue, valuesEqual, } from "./values.js";
32
+ export type { ArrayValue, ComplexValue, EnumValue, FunctionValue, Magnitude, MeasurementRefValue, MetaobjectValue, QuantityValue, RationalValue, SysMLValue, SysMLVerdict, ValueInput, VerdictBound, VerdictStanding, VerificationVerdict, WitnessAssignment, TensorQuantityValue, UndeterminedValue, UnitFactor, UnitFactorization, VerdictSubject, } from "./values.js";
12
33
  export { baseUrl } from "./transport.js";
13
34
  export { PACKAGE_NAME, PLATFORM_PACKAGE_PREFIX } from "./package.js";
14
35
  export { SysMLService } from "../generated/sysml_pb.js";
@@ -1,10 +1,19 @@
1
1
  // The isomorphic core: everything that does not need a process to spawn.
2
2
  export { Connection } from "./connection.js";
3
- export { Instance, InstanceTree, Model, ModelSymbol } from "./model.js";
4
- export { CAPABILITY_APPLY_EDITS, CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING, CAPABILITY_CASE_EVALUATIONS, CAPABILITY_COMPLEX_VALUES, CAPABILITY_CONVERT, CAPABILITY_DIAGNOSTIC_CODES, CAPABILITY_EDIT_DOCUMENTS, CAPABILITY_ENGINES, CAPABILITY_ENUM_VALUES, CAPABILITY_EVALUATE_SUBJECT, CAPABILITY_FEATURE_VALUES, CAPABILITY_FINAL_TIME, CAPABILITY_FUNCTION_VALUES, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, MissingCapabilityError, ServerInfo, requireCapability, upgradeRemedy, } from "./capabilities.js";
5
- export { ChecksumMismatchError, ClosedConnectionError, DownloadError, EvaluationError, InvalidRequestError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, ServiceError, ServiceStartError, ServiceTimeoutError, SymbolNotFoundError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, } from "./errors.js";
6
- export { fromHandshakeError, fromRpcError, statusName } from "./status.js";
7
- export { decodeValue, decodeVerdict, decodeStanding, encodeValue, formatValue, valuesEqual, } from "./values.js";
3
+ export { Instance, InstanceTree, Model, ModelSymbol, decodeDiagnostic } from "./model.js";
4
+ export { LANGUAGES, SourceDocument, sourceDocuments } from "./sources.js";
5
+ export { Conversion, EXPERIMENTAL_NOTICE, FORMAT_API_JSON, FORMAT_SYSML, FORMAT_TURTLE, MIGRATED_NOT_CONVERTED, MIGRATION_NOTICE, Migration, MigrationReport, formatOfPath, isExperimental, isV1, migrationReportOf, pathIsV1, } from "./conversion.js";
6
+ export { QueryElement, TYPE_COMPOSITE_CONSTRAINT, TYPE_PRIMITIVE_CONSTRAINT, TYPE_QUERY, buildQuery, } from "./query.js";
7
+ export { DocumentQueryResult, DocumentRow, DocumentEvent, documentEventOf, DocumentState, DocumentVerdict, ElementRef, ObjectRef, buildBindings, } from "./document.js";
8
+ export { ENGINE_ALL, ENGINE_AUTO, STRENGTH_BOUNDED, STRENGTH_NOT_COVERED, STRENGTH_OBSERVED, STRENGTH_PROVED, STRENGTH_WITNESSED, engineInfoOf, explainEngine, explainStanding, standingOf, standingReached, standingReported, } from "./engines.js";
9
+ export { Exploration, Outcome } from "./exploration.js";
10
+ export { AppliedEdit, Body, EditedDocument, EditRequestBuilder, EditResult, Editor, editErrorOf, editResultOf, errorForFailure, failureName, referrersOf, } from "./edit.js";
11
+ export { AnalysisResult, CalcResult, CaseEvaluation, KIND_ASSERTION, KIND_CONSTRAINT, KIND_OBJECT, KIND_OBJECTIVE, KIND_REQUIREMENT, KIND_SATISFY, QUESTION_EVALUATE, QUESTION_HOLDS, QUESTION_SATISFIABLE, STATUS_HOLDS, STATUS_SATISFIABLE, STATUS_UNDECIDED, STATUS_UNSATISFIABLE, STATUS_VIOLATED, SweepRow, SweepTable, Validation, VERDICT_ERROR, VERDICT_FAIL, VERDICT_INCONCLUSIVE, VERDICT_PASS, explainVerificationVerdict, explainVerdict, raiseVerdictError, verificationPassed, verdictEvaluated, verdictHolds, } from "./verdict.js";
12
+ export { CAPABILITY_APPLY_EDITS, CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING, CAPABILITY_CASE_EVALUATIONS, CAPABILITY_COMPLEX_VALUES, CAPABILITY_BIG_INT_VALUES, CAPABILITY_RATIONAL_VALUES, CAPABILITY_CONVERT, CAPABILITY_CONVERT_DOCUMENTS, CAPABILITY_CONVERT_COMPACT, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_MIGRATE, CAPABILITY_DIAGNOSTIC_CODES, CAPABILITY_EDIT_DOCUMENTS, CAPABILITY_ENGINES, CAPABILITY_ENUM_VALUES, CAPABILITY_EVALUATE_SUBJECT, CAPABILITY_FEATURE_VALUES, CAPABILITY_FINAL_TIME, CAPABILITY_FUNCTION_VALUES, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, CAPABILITY_AUTHORING, CAPABILITY_COMMENT_AUTHORING, CAPABILITY_CONNECTION_AUTHORING, CAPABILITY_CONSTRAINT_BODY_AUTHORING, CAPABILITY_DOCUMENTATION_AUTHORING, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_IMPLICIT_PARAMETERS, CAPABILITY_IMPORT_AUTHORING, CAPABILITY_MEMBER_MODIFIERS, CAPABILITY_METADATA_AUTHORING, CAPABILITY_METADATA_PREFIX_AUTHORING, CAPABILITY_PARSE_SOURCES, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, } from "./capabilities.js";
13
+ export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, MemberNameTakenError, MigrationError, MoveReferencedError, NoEditsError, OverlappingEditsError, OwnerInsideTargetError, OwnerNotFoundError, OwnerNotNamespaceError, ReferencedElsewhereError, Referrer, RenameReferencedError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, QueryError, ServiceError, ServiceStartError, ServiceTimeoutError, ServiceUnavailableError, StaleServiceError, SymbolNotFoundError, TypeMismatchError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, UnsupportedValueError, WrongKindError, } from "./errors.js";
14
+ export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
15
+ export { callRpc, fromHandshakeError, fromRpcError, statusName } from "./status.js";
16
+ export { decodeValue, decodeVerdict, decodeStanding, encodeValue, formatRational, formatValue, rational, rationalOfDouble, rationalToNumber, rationalsAsReals, requireInput, toValue, valuesEqual, } from "./values.js";
8
17
  export { baseUrl } from "./transport.js";
9
18
  export { PACKAGE_NAME, PLATFORM_PACKAGE_PREFIX } from "./package.js";
10
19
  export { SysMLService } from "../generated/sysml_pb.js";
@@ -1,14 +1,32 @@
1
- import type { Connection } from "./connection.js";
1
+ import type { Connection, VerifyOptions } from "./connection.js";
2
2
  import type { ModelDiagnostic } from "./errors.js";
3
- import type { Instance as PbInstance, ParseFileRequest, SymbolInfo } from "../generated/sysml_pb.js";
4
- import { type SysMLValue } from "./values.js";
3
+ import type { Conversion } from "./conversion.js";
4
+ import type { QueryForm, QueryElement, QueryPayload } from "./query.js";
5
+ import type { BindingValues, DocumentQueryResult } from "./document.js";
6
+ import type { RenderedView } from "./render-view.js";
7
+ import type { Graphs } from "./graphs.js";
8
+ import type { Editor } from "./edit.js";
9
+ import type { Exploration } from "./exploration.js";
10
+ import type { AnalysisResult, CalcResult, SweepTable, Validation, Verdict } from "./verdict.js";
11
+ import type { Diagnostic, Instance as PbInstance, ParseFileRequest, SymbolInfo } from "../generated/sysml_pb.js";
12
+ import { type SysMLValue, type ValueInput } from "./values.js";
5
13
  /** How a source is parsed. */
6
14
  export interface ParseOptions {
7
15
  /** Language of inline content ("sysml" or "kerml"); requires `inline_language`. */
8
16
  language?: string;
9
17
  /** Reject the OpenSysML notation extensions; requires `strict_conformance`. */
18
+ strictConformance?: boolean;
19
+ /**
20
+ * @deprecated Use `strictConformance`; `strict` is its alias. Passing both
21
+ * with different values is refused.
22
+ */
10
23
  strict?: boolean;
11
24
  }
25
+ /** Resolves `strictConformance` and its `strict` alias; differing values refuse. */
26
+ export declare function strictConformanceOf(options: {
27
+ strict?: boolean;
28
+ strictConformance?: boolean;
29
+ }): boolean | undefined;
12
30
  /** Where an expression is evaluated. */
13
31
  export interface EvalOptions {
14
32
  /** FQN of the symbol whose scope the expression's names resolve in. */
@@ -16,6 +34,15 @@ export interface EvalOptions {
16
34
  /** FQN of a usage to instantiate and evaluate against; requires `evaluate_subject`. */
17
35
  subject?: string;
18
36
  }
37
+ /** A declared multiplicity range. A bound the service could not evaluate is empty. */
38
+ export interface Multiplicity {
39
+ readonly lower: string;
40
+ readonly upper: string;
41
+ /** Whether the range admits no value; undefined when the lower bound is unknown. */
42
+ readonly isOptional: boolean | undefined;
43
+ /** Whether the range admits more than one value; undefined when the upper bound is unknown. */
44
+ readonly isCollection: boolean | undefined;
45
+ }
19
46
  /** A model the service has parsed and holds under its hash. */
20
47
  export declare class Model {
21
48
  readonly connection: Connection;
@@ -23,15 +50,33 @@ export declare class Model {
23
50
  readonly hash: string;
24
51
  /** Diagnostics the parse reported, in the order the service reported them. */
25
52
  readonly diagnostics: readonly ModelDiagnostic[];
26
- private readonly rootSymbol;
53
+ /** The name of each document this model was parsed from, empty for an adopted model. */
54
+ readonly documents: readonly string[];
55
+ private readonly rootSymbols;
27
56
  private readonly ownsConnection;
28
57
  private constructor();
29
58
  /** Adopts a model the service already holds, by the hash it holds it under. */
30
59
  static adopt(connection: Connection, hash: string): Model;
60
+ /** Builds a model of several roots, from a ParseSources response. */
61
+ static fromRoots(connection: Connection, hash: string, roots: readonly SymbolInfo[], diagnostics: readonly ModelDiagnostic[], options?: {
62
+ ownsConnection?: boolean;
63
+ documents?: readonly string[];
64
+ }): Model;
31
65
  /** Whether this model was parsed here, and so knows its root symbol. */
32
66
  get parsed(): boolean;
33
67
  /** The model's root namespace. An adopted model has none: look symbols up by id. */
34
68
  get root(): ModelSymbol;
69
+ /** One root per document parsed; the one symbol {@link root} names is the first. */
70
+ get roots(): readonly ModelSymbol[];
71
+ /** The path this model was loaded from, when it was parsed from a file;
72
+ * inline content and parseSources models have none, whatever they are named. */
73
+ readonly sourcePath: string | undefined;
74
+ /** The error-severity diagnostics the parse reported. */
75
+ get errors(): ModelDiagnostic[];
76
+ /** Whether the parse reported no error-severity diagnostic. */
77
+ get ok(): boolean;
78
+ /** Raises a {@link ParseError} carrying this model when its parse reported errors. */
79
+ raiseForErrors(): this;
35
80
  /** Parses a source over `connection`. Used by Connection.load / Connection.loads. */
36
81
  static parse(connection: Connection, source: Pick<ParseFileRequest, "source">, options?: ParseOptions, ownsConnection?: boolean): Promise<Model>;
37
82
  /** Whether the parse reported an error-severity diagnostic. */
@@ -40,6 +85,122 @@ export declare class Model {
40
85
  eval(expression: string, options?: EvalOptions): Promise<SysMLValue>;
41
86
  /** Looks a symbol up by short name, FQN or id; throws when the model declares none. */
42
87
  symbol(name: string): Promise<ModelSymbol>;
88
+ /** Writes this model out in `toFormat`. */
89
+ convert(toFormat: string, options?: {
90
+ fromFormat?: string;
91
+ tolerateSyntaxErrors?: boolean;
92
+ }): Promise<Conversion>;
93
+ /** This model written in SysML notation. */
94
+ toSysml(): Promise<Conversion>;
95
+ /** This model written as RDF Turtle. */
96
+ toTurtle(): Promise<Conversion>;
97
+ /** This model written as API JSON. */
98
+ toApiJson(): Promise<Conversion>;
99
+ /** Runs a SysML v2 API & Services Query over this model. */
100
+ query(options?: {
101
+ payload?: QueryPayload;
102
+ } & QueryForm): Promise<QueryElement[]>;
103
+ /** Runs a named document query against this model. */
104
+ runDocumentQuery(queryId: string, bindings?: Readonly<Record<string, BindingValues>>): Promise<DocumentQueryResult>;
105
+ /** Renders a named document of this model to Markdown or HTML. */
106
+ renderDocument(documentId: string, options?: {
107
+ form?: "markdown" | "html";
108
+ }): Promise<string>;
109
+ /** Renders a named view or targeted pseudo-view as diagram data. */
110
+ renderView(viewName: string, options?: {
111
+ ports?: "minimal" | "full";
112
+ }): Promise<RenderedView>;
113
+ /** Exports the lowered graph of an action or state machine of this model as `graphs:1` JSON. */
114
+ exportGraphs(subject: string): Promise<Graphs>;
115
+ /** Starts an edit of this model, to be applied in one call. */
116
+ edit(): Editor;
117
+ /** Executes an action definition of this model. */
118
+ executeAction(actionSymbolId: string, options?: {
119
+ inputs?: Readonly<Record<string, ValueInput>>;
120
+ schedule?: string;
121
+ performer?: string;
122
+ }): Promise<{
123
+ outputs: ReadonlyMap<string, SysMLValue | import("./errors.js").UnsupportedValueError>;
124
+ performer: ReadonlyMap<string, SysMLValue | import("./errors.js").UnsupportedValueError>;
125
+ finalTime: number;
126
+ }>;
127
+ /** Runs an action once per valid order of its choice points. */
128
+ exploreAction(actionSymbolId: string, options?: {
129
+ inputs?: Readonly<Record<string, ValueInput>>;
130
+ schedule?: string;
131
+ performer?: string;
132
+ }): Promise<Exploration>;
133
+ /** Executes a state machine of this model. */
134
+ executeState(stateMachineSymbolId: string, options?: {
135
+ events?: readonly string[];
136
+ schedule?: string;
137
+ performer?: string;
138
+ trace?: boolean;
139
+ }): Promise<{
140
+ statesVisited: string[];
141
+ finalContext: ReadonlyMap<string, SysMLValue | import("./errors.js").UnsupportedValueError>;
142
+ finalTime: number;
143
+ trace: import("./document.js").DocumentEvent[];
144
+ traceDropped: number;
145
+ }>;
146
+ /** Runs a state machine once per valid order of its choice points. */
147
+ exploreState(stateMachineSymbolId: string, options?: {
148
+ events?: readonly string[];
149
+ schedule?: string;
150
+ performer?: string;
151
+ }): Promise<Exploration>;
152
+ /** Asks whether a constraint of this model holds. */
153
+ verifyConstraint(symbolId: string, options?: VerifyOptions): Promise<Verdict>;
154
+ /** Asks whether a requirement of this model is satisfied. */
155
+ verifyRequirement(symbolId: string, options?: VerifyOptions): Promise<Verdict>;
156
+ /** Asks whether this model's satisfaction assertions hold. */
157
+ verifySatisfaction(options?: {
158
+ symbolId?: string;
159
+ engine?: string;
160
+ question?: string;
161
+ }): Promise<Verdict[]>;
162
+ /** Whether every verdict {@link verifySatisfaction} returns holds. */
163
+ satisfied(options?: {
164
+ symbolId?: string;
165
+ engine?: string;
166
+ question?: string;
167
+ }): Promise<boolean>;
168
+ /** Checks every assertion about an object of this model's parts. */
169
+ validateInstance(symbolId: string, options?: {
170
+ engine?: string;
171
+ }): Promise<Validation>;
172
+ /** Invokes a calculation of this model. */
173
+ calc(symbolId: string, options?: {
174
+ arguments?: readonly ValueInput[];
175
+ engine?: string;
176
+ }): Promise<CalcResult>;
177
+ /** Runs an analysis case of this model. */
178
+ runAnalysis(symbolId: string, options?: {
179
+ subject?: string;
180
+ arguments?: readonly ValueInput[];
181
+ namedArguments?: Readonly<Record<string, ValueInput>>;
182
+ schedule?: string;
183
+ engine?: string;
184
+ }): Promise<AnalysisResult>;
185
+ /** Runs an analysis case once per valid order of its choice points. */
186
+ exploreAnalysis(symbolId: string, options?: {
187
+ subject?: string;
188
+ arguments?: readonly ValueInput[];
189
+ namedArguments?: Readonly<Record<string, ValueInput>>;
190
+ schedule?: string;
191
+ }): Promise<Exploration>;
192
+ /** Runs an analysis case or calc of this model once per row of a sweep. */
193
+ runSweep(symbolId: string, ranges: Readonly<Record<string, readonly [ValueInput, ValueInput] | readonly [ValueInput, ValueInput, ValueInput]>>, options?: {
194
+ subject?: string;
195
+ arguments?: readonly ValueInput[];
196
+ namedArguments?: Readonly<Record<string, ValueInput>>;
197
+ samples?: bigint | number;
198
+ seed?: bigint | number;
199
+ engine?: string;
200
+ }): Promise<SweepTable>;
201
+ /** The diagnostics the service reports for this model now — for a model of
202
+ * several documents, or one parsed before later edits changed it. */
203
+ refreshDiagnostics(): Promise<ModelDiagnostic[]>;
43
204
  /** Looks a symbol up by its qualified name, in one call. */
44
205
  symbolById(id: string): Promise<ModelSymbol>;
45
206
  /** Looks a symbol up by short name, FQN or id, breadth-first from the root. */
@@ -89,10 +250,7 @@ export declare class ModelSymbol {
89
250
  readonly childIds: readonly string[];
90
251
  readonly attributes: readonly AttributeFacts[];
91
252
  readonly type: TypeFacts | undefined;
92
- readonly multiplicity: {
93
- lower: string;
94
- upper: string;
95
- } | undefined;
253
+ readonly multiplicity: Multiplicity | undefined;
96
254
  readonly specializations: readonly SpecializationFacts[];
97
255
  /** Library attributes the service did not send, when it withheld any. */
98
256
  readonly withheldLibraryAttributes: number;
@@ -137,3 +295,5 @@ export declare class InstanceTree {
137
295
  /** The object with this id, or undefined when the instantiation produced none. */
138
296
  byId(id: bigint): Instance | undefined;
139
297
  }
298
+ /** Reads a wire `Diagnostic` into this client's own {@link ModelDiagnostic}. */
299
+ export declare function decodeDiagnostic(diagnostic: Diagnostic): ModelDiagnostic;