Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.jobsUsing.call( jobContext , job , jobContext.callback ) ;
}
}
else if ( typeof job === 'function' )
{
if ( this.waterfallMode && indexOfKey > 0 )
{
// remove the first, error arg if waterfallTransmitError is false
//console.log( index , key , execContext.results ) ;
args = execContext.results[ execContext.jobsKeys[ indexOfKey - 1 ] ].slice( this.waterfallTransmitError ? 0 : 1 ) ;
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else if ( Array.isArray( this.jobsUsing ) || this.execMappingMaxInputs )
{
if ( Array.isArray( this.jobsUsing ) ) { args = treeExtend( null , [] , this.jobsUsing , execContext.execInputs ) ; }
else { args = treeExtend( null , [] , execContext.execInputs ) ; }
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else
{
job.call( jobContext , jobContext.callback ) ;
}
}
else if ( Array.isArray( job ) && typeof job[ 0 ] === 'function' )
{
args = job.slice( 1 ) ;
args.push( jobContext.callback ) ;
job[ 0 ].apply( jobContext , args ) ;
}
this.jobsUsing.call( jobContext , job , jobContext.callback ) ;
}
}
else if ( typeof job === 'function' )
{
if ( this.waterfallMode && indexOfKey > 0 )
{
// remove the first, error arg if waterfallTransmitError is false
//console.log( index , key , execContext.results ) ;
args = execContext.results[ execContext.jobsKeys[ indexOfKey - 1 ] ].slice( this.waterfallTransmitError ? 0 : 1 ) ;
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else if ( Array.isArray( this.jobsUsing ) || this.execMappingMaxInputs )
{
if ( Array.isArray( this.jobsUsing ) ) { args = treeExtend( null , [] , this.jobsUsing , execContext.execInputs ) ; }
else { args = treeExtend( null , [] , execContext.execInputs ) ; }
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else
{
job.call( jobContext , jobContext.callback ) ;
}
}
else if ( Array.isArray( job ) && typeof job[ 0 ] === 'function' )
{
args = job.slice( 1 ) ;
args.push( jobContext.callback ) ;
job[ 0 ].apply( jobContext , args ) ;
}
}
}
else if ( typeof job === 'function' )
{
if ( this.waterfallMode && indexOfKey > 0 )
{
// remove the first, error arg if waterfallTransmitError is false
//console.log( index , key , execContext.results ) ;
args = execContext.results[ execContext.jobsKeys[ indexOfKey - 1 ] ].slice( this.waterfallTransmitError ? 0 : 1 ) ;
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else if ( Array.isArray( this.jobsUsing ) || this.execMappingMaxInputs )
{
if ( Array.isArray( this.jobsUsing ) ) { args = treeExtend( null , [] , this.jobsUsing , execContext.execInputs ) ; }
else { args = treeExtend( null , [] , execContext.execInputs ) ; }
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else
{
job.call( jobContext , jobContext.callback ) ;
}
}
else if ( Array.isArray( job ) && typeof job[ 0 ] === 'function' )
{
args = job.slice( 1 ) ;
args.push( jobContext.callback ) ;
job[ 0 ].apply( jobContext , args ) ;
}
else if ( typeof job === 'object' && job instanceof async.Plan )
}
}
else if ( typeof job === 'function' )
{
if ( this.waterfallMode && indexOfKey > 0 )
{
// remove the first, error arg if waterfallTransmitError is false
//console.log( index , key , execContext.results ) ;
args = execContext.results[ execContext.jobsKeys[ indexOfKey - 1 ] ].slice( this.waterfallTransmitError ? 0 : 1 ) ;
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else if ( Array.isArray( this.jobsUsing ) || this.execMappingMaxInputs )
{
if ( Array.isArray( this.jobsUsing ) ) { args = treeExtend( null , [] , this.jobsUsing , execContext.execInputs ) ; }
else { args = treeExtend( null , [] , execContext.execInputs ) ; }
args.push( jobContext.callback ) ;
job.apply( jobContext , args ) ;
}
else
{
job.call( jobContext , jobContext.callback ) ;
}
}
else if ( Array.isArray( job ) && typeof job[ 0 ] === 'function' )
{
args = job.slice( 1 ) ;
args.push( jobContext.callback ) ;
job[ 0 ].apply( jobContext , args ) ;
}
else if ( typeof job === 'object' && job instanceof async.Plan )
async.Plan.prototype.execMapping = function execMapping( config )
{
if ( this.locked ) { return this ; }
config = treeExtend( null , { minInputs: 0 , maxInputs: 0 } , config ) ;
var i , j , maxUnnamed = 5 ;
config.minInputs = parseInt( config.minInputs ) ;
config.maxInputs = parseInt( config.maxInputs ) ;
if ( config.minInputs < config.maxInputs )
{
this.execMappingMinInputs = config.minInputs ;
this.execMappingMaxInputs = config.maxInputs ;
}
else
{
// User is stOopid, swap...
this.execMappingMinInputs = config.maxInputs ;
this.execMappingMaxInputs = config.minInputs ;
error: { value: undefined , writable: true , enumerable: true } ,
statusTriggerJobsKey: { value: undefined , writable: true , enumerable: true } ,
whileStatus: { value: undefined , writable: true } ,
// true if current execContext has looped in another execContext (one loop per execContext possible)
// false if this execContext will never loop, undefined if this isn't settled
whileChecked: { value: false , writable: true }
} ) ;
// Add some properties depending on inherited ExecContext or not
if ( ! fromExecContext )
{
// This is the top-level/first ExecContext
Object.defineProperties( execContext , {
root: { value: execContext , enumerable: true } ,
jobsData: {
value: ( isArray ? this.jobsData.slice(0) : treeExtend( null , {} , this.jobsData ) ) ,
enumerable: true
} ,
jobsKeys: { value: this.jobsKeys.slice(0) , enumerable: true } ,
execInputs: { value: config.inputs , enumerable: true } ,
execCallbacks: { value: config.callbacks } ,
whileIterator: { value: 0 , enumerable: true , writable: true }
} ) ;
}
else
{
// This is a loop, and this ExecContext is derived from the first one
Object.defineProperties( execContext , {
root: { value: fromExecContext.root , enumerable: true } ,
jobsData: { value: fromExecContext.jobsData , enumerable: true } ,
jobsKeys: { value: fromExecContext.jobsKeys , enumerable: true } ,
execInputs: { value: fromExecContext.execInputs , enumerable: true } ,
error: { value: undefined , writable: true , enumerable: true } ,
statusTriggerJobsKey: { value: undefined , writable: true , enumerable: true } ,
whileStatus: { value: undefined , writable: true } ,
// true if current execContext has looped in another execContext (one loop per execContext possible)
// false if this execContext will never loop, undefined if this isn't settled
whileChecked: { value: false , writable: true }
} ) ;
// Add some properties depending on inherited ExecContext or not
if ( ! fromExecContext )
{
// This is the top-level/first ExecContext
Object.defineProperties( execContext , {
root: { value: execContext , enumerable: true } ,
jobsData: {
value: ( isArray ? this.jobsData.slice(0) : treeExtend( null , {} , this.jobsData ) ) ,
enumerable: true
} ,
jobsKeys: { value: this.jobsKeys.slice(0) , enumerable: true } ,
execInputs: { value: config.inputs , enumerable: true } ,
execCallbacks: { value: config.callbacks } ,
whileIterator: { value: 0 , enumerable: true , writable: true }
} ) ;
}
else
{
// This is a loop, and this ExecContext is derived from the first one
Object.defineProperties( execContext , {
root: { value: fromExecContext.root , enumerable: true } ,
jobsData: { value: fromExecContext.jobsData , enumerable: true } ,
jobsKeys: { value: fromExecContext.jobsKeys , enumerable: true } ,
execInputs: { value: fromExecContext.execInputs , enumerable: true } ,
async.ExecContext.prototype.getJobsStatus = function getJobsStatus()
{
var i , key , fullJobsStatus = Array.isArray( this.jobsData ) ? [] : {} ;
for ( i = 0 ; i < this.jobsKeys.length ; i ++ )
{
key = this.jobsKeys[ i ] ;
fullJobsStatus[ key ] = treeExtend( null , {
job: this.jobsData[ key ] ,
result: this.results[ key ]
} ,
this.jobsStatus[ key ]
) ;
}
return fullJobsStatus ;
} ;
async.ExecContext.prototype.getJobsStatus = function getJobsStatus()
{
var i , key , fullJobsStatus = Array.isArray( this.jobsData ) ? [] : {} ;
for ( i = 0 ; i < this.jobsKeys.length ; i ++ )
{
key = this.jobsKeys[ i ] ;
fullJobsStatus[ key ] = treeExtend( null , {
job: this.jobsData[ key ] ,
result: this.results[ key ]
} ,
this.jobsStatus[ key ]
) ;
}
return fullJobsStatus ;
} ;
async.Plan.prototype.clone = function clone()
{
var asyncPlan = Object.create( async.Plan.prototype , planCommonProperties ) ;
treeExtend( null , asyncPlan , this ) ;
asyncPlan.locked = false ;
return asyncPlan ;
} ;