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.15.0 to 0.16.0

7

lib/cancellation-scope.d.ts

@@ -0,1 +1,4 @@

/// <reference types="node" />
import type { AsyncLocalStorage as ALS } from 'async_hooks';
export declare const AsyncLocalStorage: new <T>() => ALS<T>;
/** Magic symbol used to create the root scope - intentionally not exported */

@@ -109,2 +112,6 @@ declare const NO_PARENT: unique symbol;

}
/**
* This is exported so it can be disposed in the worker interface
*/
export declare const storage: ALS<CancellationScope>;
export declare class RootCancellationScope extends CancellationScope {

@@ -111,0 +118,0 @@ cancel(): void;

16

lib/cancellation-scope.js

@@ -15,5 +15,8 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.registerSleepImplementation = exports.ROOT_SCOPE = exports.RootCancellationScope = exports.CancellationScope = void 0;
exports.registerSleepImplementation = exports.ROOT_SCOPE = exports.RootCancellationScope = exports.storage = exports.CancellationScope = exports.AsyncLocalStorage = void 0;
const common_1 = require("@temporalio/common");
const async_local_storage_1 = require("./async-local-storage");
// AsyncLocalStorage is injected via vm module into global scope.
// In case Workflow code is imported in Node.js context, replace with an empty class.
exports.AsyncLocalStorage = globalThis.AsyncLocalStorage ?? class {
};
/** Magic symbol used to create the root scope - intentionally not exported */

@@ -92,3 +95,3 @@ const NO_PARENT = Symbol('NO_PARENT');

run(fn) {
return storage.run(this, this.runInContext.bind(this, fn));
return exports.storage.run(this, this.runInContext.bind(this, fn));
}

@@ -116,3 +119,3 @@ /**

static current() {
return storage.getStore() ?? exports.ROOT_SCOPE;
return exports.storage.getStore() ?? exports.ROOT_SCOPE;
}

@@ -134,3 +137,6 @@ /** Alias to `new CancellationScope({ cancellable: true }).run(fn)` */

_CancellationScope_cancelRequested = new WeakMap();
const storage = new async_local_storage_1.AsyncLocalStorage();
/**
* This is exported so it can be disposed in the worker interface
*/
exports.storage = new exports.AsyncLocalStorage();
class RootCancellationScope extends CancellationScope {

@@ -137,0 +143,0 @@ cancel() {

@@ -57,6 +57,5 @@ /**

export * from './interceptors';
export { ROOT_SCOPE, CancellationScope, CancellationScopeOptions } from './cancellation-scope';
export { AsyncLocalStorage, ROOT_SCOPE, CancellationScope, CancellationScopeOptions } from './cancellation-scope';
export { Trigger } from './trigger';
export { SinkFunction, Sink, Sinks, SinkCall } from './sinks';
export { ChildWorkflowHandle, ExternalWorkflowHandle } from './workflow-handle';
export { AsyncLocalStorage } from './async-local-storage';

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.AsyncLocalStorage = exports.Trigger = exports.CancellationScope = exports.ROOT_SCOPE = exports.ParentClosePolicy = exports.ChildWorkflowCancellationType = exports.ValueError = exports.TimeoutFailure = exports.TerminatedFailure = exports.TemporalFailure = exports.ServerFailure = exports.ChildWorkflowFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ActivityFailure = exports.WorkflowIdReusePolicy = exports.defaultDataConverter = exports.IllegalStateError = exports.rootCause = exports.ActivityCancellationType = void 0;
exports.Trigger = exports.CancellationScope = exports.ROOT_SCOPE = exports.AsyncLocalStorage = exports.ParentClosePolicy = exports.ChildWorkflowCancellationType = exports.ValueError = exports.TimeoutFailure = exports.TerminatedFailure = exports.TemporalFailure = exports.ServerFailure = exports.ChildWorkflowFailure = exports.CancelledFailure = exports.ApplicationFailure = exports.ActivityFailure = exports.WorkflowIdReusePolicy = exports.defaultDataConverter = exports.IllegalStateError = exports.rootCause = exports.ActivityCancellationType = void 0;
var common_1 = require("@temporalio/common");

@@ -88,2 +88,3 @@ Object.defineProperty(exports, "ActivityCancellationType", { enumerable: true, get: function () { return common_1.ActivityCancellationType; } });

var cancellation_scope_1 = require("./cancellation-scope");
Object.defineProperty(exports, "AsyncLocalStorage", { enumerable: true, get: function () { return cancellation_scope_1.AsyncLocalStorage; } });
Object.defineProperty(exports, "ROOT_SCOPE", { enumerable: true, get: function () { return cancellation_scope_1.ROOT_SCOPE; } });

@@ -93,4 +94,2 @@ Object.defineProperty(exports, "CancellationScope", { enumerable: true, get: function () { return cancellation_scope_1.CancellationScope; } });

Object.defineProperty(exports, "Trigger", { enumerable: true, get: function () { return trigger_1.Trigger; } });
var async_local_storage_1 = require("./async-local-storage");
Object.defineProperty(exports, "AsyncLocalStorage", { enumerable: true, get: function () { return async_local_storage_1.AsyncLocalStorage; } });
//# sourceMappingURL=index.js.map

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

}
/** Input for WorkflowInternalsInterceptor.dispose */
export interface DisposeInput {
}
/**

@@ -153,2 +156,8 @@ * Interceptor for the internals of the Workflow runtime.

concludeActivation?(input: ConcludeActivationInput, next: Next<this, 'concludeActivation'>): ConcludeActivationOutput;
/**
* Called before disposing the Workflow isolate context.
*
* Implement this method to perform any resource cleanup.
*/
dispose?(input: DisposeInput, next: Next<this, 'dispose'>): Promise<void>;
}

@@ -155,0 +164,0 @@ /**

import { coresdk } from '@temporalio/proto/lib/coresdk';
import { WorkflowOptions } from '@temporalio/common';
import { CommonWorkflowOptions } from '@temporalio/common';
/**

@@ -76,4 +76,15 @@ * Workflow execution information

export declare const ParentClosePolicy: typeof coresdk.child_workflow.ParentClosePolicy;
export interface ChildWorkflowOptions extends WorkflowOptions {
export interface ChildWorkflowOptions extends CommonWorkflowOptions {
/**
* Workflow id to use when starting. If not specified a UUID is generated. Note that it is
* dangerous as in case of client side retries no deduplication will happen based on the
* generated id. So prefer assigning business meaningful ids if possible.
*/
workflowId?: string;
/**
* Task queue to use for Workflow tasks. It should match a task queue specified when creating a
* `Worker` that hosts the Workflow code.
*/
taskQueue?: string;
/**
* In case of a child workflow cancellation it fails with a CanceledFailure.

@@ -80,0 +91,0 @@ * The type defines at which point the exception is thrown.

@@ -19,3 +19,4 @@ /**

*
* When calling a Sink function, arguments are copied from the Workflow isolate to the Node.js environment.
* When calling a Sink function, arguments are copied from the Workflow isolate to the Node.js environment using [postMessage](https://nodejs.org/api/worker_threads.html#worker_threads_port_postmessage_value_transferlist).
* This constrains the argument types to primitives (excluding Symbols).

@@ -22,0 +23,0 @@ */

import { WorkflowInfo } from './interfaces';
import { state } from './internals';
import { SinkCall } from './sinks';
import { IsolateExtension } from './promise-hooks';
export interface WorkflowCreateOptions {

@@ -19,3 +18,3 @@ info: WorkflowInfo;

*/
export declare function initRuntime({ info, interceptorModules, randomnessSeed, now, patches }: WorkflowCreateOptions, isolateExtension: IsolateExtension): Promise<void>;
export declare function initRuntime({ info, interceptorModules, randomnessSeed, now, patches, }: WorkflowCreateOptions): Promise<void>;
export interface ActivationResult {

@@ -43,1 +42,2 @@ numBlockedConditions: number;

export declare function tryUnblockConditions(): number;
export declare function dispose(): Promise<void>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryUnblockConditions = exports.getAndResetSinkCalls = exports.concludeActivation = exports.activate = exports.initRuntime = exports.overrideGlobals = exports.setRequireFunc = void 0;
exports.dispose = exports.tryUnblockConditions = exports.getAndResetSinkCalls = exports.concludeActivation = exports.activate = exports.initRuntime = exports.overrideGlobals = exports.setRequireFunc = void 0;
/**

@@ -12,5 +12,5 @@ * Exported functions for the Worker to interact with the Workflow isolate

const internals_1 = require("./internals");
const cancellation_scope_1 = require("./cancellation-scope");
const alea_1 = require("./alea");
const errors_1 = require("./errors");
const promise_hooks_1 = require("./promise-hooks");
function setRequireFunc(fn) {

@@ -80,3 +80,3 @@ internals_1.state.require = fn;

*/
async function initRuntime({ info, interceptorModules, randomnessSeed, now, patches }, isolateExtension) {
async function initRuntime({ info, interceptorModules, randomnessSeed, now, patches, }) {
// Globals are overridden while building the isolate before loading user code.

@@ -90,3 +90,2 @@ // For some reason the `WeakRef` mock is not restored properly when creating an isolate from snapshot in node 14 (at least on ubuntu), override again.

internals_1.state.random = (0, alea_1.alea)(randomnessSeed);
promise_hooks_1.HookManager.instance.setIsolateExtension(isolateExtension);
if (info.isReplaying) {

@@ -226,2 +225,9 @@ for (const patch of patches) {

exports.tryUnblockConditions = tryUnblockConditions;
async function dispose() {
const dispose = (0, common_1.composeInterceptors)(internals_1.state.interceptors.internals, 'dispose', async () => {
cancellation_scope_1.storage.disable();
});
await dispose({});
}
exports.dispose = dispose;
//# sourceMappingURL=worker-interface.js.map
{
"name": "@temporalio/workflow",
"version": "0.15.0",
"version": "0.16.0",
"description": "Temporal.io SDK Workflow sub-package",

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

"dependencies": {
"@temporalio/common": "^0.15.0",
"@temporalio/proto": "^0.15.0"
"@temporalio/common": "^0.16.0",
"@temporalio/proto": "^0.16.0"
},

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

},
"gitHead": "81960030b31d52200129d6ea9ebfaa12771dcc45"
"gitHead": "42638434f033db2b55c43c2a9a7751d883ba17ec"
}

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