MCPcopy Index your code
hub / github.com/totaljs/framework / controller_json_workflow_multiple

Function controller_json_workflow_multiple

index.js:19459–19514  ·  view source on GitHub ↗
(id)

Source from the content-addressed store, hash-verified

19457
19458// Default action for workflow routing
19459function controller_json_workflow_multiple(id) {
19460
19461 var self = this;
19462 var w = self.route.workflow;
19463
19464 self.id = self.route.paramidindex === -1 ? id : self.req.split[self.route.paramidindex];
19465 CONF.logger && (self.req.$logger = []);
19466
19467 if (w instanceof Object) {
19468 if (!w.type) {
19469
19470 // IS IT AN OPERATION?
19471 if (!self.route.schema.length) {
19472 RUN(w.id, self.body, w.view ? self.callback(w.view) : self.callback(), null, self, w.index != null ? w.id[w.index] : null);
19473 return;
19474 }
19475
19476 var schema = self.route.isDYNAMICSCHEMA ? framework_builders.findschema(self.route.schema[0] + '/' + self.params[self.route.schema[1]]) : GETSCHEMA(self.route.schema[0], self.route.schema[1]);
19477 if (!schema) {
19478 self.throw500('Schema "{0}" not found.'.format(getSchemaName(self.route.schema, self.isDYNAMICSCHEMA ? self.params : null)));
19479 return;
19480 }
19481
19482 var op = [];
19483 for (var i = 0; i < w.id.length; i++) {
19484 var id = w.id[i];
19485 if (schema.meta[id] !== undefined) {
19486 op.push({ name: '$' + id });
19487 } else if (schema.meta['workflow#' + id] !== undefined) {
19488 op.push({ name: '$workflow', id: id });
19489 } else if (schema.meta['transform#' + id] !== undefined) {
19490 op.push({ name: '$transform', id: id });
19491 } else if (schema.meta['operation#' + id] !== undefined) {
19492 op.push({ name: '$operation', id: id });
19493 } else if (schema.meta['hook#' + id] !== undefined) {
19494 op.push({ name: '$hook', id: id });
19495 } else {
19496 // not found
19497 self.throw500('Schema "{0}" does not contain "{1}" operation.'.format(schema.name, id));
19498 return;
19499 }
19500 }
19501 w.async = op;
19502 }
19503
19504 var async = self.$async(self.callback(w.view), w.index);
19505 for (var i = 0; i < w.async.length; i++) {
19506 var a = w.async[i];
19507 if (a.id)
19508 async[a.name](a.id);
19509 else
19510 async[a.name]();
19511 }
19512 } else
19513 self.$exec(w, null, self.callback(w.view));
19514}
19515
19516function ilogger(body) {

Callers

nothing calls this directly

Calls 1

getSchemaNameFunction · 0.85

Tested by

no test coverage detected