@usearazzo/runner 1.0.1-alpha.29 → 1.0.1-alpha.30
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 +7 -0
- package/README.md +27 -73
- package/dist/arazzo-runner.browser.js +161 -78
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/executor/OpenAPIOperationExecutor.cjs +65 -12
- package/src/executor/OpenAPIOperationExecutor.mjs +63 -12
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +31 -4
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +30 -4
- package/src/executor/StepExecutor.cjs +6 -4
- package/src/executor/StepExecutor.mjs +6 -4
- package/types/runner.d.ts +73 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
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.30](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.29...v1.0.1-alpha.30) (2026-11-13)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **runner:** pass request context to request interceptors ([#350](https://github.com/usearazzo/arazzo-toolkit/issues/350)) ([076dea3](https://github.com/usearazzo/arazzo-toolkit/commit/076dea3b38a1cd37fc2111ecbc91420bc4f7eb48)), closes [#36](https://github.com/usearazzo/arazzo-toolkit/issues/36)
|
|
11
|
+
- **runner:** pass the source description to request interceptors ([#351](https://github.com/usearazzo/arazzo-toolkit/issues/351)) ([046ccd1](https://github.com/usearazzo/arazzo-toolkit/commit/046ccd1077f60bf50fca5403b96bde8c08d5f52e)), closes [#36](https://github.com/usearazzo/arazzo-toolkit/issues/36)
|
|
12
|
+
|
|
6
13
|
## [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
14
|
|
|
8
15
|
### Features
|
package/README.md
CHANGED
|
@@ -8,12 +8,26 @@
|
|
|
8
8
|
<p align="center">
|
|
9
9
|
<a href="https://www.npmjs.com/package/@usearazzo/runner"><img src="https://img.shields.io/npm/v/@usearazzo/runner.svg" alt="npm version"></a>
|
|
10
10
|
<a href="https://github.com/usearazzo/arazzo-toolkit/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0"></a>
|
|
11
|
+
<a href="https://tidelift.com/subscription/pkg/npm-.usearazzo-runner?utm_source=npm-usearazzo-runner&utm_medium=referral&utm_campaign=readme"><img src="https://tidelift.com/badges/package/npm/@usearazzo%2Frunner" alt="Tidelift"></a>
|
|
11
12
|
</p>
|
|
12
13
|
|
|
13
14
|
<p align="center">
|
|
14
15
|
<a href="https://usearazzo.com"><img alt="UseArazzo" width="96" src="https://usearazzo.com/assets/images/logos/usearazzo-logo.svg"></a>
|
|
15
16
|
</p>
|
|
16
17
|
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="right" valign="middle">
|
|
21
|
+
<img src="https://raw.githubusercontent.com/usearazzo/arazzo-toolkit/main/assets/tidelift.webp" alt="Tidelift" width="60" />
|
|
22
|
+
</td>
|
|
23
|
+
<td valign="middle">
|
|
24
|
+
<a href="https://tidelift.com/subscription/pkg/npm-.usearazzo-runner?utm_source=npm-usearazzo-runner&utm_medium=referral&utm_campaign=readme">
|
|
25
|
+
Get professionally supported @usearazzo/runner with Tidelift Subscription.
|
|
26
|
+
</a>
|
|
27
|
+
</td>
|
|
28
|
+
</tr>
|
|
29
|
+
</table>
|
|
30
|
+
|
|
17
31
|
---
|
|
18
32
|
|
|
19
33
|
## What it does
|
|
@@ -27,7 +41,7 @@ Use it to test an API flow end to end in CI, to drive a workflow from your own s
|
|
|
27
41
|
- **Steps.** Parameters and request bodies resolved from runtime expressions, `successCriteria` evaluated (`simple`, `regex`, `jsonpath`, `xpath`), `outputs` resolved from the response.
|
|
28
42
|
- **Control flow.** `goto`, `retry` (with `retryLimit`, `retryAfter`, and references), and `end`, as the specification defines them, with workflow-level default actions and parameters, and action `parameters` as the inputs of a `goto` or `retry` workflow target.
|
|
29
43
|
- **Composition.** Sub-workflow steps, `dependsOn` prerequisites, one-way transfer to another workflow, and workflows in other Arazzo documents.
|
|
30
|
-
- **Your HTTP stack.** Global `fetch` by default, or any client you plug in.
|
|
44
|
+
- **Your HTTP stack.** Global `fetch` by default, or any client you plug in. Arazzo is auth-agnostic, so credentials come from you: static ones per API, or a request interceptor.
|
|
31
45
|
|
|
32
46
|
## At a glance
|
|
33
47
|
|
|
@@ -110,80 +124,20 @@ const result = await runner.execute('authenticateAndOrderPet', {
|
|
|
110
124
|
});
|
|
111
125
|
```
|
|
112
126
|
|
|
113
|
-
`
|
|
114
|
-
|
|
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
|
-
|
|
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`:
|
|
137
|
-
|
|
138
|
-
```js
|
|
139
|
-
const runner = await ArazzoRunner.load(uri, {
|
|
140
|
-
requestInterceptor: async (request) => {
|
|
141
|
-
request.headers.Authorization = `Bearer ${await acquireToken()}`;
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
```
|
|
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
|
-
|
|
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:
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
import { fetch, Agent } from 'undici';
|
|
152
|
-
|
|
153
|
-
const dispatcher = new Agent({ connections: 16, keepAliveTimeout: 60_000 });
|
|
154
|
-
|
|
155
|
-
const runner = await ArazzoRunner.load(uri, {
|
|
156
|
-
httpClient: (request) => fetch(request.url, { ...request, dispatcher }),
|
|
157
|
-
});
|
|
158
|
-
```
|
|
159
|
-
|
|
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.
|
|
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.
|
|
127
|
+
`executeOptions` is keyed by source description name, so each API gets its own options. Beyond this example:
|
|
182
128
|
|
|
183
|
-
|
|
129
|
+
| To | Use | Reference |
|
|
130
|
+
|---|---|---|
|
|
131
|
+
| Point an API at another server | `server`, `serverVariables` in its `executeOptions` entry | [Choosing the server](https://usearazzo.com/docs/runner/#server) |
|
|
132
|
+
| Send static credentials | `securities` in its `executeOptions` entry | [Authentication](https://usearazzo.com/docs/runner/#authentication) |
|
|
133
|
+
| Compute credentials per request | `requestInterceptor` | [Request interceptor](https://usearazzo.com/docs/runner/#request-interceptor) |
|
|
134
|
+
| Change the requests of one step, operation or source description only | the `RequestContext` an interceptor receives as its second argument | [Request interceptor](https://usearazzo.com/docs/runner/#request-interceptor) |
|
|
135
|
+
| Use another HTTP stack, a proxy or a client certificate for API calls | `httpClient` | [The HTTP client](https://usearazzo.com/docs/runner/#http-client) |
|
|
136
|
+
| Load documents behind credentials or mutual TLS | `reference` on `load` | [Document retrieval](https://usearazzo.com/docs/runner/#document-retrieval) |
|
|
137
|
+
| Cancel a run | `signal` | [Cancellation](https://usearazzo.com/docs/runner/#cancellation) |
|
|
138
|
+
| Compose the building blocks yourself | `DocumentRegistry`, the executors | [Runner API Reference](https://usearazzo.com/docs/runner/) |
|
|
184
139
|
|
|
185
|
-
|
|
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.
|
|
140
|
+
Retrieving documents and calling APIs are separate: credentials for one never reach the other.
|
|
187
141
|
|
|
188
142
|
## Documentation
|
|
189
143
|
|