conduyt 1.51.0 → 1.53.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.
Files changed (2) hide show
  1. package/dist/index.js +114 -3
  2. 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>")
@@ -3474,11 +3527,29 @@ reports
3474
3527
  const smartViews = program.command("smart-views").description("Smart Views and their Smart Dialing priorities");
3475
3528
  smartViews
3476
3529
  .command("list")
3477
- .description("List Smart Views in sidebar order (= Smart Dialing priority) with lead counts and dialing settings")
3530
+ .description("List Smart Views in sidebar order (= Smart Dialing priority) with lead counts, audience (groupId / members / isPersonal) and dialing settings")
3478
3531
  .option("--dialing", "only the dial-enabled views (the Smart Dialing priorities)")
3479
3532
  .action(run(async (client, opts) => {
3480
- const views = (await client.get("/api/v1/smart-views"));
3481
- const rows = Array.isArray(views) ? views : [];
3533
+ let rows = null;
3534
+ for (let attempt = 0; attempt < 3 && rows === null; attempt += 1) {
3535
+ const first = (await client.get("/api/v1/smart-views"));
3536
+ const walked = [...first.data.data];
3537
+ let meta = first.data.meta;
3538
+ let shifted = false;
3539
+ for (let page = 2; meta.has_more && page <= 50; page += 1) {
3540
+ const next = (await client.get(`/api/v1/smart-views?page=${page}&counts=false`));
3541
+ if (next.data.meta.order_stamp !== first.data.meta.order_stamp) {
3542
+ shifted = true;
3543
+ break;
3544
+ }
3545
+ walked.push(...next.data.data);
3546
+ meta = next.data.meta;
3547
+ }
3548
+ if (!shifted)
3549
+ rows = walked;
3550
+ }
3551
+ if (rows === null)
3552
+ throw new Error("Smart Views kept changing while they were listed; try again.");
3482
3553
  const sorted = [...rows].sort((a, b) => Number(a.sortPosition ?? 0) - Number(b.sortPosition ?? 0));
3483
3554
  return opts.dialing ? sorted.filter((v) => v.dialEnabled === true) : sorted;
3484
3555
  }));
@@ -3553,6 +3624,31 @@ smartViews
3553
3624
  throw new Error("Nothing to change. Pass --enable/--disable, --max-attempts, --per-day, --cooldown or --schedule.");
3554
3625
  return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, body);
3555
3626
  }));
3627
+ smartViews
3628
+ .command("audience <id>")
3629
+ .description("Who a shared Smart View is for (PATCH): everyone, one Team group (its current members, resolved when the view is read), or picked reps. A group replaces picked reps and vice versa.")
3630
+ .option("--everyone", "every rep on the account")
3631
+ .option("--group <groupId>", "one Team group (see: conduyt groups list)")
3632
+ .option("--reps <userIds>", "comma-separated user ids of the reps")
3633
+ .action(run(async (client, id, opts) => {
3634
+ assertUuid(id, "smart view id");
3635
+ const picked = [opts.everyone ? "everyone" : null, opts.group ? "group" : null, opts.reps ? "reps" : null].filter(Boolean);
3636
+ if (picked.length !== 1)
3637
+ throw new Error("Pass exactly one of --everyone, --group <groupId> or --reps <userIds>.");
3638
+ if (opts.group) {
3639
+ assertUuid(opts.group, "group id");
3640
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: opts.group, members: [] });
3641
+ }
3642
+ if (opts.reps) {
3643
+ const ids = opts.reps.split(",").map((x) => x.trim()).filter(Boolean);
3644
+ if (ids.length === 0)
3645
+ throw new Error("--reps needs at least one user id.");
3646
+ for (const u of ids)
3647
+ assertUuid(u, "user id");
3648
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: null, members: ids.map((userId) => ({ userId })) });
3649
+ }
3650
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: null, members: [] });
3651
+ }));
3556
3652
  smartViews
3557
3653
  .command("dial-order [ids...]")
3558
3654
  .description("No ids: show the Smart Dialing priorities, uncapped (every dial-enabled view in dial order + candidates). With ids: set the priority order — every dial-enabled view id, first = dialed first (the server keeps non-priority views in their slots)")
@@ -3567,6 +3663,21 @@ smartViews
3567
3663
  assertUuid(id, "smart view id");
3568
3664
  return client.patch("/api/v1/smart-views/dial-order", { order: ids });
3569
3665
  }));
3666
+ smartViews
3667
+ .command("move <id>")
3668
+ .description("Move ONE Smart View next to another in the sidebar order (= Smart Dialing priority). No size limit: use this on accounts with more than 200 views")
3669
+ .option("--before <viewId>", "land directly above this view")
3670
+ .option("--after <viewId>", "land directly below this view")
3671
+ .action(run(async (client, id, opts) => {
3672
+ assertUuid(id, "smart view id");
3673
+ const anchors = [opts.before, opts.after].filter(Boolean);
3674
+ if (anchors.length !== 1)
3675
+ throw new Error("Pass exactly one of --before <viewId> or --after <viewId>.");
3676
+ assertUuid(anchors[0], "anchor view id");
3677
+ if (anchors[0] === id)
3678
+ throw new Error("A view cannot be anchored to itself.");
3679
+ return client.patch("/api/v1/smart-views/reorder", { move: opts.before ? { id, beforeId: opts.before } : { id, afterId: opts.after } });
3680
+ }));
3570
3681
  smartViews
3571
3682
  .command("reorder <ids...>")
3572
3683
  .description("Set the SIDEBAR order of Smart Views. Pass EVERY view id; views left out keep a stale position. For the dialing priority use dial-order")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.51.0",
3
+ "version": "1.53.0",
4
4
  "description": "Command-line interface for Conduyt CRM — manage contacts, deals, pipelines, and run insight queries from your terminal.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",