function-tree
Advanced tools
Comparing version 3.2.0-1518957951883 to 3.2.0-1518980138892
@@ -27,3 +27,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
_this.latestExecutionId = null; | ||
_this.version = "3.2.0-1518957951883"; | ||
_this.version = "3.2.0-1518980138892"; | ||
_this.init(); | ||
@@ -30,0 +30,0 @@ return _this; |
@@ -11,75 +11,73 @@ import { FunctionTreeExecutionError } from './errors'; | ||
*/ | ||
export default function executeTree(execution, initialPayload, executeBranchWrapper, branchStart, branchEnd, parallelStart, parallelProgress, parallelEnd, end) { | ||
export default function executeTree(execution, initialPayload, branchStart, branchEnd, parallelStart, parallelProgress, parallelEnd, end) { | ||
function runBranch(branch, index, payload, prevPayload, nextBranch) { | ||
executeBranchWrapper(function () { | ||
function runNextItem(result) { | ||
runBranch(branch, index + 1, result, payload, nextBranch); | ||
} | ||
function runNextItem(result) { | ||
runBranch(branch, index + 1, result, payload, nextBranch); | ||
} | ||
function processFunctionOutput(funcDetails, outputResult) { | ||
return function (result) { | ||
var newPayload = Object.assign({}, payload, result ? result.payload : {}); | ||
function processFunctionOutput(funcDetails, outputResult) { | ||
return function (result) { | ||
var newPayload = Object.assign({}, payload, result ? result.payload : {}); | ||
if (result && funcDetails.outputs) { | ||
var outputs = Object.keys(funcDetails.outputs); | ||
if (result && funcDetails.outputs) { | ||
var outputs = Object.keys(funcDetails.outputs); | ||
if (~outputs.indexOf(result.path)) { | ||
branchStart(funcDetails, result.path, newPayload); | ||
runBranch(funcDetails.outputs[result.path].items, 0, newPayload, payload, outputResult); | ||
} else { | ||
throw new FunctionTreeExecutionError(execution, funcDetails, payload, 'function ' + funcDetails.name + ' must use one of its possible outputs: ' + outputs.join(', ') + '.'); | ||
} | ||
if (~outputs.indexOf(result.path)) { | ||
branchStart(funcDetails, result.path, newPayload); | ||
runBranch(funcDetails.outputs[result.path].items, 0, newPayload, payload, outputResult); | ||
} else { | ||
outputResult(newPayload); | ||
throw new FunctionTreeExecutionError(execution, funcDetails, payload, 'function ' + funcDetails.name + ' must use one of its possible outputs: ' + outputs.join(', ') + '.'); | ||
} | ||
}; | ||
} else { | ||
outputResult(newPayload); | ||
} | ||
}; | ||
} | ||
var currentItem = branch[index]; | ||
if (!currentItem) { | ||
if (branch !== execution.staticTree) { | ||
branchEnd(payload); | ||
} | ||
nextBranch(payload); | ||
} else if (isPrimitive(currentItem, 'sequence')) { | ||
runBranch(currentItem.items, 0, payload, prevPayload, runNextItem); | ||
} else if (isPrimitive(currentItem, 'parallel')) { | ||
var itemLength = currentItem.items.length; | ||
var payloads = []; | ||
var currentItem = branch[index]; | ||
if (!currentItem) { | ||
if (branch !== execution.staticTree) { | ||
branchEnd(payload); | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
if (func.function) { | ||
execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
})); | ||
} else { | ||
runBranch(func.items, 0, payload, prevPayload, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
}); | ||
} | ||
nextBranch(payload); | ||
} else if (isPrimitive(currentItem, 'sequence')) { | ||
runBranch(currentItem.items, 0, payload, prevPayload, runNextItem); | ||
} else if (isPrimitive(currentItem, 'parallel')) { | ||
var itemLength = currentItem.items.length; | ||
var payloads = []; | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
if (func.function) { | ||
execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
})); | ||
} else { | ||
runBranch(func.items, 0, payload, prevPayload, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
}); | ||
} | ||
return payloads; | ||
}); | ||
} else { | ||
execution.runFunction(currentItem, payload, prevPayload, processFunctionOutput(currentItem, runNextItem)); | ||
} | ||
}); | ||
return payloads; | ||
}); | ||
} else { | ||
execution.runFunction(currentItem, payload, prevPayload, processFunctionOutput(currentItem, runNextItem)); | ||
} | ||
} | ||
runBranch([execution.staticTree], 0, initialPayload, null, end); | ||
return runBranch([execution.staticTree], 0, initialPayload, null, end); | ||
} | ||
//# sourceMappingURL=executeTree.js.map |
@@ -238,3 +238,2 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var contextProviders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -247,5 +246,2 @@ _classCallCheck(this, FunctionTree); | ||
_this.cachedStaticTrees = []; | ||
_this.executeBranchWrapper = options.executeBranchWrapper || function (cb) { | ||
cb(); | ||
}; | ||
@@ -320,3 +316,3 @@ if ((typeof contextProviders === 'undefined' ? 'undefined' : _typeof(contextProviders)) !== 'object' || contextProviders === null || Array.isArray(contextProviders)) { | ||
_this2.emit('start', execution, payload); | ||
executeTree(execution, payload, _this2.executeBranchWrapper, function (funcDetails, path, currentPayload) { | ||
executeTree(execution, payload, function (funcDetails, path, currentPayload) { | ||
_this2.emit('pathStart', path, execution, funcDetails, currentPayload); | ||
@@ -323,0 +319,0 @@ }, function (currentPayload) { |
@@ -13,12 +13,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
_ref$wrap = _ref.wrap, | ||
wrap = _ref$wrap === undefined ? true : _ref$wrap, | ||
_ref$ignoreDefinition = _ref.ignoreDefinition, | ||
ignoreDefinition = _ref$ignoreDefinition === undefined ? false : _ref$ignoreDefinition; | ||
wrap = _ref$wrap === undefined ? true : _ref$wrap; | ||
_classCallCheck(this, Provider); | ||
if (!ignoreDefinition) { | ||
this.verifyDefinition(definition); | ||
} | ||
this.verifyDefinition(definition); | ||
this.wrap = wrap; | ||
@@ -35,3 +30,3 @@ | ||
}; | ||
this.WrappedProviderConstructor.prototype = Object.keys(ignoreDefinition ? {} : definition).reduce(function (wrappedProvider, key) { | ||
this.WrappedProviderConstructor.prototype = Object.keys(definition).reduce(function (wrappedProvider, key) { | ||
var originalFunc = definition[key]; | ||
@@ -87,6 +82,2 @@ | ||
value: function verifyDefinition(definition) { | ||
if (this.ignoreDefinition) { | ||
return; | ||
} | ||
if ((typeof definition === 'undefined' ? 'undefined' : _typeof(definition)) !== 'object' || definition === null) { | ||
@@ -93,0 +84,0 @@ throw new Error('The definition passed as Provider is not valid'); |
@@ -1,4 +0,4 @@ | ||
import { FunctionTree } from '../' | ||
import { FunctionTreeExecutable } from '../' | ||
export interface DebounceFunction extends FunctionTree { | ||
export interface DebounceFunction extends FunctionTreeExecutable { | ||
displayName: string | ||
@@ -5,0 +5,0 @@ (context: { path: string }): Promise<any> |
173
index.d.ts
import { EventEmitter } from 'eventemitter3' | ||
interface Payload { | ||
[key: string]: any | ||
[key: number]: any | ||
} | ||
export interface IPath { | ||
path: string | ||
payload: Payload | ||
} | ||
export class Path implements IPath { | ||
path: string | ||
payload: Payload | ||
constructor(path: string, payload: Payload) | ||
toJS(): IPath | ||
} | ||
export class Abort { | ||
constructor(payload: Payload) | ||
} | ||
export function createStaticTree(tree: Primitive | Array<Function | Primitive>): Array<Primitive> | ||
type RunFunctionResolve = (funcDetails: Primitive, payload: Payload, prevPayload: Payload, next: any) => void | ||
type BranchStartCallback = (funcDetails: Primitive, path: string, payload: Payload) => void | ||
type BranchEndCallback = (payload: Payload) => void | ||
type ParallelStartEndCallback = (payload: Payload, itemLength: number) => void | ||
type ParallelProgressCallback = (payload: Payload, remainingLength: number) => void | ||
export function executeTree( | ||
tree: Array<Primitive>, | ||
resolveFunctionResult: RunFunctionResolve, | ||
initialPayload: Payload, | ||
branchStart: BranchStartCallback, | ||
branchEnd: BranchEndCallback, | ||
parallelStart: ParallelStartEndCallback, | ||
parallelProgress: ParallelProgressCallback, | ||
parallelEnd: ParallelStartEndCallback, | ||
end: BranchEndCallback | ||
): void | ||
export class Primitive { | ||
name?: string | ||
function: Function | ||
"function": Function | ||
functionIndex: number | ||
@@ -13,66 +55,104 @@ items: Array<Primitive> | ||
type TPath = { | ||
[key: string]: TFunctionTreeExecutable | ||
// deprectated, use Primitive instead | ||
export type FunctionTreePrimitive = Primitive | ||
export interface FunctionTreeExecutable { | ||
} | ||
type TSequenceArray = Array<Primitive | Function | TPath> | ||
export function sequence(items: Array<FunctionTreeExecutable>): Primitive | ||
export function sequence(name: string, items: Array<FunctionTreeExecutable>): Primitive | ||
export type TFunctionTreeExecutable = Primitive | Function | TPath | TSequenceArray | ||
export function parallel(items: Array<FunctionTreeExecutable>): Primitive | ||
export function parallel(name: string, items: Array<FunctionTreeExecutable>): Primitive | ||
interface IPayload { | ||
[key: string]: any | ||
[key: number]: any | ||
export interface RunTreeFunction { | ||
(): void | ||
on(event: string | symbol, listener: Function): this | ||
once(event: string | symbol, listener: Function): this | ||
off(event: string | symbol, listener: Function): this | ||
} | ||
export interface IPath { | ||
path: string | ||
payload: IPayload | ||
} | ||
type TContextProviders = { | ||
[key: string]: Provider | ||
export interface DevtoolsOptions { | ||
host: string | ||
} | ||
export class FunctionTree extends EventEmitter { | ||
constructor(contextProviders?: TContextProviders) | ||
run(sequence: TFunctionTreeExecutable, payload?: IPayload): Promise<any> | ||
export class Devtools { | ||
constructor(options: DevtoolsOptions) | ||
addListeners(): void | ||
init(): void | ||
safeStringify(object: any): string | ||
reInit(): void | ||
sendMessage(message: string): void | ||
watchExecution(tree: FunctionTree): void | ||
sendInitial(): void | ||
createExecutionMessage(debuggingData: any, context: any, functionDetails: Primitive, payload: Payload): string | ||
sendExecutionData(debuggingData: any, context: any, functionDetails: Primitive, payload: Payload): void | ||
Provider(): (context: any, functionDetails: Primitive, payload: Payload) => any | ||
} | ||
export interface IBaseContext { | ||
[providerName: string]: any | ||
resolve: IResolve | ||
export class FunctionTreeError extends Error { | ||
constructor(error: any) | ||
toJSON(): any | ||
} | ||
export interface IContext<T={}> extends IBaseContext { | ||
props: T | ||
export class FunctionTreeExecutionError extends FunctionTreeError { | ||
constructor(execution: any, funcDetails: any, payload: any, error: any) | ||
toJSON(): any | ||
} | ||
type TTagFactory<T> = (path: TemplateStringsArray | string[], ...values: any[]) => Tag<T> | ||
export type Provider = (context: any, funcDetails: Primitive, payload: Payload, next: Payload) => any | ||
export function createTemplateTag<T=any>(tagName: string, getValue: (path: string, context: IBaseContext) => T): TTagFactory<T> | ||
export function ReduxProvider(store: any): Provider | ||
export function PropsProvider(): Provider | ||
export function PathProvider(): Provider | ||
export function ExecutionProvider(execution: any, abort: Abort): Provider | ||
export function ContextProvider(extendedContext: any): Provider | ||
export function extractValueWithPath<T=any>(obj: any, path: string): T | ||
export class FunctionTree extends EventEmitter { | ||
constructor(contextProviders: Array<Provider>) | ||
cachedTrees: Array<Primitive> | ||
contextProviders: Array<Provider> | ||
runTree: RunTreeFunction | ||
export function resolveObject<T=any>(obj: any): ResolveValue<T> | ||
createContext(funcDetails: Primitive, payload: Payload, prevPayload: Payload): Array<Provider> | ||
run(...args: any[]): Promise<any> | ||
} | ||
export class Provider<IContext = {}> { | ||
constructor (definition: { [key: string]: (this: { context: IContext }, ...args : any[]) => void }) | ||
// ========= Contextual value | ||
export interface BaseContext { | ||
[providerName: string]: any | ||
// Keys set to 'any' type are not defined so that they | ||
// can be overriden in generic type. | ||
// execution: any | ||
// path: any | ||
// props: any | ||
resolve: Resolve | ||
} | ||
export class Path implements IPath { | ||
path: string | ||
payload: IPayload | ||
constructor(path: string, payload: IPayload) | ||
toJS(): IPath | ||
export type Context<T={}> = BaseContext & T | ||
export abstract class ResolveValue<T=any, C={}> { | ||
abstract getValue(context: Context<C>): T | ||
} | ||
export function sequence(items: Array<TSequenceArray>): Primitive | ||
export function sequence(name: string, items: Array<TSequenceArray>): Primitive | ||
export function parallel(items: Array<TSequenceArray>): Primitive | ||
export function parallel(name: string, items: Array<TSequenceArray>): Primitive | ||
interface TagOptions { | ||
hasValue?: boolean | ||
isStateDependency?: boolean | ||
} | ||
export class ResolveValue<T=any> {} | ||
export class Tag<T=any> extends ResolveValue<T> { | ||
constructor() | ||
constructor( | ||
tag: string, | ||
options: TagOptions, | ||
strings: string[], | ||
values: any[] | ||
) | ||
options: TagOptions | ||
strings: string[] | ||
type: string | ||
values: any[] | ||
getPath(getters: any): string | ||
@@ -82,5 +162,6 @@ getValue(getters: any): T | ||
export interface IResolve { | ||
export interface Resolve { | ||
isTag(arg: any, ...types: string[]): arg is Tag | ||
isResolveValue(arg: any): arg is ResolveValue | ||
path(tag: Tag): string | ||
@@ -91,2 +172,10 @@ value<T>(value: Tag<T>, overrideContext?: any): T | ||
value<T=any>(value: ResolveValue<T> | T, overrideContext?: any): T | ||
} | ||
} | ||
// ========= Helpers | ||
export function extractValueWithPath<T=any>(obj: any, path: string): T | ||
type TagFactory<T> = (path: TemplateStringsArray | string[], ...values: any[]) => Tag<T> | ||
export function createTemplateTag<T=any>(tagName: string, getValue: (path: string, context: BaseContext) => T): TagFactory<T> | ||
export function resolveObject<T=any>(obj: any): ResolveValue<T> |
@@ -48,3 +48,3 @@ 'use strict'; | ||
_this.latestExecutionId = null; | ||
_this.version = "3.2.0-1518957951883"; | ||
_this.version = "3.2.0-1518980138892"; | ||
_this.init(); | ||
@@ -51,0 +51,0 @@ return _this; |
@@ -18,75 +18,73 @@ 'use strict'; | ||
*/ | ||
function executeTree(execution, initialPayload, executeBranchWrapper, branchStart, branchEnd, parallelStart, parallelProgress, parallelEnd, end) { | ||
function executeTree(execution, initialPayload, branchStart, branchEnd, parallelStart, parallelProgress, parallelEnd, end) { | ||
function runBranch(branch, index, payload, prevPayload, nextBranch) { | ||
executeBranchWrapper(function () { | ||
function runNextItem(result) { | ||
runBranch(branch, index + 1, result, payload, nextBranch); | ||
} | ||
function runNextItem(result) { | ||
runBranch(branch, index + 1, result, payload, nextBranch); | ||
} | ||
function processFunctionOutput(funcDetails, outputResult) { | ||
return function (result) { | ||
var newPayload = Object.assign({}, payload, result ? result.payload : {}); | ||
function processFunctionOutput(funcDetails, outputResult) { | ||
return function (result) { | ||
var newPayload = Object.assign({}, payload, result ? result.payload : {}); | ||
if (result && funcDetails.outputs) { | ||
var outputs = Object.keys(funcDetails.outputs); | ||
if (result && funcDetails.outputs) { | ||
var outputs = Object.keys(funcDetails.outputs); | ||
if (~outputs.indexOf(result.path)) { | ||
branchStart(funcDetails, result.path, newPayload); | ||
runBranch(funcDetails.outputs[result.path].items, 0, newPayload, payload, outputResult); | ||
} else { | ||
throw new _errors.FunctionTreeExecutionError(execution, funcDetails, payload, 'function ' + funcDetails.name + ' must use one of its possible outputs: ' + outputs.join(', ') + '.'); | ||
} | ||
if (~outputs.indexOf(result.path)) { | ||
branchStart(funcDetails, result.path, newPayload); | ||
runBranch(funcDetails.outputs[result.path].items, 0, newPayload, payload, outputResult); | ||
} else { | ||
outputResult(newPayload); | ||
throw new _errors.FunctionTreeExecutionError(execution, funcDetails, payload, 'function ' + funcDetails.name + ' must use one of its possible outputs: ' + outputs.join(', ') + '.'); | ||
} | ||
}; | ||
} else { | ||
outputResult(newPayload); | ||
} | ||
}; | ||
} | ||
var currentItem = branch[index]; | ||
if (!currentItem) { | ||
if (branch !== execution.staticTree) { | ||
branchEnd(payload); | ||
} | ||
nextBranch(payload); | ||
} else if (isPrimitive(currentItem, 'sequence')) { | ||
runBranch(currentItem.items, 0, payload, prevPayload, runNextItem); | ||
} else if (isPrimitive(currentItem, 'parallel')) { | ||
var itemLength = currentItem.items.length; | ||
var payloads = []; | ||
var currentItem = branch[index]; | ||
if (!currentItem) { | ||
if (branch !== execution.staticTree) { | ||
branchEnd(payload); | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
if (func.function) { | ||
execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
})); | ||
} else { | ||
runBranch(func.items, 0, payload, prevPayload, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
}); | ||
} | ||
nextBranch(payload); | ||
} else if (isPrimitive(currentItem, 'sequence')) { | ||
runBranch(currentItem.items, 0, payload, prevPayload, runNextItem); | ||
} else if (isPrimitive(currentItem, 'parallel')) { | ||
var itemLength = currentItem.items.length; | ||
var payloads = []; | ||
parallelStart(payload, itemLength); | ||
currentItem.items.forEach(function (func, index) { | ||
if (func.function) { | ||
execution.runFunction(func, payload, prevPayload, processFunctionOutput(func, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
})); | ||
} else { | ||
runBranch(func.items, 0, payload, prevPayload, function (payload) { | ||
payloads.push(payload); | ||
if (payloads.length === itemLength) { | ||
parallelEnd(payload, itemLength); | ||
runNextItem(Object.assign.apply(Object, [{}].concat(payloads))); | ||
} else { | ||
parallelProgress(payload, itemLength - payloads.length); | ||
} | ||
}); | ||
} | ||
return payloads; | ||
}); | ||
} else { | ||
execution.runFunction(currentItem, payload, prevPayload, processFunctionOutput(currentItem, runNextItem)); | ||
} | ||
}); | ||
return payloads; | ||
}); | ||
} else { | ||
execution.runFunction(currentItem, payload, prevPayload, processFunctionOutput(currentItem, runNextItem)); | ||
} | ||
} | ||
runBranch([execution.staticTree], 0, initialPayload, null, end); | ||
return runBranch([execution.staticTree], 0, initialPayload, null, end); | ||
} | ||
//# sourceMappingURL=executeTree.js.map |
@@ -267,3 +267,2 @@ 'use strict'; | ||
var contextProviders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
@@ -276,5 +275,2 @@ _classCallCheck(this, FunctionTree); | ||
_this.cachedStaticTrees = []; | ||
_this.executeBranchWrapper = options.executeBranchWrapper || function (cb) { | ||
cb(); | ||
}; | ||
@@ -349,3 +345,3 @@ if ((typeof contextProviders === 'undefined' ? 'undefined' : _typeof(contextProviders)) !== 'object' || contextProviders === null || Array.isArray(contextProviders)) { | ||
_this2.emit('start', execution, payload); | ||
(0, _executeTree2.default)(execution, payload, _this2.executeBranchWrapper, function (funcDetails, path, currentPayload) { | ||
(0, _executeTree2.default)(execution, payload, function (funcDetails, path, currentPayload) { | ||
_this2.emit('pathStart', path, execution, funcDetails, currentPayload); | ||
@@ -352,0 +348,0 @@ }, function (currentPayload) { |
@@ -19,12 +19,7 @@ 'use strict'; | ||
_ref$wrap = _ref.wrap, | ||
wrap = _ref$wrap === undefined ? true : _ref$wrap, | ||
_ref$ignoreDefinition = _ref.ignoreDefinition, | ||
ignoreDefinition = _ref$ignoreDefinition === undefined ? false : _ref$ignoreDefinition; | ||
wrap = _ref$wrap === undefined ? true : _ref$wrap; | ||
_classCallCheck(this, Provider); | ||
if (!ignoreDefinition) { | ||
this.verifyDefinition(definition); | ||
} | ||
this.verifyDefinition(definition); | ||
this.wrap = wrap; | ||
@@ -41,3 +36,3 @@ | ||
}; | ||
this.WrappedProviderConstructor.prototype = Object.keys(ignoreDefinition ? {} : definition).reduce(function (wrappedProvider, key) { | ||
this.WrappedProviderConstructor.prototype = Object.keys(definition).reduce(function (wrappedProvider, key) { | ||
var originalFunc = definition[key]; | ||
@@ -93,6 +88,2 @@ | ||
value: function verifyDefinition(definition) { | ||
if (this.ignoreDefinition) { | ||
return; | ||
} | ||
if ((typeof definition === 'undefined' ? 'undefined' : _typeof(definition)) !== 'object' || definition === null) { | ||
@@ -99,0 +90,0 @@ throw new Error('The definition passed as Provider is not valid'); |
{ | ||
"name": "function-tree", | ||
"version": "3.2.0-1518957951883", | ||
"version": "3.2.0-1518980138892", | ||
"description": "When a function is not enough", | ||
@@ -11,7 +11,6 @@ "main": "lib/index.js", | ||
"test": "cross-env BABEL_ENV=test mocha --compilers js:babel-register \"src/**/*.test.js\" \"__test__/**/*.test.js\"", | ||
"test:ts": "cross-env mocha --require ts-runtime.js \"src/**/*.test.ts\" \"__test__/**/*.test.ts\"", | ||
"test:watch": "npm run test -- --watch", | ||
"build:cjs": "cross-env BABEL_ENV=cjs babel src/ --out-dir=lib/ -s", | ||
"build:es": "cross-env BABEL_ENV=es babel src/ --out-dir=es/ -s", | ||
"build": "tsc && run-p build:*", | ||
"build": "run-p build:*", | ||
"coverage": "nyc --reporter=lcov --reporter=json npm run test", | ||
@@ -27,4 +26,2 @@ "prepublish": "npm run build" | ||
"devDependencies": { | ||
"@types/assert": "0.0.31", | ||
"@types/mocha": "^2.2.47", | ||
"mock-socket": "6.0.4" | ||
@@ -31,0 +28,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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1
315218
83
3093