@usearazzo/runner 1.0.1-alpha.28 → 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 +18 -0
- package/README.md +29 -54
- package/dist/arazzo-runner.browser.js +328 -181
- package/dist/arazzo-runner.browser.min.js +1 -1
- package/package.json +4 -4
- package/src/errors/ExecutionError.cjs +3 -1
- package/src/errors/ExecutionError.mjs +3 -1
- package/src/executor/OpenAPIOperationExecutor.cjs +92 -22
- package/src/executor/OpenAPIOperationExecutor.mjs +90 -22
- package/src/executor/OpenAPIOperationLocatorNormalizer.cjs +31 -4
- package/src/executor/OpenAPIOperationLocatorNormalizer.mjs +30 -4
- package/src/executor/StepExecutor.cjs +19 -7
- package/src/executor/StepExecutor.mjs +19 -7
- package/src/executor/WorkflowExecutor.cjs +50 -16
- package/src/executor/WorkflowExecutor.mjs +51 -17
- package/types/runner.d.ts +153 -25
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
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
|
+
|
|
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)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
- **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)
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
- **runner:** executeOptions passed to ArazzoRunner.execute and
|
|
22
|
+
WorkflowExecutor.execute is keyed by source description name. Replace
|
|
23
|
+
|
|
6
24
|
## [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)
|
|
7
25
|
|
|
8
26
|
### 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
|
|
|
@@ -78,7 +92,7 @@ const runner = await ArazzoRunner.load(
|
|
|
78
92
|
);
|
|
79
93
|
const result = await runner.execute('authenticateAndOrderPet', {
|
|
80
94
|
inputs: { username: 'theUser', password: '12345', preferredPetStatus: 'available', orderQuantity: 1 },
|
|
81
|
-
executeOptions: { server: 'http://localhost:8080/api/v3' },
|
|
95
|
+
executeOptions: { petstoreAPI: { server: 'http://localhost:8080/api/v3' } },
|
|
82
96
|
});
|
|
83
97
|
result.steps.map((s) => `${s.successful ? '✓' : '✗'} ${s.stepId}`);
|
|
84
98
|
|
|
@@ -106,63 +120,24 @@ const runner = await ArazzoRunner.load(
|
|
|
106
120
|
|
|
107
121
|
const result = await runner.execute('authenticateAndOrderPet', {
|
|
108
122
|
inputs: { username: 'theUser', password: '12345', preferredPetStatus: 'available', orderQuantity: 1 },
|
|
109
|
-
executeOptions: { server: 'http://localhost:8080/api/v3' },
|
|
110
|
-
});
|
|
111
|
-
```
|
|
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`), `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
|
-
|
|
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
|
-
To add credentials, pass a `requestInterceptor`:
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
const runner = await ArazzoRunner.load(uri, {
|
|
121
|
-
requestInterceptor: async (request) => {
|
|
122
|
-
request.headers.Authorization = `Bearer ${await acquireToken()}`;
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
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
|
-
|
|
129
|
-
```js
|
|
130
|
-
import { fetch, Agent } from 'undici';
|
|
131
|
-
|
|
132
|
-
const dispatcher = new Agent({ connections: 16, keepAliveTimeout: 60_000 });
|
|
133
|
-
|
|
134
|
-
const runner = await ArazzoRunner.load(uri, {
|
|
135
|
-
httpClient: (request) => fetch(request.url, { ...request, dispatcher }),
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
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
|
-
|
|
141
|
-
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:
|
|
142
|
-
|
|
143
|
-
```js
|
|
144
|
-
import https from 'node:https';
|
|
145
|
-
import { fetch, Agent } from 'undici';
|
|
146
|
-
|
|
147
|
-
const tls = { cert, key, ca };
|
|
148
|
-
const dispatcher = new Agent({ connect: tls });
|
|
149
|
-
|
|
150
|
-
const runner = await ArazzoRunner.load(uri, {
|
|
151
|
-
// document retrieval
|
|
152
|
-
reference: {
|
|
153
|
-
resolve: { resolverOpts: { axiosConfig: { httpsAgent: new https.Agent(tls) } } },
|
|
154
|
-
},
|
|
155
|
-
// API calls
|
|
156
|
-
httpClient: (request) => fetch(request.url, { ...request, dispatcher }),
|
|
123
|
+
executeOptions: { petstoreAPI: { server: 'http://localhost:8080/api/v3' } },
|
|
157
124
|
});
|
|
158
125
|
```
|
|
159
126
|
|
|
160
|
-
|
|
127
|
+
`executeOptions` is keyed by source description name, so each API gets its own options. Beyond this example:
|
|
161
128
|
|
|
162
|
-
|
|
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/) |
|
|
163
139
|
|
|
164
|
-
|
|
165
|
-
- 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.
|
|
166
141
|
|
|
167
142
|
## Documentation
|
|
168
143
|
|