@usearazzo/runner 1.0.1-alpha.33 → 1.0.1-alpha.35

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 (72) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +15 -1
  3. package/dist/arazzo-runner.browser.js +1516 -265
  4. package/dist/arazzo-runner.browser.min.js +1 -1
  5. package/package.json +64 -18
  6. package/src/ArazzoRunner.cjs +26 -3
  7. package/src/ArazzoRunner.mjs +26 -3
  8. package/src/client/OpenAPIOperationResponse.cjs +9 -0
  9. package/src/client/OpenAPIOperationResponse.mjs +9 -0
  10. package/src/document/APIDocument.cjs +53 -0
  11. package/src/document/APIDocument.mjs +53 -0
  12. package/src/errors/ExecutionError.cjs +2 -0
  13. package/src/errors/ExecutionError.mjs +2 -0
  14. package/src/executor/OpenAPIOperationExecutor.cjs +77 -6
  15. package/src/executor/OpenAPIOperationExecutor.mjs +77 -6
  16. package/src/executor/StepExecutor.cjs +16 -2
  17. package/src/executor/StepExecutor.mjs +16 -2
  18. package/src/executor/StepRetryRunner.cjs +5 -3
  19. package/src/executor/StepRetryRunner.mjs +5 -3
  20. package/src/executor/StepTransitionInterpreter.cjs +1 -1
  21. package/src/executor/StepTransitionInterpreter.mjs +1 -1
  22. package/src/executor/WorkflowCallStack.cjs +1 -1
  23. package/src/executor/WorkflowCallStack.mjs +1 -1
  24. package/src/executor/WorkflowExecutor.cjs +447 -89
  25. package/src/executor/WorkflowExecutor.mjs +447 -89
  26. package/src/index.cjs +21 -0
  27. package/src/index.mjs +4 -0
  28. package/src/observability/ArazzoRunnerEvent.cjs +5 -0
  29. package/src/observability/ArazzoRunnerEvent.mjs +1 -0
  30. package/src/observability/DocumentRegistryEvent.cjs +5 -0
  31. package/src/observability/DocumentRegistryEvent.mjs +1 -0
  32. package/src/observability/EventChannel.cjs +106 -0
  33. package/src/observability/EventChannel.mjs +98 -0
  34. package/src/observability/OpenAPIOperationEvent.cjs +5 -0
  35. package/src/observability/OpenAPIOperationEvent.mjs +1 -0
  36. package/src/observability/Redactor.cjs +215 -0
  37. package/src/observability/Redactor.mjs +210 -0
  38. package/src/observability/WorkflowExecutionEvent.cjs +5 -0
  39. package/src/observability/WorkflowExecutionEvent.mjs +1 -0
  40. package/src/observability/combineObservers.cjs +18 -0
  41. package/src/observability/combineObservers.mjs +12 -0
  42. package/src/observability/instrument.cjs +159 -0
  43. package/src/observability/instrument.mjs +144 -0
  44. package/src/observability/logging/LoggingObserver.cjs +177 -0
  45. package/src/observability/logging/LoggingObserver.mjs +172 -0
  46. package/src/observability/logging/index.cjs +13 -0
  47. package/src/observability/logging/index.mjs +1 -0
  48. package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.cjs +321 -0
  49. package/src/observability/opentelemetry/ArazzoRunnerInstrumentation.mjs +313 -0
  50. package/src/observability/opentelemetry/index.cjs +13 -0
  51. package/src/observability/opentelemetry/index.mjs +1 -0
  52. package/src/observability/stream/EventStream.cjs +112 -0
  53. package/src/observability/stream/EventStream.mjs +107 -0
  54. package/src/observability/stream/index.cjs +13 -0
  55. package/src/observability/stream/index.mjs +1 -0
  56. package/src/registry/DocumentRegistry.cjs +27 -3
  57. package/src/registry/DocumentRegistry.mjs +27 -3
  58. package/src/registry/providers/ArazzoDocumentRegistryProvider.cjs +20 -0
  59. package/src/registry/providers/ArazzoDocumentRegistryProvider.mjs +21 -1
  60. package/src/registry/providers/DocumentRegistryProvider.cjs +14 -0
  61. package/src/registry/providers/DocumentRegistryProvider.mjs +14 -0
  62. package/src/registry/providers/OpenAPIDocumentRegistryProvider.cjs +27 -5
  63. package/src/registry/providers/OpenAPIDocumentRegistryProvider.mjs +27 -5
  64. package/src/version.cjs +9 -0
  65. package/src/version.mjs +3 -0
  66. package/types/observability/logging/LoggingObserver.d.ts +82 -0
  67. package/types/observability/logging/index.d.ts +2 -0
  68. package/types/observability/opentelemetry/ArazzoRunnerInstrumentation.d.ts +84 -0
  69. package/types/observability/opentelemetry/index.d.ts +2 -0
  70. package/types/observability/stream/EventStream.d.ts +68 -0
  71. package/types/observability/stream/index.d.ts +2 -0
  72. package/types/runner.d.ts +802 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
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.35](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.34...v1.0.1-alpha.35) (2026-11-24)
7
+
8
+ ### Features
9
+
10
+ - **runner:** add observability adapters and OTel instrumentation ([#366](https://github.com/usearazzo/arazzo-toolkit/issues/366)), closes [#85](https://github.com/usearazzo/arazzo-toolkit/issues/85)
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ - **runner:** event types use colon notation (workflow-start is now
15
+ workflow:start, openapi-operation-request-settled is
16
+ openapi:operation:request:settled, and so on), and the adapter subpaths
17
+ are @usearazzo/runner/observability/logging, /observability/stream and
18
+ /observability/opentelemetry.
19
+
20
+ ## [1.0.1-alpha.34](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.33...v1.0.1-alpha.34) (2026-11-19)
21
+
22
+ ### Features
23
+
24
+ - **runner:** emit HTTP request events, redact at export ([#356](https://github.com/usearazzo/arazzo-toolkit/issues/356)) ([e872d25](https://github.com/usearazzo/arazzo-toolkit/commit/e872d25bc6af721c25b0cf0aec515ebf4ab785f3)), closes [#85](https://github.com/usearazzo/arazzo-toolkit/issues/85)
25
+ - **runner:** emit structured execution events to an observer ([#355](https://github.com/usearazzo/arazzo-toolkit/issues/355)) ([3eacded](https://github.com/usearazzo/arazzo-toolkit/commit/3eacdedf2dd777a404433f69e3747006f48ce877)), closes [#85](https://github.com/usearazzo/arazzo-toolkit/issues/85)
26
+ - **runner:** locate events and trace records in their documents ([#362](https://github.com/usearazzo/arazzo-toolkit/issues/362)) ([013c4cb](https://github.com/usearazzo/arazzo-toolkit/commit/013c4cb9d2abb7da3452e44ecf2496007fd9a6b8)), closes [#85](https://github.com/usearazzo/arazzo-toolkit/issues/85)
27
+
6
28
  ## [1.0.1-alpha.33](https://github.com/usearazzo/arazzo-toolkit/compare/v1.0.1-alpha.32...v1.0.1-alpha.33) (2026-11-16)
7
29
 
8
30
  ### Bug Fixes
package/README.md CHANGED
@@ -41,6 +41,7 @@ Use it to test an API flow end to end in CI, to drive a workflow from your own s
41
41
  - **Steps.** Parameters and request bodies resolved from runtime expressions, `successCriteria` evaluated (`simple`, `regex`, `jsonpath`, `xpath`), `outputs` resolved from the response.
42
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.
43
43
  - **Composition.** Sub-workflow steps, `dependsOn` prerequisites, one-way transfer to another workflow, and workflows in other Arazzo documents.
44
+ - **Observability.** A typed event stream while the run happens: workflows, dependencies, steps, attempts, criterion outcomes and selected actions, plus document loads, normalization, request assembly and every request sent with its response (bodies on request) underneath. Events carry what the run saw, credentials included; a `Redactor` masks them by name before they leave the process. Adapters log them through any logger (`@usearazzo/runner/observability/logging`) or stream them (`@usearazzo/runner/observability/stream`), masked by default, and an OpenTelemetry instrumentation (`@usearazzo/runner/observability/opentelemetry`) traces every run in the process. Folding a run's workflow events gives back its trace.
44
45
  - **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.
45
46
 
46
47
  ## At a glance
@@ -58,7 +59,11 @@ A runner is four building blocks, composed bottom-up; `ArazzoRunner` composes th
58
59
  <img alt="Runner architecture: WorkflowExecutor runs steps through StepExecutor, which runs OpenAPI operations through OpenAPIOperationExecutor and the HTTPClient; DocumentRegistry supplies documents to all three executors" src="https://raw.githubusercontent.com/usearazzo/arazzo-toolkit/main/packages/runner/assets/architecture.svg">
59
60
  </p>
60
61
 
61
- A step whose criteria go unmet is a result, not an error: the run resolves with `status: 'failed'`. A criterion whose condition cannot be evaluated (an invalid regex, JSONPath, XPath or simple condition, or non-XML data under an `xpath` query) counts as unmet, as Arazzo 1.1.0 requires, rather than throwing. So does a criterion of a step that calls a workflow when it reads `$statusCode`, `$url`, `$method`, `$request` or `$response`: that step made no HTTP call. Each step record's `successCriteria` and `actionCriteria` list every criterion its last attempt evaluated, as a `CriterionEvaluationRecord` with the condition, whether it was met, the action's name for an action criterion and, when it could not be evaluated, a `diagnostic` with a `code` and `message`, never request or response data. The type-specific criterion evaluators raise an unevaluable condition as `CriterionEvaluationError`, a `CriterionError` subclass, and every `CriterionError` carries a `reason`. `CriterionError`, `ExecutionError`, `ResolverError` and `RuntimeExpressionError` each list the reasons they can carry as static fields (`CriterionError.InvalidRegex`, `ExecutionError.OperationNotFound`), typed by `CriterionErrorReason`, `ExecutionErrorReason`, `ResolverErrorReason` and `RuntimeExpressionErrorReason`. Only a document that cannot be loaded or run as written, a request that cannot be built or sent, or a cancelled run throws, and every such error extends `ArazzoRunnerError`; a document that cannot be read or loaded (a missing file, an HTTP error, an unresolvable reference) throws `DocumentLoadError` with the underlying failure as its `cause`.
62
+ ### Failed runs and errors
63
+
64
+ A failed run is a result, not an exception. When a step's criteria go unmet, the run resolves with `status: 'failed'`. A criterion that can't be evaluated, such as an invalid regex, counts as unmet. Each step in `result.steps` lists its criteria and whether each was met ([The result](https://usearazzo.com/docs/runner/#result)).
65
+
66
+ Only three things throw: a document that can't be loaded or run as written, a request that can't be built or sent, and a cancelled run. Every such error extends `ArazzoRunnerError`, and most carry a `reason` to compare against static fields such as `ExecutionError.WorkflowNotFound` ([Errors](https://usearazzo.com/docs/runner/#errors)).
62
67
 
63
68
  ## Installation
64
69
 
@@ -135,6 +140,15 @@ const result = await runner.execute('authenticateAndOrderPet', {
135
140
  | 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
141
  | Load documents behind credentials or mutual TLS | `reference` on `load` | [Document retrieval](https://usearazzo.com/docs/runner/#document-retrieval) |
137
142
  | Cancel a run | `signal` | [Cancellation](https://usearazzo.com/docs/runner/#cancellation) |
143
+ | Watch a run as it happens (progress, logs, debugging) | `observer` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
144
+ | Include request and response bodies in those events | `captureBodies` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
145
+ | Give each `location` (on events, and on the result's steps and criteria) its range in the document, not only its JSON Pointer | `sourceMap` on `load` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
146
+ | Mask credentials before logging or exporting events | `new Redactor().event(event)` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
147
+ | Send the events to several consumers at once | `combineObservers(...observers)` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
148
+ | Observe every runner in the process, and run code around each workflow and step | `instrument({ observer, wrap })` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
149
+ | Log a run through pino, winston, the console or any logger, masked | `loggingObserver(log)` from `@usearazzo/runner/observability/logging` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
150
+ | Read a run's events with `for await`, or pipe them as a `ReadableStream`, masked | `eventStream()` from `@usearazzo/runner/observability/stream` | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
151
+ | Trace every run with OpenTelemetry, with the HTTP spans of each step under it | `new ArazzoRunnerInstrumentation()` from `@usearazzo/runner/observability/opentelemetry`, listed with the SDK's instrumentations (needs `@opentelemetry/api`) | [Observing a run](https://usearazzo.com/docs/runner/#observability) |
138
152
  | Compose the building blocks yourself | `DocumentRegistry`, the executors | [Runner API Reference](https://usearazzo.com/docs/runner/) |
139
153
 
140
154
  Retrieving documents and calling APIs are separate: credentials for one never reach the other.