@temporalio/activity 1.16.1 → 1.17.0
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 +38 -10
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +39 -11
package/lib/index.d.ts
CHANGED
|
@@ -115,9 +115,9 @@
|
|
|
115
115
|
* @module
|
|
116
116
|
*/
|
|
117
117
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
118
|
-
import { Logger, Duration, MetricMeter, Priority, ActivityCancellationDetails, RetryPolicy } from '@temporalio/common';
|
|
119
|
-
import { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
120
|
-
import { Client } from '@temporalio/client';
|
|
118
|
+
import type { Logger, Duration, MetricMeter, Priority, ActivityCancellationDetails, RetryPolicy } from '@temporalio/common';
|
|
119
|
+
import type { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
120
|
+
import type { Client } from '@temporalio/client';
|
|
121
121
|
export { ActivityFunction, ActivityInterface, // eslint-disable-line @typescript-eslint/no-deprecated
|
|
122
122
|
ApplicationFailure, CancelledFailure, CompleteAsyncError, UntypedActivities, } from '@temporalio/common';
|
|
123
123
|
export declare const asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
@@ -125,11 +125,17 @@ export declare const asyncLocalStorage: AsyncLocalStorage<Context>;
|
|
|
125
125
|
* Holds information about the current Activity Execution. Retrieved inside an Activity with `Context.current().info`.
|
|
126
126
|
*/
|
|
127
127
|
export interface Info {
|
|
128
|
+
/**
|
|
129
|
+
* Task token associated with this activity execution. Can be used for asynchronous completion
|
|
130
|
+
*/
|
|
128
131
|
readonly taskToken: Uint8Array;
|
|
129
132
|
/**
|
|
130
|
-
* Base64 encoded
|
|
133
|
+
* Base64 encoded {@link taskToken}
|
|
131
134
|
*/
|
|
132
135
|
readonly base64TaskToken: string;
|
|
136
|
+
/**
|
|
137
|
+
* ID of this activity
|
|
138
|
+
*/
|
|
133
139
|
readonly activityId: string;
|
|
134
140
|
/**
|
|
135
141
|
* Exposed Activity function name
|
|
@@ -137,6 +143,8 @@ export interface Info {
|
|
|
137
143
|
readonly activityType: string;
|
|
138
144
|
/**
|
|
139
145
|
* The namespace this Activity is running in
|
|
146
|
+
*
|
|
147
|
+
* @deprecated Use {@link namespace} instead
|
|
140
148
|
*/
|
|
141
149
|
readonly activityNamespace: string;
|
|
142
150
|
/**
|
|
@@ -148,20 +156,22 @@ export interface Info {
|
|
|
148
156
|
*/
|
|
149
157
|
readonly isLocal: boolean;
|
|
150
158
|
/**
|
|
151
|
-
* Information about the Workflow that scheduled the Activity
|
|
159
|
+
* Information about the Workflow that scheduled the Activity. Not set if the activity was not started by a Workflow
|
|
152
160
|
*/
|
|
153
|
-
readonly workflowExecution
|
|
161
|
+
readonly workflowExecution?: {
|
|
154
162
|
readonly workflowId: string;
|
|
155
163
|
readonly runId: string;
|
|
156
164
|
};
|
|
157
165
|
/**
|
|
158
|
-
* The namespace of the Workflow that scheduled this Activity
|
|
166
|
+
* The namespace of the Workflow that scheduled this Activity. Not set if the activity was not started by a Workflow
|
|
167
|
+
*
|
|
168
|
+
* @deprecated Use {@link namespace} instead
|
|
159
169
|
*/
|
|
160
|
-
readonly workflowNamespace
|
|
170
|
+
readonly workflowNamespace?: string;
|
|
161
171
|
/**
|
|
162
|
-
* The module name of the Workflow that scheduled this Activity
|
|
172
|
+
* The module name of the Workflow that scheduled this Activity. Not set if the activity was not started by a Workflow
|
|
163
173
|
*/
|
|
164
|
-
readonly workflowType
|
|
174
|
+
readonly workflowType?: string;
|
|
165
175
|
/**
|
|
166
176
|
* Timestamp for when this Activity was first scheduled.
|
|
167
177
|
* For retries, this will have the timestamp of the first attempt.
|
|
@@ -220,6 +230,24 @@ export interface Info {
|
|
|
220
230
|
* version), but it may still be defined server-side.
|
|
221
231
|
*/
|
|
222
232
|
readonly retryPolicy?: RetryPolicy;
|
|
233
|
+
/**
|
|
234
|
+
* The namespace this Activity is running in
|
|
235
|
+
*/
|
|
236
|
+
readonly namespace: string;
|
|
237
|
+
/**
|
|
238
|
+
* ID of the current run of this activity. Can be used to differentiate between different activity executions that
|
|
239
|
+
* share the same ID. Activities started by a Workflow don't have activity run ID - instead, they can be identified by
|
|
240
|
+
* workflow ID and workflow run ID; see {@link workflowExecution}
|
|
241
|
+
*
|
|
242
|
+
* @experimental Standalone Activities are experimental. APIs may be subject to change.
|
|
243
|
+
*/
|
|
244
|
+
readonly activityRunId?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Whether this activity was started by a workflow
|
|
247
|
+
*
|
|
248
|
+
* @experimental Standalone Activities are experimental. APIs may be subject to change.
|
|
249
|
+
*/
|
|
250
|
+
readonly inWorkflow: boolean;
|
|
223
251
|
}
|
|
224
252
|
/**
|
|
225
253
|
* Activity Context, used to:
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmHG;;;AAmVH,oCAGC;AAsCD,sBAEC;AAeD,8BAEC;AAWD,8BAEC;AAQD,kDAEC;AAgBD,gDAEC;AAcD,8BAEC;AAtcD,uDAAqD;AAWrD,+CAAuD;AACvD,sDAAyD;AAKzD,6CAO4B;AAJ1B,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gB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AACH,SAAgB,kBAAkB;IAChC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,kBAAkB,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS;IACvB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC;AAClC,CAAC;AAED;;;;;;;GAOG;AACU,QAAA,WAAW,GAAgB;IACtC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW;QACnC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9E,CAAC;IACD,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,WAAW;QACxD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC3F,CAAC;IACD,WAAW,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAE,WAAW;QACpD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IACvF,CAAC;IACD,QAAQ,CAAC,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.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Temporal.io SDK Activity sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"abort-controller": "^3.0.0",
|
|
17
|
-
"@temporalio/
|
|
18
|
-
"@temporalio/
|
|
17
|
+
"@temporalio/common": "1.17.0",
|
|
18
|
+
"@temporalio/client": "1.17.0"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">= 20.0.0"
|
package/src/index.ts
CHANGED
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
*/
|
|
117
117
|
|
|
118
118
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
119
|
-
import {
|
|
119
|
+
import type {
|
|
120
120
|
Logger,
|
|
121
121
|
Duration,
|
|
122
122
|
LogLevel,
|
|
@@ -124,13 +124,13 @@ import {
|
|
|
124
124
|
MetricMeter,
|
|
125
125
|
Priority,
|
|
126
126
|
ActivityCancellationDetails,
|
|
127
|
-
IllegalStateError,
|
|
128
127
|
RetryPolicy,
|
|
129
128
|
} from '@temporalio/common';
|
|
129
|
+
import { IllegalStateError } from '@temporalio/common';
|
|
130
130
|
import { msToNumber } from '@temporalio/common/lib/time';
|
|
131
131
|
|
|
132
|
-
import { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
133
|
-
import { Client } from '@temporalio/client';
|
|
132
|
+
import type { ActivityCancellationDetailsHolder } from '@temporalio/common/lib/activity-cancellation-details';
|
|
133
|
+
import type { Client } from '@temporalio/client';
|
|
134
134
|
|
|
135
135
|
export {
|
|
136
136
|
ActivityFunction,
|
|
@@ -153,11 +153,17 @@ export const asyncLocalStorage: AsyncLocalStorage<Context> = (globalThis as any)
|
|
|
153
153
|
* Holds information about the current Activity Execution. Retrieved inside an Activity with `Context.current().info`.
|
|
154
154
|
*/
|
|
155
155
|
export interface Info {
|
|
156
|
+
/**
|
|
157
|
+
* Task token associated with this activity execution. Can be used for asynchronous completion
|
|
158
|
+
*/
|
|
156
159
|
readonly taskToken: Uint8Array;
|
|
157
160
|
/**
|
|
158
|
-
* Base64 encoded
|
|
161
|
+
* Base64 encoded {@link taskToken}
|
|
159
162
|
*/
|
|
160
163
|
readonly base64TaskToken: string;
|
|
164
|
+
/**
|
|
165
|
+
* ID of this activity
|
|
166
|
+
*/
|
|
161
167
|
readonly activityId: string;
|
|
162
168
|
/**
|
|
163
169
|
* Exposed Activity function name
|
|
@@ -165,6 +171,8 @@ export interface Info {
|
|
|
165
171
|
readonly activityType: string;
|
|
166
172
|
/**
|
|
167
173
|
* The namespace this Activity is running in
|
|
174
|
+
*
|
|
175
|
+
* @deprecated Use {@link namespace} instead
|
|
168
176
|
*/
|
|
169
177
|
readonly activityNamespace: string;
|
|
170
178
|
/**
|
|
@@ -176,20 +184,22 @@ export interface Info {
|
|
|
176
184
|
*/
|
|
177
185
|
readonly isLocal: boolean;
|
|
178
186
|
/**
|
|
179
|
-
* Information about the Workflow that scheduled the Activity
|
|
187
|
+
* Information about the Workflow that scheduled the Activity. Not set if the activity was not started by a Workflow
|
|
180
188
|
*/
|
|
181
|
-
readonly workflowExecution
|
|
189
|
+
readonly workflowExecution?: {
|
|
182
190
|
readonly workflowId: string;
|
|
183
191
|
readonly runId: string;
|
|
184
192
|
};
|
|
185
193
|
/**
|
|
186
|
-
* The namespace of the Workflow that scheduled this Activity
|
|
194
|
+
* The namespace of the Workflow that scheduled this Activity. Not set if the activity was not started by a Workflow
|
|
195
|
+
*
|
|
196
|
+
* @deprecated Use {@link namespace} instead
|
|
187
197
|
*/
|
|
188
|
-
readonly workflowNamespace
|
|
198
|
+
readonly workflowNamespace?: string;
|
|
189
199
|
/**
|
|
190
|
-
* The module name of the Workflow that scheduled this Activity
|
|
200
|
+
* The module name of the Workflow that scheduled this Activity. Not set if the activity was not started by a Workflow
|
|
191
201
|
*/
|
|
192
|
-
readonly workflowType
|
|
202
|
+
readonly workflowType?: string;
|
|
193
203
|
/**
|
|
194
204
|
* Timestamp for when this Activity was first scheduled.
|
|
195
205
|
* For retries, this will have the timestamp of the first attempt.
|
|
@@ -249,6 +259,24 @@ export interface Info {
|
|
|
249
259
|
* version), but it may still be defined server-side.
|
|
250
260
|
*/
|
|
251
261
|
readonly retryPolicy?: RetryPolicy;
|
|
262
|
+
/**
|
|
263
|
+
* The namespace this Activity is running in
|
|
264
|
+
*/
|
|
265
|
+
readonly namespace: string;
|
|
266
|
+
/**
|
|
267
|
+
* ID of the current run of this activity. Can be used to differentiate between different activity executions that
|
|
268
|
+
* share the same ID. Activities started by a Workflow don't have activity run ID - instead, they can be identified by
|
|
269
|
+
* workflow ID and workflow run ID; see {@link workflowExecution}
|
|
270
|
+
*
|
|
271
|
+
* @experimental Standalone Activities are experimental. APIs may be subject to change.
|
|
272
|
+
*/
|
|
273
|
+
readonly activityRunId?: string;
|
|
274
|
+
/**
|
|
275
|
+
* Whether this activity was started by a workflow
|
|
276
|
+
*
|
|
277
|
+
* @experimental Standalone Activities are experimental. APIs may be subject to change.
|
|
278
|
+
*/
|
|
279
|
+
readonly inWorkflow: boolean;
|
|
252
280
|
}
|
|
253
281
|
|
|
254
282
|
/**
|