@formigio/fazemos-cli 0.10.6 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3536,6 +3536,7 @@ templates
3536
3536
  .option('--pipeline-input <name>', 'Pipeline-level input name (use instead of --source-step/--source-output)')
3537
3537
  .option('--description <desc>', 'What this data is used for')
3538
3538
  .option('--optional', 'Mark as not required (default: required)')
3539
+ .option('--required-value <value>', 'Require the upstream output to have this value before dispatching. Comma-separate multiple accepted values. Example: --required-value approved Example: --required-value "published,skipped"')
3539
3540
  .action(async (templateId, opts) => {
3540
3541
  try {
3541
3542
  const hasSrc = opts.sourceStep || opts.sourceOutput;
@@ -3601,14 +3602,24 @@ templates
3601
3602
  }
3602
3603
  if (opts.description)
3603
3604
  input.description = opts.description;
3605
+ if (opts.requiredValue !== undefined) {
3606
+ const parts = opts.requiredValue.split(',').map((v) => v.trim()).filter((v) => v.length > 0);
3607
+ input.required_value = parts.length === 1 ? parts[0] : parts;
3608
+ }
3604
3609
  step.inputs.push(input);
3605
3610
  await api('PUT', `/api/pipeline-templates/${templateId}`, { definition: t.definition });
3606
3611
  if (opts.sourceStep) {
3607
3612
  const srcStep = findStepById(t.definition, opts.sourceStep);
3608
- console.log(chalk.green(`Added input ← ${opts.name} ← ${srcStep.name}.${opts.sourceOutput} to ${step.name}`));
3613
+ let msg = `Added input ← ${opts.name} ← ${srcStep.name}.${opts.sourceOutput} to ${step.name}`;
3614
+ if (opts.requiredValue !== undefined)
3615
+ msg += `\n Required value: ${opts.requiredValue}`;
3616
+ console.log(chalk.green(msg));
3609
3617
  }
3610
3618
  else {
3611
- console.log(chalk.green(`Added input ← ${opts.name} ← pipeline.${opts.pipelineInput} to ${step.name}`));
3619
+ let msg = `Added input ← ${opts.name} ← pipeline.${opts.pipelineInput} to ${step.name}`;
3620
+ if (opts.requiredValue !== undefined)
3621
+ msg += `\n Required value: ${opts.requiredValue}`;
3622
+ console.log(chalk.green(msg));
3612
3623
  }
3613
3624
  }
3614
3625
  catch (err) {