@usearazzo/runner 1.0.1-alpha.24 → 1.0.1-alpha.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usearazzo/runner",
3
- "version": "1.0.1-alpha.24",
3
+ "version": "1.0.1-alpha.25",
4
4
  "description": "Runner for Arazzo Workflows.",
5
5
  "keywords": [
6
6
  "arazzo",
@@ -73,8 +73,8 @@
73
73
  "@swaggerexpert/json-pointer": "^3.0.2",
74
74
  "@swaggerexpert/jsonpath": "^4.0.5",
75
75
  "@swaggerexpert/media-types": "^1.0.2",
76
- "@usearazzo/parser": "1.0.1-alpha.24",
77
- "@usearazzo/resolver": "1.0.1-alpha.24",
76
+ "@usearazzo/parser": "1.0.1-alpha.25",
77
+ "@usearazzo/resolver": "1.0.1-alpha.25",
78
78
  "@xmldom/xmldom": "^0.9.12",
79
79
  "fontoxpath": "^3.34.0",
80
80
  "ramda": "^0.32.0",
@@ -94,5 +94,5 @@
94
94
  "devDependencies": {
95
95
  "swagger-client": "^3.38.4"
96
96
  },
97
- "gitHead": "ba457d4dfc1a0a0ccd91e38ad9b33b08d07dc3f0"
97
+ "gitHead": "37de6e45a52dabf8a924f09fed3ae4d41396be7d"
98
98
  }
@@ -6,11 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _apidomCore = require("@speclynx/apidom-core");
9
+ var _apidomDatamodel = require("@speclynx/apidom-datamodel");
10
+ var _apidomJsonPointer = require("@speclynx/apidom-json-pointer");
9
11
  var _APIDocument = _interopRequireDefault(require("./APIDocument.cjs"));
12
+ /**
13
+ * A workflow of an Arazzo document, as listed by
14
+ * {@link ArazzoDocument.listWorkflows}.
15
+ * @public
16
+ */
17
+
10
18
  /**
11
19
  * An Arazzo document held by the document registry: the parse result together
12
20
  * with the indexes the provider built over it — a container, not a logic
13
- * bearer. The methods below are thin reads of the source description index.
21
+ * bearer. The methods below are thin reads of those indexes.
14
22
  * @public
15
23
  */
16
24
  class ArazzoDocument extends _APIDocument.default {
@@ -46,6 +54,30 @@ class ArazzoDocument extends _APIDocument.default {
46
54
  return doc.type === 'arazzo';
47
55
  }
48
56
 
57
+ /**
58
+ * The workflows of this document that can be addressed by `workflowId`, in
59
+ * document order. Reads this document only: source descriptions are neither
60
+ * loaded nor listed.
61
+ */
62
+ listWorkflows() {
63
+ return [...this.workflowIndex].map(([workflowId, jsonPointer]) => {
64
+ const {
65
+ summary,
66
+ description
67
+ } = (0, _apidomJsonPointer.evaluate)(this.parseResult.api, jsonPointer);
68
+ return {
69
+ workflowId,
70
+ jsonPointer,
71
+ ...((0, _apidomDatamodel.isStringElement)(summary) && {
72
+ summary: (0, _apidomCore.toValue)(summary)
73
+ }),
74
+ ...((0, _apidomDatamodel.isStringElement)(description) && {
75
+ description: (0, _apidomCore.toValue)(description)
76
+ })
77
+ };
78
+ });
79
+ }
80
+
49
81
  /**
50
82
  * Resolves a source description name to its canonical URI — precomputed by
51
83
  * the provider, resolved against this document's base URI.
@@ -1,9 +1,16 @@
1
1
  import { toValue } from '@speclynx/apidom-core';
2
+ import { isStringElement } from '@speclynx/apidom-datamodel';
3
+ import { evaluate } from '@speclynx/apidom-json-pointer';
2
4
  import APIDocument from "./APIDocument.mjs";
5
+ /**
6
+ * A workflow of an Arazzo document, as listed by
7
+ * {@link ArazzoDocument.listWorkflows}.
8
+ * @public
9
+ */
3
10
  /**
4
11
  * An Arazzo document held by the document registry: the parse result together
5
12
  * with the indexes the provider built over it — a container, not a logic
6
- * bearer. The methods below are thin reads of the source description index.
13
+ * bearer. The methods below are thin reads of those indexes.
7
14
  * @public
8
15
  */
9
16
  class ArazzoDocument extends APIDocument {
@@ -39,6 +46,30 @@ class ArazzoDocument extends APIDocument {
39
46
  return doc.type === 'arazzo';
40
47
  }
41
48
 
49
+ /**
50
+ * The workflows of this document that can be addressed by `workflowId`, in
51
+ * document order. Reads this document only: source descriptions are neither
52
+ * loaded nor listed.
53
+ */
54
+ listWorkflows() {
55
+ return [...this.workflowIndex].map(([workflowId, jsonPointer]) => {
56
+ const {
57
+ summary,
58
+ description
59
+ } = evaluate(this.parseResult.api, jsonPointer);
60
+ return {
61
+ workflowId,
62
+ jsonPointer,
63
+ ...(isStringElement(summary) && {
64
+ summary: toValue(summary)
65
+ }),
66
+ ...(isStringElement(description) && {
67
+ description: toValue(description)
68
+ })
69
+ };
70
+ });
71
+ }
72
+
42
73
  /**
43
74
  * Resolves a source description name to its canonical URI — precomputed by
44
75
  * the provider, resolved against this document's base URI.
package/types/runner.d.ts CHANGED
@@ -97,7 +97,7 @@ export declare abstract class APIDocument {
97
97
  /**
98
98
  * An Arazzo document held by the document registry: the parse result together
99
99
  * with the indexes the provider built over it — a container, not a logic
100
- * bearer. The methods below are thin reads of the source description index.
100
+ * bearer. The methods below are thin reads of those indexes.
101
101
  * @public
102
102
  */
103
103
  export declare class ArazzoDocument extends APIDocument {
@@ -123,6 +123,12 @@ export declare class ArazzoDocument extends APIDocument {
123
123
  * Type guard for ArazzoDocument.
124
124
  */
125
125
  static is(doc: APIDocument): doc is ArazzoDocument;
126
+ /**
127
+ * The workflows of this document that can be addressed by `workflowId`, in
128
+ * document order. Reads this document only: source descriptions are neither
129
+ * loaded nor listed.
130
+ */
131
+ listWorkflows(): WorkflowDescriptor[];
126
132
  /**
127
133
  * Resolves a source description name to its canonical URI — precomputed by
128
134
  * the provider, resolved against this document's base URI.
@@ -2402,6 +2408,31 @@ export declare class UnmatchedProviderError extends ArazzoRunnerError {
2402
2408
  readonly uri?: string;
2403
2409
  }
2404
2410
 
2411
+ /**
2412
+ * A workflow of an Arazzo document, as listed by
2413
+ * {@link ArazzoDocument.listWorkflows}.
2414
+ * @public
2415
+ */
2416
+ export declare interface WorkflowDescriptor {
2417
+ /**
2418
+ * The id `ArazzoRunner.execute` takes to run the workflow.
2419
+ */
2420
+ workflowId: WorkflowId;
2421
+ /**
2422
+ * JSON Pointer to the workflow within the document.
2423
+ */
2424
+ jsonPointer: JSONPointer;
2425
+ /**
2426
+ * Present only when the workflow has a string `summary`.
2427
+ */
2428
+ summary?: string;
2429
+ /**
2430
+ * Present only when the workflow has a string `description`, as written
2431
+ * (CommonMark).
2432
+ */
2433
+ description?: string;
2434
+ }
2435
+
2405
2436
  /**
2406
2437
  * Per-call options for {@link WorkflowExecutor.execute}.
2407
2438
  * @public