@openmbee/opensysml 0.12.1 → 0.12.2-nightly.20261109.gddc5b7a632
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 +26 -8
- package/dist/core/capabilities.d.ts +6 -0
- package/dist/core/capabilities.js +6 -0
- package/dist/core/connection.d.ts +21 -0
- package/dist/core/connection.js +44 -3
- package/dist/core/conversion.d.ts +3 -0
- package/dist/core/element-properties.d.ts +84 -0
- package/dist/core/element-properties.js +126 -0
- package/dist/core/index.d.ts +6 -3
- package/dist/core/index.js +3 -1
- package/dist/core/instance-paths.d.ts +44 -0
- package/dist/core/instance-paths.js +36 -0
- package/dist/core/model.d.ts +128 -3
- package/dist/core/model.js +120 -3
- package/dist/core/render-view.d.ts +14 -0
- package/dist/core/render-view.js +15 -0
- package/dist/core/values.d.ts +4 -1
- package/dist/generated/sysml_pb.d.ts +641 -11
- package/dist/generated/sysml_pb.js +210 -140
- package/dist/node/generate.js +11 -2
- package/package.json +10 -11
- package/release-digests.json +6 -1
package/README.md
CHANGED
|
@@ -27,15 +27,31 @@ await using model = await loads(`package Demo {
|
|
|
27
27
|
|
|
28
28
|
const value = await model.eval("2 + 2"); // { kind: "int", value: 4n }
|
|
29
29
|
const car = await model.symbol("Demo::Car"); // by qualified name
|
|
30
|
-
await car.children(); // its members, as symbols
|
|
30
|
+
await car.children(); // its owned members, as symbols
|
|
31
|
+
car.members; // every member, own and inherited, with its provenance
|
|
32
|
+
car.inheritedMembers(); // the inherited ones: `inheritedFrom` names the type
|
|
33
|
+
car.withheldLibraryMembers; // standard-library members counted, not listed, until
|
|
34
|
+
await car.withLibraryMembers(); // ... fetched again with them listed
|
|
35
|
+
await model.elementProperties("Demo::Car", "inheritedFeature"); // metamodel properties by spec name
|
|
31
36
|
|
|
32
37
|
const tree = await model.instantiate("Demo::Car");
|
|
33
38
|
const wheels = tree.get("wheels"); // a FeatureValue union
|
|
34
39
|
if (wheels?.kind === "many") {
|
|
35
40
|
console.log(wheels.values.length); // 4
|
|
36
41
|
}
|
|
42
|
+
const wheel = tree.byId(2n);
|
|
43
|
+
wheel?.reachedBy; // how the traversal reached it: owner, feature, index, path
|
|
44
|
+
wheel?.path; // "wheels[2]"
|
|
45
|
+
tree.owner(wheel!); // the holding object, the root here
|
|
46
|
+
await model.instancePaths(wheel!); // every root-relative path to it, aliases included
|
|
37
47
|
```
|
|
38
48
|
|
|
49
|
+
`members`, `withLibraryMembers()` and `includeLibraryMembers` need the `symbol_members`
|
|
50
|
+
capability, `elementProperties` needs `element_properties` and `instancePaths` needs
|
|
51
|
+
`instance_paths`; each is refused with a `MissingCapabilityError` before asking a service
|
|
52
|
+
that lacks it, and a symbol from a service without `symbol_members` enumerates no members
|
|
53
|
+
(its `childIds` still name the owned ones).
|
|
54
|
+
|
|
39
55
|
`loads`/`load` open a connection of their own and close it with the model.
|
|
40
56
|
`connect()` is the longer-lived form, and parses more than one source over one
|
|
41
57
|
service and one parse cache:
|
|
@@ -761,15 +777,17 @@ npm run conformance -- --allow-skips --report report.json
|
|
|
761
777
|
|
|
762
778
|
| protocol | ran | passed | failed | skipped |
|
|
763
779
|
| --- | --: | --: | --: | --: |
|
|
764
|
-
| `grpc` |
|
|
765
|
-
| `connect` |
|
|
766
|
-
| `connect-json` |
|
|
767
|
-
| **total** | **
|
|
780
|
+
| `grpc` | 206 | 198 | 0 | 8 |
|
|
781
|
+
| `connect` | 206 | 198 | 0 | 8 |
|
|
782
|
+
| `connect-json` | 206 | 198 | 0 | 8 |
|
|
783
|
+
| **total** | **618** | **594** | **0** | **24** |
|
|
768
784
|
|
|
769
|
-
The
|
|
770
|
-
it validates them before calling
|
|
785
|
+
The 8 skips per protocol are three requests the public API cannot express because
|
|
786
|
+
it validates them before calling — a `ParseFile` naming no source (`load` and
|
|
771
787
|
`loads` always name one), a `ParseSources` naming no document and a
|
|
772
|
-
`ParseSources` naming two documents alike (`parseSources` refuses both)
|
|
788
|
+
`ParseSources` naming two documents alike (`parseSources` refuses both) — and the
|
|
789
|
+
five scenarios of `RunRuns`, `SelfCheck` and `RecordRun`, which this runner does
|
|
790
|
+
not yet make through the public API. Every
|
|
773
791
|
skip carries its reason in the report. A refusal the client makes before asking,
|
|
774
792
|
in the service's own words and with the status the service would answer — a v1
|
|
775
793
|
model offered to `convert`, a v2 one to `migrate` — is reported as that status,
|
|
@@ -3,6 +3,12 @@ import { OpenSysMLError } from "./errors.js";
|
|
|
3
3
|
export declare const CAPABILITY_TYPE_FACTS = "type_facts";
|
|
4
4
|
/** Populated `SymbolInfo.attributes`. */
|
|
5
5
|
export declare const CAPABILITY_SYMBOL_ATTRIBUTES = "symbol_attributes";
|
|
6
|
+
/** Populated `SymbolInfo.members`: every member, own and inherited, with its provenance. */
|
|
7
|
+
export declare const CAPABILITY_SYMBOL_MEMBERS = "symbol_members";
|
|
8
|
+
/** The `GetElementProperties` RPC: an element's metamodel properties by their specification names. */
|
|
9
|
+
export declare const CAPABILITY_ELEMENT_PROPERTIES = "element_properties";
|
|
10
|
+
/** The `InstancePaths` RPC, and `Instance.reached_by` on every instantiated object. */
|
|
11
|
+
export declare const CAPABILITY_INSTANCE_PATHS = "instance_paths";
|
|
6
12
|
/** Evaluating an expression against an instantiated subject. */
|
|
7
13
|
export declare const CAPABILITY_EVALUATE_SUBJECT = "evaluate_subject";
|
|
8
14
|
/** An object's values as `Instance.feature_values`. */
|
|
@@ -7,6 +7,12 @@ import { PLATFORM_PACKAGE_PREFIX } from "./package.js";
|
|
|
7
7
|
export const CAPABILITY_TYPE_FACTS = "type_facts";
|
|
8
8
|
/** Populated `SymbolInfo.attributes`. */
|
|
9
9
|
export const CAPABILITY_SYMBOL_ATTRIBUTES = "symbol_attributes";
|
|
10
|
+
/** Populated `SymbolInfo.members`: every member, own and inherited, with its provenance. */
|
|
11
|
+
export const CAPABILITY_SYMBOL_MEMBERS = "symbol_members";
|
|
12
|
+
/** The `GetElementProperties` RPC: an element's metamodel properties by their specification names. */
|
|
13
|
+
export const CAPABILITY_ELEMENT_PROPERTIES = "element_properties";
|
|
14
|
+
/** The `InstancePaths` RPC, and `Instance.reached_by` on every instantiated object. */
|
|
15
|
+
export const CAPABILITY_INSTANCE_PATHS = "instance_paths";
|
|
10
16
|
/** Evaluating an expression against an instantiated subject. */
|
|
11
17
|
export const CAPABILITY_EVALUATE_SUBJECT = "evaluate_subject";
|
|
12
18
|
/** An object's values as `Instance.feature_values`. */
|
|
@@ -6,6 +6,8 @@ import { Model, type ParseOptions, type ParseSourcesOptions } from "./model.js";
|
|
|
6
6
|
import { type Source } from "./sources.js";
|
|
7
7
|
import { Conversion, Migration } from "./conversion.js";
|
|
8
8
|
import type { ConvertOptions, MigrateOptions } from "./conversion.js";
|
|
9
|
+
import { type ElementProperties } from "./element-properties.js";
|
|
10
|
+
import { type InstancePaths } from "./instance-paths.js";
|
|
9
11
|
import { type QueryElement, type QueryForm, type QueryPayload } from "./query.js";
|
|
10
12
|
import { DocumentEvent, type BindingValues, type DocumentQueryResult } from "./document.js";
|
|
11
13
|
import { type RenderedView } from "./render-view.js";
|
|
@@ -151,6 +153,25 @@ export declare class Connection {
|
|
|
151
153
|
query(modelHash: string, options?: {
|
|
152
154
|
payload?: QueryPayload;
|
|
153
155
|
} & QueryForm): Promise<QueryElement[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Reads the metamodel properties of one element by their specification names
|
|
158
|
+
* (`inheritedFeature`, `connectorEnd`, ...), as the model's API element form
|
|
159
|
+
* spells them; every property the element carries when none is named. The
|
|
160
|
+
* element is a qualified name, the positional id of an unnamed member
|
|
161
|
+
* (`Owner::@2`) or an element form id.
|
|
162
|
+
*/
|
|
163
|
+
elementProperties(modelHash: string, element: string, properties?: readonly string[]): Promise<ElementProperties>;
|
|
164
|
+
/**
|
|
165
|
+
* Lists every root-relative path that reaches one object the service holds
|
|
166
|
+
* for the model, named by the id `Instantiate` answered or by path (the
|
|
167
|
+
* qualified name it was instantiated as, its id `#2`, or a path through
|
|
168
|
+
* feature values from either, `Garage::car.wheels[2]`).
|
|
169
|
+
*/
|
|
170
|
+
instancePaths(modelHash: string, object: {
|
|
171
|
+
instanceId: bigint;
|
|
172
|
+
} | {
|
|
173
|
+
path: string;
|
|
174
|
+
}): Promise<InstancePaths>;
|
|
154
175
|
/** Runs a named document query and answers its typed rows. */
|
|
155
176
|
runDocumentQuery(modelHash: string, queryId: string, bindings?: Readonly<Record<string, BindingValues>>): Promise<DocumentQueryResult>;
|
|
156
177
|
/** Applies source-preserving edits to a loaded model. Operations are the
|
package/dist/core/connection.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// tells the client what that service can do.
|
|
3
3
|
import { Code, ConnectError, createClient, } from "@connectrpc/connect";
|
|
4
4
|
import { create } from "@bufbuild/protobuf";
|
|
5
|
-
import { CAPABILITY_APPLY_EDITS, CAPABILITY_BIG_INT_VALUES, CAPABILITY_RATIONAL_VALUES, CAPABILITY_CONVERT, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_CONVERT_COMPACT, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_ENGINES, CAPABILITY_FEATURE_VALUES, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MIGRATE, CAPABILITY_PARSE_SOURCES, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_QUERY, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_RENDER_VIEW, CAPABILITY_CHECK, CAPABILITY_EXPORT_GRAPHS, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_VERIFICATION, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, ServerInfo, } from "./capabilities.js";
|
|
6
|
-
import { ClosedConnectionError, ConversionError, ExecutionError, InvalidRequestError, MigrationError, ParseError, StaleServiceError, UnsupportedValueError, } from "./errors.js";
|
|
7
|
-
import { ApplyEditsRequestSchema, ExecuteActionRequestSchema, ExecuteStateRequestSchema, ConvertRequestSchema, ListEnginesRequestSchema, MigrateRequestSchema, ParseSourcesRequestSchema, QueryRequestSchema, RenderDocumentRequestSchema, RenderViewRequestSchema, CheckBehaviorRequestSchema, ExportGraphsRequestSchema, ImportDataRequestSchema, CompareResultsRequestSchema, RunAnalysisRequestSchema, RunDocumentQueryRequestSchema, RunSweepRequestSchema, RunRunsRequestSchema, SelfCheckRequestSchema, RecordRunRequestSchema, SweepRangeSchema, ValidateInstanceRequestSchema, EvaluateCalcRequestSchema, VerifyConstraintRequestSchema, VerifyRequirementRequestSchema, VerifySatisfactionRequestSchema, FailureReason, SysMLService, } from "../generated/sysml_pb.js";
|
|
5
|
+
import { CAPABILITY_APPLY_EDITS, CAPABILITY_BIG_INT_VALUES, CAPABILITY_RATIONAL_VALUES, CAPABILITY_CONVERT, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_CONVERT_COMPACT, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_ENGINES, CAPABILITY_FEATURE_VALUES, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MIGRATE, CAPABILITY_PARSE_SOURCES, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_ELEMENT_PROPERTIES, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_QUERY, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_RENDER_VIEW, CAPABILITY_CHECK, CAPABILITY_EXPORT_GRAPHS, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, CAPABILITY_INSTANCE_PATHS, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_VERIFICATION, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, ServerInfo, } from "./capabilities.js";
|
|
6
|
+
import { ClosedConnectionError, ConversionError, EvaluationError, SymbolNotFoundError, ExecutionError, InvalidRequestError, MigrationError, ParseError, StaleServiceError, UnsupportedValueError, } from "./errors.js";
|
|
7
|
+
import { ApplyEditsRequestSchema, ExecuteActionRequestSchema, ExecuteStateRequestSchema, ConvertRequestSchema, ListEnginesRequestSchema, MigrateRequestSchema, ParseSourcesRequestSchema, QueryRequestSchema, GetElementPropertiesRequestSchema, InstancePathsRequestSchema, RenderDocumentRequestSchema, RenderViewRequestSchema, CheckBehaviorRequestSchema, ExportGraphsRequestSchema, ImportDataRequestSchema, CompareResultsRequestSchema, RunAnalysisRequestSchema, RunDocumentQueryRequestSchema, RunSweepRequestSchema, RunRunsRequestSchema, SelfCheckRequestSchema, RecordRunRequestSchema, SweepRangeSchema, ValidateInstanceRequestSchema, EvaluateCalcRequestSchema, VerifyConstraintRequestSchema, VerifyRequirementRequestSchema, VerifySatisfactionRequestSchema, FailureReason, SysMLService, } from "../generated/sysml_pb.js";
|
|
8
8
|
import { callRpc, fromHandshakeError, fromRpcError } from "./status.js";
|
|
9
9
|
import { requireString } from "./arguments.js";
|
|
10
10
|
import { decodeDiagnostic, Instance, Model, } from "./model.js";
|
|
11
11
|
import { sourceDocuments } from "./sources.js";
|
|
12
12
|
import { Conversion, EXPERIMENTAL_NOTICE, isExperimental, isV1, MIGRATED_NOT_CONVERTED, Migration, MIGRATION_NOTICE, migrationReportOf, pathIsV1, } from "./conversion.js";
|
|
13
|
+
import { elementPropertiesOf } from "./element-properties.js";
|
|
14
|
+
import { instancePathsOf } from "./instance-paths.js";
|
|
13
15
|
import { buildQuery, elementsOf, } from "./query.js";
|
|
14
16
|
import { bindingHoldsBigInt, bindingHoldsRational, bindingRationalsAsReals, buildBindings, documentEventOf, documentResult, DocumentEvent, } from "./document.js";
|
|
15
17
|
import { renderedViewOf } from "./render-view.js";
|
|
@@ -308,6 +310,45 @@ export class Connection {
|
|
|
308
310
|
}), this.callOptions()), "model", capabilityRefusal(this.info, needed));
|
|
309
311
|
return elementsOf(response);
|
|
310
312
|
}
|
|
313
|
+
/**
|
|
314
|
+
* Reads the metamodel properties of one element by their specification names
|
|
315
|
+
* (`inheritedFeature`, `connectorEnd`, ...), as the model's API element form
|
|
316
|
+
* spells them; every property the element carries when none is named. The
|
|
317
|
+
* element is a qualified name, the positional id of an unnamed member
|
|
318
|
+
* (`Owner::@2`) or an element form id.
|
|
319
|
+
*/
|
|
320
|
+
async elementProperties(modelHash, element, properties = []) {
|
|
321
|
+
requireCapability(this.info, CAPABILITY_ELEMENT_PROPERTIES, upgradeRemedy(CAPABILITY_ELEMENT_PROPERTIES));
|
|
322
|
+
const response = await callRpc(this.rpc.getElementProperties(create(GetElementPropertiesRequestSchema, {
|
|
323
|
+
modelHash,
|
|
324
|
+
elementId: element,
|
|
325
|
+
properties: [...properties],
|
|
326
|
+
}), this.callOptions()), "model", capabilityRefusal(this.info, [CAPABILITY_ELEMENT_PROPERTIES]));
|
|
327
|
+
if (response.error !== "") {
|
|
328
|
+
if (response.error.startsWith("element not found")) {
|
|
329
|
+
throw new SymbolNotFoundError(element);
|
|
330
|
+
}
|
|
331
|
+
throw new ConversionError(response.error);
|
|
332
|
+
}
|
|
333
|
+
return elementPropertiesOf(response);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Lists every root-relative path that reaches one object the service holds
|
|
337
|
+
* for the model, named by the id `Instantiate` answered or by path (the
|
|
338
|
+
* qualified name it was instantiated as, its id `#2`, or a path through
|
|
339
|
+
* feature values from either, `Garage::car.wheels[2]`).
|
|
340
|
+
*/
|
|
341
|
+
async instancePaths(modelHash, object) {
|
|
342
|
+
requireCapability(this.info, CAPABILITY_INSTANCE_PATHS, upgradeRemedy(CAPABILITY_INSTANCE_PATHS));
|
|
343
|
+
const response = await callRpc(this.rpc.instancePaths(create(InstancePathsRequestSchema, {
|
|
344
|
+
modelHash,
|
|
345
|
+
object: "instanceId" in object ? { instanceId: object.instanceId } : { path: object.path },
|
|
346
|
+
}), this.callOptions()), "model", capabilityRefusal(this.info, [CAPABILITY_INSTANCE_PATHS]));
|
|
347
|
+
if (response.error !== "") {
|
|
348
|
+
throw new EvaluationError(response.error, "unspecified", response.diagnostics.map(decodeDiagnostic));
|
|
349
|
+
}
|
|
350
|
+
return instancePathsOf(response);
|
|
351
|
+
}
|
|
311
352
|
/** Runs a named document query and answers its typed rows. */
|
|
312
353
|
async runDocumentQuery(modelHash, queryId, bindings) {
|
|
313
354
|
requireCapability(this.info, CAPABILITY_DOCUMENT_QUERY, upgradeRemedy(CAPABILITY_DOCUMENT_QUERY));
|
|
@@ -53,8 +53,11 @@ export interface ConvertOptions {
|
|
|
53
53
|
/** A referenced standard-library element, not a model root. */
|
|
54
54
|
export interface LibraryReference {
|
|
55
55
|
readonly id: string;
|
|
56
|
+
/** Empty for an unnamed member, which `libraryPath` names instead. */
|
|
56
57
|
readonly qualifiedName: string;
|
|
57
58
|
readonly type: string;
|
|
59
|
+
/** The positional path `Owner::qualifiedName/Metaclass[i]` of an unnamed member. */
|
|
60
|
+
readonly libraryPath?: string;
|
|
58
61
|
}
|
|
59
62
|
/** A model written out in one of the formats OpenSysML writes. */
|
|
60
63
|
export declare class Conversion {
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading an element's metamodel properties by their specification names.
|
|
3
|
+
*
|
|
4
|
+
* The `GetElementProperties` RPC answers the KerML 1.1 / SysML 2.1 abstract
|
|
5
|
+
* syntax of one element — `inheritedFeature`, `connectorEnd`,
|
|
6
|
+
* `directedFeature`, `payloadType`, ... — as the model's API element form
|
|
7
|
+
* (`Convert` to `api-json`) spells it, without converting the whole model. An
|
|
8
|
+
* element is named by qualified name, by the positional id of an unnamed
|
|
9
|
+
* member (`Owner::@2`) or by the element form's own id, which every element
|
|
10
|
+
* reference in an answer carries, so a client walks the graph with one vocabulary.
|
|
11
|
+
*/
|
|
12
|
+
import type { ElementPropertyValue as ElementPropertyValueMessage, ElementRef, GetElementPropertiesResponse } from "../generated/sysml_pb.js";
|
|
13
|
+
/** An element the model's element form knows: one of the model, or a standard-library element it references. */
|
|
14
|
+
export declare class ElementIdentity {
|
|
15
|
+
/** The element form's `@id`, accepted back as the element to read. */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** Empty for an unnamed element; an unnamed standard-library member carries its library path (`owner/Metaclass[i]`). */
|
|
18
|
+
readonly qualifiedName: string;
|
|
19
|
+
/** `ConnectionUsage`, `PartDefinition`, ...; empty when the id is known to nothing. */
|
|
20
|
+
readonly metaclass: string;
|
|
21
|
+
constructor(fields: {
|
|
22
|
+
id: string;
|
|
23
|
+
qualifiedName?: string;
|
|
24
|
+
metaclass?: string;
|
|
25
|
+
});
|
|
26
|
+
/** The qualified name, or the id for an unnamed element. */
|
|
27
|
+
toString(): string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One value of a metamodel property, as the element form spells it: an element
|
|
31
|
+
* reference, a string (an enumeration literal included), a boolean, a number,
|
|
32
|
+
* or a `bigint` for an integer beyond the safe range. A number beyond `int64`
|
|
33
|
+
* and `float64` arrives as its decimal text.
|
|
34
|
+
*/
|
|
35
|
+
export type PropertyValue = ElementIdentity | string | boolean | number | bigint;
|
|
36
|
+
/** One metamodel property of an element. */
|
|
37
|
+
export declare class ElementProperty {
|
|
38
|
+
/** The specification name (`connectorEnd`). */
|
|
39
|
+
readonly name: string;
|
|
40
|
+
/** The metaclass declaring the property (`Connector`); empty when the element's metaclass declares no such property. */
|
|
41
|
+
readonly definingClass: string;
|
|
42
|
+
/** Whether the property holds a collection. */
|
|
43
|
+
readonly many: boolean;
|
|
44
|
+
/** Whether the specification derives the property. */
|
|
45
|
+
readonly derived: boolean;
|
|
46
|
+
/** The values in the collection's order; empty for an empty or null property. */
|
|
47
|
+
readonly values: readonly PropertyValue[];
|
|
48
|
+
/**
|
|
49
|
+
* Why there are no values when the property cannot be answered: the metaclass
|
|
50
|
+
* declares no such property, or OpenSysML does not derive it yet. Empty for a
|
|
51
|
+
* property that is answered.
|
|
52
|
+
*/
|
|
53
|
+
readonly unsupported: string;
|
|
54
|
+
constructor(fields: {
|
|
55
|
+
name: string;
|
|
56
|
+
definingClass?: string;
|
|
57
|
+
many?: boolean;
|
|
58
|
+
derived?: boolean;
|
|
59
|
+
values?: readonly PropertyValue[];
|
|
60
|
+
unsupported?: string;
|
|
61
|
+
});
|
|
62
|
+
/** Whether the property was answered, with or without values. */
|
|
63
|
+
get supported(): boolean;
|
|
64
|
+
/** The one value of a single-valued property, `undefined` when it has none. */
|
|
65
|
+
get value(): PropertyValue | undefined;
|
|
66
|
+
/** The element references among the values, in order. */
|
|
67
|
+
get elements(): ElementIdentity[];
|
|
68
|
+
}
|
|
69
|
+
/** What one read answered: the element and its properties, in the order asked for, or the element form's order when none was named. */
|
|
70
|
+
export declare class ElementProperties {
|
|
71
|
+
readonly element: ElementIdentity;
|
|
72
|
+
readonly properties: readonly ElementProperty[];
|
|
73
|
+
private readonly byName;
|
|
74
|
+
constructor(element: ElementIdentity, properties: readonly ElementProperty[]);
|
|
75
|
+
/** The entry for the named property, `undefined` when the read did not ask for it. */
|
|
76
|
+
get(name: string): ElementProperty | undefined;
|
|
77
|
+
/** Whether the read answered the named property. */
|
|
78
|
+
has(name: string): boolean;
|
|
79
|
+
[Symbol.iterator](): Iterator<ElementProperty>;
|
|
80
|
+
}
|
|
81
|
+
export declare function elementIdentityOf(reference: ElementRef | undefined): ElementIdentity;
|
|
82
|
+
export declare function propertyValueOf(message: ElementPropertyValueMessage): PropertyValue;
|
|
83
|
+
/** Decodes a `GetElementPropertiesResponse` the service answered without error. */
|
|
84
|
+
export declare function elementPropertiesOf(response: GetElementPropertiesResponse): ElementProperties;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading an element's metamodel properties by their specification names.
|
|
3
|
+
*
|
|
4
|
+
* The `GetElementProperties` RPC answers the KerML 1.1 / SysML 2.1 abstract
|
|
5
|
+
* syntax of one element — `inheritedFeature`, `connectorEnd`,
|
|
6
|
+
* `directedFeature`, `payloadType`, ... — as the model's API element form
|
|
7
|
+
* (`Convert` to `api-json`) spells it, without converting the whole model. An
|
|
8
|
+
* element is named by qualified name, by the positional id of an unnamed
|
|
9
|
+
* member (`Owner::@2`) or by the element form's own id, which every element
|
|
10
|
+
* reference in an answer carries, so a client walks the graph with one vocabulary.
|
|
11
|
+
*/
|
|
12
|
+
/** An element the model's element form knows: one of the model, or a standard-library element it references. */
|
|
13
|
+
export class ElementIdentity {
|
|
14
|
+
/** The element form's `@id`, accepted back as the element to read. */
|
|
15
|
+
id;
|
|
16
|
+
/** Empty for an unnamed element; an unnamed standard-library member carries its library path (`owner/Metaclass[i]`). */
|
|
17
|
+
qualifiedName;
|
|
18
|
+
/** `ConnectionUsage`, `PartDefinition`, ...; empty when the id is known to nothing. */
|
|
19
|
+
metaclass;
|
|
20
|
+
constructor(fields) {
|
|
21
|
+
this.id = fields.id;
|
|
22
|
+
this.qualifiedName = fields.qualifiedName ?? "";
|
|
23
|
+
this.metaclass = fields.metaclass ?? "";
|
|
24
|
+
}
|
|
25
|
+
/** The qualified name, or the id for an unnamed element. */
|
|
26
|
+
toString() {
|
|
27
|
+
return this.qualifiedName === "" ? this.id : this.qualifiedName;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** One metamodel property of an element. */
|
|
31
|
+
export class ElementProperty {
|
|
32
|
+
/** The specification name (`connectorEnd`). */
|
|
33
|
+
name;
|
|
34
|
+
/** The metaclass declaring the property (`Connector`); empty when the element's metaclass declares no such property. */
|
|
35
|
+
definingClass;
|
|
36
|
+
/** Whether the property holds a collection. */
|
|
37
|
+
many;
|
|
38
|
+
/** Whether the specification derives the property. */
|
|
39
|
+
derived;
|
|
40
|
+
/** The values in the collection's order; empty for an empty or null property. */
|
|
41
|
+
values;
|
|
42
|
+
/**
|
|
43
|
+
* Why there are no values when the property cannot be answered: the metaclass
|
|
44
|
+
* declares no such property, or OpenSysML does not derive it yet. Empty for a
|
|
45
|
+
* property that is answered.
|
|
46
|
+
*/
|
|
47
|
+
unsupported;
|
|
48
|
+
constructor(fields) {
|
|
49
|
+
this.name = fields.name;
|
|
50
|
+
this.definingClass = fields.definingClass ?? "";
|
|
51
|
+
this.many = fields.many ?? false;
|
|
52
|
+
this.derived = fields.derived ?? false;
|
|
53
|
+
this.values = fields.values ?? [];
|
|
54
|
+
this.unsupported = fields.unsupported ?? "";
|
|
55
|
+
}
|
|
56
|
+
/** Whether the property was answered, with or without values. */
|
|
57
|
+
get supported() {
|
|
58
|
+
return this.unsupported === "";
|
|
59
|
+
}
|
|
60
|
+
/** The one value of a single-valued property, `undefined` when it has none. */
|
|
61
|
+
get value() {
|
|
62
|
+
return this.values[0];
|
|
63
|
+
}
|
|
64
|
+
/** The element references among the values, in order. */
|
|
65
|
+
get elements() {
|
|
66
|
+
return this.values.filter((value) => value instanceof ElementIdentity);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/** What one read answered: the element and its properties, in the order asked for, or the element form's order when none was named. */
|
|
70
|
+
export class ElementProperties {
|
|
71
|
+
element;
|
|
72
|
+
properties;
|
|
73
|
+
byName;
|
|
74
|
+
constructor(element, properties) {
|
|
75
|
+
this.element = element;
|
|
76
|
+
this.properties = properties;
|
|
77
|
+
this.byName = new Map(properties.map((property) => [property.name, property]));
|
|
78
|
+
}
|
|
79
|
+
/** The entry for the named property, `undefined` when the read did not ask for it. */
|
|
80
|
+
get(name) {
|
|
81
|
+
return this.byName.get(name);
|
|
82
|
+
}
|
|
83
|
+
/** Whether the read answered the named property. */
|
|
84
|
+
has(name) {
|
|
85
|
+
return this.byName.has(name);
|
|
86
|
+
}
|
|
87
|
+
[Symbol.iterator]() {
|
|
88
|
+
return this.properties[Symbol.iterator]();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function elementIdentityOf(reference) {
|
|
92
|
+
return new ElementIdentity({
|
|
93
|
+
id: reference?.id ?? "",
|
|
94
|
+
qualifiedName: reference?.qualifiedName ?? "",
|
|
95
|
+
metaclass: reference?.metaclass ?? "",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export function propertyValueOf(message) {
|
|
99
|
+
const value = message.value;
|
|
100
|
+
switch (value.case) {
|
|
101
|
+
case "element":
|
|
102
|
+
return elementIdentityOf(value.value);
|
|
103
|
+
case "stringValue":
|
|
104
|
+
case "number":
|
|
105
|
+
return value.value;
|
|
106
|
+
case "boolValue":
|
|
107
|
+
return value.value;
|
|
108
|
+
case "intValue":
|
|
109
|
+
return Number.isSafeInteger(Number(value.value)) ? Number(value.value) : value.value;
|
|
110
|
+
case "realValue":
|
|
111
|
+
return value.value;
|
|
112
|
+
default:
|
|
113
|
+
throw new Error("an ElementPropertyValue with no value");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** Decodes a `GetElementPropertiesResponse` the service answered without error. */
|
|
117
|
+
export function elementPropertiesOf(response) {
|
|
118
|
+
return new ElementProperties(elementIdentityOf(response.element), response.properties.map((property) => new ElementProperty({
|
|
119
|
+
name: property.name,
|
|
120
|
+
definingClass: property.definingClass,
|
|
121
|
+
many: property.many,
|
|
122
|
+
derived: property.derived,
|
|
123
|
+
values: property.values.map(propertyValueOf),
|
|
124
|
+
unsupported: property.unsupported,
|
|
125
|
+
})));
|
|
126
|
+
}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export { Connection } from "./connection.js";
|
|
2
|
+
export { ElementIdentity, ElementProperties, ElementProperty, type PropertyValue, elementPropertiesOf, } from "./element-properties.js";
|
|
3
|
+
export { InstancePaths, instancePathsOf } from "./instance-paths.js";
|
|
4
|
+
export type { InstancePath, PathStep } from "./instance-paths.js";
|
|
2
5
|
export type { ConnectionBackend, Encoding, ResponseTap, TransportOptions, VerifyArguments, VerifyOptions, } from "./connection.js";
|
|
3
6
|
export type { WasmHost } from "./wasm.js";
|
|
4
7
|
export { Instance, InstanceTree, Model, ModelSymbol, decodeDiagnostic, instanceFromJson } from "./model.js";
|
|
5
|
-
export type { AttributeFacts, EvalOptions, FeatureValue, Multiplicity, ParseOptions, ParseSourcesOptions, SpecializationFacts, TypeFacts, } from "./model.js";
|
|
8
|
+
export type { AttributeFacts, EvalOptions, FeatureValue, InstanceReach, MemberFacts, Multiplicity, ParseOptions, ParseSourcesOptions, SpecializationFacts, SymbolOptions, TypeFacts, } from "./model.js";
|
|
6
9
|
export { LANGUAGES, SourceDocument, sourceDocuments } from "./sources.js";
|
|
7
10
|
export type { Source } from "./sources.js";
|
|
8
11
|
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";
|
|
@@ -11,7 +14,7 @@ export { QueryElement, TYPE_COMPOSITE_CONSTRAINT, TYPE_PRIMITIVE_CONSTRAINT, TYP
|
|
|
11
14
|
export type { ConstraintPayload, QueryForm, QueryPayload, ScopeEntry } from "./query.js";
|
|
12
15
|
export { DocumentQueryResult, DocumentRow, DocumentEvent, documentEventOf, DocumentState, DocumentVerdict, ElementRef, ObjectRef, buildBindings, } from "./document.js";
|
|
13
16
|
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";
|
|
17
|
+
export type { RenderCanvas, RenderEdge, RenderGeometry, RenderNode, RenderFrame, RenderNote, RenderPoint, RenderPort, RenderRow, RenderSpan, RenderStyle, RenderedView, } from "./render-view.js";
|
|
15
18
|
export { renderedViewFromJson } from "./render-view.js";
|
|
16
19
|
export type { Graphs } from "./graphs.js";
|
|
17
20
|
export type { CheckDivergence, CheckFinal, CheckOptions, CheckResult, CheckSearch, CheckViolation, CheckWitness, } from "./check.js";
|
|
@@ -24,7 +27,7 @@ export type { EditOperationData, EditTarget } from "./edit.js";
|
|
|
24
27
|
export type { ToolDryRun } from "./verdict.js";
|
|
25
28
|
export { AnalysisResult, toolDryRunOf, 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, RunsResult, SelfCheckResult, Recording, type RunDistribution, type RunPercentile, type RunHistogramBin, type RunCountedValue, type SelfCheckFinding, type RecordedDocument, Validation, VERDICT_ERROR, VERDICT_FAIL, VERDICT_INCONCLUSIVE, VERDICT_PASS, explainVerificationVerdict, explainVerdict, raiseVerdictError, verificationPassed, verdictEvaluated, verdictHolds, ImportResult, ImportedFile, ImportedValue, Comparison, ConfigurationComparison, ObservableComparison, ComparedDistribution, type StatisticDifference, type CaseStatistics, type CaseStatistic, } from "./verdict.js";
|
|
26
29
|
export type { Verdict } from "./verdict.js";
|
|
27
|
-
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_CONVERT_LIBRARY_REFERENCES, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_RENDER_DOCUMENT_FILE_NAME, 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_ORDER_DEPENDENCE, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_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_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, CAPABILITY_VERDICT_NOTES, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.js";
|
|
30
|
+
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_CONVERT_LIBRARY_REFERENCES, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_RENDER_DOCUMENT_FILE_NAME, 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_ORDER_DEPENDENCE, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_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_SYMBOL_MEMBERS, CAPABILITY_ELEMENT_PROPERTIES, CAPABILITY_INSTANCE_PATHS, 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_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, CAPABILITY_VERDICT_NOTES, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.js";
|
|
28
31
|
export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, AuthenticationError, 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";
|
|
29
32
|
export type { FailureCause, ModelDiagnostic } from "./errors.js";
|
|
30
33
|
export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
|
package/dist/core/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// The isomorphic core: everything that does not need a process to spawn.
|
|
2
2
|
export { Connection } from "./connection.js";
|
|
3
|
+
export { ElementIdentity, ElementProperties, ElementProperty, elementPropertiesOf, } from "./element-properties.js";
|
|
4
|
+
export { InstancePaths, instancePathsOf } from "./instance-paths.js";
|
|
3
5
|
export { Instance, InstanceTree, Model, ModelSymbol, decodeDiagnostic, instanceFromJson } from "./model.js";
|
|
4
6
|
export { LANGUAGES, SourceDocument, sourceDocuments } from "./sources.js";
|
|
5
7
|
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";
|
|
@@ -10,7 +12,7 @@ export { ENGINE_ALL, ENGINE_AUTO, STRENGTH_BOUNDED, STRENGTH_NOT_COVERED, STRENG
|
|
|
10
12
|
export { Exploration, Outcome } from "./exploration.js";
|
|
11
13
|
export { AppliedEdit, Body, EditedDocument, EditRequestBuilder, EditResult, Editor, editErrorOf, editResultOf, errorForFailure, failureName, referrersOf, } from "./edit.js";
|
|
12
14
|
export { AnalysisResult, toolDryRunOf, 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, RunsResult, SelfCheckResult, Recording, Validation, VERDICT_ERROR, VERDICT_FAIL, VERDICT_INCONCLUSIVE, VERDICT_PASS, explainVerificationVerdict, explainVerdict, raiseVerdictError, verificationPassed, verdictEvaluated, verdictHolds, ImportResult, ImportedFile, ImportedValue, Comparison, ConfigurationComparison, ObservableComparison, ComparedDistribution, } from "./verdict.js";
|
|
13
|
-
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_CONVERT_LIBRARY_REFERENCES, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_RENDER_DOCUMENT_FILE_NAME, 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_ORDER_DEPENDENCE, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_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_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, CAPABILITY_VERDICT_NOTES, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.js";
|
|
15
|
+
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_CONVERT_LIBRARY_REFERENCES, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_CONVERT_CHECK_DIAGNOSTICS, CAPABILITY_PARSE_SOURCES_AFFECTED, CAPABILITY_RENDER_DOCUMENT_FILE_NAME, 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_ORDER_DEPENDENCE, CAPABILITY_INFINITY_VALUE, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MEASUREMENT_REFS, CAPABILITY_METAOBJECT_VALUES, CAPABILITY_PERFORMER, CAPABILITY_RUNS, CAPABILITY_SELF_CHECK, CAPABILITY_RECORD_RUN, CAPABILITY_STATE_TRACE, CAPABILITY_ACTION_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, CAPABILITY_OSLC_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_SYMBOL_MEMBERS, CAPABILITY_ELEMENT_PROPERTIES, CAPABILITY_INSTANCE_PATHS, 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_RENDER_DOCUMENT_ASCIIDOC, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, CAPABILITY_VERDICT_NOTES, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.js";
|
|
14
16
|
export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, AuthenticationError, 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";
|
|
15
17
|
export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
|
|
16
18
|
export { callRpc, fromHandshakeError, fromRpcError, statusName } from "./status.js";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every root-relative path that reaches one object, as the `InstancePaths` RPC
|
|
3
|
+
* answers it: aliases through connector ends and reference usages included,
|
|
4
|
+
* where `Instance.reachedBy` gives only the path the traversal came by.
|
|
5
|
+
*/
|
|
6
|
+
import type { InstancePathsResponse } from "../generated/sysml_pb.js";
|
|
7
|
+
/** One step of a path: a feature of the object before it, and the object the step reaches. */
|
|
8
|
+
export interface PathStep {
|
|
9
|
+
/** The holder's feature, a key of its `features`. */
|
|
10
|
+
featureName: string;
|
|
11
|
+
/** The qualified name of the feature as declared. */
|
|
12
|
+
featureSymbolId: string;
|
|
13
|
+
/** The position among the values of a multi-valued feature, counted from 1 as an object path indexes them; 0 for a single-valued one. */
|
|
14
|
+
index: number;
|
|
15
|
+
/** The object the step reaches. */
|
|
16
|
+
instanceId: bigint;
|
|
17
|
+
}
|
|
18
|
+
/** One root-relative path to an object. */
|
|
19
|
+
export interface InstancePath {
|
|
20
|
+
/** The root the path starts from. */
|
|
21
|
+
rootInstanceId: bigint;
|
|
22
|
+
/** The qualified name the root was instantiated as; empty when the name no longer binds it and `#<id>` addresses it. */
|
|
23
|
+
rootSymbolId: string;
|
|
24
|
+
/** The steps as an object path (`wheels[2].hub`); empty when the object is the root. */
|
|
25
|
+
path: string;
|
|
26
|
+
readonly steps: readonly PathStep[];
|
|
27
|
+
}
|
|
28
|
+
/** What one `InstancePaths` call answered. */
|
|
29
|
+
export declare class InstancePaths {
|
|
30
|
+
/**
|
|
31
|
+
* The paths in traversal order: the roots the service holds in id order and,
|
|
32
|
+
* from each, depth-first over the features of an object in name order and
|
|
33
|
+
* the values of a feature in their order.
|
|
34
|
+
*/
|
|
35
|
+
readonly paths: readonly InstancePath[];
|
|
36
|
+
/** Whether the service bounded its search short of every path: more reach the object than it lists, or one deeper than it walks. */
|
|
37
|
+
readonly truncated: boolean;
|
|
38
|
+
constructor(paths: readonly InstancePath[], truncated: boolean);
|
|
39
|
+
/** The number of paths listed. */
|
|
40
|
+
get length(): number;
|
|
41
|
+
[Symbol.iterator](): Iterator<InstancePath>;
|
|
42
|
+
}
|
|
43
|
+
/** Decodes an `InstancePathsResponse` the service answered without error. */
|
|
44
|
+
export declare function instancePathsOf(response: InstancePathsResponse): InstancePaths;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** What one `InstancePaths` call answered. */
|
|
2
|
+
export class InstancePaths {
|
|
3
|
+
/**
|
|
4
|
+
* The paths in traversal order: the roots the service holds in id order and,
|
|
5
|
+
* from each, depth-first over the features of an object in name order and
|
|
6
|
+
* the values of a feature in their order.
|
|
7
|
+
*/
|
|
8
|
+
paths;
|
|
9
|
+
/** Whether the service bounded its search short of every path: more reach the object than it lists, or one deeper than it walks. */
|
|
10
|
+
truncated;
|
|
11
|
+
constructor(paths, truncated) {
|
|
12
|
+
this.paths = paths;
|
|
13
|
+
this.truncated = truncated;
|
|
14
|
+
}
|
|
15
|
+
/** The number of paths listed. */
|
|
16
|
+
get length() {
|
|
17
|
+
return this.paths.length;
|
|
18
|
+
}
|
|
19
|
+
[Symbol.iterator]() {
|
|
20
|
+
return this.paths[Symbol.iterator]();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
/** Decodes an `InstancePathsResponse` the service answered without error. */
|
|
24
|
+
export function instancePathsOf(response) {
|
|
25
|
+
return new InstancePaths(response.paths.map((path) => ({
|
|
26
|
+
rootInstanceId: path.root?.instanceId ?? 0n,
|
|
27
|
+
rootSymbolId: path.root?.symbolId ?? "",
|
|
28
|
+
path: path.path,
|
|
29
|
+
steps: path.steps.map((step) => ({
|
|
30
|
+
featureName: step.featureName,
|
|
31
|
+
featureSymbolId: step.featureSymbolId,
|
|
32
|
+
index: step.index,
|
|
33
|
+
instanceId: step.instanceId,
|
|
34
|
+
})),
|
|
35
|
+
})), response.truncated);
|
|
36
|
+
}
|