forked from OpenAF/openaf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ojob.saved.json
1 lines (1 loc) · 73.8 KB
/
ojob.saved.json
1
[{"name":"ojob deps report","type":"simple","args":{},"deps":[],"help":{"text":"Outputs a tree list for each defined job (excluding \"ojob *\") and a comma delimited list of dependencies with a status flag"},"each":[],"exec":"\n\nvar b={};$from($ch(\"oJob::log\").getAll()).notStarts(\"name\",\"ojob \").select(function(a){b[a.name]=a.start?a.success?ansiColor(\"GREEN\",\"\\u2713\"):a.deps?a.error?ansiColor(\"RED\",\"\\u2715\"):ansiColor(\"BLUE\",\"\\u25b7\"):ansiColor(\"RED\",\"\\u2715\"):ansiColor(\"YELLOW\",\"\\u23f8\")});var c={};$from($ch(\"oJob::jobs\").getAll()).notStarts(\"name\",\"ojob \").select(function(a){c[a.name]=a.deps.map(function(d){return b[d]+\" \"+d}).join(\", \")});ow.oJob.output(c,{__format:\"tree\"})"},{"name":"ojob job report","type":"simple","args":{},"deps":[],"help":{"text":"Outputs a job jobs report (e.g. job name, action and plan)","expects":[{"name":"__format","desc":"Can be json, yaml, table (default) or any other ow.oJob.output format"}]},"each":[],"exec":"\n\now.oJob.output($ch(\"_ojob_plan\").getAll(),{__format:_$(args.__format).default(\"table\")})"},{"name":"ojob job","type":"simple","typeArgs":{"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Provides a way to organize idempotent jobs. One or more \"checks\" jobs will be called to determine an args._action.\nInitially the args._action is set to \"none\". If the \"checks\" jobs determine an action it will call the corresponding\njobs on \"actions\" jobs. If \"_go=true\" is not provided, instead of running, it will only return a plan of actions. \nFor example:\n\n - name: Write Hello World\n to : ojob job\n args:\n _checks : Check Hello World\n _actions:\n create : Create Hello World\n overwrite: Overwrite Hello World\n delete : Delete Hello World\n","expects":[{"name":"_checks","desc":"A list of one or more jobs to be called to perform checks to determine an args._action"},{"name":"_actions","desc":"A map of possible values of args._action whose values are one or more jobs to execute"},{"name":"_go","desc":"A boolean value (defaults to false) that controls if the _actions jobs are called (when true) or not"}]},"each":[],"exec":"\n$$(args).set(\"_go\", _$($$(args).get(\"_go\"), \"Job (ojob job), args [_go]\").toBoolean().isBoolean().default(false))\n\nisString(args._checks)&&(args._checks=[args._checks]);isString(args._actions)&&(args._actions={none:args._actions});var c=function(a){a=clone(a);delete a._checks;delete a._actions;return a};args._action=\"none\";args._checks.forEach(function(a){isString(a)?(a=$job(a,c(args)),isMap(a)&&isString(a._action)&&(args._action=a._action)):logErr(\"oJob Job 'checks' must be job names\")});$ch(\"_ojob_plan\").create();$ch(\"_ojob_plan\").get({name:job.name});var d=[];if(isDef(args._actions[args._action])){var b;\nisArray(args._actions[args._action])&&(b=args._actions[args._action]);isString(args._actions[args._action])&&(b=[args._actions[args._action]]);b.forEach(function(a){args._go?$job(a,c(args)):d.push(a)})}$ch(\"_ojob_plan\").set({name:job.name},{name:job.name,action:args._action,\"go?\":args._go,plan:d})"},{"name":"ojob report","type":"simple","args":{},"deps":[],"help":{"text":"Outputs a jobs report (e.g. job name, status, number of executions, total time, avg time and last execution)","expects":[{"name":"__format","desc":"Can be json, yaml, table (default) or any other ow.oJob.output format"}]},"each":[],"exec":"\n\now.loadFormat();print(\"\\n\");var b=$ch(\"oJob::log\").getAll(),c=$from(b).notEquals(\"name\",\"ojob report\").notEquals(\"name\",\"ojob final report\").select(function(a){return{\"Job name\":a.name,Status:a.start?a.success?\"OK\":a.deps?a.error?\"NOT OK!\":\"executing\":\"failed deps\":\"not started\",\"# execs\":a.count,\"Total time\":ow.format.elapsedTime4ms(a.totalTime,{abrev:!0}),\"Avg time\":ow.format.elapsedTime4ms(a.avgTime,{abrev:!0}),\"Last exec\":0<a.log.length?ow.format.timeago($from(a.log).sort(\"-endTime\").at(0).endTime):\n\"n/a\"}});c.push({\"Job name\":\"TOTAL:\",Status:\"\",\"# execs\":\"\",\"Total time\":ow.format.elapsedTime4ms(now()-$from(b).sort(\"createDate\").at(0).createDate),\"Avg time\":\"\",\"Last exec\":\"\"});args.__format=_$(args.__format).default(\"table\");ow.oJob.output(c,args)"},{"name":"ojob exit","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(fail","keyArg":"code","args":{"force":"force"},"job":"ojob exit","nolog":false,"map":true,"attrs":{"(fail":"code","((force":"force"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Ends all processing with an exit code","expects":[{"name":"code","desc":"The exit code number to use"},{"name":"force","desc":"A boolean indicating if instead of exit the processing should halt"}]},"each":[],"exec":"\n$$(args).set(\"code\", _$($$(args).get(\"code\"), \"Job (ojob exit), args [code]\").toNumber().isNumber().default(0));$$(args).set(\"force\", _$($$(args).get(\"force\"), \"Job (ojob exit), args [force]\").toBoolean().isBoolean().default(false))\n\nexit(args.code,args.force)"},{"name":"ojob pass","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(pass","keyArg":"__args","args":{"debug":"__debug","templateArgs":"__templateArgs"},"job":"ojob pass","nolog":false,"map":true,"attrs":{"(pass":"__args","((debug":"__debug","((templateArgs":"__templateArgs"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Placeholder/pass job to allow for arguments injection","expects":[{"name":"__args","desc":"The args to inject"},{"name":"__debug","desc":"Boolean to indicate that args to be inject should be printed before"},{"name":"__templateArgs","desc":"Boolean, true by default, to indicate to apply template to each string in args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"}]},"each":[],"exec":"\n$$(args).set(\"__args\", _$($$(args).get(\"__args\"), \"Job (ojob pass), args [__args]\").isMap().default({}));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob pass), args [__debug]\").toBoolean().isBoolean().default(false));$$(args).set(\"__templateArgs\", _$($$(args).get(\"__templateArgs\"), \"Job (ojob pass), args [__templateArgs]\").toBoolean().isBoolean().default(true))\n\nvar b=clone(args.__args);args.__templateArgs?traverse(b,function(c,a,e,d){isNull(a)&&(d[c]=__);isString(a)&&0<=a.indexOf(\"{{\")&&(d[c]=templify(a,args))}):traverse(b,function(c,a,e,d){isNull(a)&&(d[c]=__)});args.__debug&&cprint(ow.format.withSideLine(printTreeOrS(b,__,{bgcolor:\"BG(230)\"}),__,\"YELLOW\",\"BG(230)\",ow.format.withSideLineThemes().openBottomCurvedRect));delete args.__args;delete args.__debug;delete args.__templateArgs;args=merge(args,b)"},{"name":"ojob set","type":"simple","typeArgs":{"shortcut":{"name":"(set","keyArg":"__key","args":{"path":"__path"},"job":"ojob set","nolog":false,"map":true,"attrs":{"(set":"__key","((path":"__path"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Sets a \"key\" with the current value on a \"path\" using $set","expects":[{"name":"__key","desc":"Map key"},{"name":"__path","desc":"A key or path to a value from the current args"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob set), args [__key]\").isString().default(\"res\"));$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob set), args [__path]\").isString().$_())\n\nvar a=$path(args,args.__path);isDef(a)&&\"args\"!=args.__key&&$set(args.__key,a)"},{"name":"ojob unset","type":"simple","typeArgs":{"shortcut":{"name":"(unset","keyArg":"__key","job":"ojob unset","nolog":false,"map":true,"attrs":{"(unset":"__key"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Unsets a \"key\" using $unset","expects":[{"name":"__key","desc":"Map key"}],"check":{"in":{"__key":"isString.default(\"res\")"}}},"each":[],"exec":"\n\n$unset(args.__key)"},{"name":"ojob file get","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(fileget","keyArg":"__file","args":{"path":"__path","cache":"__cache","ttl":"__ttl","out":"__out","key":"__key"},"job":"ojob file get","nolog":false,"map":true,"attrs":{"(fileget":"__file","((path":"__path","((cache":"__cache","((ttl":"__ttl","((out":"__out","((key":"__key"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Retrieves a specific map key (or path) from an YAML or JSON file provided.","expects":[{"name":"__file","desc":"The file path to an YAML or JSON file","required":true},{"name":"__path","desc":"Path of the file contents"},{"name":"__cache","desc":"Boolean value that if false it won't cache the file contents (default: true)"},{"name":"__ttl","desc":"If cache is enabled lets you define a numeric ttl"},{"name":"__out","desc":"The path on args to set the map key/path contents"},{"name":"__key","desc":"If __out is not defined will set the content into the provided key"}]},"each":[],"exec":"\n$$(args).set(\"__file\", _$($$(args).get(\"__file\"), \"Job (ojob file get), args [__file]\").isString().$_());$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob file get), args [__path]\").isString().default(\"@\"));$$(args).set(\"__cache\", _$($$(args).get(\"__cache\"), \"Job (ojob file get), args [__cache]\").toBoolean().isBoolean().default(true));$$(args).set(\"__ttl\", _$($$(args).get(\"__ttl\"), \"Job (ojob file get), args [__ttl]\").isNumber().default(__));$$(args).set(\"__out\", _$($$(args).get(\"__out\"), \"Job (ojob file get), args [__out]\").isString().default(__));$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob file get), args [__key]\").isString().default(\"res\"))\n\nif(args.__cache){var c=$cache(\"__ojob_file_get\");isDef(args.__ttl)&&(c=c.ttl(args.__ttl));c=c.fn(function(a){return isDef(a.file)?a.file.endsWith(\".json\")?io.readFileJSON(a.file):/\\.ya?ml$/.test(a.file)?io.readFileYAML(a.file):{error:\"Not an yaml, yml or json file.\"}:{}}).create();var b=c.get({file:args.__file})}else b=args.__file.endsWith(\".json\")?io.readFileJSON(args.__file):/\\.ya?ml$/.test(args.__file)?io.readFileYAML(args.__file):{error:\"Not an yaml, yml or json file.\"};b=$path(b,\nargs.__path);isDef(args.__out)?$$(args).set(args.__out,b):isDef(args.__key)?$set(args.__key,b):Object.keys(b).forEach(function(a){return $$(args).set(a,b[a])})"},{"name":"ojob template","type":"simple","typeArgs":{"shortcut":{"name":"(template","keyArg":"template","args":{"templateFile":"templateFile","data":"data","dataFile":"dataFile","outputFile":"outputFile","key":"__key","tpath":"__tpath","dpath":"__dpath","outPath":"__outPath","out":"__out"},"job":"ojob template","nolog":false,"map":true,"attrs":{"(template":"template","((templateFile":"templateFile","((data":"data","((dataFile":"dataFile","((outputFile":"outputFile","((key":"__key","((tpath":"__tpath","((dpath":"__dpath","((outPath":"__outPath","((out":"__out"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Applies the OpenAF template over the provided data producing an output.","expects":[{"name":"__key","desc":"The key that holds template and/or data (default to 'res'). If 'args' it will use the current arguments."},{"name":"__tpath","desc":"The path in __key where a string with the template can be found."},{"name":"__dpath","desc":"The path in __key where a map/array data to use can be found."},{"name":"__out","desc":"The output will be stored into the provided key (defaults to 'res')"},{"name":"__outPath","desc":"If defined the $set path where __out will be set in the provided key."},{"name":"template","desc":"If defined, will be used as template"},{"name":"templateFile","desc":"If defined, it will use the provided template file."},{"name":"data","desc":"If defined, will be used as data"},{"name":"dataFile","desc":"If defined, it will use the provided data file (either yaml or json)."},{"name":"outputFile","desc":"If defined, the output will be written to the provided file path."}],"returns":[{"name":"output","desc":"If no outputFile is provided this will hold the output of applying the template with the provided data"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob template), args [__key]\").isString().default(\"res\"));$$(args).set(\"__tpath\", _$($$(args).get(\"__tpath\"), \"Job (ojob template), args [__tpath]\").isString().default(\"@\"));$$(args).set(\"__dpath\", _$($$(args).get(\"__dpath\"), \"Job (ojob template), args [__dpath]\").isString().default(\"@\"));$$(args).set(\"__out\", _$($$(args).get(\"__out\"), \"Job (ojob template), args [__out]\").isString().default(\"res\"));$$(args).set(\"__outPath\", _$($$(args).get(\"__outPath\"), \"Job (ojob template), args [__outPath]\").isString().default(\"\"));$$(args).set(\"templateFile\", _$($$(args).get(\"templateFile\"), \"Job (ojob template), args [templateFile]\").isString().default(__));$$(args).set(\"dataFile\", _$($$(args).get(\"dataFile\"), \"Job (ojob template), args [dataFile]\").isString().default(__));$$(args).set(\"outputFile\", _$($$(args).get(\"outputFile\"), \"Job (ojob template), args [outputFile]\").isString().default(__))\n\now.loadTemplate();ow.template.addConditionalHelpers();ow.template.addFormatHelpers();ow.template.addOpenAFHelpers();var a=isDef(args.data)?args.data:\"args\"==args.__key?$path(args,args.__dpath):$path($get(args.__key),args.__dpath);isDef(args.dataFile)&&(a=args.dataFile.match(/\\.ya?ml$/i)?io.readFileYAML(args.dataFile):io.readFileJSON(args.dataFile));var b=isDef(args.template)?args.template:\"args\"==args.__key?$path(args,args.__tpath):$path($get(args.__key),args.__tpath);isDef(args.templateFile)&&\n(b=io.readFileString(args.templateFile));isDef(args.logJob)&&$job(args.logJob,args);a=templify(b,a);isDef(args.outputFile)?io.writeFileString(args.outputFile,a):\"args\"==args.__out?isDef(args.__outPath)?$$(args).set(args.__outPath,a):args.output=a:(b={},isDef(args.__outPath)&&$$(b).set(args.__outPath,a),b.output=a,$set(args.__out,b))"},{"name":"ojob template folder","type":"simple","typeArgs":{"shortcut":{"name":"(templateFolder","keyArg":"templateFolder","args":{"templatePath":"__templatePath","data":"data","dataFile":"dataFile","outputFolder":"outputFolder","key":"__key","dpath":"__dpath","logJob":"logJob","metaTemplate":"metaTemplate"},"job":"ojob template folder","nolog":false,"map":true,"attrs":{"(templateFolder":"templateFolder","((templatePath":"__templatePath","((data":"data","((dataFile":"dataFile","((outputFolder":"outputFolder","((key":"__key","((dpath":"__dpath","((logJob":"logJob","((metaTemplate":"metaTemplate"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Given a templateFolder it will execute 'ojob template' for each (recursively), with the provided data, to output to outputFolder. Optionally metaTemplate can be use where each json/yaml file in templateFolder all or part of the arguments for 'ojob template'.\n","expects":[{"name":"templateFolder","desc":"The original folder where the templates are located.","required":true},{"name":"__templatePath","desc":"If defined, will apply a $path string over the recursive list of files in templateFolder."},{"name":"outputFolder","desc":"The path where the output should be stored.","required":true},{"name":"data","desc":"If defined, will be used as data"},{"name":"dataFile","desc":"If defined, it will use the provided data file (either yaml or json)."},{"name":"__key","desc":"The key that holds template and/or data (default to 'res'). If 'args' it will use the current arguments."},{"name":"__dpath","desc":"The path in __key where a map/array data to use can be found."},{"name":"logJob","desc":"A ojob job to log the 'ojob template' activity (receives the same arguments as 'ojob template')"},{"name":"metaTemplate","desc":"Boolean that if 'true' will interpret any json/yaml file, in the templateFolder, as a map/array of arguments to use when calling 'ojob template' overriden the defaults."}]},"each":[],"exec":"\n$$(args).set(\"templateFolder\", _$($$(args).get(\"templateFolder\"), \"Job (ojob template folder), args [templateFolder]\").isString().$_());$$(args).set(\"__templatePath\", _$($$(args).get(\"__templatePath\"), \"Job (ojob template folder), args [__templatePath]\").isString().default(\"@\"));$$(args).set(\"outputFolder\", _$($$(args).get(\"outputFolder\"), \"Job (ojob template folder), args [outputFolder]\").isString().$_());$$(args).set(\"dataFile\", _$($$(args).get(\"dataFile\"), \"Job (ojob template folder), args [dataFile]\").isString().default(__));$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob template folder), args [__key]\").isString().default(\"res\"));$$(args).set(\"__dpath\", _$($$(args).get(\"__dpath\"), \"Job (ojob template folder), args [__dpath]\").isString().default(\"@\"));$$(args).set(\"logJob\", _$($$(args).get(\"logJob\"), \"Job (ojob template folder), args [logJob]\").isString().default(__));$$(args).set(\"metaTemplate\", _$($$(args).get(\"metaTemplate\"), \"Job (ojob template folder), args [metaTemplate]\").toBoolean().isBoolean().default(false))\n\nvar e=isDef(args.data)?args.data:\"args\"==args.__key?$path(args,args.__dpath):$path($get(args.__key),args.__dpath);isDef(args.dataFile)&&(e=args.dataFile.match(/\\.ya?ml$/i)?io.readFileYAML(args.dataFile):io.readFileJSON(args.dataFile));var b=[];$path(listFilesRecursive(args.templateFolder),args.__templatePath).forEach(function(a){var d={templateFile:a.filepath,outputFile:a.filepath.replace(new RegExp(\"^\"+args.templateFolder),args.outputFolder),data:e,logJob:args.logJob};args.metaTemplate&&\na.filename.match(/\\.(ya?ml|json)$/i)?(a=a.filename.match(/\\.ya?ml$/i)?io.readFileYAML(a.filepath):io.readFileJSON(a.filepath),delete d.templateFile,isMap(a)&&(isDef(a.outputFile)&&!a.outputFile.startsWith(\"/\")&&(a.outputFile=args.outputFolder+\"/\"+a.outputFile),b.push(merge(d,a))),isArray(a)&&(b=b.concat(a.map(function(c){isDef(c.outputFile)&&!c.outputFile.startsWith(\"/\")&&(c.outputFile=args.outputFolder+\"/\"+c.outputFile);return merge(d,c)})))):b.push(d)});io.mkdir(args.outputFolder);$job(\"ojob template\",\nb)"},{"name":"ojob find/replace","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(findReplace","keyArg":"__key","args":{"path":"__path","inputKey":"inputKey","inputPath":"inputPath","inputFile":"inputFile","outputFile":"outputFile","useRegExp":"useRegExp","flagsRegExp":"flagsRegExp","logJob":"logJob"},"job":"ojob find/replace","nolog":false,"map":true,"attrs":{"(findReplace":"__key","((path":"__path","((inputKey":"inputKey","((inputPath":"inputPath","((inputFile":"inputFile","((outputFile":"outputFile","((useRegExp":"useRegExp","((flagsRegExp":"flagsRegExp","((logJob":"logJob"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Performs an in-memory find/replace on a provided string or file and outputs to args.output or, optionally, to a file.","expects":[{"name":"__key","desc":"The key that holds template and/or data (default to 'res'). If 'args' it will use the current arguments."},{"name":"__path","desc":"The path in __key where a map of replacements ([text/regexp]:[replace text]) can be found."},{"name":"inputKey","desc":"If defined, indicates the key that holds the string of data to replace."},{"name":"inputPath","desc":"If defined with inputKey, indicates the path to use to select the string of data to replace."},{"name":"inputFile","desc":"If defined the contents to be replaced will be read from the inputFile."},{"name":"outputFile","desc":"If defined will output of the content replacement to the defined file."},{"name":"useRegExp","desc":"Boolean value to determine if the map of replacements will be interpreted as a regexp or text."},{"name":"flagsRegExp","desc":"If useRegExp=true the JavaScript reg exp flags to use (defaults to 'g')"},{"name":"logJob","desc":"Optionally provide a logging job with the current args and __op with 'read' or 'write'"}],"returns":[{"name":"output","desc":"If outputFile is not defined the output will contain the content replacement"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob find/replace), args [__key]\").default(\"res\"));$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob find/replace), args [__path]\").isString().default(\"@\"));$$(args).set(\"inputKey\", _$($$(args).get(\"inputKey\"), \"Job (ojob find/replace), args [inputKey]\").isString().default(__));$$(args).set(\"inputPath\", _$($$(args).get(\"inputPath\"), \"Job (ojob find/replace), args [inputPath]\").isString().default(__));$$(args).set(\"inputFile\", _$($$(args).get(\"inputFile\"), \"Job (ojob find/replace), args [inputFile]\").isString().default(__));$$(args).set(\"outputFile\", _$($$(args).get(\"outputFile\"), \"Job (ojob find/replace), args [outputFile]\").isString().default(__));$$(args).set(\"useRegExp\", _$($$(args).get(\"useRegExp\"), \"Job (ojob find/replace), args [useRegExp]\").toBoolean().isBoolean().default(false));$$(args).set(\"flagsRegExp\", _$($$(args).get(\"flagsRegExp\"), \"Job (ojob find/replace), args [flagsRegExp]\").isString().default(\"g\"));$$(args).set(\"logJob\", _$($$(args).get(\"logJob\"), \"Job (ojob find/replace), args [logJob]\").default(__))\n\nvar b=isMap(args.__key)?args.__key:$path(\"args\"==args.__key?args:$get(args.__key),args.__path);_$(b,\"__key data\").isMap().$_();if(isUnDef(args.inputKey)&&isUnDef(args.inputFile))throw\"Need args inputKey or inputFile\";args.__op=\"read\";isDef(args.logJob)&&$job(args.logJob,args);var a=isDef(args.inputKey)?$path(\"args\"==args.inputKey?args:$get(args.inputKey),args.inputPath):io.readFileString(args.inputFile);Object.keys(b).forEach(function(c){a=a.replace(new RegExp(args.useRegExp?c:c.replace(/[.*+?^${}()|[\\]\\\\]/g,\n\"\\\\$&\"),args.useRegExp?args.flagsRegExp:\"g\"),b[c])});args.__op=\"write\";isDef(args.logJob)&&$job(args.logJob,args);isDef(args.outputFile)?io.writeFileString(args.outputFile,a):args.output=a"},{"name":"ojob channel","type":"simple","typeArgs":{"shortcut":{"name":"(ch","keyArg":"__name","args":{"op":"__op","key":"__key","kpath":"__kpath","k":"key","ks":"keys","v":"value","vs":"values","vpath":"__vpath","extra":"extra"},"job":"ojob channel","nolog":false,"map":true,"attrs":{"(ch":"__name","((op":"__op","((key":"__key","((kpath":"__kpath","((k":"key","((ks":"keys","((v":"value","((vs":"values","((vpath":"__vpath","((extra":"extra"}},"text":"Provides a set of operations over an OpenAF channel","expects":[{"name":"__name","desc":"The name of the OpenAF channel to use","required":true},{"name":"__op","desc":"The operation to perform (e.g. setall, set, get, unset, unsetall, getkeys, getall and size)","required":true},{"name":"__key","desc":"The key from where to retrieve the operation arguments (args to retrive from arguments)"},{"name":"__kpath","desc":"If defined, the path over the values retrieved from __key where the key or keys of the operation are defined"},{"name":"key","desc":"If defined, the key to use with the operations set, get and unset"},{"name":"keys","desc":"If defined, the set of fields to use with the operations setall and unsetall"},{"name":"value","desc":"If defined, the value to use with the operations set, get and unset"},{"name":"values","desc":"If defined, an array of values to use with the operations setall and unsetall"},{"name":"__vpath","desc":"If defined, the path over the values retrieved from __key where the value or values of the operation are defined"},{"name":"extra","desc":"If defined, will provide an extra argument (usually a map), depending on channel type, for the getall and getkeys operations."}],"returns":[{"name":"_list","desc":"If __key == 'args' will return the results of getall and getkeys"},{"name":"_map","desc":"If __key == 'args' will return the results of get"},{"name":"size","desc":"If __key == 'args' will return the size of the channel"}],"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{},"each":[],"exec":"\n$$(args).set(\"__name\", _$($$(args).get(\"__name\"), \"Job (ojob channel), args [__name]\").isString().$_());$$(args).set(\"__op\", _$($$(args).get(\"__op\"), \"Job (ojob channel), args [__op]\").isString().$_());$$(args).set(\"key\", _$($$(args).get(\"key\"), \"Job (ojob channel), args [key]\").default(__));$$(args).set(\"keys\", _$($$(args).get(\"keys\"), \"Job (ojob channel), args [keys]\").default(__));$$(args).set(\"value\", _$($$(args).get(\"value\"), \"Job (ojob channel), args [value]\").default(__));$$(args).set(\"values\", _$($$(args).get(\"values\"), \"Job (ojob channel), args [values]\").default(__));$$(args).set(\"__kpath\", _$($$(args).get(\"__kpath\"), \"Job (ojob channel), args [__kpath]\").isString().default(__));$$(args).set(\"__vpath\", _$($$(args).get(\"__vpath\"), \"Job (ojob channel), args [__vpath]\").isString().default(__));$$(args).set(\"extra\", _$($$(args).get(\"extra\"), \"Job (ojob channel), args [extra]\").default(__));$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob channel), args [__key]\").default(\"res\"))\n\nvar a=function(){var b={k:__,v:__};isDef(args.key)&&(b.k=args.key);isDef(args.keys)&&(b.k=args.keys);isDef(args.value)&&(b.v=args.value);isDef(args.values)&&(b.v=args.values);\"args\"==args.__key?(isDef(args.__kpath)&&(b.k=$path(args,args.__kpath)),isDef(args.__vpath)&&(b.v=$path(args,args.__vpath))):(isDef(args.__kpath)&&(b.k=$path($get(args.__key),args.__kpath)),isDef(args.__vpath)&&(b.v=$path($get(args.__key),args.__vpath)));return b};switch(args.__op.toLowerCase()){case \"getall\":a=$ch(args.__name).getAll(args.extra);\nisUnDef(a)&&(a=[]);\"args\"!=args.__key?$set(args.__key,a):args._list=a;break;case \"setall\":a=a();$ch(args.__name).setAll(a.k,a.v);break;case \"set\":a=a();$ch(args.__name).set(a.k,a.v);break;case \"get\":a=a();a=$ch(args.__name).get(a.k);isUnDef(a)&&(a={});\"args\"!=args.__key?$set(args.__key,a):args._map=a;break;case \"unset\":a=a();$ch(args.__name).unset(a.k);break;case \"unsetall\":a=a();$ch(args.__name).unsetAll(a.k,a.v);break;case \"getkeys\":a=$ch(args.__name).getKeys(args.extra);isUnDef(a)&&(a=[]);\"args\"!=\nargs.__key?$set(args.__key,a):args._list=a;break;case \"size\":a=$ch(args.__name).size(),isUnDef(a)&&(a=-1),\"args\"!=args.__key?$set(args.__key,a):args.size=a}"},{"name":"ojob print","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(print","keyArg":"msg","args":{"key":"__key","path":"__path","level":"level"},"job":"ojob print","nolog":false,"map":true,"attrs":{"(print":"msg","((key":"__key","((path":"__path","((level":"level"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Prints a message line given an OpenAF template","expects":[{"name":"__key","desc":"Map key to retrieve ('args' for arguments)"},{"name":"__path","desc":"The path to consider from the __key"},{"name":"msg","desc":"The message template to use","required":true},{"name":"level","desc":"The level of the message (info (default) or error)"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob print), args [__key]\").isString().default(\"res\"));$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob print), args [__path]\").isString().default(\"@\"));$$(args).set(\"msg\", _$($$(args).get(\"msg\"), \"Job (ojob print), args [msg]\").isString().$_());$$(args).set(\"level\", _$($$(args).get(\"level\"), \"Job (ojob print), args [level]\").isString().oneOf([\"info\",\"error\"]).default(\"info\"))\n\nvar a=\"args\"==args.__key?$path(args,args.__path):$path($get(args.__key),args.__path);switch(args.level){case \"error\":tprintErr(args.msg,a);break;case \"info\":tprint(args.msg,a)}"},{"name":"ojob log","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(log","keyArg":"msg","args":{"key":"__key","path":"__path","level":"level","options":"options"},"job":"ojob log","nolog":false,"map":true,"attrs":{"(log":"msg","((key":"__key","((path":"__path","((level":"level","((options":"options"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Logs a message line given an OpenAF template","expects":[{"name":"__key","desc":"Map key to retrieve ('args' for arguments)"},{"name":"__path","desc":"The path to consider from the __key"},{"name":"msg","desc":"The message template to use","required":true},{"name":"level","desc":"The level of the message (info (default), warn or error)"},{"name":"options","desc":"Extra options to provide to the tlog* functions. See more in the help of tlog, tlogErr and tlogWarn."}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob log), args [__key]\").isString().default(\"res\"));$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob log), args [__path]\").isString().default(\"@\"));$$(args).set(\"msg\", _$($$(args).get(\"msg\"), \"Job (ojob log), args [msg]\").isString().$_());$$(args).set(\"level\", _$($$(args).get(\"level\"), \"Job (ojob log), args [level]\").isString().oneOf([\"info\",\"warn\",\"error\"]).default(\"info\"));$$(args).set(\"options\", _$($$(args).get(\"options\"), \"Job (ojob log), args [options]\").isMap().default({}))\n\nvar a=\"args\"==args.__key?$path(args,args.__path):$path($get(args.__key),args.__path);switch(args.level){case \"warn\":tlogWarn(args.msg,a,args.options);break;case \"error\":tlogErr(args.msg,a,args.options);break;case \"info\":tlog(args.msg,a,args.options)}"},{"name":"ojob function","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(fn","keyArg":"__fn","args":{"key":"__key","path":"__path","fnPath":"__fnPath"},"job":"ojob function","nolog":false,"map":true,"attrs":{"(fn":"__fn","((key":"__key","((path":"__path","((fnPath":"__fnPath"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Executes the provided function mapping any args to the function arguments using the odoc help available for the provided function.\nNote: accessing odoc might be slow on a first execution.\n","expects":[{"name":"__key","desc":"The key string to retrieve previous results (defaults to 'res')","required":true},{"name":"__fn","desc":"The function to execute"},{"name":"__path","desc":"If defined the args path for the function arguments to consider"},{"name":"__fnPath","desc":"If defined the args path where to set the function result"}]},"each":[],"exec":"\n$$(args).set(\"__fn\", _$($$(args).get(\"__fn\"), \"Job (ojob function), args [__fn]\").isString().$_());$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob function), args [__key]\").isString().default(\"res\"))\n\n0>args.__fn.indexOf(\".\")&&(args.__fn=\"global.\"+args.__fn);var a=$fnM(args.__fn,isDef(args.__path)?$path(args,args.__path):args);isString(args.__fnPath)&&(a=$$({}).set(args.__fnPath,a));isString(args.__key)?$set(args.__key,a):args=merge(args,a)"},{"name":"ojob output","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(output","keyArg":"__key","args":{"path":"__path","format":"__format","title":"__title","internal":"__internal","query":"__query","csv":"__csv","function":"__function"},"job":"ojob output","nolog":false,"map":true,"attrs":{"(output":"__key","((path":"__path","((format":"__format","((title":"__title","((internal":"__internal","((query":"__query","((csv":"__csv","((function":"__function"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Prints the current arguments to the console.","expects":[{"name":"__key","desc":"The key string to retrieve previous results (defaults to 'res'). If \"args\" will retrieve from current args."},{"name":"__path","desc":"A path string to a map/array over the results set on key."},{"name":"__format","desc":"The output format (e.g. see ow.oJob.output help)"},{"name":"__title","desc":"Encapsulates the output map/array with a title key."},{"name":"__internal","desc":"Boolean value that if true it will display the internal oJob entries on the arguments (default false)"},{"name":"__function","desc":"One of the OpenAF's print or log functions available"}]},"each":[],"exec":"\n\nisUnDef(args.__key)&&isDef(args.key)&&(args.__key=args.key);isUnDef(args.__path)&&isDef(args.path)&&(args.__path=args.path);isUnDef(args.__format)&&isDef(args.format)&&(args.__format=args.format);isUnDef(args.__title)&&isDef(args.title)&&(args.__title=args.title);isUnDef(args.__internal)&&isDef(args.internal)&&(args.__internal=args.internal);if(isString(args.__function))if(0<=args.__function.indexOf(\"print\")||0<=args.__function.indexOf(\"log\")){if(!(0<=af.fromJavaArray(af.getScopeIds()).map(function(c){return String(c)}).indexOf(args.__function)))throw\"__function '\"+\nargs.__function+\"' not found.\";args.__function=global[args.__function]}else throw\"__function needs to be a 'print' or 'log' function\";else args.__function=__;args.__key=_$(args.__key,\"key\").isString().default(\"res\");\"\"==args.__key&&(args.__key=\"res\");var a=\"args\"==args.__key?args:$get(args.__key);isUnDef(a)&&(a=args);!isDef(a)||isNull(a)||toBoolean(args.__internal)||(delete a.objId,delete a.execid,delete a.id);isDef(args.format)&&(args.__format=args.format,delete args.format);isDef(args.__path)&&\n(a=$path(a,args.__path),delete args.__path);isMap(a)&&isDef(a._list)&&(a=a._list);isMap(a)&&isDef(a._map)&&(a=a._map);if(isDef(args.__title)){var b={};b[args.__title]=a;ow.oJob.output(b,args,args.__function)}else ow.oJob.output(a,args,args.__function)"},{"name":"ojob final report","type":"shutdown","args":{},"deps":[],"help":{"text":"Outputs a jobs report (e.g. job name, status, number of executions, total time, avg time and last execution) upon ojob termination","expects":[{"name":"__format","desc":"Can be json, yaml, table (default) or any other ow.oJob.output format"}]},"to":"ojob report","each":"\n","exec":"\n\nargs = ow.oJob.__processArgs(args, {})\n\n\n\n\now.loadFormat();print(\"\\n\");var b=$ch(\"oJob::log\").getAll(),c=$from(b).notEquals(\"name\",\"ojob report\").notEquals(\"name\",\"ojob final report\").select(function(a){return{\"Job name\":a.name,Status:a.start?a.success?\"OK\":a.deps?a.error?\"NOT OK!\":\"executing\":\"failed deps\":\"not started\",\"# execs\":a.count,\"Total time\":ow.format.elapsedTime4ms(a.totalTime,{abrev:!0}),\"Avg time\":ow.format.elapsedTime4ms(a.avgTime,{abrev:!0}),\"Last exec\":0<a.log.length?ow.format.timeago($from(a.log).sort(\"-endTime\").at(0).endTime):\n\"n/a\"}});c.push({\"Job name\":\"TOTAL:\",Status:\"\",\"# execs\":\"\",\"Total time\":ow.format.elapsedTime4ms(now()-$from(b).sort(\"createDate\").at(0).createDate),\"Avg time\":\"\",\"Last exec\":\"\"});args.__format=_$(args.__format).default(\"table\");ow.oJob.output(c,args)"},{"name":"ojob final deps report","type":"shutdown","args":{},"deps":[],"help":{"text":"Outputs a tree list for each defined job (excluding \"ojob *\") and a comma delimited list of dependencies with a status flag"},"to":"ojob deps report","each":"\n","exec":"\n\nargs = ow.oJob.__processArgs(args, {})\n\n\n\n\nvar b={};$from($ch(\"oJob::log\").getAll()).notStarts(\"name\",\"ojob \").select(function(a){b[a.name]=a.start?a.success?ansiColor(\"GREEN\",\"\\u2713\"):a.deps?a.error?ansiColor(\"RED\",\"\\u2715\"):ansiColor(\"BLUE\",\"\\u25b7\"):ansiColor(\"RED\",\"\\u2715\"):ansiColor(\"YELLOW\",\"\\u23f8\")});var c={};$from($ch(\"oJob::jobs\").getAll()).notStarts(\"name\",\"ojob \").select(function(a){c[a.name]=a.deps.map(function(d){return b[d]+\" \"+d}).join(\", \")});ow.oJob.output(c,{__format:\"tree\"})"},{"name":"ojob get","type":"simple","typeArgs":{"shortcut":{"name":"(get","keyArg":"__key","args":{"path":"__path"},"job":"ojob get","nolog":false,"map":true,"attrs":{"(get":"__key","((path":"__path"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Retrieves a specific map key (or path) using $get","expects":[{"name":"__key","desc":"Map key to retrieve (key is also checked for compatibility)"},{"name":"__path","desc":"The path to consider from the __key"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob get), args [__key]\").isString().default(\"res\"));$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob get), args [__path]\").isString().default(\"@\"))\n\nisUnDef(args.__key)&&isDef(args.key)&&(args.__key=args.key);var a=\"args\"==args.__key?$path(args,args.__path):$path($get(args.__key),args.__path);isArray(a)&&(a={_list:a});args=merge(args,a)"},{"name":"ojob get pm","type":"simple","args":{"__key":"args"},"deps":[],"help":{},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob get pm), args [__key]\").isString().default(\"res\"))\n\nvar a=__pm;isDef(__pm._map)&&(a=__pm._map);isDef(__pm._list)&&(a=__pm._list);\"args\"==args.__key?args=merge(args,a):$set(args.__key,a)"},{"name":"ojob options","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(optionOn","keyArg":"__optionOn","args":{"lowerCase":"__lowerCase","upperCase":"__upperCase","todos":"__todos","default":"__default","async":"__async"},"job":"ojob options","nolog":false,"map":true,"attrs":{"(optionOn":"__optionOn","((lowerCase":"__lowerCase","((upperCase":"__upperCase","((todos":"__todos","((default":"__default","((async":"__async"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Adds new \"todo\" entries depending on the value of a provided args variable.\n\nExample:\n\n __optionOn : mode\n __lowerCase: true\n __todos :\n mode1:\n - Job 1\n - Job 2\n mode2:\n - Job 2\n - Job 3\n __default:\n - Job 2\n","expects":[{"name":"__optionOn","desc":"The variable in args that will define which set of \"todo\"s will be added (trimmed)","required":true},{"name":"__lowerCase","desc":"Boolean value to determine if should compare the optionOn in lower case (defaults to false)"},{"name":"__upperCase","desc":"Boolean value to determine if should compare the optionOn in upper case (defaults to false)"},{"name":"__todos","desc":"Map where each option value should have a list/array of \"todo\"s","required":true},{"name":"__default","desc":"Default array of \"todo\"s"},{"name":"__async","desc":"Boolean value that if true, run the todos in async mode"}]},"each":[],"exec":"\n$$(args).set(\"__optionOn\", _$($$(args).get(\"__optionOn\"), \"Job (ojob options), args [__optionOn]\").isString().$_());$$(args).set(\"__todos\", _$($$(args).get(\"__todos\"), \"Job (ojob options), args [__todos]\").isMap().$_());$$(args).set(\"__lowerCase\", _$($$(args).get(\"__lowerCase\"), \"Job (ojob options), args [__lowerCase]\").toBoolean().isBoolean().default(false));$$(args).set(\"__upperCase\", _$($$(args).get(\"__upperCase\"), \"Job (ojob options), args [__upperCase]\").toBoolean().isBoolean().default(false));$$(args).set(\"__default\", _$($$(args).get(\"__default\"), \"Job (ojob options), args [__default]\").default([]));$$(args).set(\"__async\", _$($$(args).get(\"__async\"), \"Job (ojob options), args [__async]\").toBoolean().isBoolean().default(false))\n\nisUnDef(args.__optionOn)&&isDef(args.optionOn)&&(args.__optionOn=args.optionOn);isUnDef(args.__todos)&&isDef(args.todos)&&(args.__todos=args.todos);isUnDef(args.__lowerCase)&&isDef(args.lowerCase)&&(args.__lowerCase=args.lowerCase);isUnDef(args.__upperCase)&&isDef(args.upperCase)&&(args.__upperCase=args.upperCase);isUnDef(args.__default)&&isDef(args.default)&&(args.__default=args.default);isString(args.__default)&&(args.__default=[args.__default]);var a=String(args[args.__optionOn]).trim();\nargs.__lowerCase&&(a=a.toLowerCase());args.__upperCase&&(a=a.toUpperCase());var b=clone(args);delete b.__default;delete b.__lowerCase;delete b.__upperCase;delete b.__todos;delete b.__optionOn;delete b.__async;isDef(args.__todos[a])&&isString(args.__todos[a])&&(args.__todos[a]=[args.__todos[a]]);a=isDef(args.__todos[a])&&isArray(args.__todos[a])?{todo:args.__todos[a]}:{todo:args.__default};a.todo.forEach(function(c){isString(c.args)&&(c.args=ow.oJob.__processArgs(c.args));isMap(c)?c.args=merge(c.args,\nb):c.args=b});args.__async?$job(\"ojob parallel\",merge(b,a)):$job(\"ojob todo\",merge(b,a))"},{"name":"ojob sec get","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(secget","keyArg":"secKey","args":{"secRepo":"secRepo","secBucket":"secBucket","secPass":"secPass","secOut":"secOut","secMainPass":"secMainPass","secFile":"secFile","secDontAsk":"secDontAsk","secIgnore":"secIgnore","secEnv":"secEnv"},"job":"ojob sec get","nolog":false,"map":true,"attrs":{"(secget":"secKey","((secRepo":"secRepo","((secBucket":"secBucket","((secPass":"secPass","((secOut":"secOut","((secMainPass":"secMainPass","((secFile":"secFile","((secDontAsk":"secDontAsk","((secIgnore":"secIgnore","((secEnv":"secEnv"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"This job will get a SBucket secret and map it to oJob's args","expects":[{"name":"secIn","desc":"The args path where all the remaining sec arguments should be read from (defaults to no path)"},{"name":"[secIn].secOut","desc":"The args path to be mapped with the secret (defaults to secIn)"},{"name":"[secIn].secKey","desc":"The SBucket key"},{"name":"[secIn].secRepo","desc":"The SBucket repository"},{"name":"[secIn].secBucket","desc":"The SBucket name"},{"name":"[secIn].secPass","desc":"The SBucket password"},{"name":"[secIn].secMainPass","desc":"The SBucket repository password"},{"name":"[secIn].secFile","desc":"Optional provide a specific sbucket file"},{"name":"[secIn].secDontAsk","desc":"Determine if passwords should be asked from the user (default=false)"},{"name":"[secIn].secEnv","desc":"If true will set everything to retrieve the secret from an env variable"},{"name":"[secIn].secIgnore","desc":"If true will ignore errors of sec parameters not being provided (default=false)"}],"returns":[{"name":"[secIn].[secOut]","desc":"The args path to be mapped with the secret (defaults to secIn)"}]},"each":[],"exec":"\n$$(args).set(\"secIn\", _$($$(args).get(\"secIn\"), \"Job (ojob sec get), args [secIn]\").isString().default(\"\"))\n\now.loadSec();var a=args.secIn;\"\"!=a&&(a+=\".\");var f=_$($$(args).get(a+\"secIgnore\"),\"secIgnore\").isBoolean().default(!1),g=_$($$(args).get(a+\"secOut\"),\"secOut\").default(\"\"!=a?a.replace(/\\.$/,\"\"):__);f||_$($$(args).get(a+\"secKey\"),\"secKey\").$_();f=toBoolean(_$($$(args).get(a+\"secDontAsk\"),\"secDontAsk\").default(!1));var h=_$($$(args).get(a+\"secKey\"),\"secKey\").default(__),b=_$($$(args).get(a+\"secBucket\"),\"secBucket\").default(__),c=_$($$(args).get(a+\"secPass\"),\"secPass\").default(__),l=_$($$(args).get(a+\n\"secFile\"),\"secFile\").default(__),k=_$($$(args).get(a+\"secRepo\"),\"secRepo\").default(__),d=_$($$(args).get(a+\"secMainPass\"),\"secMainPass\").default(__);toBoolean(_$($$(args).get(a+\"secEnv\"),\"secEnv\").isBoolean().default(!1))&&(k=\"system\",b=\"envs\",f=!0);!f&&isDef(h)&&(b=askDef(b,\"Sec bucket: \"),isDef(b)&&isUnDef(l)&&(c=askDef(c,\"Sec bucket '\"+b+\"' pass: \",!0)),isDef(k)&&(d=askDef(d,\"Sec repo '\"+k+\"' pass: \",!0)));isUnDef(c)&&isDef(args.secPass)&&(c=args.secPass);isUnDef(d)&&isDef(args.secMainPass)&&\n(d=args.secMainPass);if(isDef(h)){var e=$sec(k,b,c,d,l).get(h);if(isUnDef(e))throw\"Couldn't retrieve secKey '\"+h+\"' from bucket '\"+b+\"'!\";isDef(g)&&0<g.length?(a=$$(args).get(g),$$(args).set(g,isDef(a)?merge(a,e):e)):Object.keys(e).forEach(function(m){return $$(args).set(m,e[m])})}"},{"name":"ojob split to items","type":"simple","args":{},"deps":[],"help":{"text":"Splits an args source into an array of maps (_list).\n\nExample:\n\n a source string with the value \"abc, xyz, 1\"\n + separator = ','\n transforms into:\n\n - item: abc\n - item: xyz\n - item: 1\n","expects":[{"name":"source","desc":"A object path to the string source to split"},{"name":"separator","desc":"The separator for the source string (defaults to \\n)"}]},"each":[],"exec":"\n\n_$(args.source,\"source\").isString().$_();args.separator=_$(args.separator,\"separator\").isString().default(\"\\n\");ow.loadObj();args._list=String(ow.obj.getPath(args,args.source)).split(args.separator).map(function(a){return{item:a}})"},{"name":"ojob query","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(query","keyArg":"__query","args":{"type":"__type","from":"__from","to":"__to","key":"__key"},"job":"ojob query","nolog":false,"map":true,"attrs":{"(query":"__query","((type":"__type","((from":"__from","((to":"__to","((key":"__key"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Performs a query (using ow.obj.filter) to the existing args.","expects":[{"name":"__query","desc":"The query map for ow.obj.filter or af.fromNLinq"},{"name":"__type","desc":"The type of query to perform (e.g. path, ow.obj.filter, af.fromNLinq)"},{"name":"__from","desc":"The path to the args key to perform the query"},{"name":"__to","desc":"The path to where the results should be stores"},{"name":"__key","desc":"If __from and __to not provided defaults to $get/$set on the provided key"}]},"each":[],"exec":"\n\nisUnDef(args.__from)&&isDef(args.from)&&(args.__from=args.from);isUnDef(args.__key)&&isDef(args.key)&&(args.__key=args.key);isUnDef(args.__query)&&(args.__query={});isUnDef(args.__key)&&(args.__key=\"res\");var a=\"args\"==args.__key?args:$get(args.__key);isDef(args.__from)&&(a=$path(a,args.__from));ow.loadObj();a=isDef(args.__type)&&\"path\"==args.__type?$path(a,args.__query):isString(args.__query)?$from(a).query(af.fromNLinq(args.__query)):$from(a).query(args.__query);\"args\"!=args.__key?$set(args.__key,\na):isDef(args.__to)?$$(args).set(args.__to,a):$$(args).set(args.__from,a)"},{"name":"ojob set envs","type":"simple","args":{},"deps":[],"help":{"text":"Sets job args based on environment variables.","expects":[{"name":"envs","desc":"A map where each key corresponds to an environment variable and the value to the args path where it should be placed"}]},"each":[],"exec":"\n$$(args).set(\"envs\", _$($$(args).get(\"envs\"), \"Job (ojob set envs), args [envs]\").isMap().$_())\n\nObject.keys(args.envs).forEach(function(a){var b=args.envs[a];a=getEnv(a);isDef(a)&&!isNull(a)&&$$(args).set(String(b),String(a))})"},{"name":"ojob if","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(if","keyArg":"__condition","args":{"then":"__then","else":"__else","debug":"__debug"},"job":"ojob if","nolog":false,"map":true,"attrs":{"(if":"__condition","((then":"__then","((else":"__else","((debug":"__debug"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"If the provided \"condition\" is evaluated as true it will execute the \"then\" jobs otherwise it will execute the \"else\" jobs","expects":[{"name":"__condition","desc":"An OpenAF code condition with templating functionality (example: \"{{abc}} == 123\")"},{"name":"__then","desc":"One job or a list of jobs to execute if the \"condition\" is true"},{"name":"__else","desc":"One job or a list of jobs to execute if the \"condition\" is false"},{"name":"__debug","desc":"Boolean to indicate if should log the original condition and the parsed condition for debug proposes"}]},"each":[],"exec":"\n$$(args).set(\"__condition\", _$($$(args).get(\"__condition\"), \"Job (ojob if), args [__condition]\").isString().$_());$$(args).set(\"__then\", _$($$(args).get(\"__then\"), \"Job (ojob if), args [__then]\").default([]));$$(args).set(\"__else\", _$($$(args).get(\"__else\"), \"Job (ojob if), args [__else]\").default([]));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob if), args [__debug]\").toBoolean().isBoolean().default(false))\n\nisString(args.__then)&&(args.__then=[args.__then]);isString(args.__else)&&(args.__else=[args.__else]);var a=String(args.__condition);delete args.__condition;var e=clone(args.__then);delete args.__then;var f=clone(args.__else);delete args.__else;var d=!!args.__debug;delete args.__debug;var b=templify(a,args).replace(/\\n/g,\"\");d&&log(\" DEBUG | \"+af.toSLON({origCondition:\" \"+a+\" \",parsedCondition:\" \"+b+\" \"}));b=af.eval(b);d&&log(\" DEBUG | \"+af.toSLON({origCondition:\" \"+a+\" \",result:b}));\na=function(c){c=ow.oJob.parseTodo(c);$job(c,args)};b?e.forEach(a):f.forEach(a)"},{"name":"ojob repeat","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(repeat","keyArg":"__time","args":{"todo":"__jobs"},"job":"ojob repeat","nolog":false,"map":true,"attrs":{"(repeat":"__time","((todo":"__jobs"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Repeats sequentially, for a specific number of \"times\", the provided list of \"jobs\" (one or more)","expects":[{"name":"__times","desc":"The number of times to repeat the provided list of jobs"},{"name":"__jobs","desc":"One job or a list of jobs to execute each time"}]},"each":[],"exec":"\n$$(args).set(\"__times\", _$($$(args).get(\"__times\"), \"Job (ojob repeat), args [__times]\").toNumber().isNumber().$_())\n\nif(!isString(args.__jobs)&&!isArray(args.__jobs))throw\"The provided 'jobs' need to be one or a list of jobs.\";if(isUnDef(args.__jobs))throw\"No 'jobs' list was provided.\";isString(args.__jobs)&&(args.__jobs=[args.__jobs]);var c=clone(args.__jobs);delete args.__jobs;var d=Number(args.__times);delete args.__times;var a=clone(args);delete a.__jobs;delete a.__time;for(var b=0;b<d;b++)$job(\"ojob todo\",merge(a,{todo:c}))"},{"name":"ojob repeat with each","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(each","keyArg":"__path","args":{"key":"__key","todo":"__jbos"},"job":"ojob repeat with each","nolog":false,"map":true,"attrs":{"(each":"__path","((key":"__key","((todo":"__jbos"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Repeats the configured \"jobs\" (one or more jobs) sequentially for each element of the provided \"key\" list.","expects":[{"name":"__key","desc":"The key for an existing list or args"},{"name":"__path","desc":"The path to consider from __key"},{"name":"__jobs","desc":"One job or a list of jobs to execute each time"}]},"each":[],"exec":"\n$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob repeat with each), args [__key]\").isString().$_());$$(args).set(\"__path\", _$($$(args).get(\"__path\"), \"Job (ojob repeat with each), args [__path]\").isString().default(\"@\"))\n\nif(!isString(args.__jobs)&&!isArray(args.__jobs))throw\"The provided 'jobs' need to be one or a list of jobs.\";if(isUnDef(args.__jobs))throw\"No 'jobs' list was provided.\";var b=String(args.__key),a=String(args.__path);delete args.__key;delete args.__path;isString(args.__jobs)&&(args.__jobs=[args.__jobs]);var d=clone(args.__jobs);delete args.__jobs;a=\"args\"==b?$path(args,a):$path($get(b),a);if(!isArray(a))throw\"The key/path '\"+b+\"' is not an array/list.\";a.forEach(function(e){d.forEach(function(c){c=\now.oJob.parseTodo(c);$job(c,merge(args,e))})})"},{"name":"ojob check","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(check","keyArg":"_checks","args":{"actions":"_actions"},"job":"ojob check","nolog":false,"map":true,"attrs":{"(check":"_checks","((actions":"_actions"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{},"to":"ojob job","each":"\n","exec":"\n\nargs = ow.oJob.__processArgs(args, {})\n\n\n\n$$(args).set(\"_go\", _$($$(args).get(\"_go\"), \"Job (ojob job), args [_go]\").toBoolean().isBoolean().default(false))\n\nisString(args._checks)&&(args._checks=[args._checks]);isString(args._actions)&&(args._actions={none:args._actions});var c=function(a){a=clone(a);delete a._checks;delete a._actions;return a};args._action=\"none\";args._checks.forEach(function(a){isString(a)?(a=$job(a,c(args)),isMap(a)&&isString(a._action)&&(args._action=a._action)):logErr(\"oJob Job 'checks' must be job names\")});$ch(\"_ojob_plan\").create();$ch(\"_ojob_plan\").get({name:job.name});var d=[];if(isDef(args._actions[args._action])){var b;\nisArray(args._actions[args._action])&&(b=args._actions[args._action]);isString(args._actions[args._action])&&(b=[args._actions[args._action]]);b.forEach(function(a){args._go?$job(a,c(args)):d.push(a)})}$ch(\"_ojob_plan\").set({name:job.name},{name:job.name,action:args._action,\"go?\":args._go,plan:d})"},{"name":"ojob job debug","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(jobsdebug","keyArg":"jobs","args":{"lineColor":"lineColor","textColor":"textColor","theme":"theme","emoticons":"emoticons","signs":"signs","includeTime":"includeTime"},"job":"ojob job debug","nolog":false,"map":true,"attrs":{"(jobsdebug":"jobs","((lineColor":"lineColor","((textColor":"textColor","((theme":"theme","((emoticons":"emoticons","((signs":"signs","((includeTime":"includeTime"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Provides an alternative to print based debug.\n\nExample:\n # ----------------\n - name: Sample job\n exec: |\n //@ Declaring array\n var ar = [ 0, 1, 2, 3, 4, 5 ]\n\n //@ Start cycle\n var ii = 0;\n while(ii < ar.length) {\n print(\"II = \" + ii)\n ii++\n //# ii == 3\n }\n //@ End cycle\n //? ii\n\n //?s args\n //?y args\n","expects":[{"name":"job","desc":"The job to change to include debug"},{"name":"jobs","desc":"The jobs array to change to include debug"},{"name":"lineColor","desc":"The line color around the debug info"},{"name":"textColor","desc":"The text color around the debug info"},{"name":"theme","desc":"The withSideLineThemes theme to use"},{"name":"emoticons","desc":"If emoticons should be used or not"},{"name":"signs","desc":"A custom map of emoticons (keys: checkpoint, assert and print)"},{"name":"includeTime","desc":"A boolean value to indicate if a time indication should be included"}]},"each":[],"exec":"\n$$(args).set(\"job\", _$($$(args).get(\"job\"), \"Job (ojob job debug), args [job]\").isString().default(__));$$(args).set(\"jobs\", _$($$(args).get(\"jobs\"), \"Job (ojob job debug), args [jobs]\").isArray().default([]));$$(args).set(\"lineColor\", _$($$(args).get(\"lineColor\"), \"Job (ojob job debug), args [lineColor]\").isString().default(\"FG(220)\"));$$(args).set(\"textColor\", _$($$(args).get(\"textColor\"), \"Job (ojob job debug), args [textColor]\").isString().default(\"BG(230),BLACK\"));$$(args).set(\"lineError\", _$($$(args).get(\"lineError\"), \"Job (ojob job debug), args [lineError]\").isString().default(\"FG(220)\"));$$(args).set(\"textError\", _$($$(args).get(\"textError\"), \"Job (ojob job debug), args [textError]\").isString().default(\"BG(196),FG(255),BOLD\"));$$(args).set(\"theme\", _$($$(args).get(\"theme\"), \"Job (ojob job debug), args [theme]\").isString().default(\"doubleLineBothSides\"));$$(args).set(\"emoticons\", _$($$(args).get(\"emoticons\"), \"Job (ojob job debug), args [emoticons]\").toBoolean().isBoolean().default(true));$$(args).set(\"signs\", _$($$(args).get(\"signs\"), \"Job (ojob job debug), args [signs]\").isMap().default(__));$$(args).set(\"includeTime\", _$($$(args).get(\"includeTime\"), \"Job (ojob job debug), args [includeTime]\").toBoolean().isBoolean().default(false))\n\nisMap(void 0)&&(args=merge(void 0,args));args.signs=_$(args.signs,\"signs\").isMap().default({checkpoint:127866,assert:128077,print:128270,error:128545,time:\"\\ud83d\\udd52\"});isDef(args.job)&&0==args.jobs.length&&args.jobs.push(args.job);if(isUnDef(getEnv(\"OJOB_DEBUG\"))||toBoolean(getEnv(\"OJOB_DEBUG\"))){ow.loadFormat();var h=ow.oJob.getJobsCh();0==args.jobs.length&&(args.jobs=h.getKeys().filter(function(e){return\"ojob job debug\"!=e.name}).map(function(e){return e.name}));var k=!1;isDef(ow.loadDebug)&&\n(ow.loadDebug(),ow.debug.register(),k=!0);args.jobs.forEach(function(e){var d=h.get({name:e});if(k){if(isUnDef(d.lang)||isDef(d.lang)&&(\"oaf\"==d.lang||\"js\"==d.lang))d.exec=ow.debug.debug(d.exec,args,!0)}else{var f=function(c,a){var g=\";try{\";isDef(a)&&(g+=\"if(\"+a+\") {\");var l=args.includeTime?'(new Date()).toISOString() +\" | \" + ':\"\";g+=\"cprint(ow.format.withSideLine(\"+l+c+', __, \"'+args.lineColor+'\", \"'+args.textColor+'\", ow.format.withSideLineThemes().'+args.theme+\")) \";isDef(a)&&(g+=\"}\");return g+=\n\"}catch(__e_debug){cprint(ow.format.withSideLine(\"+l+\"' \"+b.error+\" ' + String(__e_debug), __, \\\"\"+args.lineError+'\", \"'+args.textError+'\", ow.format.withSideLineThemes().'+args.theme+\"))};\"};if(args.emoticons){var b=args.signs;isNumber(b.checkpoint)&&(b.checkpoint=ow.format.string.unicode(b.checkpoint));isNumber(b.assert)&&(b.assert=ow.format.string.unicode(b.assert));isNumber(b.print)&&(b.print=ow.format.string.unicode(b.print));isNumber(b.error)&&(b.error=ow.format.string.unicode(b.error))}b.checkpoint=\n_$(b.checkpoint).default(\"@\");b.assert=_$(b.assert).default(\"#\");b.print=_$(b.print).default(\"?\");b.error=_$(b.error).default(\"!\");d.exec=d.exec.split(\"\\n\").map(function(c){var a=c.trim().match(/\\/\\/@ (.+)$/);isArray(a)&&(a=a[1],c=c.replace(/\\/\\/@ (.+)$/,f('\" '+b.checkpoint+\" \"+a.replace(/\"/g,'\\\\\"')+'\"')));a=c.trim().match(/\\/\\/# (.+)$/);isArray(a)&&(a=a[1],c=c.replace(/\\/\\/# (.+)$/,f('\" '+b.assert+\" \"+a+'\"',a)));a=c.trim().match(/\\/\\/\\? (.+)$/);isArray(a)&&(a=a[1],c=c.replace(/\\/\\/\\? (.+)$/,f('\" '+\nb.print+\" \"+a+' = \" + stringify('+a+') + \"\"')));a=c.trim().match(/\\/\\/\\?s (.+)$/);isArray(a)&&(a=a[1],c=c.replace(/\\/\\/\\?s (.+)$/,f('\" '+b.print+\" \"+a+' = \" + af.toSLON('+a+') + \"\"')));a=c.trim().match(/\\/\\/\\?y (.+)$/);isArray(a)&&(a=a[1],c=c.replace(/\\/\\/\\?y (.+)$/,f('\" '+b.print+\" \"+a+' = \" + af.toYAML('+a+') + \"\"')));return c}).join(\"\\n\")}h.set({name:e},d)})}"},{"name":"ojob debug","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(jobdebug","keyArg":"job","args":{"lineColor":"lineColor","textColor":"textColor","theme":"theme","emoticons":"emoticons","signs":"signs","includeTime":"includeTime"},"job":"ojob debug","nolog":false,"map":true,"attrs":{"(jobdebug":"job","((lineColor":"lineColor","((textColor":"textColor","((theme":"theme","((emoticons":"emoticons","((signs":"signs","((includeTime":"includeTime"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Outputs the current args and res values to help debug an ojob flow."},"each":[],"exec":"\n\now.loadFormat();print(\"\");cprint(ow.format.withSideLine(\"ARGS:\",__,\"YELLOW\",\"BOLD\",ow.format.withSideLineThemes().openBottomCurvedRect));cprint(ow.format.withSideLine(colorify(args),__,\"YELLOW\",__,ow.format.withSideLineThemes().openTopCurvedRect));cprint(ow.format.withSideLine(\"RES:\",__,\"YELLOW,BOLD\",\"BOLD\",ow.format.withSideLineThemes().openBottomCurvedRect));cprint(ow.format.withSideLine(colorify($get(\"res\")),__,\"YELLOW,BOLD\",__,ow.format.withSideLineThemes().openTopCurvedRect))"},{"name":"ojob job final report","type":"shutdown","args":{},"deps":[],"help":{"text":"Outputs a job jobs report (e.g. job name, action and plan) upon ojob termination","expects":[{"name":"__format","desc":"Can be json, yaml, table (default) or any other ow.oJob.output format"}]},"to":"ojob job report","each":"\n","exec":"\n\nargs = ow.oJob.__processArgs(args, {})\n\n\n\n\now.oJob.output($ch(\"_ojob_plan\").getAll(),{__format:_$(args.__format).default(\"table\")})"},{"name":"ojob set state","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(state","keyArg":"__state","job":"ojob set state","nolog":false,"map":true,"attrs":{"(state":"__state"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Changes the current state.","expects":[{"name":"__state","desc":"The state to change to (to execute todo.when)"}]},"each":[],"exec":"\n\nisUnDef(args.__state)&&isDef(args.state)&&(args.__state=args.state);_$(args.__state,\"state\").isString().$_();ow.oJob.setState(args.__state)"},{"name":"ojob get state","type":"simple","args":{},"deps":[],"help":{"text":"Gets the current state into args.state.","returns":[{"name":"state","desc":"The current state"}]},"each":[],"exec":"\n\nargs.state=ow.oJob.getState()"},{"name":"ojob state","type":"simple","typeArgs":{"noLog":true,"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Changes the current state depending on the value of a provided args variable.\n\n Example:\n\n stateOn : mode\n lowerCase: true\n default : Help\n","expects":[{"name":"stateOn","desc":"The variable in args that will define the current global set (to execute todo.when)"},{"name":"lowerCase","desc":"A boolean value to determine if should compare the stateOn in lower case (defaults to false)"},{"name":"upperCase","desc":"A boolean value to determine if should compare the stateOn in upper case (defaults to false)"},{"name":"validStates","desc":"An array of valid states to change to. If not included the default will be choosen (or none)."},{"name":"default","desc":"Default value of state"}]},"each":[],"exec":"\n$$(args).set(\"stateOn\", _$($$(args).get(\"stateOn\"), \"Job (ojob state), args [stateOn]\").isString().default(\"state\"));$$(args).set(\"lowerCase\", _$($$(args).get(\"lowerCase\"), \"Job (ojob state), args [lowerCase]\").toBoolean().isBoolean().default(false));$$(args).set(\"upperCase\", _$($$(args).get(\"upperCase\"), \"Job (ojob state), args [upperCase]\").toBoolean().isBoolean().default(false));$$(args).set(\"default\", _$($$(args).get(\"default\"), \"Job (ojob state), args [default]\").default(__))\n\nargs.state=_$(args[args.stateOn],args.stateOn).default(args.default);args.lowerCase&&isString(args.state)&&(args.state=args.state.toLowerCase());args.upperCase&&isString(args.state)&&(args.state=args.state.toUpperCase());isArray(args.validStates)&&0>args.validStates.indexOf(args.state)&&(isDef(args.default)?args.state=args.default:args.state=__);isString(args.state)&&isDef(ow.oJob.setState)&&ow.oJob.setState(args.state)"},{"name":"ojob todo","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(todo","keyArg":"todo","args":{"isolateArgs":"isolateArgs","isolateJob":"isolateJob","templateArgs":"templateArgs","shareArgs":"shareArgs","debug":"__debug"},"job":"ojob todo","nolog":false,"map":true,"attrs":{"(todo":"todo","((isolateArgs":"isolateArgs","((isolateJob":"isolateJob","((templateArgs":"templateArgs","((shareArgs":"shareArgs","((debug":"__debug"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Executes an ojob sub-todo.\nNOTE: doesn't perform any checks for recursive behaviour!","expects":[{"name":"todo","desc":"A string or array of todo' maps"},{"name":"todo[].name","desc":"Name of the job to execute"},{"name":"todo[].args","desc":"Arguments to merge (if isolateArgs is not true) with the main job arguments"},{"name":"todo[].isolateArgs","desc":"Boolean to indicate, for a specific todo, that args should be isolated from all others"},{"name":"todo[].isolateJob","desc":"Boolean to indicate, for a specific todo, that the job should run in a different scope (e.g. deps will not work)"},{"name":"todo[].templateArgs","desc":"Boolean to indicate, for a specific todo, to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"isolateArgs","desc":"Boolean, false by default, to indicate that args should be isolated from all others"},{"name":"isolateJob","desc":"Boolean, false by default, to indicate that the job should run in a different scope (e.g. deps will not work)"},{"name":"templateArgs","desc":"Boolean, true by default, to indicate to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"shareArgs","desc":"Boolean, false by default, to indicate that args should be shared between all todo's jobs sequentially."},{"name":"__debug","desc":"Boolean to indicate that each job execution parameters should be printed before executing"}]},"each":[],"exec":"\n$$(args).set(\"isolateArgs\", _$($$(args).get(\"isolateArgs\"), \"Job (ojob todo), args [isolateArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"isolateJob\", _$($$(args).get(\"isolateJob\"), \"Job (ojob todo), args [isolateJob]\").toBoolean().isBoolean().default(false));$$(args).set(\"templateArgs\", _$($$(args).get(\"templateArgs\"), \"Job (ojob todo), args [templateArgs]\").toBoolean().isBoolean().default(true));$$(args).set(\"shareArgs\", _$($$(args).get(\"shareArgs\"), \"Job (ojob todo), args [shareArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob todo), args [__debug]\").toBoolean().isBoolean().default(false))\n\nif(!isString(args.todo)&&!isArray(args.todo))throw\"todo needs to be a string or an array\";isString(args.todo)&&(args.todo=[args.todo]);var a=clone(args);delete a.todo;delete a.isolateArgs;delete a.templateArgs;delete a.shareArgs;delete a.__debug;args.todo.forEach(function(b){if(!isMap(b)&&!isString(b))throw\"todo entry needs to be a map or a string (\"+af.toSLON(b)+\")\";b=$job(\"ojob run\",{job:b,id:ow.oJob.__id,isolateArgs:args.isolateArgs,isolateJob:args.isolateJob,templateArgs:args.templateArgs,\n__debug:args.__debug,args:a});args.shareArgs&&(a=merge(a,b))})"},{"name":"ojob run","type":"simple","typeArgs":{"noLog":true,"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Executes an ojob but alternatively use 'ojob todo' or $job for most functionality.","expects":[{"name":"job","desc":"Name of the job to execute"},{"name":"id","desc":"The oJob id to execute (leave undefined to default to the current one)"},{"name":"args","desc":"The args to consider on execution."},{"name":"isolateArgs","desc":"Boolean to indicate that args should be isolated."},{"name":"isolateJob","desc":"Boolean to indicate that the job should run in a different scope (e.g. deps will not work)"},{"name":"templateArgs","desc":"Boolean to indicate to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"__debug","desc":"Boolean to indicate that each job execution parameters should be printed before executing"}]},"each":[],"exec":"\n$$(args).set(\"job\", _$($$(args).get(\"job\"), \"Job (ojob run), args [job]\").default(__));$$(args).set(\"id\", _$($$(args).get(\"id\"), \"Job (ojob run), args [id]\").isString().default(ow.oJob.__id));$$(args).set(\"isolateArgs\", _$($$(args).get(\"isolateArgs\"), \"Job (ojob run), args [isolateArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"isolateJob\", _$($$(args).get(\"isolateJob\"), \"Job (ojob run), args [isolateJob]\").toBoolean().isBoolean().default(false));$$(args).set(\"templateArgs\", _$($$(args).get(\"templateArgs\"), \"Job (ojob run), args [templateArgs]\").toBoolean().isBoolean().default(true));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob run), args [__debug]\").toBoolean().isBoolean().default(false))\n\nif(!isString(args.job)&&!isMap(args.job))throw\"job needs to be either a string or job map\";isString(args.job)&&(args.job={name:args.job});args.job.templateArgs=_$(args.job.templateArgs,\"templateArgs \"+args.job.name).isBoolean().default(args.templateArgs);args.job.isolateArgs=_$(args.job.isolateArgs,\"isolateArgs \"+args.job.name).isBoolean().default(args.isolateArgs);args.job.isolateJob=_$(args.job.isolateJob,\"isolateJob \"+args.job.name).isBoolean().default(args.isolateJob);args.job.templateArgs&&\nisDef(args.args)&&args.job.templateArgs&&isDef(args.job.args)&&(isString(args.job.args)&&(args.job.args=ow.oJob.__processArgs(args.job.args)),traverse(args.job.args,function(c,b,e,d){isString(b)&&(d[c]=templify(b,args))}));args.job=ow.oJob.parseTodo(args.job);var a={name:args.job.name,args:args.job.isolateArgs?args.job.args:merge(args.args,args.job.args),id:args.job.isolateJob?__:args.id};args.__debug&&cprint(ow.format.withSideLine(printTreeOrS(a,__,{bgcolor:\"BG(230)\"}),__,\"YELLOW\",\"BG(230)\",ow.format.withSideLineThemes().openBottomCurvedRect));\nargs=merge(args,$job(a.name,a.args,a.id))"},{"name":"ojob run file","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(runfile","keyArg":"__job","args":{"args":"__args","out":"__out","key":"__key","inKey":"__inKey","usePM":"__usePM","inPM":"__inPM","templateArgs":"__templateArgs","debug":"__debug"},"job":"ojob run file","nolog":false,"map":true,"attrs":{"(runfile":"__job","((args":"__args","((out":"__out","((key":"__key","((inKey":"__inKey","((usePM":"__usePM","((inPM":"__inPM","((templateArgs":"__templateArgs","((debug":"__debug"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Executes an external YAML/JSON ojob file or a remote URL with the provided args.","expects":[{"name":"__job","desc":"The YAML/JSON ojob file or remote URL to run"},{"name":"__args","desc":"The args to provide to the external ojob file/url"},{"name":"__out","desc":"The path on args to set the map key/path contents"},{"name":"__key","desc":"If __out is not defined will set the content into the provided key"},{"name":"__inKey","desc":"If defined, args will be merged with the content from the provided key"},{"name":"__usePM","desc":"Output to __pm"},{"name":"__inPM","desc":"Input from provided key to __pm"},{"name":"__templateArgs","desc":"Boolean to indicate to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"__debug","desc":"Boolean to indicate that the job execution parameters should be printed before executing"}]},"each":[],"exec":"\n$$(args).set(\"__job\", _$($$(args).get(\"__job\"), \"Job (ojob run file), args [__job]\").isString().$_());$$(args).set(\"__args\", _$($$(args).get(\"__args\"), \"Job (ojob run file), args [__args]\").isMap().default({}));$$(args).set(\"__out\", _$($$(args).get(\"__out\"), \"Job (ojob run file), args [__out]\").isString().default(__));$$(args).set(\"__key\", _$($$(args).get(\"__key\"), \"Job (ojob run file), args [__key]\").isString().default(\"res\"));$$(args).set(\"__inKey\", _$($$(args).get(\"__inKey\"), \"Job (ojob run file), args [__inKey]\").isString().default(__));$$(args).set(\"__usePM\", _$($$(args).get(\"__usePM\"), \"Job (ojob run file), args [__usePM]\").toBoolean().isBoolean().default(false));$$(args).set(\"__inPM\", _$($$(args).get(\"__inPM\"), \"Job (ojob run file), args [__inPM]\").isString().default(__));$$(args).set(\"__templateArgs\", _$($$(args).get(\"__templateArgs\"), \"Job (ojob run file), args [__templateArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob run file), args [__debug]\").toBoolean().isBoolean().default(false))\n\nvar b=\"args\"==args.__key?\"r\"+nowNano():args.__key;args.__templateArgs&&isDef(args.__args)&&traverse(args.__args,function(e,c,g,f){isString(c)&&(f[e]=templify(c,args))});if(args.__usePM){var a={__format:\"pm\"};args.__key=__;args.__usePM=__}else a={__format:\"key\",__key:b};if(isDef(args.__inKey)){var d=$get(args.__inKey);a=merge(isDef(d)?merge(args.__args,d):args.__args,a)}else a=merge(args.__args,a);isDef(args.__inPM)&&ow.oJob.output($get(args.__inPM),{__format:\"pm\"});args.__debug&&cprint(ow.format.withSideLine(printTreeOrS(a,\n__,{bgcolor:\"BG(230)\"}),__,\"YELLOW\",\"BG(230)\",ow.format.withSideLineThemes().openBottomCurvedRect));ow.oJob.runFile(args.__job,a,b,!0,{shareArgs:!1});if(\"args\"==args.__key||\"res\"==args.__key)a=$get(b),isDef(a)&&(delete a.__format,delete a.__key,args=merge(args,a),\"args\"==args.__key&&$unset(b))"},{"name":"ojob parallel","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(parallel","keyArg":"todo","job":"ojob parallel","nolog":false,"map":true,"attrs":{"(parallel":"todo"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Executes an ojob sub-todo in parallel.\nNOTE: doesn't perform any checks for recursive behaviour!","expects":[{"name":"todo","desc":"A string or array of todo' maps"},{"name":"todo[].name","desc":"Name of the job to execute"},{"name":"todo[].args","desc":"Arguments to merge (if isolateArgs is not true) with the main job arguments"},{"name":"todo[].isolateArgs","desc":"Boolean to indicate, for a specific todo, that args should be isolated from all others"},{"name":"todo[].isolateJob","desc":"Boolean to indicate, for a specific todo, that the job should run in a different scope (e.g. deps will not work)"},{"name":"todo[].templateArgs","desc":"Boolean to indicate, for a specific todo, to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"isolateArgs","desc":"Boolean, false by default, to indicate that args should be isolated from all others"},{"name":"isolateJob","desc":"Boolean, false by default, to indicate that the job should run in a different scope (e.g. deps will not work)"},{"name":"templateArgs","desc":"Boolean, true by default, to indicate to apply template to each string of the provided args (use only if typeArgs.noTemplateArgs = false OR job.templateArgs = true)"},{"name":"shareArgs","desc":"Boolean, false by default, to indicate that args should be shared between all todo's jobs sequentially."},{"name":"__debug","desc":"Boolean to indicate that each job execution parameters should be printed before executing"}]},"each":[],"exec":"\n$$(args).set(\"isolateArgs\", _$($$(args).get(\"isolateArgs\"), \"Job (ojob parallel), args [isolateArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"isolateJob\", _$($$(args).get(\"isolateJob\"), \"Job (ojob parallel), args [isolateJob]\").toBoolean().isBoolean().default(false));$$(args).set(\"templateArgs\", _$($$(args).get(\"templateArgs\"), \"Job (ojob parallel), args [templateArgs]\").toBoolean().isBoolean().default(true));$$(args).set(\"shareArgs\", _$($$(args).get(\"shareArgs\"), \"Job (ojob parallel), args [shareArgs]\").toBoolean().isBoolean().default(false));$$(args).set(\"__debug\", _$($$(args).get(\"__debug\"), \"Job (ojob parallel), args [__debug]\").toBoolean().isBoolean().default(false))\n\nif(!isString(args.todo)&&!isArray(args.todo))throw\"todo needs to be a string or an array\";isString(args.todo)&&(args.todo=[args.todo]);var a=clone(args),c=[];delete a.todo;delete a.isolateArgs;delete a.templateArgs;delete a.shareArgs;delete a.__debug;args.todo.forEach(function(b){if(!isMap(b)&&!isString(b))throw\"todo entry needs to be a map or a string (\"+af.toSLON(b)+\")\";c.push($do(function(){return $job(\"ojob run\",{job:b,id:ow.oJob.__id,isolateArgs:args.isolateArgs,isolateJob:args.isolateJob,\ntemplateArgs:args.templateArgs,__debug:args.__debug,args:a})}))});$doWait($doAll(c))"},{"name":"ojob wait","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(wait","keyArg":"time","job":"ojob wait","nolog":false,"map":true,"attrs":{"(wait":"time"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Waits for a specific amount of time","expects":[{"name":"time","desc":"The amount of time, in ms, to pause execution"}]},"each":[],"exec":"\n$$(args).set(\"time\", _$($$(args).get(\"time\"), \"Job (ojob wait), args [time]\").toNumber().isNumber().$_())\n\nsleep(args.time,!0)"},{"name":"ojob print md","type":"simple","typeArgs":{"noLog":true,"shortcut":{"name":"(printmd","keyArg":"__text","job":"ojob print md","nolog":false,"map":true,"attrs":{"(printmd":"__text"}},"lang":"oaf","lockCh":"oJob::locks"},"args":{},"deps":[],"help":{"text":"Parses an input text as simple ascii markdown","expects":[{"name":"__text","desc":"The text template to parse."}]},"each":[],"exec":"\n$$(args).set(\"__text\", _$($$(args).get(\"__text\"), \"Job (ojob print md), args [__text]\").isString().$_())\n\nvar a=clone(args);delete a.__text;printnl(ow.format.withMD($t(args.__text,a)))"}]