conduyt 1.8.0 → 1.9.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/client.js CHANGED
@@ -27,7 +27,16 @@ export class ConduytClient {
27
27
  const structured = json && typeof json === "object" && !json.error
28
28
  ? JSON.stringify(json)
29
29
  : null;
30
- const msg = json?.error || structured || res.statusText || `HTTP ${res.status}`;
30
+ let msg = json?.error || structured || res.statusText || `HTTP ${res.status}`;
31
+ // Bodies with BOTH an error message and structured context (e.g. the
32
+ // STAGE_REQUIREMENTS 422 carries lostReasonOptions) keep the context —
33
+ // same principle as `structured` above, bounded against huge bodies.
34
+ if (json && typeof json === "object" && json.error) {
35
+ const extras = Object.fromEntries(Object.entries(json).filter(([k]) => k !== "error"));
36
+ if (Object.keys(extras).length > 0) {
37
+ msg = `${msg} ${JSON.stringify(extras).slice(0, 1000)}`;
38
+ }
39
+ }
31
40
  throw new Error(`Conduyt API ${res.status}: ${msg}`);
32
41
  }
33
42
  return json;
package/dist/index.js CHANGED
@@ -363,6 +363,7 @@ deals
363
363
  .option("--contact <id>", "primary contact UUID")
364
364
  .option("--status <status>", "explicit status (open|won|lost); overrides the status auto-derived from --stage")
365
365
  .option("--source <source>", "attribution source for THIS deal (pass 'null' to clear it)")
366
+ .option("--lost-reason <reason>", "reason for a lost/disqualified deal — some stages REQUIRE it on entry; when the stage has a configured dropdown the API 422 lists the valid lostReasonOptions, resend with one of those exact values")
366
367
  .option("--json <json>", "full JSON body, merged over the flags")
367
368
  .action(run(async (client, id, opts) => {
368
369
  assertUuid(id, "deal id");
@@ -400,6 +401,11 @@ deals
400
401
  throw new Error("--stage was provided but is blank. Omit it or pass a stage name/UUID.");
401
402
  body.stageId = await resolveStageId(client, opts.stage);
402
403
  }
404
+ if (opts.lostReason !== undefined) {
405
+ if (opts.lostReason.trim() === "")
406
+ throw new Error("--lost-reason was provided but is blank. Omit it or pass a reason.");
407
+ body.lostReason = opts.lostReason;
408
+ }
403
409
  if (opts.json !== undefined)
404
410
  Object.assign(body, jsonArg(opts.json, "--json"));
405
411
  assertFiniteValue(body.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.8.0",
3
+ "version": "1.9.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",