node-autotask 0.39.0 → 0.39.2

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 (39) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/MCP_TOOL_MANIFEST.md +4 -4
  3. package/N8N_MCP_MANIFEST.json +2 -2
  4. package/N8N_MCP_MANIFEST.md +3 -3
  5. package/capabilities.json +144 -144
  6. package/dist/capabilities.cjs +2 -2
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-45PLS73K.cjs → chunk-5QS3VT34.cjs} +160 -110
  9. package/dist/{chunk-2KQS3RHQ.js → chunk-GDSCYY2G.js} +143 -143
  10. package/dist/{chunk-LD5UPSDB.js → chunk-GSGP2B4I.js} +2 -2
  11. package/dist/{chunk-6ROB5KXB.cjs → chunk-HSBIVZGJ.cjs} +285 -285
  12. package/dist/{chunk-OKFTECIE.js → chunk-I7IM342A.js} +2 -2
  13. package/dist/{chunk-KSNK6UEW.cjs → chunk-N2JOGUGI.cjs} +143 -143
  14. package/dist/{chunk-FV5PJLIZ.js → chunk-UNOQESFU.js} +73 -23
  15. package/dist/{chunk-RAZEXOLC.cjs → chunk-VR6RYXTD.cjs} +143 -143
  16. package/dist/{index-Bmoiwhx2.d.ts → index-BsyWsYWi.d.cts} +7180 -51
  17. package/dist/{index-BVOOHPvr.d.cts → index-BsyWsYWi.d.ts} +7180 -51
  18. package/dist/index.cjs +22 -22
  19. package/dist/index.d.cts +2 -4
  20. package/dist/index.d.ts +2 -4
  21. package/dist/index.js +4 -4
  22. package/dist/operations/index.cjs +179 -177
  23. package/dist/operations/index.d.cts +3 -221
  24. package/dist/operations/index.d.ts +3 -221
  25. package/dist/operations/index.js +4 -2
  26. package/dist/pool.cjs +9 -9
  27. package/dist/pool.d.cts +1 -2
  28. package/dist/pool.d.ts +1 -2
  29. package/dist/pool.js +4 -4
  30. package/dist/resources/index.cjs +4 -4
  31. package/dist/resources/index.d.cts +1 -2
  32. package/dist/resources/index.d.ts +1 -2
  33. package/dist/resources/index.js +3 -3
  34. package/dist/types/index.d.cts +1 -1
  35. package/dist/types/index.d.ts +1 -1
  36. package/docs/API.md +49 -10
  37. package/package.json +1 -1
  38. package/dist/index-BQVStxwi.d.cts +0 -6893
  39. package/dist/index-BQVStxwi.d.ts +0 -6893
@@ -68,30 +68,31 @@
68
68
 
69
69
 
70
70
 
71
- var _chunk45PLS73Kcjs = require('../chunk-45PLS73K.cjs');
72
71
 
72
+ var _chunk5QS3VT34cjs = require('../chunk-5QS3VT34.cjs');
73
73
 
74
- var _chunkRAZEXOLCcjs = require('../chunk-RAZEXOLC.cjs');
74
+
75
+ var _chunkVR6RYXTDcjs = require('../chunk-VR6RYXTD.cjs');
75
76
  require('../chunk-MJTKK3QG.cjs');
76
77
 
77
78
  // src/operations/searchAcrossResources.ts
78
79
  var DEFAULT_LIMIT = 25;
79
80
  function resourceFor(client, key) {
80
- return client[_chunk45PLS73Kcjs.camelKey.call(void 0, key)];
81
+ return client[_chunk5QS3VT34cjs.camelKey.call(void 0, key)];
81
82
  }
82
83
  async function searchAcrossResources(client, query, opts = {}) {
83
84
  const text = query.trim();
84
85
  if (text === "") {
85
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
86
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
86
87
  }
87
- const keys = _nullishCoalesce(opts.resources, () => ( _chunk45PLS73Kcjs.WORKFLOW_RESOURCES));
88
+ const keys = _nullishCoalesce(opts.resources, () => ( _chunk5QS3VT34cjs.WORKFLOW_RESOURCES));
88
89
  if (keys.length === 0) {
89
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
90
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
90
91
  }
91
- const limit = _chunk45PLS73Kcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
92
+ const limit = _chunk5QS3VT34cjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
92
93
  const totalLimit = opts.totalLimit;
93
94
  if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
94
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
95
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
95
96
  }
96
97
  const results = [];
97
98
  const skipped = [];
@@ -122,7 +123,7 @@ async function searchAcrossResources(client, query, opts = {}) {
122
123
 
123
124
  // src/operations/resolveAny.ts
124
125
  function resourceFor2(client, key) {
125
- return client[_chunk45PLS73Kcjs.camelKey.call(void 0, key)];
126
+ return client[_chunk5QS3VT34cjs.camelKey.call(void 0, key)];
126
127
  }
127
128
  var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
128
129
  function missCost(identifier) {
@@ -131,13 +132,13 @@ function missCost(identifier) {
131
132
  }
132
133
  async function resolveAny(client, identifier, opts = {}) {
133
134
  if (typeof identifier === "number") {
134
- _chunk45PLS73Kcjs.parseIdentifier.call(void 0, identifier, "identifier");
135
+ _chunk5QS3VT34cjs.parseIdentifier.call(void 0, identifier, "identifier");
135
136
  } else if (identifier.trim() === "") {
136
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
137
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
137
138
  }
138
- const keys = _nullishCoalesce(opts.resources, () => ( _chunk45PLS73Kcjs.WORKFLOW_RESOURCES));
139
+ const keys = _nullishCoalesce(opts.resources, () => ( _chunk5QS3VT34cjs.WORKFLOW_RESOURCES));
139
140
  if (keys.length === 0) {
140
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("resolveAny: no resources requested");
141
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("resolveAny: no resources requested");
141
142
  }
142
143
  const results = [];
143
144
  for (const key of keys) {
@@ -167,9 +168,9 @@ async function resolveAny(client, identifier, opts = {}) {
167
168
  } catch (err) {
168
169
  let code;
169
170
  let candidates = [];
170
- if (err instanceof _chunk45PLS73Kcjs.AutotaskConfigError) {
171
+ if (err instanceof _chunk5QS3VT34cjs.AutotaskConfigError) {
171
172
  code = "CONFIG_ERROR";
172
- } else if (_chunk45PLS73Kcjs.isAutotaskError.call(void 0, err)) {
173
+ } else if (_chunk5QS3VT34cjs.isAutotaskError.call(void 0, err)) {
173
174
  if (FAULT_CATEGORIES.has(err.category)) throw err;
174
175
  code = err.code;
175
176
  if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
@@ -196,7 +197,7 @@ async function resolveAny(client, identifier, opts = {}) {
196
197
  // src/operations/aggregate.ts
197
198
  var AGGREGATE_TOP_MAX = 100;
198
199
  var AGGREGATE_DEFAULT_TOP = 25;
199
- var AGGREGATE_DEFAULT_LIMIT = _chunk45PLS73Kcjs.BOUNDED_QUERY_MAX_LIMIT;
200
+ var AGGREGATE_DEFAULT_LIMIT = _chunk5QS3VT34cjs.BOUNDED_QUERY_MAX_LIMIT;
200
201
  var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
201
202
  var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
202
203
  var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
@@ -253,7 +254,7 @@ function dateBucketLabel(value, bucket) {
253
254
  }
254
255
  var QUERY_RESOURCE_KEYS = (() => {
255
256
  const s = /* @__PURE__ */ new Set();
256
- for (const rec of _chunkRAZEXOLCcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
257
+ for (const rec of _chunkVR6RYXTDcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
257
258
  return s;
258
259
  })();
259
260
  var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit", "names"];
@@ -289,15 +290,15 @@ function parseFilterConditions(filter, problems) {
289
290
  return [];
290
291
  }
291
292
  try {
292
- return _chunk45PLS73Kcjs.buildFilter.call(void 0, conds).filter;
293
+ return _chunk5QS3VT34cjs.buildFilter.call(void 0, conds).filter;
293
294
  } catch (err) {
294
- problems.push(err instanceof _chunk45PLS73Kcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
295
+ problems.push(err instanceof _chunk5QS3VT34cjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
295
296
  return [];
296
297
  }
297
298
  }
298
299
  function checkOptsBag(opts, problems) {
299
300
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
300
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
301
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
301
302
  `aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
302
303
  { operation: "operations.aggregate" }
303
304
  );
@@ -361,18 +362,18 @@ function parseTopAndLimit(opts, problems) {
361
362
  if (!Number.isInteger(opts.limit)) {
362
363
  problems.push(`limit must be an integer (got ${String(opts.limit)})`);
363
364
  } else {
364
- limit = Math.min(Math.max(opts.limit, 1), _chunk45PLS73Kcjs.BOUNDED_QUERY_MAX_LIMIT);
365
+ limit = Math.min(Math.max(opts.limit, 1), _chunk5QS3VT34cjs.BOUNDED_QUERY_MAX_LIMIT);
365
366
  }
366
367
  }
367
368
  return { top, limit };
368
369
  }
369
370
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
370
- const record = resourceKey === void 0 ? void 0 : _chunkRAZEXOLCcjs.CAPABILITIES.find((r) => r.resource === resourceKey && r.operation === "query");
371
+ const record = resourceKey === void 0 ? void 0 : _chunkVR6RYXTDcjs.CAPABILITIES.find((r) => r.resource === resourceKey && r.operation === "query");
371
372
  if (record === void 0) return void 0;
372
373
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
373
374
  const groupBy = strings(opts.groupBy);
374
- const found = await _chunk45PLS73Kcjs.findUnknownFieldNames.call(void 0, record, void 0, {
375
- filter: _chunk45PLS73Kcjs.collectFilterFieldNames.call(void 0, conditions),
375
+ const found = await _chunk5QS3VT34cjs.findUnknownFieldNames.call(void 0, record, void 0, {
376
+ filter: _chunk5QS3VT34cjs.collectFilterFieldNames.call(void 0, conditions),
376
377
  groupBy: groupBy.map((f) => f.split("@")[0]),
377
378
  sum: strings(opts.sum)
378
379
  });
@@ -396,14 +397,14 @@ async function validateAggregate(operation, filter, opts) {
396
397
  checkOptsBag(opts, problems);
397
398
  const oracles = {
398
399
  resourceKey,
399
- dateSets: resourceKey !== void 0 ? _chunk45PLS73Kcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
400
+ dateSets: resourceKey !== void 0 ? _chunk5QS3VT34cjs.MODEL_DATE_FIELDS[resourceKey] : void 0
400
401
  };
401
402
  const known = await checkFieldNames(resourceKey, conditions, opts, problems);
402
403
  const groupBy = parseGroupBy(opts, oracles, known, problems);
403
404
  const sum = checkSumFields("sum", opts.sum, problems);
404
405
  const { top, limit } = parseTopAndLimit(opts, problems);
405
406
  if (problems.length > 0) {
406
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
407
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
407
408
  `aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
408
409
  - ` + problems.join("\n- "),
409
410
  { operation: "operations.aggregate" }
@@ -437,9 +438,9 @@ function foldGroups(items, v) {
437
438
  }
438
439
  async function aggregate(client, operation, filter, opts = {}) {
439
440
  const v = await validateAggregate(operation, filter, opts);
440
- const holder = client[_chunk45PLS73Kcjs.camelKey.call(void 0, v.resourceKey)];
441
+ const holder = client[_chunk5QS3VT34cjs.camelKey.call(void 0, v.resourceKey)];
441
442
  if (holder === void 0) {
442
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
443
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
443
444
  operation: "operations.aggregate",
444
445
  suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
445
446
  });
@@ -456,7 +457,7 @@ async function aggregate(client, operation, filter, opts = {}) {
456
457
  const res = await holder.queryBounded({ filter: wireFilter, limit: v.limit });
457
458
  const sorted = foldGroups(res.items, v);
458
459
  const top = sorted.slice(0, v.top);
459
- const labelled = opts.names === false || v.groupBy.length === 0 ? void 0 : await _chunk45PLS73Kcjs.labelRows.call(void 0, client, v.resourceKey, top.map((g) => g.key));
460
+ const labelled = opts.names === false || v.groupBy.length === 0 ? void 0 : await _chunk5QS3VT34cjs.labelRows.call(void 0, client, v.resourceKey, top.map((g) => g.key));
460
461
  const result = {
461
462
  mode: v.groupBy.length > 0 ? "group" : "sum",
462
463
  groups: top.map((g, i) => ({ key: _nullishCoalesce(_optionalChain([labelled, 'optionalAccess', _3 => _3.rows, 'access', _4 => _4[i]]), () => ( g.key)), count: g.count, ...g.sums !== void 0 ? { sums: g.sums } : {} })),
@@ -487,10 +488,10 @@ var DEFAULT_CONTRACT_TYPE_RE = /^\s*(recurring|fixed)\b/i;
487
488
  var CONTRACTS_PATH = "/V1.0/Contracts";
488
489
  var COMPANIES_PATH = "/V1.0/Companies";
489
490
  var BILLING_ITEMS_PATH = "/V1.0/BillingItems";
490
- var LINE_TYPE_FIELDS = ["billingItemType", "timeEntryID", "expenseItemID", ..._chunk45PLS73Kcjs.CHARGE_LINE_FKS, ..._chunk45PLS73Kcjs.SERVICE_LINE_FKS];
491
- var isLabour = (line) => _chunk45PLS73Kcjs.billingLineType.call(void 0, line) === "labour";
491
+ var LINE_TYPE_FIELDS = ["billingItemType", "timeEntryID", "expenseItemID", ..._chunk5QS3VT34cjs.CHARGE_LINE_FKS, ..._chunk5QS3VT34cjs.SERVICE_LINE_FKS];
492
+ var isLabour = (line) => _chunk5QS3VT34cjs.billingLineType.call(void 0, line) === "labour";
492
493
  function picklistKey(c, dim, path, field, raw, missing) {
493
- const id = _chunk45PLS73Kcjs.num.call(void 0, raw);
494
+ const id = _chunk5QS3VT34cjs.num.call(void 0, raw);
494
495
  if (id === 0) return { id: null, label: missing };
495
496
  const label = _optionalChain([c, 'access', _6 => _6.labels, 'access', _7 => _7[path], 'optionalAccess', _8 => _8.get, 'call', _9 => _9(field), 'optionalAccess', _10 => _10.get, 'call', _11 => _11(id)]);
496
497
  if (label === void 0) {
@@ -513,7 +514,7 @@ var DIMENSIONS = {
513
514
  },
514
515
  company: {
515
516
  joins: { companies: ["companyName"] },
516
- key: (c) => ({ id: _chunk45PLS73Kcjs.num.call(void 0, c.line["companyID"]), name: String(_nullishCoalesce(_optionalChain([c, 'access', _14 => _14.company, 'optionalAccess', _15 => _15["companyName"]]), () => ( ""))) })
517
+ key: (c) => ({ id: _chunk5QS3VT34cjs.num.call(void 0, c.line["companyID"]), name: String(_nullishCoalesce(_optionalChain([c, 'access', _14 => _14.company, 'optionalAccess', _15 => _15["companyName"]]), () => ( ""))) })
517
518
  },
518
519
  month: {
519
520
  key: (c) => ({ id: c.invoice.month })
@@ -521,11 +522,11 @@ var DIMENSIONS = {
521
522
  billingItemKind: {
522
523
  lineFields: LINE_TYPE_FIELDS,
523
524
  picklist: BILLING_ITEMS_PATH,
524
- key: (c) => _chunk45PLS73Kcjs.num.call(void 0, c.line["billingItemType"]) === 0 ? { id: _chunk45PLS73Kcjs.billingLineType.call(void 0, c.line), label: _chunk45PLS73Kcjs.billingLineType.call(void 0, c.line) } : picklistKey(c, "billingItemKind", BILLING_ITEMS_PATH, "billingItemType", c.line["billingItemType"], "other")
525
+ key: (c) => _chunk5QS3VT34cjs.num.call(void 0, c.line["billingItemType"]) === 0 ? { id: _chunk5QS3VT34cjs.billingLineType.call(void 0, c.line), label: _chunk5QS3VT34cjs.billingLineType.call(void 0, c.line) } : picklistKey(c, "billingItemKind", BILLING_ITEMS_PATH, "billingItemType", c.line["billingItemType"], "other")
525
526
  },
526
527
  contract: {
527
528
  joins: { contracts: ["contractName"] },
528
- key: (c) => ({ id: _chunk45PLS73Kcjs.num.call(void 0, c.line["contractID"]), name: String(_nullishCoalesce(c.contract["contractName"], () => ( ""))) })
529
+ key: (c) => ({ id: _chunk5QS3VT34cjs.num.call(void 0, c.line["contractID"]), name: String(_nullishCoalesce(c.contract["contractName"], () => ( ""))) })
529
530
  },
530
531
  // Per line (no contract-pointer fallback): association → level2 (the Line of Business, `name`) + level1 (the division).
531
532
  lineOfBusiness: {
@@ -533,11 +534,11 @@ var DIMENSIONS = {
533
534
  joins: { organizationalLevelAssociations: [], organizationalLevel1s: [], organizationalLevel2s: [] },
534
535
  unresolved: "unresolvedAssociations",
535
536
  key: (c) => {
536
- const id = _chunk45PLS73Kcjs.num.call(void 0, c.line["organizationalLevelAssociationID"]);
537
+ const id = _chunk5QS3VT34cjs.num.call(void 0, c.line["organizationalLevelAssociationID"]);
537
538
  if (id === 0) return { id: null, label: "no LOB assigned" };
538
539
  const a = c.joined.organizationalLevelAssociations.get(id);
539
- const l1 = c.joined.organizationalLevel1s.get(_chunk45PLS73Kcjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _16 => _16["organizationalLevel1ID"]])));
540
- const l2 = c.joined.organizationalLevel2s.get(_chunk45PLS73Kcjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _17 => _17["organizationalLevel2ID"]])));
540
+ const l1 = c.joined.organizationalLevel1s.get(_chunk5QS3VT34cjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _16 => _16["organizationalLevel1ID"]])));
541
+ const l2 = c.joined.organizationalLevel2s.get(_chunk5QS3VT34cjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _17 => _17["organizationalLevel2ID"]])));
541
542
  if (l1 === void 0 || l2 === void 0) return "unresolvedAssociations";
542
543
  return { id, name: String(_nullishCoalesce(l2["name"], () => ( ""))), division: String(_nullishCoalesce(l1["name"], () => ( ""))) };
543
544
  }
@@ -548,9 +549,9 @@ var DIMENSIONS = {
548
549
  joins: { timeEntries: [], resources: [] },
549
550
  unresolved: "unresolvedTimeEntries",
550
551
  key: (c) => {
551
- const te = _chunk45PLS73Kcjs.num.call(void 0, c.line["timeEntryID"]);
552
+ const te = _chunk5QS3VT34cjs.num.call(void 0, c.line["timeEntryID"]);
552
553
  if (!isLabour(c.line) || te === 0) return { id: null, label: "n/a" };
553
- const id = _chunk45PLS73Kcjs.num.call(void 0, _optionalChain([c, 'access', _18 => _18.joined, 'access', _19 => _19.timeEntries, 'access', _20 => _20.get, 'call', _21 => _21(te), 'optionalAccess', _22 => _22["resourceID"]]));
554
+ const id = _chunk5QS3VT34cjs.num.call(void 0, _optionalChain([c, 'access', _18 => _18.joined, 'access', _19 => _19.timeEntries, 'access', _20 => _20.get, 'call', _21 => _21(te), 'optionalAccess', _22 => _22["resourceID"]]));
554
555
  const r = c.joined.resources.get(id);
555
556
  if (r === void 0) return "unresolvedTimeEntries";
556
557
  return { id, name: `${String(_nullishCoalesce(r["firstName"], () => ( "")))} ${String(_nullishCoalesce(r["lastName"], () => ( "")))}`.trim() };
@@ -561,58 +562,58 @@ var DIMENSIONS = {
561
562
  joins: { billingCodes: [] },
562
563
  unresolved: "unresolvedBillingCodes",
563
564
  key: (c) => {
564
- const id = _chunk45PLS73Kcjs.num.call(void 0, c.line["billingCodeID"]);
565
+ const id = _chunk5QS3VT34cjs.num.call(void 0, c.line["billingCodeID"]);
565
566
  if (id === 0) return { id: null, label: "none" };
566
567
  const b = c.joined.billingCodes.get(id);
567
568
  return b === void 0 ? "unresolvedBillingCodes" : { id, name: String(_nullishCoalesce(b["name"], () => ( ""))) };
568
569
  }
569
570
  }
570
571
  };
571
- var fk = (rows, field) => [...rows].map((r) => _chunk45PLS73Kcjs.num.call(void 0, r[field]));
572
+ var fk = (rows, field) => [...rows].map((r) => _chunk5QS3VT34cjs.num.call(void 0, r[field]));
572
573
  var ONE_CHUNK = (idChunks) => Math.min(1, idChunks);
573
574
  var JOINS = {
574
575
  contracts: {
575
- make: (http) => new (0, _chunk45PLS73Kcjs.ContractsResource)(http, PAGE),
576
+ make: (http) => new (0, _chunk5QS3VT34cjs.ContractsResource)(http, PAGE),
576
577
  fields: ["id", "contractType", "contractCategory"],
577
578
  ids: (lines) => fk(lines, "contractID")
578
579
  },
579
580
  companies: {
580
- make: (http) => new (0, _chunk45PLS73Kcjs.CompaniesResource)(http, PAGE),
581
+ make: (http) => new (0, _chunk5QS3VT34cjs.CompaniesResource)(http, PAGE),
581
582
  fields: ["id"],
582
583
  ids: (lines) => fk(lines, "companyID")
583
584
  },
584
585
  organizationalLevelAssociations: {
585
- make: (http) => new (0, _chunk45PLS73Kcjs.OrganizationalLevelAssociationsResource)(http, PAGE),
586
+ make: (http) => new (0, _chunk5QS3VT34cjs.OrganizationalLevelAssociationsResource)(http, PAGE),
586
587
  fields: ["id", "organizationalLevel1ID", "organizationalLevel2ID"],
587
588
  ids: (lines) => fk(lines, "organizationalLevelAssociationID")
588
589
  },
589
590
  organizationalLevel1s: {
590
- make: (http) => new (0, _chunk45PLS73Kcjs.OrganizationalLevel1sResource)(http, PAGE),
591
+ make: (http) => new (0, _chunk5QS3VT34cjs.OrganizationalLevel1sResource)(http, PAGE),
591
592
  fields: ["id", "name"],
592
593
  ids: (_, j) => fk(j["organizationalLevelAssociations"].values(), "organizationalLevel1ID"),
593
594
  chunks: ONE_CHUNK
594
595
  },
595
596
  organizationalLevel2s: {
596
- make: (http) => new (0, _chunk45PLS73Kcjs.OrganizationalLevel2sResource)(http, PAGE),
597
+ make: (http) => new (0, _chunk5QS3VT34cjs.OrganizationalLevel2sResource)(http, PAGE),
597
598
  fields: ["id", "name"],
598
599
  ids: (_, j) => fk(j["organizationalLevelAssociations"].values(), "organizationalLevel2ID"),
599
600
  chunks: ONE_CHUNK
600
601
  },
601
602
  timeEntries: {
602
- make: (http) => new (0, _chunk45PLS73Kcjs.TimeEntriesResource)(http, PAGE),
603
+ make: (http) => new (0, _chunk5QS3VT34cjs.TimeEntriesResource)(http, PAGE),
603
604
  fields: ["id", "resourceID"],
604
605
  ids: (lines) => fk(lines.filter(isLabour), "timeEntryID"),
605
606
  // One time entry per labour line: the line count is the upper bound (labour share unknown pre-walk).
606
607
  chunks: (_, lines) => pages(lines)
607
608
  },
608
609
  resources: {
609
- make: (http, client) => new (0, _chunk45PLS73Kcjs.ResourcesResource)(http, client.config, PAGE),
610
+ make: (http, client) => new (0, _chunk5QS3VT34cjs.ResourcesResource)(http, client.config, PAGE),
610
611
  fields: ["id", "firstName", "lastName"],
611
612
  ids: (_, j) => fk(j["timeEntries"].values(), "resourceID"),
612
613
  chunks: ONE_CHUNK
613
614
  },
614
615
  billingCodes: {
615
- make: (http) => new (0, _chunk45PLS73Kcjs.BillingCodesResource)(http, PAGE),
616
+ make: (http) => new (0, _chunk5QS3VT34cjs.BillingCodesResource)(http, PAGE),
616
617
  fields: ["id", "name"],
617
618
  ids: (lines) => fk(lines, "billingCodeID")
618
619
  }
@@ -647,7 +648,7 @@ function checkInt(name, v, def, max, problems) {
647
648
  }
648
649
  function validate(opts) {
649
650
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
650
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("revenueRollup: opts must be the options object { <scope>, dateFrom, dateTo, ... } (zero wire was issued)", { operation: OP });
651
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("revenueRollup: opts must be the options object { <scope>, dateFrom, dateTo, ... } (zero wire was issued)", { operation: OP });
651
652
  }
652
653
  const o = opts;
653
654
  const problems = [];
@@ -664,12 +665,12 @@ function validate(opts) {
664
665
  if (scopeKind === "tenantWide" && o.tenantWide !== true) problems.push("tenantWide must be exactly true");
665
666
  }
666
667
  const { dateFrom, dateTo } = o;
667
- if (!_chunk45PLS73Kcjs.isDateYMD.call(void 0, dateFrom) || !_chunk45PLS73Kcjs.isDateYMD.call(void 0, dateTo)) {
668
+ if (!_chunk5QS3VT34cjs.isDateYMD.call(void 0, dateFrom) || !_chunk5QS3VT34cjs.isDateYMD.call(void 0, dateTo)) {
668
669
  problems.push("dateFrom and dateTo are both required as YYYY-MM-DD (the window is inclusive, whole UTC days)");
669
670
  } else if (dateFrom > dateTo) {
670
671
  problems.push(`dateFrom ${dateFrom} is after dateTo ${dateTo}`);
671
- } else if (_chunk45PLS73Kcjs.monthsInWindow.call(void 0, dateFrom, dateTo) > _chunk45PLS73Kcjs.PROFITABILITY_MAX_WINDOW_MONTHS) {
672
- problems.push(`the window spans ${_chunk45PLS73Kcjs.monthsInWindow.call(void 0, dateFrom, dateTo)} months; the cap is ${_chunk45PLS73Kcjs.PROFITABILITY_MAX_WINDOW_MONTHS}`);
672
+ } else if (_chunk5QS3VT34cjs.monthsInWindow.call(void 0, dateFrom, dateTo) > _chunk5QS3VT34cjs.PROFITABILITY_MAX_WINDOW_MONTHS) {
673
+ problems.push(`the window spans ${_chunk5QS3VT34cjs.monthsInWindow.call(void 0, dateFrom, dateTo)} months; the cap is ${_chunk5QS3VT34cjs.PROFITABILITY_MAX_WINDOW_MONTHS}`);
673
674
  }
674
675
  let groupBy = [...DEFAULT_GROUP_BY];
675
676
  if (o.groupBy !== void 0) {
@@ -696,7 +697,7 @@ function validate(opts) {
696
697
  };
697
698
  if (o.includeNonChargeable !== void 0 && typeof o.includeNonChargeable !== "boolean") problems.push("includeNonChargeable must be a boolean");
698
699
  if (problems.length > 0) {
699
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`revenueRollup: ${problems.length} problem(s) found pre-request (zero wire was issued)
700
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`revenueRollup: ${problems.length} problem(s) found pre-request (zero wire was issued)
700
701
  - ${problems.join("\n- ")}`, { operation: OP });
701
702
  }
702
703
  return v;
@@ -714,7 +715,7 @@ function resolveSelector(name, sel, values) {
714
715
  }
715
716
  function unmatched(name, what, values) {
716
717
  const live = [...values].map(([id, l]) => `${id} ${l}`).join("; ") || "(the picklist serves no values)";
717
- return new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`revenueRollup: ${name}: ${what}. Live values (id label): ${live}`, {
718
+ return new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`revenueRollup: ${name}: ${what}. Live values (id label): ${live}`, {
718
719
  operation: OP,
719
720
  suggestedAction: `Pass ${name} as ids or exact labels from the live list.`
720
721
  });
@@ -725,10 +726,10 @@ var chunk = (a) => {
725
726
  for (let i = 0; i < a.length; i += PAGE) out.push(a.slice(i, i + PAGE));
726
727
  return out;
727
728
  };
728
- var byId = (rows) => [...new Map(rows.map((r) => [_chunk45PLS73Kcjs.num.call(void 0, r["id"]), r])).values()];
729
- var cents = (v) => Math.round(_chunk45PLS73Kcjs.num.call(void 0, v) * 100);
730
- var revC = (line) => cents(_chunk45PLS73Kcjs.internalAmount.call(void 0, line, "internalCurrencyTotalAmount", "totalAmount"));
731
- var extC = (line) => cents(_chunk45PLS73Kcjs.internalAmount.call(void 0, line, "internalCurrencyExtendedPrice", "extendedPrice"));
729
+ var byId = (rows) => [...new Map(rows.map((r) => [_chunk5QS3VT34cjs.num.call(void 0, r["id"]), r])).values()];
730
+ var cents = (v) => Math.round(_chunk5QS3VT34cjs.num.call(void 0, v) * 100);
731
+ var revC = (line) => cents(_chunk5QS3VT34cjs.internalAmount.call(void 0, line, "internalCurrencyTotalAmount", "totalAmount"));
732
+ var extC = (line) => cents(_chunk5QS3VT34cjs.internalAmount.call(void 0, line, "internalCurrencyExtendedPrice", "extendedPrice"));
732
733
  var INTERNAL_FIELDS = ["internalCurrencyTotalAmount", "internalCurrencyExtendedPrice"];
733
734
  var lacksInternal = (line) => INTERNAL_FIELDS.some((k) => !Number.isFinite(line[k]));
734
735
  var money = (c) => c / 100;
@@ -739,7 +740,7 @@ async function collect(res, filter, includeFields) {
739
740
  return out;
740
741
  }
741
742
  function blindCount() {
742
- return new (0, _chunk45PLS73Kcjs.AutotaskError)("revenueRollup: a gate count came back blind (unknown, not zero); the roll-up cannot be sized", {
743
+ return new (0, _chunk5QS3VT34cjs.AutotaskError)("revenueRollup: a gate count came back blind (unknown, not zero); the roll-up cannot be sized", {
743
744
  code: "INVALID_RESPONSE",
744
745
  category: "server",
745
746
  operation: OP,
@@ -749,7 +750,7 @@ function blindCount() {
749
750
  }
750
751
  function countMismatch(what, streamed, counted, rows) {
751
752
  const rowNote = rows !== void 0 && rows !== streamed ? ` (${rows} rows)` : "";
752
- return new (0, _chunk45PLS73Kcjs.AutotaskError)(`revenueRollup: the ${what} stream returned ${streamed} distinct ids${rowNote} but the gate count was ${counted} (the data changed mid-walk or a page dropped rows); the fold was discarded`, {
753
+ return new (0, _chunk5QS3VT34cjs.AutotaskError)(`revenueRollup: the ${what} stream returned ${streamed} distinct ids${rowNote} but the gate count was ${counted} (the data changed mid-walk or a page dropped rows); the fold was discarded`, {
753
754
  code: "INVALID_RESPONSE",
754
755
  category: "server",
755
756
  operation: OP,
@@ -758,7 +759,7 @@ function countMismatch(what, streamed, counted, rows) {
758
759
  });
759
760
  }
760
761
  function budgetError(message, details, suggestedAction) {
761
- return new (0, _chunk45PLS73Kcjs.AutotaskError)(message, { code: "BUDGET_EXCEEDED", category: "policy", operation: OP, details, suggestedAction });
762
+ return new (0, _chunk5QS3VT34cjs.AutotaskError)(message, { code: "BUDGET_EXCEEDED", category: "policy", operation: OP, details, suggestedAction });
762
763
  }
763
764
  function lastMonthsFrom(dateTo, months) {
764
765
  return new Date(Date.UTC(Number(dateTo.slice(0, 4)), Number(dateTo.slice(5, 7)) - months, 1)).toISOString().slice(0, 10);
@@ -791,7 +792,7 @@ async function revenueRollup(client, opts) {
791
792
  const groupDims = v.groupBy.map((d) => DIMENSIONS[d]);
792
793
  const paths = [.../* @__PURE__ */ new Set([CONTRACTS_PATH, ...groupDims.flatMap((d) => d.picklist ? [d.picklist] : [])])];
793
794
  const labels = {};
794
- for (const p of paths) labels[p] = await _chunk45PLS73Kcjs.readPicklists.call(void 0, http, p, OP);
795
+ for (const p of paths) labels[p] = await _chunk5QS3VT34cjs.readPicklists.call(void 0, http, p, OP);
795
796
  const contractLabels = labels[CONTRACTS_PATH];
796
797
  const typeValues = _nullishCoalesce(contractLabels.get("contractType"), () => ( /* @__PURE__ */ new Map()));
797
798
  const inTypes = v.contractTypes ? resolveSelector("contractTypes", v.contractTypes, typeValues) : new Map([...typeValues].filter(([, l]) => DEFAULT_CONTRACT_TYPE_RE.test(l)));
@@ -800,23 +801,23 @@ async function revenueRollup(client, opts) {
800
801
  let scopeIds = v.scopeIds;
801
802
  if (v.scopeKind === "ownerResourceID") {
802
803
  const owned = /* @__PURE__ */ new Set();
803
- for await (const c of new (0, _chunk45PLS73Kcjs.CompaniesResource)(http, PAGE).query({ filter: [{ field: "ownerResourceID", op: "eq", value: v.ownerResourceID }], includeFields: ["id"], maxRecords: PAGE, names: false })) {
804
- const id = _chunk45PLS73Kcjs.num.call(void 0, c.id);
804
+ for await (const c of new (0, _chunk5QS3VT34cjs.CompaniesResource)(http, PAGE).query({ filter: [{ field: "ownerResourceID", op: "eq", value: v.ownerResourceID }], includeFields: ["id"], maxRecords: PAGE, names: false })) {
805
+ const id = _chunk5QS3VT34cjs.num.call(void 0, c.id);
805
806
  if (id > 0) owned.add(id);
806
807
  if (owned.size > SCOPE_IDS_MAX) break;
807
808
  }
808
809
  scopeIds = [...owned].sort((a, b) => a - b);
809
810
  if (scopeIds.length === 0 || scopeIds.length > SCOPE_IDS_MAX) {
810
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
811
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
811
812
  `revenueRollup: ownerResourceID ${v.ownerResourceID} resolves to ${scopeIds.length > SCOPE_IDS_MAX ? `more than ${SCOPE_IDS_MAX}` : 0} companies (companies.query; 1..${SCOPE_IDS_MAX} supported)`,
812
813
  { operation: OP, suggestedAction: "Pass companyIDs explicitly, or tenantWide: true." }
813
814
  );
814
815
  }
815
816
  }
816
817
  const scopeCond = scopeIds === void 0 ? [] : [{ field: v.scopeKind === "contractIDs" ? "contractID" : "companyID", op: "in", value: scopeIds }];
817
- const invoices = new (0, _chunk45PLS73Kcjs.InvoicesResource)(http, PAGE);
818
- const billingItems = new (0, _chunk45PLS73Kcjs.BillingItemsResource)(http, PAGE);
819
- const windowOn = (field) => [{ field, op: "gte", value: v.dateFrom }, { field, op: "lt", value: _chunk45PLS73Kcjs.dayAfter.call(void 0, v.dateTo) }];
818
+ const invoices = new (0, _chunk5QS3VT34cjs.InvoicesResource)(http, PAGE);
819
+ const billingItems = new (0, _chunk5QS3VT34cjs.BillingItemsResource)(http, PAGE);
820
+ const windowOn = (field) => [{ field, op: "gte", value: v.dateFrom }, { field, op: "lt", value: _chunk5QS3VT34cjs.dayAfter.call(void 0, v.dateTo) }];
820
821
  const invoiceFilter = (voided2) => [...windowOn("invoiceDateTime"), { field: "isVoided", op: "eq", value: voided2 }];
821
822
  const withVoided = v.scopeKind !== "contractIDs";
822
823
  const voidedFilter = [...invoiceFilter(true), ...scopeIds !== void 0 && withVoided ? [{ field: "companyID", op: "in", value: scopeIds }] : []];
@@ -840,7 +841,7 @@ async function revenueRollup(client, opts) {
840
841
  const invoiceRows = await collect(invoices, invoiceFilter(false), ["id", "invoiceTotal", "invoiceDateTime", "companyID"]);
841
842
  const invoiceById = /* @__PURE__ */ new Map();
842
843
  for (const r of invoiceRows) {
843
- invoiceById.set(_chunk45PLS73Kcjs.num.call(void 0, r["id"]), { total: cents(r["invoiceTotal"]), month: String(_nullishCoalesce(r["invoiceDateTime"], () => ( ""))).slice(0, 7), companyID: _chunk45PLS73Kcjs.num.call(void 0, r["companyID"]) });
844
+ invoiceById.set(_chunk5QS3VT34cjs.num.call(void 0, r["id"]), { total: cents(r["invoiceTotal"]), month: String(_nullishCoalesce(r["invoiceDateTime"], () => ( ""))).slice(0, 7), companyID: _chunk5QS3VT34cjs.num.call(void 0, r["companyID"]) });
844
845
  }
845
846
  if (invoiceById.size !== nInvoices) throw countMismatch("invoice", invoiceById.size, nInvoices, invoiceRows.length);
846
847
  const voided = withVoided ? byId(await collect(invoices, voidedFilter, ["id", "invoiceTotal"])) : void 0;
@@ -854,13 +855,13 @@ async function revenueRollup(client, opts) {
854
855
  if (rows.length !== n) throw countMismatch("line", rows.length, n);
855
856
  return rows;
856
857
  }, chunk(ids), { concurrency: CONCURRENCY })).flat();
857
- const orphan = lines.find((l) => !invoiceById.has(_chunk45PLS73Kcjs.num.call(void 0, l["invoiceID"])));
858
+ const orphan = lines.find((l) => !invoiceById.has(_chunk5QS3VT34cjs.num.call(void 0, l["invoiceID"])));
858
859
  if (orphan !== void 0) {
859
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(`revenueRollup: billing line ${_chunk45PLS73Kcjs.num.call(void 0, orphan["id"])} belongs to invoice ${_chunk45PLS73Kcjs.num.call(void 0, orphan["invoiceID"])}, which is not among the ${invoiceById.size} streamed invoices; the fold was discarded`, {
860
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(`revenueRollup: billing line ${_chunk5QS3VT34cjs.num.call(void 0, orphan["id"])} belongs to invoice ${_chunk5QS3VT34cjs.num.call(void 0, orphan["invoiceID"])}, which is not among the ${invoiceById.size} streamed invoices; the fold was discarded`, {
860
861
  code: "INVALID_RESPONSE",
861
862
  category: "server",
862
863
  operation: OP,
863
- details: { reason: "orphan_line", lineID: _chunk45PLS73Kcjs.num.call(void 0, orphan["id"]), invoiceID: _chunk45PLS73Kcjs.num.call(void 0, orphan["invoiceID"]) },
864
+ details: { reason: "orphan_line", lineID: _chunk5QS3VT34cjs.num.call(void 0, orphan["id"]), invoiceID: _chunk5QS3VT34cjs.num.call(void 0, orphan["invoiceID"]) },
864
865
  suggestedAction: "Retry the call."
865
866
  });
866
867
  }
@@ -874,12 +875,12 @@ async function revenueRollup(client, opts) {
874
875
  const fields = [.../* @__PURE__ */ new Set([...spec.fields, ...groupDims.flatMap((d) => _nullishCoalesce(_optionalChain([d, 'access', _25 => _25.joins, 'optionalAccess', _26 => _26[j]]), () => ( [])))])];
875
876
  const want = [...new Set(spec.ids(all, joined))].filter((id) => id > 0).sort((a, b) => a - b);
876
877
  const rows = await client.batch((c) => collect(res, [{ field: "id", op: "in", value: c }], fields), chunk(want), { concurrency: CONCURRENCY });
877
- for (const r of rows.flat()) joined[j].set(_chunk45PLS73Kcjs.num.call(void 0, r["id"]), r);
878
+ for (const r of rows.flat()) joined[j].set(_chunk5QS3VT34cjs.num.call(void 0, r["id"]), r);
878
879
  }
879
880
  return fold(v, { invoiceById, voided, lines, uninvoiced, joined, labels, inTypes, inCategories, scopeIds, calls, estimate });
880
881
  }
881
882
  function refusal(v, estimate, fixed, scopeIds, joinCount) {
882
- const months = _chunk45PLS73Kcjs.monthsInWindow.call(void 0, v.dateFrom, v.dateTo);
883
+ const months = _chunk5QS3VT34cjs.monthsInWindow.call(void 0, v.dateFrom, v.dateTo);
883
884
  const variable = estimate - fixed;
884
885
  const fitMonths = Math.floor((v.budget - fixed) * months / variable);
885
886
  const suggestions = [];
@@ -975,15 +976,15 @@ function fold(v, f) {
975
976
  const zeroTotal = amt();
976
977
  const zeroIds = /* @__PURE__ */ new Set();
977
978
  const locate = (line, invoice) => {
978
- const contractID = _chunk45PLS73Kcjs.num.call(void 0, line["contractID"]);
979
+ const contractID = _chunk5QS3VT34cjs.num.call(void 0, line["contractID"]);
979
980
  if (contractID === 0) return { bucket: uncontracted, unresolved: false };
980
981
  const contract = f.joined.contracts.get(contractID);
981
982
  if (contract === void 0) return { bucket: unresolvedContracts, unresolved: true };
982
- const type = _chunk45PLS73Kcjs.num.call(void 0, contract["contractType"]);
983
+ const type = _chunk5QS3VT34cjs.num.call(void 0, contract["contractType"]);
983
984
  if (!f.inTypes.has(type)) return { bucket: slot(otherTypes, typeLabel(type)), unresolved: false };
984
- const cat = _chunk45PLS73Kcjs.num.call(void 0, contract["contractCategory"]);
985
+ const cat = _chunk5QS3VT34cjs.num.call(void 0, contract["contractCategory"]);
985
986
  if (f.inCategories !== void 0 && !f.inCategories.has(cat)) return { bucket: slot(otherCats, cat === 0 ? "uncategorised" : catLabel(cat)), unresolved: false };
986
- const company = f.joined.companies.get(_chunk45PLS73Kcjs.num.call(void 0, line["companyID"]));
987
+ const company = f.joined.companies.get(_chunk5QS3VT34cjs.num.call(void 0, line["companyID"]));
987
988
  if (needCompany && company === void 0) return { bucket: unresolvedCompanies, unresolved: true };
988
989
  const ctx = { line, invoice, contract, company, joined: f.joined, labels: f.labels, unlabelled };
989
990
  const keys = {};
@@ -1003,7 +1004,7 @@ function fold(v, f) {
1003
1004
  return { cell };
1004
1005
  };
1005
1006
  for (const line of f.lines) {
1006
- const invoiceID = _chunk45PLS73Kcjs.num.call(void 0, line["invoiceID"]);
1007
+ const invoiceID = _chunk5QS3VT34cjs.num.call(void 0, line["invoiceID"]);
1007
1008
  const invoice = f.invoiceById.get(invoiceID);
1008
1009
  lineTotals.set(invoiceID, (_nullishCoalesce(lineTotals.get(invoiceID), () => ( 0))) + cents(line["totalAmount"]));
1009
1010
  const c = revC(line);
@@ -1024,9 +1025,9 @@ function fold(v, f) {
1024
1025
  cell.creditLines += 1;
1025
1026
  }
1026
1027
  cell.included += extC(line) - c;
1027
- cell.contracts.add(_chunk45PLS73Kcjs.num.call(void 0, line["contractID"]));
1028
+ cell.contracts.add(_chunk5QS3VT34cjs.num.call(void 0, line["contractID"]));
1028
1029
  cell.items += 1;
1029
- allContracts.add(_chunk45PLS73Kcjs.num.call(void 0, line["contractID"]));
1030
+ allContracts.add(_chunk5QS3VT34cjs.num.call(void 0, line["contractID"]));
1030
1031
  if (byLob && cell.keys.lineOfBusiness.id === null) add(noPointer, c);
1031
1032
  const k = v.nonChargeable ? ncClass(line) : void 0;
1032
1033
  if (k) ncAdd(cell.nc, k, line);
@@ -1034,7 +1035,7 @@ function fold(v, f) {
1034
1035
  for (const line of f.uninvoiced) {
1035
1036
  const k = ncClass(line);
1036
1037
  if (!k) continue;
1037
- const at = locate(line, { total: 0, month: String(_nullishCoalesce(line["itemDate"], () => ( ""))).slice(0, 7), companyID: _chunk45PLS73Kcjs.num.call(void 0, line["companyID"]) });
1038
+ const at = locate(line, { total: 0, month: String(_nullishCoalesce(line["itemDate"], () => ( ""))).slice(0, 7), companyID: _chunk5QS3VT34cjs.num.call(void 0, line["companyID"]) });
1038
1039
  if ("cell" in at) ncAdd(at.cell.nc, k, line);
1039
1040
  else if (at.unresolved) add(unresolvedNc, extC(line));
1040
1041
  }
@@ -1144,20 +1145,20 @@ function slot(m, k) {
1144
1145
  async function relationshipMap(client, resourceKey) {
1145
1146
  void client;
1146
1147
  if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
1147
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1148
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1148
1149
  `relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
1149
1150
  { suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
1150
1151
  );
1151
1152
  }
1152
1153
  const key = resourceKey.trim();
1153
- const entry = _chunk45PLS73Kcjs.RELATIONSHIP_MAP[key];
1154
+ const entry = _chunk5QS3VT34cjs.RELATIONSHIP_MAP[key];
1154
1155
  if (entry === void 0) {
1155
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(
1156
- `relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk45PLS73Kcjs.RELATIONSHIP_MAP).length} resources`,
1156
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(
1157
+ `relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk5QS3VT34cjs.RELATIONSHIP_MAP).length} resources`,
1157
1158
  {
1158
1159
  code: "RESOURCE_UNKNOWN",
1159
1160
  category: "validation",
1160
- suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunk45PLS73Kcjs.RELATIONSHIP_ZONE.label} (${_chunk45PLS73Kcjs.RELATIONSHIP_ZONE.zone})-verified.`
1161
+ suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunk5QS3VT34cjs.RELATIONSHIP_ZONE.label} (${_chunk5QS3VT34cjs.RELATIONSHIP_ZONE.zone})-verified.`
1161
1162
  }
1162
1163
  );
1163
1164
  }
@@ -1174,24 +1175,24 @@ var BLIND_SURFACE_KINDS = [
1174
1175
  async function blindSurfaces(client, opts) {
1175
1176
  void client;
1176
1177
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1177
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
1178
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
1178
1179
  }
1179
- const inv = _chunk45PLS73Kcjs.BLIND_SURFACE_INVENTORY;
1180
+ const inv = _chunk5QS3VT34cjs.BLIND_SURFACE_INVENTORY;
1180
1181
  if (inv === null) {
1181
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
1182
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
1182
1183
  }
1183
1184
  let surfaces = inv.surfaces;
1184
1185
  if (_optionalChain([opts, 'optionalAccess', _32 => _32.resource]) !== void 0) {
1185
1186
  const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
1186
1187
  if (key === "") {
1187
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1188
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1188
1189
  "blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
1189
1190
  { suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
1190
1191
  );
1191
1192
  }
1192
1193
  if (!inv.surfaces.some((row) => row.resource === key)) {
1193
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(
1194
- `blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk45PLS73Kcjs.RELATIONSHIP_MAP).length} resources`,
1194
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(
1195
+ `blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk5QS3VT34cjs.RELATIONSHIP_MAP).length} resources`,
1195
1196
  {
1196
1197
  code: "RESOURCE_UNKNOWN",
1197
1198
  category: "validation",
@@ -1203,7 +1204,7 @@ async function blindSurfaces(client, opts) {
1203
1204
  }
1204
1205
  if (_optionalChain([opts, 'optionalAccess', _33 => _33.kind]) !== void 0) {
1205
1206
  if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
1206
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1207
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1207
1208
  `blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
1208
1209
  { suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
1209
1210
  );
@@ -1216,51 +1217,51 @@ async function blindSurfaces(client, opts) {
1216
1217
  // src/operations/probeReachability.ts
1217
1218
  async function probeReachability(client, opts) {
1218
1219
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1219
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
1220
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
1220
1221
  }
1221
- const defs = _chunk45PLS73Kcjs.REACHABILITY_PROBE_DEFAULTS;
1222
+ const defs = _chunk5QS3VT34cjs.REACHABILITY_PROBE_DEFAULTS;
1222
1223
  if (_optionalChain([opts, 'optionalAccess', _34 => _34.confirmProbe]) !== true) {
1223
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1224
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1224
1225
  "probeReachability: confirmProbe: true is required \u2014 the op deliberately fans out read wire across the tenant (one bounded query per surface); pass confirmProbe: true to run it",
1225
1226
  { suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
1226
1227
  );
1227
1228
  }
1228
1229
  const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _35 => _35.limit]), () => ( defs.limitDefault));
1229
1230
  if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
1230
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1231
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1231
1232
  `probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
1232
1233
  );
1233
1234
  }
1234
1235
  const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _36 => _36.maxWireCalls]), () => ( defs.defaultCap));
1235
1236
  if (!Number.isInteger(cap) || cap < 1) {
1236
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
1237
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
1237
1238
  }
1238
1239
  if (cap > defs.hardCap) {
1239
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1240
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1240
1241
  `probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
1241
1242
  { suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
1242
1243
  );
1243
1244
  }
1244
- const inv = _chunk45PLS73Kcjs.BLIND_SURFACE_INVENTORY;
1245
+ const inv = _chunk5QS3VT34cjs.BLIND_SURFACE_INVENTORY;
1245
1246
  if (inv === null) {
1246
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
1247
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
1247
1248
  }
1248
1249
  let targets;
1249
1250
  if (_optionalChain([opts, 'optionalAccess', _37 => _37.resources]) === void 0) {
1250
1251
  targets = [...defs.defaultTargets];
1251
1252
  } else {
1252
1253
  if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
1253
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
1254
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
1254
1255
  }
1255
1256
  const seen = /* @__PURE__ */ new Set();
1256
1257
  for (const r of opts.resources) {
1257
1258
  if (typeof r !== "string" || r.trim() === "") {
1258
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
1259
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
1259
1260
  }
1260
1261
  const key = r.trim();
1261
1262
  if (!inv.surfaces.some((row) => row.resource === key)) {
1262
1263
  const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
1263
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(
1264
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(
1264
1265
  `probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
1265
1266
  {
1266
1267
  code: "RESOURCE_UNKNOWN",
@@ -1274,7 +1275,7 @@ async function probeReachability(client, opts) {
1274
1275
  targets = [...seen];
1275
1276
  }
1276
1277
  if (targets.length > cap) {
1277
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1278
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1278
1279
  `probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
1279
1280
  { suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
1280
1281
  );
@@ -1284,7 +1285,7 @@ async function probeReachability(client, opts) {
1284
1285
  for (const resource of targets.sort()) {
1285
1286
  const row = byResource.get(resource);
1286
1287
  if (row === void 0) continue;
1287
- const holder = client[_chunk45PLS73Kcjs.camelKey.call(void 0, resource)];
1288
+ const holder = client[_chunk5QS3VT34cjs.camelKey.call(void 0, resource)];
1288
1289
  const probeFn = _optionalChain([holder, 'optionalAccess', _38 => _38.queryBounded]);
1289
1290
  if (typeof probeFn !== "function") {
1290
1291
  results.push({
@@ -1303,7 +1304,7 @@ async function probeReachability(client, opts) {
1303
1304
  probe: { ok: true, wire: 1, error: null }
1304
1305
  });
1305
1306
  } catch (err) {
1306
- const code = _chunk45PLS73Kcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
1307
+ const code = _chunk5QS3VT34cjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
1307
1308
  const message = err instanceof Error ? err.message : String(err);
1308
1309
  results.push({
1309
1310
  ...row,
@@ -1331,30 +1332,30 @@ var CREATE_BLOCKER_KINDS = [
1331
1332
  async function createGuidance(client, opts) {
1332
1333
  void client;
1333
1334
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1334
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1335
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1335
1336
  "createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
1336
1337
  );
1337
1338
  }
1338
- let servedRows = _chunk45PLS73Kcjs.CREATE_GUIDANCE.rows.map((row) => ({
1339
+ let servedRows = _chunk5QS3VT34cjs.CREATE_GUIDANCE.rows.map((row) => ({
1339
1340
  ...row,
1340
1341
  // Issue #219 N4: one precedence rule, stated on every row (live-proven >
1341
1342
  // zone > spec). The spec set is not available here (it is a LIVE read) —
1342
1343
  // the helper is handed the plan's two shapes and names the source.
1343
- requiredFields: _chunk45PLS73Kcjs.effectiveRequiredFields.call(void 0, void 0, _nullishCoalesce(_optionalChain([_chunk45PLS73Kcjs.RELATIONSHIP_MAP, 'access', _40 => _40[row.resource], 'optionalAccess', _41 => _41.zoneFacts]), () => ( null)))
1344
+ requiredFields: _chunk5QS3VT34cjs.effectiveRequiredFields.call(void 0, void 0, _nullishCoalesce(_optionalChain([_chunk5QS3VT34cjs.RELATIONSHIP_MAP, 'access', _40 => _40[row.resource], 'optionalAccess', _41 => _41.zoneFacts]), () => ( null)))
1344
1345
  }));
1345
1346
  if (_optionalChain([opts, 'optionalAccess', _42 => _42.resources]) !== void 0) {
1346
1347
  if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
1347
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
1348
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
1348
1349
  }
1349
1350
  const wanted = /* @__PURE__ */ new Set();
1350
1351
  for (const r of opts.resources) {
1351
1352
  if (typeof r !== "string" || r.trim() === "") {
1352
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
1353
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
1353
1354
  }
1354
1355
  const key = r.trim();
1355
- if (!_chunk45PLS73Kcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
1356
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(
1357
- `createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunk45PLS73Kcjs.CREATE_GUIDANCE.rows.length} create entities`,
1356
+ if (!_chunk5QS3VT34cjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
1357
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(
1358
+ `createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunk5QS3VT34cjs.CREATE_GUIDANCE.rows.length} create entities`,
1358
1359
  {
1359
1360
  code: "RESOURCE_UNKNOWN",
1360
1361
  category: "validation",
@@ -1368,18 +1369,18 @@ async function createGuidance(client, opts) {
1368
1369
  }
1369
1370
  if (_optionalChain([opts, 'optionalAccess', _43 => _43.kind]) !== void 0) {
1370
1371
  if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
1371
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1372
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1372
1373
  `createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
1373
1374
  );
1374
1375
  }
1375
1376
  servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _44 => _44.blocker, 'optionalAccess', _45 => _45.kind]) === opts.kind);
1376
1377
  }
1377
1378
  return {
1378
- zone: _chunk45PLS73Kcjs.CREATE_GUIDANCE.zone,
1379
- label: _chunk45PLS73Kcjs.CREATE_GUIDANCE.label,
1380
- verifiedAt: _chunk45PLS73Kcjs.CREATE_GUIDANCE.verifiedAt,
1379
+ zone: _chunk5QS3VT34cjs.CREATE_GUIDANCE.zone,
1380
+ label: _chunk5QS3VT34cjs.CREATE_GUIDANCE.label,
1381
+ verifiedAt: _chunk5QS3VT34cjs.CREATE_GUIDANCE.verifiedAt,
1381
1382
  rows: servedRows,
1382
- counts: _chunk45PLS73Kcjs.CREATE_GUIDANCE.counts
1383
+ counts: _chunk5QS3VT34cjs.CREATE_GUIDANCE.counts
1383
1384
  };
1384
1385
  }
1385
1386
 
@@ -1388,7 +1389,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
1388
1389
  var RECOVERY_DEFAULT_LIMIT = 25;
1389
1390
  var RECOVERY_MAX_LIMIT = 100;
1390
1391
  function configError(message, operation, suggestedAction) {
1391
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(message, { operation, suggestedAction });
1392
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(message, { operation, suggestedAction });
1392
1393
  }
1393
1394
  function parseMatchId(record) {
1394
1395
  const raw = record.id;
@@ -1404,7 +1405,7 @@ function parseMatchId(record) {
1404
1405
  return { id: null, unsafe: true };
1405
1406
  }
1406
1407
  function validateRecoveryInput(input, operation) {
1407
- if (!_chunk45PLS73Kcjs.isRecord.call(void 0, input)) {
1408
+ if (!_chunk5QS3VT34cjs.isRecord.call(void 0, input)) {
1408
1409
  configError(
1409
1410
  `recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
1410
1411
  operation,
@@ -1438,10 +1439,10 @@ function validateRecoveryInput(input, operation) {
1438
1439
  return { resource, marker, action };
1439
1440
  }
1440
1441
  function resolveRecoveryTarget(client, resource, operation) {
1441
- const entry = _chunk45PLS73Kcjs.RELATIONSHIP_MAP[resource];
1442
+ const entry = _chunk5QS3VT34cjs.RELATIONSHIP_MAP[resource];
1442
1443
  if (entry === void 0) {
1443
- throw new (0, _chunk45PLS73Kcjs.AutotaskError)(
1444
- `recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunk45PLS73Kcjs.RELATIONSHIP_MAP).length} resources`,
1444
+ throw new (0, _chunk5QS3VT34cjs.AutotaskError)(
1445
+ `recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunk5QS3VT34cjs.RELATIONSHIP_MAP).length} resources`,
1445
1446
  {
1446
1447
  code: "RESOURCE_UNKNOWN",
1447
1448
  category: "validation",
@@ -1450,7 +1451,7 @@ function resolveRecoveryTarget(client, resource, operation) {
1450
1451
  }
1451
1452
  );
1452
1453
  }
1453
- const holder = client[_chunk45PLS73Kcjs.camelKey.call(void 0, resource)];
1454
+ const holder = client[_chunk5QS3VT34cjs.camelKey.call(void 0, resource)];
1454
1455
  if (!holder || typeof holder.queryBounded !== "function") {
1455
1456
  configError(
1456
1457
  `recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
@@ -1461,7 +1462,7 @@ function resolveRecoveryTarget(client, resource, operation) {
1461
1462
  return { entry, holder };
1462
1463
  }
1463
1464
  function resolveMarkerField(input, resource, operation) {
1464
- const field = input.field !== void 0 ? String(input.field) : _chunk45PLS73Kcjs.MARKER_FIELDS[resource];
1465
+ const field = input.field !== void 0 ? String(input.field) : _chunk5QS3VT34cjs.MARKER_FIELDS[resource];
1465
1466
  if (typeof field !== "string" || field.trim() === "") {
1466
1467
  configError(
1467
1468
  `recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
@@ -1500,7 +1501,7 @@ function resolveExtraFilter(input, operation) {
1500
1501
  );
1501
1502
  }
1502
1503
  for (const c of input.filter) {
1503
- if (!_chunk45PLS73Kcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
1504
+ if (!_chunk5QS3VT34cjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
1504
1505
  configError(
1505
1506
  "recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
1506
1507
  operation,
@@ -1525,7 +1526,7 @@ function resolveLimit(input, operation) {
1525
1526
  async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
1526
1527
  const deleteMethod = holder.delete;
1527
1528
  if (deleteMethod === void 0) {
1528
- throw new (0, _chunk45PLS73Kcjs.DeleteBoundaryError)(
1529
+ throw new (0, _chunk5QS3VT34cjs.DeleteBoundaryError)(
1529
1530
  `recovery: ${resource} has no delete method on the client \u2014 the boundary is marked available in the plan but the typed delete surface is missing`,
1530
1531
  {
1531
1532
  operation,
@@ -1554,14 +1555,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
1554
1555
  verify = "still-present";
1555
1556
  }
1556
1557
  } catch (err) {
1557
- if (err instanceof _chunk45PLS73Kcjs.NotFoundError) verify = "not-found";
1558
+ if (err instanceof _chunk5QS3VT34cjs.NotFoundError) verify = "not-found";
1558
1559
  else {
1559
1560
  verify = "error";
1560
- code = _chunk45PLS73Kcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
1561
+ code = _chunk5QS3VT34cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
1561
1562
  }
1562
1563
  }
1563
1564
  } catch (err) {
1564
- code = _chunk45PLS73Kcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
1565
+ code = _chunk5QS3VT34cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
1565
1566
  }
1566
1567
  deleted.push({ id, verified: verify === "not-found", code });
1567
1568
  }
@@ -1589,7 +1590,7 @@ async function recovery(client, input, opts = {}) {
1589
1590
  const parentId = resolveParentId(input, entry, resource, operation);
1590
1591
  const extra = resolveExtraFilter(input, operation);
1591
1592
  const limit = resolveLimit(input, operation);
1592
- const boundaryNote = _chunk45PLS73Kcjs.DELETE_BOUNDARY_NOTES[resource];
1593
+ const boundaryNote = _chunk5QS3VT34cjs.DELETE_BOUNDARY_NOTES[resource];
1593
1594
  const boundary = {
1594
1595
  available: boundaryNote === void 0,
1595
1596
  reason: _nullishCoalesce(boundaryNote, () => ( null)),
@@ -1601,7 +1602,7 @@ async function recovery(client, input, opts = {}) {
1601
1602
  };
1602
1603
  const isDelete = action === "delete";
1603
1604
  if (isDelete && boundaryNote !== void 0) {
1604
- throw new (0, _chunk45PLS73Kcjs.DeleteBoundaryError)(
1605
+ throw new (0, _chunk5QS3VT34cjs.DeleteBoundaryError)(
1605
1606
  `recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
1606
1607
  {
1607
1608
  operation,
@@ -1613,7 +1614,7 @@ async function recovery(client, input, opts = {}) {
1613
1614
  const dryRun = _optionalChain([opts, 'optionalAccess', _46 => _46.dryRun]) !== false;
1614
1615
  const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _47 => _47.confirm]), () => ( input.confirm));
1615
1616
  if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
1616
- throw new (0, _chunk45PLS73Kcjs.ConfirmationRequiredError)(
1617
+ throw new (0, _chunk5QS3VT34cjs.ConfirmationRequiredError)(
1617
1618
  `recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
1618
1619
  {
1619
1620
  operation: RECOVERY_CONFIRM,
@@ -1629,7 +1630,7 @@ async function recovery(client, input, opts = {}) {
1629
1630
  const query = await holder.queryBounded({ filter: conditions, limit });
1630
1631
  if (query.hasMore) {
1631
1632
  const wire = isDelete ? "DELETE wire" : "mutating wire";
1632
- throw new (0, _chunk45PLS73Kcjs.RecoveryTruncatedError)(
1633
+ throw new (0, _chunk5QS3VT34cjs.RecoveryTruncatedError)(
1633
1634
  `recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
1634
1635
  {
1635
1636
  operation,
@@ -1658,7 +1659,7 @@ async function recovery(client, input, opts = {}) {
1658
1659
  return { ...base, simulated: true, dryRun: true };
1659
1660
  }
1660
1661
  if (unsafeId) {
1661
- throw new (0, _chunk45PLS73Kcjs.MarkerUnsafeIdError)(
1662
+ throw new (0, _chunk5QS3VT34cjs.MarkerUnsafeIdError)(
1662
1663
  `recovery: ${unsafeIds.length} of ${matches.length} match(es) on ${resource} have ids beyond Number.MAX_SAFE_INTEGER \u2014 they CANNOT be addressed through the SDK's typed delete surface (zero DELETE wire was issued)`,
1663
1664
  {
1664
1665
  operation,
@@ -1676,7 +1677,7 @@ function needsConfirmation(record) {
1676
1677
  return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
1677
1678
  }
1678
1679
  function refuse(message, operation, suggestedAction) {
1679
- throw new (0, _chunk45PLS73Kcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
1680
+ throw new (0, _chunk5QS3VT34cjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
1680
1681
  }
1681
1682
  var MODE_BY_EFFECT = {
1682
1683
  read: "read",
@@ -1722,7 +1723,7 @@ function looseTypeOk(type, value) {
1722
1723
  case "string[]":
1723
1724
  return Array.isArray(value) && value.every((v) => typeof v === "string");
1724
1725
  case "object":
1725
- return _chunk45PLS73Kcjs.isRecord.call(void 0, value);
1726
+ return _chunk5QS3VT34cjs.isRecord.call(void 0, value);
1726
1727
  default:
1727
1728
  return true;
1728
1729
  }
@@ -1736,12 +1737,12 @@ function declaredArgList(record) {
1736
1737
  function resolveDispatchArgs(record, argsIn) {
1737
1738
  const operation = record.id;
1738
1739
  const bad = (message) => {
1739
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
1740
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
1740
1741
  };
1741
1742
  if (argsIn === void 0 || argsIn === null) return [];
1742
1743
  if (Array.isArray(argsIn)) return argsIn;
1743
1744
  const byName = argsIn;
1744
- if (!_chunk45PLS73Kcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
1745
+ if (!_chunk5QS3VT34cjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
1745
1746
  return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
1746
1747
  }
1747
1748
  const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
@@ -1762,7 +1763,7 @@ function validateDispatchArgs(record, argsIn) {
1762
1763
  const bagName = names.find((n) => schema[n].properties);
1763
1764
  const surplus = args[names.length];
1764
1765
  const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
1765
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1766
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1766
1767
  `invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
1767
1768
  {
1768
1769
  operation,
@@ -1772,7 +1773,7 @@ function validateDispatchArgs(record, argsIn) {
1772
1773
  }
1773
1774
  const required = names.filter((n) => schema[n].required);
1774
1775
  if (args.length < required.length) {
1775
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1776
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1776
1777
  `invoke: "${operation}" requires ${required.length} positional arg(s) (${required.map((n) => `${n}: ${schema[n].type}`).join(", ")}) but only ${args.length} were passed \u2014 declared args: ${declaredArgList(record)}`,
1777
1778
  { operation }
1778
1779
  );
@@ -1783,7 +1784,7 @@ function validateDispatchArgs(record, argsIn) {
1783
1784
  const name = names[i];
1784
1785
  const spec = schema[name];
1785
1786
  if (!looseTypeOk(spec.type, value)) {
1786
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1787
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1787
1788
  `invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
1788
1789
  { operation }
1789
1790
  );
@@ -1791,8 +1792,8 @@ function validateDispatchArgs(record, argsIn) {
1791
1792
  }
1792
1793
  }
1793
1794
  function foldFlattenedOpts(record, toolArgs) {
1794
- if (!_chunk45PLS73Kcjs.isRecord.call(void 0, toolArgs)) {
1795
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
1795
+ if (!_chunk5QS3VT34cjs.isRecord.call(void 0, toolArgs)) {
1796
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
1796
1797
  }
1797
1798
  const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _48 => _48.inputSchema, 'optionalAccess', _49 => _49.opts, 'optionalAccess', _50 => _50.properties]), () => ( []))).map((p) => p.name);
1798
1799
  const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
@@ -1801,7 +1802,7 @@ function foldFlattenedOpts(record, toolArgs) {
1801
1802
  if (folded.opts === null) delete folded.opts;
1802
1803
  if (flat.length === 0) return folded;
1803
1804
  if (folded.opts !== void 0) {
1804
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1805
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1805
1806
  `invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
1806
1807
  { operation: record.id }
1807
1808
  );
@@ -1863,11 +1864,11 @@ function validateParamsBag(record, args) {
1863
1864
  const valid = PARAMS_BAG_KEYS[record.operation];
1864
1865
  if (valid === void 0) return;
1865
1866
  const bag = _optionalChain([args, 'optionalAccess', _51 => _51[0]]);
1866
- if (bag === void 0 || bag === null || !_chunk45PLS73Kcjs.isRecord.call(void 0, bag)) return;
1867
+ if (bag === void 0 || bag === null || !_chunk5QS3VT34cjs.isRecord.call(void 0, bag)) return;
1867
1868
  const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
1868
1869
  if (unknown.length === 0) return;
1869
1870
  const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1870
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1871
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1871
1872
  `invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
1872
1873
  {
1873
1874
  operation: record.id,
@@ -1879,16 +1880,16 @@ function validateGetBag(record, args) {
1879
1880
  if (record.kind !== "primitive" || record.operation !== "get") return;
1880
1881
  const at = Object.keys(_nullishCoalesce(record.inputSchema, () => ( {}))).indexOf("opts");
1881
1882
  const bag = at < 0 ? void 0 : _optionalChain([args, 'optionalAccess', _52 => _52[at]]);
1882
- if (bag === void 0 || bag === null || !_chunk45PLS73Kcjs.isRecord.call(void 0, bag)) return;
1883
+ if (bag === void 0 || bag === null || !_chunk5QS3VT34cjs.isRecord.call(void 0, bag)) return;
1883
1884
  const unknown = Object.keys(bag).filter((k) => k !== "fresh");
1884
1885
  if (unknown.length > 0) {
1885
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1886
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1886
1887
  `invoke: "${record.id}" opts bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: fresh)`,
1887
1888
  { operation: record.id, suggestedAction: "Pass only { fresh?: boolean }." }
1888
1889
  );
1889
1890
  }
1890
1891
  if (bag.fresh !== void 0 && typeof bag.fresh !== "boolean") {
1891
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1892
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1892
1893
  `invoke: fresh must be a boolean (got ${typeof bag.fresh}) \u2014 "${record.id}" was not issued`,
1893
1894
  { operation: record.id, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
1894
1895
  );
@@ -1900,7 +1901,7 @@ function validateInvokeOptions(opts, operation) {
1900
1901
  const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
1901
1902
  if (unknown.length === 0) return;
1902
1903
  const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1903
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1904
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1904
1905
  `invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries, fresh; "mode" is internal to the mode wrappers)`,
1905
1906
  {
1906
1907
  operation,
@@ -1913,7 +1914,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
1913
1914
  const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
1914
1915
  if (unknown.length === 0) return null;
1915
1916
  const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1916
- return new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1917
+ return new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1917
1918
  `unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
1918
1919
  {
1919
1920
  ...operation !== void 0 ? { operation } : {},
@@ -1923,7 +1924,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
1923
1924
  }
1924
1925
 
1925
1926
  // src/operations/invoke/registry.ts
1926
- var RECORDS = _chunkRAZEXOLCcjs.CAPABILITIES;
1927
+ var RECORDS = _chunkVR6RYXTDcjs.CAPABILITIES;
1927
1928
  var byId2 = new Map(RECORDS.map((r) => [r.id, r]));
1928
1929
 
1929
1930
  // src/operations/invoke/dispatch.ts
@@ -1942,7 +1943,7 @@ function bufferResult(buf) {
1942
1943
  function resolveRecord(operation) {
1943
1944
  const record = byId2.get(operation);
1944
1945
  if (record === void 0) {
1945
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1946
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1946
1947
  `invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
1947
1948
  { operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
1948
1949
  );
@@ -1953,30 +1954,30 @@ function governPreRequest(record, operation, opts) {
1953
1954
  validateInvokeOptions(opts, operation);
1954
1955
  const mode = opts.mode;
1955
1956
  if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
1956
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
1957
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
1957
1958
  }
1958
1959
  if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
1959
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1960
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1960
1961
  `invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
1961
1962
  { operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
1962
1963
  );
1963
1964
  }
1964
1965
  if (opts.fresh !== void 0) {
1965
1966
  if (typeof opts.fresh !== "boolean") {
1966
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1967
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1967
1968
  `invoke: fresh must be a boolean (got ${typeof opts.fresh}) \u2014 "${operation}" was not issued`,
1968
1969
  { operation, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
1969
1970
  );
1970
1971
  }
1971
1972
  if (record.effect !== "read" || record.kind !== "primitive" || record.operation !== "get" || !("opts" in (_nullishCoalesce(record.inputSchema, () => ( {}))))) {
1972
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1973
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1973
1974
  `invoke: fresh applies only to a single-record "<resource>.get" read \u2014 "${operation}" was not issued`,
1974
1975
  { operation, suggestedAction: "Drop the fresh option (only <resource>.get consults the read cache per call)." }
1975
1976
  );
1976
1977
  }
1977
1978
  }
1978
1979
  if (record.effect === "read" && opts.dryRun === true) {
1979
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
1980
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
1980
1981
  `invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
1981
1982
  { operation }
1982
1983
  );
@@ -1993,7 +1994,7 @@ function operationsHolder(client) {
1993
1994
  return {
1994
1995
  resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
1995
1996
  searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
1996
- fetchMany: (items, opts) => _chunk45PLS73Kcjs.fetchMany.call(void 0, client, items, opts),
1997
+ fetchMany: (items, opts) => _chunk5QS3VT34cjs.fetchMany.call(void 0, client, items, opts),
1997
1998
  // Issue #62: the generic aggregate + the cheap count — the
1998
1999
  // groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
1999
2000
  // sentinel rides through); the group/sum modes walk the named
@@ -2005,12 +2006,12 @@ function operationsHolder(client) {
2005
2006
  // Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
2006
2007
  // reads + the per-id `get` fallback (blind-surface-safe; per-item
2007
2008
  // typed outcomes reuse the fetchMany shapes).
2008
- fetchByIds: (items, opts) => _chunk45PLS73Kcjs.fetchByIds.call(void 0, client, items, opts),
2009
+ fetchByIds: (items, opts) => _chunk5QS3VT34cjs.fetchByIds.call(void 0, client, items, opts),
2009
2010
  // Issue #65: opt-in resource name expansion — per-id resources.get
2010
2011
  // reads ONLY (never an id-in query — the resources table can be blind
2011
2012
  // to count/query while per-id reads work); blind-marked rows for ids
2012
2013
  // the API user cannot resolve; the name cache (default-on).
2013
- expandResourceNames: (ids, opts) => _chunk45PLS73Kcjs.expandResourceNames.call(void 0, client, ids, opts),
2014
+ expandResourceNames: (ids, opts) => _chunk5QS3VT34cjs.expandResourceNames.call(void 0, client, ids, opts),
2014
2015
  relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
2015
2016
  // Issue #11: the served blind-surface inventory (zero wire) + the
2016
2017
  // bounded caller-opted reachability sweep (read-only, confirmProbe-
@@ -2020,12 +2021,12 @@ function operationsHolder(client) {
2020
2021
  // Issue #12: the served zone-fact create-guidance catalog (zero wire).
2021
2022
  createGuidance: (opts) => createGuidance(client, opts),
2022
2023
  // Issue #202: ExecuteCommand deep links — pure, zero wire.
2023
- uiLink: (input) => _chunk45PLS73Kcjs.uiLink.call(void 0, client, input),
2024
+ uiLink: (input) => _chunk5QS3VT34cjs.uiLink.call(void 0, client, input),
2024
2025
  // Issue #31: the opt-in live field-metadata channel — N bounded
2025
2026
  // entityInformation GETs (the op's own cap refuses over-cap fan-outs
2026
2027
  // pre-request; per-resource failures are recorded on the row and
2027
2028
  // never abort the call).
2028
- fieldCatalog: (opts) => _chunk45PLS73Kcjs.fieldCatalog.call(void 0, client, opts),
2029
+ fieldCatalog: (opts) => _chunk5QS3VT34cjs.fieldCatalog.call(void 0, client, opts),
2029
2030
  // Issue #9: the one-call recovery/cleanup op — effect write in the
2030
2031
  // registry (the governor's dry-run-first applies to it); the op's own
2031
2032
  // confirm gate makes the destructive action deliberate (the governor
@@ -2035,15 +2036,15 @@ function operationsHolder(client) {
2035
2036
  }
2036
2037
  function resolveHolder(client, record, operation) {
2037
2038
  const clientBag = client;
2038
- let holder = clientBag[_chunk45PLS73Kcjs.camelKey.call(void 0, record.resource)];
2039
+ let holder = clientBag[_chunk5QS3VT34cjs.camelKey.call(void 0, record.resource)];
2039
2040
  if (typeof holder === "function") {
2040
- holder = _nullishCoalesce(clientBag[`${_chunk45PLS73Kcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
2041
+ holder = _nullishCoalesce(clientBag[`${_chunk5QS3VT34cjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
2041
2042
  }
2042
2043
  if (holder === void 0 && record.resource === "operations") {
2043
2044
  holder = operationsHolder(client);
2044
2045
  }
2045
2046
  if (holder === void 0) {
2046
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
2047
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
2047
2048
  `invoke: the client exposes no accessor for resource "${record.resource}"`,
2048
2049
  { operation }
2049
2050
  );
@@ -2103,12 +2104,12 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
2103
2104
  const boundedQuery = record.kind === "primitive" && record.operation === "query";
2104
2105
  const countedQuery = record.kind === "primitive" && record.operation === "count";
2105
2106
  const holder = resolveHolder(client, record, operation);
2106
- if (boundedQuery || countedQuery) await _chunk45PLS73Kcjs.validateQueryFieldNames.call(void 0, record, holder, args);
2107
- const labelQuery = boundedQuery && _chunk45PLS73Kcjs.readNamesOpt.call(void 0, _optionalChain([args, 'access', _53 => _53[0], 'optionalAccess', _54 => _54["names"]]), `invoke: "${record.id}" params bag`);
2107
+ if (boundedQuery || countedQuery) await _chunk5QS3VT34cjs.validateQueryFieldNames.call(void 0, record, holder, args);
2108
+ const labelQuery = boundedQuery && _chunk5QS3VT34cjs.readNamesOpt.call(void 0, _optionalChain([args, 'access', _53 => _53[0], 'optionalAccess', _54 => _54["names"]]), `invoke: "${record.id}" params bag`);
2108
2109
  const methodName = boundedQuery ? "queryBounded" : record.operation;
2109
2110
  const method = holder[methodName];
2110
2111
  if (typeof method !== "function") {
2111
- throw new (0, _chunk45PLS73Kcjs.AutotaskConfigError)(
2112
+ throw new (0, _chunk5QS3VT34cjs.AutotaskConfigError)(
2112
2113
  `invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
2113
2114
  { operation }
2114
2115
  );
@@ -2120,7 +2121,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
2120
2121
  const result = await method.apply(holder, callArgs);
2121
2122
  if (labelQuery && Array.isArray(_optionalChain([result, 'optionalAccess', _55 => _55.items]))) {
2122
2123
  const bounded = result;
2123
- const labelled = await _chunk45PLS73Kcjs.labelRows.call(void 0, client, record.resource, bounded.items);
2124
+ const labelled = await _chunk5QS3VT34cjs.labelRows.call(void 0, client, record.resource, bounded.items);
2124
2125
  return { ...bounded, items: labelled.rows, ...labelled.names !== void 0 ? { names: labelled.names } : {} };
2125
2126
  }
2126
2127
  return Buffer.isBuffer(result) ? bufferResult(result) : result;
@@ -2193,4 +2194,5 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
2193
2194
 
2194
2195
 
2195
2196
 
2196
- exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.ENTITY_TYPE_TO_RESOURCE = _chunk45PLS73Kcjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunk45PLS73Kcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunk45PLS73Kcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunk45PLS73Kcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunk45PLS73Kcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunk45PLS73Kcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunk45PLS73Kcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunk45PLS73Kcjs.MAX_FIELD_CATALOG_WIRE; exports.MIN_FIELD_CATALOG_MAX_BYTES = _chunk45PLS73Kcjs.MIN_FIELD_CATALOG_MAX_BYTES; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunk45PLS73Kcjs.PICKLIST_VALUE_NOT_SERVED_NOTE; exports.RECOVERY_CONFIRM = RECOVERY_CONFIRM; exports.RECOVERY_DEFAULT_LIMIT = RECOVERY_DEFAULT_LIMIT; exports.RECOVERY_MAX_LIMIT = RECOVERY_MAX_LIMIT; exports.UI_LINK_ENTITIES = _chunk45PLS73Kcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunk45PLS73Kcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunk45PLS73Kcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = _chunk45PLS73Kcjs.effectiveRequiredFields; exports.expandResourceNames = _chunk45PLS73Kcjs.expandResourceNames; exports.fetchByIds = _chunk45PLS73Kcjs.fetchByIds; exports.fetchMany = _chunk45PLS73Kcjs.fetchMany; exports.fieldCatalog = _chunk45PLS73Kcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunk45PLS73Kcjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunk45PLS73Kcjs.resourceForEntityType; exports.revenueRollup = revenueRollup; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunk45PLS73Kcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunk45PLS73Kcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
2197
+
2198
+ exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.ENTITY_TYPE_TO_RESOURCE = _chunk5QS3VT34cjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunk5QS3VT34cjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunk5QS3VT34cjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunk5QS3VT34cjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunk5QS3VT34cjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunk5QS3VT34cjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunk5QS3VT34cjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunk5QS3VT34cjs.MAX_FIELD_CATALOG_WIRE; exports.MIN_FIELD_CATALOG_MAX_BYTES = _chunk5QS3VT34cjs.MIN_FIELD_CATALOG_MAX_BYTES; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_CATALOG_UNAVAILABLE_NOTE = _chunk5QS3VT34cjs.PICKLIST_CATALOG_UNAVAILABLE_NOTE; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunk5QS3VT34cjs.PICKLIST_VALUE_NOT_SERVED_NOTE; exports.RECOVERY_CONFIRM = RECOVERY_CONFIRM; exports.RECOVERY_DEFAULT_LIMIT = RECOVERY_DEFAULT_LIMIT; exports.RECOVERY_MAX_LIMIT = RECOVERY_MAX_LIMIT; exports.UI_LINK_ENTITIES = _chunk5QS3VT34cjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunk5QS3VT34cjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunk5QS3VT34cjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = _chunk5QS3VT34cjs.effectiveRequiredFields; exports.expandResourceNames = _chunk5QS3VT34cjs.expandResourceNames; exports.fetchByIds = _chunk5QS3VT34cjs.fetchByIds; exports.fetchMany = _chunk5QS3VT34cjs.fetchMany; exports.fieldCatalog = _chunk5QS3VT34cjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunk5QS3VT34cjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunk5QS3VT34cjs.resourceForEntityType; exports.revenueRollup = revenueRollup; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunk5QS3VT34cjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunk5QS3VT34cjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;