Socket
Socket
Sign inDemoInstall

@temporalio/workflow

Package Overview
Dependencies
Maintainers
8
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 1.8.1 to 1.8.2

2

lib/errors.d.ts

@@ -5,3 +5,2 @@ /**

export declare class WorkflowError extends Error {
readonly name: string;
}

@@ -12,3 +11,2 @@ /**

export declare class DeterminismViolationError extends WorkflowError {
readonly name: string;
}

@@ -15,0 +13,0 @@ /**

33

lib/errors.js
"use strict";
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCancellation = exports.DeterminismViolationError = exports.WorkflowError = void 0;
const common_1 = require("@temporalio/common");
const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
/**
* Base class for all workflow errors
*/
class WorkflowError extends Error {
constructor() {
super(...arguments);
this.name = 'WorkflowError';
}
}
let WorkflowError = class WorkflowError extends Error {
};
WorkflowError = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('WorkflowError')
], WorkflowError);
exports.WorkflowError = WorkflowError;

@@ -18,8 +24,7 @@ /**

*/
class DeterminismViolationError extends WorkflowError {
constructor() {
super(...arguments);
this.name = 'DeterminismViolationError';
}
}
let DeterminismViolationError = class DeterminismViolationError extends WorkflowError {
};
DeterminismViolationError = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('DeterminismViolationError')
], DeterminismViolationError);
exports.DeterminismViolationError = DeterminismViolationError;

@@ -30,6 +35,6 @@ /**

function isCancellation(err) {
return (common_1.CancelledFailure.is(err) ||
((common_1.ActivityFailure.is(err) || common_1.ChildWorkflowFailure.is(err)) && common_1.CancelledFailure.is(err.cause)));
return (err instanceof common_1.CancelledFailure ||
((err instanceof common_1.ActivityFailure || err instanceof common_1.ChildWorkflowFailure) && err.cause instanceof common_1.CancelledFailure));
}
exports.isCancellation = isCancellation;
//# sourceMappingURL=errors.js.map

@@ -131,3 +131,2 @@ import type { RawSourceMap } from 'source-map';

}
declare const isContinueAsNew: unique symbol;
/**

@@ -138,12 +137,3 @@ * Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called

readonly command: coresdk.workflow_commands.IContinueAsNewWorkflowExecution;
readonly name = "ContinueAsNew";
constructor(command: coresdk.workflow_commands.IContinueAsNewWorkflowExecution);
/**
* Marker to determine whether an error is an instance of ContinueAsNew.
*/
protected readonly [isContinueAsNew] = true;
/**
* Instanceof check that works when multiple versions of @temporalio/workflow are installed.
*/
static is(error: unknown): error is ContinueAsNew;
}

@@ -359,2 +349,1 @@ /**

export type DefaultSignalHandler = (signalName: string, ...args: unknown[]) => void | Promise<void>;
export {};
"use strict";
var _a;
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;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ParentClosePolicy = exports.ChildWorkflowCancellationType = exports.ContinueAsNew = void 0;
const type_helpers_1 = require("@temporalio/common/lib/type-helpers");
const isContinueAsNew = Symbol.for('__temporal_isContinueAsNew');
/**
* Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called
*/
class ContinueAsNew extends Error {
let ContinueAsNew = class ContinueAsNew extends Error {
constructor(command) {
super('Workflow continued as new');
this.command = command;
this.name = 'ContinueAsNew';
/**
* Marker to determine whether an error is an instance of ContinueAsNew.
*/
this[_a] = true;
}
/**
* Instanceof check that works when multiple versions of @temporalio/workflow are installed.
*/
static is(error) {
return error instanceof ContinueAsNew || error?.[isContinueAsNew] === true;
}
}
};
ContinueAsNew = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('ContinueAsNew')
], ContinueAsNew);
exports.ContinueAsNew = ContinueAsNew;
_a = isContinueAsNew;
/**

@@ -30,0 +25,0 @@ * Specifies:

@@ -31,5 +31,4 @@ import type { RawSourceMap } from 'source-map';

*/
export declare class LocalActivityDoBackoff {
export declare class LocalActivityDoBackoff extends Error {
readonly backoff: coresdk.activity_result.IDoBackoff;
readonly name = "LocalActivityDoBackoff";
constructor(backoff: coresdk.activity_result.IDoBackoff);

@@ -36,0 +35,0 @@ }

"use strict";
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 __importDefault = (this && this.__importDefault) || function (mod) {

@@ -27,8 +33,11 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

*/
class LocalActivityDoBackoff {
let LocalActivityDoBackoff = class LocalActivityDoBackoff extends Error {
constructor(backoff) {
super();
this.backoff = backoff;
this.name = 'LocalActivityDoBackoff';
}
}
};
LocalActivityDoBackoff = __decorate([
(0, type_helpers_1.SymbolBasedInstanceOfError)('LocalActivityDoBackoff')
], LocalActivityDoBackoff);
exports.LocalActivityDoBackoff = LocalActivityDoBackoff;

@@ -468,7 +477,7 @@ /**

}
else if (interfaces_1.ContinueAsNew.is(error)) {
else if (error instanceof interfaces_1.ContinueAsNew) {
this.pushCommand({ continueAsNewWorkflowExecution: error.command }, true);
}
else {
if (!common_1.TemporalFailure.is(error)) {
if (!(error instanceof common_1.TemporalFailure)) {
// This results in an unhandled rejection which will fail the activation

@@ -475,0 +484,0 @@ // preventing it from completing.

@@ -16,2 +16,3 @@ /**

*/
import { WorkflowInfo } from './interfaces';
/**

@@ -39,2 +40,3 @@ * Any function signature can be used for Sink functions as long as the return type is `void`.

args: any[];
workflowInfo: WorkflowInfo;
}

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

@@ -185,3 +185,3 @@ import { ActivityFunction, ActivityOptions, LocalActivityOptions, QueryDefinition, SearchAttributes, SignalDefinition, UntypedActivities, WithWorkflowArgs, Workflow, WorkflowResultType, WorkflowReturnType } from '@temporalio/common';

*/
export declare function executeChild<T extends Workflow>(workflowType: T, options: WithWorkflowArgs<T, ChildWorkflowOptions>): Promise<WorkflowResultType<T>>;
export declare function executeChild<T extends Workflow>(workflowFunc: T, options: WithWorkflowArgs<T, ChildWorkflowOptions>): Promise<WorkflowResultType<T>>;
/**

@@ -188,0 +188,0 @@ * Start a child Workflow execution and await its completion.

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

const activator = assertInWorkflowContext('Proxied sinks functions may only be used from a Workflow Execution.');
const info = workflowInfo();
activator.sinkCalls.push({

@@ -645,2 +646,9 @@ ifaceName: ifaceName,

args: globalThis.structuredClone ? globalThis.structuredClone(args) : args,
// Clone the workflowInfo object so that any further mutations to it does not get reflected in sink
workflowInfo: {
...info,
// Make sure to clone any sub-property that may get mutated during the lifespan of an activation
searchAttributes: { ...info.searchAttributes },
memo: info.memo ? { ...info.memo } : undefined,
},
});

@@ -647,0 +655,0 @@ };

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

@@ -25,4 +25,4 @@ "keywords": [

"dependencies": {
"@temporalio/common": "1.8.1",
"@temporalio/proto": "1.8.1"
"@temporalio/common": "1.8.2",
"@temporalio/proto": "1.8.2"
},

@@ -39,3 +39,3 @@ "devDependencies": {

],
"gitHead": "97808111bbec478260e915726bb9730a489f8fa4"
"gitHead": "d85bf54da757741b438f8d39a0e7265b80d4f0d6"
}
import { ActivityFailure, CancelledFailure, ChildWorkflowFailure } from '@temporalio/common';
import { SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
/**
* Base class for all workflow errors
*/
export class WorkflowError extends Error {
public readonly name: string = 'WorkflowError';
}
@SymbolBasedInstanceOfError('WorkflowError')
export class WorkflowError extends Error {}

@@ -12,5 +13,4 @@ /**

*/
export class DeterminismViolationError extends WorkflowError {
public readonly name: string = 'DeterminismViolationError';
}
@SymbolBasedInstanceOfError('DeterminismViolationError')
export class DeterminismViolationError extends WorkflowError {}

@@ -22,5 +22,5 @@ /**

return (
CancelledFailure.is(err) ||
((ActivityFailure.is(err) || ChildWorkflowFailure.is(err)) && CancelledFailure.is(err.cause))
err instanceof CancelledFailure ||
((err instanceof ActivityFailure || err instanceof ChildWorkflowFailure) && err.cause instanceof CancelledFailure)
);
}

@@ -12,3 +12,3 @@ import type { RawSourceMap } from 'source-map';

} from '@temporalio/common';
import { checkExtends } from '@temporalio/common/lib/type-helpers';
import { checkExtends, SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
import type { coresdk } from '@temporalio/proto';

@@ -170,25 +170,10 @@

const isContinueAsNew = Symbol.for('__temporal_isContinueAsNew');
/**
* Not an actual error, used by the Workflow runtime to abort execution when {@link continueAsNew} is called
*/
@SymbolBasedInstanceOfError('ContinueAsNew')
export class ContinueAsNew extends Error {
public readonly name = 'ContinueAsNew';
constructor(public readonly command: coresdk.workflow_commands.IContinueAsNewWorkflowExecution) {
super('Workflow continued as new');
}
/**
* Marker to determine whether an error is an instance of ContinueAsNew.
*/
protected readonly [isContinueAsNew] = true;
/**
* Instanceof check that works when multiple versions of @temporalio/workflow are installed.
*/
static is(error: unknown): error is ContinueAsNew {
return error instanceof ContinueAsNew || (error as any)?.[isContinueAsNew] === true;
}
}

@@ -195,0 +180,0 @@

@@ -18,3 +18,3 @@ import type { RawSourceMap } from 'source-map';

import { composeInterceptors } from '@temporalio/common/lib/interceptors';
import { checkExtends } from '@temporalio/common/lib/type-helpers';
import { checkExtends, SymbolBasedInstanceOfError } from '@temporalio/common/lib/type-helpers';
import type { coresdk } from '@temporalio/proto';

@@ -74,5 +74,7 @@ import { alea, RNG } from './alea';

*/
export class LocalActivityDoBackoff {
public readonly name = 'LocalActivityDoBackoff';
constructor(public readonly backoff: coresdk.activity_result.IDoBackoff) {}
@SymbolBasedInstanceOfError('LocalActivityDoBackoff')
export class LocalActivityDoBackoff extends Error {
constructor(public readonly backoff: coresdk.activity_result.IDoBackoff) {
super();
}
}

@@ -628,6 +630,6 @@

this.pushCommand({ cancelWorkflowExecution: {} }, true);
} else if (ContinueAsNew.is(error)) {
} else if (error instanceof ContinueAsNew) {
this.pushCommand({ continueAsNewWorkflowExecution: error.command }, true);
} else {
if (!TemporalFailure.is(error)) {
if (!(error instanceof TemporalFailure)) {
// This results in an unhandled rejection which will fail the activation

@@ -634,0 +636,0 @@ // preventing it from completing.

@@ -17,2 +17,4 @@ /**

import { WorkflowInfo } from './interfaces';
/**

@@ -42,2 +44,3 @@ * Any function signature can be used for Sink functions as long as the return type is `void`.

args: any[];
workflowInfo: WorkflowInfo;
}

@@ -44,0 +47,0 @@

@@ -777,3 +777,3 @@ import {

export async function executeChild<T extends Workflow>(
workflowType: T,
workflowFunc: T,
options: WithWorkflowArgs<T, ChildWorkflowOptions>

@@ -915,2 +915,3 @@ ): Promise<WorkflowResultType<T>>;

);
const info = workflowInfo();
activator.sinkCalls.push({

@@ -921,2 +922,9 @@ ifaceName: ifaceName as string,

args: (globalThis as any).structuredClone ? (globalThis as any).structuredClone(args) : args,
// Clone the workflowInfo object so that any further mutations to it does not get reflected in sink
workflowInfo: {
...info,
// Make sure to clone any sub-property that may get mutated during the lifespan of an activation
searchAttributes: { ...info.searchAttributes },
memo: info.memo ? { ...info.memo } : undefined,
},
});

@@ -923,0 +931,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

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