@temporalio/workflow
Version:
Temporal.io SDK Workflow sub-package
104 lines • 4.84 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.decodeParentClosePolicy = exports.encodeParentClosePolicy = exports.ParentClosePolicy = exports.decodeChildWorkflowCancellationType = exports.encodeChildWorkflowCancellationType = exports.ChildWorkflowCancellationType = exports.ContinueAsNew = void 0;
const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
const enums_helpers_1 = require("@temporalio/common/lib/internal-workflow/enums-helpers");
/**
* Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called
*/
let ContinueAsNew = class ContinueAsNew extends Error {
constructor(command) {
super('Workflow continued as new');
this.command = command;
}
};
exports.ContinueAsNew = ContinueAsNew;
exports.ContinueAsNew = ContinueAsNew = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('ContinueAsNew')
], ContinueAsNew);
exports.ChildWorkflowCancellationType = {
/**
* Don't send a cancellation request to the Child.
*/
ABANDON: 'ABANDON',
/**
* Send a cancellation request to the Child. Immediately throw the error.
*/
TRY_CANCEL: 'TRY_CANCEL',
/**
* Send a cancellation request to the Child. The Child may respect cancellation, in which case an error will be thrown
* when cancellation has completed, and {@link isCancellation}(error) will be true. On the other hand, the Child may
* ignore the cancellation request, in which case an error might be thrown with a different cause, or the Child may
* complete successfully.
*
* @default
*/
WAIT_CANCELLATION_COMPLETED: 'WAIT_CANCELLATION_COMPLETED',
/**
* Send a cancellation request to the Child. Throw the error once the Server receives the Child cancellation request.
*/
WAIT_CANCELLATION_REQUESTED: 'WAIT_CANCELLATION_REQUESTED',
};
// ts-prune-ignore-next
_a = (0, enums_helpers_1.makeProtoEnumConverters)({
[exports.ChildWorkflowCancellationType.ABANDON]: 0,
[exports.ChildWorkflowCancellationType.TRY_CANCEL]: 1,
[exports.ChildWorkflowCancellationType.WAIT_CANCELLATION_COMPLETED]: 2,
[exports.ChildWorkflowCancellationType.WAIT_CANCELLATION_REQUESTED]: 3,
}, ''), exports.encodeChildWorkflowCancellationType = _a[0], exports.decodeChildWorkflowCancellationType = _a[1];
exports.ParentClosePolicy = {
/**
* When the Parent is Closed, the Child is Terminated.
*
* @default
*/
TERMINATE: 'TERMINATE',
/**
* When the Parent is Closed, nothing is done to the Child.
*/
ABANDON: 'ABANDON',
/**
* When the Parent is Closed, the Child is Cancelled.
*/
REQUEST_CANCEL: 'REQUEST_CANCEL',
/// Anything below this line has been deprecated
/**
* If a `ParentClosePolicy` is set to this, or is not set at all, the server default value will be used.
*
* @deprecated Either leave property `undefined`, or set an explicit policy instead.
*/
PARENT_CLOSE_POLICY_UNSPECIFIED: undefined, // eslint-disable-line deprecation/deprecation
/**
* When the Parent is Closed, the Child is Terminated.
*
* @deprecated Use {@link ParentClosePolicy.TERMINATE} instead.
*/
PARENT_CLOSE_POLICY_TERMINATE: 'TERMINATE', // eslint-disable-line deprecation/deprecation
/**
* When the Parent is Closed, nothing is done to the Child.
*
* @deprecated Use {@link ParentClosePolicy.ABANDON} instead.
*/
PARENT_CLOSE_POLICY_ABANDON: 'ABANDON', // eslint-disable-line deprecation/deprecation
/**
* When the Parent is Closed, the Child is Cancelled.
*
* @deprecated Use {@link ParentClosePolicy.REQUEST_CANCEL} instead.
*/
PARENT_CLOSE_POLICY_REQUEST_CANCEL: 'REQUEST_CANCEL', // eslint-disable-line deprecation/deprecation
};
// ts-prune-ignore-next
_b = (0, enums_helpers_1.makeProtoEnumConverters)({
[exports.ParentClosePolicy.TERMINATE]: 1,
[exports.ParentClosePolicy.ABANDON]: 2,
[exports.ParentClosePolicy.REQUEST_CANCEL]: 3,
UNSPECIFIED: 0,
}, 'PARENT_CLOSE_POLICY_'), exports.encodeParentClosePolicy = _b[0], exports.decodeParentClosePolicy = _b[1];
//# sourceMappingURL=interfaces.js.map
;