@openmbee/opensysml 0.11.0 → 0.11.1-nightly.20261029.ge6cbbbaa8

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 CHANGED
@@ -145,7 +145,11 @@ const connection = await connect({ address: "localhost:50051" });
145
145
  await connection.close(); // that service keeps running
146
146
  ```
147
147
 
148
- or set `$OPENSYSML_SERVICE=host:port`. A connection made this way never owns the
148
+ or set `$OPENSYSML_SERVICE=host:port`. A service that other machines reach
149
+ requires a bearer token: pass `token` (or set `$OPENSYSML_GRPC_TOKEN`) and every
150
+ call carries `Authorization: Bearer`; a wrong or missing one is a `ServiceError`
151
+ with code `UNAUTHENTICATED`. A private child needs no token and is started
152
+ without `$OPENSYSML_GRPC_TOKEN` in its environment. A connection made this way never owns the
149
153
  service: closing it disconnects and nothing else. There is no adoption of a
150
154
  service left listening by another process, no pidfile and no port probing.
151
155
 
@@ -563,8 +567,8 @@ const markdown = await model.renderDocument("Observatory::Overview");
563
567
  wire `query`), never both a structured form and `oslc`. A binding value is an
564
568
  `ElementRef`, an `ObjectRef`, a primitive or a quantity; `runDocumentQuery`
565
569
  answers the typed `DocumentQueryResult` — `rows` of `DocumentValue`s, the schema
566
- the query declared — and `renderDocument` answers Markdown, or HTML with
567
- `{ form: "html" }`.
570
+ the query declared — and `renderDocument` answers Markdown, HTML with
571
+ `{ form: "html" }`, or AsciiDoc with `{ form: "asciidoc" }`.
568
572
 
569
573
  ## Execution and exploration
570
574
 
@@ -48,14 +48,20 @@ export declare const CAPABILITY_VERIFICATION = "verification";
48
48
  export declare const CAPABILITY_VERIFICATION_QUESTIONS = "verification_questions";
49
49
  /** `arguments` and `named_arguments` on VerifyConstraint and VerifyRequirement. */
50
50
  export declare const CAPABILITY_VERIFICATION_ARGUMENTS = "verification_arguments";
51
+ /** `notes` on every Verdict; a service without it answers with none. */
52
+ export declare const CAPABILITY_VERDICT_NOTES = "verdict_notes";
51
53
  /** The `Query` RPC. */
52
54
  export declare const CAPABILITY_QUERY = "query";
55
+ /** `orderBy` on `Query`; a service without it would ignore the field. */
56
+ export declare const CAPABILITY_QUERY_ORDER_BY = "query_order_by";
53
57
  /** The `RunDocumentQuery` RPC. */
54
58
  export declare const CAPABILITY_DOCUMENT_QUERY = "document_query";
55
59
  /** The `RenderDocument` RPC. */
56
60
  export declare const CAPABILITY_RENDER_DOCUMENT = "render_document";
57
61
  /** `form` on `RenderDocumentRequest` asking for HTML rather than Markdown. */
58
62
  export declare const CAPABILITY_RENDER_DOCUMENT_HTML = "render_document_html";
63
+ /** `form` on `RenderDocumentRequest` asking for AsciiDoc, answered in `asciidoc`. */
64
+ export declare const CAPABILITY_RENDER_DOCUMENT_ASCIIDOC = "render_document_asciidoc";
59
65
  /** The `RenderView` RPC, returning typed diagram data. */
60
66
  export declare const CAPABILITY_RENDER_VIEW = "render_view";
61
67
  /** The `ExportGraphs` RPC, exporting a behavior's lowered graph as `graphs:1` JSON. */
@@ -128,6 +134,10 @@ export declare const CAPABILITY_RATIONAL_VALUES = "rational_values";
128
134
  export declare const CAPABILITY_CONVERT_DOCUMENTS = "convert_documents";
129
135
  /** `ConvertRequest.compact`, `omitDerived` and `keepDerived`: api-json written as the compact document (an id table and handles), optionally without derived properties. */
130
136
  export declare const CAPABILITY_CONVERT_COMPACT = "convert_compact";
137
+ /** The standard-library name table outside API JSON's element array. */
138
+ export declare const CAPABILITY_CONVERT_LIBRARY_REFERENCES = "convert_library_references";
139
+ /** Opt-in ownerless library stubs for legacy API JSON readers. */
140
+ export declare const CAPABILITY_CONVERT_LIBRARY_STUBS = "convert_library_stubs";
131
141
  /** `ConvertRequest.includeCheckDiagnostics`: the semantic check's diagnostics, each with its own severity, reported alongside the converted output. */
132
142
  export declare const CAPABILITY_CONVERT_CHECK_DIAGNOSTICS = "convert_check_diagnostics";
133
143
  /** `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. */
@@ -52,14 +52,20 @@ export const CAPABILITY_VERIFICATION = "verification";
52
52
  export const CAPABILITY_VERIFICATION_QUESTIONS = "verification_questions";
53
53
  /** `arguments` and `named_arguments` on VerifyConstraint and VerifyRequirement. */
54
54
  export const CAPABILITY_VERIFICATION_ARGUMENTS = "verification_arguments";
55
+ /** `notes` on every Verdict; a service without it answers with none. */
56
+ export const CAPABILITY_VERDICT_NOTES = "verdict_notes";
55
57
  /** The `Query` RPC. */
56
58
  export const CAPABILITY_QUERY = "query";
59
+ /** `orderBy` on `Query`; a service without it would ignore the field. */
60
+ export const CAPABILITY_QUERY_ORDER_BY = "query_order_by";
57
61
  /** The `RunDocumentQuery` RPC. */
58
62
  export const CAPABILITY_DOCUMENT_QUERY = "document_query";
59
63
  /** The `RenderDocument` RPC. */
60
64
  export const CAPABILITY_RENDER_DOCUMENT = "render_document";
61
65
  /** `form` on `RenderDocumentRequest` asking for HTML rather than Markdown. */
62
66
  export const CAPABILITY_RENDER_DOCUMENT_HTML = "render_document_html";
67
+ /** `form` on `RenderDocumentRequest` asking for AsciiDoc, answered in `asciidoc`. */
68
+ export const CAPABILITY_RENDER_DOCUMENT_ASCIIDOC = "render_document_asciidoc";
63
69
  /** The `RenderView` RPC, returning typed diagram data. */
64
70
  export const CAPABILITY_RENDER_VIEW = "render_view";
65
71
  /** The `ExportGraphs` RPC, exporting a behavior's lowered graph as `graphs:1` JSON. */
@@ -132,6 +138,10 @@ export const CAPABILITY_RATIONAL_VALUES = "rational_values";
132
138
  export const CAPABILITY_CONVERT_DOCUMENTS = "convert_documents";
133
139
  /** `ConvertRequest.compact`, `omitDerived` and `keepDerived`: api-json written as the compact document (an id table and handles), optionally without derived properties. */
134
140
  export const CAPABILITY_CONVERT_COMPACT = "convert_compact";
141
+ /** The standard-library name table outside API JSON's element array. */
142
+ export const CAPABILITY_CONVERT_LIBRARY_REFERENCES = "convert_library_references";
143
+ /** Opt-in ownerless library stubs for legacy API JSON readers. */
144
+ export const CAPABILITY_CONVERT_LIBRARY_STUBS = "convert_library_stubs";
135
145
  /** `ConvertRequest.includeCheckDiagnostics`: the semantic check's diagnostics, each with its own severity, reported alongside the converted output. */
136
146
  export const CAPABILITY_CONVERT_CHECK_DIAGNOSTICS = "convert_check_diagnostics";
137
147
  /** `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. */
@@ -6,7 +6,7 @@ import { Model } from "./model.js";
6
6
  import type { ParseOptions } from "./model.js";
7
7
  import { type Source } from "./sources.js";
8
8
  import { Conversion, Migration } from "./conversion.js";
9
- import type { MigrateOptions } from "./conversion.js";
9
+ import type { ConvertOptions, MigrateOptions } from "./conversion.js";
10
10
  import { type QueryElement, type QueryForm, type QueryPayload } from "./query.js";
11
11
  import { DocumentEvent, type BindingValues, type DocumentQueryResult } from "./document.js";
12
12
  import { type RenderedView } from "./render-view.js";
@@ -34,6 +34,8 @@ export interface TransportOptions {
34
34
  timeoutMs?: number;
35
35
  /** Extra headers sent with every call. */
36
36
  headers?: Record<string, string>;
37
+ /** Bearer token every call carries, for a service that requires one. */
38
+ token?: string;
37
39
  /** Called with each response, for logging, metrics or a conformance runner. */
38
40
  onResponse?: ResponseTap;
39
41
  }
@@ -128,10 +130,7 @@ export declare class Connection {
128
130
  content: string;
129
131
  } | {
130
132
  modelHash: string;
131
- }, options?: {
132
- fromFormat?: string;
133
- tolerateSyntaxErrors?: boolean;
134
- }): Promise<Conversion>;
133
+ }, options?: ConvertOptions): Promise<Conversion>;
135
134
  /**
136
135
  * Migrates a SysML v1 model — a Cameo/MagicDraw `.mdzip`, a UML XMI `.xmi` or
137
136
  * an Eclipse UML2 `.uml` export — to one of the formats OpenSysML writes. A
@@ -2,7 +2,7 @@
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_DOCUMENT_QUERY, CAPABILITY_ENGINES, CAPABILITY_FEATURE_VALUES, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MIGRATE, CAPABILITY_PARSE_SOURCES, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_QUERY, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, 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";
5
+ import { CAPABILITY_APPLY_EDITS, CAPABILITY_BIG_INT_VALUES, CAPABILITY_RATIONAL_VALUES, CAPABILITY_CONVERT, CAPABILITY_CONVERT_LIBRARY_STUBS, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_ENGINES, CAPABILITY_FEATURE_VALUES, CAPABILITY_INLINE_LANGUAGE, CAPABILITY_MIGRATE, CAPABILITY_PARSE_SOURCES, CAPABILITY_PERFORMER, CAPABILITY_STATE_TRACE, CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY, 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
6
  import { ClosedConnectionError, ConversionError, ExecutionError, InvalidRequestError, MigrationError, ParseError, StaleServiceError, UnsupportedValueError, } from "./errors.js";
7
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";
8
8
  import { callRpc, fromHandshakeError, fromRpcError } from "./status.js";
@@ -147,10 +147,14 @@ export class Connection {
147
147
  });
148
148
  }
149
149
  requireCapability(this.info, CAPABILITY_CONVERT, upgradeRemedy(CAPABILITY_CONVERT));
150
+ if (options.includeLibraryStubs) {
151
+ requireCapability(this.info, CAPABILITY_CONVERT_LIBRARY_STUBS, upgradeRemedy(CAPABILITY_CONVERT_LIBRARY_STUBS));
152
+ }
150
153
  const request = create(ConvertRequestSchema, {
151
154
  toFormat,
152
155
  fromFormat: options.fromFormat ?? "",
153
156
  tolerateSyntaxErrors: options.tolerateSyntaxErrors === true,
157
+ includeLibraryStubs: options.includeLibraryStubs === true,
154
158
  });
155
159
  if ("path" in source) {
156
160
  request.source = { case: "filePath", value: source.path };
@@ -180,6 +184,7 @@ export class Connection {
180
184
  throw new ConversionError(response.error, diagnostics);
181
185
  }
182
186
  return new Conversion({
187
+ libraryReferences: response.libraryReferences,
183
188
  content: response.content,
184
189
  fromFormat: response.fromFormat,
185
190
  toFormat: response.toFormat,
@@ -261,12 +266,18 @@ export class Connection {
261
266
  }
262
267
  /** Runs a SysML v2 API & Services Query over a loaded model. */
263
268
  async query(modelHash, options = {}) {
264
- requireCapability(this.info, CAPABILITY_QUERY, upgradeRemedy(CAPABILITY_QUERY));
269
+ const query = queryField(options);
270
+ const needed = query.query !== undefined && query.query.orderBy.length > 0
271
+ ? [CAPABILITY_QUERY, CAPABILITY_QUERY_ORDER_BY]
272
+ : [CAPABILITY_QUERY];
273
+ for (const capability of needed) {
274
+ requireCapability(this.info, capability, upgradeRemedy(capability));
275
+ }
265
276
  const response = await callRpc(this.rpc.query(create(QueryRequestSchema, {
266
277
  modelHash,
267
278
  oslcQuery: options.oslc ?? "",
268
- ...queryField(options),
269
- }), this.callOptions()), "model", capabilityRefusal(this.info, [CAPABILITY_QUERY]));
279
+ ...query,
280
+ }), this.callOptions()), "model", capabilityRefusal(this.info, needed));
270
281
  return elementsOf(response);
271
282
  }
272
283
  /** Runs a named document query and answers its typed rows. */
@@ -314,13 +325,16 @@ export class Connection {
314
325
  /** Renders a named document to Markdown or HTML. */
315
326
  async renderDocument(modelHash, documentId, options = {}) {
316
327
  const form = options.form ?? "markdown";
317
- if (form !== "markdown" && form !== "html") {
318
- throw new RangeError("form must be 'markdown' or 'html'");
328
+ if (form !== "markdown" && form !== "html" && form !== "asciidoc") {
329
+ throw new RangeError("form must be 'markdown', 'html' or 'asciidoc'");
319
330
  }
320
331
  const capabilities = [CAPABILITY_RENDER_DOCUMENT];
321
332
  if (form === "html") {
322
333
  capabilities.push(CAPABILITY_RENDER_DOCUMENT_HTML);
323
334
  }
335
+ else if (form === "asciidoc") {
336
+ capabilities.push(CAPABILITY_RENDER_DOCUMENT_ASCIIDOC);
337
+ }
324
338
  for (const capability of capabilities) {
325
339
  requireCapability(this.info, capability, upgradeRemedy(capability));
326
340
  }
@@ -329,7 +343,10 @@ export class Connection {
329
343
  documentId,
330
344
  form: form === "markdown" ? "" : form,
331
345
  }), this.callOptions()), "model", capabilityRefusal(this.info, capabilities));
332
- return form === "html" ? response.html : response.markdown;
346
+ if (form === "html") {
347
+ return response.html;
348
+ }
349
+ return form === "asciidoc" ? response.asciidoc : response.markdown;
333
350
  }
334
351
  /**
335
352
  * Renders a named view or targeted pseudo-view as diagram data. `show` names
@@ -20,6 +20,19 @@ export declare const MIGRATION_NOTICE: string;
20
20
  export declare function isExperimental(fromFormat: string, toFormat: string): boolean;
21
21
  /** The format to write `path` as, from its extension. */
22
22
  export declare function formatOfPath(path: string): string;
23
+ /** Options for writing a model through Convert. */
24
+ export interface ConvertOptions {
25
+ fromFormat?: string;
26
+ tolerateSyntaxErrors?: boolean;
27
+ /** Restore pre-0.11.0 ownerless library stubs in API JSON. Default off. */
28
+ includeLibraryStubs?: boolean;
29
+ }
30
+ /** A referenced standard-library element, not a model root. */
31
+ export interface LibraryReference {
32
+ readonly id: string;
33
+ readonly qualifiedName: string;
34
+ readonly type: string;
35
+ }
23
36
  /** A model written out in one of the formats OpenSysML writes. */
24
37
  export declare class Conversion {
25
38
  /** The converted model. */
@@ -34,6 +47,8 @@ export declare class Conversion {
34
47
  readonly experimental: boolean;
35
48
  /** What is experimental about it, in the service's own wording; empty when stable. */
36
49
  readonly experimentalNotice: string;
50
+ /** Names referenced by API JSON output, outside its element array. */
51
+ readonly libraryReferences: readonly LibraryReference[];
37
52
  constructor(init: {
38
53
  content: string;
39
54
  fromFormat: string;
@@ -41,6 +56,7 @@ export declare class Conversion {
41
56
  diagnostics: readonly ModelDiagnostic[];
42
57
  experimental: boolean;
43
58
  experimentalNotice: string;
59
+ libraryReferences?: readonly LibraryReference[];
44
60
  });
45
61
  toString(): string;
46
62
  get length(): number;
@@ -73,6 +73,8 @@ export class Conversion {
73
73
  experimental;
74
74
  /** What is experimental about it, in the service's own wording; empty when stable. */
75
75
  experimentalNotice;
76
+ /** Names referenced by API JSON output, outside its element array. */
77
+ libraryReferences;
76
78
  constructor(init) {
77
79
  this.content = init.content;
78
80
  this.fromFormat = init.fromFormat;
@@ -80,6 +82,7 @@ export class Conversion {
80
82
  this.diagnostics = init.diagnostics;
81
83
  this.experimental = init.experimental;
82
84
  this.experimentalNotice = init.experimentalNotice;
85
+ this.libraryReferences = init.libraryReferences ?? [];
83
86
  }
84
87
  toString() {
85
88
  return this.content;
@@ -6,7 +6,7 @@ export type { AttributeFacts, EvalOptions, FeatureValue, Multiplicity, ParseOpti
6
6
  export { LANGUAGES, SourceDocument, sourceDocuments } from "./sources.js";
7
7
  export type { Source } from "./sources.js";
8
8
  export { Conversion, EXPERIMENTAL_NOTICE, FORMAT_API_JSON, FORMAT_SYSML, FORMAT_TURTLE, MIGRATED_NOT_CONVERTED, MIGRATION_NOTICE, Migration, MigrationReport, formatOfPath, isExperimental, isV1, migrationReportOf, pathIsV1, } from "./conversion.js";
9
- export type { MigrateOptions, MigrationEntry } from "./conversion.js";
9
+ export type { ConvertOptions, LibraryReference, MigrateOptions, MigrationEntry } from "./conversion.js";
10
10
  export { QueryElement, TYPE_COMPOSITE_CONSTRAINT, TYPE_PRIMITIVE_CONSTRAINT, TYPE_QUERY, buildQuery, } from "./query.js";
11
11
  export type { ConstraintPayload, QueryForm, QueryPayload, ScopeEntry } from "./query.js";
12
12
  export { DocumentQueryResult, DocumentRow, DocumentEvent, documentEventOf, DocumentState, DocumentVerdict, ElementRef, ObjectRef, buildBindings, } from "./document.js";
@@ -24,7 +24,7 @@ export type { EditOperationData, EditTarget } from "./edit.js";
24
24
  export type { ToolDryRun } from "./verdict.js";
25
25
  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
26
  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_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_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, CAPABILITY_AUTHORING, CAPABILITY_COMMENT_AUTHORING, CAPABILITY_CONNECTION_AUTHORING, CAPABILITY_CONSTRAINT_BODY_AUTHORING, CAPABILITY_DOCUMENTATION_AUTHORING, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_IMPLICIT_PARAMETERS, CAPABILITY_IMPORT_AUTHORING, CAPABILITY_MEMBER_MODIFIERS, CAPABILITY_METADATA_AUTHORING, CAPABILITY_METADATA_PREFIX_AUTHORING, CAPABILITY_PARSE_SOURCES, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.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_QUERY, CAPABILITY_QUERY_ORDER_BY, 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";
28
28
  export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, MemberNameTakenError, MigrationError, MoveReferencedError, NoEditsError, OverlappingEditsError, OwnerInsideTargetError, OwnerNotFoundError, OwnerNotNamespaceError, ReferencedElsewhereError, Referrer, RenameReferencedError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, QueryError, ServiceError, ServiceStartError, ServiceTimeoutError, ServiceUnavailableError, StaleServiceError, SymbolNotFoundError, TypeMismatchError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, UnsupportedValueError, WrongKindError, } from "./errors.js";
29
29
  export type { FailureCause, ModelDiagnostic } from "./errors.js";
30
30
  export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
@@ -32,7 +32,7 @@ export type { FeatureDecoder, InstanceResolver, Quantity, TypedObjectClass, } fr
32
32
  export { callRpc, fromHandshakeError, fromRpcError, statusName } from "./status.js";
33
33
  export type { NotFoundSubject, UnimplementedMapping } from "./status.js";
34
34
  export { decodeValue, decodeVerdict, decodeStanding, encodeValue, formatRational, formatValue, rational, rationalOfDouble, rationalToNumber, rationalsAsReals, requireInput, toValue, valuesEqual, } from "./values.js";
35
- export type { ArrayValue, ComplexValue, EnumValue, FunctionValue, Magnitude, MeasurementRefValue, MetaobjectValue, QuantityValue, RationalValue, SysMLValue, SysMLVerdict, ValueInput, VerdictBound, VerdictStanding, VerificationVerdict, WitnessAssignment, TensorQuantityValue, UndeterminedValue, UnitFactor, UnitFactorization, VerdictSubject, } from "./values.js";
35
+ export type { ArrayValue, ComplexValue, EnumValue, FunctionValue, Magnitude, MeasurementRefValue, MetaobjectValue, QuantityValue, RationalValue, SysMLValue, SysMLVerdict, ValueInput, VerdictBound, VerdictStanding, VerificationVerdict, WitnessAssignment, VerdictNote, TensorQuantityValue, UndeterminedValue, UnitFactor, UnitFactorization, VerdictSubject, } from "./values.js";
36
36
  export { baseUrl } from "./transport.js";
37
37
  export { PACKAGE_NAME, PLATFORM_PACKAGE_PREFIX } from "./package.js";
38
38
  export { SysMLService } from "../generated/sysml_pb.js";
@@ -10,7 +10,7 @@ export { ENGINE_ALL, ENGINE_AUTO, STRENGTH_BOUNDED, STRENGTH_NOT_COVERED, STRENG
10
10
  export { Exploration, Outcome } from "./exploration.js";
11
11
  export { AppliedEdit, Body, EditedDocument, EditRequestBuilder, EditResult, Editor, editErrorOf, editResultOf, errorForFailure, failureName, referrersOf, } from "./edit.js";
12
12
  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_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_QUERY, CAPABILITY_SCHEDULE, CAPABILITY_SCHEDULE_EXPLORE, CAPABILITY_SEQUENCE_AUTHORING, CAPABILITY_SET_VALUES, CAPABILITY_STRICT_CONFORMANCE, CAPABILITY_STRUCTURED_VALUES, CAPABILITY_UNDETERMINED_VALUE, CAPABILITY_VERIFICATION_VERDICTS, CAPABILITY_SYMBOL_ATTRIBUTES, CAPABILITY_TENSOR_VALUES, CAPABILITY_TYPE_FACTS, CAPABILITY_UNSET_VALUE, CAPABILITY_VERIFICATION, CAPABILITY_AUTHORING, CAPABILITY_COMMENT_AUTHORING, CAPABILITY_CONNECTION_AUTHORING, CAPABILITY_CONSTRAINT_BODY_AUTHORING, CAPABILITY_DOCUMENTATION_AUTHORING, CAPABILITY_DOCUMENT_QUERY, CAPABILITY_IMPLICIT_PARAMETERS, CAPABILITY_IMPORT_AUTHORING, CAPABILITY_MEMBER_MODIFIERS, CAPABILITY_METADATA_AUTHORING, CAPABILITY_METADATA_PREFIX_AUTHORING, CAPABILITY_PARSE_SOURCES, CAPABILITY_RENDER_DOCUMENT, CAPABILITY_RENDER_DOCUMENT_HTML, CAPABILITY_REQUIREMENT_CONSTRAINT_AUTHORING, CAPABILITY_SATISFY_AUTHORING, CAPABILITY_STATE_ACTION_AUTHORING, CAPABILITY_TRANSITION_AUTHORING, CAPABILITY_VERIFICATION_OBJECTIVE_AUTHORING, CAPABILITY_VERIFICATION_QUESTIONS, CAPABILITY_VERIFICATION_ARGUMENTS, MissingCapabilityError, ServerInfo, capabilityRefusal, mismatchReason, requireCapability, upgradeRemedy, CAPABILITY_IMPORT_DATA, CAPABILITY_COMPARE_RESULTS, } from "./capabilities.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_QUERY, CAPABILITY_QUERY_ORDER_BY, 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";
14
14
  export { AnalysisRunError, ChecksumMismatchError, ClosedConnectionError, ConversionError, DeleteReferencedError, DocumentQueryError, DownloadError, EditError, EditResultError, EditTargetError, EvaluationError, ExecutionError, FeatureValueError, IllegalMemberKindError, InstanceTypeError, InvalidEditError, InvalidRequestError, MemberNameTakenError, MigrationError, MoveReferencedError, NoEditsError, OverlappingEditsError, OwnerInsideTargetError, OwnerNotFoundError, OwnerNotNamespaceError, ReferencedElsewhereError, Referrer, RenameReferencedError, MalformedValueError, ManifestSignatureError, ModelFileNotFoundError, ModelNotFoundError, OpenSysMLError, ParseError, QueryError, ServiceError, ServiceStartError, ServiceTimeoutError, ServiceUnavailableError, StaleServiceError, SymbolNotFoundError, TypeMismatchError, UnpinnedReleaseError, UnsignedReleaseError, UnsupportedOperationError, UnsupportedValueError, WrongKindError, } from "./errors.js";
15
15
  export { TypedObject, asBoolean, asComplex, asEnum, asInt, asObject, asQuantity, asRational, asReal, asString, asTyped, featureValue, listFeatureValue, optionalFeatureValue, registerTyped, } from "./typed.js";
16
16
  export { callRpc, fromHandshakeError, fromRpcError, statusName } from "./status.js";
@@ -1,6 +1,6 @@
1
1
  import type { Connection, VerifyOptions } from "./connection.js";
2
2
  import type { ModelDiagnostic } from "./errors.js";
3
- import type { Conversion } from "./conversion.js";
3
+ import type { Conversion, ConvertOptions } from "./conversion.js";
4
4
  import type { QueryForm, QueryElement, QueryPayload } from "./query.js";
5
5
  import type { BindingValues, DocumentQueryResult } from "./document.js";
6
6
  import type { RenderedView } from "./render-view.js";
@@ -87,10 +87,7 @@ export declare class Model {
87
87
  /** Looks a symbol up by short name, FQN or id; throws when the model declares none. */
88
88
  symbol(name: string): Promise<ModelSymbol>;
89
89
  /** Writes this model out in `toFormat`. */
90
- convert(toFormat: string, options?: {
91
- fromFormat?: string;
92
- tolerateSyntaxErrors?: boolean;
93
- }): Promise<Conversion>;
90
+ convert(toFormat: string, options?: ConvertOptions): Promise<Conversion>;
94
91
  /** This model written in SysML notation. */
95
92
  toSysml(): Promise<Conversion>;
96
93
  /** This model written as RDF Turtle. */
@@ -103,9 +100,9 @@ export declare class Model {
103
100
  } & QueryForm): Promise<QueryElement[]>;
104
101
  /** Runs a named document query against this model. */
105
102
  runDocumentQuery(queryId: string, bindings?: Readonly<Record<string, BindingValues>>): Promise<DocumentQueryResult>;
106
- /** Renders a named document of this model to Markdown or HTML. */
103
+ /** Renders a named document of this model to Markdown, HTML or AsciiDoc. */
107
104
  renderDocument(documentId: string, options?: {
108
- form?: "markdown" | "html";
105
+ form?: "markdown" | "html" | "asciidoc";
109
106
  }): Promise<string>;
110
107
  /** Renders a named view or targeted pseudo-view as diagram data. */
111
108
  renderView(viewName: string, options?: {
@@ -274,7 +274,7 @@ export class Model {
274
274
  runDocumentQuery(queryId, bindings) {
275
275
  return this.connection.runDocumentQuery(this.hash, queryId, bindings);
276
276
  }
277
- /** Renders a named document of this model to Markdown or HTML. */
277
+ /** Renders a named document of this model to Markdown, HTML or AsciiDoc. */
278
278
  renderDocument(documentId, options = {}) {
279
279
  return this.connection.renderDocument(this.hash, documentId, options);
280
280
  }
@@ -37,6 +37,8 @@ export interface QueryForm {
37
37
  scope?: readonly ScopeEntry[];
38
38
  select?: readonly string[];
39
39
  where?: ConstraintPayload;
40
+ /** Properties to sort by, in order of precedence, each ascending; the standard's `orderBy`. */
41
+ orderBy?: readonly string[];
40
42
  /** An OSLC query text, evaluated instead of the structured query. */
41
43
  oslc?: string;
42
44
  /** A query already decoded for the wire; passes through as written. */
@@ -16,7 +16,13 @@ const PRIMITIVE_OPERATORS = new Map([
16
16
  ["=", PrimitiveOperator.EQUAL],
17
17
  [">", PrimitiveOperator.GREATER],
18
18
  ["<", PrimitiveOperator.LESS],
19
+ [">=", PrimitiveOperator.GREATER_EQUAL],
20
+ ["<=", PrimitiveOperator.LESS_EQUAL],
21
+ ["in", PrimitiveOperator.IN],
22
+ ["instanceOf", PrimitiveOperator.INSTANCE_OF],
19
23
  ]);
24
+ /** The operators that compare against exactly one value. */
25
+ const ORDERED_OPERATORS = new Set([">", "<", ">=", "<="]);
20
26
  const COMPOSITE_OPERATORS = new Map([
21
27
  ["and", CompositeOperator.AND],
22
28
  ["or", CompositeOperator.OR],
@@ -52,10 +58,10 @@ function isRecord(value) {
52
58
  /** Translate a query, given as the standard's JSON or as keywords, to protobuf. */
53
59
  export function buildQuery(options = {}) {
54
60
  const { payload } = options;
55
- let { scope, select, where } = options;
61
+ let { scope, select, where, orderBy } = options;
56
62
  if (payload !== undefined) {
57
- if (scope !== undefined || select !== undefined || where !== undefined) {
58
- throw new QueryError("pass a query payload or scope/select/where keywords, not both");
63
+ if (scope !== undefined || select !== undefined || where !== undefined || orderBy !== undefined) {
64
+ throw new QueryError("pass a query payload or scope/select/where/orderBy keywords, not both");
59
65
  }
60
66
  if (!isRecord(payload)) {
61
67
  throw new QueryError("a query is an object, not a " + typeof payload);
@@ -64,18 +70,20 @@ export function buildQuery(options = {}) {
64
70
  if (declared !== TYPE_QUERY) {
65
71
  throw new QueryError(`expected a ${JSON.stringify(TYPE_QUERY)} payload, got ${JSON.stringify(declared)}`);
66
72
  }
67
- const unknown = Object.keys(payload).filter((key) => ![TYPE_KEY, "@id", "owningProject", "scope", "select", "where"].includes(key));
73
+ const unknown = Object.keys(payload).filter((key) => ![TYPE_KEY, "@id", "owningProject", "scope", "select", "where", "orderBy"].includes(key));
68
74
  if (unknown.length > 0) {
69
75
  unknown.sort(byCodeUnit);
70
- throw new QueryError(`a query has no ${unknown.join(", ")}; the standard's query is scope, select and where`);
76
+ throw new QueryError(`a query has no ${unknown.join(", ")}; the standard's query is scope, select, where and orderBy`);
71
77
  }
72
78
  scope = payload.scope;
73
79
  select = payload.select;
74
80
  where = payload.where;
81
+ orderBy = payload.orderBy;
75
82
  }
76
83
  const query = create(QuerySchema, {
77
84
  scope: sequence("scope", scope).map(scopeId),
78
85
  select: sequence("select", select).map(propertyName),
86
+ orderBy: sequence("orderBy", orderBy).map(propertyName),
79
87
  });
80
88
  if (where !== undefined) {
81
89
  query.where = constraint(where);
@@ -141,7 +149,7 @@ function primitive(payload) {
141
149
  rejectUnknown(payload, [TYPE_KEY, "@id", "inverse", "property", "operator", "value"], TYPE_PRIMITIVE_CONSTRAINT);
142
150
  const operator = payload.operator;
143
151
  const mapped = typeof operator === "string" ? PRIMITIVE_OPERATORS.get(operator) : undefined;
144
- if (mapped === undefined) {
152
+ if (typeof operator !== "string" || mapped === undefined) {
145
153
  throw new QueryError(`unknown primitive operator ${JSON.stringify(operator)}; expected one of ` +
146
154
  [...PRIMITIVE_OPERATORS.keys()].sort(byCodeUnit).join(", "));
147
155
  }
@@ -153,9 +161,44 @@ function primitive(payload) {
153
161
  inverse: payload.inverse === true,
154
162
  property: name,
155
163
  operator: mapped,
156
- value: values(payload.value),
164
+ value: operand(operator, name, payload.value),
157
165
  };
158
166
  }
167
+ /**
168
+ * The compared values, in the shape the operator compares against: the ordered
169
+ * comparisons take one value, `in` a list of them and `instanceOf` metaclass
170
+ * names, so another shape is refused here rather than sent to be refused.
171
+ */
172
+ function operand(operator, name, value) {
173
+ if (ORDERED_OPERATORS.has(operator)) {
174
+ if (Array.isArray(value) && value.length !== 1) {
175
+ throw new QueryError(`${operator} on ${JSON.stringify(name)} compares against one value, not a list of ${value.length}`);
176
+ }
177
+ if (value === undefined || value === null) {
178
+ throw new QueryError(`${operator} on ${JSON.stringify(name)} has no value to compare against`);
179
+ }
180
+ return values(value);
181
+ }
182
+ if (operator === "in") {
183
+ if (!Array.isArray(value)) {
184
+ throw new QueryError(`in on ${JSON.stringify(name)} compares against a list of values, not ${JSON.stringify(value)}`);
185
+ }
186
+ if (value.length === 0) {
187
+ throw new QueryError(`in on ${JSON.stringify(name)} has no values to be a member of`);
188
+ }
189
+ return value.map(compared);
190
+ }
191
+ if (operator === "instanceOf") {
192
+ const names = Array.isArray(value) ? value : [value];
193
+ for (const metaclass of names) {
194
+ if (typeof metaclass !== "string" || metaclass === "") {
195
+ throw new QueryError(`instanceOf on ${JSON.stringify(name)} compares against a metaclass name, not ${JSON.stringify(metaclass)}`);
196
+ }
197
+ }
198
+ return names;
199
+ }
200
+ return values(value);
201
+ }
159
202
  function composite(payload) {
160
203
  rejectUnknown(payload, [TYPE_KEY, "@id", "constraint", "operator"], TYPE_COMPOSITE_CONSTRAINT);
161
204
  const operator = payload.operator;
@@ -168,6 +211,9 @@ function composite(payload) {
168
211
  if (!Array.isArray(nested) || nested.length === 0) {
169
212
  throw new QueryError(`a composite constraint combines a non-empty list of constraints, not ${JSON.stringify(nested)}`);
170
213
  }
214
+ if (nested.length === 1) {
215
+ throw new QueryError("a composite constraint combines at least two constraints, got one; write the constraint on its own");
216
+ }
171
217
  return {
172
218
  operator: mapped,
173
219
  constraint: nested.map(constraint),
@@ -11,6 +11,8 @@ export interface RenderPort {
11
11
  name: string;
12
12
  type: string;
13
13
  direction: string;
14
+ /** The node's owner has the port from its type rather than declares it; the notation draws `^` before `name`. */
15
+ inherited: boolean;
14
16
  }
15
17
  export interface RenderGeometry {
16
18
  x: number;
@@ -44,6 +46,8 @@ export interface RenderNode {
44
46
  detail: string;
45
47
  text: string;
46
48
  standIn: boolean;
49
+ /** The owner the node is drawn or listed under has the usage through typing, subclassification or subsetting rather than declares it; the notation draws `^` before `name`. */
50
+ inherited: boolean;
47
51
  parent: string;
48
52
  /** The compartment of the parent this node is a row of ("attributes", "parts", ...); empty for a box. */
49
53
  compartment: string;
@@ -38,7 +38,7 @@ function styleOf(style) {
38
38
  };
39
39
  }
40
40
  function portOf(port) {
41
- return { id: port.id, name: port.name, type: port.type, direction: port.direction };
41
+ return { id: port.id, name: port.name, type: port.type, direction: port.direction, inherited: port.inherited };
42
42
  }
43
43
  function pointOf(point) {
44
44
  return { x: point.x, y: point.y };
@@ -56,6 +56,7 @@ function nodeOf(node) {
56
56
  detail: node.detail,
57
57
  text: node.text,
58
58
  standIn: node.standIn,
59
+ inherited: node.inherited,
59
60
  compartment: node.compartment,
60
61
  parent: node.parent,
61
62
  ports: node.ports.map(portOf),
@@ -32,6 +32,13 @@ export function interceptors(options) {
32
32
  return next(request);
33
33
  });
34
34
  }
35
+ const token = options.token;
36
+ if (token !== undefined && token !== "") {
37
+ built.push((next) => (request) => {
38
+ request.header.set("Authorization", `Bearer ${token}`);
39
+ return next(request);
40
+ });
41
+ }
35
42
  const tap = options.onResponse;
36
43
  if (tap !== undefined) {
37
44
  built.push(responseTap(tap));
@@ -207,6 +207,19 @@ export interface WitnessAssignment {
207
207
  /** The solver's exact value as text. */
208
208
  exact: string;
209
209
  }
210
+ /**
211
+ * One assumption or omission behind a verdict, worded as every surface reports
212
+ * it: `kind` is "assumed_one" (a feature read as holding one value or object
213
+ * while only the default `0..*` multiplicity governs it) or "uncovered" (an
214
+ * object-holding feature whose own assertions the question does not state).
215
+ */
216
+ export interface VerdictNote {
217
+ kind: string;
218
+ /** The feature the note is about, as the report names it. */
219
+ subject: string;
220
+ /** The note as a sentence. */
221
+ text: string;
222
+ }
210
223
  /** What the body of a verification case answered when it ran. */
211
224
  export interface VerificationVerdict {
212
225
  /** FQN of the verification case that ran. */
@@ -253,7 +266,8 @@ export interface VerdictStanding {
253
266
  * answer, which a `holds: false` alone does not distinguish. Every arm carries
254
267
  * the `standing` its evidence rests on, the `question` asked and the `status`
255
268
  * the service answered with, the `witness` assignment when the answer carries
256
- * one, and the `verifications` the requirement's verification cases produced.
269
+ * one, the `notes` the answer rests on, and the `verifications` the
270
+ * requirement's verification cases produced.
257
271
  */
258
272
  export type SysMLVerdict = {
259
273
  kind: "holds";
@@ -262,6 +276,7 @@ export type SysMLVerdict = {
262
276
  question: string;
263
277
  status: string;
264
278
  witness: WitnessAssignment[];
279
+ notes: VerdictNote[];
265
280
  verifications: VerificationVerdict[];
266
281
  } | {
267
282
  kind: "fails";
@@ -271,6 +286,7 @@ export type SysMLVerdict = {
271
286
  question: string;
272
287
  status: string;
273
288
  witness: WitnessAssignment[];
289
+ notes: VerdictNote[];
274
290
  verifications: VerificationVerdict[];
275
291
  } | {
276
292
  kind: "undecided";
@@ -281,6 +297,7 @@ export type SysMLVerdict = {
281
297
  question: string;
282
298
  status: string;
283
299
  witness: WitnessAssignment[];
300
+ notes: VerdictNote[];
284
301
  verifications: VerificationVerdict[];
285
302
  };
286
303
  /**
@@ -203,6 +203,7 @@ export function decodeVerdict(verdict, verifications = []) {
203
203
  unit: assignment.unit,
204
204
  exact: assignment.exact,
205
205
  }));
206
+ const notes = verdict.notes.map((note) => ({ kind: note.kind, subject: note.subject, text: note.text }));
206
207
  if (verdict.error !== "") {
207
208
  return {
208
209
  kind: "undecided",
@@ -213,6 +214,7 @@ export function decodeVerdict(verdict, verifications = []) {
213
214
  question: verdict.question,
214
215
  status: verdict.status,
215
216
  witness,
217
+ notes,
216
218
  verifications: [...verifications],
217
219
  };
218
220
  }
@@ -224,6 +226,7 @@ export function decodeVerdict(verdict, verifications = []) {
224
226
  question: verdict.question,
225
227
  status: verdict.status,
226
228
  witness,
229
+ notes,
227
230
  verifications: [...verifications],
228
231
  }
229
232
  : {
@@ -234,6 +237,7 @@ export function decodeVerdict(verdict, verifications = []) {
234
237
  question: verdict.question,
235
238
  status: verdict.status,
236
239
  witness,
240
+ notes,
237
241
  verifications: [...verifications],
238
242
  };
239
243
  }