conduyt 1.51.0 → 1.52.0
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 +53 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -607,6 +607,59 @@ pipelines
|
|
|
607
607
|
assertStagesShape(body.stages);
|
|
608
608
|
return client.post("/api/v1/pipelines", body);
|
|
609
609
|
}));
|
|
610
|
+
// (system stages 2026-09-24) tri-surface parity: the stage flags the API takes on PATCH /pipelines/:id/stages/:stageId,
|
|
611
|
+
// isSystem included (a system holding stage automations route deals through; hidden from rep pickers, never won or lost)
|
|
612
|
+
pipelines
|
|
613
|
+
.command("update-stage <pipelineId> <stageId>")
|
|
614
|
+
.description("Update one stage (PATCH — only the fields you pass change). --is-system marks a system holding stage: automations route deals through it, reps never see it in a picker, and it can never be won or lost")
|
|
615
|
+
.option("--name <name>", "stage name")
|
|
616
|
+
.option("--color <hex>", "stage colour")
|
|
617
|
+
.option("--is-won <bool>", "true|false — entering this stage closes the deal as won")
|
|
618
|
+
.option("--is-lost <bool>", "true|false — entering this stage closes the deal as lost")
|
|
619
|
+
.option("--is-system <bool>", "true|false — a system holding stage (cannot also be won or lost)")
|
|
620
|
+
.option("--sort-order <n>", "position in the pipeline (integer)")
|
|
621
|
+
.option("--json <json>", "full JSON body, merged over the flags")
|
|
622
|
+
.action(run(async (client, pipelineId, stageId, opts) => {
|
|
623
|
+
assertUuid(pipelineId, "pipeline id");
|
|
624
|
+
assertUuid(stageId, "stage id");
|
|
625
|
+
const body = {};
|
|
626
|
+
if (opts.name !== undefined)
|
|
627
|
+
body.name = opts.name;
|
|
628
|
+
if (opts.color !== undefined)
|
|
629
|
+
body.color = opts.color;
|
|
630
|
+
const flag = (raw, name) => {
|
|
631
|
+
if (raw === undefined)
|
|
632
|
+
return undefined;
|
|
633
|
+
const v = raw.trim().toLowerCase();
|
|
634
|
+
if (v === "true")
|
|
635
|
+
return true;
|
|
636
|
+
if (v === "false")
|
|
637
|
+
return false;
|
|
638
|
+
throw new Error(`${name} must be true or false.`);
|
|
639
|
+
};
|
|
640
|
+
const isWon = flag(opts.isWon, "--is-won"), isLost = flag(opts.isLost, "--is-lost"), isSystem = flag(opts.isSystem, "--is-system");
|
|
641
|
+
if (isWon !== undefined)
|
|
642
|
+
body.isWon = isWon;
|
|
643
|
+
if (isLost !== undefined)
|
|
644
|
+
body.isLost = isLost;
|
|
645
|
+
if (isSystem !== undefined)
|
|
646
|
+
body.isSystem = isSystem;
|
|
647
|
+
if (opts.sortOrder !== undefined) {
|
|
648
|
+
const n = Number(opts.sortOrder.trim());
|
|
649
|
+
if (opts.sortOrder.trim() === "" || !Number.isInteger(n))
|
|
650
|
+
throw new Error("--sort-order must be an integer.");
|
|
651
|
+
body.sortOrder = n;
|
|
652
|
+
}
|
|
653
|
+
if (opts.json !== undefined)
|
|
654
|
+
Object.assign(body, jsonArg(opts.json, "--json"));
|
|
655
|
+
// mirror the API rule (system stages: pipeline_stages_system_never_terminal) so the CLI fails locally, not with a 400
|
|
656
|
+
if (body.isSystem === true && (body.isWon === true || body.isLost === true)) {
|
|
657
|
+
throw new Error("A system holding stage cannot be marked won or lost. Drop --is-won/--is-lost or --is-system.");
|
|
658
|
+
}
|
|
659
|
+
if (Object.keys(body).length === 0)
|
|
660
|
+
throw new Error("Nothing to update. Pass at least one field flag or --json.");
|
|
661
|
+
return client.patch(`/api/v1/pipelines/${encodeURIComponent(pipelineId)}/stages/${encodeURIComponent(stageId)}`, body);
|
|
662
|
+
}));
|
|
610
663
|
// ---- search ----
|
|
611
664
|
program
|
|
612
665
|
.command("search <query>")
|
package/package.json
CHANGED