@workbuddy/cli-vnext 1.0.93 → 1.0.95

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 +187 -128
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,37 +1,15 @@
1
1
  import { createRequire } from "node:module";
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
2
  var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- function __accessProp(key) {
8
- return this[key];
9
- }
10
- var __toESMCache_node;
11
- var __toESMCache_esm;
12
- var __toESM = (mod, isNodeMode, target) => {
13
- var canCache = mod != null && typeof mod === "object";
14
- if (canCache) {
15
- var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
- var cached = cache.get(mod);
17
- if (cached)
18
- return cached;
19
- }
20
- target = mod != null ? __create(__getProtoOf(mod)) : {};
21
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
22
- if (mod && typeof mod === "object" || typeof mod === "function") {
23
- for (let key of __getOwnPropNames(mod))
24
- if (!__hasOwnProp.call(to, key))
25
- __defProp(to, key, {
26
- get: __accessProp.bind(mod, key),
27
- enumerable: true
28
- });
29
- }
30
- if (canCache)
31
- cache.set(mod, to);
32
- return to;
33
- };
34
3
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
4
+ var __exportCjs = (target, getters, setters) => {
5
+ for (var name in getters)
6
+ __defProp(target, name, {
7
+ get: getters[name],
8
+ set: setters[name],
9
+ enumerable: true,
10
+ configurable: true
11
+ });
12
+ };
35
13
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
36
14
 
37
15
  // node_modules/commander/lib/error.js
@@ -154,7 +132,7 @@ var require_help = __commonJS(function(exports) {
154
132
  this.helpWidth = this.helpWidth ?? contextOptions.helpWidth ?? 80;
155
133
  }
156
134
  visibleCommands(cmd) {
157
- const visibleCommands = cmd.commands.filter((cmd2) => !cmd2._hidden);
135
+ const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
158
136
  const helpCommand = cmd._getHelpCommand();
159
137
  if (helpCommand && !helpCommand._hidden) {
160
138
  visibleCommands.push(helpCommand);
@@ -634,8 +612,8 @@ var require_option = __commonJS(function(exports) {
634
612
  }
635
613
  }
636
614
  function camelcase(str) {
637
- return str.split("-").reduce((str2, word) => {
638
- return str2 + word[0].toUpperCase() + word.slice(1);
615
+ return str.split("-").reduce((str, word) => {
616
+ return str + word[0].toUpperCase() + word.slice(1);
639
617
  });
640
618
  }
641
619
  function splitOptionFlags(flags) {
@@ -1206,44 +1184,44 @@ Expecting one of '${allowedValues.join("', '")}'`);
1206
1184
  });
1207
1185
  return source;
1208
1186
  }
1209
- _prepareUserArgs(argv, parseOptions) {
1210
- if (argv !== undefined && !Array.isArray(argv)) {
1187
+ _prepareUserArgs(argv2, parseOptions) {
1188
+ if (argv2 !== undefined && !Array.isArray(argv2)) {
1211
1189
  throw new Error("first parameter to parse must be array or undefined");
1212
1190
  }
1213
1191
  parseOptions = parseOptions || {};
1214
- if (argv === undefined && parseOptions.from === undefined) {
1192
+ if (argv2 === undefined && parseOptions.from === undefined) {
1215
1193
  if (process2.versions?.electron) {
1216
1194
  parseOptions.from = "electron";
1217
1195
  }
1218
- const execArgv = process2.execArgv ?? [];
1219
- if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) {
1196
+ const execArgv2 = process2.execArgv ?? [];
1197
+ if (execArgv2.includes("-e") || execArgv2.includes("--eval") || execArgv2.includes("-p") || execArgv2.includes("--print")) {
1220
1198
  parseOptions.from = "eval";
1221
1199
  }
1222
1200
  }
1223
- if (argv === undefined) {
1224
- argv = process2.argv;
1201
+ if (argv2 === undefined) {
1202
+ argv2 = process2.argv;
1225
1203
  }
1226
- this.rawArgs = argv.slice();
1204
+ this.rawArgs = argv2.slice();
1227
1205
  let userArgs;
1228
1206
  switch (parseOptions.from) {
1229
1207
  case undefined:
1230
1208
  case "node":
1231
- this._scriptPath = argv[1];
1232
- userArgs = argv.slice(2);
1209
+ this._scriptPath = argv2[1];
1210
+ userArgs = argv2.slice(2);
1233
1211
  break;
1234
1212
  case "electron":
1235
1213
  if (process2.defaultApp) {
1236
- this._scriptPath = argv[1];
1237
- userArgs = argv.slice(2);
1214
+ this._scriptPath = argv2[1];
1215
+ userArgs = argv2.slice(2);
1238
1216
  } else {
1239
- userArgs = argv.slice(1);
1217
+ userArgs = argv2.slice(1);
1240
1218
  }
1241
1219
  break;
1242
1220
  case "user":
1243
- userArgs = argv.slice(0);
1221
+ userArgs = argv2.slice(0);
1244
1222
  break;
1245
1223
  case "eval":
1246
- userArgs = argv.slice(1);
1224
+ userArgs = argv2.slice(1);
1247
1225
  break;
1248
1226
  default:
1249
1227
  throw new Error(`unexpected parse option { from: '${parseOptions.from}' }`);
@@ -1766,18 +1744,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
1766
1744
  this.error(message, { code: "commander.missingMandatoryOptionValue" });
1767
1745
  }
1768
1746
  _conflictingOption(option, conflictingOption) {
1769
- const findBestOptionFromValue = (option2) => {
1770
- const optionKey = option2.attributeName();
1747
+ const findBestOptionFromValue = (option) => {
1748
+ const optionKey = option.attributeName();
1771
1749
  const optionValue = this.getOptionValue(optionKey);
1772
1750
  const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
1773
1751
  const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
1774
1752
  if (negativeOption && (negativeOption.presetArg === undefined && optionValue === false || negativeOption.presetArg !== undefined && optionValue === negativeOption.presetArg)) {
1775
1753
  return negativeOption;
1776
1754
  }
1777
- return positiveOption || option2;
1755
+ return positiveOption || option;
1778
1756
  };
1779
- const getErrorMessage = (option2) => {
1780
- const bestOption = findBestOptionFromValue(option2);
1757
+ const getErrorMessage = (option) => {
1758
+ const bestOption = findBestOptionFromValue(option);
1781
1759
  const optionKey = bestOption.attributeName();
1782
1760
  const source = this.getOptionValueSource(optionKey);
1783
1761
  if (source === "env") {
@@ -1931,10 +1909,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1931
1909
  this._name = path.basename(filename, path.extname(filename));
1932
1910
  return this;
1933
1911
  }
1934
- executableDir(path2) {
1935
- if (path2 === undefined)
1912
+ executableDir(path) {
1913
+ if (path === undefined)
1936
1914
  return this._executableDir;
1937
- this._executableDir = path2;
1915
+ this._executableDir = path;
1938
1916
  return this;
1939
1917
  }
1940
1918
  helpInformation(contextOptions) {
@@ -2031,11 +2009,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2031
2009
  }
2032
2010
  help(contextOptions) {
2033
2011
  this.outputHelp(contextOptions);
2034
- let exitCode = Number(process2.exitCode ?? 0);
2035
- if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2036
- exitCode = 1;
2012
+ let exitCode2 = Number(process2.exitCode ?? 0);
2013
+ if (exitCode2 === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) {
2014
+ exitCode2 = 1;
2037
2015
  }
2038
- this._exit(exitCode, "commander.help", "(outputHelp)");
2016
+ this._exit(exitCode2, "commander.help", "(outputHelp)");
2039
2017
  }
2040
2018
  addHelpText(position, text) {
2041
2019
  const allowedValues = ["beforeAll", "before", "after", "afterAll"];
@@ -2108,40 +2086,63 @@ Expecting one of '${allowedValues.join("', '")}'`);
2108
2086
  });
2109
2087
 
2110
2088
  // node_modules/commander/index.js
2111
- var require_commander = __commonJS(function(exports) {
2112
- var { Argument } = require_argument();
2113
- var { Command } = require_command();
2114
- var { CommanderError, InvalidArgumentError } = require_error();
2115
- var { Help } = require_help();
2116
- var { Option } = require_option();
2117
- exports.program = new Command;
2118
- exports.createCommand = (name) => new Command(name);
2119
- exports.createOption = (flags, description) => new Option(flags, description);
2120
- exports.createArgument = (name, description) => new Argument(name, description);
2121
- exports.Command = Command;
2122
- exports.Option = Option;
2123
- exports.Argument = Argument;
2124
- exports.Help = Help;
2125
- exports.CommanderError = CommanderError;
2126
- exports.InvalidArgumentError = InvalidArgumentError;
2127
- exports.InvalidOptionArgumentError = InvalidArgumentError;
2089
+ var exports_commander = {};
2090
+ __exportCjs(exports_commander, {
2091
+ program: () => $program,
2092
+ createCommand: () => $createCommand,
2093
+ createOption: () => $createOption,
2094
+ createArgument: () => $createArgument,
2095
+ Command: () => $Command,
2096
+ Option: () => $Option,
2097
+ Argument: () => $Argument,
2098
+ Help: () => $Help,
2099
+ CommanderError: () => $CommanderError,
2100
+ InvalidArgumentError: () => $InvalidArgumentError,
2101
+ InvalidOptionArgumentError: () => $InvalidOptionArgumentError
2102
+ }, {
2103
+ program: (value) => $program = value,
2104
+ createCommand: (value) => $createCommand = value,
2105
+ createOption: (value) => $createOption = value,
2106
+ createArgument: (value) => $createArgument = value,
2107
+ Command: (value) => $Command = value,
2108
+ Option: (value) => $Option = value,
2109
+ Argument: (value) => $Argument = value,
2110
+ Help: (value) => $Help = value,
2111
+ CommanderError: (value) => $CommanderError = value,
2112
+ InvalidArgumentError: (value) => $InvalidArgumentError = value,
2113
+ InvalidOptionArgumentError: (value) => $InvalidOptionArgumentError = value
2128
2114
  });
2115
+ var { Argument } = require_argument();
2116
+ var { Command } = require_command();
2117
+ var { CommanderError, InvalidArgumentError } = require_error();
2118
+ var { Help } = require_help();
2119
+ var { Option } = require_option();
2120
+ var $program = new Command;
2121
+ var $createCommand = (name) => new Command(name);
2122
+ var $createOption = (flags, description) => new Option(flags, description);
2123
+ var $createArgument = (name, description) => new Argument(name, description);
2124
+ var $Command = Command;
2125
+ var $Option = Option;
2126
+ var $Argument = Argument;
2127
+ var $Help = Help;
2128
+ var $CommanderError = CommanderError;
2129
+ var $InvalidArgumentError = InvalidArgumentError;
2130
+ var $InvalidOptionArgumentError = InvalidArgumentError;
2129
2131
 
2130
2132
  // node_modules/commander/esm.mjs
2131
- var import__ = __toESM(require_commander(), 1);
2132
2133
  var {
2133
2134
  program,
2134
2135
  createCommand,
2135
2136
  createArgument,
2136
2137
  createOption,
2137
- CommanderError,
2138
- InvalidArgumentError,
2138
+ CommanderError: CommanderError2,
2139
+ InvalidArgumentError: InvalidArgumentError2,
2139
2140
  InvalidOptionArgumentError,
2140
- Command,
2141
- Argument,
2142
- Option,
2143
- Help
2144
- } = import__.default;
2141
+ Command: Command2,
2142
+ Argument: Argument2,
2143
+ Option: Option2,
2144
+ Help: Help2
2145
+ } = exports_commander;
2145
2146
 
2146
2147
  // src/index.ts
2147
2148
  import * as readline from "readline";
@@ -2522,8 +2523,8 @@ function buildRequestBody(operation, values) {
2522
2523
  }
2523
2524
  return body;
2524
2525
  }
2525
- function setNestedValue(target, path3, value) {
2526
- const segments = path3.split(".");
2526
+ function setNestedValue(target, path, value) {
2527
+ const segments = path.split(".");
2527
2528
  let current = target;
2528
2529
  for (let index = 0;index < segments.length - 1; index += 1) {
2529
2530
  const segment = segments[index];
@@ -8540,7 +8541,7 @@ var operations = [
8540
8541
  {
8541
8542
  operationId: "PublicApiStageStatusController_list",
8542
8543
  displayName: "List stage statuses",
8543
- description: `Retrieve all stage statuses configured for the tenant (Settings > Stage Status).
8544
+ description: `Retrieve active stage statuses configured for the tenant (Settings > Stage Status). Soft-deleted statuses are omitted.
8544
8545
  Each item is a workflow state a stage (work order) can use (e.g. New, Dispatched, En Route, On Site, Completed, Finalised).
8545
8546
 
8546
8547
  Response fields include:
@@ -8570,7 +8571,7 @@ Requires scope: settings:read`,
8570
8571
  {
8571
8572
  operationId: "PublicApiTagController_list",
8572
8573
  displayName: "List tags",
8573
- description: "Retrieve all active tags (labels) configured. Use the optional `type` query parameter to filter by label type. Defaults to `job` if not specified. Supported types: job, scheduling, quote, customer, user, overheads, form, finance, system, work-order-system, account, contact, zone, work-categories, lead-source, lead, opportunity, opportunity-lost, project, project-type, payment-type, file, asset, item-location, task, phase, site, service-type, subscriptions, agreement, work, integration-types, flag-category.",
8574
+ description: "Retrieve all active tags (labels) configured. Use the optional `type` query parameter to filter by label type. Defaults to `job` if not specified. `colors` is the Settings label-picker palette used by PUT /settings/tags. Supported types: job, scheduling, quote, customer, user, overheads, form, finance, system, work-order-system, account, contact, zone, work-categories, lead-source, lead, opportunity, opportunity-lost, project, project-type, payment-type, file, asset, item-location, task, phase, site, service-type, service-scope, subscriptions, agreement, work, integration-types, flag-category.",
8574
8575
  method: "GET",
8575
8576
  path: "/settings/tags",
8576
8577
  commandPath: ["settings", "reference", "data", "tags", "list"],
@@ -8580,6 +8581,91 @@ Requires scope: settings:read`,
8580
8581
  {
8581
8582
  name: "items",
8582
8583
  type: "array"
8584
+ },
8585
+ {
8586
+ name: "colors",
8587
+ type: "array"
8588
+ }
8589
+ ]
8590
+ },
8591
+ {
8592
+ operationId: "PublicApiTagController_upsert",
8593
+ displayName: "Upsert a tag",
8594
+ description: "Create a tag, or return the existing active tag with the same type and name (case-insensitive). Limited to service-type, service-scope, and work-categories. Optional color must be a Settings label-picker hex; omitted color is chosen from that palette. Does not change color on an existing tag. Requires settings:tags:write — not settings:write.",
8595
+ method: "PUT",
8596
+ path: "/settings/tags",
8597
+ commandPath: ["settings", "reference", "data", "tags", "upsert"],
8598
+ options: [
8599
+ {
8600
+ name: "type",
8601
+ cliName: "type",
8602
+ optionKey: "type",
8603
+ source: "body",
8604
+ type: "string",
8605
+ required: true,
8606
+ description: "",
8607
+ enumValues: ["service-type", "service-scope", "work-categories"]
8608
+ },
8609
+ {
8610
+ name: "name",
8611
+ cliName: "name",
8612
+ optionKey: "name",
8613
+ source: "body",
8614
+ type: "string",
8615
+ required: true,
8616
+ description: "Display name"
8617
+ },
8618
+ {
8619
+ name: "color",
8620
+ cliName: "color",
8621
+ optionKey: "color",
8622
+ source: "body",
8623
+ type: "string",
8624
+ required: false,
8625
+ description: "",
8626
+ enumValues: [
8627
+ "#1abc9c",
8628
+ "#16a085",
8629
+ "#f1c40f",
8630
+ "#f39c12",
8631
+ "#2ecc71",
8632
+ "#27ae60",
8633
+ "#e67e22",
8634
+ "#d35400",
8635
+ "#3498db",
8636
+ "#2980b9",
8637
+ "#e74c3c",
8638
+ "#c0392b",
8639
+ "#9b59b6",
8640
+ "#8e44ad",
8641
+ "#bdc3c7",
8642
+ "#34495e",
8643
+ "#2c3e50",
8644
+ "#95a5a6",
8645
+ "#7f8c8d",
8646
+ "#ec87bf",
8647
+ "#d870ad",
8648
+ "#f69785",
8649
+ "#9ba37e",
8650
+ "#b49255",
8651
+ "#a94136"
8652
+ ]
8653
+ },
8654
+ {
8655
+ name: "raw-body",
8656
+ cliName: "raw-body",
8657
+ optionKey: "rawBody",
8658
+ source: "body",
8659
+ type: "object",
8660
+ required: false,
8661
+ description: "Raw request body JSON (overrides individual fields)"
8662
+ }
8663
+ ],
8664
+ hasRequestBody: true,
8665
+ responseFields: [
8666
+ {
8667
+ name: "item",
8668
+ type: "object"
8583
8669
  }
8584
8670
  ]
8585
8671
  },
@@ -12506,15 +12592,6 @@ Requires scope: settings:read`,
12506
12592
  required: false,
12507
12593
  description: "integration ID"
12508
12594
  },
12509
- {
12510
- name: "address",
12511
- cliName: "address",
12512
- optionKey: "address",
12513
- source: "body",
12514
- type: "object",
12515
- required: false,
12516
- description: ""
12517
- },
12518
12595
  {
12519
12596
  name: "primaryContact",
12520
12597
  cliName: "primary-contact",
@@ -13374,15 +13451,6 @@ Requires scope: settings:read`,
13374
13451
  required: false,
13375
13452
  description: "integration ID"
13376
13453
  },
13377
- {
13378
- name: "address",
13379
- cliName: "address",
13380
- optionKey: "address",
13381
- source: "body",
13382
- type: "object",
13383
- required: false,
13384
- description: ""
13385
- },
13386
13454
  {
13387
13455
  name: "primaryContact",
13388
13456
  cliName: "primary-contact",
@@ -14196,15 +14264,6 @@ Requires scope: settings:read`,
14196
14264
  required: false,
14197
14265
  description: "integration ID"
14198
14266
  },
14199
- {
14200
- name: "address",
14201
- cliName: "address",
14202
- optionKey: "address",
14203
- source: "body",
14204
- type: "object",
14205
- required: false,
14206
- description: ""
14207
- },
14208
14267
  {
14209
14268
  name: "primaryContact",
14210
14269
  cliName: "primary-contact",
@@ -17010,11 +17069,11 @@ function prompt(question, mask = false) {
17010
17069
  });
17011
17070
  }
17012
17071
  async function main() {
17013
- const program2 = new Command;
17014
- program2.name("workbuddy").description("WorkBuddy CLI").version(packageVersion);
17015
- program2.option("--describe", "Print machine-readable JSON description of all available operations");
17016
- registerAuthCommands(program2);
17017
- registerGeneratedCommands(program2);
17072
+ const program = new Command2;
17073
+ program.name("workbuddy").description("WorkBuddy CLI").version(packageVersion);
17074
+ program.option("--describe", "Print machine-readable JSON description of all available operations");
17075
+ registerAuthCommands(program);
17076
+ registerGeneratedCommands(program);
17018
17077
  if (process.argv.includes("--describe")) {
17019
17078
  const args = process.argv.slice(2).filter((a) => a !== "--describe");
17020
17079
  if (args.length === 0) {
@@ -17039,10 +17098,10 @@ async function main() {
17039
17098
  return;
17040
17099
  }
17041
17100
  }
17042
- await program2.parseAsync(process.argv);
17101
+ await program.parseAsync(process.argv);
17043
17102
  }
17044
- function registerAuthCommands(program2) {
17045
- const auth = program2.command("auth").description("Manage WorkBuddy CLI credentials");
17103
+ function registerAuthCommands(program) {
17104
+ const auth = program.command("auth").description("Manage WorkBuddy CLI credentials");
17046
17105
  auth.command("login").description("Store WorkBuddy API credentials locally").option("--base-url <url>", "Tenant base URL (required)").option("--client-id <id>", "OAuth2 client ID (required)").option("--client-secret <secret>", "OAuth2 client secret (required, prompted if omitted)").option("--api-version <version>", "WorkBuddy API version header", "2026-01").option("--profile <name>", "Profile name", getActiveProfileName()).action(async (options) => {
17047
17106
  const baseUrl = options.baseUrl || await prompt("Tenant URL (e.g. https://yourcompany.workbuddy.com): ");
17048
17107
  const clientId = options.clientId || await prompt("Client ID: ");
@@ -17149,11 +17208,11 @@ var GROUP_DESCRIPTIONS = {
17149
17208
  integration: "Integration activities",
17150
17209
  resources: "Technicians and contractors assigned to stages"
17151
17210
  };
17152
- function registerGeneratedCommands(program2) {
17211
+ function registerGeneratedCommands(program) {
17153
17212
  const commandCache = new Map;
17154
- commandCache.set("", program2);
17213
+ commandCache.set("", program);
17155
17214
  for (const operation of operations) {
17156
- let parent = program2;
17215
+ let parent = program;
17157
17216
  const pathParts = [];
17158
17217
  for (const segment of operation.commandPath) {
17159
17218
  pathParts.push(segment);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workbuddy/cli-vnext",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
4
4
  "description": "WorkBuddy command line interface",
5
5
  "license": "MIT",
6
6
  "type": "module",