node-autotask 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/MCP_TOOL_CATALOG.json +27 -8
  3. package/MCP_TOOL_MANIFEST.md +12 -11
  4. package/N8N_MCP_MANIFEST.json +34 -5
  5. package/N8N_MCP_MANIFEST.md +8 -7
  6. package/README.md +1 -2
  7. package/capabilities.json +1471 -1307
  8. package/dist/capabilities.cjs +2 -2
  9. package/dist/capabilities.js +1 -1
  10. package/dist/{chunk-GUY2KK7U.cjs → chunk-APXBBN3D.cjs} +143 -143
  11. package/dist/{chunk-WYKGD5UD.cjs → chunk-BNIOQEKP.cjs} +536 -491
  12. package/dist/{chunk-D5IVS6GY.cjs → chunk-IKWHRUQ5.cjs} +97 -6
  13. package/dist/{chunk-IRVZGW5K.js → chunk-KVT5V7SA.js} +93 -2
  14. package/dist/{chunk-ZEGMVEF3.cjs → chunk-PY45RBQ2.cjs} +1470 -1306
  15. package/dist/{chunk-SYX6EWMT.js → chunk-T4SZGOJB.js} +98 -53
  16. package/dist/{chunk-6EQSXYRW.js → chunk-WKP442HS.js} +1470 -1306
  17. package/dist/{chunk-O2D7KDDD.js → chunk-X4TUU2Y6.js} +2 -2
  18. package/dist/{index-DXuV04zM.d.ts → index-6_i-__sN.d.ts} +25 -2
  19. package/dist/{index-DQ9NgraW.d.cts → index-BGZ1Mhbh.d.cts} +105 -82
  20. package/dist/{index-DQ9NgraW.d.ts → index-BGZ1Mhbh.d.ts} +105 -82
  21. package/dist/{index-CORcZUNm.d.cts → index-BZkfUU59.d.cts} +25 -2
  22. package/dist/index.cjs +22 -22
  23. package/dist/index.d.cts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +4 -4
  26. package/dist/operations/index.cjs +112 -112
  27. package/dist/operations/index.d.cts +4 -4
  28. package/dist/operations/index.d.ts +4 -4
  29. package/dist/operations/index.js +2 -2
  30. package/dist/pool.cjs +9 -9
  31. package/dist/pool.d.cts +2 -2
  32. package/dist/pool.d.ts +2 -2
  33. package/dist/pool.js +4 -4
  34. package/dist/resources/index.cjs +4 -4
  35. package/dist/resources/index.d.cts +2 -2
  36. package/dist/resources/index.d.ts +2 -2
  37. package/dist/resources/index.js +3 -3
  38. package/dist/types/index.d.cts +1 -1
  39. package/dist/types/index.d.ts +1 -1
  40. package/docs/API.md +1 -2
  41. package/package.json +1 -1
@@ -38,13 +38,15 @@
38
38
 
39
39
 
40
40
 
41
- var _chunkD5IVS6GYcjs = require('./chunk-D5IVS6GY.cjs');
42
41
 
43
42
 
44
- var _chunkZEGMVEF3cjs = require('./chunk-ZEGMVEF3.cjs');
43
+ var _chunkIKWHRUQ5cjs = require('./chunk-IKWHRUQ5.cjs');
44
+
45
+
46
+ var _chunkPY45RBQ2cjs = require('./chunk-PY45RBQ2.cjs');
45
47
 
46
48
  // src/resources/appointments.ts
47
- var AppointmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
49
+ var AppointmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
48
50
  constructor(http, pageSize) {
49
51
  super(http, {
50
52
  key: "appointments",
@@ -129,7 +131,7 @@ var AuthenticateResource = class {
129
131
  };
130
132
 
131
133
  // src/resources/billing_codes.ts
132
- var BillingCodesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
134
+ var BillingCodesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
133
135
  constructor(http, pageSize) {
134
136
  super(http, {
135
137
  key: "billing_codes",
@@ -173,7 +175,7 @@ var BillingCodesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
173
175
  };
174
176
 
175
177
  // src/resources/billing_item_approval_levels.ts
176
- var BillingItemApprovalLevelsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
178
+ var BillingItemApprovalLevelsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
177
179
  constructor(http, pageSize) {
178
180
  super(http, {
179
181
  key: "billing_item_approval_levels",
@@ -215,7 +217,7 @@ var MAX_LIMIT = 500;
215
217
  function clampWindowLimit(limit) {
216
218
  const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
217
219
  if (!Number.isInteger(n) || n < 1) {
218
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
220
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
219
221
  }
220
222
  return Math.min(n, MAX_LIMIT);
221
223
  }
@@ -261,7 +263,7 @@ function wallParts(tz, ms) {
261
263
  }
262
264
  }
263
265
  if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
264
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
266
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
265
267
  }
266
268
  return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
267
269
  }
@@ -288,7 +290,7 @@ function localDayEndMs(y, m, d, tz) {
288
290
  }
289
291
  function validateZone(tz, opName = "dateWindow") {
290
292
  if (typeof tz !== "string" || tz.length === 0) {
291
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
293
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
292
294
  `${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
293
295
  { operation: opName }
294
296
  );
@@ -296,7 +298,7 @@ function validateZone(tz, opName = "dateWindow") {
296
298
  try {
297
299
  new Intl.DateTimeFormat("en-US", { timeZone: tz });
298
300
  } catch (e2) {
299
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
301
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
300
302
  `${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
301
303
  { operation: opName }
302
304
  );
@@ -456,13 +458,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
456
458
  body: { MaxRecords: limit, filter },
457
459
  operation
458
460
  });
459
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
461
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
460
462
  }
461
463
  var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
462
464
  function customRangeDay(value, label, zone, opName) {
463
465
  const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
464
466
  if (!m) {
465
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
467
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
466
468
  zone === void 0 ? `${opName}: ${label} must be a UTC 'YYYY-MM-DD' date (got ${JSON.stringify(value)})` : `${opName}: ${label} must be a 'YYYY-MM-DD' local calendar day in ${zone} (got ${JSON.stringify(value)})`,
467
469
  { operation: opName }
468
470
  );
@@ -474,7 +476,7 @@ function customRangeDay(value, label, zone, opName) {
474
476
  const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
475
477
  const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
476
478
  if (!Number.isFinite(ms)) {
477
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
479
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
478
480
  zone === void 0 ? `${opName}: ${label} is not a valid UTC date (${JSON.stringify(value)})` : `${opName}: ${label} is not a valid calendar day in ${zone} (${JSON.stringify(value)})`,
479
481
  { operation: opName }
480
482
  );
@@ -485,7 +487,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
485
487
  const fromB = customRangeDay(from, "from", zone, operation);
486
488
  const toB = customRangeDay(to, "to", zone, operation);
487
489
  if (fromB.ms > toB.ms) {
488
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
490
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
489
491
  `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
490
492
  { operation }
491
493
  );
@@ -502,7 +504,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
502
504
  body: { MaxRecords: limit, filter },
503
505
  operation
504
506
  });
505
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
507
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
506
508
  }
507
509
 
508
510
  // src/resources/special/billing_items.ts
@@ -535,7 +537,7 @@ async function customRange(_resource, from, to, http, opts) {
535
537
  }
536
538
 
537
539
  // src/resources/billing_items.ts
538
- var BillingItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
540
+ var BillingItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
539
541
  constructor(http, pageSize) {
540
542
  super(http, {
541
543
  key: "billing_items",
@@ -637,7 +639,7 @@ var BillingItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
637
639
  };
638
640
 
639
641
  // src/resources/change_request_links.ts
640
- var ChangeRequestLinksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
642
+ var ChangeRequestLinksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
641
643
  constructor(http, pageSize) {
642
644
  super(http, {
643
645
  key: "change_request_links",
@@ -691,7 +693,7 @@ var ChangeRequestLinksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
691
693
  };
692
694
 
693
695
  // src/resources/checklist_libraries.ts
694
- var ChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
696
+ var ChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
695
697
  constructor(http, pageSize) {
696
698
  super(http, {
697
699
  key: "checklist_libraries",
@@ -765,7 +767,7 @@ var ChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
765
767
  };
766
768
 
767
769
  // src/resources/checklist_library_checklist_items.ts
768
- var ChecklistLibraryChecklistItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
770
+ var ChecklistLibraryChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
769
771
  constructor(http, pageSize) {
770
772
  super(http, {
771
773
  key: "checklist_library_checklist_items",
@@ -831,7 +833,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkD5IVS6GYcjs.Bas
831
833
  };
832
834
 
833
835
  // src/resources/classification_icons.ts
834
- var ClassificationIconsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
836
+ var ClassificationIconsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
835
837
  constructor(http, pageSize) {
836
838
  super(http, {
837
839
  key: "classification_icons",
@@ -938,7 +940,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
938
940
  body,
939
941
  operation
940
942
  });
941
- const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
943
+ const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
942
944
  const capped = items.length >= limit;
943
945
  return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
944
946
  }
@@ -948,7 +950,7 @@ var DEFAULT_LIMIT2 = 25;
948
950
  var MAX_LIMIT2 = 500;
949
951
  function clampLimit(limit) {
950
952
  const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
951
- if (!Number.isInteger(n) || n < 1) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
953
+ if (!Number.isInteger(n) || n < 1) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
952
954
  return Math.min(n, MAX_LIMIT2);
953
955
  }
954
956
 
@@ -961,7 +963,7 @@ async function queryCompanies(http, filter, limit) {
961
963
  body: { MaxRecords: limit, filter },
962
964
  operation: "companies.searchByDomain"
963
965
  });
964
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
966
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
965
967
  }
966
968
  async function queryContacts(http, filter, limit) {
967
969
  const res = await http.request({
@@ -971,7 +973,7 @@ async function queryContacts(http, filter, limit) {
971
973
  body: { MaxRecords: limit, filter },
972
974
  operation: "companies.searchByDomain"
973
975
  });
974
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
976
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
975
977
  }
976
978
  async function fetchCompanies(http, ids2, limit) {
977
979
  const out = [];
@@ -986,7 +988,7 @@ async function fetchCompanies(http, ids2, limit) {
986
988
  const item = body && "item" in body ? body.item : null;
987
989
  if (item) out.push(item);
988
990
  } catch (err) {
989
- if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) continue;
991
+ if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) continue;
990
992
  throw err;
991
993
  }
992
994
  }
@@ -994,7 +996,7 @@ async function fetchCompanies(http, ids2, limit) {
994
996
  }
995
997
  async function searchByDomain(_resource, domain, opts = {}, http) {
996
998
  const text = domain.trim();
997
- if (text === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("searchByDomain: empty domain");
999
+ if (text === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchByDomain: empty domain");
998
1000
  const limit = clampLimit(opts.limit);
999
1001
  const filter = [{ field: "webAddress", op: "contains", value: text }];
1000
1002
  const direct = await queryCompanies(http, filter, limit);
@@ -1008,7 +1010,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
1008
1010
  const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
1009
1011
  const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
1010
1012
  if (name === "" && email === "" && website === "") {
1011
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1013
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1012
1014
  }
1013
1015
  const limit = clampLimit(opts.limit);
1014
1016
  const found = /* @__PURE__ */ new Map();
@@ -1037,23 +1039,23 @@ async function familyChildPage(http, parentID) {
1037
1039
  path: "/V1.0/Companies/query",
1038
1040
  body: {
1039
1041
  MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
1040
- filter: _chunkD5IVS6GYcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1042
+ filter: _chunkIKWHRUQ5cjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1041
1043
  },
1042
1044
  operation: "companies.search"
1043
1045
  });
1044
- const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "companies.search");
1046
+ const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "companies.search");
1045
1047
  return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
1046
1048
  }
1047
1049
  function assertSearchWithDetailOpts(opts) {
1048
1050
  if (opts === void 0) return;
1049
1051
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
1050
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1052
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1051
1053
  operation: "companies.searchWithDetail"
1052
1054
  });
1053
1055
  }
1054
1056
  for (const key of Object.keys(opts)) {
1055
1057
  if (key !== "limit") {
1056
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1058
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1057
1059
  `companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
1058
1060
  { operation: "companies.searchWithDetail" }
1059
1061
  );
@@ -1062,32 +1064,32 @@ function assertSearchWithDetailOpts(opts) {
1062
1064
  }
1063
1065
  async function searchWithFamily(_resource, query, opts = {}, http) {
1064
1066
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1065
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1067
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1066
1068
  }
1067
1069
  for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
1068
1070
  if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
1069
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1071
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1070
1072
  `companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
1071
1073
  { operation: "companies.search" }
1072
1074
  );
1073
1075
  }
1074
1076
  }
1075
1077
  if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
1076
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1078
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1077
1079
  operation: "companies.search"
1078
1080
  });
1079
1081
  }
1080
1082
  const text = query.trim();
1081
- if (text === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1082
- const limit = opts.limit === void 0 ? 25 : _chunkD5IVS6GYcjs.clampPageSize.call(void 0, opts.limit);
1083
+ if (text === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1084
+ const limit = opts.limit === void 0 ? 25 : _chunkIKWHRUQ5cjs.clampPageSize.call(void 0, opts.limit);
1083
1085
  const res = await http.request({
1084
1086
  method: "POST",
1085
1087
  idempotent: true,
1086
1088
  path: "/V1.0/Companies/query",
1087
- body: { MaxRecords: limit, filter: _chunkD5IVS6GYcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1089
+ body: { MaxRecords: limit, filter: _chunkIKWHRUQ5cjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1088
1090
  operation: "companies.search"
1089
1091
  });
1090
- const hits = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "companies.search").items;
1092
+ const hits = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "companies.search").items;
1091
1093
  if (opts.includeFamily !== true) return hits;
1092
1094
  const rows = [];
1093
1095
  for (const hit of hits) {
@@ -1107,7 +1109,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
1107
1109
  }
1108
1110
 
1109
1111
  // src/resources/special/companies/errors.ts
1110
- var OwnerResourceRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1112
+ var OwnerResourceRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1111
1113
  constructor(message, options = {}) {
1112
1114
  super(message, {
1113
1115
  code: "OWNER_RESOURCE_REQUIRED",
@@ -1118,13 +1120,13 @@ var OwnerResourceRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1118
1120
  this.name = "OwnerResourceRequiredError";
1119
1121
  }
1120
1122
  };
1121
- var CompanyResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1123
+ var CompanyResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1122
1124
  constructor(message, options = {}) {
1123
1125
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
1124
1126
  this.name = "CompanyResourceInvalidError";
1125
1127
  }
1126
1128
  };
1127
- var CompanyCreateFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1129
+ var CompanyCreateFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1128
1130
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
1129
1131
 
1130
1132
  constructor(message, vendorFields, options = {}) {
@@ -1143,23 +1145,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
1143
1145
  var SAFE_COMPANY_CREATE_DEFAULTS = {};
1144
1146
  function validateUpsertInput(companyName, params) {
1145
1147
  if (typeof companyName !== "string" || companyName.trim() === "") {
1146
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1148
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1147
1149
  }
1148
1150
  if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
1149
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByName: params.phone is required (a non-empty string \u2014 the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })", { operation: OP_UPSERT_NAME });
1151
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByName: params.phone is required (a non-empty string \u2014 the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })", { operation: OP_UPSERT_NAME });
1150
1152
  }
1151
1153
  const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
1152
1154
  if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
1153
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 \u2014 the ww29-proven value)`, { operation: OP_UPSERT_NAME });
1155
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 \u2014 the ww29-proven value)`, { operation: OP_UPSERT_NAME });
1154
1156
  }
1155
1157
  const owner = params.ownerResourceID;
1156
1158
  if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
1157
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1159
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1158
1160
  }
1159
1161
  return { companyType, owner };
1160
1162
  }
1161
1163
  function existsDryRun(http, companyName, match) {
1162
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
1164
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
1163
1165
  {
1164
1166
  operation: OP_UPSERT_NAME,
1165
1167
  method: "POST",
@@ -1185,7 +1187,7 @@ function createDryRun(http, body, owner) {
1185
1187
  "ownerResourceID is REQUIRED on the apply path (the vendor requires it; the node cannot enumerate candidates \u2014 the resources table is blind to this API user (count/query return 0)): the apply throws the typed OWNER_RESOURCE_REQUIRED if it is still absent"
1186
1188
  );
1187
1189
  }
1188
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
1190
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
1189
1191
  {
1190
1192
  operation: OP_UPSERT_NAME,
1191
1193
  method: "POST",
@@ -1230,8 +1232,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1230
1232
  sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
1231
1233
  };
1232
1234
  } catch (err) {
1233
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1234
- const named = (_nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1235
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1236
+ const named = (_nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1235
1237
  const seen = /* @__PURE__ */ new Set();
1236
1238
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
1237
1239
  const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
@@ -1245,7 +1247,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1245
1247
  }
1246
1248
  continue;
1247
1249
  }
1248
- const detail = _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError);
1250
+ const detail = _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError);
1249
1251
  throw new CompanyCreateFailedError(
1250
1252
  `upsertByName: the vendor rejected the company create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the ww29 required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
1251
1253
  unique,
@@ -1319,7 +1321,7 @@ async function readFields(http, fresh) {
1319
1321
  const res = await http.request({ method: "GET", path: "/V1.0/Tickets/entityInformation/fields", operation: OP, maxRetries: 0 });
1320
1322
  const fields = _optionalChain([res, 'optionalAccess', _21 => _21.fields]);
1321
1323
  if (!Array.isArray(fields)) {
1322
- throw new (0, _chunkD5IVS6GYcjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1324
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1323
1325
  }
1324
1326
  _optionalChain([cache, 'optionalAccess', _22 => _22.set, 'call', _23 => _23(key, "fields", fields)]);
1325
1327
  return fields;
@@ -1338,7 +1340,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1338
1340
  if (opts.excludeStatusIds !== void 0) {
1339
1341
  const closedIds2 = [...new Set(opts.excludeStatusIds.map((id) => Number(id)))];
1340
1342
  if (closedIds2.length === 0 || closedIds2.some((id) => !Number.isSafeInteger(id) || id < 1)) {
1341
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
1343
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
1342
1344
  }
1343
1345
  return { picklist: [], closedIds: closedIds2, source: "picklist", note: `closed = status ${closedIds2.join(", ")} \u2014 supplied by the caller` };
1344
1346
  }
@@ -1346,7 +1348,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1346
1348
  try {
1347
1349
  fields = await readFields(http, opts.fresh === true);
1348
1350
  } catch (e) {
1349
- if (e instanceof _chunkD5IVS6GYcjs.AutotaskError && e.code === "ABORTED") throw e;
1351
+ if (e instanceof _chunkIKWHRUQ5cjs.AutotaskError && e.code === "ABORTED") throw e;
1350
1352
  return assumed();
1351
1353
  }
1352
1354
  const picklist = picklistOf(fields);
@@ -1382,30 +1384,30 @@ var LOCATION_LIMIT_MAX = 500;
1382
1384
  function locationLimit(value) {
1383
1385
  if (value === void 0) return PROFILE_PART_LIMIT;
1384
1386
  if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
1385
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1387
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1386
1388
  }
1387
1389
  return value;
1388
1390
  }
1389
1391
  function validateProjection(fields) {
1390
1392
  if (fields === void 0) return {};
1391
1393
  if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
1392
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1394
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1393
1395
  }
1394
1396
  const out = {};
1395
1397
  for (const [part, list] of Object.entries(fields)) {
1396
1398
  if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
1397
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1399
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1398
1400
  }
1399
1401
  if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
1400
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1402
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1401
1403
  }
1402
1404
  const names = [...new Set(list)];
1403
1405
  const entity = PART_ENTITY[part];
1404
- const known = _nullishCoalesce(_chunkD5IVS6GYcjs.MODEL_FIELD_SETS[entity], () => ( []));
1406
+ const known = _nullishCoalesce(_chunkIKWHRUQ5cjs.MODEL_FIELD_SETS[entity], () => ( []));
1405
1407
  const unknown = names.filter((n) => !known.includes(n));
1406
1408
  if (unknown.length > 0) {
1407
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1408
- `fullProfile: fields.${part} has unknown field name(s) ${_chunkD5IVS6GYcjs.formatUnknownNameList.call(void 0, unknown)} against the vendored spec for ${entity} (${known.length} fields; operations.fieldCatalog resources: ["${entity}"] lists the live set) \u2014 no request was issued`
1409
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1410
+ `fullProfile: fields.${part} has unknown field name(s) ${_chunkIKWHRUQ5cjs.formatUnknownNameList.call(void 0, unknown)} against the vendored spec for ${entity} (${known.length} fields; operations.fieldCatalog resources: ["${entity}"] lists the live set) \u2014 no request was issued`
1409
1411
  );
1410
1412
  }
1411
1413
  out[part] = names;
@@ -1422,7 +1424,7 @@ function project(items, names) {
1422
1424
  function profilePartLimit(value, name) {
1423
1425
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
1424
1426
  if (!Number.isInteger(n) || n < 1) {
1425
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1427
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1426
1428
  }
1427
1429
  return n;
1428
1430
  }
@@ -1434,7 +1436,7 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
1434
1436
  body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
1435
1437
  operation: "companies.fullProfile"
1436
1438
  });
1437
- return project(_chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items, includeFields);
1439
+ return project(_chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items, includeFields);
1438
1440
  }
1439
1441
  async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1440
1442
  const semantics = await resolveTicketStatusSemantics(http);
@@ -1451,7 +1453,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1451
1453
  },
1452
1454
  operation: "companies.fullProfile"
1453
1455
  });
1454
- return project(_chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items, includeFields);
1456
+ return project(_chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items, includeFields);
1455
1457
  })();
1456
1458
  const closedStatus = { closedIds: semantics.closedIds, source: semantics.source, note: semantics.note };
1457
1459
  const partNote = semantics.source === "assumed" ? OPEN_TICKETS_NOTE : semantics.note;
@@ -1463,7 +1465,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1463
1465
  closedStatus
1464
1466
  };
1465
1467
  if (openRows.length === 0) {
1466
- const stamp = _chunkD5IVS6GYcjs.blindStampFor.call(void 0, _optionalChain([_chunkD5IVS6GYcjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
1468
+ const stamp = _chunkIKWHRUQ5cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKWHRUQ5cjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
1467
1469
  if (stamp !== void 0) {
1468
1470
  openTickets = {
1469
1471
  items: openRows,
@@ -1478,7 +1480,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1478
1480
  return openTickets;
1479
1481
  }
1480
1482
  async function addProfileNames(http, company, openTickets, projects, result, opts) {
1481
- const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS);
1483
+ const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS);
1482
1484
  const c = company;
1483
1485
  builder.addResource(c["ownerResourceID"]);
1484
1486
  builder.addResource(c["createdByResourceID"]);
@@ -1495,20 +1497,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1495
1497
  builder.addResource(r["creatorResourceID"]);
1496
1498
  builder.addFk("contract", r["contractID"]);
1497
1499
  }
1498
- const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1500
+ const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1499
1501
  const companyRow = { ...company };
1500
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1501
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1502
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1503
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1502
1504
  result.company = companyRow;
1503
1505
  result.openTickets = {
1504
1506
  ...openTickets,
1505
1507
  items: openTickets.items.map((row) => {
1506
1508
  const r = { ...row };
1507
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1508
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1509
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1510
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1511
- for (const f of _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS) _chunkD5IVS6GYcjs.addLabelSibling.call(void 0, r, f, names);
1509
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1510
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1511
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1512
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1513
+ for (const f of _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS) _chunkIKWHRUQ5cjs.addLabelSibling.call(void 0, r, f, names);
1512
1514
  return r;
1513
1515
  })
1514
1516
  };
@@ -1516,9 +1518,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1516
1518
  ...result.projects,
1517
1519
  items: result.projects.items.map((row) => {
1518
1520
  const r = { ...row };
1519
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1520
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1521
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1521
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1522
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1523
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1522
1524
  return r;
1523
1525
  })
1524
1526
  };
@@ -1531,7 +1533,7 @@ async function fullProfile(resource, id, opts = {}, http) {
1531
1533
  const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
1532
1534
  const locLimit = locationLimit(opts.locationLimit);
1533
1535
  const proj = validateProjection(opts.fields);
1534
- const companyID = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
1536
+ const companyID = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
1535
1537
  const company = await resource.get(companyID);
1536
1538
  const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
1537
1539
  const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
@@ -1578,7 +1580,7 @@ var UNBILLED_WORK_OPT_KEYS = [
1578
1580
  var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
1579
1581
  function validateUnbilledWorkOptions(companyId, opts) {
1580
1582
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1581
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1583
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1582
1584
  `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
1583
1585
  { operation: "companies.unbilledWork" }
1584
1586
  );
@@ -1607,7 +1609,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1607
1609
  try {
1608
1610
  limit = clampLimit(opts.limit);
1609
1611
  } catch (err) {
1610
- problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1612
+ problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1611
1613
  limit = 50;
1612
1614
  }
1613
1615
  if (source === "date_range") {
@@ -1622,9 +1624,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
1622
1624
  problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
1623
1625
  } else {
1624
1626
  try {
1625
- _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1627
+ _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1626
1628
  } catch (err) {
1627
- problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1629
+ problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1628
1630
  }
1629
1631
  }
1630
1632
  }
@@ -1634,20 +1636,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
1634
1636
  } else {
1635
1637
  opts.ticketIds.forEach((tid, i) => {
1636
1638
  try {
1637
- _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1639
+ _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1638
1640
  } catch (err) {
1639
- problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1641
+ problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1640
1642
  }
1641
1643
  });
1642
1644
  }
1643
1645
  }
1644
1646
  try {
1645
- _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyId, "companyId");
1647
+ _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyId, "companyId");
1646
1648
  } catch (err) {
1647
- problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1649
+ problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1648
1650
  }
1649
1651
  if (problems.length > 0) {
1650
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1652
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1651
1653
  `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
1652
1654
  - ` + problems.join("\n- "),
1653
1655
  { operation: "companies.unbilledWork" }
@@ -1676,7 +1678,7 @@ function capJoinSet(ids2, cap) {
1676
1678
  }
1677
1679
  function unbilledWorkPartStatus(key, conditions, items) {
1678
1680
  if (items.length !== 0) return { status: "ok" };
1679
- const stamp = _chunkD5IVS6GYcjs.blindStampFor.call(void 0, _optionalChain([_chunkD5IVS6GYcjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1681
+ const stamp = _chunkIKWHRUQ5cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKWHRUQ5cjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1680
1682
  if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
1681
1683
  return {
1682
1684
  status: "ok",
@@ -1696,7 +1698,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
1696
1698
  parentStatus = "ok";
1697
1699
  companyIds.push(num(parent.id));
1698
1700
  } catch (err) {
1699
- if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) parent = null;
1701
+ if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) parent = null;
1700
1702
  else throw err;
1701
1703
  }
1702
1704
  }
@@ -1734,14 +1736,14 @@ async function readBillingPart(http, v, companyIds) {
1734
1736
  if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
1735
1737
  if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
1736
1738
  }
1737
- const billingFields = _chunkD5IVS6GYcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1739
+ const billingFields = _chunkIKWHRUQ5cjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1738
1740
  const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
1739
1741
  const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP2, billingIncludeFields);
1740
1742
  let billingItems = billingRaw.items;
1741
1743
  let billingNoteCharsTruncated = 0;
1742
1744
  if (v.includeNotes) {
1743
- const noteFields = (_nullishCoalesce(_chunkD5IVS6GYcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1744
- [billingItems, billingNoteCharsTruncated] = _chunkD5IVS6GYcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1745
+ const noteFields = (_nullishCoalesce(_chunkIKWHRUQ5cjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1746
+ [billingItems, billingNoteCharsTruncated] = _chunkIKWHRUQ5cjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1745
1747
  }
1746
1748
  const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
1747
1749
  const billingItemsPart = {
@@ -1785,7 +1787,7 @@ async function readTimePart(http, v, join) {
1785
1787
  let cappedItems = entries;
1786
1788
  let noteCharsTruncated = 0;
1787
1789
  if (v.includeNotes) {
1788
- [cappedItems, noteCharsTruncated] = _chunkD5IVS6GYcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1790
+ [cappedItems, noteCharsTruncated] = _chunkIKWHRUQ5cjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1789
1791
  }
1790
1792
  const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
1791
1793
  timePart = {
@@ -1873,7 +1875,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
1873
1875
  }
1874
1876
  async function unbilledWork(resource, companyId, opts = {}, http) {
1875
1877
  const v = validateUnbilledWorkOptions(companyId, opts);
1876
- const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyId, "companyId");
1878
+ const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyId, "companyId");
1877
1879
  const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
1878
1880
  const join = await readJoinSets(http, companyIds, v);
1879
1881
  const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
@@ -1900,7 +1902,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
1900
1902
  }
1901
1903
 
1902
1904
  // src/resources/companies.ts
1903
- var CompaniesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
1905
+ var CompaniesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
1904
1906
  constructor(http, pageSize) {
1905
1907
  super(http, {
1906
1908
  key: "companies",
@@ -2007,7 +2009,7 @@ var CompaniesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2007
2009
  };
2008
2010
 
2009
2011
  // src/resources/company_alerts.ts
2010
- var CompanyAlertsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2012
+ var CompanyAlertsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2011
2013
  constructor(http, pageSize) {
2012
2014
  super(http, {
2013
2015
  key: "company_alerts",
@@ -2073,7 +2075,7 @@ var CompanyAlertsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2073
2075
  };
2074
2076
 
2075
2077
  // src/resources/company_locations.ts
2076
- var CompanyLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2078
+ var CompanyLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2077
2079
  constructor(http, pageSize) {
2078
2080
  super(http, {
2079
2081
  key: "company_locations",
@@ -2144,7 +2146,7 @@ var CompanyLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2144
2146
  };
2145
2147
 
2146
2148
  // src/resources/company_notes.ts
2147
- var CompanyNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2149
+ var CompanyNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2148
2150
  constructor(http, pageSize) {
2149
2151
  super(http, {
2150
2152
  key: "company_notes",
@@ -2209,7 +2211,7 @@ var CompanyNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2209
2211
  };
2210
2212
 
2211
2213
  // src/resources/company_site_configurations.ts
2212
- var CompanySiteConfigurationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2214
+ var CompanySiteConfigurationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2213
2215
  constructor(http, pageSize) {
2214
2216
  super(http, {
2215
2217
  key: "company_site_configurations",
@@ -2260,7 +2262,7 @@ var CompanySiteConfigurationsResource = class extends _chunkD5IVS6GYcjs.BaseReso
2260
2262
  };
2261
2263
 
2262
2264
  // src/resources/company_webhooks.ts
2263
- var CompanyWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2265
+ var CompanyWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2264
2266
  constructor(http, pageSize) {
2265
2267
  super(http, {
2266
2268
  key: "company_webhooks",
@@ -2336,7 +2338,7 @@ var CompanyWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2336
2338
  };
2337
2339
 
2338
2340
  // src/resources/configuration_item_billing_product_associations.ts
2339
- var ConfigurationItemBillingProductAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2341
+ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2340
2342
  constructor(http, pageSize) {
2341
2343
  super(http, {
2342
2344
  key: "configuration_item_billing_product_associations",
@@ -2402,7 +2404,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkD5
2402
2404
  };
2403
2405
 
2404
2406
  // src/resources/configuration_item_categories.ts
2405
- var ConfigurationItemCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2407
+ var ConfigurationItemCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2406
2408
  constructor(http, pageSize) {
2407
2409
  super(http, {
2408
2410
  key: "configuration_item_categories",
@@ -2469,7 +2471,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseRe
2469
2471
  };
2470
2472
 
2471
2473
  // src/resources/configuration_item_category_udf_associations.ts
2472
- var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2474
+ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2473
2475
  constructor(http, pageSize) {
2474
2476
  super(http, {
2475
2477
  key: "configuration_item_category_udf_associations",
@@ -2535,7 +2537,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkD5IVS
2535
2537
  };
2536
2538
 
2537
2539
  // src/resources/configuration_item_dns_records.ts
2538
- var ConfigurationItemDnsRecordsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2540
+ var ConfigurationItemDnsRecordsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2539
2541
  constructor(http, pageSize) {
2540
2542
  super(http, {
2541
2543
  key: "configuration_item_dns_records",
@@ -2584,7 +2586,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkD5IVS6GYcjs.BaseRe
2584
2586
  };
2585
2587
 
2586
2588
  // src/resources/configuration_item_notes.ts
2587
- var ConfigurationItemNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2589
+ var ConfigurationItemNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2588
2590
  constructor(http, pageSize) {
2589
2591
  super(http, {
2590
2592
  key: "configuration_item_notes",
@@ -2643,7 +2645,7 @@ var ConfigurationItemNotesResource = class extends _chunkD5IVS6GYcjs.BaseResourc
2643
2645
  };
2644
2646
 
2645
2647
  // src/resources/configuration_item_related_items.ts
2646
- var ConfigurationItemRelatedItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2648
+ var ConfigurationItemRelatedItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2647
2649
  constructor(http, pageSize) {
2648
2650
  super(http, {
2649
2651
  key: "configuration_item_related_items",
@@ -2704,16 +2706,16 @@ async function fetchRecord(http, path, label, readOpts) {
2704
2706
  const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _32 => _32.maxRetries]) });
2705
2707
  const body = res;
2706
2708
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
2707
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2709
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2708
2710
  }
2709
2711
  return body.item;
2710
2712
  }
2711
2713
  async function moveConfigurationItem(_resource, sourceId, opts, http) {
2712
- const numericSource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2714
+ const numericSource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2713
2715
  if (_optionalChain([opts, 'optionalAccess', _33 => _33.destinationCompanyId]) === void 0) {
2714
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2716
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2715
2717
  }
2716
- const destId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2718
+ const destId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2717
2719
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
2718
2720
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
2719
2721
  const body = { ...source };
@@ -2723,20 +2725,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2723
2725
  body.companyID = destId;
2724
2726
  body.isActive = true;
2725
2727
  if (opts.newReferenceTitle !== void 0) {
2726
- if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2728
+ if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2727
2729
  body.referenceTitle = opts.newReferenceTitle.trim();
2728
2730
  }
2729
2731
  if (opts.lastModifiedDate !== void 0) {
2730
2732
  const current = source.lastModifiedDate;
2731
2733
  if (current !== opts.lastModifiedDate) {
2732
- throw new (0, _chunkD5IVS6GYcjs.StaleObjectError)(
2734
+ throw new (0, _chunkIKWHRUQ5cjs.StaleObjectError)(
2733
2735
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
2734
2736
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
2735
2737
  );
2736
2738
  }
2737
2739
  }
2738
2740
  if (opts.dryRun === true) {
2739
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
2741
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
2740
2742
  operation: "configuration_items.moveConfigurationItem",
2741
2743
  method: "POST",
2742
2744
  path: "/V1.0/ConfigurationItems",
@@ -2761,7 +2763,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2761
2763
  const createdBody = created;
2762
2764
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
2763
2765
  if (typeof newId !== "number") {
2764
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2766
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2765
2767
  }
2766
2768
  let sourceDeactivated = false;
2767
2769
  if (opts.deactivateSource !== false) {
@@ -2780,7 +2782,7 @@ var PROFILE_PART_LIMIT2 = 50;
2780
2782
  function profilePartLimit2(value, name) {
2781
2783
  const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
2782
2784
  if (!Number.isInteger(n) || n < 1) {
2783
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2785
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2784
2786
  }
2785
2787
  return n;
2786
2788
  }
@@ -2796,14 +2798,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
2796
2798
  });
2797
2799
  const body = res;
2798
2800
  if (body === null || !("item" in body)) {
2799
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2801
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2800
2802
  }
2801
2803
  if (body.item === null || body.item === void 0) {
2802
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2804
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2803
2805
  }
2804
2806
  return body.item;
2805
2807
  } catch (err) {
2806
- if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) return null;
2808
+ if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) return null;
2807
2809
  throw err;
2808
2810
  }
2809
2811
  }
@@ -2815,7 +2817,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
2815
2817
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
2816
2818
  operation: "configuration_items.profile"
2817
2819
  });
2818
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
2820
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
2819
2821
  }
2820
2822
  async function profile(resource, id, opts = {}, http) {
2821
2823
  const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
@@ -2827,7 +2829,7 @@ async function profile(resource, id, opts = {}, http) {
2827
2829
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
2828
2830
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
2829
2831
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
2830
- const wallQuirk = _optionalChain([_chunkD5IVS6GYcjs.RELATIONSHIP_MAP, 'access', _34 => _34["configuration_items"], 'optionalAccess', _35 => _35.zoneFacts, 'optionalAccess', _36 => _36.quirks, 'optionalAccess', _37 => _37.find, 'call', _38 => _38((q) => q.startsWith("product wall"))]);
2832
+ const wallQuirk = _optionalChain([_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP, 'access', _34 => _34["configuration_items"], 'optionalAccess', _35 => _35.zoneFacts, 'optionalAccess', _36 => _36.quirks, 'optionalAccess', _37 => _37.find, 'call', _38 => _38((q) => q.startsWith("product wall"))]);
2831
2833
  const productAssociations = {
2832
2834
  items: associations,
2833
2835
  capped: associations.length >= PROFILE_PART_LIMIT2,
@@ -2851,11 +2853,11 @@ async function profile(resource, id, opts = {}, http) {
2851
2853
  }
2852
2854
  };
2853
2855
  if (opts.names === true) {
2854
- const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, );
2856
+ const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, );
2855
2857
  builder.addFk("contract", root["contractID"]);
2856
- const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2858
+ const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2857
2859
  const ciRow = { ...ci };
2858
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2860
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2859
2861
  result.ci = ciRow;
2860
2862
  result.names = names.section;
2861
2863
  }
@@ -2863,7 +2865,7 @@ async function profile(resource, id, opts = {}, http) {
2863
2865
  }
2864
2866
 
2865
2867
  // src/resources/configuration_items.ts
2866
- var ConfigurationItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2868
+ var ConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2867
2869
  constructor(http, pageSize) {
2868
2870
  super(http, {
2869
2871
  key: "configuration_items",
@@ -2952,7 +2954,7 @@ var ConfigurationItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2952
2954
  };
2953
2955
 
2954
2956
  // src/resources/configuration_item_ssl_subject_alternative_names.ts
2955
- var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2957
+ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2956
2958
  constructor(http, pageSize) {
2957
2959
  super(http, {
2958
2960
  key: "configuration_item_ssl_subject_alternative_names",
@@ -3015,7 +3017,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkD5
3015
3017
  };
3016
3018
 
3017
3019
  // src/resources/configuration_item_types.ts
3018
- var ConfigurationItemTypesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3020
+ var ConfigurationItemTypesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3019
3021
  constructor(http, pageSize) {
3020
3022
  super(http, {
3021
3023
  key: "configuration_item_types",
@@ -3089,7 +3091,7 @@ var ConfigurationItemTypesResource = class extends _chunkD5IVS6GYcjs.BaseResourc
3089
3091
  };
3090
3092
 
3091
3093
  // src/resources/configuration_item_webhooks.ts
3092
- var ConfigurationItemWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3094
+ var ConfigurationItemWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3093
3095
  constructor(http, pageSize) {
3094
3096
  super(http, {
3095
3097
  key: "configuration_item_webhooks",
@@ -3165,7 +3167,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseReso
3165
3167
  };
3166
3168
 
3167
3169
  // src/resources/contact_group_contacts.ts
3168
- var ContactGroupContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3170
+ var ContactGroupContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3169
3171
  constructor(http, pageSize) {
3170
3172
  super(http, {
3171
3173
  key: "contact_group_contacts",
@@ -3219,7 +3221,7 @@ var ContactGroupContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource
3219
3221
  };
3220
3222
 
3221
3223
  // src/resources/contact_groups.ts
3222
- var ContactGroupsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3224
+ var ContactGroupsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3223
3225
  constructor(http, pageSize) {
3224
3226
  super(http, {
3225
3227
  key: "contact_groups",
@@ -3297,22 +3299,22 @@ async function fetchRecord2(http, path, label, readOpts) {
3297
3299
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _44 => _44.maxRetries]) });
3298
3300
  const body = res;
3299
3301
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
3300
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3302
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3301
3303
  }
3302
3304
  return body.item;
3303
3305
  }
3304
3306
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
3305
- const sourceId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3306
- const destId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3307
+ const sourceId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3308
+ const destId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3307
3309
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
3308
3310
  const companyID = source.companyID;
3309
3311
  if (typeof companyID !== "number" || companyID < 0) {
3310
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3312
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3311
3313
  }
3312
3314
  if (opts.lastModifiedDate !== void 0) {
3313
3315
  const current = source.lastModifiedDate;
3314
3316
  if (current !== opts.lastModifiedDate) {
3315
- throw new (0, _chunkD5IVS6GYcjs.StaleObjectError)(
3317
+ throw new (0, _chunkIKWHRUQ5cjs.StaleObjectError)(
3316
3318
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
3317
3319
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3318
3320
  );
@@ -3334,10 +3336,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3334
3336
  },
3335
3337
  operation: "contacts.moveToCompany"
3336
3338
  });
3337
- const items = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
3339
+ const items = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
3338
3340
  const clash = items.find((c) => String(c.id) !== String(sourceId));
3339
3341
  if (clash !== void 0) {
3340
- throw new (0, _chunkD5IVS6GYcjs.ConflictError)(
3342
+ throw new (0, _chunkIKWHRUQ5cjs.ConflictError)(
3341
3343
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
3342
3344
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3343
3345
  );
@@ -3351,7 +3353,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3351
3353
  if (opts.dryRun === true) {
3352
3354
  const warnings = [];
3353
3355
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
3354
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
3356
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
3355
3357
  operation: "contacts.moveToCompany",
3356
3358
  method: "POST",
3357
3359
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -3377,7 +3379,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3377
3379
  const createdBody = created;
3378
3380
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
3379
3381
  if (typeof newId !== "number") {
3380
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3382
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3381
3383
  }
3382
3384
  let sourceDeleted = false;
3383
3385
  if (opts.deleteSource === true) {
@@ -3396,7 +3398,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
3396
3398
  var EMAIL_SHAPE = /^.+@.+/;
3397
3399
  var SAFE_CONTACT_CREATE_DEFAULTS = {};
3398
3400
  var DEDUP_LIMIT = 10;
3399
- var CompanyNotFoundError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3401
+ var CompanyNotFoundError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3400
3402
  constructor(message, options = {}) {
3401
3403
  super(message, {
3402
3404
  code: "COMPANY_NOT_FOUND",
@@ -3407,7 +3409,7 @@ var CompanyNotFoundError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3407
3409
  this.name = "CompanyNotFoundError";
3408
3410
  }
3409
3411
  };
3410
- var ContactCreateFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3412
+ var ContactCreateFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3411
3413
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
3412
3414
 
3413
3415
  constructor(message, vendorFields, options = {}) {
@@ -3417,25 +3419,25 @@ var ContactCreateFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3417
3419
  }
3418
3420
  };
3419
3421
  async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3420
- const cid = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyID, "companyID");
3422
+ const cid = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyID, "companyID");
3421
3423
  if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
3422
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
3424
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
3423
3425
  `upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
3424
3426
  { operation: OP_UPSERT_EMAIL }
3425
3427
  );
3426
3428
  }
3427
3429
  if (extra !== void 0) {
3428
3430
  if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
3429
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
3431
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
3430
3432
  `upsertByEmail: extra.isActive must be a boolean (mapped to the zone-correct number 1/0) or a raw 0/1 number (got ${String(extra.isActive)})`,
3431
3433
  { operation: OP_UPSERT_EMAIL }
3432
3434
  );
3433
3435
  }
3434
3436
  if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
3435
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByEmail: extra.firstName must be a non-empty string (or omitted \u2014 the node defaults it to the email local-part)", { operation: OP_UPSERT_EMAIL });
3437
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByEmail: extra.firstName must be a non-empty string (or omitted \u2014 the node defaults it to the email local-part)", { operation: OP_UPSERT_EMAIL });
3436
3438
  }
3437
3439
  if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
3438
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
3440
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
3439
3441
  }
3440
3442
  }
3441
3443
  const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
@@ -3456,7 +3458,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3456
3458
  const match = q.items[0];
3457
3459
  if (match !== void 0) {
3458
3460
  if (opts.dryRun === true) {
3459
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
3461
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
3460
3462
  {
3461
3463
  operation: OP_UPSERT_EMAIL,
3462
3464
  method: "POST",
@@ -3486,7 +3488,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3486
3488
  isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
3487
3489
  };
3488
3490
  if (opts.dryRun === true) {
3489
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
3491
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
3490
3492
  {
3491
3493
  operation: OP_UPSERT_EMAIL,
3492
3494
  method: "POST",
@@ -3509,8 +3511,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3509
3511
  const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
3510
3512
  return { id: created.id, created: true };
3511
3513
  } catch (err) {
3512
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3513
- const named = (_nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3514
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3515
+ const named = (_nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3514
3516
  const seen = /* @__PURE__ */ new Set();
3515
3517
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
3516
3518
  const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
@@ -3524,7 +3526,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3524
3526
  }
3525
3527
  continue;
3526
3528
  }
3527
- const detail = _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError);
3529
+ const detail = _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError);
3528
3530
  throw new ContactCreateFailedError(
3529
3531
  `upsertByEmail: the vendor rejected the contact create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
3530
3532
  unique,
@@ -3541,7 +3543,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3541
3543
  }
3542
3544
 
3543
3545
  // src/resources/contacts.ts
3544
- var ContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3546
+ var ContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3545
3547
  constructor(http, pageSize) {
3546
3548
  super(http, {
3547
3549
  key: "contacts",
@@ -3633,7 +3635,7 @@ var ContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3633
3635
  };
3634
3636
 
3635
3637
  // src/resources/contact_webhooks.ts
3636
- var ContactWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3638
+ var ContactWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3637
3639
  constructor(http, pageSize) {
3638
3640
  super(http, {
3639
3641
  key: "contact_webhooks",
@@ -3709,7 +3711,7 @@ var ContactWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3709
3711
  };
3710
3712
 
3711
3713
  // src/resources/contract_billing_rules.ts
3712
- var ContractBillingRulesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3714
+ var ContractBillingRulesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3713
3715
  constructor(http, pageSize) {
3714
3716
  super(http, {
3715
3717
  key: "contract_billing_rules",
@@ -3775,7 +3777,7 @@ var ContractBillingRulesResource = class extends _chunkD5IVS6GYcjs.BaseResource
3775
3777
  };
3776
3778
 
3777
3779
  // src/resources/contract_block_hour_factors.ts
3778
- var ContractBlockHourFactorsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3780
+ var ContractBlockHourFactorsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3779
3781
  constructor(http, pageSize) {
3780
3782
  super(http, {
3781
3783
  key: "contract_block_hour_factors",
@@ -3834,7 +3836,7 @@ var ContractBlockHourFactorsResource = class extends _chunkD5IVS6GYcjs.BaseResou
3834
3836
  };
3835
3837
 
3836
3838
  // src/resources/contract_blocks.ts
3837
- var ContractBlocksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3839
+ var ContractBlocksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3838
3840
  constructor(http, pageSize) {
3839
3841
  super(http, {
3840
3842
  key: "contract_blocks",
@@ -3893,7 +3895,7 @@ var ContractBlocksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3893
3895
  };
3894
3896
 
3895
3897
  // src/resources/contract_charges.ts
3896
- var ContractChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3898
+ var ContractChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3897
3899
  constructor(http, pageSize) {
3898
3900
  super(http, {
3899
3901
  key: "contract_charges",
@@ -3964,7 +3966,7 @@ var ContractChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3964
3966
  };
3965
3967
 
3966
3968
  // src/resources/contract_exclusion_billing_codes.ts
3967
- var ContractExclusionBillingCodesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3969
+ var ContractExclusionBillingCodesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3968
3970
  constructor(http, pageSize) {
3969
3971
  super(http, {
3970
3972
  key: "contract_exclusion_billing_codes",
@@ -4021,7 +4023,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkD5IVS6GYcjs.Base
4021
4023
  };
4022
4024
 
4023
4025
  // src/resources/contract_exclusion_roles.ts
4024
- var ContractExclusionRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4026
+ var ContractExclusionRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4025
4027
  constructor(http, pageSize) {
4026
4028
  super(http, {
4027
4029
  key: "contract_exclusion_roles",
@@ -4078,7 +4080,7 @@ var ContractExclusionRolesResource = class extends _chunkD5IVS6GYcjs.BaseResourc
4078
4080
  };
4079
4081
 
4080
4082
  // src/resources/contract_exclusion_set_excluded_roles.ts
4081
- var ContractExclusionSetExcludedRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4083
+ var ContractExclusionSetExcludedRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4082
4084
  constructor(http, pageSize) {
4083
4085
  super(http, {
4084
4086
  key: "contract_exclusion_set_excluded_roles",
@@ -4135,7 +4137,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkD5IVS6GYcjs.
4135
4137
  };
4136
4138
 
4137
4139
  // src/resources/contract_exclusion_set_excluded_work_types.ts
4138
- var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4140
+ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4139
4141
  constructor(http, pageSize) {
4140
4142
  super(http, {
4141
4143
  key: "contract_exclusion_set_excluded_work_types",
@@ -4192,7 +4194,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkD5IVS6GY
4192
4194
  };
4193
4195
 
4194
4196
  // src/resources/contract_exclusion_sets.ts
4195
- var ContractExclusionSetsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4197
+ var ContractExclusionSetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4196
4198
  constructor(http, pageSize) {
4197
4199
  super(http, {
4198
4200
  key: "contract_exclusion_sets",
@@ -4266,7 +4268,7 @@ var ContractExclusionSetsResource = class extends _chunkD5IVS6GYcjs.BaseResource
4266
4268
  };
4267
4269
 
4268
4270
  // src/resources/contract_milestones.ts
4269
- var ContractMilestonesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4271
+ var ContractMilestonesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4270
4272
  constructor(http, pageSize) {
4271
4273
  super(http, {
4272
4274
  key: "contract_milestones",
@@ -4325,7 +4327,7 @@ var ContractMilestonesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4325
4327
  };
4326
4328
 
4327
4329
  // src/resources/contract_notes.ts
4328
- var ContractNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4330
+ var ContractNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4329
4331
  constructor(http, pageSize) {
4330
4332
  super(http, {
4331
4333
  key: "contract_notes",
@@ -4384,7 +4386,7 @@ var ContractNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4384
4386
  };
4385
4387
 
4386
4388
  // src/resources/contract_rates.ts
4387
- var ContractRatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4389
+ var ContractRatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4388
4390
  constructor(http, pageSize) {
4389
4391
  super(http, {
4390
4392
  key: "contract_rates",
@@ -4443,7 +4445,7 @@ var ContractRatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4443
4445
  };
4444
4446
 
4445
4447
  // src/resources/contract_retainers.ts
4446
- var ContractRetainersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4448
+ var ContractRetainersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4447
4449
  constructor(http, pageSize) {
4448
4450
  super(http, {
4449
4451
  key: "contract_retainers",
@@ -4502,7 +4504,7 @@ var ContractRetainersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4502
4504
  };
4503
4505
 
4504
4506
  // src/resources/contract_role_costs.ts
4505
- var ContractRoleCostsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4507
+ var ContractRoleCostsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4506
4508
  constructor(http, pageSize) {
4507
4509
  super(http, {
4508
4510
  key: "contract_role_costs",
@@ -4561,7 +4563,7 @@ var ContractRoleCostsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4561
4563
  };
4562
4564
 
4563
4565
  // src/resources/contract_service_adjustments.ts
4564
- var ContractServiceAdjustmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4566
+ var ContractServiceAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4565
4567
  constructor(http, pageSize) {
4566
4568
  super(http, {
4567
4569
  key: "contract_service_adjustments",
@@ -4595,7 +4597,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkD5IVS6GYcjs.BaseRes
4595
4597
  };
4596
4598
 
4597
4599
  // src/resources/contract_service_bundle_adjustments.ts
4598
- var ContractServiceBundleAdjustmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4600
+ var ContractServiceBundleAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4599
4601
  constructor(http, pageSize) {
4600
4602
  super(http, {
4601
4603
  key: "contract_service_bundle_adjustments",
@@ -4629,7 +4631,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkD5IVS6GYcjs.B
4629
4631
  };
4630
4632
 
4631
4633
  // src/resources/contract_service_bundles.ts
4632
- var ContractServiceBundlesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4634
+ var ContractServiceBundlesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4633
4635
  constructor(http, pageSize) {
4634
4636
  super(http, {
4635
4637
  key: "contract_service_bundles",
@@ -4688,7 +4690,7 @@ var ContractServiceBundlesResource = class extends _chunkD5IVS6GYcjs.BaseResourc
4688
4690
  };
4689
4691
 
4690
4692
  // src/resources/contract_service_bundle_units.ts
4691
- var ContractServiceBundleUnitsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4693
+ var ContractServiceBundleUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4692
4694
  constructor(http, pageSize) {
4693
4695
  super(http, {
4694
4696
  key: "contract_service_bundle_units",
@@ -4730,7 +4732,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkD5IVS6GYcjs.BaseRes
4730
4732
  };
4731
4733
 
4732
4734
  // src/resources/contract_services.ts
4733
- var ContractServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4735
+ var ContractServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4734
4736
  constructor(http, pageSize) {
4735
4737
  super(http, {
4736
4738
  key: "contract_services",
@@ -4789,7 +4791,7 @@ var ContractServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4789
4791
  };
4790
4792
 
4791
4793
  // src/resources/contract_service_units.ts
4792
- var ContractServiceUnitsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4794
+ var ContractServiceUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4793
4795
  constructor(http, pageSize) {
4794
4796
  super(http, {
4795
4797
  key: "contract_service_units",
@@ -5057,7 +5059,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
5057
5059
  // src/resources/special/contracts/profitability.validate.ts
5058
5060
  function validateProfitabilityOptions(contractId, opts) {
5059
5061
  if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
5060
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
5062
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
5061
5063
  `profitability: opts is required \u2014 the options object with dateFrom and dateTo (YYYY-MM-DD) (got ${opts === void 0 ? "undefined" : Array.isArray(opts) ? "an array" : typeof opts})`,
5062
5064
  { operation: "contracts.profitability" }
5063
5065
  );
@@ -5134,12 +5136,12 @@ function validateProfitabilityOptions(contractId, opts) {
5134
5136
  }
5135
5137
  }
5136
5138
  try {
5137
- _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, contractId, "contractId");
5139
+ _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, contractId, "contractId");
5138
5140
  } catch (err) {
5139
- problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5141
+ problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5140
5142
  }
5141
5143
  if (problems.length > 0) {
5142
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
5144
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
5143
5145
  `profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
5144
5146
  - ` + problems.join("\n- "),
5145
5147
  { operation: "contracts.profitability" }
@@ -5188,23 +5190,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5188
5190
  const byKey = /* @__PURE__ */ new Map();
5189
5191
  const misses = [];
5190
5192
  const notes = [];
5191
- for (let c = 0; c < unique.length; c += _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5192
- const chunk = unique.slice(c, c + _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE);
5193
+ for (let c = 0; c < unique.length; c += _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE) {
5194
+ const chunk = unique.slice(c, c + _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE);
5193
5195
  const chunkKeys = new Set(chunk);
5194
5196
  try {
5195
5197
  const body = {
5196
- MaxRecords: _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE,
5198
+ MaxRecords: _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE,
5197
5199
  filter: [{ field: "id", op: "in", value: chunk }],
5198
5200
  IncludeFields: fields
5199
5201
  };
5200
5202
  const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
5201
- const { items: rows } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
5203
+ const { items: rows } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
5202
5204
  for (const row of rows) {
5203
5205
  const k = num(row.id);
5204
5206
  if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
5205
5207
  }
5206
5208
  } catch (err) {
5207
- const code = err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.code : "SERVER_ERROR";
5209
+ const code = err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.code : "SERVER_ERROR";
5208
5210
  for (const k of chunk) {
5209
5211
  if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
5210
5212
  }
@@ -5214,11 +5216,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5214
5216
  for (const k of queryMissed) {
5215
5217
  try {
5216
5218
  const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
5217
- byKey.set(k, _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, k, operation, entity));
5219
+ byKey.set(k, _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, k, operation, entity));
5218
5220
  } catch (err) {
5219
- if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) {
5221
+ if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) {
5220
5222
  misses.push({ id: k, code: "NOT_FOUND", message: err.message });
5221
- } else if (err instanceof _chunkD5IVS6GYcjs.AutotaskError) {
5223
+ } else if (err instanceof _chunkIKWHRUQ5cjs.AutotaskError) {
5222
5224
  misses.push({ id: k, code: err.code, message: err.message });
5223
5225
  } else {
5224
5226
  misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
@@ -5272,7 +5274,7 @@ async function degradable(read) {
5272
5274
  try {
5273
5275
  return await read();
5274
5276
  } catch (err) {
5275
- if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5277
+ if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5276
5278
  return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
5277
5279
  }
5278
5280
  }
@@ -5292,15 +5294,15 @@ var stampPart = (key, raw, conditions, extraNotes) => {
5292
5294
  status: st.status,
5293
5295
  blindSurface: st.blindSurface,
5294
5296
  note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
5295
- emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkD5IVS6GYcjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5297
+ emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkIKWHRUQ5cjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5296
5298
  };
5297
5299
  };
5298
5300
  function appendWiresNote(wires, note) {
5299
5301
  wires.note = (wires.note ? wires.note + " | " : "") + note;
5300
5302
  }
5301
5303
  function makeFetchCtx(rawHttp, v, contractId, budget) {
5302
- const OP9 = PROFITABILITY_OP;
5303
- const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, contractId, "contractId");
5304
+ const OP10 = PROFITABILITY_OP;
5305
+ const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, contractId, "contractId");
5304
5306
  const idNum = typeof id === "number" ? id : Number(id);
5305
5307
  const wires = { issued: 0, requests: 0, budget };
5306
5308
  const toExcl = dayAfter(v.dateTo);
@@ -5311,19 +5313,19 @@ function makeFetchCtx(rawHttp, v, contractId, budget) {
5311
5313
  } };
5312
5314
  const readPart = (path, conditions, fields) => {
5313
5315
  wires.issued += 1;
5314
- return degradable(() => boundedPart(http, path, conditions, v.limit, OP9, fields));
5316
+ return degradable(() => boundedPart(http, path, conditions, v.limit, OP10, fields));
5315
5317
  };
5316
5318
  const truncatedMonths = {};
5317
5319
  const windowedPart = async (name, key, path, cond, fields, dateField) => {
5318
5320
  const first = await readPart(path, cond, fields);
5319
5321
  if (first.absent !== void 0 || !first.hasMore) return { part: stampPart(key, first, cond), rows: first.items };
5320
- const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP9, fields, dateField, v.dateFrom, v.dateTo, wires));
5322
+ const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP10, fields, dateField, v.dateFrom, v.dateTo, wires));
5321
5323
  if (!("truncatedMonths" in wp)) return { part: stampPart(key, wp, cond), rows: [] };
5322
5324
  const { truncatedMonths: tm, ...part } = wp;
5323
5325
  truncatedMonths[name] = tm;
5324
5326
  return { part, rows: wp.items };
5325
5327
  };
5326
- return { v, OP: OP9, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5328
+ return { v, OP: OP10, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5327
5329
  }
5328
5330
 
5329
5331
  // src/resources/special/contracts/profitability.stages.ts
@@ -5338,12 +5340,12 @@ async function fetchCustomer(ctx, companyID) {
5338
5340
  path: `/V1.0/Companies/${companyID}`,
5339
5341
  operation: ctx.OP
5340
5342
  });
5341
- const item = _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5343
+ const item = _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5342
5344
  customer = _nullishCoalesce(item, () => ( null));
5343
5345
  customerStatus = "ok";
5344
5346
  } catch (err) {
5345
- if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5346
- if (!(err instanceof _chunkD5IVS6GYcjs.NotFoundError)) {
5347
+ if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5348
+ if (!(err instanceof _chunkIKWHRUQ5cjs.NotFoundError)) {
5347
5349
  customerStatus = "absent";
5348
5350
  customerAbsent = err.code;
5349
5351
  }
@@ -5359,7 +5361,7 @@ async function resolveContractType(ctx, contractType) {
5359
5361
  try {
5360
5362
  contractTypeLabel = await _asyncNullishCoalesce(await _asyncOptionalChain([(await readPicklists(ctx.http, "/V1.0/Contracts", ctx.OP)), 'access', async _54 => _54.get, 'call', async _55 => _55("contractType"), 'optionalAccess', async _56 => _56.get, 'call', async _57 => _57(contractType)]), async () => ( null));
5361
5363
  } catch (err) {
5362
- if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5364
+ if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5363
5365
  }
5364
5366
  }
5365
5367
  const contractTypeKnown = contractTypeLabel !== null;
@@ -5421,8 +5423,8 @@ async function fetchInvoices(ctx, billingRows) {
5421
5423
  if (invoiceIds.length === 0) {
5422
5424
  return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
5423
5425
  }
5424
- const capped = capJoinSet2(invoiceIds, _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5425
- if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5426
+ const capped = capJoinSet2(invoiceIds, _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5427
+ if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5426
5428
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
5427
5429
  ctx.wires.issued += 1;
5428
5430
  return {
@@ -5468,7 +5470,7 @@ async function readOpenStatusSet(ctx) {
5468
5470
  }
5469
5471
  }
5470
5472
  } catch (err) {
5471
- statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5473
+ statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5472
5474
  }
5473
5475
  return { openStatusSet, statusNote };
5474
5476
  }
@@ -5491,8 +5493,8 @@ async function fetchResources(ctx, entries) {
5491
5493
  if (resourceIds.length === 0) {
5492
5494
  return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
5493
5495
  }
5494
- const capped = capJoinSet2(resourceIds, _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5495
- if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5496
+ const capped = capJoinSet2(resourceIds, _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5497
+ if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5496
5498
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
5497
5499
  ctx.wires.issued += 1;
5498
5500
  for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
@@ -5559,7 +5561,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
5559
5561
  try {
5560
5562
  return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
5561
5563
  } catch (err) {
5562
- if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5564
+ if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5563
5565
  return null;
5564
5566
  }
5565
5567
  }
@@ -5576,7 +5578,7 @@ async function fetchSubscriptions(ctx, cis) {
5576
5578
  cancelledSubs
5577
5579
  };
5578
5580
  }
5579
- const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5581
+ const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5580
5582
  const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
5581
5583
  const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
5582
5584
  const subscriptions = raw.items;
@@ -6261,7 +6263,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
6261
6263
  }
6262
6264
 
6263
6265
  // src/resources/contracts.ts
6264
- var ContractsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6266
+ var ContractsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6265
6267
  constructor(http, pageSize) {
6266
6268
  super(http, {
6267
6269
  key: "contracts",
@@ -6332,7 +6334,7 @@ var ContractsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6332
6334
  };
6333
6335
 
6334
6336
  // src/resources/contract_ticket_purchases.ts
6335
- var ContractTicketPurchasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6337
+ var ContractTicketPurchasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6336
6338
  constructor(http, pageSize) {
6337
6339
  super(http, {
6338
6340
  key: "contract_ticket_purchases",
@@ -6391,7 +6393,7 @@ var ContractTicketPurchasesResource = class extends _chunkD5IVS6GYcjs.BaseResour
6391
6393
  };
6392
6394
 
6393
6395
  // src/resources/countries.ts
6394
- var CountriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6396
+ var CountriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6395
6397
  constructor(http, pageSize) {
6396
6398
  super(http, {
6397
6399
  key: "countries",
@@ -6450,7 +6452,7 @@ var CountriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6450
6452
  };
6451
6453
 
6452
6454
  // src/resources/currencies.ts
6453
- var CurrenciesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6455
+ var CurrenciesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6454
6456
  constructor(http, pageSize) {
6455
6457
  super(http, {
6456
6458
  key: "currencies",
@@ -6494,7 +6496,7 @@ var CurrenciesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6494
6496
  };
6495
6497
 
6496
6498
  // src/resources/departments.ts
6497
- var DepartmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6499
+ var DepartmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6498
6500
  constructor(http, pageSize) {
6499
6501
  super(http, {
6500
6502
  key: "departments",
@@ -6561,7 +6563,7 @@ var DepartmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6561
6563
  };
6562
6564
 
6563
6565
  // src/resources/domain_registrars.ts
6564
- var DomainRegistrarsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6566
+ var DomainRegistrarsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6565
6567
  constructor(http, pageSize) {
6566
6568
  super(http, {
6567
6569
  key: "domain_registrars",
@@ -6644,7 +6646,7 @@ var EntityInformationResource = class {
6644
6646
  };
6645
6647
 
6646
6648
  // src/resources/expense_item_attachments.ts
6647
- var ExpenseItemAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6649
+ var ExpenseItemAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6648
6650
  constructor(http, pageSize) {
6649
6651
  super(http, {
6650
6652
  key: "expense_item_attachments",
@@ -6706,7 +6708,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResourc
6706
6708
  };
6707
6709
 
6708
6710
  // src/resources/expense_items.ts
6709
- var ExpenseItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6711
+ var ExpenseItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6710
6712
  constructor(http, pageSize) {
6711
6713
  super(http, {
6712
6714
  key: "expense_items",
@@ -6765,7 +6767,7 @@ var ExpenseItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6765
6767
  };
6766
6768
 
6767
6769
  // src/resources/expense_reports.ts
6768
- var ExpenseReportsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6770
+ var ExpenseReportsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6769
6771
  constructor(http, pageSize) {
6770
6772
  super(http, {
6771
6773
  key: "expense_reports",
@@ -6832,7 +6834,7 @@ var ExpenseReportsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6832
6834
  };
6833
6835
 
6834
6836
  // src/resources/holiday_sets.ts
6835
- var HolidaySetsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6837
+ var HolidaySetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6836
6838
  constructor(http, pageSize) {
6837
6839
  super(http, {
6838
6840
  key: "holiday_sets",
@@ -6901,7 +6903,7 @@ var HolidaySetsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6901
6903
  };
6902
6904
 
6903
6905
  // src/resources/holidays.ts
6904
- var HolidaysResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6906
+ var HolidaysResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6905
6907
  constructor(http, pageSize) {
6906
6908
  super(http, {
6907
6909
  key: "holidays",
@@ -6973,10 +6975,10 @@ var PATH_SUFFIX = {
6973
6975
  transfer: "StockedItemsTransfer"
6974
6976
  };
6975
6977
  async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6976
- const numericParent = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, parentId, "parentId");
6978
+ const numericParent = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, parentId, "parentId");
6977
6979
  const suffix = PATH_SUFFIX[kind];
6978
6980
  if (opts.dryRun === true) {
6979
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
6981
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
6980
6982
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6981
6983
  method: "POST",
6982
6984
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -6993,11 +6995,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6993
6995
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6994
6996
  maxRetries: opts.maxRetries
6995
6997
  });
6996
- return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
6998
+ return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
6997
6999
  }
6998
7000
 
6999
7001
  // src/resources/inventory_products.ts
7000
- var InventoryProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7002
+ var InventoryProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7001
7003
  constructor(http, pageSize) {
7002
7004
  super(http, {
7003
7005
  key: "inventory_products",
@@ -7079,7 +7081,7 @@ var InventoryProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7079
7081
 
7080
7082
  // src/resources/special/invoices.ts
7081
7083
  async function markup(_resource, id, format, http) {
7082
- const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
7084
+ const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
7083
7085
  const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
7084
7086
  const res = await http.request({
7085
7087
  method: "GET",
@@ -7088,7 +7090,7 @@ async function markup(_resource, id, format, http) {
7088
7090
  });
7089
7091
  const body = res;
7090
7092
  if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
7091
- throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(
7093
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
7092
7094
  `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
7093
7095
  { code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
7094
7096
  );
@@ -7096,13 +7098,13 @@ async function markup(_resource, id, format, http) {
7096
7098
  return body.invoiceMarkup;
7097
7099
  }
7098
7100
  async function pdf(_resource, id, http) {
7099
- const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
7101
+ const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
7100
7102
  const res = await http.request({
7101
7103
  method: "GET",
7102
7104
  path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
7103
7105
  operation: "invoices.pdf"
7104
7106
  });
7105
- return _chunkD5IVS6GYcjs.decodeFileData.call(void 0, res);
7107
+ return _chunkIKWHRUQ5cjs.decodeFileData.call(void 0, res);
7106
7108
  }
7107
7109
  async function windowQuery2(_resource, kind, http, opts) {
7108
7110
  const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _76 => _76.now]), () => ( /* @__PURE__ */ new Date()));
@@ -7133,7 +7135,7 @@ async function customRange2(_resource, from, to, http, opts) {
7133
7135
  }
7134
7136
 
7135
7137
  // src/resources/invoices.ts
7136
- var InvoicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7138
+ var InvoicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7137
7139
  constructor(http, pageSize) {
7138
7140
  super(http, {
7139
7141
  key: "invoices",
@@ -7247,7 +7249,7 @@ var InvoicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7247
7249
  };
7248
7250
 
7249
7251
  // src/resources/invoice_templates.ts
7250
- var InvoiceTemplatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7252
+ var InvoiceTemplatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7251
7253
  constructor(http, pageSize) {
7252
7254
  super(http, {
7253
7255
  key: "invoice_templates",
@@ -7291,7 +7293,7 @@ var ModulesResource = class {
7291
7293
  };
7292
7294
 
7293
7295
  // src/resources/notification_history.ts
7294
- var NotificationHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7296
+ var NotificationHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7295
7297
  constructor(http, pageSize) {
7296
7298
  super(http, {
7297
7299
  key: "notification_history",
@@ -7330,7 +7332,7 @@ var NotificationHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7330
7332
  };
7331
7333
 
7332
7334
  // src/resources/opportunities.ts
7333
- var OpportunitiesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7335
+ var OpportunitiesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7334
7336
  constructor(http, pageSize) {
7335
7337
  super(http, {
7336
7338
  key: "opportunities",
@@ -7392,7 +7394,7 @@ var OpportunitiesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7392
7394
  };
7393
7395
 
7394
7396
  // src/resources/opportunity_attachments.ts
7395
- var OpportunityAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7397
+ var OpportunityAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7396
7398
  constructor(http, pageSize) {
7397
7399
  super(http, {
7398
7400
  key: "opportunity_attachments",
@@ -7454,7 +7456,7 @@ var OpportunityAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResourc
7454
7456
  };
7455
7457
 
7456
7458
  // src/resources/opportunity_categories.ts
7457
- var OpportunityCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7459
+ var OpportunityCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7458
7460
  constructor(http, pageSize) {
7459
7461
  super(http, {
7460
7462
  key: "opportunity_categories",
@@ -7513,7 +7515,7 @@ var OpportunityCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource
7513
7515
  };
7514
7516
 
7515
7517
  // src/resources/organizational_level1s.ts
7516
- var OrganizationalLevel1sResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7518
+ var OrganizationalLevel1sResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7517
7519
  constructor(http, pageSize) {
7518
7520
  super(http, {
7519
7521
  key: "organizational_level1s",
@@ -7564,7 +7566,7 @@ var OrganizationalLevel1sResource = class extends _chunkD5IVS6GYcjs.BaseResource
7564
7566
  };
7565
7567
 
7566
7568
  // src/resources/organizational_level2s.ts
7567
- var OrganizationalLevel2sResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7569
+ var OrganizationalLevel2sResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7568
7570
  constructor(http, pageSize) {
7569
7571
  super(http, {
7570
7572
  key: "organizational_level2s",
@@ -7615,7 +7617,7 @@ var OrganizationalLevel2sResource = class extends _chunkD5IVS6GYcjs.BaseResource
7615
7617
  };
7616
7618
 
7617
7619
  // src/resources/organizational_level_associations.ts
7618
- var OrganizationalLevelAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7620
+ var OrganizationalLevelAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7619
7621
  constructor(http, pageSize) {
7620
7622
  super(http, {
7621
7623
  key: "organizational_level_associations",
@@ -7666,7 +7668,7 @@ var OrganizationalLevelAssociationsResource = class extends _chunkD5IVS6GYcjs.Ba
7666
7668
  };
7667
7669
 
7668
7670
  // src/resources/phases.ts
7669
- var PhasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7671
+ var PhasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7670
7672
  constructor(http, pageSize) {
7671
7673
  super(http, {
7672
7674
  key: "phases",
@@ -7725,7 +7727,7 @@ var PhasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7725
7727
  };
7726
7728
 
7727
7729
  // src/resources/products.ts
7728
- var ProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7730
+ var ProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7729
7731
  constructor(http, pageSize) {
7730
7732
  super(http, {
7731
7733
  key: "products",
@@ -7792,7 +7794,7 @@ var ProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7792
7794
  };
7793
7795
 
7794
7796
  // src/resources/product_vendors.ts
7795
- var ProductVendorsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7797
+ var ProductVendorsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7796
7798
  constructor(http, pageSize) {
7797
7799
  super(http, {
7798
7800
  key: "product_vendors",
@@ -7851,7 +7853,7 @@ var ProductVendorsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7851
7853
  };
7852
7854
 
7853
7855
  // src/resources/project_charges.ts
7854
- var ProjectChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7856
+ var ProjectChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7855
7857
  constructor(http, pageSize) {
7856
7858
  super(http, {
7857
7859
  key: "project_charges",
@@ -7922,7 +7924,7 @@ var ProjectChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7922
7924
  };
7923
7925
 
7924
7926
  // src/resources/project_notes.ts
7925
- var ProjectNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7927
+ var ProjectNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7926
7928
  constructor(http, pageSize) {
7927
7929
  super(http, {
7928
7930
  key: "project_notes",
@@ -7981,7 +7983,7 @@ var ProjectNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7981
7983
  };
7982
7984
 
7983
7985
  // src/resources/projects.ts
7984
- var ProjectsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7986
+ var ProjectsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7985
7987
  constructor(http, pageSize) {
7986
7988
  super(http, {
7987
7989
  key: "projects",
@@ -8058,13 +8060,13 @@ var ProjectsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8058
8060
  const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
8059
8061
  const result = { project: project2, company, opportunity, leadResource };
8060
8062
  if (opts.names === true) {
8061
- const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, );
8063
+ const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, );
8062
8064
  builder.addResource(root["creatorResourceID"]);
8063
8065
  builder.addFk("contract", root["contractID"]);
8064
- const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8066
+ const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8065
8067
  const row = { ...project2 };
8066
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8067
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
8068
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8069
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
8068
8070
  result.project = row;
8069
8071
  result.names = names.section;
8070
8072
  }
@@ -8073,7 +8075,7 @@ var ProjectsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8073
8075
  };
8074
8076
 
8075
8077
  // src/resources/purchase_approvals.ts
8076
- var PurchaseApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8078
+ var PurchaseApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8077
8079
  constructor(http, pageSize) {
8078
8080
  super(http, {
8079
8081
  key: "purchase_approvals",
@@ -8127,7 +8129,7 @@ var PurchaseApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8127
8129
  };
8128
8130
 
8129
8131
  // src/resources/purchase_order_item_receiving.ts
8130
- var PurchaseOrderItemReceivingResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8132
+ var PurchaseOrderItemReceivingResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8131
8133
  constructor(http, pageSize) {
8132
8134
  super(http, {
8133
8135
  key: "purchase_order_item_receiving",
@@ -8177,7 +8179,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkD5IVS6GYcjs.BaseRes
8177
8179
  };
8178
8180
 
8179
8181
  // src/resources/purchase_order_items.ts
8180
- var PurchaseOrderItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8182
+ var PurchaseOrderItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8181
8183
  constructor(http, pageSize) {
8182
8184
  super(http, {
8183
8185
  key: "purchase_order_items",
@@ -8236,7 +8238,7 @@ var PurchaseOrderItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8236
8238
  };
8237
8239
 
8238
8240
  // src/resources/purchase_orders.ts
8239
- var PurchaseOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8241
+ var PurchaseOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8240
8242
  constructor(http, pageSize) {
8241
8243
  super(http, {
8242
8244
  key: "purchase_orders",
@@ -8298,7 +8300,7 @@ var PurchaseOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8298
8300
  };
8299
8301
 
8300
8302
  // src/resources/quote_items.ts
8301
- var QuoteItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8303
+ var QuoteItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8302
8304
  constructor(http, pageSize) {
8303
8305
  super(http, {
8304
8306
  key: "quote_items",
@@ -8369,7 +8371,7 @@ var QuoteItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8369
8371
  };
8370
8372
 
8371
8373
  // src/resources/quote_locations.ts
8372
- var QuoteLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8374
+ var QuoteLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8373
8375
  constructor(http, pageSize) {
8374
8376
  super(http, {
8375
8377
  key: "quote_locations",
@@ -8434,7 +8436,7 @@ var QuoteLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8434
8436
  };
8435
8437
 
8436
8438
  // src/resources/quotes.ts
8437
- var QuotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8439
+ var QuotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8438
8440
  constructor(http, pageSize) {
8439
8441
  super(http, {
8440
8442
  key: "quotes",
@@ -8501,7 +8503,7 @@ var QuotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8501
8503
  };
8502
8504
 
8503
8505
  // src/resources/quote_templates.ts
8504
- var QuoteTemplatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8506
+ var QuoteTemplatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8505
8507
  constructor(http, pageSize) {
8506
8508
  super(http, {
8507
8509
  key: "quote_templates",
@@ -8545,7 +8547,7 @@ var QuoteTemplatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8545
8547
  };
8546
8548
 
8547
8549
  // src/resources/resource_role_queues.ts
8548
- var ResourceRoleQueuesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8550
+ var ResourceRoleQueuesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8549
8551
  constructor(http, pageSize) {
8550
8552
  super(http, {
8551
8553
  key: "resource_role_queues",
@@ -8604,7 +8606,7 @@ var ResourceRoleQueuesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8604
8606
  };
8605
8607
 
8606
8608
  // src/resources/resource_roles.ts
8607
- var ResourceRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8609
+ var ResourceRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8608
8610
  constructor(http, pageSize) {
8609
8611
  super(http, {
8610
8612
  key: "resource_roles",
@@ -8646,7 +8648,7 @@ var ResourceRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8646
8648
  };
8647
8649
 
8648
8650
  // src/resources/resource_skills.ts
8649
- var ResourceSkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8651
+ var ResourceSkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8650
8652
  constructor(http, pageSize) {
8651
8653
  super(http, {
8652
8654
  key: "resource_skills",
@@ -8700,16 +8702,16 @@ var ResourceSkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8700
8702
  var MAX_TRANSFER_IDS = 500;
8701
8703
  function requirePositiveIds(ids2, label) {
8702
8704
  if (!Array.isArray(ids2) || ids2.length === 0) {
8703
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8705
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8704
8706
  }
8705
8707
  if (ids2.length > MAX_TRANSFER_IDS) {
8706
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8708
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8707
8709
  }
8708
8710
  const out = [];
8709
8711
  for (const raw of ids2) {
8710
- const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8712
+ const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, raw, `${label} id`);
8711
8713
  if (typeof id === "number" && id < 1) {
8712
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8714
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8713
8715
  }
8714
8716
  out.push(id);
8715
8717
  }
@@ -8717,7 +8719,7 @@ function requirePositiveIds(ids2, label) {
8717
8719
  }
8718
8720
  async function whoAmI(_resource, userName, http) {
8719
8721
  const user = userName.trim();
8720
- if (user === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8722
+ if (user === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8721
8723
  const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
8722
8724
  const res = await http.request({
8723
8725
  method: "POST",
@@ -8726,11 +8728,11 @@ async function whoAmI(_resource, userName, http) {
8726
8728
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
8727
8729
  operation: "resources.whoAmI"
8728
8730
  });
8729
- const matches = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
8731
+ const matches = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
8730
8732
  if (matches.length === 0) return null;
8731
8733
  if (matches.length > 1) {
8732
8734
  const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
8733
- throw new (0, _chunkD5IVS6GYcjs.ResolutionError)(
8735
+ throw new (0, _chunkIKWHRUQ5cjs.ResolutionError)(
8734
8736
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
8735
8737
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
8736
8738
  );
@@ -8739,9 +8741,9 @@ async function whoAmI(_resource, userName, http) {
8739
8741
  }
8740
8742
  async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
8741
8743
  const ids2 = requirePositiveIds(companyIds, "transferOwnership");
8742
- const destination = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8744
+ const destination = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8743
8745
  if (typeof destination === "number" && destination < 1) {
8744
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8746
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8745
8747
  }
8746
8748
  const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _88 => _88.dryRun]), () => ( true));
8747
8749
  const changes = [];
@@ -8754,7 +8756,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8754
8756
  operation: "resources.transferOwnership",
8755
8757
  maxRetries: _optionalChain([opts, 'optionalAccess', _89 => _89.maxRetries])
8756
8758
  });
8757
- const company = _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8759
+ const company = _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, id, void 0, "company");
8758
8760
  const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
8759
8761
  changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
8760
8762
  if (!dryRun) {
@@ -8765,13 +8767,13 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8765
8767
  operation: "resources.transferOwnership",
8766
8768
  maxRetries: _optionalChain([opts, 'optionalAccess', _90 => _90.maxRetries])
8767
8769
  });
8768
- _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, update);
8770
+ _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, update);
8769
8771
  applied.push(id);
8770
8772
  }
8771
8773
  } catch (err) {
8772
- if (!dryRun && err instanceof _chunkD5IVS6GYcjs.AutotaskError) {
8774
+ if (!dryRun && err instanceof _chunkIKWHRUQ5cjs.AutotaskError) {
8773
8775
  err.resourceIds = [id];
8774
- err.details = _chunkD5IVS6GYcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8776
+ err.details = _chunkIKWHRUQ5cjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8775
8777
  err.suggestedAction = `Partial transfer: ${applied.length} of ${ids2.length} companies were re-owned (ids: ${applied.join(", ") || "none"}); id ${id} failed. Re-run transferOwnership for the remaining ids (from ${id} on).`;
8776
8778
  }
8777
8779
  throw err;
@@ -8780,7 +8782,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8780
8782
  if (dryRun) {
8781
8783
  const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
8782
8784
  return {
8783
- ..._chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
8785
+ ..._chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
8784
8786
  operation: "resources.transferOwnership",
8785
8787
  method: "PUT",
8786
8788
  path: "/V1.0/Companies",
@@ -8804,7 +8806,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8804
8806
  }
8805
8807
 
8806
8808
  // src/resources/resources.ts
8807
- var ResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8809
+ var ResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8808
8810
 
8809
8811
  constructor(http, clientConfig, pageSize) {
8810
8812
  super(http, {
@@ -8877,7 +8879,7 @@ var ResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8877
8879
 
8878
8880
  // src/resources/special/resource_time_off_additional.ts
8879
8881
  async function getByResource(_resource, resourceId, http) {
8880
- const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8882
+ const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8881
8883
  const res = await http.request({
8882
8884
  method: "GET",
8883
8885
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -8891,11 +8893,11 @@ async function getByResource(_resource, resourceId, http) {
8891
8893
  if (typeof item === "object" && !Array.isArray(item)) return [item];
8892
8894
  }
8893
8895
  }
8894
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8896
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8895
8897
  }
8896
8898
 
8897
8899
  // src/resources/resource_time_off_additional.ts
8898
- var ResourceTimeOffAdditionalResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8900
+ var ResourceTimeOffAdditionalResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8899
8901
  constructor(http, pageSize) {
8900
8902
  super(http, {
8901
8903
  key: "resource_time_off_additional",
@@ -8934,7 +8936,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkD5IVS6GYcjs.BaseReso
8934
8936
  };
8935
8937
 
8936
8938
  // src/resources/resource_time_off_approvers.ts
8937
- var ResourceTimeOffApproversResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8939
+ var ResourceTimeOffApproversResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8938
8940
  constructor(http, pageSize) {
8939
8941
  super(http, {
8940
8942
  key: "resource_time_off_approvers",
@@ -8977,29 +8979,29 @@ var ResourceTimeOffApproversResource = class extends _chunkD5IVS6GYcjs.BaseResou
8977
8979
 
8978
8980
  // src/resources/special/resource_time_off_balances.ts
8979
8981
  async function getByResource2(_resource, resourceId, http) {
8980
- const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8982
+ const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8981
8983
  const res = await http.request({
8982
8984
  method: "GET",
8983
8985
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
8984
8986
  operation: "resource_time_off_balances.getByResource"
8985
8987
  });
8986
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8988
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8987
8989
  }
8988
8990
  async function getByYear(_resource, resourceId, year, http) {
8989
- const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8991
+ const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8990
8992
  if (!Number.isSafeInteger(year) || year < 1) {
8991
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8993
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8992
8994
  }
8993
8995
  const res = await http.request({
8994
8996
  method: "GET",
8995
8997
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
8996
8998
  operation: "resource_time_off_balances.getByYear"
8997
8999
  });
8998
- return _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
9000
+ return _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
8999
9001
  }
9000
9002
 
9001
9003
  // src/resources/resource_time_off_balances.ts
9002
- var ResourceTimeOffBalancesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9004
+ var ResourceTimeOffBalancesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9003
9005
  constructor(http, pageSize) {
9004
9006
  super(http, {
9005
9007
  key: "resource_time_off_balances",
@@ -9037,7 +9039,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkD5IVS6GYcjs.BaseResour
9037
9039
  };
9038
9040
 
9039
9041
  // src/resources/roles.ts
9040
- var RolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9042
+ var RolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9041
9043
  constructor(http, pageSize) {
9042
9044
  super(http, {
9043
9045
  key: "roles",
@@ -9104,7 +9106,7 @@ var RolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9104
9106
  };
9105
9107
 
9106
9108
  // src/resources/sales_orders.ts
9107
- var SalesOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9109
+ var SalesOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9108
9110
  constructor(http, pageSize) {
9109
9111
  super(http, {
9110
9112
  key: "sales_orders",
@@ -9147,7 +9149,7 @@ var SalesOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9147
9149
  };
9148
9150
 
9149
9151
  // src/resources/service_calls.ts
9150
- var ServiceCallsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9152
+ var ServiceCallsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9151
9153
  constructor(http, pageSize) {
9152
9154
  super(http, {
9153
9155
  key: "service_calls",
@@ -9216,7 +9218,7 @@ var ServiceCallsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9216
9218
  };
9217
9219
 
9218
9220
  // src/resources/service_call_task_resources.ts
9219
- var ServiceCallTaskResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9221
+ var ServiceCallTaskResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9220
9222
  constructor(http, pageSize) {
9221
9223
  super(http, {
9222
9224
  key: "service_call_task_resources",
@@ -9273,7 +9275,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResou
9273
9275
  };
9274
9276
 
9275
9277
  // src/resources/service_call_tasks.ts
9276
- var ServiceCallTasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9278
+ var ServiceCallTasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9277
9279
  constructor(http, pageSize) {
9278
9280
  super(http, {
9279
9281
  key: "service_call_tasks",
@@ -9330,7 +9332,7 @@ var ServiceCallTasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9330
9332
  };
9331
9333
 
9332
9334
  // src/resources/service_call_ticket_resources.ts
9333
- var ServiceCallTicketResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9335
+ var ServiceCallTicketResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9334
9336
  constructor(http, pageSize) {
9335
9337
  super(http, {
9336
9338
  key: "service_call_ticket_resources",
@@ -9387,7 +9389,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkD5IVS6GYcjs.BaseRes
9387
9389
  };
9388
9390
 
9389
9391
  // src/resources/service_call_tickets.ts
9390
- var ServiceCallTicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9392
+ var ServiceCallTicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9391
9393
  constructor(http, pageSize) {
9392
9394
  super(http, {
9393
9395
  key: "service_call_tickets",
@@ -9444,7 +9446,7 @@ var ServiceCallTicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9444
9446
  };
9445
9447
 
9446
9448
  // src/resources/service_level_agreement_results.ts
9447
- var ServiceLevelAgreementResultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9449
+ var ServiceLevelAgreementResultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9448
9450
  constructor(http, pageSize) {
9449
9451
  super(http, {
9450
9452
  key: "service_level_agreement_results",
@@ -9483,7 +9485,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkD5IVS6GYcjs.BaseR
9483
9485
  };
9484
9486
 
9485
9487
  // src/resources/services.ts
9486
- var ServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9488
+ var ServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9487
9489
  constructor(http, pageSize) {
9488
9490
  super(http, {
9489
9491
  key: "services",
@@ -9551,7 +9553,7 @@ var ServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9551
9553
  };
9552
9554
 
9553
9555
  // src/resources/skills.ts
9554
- var SkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9556
+ var SkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9555
9557
  constructor(http, pageSize) {
9556
9558
  super(http, {
9557
9559
  key: "skills",
@@ -9595,7 +9597,7 @@ var SkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9595
9597
  };
9596
9598
 
9597
9599
  // src/resources/subscription_periods.ts
9598
- var SubscriptionPeriodsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9600
+ var SubscriptionPeriodsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9599
9601
  constructor(http, pageSize) {
9600
9602
  super(http, {
9601
9603
  key: "subscription_periods",
@@ -9634,7 +9636,7 @@ var SubscriptionPeriodsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9634
9636
  };
9635
9637
 
9636
9638
  // src/resources/subscriptions.ts
9637
- var SubscriptionsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9639
+ var SubscriptionsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9638
9640
  constructor(http, pageSize) {
9639
9641
  super(http, {
9640
9642
  key: "subscriptions",
@@ -9703,7 +9705,7 @@ var SubscriptionsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9703
9705
  };
9704
9706
 
9705
9707
  // src/resources/survey_results.ts
9706
- var SurveyResultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9708
+ var SurveyResultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9707
9709
  constructor(http, pageSize) {
9708
9710
  super(http, {
9709
9711
  key: "survey_results",
@@ -9742,7 +9744,7 @@ var SurveyResultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9742
9744
  };
9743
9745
 
9744
9746
  // src/resources/surveys.ts
9745
- var SurveysResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9747
+ var SurveysResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9746
9748
  constructor(http, pageSize) {
9747
9749
  super(http, {
9748
9750
  key: "surveys",
@@ -9786,7 +9788,7 @@ var SurveysResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9786
9788
  };
9787
9789
 
9788
9790
  // src/resources/tag_aliases.ts
9789
- var TagAliasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9791
+ var TagAliasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9790
9792
  constructor(http, pageSize) {
9791
9793
  super(http, {
9792
9794
  key: "tag_aliases",
@@ -9843,7 +9845,7 @@ var TagAliasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9843
9845
  };
9844
9846
 
9845
9847
  // src/resources/tag_groups.ts
9846
- var TagGroupsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9848
+ var TagGroupsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9847
9849
  constructor(http, pageSize) {
9848
9850
  super(http, {
9849
9851
  key: "tag_groups",
@@ -9912,7 +9914,7 @@ var TagGroupsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9912
9914
  };
9913
9915
 
9914
9916
  // src/resources/tags.ts
9915
- var TagsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9917
+ var TagsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9916
9918
  constructor(http, pageSize) {
9917
9919
  super(http, {
9918
9920
  key: "tags",
@@ -9981,7 +9983,7 @@ var TagsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9981
9983
  };
9982
9984
 
9983
9985
  // src/resources/task_secondary_resources.ts
9984
- var TaskSecondaryResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9986
+ var TaskSecondaryResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9985
9987
  constructor(http, pageSize) {
9986
9988
  super(http, {
9987
9989
  key: "task_secondary_resources",
@@ -10038,7 +10040,7 @@ var TaskSecondaryResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResourc
10038
10040
  };
10039
10041
 
10040
10042
  // src/resources/tasks.ts
10041
- var TasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10043
+ var TasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10042
10044
  constructor(http, pageSize) {
10043
10045
  super(http, {
10044
10046
  key: "tasks",
@@ -10102,7 +10104,7 @@ var TasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10102
10104
  };
10103
10105
 
10104
10106
  // src/resources/tax_regions.ts
10105
- var TaxRegionsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10107
+ var TaxRegionsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10106
10108
  constructor(http, pageSize) {
10107
10109
  super(http, {
10108
10110
  key: "tax_regions",
@@ -10177,7 +10179,7 @@ var ThresholdInformationResource = class {
10177
10179
  };
10178
10180
 
10179
10181
  // src/resources/ticket_additional_configuration_items.ts
10180
- var TicketAdditionalConfigurationItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10182
+ var TicketAdditionalConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10181
10183
  constructor(http, pageSize) {
10182
10184
  super(http, {
10183
10185
  key: "ticket_additional_configuration_items",
@@ -10234,7 +10236,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkD5IVS6GYcjs
10234
10236
  };
10235
10237
 
10236
10238
  // src/resources/ticket_additional_contacts.ts
10237
- var TicketAdditionalContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10239
+ var TicketAdditionalContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10238
10240
  constructor(http, pageSize) {
10239
10241
  super(http, {
10240
10242
  key: "ticket_additional_contacts",
@@ -10291,7 +10293,7 @@ var TicketAdditionalContactsResource = class extends _chunkD5IVS6GYcjs.BaseResou
10291
10293
  };
10292
10294
 
10293
10295
  // src/resources/ticket_attachments.ts
10294
- var TicketAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10296
+ var TicketAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10295
10297
  constructor(http, pageSize) {
10296
10298
  super(http, {
10297
10299
  key: "ticket_attachments",
@@ -10353,7 +10355,7 @@ var TicketAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10353
10355
  };
10354
10356
 
10355
10357
  // src/resources/ticket_categories.ts
10356
- var TicketCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10358
+ var TicketCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10357
10359
  constructor(http, pageSize) {
10358
10360
  super(http, {
10359
10361
  key: "ticket_categories",
@@ -10412,7 +10414,7 @@ var TicketCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10412
10414
  };
10413
10415
 
10414
10416
  // src/resources/ticket_category_field_defaults.ts
10415
- var TicketCategoryFieldDefaultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10417
+ var TicketCategoryFieldDefaultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10416
10418
  constructor(http, pageSize) {
10417
10419
  super(http, {
10418
10420
  key: "ticket_category_field_defaults",
@@ -10454,7 +10456,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkD5IVS6GYcjs.BaseRe
10454
10456
  };
10455
10457
 
10456
10458
  // src/resources/ticket_change_request_approvals.ts
10457
- var TicketChangeRequestApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10459
+ var TicketChangeRequestApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10458
10460
  constructor(http, pageSize) {
10459
10461
  super(http, {
10460
10462
  key: "ticket_change_request_approvals",
@@ -10514,10 +10516,10 @@ var TicketChangeRequestApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseR
10514
10516
  var _crypto = require('crypto');
10515
10517
  var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
10516
10518
  var MOVE_EFFECTS_NOTE = "Create then delete: the new record gets a fresh create date and creator; creating/deleting may trigger notifications, SLA and workflow rules the API cannot suppress; vendor acceptance of the create is not validated by a dry run";
10517
- var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10519
+ var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10518
10520
  async function queryRows(http, resource, filter, operation, retries) {
10519
10521
  const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
10520
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
10522
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
10521
10523
  }
10522
10524
  function sameValue(a, b) {
10523
10525
  if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
@@ -10537,7 +10539,7 @@ async function readTicket(http, id, retries, operation) {
10537
10539
  const item = _optionalChain([res, 'optionalAccess', _98 => _98.item]);
10538
10540
  return _nullishCoalesce(item, () => ( null));
10539
10541
  } catch (e) {
10540
- if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10542
+ if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10541
10543
  throw e;
10542
10544
  }
10543
10545
  }
@@ -10558,7 +10560,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
10558
10560
  }
10559
10561
  }
10560
10562
  const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
10561
- if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10563
+ if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10562
10564
  const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
10563
10565
  if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
10564
10566
  throw refuse("MOVE_SOURCE_TOO_OLD", `${op}: source ${spec.entity} ${sourceId} is older than ${cap} day(s) (or undated) \u2014 move it in the Autotask UI`, ids2, op, { manualAction: manualFor(http, spec, source, "older than the move age limit") });
@@ -10601,17 +10603,17 @@ async function assertNoTwin(ctx, payload) {
10601
10603
  throw refuse("MOVE_TARGET_HAS_TWIN", `${ctx.spec.operation}: target ticket ${ctx.toTicketId} already has an equivalent ${ctx.spec.entity} (id ${String(rows[0].id)}) \u2014 a duplicate or resumed move`, { sourceId: ctx.sourceId, toTicketId: ctx.toTicketId }, ctx.spec.operation, { twinId: rows[0].id });
10602
10604
  }
10603
10605
  }
10604
- var statusOf = (e) => _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10606
+ var statusOf = (e) => _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10605
10607
  async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10606
10608
  const op = spec.operation;
10607
- const sourceId = Number(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10608
- const toTicketId = Number(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10609
+ const sourceId = Number(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10610
+ const toTicketId = Number(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10609
10611
  if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
10610
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10612
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10611
10613
  }
10612
10614
  const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
10613
10615
  if (opts.dryRun === true) {
10614
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
10616
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
10615
10617
  {
10616
10618
  operation: op,
10617
10619
  method: "POST",
@@ -10636,22 +10638,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10636
10638
  let newId;
10637
10639
  try {
10638
10640
  const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
10639
- newId = Number(_chunkD5IVS6GYcjs.unwrapOperation.call(void 0, created, op).id);
10641
+ newId = Number(_chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, created, op).id);
10640
10642
  } catch (e) {
10641
10643
  const status = statusOf(e);
10642
10644
  if (status !== void 0 && status >= 400 && status < 500) {
10643
- throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10645
+ throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10644
10646
  }
10645
- throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the create outcome is unknown (never resent) \u2014 check the target ticket for a new ${spec.entity} before retrying; the twin check blocks a second create`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2 } });
10647
+ throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the create outcome is unknown (never resent) \u2014 check the target ticket for a new ${spec.entity} before retrying; the twin check blocks a second create`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2 } });
10646
10648
  }
10647
10649
  const rollback = async (code, message) => {
10648
10650
  try {
10649
10651
  await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
10650
10652
  } catch (re) {
10651
10653
  const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
10652
- throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: ${message}; rolling back the new ${spec.entity} ${newId} FAILED \u2014 both records exist`, { code: unreadable ? "MOVE_UNKNOWN" : "MOVE_PARTIAL", operation: op, details: { status: unreadable ? "unknown" : "partial", ...ids2, newId, reason: code } });
10654
+ throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: ${message}; rolling back the new ${spec.entity} ${newId} FAILED \u2014 both records exist`, { code: unreadable ? "MOVE_UNKNOWN" : "MOVE_PARTIAL", operation: op, details: { status: unreadable ? "unknown" : "partial", ...ids2, newId, reason: code } });
10653
10655
  }
10654
- throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10656
+ throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10655
10657
  };
10656
10658
  const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
10657
10659
  if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
@@ -10680,14 +10682,14 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10680
10682
  };
10681
10683
  }
10682
10684
  if (status === void 0) {
10683
- throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the source delete outcome is unknown (never resent) \u2014 re-read the source: absent means the move completed`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2, newId } });
10685
+ throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the source delete outcome is unknown (never resent) \u2014 re-read the source: absent means the move completed`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2, newId } });
10684
10686
  }
10685
10687
  return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
10686
10688
  }
10687
10689
  return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
10688
10690
  }
10689
10691
  function uiLinkFor(http, entity, id) {
10690
- return _nullishCoalesce(_chunkD5IVS6GYcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10692
+ return _nullishCoalesce(_chunkIKWHRUQ5cjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10691
10693
  }
10692
10694
 
10693
10695
  // src/resources/special/ticket_charges.ts
@@ -10742,7 +10744,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
10742
10744
  }
10743
10745
 
10744
10746
  // src/resources/ticket_charges.ts
10745
- var TicketChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10747
+ var TicketChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10746
10748
  constructor(http, pageSize) {
10747
10749
  super(http, {
10748
10750
  key: "ticket_charges",
@@ -10817,7 +10819,7 @@ var TicketChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10817
10819
  };
10818
10820
 
10819
10821
  // src/resources/ticket_checklist_items.ts
10820
- var TicketChecklistItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10822
+ var TicketChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10821
10823
  constructor(http, pageSize) {
10822
10824
  super(http, {
10823
10825
  key: "ticket_checklist_items",
@@ -10883,7 +10885,7 @@ var TicketChecklistItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource
10883
10885
  };
10884
10886
 
10885
10887
  // src/resources/ticket_checklist_libraries.ts
10886
- var TicketChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10888
+ var TicketChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10887
10889
  constructor(http, pageSize) {
10888
10890
  super(http, {
10889
10891
  key: "ticket_checklist_libraries",
@@ -10907,9 +10909,9 @@ var TicketChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResou
10907
10909
  * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
10908
10910
  * surface — no documents read op — and never issues the POST). */
10909
10911
  async attachToDocument(documentID, data, opts = {}) {
10910
- const n = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, documentID, "documentID");
10912
+ const n = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, documentID, "documentID");
10911
10913
  if (opts.dryRun === true) {
10912
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
10914
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
10913
10915
  operation: "ticket_checklist_libraries.attachToDocument",
10914
10916
  method: "POST",
10915
10917
  path: `/V1.0/Documents/${n}/ChecklistLibraries`,
@@ -10927,7 +10929,7 @@ var TicketChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResou
10927
10929
  operation: "ticket_checklist_libraries.attachToDocument",
10928
10930
  maxRetries: opts.maxRetries
10929
10931
  });
10930
- return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
10932
+ return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
10931
10933
  }
10932
10934
  /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
10933
10935
  * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
@@ -10943,7 +10945,7 @@ var TicketChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResou
10943
10945
  };
10944
10946
 
10945
10947
  // src/resources/ticket_history.ts
10946
- var TicketHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10948
+ var TicketHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10947
10949
  constructor(http, pageSize) {
10948
10950
  super(http, {
10949
10951
  key: "ticket_history",
@@ -10982,7 +10984,7 @@ var TicketHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10982
10984
  };
10983
10985
 
10984
10986
  // src/resources/ticket_note_attachments.ts
10985
- var TicketNoteAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10987
+ var TicketNoteAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10986
10988
  constructor(http, pageSize) {
10987
10989
  super(http, {
10988
10990
  key: "ticket_note_attachments",
@@ -11044,7 +11046,7 @@ var TicketNoteAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource
11044
11046
  };
11045
11047
 
11046
11048
  // src/resources/ticket_notes.ts
11047
- var TicketNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11049
+ var TicketNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11048
11050
  constructor(http, pageSize) {
11049
11051
  super(http, {
11050
11052
  key: "ticket_notes",
@@ -11103,7 +11105,7 @@ var TicketNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11103
11105
  };
11104
11106
 
11105
11107
  // src/resources/ticket_note_webhooks.ts
11106
- var TicketNoteWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11108
+ var TicketNoteWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11107
11109
  constructor(http, pageSize) {
11108
11110
  super(http, {
11109
11111
  key: "ticket_note_webhooks",
@@ -11179,7 +11181,7 @@ var TicketNoteWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11179
11181
  };
11180
11182
 
11181
11183
  // src/resources/ticket_secondary_resources.ts
11182
- var TicketSecondaryResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11184
+ var TicketSecondaryResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11183
11185
  constructor(http, pageSize) {
11184
11186
  super(http, {
11185
11187
  key: "ticket_secondary_resources",
@@ -11244,9 +11246,9 @@ async function fetchTicket(http, id, operation) {
11244
11246
  });
11245
11247
  const body = res;
11246
11248
  if (body === null || !("item" in body)) {
11247
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11249
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11248
11250
  }
11249
- if (body.item === null || body.item === void 0) throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11251
+ if (body.item === null || body.item === void 0) throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11250
11252
  return body.item;
11251
11253
  }
11252
11254
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -11257,7 +11259,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
11257
11259
  body: { MaxRecords: maxRecords, filter },
11258
11260
  operation
11259
11261
  });
11260
- return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
11262
+ return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
11261
11263
  }
11262
11264
  function truncate(text, limit) {
11263
11265
  const full = _nullishCoalesce(text, () => ( ""));
@@ -11267,26 +11269,26 @@ function truncate(text, limit) {
11267
11269
 
11268
11270
  // src/resources/special/tickets/childRead.ts
11269
11271
  function isRouteUnavailable(err) {
11270
- return _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11272
+ return _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11271
11273
  }
11272
11274
  function routeFact(route, path, err) {
11273
11275
  return {
11274
11276
  route,
11275
11277
  path,
11276
- httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11278
+ httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11277
11279
  };
11278
11280
  }
11279
11281
  function childDeclaresQuery(resourceKey) {
11280
- return _chunkZEGMVEF3cjs.CAPABILITIES.some(
11282
+ return _chunkPY45RBQ2cjs.CAPABILITIES.some(
11281
11283
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
11282
11284
  );
11283
11285
  }
11284
11286
  function planScopedPath(resourceKey, ticketId) {
11285
11287
  if (!childDeclaresQuery(resourceKey)) return null;
11286
- const entry = _chunkD5IVS6GYcjs.RELATIONSHIP_MAP[resourceKey];
11288
+ const entry = _chunkIKWHRUQ5cjs.RELATIONSHIP_MAP[resourceKey];
11287
11289
  const parent = entry === void 0 ? null : entry.parent;
11288
11290
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
11289
- const parentPath = _optionalChain([_chunkD5IVS6GYcjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11291
+ const parentPath = _optionalChain([_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11290
11292
  if (parentPath === null || parentPath === void 0) return null;
11291
11293
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
11292
11294
  }
@@ -11325,14 +11327,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
11325
11327
  break;
11326
11328
  }
11327
11329
  const body = await http.request({ method: "GET", path: target, operation });
11328
- const { items: pageItems, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, body, operation);
11330
+ const { items: pageItems, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, body, operation);
11329
11331
  nextCursor = pageDetails.nextPageUrl;
11330
11332
  pages += 1;
11331
11333
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
11332
11334
  for (const row of window) if (accept(row)) items.push(row);
11333
11335
  if (items.length >= limit) break;
11334
11336
  if (nextCursor === null || pageItems.length === 0) break;
11335
- target = _chunkD5IVS6GYcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11337
+ target = _chunkIKWHRUQ5cjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11336
11338
  }
11337
11339
  const capped = items.length >= limit || guard && nextCursor !== null;
11338
11340
  return { items, capped };
@@ -11365,7 +11367,7 @@ var MS = 864e5;
11365
11367
  var SLA_PAGE = 100;
11366
11368
  async function slaHealthCheck(_resource, id, opts = {}, http) {
11367
11369
  void opts;
11368
- const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11370
+ const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11369
11371
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
11370
11372
  const rows = await ticketQueryItems(
11371
11373
  http,
@@ -11390,9 +11392,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
11390
11392
  async function summary(_resource, id, opts = {}, http) {
11391
11393
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
11392
11394
  if (!Number.isInteger(limit) || limit < 1) {
11393
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11395
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11394
11396
  }
11395
- const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11397
+ const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11396
11398
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
11397
11399
  const desc = truncate(ticket.description, limit);
11398
11400
  const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
@@ -11421,11 +11423,11 @@ async function summary(_resource, id, opts = {}, http) {
11421
11423
  // src/resources/special/tickets/timeline.ts
11422
11424
  function validateTimelineLimits(opts) {
11423
11425
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
11424
- if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11426
+ if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11425
11427
  const bounded = Math.min(limit, 500);
11426
11428
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
11427
11429
  if (!Number.isInteger(textLimit) || textLimit < 1) {
11428
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11430
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11429
11431
  }
11430
11432
  return { bounded, textLimit };
11431
11433
  }
@@ -11477,7 +11479,7 @@ function compareEventDates(a, b) {
11477
11479
  }
11478
11480
  async function timeline(_resource, id, opts = {}, http) {
11479
11481
  const { bounded, textLimit } = validateTimelineLimits(opts);
11480
- const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11482
+ const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11481
11483
  await fetchTicket(http, ticketId, "tickets.timeline");
11482
11484
  const dateFilters = (field) => {
11483
11485
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11517,7 +11519,7 @@ async function timeline(_resource, id, opts = {}, http) {
11517
11519
  }
11518
11520
 
11519
11521
  // src/resources/special/tickets/errors.ts
11520
- var QueueRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11522
+ var QueueRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11521
11523
  constructor(message, options = {}) {
11522
11524
  super(message, {
11523
11525
  code: "QUEUE_REQUIRED",
@@ -11528,13 +11530,13 @@ var QueueRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11528
11530
  this.name = "QueueRequiredError";
11529
11531
  }
11530
11532
  };
11531
- var TicketResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11533
+ var TicketResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11532
11534
  constructor(message, options = {}) {
11533
11535
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11534
11536
  this.name = "TicketResourceInvalidError";
11535
11537
  }
11536
11538
  };
11537
- var TicketCreateValidationFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11539
+ var TicketCreateValidationFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11538
11540
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
11539
11541
 
11540
11542
  constructor(message, vendorFields, options = {}) {
@@ -11543,7 +11545,7 @@ var TicketCreateValidationFailedError = class extends _chunkD5IVS6GYcjs.Autotask
11543
11545
  this.vendorFields = vendorFields;
11544
11546
  }
11545
11547
  };
11546
- var StatusUnknownError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11548
+ var StatusUnknownError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11547
11549
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
11548
11550
 
11549
11551
  constructor(message, options = {}) {
@@ -11557,7 +11559,7 @@ var StatusUnknownError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11557
11559
  this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
11558
11560
  }
11559
11561
  };
11560
- var StatusFieldsRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11562
+ var StatusFieldsRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11561
11563
 
11562
11564
 
11563
11565
 
@@ -11580,14 +11582,14 @@ function isPositiveInt(v) {
11580
11582
  return typeof v === "number" && Number.isInteger(v) && v > 0;
11581
11583
  }
11582
11584
  function namedVendorFields(err) {
11583
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11584
- const entries = _nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11585
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11586
+ const entries = _nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11585
11587
  const out = /* @__PURE__ */ new Set();
11586
11588
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
11587
11589
  return [...out];
11588
11590
  }
11589
11591
  function vendorDetailOf(err) {
11590
- return _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11592
+ return _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11591
11593
  }
11592
11594
  async function fetchItem(http, path, operation, readOpts) {
11593
11595
  const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _104 => _104.maxRetries]) });
@@ -11608,8 +11610,8 @@ function operationId(res) {
11608
11610
  return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
11609
11611
  }
11610
11612
  function discoveryMerge(err, body, defaults) {
11611
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11612
- const entries = _chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError);
11613
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11614
+ const entries = _chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError);
11613
11615
  if (entries === void 0) return null;
11614
11616
  for (const entry of entries) {
11615
11617
  const field = entry.field;
@@ -11621,7 +11623,7 @@ function discoveryMerge(err, body, defaults) {
11621
11623
  }
11622
11624
  function stepErrorText(code, err) {
11623
11625
  const detail = vendorDetailOf(err);
11624
- const base = _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11626
+ const base = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11625
11627
  return detail ? `${code}: ${detail}` : `${code}: ${base}`;
11626
11628
  }
11627
11629
 
@@ -11633,43 +11635,43 @@ var DEFAULT_PUBLISH = 1;
11633
11635
  var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
11634
11636
  var SAFE_TICKET_CREATE_DEFAULTS = {};
11635
11637
  function validateOpenInput(params, note, assign) {
11636
- const companyID = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11638
+ const companyID = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11637
11639
  const title = _optionalChain([params, 'optionalAccess', _107 => _107.title]);
11638
11640
  if (typeof title !== "string" || title.trim() === "") {
11639
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11641
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11640
11642
  }
11641
11643
  const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
11642
11644
  const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
11643
11645
  if (!isPositiveInt(priority)) {
11644
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11646
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11645
11647
  }
11646
11648
  if (!isPositiveInt(status)) {
11647
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11649
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11648
11650
  }
11649
11651
  if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
11650
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11652
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11651
11653
  }
11652
11654
  if (note !== void 0) {
11653
11655
  if (typeof note.description !== "string" || note.description.trim() === "") {
11654
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11656
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11655
11657
  }
11656
11658
  if (typeof note.title !== "string" || note.title.trim() === "") {
11657
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: note.title is required (a non-empty string) \u2014 the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })", { operation: OP_OPEN });
11659
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: note.title is required (a non-empty string) \u2014 the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })", { operation: OP_OPEN });
11658
11660
  }
11659
11661
  if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
11660
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11662
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11661
11663
  }
11662
11664
  if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
11663
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11665
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11664
11666
  }
11665
11667
  }
11666
- const assignee = assign === void 0 ? void 0 : _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11668
+ const assignee = assign === void 0 ? void 0 : _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11667
11669
  if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
11668
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11670
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11669
11671
  }
11670
11672
  const roleID = _optionalChain([assign, 'optionalAccess', _108 => _108.roleID]);
11671
11673
  if (assign !== void 0 && !isPositiveInt(roleID)) {
11672
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: assign.roleID is required (a positive integer) \u2014 the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)", { operation: OP_OPEN });
11674
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: assign.roleID is required (a positive integer) \u2014 the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)", { operation: OP_OPEN });
11673
11675
  }
11674
11676
  return { companyID, title, priority, status, assignee, roleID };
11675
11677
  }
@@ -11698,7 +11700,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
11698
11700
  if (assign !== void 0) {
11699
11701
  warnings.push(`the assignment is the v0.6.0 MERGE update (unredacted GET + collection PUT, 2 wire) setting assignedResourceID ${String(assignee)} + assignedResourceRoleID ${String(roleID)} (the vendor requires both \u2014 S12-A live-verified); a failure lands in steps[] as ASSIGN_FAILED (the applied ticketId is still returned).`);
11700
11702
  }
11701
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11703
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11702
11704
  {
11703
11705
  operation: OP_OPEN,
11704
11706
  method: "POST",
@@ -11738,8 +11740,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11738
11740
  `openWithNoteAndAssign: the vendor rejected the ticket create naming 'queueID' (the ww29 live-required set is { title, status, priority, companyID, queueID }) and the node never guesses a queue${detail ? ` \u2014 ${detail}` : ""}`,
11739
11741
  {
11740
11742
  operation: OP_OPEN,
11741
- httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11742
- vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11743
+ httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11744
+ vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11743
11745
  }
11744
11746
  );
11745
11747
  }
@@ -11754,8 +11756,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11754
11756
  named,
11755
11757
  {
11756
11758
  operation: OP_OPEN,
11757
- httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11758
- vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11759
+ httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11760
+ vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11759
11761
  resourceIds: [companyID],
11760
11762
  details: { idRefs: [{ entity: "company", id: companyID }] }
11761
11763
  }
@@ -11780,10 +11782,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
11780
11782
  try {
11781
11783
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
11782
11784
  if (current === null) {
11783
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11785
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11784
11786
  }
11785
11787
  ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
11786
- const merged = _chunkD5IVS6GYcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11788
+ const merged = _chunkIKWHRUQ5cjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11787
11789
  merged.id = ticketId;
11788
11790
  await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
11789
11791
  assigned = true;
@@ -11847,7 +11849,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11847
11849
  const ids2 = await readLiveStatusSet(resource);
11848
11850
  if (ids2.size > 0) liveStatus = ids2;
11849
11851
  } catch (err) {
11850
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11852
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11851
11853
  }
11852
11854
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
11853
11855
  _optionalChain([http, 'access', _109 => _109.fieldCache, 'optionalAccess', _110 => _110.invalidate, 'call', _111 => _111("tickets")]);
@@ -11857,7 +11859,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11857
11859
  const freshIds = await readLiveStatusSet(resource);
11858
11860
  if (freshIds.size > 0) freshStatus = freshIds;
11859
11861
  } catch (err) {
11860
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11862
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11861
11863
  freshStatus = null;
11862
11864
  reReadFailed = true;
11863
11865
  }
@@ -11875,7 +11877,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11875
11877
  return { guardDegraded: liveStatus === null };
11876
11878
  }
11877
11879
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
11878
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11880
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11879
11881
  {
11880
11882
  operation: OP_STATUS,
11881
11883
  method: "PUT",
@@ -11929,7 +11931,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11929
11931
  if (mapEntry === void 0) {
11930
11932
  warnings.push(`status ${targetStatus} has no entry in the live-discovered required-field map yet \u2014 if the vendor 500 names a required field without a safe default, the apply throws the typed STATUS_FIELDS_REQUIRED (the caller supplies the value; never a blind retry).`);
11931
11933
  }
11932
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11934
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11933
11935
  {
11934
11936
  operation: OP_STATUS,
11935
11937
  method: "PUT",
@@ -11949,7 +11951,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11949
11951
  }
11950
11952
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
11951
11953
  const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _114 => _114.safeDefaults]), () => ( {}));
11952
- const body = _chunkD5IVS6GYcjs.mergePartialBody.call(void 0, current, mergeData);
11954
+ const body = _chunkIKWHRUQ5cjs.mergePartialBody.call(void 0, current, mergeData);
11953
11955
  body.id = ticketId;
11954
11956
  let merges = 0;
11955
11957
  for (; ; ) {
@@ -11973,8 +11975,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11973
11975
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
11974
11976
  {
11975
11977
  operation: OP_STATUS,
11976
- httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11977
- vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11978
+ httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11979
+ vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11978
11980
  resourceIds: [ticketId],
11979
11981
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
11980
11982
  }
@@ -11987,7 +11989,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11987
11989
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11988
11990
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11989
11991
  if (verify === null) {
11990
- throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11992
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11991
11993
  code: "INVALID_RESPONSE",
11992
11994
  category: "server",
11993
11995
  operation: OP_STATUS,
@@ -11997,7 +11999,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11997
11999
  }
11998
12000
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
11999
12001
  if (finalStatus !== targetStatus) {
12000
- throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(
12002
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
12001
12003
  `changeStatus: the post-PUT read-back shows status ${_nullishCoalesce(finalStatus, () => ( "unknown"))} (the vendor 200ed the PUT but did not apply ${targetStatus} \u2014 the F-A1 lesson: the 200 proves nothing)`,
12002
12004
  {
12003
12005
  code: "INVALID_RESPONSE",
@@ -12012,17 +12014,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
12012
12014
  }
12013
12015
  }
12014
12016
  async function changeStatus(resource, id, targetStatus, fields, opts, http) {
12015
- const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
12017
+ const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
12016
12018
  if (!isPositiveInt(targetStatus)) {
12017
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12019
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12018
12020
  }
12019
12021
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
12020
12022
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
12021
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12023
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12022
12024
  }
12023
12025
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
12024
12026
  if (current === null) {
12025
- throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
12027
+ throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
12026
12028
  }
12027
12029
  const previousStatus = typeof current.status === "number" ? current.status : null;
12028
12030
  if (previousStatus === targetStatus) {
@@ -12042,7 +12044,7 @@ var DEFAULT_PART_LIMIT = 50;
12042
12044
  function partLimit(value, name) {
12043
12045
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
12044
12046
  if (!Number.isInteger(n) || n < 1) {
12045
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12047
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12046
12048
  }
12047
12049
  return n;
12048
12050
  }
@@ -12055,42 +12057,49 @@ function servedTextRecord(row, textField, limit) {
12055
12057
  return out;
12056
12058
  }
12057
12059
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
12058
- const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS);
12060
+ const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS);
12059
12061
  const t = ctx.ticket;
12060
12062
  builder.addResource(t["creatorResourceID"]);
12061
12063
  builder.addFk("contract", t["contractID"]);
12062
12064
  builder.addFk("billingCode", t["billingCodeID"]);
12063
12065
  builder.addFk("role", t["assignedResourceRoleID"]);
12066
+ builder.addLineOfBusiness(t["organizationalLevelAssociationID"]);
12064
12067
  for (const e of entriesPart.items) {
12065
12068
  builder.addResource(e["resourceID"]);
12066
12069
  builder.addFk("role", e["roleID"]);
12067
12070
  builder.addFk("billingCode", e["billingCodeID"]);
12068
12071
  builder.addFk("contract", e["contractID"]);
12069
12072
  }
12070
- const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12073
+ const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12071
12074
  const ticketRow = { ...ctx.ticket };
12072
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12073
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12074
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12075
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12076
- for (const f of _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS) _chunkD5IVS6GYcjs.addLabelSibling.call(void 0, ticketRow, f, names);
12075
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12076
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12077
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12078
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12079
+ for (const f of _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS) _chunkIKWHRUQ5cjs.addLabelSibling.call(void 0, ticketRow, f, names);
12077
12080
  result.ticket = ticketRow;
12078
12081
  result.timeEntries.items = entriesPart.items.map((e) => {
12079
12082
  const row = { ...e };
12080
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12081
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12082
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12083
- _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
12083
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12084
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12085
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12086
+ _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
12084
12087
  return row;
12085
12088
  });
12086
12089
  result.names = names.section;
12090
+ result.lineOfBusiness = _nullishCoalesce(names.lineOfBusiness, () => ( {
12091
+ association: null,
12092
+ organizationalLevel2: null,
12093
+ organizationalLevel1: null,
12094
+ markers: { association: "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
12095
+ }));
12087
12096
  result.truncated = result.truncated || names.section.truncated;
12088
12097
  }
12089
12098
  async function fullContext(resource, id, opts = {}, http) {
12090
12099
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
12091
12100
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
12092
12101
  const textLimit = partLimit(opts.textLimit, "textLimit");
12093
- const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
12102
+ const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
12094
12103
  const ctx = await resource.getContext(ticketId);
12095
12104
  const op = "tickets.fullContext";
12096
12105
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -12157,7 +12166,7 @@ var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResource
12157
12166
  function positiveId(value, name) {
12158
12167
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12159
12168
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12160
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
12169
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
12161
12170
  }
12162
12171
  return n;
12163
12172
  }
@@ -12169,26 +12178,26 @@ async function ticketPage(http, filter, maxRecords, fields) {
12169
12178
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
12170
12179
  operation: OP4
12171
12180
  });
12172
- const page = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP4);
12181
+ const page = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP4);
12173
12182
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
12174
12183
  }
12175
12184
  async function forResource(_resource, resourceIDIn, http, opts = {}) {
12176
- if (opts === null || typeof opts !== "object") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: opts must be an object`, { operation: OP4 });
12185
+ if (opts === null || typeof opts !== "object") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: opts must be an object`, { operation: OP4 });
12177
12186
  const resourceID = positiveId(resourceIDIn, "resourceID");
12178
12187
  const scope = _nullishCoalesce(opts.scope, () => ( "both"));
12179
12188
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
12180
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
12189
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
12181
12190
  }
12182
12191
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
12183
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
12192
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
12184
12193
  }
12185
12194
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
12186
12195
  if (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX) {
12187
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
12196
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
12188
12197
  }
12189
12198
  const includeFields = _nullishCoalesce(opts.includeFields, () => ( []));
12190
12199
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
12191
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
12200
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
12192
12201
  }
12193
12202
  const openOnly = opts.openOnly === true;
12194
12203
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS2, ...includeFields])];
@@ -12205,7 +12214,7 @@ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12205
12214
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
12206
12215
  operation: OP4
12207
12216
  });
12208
- const page = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP4);
12217
+ const page = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP4);
12209
12218
  for (const row of page.items) if (typeof row.ticketID === "number" && !linkIds.includes(row.ticketID)) linkIds.push(row.ticketID);
12210
12219
  if (page.items.length >= LINK_READ_CAP || page.pageDetails.nextPageUrl !== null) capped = true;
12211
12220
  }
@@ -12257,13 +12266,45 @@ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12257
12266
  };
12258
12267
  }
12259
12268
 
12269
+ // src/resources/special/tickets/lineOfBusiness.ts
12270
+ var OP5 = "tickets.lineOfBusiness";
12271
+ function positiveId2(value, name) {
12272
+ const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
12273
+ if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12274
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
12275
+ }
12276
+ return n;
12277
+ }
12278
+ async function lineOfBusiness(resource, ticketIdIn, http, associationIdIn) {
12279
+ const ticketId = positiveId2(ticketIdIn, "ticketId");
12280
+ let associationId;
12281
+ if (associationIdIn !== void 0) {
12282
+ associationId = positiveId2(associationIdIn, "associationId");
12283
+ } else {
12284
+ const ticket = await resource.get(ticketId);
12285
+ associationId = _chunkIKWHRUQ5cjs.vendorId.call(void 0, ticket.organizationalLevelAssociationID);
12286
+ }
12287
+ if (associationId === void 0) {
12288
+ return {
12289
+ ticketId,
12290
+ association: null,
12291
+ organizationalLevel2: null,
12292
+ organizationalLevel1: null,
12293
+ markers: { association: "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
12294
+ };
12295
+ }
12296
+ const chain = await _chunkIKWHRUQ5cjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
12297
+ const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
12298
+ return { ticketId, association, organizationalLevel2, organizationalLevel1, markers };
12299
+ }
12300
+
12260
12301
  // src/resources/special/tickets/statusSemantics.ts
12261
12302
  async function statusSemantics(_resource, opts = {}, http) {
12262
12303
  return resolveTicketStatusSemantics(http, opts);
12263
12304
  }
12264
12305
 
12265
12306
  // src/resources/tickets.ts
12266
- var TicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12307
+ var TicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
12267
12308
  constructor(http, pageSize) {
12268
12309
  super(http, {
12269
12310
  key: "tickets",
@@ -12375,10 +12416,14 @@ var TicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12375
12416
  forResource(resourceID, opts) {
12376
12417
  return forResource(this, resourceID, this.http, opts);
12377
12418
  }
12419
+ /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */
12420
+ lineOfBusiness(ticketId, associationId) {
12421
+ return lineOfBusiness(this, ticketId, this.http, associationId);
12422
+ }
12378
12423
  };
12379
12424
 
12380
12425
  // src/resources/ticket_webhooks.ts
12381
- var TicketWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12426
+ var TicketWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
12382
12427
  constructor(http, pageSize) {
12383
12428
  super(http, {
12384
12429
  key: "ticket_webhooks",
@@ -12464,7 +12509,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
12464
12509
  body: { MaxRecords: limit, filter },
12465
12510
  operation
12466
12511
  });
12467
- const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res);
12512
+ const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res);
12468
12513
  return { items, hasMore: pageDetails.nextPageUrl != null };
12469
12514
  }
12470
12515
  async function windowQuery3(_resource, kind, http, opts) {
@@ -12483,7 +12528,7 @@ async function customRange3(_resource, from, to, http, opts) {
12483
12528
  const fromB = customRangeDay(from, "from", void 0, "customRange");
12484
12529
  const toB = customRangeDay(to, "to", void 0, "customRange");
12485
12530
  if (fromB.ms > toB.ms) {
12486
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("customRange: from must not be after to");
12531
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("customRange: from must not be after to");
12487
12532
  }
12488
12533
  const toEndMs = toB.ms + DAY_MS2 - 1;
12489
12534
  const filter = [
@@ -12503,12 +12548,12 @@ async function postedDateStatusQuery(_resource, mode, http, opts) {
12503
12548
  return items;
12504
12549
  }
12505
12550
  async function postedWithin(_resource, from, to, http, opts, opLabel = "time_entries.postedWithin") {
12506
- const OP9 = opLabel;
12507
- if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP9);
12508
- const fromB = customRangeDay(from, "from", void 0, OP9);
12509
- const toB = customRangeDay(to, "to", void 0, OP9);
12551
+ const OP10 = opLabel;
12552
+ if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP10);
12553
+ const fromB = customRangeDay(from, "from", void 0, OP10);
12554
+ const toB = customRangeDay(to, "to", void 0, OP10);
12510
12555
  if (fromB.ms > toB.ms) {
12511
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP9}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP9 });
12556
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP10}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP10 });
12512
12557
  }
12513
12558
  const windowToMs = toB.ms + DAY_MS2 - 1;
12514
12559
  const filter = [
@@ -12519,7 +12564,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
12519
12564
  else if (_optionalChain([opts, 'optionalAccess', _125 => _125.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
12520
12565
  if (_optionalChain([opts, 'optionalAccess', _126 => _126.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12521
12566
  if (_optionalChain([opts, 'optionalAccess', _127 => _127.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
12522
- const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP9, http);
12567
+ const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP10, http);
12523
12568
  let postedCount = 0;
12524
12569
  for (const item of items) {
12525
12570
  const postedDate = item.postedDate;
@@ -12542,13 +12587,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
12542
12587
  }
12543
12588
 
12544
12589
  // src/resources/special/time_entries/errors.ts
12545
- var ResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12590
+ var ResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12546
12591
  constructor(message, options = {}) {
12547
12592
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
12548
12593
  this.name = "ResourceInvalidError";
12549
12594
  }
12550
12595
  };
12551
- var AllocationCodeError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12596
+ var AllocationCodeError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12552
12597
  /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
12553
12598
 
12554
12599
  constructor(kind, message, options = {}) {
@@ -12557,7 +12602,7 @@ var AllocationCodeError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12557
12602
  this.kind = kind;
12558
12603
  }
12559
12604
  };
12560
- var NoApplicableAllocationCodeError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12605
+ var NoApplicableAllocationCodeError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12561
12606
  /** The structured blocker details (filters tried + department sets). */
12562
12607
 
12563
12608
  constructor(details, options = {}) {
@@ -12622,7 +12667,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12622
12667
  let pages = 0;
12623
12668
  for (; ; ) {
12624
12669
  if (pages >= PAGE_GUARD) {
12625
- throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12670
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12626
12671
  code: "RESOLUTION_TRUNCATED",
12627
12672
  category: "resolution",
12628
12673
  operation,
@@ -12633,11 +12678,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12633
12678
  const res = await http.request({
12634
12679
  method: "POST",
12635
12680
  idempotent: true,
12636
- path: isFirst ? path : _chunkD5IVS6GYcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12681
+ path: isFirst ? path : _chunkIKWHRUQ5cjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12637
12682
  body: { MaxRecords: pageSize, filter },
12638
12683
  operation
12639
12684
  });
12640
- const { items: pageItems, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
12685
+ const { items: pageItems, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
12641
12686
  items.push(...pageItems);
12642
12687
  pages += 1;
12643
12688
  if (items.length >= totalCap) break;
@@ -12729,7 +12774,7 @@ async function resolveCode(http, family, familyLabel2, pinnedId, departments, op
12729
12774
  }
12730
12775
 
12731
12776
  // src/resources/special/time_entries/createForResource.ts
12732
- var OP5 = "time_entries.createForResource";
12777
+ var OP6 = "time_entries.createForResource";
12733
12778
  var PARAM_KEYS = /* @__PURE__ */ new Set([
12734
12779
  "internallAllocationCodeID",
12735
12780
  "ticketID",
@@ -12754,7 +12799,7 @@ function windowDefaults(params) {
12754
12799
  var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
12755
12800
  var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
12756
12801
  function validateCreateParams(params) {
12757
- const pin = (value, label) => typeof value === "number" ? _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, value, label) : void 0;
12802
+ const pin = (value, label) => typeof value === "number" ? _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, value, label) : void 0;
12758
12803
  const pins = {
12759
12804
  code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
12760
12805
  ticket: pin(params.ticketID, "ticketID"),
@@ -12763,32 +12808,32 @@ function validateCreateParams(params) {
12763
12808
  };
12764
12809
  const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
12765
12810
  if (pinCount > 1) {
12766
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12811
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12767
12812
  "createForResource: exactly one linkage pin is honoured (internallAllocationCodeID | ticketID | taskID) \u2014 the vendor gate requires exactly one; pass one pin (or none for the default internal linkage)",
12768
- { operation: OP5 }
12813
+ { operation: OP6 }
12769
12814
  );
12770
12815
  }
12771
12816
  if (pins.role !== void 0 && pins.code !== void 0) {
12772
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12817
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12773
12818
  "createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
12774
- { operation: OP5 }
12819
+ { operation: OP6 }
12775
12820
  );
12776
12821
  }
12777
12822
  if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
12778
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12823
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12779
12824
  `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
12780
- { operation: OP5 }
12825
+ { operation: OP6 }
12781
12826
  );
12782
12827
  }
12783
12828
  return pins;
12784
12829
  }
12785
12830
  async function assertResourceActive(http, rid) {
12786
- const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP5);
12831
+ const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP6);
12787
12832
  if (rec === null) {
12788
12833
  throw new ResourceInvalidError(`Resource ${rid} was not found \u2014 a time entry cannot attach to a missing resource`, {
12789
12834
  resourceIds: [rid],
12790
12835
  details: { idRefs: [{ entity: "resource", id: rid }] },
12791
- operation: OP5,
12836
+ operation: OP6,
12792
12837
  category: "not_found",
12793
12838
  suggestedAction: "Resolve the resource id (resources.get / resources.search) and retry."
12794
12839
  });
@@ -12797,7 +12842,7 @@ async function assertResourceActive(http, rid) {
12797
12842
  throw new ResourceInvalidError(`Resource ${rid} is not active (isActive !== true) \u2014 the vendor would reject a time entry for an inactive resource`, {
12798
12843
  resourceIds: [rid],
12799
12844
  details: { idRefs: [{ entity: "resource", id: rid }] },
12800
- operation: OP5,
12845
+ operation: OP6,
12801
12846
  suggestedAction: "Activate the resource or pick an active one."
12802
12847
  });
12803
12848
  }
@@ -12807,11 +12852,11 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12807
12852
  const pinnedForCode = pins.code !== void 0 ? pins.code : pins.role;
12808
12853
  let code = null;
12809
12854
  const familiesTried = [];
12810
- code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP5);
12855
+ code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP6);
12811
12856
  familiesTried.push({ family: familyOf(linkage), label: familyLabel(familyOf(linkage)), filters: [{ field: "useType", op: "eq", value: familyOf(linkage) }, { field: "isActive", op: "eq", value: true }] });
12812
12857
  if (code === null && linkage === "task" && pins.role === void 0) {
12813
12858
  usedLinkage = "internal";
12814
- code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP5);
12859
+ code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP6);
12815
12860
  familiesTried.push({ family: USE_TYPE_INTERNAL, label: familyLabel(USE_TYPE_INTERNAL), filters: [{ field: "useType", op: "eq", value: USE_TYPE_INTERNAL }, { field: "isActive", op: "eq", value: true }] });
12816
12861
  }
12817
12862
  if (code === null) {
@@ -12821,7 +12866,7 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12821
12866
  families: familiesTried,
12822
12867
  resourceDepartments: [...departments].sort((a, b) => a - b)
12823
12868
  },
12824
- { operation: OP5 }
12869
+ { operation: OP6 }
12825
12870
  );
12826
12871
  }
12827
12872
  const resolvedCode = codeInfo(code);
@@ -12858,9 +12903,9 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
12858
12903
  if (usedLinkage === "internal" && linkage === "task") {
12859
12904
  warnings.push("the task had zero applicable general allocation codes \u2014 the linkage fell back to internal (the sanctioned fallback; no taskID/roleID in the body).");
12860
12905
  }
12861
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
12906
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
12862
12907
  {
12863
- operation: OP5,
12908
+ operation: OP6,
12864
12909
  method: "POST",
12865
12910
  path: "/V1.0/TimeEntries",
12866
12911
  ids: [rid],
@@ -12898,11 +12943,11 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12898
12943
  };
12899
12944
  } catch (err) {
12900
12945
  lastError = err;
12901
- const text = _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12946
+ const text = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12902
12947
  const gate3 = ROLE_REJECTION_PATTERN.test(text);
12903
12948
  if (usedLinkage !== "internal" && gate3) {
12904
12949
  if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
12905
- const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP5);
12950
+ const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP6);
12906
12951
  taskRoleFetched = true;
12907
12952
  if (task !== null) pushLadder(task.assignedResourceRoleID);
12908
12953
  }
@@ -12918,17 +12963,17 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12918
12963
  throw err;
12919
12964
  }
12920
12965
  }
12921
- if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, lastError)) {
12966
+ if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, lastError)) {
12922
12967
  lastError.suggestedAction = (lastError.suggestedAction ? `${lastError.suggestedAction} ` : "") + `The createForResource attempt budget (${MAX_CREATE_ATTEMPTS} attempts: the role ladder + ${MAX_DISCOVERY_MERGES2} discovery merges) was exhausted \u2014 the vendor oracle rejected every candidate. Re-read the record/fields (operations.fieldCatalog, billing_codes.query with a filter) and retry with an explicit pin.`;
12923
12968
  }
12924
12969
  throw lastError;
12925
12970
  }
12926
12971
  async function createForResource(resource, resourceID, params, opts = {}, http) {
12927
- const rid = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12972
+ const rid = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12928
12973
  const pins = validateCreateParams(params);
12929
12974
  await assertResourceActive(http, rid);
12930
12975
  const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
12931
- const roleRows = await resourceRoleRows(http, rid, OP5);
12976
+ const roleRows = await resourceRoleRows(http, rid, OP6);
12932
12977
  const departments = roleRows.departments;
12933
12978
  const { usedLinkage, resolvedCode } = await resolveAllocationCode(http, rid, linkage, pins, departments);
12934
12979
  const defaults = windowDefaults(params);
@@ -12937,8 +12982,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
12937
12982
  return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
12938
12983
  }
12939
12984
  function discoveryField(err, body, defaults) {
12940
- if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12941
- const entries = _chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError);
12985
+ if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12986
+ const entries = _chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError);
12942
12987
  if (entries === void 0) return null;
12943
12988
  for (const entry of entries) {
12944
12989
  const field = entry.field;
@@ -12951,42 +12996,42 @@ function discoveryField(err, body, defaults) {
12951
12996
  }
12952
12997
 
12953
12998
  // src/resources/special/time_entries/move.ts
12954
- var OP6 = "time_entries.moveToTicket";
12999
+ var OP7 = "time_entries.moveToTicket";
12955
13000
  var COPY2 = ["resourceID", "roleID", "billingCodeID", "dateWorked", "startDateTime", "endDateTime", "hoursWorked", "offsetHours", "summaryNotes", "internalNotes", "isNonBillable", "showOnInvoice"];
12956
13001
  var CONTRACT_SCOPED2 = ["contractID", "contractServiceID", "contractServiceBundleID"];
12957
13002
  async function readTimeEntry(http, id, retries) {
12958
13003
  try {
12959
- const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP6, maxRetries: retries });
13004
+ const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP7, maxRetries: retries });
12960
13005
  return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _129 => _129.item]), () => ( null));
12961
13006
  } catch (e) {
12962
- if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
13007
+ if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
12963
13008
  throw e;
12964
13009
  }
12965
13010
  }
12966
13011
  async function checkSource2({ http, source, sourceId, toTicketId, retries }) {
12967
13012
  const ids2 = { sourceId, toTicketId };
12968
13013
  if (source.taskID !== null && source.taskID !== void 0) {
12969
- throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP6}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP6);
13014
+ throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP7}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP7);
12970
13015
  }
12971
13016
  if (source.billingApprovalDateTime || source.billingApprovalResourceID || source.billingApprovalLevelMostRecent) {
12972
- throw refuse("MOVE_BLOCKED_APPROVED", `${OP6}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
13017
+ throw refuse("MOVE_BLOCKED_APPROVED", `${OP7}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
12973
13018
  }
12974
13019
  let billing;
12975
13020
  try {
12976
- billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP6, retries);
13021
+ billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP7, retries);
12977
13022
  } catch (e3) {
12978
- throw refuse("MOVE_BLOCKED_BILLED", `${OP6}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
13023
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP7}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
12979
13024
  }
12980
13025
  if (billing.some((b) => b.invoiceID || b.postedDate)) {
12981
- throw refuse("MOVE_BLOCKED_BILLED", `${OP6}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
13026
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP7}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
12982
13027
  }
12983
- const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP6, retries);
13028
+ const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP7, retries);
12984
13029
  if (attachments.length > 0) {
12985
- throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP6}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
13030
+ throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP7}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
12986
13031
  }
12987
13032
  }
12988
13033
  var SPEC2 = {
12989
- operation: OP6,
13034
+ operation: OP7,
12990
13035
  entity: "time_entry",
12991
13036
  readSource: readTimeEntry,
12992
13037
  sourceTicketId: (s) => typeof s.ticketID === "number" ? s.ticketID : null,
@@ -13021,15 +13066,15 @@ function moveToTicket2(_resource, sourceId, toTicketId, opts, http) {
13021
13066
  }
13022
13067
 
13023
13068
  // src/resources/special/time_entries/approve.ts
13024
- var OP7 = "time_entries.approve";
13069
+ var OP8 = "time_entries.approve";
13025
13070
  var APPROVAL_LEVELS_PATH = "/V1.0/BillingItemApprovalLevels";
13026
13071
  function toIso(value) {
13027
13072
  if (value instanceof Date) {
13028
- if (Number.isNaN(value.getTime())) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13073
+ if (Number.isNaN(value.getTime())) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13029
13074
  return value.toISOString();
13030
13075
  }
13031
13076
  const parsed = new Date(value);
13032
- if (Number.isNaN(parsed.getTime())) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13077
+ if (Number.isNaN(parsed.getTime())) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13033
13078
  return parsed.toISOString();
13034
13079
  }
13035
13080
  function toNumber(value) {
@@ -13042,24 +13087,24 @@ function sameInstant(a, b) {
13042
13087
  return !Number.isNaN(left) && left === right;
13043
13088
  }
13044
13089
  async function approve(resource, id, opts = {}, http) {
13045
- const numericId = toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id"));
13090
+ const numericId = toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id"));
13046
13091
  if (opts.approvalLevel !== void 0 && (!Number.isInteger(opts.approvalLevel) || opts.approvalLevel < 1)) {
13047
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13092
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13048
13093
  }
13049
13094
  const approvalLevel = _nullishCoalesce(opts.approvalLevel, () => ( 1));
13050
13095
  const approvalDateTime = toIso(_nullishCoalesce(opts.approvalDateTime, () => ( /* @__PURE__ */ new Date())));
13051
13096
  const entry = await resource.get(numericId);
13052
- const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13097
+ const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13053
13098
  if (approvalResourceID === void 0) {
13054
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
13099
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
13055
13100
  `time_entries.approve: time entry ${numericId} carries no resourceID and the caller supplied no approvalResourceID \u2014 the vendor requires an approving resource`
13056
13101
  );
13057
13102
  }
13058
13103
  const body = { timeEntryID: numericId, approvalLevel, approvalResourceID, approvalDateTime };
13059
13104
  if (opts.dryRun === true) {
13060
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
13105
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
13061
13106
  {
13062
- operation: OP7,
13107
+ operation: OP8,
13063
13108
  method: "POST",
13064
13109
  path: APPROVAL_LEVELS_PATH,
13065
13110
  ids: [numericId],
@@ -13082,10 +13127,10 @@ async function approve(resource, id, opts = {}, http) {
13082
13127
  method: "POST",
13083
13128
  path: APPROVAL_LEVELS_PATH,
13084
13129
  body,
13085
- operation: OP7,
13130
+ operation: OP8,
13086
13131
  maxRetries: opts.maxRetries
13087
13132
  });
13088
- const levelId = toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, created, OP7).id, "billingItemApprovalLevelID"));
13133
+ const levelId = toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, created, OP8).id, "billingItemApprovalLevelID"));
13089
13134
  await resource.update(
13090
13135
  numericId,
13091
13136
  { billingApprovalDateTime: approvalDateTime, billingApprovalResourceID: approvalResourceID },
@@ -13108,28 +13153,28 @@ async function approve(resource, id, opts = {}, http) {
13108
13153
  }
13109
13154
 
13110
13155
  // src/resources/special/time_entries/recentTickets.ts
13111
- var OP8 = "time_entries.recentTickets";
13156
+ var OP9 = "time_entries.recentTickets";
13112
13157
  var DAY_MS3 = 864e5;
13113
13158
  var TICKET_CHUNK2 = 100;
13114
13159
  var TICKET_FIELDS3 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
13115
- function positiveId2(value, name) {
13160
+ function positiveId3(value, name) {
13116
13161
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
13117
13162
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
13118
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP8 });
13163
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP9 });
13119
13164
  }
13120
13165
  return n;
13121
13166
  }
13122
13167
  async function recentTickets(_resource, from, to, http, opts) {
13123
13168
  if (opts === void 0 || opts === null || typeof opts !== "object") {
13124
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP8 });
13169
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP9 });
13125
13170
  }
13126
- const resourceID = positiveId2(opts.resourceID, "resourceID");
13127
- const companyID = opts.companyID === void 0 ? void 0 : positiveId2(opts.companyID, "companyID");
13128
- if (opts.tz !== void 0) validateZone(opts.tz, OP8);
13129
- const fromB = customRangeDay(from, "from", void 0, OP8);
13130
- const toB = customRangeDay(to, "to", void 0, OP8);
13171
+ const resourceID = positiveId3(opts.resourceID, "resourceID");
13172
+ const companyID = opts.companyID === void 0 ? void 0 : positiveId3(opts.companyID, "companyID");
13173
+ if (opts.tz !== void 0) validateZone(opts.tz, OP9);
13174
+ const fromB = customRangeDay(from, "from", void 0, OP9);
13175
+ const toB = customRangeDay(to, "to", void 0, OP9);
13131
13176
  if (fromB.ms > toB.ms) {
13132
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP8 });
13177
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP9 });
13133
13178
  }
13134
13179
  const windowToMs = toB.ms + DAY_MS3 - 1;
13135
13180
  const { items: entries, hasMore } = await queryTimeEntries(
@@ -13140,7 +13185,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13140
13185
  { field: "resourceID", op: "eq", value: resourceID }
13141
13186
  ],
13142
13187
  clampWindowLimit(opts.limit),
13143
- OP8,
13188
+ OP9,
13144
13189
  http
13145
13190
  );
13146
13191
  const groups = /* @__PURE__ */ new Map();
@@ -13166,9 +13211,9 @@ async function recentTickets(_resource, from, to, http, opts) {
13166
13211
  idempotent: true,
13167
13212
  path: "/V1.0/Tickets/query",
13168
13213
  body: { MaxRecords: TICKET_CHUNK2, filter, IncludeFields: TICKET_FIELDS3 },
13169
- operation: OP8
13214
+ operation: OP9
13170
13215
  });
13171
- for (const t of _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP8).items) if (typeof t.id === "number") tickets.set(t.id, t);
13216
+ for (const t of _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP9).items) if (typeof t.id === "number") tickets.set(t.id, t);
13172
13217
  }
13173
13218
  const items = [];
13174
13219
  const unresolvedTicketIDs = [];
@@ -13205,7 +13250,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13205
13250
  }
13206
13251
 
13207
13252
  // src/resources/time_entries.ts
13208
- var TimeEntriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
13253
+ var TimeEntriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13209
13254
  constructor(http, pageSize) {
13210
13255
  super(http, {
13211
13256
  key: "time_entries",
@@ -13354,7 +13399,7 @@ var TimeEntriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
13354
13399
  };
13355
13400
 
13356
13401
  // src/resources/time_entry_attachments.ts
13357
- var TimeEntryAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
13402
+ var TimeEntryAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13358
13403
  constructor(http, pageSize) {
13359
13404
  super(http, {
13360
13405
  key: "time_entry_attachments",
@@ -13417,9 +13462,9 @@ var TimeEntryAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource
13417
13462
 
13418
13463
  // src/resources/special/time_off_requests.ts
13419
13464
  async function approve2(_resource, id, opts = {}, http) {
13420
- const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
13465
+ const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
13421
13466
  if (opts.dryRun === true) {
13422
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
13467
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
13423
13468
  operation: "time_off_requests.approve",
13424
13469
  method: "GET",
13425
13470
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -13435,16 +13480,16 @@ async function approve2(_resource, id, opts = {}, http) {
13435
13480
  operation: "time_off_requests.approve",
13436
13481
  maxRetries: opts.maxRetries
13437
13482
  });
13438
- return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
13483
+ return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
13439
13484
  }
13440
13485
  async function reject(_resource, id, reason, opts = {}, http) {
13441
- const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
13486
+ const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
13442
13487
  const text = reason.trim();
13443
13488
  if (text === "") {
13444
- throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13489
+ throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13445
13490
  }
13446
13491
  if (opts.dryRun === true) {
13447
- return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
13492
+ return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
13448
13493
  operation: "time_off_requests.reject",
13449
13494
  method: "POST",
13450
13495
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -13462,11 +13507,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
13462
13507
  operation: "time_off_requests.reject",
13463
13508
  maxRetries: opts.maxRetries
13464
13509
  });
13465
- return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
13510
+ return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
13466
13511
  }
13467
13512
 
13468
13513
  // src/resources/time_off_requests.ts
13469
- var TimeOffRequestsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
13514
+ var TimeOffRequestsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13470
13515
  constructor(http, pageSize) {
13471
13516
  super(http, {
13472
13517
  key: "time_off_requests",