@usearazzo/runner 0.0.0-stage → 1.0.1-alpha.11

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.
Files changed (154) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +20 -0
  4. package/README.md +163 -2
  5. package/dist/arazzo-runner.browser.js +113245 -0
  6. package/dist/arazzo-runner.browser.min.js +1 -0
  7. package/package.json +95 -4
  8. package/src/ArazzoRunner.cjs +122 -0
  9. package/src/ArazzoRunner.mjs +113 -0
  10. package/src/action/ActionResolver.cjs +160 -0
  11. package/src/action/ActionResolver.mjs +150 -0
  12. package/src/assembler/OpenAPI2DocumentAssembler.cjs +111 -0
  13. package/src/assembler/OpenAPI2DocumentAssembler.mjs +104 -0
  14. package/src/assembler/OpenAPI30DocumentAssembler.cjs +110 -0
  15. package/src/assembler/OpenAPI30DocumentAssembler.mjs +103 -0
  16. package/src/assembler/OpenAPI31DocumentAssembler.cjs +111 -0
  17. package/src/assembler/OpenAPI31DocumentAssembler.mjs +104 -0
  18. package/src/assembler/OpenAPIDocumentAssembler.cjs +58 -0
  19. package/src/assembler/OpenAPIDocumentAssembler.mjs +50 -0
  20. package/src/client/HTTPClient.cjs +5 -0
  21. package/src/client/HTTPClient.mjs +1 -0
  22. package/src/client/HTTPClientFetch.cjs +16 -0
  23. package/src/client/HTTPClientFetch.mjs +10 -0
  24. package/src/client/OpenAPIOperationRequest.cjs +5 -0
  25. package/src/client/OpenAPIOperationRequest.mjs +1 -0
  26. package/src/client/OpenAPIOperationResponse.cjs +42 -0
  27. package/src/client/OpenAPIOperationResponse.mjs +36 -0
  28. package/src/client/OpenAPIOperationResponseNormalizer.cjs +48 -0
  29. package/src/client/OpenAPIOperationResponseNormalizer.mjs +40 -0
  30. package/src/client/ParameterDelivery.cjs +119 -0
  31. package/src/client/ParameterDelivery.mjs +113 -0
  32. package/src/constants.cjs +9 -0
  33. package/src/constants.mjs +3 -0
  34. package/src/criterion/CriterionEvaluator.cjs +205 -0
  35. package/src/criterion/CriterionEvaluator.mjs +196 -0
  36. package/src/criterion/JSONPathCriterionEvaluator.cjs +47 -0
  37. package/src/criterion/JSONPathCriterionEvaluator.mjs +40 -0
  38. package/src/criterion/RegexCriterionEvaluator.cjs +67 -0
  39. package/src/criterion/RegexCriterionEvaluator.mjs +60 -0
  40. package/src/criterion/SimpleCriterionEvaluator.cjs +50 -0
  41. package/src/criterion/SimpleCriterionEvaluator.mjs +43 -0
  42. package/src/criterion/XPathCriterionEvaluator.cjs +117 -0
  43. package/src/criterion/XPathCriterionEvaluator.mjs +109 -0
  44. package/src/document/APIDocument.cjs +35 -0
  45. package/src/document/APIDocument.mjs +30 -0
  46. package/src/document/ArazzoDocument.cjs +81 -0
  47. package/src/document/ArazzoDocument.mjs +74 -0
  48. package/src/document/ArazzoSourceDescriptionIndex.cjs +26 -0
  49. package/src/document/ArazzoSourceDescriptionIndex.mjs +20 -0
  50. package/src/document/ArazzoStepIndex.cjs +25 -0
  51. package/src/document/ArazzoStepIndex.mjs +19 -0
  52. package/src/document/ArazzoWorkflowIndex.cjs +17 -0
  53. package/src/document/ArazzoWorkflowIndex.mjs +11 -0
  54. package/src/document/OpenAPIDocument.cjs +28 -0
  55. package/src/document/OpenAPIDocument.mjs +21 -0
  56. package/src/document/OpenAPIOperationIndex.cjs +24 -0
  57. package/src/document/OpenAPIOperationIndex.mjs +18 -0
  58. package/src/document/ParameterIdentity.cjs +93 -0
  59. package/src/document/ParameterIdentity.mjs +88 -0
  60. package/src/document/openapi-types.cjs +5 -0
  61. package/src/document/openapi-types.mjs +1 -0
  62. package/src/errors/ArazzoRunnerError.cjs +10 -0
  63. package/src/errors/ArazzoRunnerError.mjs +5 -0
  64. package/src/errors/AssemblerError.cjs +11 -0
  65. package/src/errors/AssemblerError.mjs +4 -0
  66. package/src/errors/ClientError.cjs +11 -0
  67. package/src/errors/ClientError.mjs +4 -0
  68. package/src/errors/CriterionError.cjs +11 -0
  69. package/src/errors/CriterionError.mjs +4 -0
  70. package/src/errors/ExecutionError.cjs +11 -0
  71. package/src/errors/ExecutionError.mjs +4 -0
  72. package/src/errors/ExtractionError.cjs +11 -0
  73. package/src/errors/ExtractionError.mjs +4 -0
  74. package/src/errors/InvalidEntryDocumentError.cjs +11 -0
  75. package/src/errors/InvalidEntryDocumentError.mjs +4 -0
  76. package/src/errors/NormalizationError.cjs +11 -0
  77. package/src/errors/NormalizationError.mjs +4 -0
  78. package/src/errors/ResolverError.cjs +11 -0
  79. package/src/errors/ResolverError.mjs +4 -0
  80. package/src/errors/RuntimeExpressionError.cjs +11 -0
  81. package/src/errors/RuntimeExpressionError.mjs +4 -0
  82. package/src/errors/UnmatchedProviderError.cjs +11 -0
  83. package/src/errors/UnmatchedProviderError.mjs +4 -0
  84. package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +147 -0
  85. package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +137 -0
  86. package/src/executor/OpenAPIOperationExecutor.cjs +458 -0
  87. package/src/executor/OpenAPIOperationExecutor.mjs +447 -0
  88. package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +197 -0
  89. package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +189 -0
  90. package/src/executor/SourceDescriptionsLocatorNormalizer.cjs +44 -0
  91. package/src/executor/SourceDescriptionsLocatorNormalizer.mjs +38 -0
  92. package/src/executor/StepExecutor.cjs +333 -0
  93. package/src/executor/StepExecutor.mjs +326 -0
  94. package/src/executor/StepRetryRunner.cjs +226 -0
  95. package/src/executor/StepRetryRunner.mjs +215 -0
  96. package/src/executor/StepTransitionInterpreter.cjs +159 -0
  97. package/src/executor/StepTransitionInterpreter.mjs +151 -0
  98. package/src/executor/WorkflowCallStack.cjs +116 -0
  99. package/src/executor/WorkflowCallStack.mjs +106 -0
  100. package/src/executor/WorkflowExecutor.cjs +1091 -0
  101. package/src/executor/WorkflowExecutor.mjs +1077 -0
  102. package/src/executor/abort.cjs +70 -0
  103. package/src/executor/abort.mjs +60 -0
  104. package/src/expression/RuntimeExpressionContext.cjs +5 -0
  105. package/src/expression/RuntimeExpressionContext.mjs +1 -0
  106. package/src/expression/RuntimeExpressionEvaluator.cjs +337 -0
  107. package/src/expression/RuntimeExpressionEvaluator.mjs +328 -0
  108. package/src/extractor/ArazzoStepExtractor.cjs +48 -0
  109. package/src/extractor/ArazzoStepExtractor.mjs +41 -0
  110. package/src/extractor/ArazzoWorkflowExtractor.cjs +50 -0
  111. package/src/extractor/ArazzoWorkflowExtractor.mjs +43 -0
  112. package/src/extractor/OpenAPIOperationExtractor.cjs +84 -0
  113. package/src/extractor/OpenAPIOperationExtractor.mjs +77 -0
  114. package/src/index.cjs +426 -0
  115. package/src/index.mjs +75 -0
  116. package/src/normalizer/ArazzoStepNormalizer.cjs +23 -0
  117. package/src/normalizer/ArazzoStepNormalizer.mjs +17 -0
  118. package/src/normalizer/ArazzoWorkflowNormalizer.cjs +214 -0
  119. package/src/normalizer/ArazzoWorkflowNormalizer.mjs +206 -0
  120. package/src/normalizer/OpenAPI2OperationNormalizer.cjs +128 -0
  121. package/src/normalizer/OpenAPI2OperationNormalizer.mjs +120 -0
  122. package/src/normalizer/OpenAPI30OperationNormalizer.cjs +129 -0
  123. package/src/normalizer/OpenAPI30OperationNormalizer.mjs +121 -0
  124. package/src/normalizer/OpenAPI31OperationNormalizer.cjs +131 -0
  125. package/src/normalizer/OpenAPI31OperationNormalizer.mjs +123 -0
  126. package/src/normalizer/OpenAPIOperationNormalizer.cjs +58 -0
  127. package/src/normalizer/OpenAPIOperationNormalizer.mjs +50 -0
  128. package/src/registry/DocumentRegistry.cjs +160 -0
  129. package/src/registry/DocumentRegistry.mjs +151 -0
  130. package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +154 -0
  131. package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +146 -0
  132. package/src/registry/providers/DocumentRegistryProvider.cjs +31 -0
  133. package/src/registry/providers/DocumentRegistryProvider.mjs +25 -0
  134. package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +122 -0
  135. package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +114 -0
  136. package/src/resolver/ArazzoValueResolver.cjs +42 -0
  137. package/src/resolver/ArazzoValueResolver.mjs +37 -0
  138. package/src/resolver/OpenAPIOperationParameterResolver.cjs +117 -0
  139. package/src/resolver/OpenAPIOperationParameterResolver.mjs +110 -0
  140. package/src/resolver/OutputResolver.cjs +71 -0
  141. package/src/resolver/OutputResolver.mjs +64 -0
  142. package/src/resolver/RequestBodyResolver.cjs +227 -0
  143. package/src/resolver/RequestBodyResolver.mjs +220 -0
  144. package/src/resolver/ResolverScope.cjs +5 -0
  145. package/src/resolver/ResolverScope.mjs +1 -0
  146. package/src/resolver/StepParameterResolver.cjs +22 -0
  147. package/src/resolver/StepParameterResolver.mjs +15 -0
  148. package/src/resolver/WorkflowParameterResolver.cjs +73 -0
  149. package/src/resolver/WorkflowParameterResolver.mjs +66 -0
  150. package/src/state/WorkflowExecutionState.cjs +99 -0
  151. package/src/state/WorkflowExecutionState.mjs +93 -0
  152. package/src/vendor/swagger-client.cjs +1 -0
  153. package/src/vendor/swagger-client.mjs +1 -0
  154. package/types/runner.d.ts +2410 -0
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Unique identifier of an OpenAPI operation.
9
+ * @public
10
+ */
11
+
12
+ /**
13
+ * Index mapping operationId to its JSON Pointer in an OpenAPI document.
14
+ *
15
+ * Only used when an Arazzo step references an operation by `operationId`.
16
+ * When a step uses `operationPath` (a JSON Pointer), the index is bypassed
17
+ * and the pointer is used directly to locate the operation.
18
+ *
19
+ * Only operations with an operationId are indexed; operations without one
20
+ * are only reachable via `operationPath`.
21
+ * @public
22
+ */
23
+ class OpenAPIOperationIndex extends Map {}
24
+ var _default = exports.default = OpenAPIOperationIndex;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Unique identifier of an OpenAPI operation.
3
+ * @public
4
+ */
5
+
6
+ /**
7
+ * Index mapping operationId to its JSON Pointer in an OpenAPI document.
8
+ *
9
+ * Only used when an Arazzo step references an operation by `operationId`.
10
+ * When a step uses `operationPath` (a JSON Pointer), the index is bypassed
11
+ * and the pointer is used directly to locate the operation.
12
+ *
13
+ * Only operations with an operationId are indexed; operations without one
14
+ * are only reachable via `operationPath`.
15
+ * @public
16
+ */
17
+ class OpenAPIOperationIndex extends Map {}
18
+ export default OpenAPIOperationIndex;
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _apidomCore = require("@speclynx/apidom-core");
8
+ var _apidomDatamodel = require("@speclynx/apidom-datamodel");
9
+ var _apidomNsArazzo = require("@speclynx/apidom-ns-arazzo-1");
10
+ /**
11
+ * The `(name, in)` identity of an Arazzo Parameter Object — the one encoding
12
+ * of what makes two parameters "the same parameter", shared by
13
+ * `ArazzoWorkflowNormalizer` (which merges a workflow's parameters into its
14
+ * steps by it) and `OpenAPIOperationParameterResolver` (which keys delivery by
15
+ * it), so the two cannot drift apart.
16
+ *
17
+ * Identity is the pair — the rule ApiDOM's OpenAPI `normalize-parameters`
18
+ * plugin applies when inheriting a Path Item's parameters into an Operation
19
+ * ("a unique parameter is defined by a combination of a name and location").
20
+ * Arazzo's `in` is optional where OpenAPI's is required, and an absent one
21
+ * compares equal only to another absent one: that is a step naming a
22
+ * `workflowId`, where "all parameters map to workflow inputs" and there is no
23
+ * location to pair the name with. Names are case-sensitive per the
24
+ * specification, so nothing is case-folded.
25
+ *
26
+ * The location side is read three-way:
27
+ *
28
+ * - a string — the declared location, e.g. `'query'`;
29
+ * - `undefined` — no location: the shape of a workflow-input mapping,
30
+ * meaningful for a step targeting a `workflowId` but naming no place in a
31
+ * request. An explicitly empty `in:` (a YAML null) reads the same as an
32
+ * omitted one — both say "no location", and treating the explicit spelling
33
+ * as malformed would fail a run its `in`-omitted twin completes;
34
+ * - `null` — a location is declared but is not a string (`in: 1`), which
35
+ * names no location and equals no other, its own duplicate included.
36
+ *
37
+ * An element without a well-formed identity has none at all
38
+ * ({@link ParameterIdentity.of} yields `undefined`) and is equal to nothing —
39
+ * an unresolved Reusable Object, a scalar someone put in the list, or a
40
+ * parameter whose `name` is missing or not a string. Such an entry has
41
+ * nothing to deduplicate on, and the normalizer's merge rebuilds the step's
42
+ * list, so calling it equal to another would delete authored content from the
43
+ * document. The OpenAPI plugin guards the same way and for the same reason.
44
+ * @internal
45
+ */
46
+ class ParameterIdentity {
47
+ /**
48
+ * The identity of an element, or `undefined` when it has none — the element
49
+ * is not a Parameter Object, or its `name` is not a string.
50
+ */
51
+ static of(element) {
52
+ if (!(0, _apidomNsArazzo.isParameterElement)(element)) return undefined;
53
+ const name = (0, _apidomCore.toValue)(element.name);
54
+ if (typeof name !== 'string') return undefined;
55
+ return new ParameterIdentity(name, ParameterIdentity.locationOf(element));
56
+ }
57
+
58
+ /**
59
+ * Whether two elements are the same parameter: both have an identity, and
60
+ * the identities are equal. The shape `uniqWith` consumes.
61
+ */
62
+ static equal(element1, element2) {
63
+ const identity1 = ParameterIdentity.of(element1);
64
+ const identity2 = ParameterIdentity.of(element2);
65
+ return identity1 !== undefined && identity2 !== undefined && identity1.equals(identity2);
66
+ }
67
+
68
+ /**
69
+ * The three-way location read alone, for callers that need it without a
70
+ * full identity — the inheritance filter must keep a nameless-but-located
71
+ * entry, which has a location but no identity.
72
+ */
73
+ static locationOf(parameter) {
74
+ const location = parameter.in;
75
+ if (location === undefined || (0, _apidomDatamodel.isNullElement)(location)) return undefined;
76
+ return (0, _apidomDatamodel.isStringElement)(location) ? (0, _apidomCore.toValue)(location) : null;
77
+ }
78
+ name;
79
+ location;
80
+ constructor(name, location) {
81
+ this.name = name;
82
+ this.location = location;
83
+ }
84
+
85
+ /**
86
+ * Whether this and the other identity name the same parameter. A malformed
87
+ * location equals nothing, its own duplicate included.
88
+ */
89
+ equals(other) {
90
+ return this.location !== null && other.location !== null && this.name === other.name && this.location === other.location;
91
+ }
92
+ }
93
+ var _default = exports.default = ParameterIdentity;
@@ -0,0 +1,88 @@
1
+ import { toValue } from '@speclynx/apidom-core';
2
+ import { isNullElement, isStringElement } from '@speclynx/apidom-datamodel';
3
+ import { isParameterElement } from '@speclynx/apidom-ns-arazzo-1';
4
+
5
+ /**
6
+ * The `(name, in)` identity of an Arazzo Parameter Object — the one encoding
7
+ * of what makes two parameters "the same parameter", shared by
8
+ * `ArazzoWorkflowNormalizer` (which merges a workflow's parameters into its
9
+ * steps by it) and `OpenAPIOperationParameterResolver` (which keys delivery by
10
+ * it), so the two cannot drift apart.
11
+ *
12
+ * Identity is the pair — the rule ApiDOM's OpenAPI `normalize-parameters`
13
+ * plugin applies when inheriting a Path Item's parameters into an Operation
14
+ * ("a unique parameter is defined by a combination of a name and location").
15
+ * Arazzo's `in` is optional where OpenAPI's is required, and an absent one
16
+ * compares equal only to another absent one: that is a step naming a
17
+ * `workflowId`, where "all parameters map to workflow inputs" and there is no
18
+ * location to pair the name with. Names are case-sensitive per the
19
+ * specification, so nothing is case-folded.
20
+ *
21
+ * The location side is read three-way:
22
+ *
23
+ * - a string — the declared location, e.g. `'query'`;
24
+ * - `undefined` — no location: the shape of a workflow-input mapping,
25
+ * meaningful for a step targeting a `workflowId` but naming no place in a
26
+ * request. An explicitly empty `in:` (a YAML null) reads the same as an
27
+ * omitted one — both say "no location", and treating the explicit spelling
28
+ * as malformed would fail a run its `in`-omitted twin completes;
29
+ * - `null` — a location is declared but is not a string (`in: 1`), which
30
+ * names no location and equals no other, its own duplicate included.
31
+ *
32
+ * An element without a well-formed identity has none at all
33
+ * ({@link ParameterIdentity.of} yields `undefined`) and is equal to nothing —
34
+ * an unresolved Reusable Object, a scalar someone put in the list, or a
35
+ * parameter whose `name` is missing or not a string. Such an entry has
36
+ * nothing to deduplicate on, and the normalizer's merge rebuilds the step's
37
+ * list, so calling it equal to another would delete authored content from the
38
+ * document. The OpenAPI plugin guards the same way and for the same reason.
39
+ * @internal
40
+ */
41
+ class ParameterIdentity {
42
+ /**
43
+ * The identity of an element, or `undefined` when it has none — the element
44
+ * is not a Parameter Object, or its `name` is not a string.
45
+ */
46
+ static of(element) {
47
+ if (!isParameterElement(element)) return undefined;
48
+ const name = toValue(element.name);
49
+ if (typeof name !== 'string') return undefined;
50
+ return new ParameterIdentity(name, ParameterIdentity.locationOf(element));
51
+ }
52
+
53
+ /**
54
+ * Whether two elements are the same parameter: both have an identity, and
55
+ * the identities are equal. The shape `uniqWith` consumes.
56
+ */
57
+ static equal(element1, element2) {
58
+ const identity1 = ParameterIdentity.of(element1);
59
+ const identity2 = ParameterIdentity.of(element2);
60
+ return identity1 !== undefined && identity2 !== undefined && identity1.equals(identity2);
61
+ }
62
+
63
+ /**
64
+ * The three-way location read alone, for callers that need it without a
65
+ * full identity — the inheritance filter must keep a nameless-but-located
66
+ * entry, which has a location but no identity.
67
+ */
68
+ static locationOf(parameter) {
69
+ const location = parameter.in;
70
+ if (location === undefined || isNullElement(location)) return undefined;
71
+ return isStringElement(location) ? toValue(location) : null;
72
+ }
73
+ name;
74
+ location;
75
+ constructor(name, location) {
76
+ this.name = name;
77
+ this.location = location;
78
+ }
79
+
80
+ /**
81
+ * Whether this and the other identity name the same parameter. A malformed
82
+ * location equals nothing, its own duplicate included.
83
+ */
84
+ equals(other) {
85
+ return this.location !== null && other.location !== null && this.name === other.name && this.location === other.location;
86
+ }
87
+ }
88
+ export default ParameterIdentity;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _apidomError = require("@speclynx/apidom-error");
8
+ /** @public */
9
+ class ArazzoRunnerError extends _apidomError.ApiDOMStructuredError {}
10
+ var _default = exports.default = ArazzoRunnerError;
@@ -0,0 +1,5 @@
1
+ import { ApiDOMStructuredError } from '@speclynx/apidom-error';
2
+
3
+ /** @public */
4
+ class ArazzoRunnerError extends ApiDOMStructuredError {}
5
+ export default ArazzoRunnerError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class AssemblerError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = AssemblerError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class AssemblerError extends ArazzoRunnerError {}
4
+ export default AssemblerError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class ClientError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = ClientError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class ClientError extends ArazzoRunnerError {}
4
+ export default ClientError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class CriterionError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = CriterionError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class CriterionError extends ArazzoRunnerError {}
4
+ export default CriterionError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class ExecutionError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = ExecutionError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class ExecutionError extends ArazzoRunnerError {}
4
+ export default ExecutionError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class ExtractionError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = ExtractionError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class ExtractionError extends ArazzoRunnerError {}
4
+ export default ExtractionError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class InvalidEntryDocumentError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = InvalidEntryDocumentError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class InvalidEntryDocumentError extends ArazzoRunnerError {}
4
+ export default InvalidEntryDocumentError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class NormalizationError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = NormalizationError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class NormalizationError extends ArazzoRunnerError {}
4
+ export default NormalizationError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class ResolverError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = ResolverError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class ResolverError extends ArazzoRunnerError {}
4
+ export default ResolverError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class RuntimeExpressionError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = RuntimeExpressionError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class RuntimeExpressionError extends ArazzoRunnerError {}
4
+ export default RuntimeExpressionError;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoRunnerError = _interopRequireDefault(require("./ArazzoRunnerError.cjs"));
9
+ /** @public */
10
+ class UnmatchedProviderError extends _ArazzoRunnerError.default {}
11
+ var _default = exports.default = UnmatchedProviderError;
@@ -0,0 +1,4 @@
1
+ import ArazzoRunnerError from "./ArazzoRunnerError.mjs";
2
+ /** @public */
3
+ class UnmatchedProviderError extends ArazzoRunnerError {}
4
+ export default UnmatchedProviderError;
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _ArazzoDocument = _interopRequireDefault(require("../document/ArazzoDocument.cjs"));
9
+ var _ExecutionError = _interopRequireDefault(require("../errors/ExecutionError.cjs"));
10
+ var _SourceDescriptionsLocatorNormalizer = _interopRequireDefault(require("./SourceDescriptionsLocatorNormalizer.cjs"));
11
+ /**
12
+ * A canonical Arazzo workflow locator: the Arazzo document that owns the
13
+ * workflow and the workflow's id within it.
14
+ *
15
+ * A workflow reference names its target in one of two ways — a plain
16
+ * `workflowId` of the current document, or a
17
+ * `$sourceDescriptions.{name}.{workflowId}` runtime expression naming a
18
+ * workflow of another Arazzo document. Both are locators for the same thing;
19
+ * the normalizer reduces either to this single canonical form. `workflowId`
20
+ * is the bare id either way — the key run state (`$workflows.{id}`) is
21
+ * recorded under, which the runtime-expression grammar can only express
22
+ * unqualified.
23
+ * @public
24
+ */
25
+
26
+ /**
27
+ * A workflow reference, parsed but not yet resolved — the intermediate form
28
+ * between {@link ArazzoWorkflowLocatorNormalizer.normalize}'s two halves.
29
+ */
30
+
31
+ /**
32
+ * The referencing context a reference is resolved in: the workflow (and step,
33
+ * when the reference sits on one) making the reference, stamped onto every
34
+ * error.
35
+ * @public
36
+ */
37
+
38
+ /**
39
+ * Normalizes a workflow reference to a canonical {@link ArazzoWorkflowLocator}
40
+ * — the Arazzo document and the workflow's id within it.
41
+ *
42
+ * A reference appears in four author-facing positions — a sub-workflow step's
43
+ * `workflowId`, a `dependsOn` entry, a `retry` action's `workflowId`
44
+ * reference, and a `goto` action's transfer target — and is either a plain id
45
+ * of the referencing document or a whole
46
+ * `$sourceDescriptions.{name}.{workflowId}` runtime expression naming a
47
+ * workflow of another Arazzo document. Only that dotted expression form is a
48
+ * workflow reference; the resolver package's
49
+ * `$sourceDescriptions.{name}#/json/pointer` form is a `$ref`-time construct,
50
+ * not a runtime expression, and does not parse here.
51
+ *
52
+ * The `type` declared on a source description is not trusted (it may be
53
+ * absent or wrong); a source is classified by what it actually parses to,
54
+ * the same convention the OpenAPI operation locator follows. Source
55
+ * documents are acquired from the registry on demand. Whether the resolved
56
+ * document *defines* the workflow is deliberately left to the caller, which
57
+ * owns the timing of that check (eager for a `dependsOn` list validated
58
+ * before any prerequisite runs, lazy for a sub-workflow step resolved per
59
+ * attempt).
60
+ * @public
61
+ */
62
+ class ArazzoWorkflowLocatorNormalizer extends _SourceDescriptionsLocatorNormalizer.default {
63
+ /**
64
+ * Resolves a reference — a plain workflowId or a
65
+ * `$sourceDescriptions.{name}.{workflowId}` expression, as written — to the
66
+ * canonical locator: the Arazzo document that owns the target workflow,
67
+ * and the bare id within it.
68
+ */
69
+ async normalize(reference, document, context) {
70
+ return this.#resolve(this.#parseReference(reference, context), document, context);
71
+ }
72
+
73
+ /**
74
+ * Parses a reference to its target. A reference starting with `$` must be
75
+ * a whole `$sourceDescriptions.{name}.{workflowId}` expression; anything
76
+ * else `$`-prefixed (another expression kind, or one that does not parse)
77
+ * is a malformed reference, rejected here rather than looked up as a
78
+ * literal id that cannot exist.
79
+ */
80
+ #parseReference(reference, {
81
+ workflowId,
82
+ stepId
83
+ }) {
84
+ if (!reference.startsWith('$')) {
85
+ return {
86
+ kind: 'local',
87
+ reference,
88
+ workflowId: reference
89
+ };
90
+ }
91
+ const parsed = this.parseSourceDescriptionsExpression(reference);
92
+ if (parsed === undefined) {
93
+ throw new _ExecutionError.default(`workflow reference "${reference}" in workflow "${workflowId}" is not a $sourceDescriptions.{name}.{workflowId} expression`, {
94
+ workflowId,
95
+ stepId,
96
+ reason: 'invalid-workflow-reference'
97
+ });
98
+ }
99
+ return {
100
+ kind: 'sourced',
101
+ reference,
102
+ sourceName: parsed.sourceName,
103
+ workflowId: parsed.reference
104
+ };
105
+ }
106
+
107
+ /**
108
+ * Resolves a parsed reference to the Arazzo document that owns the target
109
+ * workflow. A plain id resolves to the referencing document itself; an
110
+ * expression resolves its named source description to a URI, acquires that
111
+ * document from the registry, and requires it to actually be an Arazzo
112
+ * document.
113
+ */
114
+ async #resolve(parsed, document, context) {
115
+ if (parsed.kind === 'local') {
116
+ return {
117
+ document,
118
+ workflowId: parsed.workflowId
119
+ };
120
+ }
121
+ const {
122
+ workflowId,
123
+ stepId
124
+ } = context;
125
+ const uri = document.resolveSourceDescriptionURI(parsed.sourceName);
126
+ if (uri === undefined) {
127
+ throw new _ExecutionError.default(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}", which the Arazzo document at "${document.uri}" does not define`, {
128
+ workflowId,
129
+ stepId,
130
+ reason: 'source-description-not-found'
131
+ });
132
+ }
133
+ const source = await this.registry.acquire(uri);
134
+ if (!_ArazzoDocument.default.is(source)) {
135
+ throw new _ExecutionError.default(`workflow reference "${parsed.reference}" in workflow "${workflowId}" names source description "${parsed.sourceName}" at "${uri}", which is not an Arazzo document`, {
136
+ workflowId,
137
+ stepId,
138
+ reason: 'source-description-not-arazzo'
139
+ });
140
+ }
141
+ return {
142
+ document: source,
143
+ workflowId: parsed.workflowId
144
+ };
145
+ }
146
+ }
147
+ var _default = exports.default = ArazzoWorkflowLocatorNormalizer;