function-tree
Advanced tools
Comparing version
@@ -50,3 +50,3 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
key: "onMessage", | ||
value: function onMessage(event) {} | ||
value: function onMessage(_event) {} | ||
}, { | ||
@@ -257,2 +257,3 @@ key: "reconnect", | ||
value: function sendInitial() {} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
}, { | ||
@@ -259,0 +260,0 @@ key: "createExecutionMessage", |
@@ -44,3 +44,3 @@ import { FunctionTreeExecutionError } from './errors'; | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
currentItem.items.forEach(function (func) { | ||
if (func["function"]) { | ||
@@ -47,0 +47,0 @@ execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { |
@@ -31,3 +31,5 @@ var __extends = (this && this.__extends) || (function () { | ||
actions.forEach(function (element) { | ||
typeFirst && Object.defineProperty(element, 'name', { value: action[0] }); | ||
if (typeFirst) { | ||
Object.defineProperty(element, 'name', { value: action[0] }); | ||
} | ||
}); | ||
@@ -34,0 +36,0 @@ (_a = this.sequenceArray).push.apply(_a, actions); |
@@ -34,3 +34,3 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | ||
} | ||
function analyze(name, functions, item, isParallel) { | ||
function analyze(name, functions, item, _isParallel) { | ||
if (item instanceof Primitive) { | ||
@@ -37,0 +37,0 @@ var instance = item.toJSON(); |
@@ -26,24 +26,22 @@ import { Primitive } from '../' | ||
branch<TPaths, TOutput = {}>( | ||
action: (( | ||
action: ( | ||
props: TContext & IBranchContext<TPaths, TProps> | ||
) => TOutput | Promise<TOutput>) | ||
) => TOutput | Promise<TOutput> | ||
): { | ||
paths: ( | ||
paths: { | ||
[key in keyof TPaths]: ( | ||
props: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
} | ||
) => SequenceBuilder<TContext, TProps & TOutput> | ||
paths: (paths: { | ||
[key in keyof TPaths]: ( | ||
props: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
}) => SequenceBuilder<TContext, TProps & TOutput> | ||
} | ||
parallel<TOutput>( | ||
name: string, | ||
chain: (( | ||
chain: ( | ||
props: SequenceBuilder<TContext, TProps> | ||
) => SequenceBuilder<TContext, TOutput>) | ||
) => SequenceBuilder<TContext, TOutput> | ||
): SequenceBuilder<TContext, TProps & TOutput> | ||
parallel<TOutput>( | ||
chain: (( | ||
chain: ( | ||
props: SequenceBuilder<TContext, TProps> | ||
) => SequenceBuilder<TContext, TOutput>) | ||
) => SequenceBuilder<TContext, TOutput> | ||
): SequenceBuilder<TContext, TProps & TOutput> | ||
@@ -56,9 +54,7 @@ sequence<TOutput = void>( | ||
): { | ||
paths: ( | ||
paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
} | ||
) => SequenceBuilder<TContext, TProps> | ||
paths: (paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
}) => SequenceBuilder<TContext, TProps> | ||
} | ||
@@ -68,9 +64,7 @@ debounce<TPaths extends { continue: {}; discard: {} }>( | ||
): { | ||
paths: ( | ||
paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
} | ||
) => SequenceBuilder<TContext, TProps> | ||
paths: (paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
}) => SequenceBuilder<TContext, TProps> | ||
} | ||
@@ -80,9 +74,7 @@ equals<TPaths extends { [key: string]: {} }, TValue>( | ||
): { | ||
paths: ( | ||
paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
} | ||
) => SequenceBuilder<TContext, TProps> | ||
paths: (paths: { | ||
[key in keyof TPaths]: ( | ||
input: SequenceBuilder<TContext, TProps & TPaths[key]> | ||
) => SequenceBuilder<TContext, TProps & TPaths[key]> | ||
}) => SequenceBuilder<TContext, TProps> | ||
} | ||
@@ -94,3 +86,3 @@ wait(ms: number): ContinueSequenceBuilder<TContext, TProps> | ||
TContext = {}, | ||
TProps = {} | ||
TProps = {}, | ||
> extends SequenceBuilder<TContext, TProps> { | ||
@@ -126,3 +118,3 @@ continue( | ||
Props, | ||
Output = Props | ||
Output = Props, | ||
>( | ||
@@ -129,0 +121,0 @@ arg: ( |
@@ -57,3 +57,3 @@ "use strict"; | ||
key: "onMessage", | ||
value: function onMessage(event) {} | ||
value: function onMessage(_event) {} | ||
}, { | ||
@@ -264,2 +264,3 @@ key: "reconnect", | ||
value: function sendInitial() {} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
}, { | ||
@@ -266,0 +267,0 @@ key: "createExecutionMessage", |
@@ -50,3 +50,3 @@ "use strict"; | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
currentItem.items.forEach(function (func) { | ||
if (func["function"]) { | ||
@@ -53,0 +53,0 @@ execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { |
@@ -18,3 +18,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SequenceWithPropsFactory = exports.SequenceFactory = exports.SequenceWithProps = exports.Sequence = exports.sequenceFactory = exports.ContinueSequenceBuilder = exports.SequenceBuilder = void 0; | ||
exports.ContinueSequenceBuilder = exports.SequenceBuilder = void 0; | ||
exports.sequenceFactory = sequenceFactory; | ||
exports.Sequence = Sequence; | ||
exports.SequenceWithProps = SequenceWithProps; | ||
exports.SequenceFactory = SequenceFactory; | ||
exports.SequenceWithPropsFactory = SequenceWithPropsFactory; | ||
var __1 = require("../../"); | ||
@@ -35,3 +40,5 @@ var factories_1 = require("../../factories/"); | ||
actions.forEach(function (element) { | ||
typeFirst && Object.defineProperty(element, 'name', { value: action[0] }); | ||
if (typeFirst) { | ||
Object.defineProperty(element, 'name', { value: action[0] }); | ||
} | ||
}); | ||
@@ -122,11 +129,8 @@ (_a = this.sequenceArray).push.apply(_a, actions); | ||
} | ||
exports.sequenceFactory = sequenceFactory; | ||
function Sequence(arg) { | ||
return sequenceFactory(arg); | ||
} | ||
exports.Sequence = Sequence; | ||
function SequenceWithProps(arg) { | ||
return sequenceFactory(arg); | ||
} | ||
exports.SequenceWithProps = SequenceWithProps; | ||
function SequenceFactory() { | ||
@@ -138,3 +142,2 @@ function returned(arg) { | ||
} | ||
exports.SequenceFactory = SequenceFactory; | ||
function SequenceWithPropsFactory() { | ||
@@ -146,3 +149,2 @@ function returned(arg) { | ||
} | ||
exports.SequenceWithPropsFactory = SequenceWithPropsFactory; | ||
//# sourceMappingURL=index.js.map |
@@ -40,3 +40,3 @@ "use strict"; | ||
} | ||
function analyze(name, functions, item, isParallel) { | ||
function analyze(name, functions, item, _isParallel) { | ||
if (item instanceof _primitives.Primitive) { | ||
@@ -43,0 +43,0 @@ var instance = item.toJSON(); |
{ | ||
"name": "function-tree", | ||
"version": "3.3.2-1741013561634", | ||
"version": "3.3.2-1742462834313", | ||
"description": "When a function is not enough", | ||
@@ -16,4 +16,5 @@ "main": "index.js", | ||
"test": "npm run test:ts && cross-env NODE_ENV=test BABEL_ENV=test mocha --require @babel/register \"src/**/*.test.js\"", | ||
"test:ts": "cross-env TS_NODE_IGNORE=false mocha --require ts-node/register \"src/**/*.spec.ts\"", | ||
"test:watch": "npm run test -- --watch" | ||
"test:ts": "cross-env NODE_OPTIONS=--import=tsx mocha \"src/**/*.spec.ts\"", | ||
"test:watch": "npm run test -- --watch", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
@@ -24,6 +25,2 @@ "dependencies": { | ||
}, | ||
"devDependencies": { | ||
"mock-socket": "^6.0.4", | ||
"npm-run-all": "^4.1.5" | ||
}, | ||
"directories": { | ||
@@ -30,0 +27,0 @@ "test": "tests" |
@@ -28,21 +28,19 @@ # function-tree | ||
ft | ||
.run( | ||
[ | ||
// returns a promise | ||
function someFunc(context) {}, | ||
function someOtherFunc(context) {} | ||
], | ||
{ | ||
foo: 'bar' // optional payload | ||
} | ||
) | ||
.catch((error) => { | ||
// Current payload with execution details, | ||
// can be passed in to a new execution (will be indicated in debugger) | ||
error.payload | ||
ft.run( | ||
[ | ||
// returns a promise | ||
function someFunc(context) {}, | ||
function someOtherFunc(context) {} | ||
], | ||
{ | ||
foo: 'bar' // optional payload | ||
} | ||
).catch((error) => { | ||
// Current payload with execution details, | ||
// can be passed in to a new execution (will be indicated in debugger) | ||
error.payload | ||
// A serialized version of the error. Name, message and stack, or custom error serialization | ||
error.payload.error | ||
}) | ||
// A serialized version of the error. Name, message and stack, or custom error serialization | ||
error.payload.error | ||
}) | ||
``` | ||
@@ -73,3 +71,3 @@ | ||
message: 'Some function-tree error' | ||
stack: '...' | ||
stack: '...' | ||
} | ||
@@ -92,3 +90,3 @@ ``` | ||
payload: {foo: 'bar'}, | ||
stack: '...' | ||
stack: '...' | ||
} | ||
@@ -259,3 +257,3 @@ ``` | ||
// As an event (async) | ||
ft.on('error', function(error, execution, payload) {}) | ||
ft.on('error', function (error, execution, payload) {}) | ||
@@ -262,0 +260,0 @@ // As callback for single execution |
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
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
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
Sorry, the diff of this file is not supported yet
421294
00
-100%3963
-0.05%470
-0.42%