@temporalio/activity 1.12.1 → 1.12.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/index.d.ts +22 -3
- package/lib/index.js +26 -2
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +39 -3
package/lib/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
*
|
|
49
49
|
* 1. `await` on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
50
50
|
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
51
|
-
*
|
|
51
|
+
* 2. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
52
52
|
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
53
53
|
*
|
|
54
54
|
* ### Examples
|
|
@@ -69,7 +69,8 @@
|
|
|
69
69
|
* @module
|
|
70
70
|
*/
|
|
71
71
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
72
|
-
import { Logger, Duration, MetricMeter, Priority } from '@temporalio/common';
|
|
72
|
+
import { Logger, Duration, MetricMeter, Priority, ActivityCancellationDetails } from '@temporalio/common';
|
|
73
|
+
import { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
73
74
|
export { ActivityFunction, ActivityInterface, // eslint-disable-line deprecation/deprecation
|
|
74
75
|
ApplicationFailure, CancelledFailure, UntypedActivities, } from '@temporalio/common';
|
|
75
76
|
/**
|
|
@@ -256,12 +257,16 @@ export declare class Context {
|
|
|
256
257
|
* intercepts the `getMetricTags()` method.
|
|
257
258
|
*/
|
|
258
259
|
readonly metricMeter: MetricMeter;
|
|
260
|
+
/**
|
|
261
|
+
* Holder object for activity cancellation details
|
|
262
|
+
*/
|
|
263
|
+
private readonly _cancellationDetails;
|
|
259
264
|
/**
|
|
260
265
|
* **Not** meant to instantiated by Activity code, used by the worker.
|
|
261
266
|
*
|
|
262
267
|
* @ignore
|
|
263
268
|
*/
|
|
264
|
-
constructor(info: Info, cancelled: Promise<never>, cancellationSignal: AbortSignal, heartbeat: (details?: any) => void, log: Logger, metricMeter: MetricMeter);
|
|
269
|
+
constructor(info: Info, cancelled: Promise<never>, cancellationSignal: AbortSignal, heartbeat: (details?: any) => void, log: Logger, metricMeter: MetricMeter, details: ActivityCancellationDetailsHolder);
|
|
265
270
|
/**
|
|
266
271
|
* Send a {@link https://docs.temporal.io/concepts/what-is-an-activity-heartbeat | heartbeat} from an Activity.
|
|
267
272
|
*
|
|
@@ -290,6 +295,13 @@ export declare class Context {
|
|
|
290
295
|
* @returns A Promise that either resolves when `ms` is reached or rejects when the Activity is cancelled
|
|
291
296
|
*/
|
|
292
297
|
readonly sleep: (ms: Duration) => Promise<void>;
|
|
298
|
+
/**
|
|
299
|
+
* Return the cancellation details for this activity, if any.
|
|
300
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
301
|
+
*
|
|
302
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
303
|
+
*/
|
|
304
|
+
get cancellationDetails(): ActivityCancellationDetails | undefined;
|
|
293
305
|
}
|
|
294
306
|
/**
|
|
295
307
|
* The current Activity's context.
|
|
@@ -334,6 +346,13 @@ export declare function heartbeat(details?: unknown): void;
|
|
|
334
346
|
* This is a shortcut for `Context.current().cancelled` (see {@link Context.cancelled}).
|
|
335
347
|
*/
|
|
336
348
|
export declare function cancelled(): Promise<never>;
|
|
349
|
+
/**
|
|
350
|
+
* Return the cancellation details for this activity, if any.
|
|
351
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
352
|
+
*
|
|
353
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
354
|
+
*/
|
|
355
|
+
export declare function cancellationDetails(): ActivityCancellationDetails | undefined;
|
|
337
356
|
/**
|
|
338
357
|
* Return an {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} that can be used to
|
|
339
358
|
* react to Activity cancellation.
|
package/lib/index.js
CHANGED
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* 1. `await` on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
51
51
|
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
52
|
-
*
|
|
52
|
+
* 2. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
53
53
|
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
54
54
|
*
|
|
55
55
|
* ### Examples
|
|
@@ -81,6 +81,7 @@ exports.activityInfo = activityInfo;
|
|
|
81
81
|
exports.sleep = sleep;
|
|
82
82
|
exports.heartbeat = heartbeat;
|
|
83
83
|
exports.cancelled = cancelled;
|
|
84
|
+
exports.cancellationDetails = cancellationDetails;
|
|
84
85
|
exports.cancellationSignal = cancellationSignal;
|
|
85
86
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
86
87
|
const time_1 = require("@temporalio/common/lib/time");
|
|
@@ -195,18 +196,23 @@ class Context {
|
|
|
195
196
|
* intercepts the `getMetricTags()` method.
|
|
196
197
|
*/
|
|
197
198
|
metricMeter;
|
|
199
|
+
/**
|
|
200
|
+
* Holder object for activity cancellation details
|
|
201
|
+
*/
|
|
202
|
+
_cancellationDetails;
|
|
198
203
|
/**
|
|
199
204
|
* **Not** meant to instantiated by Activity code, used by the worker.
|
|
200
205
|
*
|
|
201
206
|
* @ignore
|
|
202
207
|
*/
|
|
203
|
-
constructor(info, cancelled, cancellationSignal, heartbeat, log, metricMeter) {
|
|
208
|
+
constructor(info, cancelled, cancellationSignal, heartbeat, log, metricMeter, details) {
|
|
204
209
|
this.info = info;
|
|
205
210
|
this.cancelled = cancelled;
|
|
206
211
|
this.cancellationSignal = cancellationSignal;
|
|
207
212
|
this.heartbeatFn = heartbeat;
|
|
208
213
|
this.log = log;
|
|
209
214
|
this.metricMeter = metricMeter;
|
|
215
|
+
this._cancellationDetails = details;
|
|
210
216
|
}
|
|
211
217
|
/**
|
|
212
218
|
* Send a {@link https://docs.temporal.io/concepts/what-is-an-activity-heartbeat | heartbeat} from an Activity.
|
|
@@ -244,6 +250,15 @@ class Context {
|
|
|
244
250
|
});
|
|
245
251
|
return Promise.race([this.cancelled.finally(() => clearTimeout(handle)), timer]);
|
|
246
252
|
};
|
|
253
|
+
/**
|
|
254
|
+
* Return the cancellation details for this activity, if any.
|
|
255
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
256
|
+
*
|
|
257
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
258
|
+
*/
|
|
259
|
+
get cancellationDetails() {
|
|
260
|
+
return this._cancellationDetails.details;
|
|
261
|
+
}
|
|
247
262
|
}
|
|
248
263
|
exports.Context = Context;
|
|
249
264
|
/**
|
|
@@ -319,6 +334,15 @@ function heartbeat(details) {
|
|
|
319
334
|
function cancelled() {
|
|
320
335
|
return Context.current().cancelled;
|
|
321
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Return the cancellation details for this activity, if any.
|
|
339
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
340
|
+
*
|
|
341
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
342
|
+
*/
|
|
343
|
+
function cancellationDetails() {
|
|
344
|
+
return Context.current().cancellationDetails;
|
|
345
|
+
}
|
|
322
346
|
/**
|
|
323
347
|
* Return an {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} that can be used to
|
|
324
348
|
* react to Activity cancellation.
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;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AAC,IAAI;QACX,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/activity",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "Temporal.io SDK Activity sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "Temporal Technologies Inc. <sdk@temporal.io>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@temporalio/common": "1.12.
|
|
16
|
+
"@temporalio/common": "1.12.3",
|
|
17
17
|
"abort-controller": "^3.0.0"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"src",
|
|
36
36
|
"lib"
|
|
37
37
|
],
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e25f1d5ddaf0b5c755457b1cc1dde7c6e089a63b"
|
|
39
39
|
}
|
package/src/index.ts
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
*
|
|
49
49
|
* 1. `await` on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
50
50
|
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
51
|
-
*
|
|
51
|
+
* 2. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
52
52
|
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
53
53
|
*
|
|
54
54
|
* ### Examples
|
|
@@ -70,9 +70,18 @@
|
|
|
70
70
|
*/
|
|
71
71
|
|
|
72
72
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
73
|
-
import {
|
|
73
|
+
import {
|
|
74
|
+
Logger,
|
|
75
|
+
Duration,
|
|
76
|
+
LogLevel,
|
|
77
|
+
LogMetadata,
|
|
78
|
+
MetricMeter,
|
|
79
|
+
Priority,
|
|
80
|
+
ActivityCancellationDetails,
|
|
81
|
+
} from '@temporalio/common';
|
|
74
82
|
import { msToNumber } from '@temporalio/common/lib/time';
|
|
75
83
|
import { SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
|
|
84
|
+
import { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
76
85
|
|
|
77
86
|
export {
|
|
78
87
|
ActivityFunction,
|
|
@@ -289,6 +298,11 @@ export class Context {
|
|
|
289
298
|
*/
|
|
290
299
|
public readonly metricMeter: MetricMeter;
|
|
291
300
|
|
|
301
|
+
/**
|
|
302
|
+
* Holder object for activity cancellation details
|
|
303
|
+
*/
|
|
304
|
+
private readonly _cancellationDetails: ActivityCancellationDetailsHolder;
|
|
305
|
+
|
|
292
306
|
/**
|
|
293
307
|
* **Not** meant to instantiated by Activity code, used by the worker.
|
|
294
308
|
*
|
|
@@ -300,7 +314,8 @@ export class Context {
|
|
|
300
314
|
cancellationSignal: AbortSignal,
|
|
301
315
|
heartbeat: (details?: any) => void,
|
|
302
316
|
log: Logger,
|
|
303
|
-
metricMeter: MetricMeter
|
|
317
|
+
metricMeter: MetricMeter,
|
|
318
|
+
details: ActivityCancellationDetailsHolder
|
|
304
319
|
) {
|
|
305
320
|
this.info = info;
|
|
306
321
|
this.cancelled = cancelled;
|
|
@@ -308,6 +323,7 @@ export class Context {
|
|
|
308
323
|
this.heartbeatFn = heartbeat;
|
|
309
324
|
this.log = log;
|
|
310
325
|
this.metricMeter = metricMeter;
|
|
326
|
+
this._cancellationDetails = details;
|
|
311
327
|
}
|
|
312
328
|
|
|
313
329
|
/**
|
|
@@ -347,6 +363,16 @@ export class Context {
|
|
|
347
363
|
});
|
|
348
364
|
return Promise.race([this.cancelled.finally(() => clearTimeout(handle)), timer]);
|
|
349
365
|
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Return the cancellation details for this activity, if any.
|
|
369
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
370
|
+
*
|
|
371
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
372
|
+
*/
|
|
373
|
+
public get cancellationDetails(): ActivityCancellationDetails | undefined {
|
|
374
|
+
return this._cancellationDetails.details;
|
|
375
|
+
}
|
|
350
376
|
}
|
|
351
377
|
|
|
352
378
|
/**
|
|
@@ -427,6 +453,16 @@ export function cancelled(): Promise<never> {
|
|
|
427
453
|
return Context.current().cancelled;
|
|
428
454
|
}
|
|
429
455
|
|
|
456
|
+
/**
|
|
457
|
+
* Return the cancellation details for this activity, if any.
|
|
458
|
+
* @returns an object with boolean properties that describes the reason for cancellation, or undefined if not cancelled.
|
|
459
|
+
*
|
|
460
|
+
* @experimental Activity cancellation details include usage of experimental features such as activity pause, and may be subject to change.
|
|
461
|
+
*/
|
|
462
|
+
export function cancellationDetails(): ActivityCancellationDetails | undefined {
|
|
463
|
+
return Context.current().cancellationDetails;
|
|
464
|
+
}
|
|
465
|
+
|
|
430
466
|
/**
|
|
431
467
|
* Return an {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} that can be used to
|
|
432
468
|
* react to Activity cancellation.
|