@temporalio/workflow 1.8.6 → 1.9.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/alea.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"alea.js","sourceRoot":"","sources":["../src/alea.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iDAAiD;AACjD,0EAA0E;AAC1E,uCAAuC;;;AAEvC,4DAA4D;AAC5D,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,4EAA4E;AAC5E,wEAAwE;AACxE,2DAA2D;AAC3D,EAAE;AACF,6EAA6E;AAC7E,sDAAsD;AACtD,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,4EAA4E;AAC5E,gBAAgB;AAEhB,2FAA2F;AAE3F,MAAM,IAAI;IAMR,YAAY,IAAc;QACxB,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,2CAA2C;QAC3C,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;YACf,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;SACd;QACD,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,IAAI,CAAC,EAAE,G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poralio/proto';
1
2
  /**
2
3
  * Base class for all workflow errors
3
4
  */
@@ -8,6 +9,13 @@ export declare class WorkflowError extends Error {
8
9
  */
9
10
  export declare class DeterminismViolationError extends WorkflowError {
10
11
  }
12
+ /**
13
+ * A class that acts as a marker for this special result type
14
+ */
15
+ export declare class LocalActivityDoBackoff extends Error {
16
+ readonly backoff: coresdk.activity_result.IDoBackoff;
17
+ constructor(backoff: coresdk.activity_result.IDoBackoff);
18
+ }
11
19
  /**
12
20
  * Returns whether provided `err` is caused by cancellation
13
21
  */
package/lib/errors.js CHANGED
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.isCancellation = exports.DeterminismViolationError = exports.WorkflowError = void 0;
9
+ exports.isCancellation = exports.LocalActivityDoBackoff = exports.DeterminismViolationError = exports.WorkflowError = void 0;
10
10
  const common_1 = require("@temporalio/common");
11
11
  const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
12
12
  /**
@@ -14,19 +14,32 @@ const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
14
14
  */
15
15
  let WorkflowError = class WorkflowError extends Error {
16
16
  };
17
- WorkflowError = __decorate([
17
+ exports.WorkflowError = WorkflowError;
18
+ exports.WorkflowError = WorkflowError = __decorate([
18
19
  (0, type_helpers_1.SymbolBasedInstanceOfError)('WorkflowError')
19
20
  ], WorkflowError);
20
- exports.WorkflowError = WorkflowError;
21
21
  /**
22
22
  * Thrown in workflow when it tries to do something that non-deterministic such as construct a WeakRef()
23
23
  */
24
24
  let DeterminismViolationError = class DeterminismViolationError extends WorkflowError {
25
25
  };
26
- DeterminismViolationError = __decorate([
26
+ exports.DeterminismViolationError = DeterminismViolationError;
27
+ exports.DeterminismViolationError = DeterminismViolationError = __decorate([
27
28
  (0, type_helpers_1.SymbolBasedInstanceOfError)('DeterminismViolationError')
28
29
  ], DeterminismViolationError);
29
- exports.DeterminismViolationError = DeterminismViolationError;
30
+ /**
31
+ * A class that acts as a marker for this special result type
32
+ */
33
+ let LocalActivityDoBackoff = class LocalActivityDoBackoff extends Error {
34
+ constructor(backoff) {
35
+ super();
36
+ this.backoff = backoff;
37
+ }
38
+ };
39
+ exports.LocalActivityDoBackoff = LocalActivityDoBackoff;
40
+ exports.LocalActivityDoBackoff = LocalActivityDoBackoff = __decorate([
41
+ (0, type_helpers_1.SymbolBasedInstanceOfError)('LocalActivityDoBackoff')
42
+ ], LocalActivityDoBackoff);
30
43
  /**
31
44
  * Returns whether provided `err` is caused by cancellation
32
45
  */
package/lib/errors.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA6F;AAC7F,sEAAiF;AAEjF;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;CAAG,CAAA;AAA9B,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAAiB;AAA9B,sCAAa;AAE1B;;GAEG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,aAAa;CAAG,CAAA;AAAlD,yBAAyB;IADrC,IAAA,yCAA0B,EAAC,2BAA2B,CAAC;GAC3C,yBAAyB,CAAyB;AAAlD,8DAAyB;AAEtC;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAY;IACzC,OAAO,CACL,GAAG,YAAY,yBAAgB;QAC/B,CAAC,CAAC,GAAG,YAAY,wBAAe,IAAI,GAAG,YAAY,6BAAoB,CAAC,IAAI,GAAG,CAAC,KAAK,YAAY,yBAAgB,CAAC,CACnH,CAAC;AACJ,CAAC;AALD,wCAKC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAA6F;AAC7F,sEAAiF;AAGjF;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;CAAG,CAAA;AAA9B,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAAiB;AAE3C;;GAEG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,aAAa;CAAG,CAAA;AAAlD,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,yCAA0B,EAAC,2BAA2B,CAAC;GAC3C,yBAAyB,CAAyB;AAE/D;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,KAAK;IAC/C,YAA4B,OAA2C;QACrE,KAAK,EAAE,CAAC;QADkB,YAAO,GAAP,OAAO,CAAoC;IAEvE,CAAC;CACF,CAAA;AAJY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,yCAA0B,EAAC,wBAAwB,CAAC;GACxC,sBAAsB,CAIlC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAY;IACzC,OAAO,CACL,GAAG,YAAY,yBAAgB;QAC/B,CAAC,CAAC,GAAG,YAAY,wBAAe,IAAI,GAAG,YAAY,6BAAoB,CAAC,IAAI,GAAG,CAAC,KAAK,YAAY,yBAAgB,CAAC,CACnH,CAAC;AACJ,CAAC;AALD,wCAKC"}
@@ -1,2 +1,6 @@
1
+ import { type Activator } from './internals';
1
2
  export declare function maybeGetActivatorUntyped(): unknown;
2
3
  export declare function setActivatorUntyped(activator: unknown): void;
4
+ export declare function maybeGetActivator(): Activator | undefined;
5
+ export declare function assertInWorkflowContext(message: string): Activator;
6
+ export declare function getActivator(): Activator;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setActivatorUntyped = exports.maybeGetActivatorUntyped = void 0;
3
+ exports.getActivator = exports.assertInWorkflowContext = exports.maybeGetActivator = exports.setActivatorUntyped = exports.maybeGetActivatorUntyped = void 0;
4
+ const common_1 = require("@temporalio/common");
4
5
  function maybeGetActivatorUntyped() {
5
6
  return globalThis.__TEMPORAL_ACTIVATOR__;
6
7
  }
@@ -9,4 +10,23 @@ function setActivatorUntyped(activator) {
9
10
  globalThis.__TEMPORAL_ACTIVATOR__ = activator;
10
11
  }
11
12
  exports.setActivatorUntyped = setActivatorUntyped;
13
+ function maybeGetActivator() {
14
+ return maybeGetActivatorUntyped();
15
+ }
16
+ exports.maybeGetActivator = maybeGetActivator;
17
+ function assertInWorkflowContext(message) {
18
+ const activator = maybeGetActivator();
19
+ if (activator == null)
20
+ throw new common_1.IllegalStateError(message);
21
+ return activator;
22
+ }
23
+ exports.assertInWorkflowContext = assertInWorkflowContext;
24
+ function getActivator() {
25
+ const activator = maybeGetActivator();
26
+ if (activator === undefined) {
27
+ throw new common_1.IllegalStateError('Workflow uninitialized');
28
+ }
29
+ return activator;
30
+ }
31
+ exports.getActivator = getActivator;
12
32
  //# sourceMappingURL=global-attributes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-attributes.js","sourceRoot":"","sources":["../src/global-attributes.ts"],"names":[],"mappings":";;;AAAA,SAAgB,wBAAwB;IACtC,OAAQ,UAAkB,CAAC,sBAAsB,CAAC;AACpD,CAAC;AAFD,4DAEC;AAED,SAAgB,mBAAmB,CAAC,SAAkB;IACnD,UAAkB,CAAC,sBAAsB,GAAG,SAAS,CAAC;AACzD,CAAC;AAFD,kDAEC"}
1
+ {"version":3,"file":"global-attributes.js","sourceRoot":"","sources":["../src/global-attributes.ts"],"names":[],"mappings":";;;AAAA,+CAAuD;AAGvD,SAAgB,wBAAwB;IACtC,OAAQ,UAAkB,CAAC,sBAAsB,CAAC;AACpD,CAAC;AAFD,4DAEC;AAED,SAAgB,mBAAmB,CAAC,SAAkB;IACnD,UAAkB,CAAC,sBAAsB,GAAG,SAAS,CAAC;AACzD,CAAC;AAFD,kDAEC;AAED,SAAgB,iBAAiB;IAC/B,OAAO,wBAAwB,EAA2B,CAAC;AAC7D,CAAC;AAFD,8CAEC;AAED,SAAgB,uBAAuB,CAAC,OAAe;IACrD,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;IACtC,IAAI,SAAS,IAAI,IAAI;QAAE,MAAM,IAAI,0BAAiB,CAAC,OAAO,CAAC,CAAC;IAC5D,OAAO,SAAS,CAAC;AACnB,CAAC;AAJD,0DAIC;AAED,SAAgB,YAAY;IAC1B,MAAM,SAAS,GAAG,iBAAiB,EAAE,CAAC;IACtC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC5B,MAAM,IAAI,0BAAiB,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAND,oCAMC"}
package/lib/index.d.ts CHANGED
@@ -20,18 +20,21 @@
20
20
  * <!--SNIPSTART typescript-schedule-activity-workflow-->
21
21
  * <!--SNIPEND-->
22
22
  *
23
- * ### Signals and Queries
23
+ * ### Updates, Signals and Queries
24
24
  *
25
- * To add signal handlers to a Workflow, add a signals property to the exported `workflow` object. Signal handlers can
26
- * return either `void` or `Promise<void>`, you may schedule activities and timers from a signal handler.
25
+ * Use {@link setHandler} to set handlers for Updates, Signals, and Queries.
27
26
  *
28
- * To add query handlers to a Workflow, add a queries property to the exported `workflow` object. Query handlers must
29
- * **not** mutate any variables or generate any commands (like Activities or Timers), they run synchronously and thus
30
- * **must** return a `Promise`.
27
+ * Update and Signal handlers can be either async or non-async functions. Update handlers may return a value, but signal
28
+ * handlers may not (return `void` or `Promise<void>`). You may use Activities, Timers, child Workflows, etc in Update
29
+ * and Signal handlers, but this should be done cautiously: for example, note that if you await async operations such as
30
+ * these in an Update or Signal handler, then you are responsible for ensuring that the workflow does not complete first.
31
+ *
32
+ * Query handlers may **not** be async functions, and may **not** mutate any variables or use Activities, Timers,
33
+ * child Workflows, etc.
31
34
  *
32
35
  * #### Implementation
33
36
  *
34
- * <!--SNIPSTART typescript-workflow-signal-implementation-->
37
+ * <!--SNIPSTART typescript-workflow-update-signal-query-example-->
35
38
  * <!--SNIPEND-->
36
39
  *
37
40
  * ### More
@@ -55,7 +58,15 @@ export { AsyncLocalStorage, CancellationScope, CancellationScopeOptions } from '
55
58
  export * from './errors';
56
59
  export * from './interceptors';
57
60
  export { ChildWorkflowCancellationType, ChildWorkflowOptions, ContinueAsNew, ContinueAsNewOptions, EnhancedStackTrace, FileLocation, FileSlice, ParentClosePolicy, ParentWorkflowInfo, SDKInfo, StackTrace, UnsafeWorkflowInfo, WorkflowInfo, } from './interfaces';
58
- export { LoggerSinks, Sink, SinkCall, SinkFunction, Sinks } from './sinks';
61
+ export { proxySinks, Sink, SinkCall, SinkFunction, Sinks } from './sinks';
62
+ export { log } from './logs';
59
63
  export { Trigger } from './trigger';
60
64
  export * from './workflow';
61
65
  export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
66
+ export {
67
+ /**
68
+ * @deprecated Do not use LoggerSinks directly. To log from Workflow code, use the `log` object
69
+ * exported by the `@temporalio/workflow` package. To capture log messages emitted
70
+ * by Workflow code, set the {@link Runtime.logger} property.
71
+ */
72
+ LoggerSinksDeprecated as LoggerSinks, } from './logs';
package/lib/index.js CHANGED
@@ -21,18 +21,21 @@
21
21
  * <!--SNIPSTART typescript-schedule-activity-workflow-->
22
22
  * <!--SNIPEND-->
23
23
  *
24
- * ### Signals and Queries
24
+ * ### Updates, Signals and Queries
25
25
  *
26
- * To add signal handlers to a Workflow, add a signals property to the exported `workflow` object. Signal handlers can
27
- * return either `void` or `Promise<void>`, you may schedule activities and timers from a signal handler.
26
+ * Use {@link setHandler} to set handlers for Updates, Signals, and Queries.
28
27
  *
29
- * To add query handlers to a Workflow, add a queries property to the exported `workflow` object. Query handlers must
30
- * **not** mutate any variables or generate any commands (like Activities or Timers), they run synchronously and thus
31
- * **must** return a `Promise`.
28
+ * Update and Signal handlers can be either async or non-async functions. Update handlers may return a value, but signal
29
+ * handlers may not (return `void` or `Promise<void>`). You may use Activities, Timers, child Workflows, etc in Update
30
+ * and Signal handlers, but this should be done cautiously: for example, note that if you await async operations such as
31
+ * these in an Update or Signal handler, then you are responsible for ensuring that the workflow does not complete first.
32
+ *
33
+ * Query handlers may **not** be async functions, and may **not** mutate any variables or use Activities, Timers,
34
+ * child Workflows, etc.
32
35
  *
33
36
  * #### Implementation
34
37
  *
35
- * <!--SNIPSTART typescript-workflow-signal-implementation-->
38
+ * <!--SNIPSTART typescript-workflow-update-signal-query-example-->
36
39
  * <!--SNIPEND-->
37
40
  *
38
41
  * ### More
@@ -61,7 +64,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
61
64
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
62
65
  };
63
66
  Object.defineProperty(exports, "__esModule", { value: true });
64
- exports.Trigger = exports.ParentClosePolicy = exports.ContinueAsNew = exports.ChildWorkflowCancellationType = exports.CancellationScope = exports.AsyncLocalStorage = exports.TimeoutFailure = exports.TerminatedFailure = exports.TemporalFailure = exports.ServerFailure = exports.rootCause = exports.defaultPayloadConverter = exports.ChildWorkflowFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ActivityFailure = exports.ActivityCancellationType = void 0;
67
+ exports.Trigger = exports.log = exports.proxySinks = exports.ParentClosePolicy = exports.ContinueAsNew = exports.ChildWorkflowCancellationType = exports.CancellationScope = exports.AsyncLocalStorage = exports.TimeoutFailure = exports.TerminatedFailure = exports.TemporalFailure = exports.ServerFailure = exports.rootCause = exports.defaultPayloadConverter = exports.ChildWorkflowFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ActivityFailure = exports.ActivityCancellationType = void 0;
65
68
  var common_1 = require("@temporalio/common");
66
69
  Object.defineProperty(exports, "ActivityCancellationType", { enumerable: true, get: function () { return common_1.ActivityCancellationType; } });
67
70
  Object.defineProperty(exports, "ActivityFailure", { enumerable: true, get: function () { return common_1.ActivityFailure; } });
@@ -86,6 +89,10 @@ var interfaces_1 = require("./interfaces");
86
89
  Object.defineProperty(exports, "ChildWorkflowCancellationType", { enumerable: true, get: function () { return interfaces_1.ChildWorkflowCancellationType; } });
87
90
  Object.defineProperty(exports, "ContinueAsNew", { enumerable: true, get: function () { return interfaces_1.ContinueAsNew; } });
88
91
  Object.defineProperty(exports, "ParentClosePolicy", { enumerable: true, get: function () { return interfaces_1.ParentClosePolicy; } });
92
+ var sinks_1 = require("./sinks");
93
+ Object.defineProperty(exports, "proxySinks", { enumerable: true, get: function () { return sinks_1.proxySinks; } });
94
+ var logs_1 = require("./logs");
95
+ Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logs_1.log; } });
89
96
  var trigger_1 = require("./trigger");
90
97
  Object.defineProperty(exports, "Trigger", { enumerable: true, get: function () { return trigger_1.Trigger; } });
91
98
  __exportStar(require("./workflow"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;;;;;;;;;;;;;;;;;AAEH,6CAe4B;AAd1B,kHAAA,wBAAwB,OAAA;AACxB,yGAAA,eAAe,OAAA;AAEf,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AACpB,iHAAA,uBAAuB,OAAA;AAGvB,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AAEhB,gEAA8C;AAgB9C,yEAAuD;AACvD,0EAAwD;AACxD,2DAAsG;AAA7F,uHAAA,iBAAiB,OAAA;AAAE,uHAAA,iBAAiB,OAAA;AAC7C,2CAAyB;AACzB,iDAA+B;AAC/B,2CAcsB;AAbpB,2HAAA,6BAA6B,OAAA;AAE7B,2GAAA,aAAa,OAAA;AAKb,+GAAA,iBAAiB,OAAA;AAQnB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,6CAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;;;;;;;;;;;;;;;;;AAEH,6CAe4B;AAd1B,kHAAA,wBAAwB,OAAA;AACxB,yGAAA,eAAe,OAAA;AAEf,4GAAA,kBAAkB,OAAA;AAClB,0GAAA,gBAAgB,OAAA;AAChB,8GAAA,oBAAoB,OAAA;AACpB,iHAAA,uBAAuB,OAAA;AAGvB,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AACb,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,wGAAA,cAAc,OAAA;AAEhB,gEAA8C;AAgB9C,yEAAuD;AACvD,0EAAwD;AACxD,2DAAsG;AAA7F,uHAAA,iBAAiB,OAAA;AAAE,uHAAA,iBAAiB,OAAA;AAC7C,2CAAyB;AACzB,iDAA+B;AAC/B,2CAcsB;AAbpB,2HAAA,6BAA6B,OAAA;AAE7B,2GAAA,aAAa,OAAA;AAKb,+GAAA,iBAAiB,OAAA;AAOnB,iCAA0E;AAAjE,mGAAA,UAAU,OAAA;AACnB,+BAA6B;AAApB,2FAAA,GAAG,OAAA;AACZ,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,6CAA2B"}
@@ -14,6 +14,14 @@ export interface WorkflowExecuteInput {
14
14
  readonly args: unknown[];
15
15
  readonly headers: Headers;
16
16
  }
17
+ /** Input for WorkflowInboundCallsInterceptor.handleUpdate and
18
+ * WorkflowInboundCallsInterceptor.validateUpdate */
19
+ export interface UpdateInput {
20
+ readonly updateId: string;
21
+ readonly name: string;
22
+ readonly args: unknown[];
23
+ readonly headers: Headers;
24
+ }
17
25
  /** Input for WorkflowInboundCallsInterceptor.handleSignal */
18
26
  export interface SignalInput {
19
27
  readonly signalName: string;
@@ -37,6 +45,13 @@ export interface WorkflowInboundCallsInterceptor {
37
45
  * @return result of the Workflow execution
38
46
  */
39
47
  execute?: (input: WorkflowExecuteInput, next: Next<this, 'execute'>) => Promise<unknown>;
48
+ /** Called when Update handler is called
49
+ *
50
+ * @return result of the Update
51
+ */
52
+ handleUpdate?: (input: UpdateInput, next: Next<this, 'handleUpdate'>) => Promise<unknown>;
53
+ /** Called when update validator called */
54
+ validateUpdate?: (input: UpdateInput, next: Next<this, 'validateUpdate'>) => void;
40
55
  /** Called when signal is delivered to a Workflow execution */
41
56
  handleSignal?: (input: SignalInput, next: Next<this, 'handleSignal'>) => Promise<void>;
42
57
  /**
@@ -1,5 +1,5 @@
1
1
  import type { RawSourceMap } from 'source-map';
2
- import { RetryPolicy, TemporalFailure, CommonWorkflowOptions, SearchAttributes, SignalDefinition, QueryDefinition, Duration, VersioningIntent } from '@temporalio/common';
2
+ import { RetryPolicy, TemporalFailure, CommonWorkflowOptions, SearchAttributes, SignalDefinition, UpdateDefinition, QueryDefinition, Duration, VersioningIntent } from '@temporalio/common';
3
3
  import type { coresdk } from '@temporalio/proto';
4
4
  /**
5
5
  * Workflow Execution information
@@ -9,39 +9,39 @@ export interface WorkflowInfo {
9
9
  * ID of the Workflow, this can be set by the client during Workflow creation.
10
10
  * A single Workflow may run multiple times e.g. when scheduled with cron.
11
11
  */
12
- workflowId: string;
12
+ readonly workflowId: string;
13
13
  /**
14
14
  * ID of a single Workflow run
15
15
  */
16
- runId: string;
16
+ readonly runId: string;
17
17
  /**
18
18
  * Workflow function's name
19
19
  */
20
- workflowType: string;
20
+ readonly workflowType: string;
21
21
  /**
22
22
  * Indexed information attached to the Workflow Execution
23
23
  *
24
24
  * This value may change during the lifetime of an Execution.
25
25
  */
26
- searchAttributes: SearchAttributes;
26
+ readonly searchAttributes: SearchAttributes;
27
27
  /**
28
28
  * Non-indexed information attached to the Workflow Execution
29
29
  */
30
- memo?: Record<string, unknown>;
30
+ readonly memo?: Record<string, unknown>;
31
31
  /**
32
32
  * Parent Workflow info (present if this is a Child Workflow)
33
33
  */
34
- parent?: ParentWorkflowInfo;
34
+ readonly parent?: ParentWorkflowInfo;
35
35
  /**
36
36
  * Result from the previous Run (present if this is a Cron Workflow or was Continued As New).
37
37
  *
38
38
  * An array of values, since other SDKs may return multiple values from a Workflow.
39
39
  */
40
- lastResult?: unknown;
40
+ readonly lastResult?: unknown;
41
41
  /**
42
42
  * Failure from the previous Run (present when this Run is a retry, or the last Run of a Cron Workflow failed)
43
43
  */
44
- lastFailure?: TemporalFailure;
44
+ readonly lastFailure?: TemporalFailure;
45
45
  /**
46
46
  * Length of Workflow history up until the current Workflow Task.
47
47
  *
@@ -49,7 +49,7 @@ export interface WorkflowInfo {
49
49
  *
50
50
  * You may safely use this information to decide when to {@link continueAsNew}.
51
51
  */
52
- historyLength: number;
52
+ readonly historyLength: number;
53
53
  /**
54
54
  * Size of Workflow history in bytes until the current Workflow Task.
55
55
  *
@@ -59,7 +59,7 @@ export interface WorkflowInfo {
59
59
  *
60
60
  * You may safely use this information to decide when to {@link continueAsNew}.
61
61
  */
62
- historySize: number;
62
+ readonly historySize: number;
63
63
  /**
64
64
  * A hint provided by the current WorkflowTaskStarted event recommending whether to
65
65
  * {@link continueAsNew}.
@@ -68,64 +68,71 @@ export interface WorkflowInfo {
68
68
  *
69
69
  * Supported only on Temporal Server 1.20+, always `false` on older servers.
70
70
  */
71
- continueAsNewSuggested: boolean;
71
+ readonly continueAsNewSuggested: boolean;
72
72
  /**
73
73
  * Task queue this Workflow is executing on
74
74
  */
75
- taskQueue: string;
75
+ readonly taskQueue: string;
76
76
  /**
77
77
  * Namespace this Workflow is executing in
78
78
  */
79
- namespace: string;
79
+ readonly namespace: string;
80
80
  /**
81
81
  * Run Id of the first Run in this Execution Chain
82
82
  */
83
- firstExecutionRunId: string;
83
+ readonly firstExecutionRunId: string;
84
84
  /**
85
85
  * The last Run Id in this Execution Chain
86
86
  */
87
- continuedFromExecutionRunId?: string;
87
+ readonly continuedFromExecutionRunId?: string;
88
88
  /**
89
89
  * Time at which this [Workflow Execution Chain](https://docs.temporal.io/workflows#workflow-execution-chain) was started
90
90
  */
91
- startTime: Date;
91
+ readonly startTime: Date;
92
92
  /**
93
93
  * Time at which the current Workflow Run started
94
94
  */
95
- runStartTime: Date;
95
+ readonly runStartTime: Date;
96
96
  /**
97
97
  * Milliseconds after which the Workflow Execution is automatically terminated by Temporal Server. Set via {@link WorkflowOptions.workflowExecutionTimeout}.
98
98
  */
99
- executionTimeoutMs?: number;
99
+ readonly executionTimeoutMs?: number;
100
100
  /**
101
101
  * Time at which the Workflow Execution expires
102
102
  */
103
- executionExpirationTime?: Date;
103
+ readonly executionExpirationTime?: Date;
104
104
  /**
105
105
  * Milliseconds after which the Workflow Run is automatically terminated by Temporal Server. Set via {@link WorkflowOptions.workflowRunTimeout}.
106
106
  */
107
- runTimeoutMs?: number;
107
+ readonly runTimeoutMs?: number;
108
108
  /**
109
109
  * Maximum execution time of a Workflow Task in milliseconds. Set via {@link WorkflowOptions.workflowTaskTimeout}.
110
110
  */
111
- taskTimeoutMs: number;
111
+ readonly taskTimeoutMs: number;
112
112
  /**
113
113
  * Retry Policy for this Execution. Set via {@link WorkflowOptions.retry}.
114
114
  */
115
- retryPolicy?: RetryPolicy;
115
+ readonly retryPolicy?: RetryPolicy;
116
116
  /**
117
117
  * Starts at 1 and increments for every retry if there is a `retryPolicy`
118
118
  */
119
- attempt: number;
119
+ readonly attempt: number;
120
120
  /**
121
121
  * Cron Schedule for this Execution. Set via {@link WorkflowOptions.cronSchedule}.
122
122
  */
123
- cronSchedule?: string;
123
+ readonly cronSchedule?: string;
124
124
  /**
125
125
  * Milliseconds between Cron Runs
126
126
  */
127
- cronScheduleToScheduleInterval?: number;
128
- unsafe: UnsafeWorkflowInfo;
127
+ readonly cronScheduleToScheduleInterval?: number;
128
+ /**
129
+ * The Build ID of the worker which executed the current Workflow Task. May be undefined if the
130
+ * task was completed by a worker without a Build ID. If this worker is the one executing this
131
+ * task for the first time and has a Build ID set, then its ID will be used. This value may change
132
+ * over the lifetime of the workflow run, but is deterministic and safe to use for branching.
133
+ */
134
+ readonly currentBuildId?: string;
135
+ readonly unsafe: UnsafeWorkflowInfo;
129
136
  }
130
137
  /**
131
138
  * Unsafe information about the current Workflow Execution.
@@ -139,8 +146,8 @@ export interface UnsafeWorkflowInfo {
139
146
  * The safe version of time is `new Date()` and `Date.now()`, which are set on the first invocation of a Workflow
140
147
  * Task and stay constant for the duration of the Task and during replay.
141
148
  */
142
- now(): number;
143
- isReplaying: boolean;
149
+ readonly now: () => number;
150
+ readonly isReplaying: boolean;
144
151
  }
145
152
  export interface ParentWorkflowInfo {
146
153
  workflowId: string;
@@ -188,6 +195,8 @@ export interface ContinueAsNewOptions {
188
195
  * When using the Worker Versioning feature, specifies whether this Workflow should
189
196
  * Continue-as-New onto a worker with a compatible Build Id or not. See {@link VersioningIntent}.
190
197
  *
198
+ * @default 'COMPATIBLE'
199
+ *
191
200
  * @experimental
192
201
  */
193
202
  versioningIntent?: VersioningIntent;
@@ -279,6 +288,8 @@ export interface ChildWorkflowOptions extends CommonWorkflowOptions {
279
288
  * When using the Worker Versioning feature, specifies whether this Child Workflow should run on
280
289
  * a worker with a compatible Build Id or not. See {@link VersioningIntent}.
281
290
  *
291
+ * @default 'COMPATIBLE'
292
+ *
282
293
  * @experimental
283
294
  */
284
295
  versioningIntent?: VersioningIntent;
@@ -356,10 +367,14 @@ export interface WorkflowCreateOptionsInternal extends WorkflowCreateOptions {
356
367
  getTimeOfDay(): bigint;
357
368
  }
358
369
  /**
359
- * A handler function capable of accepting the arguments for a given SignalDefinition or QueryDefinition.
370
+ * A handler function capable of accepting the arguments for a given UpdateDefinition, SignalDefinition or QueryDefinition.
360
371
  */
361
- export type Handler<Ret, Args extends any[], T extends SignalDefinition<Args> | QueryDefinition<Ret, Args>> = T extends SignalDefinition<infer A> ? (...args: A) => void | Promise<void> : T extends QueryDefinition<infer R, infer A> ? (...args: A) => R : never;
372
+ export type Handler<Ret, Args extends any[], T extends UpdateDefinition<Ret, Args> | SignalDefinition<Args> | QueryDefinition<Ret, Args>> = T extends UpdateDefinition<infer R, infer A> ? (...args: A) => R | Promise<R> : T extends SignalDefinition<infer A> ? (...args: A) => void | Promise<void> : T extends QueryDefinition<infer R, infer A> ? (...args: A) => R : never;
362
373
  /**
363
- * A handler function accepting signals calls for non-registered signal names.
374
+ * A handler function accepting signal calls for non-registered signal names.
364
375
  */
365
376
  export type DefaultSignalHandler = (signalName: string, ...args: unknown[]) => void | Promise<void>;
377
+ /**
378
+ * A validation function capable of accepting the arguments for a given UpdateDefinition.
379
+ */
380
+ export type UpdateValidator<Args extends any[]> = (...args: Args) => void;
package/lib/interfaces.js CHANGED
@@ -17,10 +17,10 @@ let ContinueAsNew = class ContinueAsNew extends Error {
17
17
  this.command = command;
18
18
  }
19
19
  };
20
- ContinueAsNew = __decorate([
20
+ exports.ContinueAsNew = ContinueAsNew;
21
+ exports.ContinueAsNew = ContinueAsNew = __decorate([
21
22
  (0, type_helpers_1.SymbolBasedInstanceOfError)('ContinueAsNew')
22
23
  ], ContinueAsNew);
23
- exports.ContinueAsNew = ContinueAsNew;
24
24
  /**
25
25
  * Specifies:
26
26
  * - whether cancellation requests are sent to the Child
@@ -52,7 +52,7 @@ var ChildWorkflowCancellationType;
52
52
  * Send a cancellation request to the Child. Throw the error once the Server receives the Child cancellation request.
53
53
  */
54
54
  ChildWorkflowCancellationType[ChildWorkflowCancellationType["WAIT_CANCELLATION_REQUESTED"] = 3] = "WAIT_CANCELLATION_REQUESTED";
55
- })(ChildWorkflowCancellationType = exports.ChildWorkflowCancellationType || (exports.ChildWorkflowCancellationType = {}));
55
+ })(ChildWorkflowCancellationType || (exports.ChildWorkflowCancellationType = ChildWorkflowCancellationType = {}));
56
56
  (0, type_helpers_1.checkExtends)();
57
57
  (0, type_helpers_1.checkExtends)();
58
58
  /**
@@ -80,7 +80,7 @@ var ParentClosePolicy;
80
80
  * When the Parent is Closed, the Child is Cancelled.
81
81
  */
82
82
  ParentClosePolicy[ParentClosePolicy["PARENT_CLOSE_POLICY_REQUEST_CANCEL"] = 3] = "PARENT_CLOSE_POLICY_REQUEST_CANCEL";
83
- })(ParentClosePolicy = exports.ParentClosePolicy || (exports.ParentClosePolicy = {}));
83
+ })(ParentClosePolicy || (exports.ParentClosePolicy = ParentClosePolicy = {}));
84
84
  (0, type_helpers_1.checkExtends)();
85
85
  (0, type_helpers_1.checkExtends)();
86
86
  //# sourceMappingURL=interfaces.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AAWA,sEAA+F;AAkL/F;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;IACtC,YAA4B,OAAkE;QAC5F,KAAK,CAAC,2BAA2B,CAAC,CAAC;QADT,YAAO,GAAP,OAAO,CAA2D;IAE9F,CAAC;CACF,CAAA;AAJY,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAIzB;AAJY,sCAAa;AA6C1B;;;;;;;GAOG;AACH,IAAY,6BAyBX;AAzBD,WAAY,6BAA6B;IACvC;;OAEG;IACH,uFAAW,CAAA;IAEX;;OAEG;IACH,6FAAc,CAAA;IAEd;;;;;;;OAOG;IACH,+HAA+B,CAAA;IAE/B;;OAEG;IACH,+HAA+B,CAAA;AACjC,CAAC,EAzBW,6BAA6B,GAA7B,qCAA6B,KAA7B,qCAA6B,QAyBxC;AAED,IAAA,2BAAY,GAAuF,CAAC;AACpG,IAAA,2BAAY,GAAuF,CAAC;AAEpG;;;;GAIG;AACH,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,+GAAmC,CAAA;IAEnC;;;;OAIG;IACH,2GAAiC,CAAA;IAEjC;;OAEG;IACH,uGAA+B,CAAA;IAE/B;;OAEG;IACH,qHAAsC,CAAA;AACxC,CAAC,EAtBW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAsB5B;AAED,IAAA,2BAAY,GAA+D,CAAC;AAC5E,IAAA,2BAAY,GAA+D,CAAC"}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":";;;;;;;;;AAYA,sEAA+F;AA0L/F;;GAEG;AAEI,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,KAAK;IACtC,YAA4B,OAAkE;QAC5F,KAAK,CAAC,2BAA2B,CAAC,CAAC;QADT,YAAO,GAAP,OAAO,CAA2D;IAE9F,CAAC;CACF,CAAA;AAJY,sCAAa;wBAAb,aAAa;IADzB,IAAA,yCAA0B,EAAC,eAAe,CAAC;GAC/B,aAAa,CAIzB;AA2CD;;;;;;;GAOG;AACH,IAAY,6BAyBX;AAzBD,WAAY,6BAA6B;IACvC;;OAEG;IACH,uFAAW,CAAA;IAEX;;OAEG;IACH,6FAAc,CAAA;IAEd;;;;;;;OAOG;IACH,+HAA+B,CAAA;IAE/B;;OAEG;IACH,+HAA+B,CAAA;AACjC,CAAC,EAzBW,6BAA6B,6CAA7B,6BAA6B,QAyBxC;AAED,IAAA,2BAAY,GAAuF,CAAC;AACpG,IAAA,2BAAY,GAAuF,CAAC;AAEpG;;;;GAIG;AACH,IAAY,iBAsBX;AAtBD,WAAY,iBAAiB;IAC3B;;OAEG;IACH,+GAAmC,CAAA;IAEnC;;;;OAIG;IACH,2GAAiC,CAAA;IAEjC;;OAEG;IACH,uGAA+B,CAAA;IAE/B;;OAEG;IACH,qHAAsC,CAAA;AACxC,CAAC,EAtBW,iBAAiB,iCAAjB,iBAAiB,QAsB5B;AAED,IAAA,2BAAY,GAA+D,CAAC;AAC5E,IAAA,2BAAY,GAA+D,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { RawSourceMap } from 'source-map';
2
- import { FailureConverter, PayloadConverter, Workflow, WorkflowQueryType, WorkflowSignalType, ProtoFailure } from '@temporalio/common';
2
+ import { FailureConverter, PayloadConverter, Workflow, WorkflowQueryType, WorkflowSignalType, WorkflowUpdateType, ProtoFailure, WorkflowUpdateValidatorType } from '@temporalio/common';
3
3
  import type { coresdk } from '@temporalio/proto';
4
4
  import { RNG } from './alea';
5
5
  import { RootCancellationScope } from './cancellation-scope';
6
- import { QueryInput, SignalInput, WorkflowExecuteInput, WorkflowInterceptors } from './interceptors';
6
+ import { QueryInput, SignalInput, UpdateInput, WorkflowExecuteInput, WorkflowInterceptors } from './interceptors';
7
7
  import { DefaultSignalHandler, FileLocation, WorkflowInfo, WorkflowCreateOptionsInternal } from './interfaces';
8
- import { SinkCall } from './sinks';
8
+ import { type SinkCall } from './sinks';
9
9
  export interface Stack {
10
10
  formatted: string;
11
11
  structured: FileLocation[];
@@ -25,13 +25,6 @@ export interface Condition {
25
25
  fn(): boolean;
26
26
  resolve(): void;
27
27
  }
28
- /**
29
- * A class that acts as a marker for this special result type
30
- */
31
- export declare class LocalActivityDoBackoff extends Error {
32
- readonly backoff: coresdk.activity_result.IDoBackoff;
33
- constructor(backoff: coresdk.activity_result.IDoBackoff);
34
- }
35
28
  export type ActivationHandlerFunction<K extends keyof coresdk.workflow_activation.IWorkflowActivationJob> = (activation: NonNullable<coresdk.workflow_activation.IWorkflowActivationJob[K]>) => void;
36
29
  /**
37
30
  * Verifies all activation job handling methods are implemented
@@ -60,6 +53,10 @@ export declare class Activator implements ActivationHandler {
60
53
  signalWorkflow: Map<number, Completion>;
61
54
  cancelWorkflow: Map<number, Completion>;
62
55
  };
56
+ /**
57
+ * Holds buffered Update calls until a handler is registered
58
+ */
59
+ readonly bufferedUpdates: coresdk.workflow_activation.IDoUpdate[];
63
60
  /**
64
61
  * Holds buffered signal calls until a handler is registered
65
62
  */
@@ -72,6 +69,13 @@ export declare class Activator implements ActivationHandler {
72
69
  * which delays query handler registration.
73
70
  */
74
71
  protected readonly bufferedQueries: coresdk.workflow_activation.IQueryWorkflow[];
72
+ /**
73
+ * Mapping of update name to handler and validator
74
+ */
75
+ readonly updateHandlers: Map<string, {
76
+ handler: WorkflowUpdateType;
77
+ validator?: WorkflowUpdateValidatorType | undefined;
78
+ }>;
75
79
  /**
76
80
  * Mapping of signal name to handler
77
81
  */
@@ -147,7 +151,7 @@ export declare class Activator implements ActivationHandler {
147
151
  /**
148
152
  * Information about the current Workflow
149
153
  */
150
- readonly info: WorkflowInfo;
154
+ info: WorkflowInfo;
151
155
  /**
152
156
  * A deterministic RNG, used by the isolate's overridden Math.random
153
157
  */
@@ -172,6 +176,7 @@ export declare class Activator implements ActivationHandler {
172
176
  readonly getTimeOfDay: () => bigint;
173
177
  readonly registeredActivityNames: Set<string>;
174
178
  constructor({ info, now, showStackTraceSources, sourceMap, getTimeOfDay, randomnessSeed, patches, registeredActivityNames, }: WorkflowCreateOptionsInternal);
179
+ mutateWorkflowInfo(fn: (info: WorkflowInfo) => WorkflowInfo): void;
175
180
  protected getStackTraces(): Stack[];
176
181
  getAndResetSinkCalls(): SinkCall[];
177
182
  /**
@@ -190,6 +195,11 @@ export declare class Activator implements ActivationHandler {
190
195
  resolveChildWorkflowExecution(activation: coresdk.workflow_activation.IResolveChildWorkflowExecution): void;
191
196
  protected queryWorkflowNextHandler({ queryName, args }: QueryInput): Promise<unknown>;
192
197
  queryWorkflow(activation: coresdk.workflow_activation.IQueryWorkflow): void;
198
+ doUpdate(activation: coresdk.workflow_activation.IDoUpdate): void;
199
+ protected updateNextHandler({ name, args }: UpdateInput): Promise<unknown>;
200
+ protected validateUpdateNextHandler({ name, args }: UpdateInput): void;
201
+ dispatchBufferedUpdates(): void;
202
+ rejectBufferedUpdates(): void;
193
203
  signalWorkflowNextHandler({ signalName, args }: SignalInput): Promise<void>;
194
204
  signalWorkflow(activation: coresdk.workflow_activation.ISignalWorkflow): void;
195
205
  dispatchBufferedSignals(): void;
@@ -205,6 +215,9 @@ export declare class Activator implements ActivationHandler {
205
215
  handleWorkflowFailure(error: unknown): Promise<void>;
206
216
  private completeQuery;
207
217
  private failQuery;
218
+ private acceptUpdate;
219
+ private completeUpdate;
220
+ private rejectUpdate;
208
221
  /** Consume a completion if it exists in Workflow state */
209
222
  private maybeConsumeCompletion;
210
223
  /** Consume a completion if it exists in Workflow state, throws if it doesn't */
@@ -213,5 +226,3 @@ export declare class Activator implements ActivationHandler {
213
226
  errorToFailure(err: unknown): ProtoFailure;
214
227
  failureToError(failure: ProtoFailure): Error;
215
228
  }
216
- export declare function maybeGetActivator(): Activator | undefined;
217
- export declare function getActivator(): Activator;