@usearazzo/runner 1.0.1-alpha.27 → 1.0.1-alpha.29
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/CHANGELOG.md +17 -0
- package/README.md +51 -4
- package/dist/arazzo-runner.browser.js +388 -206
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +15 -15
- package/src/ArazzoRunner.cjs +39 -4
- package/src/ArazzoRunner.mjs +38 -4
- package/src/errors/ExecutionError.cjs +3 -1
- package/src/errors/ExecutionError.mjs +3 -1
- package/src/executor/OpenAPIOperationExecutor.cjs +27 -10
- package/src/executor/OpenAPIOperationExecutor.mjs +27 -10
- package/src/executor/StepExecutor.cjs +13 -3
- package/src/executor/StepExecutor.mjs +13 -3
- package/src/executor/WorkflowExecutor.cjs +52 -17
- package/src/executor/WorkflowExecutor.mjs +53 -18
- package/types/runner.d.ts +115 -22
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.0.1-alpha.29](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.28...v1.0.1-alpha.29) (2026-11-11)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **runner:** address execute options to a source description ([#346](https://github.com/usearazzo/arazzo-toolkit/issues/346)) ([d5375cd](https://github.com/usearazzo/arazzo-toolkit/commit/d5375cdedab0fcb6d2cf23b5db130fc0656ff498)), closes [#345](https://github.com/usearazzo/arazzo-toolkit/issues/345)
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **runner:** executeOptions passed to ArazzoRunner.execute and
|
|
15
|
+
WorkflowExecutor.execute is keyed by source description name. Replace
|
|
16
|
+
|
|
17
|
+
## [1.0.1-alpha.28](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.27...v1.0.1-alpha.28) (2026-11-11)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
- **runner:** add reference options for document retrieval ([#343](https://github.com/usearazzo/arazzo-toolkit/issues/343)) ([e26323c](https://github.com/usearazzo/arazzo-toolkit/commit/e26323cafe9a15e89e5e327ce7cee74deefb4cf8)), closes [#310](https://github.com/usearazzo/arazzo-toolkit/issues/310)
|
|
22
|
+
|
|
6
23
|
## [1.0.1-alpha.27](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.26...v1.0.1-alpha.27) (2026-11-08)
|
|
7
24
|
|
|
8
25
|
### Bug Fixes
|
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ const runner = await ArazzoRunner.load(
|
|
|
78
78
|
);
|
|
79
79
|
const result = await runner.execute('authenticateAndOrderPet', {
|
|
80
80
|
inputs: { username: 'theUser', password: '12345', preferredPetStatus: 'available', orderQuantity: 1 },
|
|
81
|
-
executeOptions: { server: 'http://localhost:8080/api/v3' },
|
|
81
|
+
executeOptions: { petstoreAPI: { server: 'http://localhost:8080/api/v3' } },
|
|
82
82
|
});
|
|
83
83
|
result.steps.map((s) => `${s.successful ? '✓' : '✗'} ${s.stepId}`);
|
|
84
84
|
|
|
@@ -106,15 +106,34 @@ const runner = await ArazzoRunner.load(
|
|
|
106
106
|
|
|
107
107
|
const result = await runner.execute('authenticateAndOrderPet', {
|
|
108
108
|
inputs: { username: 'theUser', password: '12345', preferredPetStatus: 'available', orderQuantity: 1 },
|
|
109
|
-
executeOptions: { server: 'http://localhost:8080/api/v3' },
|
|
109
|
+
executeOptions: { petstoreAPI: { server: 'http://localhost:8080/api/v3' } },
|
|
110
110
|
});
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
-
`runner.document` and `runner.registry` are the loaded entry document and the registry holding its source descriptions; unless you pass one, every runner `load` returns has a registry of its own. `load` takes the seams of the building blocks it wires: `registry` (one registry backs one entry document, so loading a different document into it throws `InvalidEntryDocumentError`), `httpClient` and `requestInterceptor`, and the workflow executor's `maxSteps`, `maxWorkflowDepth`, `sleep` and `now`. To bind a runner to a document you already acquired, use `new ArazzoRunner({ document, registry })`; it throws `InvalidEntryDocumentError` unless `document` is the entry document of `registry`.
|
|
113
|
+
`runner.document` and `runner.registry` are the loaded entry document and the registry holding its source descriptions; unless you pass one, every runner `load` returns has a registry of its own. `load` takes the seams of the building blocks it wires: `registry` (one registry backs one entry document, so loading a different document into it throws `InvalidEntryDocumentError`), `reference` (how documents are retrieved, see below), `httpClient` and `requestInterceptor`, and the workflow executor's `maxSteps`, `maxWorkflowDepth`, `sleep` and `now`. To bind a runner to a document you already acquired, use `new ArazzoRunner({ document, registry })`; it throws `InvalidEntryDocumentError` unless `document` is the entry document of `registry`.
|
|
114
114
|
|
|
115
115
|
To see what a document offers before running it, `runner.document.listWorkflows()` returns a `WorkflowDescriptor` for each workflow `execute` accepts, in document order: its `workflowId`, its `jsonPointer` in the document and, when the document gives them as strings, its `summary` and `description`. It reads the entry document only; source descriptions are not loaded.
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
`executeOptions` is keyed by source description name: each entry holds the options for the API that source description points at, and reaches only the steps calling it. That is where a `server` and static credentials go. `securities` takes a credential per security scheme the API's OpenAPI document declares, and each is applied where its scheme says, to the operations that require it:
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
await runner.execute('buyPet', {
|
|
121
|
+
inputs,
|
|
122
|
+
executeOptions: {
|
|
123
|
+
petstoreAPI: {
|
|
124
|
+
server: 'http://localhost:8080/api/v3',
|
|
125
|
+
securities: { authorized: { api_key: 'KEY' } },
|
|
126
|
+
},
|
|
127
|
+
paymentsAPI: {
|
|
128
|
+
securities: { authorized: { bearerAuth: 'TOKEN', basicAuth: { username: 'user', password: 'pass' } } },
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
An entry configures the OpenAPI document its name points at, so two APIs that happen to name a scheme alike never see each other's credentials, and a workflow of another Arazzo document calling the same OpenAPI document gets the entry too. A key that names no source description or an Arazzo one, two keys for one document, and an entry that is not an object all throw before the first request. A `signal` in an entry is dropped; cancel a run with the `signal` option. An API that only a nested Arazzo document declares has no name here: declare it in the entry document, or use an interceptor.
|
|
135
|
+
|
|
136
|
+
For credentials computed per request, or anything `securities` cannot express, pass a `requestInterceptor`:
|
|
118
137
|
|
|
119
138
|
```js
|
|
120
139
|
const runner = await ArazzoRunner.load(uri, {
|
|
@@ -124,6 +143,8 @@ const runner = await ArazzoRunner.load(uri, {
|
|
|
124
143
|
});
|
|
125
144
|
```
|
|
126
145
|
|
|
146
|
+
`request.headers` is a plain object, and the case of a header name in it can differ: for an OpenAPI 2.0 document, credentials from `securities` arrive under `authorization`. Match header names case-insensitively in an interceptor, and when replacing a header that may already be there, delete the existing key first: the same header under two spellings is sent as one header with both values.
|
|
147
|
+
|
|
127
148
|
To send requests through another HTTP stack, replace the `httpClient`. It is a function from the built request to a WHATWG `Response`; here undici with a connection pool that global `fetch` cannot take:
|
|
128
149
|
|
|
129
150
|
```js
|
|
@@ -138,6 +159,32 @@ const runner = await ArazzoRunner.load(uri, {
|
|
|
138
159
|
|
|
139
160
|
The two combine: the interceptor changes the request, and the client sends it. Both are options of `OpenAPIOperationExecutor` too, for when you compose the building blocks yourself.
|
|
140
161
|
|
|
162
|
+
Retrieving documents is separate from calling APIs. The entry document, its source descriptions and every externally referenced document are fetched by [ApiDOM reference](https://github.com/speclynx/apidom/tree/main/packages/apidom-reference#resolver-plugin-options), which `httpClient` and `requestInterceptor` never touch, so credentials for an API do not reach a host that only serves a document. Configure it with `reference`, which takes its `resolve` options; here a client certificate (mutual TLS) for both sides:
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
import https from 'node:https';
|
|
166
|
+
import { fetch, Agent } from 'undici';
|
|
167
|
+
|
|
168
|
+
const tls = { cert, key, ca };
|
|
169
|
+
const dispatcher = new Agent({ connect: tls });
|
|
170
|
+
|
|
171
|
+
const runner = await ArazzoRunner.load(uri, {
|
|
172
|
+
// document retrieval
|
|
173
|
+
reference: {
|
|
174
|
+
resolve: { resolverOpts: { axiosConfig: { httpsAgent: new https.Agent(tls) } } },
|
|
175
|
+
},
|
|
176
|
+
// API calls
|
|
177
|
+
httpClient: (request) => fetch(request.url, { ...request, dispatcher }),
|
|
178
|
+
});
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
For documents behind an API key or token, add the header per origin with `axiosConfig.interceptors.request`; plain `axiosConfig.headers` are sent to every host a document or reference points at. In the errors of failed downloads, standard credentials such as the `Authorization` header are masked. A custom header is masked only when listed in `axiosConfig.redact`, and that list replaces the default one, so spread ApiDOM's `HTTPResolverAxios.defaultRedact` into it. Credentials embedded in a URL are not masked.
|
|
182
|
+
|
|
183
|
+
Two things to know:
|
|
184
|
+
|
|
185
|
+
- A `registry` of your own is configured through its providers (`new ArazzoDocumentRegistryProvider({ resolve })`, `new OpenAPIDocumentRegistryProvider({ resolve })`, both need the options). Pass the same options to `load` as `reference` too: they then reach the normalizers, which fetch external references.
|
|
186
|
+
- Retrieved documents are cached per process by URL, for all registries. A registry whose providers get an HTTP resolver of their own in `resolve.resolvers` has a private cache; `resolvers` replaces the default list, so include a file resolver if you load local documents.
|
|
187
|
+
|
|
141
188
|
## Documentation
|
|
142
189
|
|
|
143
190
|
The example above is the happy path. Everything else is on [usearazzo.com](https://usearazzo.com/):
|