UNPKG

@temporalio/workflow

Version:
99 lines 6.49 kB
"use strict"; /** * This library provides tools required for authoring workflows. * * ## Usage * See the {@link https://docs.temporal.io/typescript/hello-world#workflows | tutorial} for writing your first workflow. * * ### Timers * * The recommended way of scheduling timers is by using the {@link sleep} function. We've replaced `setTimeout` and * `clearTimeout` with deterministic versions so these are also usable but have a limitation that they don't play well * with {@link https://docs.temporal.io/typescript/cancellation-scopes | cancellation scopes}. * * <!--SNIPSTART typescript-sleep-workflow--> * <!--SNIPEND--> * * ### Activities * * To schedule Activities, use {@link proxyActivities} to obtain an Activity function and call. * * <!--SNIPSTART typescript-schedule-activity-workflow--> * <!--SNIPEND--> * * ### Updates, Signals and Queries * * Use {@link setHandler} to set handlers for Updates, Signals, and Queries. * * Update and Signal handlers can be either async or non-async functions. Update handlers may return a value, but signal * handlers may not (return `void` or `Promise<void>`). You may use Activities, Timers, child Workflows, etc in Update * and Signal handlers, but this should be done cautiously: for example, note that if you await async operations such as * these in an Update or Signal handler, then you are responsible for ensuring that the workflow does not complete first. * * Query handlers may **not** be async functions, and may **not** mutate any variables or use Activities, Timers, * child Workflows, etc. * * #### Implementation * * <!--SNIPSTART typescript-workflow-update-signal-query-example--> * <!--SNIPEND--> * * ### More * * - [Deterministic built-ins](https://docs.temporal.io/typescript/determinism#sources-of-non-determinism) * - [Cancellation and scopes](https://docs.temporal.io/typescript/cancellation-scopes) * - {@link CancellationScope} * - {@link Trigger} * - [Sinks](https://docs.temporal.io/application-development/observability/?lang=ts#logging) * - {@link Sinks} * * @module */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); 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; var common_1 = require("@temporalio/common"); Object.defineProperty(exports, "ActivityCancellationType", { enumerable: true, get: function () { return common_1.ActivityCancellationType; } }); Object.defineProperty(exports, "ActivityFailure", { enumerable: true, get: function () { return common_1.ActivityFailure; } }); Object.defineProperty(exports, "ApplicationFailure", { enumerable: true, get: function () { return common_1.ApplicationFailure; } }); Object.defineProperty(exports, "CancelledFailure", { enumerable: true, get: function () { return common_1.CancelledFailure; } }); Object.defineProperty(exports, "ChildWorkflowFailure", { enumerable: true, get: function () { return common_1.ChildWorkflowFailure; } }); Object.defineProperty(exports, "defaultPayloadConverter", { enumerable: true, get: function () { return common_1.defaultPayloadConverter; } }); Object.defineProperty(exports, "rootCause", { enumerable: true, get: function () { return common_1.rootCause; } }); Object.defineProperty(exports, "ServerFailure", { enumerable: true, get: function () { return common_1.ServerFailure; } }); Object.defineProperty(exports, "TemporalFailure", { enumerable: true, get: function () { return common_1.TemporalFailure; } }); Object.defineProperty(exports, "TerminatedFailure", { enumerable: true, get: function () { return common_1.TerminatedFailure; } }); Object.defineProperty(exports, "TimeoutFailure", { enumerable: true, get: function () { return common_1.TimeoutFailure; } }); __exportStar(require("@temporalio/common/lib/errors"), exports); __exportStar(require("@temporalio/common/lib/workflow-handle"), exports); __exportStar(require("@temporalio/common/lib/workflow-options"), exports); var cancellation_scope_1 = require("./cancellation-scope"); Object.defineProperty(exports, "AsyncLocalStorage", { enumerable: true, get: function () { return cancellation_scope_1.AsyncLocalStorage; } }); Object.defineProperty(exports, "CancellationScope", { enumerable: true, get: function () { return cancellation_scope_1.CancellationScope; } }); __exportStar(require("./errors"), exports); __exportStar(require("./interceptors"), exports); var interfaces_1 = require("./interfaces"); Object.defineProperty(exports, "ChildWorkflowCancellationType", { enumerable: true, get: function () { return interfaces_1.ChildWorkflowCancellationType; } }); Object.defineProperty(exports, "ContinueAsNew", { enumerable: true, get: function () { return interfaces_1.ContinueAsNew; } }); Object.defineProperty(exports, "ParentClosePolicy", { enumerable: true, get: function () { return interfaces_1.ParentClosePolicy; } }); var sinks_1 = require("./sinks"); Object.defineProperty(exports, "proxySinks", { enumerable: true, get: function () { return sinks_1.proxySinks; } }); var logs_1 = require("./logs"); Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logs_1.log; } }); var trigger_1 = require("./trigger"); Object.defineProperty(exports, "Trigger", { enumerable: true, get: function () { return trigger_1.Trigger; } }); __exportStar(require("./workflow"), exports); //# sourceMappingURL=index.js.map