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

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 (152) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +20 -0
  4. package/README.md +777 -2
  5. package/dist/arazzo-runner.browser.js +111247 -0
  6. package/dist/arazzo-runner.browser.min.js +1 -0
  7. package/package.json +90 -4
  8. package/src/action/ActionResolver.cjs +160 -0
  9. package/src/action/ActionResolver.mjs +150 -0
  10. package/src/assembler/OpenAPI2DocumentAssembler.cjs +111 -0
  11. package/src/assembler/OpenAPI2DocumentAssembler.mjs +104 -0
  12. package/src/assembler/OpenAPI30DocumentAssembler.cjs +110 -0
  13. package/src/assembler/OpenAPI30DocumentAssembler.mjs +103 -0
  14. package/src/assembler/OpenAPI31DocumentAssembler.cjs +111 -0
  15. package/src/assembler/OpenAPI31DocumentAssembler.mjs +104 -0
  16. package/src/assembler/OpenAPIDocumentAssembler.cjs +58 -0
  17. package/src/assembler/OpenAPIDocumentAssembler.mjs +50 -0
  18. package/src/client/HTTPClient.cjs +5 -0
  19. package/src/client/HTTPClient.mjs +1 -0
  20. package/src/client/HTTPClientFetch.cjs +16 -0
  21. package/src/client/HTTPClientFetch.mjs +10 -0
  22. package/src/client/OpenAPIOperationRequest.cjs +5 -0
  23. package/src/client/OpenAPIOperationRequest.mjs +1 -0
  24. package/src/client/OpenAPIOperationResponse.cjs +42 -0
  25. package/src/client/OpenAPIOperationResponse.mjs +36 -0
  26. package/src/client/OpenAPIOperationResponseNormalizer.cjs +48 -0
  27. package/src/client/OpenAPIOperationResponseNormalizer.mjs +40 -0
  28. package/src/client/ParameterDelivery.cjs +119 -0
  29. package/src/client/ParameterDelivery.mjs +113 -0
  30. package/src/constants.cjs +9 -0
  31. package/src/constants.mjs +3 -0
  32. package/src/criterion/CriterionEvaluator.cjs +205 -0
  33. package/src/criterion/CriterionEvaluator.mjs +196 -0
  34. package/src/criterion/JSONPathCriterionEvaluator.cjs +47 -0
  35. package/src/criterion/JSONPathCriterionEvaluator.mjs +40 -0
  36. package/src/criterion/RegexCriterionEvaluator.cjs +67 -0
  37. package/src/criterion/RegexCriterionEvaluator.mjs +60 -0
  38. package/src/criterion/SimpleCriterionEvaluator.cjs +50 -0
  39. package/src/criterion/SimpleCriterionEvaluator.mjs +43 -0
  40. package/src/criterion/XPathCriterionEvaluator.cjs +117 -0
  41. package/src/criterion/XPathCriterionEvaluator.mjs +109 -0
  42. package/src/document/APIDocument.cjs +35 -0
  43. package/src/document/APIDocument.mjs +30 -0
  44. package/src/document/ArazzoDocument.cjs +81 -0
  45. package/src/document/ArazzoDocument.mjs +74 -0
  46. package/src/document/ArazzoSourceDescriptionIndex.cjs +26 -0
  47. package/src/document/ArazzoSourceDescriptionIndex.mjs +20 -0
  48. package/src/document/ArazzoStepIndex.cjs +25 -0
  49. package/src/document/ArazzoStepIndex.mjs +19 -0
  50. package/src/document/ArazzoWorkflowIndex.cjs +17 -0
  51. package/src/document/ArazzoWorkflowIndex.mjs +11 -0
  52. package/src/document/OpenAPIDocument.cjs +28 -0
  53. package/src/document/OpenAPIDocument.mjs +21 -0
  54. package/src/document/OpenAPIOperationIndex.cjs +24 -0
  55. package/src/document/OpenAPIOperationIndex.mjs +18 -0
  56. package/src/document/ParameterIdentity.cjs +93 -0
  57. package/src/document/ParameterIdentity.mjs +88 -0
  58. package/src/document/openapi-types.cjs +5 -0
  59. package/src/document/openapi-types.mjs +1 -0
  60. package/src/errors/ArazzoRunnerError.cjs +10 -0
  61. package/src/errors/ArazzoRunnerError.mjs +5 -0
  62. package/src/errors/AssemblerError.cjs +11 -0
  63. package/src/errors/AssemblerError.mjs +4 -0
  64. package/src/errors/ClientError.cjs +11 -0
  65. package/src/errors/ClientError.mjs +4 -0
  66. package/src/errors/CriterionError.cjs +11 -0
  67. package/src/errors/CriterionError.mjs +4 -0
  68. package/src/errors/ExecutionError.cjs +11 -0
  69. package/src/errors/ExecutionError.mjs +4 -0
  70. package/src/errors/ExtractionError.cjs +11 -0
  71. package/src/errors/ExtractionError.mjs +4 -0
  72. package/src/errors/InvalidEntryDocumentError.cjs +11 -0
  73. package/src/errors/InvalidEntryDocumentError.mjs +4 -0
  74. package/src/errors/NormalizationError.cjs +11 -0
  75. package/src/errors/NormalizationError.mjs +4 -0
  76. package/src/errors/ResolverError.cjs +11 -0
  77. package/src/errors/ResolverError.mjs +4 -0
  78. package/src/errors/RuntimeExpressionError.cjs +11 -0
  79. package/src/errors/RuntimeExpressionError.mjs +4 -0
  80. package/src/errors/UnmatchedProviderError.cjs +11 -0
  81. package/src/errors/UnmatchedProviderError.mjs +4 -0
  82. package/src/executor/ArazzoWorkflowLocatorNormalizer.cjs +147 -0
  83. package/src/executor/ArazzoWorkflowLocatorNormalizer.mjs +137 -0
  84. package/src/executor/OpenAPIOperationExecutor.cjs +457 -0
  85. package/src/executor/OpenAPIOperationExecutor.mjs +446 -0
  86. package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +197 -0
  87. package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +189 -0
  88. package/src/executor/SourceDescriptionsLocatorNormalizer.cjs +44 -0
  89. package/src/executor/SourceDescriptionsLocatorNormalizer.mjs +38 -0
  90. package/src/executor/StepExecutor.cjs +333 -0
  91. package/src/executor/StepExecutor.mjs +326 -0
  92. package/src/executor/StepRetryRunner.cjs +226 -0
  93. package/src/executor/StepRetryRunner.mjs +215 -0
  94. package/src/executor/StepTransitionInterpreter.cjs +159 -0
  95. package/src/executor/StepTransitionInterpreter.mjs +151 -0
  96. package/src/executor/WorkflowCallStack.cjs +116 -0
  97. package/src/executor/WorkflowCallStack.mjs +106 -0
  98. package/src/executor/WorkflowExecutor.cjs +1091 -0
  99. package/src/executor/WorkflowExecutor.mjs +1077 -0
  100. package/src/executor/abort.cjs +70 -0
  101. package/src/executor/abort.mjs +60 -0
  102. package/src/expression/RuntimeExpressionContext.cjs +5 -0
  103. package/src/expression/RuntimeExpressionContext.mjs +1 -0
  104. package/src/expression/RuntimeExpressionEvaluator.cjs +337 -0
  105. package/src/expression/RuntimeExpressionEvaluator.mjs +328 -0
  106. package/src/extractor/ArazzoStepExtractor.cjs +48 -0
  107. package/src/extractor/ArazzoStepExtractor.mjs +41 -0
  108. package/src/extractor/ArazzoWorkflowExtractor.cjs +50 -0
  109. package/src/extractor/ArazzoWorkflowExtractor.mjs +43 -0
  110. package/src/extractor/OpenAPIOperationExtractor.cjs +84 -0
  111. package/src/extractor/OpenAPIOperationExtractor.mjs +77 -0
  112. package/src/index.cjs +419 -0
  113. package/src/index.mjs +73 -0
  114. package/src/normalizer/ArazzoStepNormalizer.cjs +23 -0
  115. package/src/normalizer/ArazzoStepNormalizer.mjs +17 -0
  116. package/src/normalizer/ArazzoWorkflowNormalizer.cjs +214 -0
  117. package/src/normalizer/ArazzoWorkflowNormalizer.mjs +206 -0
  118. package/src/normalizer/OpenAPI2OperationNormalizer.cjs +128 -0
  119. package/src/normalizer/OpenAPI2OperationNormalizer.mjs +120 -0
  120. package/src/normalizer/OpenAPI30OperationNormalizer.cjs +129 -0
  121. package/src/normalizer/OpenAPI30OperationNormalizer.mjs +121 -0
  122. package/src/normalizer/OpenAPI31OperationNormalizer.cjs +131 -0
  123. package/src/normalizer/OpenAPI31OperationNormalizer.mjs +123 -0
  124. package/src/normalizer/OpenAPIOperationNormalizer.cjs +58 -0
  125. package/src/normalizer/OpenAPIOperationNormalizer.mjs +50 -0
  126. package/src/registry/DocumentRegistry.cjs +160 -0
  127. package/src/registry/DocumentRegistry.mjs +151 -0
  128. package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +154 -0
  129. package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +146 -0
  130. package/src/registry/providers/DocumentRegistryProvider.cjs +31 -0
  131. package/src/registry/providers/DocumentRegistryProvider.mjs +25 -0
  132. package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +122 -0
  133. package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +114 -0
  134. package/src/resolver/ArazzoValueResolver.cjs +42 -0
  135. package/src/resolver/ArazzoValueResolver.mjs +37 -0
  136. package/src/resolver/OpenAPIOperationParameterResolver.cjs +117 -0
  137. package/src/resolver/OpenAPIOperationParameterResolver.mjs +110 -0
  138. package/src/resolver/OutputResolver.cjs +71 -0
  139. package/src/resolver/OutputResolver.mjs +64 -0
  140. package/src/resolver/RequestBodyResolver.cjs +227 -0
  141. package/src/resolver/RequestBodyResolver.mjs +220 -0
  142. package/src/resolver/ResolverScope.cjs +5 -0
  143. package/src/resolver/ResolverScope.mjs +1 -0
  144. package/src/resolver/StepParameterResolver.cjs +22 -0
  145. package/src/resolver/StepParameterResolver.mjs +15 -0
  146. package/src/resolver/WorkflowParameterResolver.cjs +73 -0
  147. package/src/resolver/WorkflowParameterResolver.mjs +66 -0
  148. package/src/state/WorkflowExecutionState.cjs +99 -0
  149. package/src/state/WorkflowExecutionState.mjs +93 -0
  150. package/src/vendor/swagger-client.cjs +1 -0
  151. package/src/vendor/swagger-client.mjs +1 -0
  152. package/types/runner.d.ts +2341 -0
@@ -0,0 +1,109 @@
1
+ // fontoxpath is CommonJS and its named exports are not statically resolvable
2
+ // under ESM, so import the default and destructure.
3
+ import fontoxpath from 'fontoxpath';
4
+ import { DOMParser } from '@xmldom/xmldom';
5
+ import CriterionError from "../errors/CriterionError.mjs";
6
+ const {
7
+ evaluateXPathToBoolean,
8
+ evaluateXPath
9
+ } = fontoxpath;
10
+
11
+ /**
12
+ * Evaluates an `xpath` Arazzo criterion condition against a resolved context value.
13
+ *
14
+ * The condition is an XPath 3.1 query applied to the resolved `context`, which
15
+ * must be XML. A string context is parsed as XML; an already-parsed DOM node is
16
+ * used as-is. The criterion is met by the query's Effective Boolean Value
17
+ * (XPath 3.1 §19.1.2), as the Arazzo specification mandates — so a boolean
18
+ * predicate (`//status = 'ok'`), a non-empty node set, a non-zero number, and a
19
+ * non-empty string all evaluate to `true`.
20
+ *
21
+ * Only XPath 3.1 is supported (`fontoxpath`'s engine); version gating happens in
22
+ * the facade. Per Arazzo 1.1.0, a `null` or `undefined` context fails the
23
+ * condition. An invalid query throws {@link CriterionError}.
24
+ * @public
25
+ */
26
+ class XPathCriterionEvaluator {
27
+ /**
28
+ * Evaluates the XPath `condition` against the resolved context value, returning
29
+ * its Effective Boolean Value.
30
+ *
31
+ * Returns `false` when the context is `null` or `undefined`. Throws
32
+ * {@link CriterionError} when the context is not XML or the query is invalid.
33
+ */
34
+ evaluate(condition, context) {
35
+ if (context === null || context === undefined) return false;
36
+ const node = this.#toNode(condition, context);
37
+ try {
38
+ return evaluateXPathToBoolean(condition, node, null, null, {
39
+ language: evaluateXPath.XPATH_3_1_LANGUAGE
40
+ });
41
+ } catch (error) {
42
+ throw new CriterionError(`Invalid xpath criterion condition "${condition}"`, {
43
+ cause: error,
44
+ condition,
45
+ type: 'xpath',
46
+ reason: 'invalid-xpath'
47
+ });
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Coerces the resolved context to an XML DOM node: an already-parsed node is
53
+ * used as-is, a string is parsed as XML. Any other value cannot be an XPath
54
+ * context and throws.
55
+ */
56
+ #toNode(condition, context) {
57
+ if (this.#isNode(context)) return context;
58
+ if (typeof context !== 'string') {
59
+ throw new CriterionError('xpath criterion context is not XML', {
60
+ condition,
61
+ type: 'xpath',
62
+ reason: 'invalid-context'
63
+ });
64
+ }
65
+
66
+ // capture parse errors via `onError` rather than the default handler: this
67
+ // both suppresses the parser writing to the console and catches *recoverable*
68
+ // errors (e.g. an undefined entity, stray text) that do not throw but would
69
+ // otherwise yield a degraded document evaluated silently.
70
+ let parseError;
71
+ try {
72
+ const document = new DOMParser({
73
+ onError: (_level, message) => {
74
+ parseError ??= message;
75
+ }
76
+ }).parseFromString(context, 'text/xml');
77
+ if (parseError !== undefined) {
78
+ throw new CriterionError('xpath criterion context is not valid XML', {
79
+ cause: parseError,
80
+ condition,
81
+ type: 'xpath',
82
+ reason: 'invalid-context'
83
+ });
84
+ }
85
+ return document;
86
+ } catch (error) {
87
+ if (error instanceof CriterionError) throw error;
88
+ throw new CriterionError('xpath criterion context is not valid XML', {
89
+ cause: error,
90
+ condition,
91
+ type: 'xpath',
92
+ reason: 'invalid-context'
93
+ });
94
+ }
95
+ }
96
+
97
+ /**
98
+ * Duck-types a DOM node, so a caller may pass an already-parsed document
99
+ * instead of an XML string. Requires both a numeric `nodeType` and a string
100
+ * `nodeName` so a plain JSON value that happens to carry a `nodeType` property
101
+ * is not mistaken for a node (and is instead rejected as a non-XML context).
102
+ */
103
+ #isNode(value) {
104
+ if (typeof value !== 'object' || value === null) return false;
105
+ const node = value;
106
+ return typeof node.nodeType === 'number' && typeof node.nodeName === 'string';
107
+ }
108
+ }
109
+ export default XPathCriterionEvaluator;
@@ -0,0 +1,35 @@
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
+ /**
9
+ * Base document held by the document registry.
10
+ * @public
11
+ */
12
+ class APIDocument {
13
+ uri;
14
+ parseResult;
15
+ constructor(uri, parseResult) {
16
+ this.uri = uri;
17
+ this.parseResult = parseResult;
18
+ }
19
+
20
+ /**
21
+ * Returns a JSON-serializable representation of the document's API element.
22
+ * Compatible with JSON.stringify() — JSON.stringify(doc) produces correct output.
23
+ */
24
+ toJSON() {
25
+ return (0, _apidomCore.toValue)(this.parseResult.api);
26
+ }
27
+
28
+ /**
29
+ * Serializes the document's API element to a YAML string.
30
+ */
31
+ toYAML(...args) {
32
+ return (0, _apidomCore.toYAML)(this.parseResult.api, ...args);
33
+ }
34
+ }
35
+ var _default = exports.default = APIDocument;
@@ -0,0 +1,30 @@
1
+ import { toValue, toYAML } from '@speclynx/apidom-core';
2
+
3
+ /**
4
+ * Base document held by the document registry.
5
+ * @public
6
+ */
7
+ class APIDocument {
8
+ uri;
9
+ parseResult;
10
+ constructor(uri, parseResult) {
11
+ this.uri = uri;
12
+ this.parseResult = parseResult;
13
+ }
14
+
15
+ /**
16
+ * Returns a JSON-serializable representation of the document's API element.
17
+ * Compatible with JSON.stringify() — JSON.stringify(doc) produces correct output.
18
+ */
19
+ toJSON() {
20
+ return toValue(this.parseResult.api);
21
+ }
22
+
23
+ /**
24
+ * Serializes the document's API element to a YAML string.
25
+ */
26
+ toYAML(...args) {
27
+ return toYAML(this.parseResult.api, ...args);
28
+ }
29
+ }
30
+ export default APIDocument;
@@ -0,0 +1,81 @@
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 _apidomCore = require("@speclynx/apidom-core");
9
+ var _APIDocument = _interopRequireDefault(require("./APIDocument.cjs"));
10
+ /**
11
+ * An Arazzo document held by the document registry: the parse result together
12
+ * 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.
14
+ * @public
15
+ */
16
+ class ArazzoDocument extends _APIDocument.default {
17
+ type = 'arazzo';
18
+ isEntry;
19
+ /**
20
+ * WorkflowId → JSON Pointer to the workflow within the parse result.
21
+ */
22
+ workflowIndex;
23
+ /**
24
+ * WorkflowId → stepId → JSON Pointer to the step within the parse result.
25
+ * Built by the provider, like {@link ArazzoDocument.workflowIndex}.
26
+ */
27
+ stepIndex;
28
+ /**
29
+ * Name → source description element and canonical URI (already resolved
30
+ * against this document's base URI). Built by the provider, like
31
+ * {@link ArazzoDocument.workflowIndex}.
32
+ */
33
+ sourceDescriptionIndex;
34
+ constructor(uri, parseResult, workflowIndex, stepIndex, sourceDescriptionIndex, isEntry = false) {
35
+ super(uri, parseResult);
36
+ this.isEntry = isEntry;
37
+ this.workflowIndex = workflowIndex;
38
+ this.stepIndex = stepIndex;
39
+ this.sourceDescriptionIndex = sourceDescriptionIndex;
40
+ }
41
+
42
+ /**
43
+ * Type guard for ArazzoDocument.
44
+ */
45
+ static is(doc) {
46
+ return doc.type === 'arazzo';
47
+ }
48
+
49
+ /**
50
+ * Resolves a source description name to its canonical URI — precomputed by
51
+ * the provider, resolved against this document's base URI.
52
+ */
53
+ resolveSourceDescriptionURI(sourceDescriptionName) {
54
+ return this.sourceDescriptionIndex.get(sourceDescriptionName)?.uri;
55
+ }
56
+
57
+ /**
58
+ * Resolves a field of a source description object (e.g. `url`, `type`).
59
+ *
60
+ * The `url` field resolves to the canonical URI (resolved against this
61
+ * document's base URI, as `resolveSourceDescriptionURI` does); every other
62
+ * field resolves to its literal value. Returns `undefined` when the source
63
+ * description or the field is absent.
64
+ */
65
+ resolveSourceDescriptionField(sourceDescriptionName, field) {
66
+ const sourceDescription = this.sourceDescriptionIndex.get(sourceDescriptionName);
67
+ if (sourceDescription === undefined) return undefined;
68
+ if (field === 'url') return sourceDescription.uri;
69
+ return (0, _apidomCore.toValue)(sourceDescription.element.get(field));
70
+ }
71
+
72
+ /**
73
+ * The canonical URIs of this document's source descriptions, resolved against
74
+ * this document's base URI, in declaration order. Sources without a resolvable
75
+ * url are omitted.
76
+ */
77
+ sourceDescriptionURIs() {
78
+ return [...this.sourceDescriptionIndex.values()].map(entry => entry.uri).filter(uri => uri !== undefined);
79
+ }
80
+ }
81
+ var _default = exports.default = ArazzoDocument;
@@ -0,0 +1,74 @@
1
+ import { toValue } from '@speclynx/apidom-core';
2
+ import APIDocument from "./APIDocument.mjs";
3
+ /**
4
+ * An Arazzo document held by the document registry: the parse result together
5
+ * 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.
7
+ * @public
8
+ */
9
+ class ArazzoDocument extends APIDocument {
10
+ type = 'arazzo';
11
+ isEntry;
12
+ /**
13
+ * WorkflowId → JSON Pointer to the workflow within the parse result.
14
+ */
15
+ workflowIndex;
16
+ /**
17
+ * WorkflowId → stepId → JSON Pointer to the step within the parse result.
18
+ * Built by the provider, like {@link ArazzoDocument.workflowIndex}.
19
+ */
20
+ stepIndex;
21
+ /**
22
+ * Name → source description element and canonical URI (already resolved
23
+ * against this document's base URI). Built by the provider, like
24
+ * {@link ArazzoDocument.workflowIndex}.
25
+ */
26
+ sourceDescriptionIndex;
27
+ constructor(uri, parseResult, workflowIndex, stepIndex, sourceDescriptionIndex, isEntry = false) {
28
+ super(uri, parseResult);
29
+ this.isEntry = isEntry;
30
+ this.workflowIndex = workflowIndex;
31
+ this.stepIndex = stepIndex;
32
+ this.sourceDescriptionIndex = sourceDescriptionIndex;
33
+ }
34
+
35
+ /**
36
+ * Type guard for ArazzoDocument.
37
+ */
38
+ static is(doc) {
39
+ return doc.type === 'arazzo';
40
+ }
41
+
42
+ /**
43
+ * Resolves a source description name to its canonical URI — precomputed by
44
+ * the provider, resolved against this document's base URI.
45
+ */
46
+ resolveSourceDescriptionURI(sourceDescriptionName) {
47
+ return this.sourceDescriptionIndex.get(sourceDescriptionName)?.uri;
48
+ }
49
+
50
+ /**
51
+ * Resolves a field of a source description object (e.g. `url`, `type`).
52
+ *
53
+ * The `url` field resolves to the canonical URI (resolved against this
54
+ * document's base URI, as `resolveSourceDescriptionURI` does); every other
55
+ * field resolves to its literal value. Returns `undefined` when the source
56
+ * description or the field is absent.
57
+ */
58
+ resolveSourceDescriptionField(sourceDescriptionName, field) {
59
+ const sourceDescription = this.sourceDescriptionIndex.get(sourceDescriptionName);
60
+ if (sourceDescription === undefined) return undefined;
61
+ if (field === 'url') return sourceDescription.uri;
62
+ return toValue(sourceDescription.element.get(field));
63
+ }
64
+
65
+ /**
66
+ * The canonical URIs of this document's source descriptions, resolved against
67
+ * this document's base URI, in declaration order. Sources without a resolvable
68
+ * url are omitted.
69
+ */
70
+ sourceDescriptionURIs() {
71
+ return [...this.sourceDescriptionIndex.values()].map(entry => entry.uri).filter(uri => uri !== undefined);
72
+ }
73
+ }
74
+ export default ArazzoDocument;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Unique name of a source description within an Arazzo document.
9
+ * @public
10
+ */
11
+
12
+ /**
13
+ * One indexed source description: the parsed element and its canonical URI —
14
+ * already resolved against the owning document's base URI, in the exact form
15
+ * the document registry keys on — or `undefined` for a source with no
16
+ * resolvable `url`.
17
+ * @public
18
+ */
19
+
20
+ /**
21
+ * Index mapping a source description name to its element and canonical URI in
22
+ * an Arazzo document.
23
+ * @public
24
+ */
25
+ class ArazzoSourceDescriptionIndex extends Map {}
26
+ var _default = exports.default = ArazzoSourceDescriptionIndex;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Unique name of a source description within an Arazzo document.
3
+ * @public
4
+ */
5
+
6
+ /**
7
+ * One indexed source description: the parsed element and its canonical URI —
8
+ * already resolved against the owning document's base URI, in the exact form
9
+ * the document registry keys on — or `undefined` for a source with no
10
+ * resolvable `url`.
11
+ * @public
12
+ */
13
+
14
+ /**
15
+ * Index mapping a source description name to its element and canonical URI in
16
+ * an Arazzo document.
17
+ * @public
18
+ */
19
+ class ArazzoSourceDescriptionIndex extends Map {}
20
+ export default ArazzoSourceDescriptionIndex;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Unique identifier of a step within an Arazzo workflow.
9
+ * @public
10
+ */
11
+
12
+ /**
13
+ * Index mapping workflowId → stepId → JSON Pointer to the step in an Arazzo
14
+ * document. Steps are unique only within their workflow, hence the nesting.
15
+ * @public
16
+ */
17
+ class ArazzoStepIndex extends Map {
18
+ /**
19
+ * The JSON Pointer of a step, or `undefined` when the workflow or step is absent.
20
+ */
21
+ getStep(workflowId, stepId) {
22
+ return this.get(workflowId)?.get(stepId);
23
+ }
24
+ }
25
+ var _default = exports.default = ArazzoStepIndex;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Unique identifier of a step within an Arazzo workflow.
3
+ * @public
4
+ */
5
+
6
+ /**
7
+ * Index mapping workflowId → stepId → JSON Pointer to the step in an Arazzo
8
+ * document. Steps are unique only within their workflow, hence the nesting.
9
+ * @public
10
+ */
11
+ class ArazzoStepIndex extends Map {
12
+ /**
13
+ * The JSON Pointer of a step, or `undefined` when the workflow or step is absent.
14
+ */
15
+ getStep(workflowId, stepId) {
16
+ return this.get(workflowId)?.get(stepId);
17
+ }
18
+ }
19
+ export default ArazzoStepIndex;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ /**
8
+ * Unique identifier of an Arazzo workflow.
9
+ * @public
10
+ */
11
+
12
+ /**
13
+ * Index mapping workflowId to its JSON Pointer in an Arazzo document.
14
+ * @public
15
+ */
16
+ class ArazzoWorkflowIndex extends Map {}
17
+ var _default = exports.default = ArazzoWorkflowIndex;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Unique identifier of an Arazzo workflow.
3
+ * @public
4
+ */
5
+
6
+ /**
7
+ * Index mapping workflowId to its JSON Pointer in an Arazzo document.
8
+ * @public
9
+ */
10
+ class ArazzoWorkflowIndex extends Map {}
11
+ export default ArazzoWorkflowIndex;
@@ -0,0 +1,28 @@
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 _APIDocument = _interopRequireDefault(require("./APIDocument.cjs"));
9
+ /**
10
+ * An OpenAPI document held by the document registry.
11
+ * @public
12
+ */
13
+ class OpenAPIDocument extends _APIDocument.default {
14
+ type = 'openapi';
15
+ operationIndex;
16
+ constructor(uri, parseResult, operationIndex) {
17
+ super(uri, parseResult);
18
+ this.operationIndex = operationIndex;
19
+ }
20
+
21
+ /**
22
+ * Type guard for OpenAPIDocument.
23
+ */
24
+ static is(doc) {
25
+ return doc.type === 'openapi';
26
+ }
27
+ }
28
+ var _default = exports.default = OpenAPIDocument;
@@ -0,0 +1,21 @@
1
+ import APIDocument from "./APIDocument.mjs";
2
+ /**
3
+ * An OpenAPI document held by the document registry.
4
+ * @public
5
+ */
6
+ class OpenAPIDocument extends APIDocument {
7
+ type = 'openapi';
8
+ operationIndex;
9
+ constructor(uri, parseResult, operationIndex) {
10
+ super(uri, parseResult);
11
+ this.operationIndex = operationIndex;
12
+ }
13
+
14
+ /**
15
+ * Type guard for OpenAPIDocument.
16
+ */
17
+ static is(doc) {
18
+ return doc.type === 'openapi';
19
+ }
20
+ }
21
+ export default OpenAPIDocument;
@@ -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;