conduyt 1.8.0 → 1.10.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);
@@ -1356,6 +1362,12 @@ users
1356
1362
  .option("--email <email>", "email")
1357
1363
  .option("--role <role>", "member | admin | owner")
1358
1364
  .option("--phone <phone>", "phone")
1365
+ .option("--position <text>", "rep-profile position/title, merge-taggable as {{user.position}} (pass '' to clear)")
1366
+ .option("--mobile <phone>", "rep-profile mobile phone, merge-taggable as {{user.mobilePhone}} (pass '' to clear)")
1367
+ .option("--custom1 <text>", "rep-profile custom 1, {{user.custom1}} (pass '' to clear)")
1368
+ .option("--custom2 <text>", "rep-profile custom 2, {{user.custom2}} (pass '' to clear)")
1369
+ .option("--custom3 <text>", "rep-profile custom 3, {{user.custom3}} (pass '' to clear)")
1370
+ .option("--custom4 <text>", "rep-profile custom 4, {{user.custom4}} (pass '' to clear)")
1359
1371
  .option("--json <json>", "full JSON body, merged over the flags")
1360
1372
  .action(run(async (client, id, opts) => {
1361
1373
  assertUuid(id, "user id");
@@ -1370,6 +1382,20 @@ users
1370
1382
  body.role = opts.role;
1371
1383
  if (opts.phone !== undefined)
1372
1384
  body.phone = opts.phone;
1385
+ // Rep-profile fields (#42): an explicit empty string clears the field
1386
+ // (the API treats blank as null); omitted flags leave it untouched.
1387
+ if (opts.position !== undefined)
1388
+ body.position = opts.position || null;
1389
+ if (opts.mobile !== undefined)
1390
+ body.mobilePhone = opts.mobile || null;
1391
+ if (opts.custom1 !== undefined)
1392
+ body.custom1 = opts.custom1 || null;
1393
+ if (opts.custom2 !== undefined)
1394
+ body.custom2 = opts.custom2 || null;
1395
+ if (opts.custom3 !== undefined)
1396
+ body.custom3 = opts.custom3 || null;
1397
+ if (opts.custom4 !== undefined)
1398
+ body.custom4 = opts.custom4 || null;
1373
1399
  if (opts.json !== undefined)
1374
1400
  Object.assign(body, jsonArg(opts.json, "--json"));
1375
1401
  if (Object.keys(body).length === 0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.8.0",
3
+ "version": "1.10.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",