@temporalio/activity 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/index.d.ts +4 -11
- package/lib/index.js +12 -19
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +7 -21
package/lib/index.d.ts
CHANGED
|
@@ -75,7 +75,6 @@ import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
75
75
|
import { Logger, Duration } from '@temporalio/common';
|
|
76
76
|
export { ActivityFunction, ActivityInterface, // eslint-disable-line deprecation/deprecation
|
|
77
77
|
ApplicationFailure, CancelledFailure, UntypedActivities, } from '@temporalio/common';
|
|
78
|
-
declare const isCompleteAsyncError: unique symbol;
|
|
79
78
|
/**
|
|
80
79
|
* Throw this error from an Activity in order to make the Worker forget about this Activity.
|
|
81
80
|
*
|
|
@@ -94,16 +93,6 @@ declare const isCompleteAsyncError: unique symbol;
|
|
|
94
93
|
*```
|
|
95
94
|
*/
|
|
96
95
|
export declare class CompleteAsyncError extends Error {
|
|
97
|
-
readonly name: string;
|
|
98
|
-
constructor();
|
|
99
|
-
/**
|
|
100
|
-
* Marker to determine whether an error is an instance of CompleteAsyncError.
|
|
101
|
-
*/
|
|
102
|
-
protected readonly [isCompleteAsyncError] = true;
|
|
103
|
-
/**
|
|
104
|
-
* Instanceof check that works when multiple versions of @temporalio/activity are installed.
|
|
105
|
-
*/
|
|
106
|
-
static is(error: unknown): error is CompleteAsyncError;
|
|
107
96
|
}
|
|
108
97
|
export declare const asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
109
98
|
/**
|
|
@@ -159,6 +148,10 @@ export interface Info {
|
|
|
159
148
|
* Timeout for this Activity from start to close in milliseconds
|
|
160
149
|
*/
|
|
161
150
|
startToCloseTimeoutMs: number;
|
|
151
|
+
/**
|
|
152
|
+
* Timestamp for when the current attempt of this Activity was scheduled in milliseconds
|
|
153
|
+
*/
|
|
154
|
+
currentAttemptScheduledTimestampMs: number;
|
|
162
155
|
/**
|
|
163
156
|
* Heartbeat timeout in milliseconds.
|
|
164
157
|
* If this timeout is defined, the Activity must heartbeat before the timeout is reached.
|
package/lib/index.js
CHANGED
|
@@ -69,16 +69,21 @@
|
|
|
69
69
|
*
|
|
70
70
|
* @module
|
|
71
71
|
*/
|
|
72
|
-
var
|
|
72
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
73
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
74
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
75
|
+
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;
|
|
76
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
77
|
+
};
|
|
73
78
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
79
|
exports.Context = exports.asyncLocalStorage = exports.CompleteAsyncError = exports.CancelledFailure = exports.ApplicationFailure = void 0;
|
|
75
80
|
require("abort-controller/polyfill"); // eslint-disable-line import/no-unassigned-import
|
|
76
81
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
77
82
|
const time_1 = require("@temporalio/common/lib/time");
|
|
83
|
+
const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
|
|
78
84
|
var common_1 = require("@temporalio/common");
|
|
79
85
|
Object.defineProperty(exports, "ApplicationFailure", { enumerable: true, get: function () { return common_1.ApplicationFailure; } });
|
|
80
86
|
Object.defineProperty(exports, "CancelledFailure", { enumerable: true, get: function () { return common_1.CancelledFailure; } });
|
|
81
|
-
const isCompleteAsyncError = Symbol.for('__temporal_isCompleteAsyncError');
|
|
82
87
|
/**
|
|
83
88
|
* Throw this error from an Activity in order to make the Worker forget about this Activity.
|
|
84
89
|
*
|
|
@@ -96,24 +101,12 @@ const isCompleteAsyncError = Symbol.for('__temporal_isCompleteAsyncError');
|
|
|
96
101
|
*}
|
|
97
102
|
*```
|
|
98
103
|
*/
|
|
99
|
-
class CompleteAsyncError extends Error {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* Marker to determine whether an error is an instance of CompleteAsyncError.
|
|
105
|
-
*/
|
|
106
|
-
this[_a] = true;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Instanceof check that works when multiple versions of @temporalio/activity are installed.
|
|
110
|
-
*/
|
|
111
|
-
static is(error) {
|
|
112
|
-
return error instanceof CompleteAsyncError || error?.[isCompleteAsyncError] === true;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
104
|
+
let CompleteAsyncError = class CompleteAsyncError extends Error {
|
|
105
|
+
};
|
|
106
|
+
CompleteAsyncError = __decorate([
|
|
107
|
+
(0, type_helpers_1.SymbolBasedInstanceOfError)('CompleteAsyncError')
|
|
108
|
+
], CompleteAsyncError);
|
|
115
109
|
exports.CompleteAsyncError = CompleteAsyncError;
|
|
116
|
-
_a = isCompleteAsyncError;
|
|
117
110
|
// Make it safe to use @temporalio/activity with multiple versions installed.
|
|
118
111
|
const asyncLocalStorageSymbol = Symbol.for('__temporal_activity_context_storage__');
|
|
119
112
|
if (!globalThis[asyncLocalStorageSymbol]) {
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;;;;;;;;;AAEH,qCAAmC,CAAC,kDA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AkC,CAAC,CAAC;SACrD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,EAAY;QACvB,IAAI,MAAsB,CAAC;QAC3B,MAAM,KAAK,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,IAAA,iBAAU,EAAC,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IACnF,CAAC;CACF;AAjHD,0BAiHC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/activity",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.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.8.
|
|
16
|
+
"@temporalio/common": "1.8.3",
|
|
17
17
|
"abort-controller": "^3.0.0"
|
|
18
18
|
},
|
|
19
19
|
"bugs": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"src",
|
|
33
33
|
"lib"
|
|
34
34
|
],
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "7d1c0ec969b897b4f32bd5a8eda9819a03bd2f83"
|
|
36
36
|
}
|
package/src/index.ts
CHANGED
|
@@ -73,6 +73,7 @@ import 'abort-controller/polyfill'; // eslint-disable-line import/no-unassigned-
|
|
|
73
73
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
74
74
|
import { Logger, Duration } from '@temporalio/common';
|
|
75
75
|
import { msToNumber } from '@temporalio/common/lib/time';
|
|
76
|
+
import { SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
|
|
76
77
|
|
|
77
78
|
export {
|
|
78
79
|
ActivityFunction,
|
|
@@ -82,8 +83,6 @@ export {
|
|
|
82
83
|
UntypedActivities,
|
|
83
84
|
} from '@temporalio/common';
|
|
84
85
|
|
|
85
|
-
const isCompleteAsyncError = Symbol.for('__temporal_isCompleteAsyncError');
|
|
86
|
-
|
|
87
86
|
/**
|
|
88
87
|
* Throw this error from an Activity in order to make the Worker forget about this Activity.
|
|
89
88
|
*
|
|
@@ -101,25 +100,8 @@ const isCompleteAsyncError = Symbol.for('__temporal_isCompleteAsyncError');
|
|
|
101
100
|
*}
|
|
102
101
|
*```
|
|
103
102
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
constructor() {
|
|
108
|
-
super();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Marker to determine whether an error is an instance of CompleteAsyncError.
|
|
113
|
-
*/
|
|
114
|
-
protected readonly [isCompleteAsyncError] = true;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Instanceof check that works when multiple versions of @temporalio/activity are installed.
|
|
118
|
-
*/
|
|
119
|
-
static is(error: unknown): error is CompleteAsyncError {
|
|
120
|
-
return error instanceof CompleteAsyncError || (error as any)?.[isCompleteAsyncError] === true;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
103
|
+
@SymbolBasedInstanceOfError('CompleteAsyncError')
|
|
104
|
+
export class CompleteAsyncError extends Error {}
|
|
123
105
|
|
|
124
106
|
// Make it safe to use @temporalio/activity with multiple versions installed.
|
|
125
107
|
const asyncLocalStorageSymbol = Symbol.for('__temporal_activity_context_storage__');
|
|
@@ -182,6 +164,10 @@ export interface Info {
|
|
|
182
164
|
* Timeout for this Activity from start to close in milliseconds
|
|
183
165
|
*/
|
|
184
166
|
startToCloseTimeoutMs: number;
|
|
167
|
+
/**
|
|
168
|
+
* Timestamp for when the current attempt of this Activity was scheduled in milliseconds
|
|
169
|
+
*/
|
|
170
|
+
currentAttemptScheduledTimestampMs: number;
|
|
185
171
|
/**
|
|
186
172
|
* Heartbeat timeout in milliseconds.
|
|
187
173
|
* If this timeout is defined, the Activity must heartbeat before the timeout is reached.
|