Socket
Socket
Sign inDemoInstall

@temporalio/common

Package Overview
Dependencies
Maintainers
0
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@temporalio/common - npm Package Compare versions

Comparing version 1.10.3 to 1.11.0

2

lib/converter/failure-converter.js

@@ -6,2 +6,3 @@ "use strict";

const type_helpers_1 = require("../type-helpers");
const time_1 = require("../time");
const payload_converter_1 = require("./payload-converter");

@@ -168,2 +169,3 @@ function combineRegExp(...regexps) {

: undefined,
nextRetryDelay: (0, time_1.msOptionalToTs)(err.nextRetryDelay),
},

@@ -170,0 +172,0 @@ };

14

lib/errors.d.ts

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

import { TemporalFailure } from './failure';
/**

@@ -20,15 +19,2 @@ * Thrown from code that receives a value that is unexpected or that it's unable to handle.

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
export declare class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
readonly workflowId: string;
readonly workflowType: string;
constructor(message: string, workflowId: string, workflowType: string);
}
/**
* Thrown when a Workflow with the given Id is not known to Temporal Server.

@@ -35,0 +21,0 @@ * It could be because:

@@ -9,4 +9,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.NamespaceNotFoundError = exports.WorkflowNotFoundError = exports.WorkflowExecutionAlreadyStartedError = exports.IllegalStateError = exports.PayloadConverterError = exports.ValueError = void 0;
const failure_1 = require("./failure");
exports.NamespaceNotFoundError = exports.WorkflowNotFoundError = exports.IllegalStateError = exports.PayloadConverterError = exports.ValueError = void 0;
const type_helpers_1 = require("./type-helpers");

@@ -45,21 +44,2 @@ /**

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
let WorkflowExecutionAlreadyStartedError = class WorkflowExecutionAlreadyStartedError extends failure_1.TemporalFailure {
constructor(message, workflowId, workflowType) {
super(message);
this.workflowId = workflowId;
this.workflowType = workflowType;
}
};
exports.WorkflowExecutionAlreadyStartedError = WorkflowExecutionAlreadyStartedError;
exports.WorkflowExecutionAlreadyStartedError = WorkflowExecutionAlreadyStartedError = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('WorkflowExecutionAlreadyStartedError')
], WorkflowExecutionAlreadyStartedError);
/**
* Thrown when a Workflow with the given Id is not known to Temporal Server.

@@ -66,0 +46,0 @@ * It could be because:

import type { temporal } from '@temporalio/proto';
import { Duration } from './time';
export declare const FAILURE_SOURCE = "TypeScriptSDK";

@@ -70,6 +71,7 @@ export type ProtoFailure = temporal.api.failure.v1.IFailure;

readonly details?: unknown[] | null | undefined;
readonly nextRetryDelay?: Duration | null | undefined;
/**
* Alternatively, use {@link fromError} or {@link create}.
*/
constructor(message?: string | undefined | null, type?: string | null | undefined, nonRetryable?: boolean | null | undefined, details?: unknown[] | null | undefined, cause?: Error);
constructor(message?: string | undefined | null, type?: string | null | undefined, nonRetryable?: boolean | null | undefined, details?: unknown[] | null | undefined, cause?: Error, nextRetryDelay?: Duration | null | undefined);
/**

@@ -129,2 +131,9 @@ * Create a new `ApplicationFailure` from an Error object.

/**
* If set, overrides the delay until the next retry of this Activity / Workflow Task.
*
* Retry attempts will still be subject to the maximum retries limit and total time limit defined
* by the policy.
*/
nextRetryDelay?: Duration;
/**
* Cause of the failure

@@ -186,2 +195,15 @@ */

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
export declare class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
readonly workflowId: string;
readonly workflowType: string;
constructor(message: string, workflowId: string, workflowType: string);
}
/**
* If `error` is already an `ApplicationFailure`, returns `error`.

@@ -188,0 +210,0 @@ *

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.rootCause = exports.ensureTemporalFailure = exports.ensureApplicationFailure = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.RetryState = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
exports.rootCause = exports.ensureTemporalFailure = exports.ensureApplicationFailure = exports.WorkflowExecutionAlreadyStartedError = exports.ChildWorkflowFailure = exports.ActivityFailure = exports.TimeoutFailure = exports.TerminatedFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ServerFailure = exports.TemporalFailure = exports.RetryState = exports.TimeoutType = exports.FAILURE_SOURCE = void 0;
const type_helpers_1 = require("./type-helpers");

@@ -94,3 +94,3 @@ exports.FAILURE_SOURCE = 'TypeScriptSDK';

*/
constructor(message, type, nonRetryable, details, cause) {
constructor(message, type, nonRetryable, details, cause, nextRetryDelay) {
super(message, cause);

@@ -100,2 +100,3 @@ this.type = type;

this.details = details;
this.nextRetryDelay = nextRetryDelay;
}

@@ -119,4 +120,4 @@ /**

static create(options) {
const { message, type, nonRetryable = false, details, cause } = options;
return new this(message, type, nonRetryable, details, cause);
const { message, type, nonRetryable = false, details, nextRetryDelay, cause } = options;
return new this(message, type, nonRetryable, details, cause, nextRetryDelay);
}

@@ -234,2 +235,21 @@ /**

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
let WorkflowExecutionAlreadyStartedError = class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
constructor(message, workflowId, workflowType) {
super(message);
this.workflowId = workflowId;
this.workflowType = workflowType;
}
};
exports.WorkflowExecutionAlreadyStartedError = WorkflowExecutionAlreadyStartedError;
exports.WorkflowExecutionAlreadyStartedError = WorkflowExecutionAlreadyStartedError = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('WorkflowExecutionAlreadyStartedError')
], WorkflowExecutionAlreadyStartedError);
/**
* If `error` is already an `ApplicationFailure`, returns `error`.

@@ -236,0 +256,0 @@ *

@@ -9,2 +9,3 @@ import type { temporal } from '@temporalio/proto';

handler: WorkflowUpdateType;
unfinishedPolicy: HandlerUnfinishedPolicy;
validator?: WorkflowUpdateValidatorType;

@@ -16,2 +17,3 @@ description?: string;

handler: WorkflowSignalType;
unfinishedPolicy: HandlerUnfinishedPolicy;
description?: string;

@@ -116,2 +118,19 @@ };

}
/**
* Policy defining actions taken when a workflow exits while update or signal handlers are running.
* The workflow exit may be due to successful return, failure, cancellation, or continue-as-new.
*/
export declare enum HandlerUnfinishedPolicy {
/**
* Issue a warning in addition to abandoning the handler execution. The warning will not be issued if the workflow fails.
*/
WARN_AND_ABANDON = 1,
/**
* Abandon the handler execution.
*
* In the case of an update handler this means that the client will receive an error rather than
* the update result.
*/
ABANDON = 2
}
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HandlerUnfinishedPolicy = void 0;
/**
* Policy defining actions taken when a workflow exits while update or signal handlers are running.
* The workflow exit may be due to successful return, failure, cancellation, or continue-as-new.
*/
var HandlerUnfinishedPolicy;
(function (HandlerUnfinishedPolicy) {
/**
* Issue a warning in addition to abandoning the handler execution. The warning will not be issued if the workflow fails.
*/
HandlerUnfinishedPolicy[HandlerUnfinishedPolicy["WARN_AND_ABANDON"] = 1] = "WARN_AND_ABANDON";
/**
* Abandon the handler execution.
*
* In the case of an update handler this means that the client will receive an error rather than
* the update result.
*/
HandlerUnfinishedPolicy[HandlerUnfinishedPolicy["ABANDON"] = 2] = "ABANDON";
})(HandlerUnfinishedPolicy || (exports.HandlerUnfinishedPolicy = HandlerUnfinishedPolicy = {}));
//# sourceMappingURL=interfaces.js.map

@@ -25,3 +25,3 @@ import { StringValue } from 'ms';

export declare function msToTs(str: Duration): Timestamp;
export declare function msOptionalToTs(str: Duration | undefined): Timestamp | undefined;
export declare function msOptionalToTs(str: Duration | undefined | null): Timestamp | undefined;
export declare function msOptionalToNumber(val: Duration | undefined): number | undefined;

@@ -28,0 +28,0 @@ export declare function msToNumber(val: Duration): number;

{
"name": "@temporalio/common",
"version": "1.10.3",
"version": "1.11.0",
"description": "Common library for code that's used across the Client, Worker, and/or Workflow",

@@ -15,3 +15,3 @@ "main": "lib/index.js",

"dependencies": {
"@temporalio/proto": "1.10.3",
"@temporalio/proto": "1.11.0",
"long": "^5.2.3",

@@ -40,3 +40,3 @@ "ms": "^3.0.0-canary.1",

],
"gitHead": "7832067434443145e1f0ddf07cb37b0b90158bfb"
"gitHead": "3d7dd521cadc2ebcc4989360eeb0bedacd4533ab"
}

@@ -16,2 +16,3 @@ import {

import { isError } from '../type-helpers';
import { msOptionalToTs } from '../time';
import { arrayFromPayloads, fromPayloadsAtIndex, PayloadConverter, toPayloads } from './payload-converter';

@@ -70,2 +71,3 @@

errorToFailure(err: unknown, payloadConverter: PayloadConverter): ProtoFailure;
/**

@@ -271,2 +273,3 @@ * Converts a Failure proto message to a JS Error object.

: undefined,
nextRetryDelay: msOptionalToTs(err.nextRetryDelay),
},

@@ -273,0 +276,0 @@ };

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

import { TemporalFailure } from './failure';
import { SymbolBasedInstanceOfError } from './type-helpers';

@@ -30,21 +29,2 @@

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
@SymbolBasedInstanceOfError('WorkflowExecutionAlreadyStartedError')
export class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
constructor(
message: string,
public readonly workflowId: string,
public readonly workflowType: string
) {
super(message);
}
}
/**
* Thrown when a Workflow with the given Id is not known to Temporal Server.

@@ -51,0 +31,0 @@ * It could be because:

import type { temporal } from '@temporalio/proto';
import { checkExtends, errorMessage, isRecord, SymbolBasedInstanceOfError } from './type-helpers';
import { Duration } from './time';

@@ -106,3 +107,4 @@ export const FAILURE_SOURCE = 'TypeScriptSDK';

public readonly details?: unknown[] | undefined | null,
cause?: Error
cause?: Error,
public readonly nextRetryDelay?: Duration | undefined | null
) {

@@ -130,4 +132,4 @@ super(message, cause);

public static create(options: ApplicationFailureOptions): ApplicationFailure {
const { message, type, nonRetryable = false, details, cause } = options;
return new this(message, type, nonRetryable, details, cause);
const { message, type, nonRetryable = false, details, nextRetryDelay, cause } = options;
return new this(message, type, nonRetryable, details, cause, nextRetryDelay);
}

@@ -186,2 +188,10 @@

/**
* If set, overrides the delay until the next retry of this Activity / Workflow Task.
*
* Retry attempts will still be subject to the maximum retries limit and total time limit defined
* by the policy.
*/
nextRetryDelay?: Duration;
/**
* Cause of the failure

@@ -274,2 +284,21 @@ */

/**
* This exception is thrown in the following cases:
* - Workflow with the same Workflow Id is currently running
* - There is a closed Workflow with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE`
* - There is closed Workflow in the `Completed` state with the same Workflow Id and the {@link WorkflowOptions.workflowIdReusePolicy}
* is `WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY`
*/
@SymbolBasedInstanceOfError('WorkflowExecutionAlreadyStartedError')
export class WorkflowExecutionAlreadyStartedError extends TemporalFailure {
constructor(
message: string,
public readonly workflowId: string,
public readonly workflowType: string
) {
super(message);
}
}
/**
* If `error` is already an `ApplicationFailure`, returns `error`.

@@ -276,0 +305,0 @@ *

@@ -11,2 +11,3 @@ import type { temporal } from '@temporalio/proto';

handler: WorkflowUpdateType;
unfinishedPolicy: HandlerUnfinishedPolicy;
validator?: WorkflowUpdateValidatorType;

@@ -16,3 +17,7 @@ description?: string;

export type WorkflowSignalType = (...args: any[]) => Promise<void> | void;
export type WorkflowSignalAnnotatedType = { handler: WorkflowSignalType; description?: string };
export type WorkflowSignalAnnotatedType = {
handler: WorkflowSignalType;
unfinishedPolicy: HandlerUnfinishedPolicy;
description?: string;
};
export type WorkflowQueryType = (...args: any[]) => any;

@@ -123,1 +128,20 @@ export type WorkflowQueryAnnotatedType = { handler: WorkflowQueryType; description?: string };

}
/**
* Policy defining actions taken when a workflow exits while update or signal handlers are running.
* The workflow exit may be due to successful return, failure, cancellation, or continue-as-new.
*/
export enum HandlerUnfinishedPolicy {
/**
* Issue a warning in addition to abandoning the handler execution. The warning will not be issued if the workflow fails.
*/
WARN_AND_ABANDON = 1,
/**
* Abandon the handler execution.
*
* In the case of an update handler this means that the client will receive an error rather than
* the update result.
*/
ABANDON = 2,
}

@@ -69,3 +69,3 @@ import Long from 'long'; // eslint-disable-line import/no-named-as-default

export function msOptionalToTs(str: Duration | undefined): Timestamp | undefined {
export function msOptionalToTs(str: Duration | undefined | null): Timestamp | undefined {
return str ? msToTs(str) : undefined;

@@ -72,0 +72,0 @@ }

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

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