@temporalio/activity 1.0.1 → 1.1.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 +18 -9
- package/lib/index.js +12 -6
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +18 -9
package/lib/index.d.ts
CHANGED
|
@@ -15,15 +15,19 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ### Cancellation
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Activity Cancellation serves three purposes:
|
|
19
|
+
*
|
|
20
|
+
* - It lets an Activity know it doesn't need to keep doing work.
|
|
21
|
+
* - It gives the Activity time to clean up any resources it has created.
|
|
22
|
+
*
|
|
23
|
+
* Activities may receive Cancellation only if they {@link Context.heartbeat | emit heartbeats} or are Local Activities
|
|
24
|
+
* (which can't heartbeat but receive Cancellation anyway).
|
|
19
25
|
*
|
|
20
26
|
* There are two ways to handle Activity cancellation:
|
|
21
27
|
* 1. await on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
22
|
-
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a
|
|
23
|
-
* {@link CancelledFailure}.
|
|
28
|
+
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
24
29
|
* 1. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
25
|
-
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that
|
|
26
|
-
* supports it.
|
|
30
|
+
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
27
31
|
*
|
|
28
32
|
* ### Examples
|
|
29
33
|
*
|
|
@@ -133,12 +137,15 @@ export interface Info {
|
|
|
133
137
|
*/
|
|
134
138
|
heartbeatTimeoutMs?: number;
|
|
135
139
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
140
|
+
* The {@link Context.heartbeat | details} from the last recorded heartbeat from the last attempt of this Activity.
|
|
141
|
+
*
|
|
142
|
+
* Use this to resume your Activity from a checkpoint.
|
|
138
143
|
*/
|
|
139
144
|
heartbeatDetails: any;
|
|
140
145
|
/**
|
|
141
|
-
* Task
|
|
146
|
+
* Task Queue the Activity is scheduled in.
|
|
147
|
+
*
|
|
148
|
+
* For Local Activities, this is set to the Workflow's Task Queue.
|
|
142
149
|
*/
|
|
143
150
|
taskQueue: string;
|
|
144
151
|
}
|
|
@@ -198,7 +205,9 @@ export declare class Context {
|
|
|
198
205
|
* attribute set to a {@link TimeoutFailure}, which has the last value of `details` available at
|
|
199
206
|
* {@link TimeoutFailure.lastHeartbeatDetails}.
|
|
200
207
|
*
|
|
201
|
-
*
|
|
208
|
+
* Calling `heartbeat()` from a Local Activity has no effect.
|
|
209
|
+
*
|
|
210
|
+
* Activities must heartbeat in order to receive Cancellation (unless they're Local Activities, which don't need to).
|
|
202
211
|
*/
|
|
203
212
|
heartbeat(details?: unknown): void;
|
|
204
213
|
/**
|
package/lib/index.js
CHANGED
|
@@ -16,15 +16,19 @@
|
|
|
16
16
|
*
|
|
17
17
|
* ### Cancellation
|
|
18
18
|
*
|
|
19
|
-
*
|
|
19
|
+
* Activity Cancellation serves three purposes:
|
|
20
|
+
*
|
|
21
|
+
* - It lets an Activity know it doesn't need to keep doing work.
|
|
22
|
+
* - It gives the Activity time to clean up any resources it has created.
|
|
23
|
+
*
|
|
24
|
+
* Activities may receive Cancellation only if they {@link Context.heartbeat | emit heartbeats} or are Local Activities
|
|
25
|
+
* (which can't heartbeat but receive Cancellation anyway).
|
|
20
26
|
*
|
|
21
27
|
* There are two ways to handle Activity cancellation:
|
|
22
28
|
* 1. await on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
23
|
-
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a
|
|
24
|
-
* {@link CancelledFailure}.
|
|
29
|
+
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
25
30
|
* 1. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
26
|
-
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that
|
|
27
|
-
* supports it.
|
|
31
|
+
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
28
32
|
*
|
|
29
33
|
* ### Examples
|
|
30
34
|
*
|
|
@@ -112,7 +116,9 @@ class Context {
|
|
|
112
116
|
* attribute set to a {@link TimeoutFailure}, which has the last value of `details` available at
|
|
113
117
|
* {@link TimeoutFailure.lastHeartbeatDetails}.
|
|
114
118
|
*
|
|
115
|
-
*
|
|
119
|
+
* Calling `heartbeat()` from a Local Activity has no effect.
|
|
120
|
+
*
|
|
121
|
+
* Activities must heartbeat in order to receive Cancellation (unless they're Local Activities, which don't need to).
|
|
116
122
|
*/
|
|
117
123
|
heartbeat(details) {
|
|
118
124
|
this.heartbeatFn(details);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;;;AAEH,mFAAkE;AAElE,6CAAgD;AAChD,6CAA0E;AAAjE,0GAAA,gBAAgB,OAAA;AAAE,4GAAA,kBAAkB,OAAA;AAC7C,iFAM8C;AAF5C,wHAAA,YAAY,OAAA;AACZ,qHAAA,SAAS,OAAA;AAGX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAa,kBAAmB,SAAQ,KAAK;IAG3C;QACE,KAAK,EAAE,CAAC;QAHM,SAAI,GAAW,oBAAoB,CAAC;IAIpD,CAAC;CACF;AAND,gDAMC;AAED,cAAc;AACD,QAAA,iBAAiB,GAAG,IAAI,+BAAiB,EAAW,CAAC;AA8ElE;;;;;;;;;GASG;AACH,MAAa,OAAO;IA8BlB;;;;OAIG;IACH,YACE,IAAU,EACV,SAAyB,EACzB,kBAA+B,EAC/B,SAAkC;QAElC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACI,SAAS,CAAC,OAAiB;QAChC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,OAAO;QACnB,MAAM,KAAK,GAAG,yBAAiB,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;SACrD;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,EAAmB;QAC9B,IAAI,MAAsB,CAAC;QAC3B,MAAM,KAAK,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,IAAA,qCAAU,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;AA3FD,0BA2FC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/activity",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Temporal.io SDK Activity sub-package",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"author": "Temporal Technologies Inc. <sdk@temporal.io>",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@temporalio/common": "^1.0
|
|
17
|
-
"@temporalio/internal-workflow-common": "^1.0
|
|
16
|
+
"@temporalio/common": "^1.1.0",
|
|
17
|
+
"@temporalio/internal-workflow-common": "^1.1.0",
|
|
18
18
|
"abort-controller": "^3.0.0"
|
|
19
19
|
},
|
|
20
20
|
"bugs": {
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"src",
|
|
29
29
|
"lib"
|
|
30
30
|
],
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "132f23a47a93fecf3f39836b31f08ea837b30320"
|
|
32
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -15,15 +15,19 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ### Cancellation
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Activity Cancellation serves three purposes:
|
|
19
|
+
*
|
|
20
|
+
* - It lets an Activity know it doesn't need to keep doing work.
|
|
21
|
+
* - It gives the Activity time to clean up any resources it has created.
|
|
22
|
+
*
|
|
23
|
+
* Activities may receive Cancellation only if they {@link Context.heartbeat | emit heartbeats} or are Local Activities
|
|
24
|
+
* (which can't heartbeat but receive Cancellation anyway).
|
|
19
25
|
*
|
|
20
26
|
* There are two ways to handle Activity cancellation:
|
|
21
27
|
* 1. await on {@link Context.cancelled | `Context.current().cancelled`} or
|
|
22
|
-
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a
|
|
23
|
-
* {@link CancelledFailure}.
|
|
28
|
+
* {@link Context.sleep | `Context.current().sleep()`}, which each throw a {@link CancelledFailure}.
|
|
24
29
|
* 1. Pass the context's {@link https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal | `AbortSignal`} at
|
|
25
|
-
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that
|
|
26
|
-
* supports it.
|
|
30
|
+
* {@link Context.cancellationSignal | `Context.current().cancellationSignal`} to a library that supports it.
|
|
27
31
|
*
|
|
28
32
|
* ### Examples
|
|
29
33
|
*
|
|
@@ -145,13 +149,16 @@ export interface Info {
|
|
|
145
149
|
*/
|
|
146
150
|
heartbeatTimeoutMs?: number;
|
|
147
151
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
152
|
+
* The {@link Context.heartbeat | details} from the last recorded heartbeat from the last attempt of this Activity.
|
|
153
|
+
*
|
|
154
|
+
* Use this to resume your Activity from a checkpoint.
|
|
150
155
|
*/
|
|
151
156
|
heartbeatDetails: any;
|
|
152
157
|
|
|
153
158
|
/**
|
|
154
|
-
* Task
|
|
159
|
+
* Task Queue the Activity is scheduled in.
|
|
160
|
+
*
|
|
161
|
+
* For Local Activities, this is set to the Workflow's Task Queue.
|
|
155
162
|
*/
|
|
156
163
|
taskQueue: string;
|
|
157
164
|
}
|
|
@@ -224,7 +231,9 @@ export class Context {
|
|
|
224
231
|
* attribute set to a {@link TimeoutFailure}, which has the last value of `details` available at
|
|
225
232
|
* {@link TimeoutFailure.lastHeartbeatDetails}.
|
|
226
233
|
*
|
|
227
|
-
*
|
|
234
|
+
* Calling `heartbeat()` from a Local Activity has no effect.
|
|
235
|
+
*
|
|
236
|
+
* Activities must heartbeat in order to receive Cancellation (unless they're Local Activities, which don't need to).
|
|
228
237
|
*/
|
|
229
238
|
public heartbeat(details?: unknown): void {
|
|
230
239
|
this.heartbeatFn(details);
|