@camunda8/sdk 8.9.0-alpha.15 → 8.9.0-alpha.17
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/.eslintrc.json +79 -0
- package/AGENT.md +9 -0
- package/CHANGELOG.md +14 -0
- package/MAINTAINER.md +10 -10
- package/README.md +36 -2
- package/dist/test-support/socketTap.d.ts +23 -0
- package/dist/test-support/socketTap.js +183 -0
- package/dist/test-support/socketTap.js.map +1 -0
- package/dist/zeebe/index.d.ts +1 -0
- package/dist/zeebe/index.js.map +1 -1
- package/dist/zeebe/lib/GrpcClient.d.ts +6 -0
- package/dist/zeebe/lib/GrpcClient.js +93 -85
- package/dist/zeebe/lib/GrpcClient.js.map +1 -1
- package/dist/zeebe/lib/StreamLifecycle.d.ts +189 -0
- package/dist/zeebe/lib/StreamLifecycle.js +142 -0
- package/dist/zeebe/lib/StreamLifecycle.js.map +1 -0
- package/dist/zeebe/lib/ZBStreamWorker.d.ts +41 -3
- package/dist/zeebe/lib/ZBStreamWorker.js +401 -81
- package/dist/zeebe/lib/ZBStreamWorker.js.map +1 -1
- package/dist/zeebe/lib/cancelProcesses.js +8 -0
- package/dist/zeebe/lib/cancelProcesses.js.map +1 -1
- package/dist/zeebe/zb/ZeebeGrpcClient.d.ts +17 -5
- package/dist/zeebe/zb/ZeebeGrpcClient.js +14 -2
- package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -1
- package/package.json +8 -2
- package/scripts/assert-no-skipped-tests.d.ts +17 -0
- package/scripts/assert-no-skipped-tests.js +118 -0
- package/scripts/required-integration-specs.json +4 -0
- package/stryker.config.json +20 -0
- package/vitest.mutation.config.js +18 -0
package/.eslintrc.json
CHANGED
|
@@ -28,6 +28,85 @@
|
|
|
28
28
|
"import/newline-after-import": "error",
|
|
29
29
|
"prettier/prettier": "error"
|
|
30
30
|
},
|
|
31
|
+
"overrides": [
|
|
32
|
+
{
|
|
33
|
+
// Stream lifecycle (see src/zeebe/lib/StreamLifecycle.ts): stream workers
|
|
34
|
+
// must not attach listeners to a raw gRPC stream themselves. The adapter
|
|
35
|
+
// owns that, and requires a handler for every event. The selectors match
|
|
36
|
+
// on the receiver's name, because the rule has no type information.
|
|
37
|
+
//
|
|
38
|
+
// GrpcClient.ts (the transport that creates streams), ZBWorkerBase.ts (the
|
|
39
|
+
// long-poll worker, which has its own handling) and ZeebeGrpcClient.ts
|
|
40
|
+
// (activateJobs, a finite request/response stream) are existing call
|
|
41
|
+
// sites and are exempt for now.
|
|
42
|
+
"files": ["src/zeebe/**/*.ts"],
|
|
43
|
+
"excludedFiles": [
|
|
44
|
+
"src/zeebe/lib/StreamLifecycle.ts",
|
|
45
|
+
"src/zeebe/lib/GrpcClient.ts",
|
|
46
|
+
"src/zeebe/lib/ZBWorkerBase.ts",
|
|
47
|
+
"src/zeebe/zb/ZeebeGrpcClient.ts"
|
|
48
|
+
],
|
|
49
|
+
"rules": {
|
|
50
|
+
"no-restricted-syntax": [
|
|
51
|
+
"error",
|
|
52
|
+
{
|
|
53
|
+
"selector": "CallExpression[callee.property.name=/^(on|once|addListener|prependListener|prependOnceListener)$/][callee.object.name=/stream/i]",
|
|
54
|
+
"message": "Do not attach listeners to a gRPC stream directly. Use attachStream() from src/zeebe/lib/StreamLifecycle.ts, which requires handlers for data, error, end and close."
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"selector": "CallExpression[callee.property.name=/^(on|once|addListener|prependListener|prependOnceListener)$/][callee.object.property.name=/stream/i]",
|
|
58
|
+
"message": "Do not attach listeners to a gRPC stream directly. Use attachStream() from src/zeebe/lib/StreamLifecycle.ts, which requires handlers for data, error, end and close."
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
// Stream workers must not name the raw gRPC stream types, so they cannot
|
|
65
|
+
// hold a typed reference to a stream and attach listeners to it.
|
|
66
|
+
"files": ["src/zeebe/**/*.ts"],
|
|
67
|
+
"excludedFiles": [
|
|
68
|
+
"src/zeebe/lib/StreamLifecycle.ts",
|
|
69
|
+
"src/zeebe/lib/GrpcClient.ts",
|
|
70
|
+
"src/zeebe/lib/ZBWorkerBase.ts",
|
|
71
|
+
"src/zeebe/lib/interfaces-1.0.ts"
|
|
72
|
+
],
|
|
73
|
+
"rules": {
|
|
74
|
+
"no-restricted-imports": [
|
|
75
|
+
"error",
|
|
76
|
+
{
|
|
77
|
+
"paths": [
|
|
78
|
+
{
|
|
79
|
+
"name": "@grpc/grpc-js",
|
|
80
|
+
"importNames": [
|
|
81
|
+
"ClientReadableStream",
|
|
82
|
+
"ClientDuplexStream",
|
|
83
|
+
"ClientWritableStream"
|
|
84
|
+
],
|
|
85
|
+
"message": "Stream workers must go through src/zeebe/lib/StreamLifecycle.ts instead of using the raw gRPC stream types."
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
// Stream modules: a failure must reach the caller or the logger, never
|
|
94
|
+
// vanish. `no-console` is scoped to these files because the rest of the
|
|
95
|
+
// library still logs to the console in places; widening it is a
|
|
96
|
+
// separate clean-up. `no-floating-promises` needs type information.
|
|
97
|
+
"files": [
|
|
98
|
+
"src/zeebe/lib/StreamLifecycle.ts",
|
|
99
|
+
"src/zeebe/lib/ZBStreamWorker.ts"
|
|
100
|
+
],
|
|
101
|
+
"parserOptions": {
|
|
102
|
+
"project": "./tsconfig.json"
|
|
103
|
+
},
|
|
104
|
+
"rules": {
|
|
105
|
+
"no-console": "error",
|
|
106
|
+
"@typescript-eslint/no-floating-promises": "error"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
],
|
|
31
110
|
"env": {
|
|
32
111
|
"node": true
|
|
33
112
|
}
|
package/AGENT.md
CHANGED
|
@@ -90,6 +90,7 @@ npm run test:8.7:sm # 8.7 self-managed integration
|
|
|
90
90
|
npm run test:8.7:mt # 8.7 multi-tenancy integration
|
|
91
91
|
npm run test:8.7:saas # 8.7 SaaS integration
|
|
92
92
|
npm run test:c8run # C8Run integration
|
|
93
|
+
npm run test:mutation # Stryker mutation tests of the stream lifecycle modules (several minutes)
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
Run a single test file:
|
|
@@ -341,6 +342,14 @@ async searchEntities(
|
|
|
341
342
|
- Local integration: `*local-integration.spec.ts` — local Docker setup.
|
|
342
343
|
- Tests are organized by component and version under `src/__tests__/`.
|
|
343
344
|
|
|
345
|
+
### Streaming operations (long-lived streams and background loops)
|
|
346
|
+
|
|
347
|
+
A stream, subscription or background loop that fails without the caller being able to see it, and without recovering, is a defect class this repository guards against in three layers. Follow them when adding or changing one:
|
|
348
|
+
|
|
349
|
+
1. **Types and lint.** Listen to a raw gRPC stream only through `attachStream()` in `src/zeebe/lib/StreamLifecycle.ts`, whose handler contract requires `data`, `error`, `end` and `close`. A streaming method returns a `StreamHandle` (`close()`, `state`, `done`). ESLint forbids listeners on streams, naming the raw gRPC stream types, `console.*` and floating promises in the stream modules.
|
|
350
|
+
2. **Conformance registry.** `src/__tests__/zeebe/conformance/registry.ts` has one entry per method of `ZeebeGrpcClient` that returns a `StreamHandle`; `tsc` (`npm run typecheck:tests`) fails if a streaming method has no entry. The shared suite runs every entry against a fake transport for errors, graceful ends, open failures, close and leaks.
|
|
351
|
+
3. **CI.** `src/__tests__/zeebe/integration/StreamJobs.FaultInjection.spec.ts` cuts the connection to a real broker with `TcpFaultProxy`. `scripts/required-integration-specs.json` lists the integration specs that must run and pass (none skipped) in the broker jobs, enforced by `npm run test:assert-required-ran`. `npm run test:mutation` mutates the stream modules; a score below the `break` threshold in `stryker.config.json` fails the `Mutation Tests` workflow.
|
|
352
|
+
|
|
344
353
|
### Test Environment Variables
|
|
345
354
|
|
|
346
355
|
- `CAMUNDA_UNIT_TEST=true` — forces unit-test mode.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [8.9.0-alpha.17](https://github.com/camunda/camunda-8-js-sdk/compare/v8.9.0-alpha.16...v8.9.0-alpha.17) (2026-11-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **zeebe:** drain a job backlog in ZBStreamWorker instead of one batch per poll interval ([#872](https://github.com/camunda/camunda-8-js-sdk/issues/872)) ([f3c8f25](https://github.com/camunda/camunda-8-js-sdk/commit/f3c8f25158f83612990eb83ec87035f9d66ab897))
|
|
7
|
+
|
|
8
|
+
# [8.9.0-alpha.16](https://github.com/camunda/camunda-8-js-sdk/compare/v8.9.0-alpha.15...v8.9.0-alpha.16) (2026-11-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **zeebe:** detect and recover from dead job streams in streamJobs ([#874](https://github.com/camunda/camunda-8-js-sdk/issues/874)) ([3bb3edc](https://github.com/camunda/camunda-8-js-sdk/commit/3bb3edcfd8e1d5958ff8171900812cf89b26a2d9))
|
|
14
|
+
|
|
1
15
|
# [8.9.0-alpha.15](https://github.com/camunda/camunda-8-js-sdk/compare/v8.9.0-alpha.14...v8.9.0-alpha.15) (2026-10-08)
|
|
2
16
|
|
|
3
17
|
|
package/MAINTAINER.md
CHANGED
|
@@ -32,8 +32,7 @@ When a new Camunda minor (e.g. `8.9`) is ready to be promoted to `latest`:
|
|
|
32
32
|
```
|
|
33
33
|
2. Update the GitHub **repository variable** (Settings → Secrets and variables → Actions → Variables) `CAMUNDA_SDK_CURRENT_STABLE_MINOR` from `8.8` to `8.9`.
|
|
34
34
|
3. The next merge to `stable/8.9` will publish to npm dist-tag `latest`. The previous current line (`stable/8.8`) automatically falls back to maintenance dist-tag `8.8-stable` on its next release.
|
|
35
|
-
4. Update [.github/
|
|
36
|
-
5. Update [.github/renovate.json](.github/renovate.json) `baseBranchPatterns` if the previous stable line should be replaced as a Renovate target.
|
|
35
|
+
4. Update [.github/renovate.json](.github/renovate.json) `baseBranchPatterns` if the previous stable line should be replaced as a Renovate target.
|
|
37
36
|
|
|
38
37
|
No git tag manipulation is required — semantic-release reads existing tags and computes the next version per branch independently.
|
|
39
38
|
|
|
@@ -45,13 +44,13 @@ All workflows live under [.github/workflows/](.github/workflows/).
|
|
|
45
44
|
|
|
46
45
|
| Workflow | Trigger | Purpose |
|
|
47
46
|
| ----------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
-
| `ci.yml` | push to feature branches, all PRs | Fast feedback for contributors. Unit tests + 8.8 SM integration. Heavier 8.7 jobs are PR-only and gated by environment. |
|
|
47
|
+
| `ci.yml` | push to feature branches, all PRs | Fast feedback for contributors. Unit tests + 8.8 SM integration. The 8.8 SM jobs also run `npm run test:assert-required-ran`, which fails if the specs in `scripts/required-integration-specs.json` were skipped. Heavier 8.7 jobs are PR-only and gated by environment. |
|
|
49
48
|
| `release.yml` | push to `main` or `stable/**`, manual dispatch | Full integration suite **plus** semantic-release publish step. |
|
|
50
49
|
| `commitlint.yml` | PR | Enforces conventional commits. |
|
|
51
50
|
| `code-scanning.yml` | scheduled / push | CodeQL. |
|
|
52
51
|
| `backport.yml` | PR closed, `/backport` comment | Creates backport PRs (e.g. `main` → `stable/8.8`) via `korthout/backport-action`. |
|
|
53
|
-
| `integration-test-matrix.yml` | scheduled (02:00 UTC), manual dispatch | Cross-version client × server compatibility matrix. Runs
|
|
54
|
-
| `
|
|
52
|
+
| `integration-test-matrix.yml` | scheduled (02:00 UTC), manual dispatch | Cross-version client × server compatibility matrix. Runs from `main` and tests released SDK versions (from git tags) ≥ the current minor against released server versions from the **next** minor onwards, plus `SNAPSHOT`. |
|
|
53
|
+
| `mutation.yml` | PRs touching the stream modules or their tests, manual dispatch | Stryker mutation tests of the stream lifecycle modules (`npm run test:mutation`). Unit tests only; fails below the `break` threshold in `stryker.config.json`. |
|
|
55
54
|
|
|
56
55
|
### CI vs. Release: why feature branches and `main`/`stable/**` are separated
|
|
57
56
|
|
|
@@ -128,16 +127,16 @@ After a successful release on `main`, the same job builds TypeDoc output (`npm r
|
|
|
128
127
|
|
|
129
128
|
## 4. Compatibility Matrix
|
|
130
129
|
|
|
131
|
-
[integration-test-matrix.yml](.github/workflows/integration-test-matrix.yml) runs nightly
|
|
130
|
+
[integration-test-matrix.yml](.github/workflows/integration-test-matrix.yml) runs nightly from `main` (scheduled workflows only run from the default branch). Each job checks out the SDK **source from a release tag**, then overwrites `docker/docker-compose-matrix.yaml` with the copy from the branch the workflow runs on (`main` for scheduled runs). So the SDK under test comes from tags, while the test infrastructure comes from `main`. It:
|
|
132
131
|
|
|
133
|
-
1. Derives the current minor from the **latest stable git tag
|
|
132
|
+
1. Derives the current minor from the **latest stable git tag in the repository** (intentionally not from `package.json`, which may already be at a pre-release version).
|
|
134
133
|
2. Enumerates SDK client versions ≥ that minor from local git tags.
|
|
135
|
-
3. Enumerates Camunda server versions
|
|
134
|
+
3. Enumerates released Camunda server versions from the **next** minor onwards (e.g. 8.9.x and later when the current minor is 8.8) from `camunda/camunda` git tags via `git ls-remote` (no clone), and adds `SNAPSHOT`. The matrix does not test same-minor pairs (e.g. an SDK 8.8 release against server 8.8). The current code is tested against its own minor by the regular CI and Release jobs (e.g. `local_integration_8_8`).
|
|
136
135
|
4. Runs the full client × server matrix, with caching to avoid retesting known-good combinations.
|
|
137
136
|
|
|
138
137
|
Manual dispatch supports pinning a `client_version`, a `server_version`, and `skip_cache` to force a full re-run.
|
|
139
138
|
|
|
140
|
-
|
|
139
|
+
Because the minimum minor comes from the latest stable tag, promoting a new stable line (e.g. the first `v8.9.x` tag) drops the previous line's clients (`8.8.x`) from the matrix. If the previous line still needs nightly compatibility coverage, extend the client filter in `integration-test-matrix.yml` to include it. Running the workflow from the stable branch would not help: the tag list is the same on every branch.
|
|
141
140
|
|
|
142
141
|
---
|
|
143
142
|
|
|
@@ -146,7 +145,8 @@ When promoting a new stable line, **add a trigger entry** in `integration-test-m
|
|
|
146
145
|
To ship a fix to a stable line:
|
|
147
146
|
|
|
148
147
|
1. Land the fix on `main` via a normal PR (so `alpha` users get it immediately).
|
|
149
|
-
2. Add the appropriate `backport
|
|
148
|
+
2. Add the appropriate `backport stable/<x.y>` label (with a space) on the PR, before or after merging (or comment `/backport stable/<x.y>`). [backport.yml](.github/workflows/backport.yml) creates the backport PR automatically. On a conflict it commits the conflict markers, opens the PR as a **draft**, and comments with the commands to resolve it locally (the `experimental.conflict_resolution: draft_commit_conflicts` setting). Resolve the conflict on that branch before marking it ready. CI's `conflict-markers` job fails while any `<<<<<<<`/`>>>>>>>` lines remain.
|
|
149
|
+
- **If `package-lock.json` is the only conflict** (typical for dependency updates), don't resolve it by hand — regenerate it instead of merging the markers. Reset **only the lockfile** to `stable/<x.y>` so any source files that cherry-picked cleanly are preserved: `git checkout stable/<x.y> -- package-lock.json`. Then regenerate it there with the same `npm update <packages> --package-lock-only` and **npm 10** (the npm that ships with Node 22, which CI uses, so the lockfile format matches), and commit the regenerated lockfile alongside the backported changes. Only when the backport is a pure dependency bump that touches nothing but `package-lock.json` is it safe to reset the whole branch to `stable/<x.y>` and force-push a single `chore(deps): …` commit — #865 is an example of that case.
|
|
150
150
|
3. Merge the backport PR to `stable/<x.y>`. The Release workflow then runs the full integration suite and publishes to npm.
|
|
151
151
|
|
|
152
152
|
Always land on `main` first unless the fix is genuinely stable-only (e.g. it touches code that no longer exists on `main`). Stable-only fixes should be opened directly against the `stable/<x.y>` branch.
|
package/README.md
CHANGED
|
@@ -731,7 +731,7 @@ When `streamJobs` is called, it first opens a stream to receive any newly create
|
|
|
731
731
|
|
|
732
732
|
### Sidecar polling
|
|
733
733
|
|
|
734
|
-
After the initial backfill, a low-frequency sidecar poll runs alongside the stream as a safety net. This catches edge cases the stream alone cannot handle — for example, jobs that are re-queued after a worker fails to complete them within the timeout, or jobs that arrive
|
|
734
|
+
After the initial backfill, a low-frequency sidecar poll runs alongside the stream as a safety net. This catches edge cases the stream alone cannot handle — for example, jobs that are re-queued after a worker fails to complete them within the timeout, or jobs that arrive while a dead stream is being re-opened (see [Stream failure and recovery](#stream-failure-and-recovery)).
|
|
735
735
|
|
|
736
736
|
Each poll is a command on the broker, so the default interval is deliberately long (30 seconds) to minimise server load. The stream remains the primary delivery mechanism.
|
|
737
737
|
|
|
@@ -740,12 +740,38 @@ Configure the sidecar poll with:
|
|
|
740
740
|
- **`pollInterval`** — milliseconds between sidecar poll cycles. Defaults to `30000` (30 s). Set to `0` or `-1` to disable recurring polling entirely (the initial backfill poll still runs).
|
|
741
741
|
- **`pollMaxJobsToActivate`** — maximum jobs per poll cycle (both initial and recurring). Defaults to `32`.
|
|
742
742
|
|
|
743
|
+
### Stream failure and recovery
|
|
744
|
+
|
|
745
|
+
A job stream can die while the worker process keeps running: the connection drops, the gateway restarts or rejects the stream, or the server ends it. Without recovery, a worker whose stream has died receives only the jobs found by the low-frequency sidecar poll.
|
|
746
|
+
|
|
747
|
+
`streamJobs` detects a dead stream (an `error`, `end` or `close` event, or a failed attempt to open it) and, by default, re-opens it with exponential backoff (1 s, doubling to a cap of 30 s). Once the stream is re-established it runs one backfill poll to pick up jobs created while the stream was down. The backoff restarts from the beginning once a re-opened stream delivers a job or stays up for at least the maximum delay. Calling `close()` on the returned handle (or on the client) stops all reconnection attempts.
|
|
748
|
+
|
|
749
|
+
Observe and configure this with:
|
|
750
|
+
|
|
751
|
+
- **`onStreamError(error)`** — called when the stream errors or cannot be opened.
|
|
752
|
+
- **`onStreamEnd()`** — called when the server ends or closes the stream without an error.
|
|
753
|
+
- **`onStreamReconnect(attempt)`** — called before each attempt to re-open the stream. `attempt` is the number of consecutive failures, starting at 1.
|
|
754
|
+
- **`streamReconnect`** — `true` (the default), `false` to disable reconnection (the callbacks above still fire), or `{ initialDelayMs, maxDelayMs }` to tune the backoff.
|
|
755
|
+
|
|
756
|
+
The callbacks may be `async`. Exceptions thrown by these callbacks, and rejections of any promise they return, are caught and logged; they do not affect reconnection. If the stream cannot be opened on the first attempt and `streamReconnect` is `false`, the promise returned by `streamJobs` rejects with the underlying error.
|
|
757
|
+
|
|
758
|
+
`streamJobs` returns a promise, so `await` it to obtain the handle. Besides `close()`, the handle reports the state of the job stream:
|
|
759
|
+
|
|
760
|
+
- **`state`** — the current state: `{ status: 'open' }`, `{ status: 'reconnecting', attempt, cause }` while a dead stream is being re-opened, or `{ status: 'closed', reason }`. `reason.kind` is `closed-by-caller`, `client-closed`, or `stream-failed` (reconnection is disabled and the stream died; the sidecar poll keeps running until you call `close()`).
|
|
761
|
+
- **`done`** — a promise that resolves (it never rejects) with the closed `reason` when the handle reaches `closed`.
|
|
762
|
+
|
|
763
|
+
```typescript
|
|
764
|
+
const handle = await client.streamJobs({ /* ... */ })
|
|
765
|
+
console.log(handle.state.status) // 'open'
|
|
766
|
+
handle.done.then((reason) => console.log('Job stream closed:', reason.kind))
|
|
767
|
+
```
|
|
768
|
+
|
|
743
769
|
You can optionally pass a `jitter` parameter (in milliseconds) to delay the start by a random period up to that value. This is useful when starting multiple stream workers simultaneously, to avoid saturating the gateway at application startup.
|
|
744
770
|
|
|
745
771
|
Example:
|
|
746
772
|
|
|
747
773
|
```typescript
|
|
748
|
-
client.streamJobs({
|
|
774
|
+
const streamWorker = await client.streamJobs({
|
|
749
775
|
type: 'payment-service',
|
|
750
776
|
worker: 'my-worker',
|
|
751
777
|
timeout: 30000,
|
|
@@ -760,7 +786,15 @@ client.streamJobs({
|
|
|
760
786
|
pollMaxJobsToActivate: 64,
|
|
761
787
|
// Optional: sidecar poll every 60 s instead of the default 30 s
|
|
762
788
|
pollInterval: 60_000,
|
|
789
|
+
// Optional: be told when the job stream dies and when it is re-opened
|
|
790
|
+
onStreamError: (error) => console.error('Job stream failed', error),
|
|
791
|
+
onStreamReconnect: (attempt) => console.log(`Re-opening stream (${attempt})`),
|
|
792
|
+
// Optional: tune the reconnect backoff (default: 1 s doubling to 30 s)
|
|
793
|
+
streamReconnect: { initialDelayMs: 1000, maxDelayMs: 30_000 },
|
|
763
794
|
})
|
|
795
|
+
|
|
796
|
+
// Stop the worker, including any pending reconnect
|
|
797
|
+
streamWorker.close()
|
|
764
798
|
```
|
|
765
799
|
|
|
766
800
|
## Multi-tenant workers
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function redact(text: string): string;
|
|
2
|
+
export declare function createSocketTap(filter?: (port: number) => boolean): {
|
|
3
|
+
/** Stop recording and remove every hook from every socket seen. */
|
|
4
|
+
stop: () => void;
|
|
5
|
+
/**
|
|
6
|
+
* Render every recorded socket, escaping CR/LF and non-printables.
|
|
7
|
+
* Each chunk shows its full header block (everything up to the first
|
|
8
|
+
* blank line, or the whole kept chunk if there is none) and at most
|
|
9
|
+
* `maxBodyChars` of what follows, so the malformed bytes are never cut.
|
|
10
|
+
*/
|
|
11
|
+
describe: (maxBodyChars?: number) => string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* True for llhttp parse errors, the case the tap is for. Through the SDK's
|
|
15
|
+
* HttpClient these arrive as a RequestError (code ERR_GOT_REQUEST_ERROR) with
|
|
16
|
+
* undici's HTTPParserError as its cause, so the cause chain is searched.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isHttpParseError(e: unknown): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* The unparsed bytes undici attaches to an HTTPParserError: the response from
|
|
21
|
+
* the point where parsing failed. Escaped so control characters are visible.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseErrorData(e: unknown): string | undefined;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.redact = redact;
|
|
7
|
+
exports.createSocketTap = createSocketTap;
|
|
8
|
+
exports.isHttpParseError = isHttpParseError;
|
|
9
|
+
exports.parseErrorData = parseErrorData;
|
|
10
|
+
/**
|
|
11
|
+
* Socket tap: records the raw bytes on every outgoing TCP/TLS client socket, so
|
|
12
|
+
* a test that fails with an HTTP parse error can show what was on the wire.
|
|
13
|
+
*
|
|
14
|
+
* Why this exists: `deleteDocument.spec.ts` fails intermittently in CI with
|
|
15
|
+
* `Parse Error: Invalid header token` (HPE_INVALID_HEADER_TOKEN), see #562.
|
|
16
|
+
* Every CI failure so far has recorded the symptom and none of the evidence.
|
|
17
|
+
* This tap keeps a per-socket transcript (bytes written and received, in
|
|
18
|
+
* order) which `describe()` renders with control characters escaped, so the
|
|
19
|
+
* offending bytes are visible in the log.
|
|
20
|
+
*
|
|
21
|
+
* How: it subscribes to the `net.client.socket` diagnostics channel, which
|
|
22
|
+
* fires for TLS sockets too, for both undici and node:http(s), on Node 22 and
|
|
23
|
+
* 24. It wraps the socket's stream-level writers and adds a `data` listener; it
|
|
24
|
+
* never changes what the HTTP client reads or writes. `stop()` undoes all of
|
|
25
|
+
* that on every socket it touched, because keep-alive sockets outlive the test.
|
|
26
|
+
*
|
|
27
|
+
* Safety: transcripts end up in public CI logs, so `describe()` redacts
|
|
28
|
+
* credentials (auth headers and cookies; OAuth secrets and tokens in bodies).
|
|
29
|
+
*/
|
|
30
|
+
const node_diagnostics_channel_1 = __importDefault(require("node:diagnostics_channel"));
|
|
31
|
+
/**
|
|
32
|
+
* Each chunk keeps its first MAX_BYTES_PER_CHUNK bytes, which always covers
|
|
33
|
+
* the status line and headers, where parse errors occur. A per-socket byte
|
|
34
|
+
* budget would not do: an upload and a download on one keep-alive socket can
|
|
35
|
+
* exhaust it before the response that fails.
|
|
36
|
+
*/
|
|
37
|
+
const MAX_BYTES_PER_CHUNK = 16 * 1024;
|
|
38
|
+
const MAX_CHUNKS_PER_SOCKET = 2000;
|
|
39
|
+
/** Header lines whose values must never be logged. */
|
|
40
|
+
const SECRET_HEADER = /^((?:authorization|proxy-authorization|cookie|set-cookie|x-api-key)\s*:\s*)[^\r\n]*/gim;
|
|
41
|
+
/** Credential fields in JSON or form-encoded bodies (OAuth requests/responses). */
|
|
42
|
+
const SECRET_FIELD = /((?:^|[?&{,\s"])(?:client_secret|client_id|access_token|refresh_token|id_token|password|assertion)"?\s*[:=]\s*"?)[^"&,}\s]+/gim;
|
|
43
|
+
function redact(text) {
|
|
44
|
+
return text
|
|
45
|
+
.replace(SECRET_HEADER, '$1[redacted]')
|
|
46
|
+
.replace(SECRET_FIELD, '$1[redacted]');
|
|
47
|
+
}
|
|
48
|
+
function createSocketTap(filter = () => true) {
|
|
49
|
+
const transcripts = [];
|
|
50
|
+
const cleanups = [];
|
|
51
|
+
let nextId = 1;
|
|
52
|
+
let stopped = false;
|
|
53
|
+
const start = Date.now();
|
|
54
|
+
const onSocket = (message) => {
|
|
55
|
+
if (stopped)
|
|
56
|
+
return;
|
|
57
|
+
const socket = message.socket;
|
|
58
|
+
const transcript = { id: nextId++, remote: '?', chunks: [] };
|
|
59
|
+
const record = (dir, data) => {
|
|
60
|
+
if (transcript.chunks.length >= MAX_CHUNKS_PER_SOCKET)
|
|
61
|
+
return;
|
|
62
|
+
const buf = Buffer.isBuffer(data)
|
|
63
|
+
? data
|
|
64
|
+
: Buffer.from(String(data), 'latin1');
|
|
65
|
+
transcript.chunks.push({
|
|
66
|
+
at: Date.now() - start,
|
|
67
|
+
dir,
|
|
68
|
+
// Copy: the client may reuse the buffer after the write completes.
|
|
69
|
+
data: Buffer.from(buf.subarray(0, MAX_BYTES_PER_CHUNK)),
|
|
70
|
+
length: buf.length,
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const s = socket;
|
|
74
|
+
const ownWrite = Object.prototype.hasOwnProperty.call(s, '_write');
|
|
75
|
+
const ownWritev = Object.prototype.hasOwnProperty.call(s, '_writev');
|
|
76
|
+
const _write = s._write;
|
|
77
|
+
const _writev = s._writev;
|
|
78
|
+
s._write = function (...args) {
|
|
79
|
+
record('>>', args[0]);
|
|
80
|
+
return _write.apply(this, args);
|
|
81
|
+
};
|
|
82
|
+
if (_writev) {
|
|
83
|
+
s._writev = function (...args) {
|
|
84
|
+
for (const { chunk } of args[0])
|
|
85
|
+
record('>>', chunk);
|
|
86
|
+
return _writev.apply(this, args);
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const onData = (d) => record('<<', d);
|
|
90
|
+
const onConnect = () => {
|
|
91
|
+
if (!filter(socket.remotePort ?? -1))
|
|
92
|
+
return;
|
|
93
|
+
transcript.remote = `${socket.remoteAddress}:${socket.remotePort}`;
|
|
94
|
+
transcripts.push(transcript);
|
|
95
|
+
};
|
|
96
|
+
socket.on('data', onData);
|
|
97
|
+
// TLS sockets emit 'secureConnect' after 'connect'; 'connect' is enough
|
|
98
|
+
// to learn the remote address for both.
|
|
99
|
+
socket.once('connect', onConnect);
|
|
100
|
+
cleanups.push(() => {
|
|
101
|
+
// Restore the writers exactly: delete our own-property wrapper if the
|
|
102
|
+
// original came from the prototype, otherwise put the original back.
|
|
103
|
+
if (ownWrite)
|
|
104
|
+
s._write = _write;
|
|
105
|
+
else
|
|
106
|
+
delete s._write;
|
|
107
|
+
if (_writev) {
|
|
108
|
+
if (ownWritev)
|
|
109
|
+
s._writev = _writev;
|
|
110
|
+
else
|
|
111
|
+
delete s._writev;
|
|
112
|
+
}
|
|
113
|
+
socket.off('data', onData);
|
|
114
|
+
socket.off('connect', onConnect);
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
node_diagnostics_channel_1.default.subscribe('net.client.socket', onSocket);
|
|
118
|
+
return {
|
|
119
|
+
/** Stop recording and remove every hook from every socket seen. */
|
|
120
|
+
stop: () => {
|
|
121
|
+
if (stopped)
|
|
122
|
+
return;
|
|
123
|
+
stopped = true;
|
|
124
|
+
node_diagnostics_channel_1.default.unsubscribe('net.client.socket', onSocket);
|
|
125
|
+
for (const cleanup of cleanups.splice(0))
|
|
126
|
+
cleanup();
|
|
127
|
+
},
|
|
128
|
+
/**
|
|
129
|
+
* Render every recorded socket, escaping CR/LF and non-printables.
|
|
130
|
+
* Each chunk shows its full header block (everything up to the first
|
|
131
|
+
* blank line, or the whole kept chunk if there is none) and at most
|
|
132
|
+
* `maxBodyChars` of what follows, so the malformed bytes are never cut.
|
|
133
|
+
*/
|
|
134
|
+
describe: (maxBodyChars = 600) => transcripts
|
|
135
|
+
.map((t) => `socket #${t.id} ${t.remote}\n` +
|
|
136
|
+
t.chunks
|
|
137
|
+
.map((c) => {
|
|
138
|
+
const text = c.data.toString('latin1');
|
|
139
|
+
const end = text.indexOf('\r\n\r\n');
|
|
140
|
+
const keep = end === -1 && /^HTTP\/|^[A-Z]+ \S+ HTTP\//.test(text)
|
|
141
|
+
? text.length // headers without an end: show them all
|
|
142
|
+
: end === -1
|
|
143
|
+
? maxBodyChars
|
|
144
|
+
: end + 4 + maxBodyChars;
|
|
145
|
+
const shown = redact(text.slice(0, keep));
|
|
146
|
+
const note = c.length > shown.length
|
|
147
|
+
? ` (showing ${shown.length} of ${c.length}B)`
|
|
148
|
+
: '';
|
|
149
|
+
return ` +${c.at}ms ${c.dir} ${c.length}B${note} ${JSON.stringify(shown)}`;
|
|
150
|
+
})
|
|
151
|
+
.join('\n'))
|
|
152
|
+
.join('\n'),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
/** The first HTTP parse error in `e`'s cause chain, if any. */
|
|
156
|
+
function findParseError(e) {
|
|
157
|
+
let err = e;
|
|
158
|
+
for (let i = 0; i < 6 && err; i++) {
|
|
159
|
+
// node:http (and got) report llhttp errors as code HPE_*. undici throws
|
|
160
|
+
// an HTTPParserError whose code is often unset, so match the name too.
|
|
161
|
+
if (/^HPE_/.test(String(err.code ?? '')) || err.name === 'HTTPParserError')
|
|
162
|
+
return err;
|
|
163
|
+
err = err.cause;
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* True for llhttp parse errors, the case the tap is for. Through the SDK's
|
|
169
|
+
* HttpClient these arrive as a RequestError (code ERR_GOT_REQUEST_ERROR) with
|
|
170
|
+
* undici's HTTPParserError as its cause, so the cause chain is searched.
|
|
171
|
+
*/
|
|
172
|
+
function isHttpParseError(e) {
|
|
173
|
+
return findParseError(e) !== undefined;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* The unparsed bytes undici attaches to an HTTPParserError: the response from
|
|
177
|
+
* the point where parsing failed. Escaped so control characters are visible.
|
|
178
|
+
*/
|
|
179
|
+
function parseErrorData(e) {
|
|
180
|
+
const data = findParseError(e)?.data;
|
|
181
|
+
return data === undefined ? undefined : JSON.stringify(redact(String(data)));
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=socketTap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socketTap.js","sourceRoot":"","sources":["../../src/test-support/socketTap.ts"],"names":[],"mappings":";;;;;AA0CA,wBAIC;AAED,0CAmHC;AA2BD,4CAEC;AAMD,wCAGC;AAzMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wFAAyD;AAMzD;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,CAAA;AACrC,MAAM,qBAAqB,GAAG,IAAI,CAAA;AAElC,sDAAsD;AACtD,MAAM,aAAa,GAClB,wFAAwF,CAAA;AACzF,mFAAmF;AACnF,MAAM,YAAY,GACjB,gIAAgI,CAAA;AAEjI,SAAgB,MAAM,CAAC,IAAY;IAClC,OAAO,IAAI;SACT,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC;SACtC,OAAO,CAAC,YAAY,EAAE,cAAc,CAAC,CAAA;AACxC,CAAC;AAED,SAAgB,eAAe,CAC9B,SAAoC,GAAG,EAAE,CAAC,IAAI;IAE9C,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,QAAQ,GAAsB,EAAE,CAAA;IACtC,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,MAAM,KAAK,GAAG,IAAI,CAAC,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AA;IACpC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AAC7E,CAAC"}
|
package/dist/zeebe/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { Duration } from 'typed-duration';
|
|
|
2
2
|
export { BpmnParser } from './lib/BpmnParser';
|
|
3
3
|
import { ZBLogger } from './lib/ZBLogger';
|
|
4
4
|
import * as GrpcInterfaces from './lib/interfaces-grpc-1.0';
|
|
5
|
+
export type { StreamClosedReason, StreamFailure, StreamHandle, StreamState, } from './lib/StreamLifecycle';
|
|
5
6
|
export * from './zb/ZBWorker';
|
|
6
7
|
export * from './zb/ZeebeGrpcClient';
|
|
7
8
|
/** @namespace */
|
package/dist/zeebe/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zeebe/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyC;AAAhC,0GAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,wGAAA,UAAU,OAAA;AACnB,qDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iEAAkD;AAClD,0EAA2D;AAC3D,uFAAwE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/zeebe/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAyC;AAAhC,0GAAA,QAAQ,OAAA;AACjB,+CAA6C;AAApC,wGAAA,UAAU,OAAA;AACnB,qDAAmD;AACnD,qDAAiD;AACjD,6CAAyC;AACzC,iEAAkD;AAClD,0EAA2D;AAC3D,uFAAwE;AAQxE,gDAA6B;AAC7B,uDAAoC;AAEpC,iBAAiB;AACJ,QAAA,KAAK,GAAG;IACpB,GAAG,UAAU;IACb,GAAG,cAAc;IACjB,GAAG,iBAAiB;CACpB,CAAA;AAEY,QAAA,OAAO,GAAG;IACtB,YAAY,EAAZ,2BAAY;IACZ,QAAQ,EAAR,mBAAQ;IACR,cAAc,EAAd,6BAAc;CACd,CAAA"}
|
|
@@ -43,6 +43,12 @@ export interface CustomSSL {
|
|
|
43
43
|
certChain?: Buffer;
|
|
44
44
|
verifyOptions?: VerifyOptions;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* The gRPC channel arguments for a Zeebe client. Extracted so that the
|
|
48
|
+
* liveness settings (HTTP/2 keepalive pings, which are what detects a stream
|
|
49
|
+
* whose connection died silently) can be asserted in a unit test.
|
|
50
|
+
*/
|
|
51
|
+
export declare const buildGrpcChannelOptions: (settings: CamundaPlatform8Configuration["zeebeGrpcSettings"]) => Record<string, string | number>;
|
|
46
52
|
export declare class GrpcClient extends EventEmitter {
|
|
47
53
|
channelClosed: boolean;
|
|
48
54
|
longPoll?: MaybeTimeDuration;
|