processWilds()

in src/parser/WDL/entities/WDLWorkflow.js [431:491]


  processWilds(outputList) {
    outputList.forEach((item) => {
      if (!item.fqn) {
        return;
      }
      const fqn = item.fqn;
      const wildcard = item.wildcard;
      const res = (fqn.source_string + (wildcard ? `.${wildcard.source_string}` : '')).trim();

      const obj = {};
      obj[res] = {
        expression: res,
      };

      this.workflowStep.action.addPorts({
        o: obj,
      });
      // WF output connections
      if (!wildcard) { // syntax: call_name.output_name
        const [callName, outputName] = fqn.source_string.split('.');
        const startStep = WDLWorkflow.findStepInStructureRecursively(this.workflowStep, callName);

        if (startStep && startStep instanceof Step) {
          if (startStep.o[outputName]) {
            this.workflowStep.o[fqn.source_string].bind(startStep.o[outputName]);
          } else {
            throw new WDLParserError(
              `In '${this.workflowStep.name}' 
              output block undeclared variable is referenced: '${callName}.${outputName}'`);
          }
        } else if (startStep && startStep instanceof Port) {
          this.workflowStep.o[fqn.source_string].bind(startStep);
        } else {
          throw new WDLParserError(
            `In '${this.workflowStep.name}' 
            output block undeclared call is referenced: '${callName}'`);
        }
      } else { // syntax: call_name.* (all call's outputs)
        const callName = fqn.source_string;
        const startStep = WDLWorkflow.findStepInStructureRecursively(this.workflowStep, callName);

        if (startStep && startStep instanceof Step) {
          if (_.size(startStep.o)) {
            _.forEach(startStep.o, (output, outputName) => {
              this.workflowStep.o[`${fqn.source_string}.*`].bind(startStep.o[outputName]);
            });
          } else {
            throw new WDLParserError(
              `In '${this.workflowStep.name}' 
              output block undeclared variable is referenced: '${callName}.* (${callName} doesn't have any outputs)`);
          }
        } else if (startStep && startStep instanceof Port) {
          this.workflowStep.o[`${fqn.source_string}.*`].bind(startStep);
        } else {
          throw new WDLParserError(
            `In '${this.workflowStep.name}' 
            output block undeclared call is referenced: '${callName}'`);
        }
      }
    });
  }