@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
|
@@ -35,34 +35,99 @@ export declare const CAPABILITY_FINAL_TIME = "final_time";
|
|
|
35
35
|
export declare const CAPABILITY_INLINE_LANGUAGE = "inline_language";
|
|
36
36
|
/** `ParseFileRequest.strict_conformance`. */
|
|
37
37
|
export declare const CAPABILITY_STRICT_CONFORMANCE = "strict_conformance";
|
|
38
|
-
/** The `Convert` RPC.
|
|
38
|
+
/** The `Convert` RPC. */
|
|
39
39
|
export declare const CAPABILITY_CONVERT = "convert";
|
|
40
|
-
/** The
|
|
40
|
+
/** The `Migrate` RPC, which migrates a SysML v1 model. */
|
|
41
|
+
export declare const CAPABILITY_MIGRATE = "migrate";
|
|
42
|
+
/** The verification RPCs. */
|
|
41
43
|
export declare const CAPABILITY_VERIFICATION = "verification";
|
|
44
|
+
/** The `question` field of the verification RPCs. */
|
|
45
|
+
export declare const CAPABILITY_VERIFICATION_QUESTIONS = "verification_questions";
|
|
46
|
+
/** `arguments` and `named_arguments` on VerifyConstraint and VerifyRequirement. */
|
|
47
|
+
export declare const CAPABILITY_VERIFICATION_ARGUMENTS = "verification_arguments";
|
|
48
|
+
/** The `Query` RPC. */
|
|
49
|
+
export declare const CAPABILITY_QUERY = "query";
|
|
50
|
+
/** The `RunDocumentQuery` RPC. */
|
|
51
|
+
export declare const CAPABILITY_DOCUMENT_QUERY = "document_query";
|
|
52
|
+
/** The `RenderDocument` RPC. */
|
|
53
|
+
export declare const CAPABILITY_RENDER_DOCUMENT = "render_document";
|
|
54
|
+
/** `form` on `RenderDocumentRequest` asking for HTML rather than Markdown. */
|
|
55
|
+
export declare const CAPABILITY_RENDER_DOCUMENT_HTML = "render_document_html";
|
|
56
|
+
/** The `RenderView` RPC, returning typed diagram data. */
|
|
57
|
+
export declare const CAPABILITY_RENDER_VIEW = "render_view";
|
|
58
|
+
/** The `ExportGraphs` RPC, exporting a behavior's lowered graph as `graphs:1` JSON. */
|
|
59
|
+
export declare const CAPABILITY_EXPORT_GRAPHS = "export_graphs";
|
|
42
60
|
/** What the body of a verification case answered, as `verification_verdicts`. */
|
|
43
61
|
export declare const CAPABILITY_VERIFICATION_VERDICTS = "verification_verdicts";
|
|
44
62
|
/** `RunAnalysisResponse.evaluations`: each call the run made to a calc held as a value, such as a trade study's evaluation of every alternative. */
|
|
45
63
|
export declare const CAPABILITY_CASE_EVALUATIONS = "case_evaluations";
|
|
46
|
-
/** The `
|
|
47
|
-
export declare const CAPABILITY_QUERY = "query";
|
|
48
|
-
/** The `ApplyEdits` RPC. Not used by this version; see the README. */
|
|
64
|
+
/** The `ApplyEdits` RPC. */
|
|
49
65
|
export declare const CAPABILITY_APPLY_EDITS = "apply_edits";
|
|
66
|
+
/** Source-preserving add-member and delete authoring operations. */
|
|
67
|
+
export declare const CAPABILITY_AUTHORING = "authoring";
|
|
68
|
+
/** The `ApplyEdits` `add_connection` operation. */
|
|
69
|
+
export declare const CAPABILITY_CONNECTION_AUTHORING = "connection_authoring";
|
|
70
|
+
/** The `ApplyEdits` `add_satisfy` operation. */
|
|
71
|
+
export declare const CAPABILITY_SATISFY_AUTHORING = "satisfy_authoring";
|
|
72
|
+
/** The `ApplyEdits` `add_requirement_constraint` operation. */
|
|
73
|
+
export declare const CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING = "requirement_constraint_authoring";
|
|
74
|
+
/** The `ApplyEdits` `add_transition` operation. */
|
|
75
|
+
export declare const CAPABILITY_TRANSITION_AUTHORING = "transition_authoring";
|
|
76
|
+
/** The `ApplyEdits` `add_verify` operation and anonymous objectives. */
|
|
77
|
+
export declare const CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING = "verification_objective_authoring";
|
|
78
|
+
/** The `ApplyEdits` `add_metadata` operation. */
|
|
79
|
+
export declare const CAPABILITY_METADATA_AUTHORING = "metadata_authoring";
|
|
80
|
+
/** `ApplyEdits` metadata prefixes. */
|
|
81
|
+
export declare const CAPABILITY_METADATA_PREFIX_AUTHORING = "metadata_prefix_authoring";
|
|
50
82
|
/** `ApplyEdits` can add `first`/`then` action sequencing members. */
|
|
51
83
|
export declare const CAPABILITY_SEQUENCE_AUTHORING = "sequence_authoring";
|
|
52
84
|
/** `ApplyEdits` can add action-body statements and succession source multiplicities. */
|
|
53
85
|
export declare const CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING = "action_body_statement_authoring";
|
|
86
|
+
/** The `ApplyEdits` `add_import` operation. */
|
|
87
|
+
export declare const CAPABILITY_IMPORT_AUTHORING = "import_authoring";
|
|
88
|
+
/** The `ApplyEdits` `add_documentation` operation and `AddMemberEdit.doc`. */
|
|
89
|
+
export declare const CAPABILITY_DOCUMENTATION_AUTHORING = "documentation_authoring";
|
|
90
|
+
/** The `ApplyEdits` `add_comment` and `add_note` operations. */
|
|
91
|
+
export declare const CAPABILITY_COMMENT_AUTHORING = "comment_authoring";
|
|
92
|
+
/** The additional `AddMemberEdit` modifiers and `ref`/`return` kinds. */
|
|
93
|
+
export declare const CAPABILITY_MEMBER_MODIFIERS = "member_modifiers";
|
|
94
|
+
/** `ApplyEdits` adds a directed usage with no kind keyword (`in x : T;`). */
|
|
95
|
+
export declare const CAPABILITY_IMPLICIT_PARAMETERS = "implicit_parameters";
|
|
96
|
+
/** Constraint body expressions and asserted constraints in `ApplyEdits`. */
|
|
97
|
+
export declare const CAPABILITY_CONSTRAINT_BODY_AUTHORING = "constraint_body_authoring";
|
|
98
|
+
/** State behavior member kinds in `ApplyEdits`. */
|
|
99
|
+
export declare const CAPABILITY_STATE_ACTION_AUTHORING = "state_action_authoring";
|
|
54
100
|
/** `ApplyEdits` edits a model of several documents as one batch and answers each edited document by name in `documents`. Not used by this version; see the README. */
|
|
55
101
|
export declare const CAPABILITY_EDIT_DOCUMENTS = "edit_documents";
|
|
56
|
-
/**
|
|
102
|
+
/** `ParseSources`, parsing several named documents as one model. */
|
|
103
|
+
export declare const CAPABILITY_PARSE_SOURCES = "parse_sources";
|
|
104
|
+
/** The `schedule` field of the execution requests, naming the scheduling policy. */
|
|
57
105
|
export declare const CAPABILITY_SCHEDULE = "schedule";
|
|
58
|
-
/** The `explore` scheduling policy, answering with every `outcomes` entry and an `exploration` status.
|
|
106
|
+
/** The `explore` scheduling policy, answering with every `outcomes` entry and an `exploration` status. */
|
|
59
107
|
export declare const CAPABILITY_SCHEDULE_EXPLORE = "schedule_explore";
|
|
60
|
-
/** `performerSymbolId` on the action and state requests: the object the behavior runs on, a declaration or a path from one into its parts.
|
|
108
|
+
/** `performerSymbolId` on the action and state requests: the object the behavior runs on, a declaration or a path from one into its parts. */
|
|
61
109
|
export declare const CAPABILITY_PERFORMER = "performer";
|
|
62
|
-
/**
|
|
110
|
+
/** `trace` on `ExecuteStateRequest`, returning documented events from one run. */
|
|
111
|
+
export declare const CAPABILITY_STATE_TRACE = "state_trace";
|
|
112
|
+
/** The `ListEngines` RPC, the `engine` field selecting an analysis engine, and `engine`, `strength` and `bounds` on the answers. */
|
|
63
113
|
export declare const CAPABILITY_ENGINES = "engines";
|
|
64
114
|
/** A model-level result the model leaves open as `Value.undetermined`, read as an `undetermined` value. */
|
|
65
115
|
export declare const CAPABILITY_UNDETERMINED_VALUE = "undetermined_value";
|
|
116
|
+
/** An Integer beyond int64 as `Value.bigIntValue`, `Quantity.bigIntMagnitude` and `DocumentValue.bigIntValue`; a service without it reads one sent to it as null. */
|
|
117
|
+
export declare const CAPABILITY_BIG_INT_VALUES = "big_int_values";
|
|
118
|
+
/** An exact Rational no double holds as `Value.rationalValue`, `Quantity.rationalMagnitude` and `DocumentValue.rationalValue`; a service without it reads one sent to it as null. */
|
|
119
|
+
export declare const CAPABILITY_RATIONAL_VALUES = "rational_values";
|
|
120
|
+
/** `ConvertRequest.documents`: a model converted with only the named documents written, the references into the others linked by id. */
|
|
121
|
+
export declare const CAPABILITY_CONVERT_DOCUMENTS = "convert_documents";
|
|
122
|
+
/** `ConvertRequest.compact`, `omitDerived` and `keepDerived`: api-json written as the compact document (an id table and handles), optionally without derived properties. */
|
|
123
|
+
export declare const CAPABILITY_CONVERT_COMPACT = "convert_compact";
|
|
124
|
+
/** `ParseSourcesRequest.baseModelHash` and `ParseSourcesResponse.affected`: the documents whose results may differ from the base model's, so a client re-reads only those after an edit. */
|
|
125
|
+
export declare const CAPABILITY_PARSE_SOURCES_AFFECTED = "parse_sources_affected";
|
|
126
|
+
/**
|
|
127
|
+
* Orders capability names by code unit, the order the service reports them in.
|
|
128
|
+
* Locale-aware collation ignores the underscores that separate their words.
|
|
129
|
+
*/
|
|
130
|
+
export declare function byCodeUnit(a: string, b: string): number;
|
|
66
131
|
/** Self-description of the service a connection talks to. */
|
|
67
132
|
export declare class ServerInfo {
|
|
68
133
|
/** Version the service reports. Informational only; empty when unanswered. */
|
|
@@ -92,3 +157,19 @@ export declare class MissingCapabilityError extends OpenSysMLError {
|
|
|
92
157
|
export declare function requireCapability(info: ServerInfo, capability: string, remedy: string): void;
|
|
93
158
|
/** Remedy text for a service that lacks `capability`, naming both routes to one that has it. */
|
|
94
159
|
export declare function upgradeRemedy(capability: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* Why `info` is not the service that was asked for, or undefined when it is. A
|
|
162
|
+
* release is compared as an exact tag: a build that cannot be shown to be the
|
|
163
|
+
* one asked for is a mismatch.
|
|
164
|
+
*/
|
|
165
|
+
export declare function mismatchReason(info: ServerInfo, options?: {
|
|
166
|
+
version?: string;
|
|
167
|
+
capabilities?: Iterable<string>;
|
|
168
|
+
}): string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* The UNIMPLEMENTED translator for a call whose capabilities were checked
|
|
171
|
+
* before it was sent: a refusal the service still answers with is mapped back
|
|
172
|
+
* to the capability it names — the first one present in its message — rather
|
|
173
|
+
* than arriving as a generic unsupported-operation error.
|
|
174
|
+
*/
|
|
175
|
+
export declare function capabilityRefusal(info: ServerInfo, capabilities: readonly string[]): ((details: string) => MissingCapabilityError) | undefined;
|
|
@@ -39,39 +39,99 @@ export const CAPABILITY_FINAL_TIME = "final_time";
|
|
|
39
39
|
export const CAPABILITY_INLINE_LANGUAGE = "inline_language";
|
|
40
40
|
/** `ParseFileRequest.strict_conformance`. */
|
|
41
41
|
export const CAPABILITY_STRICT_CONFORMANCE = "strict_conformance";
|
|
42
|
-
/** The `Convert` RPC.
|
|
42
|
+
/** The `Convert` RPC. */
|
|
43
43
|
export const CAPABILITY_CONVERT = "convert";
|
|
44
|
-
/** The
|
|
44
|
+
/** The `Migrate` RPC, which migrates a SysML v1 model. */
|
|
45
|
+
export const CAPABILITY_MIGRATE = "migrate";
|
|
46
|
+
/** The verification RPCs. */
|
|
45
47
|
export const CAPABILITY_VERIFICATION = "verification";
|
|
48
|
+
/** The `question` field of the verification RPCs. */
|
|
49
|
+
export const CAPABILITY_VERIFICATION_QUESTIONS = "verification_questions";
|
|
50
|
+
/** `arguments` and `named_arguments` on VerifyConstraint and VerifyRequirement. */
|
|
51
|
+
export const CAPABILITY_VERIFICATION_ARGUMENTS = "verification_arguments";
|
|
52
|
+
/** The `Query` RPC. */
|
|
53
|
+
export const CAPABILITY_QUERY = "query";
|
|
54
|
+
/** The `RunDocumentQuery` RPC. */
|
|
55
|
+
export const CAPABILITY_DOCUMENT_QUERY = "document_query";
|
|
56
|
+
/** The `RenderDocument` RPC. */
|
|
57
|
+
export const CAPABILITY_RENDER_DOCUMENT = "render_document";
|
|
58
|
+
/** `form` on `RenderDocumentRequest` asking for HTML rather than Markdown. */
|
|
59
|
+
export const CAPABILITY_RENDER_DOCUMENT_HTML = "render_document_html";
|
|
60
|
+
/** The `RenderView` RPC, returning typed diagram data. */
|
|
61
|
+
export const CAPABILITY_RENDER_VIEW = "render_view";
|
|
62
|
+
/** The `ExportGraphs` RPC, exporting a behavior's lowered graph as `graphs:1` JSON. */
|
|
63
|
+
export const CAPABILITY_EXPORT_GRAPHS = "export_graphs";
|
|
46
64
|
/** What the body of a verification case answered, as `verification_verdicts`. */
|
|
47
65
|
export const CAPABILITY_VERIFICATION_VERDICTS = "verification_verdicts";
|
|
48
66
|
/** `RunAnalysisResponse.evaluations`: each call the run made to a calc held as a value, such as a trade study's evaluation of every alternative. */
|
|
49
67
|
export const CAPABILITY_CASE_EVALUATIONS = "case_evaluations";
|
|
50
|
-
/** The `
|
|
51
|
-
export const CAPABILITY_QUERY = "query";
|
|
52
|
-
/** The `ApplyEdits` RPC. Not used by this version; see the README. */
|
|
68
|
+
/** The `ApplyEdits` RPC. */
|
|
53
69
|
export const CAPABILITY_APPLY_EDITS = "apply_edits";
|
|
70
|
+
/** Source-preserving add-member and delete authoring operations. */
|
|
71
|
+
export const CAPABILITY_AUTHORING = "authoring";
|
|
72
|
+
/** The `ApplyEdits` `add_connection` operation. */
|
|
73
|
+
export const CAPABILITY_CONNECTION_AUTHORING = "connection_authoring";
|
|
74
|
+
/** The `ApplyEdits` `add_satisfy` operation. */
|
|
75
|
+
export const CAPABILITY_SATISFY_AUTHORING = "satisfy_authoring";
|
|
76
|
+
/** The `ApplyEdits` `add_requirement_constraint` operation. */
|
|
77
|
+
export const CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING = "requirement_constraint_authoring";
|
|
78
|
+
/** The `ApplyEdits` `add_transition` operation. */
|
|
79
|
+
export const CAPABILITY_TRANSITION_AUTHORING = "transition_authoring";
|
|
80
|
+
/** The `ApplyEdits` `add_verify` operation and anonymous objectives. */
|
|
81
|
+
export const CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING = "verification_objective_authoring";
|
|
82
|
+
/** The `ApplyEdits` `add_metadata` operation. */
|
|
83
|
+
export const CAPABILITY_METADATA_AUTHORING = "metadata_authoring";
|
|
84
|
+
/** `ApplyEdits` metadata prefixes. */
|
|
85
|
+
export const CAPABILITY_METADATA_PREFIX_AUTHORING = "metadata_prefix_authoring";
|
|
54
86
|
/** `ApplyEdits` can add `first`/`then` action sequencing members. */
|
|
55
87
|
export const CAPABILITY_SEQUENCE_AUTHORING = "sequence_authoring";
|
|
56
88
|
/** `ApplyEdits` can add action-body statements and succession source multiplicities. */
|
|
57
89
|
export const CAPABILITY_ACTION_BODY_STATEMENT_AUTHORING = "action_body_statement_authoring";
|
|
90
|
+
/** The `ApplyEdits` `add_import` operation. */
|
|
91
|
+
export const CAPABILITY_IMPORT_AUTHORING = "import_authoring";
|
|
92
|
+
/** The `ApplyEdits` `add_documentation` operation and `AddMemberEdit.doc`. */
|
|
93
|
+
export const CAPABILITY_DOCUMENTATION_AUTHORING = "documentation_authoring";
|
|
94
|
+
/** The `ApplyEdits` `add_comment` and `add_note` operations. */
|
|
95
|
+
export const CAPABILITY_COMMENT_AUTHORING = "comment_authoring";
|
|
96
|
+
/** The additional `AddMemberEdit` modifiers and `ref`/`return` kinds. */
|
|
97
|
+
export const CAPABILITY_MEMBER_MODIFIERS = "member_modifiers";
|
|
98
|
+
/** `ApplyEdits` adds a directed usage with no kind keyword (`in x : T;`). */
|
|
99
|
+
export const CAPABILITY_IMPLICIT_PARAMETERS = "implicit_parameters";
|
|
100
|
+
/** Constraint body expressions and asserted constraints in `ApplyEdits`. */
|
|
101
|
+
export const CAPABILITY_CONSTRAINT_BODY_AUTHORING = "constraint_body_authoring";
|
|
102
|
+
/** State behavior member kinds in `ApplyEdits`. */
|
|
103
|
+
export const CAPABILITY_STATE_ACTION_AUTHORING = "state_action_authoring";
|
|
58
104
|
/** `ApplyEdits` edits a model of several documents as one batch and answers each edited document by name in `documents`. Not used by this version; see the README. */
|
|
59
105
|
export const CAPABILITY_EDIT_DOCUMENTS = "edit_documents";
|
|
60
|
-
/**
|
|
106
|
+
/** `ParseSources`, parsing several named documents as one model. */
|
|
107
|
+
export const CAPABILITY_PARSE_SOURCES = "parse_sources";
|
|
108
|
+
/** The `schedule` field of the execution requests, naming the scheduling policy. */
|
|
61
109
|
export const CAPABILITY_SCHEDULE = "schedule";
|
|
62
|
-
/** The `explore` scheduling policy, answering with every `outcomes` entry and an `exploration` status.
|
|
110
|
+
/** The `explore` scheduling policy, answering with every `outcomes` entry and an `exploration` status. */
|
|
63
111
|
export const CAPABILITY_SCHEDULE_EXPLORE = "schedule_explore";
|
|
64
|
-
/** `performerSymbolId` on the action and state requests: the object the behavior runs on, a declaration or a path from one into its parts.
|
|
112
|
+
/** `performerSymbolId` on the action and state requests: the object the behavior runs on, a declaration or a path from one into its parts. */
|
|
65
113
|
export const CAPABILITY_PERFORMER = "performer";
|
|
66
|
-
/**
|
|
114
|
+
/** `trace` on `ExecuteStateRequest`, returning documented events from one run. */
|
|
115
|
+
export const CAPABILITY_STATE_TRACE = "state_trace";
|
|
116
|
+
/** The `ListEngines` RPC, the `engine` field selecting an analysis engine, and `engine`, `strength` and `bounds` on the answers. */
|
|
67
117
|
export const CAPABILITY_ENGINES = "engines";
|
|
68
118
|
/** A model-level result the model leaves open as `Value.undetermined`, read as an `undetermined` value. */
|
|
69
119
|
export const CAPABILITY_UNDETERMINED_VALUE = "undetermined_value";
|
|
120
|
+
/** An Integer beyond int64 as `Value.bigIntValue`, `Quantity.bigIntMagnitude` and `DocumentValue.bigIntValue`; a service without it reads one sent to it as null. */
|
|
121
|
+
export const CAPABILITY_BIG_INT_VALUES = "big_int_values";
|
|
122
|
+
/** An exact Rational no double holds as `Value.rationalValue`, `Quantity.rationalMagnitude` and `DocumentValue.rationalValue`; a service without it reads one sent to it as null. */
|
|
123
|
+
export const CAPABILITY_RATIONAL_VALUES = "rational_values";
|
|
124
|
+
/** `ConvertRequest.documents`: a model converted with only the named documents written, the references into the others linked by id. */
|
|
125
|
+
export const CAPABILITY_CONVERT_DOCUMENTS = "convert_documents";
|
|
126
|
+
/** `ConvertRequest.compact`, `omitDerived` and `keepDerived`: api-json written as the compact document (an id table and handles), optionally without derived properties. */
|
|
127
|
+
export const CAPABILITY_CONVERT_COMPACT = "convert_compact";
|
|
128
|
+
/** `ParseSourcesRequest.baseModelHash` and `ParseSourcesResponse.affected`: the documents whose results may differ from the base model's, so a client re-reads only those after an edit. */
|
|
129
|
+
export const CAPABILITY_PARSE_SOURCES_AFFECTED = "parse_sources_affected";
|
|
70
130
|
/**
|
|
71
131
|
* Orders capability names by code unit, the order the service reports them in.
|
|
72
132
|
* Locale-aware collation ignores the underscores that separate their words.
|
|
73
133
|
*/
|
|
74
|
-
function byCodeUnit(a, b) {
|
|
134
|
+
export function byCodeUnit(a, b) {
|
|
75
135
|
if (a < b) {
|
|
76
136
|
return -1;
|
|
77
137
|
}
|
|
@@ -128,3 +188,44 @@ export function upgradeRemedy(capability) {
|
|
|
128
188
|
`newer ${PLATFORM_PACKAGE_PREFIX}<platform> package, point $OPENSYSML_BINARY at a build that ` +
|
|
129
189
|
`has it, or start one yourself and connect to its address`);
|
|
130
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Why `info` is not the service that was asked for, or undefined when it is. A
|
|
193
|
+
* release is compared as an exact tag: a build that cannot be shown to be the
|
|
194
|
+
* one asked for is a mismatch.
|
|
195
|
+
*/
|
|
196
|
+
export function mismatchReason(info, options = {}) {
|
|
197
|
+
const reasons = [];
|
|
198
|
+
if (options.version !== undefined) {
|
|
199
|
+
if (!info.answered) {
|
|
200
|
+
reasons.push(`it did not answer GetServerInfo, so it cannot be shown to be the ${options.version} ` +
|
|
201
|
+
`that was asked for`);
|
|
202
|
+
}
|
|
203
|
+
else if (info.version !== options.version) {
|
|
204
|
+
reasons.push(`it reports version ${info.version === "" ? "unknown" : info.version}, but ` +
|
|
205
|
+
`${options.version} was asked for`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const missing = [...(options.capabilities ?? [])].filter((capability) => !info.has(capability));
|
|
209
|
+
missing.sort(byCodeUnit);
|
|
210
|
+
if (missing.length > 0) {
|
|
211
|
+
const named = missing.map((capability) => JSON.stringify(capability)).join(", ");
|
|
212
|
+
const noun = missing.length > 1 ? "capabilities" : "capability";
|
|
213
|
+
reasons.push(`it does not report the ${named} ${noun} this client requires`);
|
|
214
|
+
}
|
|
215
|
+
return reasons.length === 0 ? undefined : reasons.join("; ");
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The UNIMPLEMENTED translator for a call whose capabilities were checked
|
|
219
|
+
* before it was sent: a refusal the service still answers with is mapped back
|
|
220
|
+
* to the capability it names — the first one present in its message — rather
|
|
221
|
+
* than arriving as a generic unsupported-operation error.
|
|
222
|
+
*/
|
|
223
|
+
export function capabilityRefusal(info, capabilities) {
|
|
224
|
+
if (capabilities.length === 0) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
return (details) => {
|
|
228
|
+
const capability = capabilities.find((name) => details.includes(name)) ?? capabilities[0];
|
|
229
|
+
return new MissingCapabilityError(capability, info, upgradeRemedy(capability));
|
|
230
|
+
};
|
|
231
|
+
}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { type Client, type Transport } from "@connectrpc/connect";
|
|
2
2
|
import { ServerInfo } from "./capabilities.js";
|
|
3
|
-
import {
|
|
3
|
+
import { UnsupportedValueError } from "./errors.js";
|
|
4
|
+
import { SysMLService, type EditOperation } from "../generated/sysml_pb.js";
|
|
4
5
|
import { Model } from "./model.js";
|
|
5
6
|
import type { ParseOptions } from "./model.js";
|
|
7
|
+
import { type Source } from "./sources.js";
|
|
8
|
+
import { Conversion, Migration } from "./conversion.js";
|
|
9
|
+
import type { MigrateOptions } from "./conversion.js";
|
|
10
|
+
import { type QueryElement, type QueryForm, type QueryPayload } from "./query.js";
|
|
11
|
+
import { DocumentEvent, type BindingValues, type DocumentQueryResult } from "./document.js";
|
|
12
|
+
import { type RenderedView } from "./render-view.js";
|
|
13
|
+
import { type Graphs } from "./graphs.js";
|
|
14
|
+
import { type EngineInfo } from "./engines.js";
|
|
15
|
+
import { Exploration } from "./exploration.js";
|
|
16
|
+
import { CalcResult, type AnalysisResult, type SweepTable, type Validation, type Verdict } from "./verdict.js";
|
|
17
|
+
import { type SysMLValue, type ValueInput } from "./values.js";
|
|
18
|
+
import { Editor, type EditOperationData, type EditResult } from "./edit.js";
|
|
6
19
|
/** Wire encoding of the request and response bodies. Protobuf is the default. */
|
|
7
20
|
export type Encoding = "protobuf" | "json";
|
|
8
21
|
/** Observability hook: called with every response the service returns. */
|
|
@@ -32,8 +45,29 @@ export interface ConnectionBackend {
|
|
|
32
45
|
readonly origin: string;
|
|
33
46
|
/** Releases this connection's hold. Never stops a service the client did not start. */
|
|
34
47
|
release(): Promise<void>;
|
|
48
|
+
/** Reports a warning the runtime raises: Node emits it, the browser logs it. */
|
|
49
|
+
warn?(message: string, type: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* Makes a path the caller handed this client absolute, so that what a
|
|
52
|
+
* `Migration` remembers as its source outlives a later change of working
|
|
53
|
+
* directory. Absent where paths have no working directory, as in a browser.
|
|
54
|
+
*/
|
|
55
|
+
resolvePath?(path: string): string;
|
|
35
56
|
}
|
|
36
57
|
/** A connection to a sysml-grpc service. Close it, or use `await using`. */
|
|
58
|
+
/** Argument bindings for a constraint's or requirement's `in` parameters. */
|
|
59
|
+
export interface VerifyArguments {
|
|
60
|
+
/** Positional arguments, bound in declaration order. */
|
|
61
|
+
arguments?: readonly ValueInput[];
|
|
62
|
+
/** Arguments by parameter name. */
|
|
63
|
+
namedArguments?: Readonly<Record<string, ValueInput>>;
|
|
64
|
+
}
|
|
65
|
+
/** Options of verifyConstraint and verifyRequirement. */
|
|
66
|
+
export interface VerifyOptions extends VerifyArguments {
|
|
67
|
+
subject?: string;
|
|
68
|
+
engine?: string;
|
|
69
|
+
question?: string;
|
|
70
|
+
}
|
|
37
71
|
export declare class Connection {
|
|
38
72
|
/**
|
|
39
73
|
* The generated Connect client. The ergonomic API covers what this version
|
|
@@ -46,12 +80,25 @@ export declare class Connection {
|
|
|
46
80
|
private readonly timeoutMs;
|
|
47
81
|
private closed;
|
|
48
82
|
private constructor();
|
|
49
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* Opens a connection over `transport` and performs the capability handshake.
|
|
85
|
+
* A refused handshake — the service is not the release asked for, or lacks a
|
|
86
|
+
* required capability — releases the backend and is never returned.
|
|
87
|
+
*/
|
|
50
88
|
static open(init: {
|
|
51
89
|
transport: Transport;
|
|
52
90
|
backend: ConnectionBackend;
|
|
53
91
|
encoding: Encoding;
|
|
54
92
|
timeoutMs?: number | undefined;
|
|
93
|
+
/** Release tag the service must report. */
|
|
94
|
+
requiredVersion?: string;
|
|
95
|
+
/** Capabilities the service must report. */
|
|
96
|
+
requiredCapabilities?: readonly string[];
|
|
97
|
+
/** How a stale-service error addresses the service, and its remedy. */
|
|
98
|
+
stale?: {
|
|
99
|
+
address: string;
|
|
100
|
+
remedy: string;
|
|
101
|
+
};
|
|
55
102
|
}): Promise<Connection>;
|
|
56
103
|
/** Whether this connection has been closed. */
|
|
57
104
|
get isClosed(): boolean;
|
|
@@ -68,6 +115,160 @@ export declare class Connection {
|
|
|
68
115
|
* processes, and answers NOT_FOUND once the service has evicted the model.
|
|
69
116
|
*/
|
|
70
117
|
model(hash: string): Model;
|
|
118
|
+
/** Parses several documents together as one model, one root per document. */
|
|
119
|
+
parseSources(documents: readonly Source[], options?: ParseOptions): Promise<Model>;
|
|
120
|
+
/**
|
|
121
|
+
* Writes a model out in another of the formats OpenSysML writes. Exactly one
|
|
122
|
+
* of `source.path`, `source.content` and `source.modelHash` names the source.
|
|
123
|
+
*/
|
|
124
|
+
convert(toFormat: string, source: {
|
|
125
|
+
path: string;
|
|
126
|
+
} | {
|
|
127
|
+
content: string;
|
|
128
|
+
} | {
|
|
129
|
+
modelHash: string;
|
|
130
|
+
}, options?: {
|
|
131
|
+
fromFormat?: string;
|
|
132
|
+
tolerateSyntaxErrors?: boolean;
|
|
133
|
+
}): Promise<Conversion>;
|
|
134
|
+
/**
|
|
135
|
+
* Migrates a SysML v1 model — a Cameo/MagicDraw `.mdzip`, a UML XMI `.xmi` or
|
|
136
|
+
* an Eclipse UML2 `.uml` export — to one of the formats OpenSysML writes. A
|
|
137
|
+
* migration is ledgered, not lossless: every v1 element lands in the
|
|
138
|
+
* `Migration.report` as mapped, approximated, unmapped or skipped. Exactly one
|
|
139
|
+
* of `source.path` and `source.content` names the source; inline content is
|
|
140
|
+
* the file's bytes and needs `fromFormat` to say which form they are.
|
|
141
|
+
*/
|
|
142
|
+
migrate(toFormat: string, source: {
|
|
143
|
+
path: string;
|
|
144
|
+
} | {
|
|
145
|
+
content: Uint8Array;
|
|
146
|
+
}, options?: MigrateOptions): Promise<Migration>;
|
|
147
|
+
/** Runs a SysML v2 API & Services Query over a loaded model. */
|
|
148
|
+
query(modelHash: string, options?: {
|
|
149
|
+
payload?: QueryPayload;
|
|
150
|
+
} & QueryForm): Promise<QueryElement[]>;
|
|
151
|
+
/** Runs a named document query and answers its typed rows. */
|
|
152
|
+
runDocumentQuery(modelHash: string, queryId: string, bindings?: Readonly<Record<string, BindingValues>>): Promise<DocumentQueryResult>;
|
|
153
|
+
/** Applies source-preserving edits to a loaded model. Operations are the
|
|
154
|
+
* tuple form the {@link Editor} builds, or wire `EditOperation` messages,
|
|
155
|
+
* which pass through as written. */
|
|
156
|
+
applyEdits(modelHash: string, operations: readonly (EditOperationData | EditOperation)[], options?: {
|
|
157
|
+
acceptDocuments?: boolean;
|
|
158
|
+
document?: string;
|
|
159
|
+
}): Promise<EditResult>;
|
|
160
|
+
/** Starts an edit of a loaded model, applied with {@link Editor.apply}. */
|
|
161
|
+
edit(modelHash: string): Editor;
|
|
162
|
+
/** Renders a named document to Markdown or HTML. */
|
|
163
|
+
renderDocument(modelHash: string, documentId: string, options?: {
|
|
164
|
+
form?: string;
|
|
165
|
+
}): Promise<string>;
|
|
166
|
+
/** Renders a named view or targeted pseudo-view as diagram data. */
|
|
167
|
+
renderView(modelHash: string, viewName: string, options?: {
|
|
168
|
+
ports?: "minimal" | "full";
|
|
169
|
+
}): Promise<RenderedView>;
|
|
170
|
+
/**
|
|
171
|
+
* Exports the lowered graph of an action or state machine, and of every
|
|
172
|
+
* behavior it performs, as the canonical `graphs:1` JSON an external
|
|
173
|
+
* analysis engine is sent.
|
|
174
|
+
*/
|
|
175
|
+
exportGraphs(modelHash: string, subject: string): Promise<Graphs>;
|
|
176
|
+
/** Executes an action definition. */
|
|
177
|
+
executeAction(modelHash: string, actionSymbolId: string, options?: {
|
|
178
|
+
inputs?: Readonly<Record<string, ValueInput>>;
|
|
179
|
+
schedule?: string;
|
|
180
|
+
performer?: string;
|
|
181
|
+
}): Promise<{
|
|
182
|
+
outputs: ReadonlyMap<string, SysMLValue | UnsupportedValueError>;
|
|
183
|
+
performer: ReadonlyMap<string, SysMLValue | UnsupportedValueError>;
|
|
184
|
+
finalTime: number;
|
|
185
|
+
}>;
|
|
186
|
+
/** Runs an action once per valid order of its choice points, within a budget. */
|
|
187
|
+
exploreAction(modelHash: string, actionSymbolId: string, options?: {
|
|
188
|
+
inputs?: Readonly<Record<string, ValueInput>>;
|
|
189
|
+
schedule?: string;
|
|
190
|
+
performer?: string;
|
|
191
|
+
}): Promise<Exploration>;
|
|
192
|
+
private sendExecuteAction;
|
|
193
|
+
/** Executes a state machine; a failed traced run carries its partial trace on ExecutionError. */
|
|
194
|
+
executeState(modelHash: string, stateMachineSymbolId: string, options?: {
|
|
195
|
+
events?: readonly string[];
|
|
196
|
+
schedule?: string;
|
|
197
|
+
performer?: string;
|
|
198
|
+
trace?: boolean;
|
|
199
|
+
}): Promise<{
|
|
200
|
+
statesVisited: string[];
|
|
201
|
+
finalContext: ReadonlyMap<string, SysMLValue | UnsupportedValueError>;
|
|
202
|
+
finalTime: number;
|
|
203
|
+
trace: DocumentEvent[];
|
|
204
|
+
traceDropped: number;
|
|
205
|
+
}>;
|
|
206
|
+
/** Runs a state machine over the events once per valid order of its choice points. */
|
|
207
|
+
exploreState(modelHash: string, stateMachineSymbolId: string, options?: {
|
|
208
|
+
events?: readonly string[];
|
|
209
|
+
schedule?: string;
|
|
210
|
+
performer?: string;
|
|
211
|
+
}): Promise<Exploration>;
|
|
212
|
+
private sendExecuteState;
|
|
213
|
+
private explorationOf;
|
|
214
|
+
/** Lists the analysis engines the service answers with, as `sysml -engines` does. */
|
|
215
|
+
listEngines(): Promise<EngineInfo[]>;
|
|
216
|
+
/** Asks whether a constraint holds. */
|
|
217
|
+
verifyConstraint(modelHash: string, symbolId: string, options?: VerifyOptions): Promise<Verdict>;
|
|
218
|
+
/** Asks whether a requirement is satisfied. */
|
|
219
|
+
verifyRequirement(modelHash: string, symbolId: string, options?: VerifyOptions): Promise<Verdict>;
|
|
220
|
+
/** Asks whether the model's satisfaction assertions hold. */
|
|
221
|
+
verifySatisfaction(modelHash: string, options?: {
|
|
222
|
+
symbolId?: string;
|
|
223
|
+
engine?: string;
|
|
224
|
+
question?: string;
|
|
225
|
+
}): Promise<Verdict[]>;
|
|
226
|
+
/** Checks every assertion about an object of one of this model's parts. */
|
|
227
|
+
validateInstance(modelHash: string, symbolId: string, options?: {
|
|
228
|
+
engine?: string;
|
|
229
|
+
}): Promise<Validation>;
|
|
230
|
+
/** Invokes a calculation. */
|
|
231
|
+
calc(modelHash: string, symbolId: string, options?: {
|
|
232
|
+
arguments?: readonly ValueInput[];
|
|
233
|
+
engine?: string;
|
|
234
|
+
}): Promise<CalcResult>;
|
|
235
|
+
/** Runs an analysis case. */
|
|
236
|
+
runAnalysis(modelHash: string, symbolId: string, options?: {
|
|
237
|
+
subject?: string;
|
|
238
|
+
arguments?: readonly ValueInput[];
|
|
239
|
+
namedArguments?: Readonly<Record<string, ValueInput>>;
|
|
240
|
+
schedule?: string;
|
|
241
|
+
engine?: string;
|
|
242
|
+
}): Promise<AnalysisResult>;
|
|
243
|
+
/** Runs an analysis case once per valid order of its choice points. */
|
|
244
|
+
exploreAnalysis(modelHash: string, symbolId: string, options?: {
|
|
245
|
+
subject?: string;
|
|
246
|
+
arguments?: readonly ValueInput[];
|
|
247
|
+
namedArguments?: Readonly<Record<string, ValueInput>>;
|
|
248
|
+
schedule?: string;
|
|
249
|
+
}): Promise<Exploration>;
|
|
250
|
+
private sendRunAnalysis;
|
|
251
|
+
/** Runs an analysis case or calc once per row of a parameter sweep. */
|
|
252
|
+
runSweep(modelHash: string, symbolId: string, ranges: Readonly<Record<string, readonly [ValueInput, ValueInput] | readonly [ValueInput, ValueInput, ValueInput]>>, options?: {
|
|
253
|
+
subject?: string;
|
|
254
|
+
arguments?: readonly ValueInput[];
|
|
255
|
+
namedArguments?: Readonly<Record<string, ValueInput>>;
|
|
256
|
+
samples?: bigint | number;
|
|
257
|
+
seed?: bigint | number;
|
|
258
|
+
engine?: string;
|
|
259
|
+
}): Promise<SweepTable>;
|
|
260
|
+
private sweepRange;
|
|
261
|
+
private verdictOf;
|
|
262
|
+
private instancesOf;
|
|
263
|
+
private requireVerification;
|
|
264
|
+
private requireEngines;
|
|
265
|
+
private requireEngine;
|
|
266
|
+
private requireArguments;
|
|
267
|
+
private requireQuestion;
|
|
268
|
+
private requireSchedule;
|
|
269
|
+
private requireStrictConformance;
|
|
270
|
+
private runCapabilities;
|
|
271
|
+
private warn;
|
|
71
272
|
/** Asks the service what it is and what it can do, again. */
|
|
72
273
|
serverInfo(): Promise<ServerInfo>;
|
|
73
274
|
/**
|