Socket
Socket
Sign inDemoInstall

@temporalio/workflow

Package Overview
Dependencies
Maintainers
4
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@temporalio/workflow - npm Package Compare versions

Comparing version 0.17.2 to 0.18.0

19

lib/errors.d.ts

@@ -0,1 +1,2 @@

export { WorkflowExecutionAlreadyStartedError } from '@temporalio/common';
/**

@@ -8,3 +9,3 @@ * Base class for all workflow errors

/**
* Thrown in workflow when it trys to do something that non-deterministic such as construct a WeakMap()
* Thrown in workflow when it tries to do something that non-deterministic such as construct a WeakMap()
*/

@@ -15,20 +16,4 @@ export declare class DeterminismViolationError extends WorkflowError {

/**
* This exception is thrown in the following cases:
* - Workflow with the same WorkflowId is currently running
* - There is a closed workflow with the same ID and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is successfully closed workflow with the same ID and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
* - {@link Workflow.execute} is called *more than once* on a handle created through {@link createChildWorkflowHandle} and the
* {@link WorkflowOptions.workflowIdReusePolicy} is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE`
*/
export declare class WorkflowExecutionAlreadyStartedError extends WorkflowError {
readonly workflowId: string;
readonly workflowType: string;
readonly name: string;
constructor(message: string, workflowId: string, workflowType: string);
}
/**
* Returns whether provided `err` is caused by cancellation
*/
export declare function isCancellation(err: unknown): boolean;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCancellation = exports.WorkflowExecutionAlreadyStartedError = exports.DeterminismViolationError = exports.WorkflowError = void 0;
exports.isCancellation = exports.DeterminismViolationError = exports.WorkflowError = exports.WorkflowExecutionAlreadyStartedError = void 0;
const common_1 = require("@temporalio/common");
var common_2 = require("@temporalio/common");
Object.defineProperty(exports, "WorkflowExecutionAlreadyStartedError", { enumerable: true, get: function () { return common_2.WorkflowExecutionAlreadyStartedError; } });
/**

@@ -16,3 +18,3 @@ * Base class for all workflow errors

/**
* Thrown in workflow when it trys to do something that non-deterministic such as construct a WeakMap()
* Thrown in workflow when it tries to do something that non-deterministic such as construct a WeakMap()
*/

@@ -27,21 +29,2 @@ class DeterminismViolationError extends WorkflowError {

/**
* This exception is thrown in the following cases:
* - Workflow with the same WorkflowId is currently running
* - There is a closed workflow with the same ID and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is successfully closed workflow with the same ID and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
* - {@link Workflow.execute} is called *more than once* on a handle created through {@link createChildWorkflowHandle} and the
* {@link WorkflowOptions.workflowIdReusePolicy} is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE`
*/
class WorkflowExecutionAlreadyStartedError extends WorkflowError {
constructor(message, workflowId, workflowType) {
super(message);
this.workflowId = workflowId;
this.workflowType = workflowType;
this.name = 'ChildWorkflowExecutionAlreadyStartedError';
}
}
exports.WorkflowExecutionAlreadyStartedError = WorkflowExecutionAlreadyStartedError;
/**
* Returns whether provided `err` is caused by cancellation

@@ -48,0 +31,0 @@ */

6

lib/interceptors.d.ts

@@ -133,3 +133,3 @@ /**

export interface ActivateInput {
activation: coresdk.workflow_activation.IWFActivation;
activation: coresdk.workflow_activation.IWorkflowActivation;
batchIndex: number;

@@ -147,7 +147,7 @@ }

/**
* Called when the Workflow runtime runs a WFActivationJob.
* Called when the Workflow runtime runs a WorkflowActivationJob.
*/
activate?(input: ActivateInput, next: Next<this, 'activate'>): Promise<void>;
/**
* Called after all `WFActivationJob`s have been proccesed for an activation.
* Called after all `WorkflowActivationJob`s have been processed for an activation.
*

@@ -154,0 +154,0 @@ * Can manipulate the commands generated by the Workflow

@@ -17,5 +17,5 @@ import { WorkflowSignalType, DataConverter, Workflow, WorkflowQueryType } from '@temporalio/common';

}
export declare type ActivationHandlerFunction<K extends keyof coresdk.workflow_activation.IWFActivationJob> = (activation: NonNullable<coresdk.workflow_activation.IWFActivationJob[K]>) => Promise<void> | void;
export declare type ActivationHandlerFunction<K extends keyof coresdk.workflow_activation.IWorkflowActivationJob> = (activation: NonNullable<coresdk.workflow_activation.IWorkflowActivationJob[K]>) => Promise<void> | void;
export declare type ActivationHandler = {
[P in keyof coresdk.workflow_activation.IWFActivationJob]: ActivationHandlerFunction<P>;
[P in keyof coresdk.workflow_activation.IWorkflowActivationJob]: ActivationHandlerFunction<P>;
};

@@ -173,2 +173,5 @@ export declare class Activator implements ActivationHandler {

export declare function handleWorkflowFailure(error: unknown): Promise<void>;
/** Consume a completion if it exists in Workflow state */
export declare function maybeConsumeCompletion(type: keyof State['completions'], taskSeq: number): Completion | undefined;
/** Consume a completion if it exists in Workflow state, throws if it doesn't */
export declare function consumeCompletion(type: keyof State['completions'], taskSeq: number): Completion;

@@ -15,3 +15,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.consumeCompletion = exports.handleWorkflowFailure = exports.state = exports.State = exports.Activator = void 0;
exports.consumeCompletion = exports.maybeConsumeCompletion = exports.handleWorkflowFailure = exports.state = exports.State = exports.Activator = void 0;
const common_1 = require("@temporalio/common");

@@ -72,4 +72,6 @@ const type_helpers_1 = require("@temporalio/common/lib/type-helpers");

fireTimer(activation) {
const { resolve } = consumeCompletion('timer', getSeq(activation));
resolve(undefined);
// Timers are a special case where their completion might not be in Workflow state,
// this is due to immediate timer cancellation that doesn't go wait for Core.
const completion = maybeConsumeCompletion('timer', getSeq(activation));
completion?.resolve(undefined);
}

@@ -411,8 +413,17 @@ async resolveActivity(activation) {

}
/** Consume a completion if it exists in Workflow state */
function maybeConsumeCompletion(type, taskSeq) {
const completion = exports.state.completions[type].get(taskSeq);
if (completion !== undefined) {
exports.state.completions[type].delete(taskSeq);
}
return completion;
}
exports.maybeConsumeCompletion = maybeConsumeCompletion;
/** Consume a completion if it exists in Workflow state, throws if it doesn't */
function consumeCompletion(type, taskSeq) {
const completion = exports.state.completions[type].get(taskSeq);
const completion = maybeConsumeCompletion(type, taskSeq);
if (completion === undefined) {
throw new common_1.IllegalStateError(`No completion for taskSeq ${taskSeq}`);
}
exports.state.completions[type].delete(taskSeq);
return completion;

@@ -419,0 +430,0 @@ }

@@ -30,3 +30,3 @@ import type { coresdk } from '@temporalio/proto/lib/coresdk';

*/
export declare function activate(activation: coresdk.workflow_activation.WFActivation, batchIndex: number): Promise<ActivationResult>;
export declare function activate(activation: coresdk.workflow_activation.WorkflowActivation, batchIndex: number): Promise<ActivationResult>;
/**

@@ -38,3 +38,3 @@ * Conclude a single activation.

*/
export declare function concludeActivation(): coresdk.workflow_completion.IWFActivationCompletion;
export declare function concludeActivation(): coresdk.workflow_completion.IWorkflowActivationCompletion;
export declare function getAndResetSinkCalls(): SinkCall[];

@@ -41,0 +41,0 @@ /**

@@ -84,3 +84,3 @@ import { ActivityFunction, ActivityOptions, Workflow, WorkflowResultType, SignalDefinition, QueryDefinition, WithWorkflowArgs, WorkflowReturnType, ActivityInterface } from '@temporalio/common';

* - Returns a client-side handle that implements a child Workflow interface.
* - By default a child will be scheduled on the same task queue as its parent.
* - By default, a child will be scheduled on the same task queue as its parent.
*

@@ -90,3 +90,3 @@ * A child Workflow handle supports awaiting completion, signaling and cancellation via {@link CancellationScope}s.

*/
export declare function startChild<T extends Workflow>(workflowType: string, options: ChildWorkflowOptions): Promise<ChildWorkflowHandle<T>>;
export declare function startChild<T extends Workflow>(workflowType: string, options: WithWorkflowArgs<T, ChildWorkflowOptions>): Promise<ChildWorkflowHandle<T>>;
/**

@@ -99,3 +99,3 @@ * Start a child Workflow execution

* - Deduces the Workflow type and signature from provided Workflow function.
* - By default a child will be scheduled on the same task queue as its parent.
* - By default, a child will be scheduled on the same task queue as its parent.
*

@@ -134,3 +134,3 @@ * A child Workflow handle supports awaiting completion, signaling and cancellation via {@link CancellationScope}s.

*
* - By default a child will be scheduled on the same task queue as its parent.
* - By default, a child will be scheduled on the same task queue as its parent.
* - This operation is cancellable using {@link CancellationScope}s.

@@ -144,3 +144,3 @@ *

*
* - By default a child will be scheduled on the same task queue as its parent.
* - By default, a child will be scheduled on the same task queue as its parent.
* - Deduces the Workflow type and signature from provided Workflow function.

@@ -147,0 +147,0 @@ * - This operation is cancellable using {@link CancellationScope}s.

{
"name": "@temporalio/workflow",
"version": "0.17.2",
"version": "0.18.0",
"description": "Temporal.io SDK Workflow sub-package",

@@ -16,4 +16,4 @@ "main": "lib/index.js",

"dependencies": {
"@temporalio/common": "^0.17.2",
"@temporalio/proto": "^0.17.2"
"@temporalio/common": "^0.18.0",
"@temporalio/proto": "^0.18.0"
},

@@ -30,3 +30,3 @@ "bugs": {

},
"gitHead": "2232465a4f9b0cade28f0c21c2d7856053678728"
"gitHead": "1f8030e0e003fac70969bee9bb816d9520910d02"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc