@temporalio/common 1.8.1 → 1.8.3
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/lib/converter/failure-converter.js +10 -10
- package/lib/converter/failure-converter.js.map +1 -1
- package/lib/converter/payload-converter.js +2 -2
- package/lib/converter/payload-converter.js.map +1 -1
- package/lib/converter/protobuf-payload-converters.js +58 -7
- package/lib/converter/protobuf-payload-converters.js.map +1 -1
- package/lib/errors.d.ts +0 -16
- package/lib/errors.js +37 -38
- package/lib/errors.js.map +1 -1
- package/lib/failure.d.ts +0 -81
- package/lib/failure.js +50 -131
- package/lib/failure.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/type-helpers.d.ts +33 -0
- package/lib/type-helpers.js +70 -9
- package/lib/type-helpers.js.map +1 -1
- package/lib/versioning-intent-enum.d.ts +12 -0
- package/lib/versioning-intent-enum.js +33 -0
- package/lib/versioning-intent-enum.js.map +1 -0
- package/lib/workflow-options.d.ts +1 -1
- package/package.json +3 -3
- package/src/converter/failure-converter.ts +12 -12
- package/src/converter/payload-converter.ts +2 -2
- package/src/converter/protobuf-payload-converters.ts +62 -8
- package/src/errors.ts +9 -31
- package/src/failure.ts +13 -138
- package/src/index.ts +1 -1
- package/src/type-helpers.ts +78 -11
- package/src/versioning-intent-enum.ts +32 -0
- package/src/workflow-options.ts +1 -1
package/lib/failure.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
3
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
9
|
exports.rootCause = exports.ensureTemporalFailure = exports.ensureApplicationFailure = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.RetryState = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
|
|
5
10
|
const type_helpers_1 = require("./type-helpers");
|
|
@@ -31,7 +36,6 @@ var RetryState;
|
|
|
31
36
|
})(RetryState = exports.RetryState || (exports.RetryState = {}));
|
|
32
37
|
(0, type_helpers_1.checkExtends)();
|
|
33
38
|
(0, type_helpers_1.checkExtends)();
|
|
34
|
-
const isTemporalFailure = Symbol.for('__temporal_isTemporalFailure');
|
|
35
39
|
/**
|
|
36
40
|
* Represents failures that can cross Workflow and Activity boundaries.
|
|
37
41
|
*
|
|
@@ -39,47 +43,27 @@ const isTemporalFailure = Symbol.for('__temporal_isTemporalFailure');
|
|
|
39
43
|
*
|
|
40
44
|
* The only child class you should ever throw from your code is {@link ApplicationFailure}.
|
|
41
45
|
*/
|
|
42
|
-
class TemporalFailure extends Error {
|
|
46
|
+
let TemporalFailure = class TemporalFailure extends Error {
|
|
43
47
|
constructor(message, cause) {
|
|
44
48
|
super(message ?? undefined);
|
|
45
49
|
this.cause = cause;
|
|
46
|
-
this.name = 'TemporalFailure';
|
|
47
|
-
/**
|
|
48
|
-
* Marker to determine whether an error is an instance of TemporalFailure.
|
|
49
|
-
*/
|
|
50
|
-
this[_a] = true;
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return error instanceof TemporalFailure || error?.[isTemporalFailure] === true;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
51
|
+
};
|
|
52
|
+
TemporalFailure = __decorate([
|
|
53
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('TemporalFailure')
|
|
54
|
+
], TemporalFailure);
|
|
59
55
|
exports.TemporalFailure = TemporalFailure;
|
|
60
|
-
_a = isTemporalFailure;
|
|
61
|
-
const isServerFailure = Symbol.for('__temporal_isServerFailure');
|
|
62
56
|
/** Exceptions originated at the Temporal service. */
|
|
63
|
-
class ServerFailure extends TemporalFailure {
|
|
57
|
+
let ServerFailure = class ServerFailure extends TemporalFailure {
|
|
64
58
|
constructor(message, nonRetryable, cause) {
|
|
65
59
|
super(message, cause);
|
|
66
60
|
this.nonRetryable = nonRetryable;
|
|
67
|
-
this.name = 'ServerFailure';
|
|
68
|
-
/**
|
|
69
|
-
* Marker to determine whether an error is an instance of ServerFailure.
|
|
70
|
-
*/
|
|
71
|
-
this[_b] = true;
|
|
72
61
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return error instanceof ServerFailure || error?.[isServerFailure] === true;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
62
|
+
};
|
|
63
|
+
ServerFailure = __decorate([
|
|
64
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('ServerFailure')
|
|
65
|
+
], ServerFailure);
|
|
80
66
|
exports.ServerFailure = ServerFailure;
|
|
81
|
-
_b = isServerFailure;
|
|
82
|
-
const isApplicationFailure = Symbol.for('__temporal_isApplicationFailure');
|
|
83
67
|
/**
|
|
84
68
|
* `ApplicationFailure`s are used to communicate application-specific failures in Workflows and Activities.
|
|
85
69
|
*
|
|
@@ -102,7 +86,7 @@ const isApplicationFailure = Symbol.for('__temporal_isApplicationFailure');
|
|
|
102
86
|
* `ApplicationFailure` from the last Activity Task will be the `cause` of the {@link ActivityFailure} thrown in the
|
|
103
87
|
* Workflow.
|
|
104
88
|
*/
|
|
105
|
-
class ApplicationFailure extends TemporalFailure {
|
|
89
|
+
let ApplicationFailure = class ApplicationFailure extends TemporalFailure {
|
|
106
90
|
/**
|
|
107
91
|
* Alternatively, use {@link fromError} or {@link create}.
|
|
108
92
|
*/
|
|
@@ -111,17 +95,6 @@ class ApplicationFailure extends TemporalFailure {
|
|
|
111
95
|
this.type = type;
|
|
112
96
|
this.nonRetryable = nonRetryable;
|
|
113
97
|
this.details = details;
|
|
114
|
-
this.name = 'ApplicationFailure';
|
|
115
|
-
/**
|
|
116
|
-
* Marker to determine whether an error is an instance of ApplicationFailure.
|
|
117
|
-
*/
|
|
118
|
-
this[_c] = true;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Instanceof check that works when multiple versions of @temporalio/common are installed.
|
|
122
|
-
*/
|
|
123
|
-
static is(error) {
|
|
124
|
-
return error instanceof ApplicationFailure || error?.[isApplicationFailure] === true;
|
|
125
98
|
}
|
|
126
99
|
/**
|
|
127
100
|
* Create a new `ApplicationFailure` from an Error object.
|
|
@@ -167,10 +140,11 @@ class ApplicationFailure extends TemporalFailure {
|
|
|
167
140
|
static nonRetryable(message, type, ...details) {
|
|
168
141
|
return new this(message, type ?? 'Error', true, details);
|
|
169
142
|
}
|
|
170
|
-
}
|
|
143
|
+
};
|
|
144
|
+
ApplicationFailure = __decorate([
|
|
145
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('ApplicationFailure')
|
|
146
|
+
], ApplicationFailure);
|
|
171
147
|
exports.ApplicationFailure = ApplicationFailure;
|
|
172
|
-
_c = isApplicationFailure;
|
|
173
|
-
const isCancelledFailure = Symbol.for('__temporal_isCancelledFailure');
|
|
174
148
|
/**
|
|
175
149
|
* This error is thrown when Cancellation has been requested. To allow Cancellation to happen, let it propagate. To
|
|
176
150
|
* ignore Cancellation, catch it and continue executing. Note that Cancellation can only be requested a single time, so
|
|
@@ -178,129 +152,80 @@ const isCancelledFailure = Symbol.for('__temporal_isCancelledFailure');
|
|
|
178
152
|
*
|
|
179
153
|
* When a Workflow or Activity has been successfully cancelled, a `CancelledFailure` will be the `cause`.
|
|
180
154
|
*/
|
|
181
|
-
class CancelledFailure extends TemporalFailure {
|
|
155
|
+
let CancelledFailure = class CancelledFailure extends TemporalFailure {
|
|
182
156
|
constructor(message, details = [], cause) {
|
|
183
157
|
super(message, cause);
|
|
184
158
|
this.details = details;
|
|
185
|
-
this.name = 'CancelledFailure';
|
|
186
|
-
/**
|
|
187
|
-
* Marker to determine whether an error is an instance of CancelledFailure.
|
|
188
|
-
*/
|
|
189
|
-
this[_d] = true;
|
|
190
159
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return error instanceof CancelledFailure || error?.[isCancelledFailure] === true;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
160
|
+
};
|
|
161
|
+
CancelledFailure = __decorate([
|
|
162
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('CancelledFailure')
|
|
163
|
+
], CancelledFailure);
|
|
198
164
|
exports.CancelledFailure = CancelledFailure;
|
|
199
|
-
_d = isCancelledFailure;
|
|
200
|
-
const isTerminatedFailure = Symbol.for('__temporal_isTerminatedFailure');
|
|
201
165
|
/**
|
|
202
166
|
* Used as the `cause` when a Workflow has been terminated
|
|
203
167
|
*/
|
|
204
|
-
class TerminatedFailure extends TemporalFailure {
|
|
168
|
+
let TerminatedFailure = class TerminatedFailure extends TemporalFailure {
|
|
205
169
|
constructor(message, cause) {
|
|
206
170
|
super(message, cause);
|
|
207
|
-
this.name = 'TerminatedFailure';
|
|
208
|
-
/**
|
|
209
|
-
* Marker to determine whether an error is an instance of TerminatedFailure.
|
|
210
|
-
*/
|
|
211
|
-
this[_e] = true;
|
|
212
171
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return error instanceof TerminatedFailure || error?.[isTerminatedFailure] === true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
172
|
+
};
|
|
173
|
+
TerminatedFailure = __decorate([
|
|
174
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('TerminatedFailure')
|
|
175
|
+
], TerminatedFailure);
|
|
220
176
|
exports.TerminatedFailure = TerminatedFailure;
|
|
221
|
-
_e = isTerminatedFailure;
|
|
222
|
-
const isTimeoutFailure = Symbol.for('__temporal_isTimeoutFailure');
|
|
223
177
|
/**
|
|
224
178
|
* Used to represent timeouts of Activities and Workflows
|
|
225
179
|
*/
|
|
226
|
-
class TimeoutFailure extends TemporalFailure {
|
|
180
|
+
let TimeoutFailure = class TimeoutFailure extends TemporalFailure {
|
|
227
181
|
constructor(message, lastHeartbeatDetails, timeoutType) {
|
|
228
182
|
super(message);
|
|
229
183
|
this.lastHeartbeatDetails = lastHeartbeatDetails;
|
|
230
184
|
this.timeoutType = timeoutType;
|
|
231
|
-
this.name = 'TimeoutFailure';
|
|
232
|
-
/**
|
|
233
|
-
* Marker to determine whether an error is an instance of TimeoutFailure.
|
|
234
|
-
*/
|
|
235
|
-
this[_f] = true;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Instanceof check that works when multiple versions of @temporalio/common are installed.
|
|
239
|
-
*/
|
|
240
|
-
static is(error) {
|
|
241
|
-
return error instanceof TimeoutFailure || error?.[isTimeoutFailure] === true;
|
|
242
185
|
}
|
|
243
|
-
}
|
|
186
|
+
};
|
|
187
|
+
TimeoutFailure = __decorate([
|
|
188
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('TimeoutFailure')
|
|
189
|
+
], TimeoutFailure);
|
|
244
190
|
exports.TimeoutFailure = TimeoutFailure;
|
|
245
|
-
_f = isTimeoutFailure;
|
|
246
|
-
const isActivityFailure = Symbol.for('__temporal_isActivityFailure');
|
|
247
191
|
/**
|
|
248
192
|
* Contains information about an Activity failure. Always contains the original reason for the failure as its `cause`.
|
|
249
193
|
* For example, if an Activity timed out, the cause will be a {@link TimeoutFailure}.
|
|
250
194
|
*
|
|
251
195
|
* This exception is expected to be thrown only by the framework code.
|
|
252
196
|
*/
|
|
253
|
-
class ActivityFailure extends TemporalFailure {
|
|
197
|
+
let ActivityFailure = class ActivityFailure extends TemporalFailure {
|
|
254
198
|
constructor(message, activityType, activityId, retryState, identity, cause) {
|
|
255
199
|
super(message, cause);
|
|
256
200
|
this.activityType = activityType;
|
|
257
201
|
this.activityId = activityId;
|
|
258
202
|
this.retryState = retryState;
|
|
259
203
|
this.identity = identity;
|
|
260
|
-
this.name = 'ActivityFailure';
|
|
261
|
-
/**
|
|
262
|
-
* Marker to determine whether an error is an instance of ActivityFailure.
|
|
263
|
-
*/
|
|
264
|
-
this[_g] = true;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Instanceof check that works when multiple versions of @temporalio/common are installed.
|
|
268
|
-
*/
|
|
269
|
-
static is(error) {
|
|
270
|
-
return error instanceof ActivityFailure || error?.[isActivityFailure] === true;
|
|
271
204
|
}
|
|
272
|
-
}
|
|
205
|
+
};
|
|
206
|
+
ActivityFailure = __decorate([
|
|
207
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('ActivityFailure')
|
|
208
|
+
], ActivityFailure);
|
|
273
209
|
exports.ActivityFailure = ActivityFailure;
|
|
274
|
-
_g = isActivityFailure;
|
|
275
|
-
const isChildWorkflowFailure = Symbol.for('__temporal_isChildWorkflowFailure');
|
|
276
210
|
/**
|
|
277
211
|
* Contains information about a Child Workflow failure. Always contains the reason for the failure as its {@link cause}.
|
|
278
212
|
* For example, if the Child was Terminated, the `cause` is a {@link TerminatedFailure}.
|
|
279
213
|
*
|
|
280
214
|
* This exception is expected to be thrown only by the framework code.
|
|
281
215
|
*/
|
|
282
|
-
class ChildWorkflowFailure extends TemporalFailure {
|
|
216
|
+
let ChildWorkflowFailure = class ChildWorkflowFailure extends TemporalFailure {
|
|
283
217
|
constructor(namespace, execution, workflowType, retryState, cause) {
|
|
284
218
|
super('Child Workflow execution failed', cause);
|
|
285
219
|
this.namespace = namespace;
|
|
286
220
|
this.execution = execution;
|
|
287
221
|
this.workflowType = workflowType;
|
|
288
222
|
this.retryState = retryState;
|
|
289
|
-
this.name = 'ChildWorkflowFailure';
|
|
290
|
-
/**
|
|
291
|
-
* Marker to determine whether an error is an instance of ChildWorkflowFailure.
|
|
292
|
-
*/
|
|
293
|
-
this[_h] = true;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Instanceof check that works when multiple versions of @temporalio/common are installed.
|
|
297
|
-
*/
|
|
298
|
-
static is(error) {
|
|
299
|
-
return error instanceof ChildWorkflowFailure || error?.[isChildWorkflowFailure] === true;
|
|
300
223
|
}
|
|
301
|
-
}
|
|
224
|
+
};
|
|
225
|
+
ChildWorkflowFailure = __decorate([
|
|
226
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('ChildWorkflowFailure')
|
|
227
|
+
], ChildWorkflowFailure);
|
|
302
228
|
exports.ChildWorkflowFailure = ChildWorkflowFailure;
|
|
303
|
-
_h = isChildWorkflowFailure;
|
|
304
229
|
/**
|
|
305
230
|
* If `error` is already an `ApplicationFailure`, returns `error`.
|
|
306
231
|
*
|
|
@@ -311,7 +236,7 @@ _h = isChildWorkflowFailure;
|
|
|
311
236
|
* - `stack`: `error.stack` or `''`
|
|
312
237
|
*/
|
|
313
238
|
function ensureApplicationFailure(error) {
|
|
314
|
-
if (ApplicationFailure
|
|
239
|
+
if (error instanceof ApplicationFailure) {
|
|
315
240
|
return error;
|
|
316
241
|
}
|
|
317
242
|
const message = ((0, type_helpers_1.isRecord)(error) && String(error.message)) || String(error);
|
|
@@ -329,7 +254,7 @@ exports.ensureApplicationFailure = ensureApplicationFailure;
|
|
|
329
254
|
* Otherwise returns an `ApplicationFailure` with `String(err)` as the message.
|
|
330
255
|
*/
|
|
331
256
|
function ensureTemporalFailure(err) {
|
|
332
|
-
if (TemporalFailure
|
|
257
|
+
if (err instanceof TemporalFailure) {
|
|
333
258
|
return err;
|
|
334
259
|
}
|
|
335
260
|
return ensureApplicationFailure(err);
|
|
@@ -342,16 +267,10 @@ exports.ensureTemporalFailure = ensureTemporalFailure;
|
|
|
342
267
|
* Otherwise, return `error.message`.
|
|
343
268
|
*/
|
|
344
269
|
function rootCause(error) {
|
|
345
|
-
if (TemporalFailure
|
|
270
|
+
if (error instanceof TemporalFailure) {
|
|
346
271
|
return error.cause ? rootCause(error.cause) : error.message;
|
|
347
272
|
}
|
|
348
|
-
|
|
349
|
-
return error.message;
|
|
350
|
-
}
|
|
351
|
-
if (typeof error === 'string') {
|
|
352
|
-
return error;
|
|
353
|
-
}
|
|
354
|
-
return undefined;
|
|
273
|
+
return (0, type_helpers_1.errorMessage)(error);
|
|
355
274
|
}
|
|
356
275
|
exports.rootCause = rootCause;
|
|
357
276
|
//# sourceMappingURL=failure.js.map
|
package/lib/failure.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"failure.js","sourceRoot":"","sources":["../src/failure.ts"],"names":[],"mappings":";;;;;;;;;AACA,iDAAkG;AAErF,QAAA,cAAc,GAAG,eAAe,CAAC;AAG9C,0EAA0E;AAC1E,gDAAgD;AAChD,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,qFAA4B,CAAA;IAC5B,2FAA+B,CAAA;IAC/B,iGAAkC,CAAA;IAClC,iGAAkC,CAAA;IAClC,iFAA0B,CAAA;AAC5B,CAAC,EANW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAMtB;AAED,IAAA,2BAAY,GAAkD,CAAC;AAC/D,IAAA,2BAAY,GAAkD,CAAC;AAE/D,0EAA0E;AAC1E,+CAA+C;AAC/C,IAAY,UASX;AATD,WAAY,UAAU;IACpB,iFAA2B,CAAA;IAC3B,iFAA2B,CAAA;IAC3B,qGAAqC,CAAA;IACrC,yEAAuB,CAAA;IACvB,2GAAwC,CAAA;IACxC,mGAAoC,CAAA;IACpC,qGAAqC,CAAA;IACrC,2FAAgC,CAAA;AAClC,CAAC,EATW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QASrB;AAED,IAAA,2BAAY,GAAgD,CAAC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7B,CAAC;AALD,8BAKC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export { Headers, Next } from './interceptors';
|
|
|
16
16
|
export * from './interfaces';
|
|
17
17
|
export * from './logger';
|
|
18
18
|
export * from './retry-policy';
|
|
19
|
-
export {
|
|
19
|
+
export type { Timestamp, Duration, StringValue } from './time';
|
|
20
20
|
export * from './workflow-handle';
|
|
21
21
|
export * from './workflow-options';
|
|
22
22
|
export * from './versioning-intent';
|
package/lib/type-helpers.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export type Replace<Base, New> = Omit<Base, keyof New> & New;
|
|
|
14
14
|
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
15
15
|
export declare function hasOwnProperty<X extends Record<string, unknown>, Y extends PropertyKey>(record: X, prop: Y): record is X & Record<Y, unknown>;
|
|
16
16
|
export declare function hasOwnProperties<X extends Record<string, unknown>, Y extends PropertyKey>(record: X, props: Y[]): record is X & Record<Y, unknown>;
|
|
17
|
+
export declare function isError(error: unknown): error is Error;
|
|
18
|
+
export declare function isAbortError(error: unknown): error is Error & {
|
|
19
|
+
name: 'AbortError';
|
|
20
|
+
};
|
|
17
21
|
/**
|
|
18
22
|
* Get `error.message` (or `undefined` if not present)
|
|
19
23
|
*/
|
|
@@ -26,3 +30,32 @@ export declare function errorCode(error: unknown): string | undefined;
|
|
|
26
30
|
* Asserts that some type is the never type
|
|
27
31
|
*/
|
|
28
32
|
export declare function assertNever(msg: string, x: never): never;
|
|
33
|
+
export type Class<E extends Error> = {
|
|
34
|
+
new (...args: any[]): E;
|
|
35
|
+
prototype: E;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* A decorator to be used on error classes. It adds the 'name' property AND provides a custom
|
|
39
|
+
* 'instanceof' handler that works correctly across execution contexts.
|
|
40
|
+
*
|
|
41
|
+
* ### Details ###
|
|
42
|
+
*
|
|
43
|
+
* According to the EcmaScript's spec, the default behavior of JavaScript's `x instanceof Y` operator is to walk up the
|
|
44
|
+
* prototype chain of object 'x', checking if any constructor in that hierarchy is _exactly the same object_ as the
|
|
45
|
+
* constructor function 'Y'.
|
|
46
|
+
*
|
|
47
|
+
* Unfortunately, it happens in various situations that different constructor function objects get created for what
|
|
48
|
+
* appears to be the very same class. This leads to surprising behavior where `instanceof` returns false though it is
|
|
49
|
+
* known that the object is indeed an instance of that class. One particular case where this happens is when constructor
|
|
50
|
+
* 'Y' belongs to a different realm than the constuctor with which 'x' was instantiated. Another case is when two copies
|
|
51
|
+
* of the same library gets loaded in the same realm.
|
|
52
|
+
*
|
|
53
|
+
* In practice, this tends to cause issues when crossing the workflow-sandboxing boundary (since Node's vm module
|
|
54
|
+
* really creates new execution realms), as well as when running tests using Jest (see https://github.com/jestjs/jest/issues/2549
|
|
55
|
+
* for some details on that one).
|
|
56
|
+
*
|
|
57
|
+
* This function injects a custom 'instanceof' handler into the prototype of 'clazz', which is both cross-realm safe and
|
|
58
|
+
* cross-copies-of-the-same-lib safe. It works by adding a special symbol property to the prototype of 'clazz', and then
|
|
59
|
+
* checking for the presence of that symbol.
|
|
60
|
+
*/
|
|
61
|
+
export declare function SymbolBasedInstanceOfError<E extends Error>(markerName: string): (clazz: Class<E>) => void;
|
package/lib/type-helpers.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertNever = exports.errorCode = exports.errorMessage = exports.hasOwnProperties = exports.hasOwnProperty = exports.isRecord = exports.checkExtends = void 0;
|
|
3
|
+
exports.SymbolBasedInstanceOfError = exports.assertNever = exports.errorCode = exports.errorMessage = exports.isAbortError = exports.isError = exports.hasOwnProperties = exports.hasOwnProperty = exports.isRecord = exports.checkExtends = void 0;
|
|
4
4
|
/** Verify that an type _Copy extends _Orig */
|
|
5
5
|
function checkExtends() {
|
|
6
6
|
// noop, just type check
|
|
@@ -10,7 +10,6 @@ function isRecord(value) {
|
|
|
10
10
|
return typeof value === 'object' && value !== null;
|
|
11
11
|
}
|
|
12
12
|
exports.isRecord = isRecord;
|
|
13
|
-
// ts-prune-ignore-next
|
|
14
13
|
function hasOwnProperty(record, prop) {
|
|
15
14
|
return prop in record;
|
|
16
15
|
}
|
|
@@ -19,26 +18,38 @@ function hasOwnProperties(record, props) {
|
|
|
19
18
|
return props.every((prop) => prop in record);
|
|
20
19
|
}
|
|
21
20
|
exports.hasOwnProperties = hasOwnProperties;
|
|
21
|
+
function isError(error) {
|
|
22
|
+
return (isRecord(error) &&
|
|
23
|
+
typeof error.name === 'string' &&
|
|
24
|
+
typeof error.message === 'string' &&
|
|
25
|
+
(error.stack == null || typeof error.stack === 'string'));
|
|
26
|
+
}
|
|
27
|
+
exports.isError = isError;
|
|
28
|
+
function isAbortError(error) {
|
|
29
|
+
return isError(error) && error.name === 'AbortError';
|
|
30
|
+
}
|
|
31
|
+
exports.isAbortError = isAbortError;
|
|
22
32
|
/**
|
|
23
33
|
* Get `error.message` (or `undefined` if not present)
|
|
24
34
|
*/
|
|
25
35
|
function errorMessage(error) {
|
|
26
|
-
if (
|
|
27
|
-
return error;
|
|
28
|
-
}
|
|
29
|
-
if (error instanceof Error) {
|
|
36
|
+
if (isError(error)) {
|
|
30
37
|
return error.message;
|
|
31
38
|
}
|
|
39
|
+
else if (typeof error === 'string') {
|
|
40
|
+
return error;
|
|
41
|
+
}
|
|
32
42
|
return undefined;
|
|
33
43
|
}
|
|
34
44
|
exports.errorMessage = errorMessage;
|
|
45
|
+
function isErrorWithCode(error) {
|
|
46
|
+
return isRecord(error) && typeof error.code === 'string';
|
|
47
|
+
}
|
|
35
48
|
/**
|
|
36
49
|
* Get `error.code` (or `undefined` if not present)
|
|
37
50
|
*/
|
|
38
51
|
function errorCode(error) {
|
|
39
|
-
if (
|
|
40
|
-
error.code !== undefined &&
|
|
41
|
-
typeof error.code === 'string') {
|
|
52
|
+
if (isErrorWithCode(error)) {
|
|
42
53
|
return error.code;
|
|
43
54
|
}
|
|
44
55
|
return undefined;
|
|
@@ -51,4 +62,54 @@ function assertNever(msg, x) {
|
|
|
51
62
|
throw new TypeError(msg + ': ' + x);
|
|
52
63
|
}
|
|
53
64
|
exports.assertNever = assertNever;
|
|
65
|
+
/**
|
|
66
|
+
* A decorator to be used on error classes. It adds the 'name' property AND provides a custom
|
|
67
|
+
* 'instanceof' handler that works correctly across execution contexts.
|
|
68
|
+
*
|
|
69
|
+
* ### Details ###
|
|
70
|
+
*
|
|
71
|
+
* According to the EcmaScript's spec, the default behavior of JavaScript's `x instanceof Y` operator is to walk up the
|
|
72
|
+
* prototype chain of object 'x', checking if any constructor in that hierarchy is _exactly the same object_ as the
|
|
73
|
+
* constructor function 'Y'.
|
|
74
|
+
*
|
|
75
|
+
* Unfortunately, it happens in various situations that different constructor function objects get created for what
|
|
76
|
+
* appears to be the very same class. This leads to surprising behavior where `instanceof` returns false though it is
|
|
77
|
+
* known that the object is indeed an instance of that class. One particular case where this happens is when constructor
|
|
78
|
+
* 'Y' belongs to a different realm than the constuctor with which 'x' was instantiated. Another case is when two copies
|
|
79
|
+
* of the same library gets loaded in the same realm.
|
|
80
|
+
*
|
|
81
|
+
* In practice, this tends to cause issues when crossing the workflow-sandboxing boundary (since Node's vm module
|
|
82
|
+
* really creates new execution realms), as well as when running tests using Jest (see https://github.com/jestjs/jest/issues/2549
|
|
83
|
+
* for some details on that one).
|
|
84
|
+
*
|
|
85
|
+
* This function injects a custom 'instanceof' handler into the prototype of 'clazz', which is both cross-realm safe and
|
|
86
|
+
* cross-copies-of-the-same-lib safe. It works by adding a special symbol property to the prototype of 'clazz', and then
|
|
87
|
+
* checking for the presence of that symbol.
|
|
88
|
+
*/
|
|
89
|
+
function SymbolBasedInstanceOfError(markerName) {
|
|
90
|
+
return (clazz) => {
|
|
91
|
+
const marker = Symbol.for(`__temporal_is${markerName}`);
|
|
92
|
+
Object.defineProperty(clazz.prototype, 'name', { value: markerName, enumerable: true });
|
|
93
|
+
Object.defineProperty(clazz.prototype, marker, { value: true, enumerable: false });
|
|
94
|
+
Object.defineProperty(clazz, Symbol.hasInstance, {
|
|
95
|
+
// eslint-disable-next-line object-shorthand
|
|
96
|
+
value: function (error) {
|
|
97
|
+
if (this === clazz) {
|
|
98
|
+
return isRecord(error) && error[marker] === true;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// 'this' must be a _subclass_ of clazz that doesn't redefined [Symbol.hasInstance], so that it inherited
|
|
102
|
+
// from clazz's [Symbol.hasInstance]. If we don't handle this particular situation, then
|
|
103
|
+
// `x instanceof SubclassOfParent` would return true for any instance of 'Parent', which is clearly wrong.
|
|
104
|
+
//
|
|
105
|
+
// Ideally, it'd be preferable to avoid this case entirely, by making sure that all subclasses of 'clazz'
|
|
106
|
+
// redefine [Symbol.hasInstance], but we can't enforce that. We therefore fallback to the default instanceof
|
|
107
|
+
// behavior (which is NOT cross-realm safe).
|
|
108
|
+
return this.prototype.isPrototypeOf(error); // eslint-disable-line no-prototype-builtins
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
exports.SymbolBasedInstanceOfError = SymbolBasedInstanceOfError;
|
|
54
115
|
//# sourceMappingURL=type-helpers.js.map
|
package/lib/type-helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-helpers.js","sourceRoot":"","sources":["../src/type-helpers.ts"],"names":[],"mappings":";;;AAYA,8CAA8C;AAC9C,SAAgB,YAAY;IAC1B,wBAAwB;AAC1B,CAAC;AAFD,oCAEC;AAID,SAAgB,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAFD,4BAEC;AAED,
|
|
1
|
+
{"version":3,"file":"type-helpers.js","sourceRoot":"","sources":["../src/type-helpers.ts"],"names":[],"mappings":";;;AAYA,8CAA8C;AAC9C,SAAgB,YAAY;IAC1B,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YACH,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAxBD,gEAwBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VersioningIntent as VersioningIntentString } from './versioning-intent';
|
|
2
|
+
/**
|
|
3
|
+
* Protobuf enum representation of {@link VersioningIntentString}.
|
|
4
|
+
*
|
|
5
|
+
* @experimental
|
|
6
|
+
*/
|
|
7
|
+
export declare enum VersioningIntent {
|
|
8
|
+
UNSPECIFIED = 0,
|
|
9
|
+
COMPATIBLE = 1,
|
|
10
|
+
DEFAULT = 2
|
|
11
|
+
}
|
|
12
|
+
export declare function versioningIntentToProto(intent: VersioningIntentString | undefined): VersioningIntent;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.versioningIntentToProto = exports.VersioningIntent = void 0;
|
|
4
|
+
const type_helpers_1 = require("./type-helpers");
|
|
5
|
+
// Avoid importing the proto implementation to reduce workflow bundle size
|
|
6
|
+
// Copied from coresdk.common.VersioningIntent
|
|
7
|
+
/**
|
|
8
|
+
* Protobuf enum representation of {@link VersioningIntentString}.
|
|
9
|
+
*
|
|
10
|
+
* @experimental
|
|
11
|
+
*/
|
|
12
|
+
var VersioningIntent;
|
|
13
|
+
(function (VersioningIntent) {
|
|
14
|
+
VersioningIntent[VersioningIntent["UNSPECIFIED"] = 0] = "UNSPECIFIED";
|
|
15
|
+
VersioningIntent[VersioningIntent["COMPATIBLE"] = 1] = "COMPATIBLE";
|
|
16
|
+
VersioningIntent[VersioningIntent["DEFAULT"] = 2] = "DEFAULT";
|
|
17
|
+
})(VersioningIntent = exports.VersioningIntent || (exports.VersioningIntent = {}));
|
|
18
|
+
(0, type_helpers_1.checkExtends)();
|
|
19
|
+
(0, type_helpers_1.checkExtends)();
|
|
20
|
+
function versioningIntentToProto(intent) {
|
|
21
|
+
switch (intent) {
|
|
22
|
+
case 'DEFAULT':
|
|
23
|
+
return VersioningIntent.DEFAULT;
|
|
24
|
+
case 'COMPATIBLE':
|
|
25
|
+
return VersioningIntent.COMPATIBLE;
|
|
26
|
+
case undefined:
|
|
27
|
+
return VersioningIntent.UNSPECIFIED;
|
|
28
|
+
default:
|
|
29
|
+
(0, type_helpers_1.assertNever)('Unexpected VersioningIntent', intent);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.versioningIntentToProto = versioningIntentToProto;
|
|
33
|
+
//# sourceMappingURL=versioning-intent-enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versioning-intent-enum.js","sourceRoot":"","sources":["../src/versioning-intent-enum.ts"],"names":[],"mappings":";;;AAEA,iDAA2D;AAE3D,0EAA0E;AAC1E,8CAA8C;AAC9C;;;;GAIG;AACH,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,qEAAe,CAAA;IACf,mEAAc,CAAA;IACd,6DAAW,CAAA;AACb,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B;AAED,IAAA,2BAAY,GAAqD,CAAC;AAClE,IAAA,2BAAY,GAAqD,CAAC;AAElE,SAAgB,uBAAuB,CAAC,MAA0C;IAChF,QAAQ,MAAM,EAAE;QACd,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC,OAAO,CAAC;QAClC,KAAK,YAAY;YACf,OAAO,gBAAgB,CAAC,UAAU,CAAC;QACrC,KAAK,SAAS;YACZ,OAAO,gBAAgB,CAAC,WAAW,CAAC;QACtC;YACE,IAAA,0BAAW,EAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;KACtD;AACH,CAAC;AAXD,0DAWC"}
|
|
@@ -41,7 +41,7 @@ export interface BaseWorkflowOptions {
|
|
|
41
41
|
*
|
|
42
42
|
* *Note: A Workflow can never be started with a Workflow Id of a Running Workflow.*
|
|
43
43
|
*
|
|
44
|
-
* @default {@link WorkflowIdReusePolicy.
|
|
44
|
+
* @default {@link WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE}
|
|
45
45
|
*/
|
|
46
46
|
workflowIdReusePolicy?: WorkflowIdReusePolicy;
|
|
47
47
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/common",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Common library for code that's used across the Client, Worker, and/or Workflow",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@opentelemetry/api": "^1.4.1",
|
|
16
|
-
"@temporalio/proto": "1.8.
|
|
16
|
+
"@temporalio/proto": "1.8.3",
|
|
17
17
|
"long": "^5.2.0",
|
|
18
18
|
"ms": "^3.0.0-canary.1",
|
|
19
19
|
"proto3-json-serializer": "^1.0.3",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"src",
|
|
36
36
|
"lib"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "7d1c0ec969b897b4f32bd5a8eda9819a03bd2f83"
|
|
39
39
|
}
|