@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.
- 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 +97 -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 +538 -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 +1062 -15
- package/dist/generated/sysml_pb.js +200 -100
- 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 +117 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ModelDiagnostic } from "./errors.js";
|
|
2
|
+
import type { MigrationReport as PbMigrationReport } from "../generated/sysml_pb.js";
|
|
3
|
+
/** SysML v2 / KerML textual notation. `kerml` and `text` name it too. */
|
|
4
|
+
export declare const FORMAT_SYSML = "sysml";
|
|
5
|
+
/** RDF in Turtle syntax. `turtle` and `rdf` name it too. */
|
|
6
|
+
export declare const FORMAT_TURTLE = "ttl";
|
|
7
|
+
/** The OMG API's JSON element form, the same RDF mapping spelled differently. `json` names it too. */
|
|
8
|
+
export declare const FORMAT_API_JSON = "api-json";
|
|
9
|
+
/** Whether a format names SysML v1 in any of its forms: `xmi`, `uml` or `mdzip`, spelt as the service reads them. */
|
|
10
|
+
export declare function isV1(format: string): boolean;
|
|
11
|
+
/** Whether a path's extension names a SysML v1 model: `.xmi`, `.uml` or `.mdzip`. */
|
|
12
|
+
export declare function pathIsV1(path: string): boolean;
|
|
13
|
+
/** Why a v1 model is refused by a conversion, in the words every surface uses. */
|
|
14
|
+
export declare const MIGRATED_NOT_CONVERTED: string;
|
|
15
|
+
/** The fallback wording, for a service too old to send its own notice. */
|
|
16
|
+
export declare const EXPERIMENTAL_NOTICE: string;
|
|
17
|
+
/** The fallback wording for a migration, for a service too old to send its own notice. */
|
|
18
|
+
export declare const MIGRATION_NOTICE: string;
|
|
19
|
+
/** Whether a conversion between these formats uses an experimental mapping. */
|
|
20
|
+
export declare function isExperimental(fromFormat: string, toFormat: string): boolean;
|
|
21
|
+
/** The format to write `path` as, from its extension. */
|
|
22
|
+
export declare function formatOfPath(path: string): string;
|
|
23
|
+
/** A model written out in one of the formats OpenSysML writes. */
|
|
24
|
+
export declare class Conversion {
|
|
25
|
+
/** The converted model. */
|
|
26
|
+
readonly content: string;
|
|
27
|
+
/** Format the source was read as, reported even when inferred. */
|
|
28
|
+
readonly fromFormat: string;
|
|
29
|
+
/** Format `content` is written in. */
|
|
30
|
+
readonly toFormat: string;
|
|
31
|
+
/** Syntax errors the service tolerated under `tolerateSyntaxErrors`. */
|
|
32
|
+
readonly diagnostics: readonly ModelDiagnostic[];
|
|
33
|
+
/** True when the conversion went through the RDF mapping, which is experimental. */
|
|
34
|
+
readonly experimental: boolean;
|
|
35
|
+
/** What is experimental about it, in the service's own wording; empty when stable. */
|
|
36
|
+
readonly experimentalNotice: string;
|
|
37
|
+
constructor(init: {
|
|
38
|
+
content: string;
|
|
39
|
+
fromFormat: string;
|
|
40
|
+
toFormat: string;
|
|
41
|
+
diagnostics: readonly ModelDiagnostic[];
|
|
42
|
+
experimental: boolean;
|
|
43
|
+
experimentalNotice: string;
|
|
44
|
+
});
|
|
45
|
+
toString(): string;
|
|
46
|
+
get length(): number;
|
|
47
|
+
}
|
|
48
|
+
/** What a migration may be asked for beside the target format. */
|
|
49
|
+
export interface MigrateOptions {
|
|
50
|
+
/** The v1 form the source is in: `xmi`, `uml` or `mdzip`. Required for inline content; a path's extension names it otherwise. */
|
|
51
|
+
fromFormat?: string;
|
|
52
|
+
/** Answer every element's verdict and the report text `-migration-report` writes. */
|
|
53
|
+
report?: boolean;
|
|
54
|
+
/** Answer the JSON index of result snapshots `-migration-results` writes. */
|
|
55
|
+
results?: boolean;
|
|
56
|
+
/** Path of an MTIP layout file the service reads, as `-layout` names it. */
|
|
57
|
+
layoutPath?: string;
|
|
58
|
+
/** An MTIP layout carried inline; at most one of `layoutPath` and `layoutContent`. */
|
|
59
|
+
layoutContent?: string;
|
|
60
|
+
/** Prefix the migrated model refers to its image files with, as `-image-base-url` sets it. */
|
|
61
|
+
imageBaseUrl?: string;
|
|
62
|
+
/** Refuse a model with an unmapped element rather than reporting it, as `-strict` does. */
|
|
63
|
+
strict?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/** One SysML v1 element's verdict in a migration. */
|
|
66
|
+
export interface MigrationEntry {
|
|
67
|
+
/** The element's `xmi:id`. */
|
|
68
|
+
readonly id: string;
|
|
69
|
+
/** Its v1 metaclass, with its applied stereotypes. */
|
|
70
|
+
readonly kind: string;
|
|
71
|
+
/** Its qualified name in the v1 model. */
|
|
72
|
+
readonly name: string;
|
|
73
|
+
/** The v2 element it was written as, when it was written. */
|
|
74
|
+
readonly target: string;
|
|
75
|
+
/** `mapped`, `approximated`, `unmapped` or `skipped`. */
|
|
76
|
+
readonly verdict: string;
|
|
77
|
+
/** Why the verdict is what it is, in the migrator's words. */
|
|
78
|
+
readonly note: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The account a migration gives of itself: what became of every element. The
|
|
82
|
+
* summary and the four counts always come back; `entries` and `text` when the
|
|
83
|
+
* migration was asked for the report.
|
|
84
|
+
*/
|
|
85
|
+
export declare class MigrationReport {
|
|
86
|
+
/** The v1 model migrated, as the service named it. */
|
|
87
|
+
readonly source: string;
|
|
88
|
+
/** The tool that exported it, as its XMI says. */
|
|
89
|
+
readonly exporter: string;
|
|
90
|
+
/** The one-line account: `migrated N element(s): … mapped, … approximated, … unmapped`. */
|
|
91
|
+
readonly summary: string;
|
|
92
|
+
/** Elements with a faithful v2 form. */
|
|
93
|
+
readonly mapped: number;
|
|
94
|
+
/** Elements written in a v2 form that is not quite theirs. */
|
|
95
|
+
readonly approximated: number;
|
|
96
|
+
/** Elements with no v2 form, left out and reported. */
|
|
97
|
+
readonly unmapped: number;
|
|
98
|
+
/** Elements the migration does not consider: profile, library and notation-only content, and elements nothing refers to. */
|
|
99
|
+
readonly skipped: number;
|
|
100
|
+
/** Every element's verdict, when the report was asked for. */
|
|
101
|
+
readonly entries: readonly MigrationEntry[];
|
|
102
|
+
/** The report as `-migration-report` writes it, when asked for; else empty. */
|
|
103
|
+
readonly text: string;
|
|
104
|
+
constructor(init: {
|
|
105
|
+
source: string;
|
|
106
|
+
exporter: string;
|
|
107
|
+
summary: string;
|
|
108
|
+
mapped: number;
|
|
109
|
+
approximated: number;
|
|
110
|
+
unmapped: number;
|
|
111
|
+
skipped: number;
|
|
112
|
+
entries: readonly MigrationEntry[];
|
|
113
|
+
text: string;
|
|
114
|
+
});
|
|
115
|
+
/** The entries with `verdict`: `mapped`, `approximated`, `unmapped` or `skipped`. */
|
|
116
|
+
byVerdict(verdict: string): MigrationEntry[];
|
|
117
|
+
toString(): string;
|
|
118
|
+
}
|
|
119
|
+
/** Reads the report the service sent. */
|
|
120
|
+
export declare function migrationReportOf(message: PbMigrationReport | undefined): MigrationReport;
|
|
121
|
+
/** A SysML v1 model migrated to one of the formats OpenSysML writes. */
|
|
122
|
+
export declare class Migration {
|
|
123
|
+
/** The migrated model. */
|
|
124
|
+
readonly content: string;
|
|
125
|
+
/** The v1 form read, canonically `xmi`: `uml` and `mdzip` name the same reader. */
|
|
126
|
+
readonly fromFormat: string;
|
|
127
|
+
/** Format `content` is written in. */
|
|
128
|
+
readonly toFormat: string;
|
|
129
|
+
/** What became of every element; the summary and the counts come back with every migration. */
|
|
130
|
+
readonly report: MigrationReport;
|
|
131
|
+
/** The JSON index of the result snapshots the v1 tool stored, as `-migration-results` writes it, when asked for; else empty. */
|
|
132
|
+
readonly results: string;
|
|
133
|
+
/** Image files the model's diagrams embed, by the relative path `content` refers to them with. */
|
|
134
|
+
readonly files: ReadonlyMap<string, Uint8Array>;
|
|
135
|
+
/** The path the v1 model was read from, as given; empty when it was inline content. */
|
|
136
|
+
readonly sourcePath: string;
|
|
137
|
+
/** Always true: the migration is experimental. */
|
|
138
|
+
readonly experimental = true;
|
|
139
|
+
/** What is experimental about it, in the service's own wording. */
|
|
140
|
+
readonly experimentalNotice: string;
|
|
141
|
+
constructor(init: {
|
|
142
|
+
content: string;
|
|
143
|
+
fromFormat: string;
|
|
144
|
+
toFormat: string;
|
|
145
|
+
report: MigrationReport;
|
|
146
|
+
results: string;
|
|
147
|
+
files: ReadonlyMap<string, Uint8Array>;
|
|
148
|
+
sourcePath: string;
|
|
149
|
+
experimentalNotice: string;
|
|
150
|
+
});
|
|
151
|
+
toString(): string;
|
|
152
|
+
get length(): number;
|
|
153
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
// Writing a model back out, in SysML notation or RDF Turtle. The formats are
|
|
2
|
+
// named as the `sysml` CLI's -from/-to name them.
|
|
3
|
+
import { byCodeUnit } from "./capabilities.js";
|
|
4
|
+
/** SysML v2 / KerML textual notation. `kerml` and `text` name it too. */
|
|
5
|
+
export const FORMAT_SYSML = "sysml";
|
|
6
|
+
/** RDF in Turtle syntax. `turtle` and `rdf` name it too. */
|
|
7
|
+
export const FORMAT_TURTLE = "ttl";
|
|
8
|
+
/** The OMG API's JSON element form, the same RDF mapping spelled differently. `json` names it too. */
|
|
9
|
+
export const FORMAT_API_JSON = "api-json";
|
|
10
|
+
const TURTLE_NAMES = new Set(["ttl", "turtle", "rdf"]);
|
|
11
|
+
const API_JSON_NAMES = new Set(["api-json", "json"]);
|
|
12
|
+
const XMI_NAMES = new Set(["xmi", "uml", "mdzip"]);
|
|
13
|
+
/** Whether a format names SysML v1 in any of its forms: `xmi`, `uml` or `mdzip`, spelt as the service reads them. */
|
|
14
|
+
export function isV1(format) {
|
|
15
|
+
return XMI_NAMES.has(format.trim().toLowerCase());
|
|
16
|
+
}
|
|
17
|
+
/** Whether a path's extension names a SysML v1 model: `.xmi`, `.uml` or `.mdzip`. */
|
|
18
|
+
export function pathIsV1(path) {
|
|
19
|
+
const dot = path.lastIndexOf(".");
|
|
20
|
+
return dot !== -1 && XMI_NAMES.has(path.slice(dot + 1).toLowerCase());
|
|
21
|
+
}
|
|
22
|
+
/** Why a v1 model is refused by a conversion, in the words every surface uses. */
|
|
23
|
+
export const MIGRATED_NOT_CONVERTED = "is a SysML v1 model, which is migrated, not converted: every element is mapped, " +
|
|
24
|
+
"approximated or left unmapped and reported element by element";
|
|
25
|
+
/** The fallback wording, for a service too old to send its own notice. */
|
|
26
|
+
export const EXPERIMENTAL_NOTICE = "RDF conversion — Turtle and the API's JSON element form alike — is experimental: the " +
|
|
27
|
+
"mapping covers model structure and the behavior its bodies state, refuses what it " +
|
|
28
|
+
"cannot write back, and its vocabulary may change without a compatibility path; see " +
|
|
29
|
+
"docs/reference/rdf-mapping.md § Status";
|
|
30
|
+
/** The fallback wording for a migration, for a service too old to send its own notice. */
|
|
31
|
+
export const MIGRATION_NOTICE = "SysML v1 migration is experimental: the mapping covers structure, ports and connectors, " +
|
|
32
|
+
"requirements, constraints, instances and allocations, reports every element it approximates " +
|
|
33
|
+
"or leaves behind, and what it writes for a v1 element may change without a compatibility " +
|
|
34
|
+
"path; see docs/reference/sysml-v1-migration.md § Status";
|
|
35
|
+
/** Whether a conversion between these formats uses an experimental mapping. */
|
|
36
|
+
export function isExperimental(fromFormat, toFormat) {
|
|
37
|
+
return (TURTLE_NAMES.has(fromFormat) ||
|
|
38
|
+
TURTLE_NAMES.has(toFormat) ||
|
|
39
|
+
API_JSON_NAMES.has(fromFormat) ||
|
|
40
|
+
API_JSON_NAMES.has(toFormat) ||
|
|
41
|
+
XMI_NAMES.has(fromFormat));
|
|
42
|
+
}
|
|
43
|
+
const EXTENSIONS = new Map([
|
|
44
|
+
[".sysml", FORMAT_SYSML],
|
|
45
|
+
[".kerml", FORMAT_SYSML],
|
|
46
|
+
[".ttl", FORMAT_TURTLE],
|
|
47
|
+
[".turtle", FORMAT_TURTLE],
|
|
48
|
+
[".json", FORMAT_API_JSON],
|
|
49
|
+
]);
|
|
50
|
+
/** The format to write `path` as, from its extension. */
|
|
51
|
+
export function formatOfPath(path) {
|
|
52
|
+
const dot = path.lastIndexOf(".");
|
|
53
|
+
const ext = dot === -1 ? "" : path.slice(dot).toLowerCase();
|
|
54
|
+
const format = EXTENSIONS.get(ext);
|
|
55
|
+
if (format === undefined) {
|
|
56
|
+
const known = [...EXTENSIONS.keys()].sort(byCodeUnit).join(", ");
|
|
57
|
+
throw new RangeError(`cannot tell the format to write ${JSON.stringify(path)} as: expected one of ${known}, ` +
|
|
58
|
+
`or pass toFormat explicitly`);
|
|
59
|
+
}
|
|
60
|
+
return format;
|
|
61
|
+
}
|
|
62
|
+
/** A model written out in one of the formats OpenSysML writes. */
|
|
63
|
+
export class Conversion {
|
|
64
|
+
/** The converted model. */
|
|
65
|
+
content;
|
|
66
|
+
/** Format the source was read as, reported even when inferred. */
|
|
67
|
+
fromFormat;
|
|
68
|
+
/** Format `content` is written in. */
|
|
69
|
+
toFormat;
|
|
70
|
+
/** Syntax errors the service tolerated under `tolerateSyntaxErrors`. */
|
|
71
|
+
diagnostics;
|
|
72
|
+
/** True when the conversion went through the RDF mapping, which is experimental. */
|
|
73
|
+
experimental;
|
|
74
|
+
/** What is experimental about it, in the service's own wording; empty when stable. */
|
|
75
|
+
experimentalNotice;
|
|
76
|
+
constructor(init) {
|
|
77
|
+
this.content = init.content;
|
|
78
|
+
this.fromFormat = init.fromFormat;
|
|
79
|
+
this.toFormat = init.toFormat;
|
|
80
|
+
this.diagnostics = init.diagnostics;
|
|
81
|
+
this.experimental = init.experimental;
|
|
82
|
+
this.experimentalNotice = init.experimentalNotice;
|
|
83
|
+
}
|
|
84
|
+
toString() {
|
|
85
|
+
return this.content;
|
|
86
|
+
}
|
|
87
|
+
get length() {
|
|
88
|
+
return this.content.length;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The account a migration gives of itself: what became of every element. The
|
|
93
|
+
* summary and the four counts always come back; `entries` and `text` when the
|
|
94
|
+
* migration was asked for the report.
|
|
95
|
+
*/
|
|
96
|
+
export class MigrationReport {
|
|
97
|
+
/** The v1 model migrated, as the service named it. */
|
|
98
|
+
source;
|
|
99
|
+
/** The tool that exported it, as its XMI says. */
|
|
100
|
+
exporter;
|
|
101
|
+
/** The one-line account: `migrated N element(s): … mapped, … approximated, … unmapped`. */
|
|
102
|
+
summary;
|
|
103
|
+
/** Elements with a faithful v2 form. */
|
|
104
|
+
mapped;
|
|
105
|
+
/** Elements written in a v2 form that is not quite theirs. */
|
|
106
|
+
approximated;
|
|
107
|
+
/** Elements with no v2 form, left out and reported. */
|
|
108
|
+
unmapped;
|
|
109
|
+
/** Elements the migration does not consider: profile, library and notation-only content, and elements nothing refers to. */
|
|
110
|
+
skipped;
|
|
111
|
+
/** Every element's verdict, when the report was asked for. */
|
|
112
|
+
entries;
|
|
113
|
+
/** The report as `-migration-report` writes it, when asked for; else empty. */
|
|
114
|
+
text;
|
|
115
|
+
constructor(init) {
|
|
116
|
+
this.source = init.source;
|
|
117
|
+
this.exporter = init.exporter;
|
|
118
|
+
this.summary = init.summary;
|
|
119
|
+
this.mapped = init.mapped;
|
|
120
|
+
this.approximated = init.approximated;
|
|
121
|
+
this.unmapped = init.unmapped;
|
|
122
|
+
this.skipped = init.skipped;
|
|
123
|
+
this.entries = init.entries;
|
|
124
|
+
this.text = init.text;
|
|
125
|
+
}
|
|
126
|
+
/** The entries with `verdict`: `mapped`, `approximated`, `unmapped` or `skipped`. */
|
|
127
|
+
byVerdict(verdict) {
|
|
128
|
+
return this.entries.filter((entry) => entry.verdict === verdict);
|
|
129
|
+
}
|
|
130
|
+
toString() {
|
|
131
|
+
return this.text !== "" ? this.text : this.summary;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/** Reads the report the service sent. */
|
|
135
|
+
export function migrationReportOf(message) {
|
|
136
|
+
return new MigrationReport({
|
|
137
|
+
source: message?.source ?? "",
|
|
138
|
+
exporter: message?.exporter ?? "",
|
|
139
|
+
summary: message?.summary ?? "",
|
|
140
|
+
mapped: message?.mapped ?? 0,
|
|
141
|
+
approximated: message?.approximated ?? 0,
|
|
142
|
+
unmapped: message?.unmapped ?? 0,
|
|
143
|
+
skipped: message?.skipped ?? 0,
|
|
144
|
+
entries: (message?.entries ?? []).map((entry) => ({
|
|
145
|
+
id: entry.id,
|
|
146
|
+
kind: entry.kind,
|
|
147
|
+
name: entry.name,
|
|
148
|
+
target: entry.target,
|
|
149
|
+
verdict: entry.verdict,
|
|
150
|
+
note: entry.note,
|
|
151
|
+
})),
|
|
152
|
+
text: message?.text ?? "",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/** A SysML v1 model migrated to one of the formats OpenSysML writes. */
|
|
156
|
+
export class Migration {
|
|
157
|
+
/** The migrated model. */
|
|
158
|
+
content;
|
|
159
|
+
/** The v1 form read, canonically `xmi`: `uml` and `mdzip` name the same reader. */
|
|
160
|
+
fromFormat;
|
|
161
|
+
/** Format `content` is written in. */
|
|
162
|
+
toFormat;
|
|
163
|
+
/** What became of every element; the summary and the counts come back with every migration. */
|
|
164
|
+
report;
|
|
165
|
+
/** The JSON index of the result snapshots the v1 tool stored, as `-migration-results` writes it, when asked for; else empty. */
|
|
166
|
+
results;
|
|
167
|
+
/** Image files the model's diagrams embed, by the relative path `content` refers to them with. */
|
|
168
|
+
files;
|
|
169
|
+
/** The path the v1 model was read from, as given; empty when it was inline content. */
|
|
170
|
+
sourcePath;
|
|
171
|
+
/** Always true: the migration is experimental. */
|
|
172
|
+
experimental = true;
|
|
173
|
+
/** What is experimental about it, in the service's own wording. */
|
|
174
|
+
experimentalNotice;
|
|
175
|
+
constructor(init) {
|
|
176
|
+
this.content = init.content;
|
|
177
|
+
this.fromFormat = init.fromFormat;
|
|
178
|
+
this.toFormat = init.toFormat;
|
|
179
|
+
this.report = init.report;
|
|
180
|
+
this.results = init.results;
|
|
181
|
+
this.files = init.files;
|
|
182
|
+
this.sourcePath = init.sourcePath;
|
|
183
|
+
this.experimentalNotice = init.experimentalNotice;
|
|
184
|
+
}
|
|
185
|
+
toString() {
|
|
186
|
+
return this.content;
|
|
187
|
+
}
|
|
188
|
+
get length() {
|
|
189
|
+
return this.content.length;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { DocumentEvent as PbDocumentEvent, DocumentQueryBinding, RunDocumentQueryResponse } from "../generated/sysml_pb.js";
|
|
2
|
+
import { type SysMLValue } from "./values.js";
|
|
3
|
+
/** Whether a wire binding sends an Integer beyond int64, which needs `big_int_values`. */
|
|
4
|
+
export declare function bindingHoldsBigInt(binding: DocumentQueryBinding): boolean;
|
|
5
|
+
/** Whether a wire binding sends an exact Rational, which needs `rational_values`. */
|
|
6
|
+
export declare function bindingHoldsRational(binding: DocumentQueryBinding): boolean;
|
|
7
|
+
/** Rewrites each Rational a binding sends that a double holds exactly as that double, for a service without `rational_values`. */
|
|
8
|
+
export declare function bindingRationalsAsReals(binding: DocumentQueryBinding): void;
|
|
9
|
+
/** A model element, named by qualified name. */
|
|
10
|
+
export declare class ElementRef {
|
|
11
|
+
/** Qualified name of the element. */
|
|
12
|
+
readonly id: string;
|
|
13
|
+
/** Metamodel type name; empty when bound by a caller, reported when answered. */
|
|
14
|
+
readonly type: string;
|
|
15
|
+
constructor(id: string, type?: string);
|
|
16
|
+
toString(): string;
|
|
17
|
+
}
|
|
18
|
+
/** An object the service holds for the model, created by `instantiate`. */
|
|
19
|
+
export declare class ObjectRef {
|
|
20
|
+
/** The object's id, as `instantiate` answered it. */
|
|
21
|
+
readonly id: bigint;
|
|
22
|
+
/** The object by the label a session reaches it under. */
|
|
23
|
+
readonly path: string;
|
|
24
|
+
/** The usage the object is held under; reported when answered, ignored when bound. */
|
|
25
|
+
readonly element: ElementRef | undefined;
|
|
26
|
+
constructor(options?: {
|
|
27
|
+
id?: bigint | number;
|
|
28
|
+
path?: string;
|
|
29
|
+
element?: ElementRef;
|
|
30
|
+
});
|
|
31
|
+
toString(): string;
|
|
32
|
+
}
|
|
33
|
+
/** A row a `Verdicts` query answered: an assertion checked on one object. Answered only. */
|
|
34
|
+
export declare class DocumentVerdict {
|
|
35
|
+
readonly assertion: ElementRef;
|
|
36
|
+
/** "constraint", "requirement", "satisfaction" or "verification". */
|
|
37
|
+
readonly kind: string;
|
|
38
|
+
/** The assertion as written. */
|
|
39
|
+
readonly text: string;
|
|
40
|
+
/** The object checked, named from the element the query was bound to. */
|
|
41
|
+
readonly path: string;
|
|
42
|
+
/** "holds", "violated" or "undecided". */
|
|
43
|
+
readonly status: string;
|
|
44
|
+
/** The condition that evaluated to false, as written; empty otherwise. */
|
|
45
|
+
readonly condition: string;
|
|
46
|
+
/** Why the assertion is violated or undecided; empty when it holds. */
|
|
47
|
+
readonly reason: string;
|
|
48
|
+
/** Verdict kinds of the verification cases verifying the row's requirement. */
|
|
49
|
+
readonly verification: readonly string[];
|
|
50
|
+
constructor(init: {
|
|
51
|
+
assertion: ElementRef;
|
|
52
|
+
kind: string;
|
|
53
|
+
text: string;
|
|
54
|
+
path: string;
|
|
55
|
+
status: string;
|
|
56
|
+
condition?: string;
|
|
57
|
+
reason?: string;
|
|
58
|
+
verification?: readonly string[];
|
|
59
|
+
});
|
|
60
|
+
toString(): string;
|
|
61
|
+
}
|
|
62
|
+
/** A row a `States` query answered: one active leaf state of one object. Answered only. */
|
|
63
|
+
export declare class DocumentState {
|
|
64
|
+
/** The object whose state machine the row reads. */
|
|
65
|
+
readonly object: ObjectRef;
|
|
66
|
+
/** The exhibited state usage's name, or the state def's. */
|
|
67
|
+
readonly machine: string;
|
|
68
|
+
/** The active leaf state's own name. */
|
|
69
|
+
readonly name: string;
|
|
70
|
+
/** The leaf's path from the machine's top level. */
|
|
71
|
+
readonly path: string;
|
|
72
|
+
/** The state usage's declaration. */
|
|
73
|
+
readonly state: ElementRef | undefined;
|
|
74
|
+
/** The orthogonal region declaring the leaf; empty when not in one. */
|
|
75
|
+
readonly region: string;
|
|
76
|
+
/** The active composite states around the leaf, outermost first. */
|
|
77
|
+
readonly enclosing: readonly string[];
|
|
78
|
+
constructor(init: {
|
|
79
|
+
object: ObjectRef;
|
|
80
|
+
machine: string;
|
|
81
|
+
name: string;
|
|
82
|
+
path: string;
|
|
83
|
+
state?: ElementRef;
|
|
84
|
+
region?: string;
|
|
85
|
+
enclosing?: readonly string[];
|
|
86
|
+
});
|
|
87
|
+
toString(): string;
|
|
88
|
+
}
|
|
89
|
+
/** A row an `Events` query answered: one record of a session's trace. Answered only. */
|
|
90
|
+
export declare class DocumentEvent {
|
|
91
|
+
/** "accept", "send", "transition", "entry", "exit", "do", "choice", "guard" or "terminate". */
|
|
92
|
+
readonly kind: string;
|
|
93
|
+
/** The instant the record was written at: a quantity, an int or a real. */
|
|
94
|
+
readonly time: DocumentValue;
|
|
95
|
+
/** The object the record is about; undefined for a record of the run as a whole. */
|
|
96
|
+
readonly object: ObjectRef | undefined;
|
|
97
|
+
/** The state machine the record is about. */
|
|
98
|
+
readonly machine: string;
|
|
99
|
+
/** The state entered, exited or run (entry, exit and do records). */
|
|
100
|
+
readonly state: string;
|
|
101
|
+
/** The transition's source state. */
|
|
102
|
+
readonly fromState: string;
|
|
103
|
+
/** The transition's target state. */
|
|
104
|
+
readonly toState: string;
|
|
105
|
+
/** The object a send was delivered to. */
|
|
106
|
+
readonly target: ObjectRef | undefined;
|
|
107
|
+
/** The accepted or sent event's type name. */
|
|
108
|
+
readonly event: string;
|
|
109
|
+
/** The accept's payload, one `name = value` text per attribute. */
|
|
110
|
+
readonly payload: readonly string[];
|
|
111
|
+
/** What a choice drew from, in order. */
|
|
112
|
+
readonly alternatives: readonly string[];
|
|
113
|
+
/** The alternative the choice took. */
|
|
114
|
+
readonly taken: string;
|
|
115
|
+
/** The record as the trace prints it. */
|
|
116
|
+
readonly text: string;
|
|
117
|
+
constructor(init: {
|
|
118
|
+
kind: string;
|
|
119
|
+
time: DocumentValue;
|
|
120
|
+
text: string;
|
|
121
|
+
object?: ObjectRef;
|
|
122
|
+
machine?: string;
|
|
123
|
+
state?: string;
|
|
124
|
+
fromState?: string;
|
|
125
|
+
toState?: string;
|
|
126
|
+
target?: ObjectRef;
|
|
127
|
+
event?: string;
|
|
128
|
+
payload?: readonly string[];
|
|
129
|
+
alternatives?: readonly string[];
|
|
130
|
+
taken?: string;
|
|
131
|
+
});
|
|
132
|
+
toString(): string;
|
|
133
|
+
}
|
|
134
|
+
export type DocumentValue = ElementRef | ObjectRef | DocumentVerdict | DocumentState | DocumentEvent | string | bigint | number | boolean | {
|
|
135
|
+
kind: "infinity";
|
|
136
|
+
} | Extract<SysMLValue, {
|
|
137
|
+
kind: "rational";
|
|
138
|
+
}> | ({
|
|
139
|
+
kind: "quantity";
|
|
140
|
+
} & Extract<SysMLValue, {
|
|
141
|
+
kind: "quantity";
|
|
142
|
+
}>);
|
|
143
|
+
/** What `bindings` accepts for one parameter: one value or several. */
|
|
144
|
+
export type BindingValues = DocumentValue | readonly DocumentValue[];
|
|
145
|
+
/** One selected element and its projected cells, one per column. */
|
|
146
|
+
export declare class DocumentRow {
|
|
147
|
+
/** The selected element itself, or the usage the row's object is held under. */
|
|
148
|
+
readonly element: ElementRef;
|
|
149
|
+
/** One value sequence per column, in column order. */
|
|
150
|
+
readonly cells: readonly (readonly DocumentValue[])[];
|
|
151
|
+
/** The verdict a `Verdicts` row carries; undefined for any other row. */
|
|
152
|
+
readonly verdict: DocumentVerdict | undefined;
|
|
153
|
+
/** The object a row over held objects is about; undefined for any other row. */
|
|
154
|
+
readonly object: ObjectRef | undefined;
|
|
155
|
+
/** The state a `States` row carries; undefined for any other row. */
|
|
156
|
+
readonly state: DocumentState | undefined;
|
|
157
|
+
/** The event an `Events` row carries; undefined for any other row. */
|
|
158
|
+
readonly event: DocumentEvent | undefined;
|
|
159
|
+
constructor(init: {
|
|
160
|
+
element: ElementRef;
|
|
161
|
+
cells: readonly (readonly DocumentValue[])[];
|
|
162
|
+
verdict?: DocumentVerdict;
|
|
163
|
+
object?: ObjectRef;
|
|
164
|
+
state?: DocumentState;
|
|
165
|
+
event?: DocumentEvent;
|
|
166
|
+
});
|
|
167
|
+
/** The values of the `index`-th column. */
|
|
168
|
+
cell(index: number): readonly DocumentValue[];
|
|
169
|
+
}
|
|
170
|
+
/** A document query's answer: projected columns and typed rows, in the engine's order. */
|
|
171
|
+
export declare class DocumentQueryResult {
|
|
172
|
+
/** Projected property names, in projection order. */
|
|
173
|
+
readonly columns: readonly string[];
|
|
174
|
+
/** The selected rows, in the engine's order. */
|
|
175
|
+
readonly rows: readonly DocumentRow[];
|
|
176
|
+
constructor(init: {
|
|
177
|
+
columns: readonly string[];
|
|
178
|
+
rows: readonly DocumentRow[];
|
|
179
|
+
});
|
|
180
|
+
get length(): number;
|
|
181
|
+
[Symbol.iterator](): Iterator<DocumentRow>;
|
|
182
|
+
}
|
|
183
|
+
/** Translate a bindings mapping into the RPC's protobuf. */
|
|
184
|
+
export declare function buildBindings(bindings: Readonly<Record<string, BindingValues>> | undefined): DocumentQueryBinding[];
|
|
185
|
+
/** Decode a `RunDocumentQueryResponse` into a `DocumentQueryResult`. */
|
|
186
|
+
export declare function documentResult(response: RunDocumentQueryResponse): DocumentQueryResult;
|
|
187
|
+
/** Decode a run-trace event using the document query's event conversion. */
|
|
188
|
+
export declare function documentEventOf(event: PbDocumentEvent): DocumentEvent;
|