@temporalio/common 1.14.2-canary-release-testing.0 → 1.16.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.
Files changed (60) hide show
  1. package/lib/activity-options.d.ts +67 -16
  2. package/lib/activity-options.js +47 -1
  3. package/lib/activity-options.js.map +1 -1
  4. package/lib/continue-as-new.d.ts +14 -0
  5. package/lib/continue-as-new.js +41 -0
  6. package/lib/continue-as-new.js.map +1 -0
  7. package/lib/converter/failure-converter.d.ts +2 -0
  8. package/lib/converter/failure-converter.js +69 -29
  9. package/lib/converter/failure-converter.js.map +1 -1
  10. package/lib/converter/payload-search-attributes.d.ts +1 -1
  11. package/lib/converter/payload-search-attributes.js +3 -3
  12. package/lib/converter/payload-search-attributes.js.map +1 -1
  13. package/lib/errors.d.ts +19 -0
  14. package/lib/errors.js +24 -1
  15. package/lib/errors.js.map +1 -1
  16. package/lib/failure.d.ts +1 -1
  17. package/lib/failure.js +14 -14
  18. package/lib/failure.js.map +1 -1
  19. package/lib/index.d.ts +3 -2
  20. package/lib/index.js +3 -1
  21. package/lib/index.js.map +1 -1
  22. package/lib/internal-non-workflow/codec-helpers.d.ts +1 -0
  23. package/lib/internal-non-workflow/codec-helpers.js +9 -0
  24. package/lib/internal-non-workflow/codec-helpers.js.map +1 -1
  25. package/lib/internal-workflow/enums-helpers.d.ts +1 -1
  26. package/lib/internal-workflow/enums-helpers.js +1 -1
  27. package/lib/metrics.d.ts +34 -15
  28. package/lib/metrics.js +11 -3
  29. package/lib/metrics.js.map +1 -1
  30. package/lib/search-attributes.js +10 -1
  31. package/lib/search-attributes.js.map +1 -1
  32. package/lib/time.js +1 -1
  33. package/lib/time.js.map +1 -1
  34. package/lib/versioning-intent-enum.d.ts +4 -2
  35. package/lib/versioning-intent-enum.js +5 -3
  36. package/lib/versioning-intent-enum.js.map +1 -1
  37. package/lib/versioning-intent.d.ts +1 -2
  38. package/lib/worker-deployments.d.ts +20 -4
  39. package/lib/worker-deployments.js +24 -4
  40. package/lib/worker-deployments.js.map +1 -1
  41. package/lib/workflow-options.d.ts +3 -3
  42. package/lib/workflow-options.js +15 -7
  43. package/lib/workflow-options.js.map +1 -1
  44. package/package.json +4 -4
  45. package/src/activity-options.ts +78 -16
  46. package/src/continue-as-new.ts +52 -0
  47. package/src/converter/failure-converter.ts +74 -37
  48. package/src/converter/payload-search-attributes.ts +3 -3
  49. package/src/errors.ts +20 -0
  50. package/src/failure.ts +14 -15
  51. package/src/index.ts +3 -2
  52. package/src/internal-non-workflow/codec-helpers.ts +11 -0
  53. package/src/internal-workflow/enums-helpers.ts +1 -1
  54. package/src/metrics.ts +64 -22
  55. package/src/search-attributes.ts +13 -5
  56. package/src/time.ts +1 -1
  57. package/src/versioning-intent-enum.ts +5 -3
  58. package/src/versioning-intent.ts +1 -2
  59. package/src/worker-deployments.ts +34 -4
  60. package/src/workflow-options.ts +11 -11
@@ -1,8 +1,6 @@
1
1
  import type { temporal } from '@temporalio/proto';
2
2
  /**
3
3
  * Represents the version of a specific worker deployment.
4
- *
5
- * @experimental Deployment based versioning is experimental and may change in the future.
6
4
  */
7
5
  export interface WorkerDeploymentVersion {
8
6
  readonly buildId: string;
@@ -19,8 +17,6 @@ export declare function toCanonicalString(version: WorkerDeploymentVersion): str
19
17
  * * 'PINNED' - The workflow will be pinned to the current Build ID unless manually moved.
20
18
  * * 'AUTO_UPGRADE' - The workflow will automatically move to the latest version (default Build ID
21
19
  * of the task queue) when the next task is dispatched.
22
- *
23
- * @experimental Deployment based versioning is experimental and may change in the future.
24
20
  */
25
21
  export declare const VersioningBehavior: {
26
22
  readonly PINNED: "PINNED";
@@ -45,3 +41,23 @@ export interface PinnedVersioningOverride {
45
41
  * The workflow will auto-upgrade to the current deployment version on the next workflow task.
46
42
  */
47
43
  export type AutoUpgradeVersioningOverride = 'AUTO_UPGRADE';
44
+ /**
45
+ * Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.
46
+ *
47
+ * AUTO_UPGRADE - Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at
48
+ * start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever
49
+ * Versioning Behavior the workflow is annotated with in the workflow code.
50
+ *
51
+ * Note that if the previous workflow had a Pinned override, that override will be inherited by the
52
+ * new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new
53
+ * command. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade
54
+ * behavior, the base version of the new run will be the Target Version as described above, but the
55
+ * effective version will be whatever is specified by the Versioning Override until the override is removed.
56
+ *
57
+ * @experimental Versioning semantics with continue-as-new are experimental and may change in the future.
58
+ */
59
+ export declare const InitialVersioningBehavior: {
60
+ readonly AUTO_UPGRADE: "AUTO_UPGRADE";
61
+ };
62
+ export type InitialVersioningBehavior = (typeof InitialVersioningBehavior)[keyof typeof InitialVersioningBehavior];
63
+ export declare const encodeInitialVersioningBehavior: (input: "AUTO_UPGRADE" | temporal.api.enums.v1.ContinueAsNewVersioningBehavior | "CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_AUTO_UPGRADE" | null | undefined) => temporal.api.enums.v1.ContinueAsNewVersioningBehavior | undefined, decodeInitialVersioningBehavior: (input: temporal.api.enums.v1.ContinueAsNewVersioningBehavior | null | undefined) => "AUTO_UPGRADE" | undefined;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- var _a;
2
+ var _a, _b;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.decodeVersioningBehavior = exports.encodeVersioningBehavior = exports.VersioningBehavior = void 0;
4
+ exports.decodeInitialVersioningBehavior = exports.encodeInitialVersioningBehavior = exports.InitialVersioningBehavior = exports.decodeVersioningBehavior = exports.encodeVersioningBehavior = exports.VersioningBehavior = void 0;
5
5
  exports.toCanonicalString = toCanonicalString;
6
6
  const internal_workflow_1 = require("./internal-workflow");
7
7
  /**
@@ -17,8 +17,6 @@ function toCanonicalString(version) {
17
17
  * * 'PINNED' - The workflow will be pinned to the current Build ID unless manually moved.
18
18
  * * 'AUTO_UPGRADE' - The workflow will automatically move to the latest version (default Build ID
19
19
  * of the task queue) when the next task is dispatched.
20
- *
21
- * @experimental Deployment based versioning is experimental and may change in the future.
22
20
  */
23
21
  exports.VersioningBehavior = {
24
22
  PINNED: 'PINNED',
@@ -29,4 +27,26 @@ _a = (0, internal_workflow_1.makeProtoEnumConverters)({
29
27
  [exports.VersioningBehavior.AUTO_UPGRADE]: 2,
30
28
  UNSPECIFIED: 0,
31
29
  }, 'VERSIONING_BEHAVIOR_'), exports.encodeVersioningBehavior = _a[0], exports.decodeVersioningBehavior = _a[1];
30
+ /**
31
+ * Defines the versioning behavior to be used by the first task of a new workflow run in a continue-as-new chain.
32
+ *
33
+ * AUTO_UPGRADE - Start the new run with AutoUpgrade behavior. Use the Target Version of the workflow's task queue at
34
+ * start-time, as AutoUpgrade workflows do. After the first workflow task completes, use whatever
35
+ * Versioning Behavior the workflow is annotated with in the workflow code.
36
+ *
37
+ * Note that if the previous workflow had a Pinned override, that override will be inherited by the
38
+ * new workflow run regardless of the ContinueAsNewVersioningBehavior specified in the continue-as-new
39
+ * command. If a Pinned override is inherited by the new run, and the new run starts with AutoUpgrade
40
+ * behavior, the base version of the new run will be the Target Version as described above, but the
41
+ * effective version will be whatever is specified by the Versioning Override until the override is removed.
42
+ *
43
+ * @experimental Versioning semantics with continue-as-new are experimental and may change in the future.
44
+ */
45
+ exports.InitialVersioningBehavior = {
46
+ AUTO_UPGRADE: 'AUTO_UPGRADE',
47
+ };
48
+ _b = (0, internal_workflow_1.makeProtoEnumConverters)({
49
+ [exports.InitialVersioningBehavior.AUTO_UPGRADE]: 1,
50
+ UNSPECIFIED: 0,
51
+ }, 'CONTINUE_AS_NEW_VERSIONING_BEHAVIOR_'), exports.encodeInitialVersioningBehavior = _b[0], exports.decodeInitialVersioningBehavior = _b[1];
32
52
  //# sourceMappingURL=worker-deployments.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker-deployments.js","sourceRoot":"","sources":["../src/worker-deployments.ts"],"names":[],"mappings":";;;;AAiBA,8CAEC;AAlBD,2DAA8D;AAY9D;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAgC;IAChE,OAAO,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;CACpB,CAAC;AAGE,KAAuD,IAAA,2CAAuB,EAOzF;IACE,CAAC,0BAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9B,CAAC,0BAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;IACpC,WAAW,EAAE,CAAC;CACN,EACV,sBAAsB,CACvB,EAba,gCAAwB,UAAE,gCAAwB,SAa9D"}
1
+ {"version":3,"file":"worker-deployments.js","sourceRoot":"","sources":["../src/worker-deployments.ts"],"names":[],"mappings":";;;;AAeA,8CAEC;AAhBD,2DAA8D;AAU9D;;;GAGG;AACH,SAAgB,iBAAiB,CAAC,OAAgC;IAChE,OAAO,GAAG,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AACxD,CAAC;AAED;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;CACpB,CAAC;AAGE,KAAuD,IAAA,2CAAuB,EAOzF;IACE,CAAC,0BAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;IAC9B,CAAC,0BAAkB,CAAC,YAAY,CAAC,EAAE,CAAC;IACpC,WAAW,EAAE,CAAC;CACN,EACV,sBAAsB,CACvB,EAba,gCAAwB,UAAE,gCAAwB,SAa9D;AAsBF;;;;;;;;;;;;;;GAcG;AACU,QAAA,yBAAyB,GAAG;IACvC,YAAY,EAAE,cAAc;CACpB,CAAC;AAGE,KAAqE,IAAA,2CAAuB,EAOvG;IACE,CAAC,iCAAyB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC3C,WAAW,EAAE,CAAC;CACN,EACV,sCAAsC,CACvC,EAZa,uCAA+B,UAAE,uCAA+B,SAY5E"}
@@ -64,7 +64,6 @@ export declare const encodeWorkflowIdReusePolicy: (input: "ALLOW_DUPLICATE" | "A
64
64
  *
65
65
  * *Note: It is never possible to have two _actively running_ Workflows with the same ID.*
66
66
  */
67
- export type WorkflowIdConflictPolicy = (typeof WorkflowIdConflictPolicy)[keyof typeof WorkflowIdConflictPolicy];
68
67
  export declare const WorkflowIdConflictPolicy: {
69
68
  /**
70
69
  * Do not start a new Workflow. Instead raise a `WorkflowExecutionAlreadyStartedError`.
@@ -79,6 +78,7 @@ export declare const WorkflowIdConflictPolicy: {
79
78
  */
80
79
  readonly TERMINATE_EXISTING: "TERMINATE_EXISTING";
81
80
  };
81
+ export type WorkflowIdConflictPolicy = (typeof WorkflowIdConflictPolicy)[keyof typeof WorkflowIdConflictPolicy];
82
82
  export declare const encodeWorkflowIdConflictPolicy: (input: "FAIL" | "USE_EXISTING" | "TERMINATE_EXISTING" | temporal.api.enums.v1.WorkflowIdConflictPolicy | "WORKFLOW_ID_CONFLICT_POLICY_FAIL" | "WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING" | "WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING" | null | undefined) => temporal.api.enums.v1.WorkflowIdConflictPolicy | undefined, decodeWorkflowIdConflictPolicy: (input: temporal.api.enums.v1.WorkflowIdConflictPolicy | null | undefined) => "FAIL" | "USE_EXISTING" | "TERMINATE_EXISTING" | undefined;
83
83
  export interface BaseWorkflowOptions {
84
84
  /**
@@ -86,7 +86,7 @@ export interface BaseWorkflowOptions {
86
86
  *
87
87
  * *Note: It is not possible to have two actively running Workflows with the same ID.*
88
88
  *
89
- * @default {@link WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE}
89
+ * @default WorkflowIdReusePolicy.WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
90
90
  */
91
91
  workflowIdReusePolicy?: WorkflowIdReusePolicy;
92
92
  /**
@@ -94,7 +94,7 @@ export interface BaseWorkflowOptions {
94
94
  *
95
95
  * *Note: It is not possible to have two actively running Workflows with the same ID.*
96
96
  *
97
- * @default {@link WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED}
97
+ * @default WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED
98
98
  */
99
99
  workflowIdConflictPolicy?: WorkflowIdConflictPolicy;
100
100
  /**
@@ -37,30 +37,38 @@ exports.WorkflowIdReusePolicy = {
37
37
  * {@link WorkflowIdConflictPolicy.WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING}.
38
38
  * When using this option, `WorkflowOptions.workflowIdConflictPolicy` must be left unspecified.
39
39
  */
40
- TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING', // eslint-disable-line deprecation/deprecation
40
+ TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
41
41
  /// Anything below this line has been deprecated
42
42
  /**
43
43
  * No need to use this. If a `WorkflowIdReusePolicy` is set to this, or is not set at all, the default value will be used.
44
44
  *
45
45
  * @deprecated Either leave property `undefined`, or use {@link ALLOW_DUPLICATE} instead.
46
46
  */
47
- WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED: undefined, // eslint-disable-line deprecation/deprecation
47
+ WORKFLOW_ID_REUSE_POLICY_UNSPECIFIED: undefined,
48
48
  /** @deprecated Use {@link ALLOW_DUPLICATE} instead. */
49
- WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: 'ALLOW_DUPLICATE', // eslint-disable-line deprecation/deprecation
49
+ WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE: 'ALLOW_DUPLICATE',
50
50
  /** @deprecated Use {@link ALLOW_DUPLICATE_FAILED_ONLY} instead. */
51
- WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: 'ALLOW_DUPLICATE_FAILED_ONLY', // eslint-disable-line deprecation/deprecation
51
+ WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY: 'ALLOW_DUPLICATE_FAILED_ONLY',
52
52
  /** @deprecated Use {@link REJECT_DUPLICATE} instead. */
53
- WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: 'REJECT_DUPLICATE', // eslint-disable-line deprecation/deprecation
53
+ WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE: 'REJECT_DUPLICATE',
54
54
  /** @deprecated Use {@link TERMINATE_IF_RUNNING} instead. */
55
- WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING', // eslint-disable-line deprecation/deprecation
55
+ WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING: 'TERMINATE_IF_RUNNING',
56
56
  };
57
57
  _a = (0, internal_workflow_1.makeProtoEnumConverters)({
58
58
  [exports.WorkflowIdReusePolicy.ALLOW_DUPLICATE]: 1,
59
59
  [exports.WorkflowIdReusePolicy.ALLOW_DUPLICATE_FAILED_ONLY]: 2,
60
60
  [exports.WorkflowIdReusePolicy.REJECT_DUPLICATE]: 3,
61
- [exports.WorkflowIdReusePolicy.TERMINATE_IF_RUNNING]: 4, // eslint-disable-line deprecation/deprecation
61
+ [exports.WorkflowIdReusePolicy.TERMINATE_IF_RUNNING]: 4, // eslint-disable-line @typescript-eslint/no-deprecated
62
62
  UNSPECIFIED: 0,
63
63
  }, 'WORKFLOW_ID_REUSE_POLICY_'), exports.encodeWorkflowIdReusePolicy = _a[0], exports.decodeWorkflowIdReusePolicy = _a[1];
64
+ /**
65
+ * Defines what happens when trying to start a Workflow with the same ID as a *Running* Workflow.
66
+ *
67
+ * See {@link WorkflowOptions.workflowIdReusePolicy} for what happens when trying to start a Workflow
68
+ * with the same ID as a *Closed* Workflow.
69
+ *
70
+ * *Note: It is never possible to have two _actively running_ Workflows with the same ID.*
71
+ */
64
72
  exports.WorkflowIdConflictPolicy = {
65
73
  /**
66
74
  * Do not start a new Workflow. Instead raise a `WorkflowExecutionAlreadyStartedError`.
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-options.js","sourceRoot":"","sources":["../src/workflow-options.ts"],"names":[],"mappings":";;;;AAqQA,kDAWC;AA5QD,2DAA8D;AAK9D;;;;;;;;;;GAUG;AACU,QAAA,qBAAqB,GAAG;IACnC;;;OAGG;IACH,eAAe,EAAE,iBAAiB;IAElC;;OAEG;IACH,2BAA2B,EAAE,6BAA6B;IAE1D;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;IAEpC;;;;;;;OAOG;IACH,oBAAoB,EAAE,sBAAsB,EAAE,8CAA8C;IAE5F,gDAAgD;IAEhD;;;;OAIG;IACH,oCAAoC,EAAE,SAAS,EAAE,8CAA8C;IAE/F,uDAAuD;IACvD,wCAAwC,EAAE,iBAAiB,EAAE,8CAA8C;IAE3G,mEAAmE;IACnE,oDAAoD,EAAE,6BAA6B,EAAE,8CAA8C;IAEnI,wDAAwD;IACxD,yCAAyC,EAAE,kBAAkB,EAAE,8CAA8C;IAE7G,4DAA4D;IAC5D,6CAA6C,EAAE,sBAAsB,EAAE,8CAA8C;CAC7G,CAAC;AAGE,KAA6D,IAAA,2CAAuB,EAO/F;IACE,CAAC,6BAAqB,CAAC,eAAe,CAAC,EAAE,CAAC;IAC1C,CAAC,6BAAqB,CAAC,2BAA2B,CAAC,EAAE,CAAC;IACtD,CAAC,6BAAqB,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAC3C,CAAC,6BAAqB,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,8CAA8C;IAC/F,WAAW,EAAE,CAAC;CACN,EACV,2BAA2B,CAC5B,EAfa,mCAA2B,UAAE,mCAA2B,SAepE;AAWW,QAAA,wBAAwB,GAAG;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;OAEG;IACH,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAEE,KAAmE,IAAA,2CAAuB,EAOrG;IACE,CAAC,gCAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,CAAC,gCAAwB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC1C,CAAC,gCAAwB,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAChD,WAAW,EAAE,CAAC;CACN,EACV,8BAA8B,CAC/B,EAda,sCAA8B,UAAE,sCAA8B,SAc1E;AAsIF,SAAgB,mBAAmB,CACjC,kBAAwE;IAExE,IAAI,OAAO,kBAAkB,KAAK,QAAQ;QAAE,OAAO,kBAA4B,CAAC;IAChF,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE,CAAC;QAC7C,IAAI,kBAAkB,EAAE,IAAI;YAAE,OAAO,kBAAkB,CAAC,IAAI,CAAC;QAC7D,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,uEAAuE,OAAO,kBAAkB,GAAG,CACpG,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"workflow-options.js","sourceRoot":"","sources":["../src/workflow-options.ts"],"names":[],"mappings":";;;;AAqQA,kDAWC;AA5QD,2DAA8D;AAK9D;;;;;;;;;;GAUG;AACU,QAAA,qBAAqB,GAAG;IACnC;;;OAGG;IACH,eAAe,EAAE,iBAAiB;IAElC;;OAEG;IACH,2BAA2B,EAAE,6BAA6B;IAE1D;;OAEG;IACH,gBAAgB,EAAE,kBAAkB;IAEpC;;;;;;;OAOG;IACH,oBAAoB,EAAE,sBAAsB;IAE5C,gDAAgD;IAEhD;;;;OAIG;IACH,oCAAoC,EAAE,SAAS;IAE/C,uDAAuD;IACvD,wCAAwC,EAAE,iBAAiB;IAE3D,mEAAmE;IACnE,oDAAoD,EAAE,6BAA6B;IAEnF,wDAAwD;IACxD,yCAAyC,EAAE,kBAAkB;IAE7D,4DAA4D;IAC5D,6CAA6C,EAAE,sBAAsB;CAC7D,CAAC;AAGE,KAA6D,IAAA,2CAAuB,EAO/F;IACE,CAAC,6BAAqB,CAAC,eAAe,CAAC,EAAE,CAAC;IAC1C,CAAC,6BAAqB,CAAC,2BAA2B,CAAC,EAAE,CAAC;IACtD,CAAC,6BAAqB,CAAC,gBAAgB,CAAC,EAAE,CAAC;IAC3C,CAAC,6BAAqB,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,uDAAuD;IACxG,WAAW,EAAE,CAAC;CACN,EACV,2BAA2B,CAC5B,EAfa,mCAA2B,UAAE,mCAA2B,SAepE;AAEF;;;;;;;GAOG;AACU,QAAA,wBAAwB,GAAG;IACtC;;OAEG;IACH,IAAI,EAAE,MAAM;IAEZ;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;OAEG;IACH,kBAAkB,EAAE,oBAAoB;CAChC,CAAC;AAGE,KAAmE,IAAA,2CAAuB,EAOrG;IACE,CAAC,gCAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAClC,CAAC,gCAAwB,CAAC,YAAY,CAAC,EAAE,CAAC;IAC1C,CAAC,gCAAwB,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAChD,WAAW,EAAE,CAAC;CACN,EACV,8BAA8B,CAC/B,EAda,sCAA8B,UAAE,sCAA8B,SAc1E;AAsIF,SAAgB,mBAAmB,CACjC,kBAAwE;IAExE,IAAI,OAAO,kBAAkB,KAAK,QAAQ;QAAE,OAAO,kBAA4B,CAAC;IAChF,IAAI,OAAO,kBAAkB,KAAK,UAAU,EAAE,CAAC;QAC7C,IAAI,kBAAkB,EAAE,IAAI;YAAE,OAAO,kBAAkB,CAAC,IAAI,CAAC;QAC7D,MAAM,IAAI,SAAS,CAAC,2DAA2D,CAAC,CAAC;IACnF,CAAC;IACD,MAAM,IAAI,SAAS,CACjB,uEAAuE,OAAO,kBAAkB,GAAG,CACpG,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temporalio/common",
3
- "version": "1.14.2-canary-release-testing.0",
3
+ "version": "1.16.0",
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",
@@ -14,9 +14,9 @@
14
14
  "dependencies": {
15
15
  "long": "^5.2.3",
16
16
  "ms": "3.0.0-canary.1",
17
- "nexus-rpc": "^0.0.1",
17
+ "nexus-rpc": "^0.0.2",
18
18
  "proto3-json-serializer": "^2.0.0",
19
- "@temporalio/proto": "1.14.2-canary-release-testing.0"
19
+ "@temporalio/proto": "1.16.0"
20
20
  },
21
21
  "devDependencies": {
22
22
  "protobufjs": "^7.2.5"
@@ -34,7 +34,7 @@
34
34
  "access": "public"
35
35
  },
36
36
  "engines": {
37
- "node": ">= 18.0.0"
37
+ "node": ">= 20.0.0"
38
38
  },
39
39
  "files": [
40
40
  "src",
@@ -5,10 +5,59 @@ import { VersioningIntent } from './versioning-intent';
5
5
  import { makeProtoEnumConverters } from './internal-workflow';
6
6
  import { Priority } from './priority';
7
7
 
8
+ // Note: The types defined in this file are here for legacy reasons. They should have been defined
9
+ // in the 'workflow' package, instead of 'common'. They are now reexported from the 'workflow'
10
+ // package, which is the preferred way to import them, but we unfortunately can't remove them from
11
+ // here as that would be a breaking change.
12
+
13
+ /**
14
+ * Determines:
15
+ * - whether cancellation requests should be propagated from the current Workflow to the Activity; and
16
+ * - when should the Activity cancellation be reported to Workflow (i.e. at which moment should the
17
+ * Activity call's promise fail with an `ActivityFailure`, with `cause` set to a `CancelledFailure`).
18
+ *
19
+ * Note that this setting only applies to cancellation originating from cancellation being
20
+ * externally requested on the Workflow itself, or from internal cancellation of the
21
+ * `CancellationScope` in which the Activity call was made. Termination of a Workflow Execution
22
+ * always results in cancellation of its outstanding Activity executions, regardless of those
23
+ * Activities' {@link ActivityCancellationType} settings.
24
+ *
25
+ * @default ActivityCancellationType.WAIT_CANCELLATION_COMPLETED
26
+ */
27
+ // MAINTENANCE: Keep this typedoc in sync with the `ActivityOptions.cancellationType` and
28
+ // `LocalActivityOptions.cancellationType` fields later in this file.
8
29
  export const ActivityCancellationType = {
30
+ /**
31
+ * Do not propagate cancellation requests to the Activity, and immediately report cancellation
32
+ * to the caller.
33
+ */
34
+ ABANDON: 'ABANDON',
35
+
36
+ /**
37
+ * Propagate cancellation request from the Workflow to the Activity, yet _immediately_ report
38
+ * cancellation to the caller, i.e. without waiting for the server to confirm the cancellation
39
+ * request.
40
+ *
41
+ * Note that this cancellation type provides no guarantee, from the Workflow-side, that the
42
+ * cancellation request will actually be delivered to the Activity; e.g. the calling Workflow
43
+ * may exit before the delivery is completed, or the Activity may complete (either successfully
44
+ * or uncessfully) before the cancellation is delivered, resulting in a situation where the
45
+ * workflow thinks the activity was cancelled, but the activity actually completed successfully.
46
+ *
47
+ * To ensure that the Workflow is properly informed of the Activity's final state (i.e. either
48
+ * completion or cancellation), use {@link WAIT_CANCELLATION_COMPLETED}.
49
+ */
9
50
  TRY_CANCEL: 'TRY_CANCEL',
51
+
52
+ /**
53
+ * Propagate cancellation request from the Workflow to the Activity, and wait for the activity
54
+ * to complete its execution (either successfully, uncessfully, or as cancelled).
55
+ *
56
+ * Note that the Activity must heartbeat to receive a cancellation notification. This can block
57
+ * the Workflow's cancellation for a long time if the Activity doesn't heartbeat or chooses to
58
+ * ignore the cancellation request.
59
+ */
10
60
  WAIT_CANCELLATION_COMPLETED: 'WAIT_CANCELLATION_COMPLETED',
11
- ABANDON: 'ABANDON',
12
61
  } as const;
13
62
  export type ActivityCancellationType = (typeof ActivityCancellationType)[keyof typeof ActivityCancellationType];
14
63
 
@@ -93,13 +142,20 @@ export interface ActivityOptions {
93
142
  scheduleToCloseTimeout?: Duration;
94
143
 
95
144
  /**
96
- * Determines what the SDK does when the Activity is cancelled.
97
- * - `TRY_CANCEL` - Initiate a cancellation request and immediately report cancellation to the workflow.
98
- * - `WAIT_CANCELLATION_COMPLETED` - Wait for activity cancellation completion. Note that activity must heartbeat to receive a
99
- * cancellation notification. This can block the cancellation for a long time if activity doesn't
100
- * heartbeat or chooses to ignore the cancellation request.
101
- * - `ABANDON` - Do not request cancellation of the activity and immediately report cancellation to the workflow.
145
+ * Determines:
146
+ * - whether cancellation requests should be propagated from the current Workflow to the Activity; and
147
+ * - when should the Activity cancellation be reported to Workflow (i.e. at which moment should the
148
+ * Activity call's promise fail with an `ActivityFailure`, with `cause` set to a `CancelledFailure`).
149
+ *
150
+ * Note that this setting only applies to cancellation originating from cancellation being
151
+ * externally requested on the Workflow itself, or from internal cancellation of the
152
+ * `CancellationScope` in which the Activity call was made. Termination of a Workflow Execution
153
+ * always results in cancellation of its outstanding Activity executions, regardless of those
154
+ * Activities' {@link ActivityCancellationType} settings.
155
+ *
156
+ * @default ActivityCancellationType.WAIT_CANCELLATION_COMPLETED
102
157
  */
158
+ // MAINTENANCE: Keep this typedoc in sync with the `ActivityCancellationType` enum
103
159
  cancellationType?: ActivityCancellationType;
104
160
 
105
161
  /**
@@ -120,10 +176,9 @@ export interface ActivityOptions {
120
176
  *
121
177
  * @default 'COMPATIBLE'
122
178
  *
123
- * @deprecated In favor of the new Worker Deployment API.
124
- * @experimental The Worker Versioning API is still being designed. Major changes are expected.
179
+ * @deprecated Worker Versioning is now deprecated. Please use the Worker Deployment API instead: https://docs.temporal.io/worker-deployments
125
180
  */
126
- versioningIntent?: VersioningIntent; // eslint-disable-line deprecation/deprecation
181
+ versioningIntent?: VersioningIntent; // eslint-disable-line @typescript-eslint/no-deprecated
127
182
 
128
183
  /**
129
184
  * A fixed, single-line summary for this workflow execution that may appear in the UI/CLI.
@@ -193,13 +248,20 @@ export interface LocalActivityOptions {
193
248
  localRetryThreshold?: Duration;
194
249
 
195
250
  /**
196
- * Determines what the SDK does when the Activity is cancelled.
197
- * - `TRY_CANCEL` - Initiate a cancellation request and immediately report cancellation to the workflow.
198
- * - `WAIT_CANCELLATION_COMPLETED` - Wait for activity cancellation completion. Note that activity must heartbeat to receive a
199
- * cancellation notification. This can block the cancellation for a long time if activity doesn't
200
- * heartbeat or chooses to ignore the cancellation request.
201
- * - `ABANDON` - Do not request cancellation of the activity and immediately report cancellation to the workflow.
251
+ * Determines:
252
+ * - whether cancellation requests should be propagated from the current Workflow to the Activity; and
253
+ * - when should the Activity cancellation be reported to Workflow (i.e. at which moment should the
254
+ * Activity call's promise fail with an `ActivityFailure`, with `cause` set to a `CancelledFailure`).
255
+ *
256
+ * Note that this setting only applies to cancellation originating from cancellation being
257
+ * externally requested on the Workflow itself, or from internal cancellation of the
258
+ * `CancellationScope` in which the Activity call was made. Termination of a Workflow Execution
259
+ * always results in cancellation of its outstanding Activity executions, regardless of those
260
+ * Activities' {@link ActivityCancellationType} settings.
261
+ *
262
+ * @default ActivityCancellationType.WAIT_CANCELLATION_COMPLETED
202
263
  */
264
+ // MAINTENANCE: Keep this typedoc in sync with the `ActivityCancellationType` enum
203
265
  cancellationType?: ActivityCancellationType;
204
266
 
205
267
  /**
@@ -0,0 +1,52 @@
1
+ import { temporal } from '@temporalio/proto';
2
+ import { makeProtoEnumConverters } from './internal-workflow';
3
+
4
+ /**
5
+ * Reason(s) why continue as new is suggested. Can potentially be multiple reasons.
6
+ *
7
+ * @experimental May be removed or changed in the future.
8
+ */
9
+ export const SuggestContinueAsNewReason = {
10
+ HISTORY_SIZE_TOO_LARGE: 'HISTORY_SIZE_TOO_LARGE',
11
+ TOO_MANY_HISTORY_EVENTS: 'TOO_MANY_HISTORY_EVENTS',
12
+ TOO_MANY_UPDATES: 'TOO_MANY_UPDATES',
13
+ } as const;
14
+ export type SuggestContinueAsNewReason = (typeof SuggestContinueAsNewReason)[keyof typeof SuggestContinueAsNewReason];
15
+
16
+ // ts-prune-ignore-next
17
+ export const [encodeSuggestContinueAsNewReason, decodeSuggestContinueAsNewReason] = makeProtoEnumConverters<
18
+ temporal.api.enums.v1.SuggestContinueAsNewReason,
19
+ typeof temporal.api.enums.v1.SuggestContinueAsNewReason,
20
+ keyof typeof temporal.api.enums.v1.SuggestContinueAsNewReason,
21
+ typeof SuggestContinueAsNewReason,
22
+ 'SUGGEST_CONTINUE_AS_NEW_REASON_'
23
+ >(
24
+ {
25
+ [SuggestContinueAsNewReason.HISTORY_SIZE_TOO_LARGE]: 1,
26
+ [SuggestContinueAsNewReason.TOO_MANY_HISTORY_EVENTS]: 2,
27
+ [SuggestContinueAsNewReason.TOO_MANY_UPDATES]: 3,
28
+ UNSPECIFIED: 0,
29
+ } as const,
30
+ 'SUGGEST_CONTINUE_AS_NEW_REASON_'
31
+ );
32
+
33
+ // ts-prune-ignore-next
34
+ export function suggestContinueAsNewReasonsFromProto(
35
+ reasons: temporal.api.enums.v1.SuggestContinueAsNewReason[] | null | undefined
36
+ ): SuggestContinueAsNewReason[] | undefined {
37
+ if (reasons == null) {
38
+ return undefined;
39
+ }
40
+
41
+ const res: SuggestContinueAsNewReason[] = [];
42
+ for (const r of reasons) {
43
+ const decoded = decodeSuggestContinueAsNewReason(r);
44
+ if (decoded !== undefined) {
45
+ res.push(decoded);
46
+ }
47
+ }
48
+ if (res.length === 0) {
49
+ return undefined;
50
+ }
51
+ return res;
52
+ }
@@ -23,6 +23,7 @@ import {
23
23
  import { makeProtoEnumConverters } from '../internal-workflow';
24
24
  import { isError } from '../type-helpers';
25
25
  import { msOptionalToTs } from '../time';
26
+ import { encode } from '../encoding';
26
27
  import { arrayFromPayloads, fromPayloadsAtIndex, PayloadConverter, toPayloads } from './payload-converter';
27
28
 
28
29
  // Can't import proto enums into the workflow sandbox, use this helper type and enum converter instead.
@@ -30,7 +31,6 @@ const NexusHandlerErrorRetryBehavior = {
30
31
  RETRYABLE: 'RETRYABLE',
31
32
  NON_RETRYABLE: 'NON_RETRYABLE',
32
33
  } as const;
33
-
34
34
  type NexusHandlerErrorRetryBehavior =
35
35
  (typeof NexusHandlerErrorRetryBehavior)[keyof typeof NexusHandlerErrorRetryBehavior];
36
36
 
@@ -58,13 +58,13 @@ function combineRegExp(...regexps: RegExp[]): RegExp {
58
58
  */
59
59
  const CUTOFF_STACK_PATTERNS = combineRegExp(
60
60
  /** Activity execution */
61
- /\s+at Activity\.execute \(.*[\\/]worker[\\/](?:src|lib)[\\/]activity\.[jt]s:\d+:\d+\)/,
61
+ /\s+at (Activity\.)?execute \(.*[\\/]worker[\\/](?:src|lib)[\\/]activity\.[jt]s:\d+:\d+\)/,
62
62
  /** Nexus execution */
63
- /\s+at( async)? NexusHandler\.invokeUserCode \(.*[\\/]worker[\\/](?:src|lib)[\\/]nexus[\\/]index\.[jt]s:\d+:\d+\)/,
64
- /** Workflow activation */
65
- /\s+at Activator\.\S+NextHandler \(.*[\\/]workflow[\\/](?:src|lib)[\\/]internals\.[jt]s:\d+:\d+\)/,
63
+ /\s+at( async)? (NexusHandler\.)?invokeUserCode \(.*[\\/]worker[\\/](?:src|lib)[\\/]nexus[\\/]index\.[jt]s:\d+:\d+\)/,
64
+ /** Workflow activation (inbound handlers only) */
65
+ /\s+at( async)? (Activator\.)?(startWorkflow|queryWorkflow|signalWorkflow|update|validateUpdate)NextHandler \(.*\.[jt]s:\d+:\d+\)/,
66
66
  /** Workflow run anything in context */
67
- /\s+at Script\.runInContext \((?:node:vm|vm\.js):\d+:\d+\)/
67
+ /\s+at (Script\.)?runInContext \(native|unknown|(?:(?:node:vm|vm\.js):\d+:\d+)\)/
68
68
  );
69
69
 
70
70
  /**
@@ -239,15 +239,17 @@ export class DefaultFailureConverter implements FailureConverter {
239
239
  break;
240
240
  }
241
241
 
242
- return new nexus.HandlerError(
243
- (failure.nexusHandlerFailureInfo.type as nexus.HandlerErrorType) ?? 'INTERNAL',
244
- // TODO(nexus/error): Maybe set a default message here, once we've decided on error handling.
245
- failure.message ?? undefined,
246
- {
247
- cause: this.optionalFailureToOptionalError(failure.cause, payloadConverter),
248
- retryableOverride,
249
- }
250
- );
242
+ const rawErrorType = failure.nexusHandlerFailureInfo.type || '';
243
+ const resolvedType: nexus.HandlerErrorType = Object.hasOwn(nexus.HandlerErrorType, rawErrorType)
244
+ ? nexus.HandlerErrorType[rawErrorType as keyof typeof nexus.HandlerErrorType]
245
+ : 'UNKNOWN';
246
+
247
+ return new nexus.HandlerError(resolvedType, failure.message ?? 'Nexus handler error', {
248
+ cause: this.optionalFailureToOptionalError(failure.cause, payloadConverter),
249
+ retryableOverride,
250
+ rawErrorType,
251
+ originalFailure: this.temporalFailureToNexusFailure(failure),
252
+ });
251
253
  }
252
254
  if (failure.nexusOperationExecutionFailureInfo) {
253
255
  return new NexusOperationFailure(
@@ -304,9 +306,6 @@ export class DefaultFailureConverter implements FailureConverter {
304
306
  }
305
307
 
306
308
  errorToFailureInner(err: unknown, payloadConverter: PayloadConverter): ProtoFailure {
307
- // TODO(nexus/error): If we decide not to have a NexusHandlerFailure, we could still attach the
308
- // failure proto to the Nexus HandlerError object, by using a private symbol
309
- // property. To be considered once we have a decision on error handling.
310
309
  if (err instanceof TemporalFailure || err instanceof nexus.HandlerError) {
311
310
  if (err instanceof TemporalFailure && err.failure) return err.failure;
312
311
  const base = {
@@ -387,28 +386,30 @@ export class DefaultFailureConverter implements FailureConverter {
387
386
  };
388
387
  }
389
388
  if (err instanceof nexus.HandlerError) {
390
- let retryBehavior: temporal.api.enums.v1.NexusHandlerErrorRetryBehavior | undefined = undefined;
391
- switch (err.retryableOverride) {
392
- case true:
393
- retryBehavior = encodeNexusHandlerErrorRetryBehavior('RETRYABLE');
394
- break;
395
- case false:
396
- retryBehavior = encodeNexusHandlerErrorRetryBehavior('NON_RETRYABLE');
397
- break;
398
- }
389
+ if (err.originalFailure) {
390
+ return this.nexusFailureToTemporalFailure(err.originalFailure, err.retryable);
391
+ } else {
392
+ let retryBehavior: temporal.api.enums.v1.NexusHandlerErrorRetryBehavior | undefined = undefined;
393
+ switch (err.retryableOverride) {
394
+ case true:
395
+ retryBehavior = encodeNexusHandlerErrorRetryBehavior('RETRYABLE');
396
+ break;
397
+ case false:
398
+ retryBehavior = encodeNexusHandlerErrorRetryBehavior('NON_RETRYABLE');
399
+ break;
400
+ }
399
401
 
400
- return {
401
- // TODO(nexus/error): Maybe set a default message here, once we've decided on error handling.
402
- ...base,
403
- nexusHandlerFailureInfo: {
404
- type: err.type,
405
- retryBehavior,
406
- },
407
- };
402
+ return {
403
+ ...base,
404
+ nexusHandlerFailureInfo: {
405
+ type: err.type,
406
+ retryBehavior,
407
+ },
408
+ };
409
+ }
408
410
  }
409
411
  if (err instanceof NexusOperationFailure) {
410
412
  return {
411
- // TODO(nexus/error): Maybe set a default message here, once we've decided on error handling.
412
413
  ...base,
413
414
  nexusOperationExecutionFailureInfo: {
414
415
  scheduledEventId: err.scheduledEventId ? Long.fromNumber(err.scheduledEventId) : undefined,
@@ -430,7 +431,7 @@ export class DefaultFailureConverter implements FailureConverter {
430
431
  if (isError(err)) {
431
432
  return {
432
433
  ...base,
433
- message: String(err.message) ?? '',
434
+ message: String(err.message ?? ''),
434
435
  stackTrace: cutoffStackTrace(err.stack),
435
436
  cause: this.optionalErrorToOptionalFailure((err as any).cause, payloadConverter),
436
437
  };
@@ -470,4 +471,40 @@ export class DefaultFailureConverter implements FailureConverter {
470
471
  optionalErrorToOptionalFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure | undefined {
471
472
  return err ? this.errorToFailure(err, payloadConverter) : undefined;
472
473
  }
474
+
475
+ private nexusFailureToTemporalFailure(failure: nexus.Failure, retryable: boolean): ProtoFailure {
476
+ if (failure.metadata?.type === 'temporal.api.failure.v1.Failure') {
477
+ if (failure.details == null) {
478
+ throw new TypeError("missing details for Nexus Failure of type 'temporal.api.failure.v1.Failure'");
479
+ }
480
+ return failure.details;
481
+ } else {
482
+ const temporalFailure: ProtoFailure = {};
483
+ temporalFailure.applicationFailureInfo = {
484
+ type: 'NexusFailure',
485
+ nonRetryable: !retryable,
486
+ details: {
487
+ payloads: [
488
+ {
489
+ metadata: { encoding: encode('json/plain') },
490
+ data: encode(JSON.stringify({ ...failure, message: '' })),
491
+ },
492
+ ],
493
+ },
494
+ };
495
+ temporalFailure.message = failure.message;
496
+ temporalFailure.stackTrace = failure.stackTrace ?? '';
497
+ return temporalFailure;
498
+ }
499
+ }
500
+
501
+ private temporalFailureToNexusFailure(failure: ProtoFailure): nexus.Failure {
502
+ return {
503
+ message: failure.message ?? '',
504
+ metadata: { type: 'temporal.api.failure.v1.Failure' },
505
+ // Store the full ProtoFailure as the Nexus failure details so it can be round-tripped
506
+ // losslessly back to a ProtoFailure via nexusFailureToTemporalFailure.
507
+ details: { ...failure },
508
+ };
509
+ }
473
510
  }
@@ -164,7 +164,7 @@ export const typedSearchAttributePayloadConverter = new TypedSearchAttributePayl
164
164
 
165
165
  // If both params are provided, conflicting keys will be overwritten by typedSearchAttributes.
166
166
  export function encodeUnifiedSearchAttributes(
167
- searchAttributes?: SearchAttributes, // eslint-disable-line deprecation/deprecation
167
+ searchAttributes?: SearchAttributes, // eslint-disable-line @typescript-eslint/no-deprecated
168
168
  typedSearchAttributes?: TypedSearchAttributes | SearchAttributeUpdatePair[]
169
169
  ): Record<string, Payload> {
170
170
  return {
@@ -184,11 +184,11 @@ export function encodeUnifiedSearchAttributes(
184
184
  };
185
185
  }
186
186
 
187
- // eslint-disable-next-line deprecation/deprecation
187
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
188
188
  export function decodeSearchAttributes(indexedFields: Record<string, Payload> | undefined | null): SearchAttributes {
189
189
  if (!indexedFields) return {};
190
190
  return Object.fromEntries(
191
- // eslint-disable-next-line deprecation/deprecation
191
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
192
192
  Object.entries(mapFromPayloads(searchAttributePayloadConverter, indexedFields) as SearchAttributes).filter(
193
193
  ([_, v]) => v && v.length > 0
194
194
  ) // Filter out empty arrays returned by pre 1.18 servers
package/src/errors.ts CHANGED
@@ -53,3 +53,23 @@ export class NamespaceNotFoundError extends Error {
53
53
  super(`Namespace not found: '${namespace}'`);
54
54
  }
55
55
  }
56
+
57
+ /**
58
+ * Throw this error from an Activity in order to make the Worker forget about this Activity.
59
+ *
60
+ * The Activity can then be completed asynchronously (from anywhere—usually outside the Worker) using
61
+ * the Client's activity handle.
62
+ *
63
+ * @example
64
+ *
65
+ * ```ts
66
+ *import { CompleteAsyncError } from '@temporalio/activity';
67
+ *
68
+ *export async function myActivity(): Promise<never> {
69
+ * // ...
70
+ * throw new CompleteAsyncError();
71
+ *}
72
+ * ```
73
+ */
74
+ @SymbolBasedInstanceOfError('CompleteAsyncError')
75
+ export class CompleteAsyncError extends Error {}