@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.
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.GrpcClient = exports.MiddlewareSignals = void 0;
6
+ exports.GrpcClient = exports.buildGrpcChannelOptions = exports.MiddlewareSignals = void 0;
7
7
  const events_1 = require("events");
8
8
  const grpc_js_1 = require("@grpc/grpc-js");
9
9
  const proto_loader_1 = require("@grpc/proto-loader");
@@ -73,6 +73,97 @@ const connectivityState = [
73
73
  'TRANSIENT_FAILURE',
74
74
  'SHUTDOWN',
75
75
  ];
76
+ /**
77
+ * The gRPC channel arguments for a Zeebe client. Extracted so that the
78
+ * liveness settings (HTTP/2 keepalive pings, which are what detects a stream
79
+ * whose connection died silently) can be asserted in a unit test.
80
+ */
81
+ const buildGrpcChannelOptions = (settings) => ({
82
+ /**
83
+ * If set to zero, disables retry behavior.
84
+ * Otherwise, transparent retries are enabled for all RPCs,
85
+ * and configurable retries are enabled when they are configured
86
+ * via the service config. For details, see:
87
+ * https://github.com/grpc/proposal/blob/master/A6-client-retries.md
88
+ */
89
+ 'grpc.enable_retries': 1,
90
+ /**
91
+ * The time between the first and second connection attempts,
92
+ * in ms
93
+ */
94
+ 'grpc.initial_reconnect_backoff_ms': settings.GRPC_INITIAL_RECONNECT_BACKOFF_MS,
95
+ /**
96
+ * The maximum time between subsequent connection attempts,
97
+ * in ms
98
+ */
99
+ 'grpc.max_reconnect_backoff_ms': settings.GRPC_MAX_RECONNECT_BACKOFF_MS,
100
+ /**
101
+ * The minimum time between subsequent connection attempts,
102
+ * in ms. Default is 1000ms, but this can cause an SSL Handshake failure.
103
+ * This causes an intermittent failure in the Worker-LongPoll test when run
104
+ * against Camunda Cloud.
105
+ * Raised to 5000ms.
106
+ * See: https://github.com/grpc/grpc/issues/8382#issuecomment-259482949
107
+ */
108
+ 'grpc.min_reconnect_backoff_ms': settings.GRPC_INITIAL_RECONNECT_BACKOFF_MS,
109
+ /**
110
+ * After a duration of this time the client/server
111
+ * pings its peer to see if the transport is still alive.
112
+ * Int valued, milliseconds.
113
+ */
114
+ 'grpc.keepalive_time_ms': settings.GRPC_KEEPALIVE_TIME_MS,
115
+ /**
116
+ * After waiting for a duration of this time,
117
+ * if the keepalive ping sender does
118
+ * not receive the ping ack, it will close the
119
+ * transport. Int valued, milliseconds.
120
+ */
121
+ 'grpc.keepalive_timeout_ms': settings.GRPC_KEEPALIVE_TIMEOUT_MS,
122
+ 'grpc.http2.min_time_between_pings_ms': settings.GRPC_HTTP2_MIN_TIME_BETWEEN_PINGS_MS,
123
+ /**
124
+ * Minimum allowed time between a server receiving
125
+ * successive ping frames without sending any data
126
+ * frame. Int valued, milliseconds. Default: 90000
127
+ */
128
+ 'grpc.http2.min_ping_interval_without_data_ms': settings.GRPC_HTTP2_MIN_PING_INTERVAL_WITHOUT_DATA_MS,
129
+ /**
130
+ * This channel argument if set to 1
131
+ * (0 : false; 1 : true), allows keepalive pings
132
+ * to be sent even if there are no calls in flight.
133
+ * Default is 1.
134
+ */
135
+ 'grpc.keepalive_permit_without_calls': settings.GRPC_KEEPALIVE_PERMIT_WITHOUT_CALLS,
136
+ /**
137
+ * This channel argument controls the maximum number
138
+ * of pings that can be sent when there is no other
139
+ * data (data frame or header frame) to be sent.
140
+ * GRPC Core will not continue sending pings if we
141
+ * run over the limit. Setting it to 0 allows sending
142
+ * pings without sending data.
143
+ */
144
+ 'grpc.http2.max_pings_without_data': settings.GRPC_HTTP2_MAX_PINGS_WITHOUT_DATA,
145
+ /**
146
+ * Default compression algorithm for the channel, applies to sending messages.
147
+ *
148
+ * Possible values for this option are:
149
+ * - `0` - No compression
150
+ * - `1` - Compress with DEFLATE algorithm
151
+ * - `2` - Compress with GZIP algorithm
152
+ * - `3` - Stream compression with GZIP algorithm
153
+ */
154
+ 'grpc.default_compression_algorithm': 2,
155
+ /**
156
+ * Default compression level for the channel, applies to receiving messages.
157
+ *
158
+ * Possible values for this option are:
159
+ * - `0` - None
160
+ * - `1` - Low level
161
+ * - `2` - Medium level
162
+ * - `3` - High level
163
+ */
164
+ 'grpc.default_compression_level': 2,
165
+ });
166
+ exports.buildGrpcChannelOptions = buildGrpcChannelOptions;
76
167
  class GrpcClient extends events_1.EventEmitter {
77
168
  constructor({ config, connectionTolerance, host, oAuth, options = {}, packageName, protoPath, service, useTLS, customSSL, }) {
78
169
  super();
@@ -155,90 +246,7 @@ class GrpcClient extends events_1.EventEmitter {
155
246
  debug('channelCredentials:', channelCredentials);
156
247
  // Options documented here: https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/grpc_types.h
157
248
  this.client = new proto[service](host, channelCredentials, {
158
- /**
159
- * If set to zero, disables retry behavior.
160
- * Otherwise, transparent retries are enabled for all RPCs,
161
- * and configurable retries are enabled when they are configured
162
- * via the service config. For details, see:
163
- * https://github.com/grpc/proposal/blob/master/A6-client-retries.md
164
- */
165
- 'grpc.enable_retries': 1,
166
- /**
167
- * The time between the first and second connection attempts,
168
- * in ms
169
- */
170
- 'grpc.initial_reconnect_backoff_ms': this.config.zeebeGrpcSettings.GRPC_INITIAL_RECONNECT_BACKOFF_MS,
171
- /**
172
- * The maximum time between subsequent connection attempts,
173
- * in ms
174
- */
175
- 'grpc.max_reconnect_backoff_ms': this.config.zeebeGrpcSettings.GRPC_MAX_RECONNECT_BACKOFF_MS,
176
- /**
177
- * The minimum time between subsequent connection attempts,
178
- * in ms. Default is 1000ms, but this can cause an SSL Handshake failure.
179
- * This causes an intermittent failure in the Worker-LongPoll test when run
180
- * against Camunda Cloud.
181
- * Raised to 5000ms.
182
- * See: https://github.com/grpc/grpc/issues/8382#issuecomment-259482949
183
- */
184
- 'grpc.min_reconnect_backoff_ms': this.config.zeebeGrpcSettings.GRPC_INITIAL_RECONNECT_BACKOFF_MS,
185
- /**
186
- * After a duration of this time the client/server
187
- * pings its peer to see if the transport is still alive.
188
- * Int valued, milliseconds.
189
- */
190
- 'grpc.keepalive_time_ms': this.config.zeebeGrpcSettings.GRPC_KEEPALIVE_TIME_MS,
191
- /**
192
- * After waiting for a duration of this time,
193
- * if the keepalive ping sender does
194
- * not receive the ping ack, it will close the
195
- * transport. Int valued, milliseconds.
196
- */
197
- 'grpc.keepalive_timeout_ms': this.config.zeebeGrpcSettings.GRPC_KEEPALIVE_TIMEOUT_MS,
198
- 'grpc.http2.min_time_between_pings_ms': this.config.zeebeGrpcSettings.GRPC_HTTP2_MIN_TIME_BETWEEN_PINGS_MS,
199
- /**
200
- * Minimum allowed time between a server receiving
201
- * successive ping frames without sending any data
202
- * frame. Int valued, milliseconds. Default: 90000
203
- */
204
- 'grpc.http2.min_ping_interval_without_data_ms': this.config.zeebeGrpcSettings
205
- .GRPC_HTTP2_MIN_PING_INTERVAL_WITHOUT_DATA_MS,
206
- /**
207
- * This channel argument if set to 1
208
- * (0 : false; 1 : true), allows keepalive pings
209
- * to be sent even if there are no calls in flight.
210
- * Default is 1.
211
- */
212
- 'grpc.keepalive_permit_without_calls': this.config.zeebeGrpcSettings.GRPC_KEEPALIVE_PERMIT_WITHOUT_CALLS,
213
- /**
214
- * This channel argument controls the maximum number
215
- * of pings that can be sent when there is no other
216
- * data (data frame or header frame) to be sent.
217
- * GRPC Core will not continue sending pings if we
218
- * run over the limit. Setting it to 0 allows sending
219
- * pings without sending data.
220
- */
221
- 'grpc.http2.max_pings_without_data': this.config.zeebeGrpcSettings.GRPC_HTTP2_MAX_PINGS_WITHOUT_DATA,
222
- /**
223
- * Default compression algorithm for the channel, applies to sending messages.
224
- *
225
- * Possible values for this option are:
226
- * - `0` - No compression
227
- * - `1` - Compress with DEFLATE algorithm
228
- * - `2` - Compress with GZIP algorithm
229
- * - `3` - Stream compression with GZIP algorithm
230
- */
231
- 'grpc.default_compression_algorithm': 2,
232
- /**
233
- * Default compression level for the channel, applies to receiving messages.
234
- *
235
- * Possible values for this option are:
236
- * - `0` - None
237
- * - `1` - Low level
238
- * - `2` - Medium level
239
- * - `3` - High level
240
- */
241
- 'grpc.default_compression_level': 2,
249
+ ...(0, exports.buildGrpcChannelOptions)(this.config.zeebeGrpcSettings),
242
250
  interceptors: [this.interceptor],
243
251
  });
244
252
  this.listNameMethods = [];
@@ -1 +1 @@
1
- {"version":3,"file":"GrpcClient.js","sourceRoot":"","sources":["../../../src/zeebe/lib/GrpcClient.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAqC;AAErC,2CASsB;AACtB,qDAAyE;AACzE,kDAAqB;AACrB,mDAA0E;AAE1E,mCAAgF;AAChF,yEAAqE;AAGrE,2CAAuC;AAGvC,MAAM,KAAK,GAAG,IAAA,eAAC,EAAC,cAAc,CAAC,CAAA;AAC/B,MAAM,aAAa,GAAG,2CAAoB,CAAC,WAAW,EAAE,CAAA;AAMxD,2CAA2C;AAE3C,SAAS,sCAAsC,CAG7C,IAAO;IACR,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAA;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CACjC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QACvB,GAAG,GAAG;QACN,CAAC,GAAG,CAAC,EAAE,yBAAQ,CAAC,eAAe,CAAC,KAAK,CAAC;YACrC,CAAC,CAAC,yBAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;YACnC,CAAC,CAAC,KAAK;KACR,CAAC,EACF,EAAO,CACP,CAAA;AACF,CAAC;AAEY,QAAA,iBAAiB,GAAG;IAChC,GAAG,EAAE;QACJ,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE,iBAAiB;QACvB,KAAK,EAAE,kBAAkB;KACzB;IACD,KAA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AAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;gBAChC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;oBACrB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;oBAC1B,IAAI,CAAC,IAAI,CACR,yBAAiB,CAAC,GAAG,CAAC,KAAK,EAC3B,6DAA6D,CAC7D,CAAA;oBACD,OAAM;gBACP,CAAC;gBACD,IAAI,CAAC,IAAI,CACR,yBAAiB,CAAC,GAAG,CAAC,KAAK,EAC3B,0CAA0C,IAAI,CAAC,mBAAmB,IAAI,CACtE,CAAA;gBACD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;gBAC1B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;gBACtB,IAAI,CAAC,IAAI,CAAC,yBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACzC,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAA;QAC7B,CAAC;IACF,CAAC;CAgDD;AAjhBD,gCAihBC"}
@@ -0,0 +1,189 @@
1
+ import type { ClientReadableStream } from '@grpc/grpc-js';
2
+ /**
3
+ * Stream lifecycle adapter.
4
+ *
5
+ * A long-lived gRPC stream has four ways to stop delivering: it errors, the
6
+ * server ends it, the connection hangs silently, or it cannot be opened. This
7
+ * module exists so that none of them can go unobserved:
8
+ *
9
+ * - `attachStream` is the ONLY code in the SDK's stream workers that attaches
10
+ * listeners to a raw gRPC stream. Its handler contract, `StreamHandlers`,
11
+ * requires a handler for every event. Omitting `error` (the classic
12
+ * `stream.on('data', ...)` with a `console.error` on the side) does not
13
+ * compile. ESLint rules (see `.eslintrc.json`) forbid attaching listeners to
14
+ * a stream anywhere else in the stream modules.
15
+ * - `StreamHandle` is the branded value that a streaming API returns. It has a
16
+ * failure channel: `state` (a discriminated union) and `done` (a promise of
17
+ * the terminal reason). An API whose return type is not a `StreamHandle`
18
+ * is not a streaming API as far as the conformance registry is concerned.
19
+ *
20
+ * The conformance registry in `src/__tests__/zeebe/conformance` derives the set
21
+ * of streaming operations from the return types of `ZeebeGrpcClient`, so
22
+ * adding a streaming method without registering it fails `tsc`.
23
+ */
24
+ /** Why a stream stopped delivering. */
25
+ export type StreamFailure =
26
+ /** The stream emitted an `error` event. */
27
+ {
28
+ readonly kind: 'error';
29
+ readonly error: Error;
30
+ }
31
+ /** The server ended or closed the stream without an error. */
32
+ | {
33
+ readonly kind: 'end';
34
+ }
35
+ /** The stream could not be opened. */
36
+ | {
37
+ readonly kind: 'open-failed';
38
+ readonly error: Error;
39
+ };
40
+ /** Why a handle reached its terminal `closed` state. */
41
+ export type StreamClosedReason =
42
+ /** `close()` was called on the handle. */
43
+ {
44
+ readonly kind: 'closed-by-caller';
45
+ }
46
+ /** The owning client was closed. */
47
+ | {
48
+ readonly kind: 'client-closed';
49
+ }
50
+ /**
51
+ * The stream failed and reconnection is disabled, so it will not be
52
+ * re-opened. Other work owned by the handle (for example `streamJobs`'
53
+ * sidecar poll) keeps running until `close()` is called.
54
+ */
55
+ | {
56
+ readonly kind: 'stream-failed';
57
+ readonly failure: StreamFailure;
58
+ };
59
+ /** The observable state of a stream handle. */
60
+ export type StreamState =
61
+ /** The stream is established. */
62
+ {
63
+ readonly status: 'open';
64
+ }
65
+ /** The stream is down and a re-open attempt is scheduled or in flight. */
66
+ | {
67
+ readonly status: 'reconnecting';
68
+ /** Consecutive failed streams or open attempts, starting at 1. */
69
+ readonly attempt: number;
70
+ readonly cause: StreamFailure;
71
+ }
72
+ /** Terminal: the stream is down and will not be re-opened. */
73
+ | {
74
+ readonly status: 'closed';
75
+ readonly reason: StreamClosedReason;
76
+ };
77
+ /**
78
+ * The listener contract for a raw stream. Every key is required: leaving one
79
+ * out is a compile error, so "forgot to handle `error`" cannot be written.
80
+ */
81
+ export interface StreamHandlers<T> {
82
+ /** One item was received. Must not throw; if it does it is treated as a stream `error`. */
83
+ readonly data: (item: T) => void;
84
+ /**
85
+ * The stream failed. Called at most once per stream, and never after `end`
86
+ * for the same stream.
87
+ */
88
+ readonly error: (error: Error) => void;
89
+ /**
90
+ * The server ended the stream (an `end` event, or a `close` with no prior
91
+ * `end` or `error`). Called at most once per stream, and never after `error`
92
+ * for the same stream.
93
+ */
94
+ readonly end: () => void;
95
+ /**
96
+ * Called exactly once per stream, immediately after the `error` or `end`
97
+ * handler, so that the stream's resources can be released and recovery
98
+ * scheduled in one place. Not called after `dispose()`.
99
+ */
100
+ readonly close: () => void;
101
+ }
102
+ export interface StreamAttachment {
103
+ /**
104
+ * Cancel and destroy the stream and suppress all further handler calls.
105
+ * The adapter's own listeners stay attached on purpose: removing the
106
+ * `error` listener from a stream that is then cancelled would turn the
107
+ * resulting CANCELLED `error` event into an uncaught exception.
108
+ */
109
+ readonly dispose: () => void;
110
+ }
111
+ /**
112
+ * Narrow the value that a stream-opening call resolved to (after
113
+ * `getOpenError` found no error) to a stream. Lives here so that stream workers
114
+ * never need to name, and therefore never hold a typed reference to, the raw
115
+ * gRPC stream type.
116
+ */
117
+ export declare const asStream: <T>(opened: unknown) => ClientReadableStream<T>;
118
+ /**
119
+ * Cancel and destroy a raw stream. Also used for a stream that was never
120
+ * attached (for example one that finished opening after its handle was
121
+ * closed): cancelling reports CANCELLED as an `error` event, which with no
122
+ * listener would be an uncaught exception, so a listener for that expected
123
+ * error is added first.
124
+ */
125
+ export declare const cancelStream: (stream: ClientReadableStream<unknown>) => void;
126
+ export declare const toError: (e: unknown) => Error;
127
+ /**
128
+ * Attach the lifecycle handlers to a raw gRPC stream. The only place in the
129
+ * stream modules that calls `.on(...)` on a stream.
130
+ *
131
+ * `error`, `end` and `close` events can all fire for one dead stream; the first
132
+ * one decides which handler runs, and the `close` handler runs exactly once.
133
+ */
134
+ export declare function attachStream<T>(stream: ClientReadableStream<T>, handlers: StreamHandlers<T>): StreamAttachment;
135
+ /**
136
+ * `streamActivatedJobsStream` resolves to `{ error }` (or `undefined` when the
137
+ * client is closing) instead of a stream when the stream cannot be opened.
138
+ * Returns the open error, or `undefined` when `result` is a usable stream.
139
+ */
140
+ export declare const getOpenError: (result: unknown) => Error | undefined;
141
+ /** Delay before reconnect `attempt` (1-based): exponential, capped. */
142
+ export declare const backoffDelayMs: (attempt: number, initialDelayMs: number, maxDelayMs: number) => number;
143
+ export declare const STREAM_HANDLE_BRAND: unique symbol;
144
+ /**
145
+ * The value returned by every streaming API in the SDK. Extends the original
146
+ * `{ close }` return type backward-compatibly with a failure channel.
147
+ *
148
+ * - `state` is the current state; read it any time.
149
+ * - `done` resolves (never rejects) with the terminal reason when the handle
150
+ * reaches `closed`.
151
+ *
152
+ * Handle states are only ever produced by `createStreamHandle`; the brand
153
+ * stops a structural `{ close }` literal from passing as a stream handle.
154
+ */
155
+ export interface StreamHandle {
156
+ readonly [STREAM_HANDLE_BRAND]: true;
157
+ /** Stop the stream and any reconnection. Idempotent. */
158
+ close(): void;
159
+ /** The current state of the stream. */
160
+ readonly state: StreamState;
161
+ /** Resolves with the terminal reason when the handle becomes `closed`. */
162
+ readonly done: Promise<StreamClosedReason>;
163
+ }
164
+ export interface StreamStateMachine {
165
+ readonly state: StreamState;
166
+ readonly done: Promise<StreamClosedReason>;
167
+ /**
168
+ * Move to `next`. `closed` is terminal: transitions after it are ignored
169
+ * and return `false`.
170
+ */
171
+ readonly transition: (next: StreamState) => boolean;
172
+ }
173
+ export declare function createStreamStateMachine(initial?: StreamState): StreamStateMachine;
174
+ export declare function createStreamHandle(machine: Pick<StreamStateMachine, 'state' | 'done'>, close: () => void): StreamHandle;
175
+ /** Human-readable description of a state, for logs. */
176
+ export declare const describeStreamState: (state: StreamState) => string;
177
+ type IsAny<T> = 0 extends 1 & T ? true : false;
178
+ /**
179
+ * The names of the methods of `Client` that return (or resolve to) a
180
+ * `StreamHandle`: its streaming operations. Type-level only.
181
+ *
182
+ * The conformance registry is keyed by this type, so a new streaming method on
183
+ * the client cannot be added without a registry entry (and therefore the
184
+ * conformance suite) or `tsc` fails.
185
+ */
186
+ export type StreamingOpsOf<Client> = {
187
+ [K in keyof Client & string]: Client[K] extends (...args: never[]) => infer R ? IsAny<Awaited<R>> extends true ? never : Awaited<R> extends StreamHandle ? K : never : never;
188
+ }[keyof Client & string];
189
+ export {};
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.describeStreamState = exports.STREAM_HANDLE_BRAND = exports.backoffDelayMs = exports.getOpenError = exports.toError = exports.cancelStream = exports.asStream = void 0;
4
+ exports.attachStream = attachStream;
5
+ exports.createStreamStateMachine = createStreamStateMachine;
6
+ exports.createStreamHandle = createStreamHandle;
7
+ /**
8
+ * Narrow the value that a stream-opening call resolved to (after
9
+ * `getOpenError` found no error) to a stream. Lives here so that stream workers
10
+ * never need to name, and therefore never hold a typed reference to, the raw
11
+ * gRPC stream type.
12
+ */
13
+ const asStream = (opened) => opened;
14
+ exports.asStream = asStream;
15
+ /**
16
+ * Cancel and destroy a raw stream. Also used for a stream that was never
17
+ * attached (for example one that finished opening after its handle was
18
+ * closed): cancelling reports CANCELLED as an `error` event, which with no
19
+ * listener would be an uncaught exception, so a listener for that expected
20
+ * error is added first.
21
+ */
22
+ const cancelStream = (stream) => {
23
+ stream.on('error', () => undefined);
24
+ stream.cancel();
25
+ stream.destroy();
26
+ };
27
+ exports.cancelStream = cancelStream;
28
+ const toError = (e) => e instanceof Error ? e : new Error(String(e));
29
+ exports.toError = toError;
30
+ /**
31
+ * Attach the lifecycle handlers to a raw gRPC stream. The only place in the
32
+ * stream modules that calls `.on(...)` on a stream.
33
+ *
34
+ * `error`, `end` and `close` events can all fire for one dead stream; the first
35
+ * one decides which handler runs, and the `close` handler runs exactly once.
36
+ */
37
+ function attachStream(stream, handlers) {
38
+ let settled = false;
39
+ const settle = (deliverCause) => {
40
+ if (settled) {
41
+ return;
42
+ }
43
+ settled = true;
44
+ try {
45
+ deliverCause();
46
+ }
47
+ finally {
48
+ handlers.close();
49
+ }
50
+ };
51
+ stream.on('data', (item) => {
52
+ if (settled) {
53
+ return;
54
+ }
55
+ try {
56
+ handlers.data(item);
57
+ }
58
+ catch (e) {
59
+ // A throwing data handler is a bug, but it must not be silent and it
60
+ // must not leave a stream running that nobody is processing.
61
+ (0, exports.cancelStream)(stream);
62
+ settle(() => handlers.error((0, exports.toError)(e)));
63
+ }
64
+ });
65
+ stream.on('error', (e) => settle(() => handlers.error((0, exports.toError)(e))));
66
+ stream.on('end', () => settle(() => handlers.end()));
67
+ stream.on('close', () => settle(() => handlers.end()));
68
+ return {
69
+ dispose: () => {
70
+ settled = true;
71
+ (0, exports.cancelStream)(stream);
72
+ },
73
+ };
74
+ }
75
+ /**
76
+ * `streamActivatedJobsStream` resolves to `{ error }` (or `undefined` when the
77
+ * client is closing) instead of a stream when the stream cannot be opened.
78
+ * Returns the open error, or `undefined` when `result` is a usable stream.
79
+ */
80
+ const getOpenError = (result) => {
81
+ if (!result)
82
+ return new Error('Stream could not be opened');
83
+ if (typeof result === 'object' && 'error' in result) {
84
+ return (0, exports.toError)(result.error);
85
+ }
86
+ return undefined;
87
+ };
88
+ exports.getOpenError = getOpenError;
89
+ /** Delay before reconnect `attempt` (1-based): exponential, capped. */
90
+ const backoffDelayMs = (attempt, initialDelayMs, maxDelayMs) => Math.min(initialDelayMs * 2 ** (attempt - 1), maxDelayMs);
91
+ exports.backoffDelayMs = backoffDelayMs;
92
+ exports.STREAM_HANDLE_BRAND = Symbol('StreamHandle');
93
+ function createStreamStateMachine(initial = { status: 'open' }) {
94
+ let state = initial;
95
+ let resolveDone = () => { };
96
+ const done = new Promise((resolve) => {
97
+ resolveDone = resolve;
98
+ });
99
+ return {
100
+ get state() {
101
+ return state;
102
+ },
103
+ done,
104
+ transition: (next) => {
105
+ if (state.status === 'closed') {
106
+ return false;
107
+ }
108
+ state = next;
109
+ if (next.status === 'closed') {
110
+ resolveDone(next.reason);
111
+ }
112
+ return true;
113
+ },
114
+ };
115
+ }
116
+ function createStreamHandle(machine, close) {
117
+ return {
118
+ [exports.STREAM_HANDLE_BRAND]: true,
119
+ close,
120
+ get state() {
121
+ return machine.state;
122
+ },
123
+ done: machine.done,
124
+ };
125
+ }
126
+ const describeFailure = (failure) => failure.kind === 'end'
127
+ ? 'stream ended'
128
+ : `${failure.kind}: ${failure.error.message}`;
129
+ const describeReason = (reason) => reason.kind === 'stream-failed'
130
+ ? `stream failed (${describeFailure(reason.failure)})`
131
+ : reason.kind;
132
+ // An exhaustive lookup rather than a `switch` (see STYLE.md): adding a state
133
+ // to `StreamState` without describing it here fails `tsc`.
134
+ const describers = {
135
+ open: () => 'open',
136
+ reconnecting: (s) => `reconnecting (attempt ${s.attempt}, ${describeFailure(s.cause)})`,
137
+ closed: (s) => `closed (${describeReason(s.reason)})`,
138
+ };
139
+ /** Human-readable description of a state, for logs. */
140
+ const describeStreamState = (state) => describers[state.status](state);
141
+ exports.describeStreamState = describeStreamState;
142
+ //# sourceMappingURL=StreamLifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StreamLifecycle.js","sourceRoot":"","sources":["../../../src/zeebe/lib/StreamLifecycle.ts"],"names":[],"mappings":";;;AAiIA,oCAyCC;AAuDD,4DAwBC;AAED,gDAYC;AAtKD;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAI,MAAe,EAA2B,EAAE,CACvE,MAAiC,CAAA;AADrB,QAAA,QAAQ,YACa;AAElC;;;;;;GAMG;AACI,MAAM,YAAY,GAAG,CAAC,MAAqC,EAAQ,EAAE;IAC3E,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IACnC,MAAM,CAAC,MAAM,EAAE,CAAA;IACf,MAAM,CAAC,OAAO,EAAE,CAAA;AACjB,CAAC,CAAA;AAJY,QAAA,YAAY,gBAIxB;AAEM,MAAM,OAAO,GAAG,CAAC,CAAU,EAAS,EAAE,CAC5C,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC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