node-autotask 0.30.0 → 0.32.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 (42) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/MCP_TOOL_CATALOG.json +6 -6
  3. package/MCP_TOOL_MANIFEST.md +26 -28
  4. package/MCP_TOOL_OVERRIDES.json +0 -12
  5. package/N8N_MCP_MANIFEST.json +8 -8
  6. package/N8N_MCP_MANIFEST.md +8 -8
  7. package/README.md +7 -5
  8. package/capabilities.json +1473 -1449
  9. package/dist/capabilities.cjs +2 -2
  10. package/dist/capabilities.js +1 -1
  11. package/dist/{chunk-EDVSWL32.cjs → chunk-DCTHO7CQ.cjs} +1472 -1448
  12. package/dist/{chunk-RS7QMPRO.cjs → chunk-FTF2FEQ6.cjs} +526 -490
  13. package/dist/{chunk-P4PC32RJ.js → chunk-FVHPN7ZR.js} +61 -25
  14. package/dist/{chunk-LLIB4JGK.cjs → chunk-IKPFR6K2.cjs} +6 -6
  15. package/dist/{chunk-TZC4ZAA6.js → chunk-M2EGFPGF.js} +1472 -1448
  16. package/dist/{chunk-L4TDVUJM.cjs → chunk-QCB4LYKD.cjs} +143 -143
  17. package/dist/{chunk-QQPCJT2L.js → chunk-R6HLJCI2.js} +3 -3
  18. package/dist/{chunk-2ETR5GSO.js → chunk-T6EDJRLT.js} +2 -2
  19. package/dist/{index-B9VNv-EP.d.cts → index-Cw4aNNMo.d.ts} +65 -14
  20. package/dist/{index-DkpaFqyu.d.ts → index-OkbCWcef.d.cts} +65 -14
  21. package/dist/{index-CJ36PwRG.d.cts → index-m-7fOwFl.d.cts} +1 -1
  22. package/dist/{index-CJ36PwRG.d.ts → index-m-7fOwFl.d.ts} +1 -1
  23. package/dist/index.cjs +22 -22
  24. package/dist/index.d.cts +52 -5
  25. package/dist/index.d.ts +52 -5
  26. package/dist/index.js +4 -4
  27. package/dist/operations/index.cjs +112 -112
  28. package/dist/operations/index.d.cts +4 -4
  29. package/dist/operations/index.d.ts +4 -4
  30. package/dist/operations/index.js +2 -2
  31. package/dist/pool.cjs +9 -9
  32. package/dist/pool.d.cts +2 -2
  33. package/dist/pool.d.ts +2 -2
  34. package/dist/pool.js +4 -4
  35. package/dist/resources/index.cjs +4 -4
  36. package/dist/resources/index.d.cts +2 -2
  37. package/dist/resources/index.d.ts +2 -2
  38. package/dist/resources/index.js +3 -3
  39. package/dist/types/index.d.cts +1 -1
  40. package/dist/types/index.d.ts +1 -1
  41. package/docs/API.md +61 -36
  42. package/package.json +1 -1
@@ -40,13 +40,13 @@
40
40
 
41
41
 
42
42
 
43
- var _chunkLLIB4JGKcjs = require('./chunk-LLIB4JGK.cjs');
43
+ var _chunkIKPFR6K2cjs = require('./chunk-IKPFR6K2.cjs');
44
44
 
45
45
 
46
- var _chunkEDVSWL32cjs = require('./chunk-EDVSWL32.cjs');
46
+ var _chunkDCTHO7CQcjs = require('./chunk-DCTHO7CQ.cjs');
47
47
 
48
48
  // src/resources/appointments.ts
49
- var AppointmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
49
+ var AppointmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
50
50
  constructor(http, pageSize) {
51
51
  super(http, {
52
52
  key: "appointments",
@@ -131,7 +131,7 @@ var AuthenticateResource = class {
131
131
  };
132
132
 
133
133
  // src/resources/billing_codes.ts
134
- var BillingCodesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
134
+ var BillingCodesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
135
135
  constructor(http, pageSize) {
136
136
  super(http, {
137
137
  key: "billing_codes",
@@ -175,7 +175,7 @@ var BillingCodesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
175
175
  };
176
176
 
177
177
  // src/resources/billing_item_approval_levels.ts
178
- var BillingItemApprovalLevelsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
178
+ var BillingItemApprovalLevelsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
179
179
  constructor(http, pageSize) {
180
180
  super(http, {
181
181
  key: "billing_item_approval_levels",
@@ -217,7 +217,7 @@ var MAX_LIMIT = 500;
217
217
  function clampWindowLimit(limit) {
218
218
  const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
219
219
  if (!Number.isInteger(n) || n < 1) {
220
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
220
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
221
221
  }
222
222
  return Math.min(n, MAX_LIMIT);
223
223
  }
@@ -263,7 +263,7 @@ function wallParts(tz, ms) {
263
263
  }
264
264
  }
265
265
  if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
266
- throw new (0, _chunkLLIB4JGKcjs.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, _chunkIKPFR6K2cjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
267
267
  }
268
268
  return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
269
269
  }
@@ -290,7 +290,7 @@ function localDayEndMs(y, m, d, tz) {
290
290
  }
291
291
  function validateZone(tz, opName = "dateWindow") {
292
292
  if (typeof tz !== "string" || tz.length === 0) {
293
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
293
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
294
294
  `${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
295
295
  { operation: opName }
296
296
  );
@@ -298,7 +298,7 @@ function validateZone(tz, opName = "dateWindow") {
298
298
  try {
299
299
  new Intl.DateTimeFormat("en-US", { timeZone: tz });
300
300
  } catch (e2) {
301
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
301
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
302
302
  `${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
303
303
  { operation: opName }
304
304
  );
@@ -446,7 +446,7 @@ function dateOnlyWindowBounds(kind, now, tz) {
446
446
  }
447
447
  async function dateWindowQuery(http, path, field, kind, limit, operation, now, tz) {
448
448
  const zone = tz === void 0 ? void 0 : validateZone(tz, operation);
449
- const { from, to } = dateWindowBounds(kind, now, zone);
449
+ const { from, to } = dateOnlyWindowBounds(kind, now, zone);
450
450
  const filter = [
451
451
  { field, op: "gte", value: from },
452
452
  { field, op: "lte", value: to }
@@ -458,13 +458,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
458
458
  body: { MaxRecords: limit, filter },
459
459
  operation
460
460
  });
461
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
461
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
462
462
  }
463
463
  var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
464
464
  function customRangeDay(value, label, zone, opName) {
465
465
  const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
466
466
  if (!m) {
467
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
467
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
468
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)})`,
469
469
  { operation: opName }
470
470
  );
@@ -476,7 +476,7 @@ function customRangeDay(value, label, zone, opName) {
476
476
  const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
477
477
  const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
478
478
  if (!Number.isFinite(ms)) {
479
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
479
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
480
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)})`,
481
481
  { operation: opName }
482
482
  );
@@ -484,15 +484,16 @@ function customRangeDay(value, label, zone, opName) {
484
484
  return { y, mo, d, ms };
485
485
  }
486
486
  async function customRangeQuery(http, path, field, from, to, limit, operation, zone) {
487
- const fromB = customRangeDay(from, "from", zone, operation);
488
- const toB = customRangeDay(to, "to", zone, operation);
487
+ if (zone !== void 0) validateZone(zone, operation);
488
+ const fromB = customRangeDay(from, "from", void 0, operation);
489
+ const toB = customRangeDay(to, "to", void 0, operation);
489
490
  if (fromB.ms > toB.ms) {
490
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
491
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
491
492
  `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
492
493
  { operation }
493
494
  );
494
495
  }
495
- const toEndMs = zone === void 0 ? toB.ms + DAY_MS - 1 : localDayEndMs(toB.y, toB.mo, toB.d, zone);
496
+ const toEndMs = toB.ms + DAY_MS - 1;
496
497
  const filter = [
497
498
  { field, op: "gte", value: isoUtc(fromB.ms) },
498
499
  { field, op: "lte", value: isoUtc(toEndMs) }
@@ -504,7 +505,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
504
505
  body: { MaxRecords: limit, filter },
505
506
  operation
506
507
  });
507
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
508
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
508
509
  }
509
510
 
510
511
  // src/resources/special/billing_items.ts
@@ -537,7 +538,7 @@ async function customRange(_resource, from, to, http, opts) {
537
538
  }
538
539
 
539
540
  // src/resources/billing_items.ts
540
- var BillingItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
541
+ var BillingItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
541
542
  constructor(http, pageSize) {
542
543
  super(http, {
543
544
  key: "billing_items",
@@ -639,7 +640,7 @@ var BillingItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
639
640
  };
640
641
 
641
642
  // src/resources/change_request_links.ts
642
- var ChangeRequestLinksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
643
+ var ChangeRequestLinksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
643
644
  constructor(http, pageSize) {
644
645
  super(http, {
645
646
  key: "change_request_links",
@@ -693,7 +694,7 @@ var ChangeRequestLinksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
693
694
  };
694
695
 
695
696
  // src/resources/checklist_libraries.ts
696
- var ChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
697
+ var ChecklistLibrariesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
697
698
  constructor(http, pageSize) {
698
699
  super(http, {
699
700
  key: "checklist_libraries",
@@ -767,7 +768,7 @@ var ChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
767
768
  };
768
769
 
769
770
  // src/resources/checklist_library_checklist_items.ts
770
- var ChecklistLibraryChecklistItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
771
+ var ChecklistLibraryChecklistItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
771
772
  constructor(http, pageSize) {
772
773
  super(http, {
773
774
  key: "checklist_library_checklist_items",
@@ -833,7 +834,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkLLIB4JGKcjs.Bas
833
834
  };
834
835
 
835
836
  // src/resources/classification_icons.ts
836
- var ClassificationIconsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
837
+ var ClassificationIconsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
837
838
  constructor(http, pageSize) {
838
839
  super(http, {
839
840
  key: "classification_icons",
@@ -940,7 +941,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
940
941
  body,
941
942
  operation
942
943
  });
943
- const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
944
+ const { items, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, operation);
944
945
  const capped = items.length >= limit;
945
946
  return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
946
947
  }
@@ -950,7 +951,7 @@ var DEFAULT_LIMIT2 = 25;
950
951
  var MAX_LIMIT2 = 500;
951
952
  function clampLimit(limit) {
952
953
  const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
953
- if (!Number.isInteger(n) || n < 1) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
954
+ if (!Number.isInteger(n) || n < 1) throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
954
955
  return Math.min(n, MAX_LIMIT2);
955
956
  }
956
957
 
@@ -963,7 +964,7 @@ async function queryCompanies(http, filter, limit) {
963
964
  body: { MaxRecords: limit, filter },
964
965
  operation: "companies.searchByDomain"
965
966
  });
966
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
967
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
967
968
  }
968
969
  async function queryContacts(http, filter, limit) {
969
970
  const res = await http.request({
@@ -973,7 +974,7 @@ async function queryContacts(http, filter, limit) {
973
974
  body: { MaxRecords: limit, filter },
974
975
  operation: "companies.searchByDomain"
975
976
  });
976
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
977
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
977
978
  }
978
979
  async function fetchCompanies(http, ids2, limit) {
979
980
  const out = [];
@@ -988,7 +989,7 @@ async function fetchCompanies(http, ids2, limit) {
988
989
  const item = body && "item" in body ? body.item : null;
989
990
  if (item) out.push(item);
990
991
  } catch (err) {
991
- if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) continue;
992
+ if (err instanceof _chunkIKPFR6K2cjs.NotFoundError) continue;
992
993
  throw err;
993
994
  }
994
995
  }
@@ -996,7 +997,7 @@ async function fetchCompanies(http, ids2, limit) {
996
997
  }
997
998
  async function searchByDomain(_resource, domain, opts = {}, http) {
998
999
  const text = domain.trim();
999
- if (text === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("searchByDomain: empty domain");
1000
+ if (text === "") throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("searchByDomain: empty domain");
1000
1001
  const limit = clampLimit(opts.limit);
1001
1002
  const filter = [{ field: "webAddress", op: "contains", value: text }];
1002
1003
  const direct = await queryCompanies(http, filter, limit);
@@ -1010,7 +1011,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
1010
1011
  const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
1011
1012
  const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
1012
1013
  if (name === "" && email === "" && website === "") {
1013
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1014
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1014
1015
  }
1015
1016
  const limit = clampLimit(opts.limit);
1016
1017
  const found = /* @__PURE__ */ new Map();
@@ -1039,23 +1040,23 @@ async function familyChildPage(http, parentID) {
1039
1040
  path: "/V1.0/Companies/query",
1040
1041
  body: {
1041
1042
  MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
1042
- filter: _chunkLLIB4JGKcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1043
+ filter: _chunkIKPFR6K2cjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1043
1044
  },
1044
1045
  operation: "companies.search"
1045
1046
  });
1046
- const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "companies.search");
1047
+ const { items, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, "companies.search");
1047
1048
  return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
1048
1049
  }
1049
1050
  function assertSearchWithDetailOpts(opts) {
1050
1051
  if (opts === void 0) return;
1051
1052
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
1052
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1053
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1053
1054
  operation: "companies.searchWithDetail"
1054
1055
  });
1055
1056
  }
1056
1057
  for (const key of Object.keys(opts)) {
1057
1058
  if (key !== "limit") {
1058
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1059
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
1059
1060
  `companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
1060
1061
  { operation: "companies.searchWithDetail" }
1061
1062
  );
@@ -1064,32 +1065,32 @@ function assertSearchWithDetailOpts(opts) {
1064
1065
  }
1065
1066
  async function searchWithFamily(_resource, query, opts = {}, http) {
1066
1067
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1067
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1068
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1068
1069
  }
1069
1070
  for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
1070
1071
  if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
1071
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1072
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
1072
1073
  `companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
1073
1074
  { operation: "companies.search" }
1074
1075
  );
1075
1076
  }
1076
1077
  }
1077
1078
  if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
1078
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1079
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1079
1080
  operation: "companies.search"
1080
1081
  });
1081
1082
  }
1082
1083
  const text = query.trim();
1083
- if (text === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1084
- const limit = opts.limit === void 0 ? 25 : _chunkLLIB4JGKcjs.clampPageSize.call(void 0, opts.limit);
1084
+ if (text === "") throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1085
+ const limit = opts.limit === void 0 ? 25 : _chunkIKPFR6K2cjs.clampPageSize.call(void 0, opts.limit);
1085
1086
  const res = await http.request({
1086
1087
  method: "POST",
1087
1088
  idempotent: true,
1088
1089
  path: "/V1.0/Companies/query",
1089
- body: { MaxRecords: limit, filter: _chunkLLIB4JGKcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1090
+ body: { MaxRecords: limit, filter: _chunkIKPFR6K2cjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1090
1091
  operation: "companies.search"
1091
1092
  });
1092
- const hits = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "companies.search").items;
1093
+ const hits = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, "companies.search").items;
1093
1094
  if (opts.includeFamily !== true) return hits;
1094
1095
  const rows = [];
1095
1096
  for (const hit of hits) {
@@ -1109,7 +1110,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
1109
1110
  }
1110
1111
 
1111
1112
  // src/resources/special/companies/errors.ts
1112
- var OwnerResourceRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1113
+ var OwnerResourceRequiredError = class extends _chunkIKPFR6K2cjs.AutotaskError {
1113
1114
  constructor(message, options = {}) {
1114
1115
  super(message, {
1115
1116
  code: "OWNER_RESOURCE_REQUIRED",
@@ -1120,13 +1121,13 @@ var OwnerResourceRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1120
1121
  this.name = "OwnerResourceRequiredError";
1121
1122
  }
1122
1123
  };
1123
- var CompanyResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1124
+ var CompanyResourceInvalidError = class extends _chunkIKPFR6K2cjs.AutotaskError {
1124
1125
  constructor(message, options = {}) {
1125
1126
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
1126
1127
  this.name = "CompanyResourceInvalidError";
1127
1128
  }
1128
1129
  };
1129
- var CompanyCreateFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1130
+ var CompanyCreateFailedError = class extends _chunkIKPFR6K2cjs.AutotaskError {
1130
1131
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
1131
1132
 
1132
1133
  constructor(message, vendorFields, options = {}) {
@@ -1145,23 +1146,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
1145
1146
  var SAFE_COMPANY_CREATE_DEFAULTS = {};
1146
1147
  function validateUpsertInput(companyName, params) {
1147
1148
  if (typeof companyName !== "string" || companyName.trim() === "") {
1148
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1149
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1149
1150
  }
1150
1151
  if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
1151
- throw new (0, _chunkLLIB4JGKcjs.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 });
1152
+ throw new (0, _chunkIKPFR6K2cjs.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 });
1152
1153
  }
1153
1154
  const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
1154
1155
  if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
1155
- throw new (0, _chunkLLIB4JGKcjs.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 });
1156
+ throw new (0, _chunkIKPFR6K2cjs.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 });
1156
1157
  }
1157
1158
  const owner = params.ownerResourceID;
1158
1159
  if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
1159
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1160
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1160
1161
  }
1161
1162
  return { companyType, owner };
1162
1163
  }
1163
1164
  function existsDryRun(http, companyName, match) {
1164
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
1165
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
1165
1166
  {
1166
1167
  operation: OP_UPSERT_NAME,
1167
1168
  method: "POST",
@@ -1187,7 +1188,7 @@ function createDryRun(http, body, owner) {
1187
1188
  "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"
1188
1189
  );
1189
1190
  }
1190
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
1191
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
1191
1192
  {
1192
1193
  operation: OP_UPSERT_NAME,
1193
1194
  method: "POST",
@@ -1232,8 +1233,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1232
1233
  sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
1233
1234
  };
1234
1235
  } catch (err) {
1235
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1236
- const named = (_nullishCoalesce(_chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1236
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1237
+ const named = (_nullishCoalesce(_chunkIKPFR6K2cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1237
1238
  const seen = /* @__PURE__ */ new Set();
1238
1239
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
1239
1240
  const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
@@ -1247,7 +1248,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1247
1248
  }
1248
1249
  continue;
1249
1250
  }
1250
- const detail = _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError);
1251
+ const detail = _chunkIKPFR6K2cjs.formatVendorDetail.call(void 0, err.vendorError);
1251
1252
  throw new CompanyCreateFailedError(
1252
1253
  `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}` : ""}`,
1253
1254
  unique,
@@ -1321,7 +1322,7 @@ async function readFields(http, fresh) {
1321
1322
  const res = await http.request({ method: "GET", path: "/V1.0/Tickets/entityInformation/fields", operation: OP, maxRetries: 0 });
1322
1323
  const fields = _optionalChain([res, 'optionalAccess', _21 => _21.fields]);
1323
1324
  if (!Array.isArray(fields)) {
1324
- throw new (0, _chunkLLIB4JGKcjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1325
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1325
1326
  }
1326
1327
  _optionalChain([cache, 'optionalAccess', _22 => _22.set, 'call', _23 => _23(key, "fields", fields)]);
1327
1328
  return fields;
@@ -1340,7 +1341,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1340
1341
  if (opts.excludeStatusIds !== void 0) {
1341
1342
  const closedIds2 = [...new Set(opts.excludeStatusIds.map((id) => Number(id)))];
1342
1343
  if (closedIds2.length === 0 || closedIds2.some((id) => !Number.isSafeInteger(id) || id < 1)) {
1343
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
1344
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
1344
1345
  }
1345
1346
  return { picklist: [], closedIds: closedIds2, source: "picklist", note: `closed = status ${closedIds2.join(", ")} \u2014 supplied by the caller` };
1346
1347
  }
@@ -1348,7 +1349,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1348
1349
  try {
1349
1350
  fields = await readFields(http, opts.fresh === true);
1350
1351
  } catch (e) {
1351
- if (e instanceof _chunkLLIB4JGKcjs.AutotaskError && e.code === "ABORTED") throw e;
1352
+ if (e instanceof _chunkIKPFR6K2cjs.AutotaskError && e.code === "ABORTED") throw e;
1352
1353
  return assumed();
1353
1354
  }
1354
1355
  const picklist = picklistOf(fields);
@@ -1384,30 +1385,30 @@ var LOCATION_LIMIT_MAX = 500;
1384
1385
  function locationLimit(value) {
1385
1386
  if (value === void 0) return PROFILE_PART_LIMIT;
1386
1387
  if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
1387
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1388
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1388
1389
  }
1389
1390
  return value;
1390
1391
  }
1391
1392
  function validateProjection(fields) {
1392
1393
  if (fields === void 0) return {};
1393
1394
  if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
1394
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1395
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1395
1396
  }
1396
1397
  const out = {};
1397
1398
  for (const [part, list] of Object.entries(fields)) {
1398
1399
  if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
1399
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1400
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1400
1401
  }
1401
1402
  if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
1402
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1403
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1403
1404
  }
1404
1405
  const names = [...new Set(list)];
1405
1406
  const entity = PART_ENTITY[part];
1406
- const known = _nullishCoalesce(_chunkLLIB4JGKcjs.MODEL_FIELD_SETS[entity], () => ( []));
1407
+ const known = _nullishCoalesce(_chunkIKPFR6K2cjs.MODEL_FIELD_SETS[entity], () => ( []));
1407
1408
  const unknown = names.filter((n) => !known.includes(n));
1408
1409
  if (unknown.length > 0) {
1409
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1410
- `fullProfile: fields.${part} has unknown field name(s) ${_chunkLLIB4JGKcjs.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`
1410
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
1411
+ `fullProfile: fields.${part} has unknown field name(s) ${_chunkIKPFR6K2cjs.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`
1411
1412
  );
1412
1413
  }
1413
1414
  out[part] = names;
@@ -1424,7 +1425,7 @@ function project(items, names) {
1424
1425
  function profilePartLimit(value, name) {
1425
1426
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
1426
1427
  if (!Number.isInteger(n) || n < 1) {
1427
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1428
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1428
1429
  }
1429
1430
  return n;
1430
1431
  }
@@ -1436,7 +1437,7 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
1436
1437
  body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
1437
1438
  operation: "companies.fullProfile"
1438
1439
  });
1439
- return project(_chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items, includeFields);
1440
+ return project(_chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items, includeFields);
1440
1441
  }
1441
1442
  async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1442
1443
  const semantics = await resolveTicketStatusSemantics(http);
@@ -1453,7 +1454,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1453
1454
  },
1454
1455
  operation: "companies.fullProfile"
1455
1456
  });
1456
- return project(_chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items, includeFields);
1457
+ return project(_chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items, includeFields);
1457
1458
  })();
1458
1459
  const closedStatus = { closedIds: semantics.closedIds, source: semantics.source, note: semantics.note };
1459
1460
  const partNote = semantics.source === "assumed" ? OPEN_TICKETS_NOTE : semantics.note;
@@ -1465,7 +1466,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1465
1466
  closedStatus
1466
1467
  };
1467
1468
  if (openRows.length === 0) {
1468
- const stamp = _chunkLLIB4JGKcjs.blindStampFor.call(void 0, _optionalChain([_chunkLLIB4JGKcjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
1469
+ const stamp = _chunkIKPFR6K2cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKPFR6K2cjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
1469
1470
  if (stamp !== void 0) {
1470
1471
  openTickets = {
1471
1472
  items: openRows,
@@ -1480,7 +1481,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1480
1481
  return openTickets;
1481
1482
  }
1482
1483
  async function addProfileNames(http, company, openTickets, projects, result, opts) {
1483
- const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS);
1484
+ const builder = _chunkIKPFR6K2cjs.createNamePlan.call(void 0, _chunkIKPFR6K2cjs.TICKET_LABEL_FIELDS);
1484
1485
  const c = company;
1485
1486
  builder.addResource(c["ownerResourceID"]);
1486
1487
  builder.addResource(c["createdByResourceID"]);
@@ -1497,20 +1498,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1497
1498
  builder.addResource(r["creatorResourceID"]);
1498
1499
  builder.addFk("contract", r["contractID"]);
1499
1500
  }
1500
- const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1501
+ const names = await _chunkIKPFR6K2cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1501
1502
  const companyRow = { ...company };
1502
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1503
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1503
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1504
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1504
1505
  result.company = companyRow;
1505
1506
  result.openTickets = {
1506
1507
  ...openTickets,
1507
1508
  items: openTickets.items.map((row) => {
1508
1509
  const r = { ...row };
1509
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1510
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1511
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1512
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1513
- for (const f of _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS) _chunkLLIB4JGKcjs.addLabelSibling.call(void 0, r, f, names);
1510
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1511
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1512
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1513
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1514
+ for (const f of _chunkIKPFR6K2cjs.TICKET_LABEL_FIELDS) _chunkIKPFR6K2cjs.addLabelSibling.call(void 0, r, f, names);
1514
1515
  return r;
1515
1516
  })
1516
1517
  };
@@ -1518,9 +1519,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1518
1519
  ...result.projects,
1519
1520
  items: result.projects.items.map((row) => {
1520
1521
  const r = { ...row };
1521
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1522
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1523
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1522
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1523
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1524
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1524
1525
  return r;
1525
1526
  })
1526
1527
  };
@@ -1533,7 +1534,7 @@ async function fullProfile(resource, id, opts = {}, http) {
1533
1534
  const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
1534
1535
  const locLimit = locationLimit(opts.locationLimit);
1535
1536
  const proj = validateProjection(opts.fields);
1536
- const companyID = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
1537
+ const companyID = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
1537
1538
  const company = await resource.get(companyID);
1538
1539
  const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
1539
1540
  const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
@@ -1580,7 +1581,7 @@ var UNBILLED_WORK_OPT_KEYS = [
1580
1581
  var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
1581
1582
  function validateUnbilledWorkOptions(companyId, opts) {
1582
1583
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1583
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1584
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
1584
1585
  `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
1585
1586
  { operation: "companies.unbilledWork" }
1586
1587
  );
@@ -1609,7 +1610,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1609
1610
  try {
1610
1611
  limit = clampLimit(opts.limit);
1611
1612
  } catch (err) {
1612
- problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1613
+ problems.push(err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1613
1614
  limit = 50;
1614
1615
  }
1615
1616
  if (source === "date_range") {
@@ -1624,9 +1625,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
1624
1625
  problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
1625
1626
  } else {
1626
1627
  try {
1627
- _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1628
+ _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1628
1629
  } catch (err) {
1629
- problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1630
+ problems.push(err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1630
1631
  }
1631
1632
  }
1632
1633
  }
@@ -1636,20 +1637,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
1636
1637
  } else {
1637
1638
  opts.ticketIds.forEach((tid, i) => {
1638
1639
  try {
1639
- _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1640
+ _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1640
1641
  } catch (err) {
1641
- problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1642
+ problems.push(err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1642
1643
  }
1643
1644
  });
1644
1645
  }
1645
1646
  }
1646
1647
  try {
1647
- _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyId, "companyId");
1648
+ _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, companyId, "companyId");
1648
1649
  } catch (err) {
1649
- problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1650
+ problems.push(err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1650
1651
  }
1651
1652
  if (problems.length > 0) {
1652
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1653
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
1653
1654
  `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
1654
1655
  - ` + problems.join("\n- "),
1655
1656
  { operation: "companies.unbilledWork" }
@@ -1678,7 +1679,7 @@ function capJoinSet(ids2, cap) {
1678
1679
  }
1679
1680
  function unbilledWorkPartStatus(key, conditions, items) {
1680
1681
  if (items.length !== 0) return { status: "ok" };
1681
- const stamp = _chunkLLIB4JGKcjs.blindStampFor.call(void 0, _optionalChain([_chunkLLIB4JGKcjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1682
+ const stamp = _chunkIKPFR6K2cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKPFR6K2cjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1682
1683
  if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
1683
1684
  return {
1684
1685
  status: "ok",
@@ -1698,7 +1699,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
1698
1699
  parentStatus = "ok";
1699
1700
  companyIds.push(num(parent.id));
1700
1701
  } catch (err) {
1701
- if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) parent = null;
1702
+ if (err instanceof _chunkIKPFR6K2cjs.NotFoundError) parent = null;
1702
1703
  else throw err;
1703
1704
  }
1704
1705
  }
@@ -1736,14 +1737,14 @@ async function readBillingPart(http, v, companyIds) {
1736
1737
  if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
1737
1738
  if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
1738
1739
  }
1739
- const billingFields = _chunkLLIB4JGKcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1740
+ const billingFields = _chunkIKPFR6K2cjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1740
1741
  const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
1741
1742
  const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP2, billingIncludeFields);
1742
1743
  let billingItems = billingRaw.items;
1743
1744
  let billingNoteCharsTruncated = 0;
1744
1745
  if (v.includeNotes) {
1745
- const noteFields = (_nullishCoalesce(_chunkLLIB4JGKcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1746
- [billingItems, billingNoteCharsTruncated] = _chunkLLIB4JGKcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1746
+ const noteFields = (_nullishCoalesce(_chunkIKPFR6K2cjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1747
+ [billingItems, billingNoteCharsTruncated] = _chunkIKPFR6K2cjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1747
1748
  }
1748
1749
  const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
1749
1750
  const billingItemsPart = {
@@ -1787,7 +1788,7 @@ async function readTimePart(http, v, join) {
1787
1788
  let cappedItems = entries;
1788
1789
  let noteCharsTruncated = 0;
1789
1790
  if (v.includeNotes) {
1790
- [cappedItems, noteCharsTruncated] = _chunkLLIB4JGKcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1791
+ [cappedItems, noteCharsTruncated] = _chunkIKPFR6K2cjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1791
1792
  }
1792
1793
  const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
1793
1794
  timePart = {
@@ -1875,7 +1876,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
1875
1876
  }
1876
1877
  async function unbilledWork(resource, companyId, opts = {}, http) {
1877
1878
  const v = validateUnbilledWorkOptions(companyId, opts);
1878
- const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyId, "companyId");
1879
+ const id = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, companyId, "companyId");
1879
1880
  const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
1880
1881
  const join = await readJoinSets(http, companyIds, v);
1881
1882
  const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
@@ -1902,7 +1903,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
1902
1903
  }
1903
1904
 
1904
1905
  // src/resources/companies.ts
1905
- var CompaniesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
1906
+ var CompaniesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
1906
1907
  constructor(http, pageSize) {
1907
1908
  super(http, {
1908
1909
  key: "companies",
@@ -2009,7 +2010,7 @@ var CompaniesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2009
2010
  };
2010
2011
 
2011
2012
  // src/resources/company_alerts.ts
2012
- var CompanyAlertsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2013
+ var CompanyAlertsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2013
2014
  constructor(http, pageSize) {
2014
2015
  super(http, {
2015
2016
  key: "company_alerts",
@@ -2075,7 +2076,7 @@ var CompanyAlertsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2075
2076
  };
2076
2077
 
2077
2078
  // src/resources/company_locations.ts
2078
- var CompanyLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2079
+ var CompanyLocationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2079
2080
  constructor(http, pageSize) {
2080
2081
  super(http, {
2081
2082
  key: "company_locations",
@@ -2146,7 +2147,7 @@ var CompanyLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2146
2147
  };
2147
2148
 
2148
2149
  // src/resources/company_notes.ts
2149
- var CompanyNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2150
+ var CompanyNotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2150
2151
  constructor(http, pageSize) {
2151
2152
  super(http, {
2152
2153
  key: "company_notes",
@@ -2211,7 +2212,7 @@ var CompanyNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2211
2212
  };
2212
2213
 
2213
2214
  // src/resources/company_site_configurations.ts
2214
- var CompanySiteConfigurationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2215
+ var CompanySiteConfigurationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2215
2216
  constructor(http, pageSize) {
2216
2217
  super(http, {
2217
2218
  key: "company_site_configurations",
@@ -2262,7 +2263,7 @@ var CompanySiteConfigurationsResource = class extends _chunkLLIB4JGKcjs.BaseReso
2262
2263
  };
2263
2264
 
2264
2265
  // src/resources/company_webhooks.ts
2265
- var CompanyWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2266
+ var CompanyWebhooksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2266
2267
  constructor(http, pageSize) {
2267
2268
  super(http, {
2268
2269
  key: "company_webhooks",
@@ -2338,7 +2339,7 @@ var CompanyWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2338
2339
  };
2339
2340
 
2340
2341
  // src/resources/configuration_item_billing_product_associations.ts
2341
- var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2342
+ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2342
2343
  constructor(http, pageSize) {
2343
2344
  super(http, {
2344
2345
  key: "configuration_item_billing_product_associations",
@@ -2404,7 +2405,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLL
2404
2405
  };
2405
2406
 
2406
2407
  // src/resources/configuration_item_categories.ts
2407
- var ConfigurationItemCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2408
+ var ConfigurationItemCategoriesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2408
2409
  constructor(http, pageSize) {
2409
2410
  super(http, {
2410
2411
  key: "configuration_item_categories",
@@ -2471,7 +2472,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseRe
2471
2472
  };
2472
2473
 
2473
2474
  // src/resources/configuration_item_category_udf_associations.ts
2474
- var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2475
+ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2475
2476
  constructor(http, pageSize) {
2476
2477
  super(http, {
2477
2478
  key: "configuration_item_category_udf_associations",
@@ -2537,7 +2538,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLLIB4
2537
2538
  };
2538
2539
 
2539
2540
  // src/resources/configuration_item_dns_records.ts
2540
- var ConfigurationItemDnsRecordsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2541
+ var ConfigurationItemDnsRecordsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2541
2542
  constructor(http, pageSize) {
2542
2543
  super(http, {
2543
2544
  key: "configuration_item_dns_records",
@@ -2586,7 +2587,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkLLIB4JGKcjs.BaseRe
2586
2587
  };
2587
2588
 
2588
2589
  // src/resources/configuration_item_notes.ts
2589
- var ConfigurationItemNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2590
+ var ConfigurationItemNotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2590
2591
  constructor(http, pageSize) {
2591
2592
  super(http, {
2592
2593
  key: "configuration_item_notes",
@@ -2645,7 +2646,7 @@ var ConfigurationItemNotesResource = class extends _chunkLLIB4JGKcjs.BaseResourc
2645
2646
  };
2646
2647
 
2647
2648
  // src/resources/configuration_item_related_items.ts
2648
- var ConfigurationItemRelatedItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2649
+ var ConfigurationItemRelatedItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2649
2650
  constructor(http, pageSize) {
2650
2651
  super(http, {
2651
2652
  key: "configuration_item_related_items",
@@ -2706,16 +2707,16 @@ async function fetchRecord(http, path, label, readOpts) {
2706
2707
  const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _32 => _32.maxRetries]) });
2707
2708
  const body = res;
2708
2709
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
2709
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2710
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2710
2711
  }
2711
2712
  return body.item;
2712
2713
  }
2713
2714
  async function moveConfigurationItem(_resource, sourceId, opts, http) {
2714
- const numericSource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2715
+ const numericSource = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2715
2716
  if (_optionalChain([opts, 'optionalAccess', _33 => _33.destinationCompanyId]) === void 0) {
2716
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2717
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2717
2718
  }
2718
- const destId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2719
+ const destId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2719
2720
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
2720
2721
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
2721
2722
  const body = { ...source };
@@ -2725,20 +2726,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2725
2726
  body.companyID = destId;
2726
2727
  body.isActive = true;
2727
2728
  if (opts.newReferenceTitle !== void 0) {
2728
- if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2729
+ if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2729
2730
  body.referenceTitle = opts.newReferenceTitle.trim();
2730
2731
  }
2731
2732
  if (opts.lastModifiedDate !== void 0) {
2732
2733
  const current = source.lastModifiedDate;
2733
2734
  if (current !== opts.lastModifiedDate) {
2734
- throw new (0, _chunkLLIB4JGKcjs.StaleObjectError)(
2735
+ throw new (0, _chunkIKPFR6K2cjs.StaleObjectError)(
2735
2736
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
2736
2737
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
2737
2738
  );
2738
2739
  }
2739
2740
  }
2740
2741
  if (opts.dryRun === true) {
2741
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
2742
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
2742
2743
  operation: "configuration_items.moveConfigurationItem",
2743
2744
  method: "POST",
2744
2745
  path: "/V1.0/ConfigurationItems",
@@ -2763,7 +2764,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2763
2764
  const createdBody = created;
2764
2765
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
2765
2766
  if (typeof newId !== "number") {
2766
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2767
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2767
2768
  }
2768
2769
  let sourceDeactivated = false;
2769
2770
  if (opts.deactivateSource !== false) {
@@ -2782,7 +2783,7 @@ var PROFILE_PART_LIMIT2 = 50;
2782
2783
  function profilePartLimit2(value, name) {
2783
2784
  const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
2784
2785
  if (!Number.isInteger(n) || n < 1) {
2785
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2786
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2786
2787
  }
2787
2788
  return n;
2788
2789
  }
@@ -2798,14 +2799,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
2798
2799
  });
2799
2800
  const body = res;
2800
2801
  if (body === null || !("item" in body)) {
2801
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2802
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2802
2803
  }
2803
2804
  if (body.item === null || body.item === void 0) {
2804
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2805
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2805
2806
  }
2806
2807
  return body.item;
2807
2808
  } catch (err) {
2808
- if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) return null;
2809
+ if (err instanceof _chunkIKPFR6K2cjs.NotFoundError) return null;
2809
2810
  throw err;
2810
2811
  }
2811
2812
  }
@@ -2817,7 +2818,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
2817
2818
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
2818
2819
  operation: "configuration_items.profile"
2819
2820
  });
2820
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
2821
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
2821
2822
  }
2822
2823
  async function profile(resource, id, opts = {}, http) {
2823
2824
  const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
@@ -2829,7 +2830,7 @@ async function profile(resource, id, opts = {}, http) {
2829
2830
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
2830
2831
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
2831
2832
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
2832
- const wallQuirk = _optionalChain([_chunkLLIB4JGKcjs.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"))]);
2833
+ const wallQuirk = _optionalChain([_chunkIKPFR6K2cjs.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"))]);
2833
2834
  const productAssociations = {
2834
2835
  items: associations,
2835
2836
  capped: associations.length >= PROFILE_PART_LIMIT2,
@@ -2853,11 +2854,11 @@ async function profile(resource, id, opts = {}, http) {
2853
2854
  }
2854
2855
  };
2855
2856
  if (opts.names === true) {
2856
- const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, );
2857
+ const builder = _chunkIKPFR6K2cjs.createNamePlan.call(void 0, );
2857
2858
  builder.addFk("contract", root["contractID"]);
2858
- const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2859
+ const names = await _chunkIKPFR6K2cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2859
2860
  const ciRow = { ...ci };
2860
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2861
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2861
2862
  result.ci = ciRow;
2862
2863
  result.names = names.section;
2863
2864
  }
@@ -2865,7 +2866,7 @@ async function profile(resource, id, opts = {}, http) {
2865
2866
  }
2866
2867
 
2867
2868
  // src/resources/configuration_items.ts
2868
- var ConfigurationItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2869
+ var ConfigurationItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2869
2870
  constructor(http, pageSize) {
2870
2871
  super(http, {
2871
2872
  key: "configuration_items",
@@ -2954,7 +2955,7 @@ var ConfigurationItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2954
2955
  };
2955
2956
 
2956
2957
  // src/resources/configuration_item_ssl_subject_alternative_names.ts
2957
- var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2958
+ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
2958
2959
  constructor(http, pageSize) {
2959
2960
  super(http, {
2960
2961
  key: "configuration_item_ssl_subject_alternative_names",
@@ -3017,7 +3018,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLL
3017
3018
  };
3018
3019
 
3019
3020
  // src/resources/configuration_item_types.ts
3020
- var ConfigurationItemTypesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3021
+ var ConfigurationItemTypesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3021
3022
  constructor(http, pageSize) {
3022
3023
  super(http, {
3023
3024
  key: "configuration_item_types",
@@ -3091,7 +3092,7 @@ var ConfigurationItemTypesResource = class extends _chunkLLIB4JGKcjs.BaseResourc
3091
3092
  };
3092
3093
 
3093
3094
  // src/resources/configuration_item_webhooks.ts
3094
- var ConfigurationItemWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3095
+ var ConfigurationItemWebhooksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3095
3096
  constructor(http, pageSize) {
3096
3097
  super(http, {
3097
3098
  key: "configuration_item_webhooks",
@@ -3167,7 +3168,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseReso
3167
3168
  };
3168
3169
 
3169
3170
  // src/resources/contact_group_contacts.ts
3170
- var ContactGroupContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3171
+ var ContactGroupContactsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3171
3172
  constructor(http, pageSize) {
3172
3173
  super(http, {
3173
3174
  key: "contact_group_contacts",
@@ -3221,7 +3222,7 @@ var ContactGroupContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource
3221
3222
  };
3222
3223
 
3223
3224
  // src/resources/contact_groups.ts
3224
- var ContactGroupsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3225
+ var ContactGroupsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3225
3226
  constructor(http, pageSize) {
3226
3227
  super(http, {
3227
3228
  key: "contact_groups",
@@ -3299,22 +3300,22 @@ async function fetchRecord2(http, path, label, readOpts) {
3299
3300
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _44 => _44.maxRetries]) });
3300
3301
  const body = res;
3301
3302
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
3302
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3303
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3303
3304
  }
3304
3305
  return body.item;
3305
3306
  }
3306
3307
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
3307
- const sourceId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3308
- const destId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3308
+ const sourceId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3309
+ const destId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3309
3310
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
3310
3311
  const companyID = source.companyID;
3311
3312
  if (typeof companyID !== "number" || companyID < 0) {
3312
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3313
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3313
3314
  }
3314
3315
  if (opts.lastModifiedDate !== void 0) {
3315
3316
  const current = source.lastModifiedDate;
3316
3317
  if (current !== opts.lastModifiedDate) {
3317
- throw new (0, _chunkLLIB4JGKcjs.StaleObjectError)(
3318
+ throw new (0, _chunkIKPFR6K2cjs.StaleObjectError)(
3318
3319
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
3319
3320
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3320
3321
  );
@@ -3336,10 +3337,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3336
3337
  },
3337
3338
  operation: "contacts.moveToCompany"
3338
3339
  });
3339
- const items = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
3340
+ const items = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
3340
3341
  const clash = items.find((c) => String(c.id) !== String(sourceId));
3341
3342
  if (clash !== void 0) {
3342
- throw new (0, _chunkLLIB4JGKcjs.ConflictError)(
3343
+ throw new (0, _chunkIKPFR6K2cjs.ConflictError)(
3343
3344
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
3344
3345
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3345
3346
  );
@@ -3353,7 +3354,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3353
3354
  if (opts.dryRun === true) {
3354
3355
  const warnings = [];
3355
3356
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
3356
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
3357
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
3357
3358
  operation: "contacts.moveToCompany",
3358
3359
  method: "POST",
3359
3360
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -3379,7 +3380,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3379
3380
  const createdBody = created;
3380
3381
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
3381
3382
  if (typeof newId !== "number") {
3382
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3383
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3383
3384
  }
3384
3385
  let sourceDeleted = false;
3385
3386
  if (opts.deleteSource === true) {
@@ -3398,7 +3399,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
3398
3399
  var EMAIL_SHAPE = /^.+@.+/;
3399
3400
  var SAFE_CONTACT_CREATE_DEFAULTS = {};
3400
3401
  var DEDUP_LIMIT = 10;
3401
- var CompanyNotFoundError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3402
+ var CompanyNotFoundError = class extends _chunkIKPFR6K2cjs.AutotaskError {
3402
3403
  constructor(message, options = {}) {
3403
3404
  super(message, {
3404
3405
  code: "COMPANY_NOT_FOUND",
@@ -3409,7 +3410,7 @@ var CompanyNotFoundError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3409
3410
  this.name = "CompanyNotFoundError";
3410
3411
  }
3411
3412
  };
3412
- var ContactCreateFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3413
+ var ContactCreateFailedError = class extends _chunkIKPFR6K2cjs.AutotaskError {
3413
3414
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
3414
3415
 
3415
3416
  constructor(message, vendorFields, options = {}) {
@@ -3419,25 +3420,25 @@ var ContactCreateFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3419
3420
  }
3420
3421
  };
3421
3422
  async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3422
- const cid = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyID, "companyID");
3423
+ const cid = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, companyID, "companyID");
3423
3424
  if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
3424
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
3425
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
3425
3426
  `upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
3426
3427
  { operation: OP_UPSERT_EMAIL }
3427
3428
  );
3428
3429
  }
3429
3430
  if (extra !== void 0) {
3430
3431
  if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
3431
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
3432
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
3432
3433
  `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)})`,
3433
3434
  { operation: OP_UPSERT_EMAIL }
3434
3435
  );
3435
3436
  }
3436
3437
  if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
3437
- throw new (0, _chunkLLIB4JGKcjs.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 });
3438
+ throw new (0, _chunkIKPFR6K2cjs.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 });
3438
3439
  }
3439
3440
  if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
3440
- throw new (0, _chunkLLIB4JGKcjs.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 });
3441
+ throw new (0, _chunkIKPFR6K2cjs.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 });
3441
3442
  }
3442
3443
  }
3443
3444
  const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
@@ -3458,7 +3459,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3458
3459
  const match = q.items[0];
3459
3460
  if (match !== void 0) {
3460
3461
  if (opts.dryRun === true) {
3461
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
3462
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
3462
3463
  {
3463
3464
  operation: OP_UPSERT_EMAIL,
3464
3465
  method: "POST",
@@ -3488,7 +3489,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3488
3489
  isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
3489
3490
  };
3490
3491
  if (opts.dryRun === true) {
3491
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
3492
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
3492
3493
  {
3493
3494
  operation: OP_UPSERT_EMAIL,
3494
3495
  method: "POST",
@@ -3511,8 +3512,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3511
3512
  const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
3512
3513
  return { id: created.id, created: true };
3513
3514
  } catch (err) {
3514
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3515
- const named = (_nullishCoalesce(_chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3515
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3516
+ const named = (_nullishCoalesce(_chunkIKPFR6K2cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3516
3517
  const seen = /* @__PURE__ */ new Set();
3517
3518
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
3518
3519
  const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
@@ -3526,7 +3527,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3526
3527
  }
3527
3528
  continue;
3528
3529
  }
3529
- const detail = _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError);
3530
+ const detail = _chunkIKPFR6K2cjs.formatVendorDetail.call(void 0, err.vendorError);
3530
3531
  throw new ContactCreateFailedError(
3531
3532
  `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}` : ""}`,
3532
3533
  unique,
@@ -3543,7 +3544,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3543
3544
  }
3544
3545
 
3545
3546
  // src/resources/contacts.ts
3546
- var ContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3547
+ var ContactsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3547
3548
  constructor(http, pageSize) {
3548
3549
  super(http, {
3549
3550
  key: "contacts",
@@ -3635,7 +3636,7 @@ var ContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3635
3636
  };
3636
3637
 
3637
3638
  // src/resources/contact_webhooks.ts
3638
- var ContactWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3639
+ var ContactWebhooksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3639
3640
  constructor(http, pageSize) {
3640
3641
  super(http, {
3641
3642
  key: "contact_webhooks",
@@ -3711,7 +3712,7 @@ var ContactWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3711
3712
  };
3712
3713
 
3713
3714
  // src/resources/contract_billing_rules.ts
3714
- var ContractBillingRulesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3715
+ var ContractBillingRulesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3715
3716
  constructor(http, pageSize) {
3716
3717
  super(http, {
3717
3718
  key: "contract_billing_rules",
@@ -3777,7 +3778,7 @@ var ContractBillingRulesResource = class extends _chunkLLIB4JGKcjs.BaseResource
3777
3778
  };
3778
3779
 
3779
3780
  // src/resources/contract_block_hour_factors.ts
3780
- var ContractBlockHourFactorsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3781
+ var ContractBlockHourFactorsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3781
3782
  constructor(http, pageSize) {
3782
3783
  super(http, {
3783
3784
  key: "contract_block_hour_factors",
@@ -3836,7 +3837,7 @@ var ContractBlockHourFactorsResource = class extends _chunkLLIB4JGKcjs.BaseResou
3836
3837
  };
3837
3838
 
3838
3839
  // src/resources/contract_blocks.ts
3839
- var ContractBlocksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3840
+ var ContractBlocksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3840
3841
  constructor(http, pageSize) {
3841
3842
  super(http, {
3842
3843
  key: "contract_blocks",
@@ -3895,7 +3896,7 @@ var ContractBlocksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3895
3896
  };
3896
3897
 
3897
3898
  // src/resources/contract_charges.ts
3898
- var ContractChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3899
+ var ContractChargesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3899
3900
  constructor(http, pageSize) {
3900
3901
  super(http, {
3901
3902
  key: "contract_charges",
@@ -3966,7 +3967,7 @@ var ContractChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3966
3967
  };
3967
3968
 
3968
3969
  // src/resources/contract_exclusion_billing_codes.ts
3969
- var ContractExclusionBillingCodesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3970
+ var ContractExclusionBillingCodesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
3970
3971
  constructor(http, pageSize) {
3971
3972
  super(http, {
3972
3973
  key: "contract_exclusion_billing_codes",
@@ -4023,7 +4024,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkLLIB4JGKcjs.Base
4023
4024
  };
4024
4025
 
4025
4026
  // src/resources/contract_exclusion_roles.ts
4026
- var ContractExclusionRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4027
+ var ContractExclusionRolesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4027
4028
  constructor(http, pageSize) {
4028
4029
  super(http, {
4029
4030
  key: "contract_exclusion_roles",
@@ -4080,7 +4081,7 @@ var ContractExclusionRolesResource = class extends _chunkLLIB4JGKcjs.BaseResourc
4080
4081
  };
4081
4082
 
4082
4083
  // src/resources/contract_exclusion_set_excluded_roles.ts
4083
- var ContractExclusionSetExcludedRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4084
+ var ContractExclusionSetExcludedRolesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4084
4085
  constructor(http, pageSize) {
4085
4086
  super(http, {
4086
4087
  key: "contract_exclusion_set_excluded_roles",
@@ -4137,7 +4138,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkLLIB4JGKcjs.
4137
4138
  };
4138
4139
 
4139
4140
  // src/resources/contract_exclusion_set_excluded_work_types.ts
4140
- var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4141
+ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4141
4142
  constructor(http, pageSize) {
4142
4143
  super(http, {
4143
4144
  key: "contract_exclusion_set_excluded_work_types",
@@ -4194,7 +4195,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLLIB4JGK
4194
4195
  };
4195
4196
 
4196
4197
  // src/resources/contract_exclusion_sets.ts
4197
- var ContractExclusionSetsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4198
+ var ContractExclusionSetsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4198
4199
  constructor(http, pageSize) {
4199
4200
  super(http, {
4200
4201
  key: "contract_exclusion_sets",
@@ -4268,7 +4269,7 @@ var ContractExclusionSetsResource = class extends _chunkLLIB4JGKcjs.BaseResource
4268
4269
  };
4269
4270
 
4270
4271
  // src/resources/contract_milestones.ts
4271
- var ContractMilestonesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4272
+ var ContractMilestonesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4272
4273
  constructor(http, pageSize) {
4273
4274
  super(http, {
4274
4275
  key: "contract_milestones",
@@ -4327,7 +4328,7 @@ var ContractMilestonesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4327
4328
  };
4328
4329
 
4329
4330
  // src/resources/contract_notes.ts
4330
- var ContractNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4331
+ var ContractNotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4331
4332
  constructor(http, pageSize) {
4332
4333
  super(http, {
4333
4334
  key: "contract_notes",
@@ -4386,7 +4387,7 @@ var ContractNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4386
4387
  };
4387
4388
 
4388
4389
  // src/resources/contract_rates.ts
4389
- var ContractRatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4390
+ var ContractRatesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4390
4391
  constructor(http, pageSize) {
4391
4392
  super(http, {
4392
4393
  key: "contract_rates",
@@ -4445,7 +4446,7 @@ var ContractRatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4445
4446
  };
4446
4447
 
4447
4448
  // src/resources/contract_retainers.ts
4448
- var ContractRetainersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4449
+ var ContractRetainersResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4449
4450
  constructor(http, pageSize) {
4450
4451
  super(http, {
4451
4452
  key: "contract_retainers",
@@ -4504,7 +4505,7 @@ var ContractRetainersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4504
4505
  };
4505
4506
 
4506
4507
  // src/resources/contract_role_costs.ts
4507
- var ContractRoleCostsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4508
+ var ContractRoleCostsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4508
4509
  constructor(http, pageSize) {
4509
4510
  super(http, {
4510
4511
  key: "contract_role_costs",
@@ -4563,7 +4564,7 @@ var ContractRoleCostsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4563
4564
  };
4564
4565
 
4565
4566
  // src/resources/contract_service_adjustments.ts
4566
- var ContractServiceAdjustmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4567
+ var ContractServiceAdjustmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4567
4568
  constructor(http, pageSize) {
4568
4569
  super(http, {
4569
4570
  key: "contract_service_adjustments",
@@ -4597,7 +4598,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkLLIB4JGKcjs.BaseRes
4597
4598
  };
4598
4599
 
4599
4600
  // src/resources/contract_service_bundle_adjustments.ts
4600
- var ContractServiceBundleAdjustmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4601
+ var ContractServiceBundleAdjustmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4601
4602
  constructor(http, pageSize) {
4602
4603
  super(http, {
4603
4604
  key: "contract_service_bundle_adjustments",
@@ -4631,7 +4632,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkLLIB4JGKcjs.B
4631
4632
  };
4632
4633
 
4633
4634
  // src/resources/contract_service_bundles.ts
4634
- var ContractServiceBundlesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4635
+ var ContractServiceBundlesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4635
4636
  constructor(http, pageSize) {
4636
4637
  super(http, {
4637
4638
  key: "contract_service_bundles",
@@ -4690,7 +4691,7 @@ var ContractServiceBundlesResource = class extends _chunkLLIB4JGKcjs.BaseResourc
4690
4691
  };
4691
4692
 
4692
4693
  // src/resources/contract_service_bundle_units.ts
4693
- var ContractServiceBundleUnitsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4694
+ var ContractServiceBundleUnitsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4694
4695
  constructor(http, pageSize) {
4695
4696
  super(http, {
4696
4697
  key: "contract_service_bundle_units",
@@ -4732,7 +4733,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkLLIB4JGKcjs.BaseRes
4732
4733
  };
4733
4734
 
4734
4735
  // src/resources/contract_services.ts
4735
- var ContractServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4736
+ var ContractServicesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4736
4737
  constructor(http, pageSize) {
4737
4738
  super(http, {
4738
4739
  key: "contract_services",
@@ -4791,7 +4792,7 @@ var ContractServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4791
4792
  };
4792
4793
 
4793
4794
  // src/resources/contract_service_units.ts
4794
- var ContractServiceUnitsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4795
+ var ContractServiceUnitsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
4795
4796
  constructor(http, pageSize) {
4796
4797
  super(http, {
4797
4798
  key: "contract_service_units",
@@ -4837,7 +4838,7 @@ var OP3 = "contracts.lineOfBusiness";
4837
4838
  function positiveId(value, name) {
4838
4839
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
4839
4840
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
4840
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(OP3 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP3 });
4841
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(OP3 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP3 });
4841
4842
  }
4842
4843
  return n;
4843
4844
  }
@@ -4851,7 +4852,7 @@ async function lineOfBusiness(resource, contractIdIn, http, associationIdIn) {
4851
4852
  } else {
4852
4853
  associationSource = "contract";
4853
4854
  const contract = await resource.get(contractId);
4854
- associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
4855
+ associationId = _chunkIKPFR6K2cjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
4855
4856
  }
4856
4857
  if (associationId === void 0) {
4857
4858
  return {
@@ -4863,7 +4864,7 @@ async function lineOfBusiness(resource, contractIdIn, http, associationIdIn) {
4863
4864
  markers: { association: "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
4864
4865
  };
4865
4866
  }
4866
- const chain = await _chunkLLIB4JGKcjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP3, onError: "propagate" });
4867
+ const chain = await _chunkIKPFR6K2cjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP3, onError: "propagate" });
4867
4868
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
4868
4869
  return { contractId, associationSource, association, organizationalLevel2, organizationalLevel1, markers };
4869
4870
  }
@@ -5095,7 +5096,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
5095
5096
  // src/resources/special/contracts/profitability.validate.ts
5096
5097
  function validateProfitabilityOptions(contractId, opts) {
5097
5098
  if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
5098
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
5099
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
5099
5100
  `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})`,
5100
5101
  { operation: "contracts.profitability" }
5101
5102
  );
@@ -5172,12 +5173,12 @@ function validateProfitabilityOptions(contractId, opts) {
5172
5173
  }
5173
5174
  }
5174
5175
  try {
5175
- _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, contractId, "contractId");
5176
+ _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, contractId, "contractId");
5176
5177
  } catch (err) {
5177
- problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5178
+ problems.push(err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5178
5179
  }
5179
5180
  if (problems.length > 0) {
5180
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
5181
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
5181
5182
  `profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
5182
5183
  - ` + problems.join("\n- "),
5183
5184
  { operation: "contracts.profitability" }
@@ -5226,23 +5227,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5226
5227
  const byKey = /* @__PURE__ */ new Map();
5227
5228
  const misses = [];
5228
5229
  const notes = [];
5229
- for (let c = 0; c < unique.length; c += _chunkLLIB4JGKcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5230
- const chunk = unique.slice(c, c + _chunkLLIB4JGKcjs.FETCH_BY_IDS_CHUNK_SIZE);
5230
+ for (let c = 0; c < unique.length; c += _chunkIKPFR6K2cjs.FETCH_BY_IDS_CHUNK_SIZE) {
5231
+ const chunk = unique.slice(c, c + _chunkIKPFR6K2cjs.FETCH_BY_IDS_CHUNK_SIZE);
5231
5232
  const chunkKeys = new Set(chunk);
5232
5233
  try {
5233
5234
  const body = {
5234
- MaxRecords: _chunkLLIB4JGKcjs.FETCH_BY_IDS_CHUNK_SIZE,
5235
+ MaxRecords: _chunkIKPFR6K2cjs.FETCH_BY_IDS_CHUNK_SIZE,
5235
5236
  filter: [{ field: "id", op: "in", value: chunk }],
5236
5237
  IncludeFields: fields
5237
5238
  };
5238
5239
  const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
5239
- const { items: rows } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
5240
+ const { items: rows } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, operation);
5240
5241
  for (const row of rows) {
5241
5242
  const k = num(row.id);
5242
5243
  if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
5243
5244
  }
5244
5245
  } catch (err) {
5245
- const code = err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.code : "SERVER_ERROR";
5246
+ const code = err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.code : "SERVER_ERROR";
5246
5247
  for (const k of chunk) {
5247
5248
  if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
5248
5249
  }
@@ -5252,11 +5253,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5252
5253
  for (const k of queryMissed) {
5253
5254
  try {
5254
5255
  const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
5255
- byKey.set(k, _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, k, operation, entity));
5256
+ byKey.set(k, _chunkIKPFR6K2cjs.unwrapItem.call(void 0, res, k, operation, entity));
5256
5257
  } catch (err) {
5257
- if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) {
5258
+ if (err instanceof _chunkIKPFR6K2cjs.NotFoundError) {
5258
5259
  misses.push({ id: k, code: "NOT_FOUND", message: err.message });
5259
- } else if (err instanceof _chunkLLIB4JGKcjs.AutotaskError) {
5260
+ } else if (err instanceof _chunkIKPFR6K2cjs.AutotaskError) {
5260
5261
  misses.push({ id: k, code: err.code, message: err.message });
5261
5262
  } else {
5262
5263
  misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
@@ -5310,7 +5311,7 @@ async function degradable(read) {
5310
5311
  try {
5311
5312
  return await read();
5312
5313
  } catch (err) {
5313
- if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5314
+ if (!(err instanceof _chunkIKPFR6K2cjs.AutotaskError)) throw err;
5314
5315
  return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
5315
5316
  }
5316
5317
  }
@@ -5330,7 +5331,7 @@ var stampPart = (key, raw, conditions, extraNotes) => {
5330
5331
  status: st.status,
5331
5332
  blindSurface: st.blindSurface,
5332
5333
  note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
5333
- emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkLLIB4JGKcjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5334
+ emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkIKPFR6K2cjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5334
5335
  };
5335
5336
  };
5336
5337
  function appendWiresNote(wires, note) {
@@ -5338,7 +5339,7 @@ function appendWiresNote(wires, note) {
5338
5339
  }
5339
5340
  function makeFetchCtx(rawHttp, v, contractId, budget) {
5340
5341
  const OP11 = PROFITABILITY_OP;
5341
- const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, contractId, "contractId");
5342
+ const id = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, contractId, "contractId");
5342
5343
  const idNum = typeof id === "number" ? id : Number(id);
5343
5344
  const wires = { issued: 0, requests: 0, budget };
5344
5345
  const toExcl = dayAfter(v.dateTo);
@@ -5376,12 +5377,12 @@ async function fetchCustomer(ctx, companyID) {
5376
5377
  path: `/V1.0/Companies/${companyID}`,
5377
5378
  operation: ctx.OP
5378
5379
  });
5379
- const item = _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5380
+ const item = _chunkIKPFR6K2cjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5380
5381
  customer = _nullishCoalesce(item, () => ( null));
5381
5382
  customerStatus = "ok";
5382
5383
  } catch (err) {
5383
- if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5384
- if (!(err instanceof _chunkLLIB4JGKcjs.NotFoundError)) {
5384
+ if (!(err instanceof _chunkIKPFR6K2cjs.AutotaskError)) throw err;
5385
+ if (!(err instanceof _chunkIKPFR6K2cjs.NotFoundError)) {
5385
5386
  customerStatus = "absent";
5386
5387
  customerAbsent = err.code;
5387
5388
  }
@@ -5397,7 +5398,7 @@ async function resolveContractType(ctx, contractType) {
5397
5398
  try {
5398
5399
  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));
5399
5400
  } catch (err) {
5400
- if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5401
+ if (!(err instanceof _chunkIKPFR6K2cjs.AutotaskError)) throw err;
5401
5402
  }
5402
5403
  }
5403
5404
  const contractTypeKnown = contractTypeLabel !== null;
@@ -5459,8 +5460,8 @@ async function fetchInvoices(ctx, billingRows) {
5459
5460
  if (invoiceIds.length === 0) {
5460
5461
  return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
5461
5462
  }
5462
- const capped = capJoinSet2(invoiceIds, _chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS);
5463
- if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5463
+ const capped = capJoinSet2(invoiceIds, _chunkIKPFR6K2cjs.FETCH_BY_IDS_MAX_ITEMS);
5464
+ if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkIKPFR6K2cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5464
5465
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
5465
5466
  ctx.wires.issued += 1;
5466
5467
  return {
@@ -5506,7 +5507,7 @@ async function readOpenStatusSet(ctx) {
5506
5507
  }
5507
5508
  }
5508
5509
  } catch (err) {
5509
- statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5510
+ statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkIKPFR6K2cjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5510
5511
  }
5511
5512
  return { openStatusSet, statusNote };
5512
5513
  }
@@ -5529,8 +5530,8 @@ async function fetchResources(ctx, entries) {
5529
5530
  if (resourceIds.length === 0) {
5530
5531
  return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
5531
5532
  }
5532
- const capped = capJoinSet2(resourceIds, _chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS);
5533
- if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5533
+ const capped = capJoinSet2(resourceIds, _chunkIKPFR6K2cjs.FETCH_BY_IDS_MAX_ITEMS);
5534
+ if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkIKPFR6K2cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5534
5535
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
5535
5536
  ctx.wires.issued += 1;
5536
5537
  for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
@@ -5597,7 +5598,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
5597
5598
  try {
5598
5599
  return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
5599
5600
  } catch (err) {
5600
- if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5601
+ if (!(err instanceof _chunkIKPFR6K2cjs.AutotaskError)) throw err;
5601
5602
  return null;
5602
5603
  }
5603
5604
  }
@@ -5614,7 +5615,7 @@ async function fetchSubscriptions(ctx, cis) {
5614
5615
  cancelledSubs
5615
5616
  };
5616
5617
  }
5617
- const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS);
5618
+ const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkIKPFR6K2cjs.FETCH_BY_IDS_MAX_ITEMS);
5618
5619
  const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
5619
5620
  const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
5620
5621
  const subscriptions = raw.items;
@@ -6299,7 +6300,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
6299
6300
  }
6300
6301
 
6301
6302
  // src/resources/contracts.ts
6302
- var ContractsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6303
+ var ContractsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6303
6304
  constructor(http, pageSize) {
6304
6305
  super(http, {
6305
6306
  key: "contracts",
@@ -6374,7 +6375,7 @@ var ContractsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6374
6375
  };
6375
6376
 
6376
6377
  // src/resources/contract_ticket_purchases.ts
6377
- var ContractTicketPurchasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6378
+ var ContractTicketPurchasesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6378
6379
  constructor(http, pageSize) {
6379
6380
  super(http, {
6380
6381
  key: "contract_ticket_purchases",
@@ -6433,7 +6434,7 @@ var ContractTicketPurchasesResource = class extends _chunkLLIB4JGKcjs.BaseResour
6433
6434
  };
6434
6435
 
6435
6436
  // src/resources/countries.ts
6436
- var CountriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6437
+ var CountriesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6437
6438
  constructor(http, pageSize) {
6438
6439
  super(http, {
6439
6440
  key: "countries",
@@ -6492,7 +6493,7 @@ var CountriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6492
6493
  };
6493
6494
 
6494
6495
  // src/resources/currencies.ts
6495
- var CurrenciesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6496
+ var CurrenciesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6496
6497
  constructor(http, pageSize) {
6497
6498
  super(http, {
6498
6499
  key: "currencies",
@@ -6536,7 +6537,7 @@ var CurrenciesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6536
6537
  };
6537
6538
 
6538
6539
  // src/resources/departments.ts
6539
- var DepartmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6540
+ var DepartmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6540
6541
  constructor(http, pageSize) {
6541
6542
  super(http, {
6542
6543
  key: "departments",
@@ -6603,7 +6604,7 @@ var DepartmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6603
6604
  };
6604
6605
 
6605
6606
  // src/resources/domain_registrars.ts
6606
- var DomainRegistrarsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6607
+ var DomainRegistrarsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6607
6608
  constructor(http, pageSize) {
6608
6609
  super(http, {
6609
6610
  key: "domain_registrars",
@@ -6686,7 +6687,7 @@ var EntityInformationResource = class {
6686
6687
  };
6687
6688
 
6688
6689
  // src/resources/expense_item_attachments.ts
6689
- var ExpenseItemAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6690
+ var ExpenseItemAttachmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6690
6691
  constructor(http, pageSize) {
6691
6692
  super(http, {
6692
6693
  key: "expense_item_attachments",
@@ -6748,7 +6749,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResourc
6748
6749
  };
6749
6750
 
6750
6751
  // src/resources/expense_items.ts
6751
- var ExpenseItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6752
+ var ExpenseItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6752
6753
  constructor(http, pageSize) {
6753
6754
  super(http, {
6754
6755
  key: "expense_items",
@@ -6807,7 +6808,7 @@ var ExpenseItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6807
6808
  };
6808
6809
 
6809
6810
  // src/resources/expense_reports.ts
6810
- var ExpenseReportsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6811
+ var ExpenseReportsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6811
6812
  constructor(http, pageSize) {
6812
6813
  super(http, {
6813
6814
  key: "expense_reports",
@@ -6874,7 +6875,7 @@ var ExpenseReportsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6874
6875
  };
6875
6876
 
6876
6877
  // src/resources/holiday_sets.ts
6877
- var HolidaySetsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6878
+ var HolidaySetsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6878
6879
  constructor(http, pageSize) {
6879
6880
  super(http, {
6880
6881
  key: "holiday_sets",
@@ -6943,7 +6944,7 @@ var HolidaySetsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6943
6944
  };
6944
6945
 
6945
6946
  // src/resources/holidays.ts
6946
- var HolidaysResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6947
+ var HolidaysResource = class extends _chunkIKPFR6K2cjs.BaseResource {
6947
6948
  constructor(http, pageSize) {
6948
6949
  super(http, {
6949
6950
  key: "holidays",
@@ -7015,10 +7016,10 @@ var PATH_SUFFIX = {
7015
7016
  transfer: "StockedItemsTransfer"
7016
7017
  };
7017
7018
  async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
7018
- const numericParent = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, parentId, "parentId");
7019
+ const numericParent = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, parentId, "parentId");
7019
7020
  const suffix = PATH_SUFFIX[kind];
7020
7021
  if (opts.dryRun === true) {
7021
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
7022
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
7022
7023
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
7023
7024
  method: "POST",
7024
7025
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -7035,11 +7036,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
7035
7036
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
7036
7037
  maxRetries: opts.maxRetries
7037
7038
  });
7038
- return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
7039
+ return _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, res);
7039
7040
  }
7040
7041
 
7041
7042
  // src/resources/inventory_products.ts
7042
- var InventoryProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7043
+ var InventoryProductsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7043
7044
  constructor(http, pageSize) {
7044
7045
  super(http, {
7045
7046
  key: "inventory_products",
@@ -7121,7 +7122,7 @@ var InventoryProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7121
7122
 
7122
7123
  // src/resources/special/invoices.ts
7123
7124
  async function markup(_resource, id, format, http) {
7124
- const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
7125
+ const numericId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
7125
7126
  const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
7126
7127
  const res = await http.request({
7127
7128
  method: "GET",
@@ -7130,7 +7131,7 @@ async function markup(_resource, id, format, http) {
7130
7131
  });
7131
7132
  const body = res;
7132
7133
  if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
7133
- throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(
7134
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskError)(
7134
7135
  `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
7135
7136
  { code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
7136
7137
  );
@@ -7138,13 +7139,13 @@ async function markup(_resource, id, format, http) {
7138
7139
  return body.invoiceMarkup;
7139
7140
  }
7140
7141
  async function pdf(_resource, id, http) {
7141
- const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
7142
+ const numericId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
7142
7143
  const res = await http.request({
7143
7144
  method: "GET",
7144
7145
  path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
7145
7146
  operation: "invoices.pdf"
7146
7147
  });
7147
- return _chunkLLIB4JGKcjs.decodeFileData.call(void 0, res);
7148
+ return _chunkIKPFR6K2cjs.decodeFileData.call(void 0, res);
7148
7149
  }
7149
7150
  async function windowQuery2(_resource, kind, http, opts) {
7150
7151
  const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _76 => _76.now]), () => ( /* @__PURE__ */ new Date()));
@@ -7175,7 +7176,7 @@ async function customRange2(_resource, from, to, http, opts) {
7175
7176
  }
7176
7177
 
7177
7178
  // src/resources/invoices.ts
7178
- var InvoicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7179
+ var InvoicesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7179
7180
  constructor(http, pageSize) {
7180
7181
  super(http, {
7181
7182
  key: "invoices",
@@ -7289,7 +7290,7 @@ var InvoicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7289
7290
  };
7290
7291
 
7291
7292
  // src/resources/invoice_templates.ts
7292
- var InvoiceTemplatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7293
+ var InvoiceTemplatesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7293
7294
  constructor(http, pageSize) {
7294
7295
  super(http, {
7295
7296
  key: "invoice_templates",
@@ -7333,7 +7334,7 @@ var ModulesResource = class {
7333
7334
  };
7334
7335
 
7335
7336
  // src/resources/notification_history.ts
7336
- var NotificationHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7337
+ var NotificationHistoryResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7337
7338
  constructor(http, pageSize) {
7338
7339
  super(http, {
7339
7340
  key: "notification_history",
@@ -7372,7 +7373,7 @@ var NotificationHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7372
7373
  };
7373
7374
 
7374
7375
  // src/resources/opportunities.ts
7375
- var OpportunitiesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7376
+ var OpportunitiesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7376
7377
  constructor(http, pageSize) {
7377
7378
  super(http, {
7378
7379
  key: "opportunities",
@@ -7434,7 +7435,7 @@ var OpportunitiesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7434
7435
  };
7435
7436
 
7436
7437
  // src/resources/opportunity_attachments.ts
7437
- var OpportunityAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7438
+ var OpportunityAttachmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7438
7439
  constructor(http, pageSize) {
7439
7440
  super(http, {
7440
7441
  key: "opportunity_attachments",
@@ -7496,7 +7497,7 @@ var OpportunityAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResourc
7496
7497
  };
7497
7498
 
7498
7499
  // src/resources/opportunity_categories.ts
7499
- var OpportunityCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7500
+ var OpportunityCategoriesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7500
7501
  constructor(http, pageSize) {
7501
7502
  super(http, {
7502
7503
  key: "opportunity_categories",
@@ -7555,7 +7556,7 @@ var OpportunityCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource
7555
7556
  };
7556
7557
 
7557
7558
  // src/resources/organizational_level1s.ts
7558
- var OrganizationalLevel1sResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7559
+ var OrganizationalLevel1sResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7559
7560
  constructor(http, pageSize) {
7560
7561
  super(http, {
7561
7562
  key: "organizational_level1s",
@@ -7606,7 +7607,7 @@ var OrganizationalLevel1sResource = class extends _chunkLLIB4JGKcjs.BaseResource
7606
7607
  };
7607
7608
 
7608
7609
  // src/resources/organizational_level2s.ts
7609
- var OrganizationalLevel2sResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7610
+ var OrganizationalLevel2sResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7610
7611
  constructor(http, pageSize) {
7611
7612
  super(http, {
7612
7613
  key: "organizational_level2s",
@@ -7657,7 +7658,7 @@ var OrganizationalLevel2sResource = class extends _chunkLLIB4JGKcjs.BaseResource
7657
7658
  };
7658
7659
 
7659
7660
  // src/resources/organizational_level_associations.ts
7660
- var OrganizationalLevelAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7661
+ var OrganizationalLevelAssociationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7661
7662
  constructor(http, pageSize) {
7662
7663
  super(http, {
7663
7664
  key: "organizational_level_associations",
@@ -7708,7 +7709,7 @@ var OrganizationalLevelAssociationsResource = class extends _chunkLLIB4JGKcjs.Ba
7708
7709
  };
7709
7710
 
7710
7711
  // src/resources/phases.ts
7711
- var PhasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7712
+ var PhasesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7712
7713
  constructor(http, pageSize) {
7713
7714
  super(http, {
7714
7715
  key: "phases",
@@ -7767,7 +7768,7 @@ var PhasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7767
7768
  };
7768
7769
 
7769
7770
  // src/resources/products.ts
7770
- var ProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7771
+ var ProductsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7771
7772
  constructor(http, pageSize) {
7772
7773
  super(http, {
7773
7774
  key: "products",
@@ -7834,7 +7835,7 @@ var ProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7834
7835
  };
7835
7836
 
7836
7837
  // src/resources/product_vendors.ts
7837
- var ProductVendorsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7838
+ var ProductVendorsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7838
7839
  constructor(http, pageSize) {
7839
7840
  super(http, {
7840
7841
  key: "product_vendors",
@@ -7893,7 +7894,7 @@ var ProductVendorsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7893
7894
  };
7894
7895
 
7895
7896
  // src/resources/project_charges.ts
7896
- var ProjectChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7897
+ var ProjectChargesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7897
7898
  constructor(http, pageSize) {
7898
7899
  super(http, {
7899
7900
  key: "project_charges",
@@ -7964,7 +7965,7 @@ var ProjectChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7964
7965
  };
7965
7966
 
7966
7967
  // src/resources/project_notes.ts
7967
- var ProjectNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7968
+ var ProjectNotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
7968
7969
  constructor(http, pageSize) {
7969
7970
  super(http, {
7970
7971
  key: "project_notes",
@@ -8023,7 +8024,7 @@ var ProjectNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8023
8024
  };
8024
8025
 
8025
8026
  // src/resources/projects.ts
8026
- var ProjectsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8027
+ var ProjectsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8027
8028
  constructor(http, pageSize) {
8028
8029
  super(http, {
8029
8030
  key: "projects",
@@ -8100,13 +8101,13 @@ var ProjectsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8100
8101
  const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
8101
8102
  const result = { project: project2, company, opportunity, leadResource };
8102
8103
  if (opts.names === true) {
8103
- const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, );
8104
+ const builder = _chunkIKPFR6K2cjs.createNamePlan.call(void 0, );
8104
8105
  builder.addResource(root["creatorResourceID"]);
8105
8106
  builder.addFk("contract", root["contractID"]);
8106
- const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8107
+ const names = await _chunkIKPFR6K2cjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8107
8108
  const row = { ...project2 };
8108
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8109
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
8109
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8110
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
8110
8111
  result.project = row;
8111
8112
  result.names = names.section;
8112
8113
  }
@@ -8115,7 +8116,7 @@ var ProjectsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8115
8116
  };
8116
8117
 
8117
8118
  // src/resources/purchase_approvals.ts
8118
- var PurchaseApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8119
+ var PurchaseApprovalsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8119
8120
  constructor(http, pageSize) {
8120
8121
  super(http, {
8121
8122
  key: "purchase_approvals",
@@ -8169,7 +8170,7 @@ var PurchaseApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8169
8170
  };
8170
8171
 
8171
8172
  // src/resources/purchase_order_item_receiving.ts
8172
- var PurchaseOrderItemReceivingResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8173
+ var PurchaseOrderItemReceivingResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8173
8174
  constructor(http, pageSize) {
8174
8175
  super(http, {
8175
8176
  key: "purchase_order_item_receiving",
@@ -8219,7 +8220,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkLLIB4JGKcjs.BaseRes
8219
8220
  };
8220
8221
 
8221
8222
  // src/resources/purchase_order_items.ts
8222
- var PurchaseOrderItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8223
+ var PurchaseOrderItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8223
8224
  constructor(http, pageSize) {
8224
8225
  super(http, {
8225
8226
  key: "purchase_order_items",
@@ -8278,7 +8279,7 @@ var PurchaseOrderItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8278
8279
  };
8279
8280
 
8280
8281
  // src/resources/purchase_orders.ts
8281
- var PurchaseOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8282
+ var PurchaseOrdersResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8282
8283
  constructor(http, pageSize) {
8283
8284
  super(http, {
8284
8285
  key: "purchase_orders",
@@ -8340,7 +8341,7 @@ var PurchaseOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8340
8341
  };
8341
8342
 
8342
8343
  // src/resources/quote_items.ts
8343
- var QuoteItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8344
+ var QuoteItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8344
8345
  constructor(http, pageSize) {
8345
8346
  super(http, {
8346
8347
  key: "quote_items",
@@ -8411,7 +8412,7 @@ var QuoteItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8411
8412
  };
8412
8413
 
8413
8414
  // src/resources/quote_locations.ts
8414
- var QuoteLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8415
+ var QuoteLocationsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8415
8416
  constructor(http, pageSize) {
8416
8417
  super(http, {
8417
8418
  key: "quote_locations",
@@ -8476,7 +8477,7 @@ var QuoteLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8476
8477
  };
8477
8478
 
8478
8479
  // src/resources/quotes.ts
8479
- var QuotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8480
+ var QuotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8480
8481
  constructor(http, pageSize) {
8481
8482
  super(http, {
8482
8483
  key: "quotes",
@@ -8543,7 +8544,7 @@ var QuotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8543
8544
  };
8544
8545
 
8545
8546
  // src/resources/quote_templates.ts
8546
- var QuoteTemplatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8547
+ var QuoteTemplatesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8547
8548
  constructor(http, pageSize) {
8548
8549
  super(http, {
8549
8550
  key: "quote_templates",
@@ -8587,7 +8588,7 @@ var QuoteTemplatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8587
8588
  };
8588
8589
 
8589
8590
  // src/resources/resource_role_queues.ts
8590
- var ResourceRoleQueuesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8591
+ var ResourceRoleQueuesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8591
8592
  constructor(http, pageSize) {
8592
8593
  super(http, {
8593
8594
  key: "resource_role_queues",
@@ -8646,7 +8647,7 @@ var ResourceRoleQueuesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8646
8647
  };
8647
8648
 
8648
8649
  // src/resources/resource_roles.ts
8649
- var ResourceRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8650
+ var ResourceRolesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8650
8651
  constructor(http, pageSize) {
8651
8652
  super(http, {
8652
8653
  key: "resource_roles",
@@ -8688,7 +8689,7 @@ var ResourceRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8688
8689
  };
8689
8690
 
8690
8691
  // src/resources/resource_skills.ts
8691
- var ResourceSkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8692
+ var ResourceSkillsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8692
8693
  constructor(http, pageSize) {
8693
8694
  super(http, {
8694
8695
  key: "resource_skills",
@@ -8742,16 +8743,16 @@ var ResourceSkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8742
8743
  var MAX_TRANSFER_IDS = 500;
8743
8744
  function requirePositiveIds(ids2, label) {
8744
8745
  if (!Array.isArray(ids2) || ids2.length === 0) {
8745
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8746
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8746
8747
  }
8747
8748
  if (ids2.length > MAX_TRANSFER_IDS) {
8748
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8749
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8749
8750
  }
8750
8751
  const out = [];
8751
8752
  for (const raw of ids2) {
8752
- const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8753
+ const id = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, raw, `${label} id`);
8753
8754
  if (typeof id === "number" && id < 1) {
8754
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8755
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8755
8756
  }
8756
8757
  out.push(id);
8757
8758
  }
@@ -8759,7 +8760,7 @@ function requirePositiveIds(ids2, label) {
8759
8760
  }
8760
8761
  async function whoAmI(_resource, userName, http) {
8761
8762
  const user = userName.trim();
8762
- if (user === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8763
+ if (user === "") throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8763
8764
  const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
8764
8765
  const res = await http.request({
8765
8766
  method: "POST",
@@ -8768,11 +8769,11 @@ async function whoAmI(_resource, userName, http) {
8768
8769
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
8769
8770
  operation: "resources.whoAmI"
8770
8771
  });
8771
- const matches = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
8772
+ const matches = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
8772
8773
  if (matches.length === 0) return null;
8773
8774
  if (matches.length > 1) {
8774
8775
  const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
8775
- throw new (0, _chunkLLIB4JGKcjs.ResolutionError)(
8776
+ throw new (0, _chunkIKPFR6K2cjs.ResolutionError)(
8776
8777
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
8777
8778
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
8778
8779
  );
@@ -8781,9 +8782,9 @@ async function whoAmI(_resource, userName, http) {
8781
8782
  }
8782
8783
  async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
8783
8784
  const ids2 = requirePositiveIds(companyIds, "transferOwnership");
8784
- const destination = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8785
+ const destination = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8785
8786
  if (typeof destination === "number" && destination < 1) {
8786
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8787
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8787
8788
  }
8788
8789
  const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _88 => _88.dryRun]), () => ( true));
8789
8790
  const changes = [];
@@ -8796,7 +8797,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8796
8797
  operation: "resources.transferOwnership",
8797
8798
  maxRetries: _optionalChain([opts, 'optionalAccess', _89 => _89.maxRetries])
8798
8799
  });
8799
- const company = _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8800
+ const company = _chunkIKPFR6K2cjs.unwrapItem.call(void 0, res, id, void 0, "company");
8800
8801
  const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
8801
8802
  changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
8802
8803
  if (!dryRun) {
@@ -8807,13 +8808,13 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8807
8808
  operation: "resources.transferOwnership",
8808
8809
  maxRetries: _optionalChain([opts, 'optionalAccess', _90 => _90.maxRetries])
8809
8810
  });
8810
- _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, update);
8811
+ _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, update);
8811
8812
  applied.push(id);
8812
8813
  }
8813
8814
  } catch (err) {
8814
- if (!dryRun && err instanceof _chunkLLIB4JGKcjs.AutotaskError) {
8815
+ if (!dryRun && err instanceof _chunkIKPFR6K2cjs.AutotaskError) {
8815
8816
  err.resourceIds = [id];
8816
- err.details = _chunkLLIB4JGKcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8817
+ err.details = _chunkIKPFR6K2cjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8817
8818
  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).`;
8818
8819
  }
8819
8820
  throw err;
@@ -8822,7 +8823,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8822
8823
  if (dryRun) {
8823
8824
  const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
8824
8825
  return {
8825
- ..._chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
8826
+ ..._chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
8826
8827
  operation: "resources.transferOwnership",
8827
8828
  method: "PUT",
8828
8829
  path: "/V1.0/Companies",
@@ -8846,7 +8847,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8846
8847
  }
8847
8848
 
8848
8849
  // src/resources/resources.ts
8849
- var ResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8850
+ var ResourcesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8850
8851
 
8851
8852
  constructor(http, clientConfig, pageSize) {
8852
8853
  super(http, {
@@ -8919,7 +8920,7 @@ var ResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8919
8920
 
8920
8921
  // src/resources/special/resource_time_off_additional.ts
8921
8922
  async function getByResource(_resource, resourceId, http) {
8922
- const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8923
+ const numericResource = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8923
8924
  const res = await http.request({
8924
8925
  method: "GET",
8925
8926
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -8933,11 +8934,11 @@ async function getByResource(_resource, resourceId, http) {
8933
8934
  if (typeof item === "object" && !Array.isArray(item)) return [item];
8934
8935
  }
8935
8936
  }
8936
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8937
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8937
8938
  }
8938
8939
 
8939
8940
  // src/resources/resource_time_off_additional.ts
8940
- var ResourceTimeOffAdditionalResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8941
+ var ResourceTimeOffAdditionalResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8941
8942
  constructor(http, pageSize) {
8942
8943
  super(http, {
8943
8944
  key: "resource_time_off_additional",
@@ -8976,7 +8977,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkLLIB4JGKcjs.BaseReso
8976
8977
  };
8977
8978
 
8978
8979
  // src/resources/resource_time_off_approvers.ts
8979
- var ResourceTimeOffApproversResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8980
+ var ResourceTimeOffApproversResource = class extends _chunkIKPFR6K2cjs.BaseResource {
8980
8981
  constructor(http, pageSize) {
8981
8982
  super(http, {
8982
8983
  key: "resource_time_off_approvers",
@@ -9019,29 +9020,29 @@ var ResourceTimeOffApproversResource = class extends _chunkLLIB4JGKcjs.BaseResou
9019
9020
 
9020
9021
  // src/resources/special/resource_time_off_balances.ts
9021
9022
  async function getByResource2(_resource, resourceId, http) {
9022
- const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9023
+ const numericResource = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9023
9024
  const res = await http.request({
9024
9025
  method: "GET",
9025
9026
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
9026
9027
  operation: "resource_time_off_balances.getByResource"
9027
9028
  });
9028
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
9029
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
9029
9030
  }
9030
9031
  async function getByYear(_resource, resourceId, year, http) {
9031
- const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9032
+ const numericResource = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9032
9033
  if (!Number.isSafeInteger(year) || year < 1) {
9033
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
9034
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("getByYear: year must be a positive integer");
9034
9035
  }
9035
9036
  const res = await http.request({
9036
9037
  method: "GET",
9037
9038
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
9038
9039
  operation: "resource_time_off_balances.getByYear"
9039
9040
  });
9040
- return _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
9041
+ return _chunkIKPFR6K2cjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
9041
9042
  }
9042
9043
 
9043
9044
  // src/resources/resource_time_off_balances.ts
9044
- var ResourceTimeOffBalancesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9045
+ var ResourceTimeOffBalancesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9045
9046
  constructor(http, pageSize) {
9046
9047
  super(http, {
9047
9048
  key: "resource_time_off_balances",
@@ -9079,7 +9080,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkLLIB4JGKcjs.BaseResour
9079
9080
  };
9080
9081
 
9081
9082
  // src/resources/roles.ts
9082
- var RolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9083
+ var RolesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9083
9084
  constructor(http, pageSize) {
9084
9085
  super(http, {
9085
9086
  key: "roles",
@@ -9146,7 +9147,7 @@ var RolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9146
9147
  };
9147
9148
 
9148
9149
  // src/resources/sales_orders.ts
9149
- var SalesOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9150
+ var SalesOrdersResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9150
9151
  constructor(http, pageSize) {
9151
9152
  super(http, {
9152
9153
  key: "sales_orders",
@@ -9189,7 +9190,7 @@ var SalesOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9189
9190
  };
9190
9191
 
9191
9192
  // src/resources/service_calls.ts
9192
- var ServiceCallsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9193
+ var ServiceCallsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9193
9194
  constructor(http, pageSize) {
9194
9195
  super(http, {
9195
9196
  key: "service_calls",
@@ -9258,7 +9259,7 @@ var ServiceCallsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9258
9259
  };
9259
9260
 
9260
9261
  // src/resources/service_call_task_resources.ts
9261
- var ServiceCallTaskResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9262
+ var ServiceCallTaskResourcesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9262
9263
  constructor(http, pageSize) {
9263
9264
  super(http, {
9264
9265
  key: "service_call_task_resources",
@@ -9315,7 +9316,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResou
9315
9316
  };
9316
9317
 
9317
9318
  // src/resources/service_call_tasks.ts
9318
- var ServiceCallTasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9319
+ var ServiceCallTasksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9319
9320
  constructor(http, pageSize) {
9320
9321
  super(http, {
9321
9322
  key: "service_call_tasks",
@@ -9372,7 +9373,7 @@ var ServiceCallTasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9372
9373
  };
9373
9374
 
9374
9375
  // src/resources/service_call_ticket_resources.ts
9375
- var ServiceCallTicketResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9376
+ var ServiceCallTicketResourcesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9376
9377
  constructor(http, pageSize) {
9377
9378
  super(http, {
9378
9379
  key: "service_call_ticket_resources",
@@ -9429,7 +9430,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkLLIB4JGKcjs.BaseRes
9429
9430
  };
9430
9431
 
9431
9432
  // src/resources/service_call_tickets.ts
9432
- var ServiceCallTicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9433
+ var ServiceCallTicketsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9433
9434
  constructor(http, pageSize) {
9434
9435
  super(http, {
9435
9436
  key: "service_call_tickets",
@@ -9486,7 +9487,7 @@ var ServiceCallTicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9486
9487
  };
9487
9488
 
9488
9489
  // src/resources/service_level_agreement_results.ts
9489
- var ServiceLevelAgreementResultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9490
+ var ServiceLevelAgreementResultsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9490
9491
  constructor(http, pageSize) {
9491
9492
  super(http, {
9492
9493
  key: "service_level_agreement_results",
@@ -9525,7 +9526,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkLLIB4JGKcjs.BaseR
9525
9526
  };
9526
9527
 
9527
9528
  // src/resources/services.ts
9528
- var ServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9529
+ var ServicesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9529
9530
  constructor(http, pageSize) {
9530
9531
  super(http, {
9531
9532
  key: "services",
@@ -9593,7 +9594,7 @@ var ServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9593
9594
  };
9594
9595
 
9595
9596
  // src/resources/skills.ts
9596
- var SkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9597
+ var SkillsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9597
9598
  constructor(http, pageSize) {
9598
9599
  super(http, {
9599
9600
  key: "skills",
@@ -9637,7 +9638,7 @@ var SkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9637
9638
  };
9638
9639
 
9639
9640
  // src/resources/subscription_periods.ts
9640
- var SubscriptionPeriodsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9641
+ var SubscriptionPeriodsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9641
9642
  constructor(http, pageSize) {
9642
9643
  super(http, {
9643
9644
  key: "subscription_periods",
@@ -9676,7 +9677,7 @@ var SubscriptionPeriodsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9676
9677
  };
9677
9678
 
9678
9679
  // src/resources/subscriptions.ts
9679
- var SubscriptionsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9680
+ var SubscriptionsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9680
9681
  constructor(http, pageSize) {
9681
9682
  super(http, {
9682
9683
  key: "subscriptions",
@@ -9745,7 +9746,7 @@ var SubscriptionsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9745
9746
  };
9746
9747
 
9747
9748
  // src/resources/survey_results.ts
9748
- var SurveyResultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9749
+ var SurveyResultsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9749
9750
  constructor(http, pageSize) {
9750
9751
  super(http, {
9751
9752
  key: "survey_results",
@@ -9784,7 +9785,7 @@ var SurveyResultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9784
9785
  };
9785
9786
 
9786
9787
  // src/resources/surveys.ts
9787
- var SurveysResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9788
+ var SurveysResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9788
9789
  constructor(http, pageSize) {
9789
9790
  super(http, {
9790
9791
  key: "surveys",
@@ -9828,7 +9829,7 @@ var SurveysResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9828
9829
  };
9829
9830
 
9830
9831
  // src/resources/tag_aliases.ts
9831
- var TagAliasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9832
+ var TagAliasesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9832
9833
  constructor(http, pageSize) {
9833
9834
  super(http, {
9834
9835
  key: "tag_aliases",
@@ -9885,7 +9886,7 @@ var TagAliasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9885
9886
  };
9886
9887
 
9887
9888
  // src/resources/tag_groups.ts
9888
- var TagGroupsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9889
+ var TagGroupsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9889
9890
  constructor(http, pageSize) {
9890
9891
  super(http, {
9891
9892
  key: "tag_groups",
@@ -9954,7 +9955,7 @@ var TagGroupsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9954
9955
  };
9955
9956
 
9956
9957
  // src/resources/tags.ts
9957
- var TagsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9958
+ var TagsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
9958
9959
  constructor(http, pageSize) {
9959
9960
  super(http, {
9960
9961
  key: "tags",
@@ -10023,7 +10024,7 @@ var TagsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10023
10024
  };
10024
10025
 
10025
10026
  // src/resources/task_secondary_resources.ts
10026
- var TaskSecondaryResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10027
+ var TaskSecondaryResourcesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10027
10028
  constructor(http, pageSize) {
10028
10029
  super(http, {
10029
10030
  key: "task_secondary_resources",
@@ -10080,7 +10081,7 @@ var TaskSecondaryResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResourc
10080
10081
  };
10081
10082
 
10082
10083
  // src/resources/tasks.ts
10083
- var TasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10084
+ var TasksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10084
10085
  constructor(http, pageSize) {
10085
10086
  super(http, {
10086
10087
  key: "tasks",
@@ -10144,7 +10145,7 @@ var TasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10144
10145
  };
10145
10146
 
10146
10147
  // src/resources/tax_regions.ts
10147
- var TaxRegionsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10148
+ var TaxRegionsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10148
10149
  constructor(http, pageSize) {
10149
10150
  super(http, {
10150
10151
  key: "tax_regions",
@@ -10219,7 +10220,7 @@ var ThresholdInformationResource = class {
10219
10220
  };
10220
10221
 
10221
10222
  // src/resources/ticket_additional_configuration_items.ts
10222
- var TicketAdditionalConfigurationItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10223
+ var TicketAdditionalConfigurationItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10223
10224
  constructor(http, pageSize) {
10224
10225
  super(http, {
10225
10226
  key: "ticket_additional_configuration_items",
@@ -10276,7 +10277,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkLLIB4JGKcjs
10276
10277
  };
10277
10278
 
10278
10279
  // src/resources/ticket_additional_contacts.ts
10279
- var TicketAdditionalContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10280
+ var TicketAdditionalContactsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10280
10281
  constructor(http, pageSize) {
10281
10282
  super(http, {
10282
10283
  key: "ticket_additional_contacts",
@@ -10333,7 +10334,7 @@ var TicketAdditionalContactsResource = class extends _chunkLLIB4JGKcjs.BaseResou
10333
10334
  };
10334
10335
 
10335
10336
  // src/resources/ticket_attachments.ts
10336
- var TicketAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10337
+ var TicketAttachmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10337
10338
  constructor(http, pageSize) {
10338
10339
  super(http, {
10339
10340
  key: "ticket_attachments",
@@ -10395,7 +10396,7 @@ var TicketAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10395
10396
  };
10396
10397
 
10397
10398
  // src/resources/ticket_categories.ts
10398
- var TicketCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10399
+ var TicketCategoriesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10399
10400
  constructor(http, pageSize) {
10400
10401
  super(http, {
10401
10402
  key: "ticket_categories",
@@ -10454,7 +10455,7 @@ var TicketCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10454
10455
  };
10455
10456
 
10456
10457
  // src/resources/ticket_category_field_defaults.ts
10457
- var TicketCategoryFieldDefaultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10458
+ var TicketCategoryFieldDefaultsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10458
10459
  constructor(http, pageSize) {
10459
10460
  super(http, {
10460
10461
  key: "ticket_category_field_defaults",
@@ -10496,7 +10497,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkLLIB4JGKcjs.BaseRe
10496
10497
  };
10497
10498
 
10498
10499
  // src/resources/ticket_change_request_approvals.ts
10499
- var TicketChangeRequestApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10500
+ var TicketChangeRequestApprovalsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10500
10501
  constructor(http, pageSize) {
10501
10502
  super(http, {
10502
10503
  key: "ticket_change_request_approvals",
@@ -10556,10 +10557,10 @@ var TicketChangeRequestApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseR
10556
10557
  var _crypto = require('crypto');
10557
10558
  var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
10558
10559
  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";
10559
- var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkLLIB4JGKcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10560
+ var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkIKPFR6K2cjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10560
10561
  async function queryRows(http, resource, filter, operation, retries) {
10561
10562
  const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
10562
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
10563
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
10563
10564
  }
10564
10565
  function sameValue(a, b) {
10565
10566
  if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
@@ -10579,7 +10580,7 @@ async function readTicket(http, id, retries, operation) {
10579
10580
  const item = _optionalChain([res, 'optionalAccess', _98 => _98.item]);
10580
10581
  return _nullishCoalesce(item, () => ( null));
10581
10582
  } catch (e) {
10582
- if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10583
+ if (_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10583
10584
  throw e;
10584
10585
  }
10585
10586
  }
@@ -10600,7 +10601,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
10600
10601
  }
10601
10602
  }
10602
10603
  const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
10603
- if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10604
+ if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10604
10605
  const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
10605
10606
  if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
10606
10607
  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") });
@@ -10643,17 +10644,17 @@ async function assertNoTwin(ctx, payload) {
10643
10644
  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 });
10644
10645
  }
10645
10646
  }
10646
- var statusOf = (e) => _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10647
+ var statusOf = (e) => _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10647
10648
  async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10648
10649
  const op = spec.operation;
10649
- const sourceId = Number(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10650
- const toTicketId = Number(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10650
+ const sourceId = Number(_chunkIKPFR6K2cjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10651
+ const toTicketId = Number(_chunkIKPFR6K2cjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10651
10652
  if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
10652
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10653
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10653
10654
  }
10654
10655
  const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
10655
10656
  if (opts.dryRun === true) {
10656
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
10657
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
10657
10658
  {
10658
10659
  operation: op,
10659
10660
  method: "POST",
@@ -10678,22 +10679,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10678
10679
  let newId;
10679
10680
  try {
10680
10681
  const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
10681
- newId = Number(_chunkLLIB4JGKcjs.unwrapOperation.call(void 0, created, op).id);
10682
+ newId = Number(_chunkIKPFR6K2cjs.unwrapOperation.call(void 0, created, op).id);
10682
10683
  } catch (e) {
10683
10684
  const status = statusOf(e);
10684
10685
  if (status !== void 0 && status >= 400 && status < 500) {
10685
- throw new (0, _chunkLLIB4JGKcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10686
+ throw new (0, _chunkIKPFR6K2cjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10686
10687
  }
10687
- throw new (0, _chunkLLIB4JGKcjs.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 } });
10688
+ throw new (0, _chunkIKPFR6K2cjs.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 } });
10688
10689
  }
10689
10690
  const rollback = async (code, message) => {
10690
10691
  try {
10691
10692
  await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
10692
10693
  } catch (re) {
10693
10694
  const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
10694
- throw new (0, _chunkLLIB4JGKcjs.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 } });
10695
+ throw new (0, _chunkIKPFR6K2cjs.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 } });
10695
10696
  }
10696
- throw new (0, _chunkLLIB4JGKcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10697
+ throw new (0, _chunkIKPFR6K2cjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10697
10698
  };
10698
10699
  const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
10699
10700
  if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
@@ -10722,14 +10723,14 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10722
10723
  };
10723
10724
  }
10724
10725
  if (status === void 0) {
10725
- throw new (0, _chunkLLIB4JGKcjs.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 } });
10726
+ throw new (0, _chunkIKPFR6K2cjs.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 } });
10726
10727
  }
10727
10728
  return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
10728
10729
  }
10729
10730
  return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
10730
10731
  }
10731
10732
  function uiLinkFor(http, entity, id) {
10732
- return _nullishCoalesce(_chunkLLIB4JGKcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10733
+ return _nullishCoalesce(_chunkIKPFR6K2cjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10733
10734
  }
10734
10735
 
10735
10736
  // src/resources/special/ticket_charges.ts
@@ -10784,7 +10785,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
10784
10785
  }
10785
10786
 
10786
10787
  // src/resources/ticket_charges.ts
10787
- var TicketChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10788
+ var TicketChargesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10788
10789
  constructor(http, pageSize) {
10789
10790
  super(http, {
10790
10791
  key: "ticket_charges",
@@ -10859,7 +10860,7 @@ var TicketChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10859
10860
  };
10860
10861
 
10861
10862
  // src/resources/ticket_checklist_items.ts
10862
- var TicketChecklistItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10863
+ var TicketChecklistItemsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10863
10864
  constructor(http, pageSize) {
10864
10865
  super(http, {
10865
10866
  key: "ticket_checklist_items",
@@ -10925,7 +10926,7 @@ var TicketChecklistItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource
10925
10926
  };
10926
10927
 
10927
10928
  // src/resources/ticket_checklist_libraries.ts
10928
- var TicketChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10929
+ var TicketChecklistLibrariesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10929
10930
  constructor(http, pageSize) {
10930
10931
  super(http, {
10931
10932
  key: "ticket_checklist_libraries",
@@ -10949,9 +10950,9 @@ var TicketChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResou
10949
10950
  * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
10950
10951
  * surface — no documents read op — and never issues the POST). */
10951
10952
  async attachToDocument(documentID, data, opts = {}) {
10952
- const n = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, documentID, "documentID");
10953
+ const n = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, documentID, "documentID");
10953
10954
  if (opts.dryRun === true) {
10954
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
10955
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
10955
10956
  operation: "ticket_checklist_libraries.attachToDocument",
10956
10957
  method: "POST",
10957
10958
  path: `/V1.0/Documents/${n}/ChecklistLibraries`,
@@ -10969,7 +10970,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResou
10969
10970
  operation: "ticket_checklist_libraries.attachToDocument",
10970
10971
  maxRetries: opts.maxRetries
10971
10972
  });
10972
- return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
10973
+ return _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, res);
10973
10974
  }
10974
10975
  /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
10975
10976
  * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
@@ -10985,7 +10986,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResou
10985
10986
  };
10986
10987
 
10987
10988
  // src/resources/ticket_history.ts
10988
- var TicketHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10989
+ var TicketHistoryResource = class extends _chunkIKPFR6K2cjs.BaseResource {
10989
10990
  constructor(http, pageSize) {
10990
10991
  super(http, {
10991
10992
  key: "ticket_history",
@@ -11024,7 +11025,7 @@ var TicketHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11024
11025
  };
11025
11026
 
11026
11027
  // src/resources/ticket_note_attachments.ts
11027
- var TicketNoteAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11028
+ var TicketNoteAttachmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
11028
11029
  constructor(http, pageSize) {
11029
11030
  super(http, {
11030
11031
  key: "ticket_note_attachments",
@@ -11086,7 +11087,7 @@ var TicketNoteAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource
11086
11087
  };
11087
11088
 
11088
11089
  // src/resources/ticket_notes.ts
11089
- var TicketNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11090
+ var TicketNotesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
11090
11091
  constructor(http, pageSize) {
11091
11092
  super(http, {
11092
11093
  key: "ticket_notes",
@@ -11145,7 +11146,7 @@ var TicketNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11145
11146
  };
11146
11147
 
11147
11148
  // src/resources/ticket_note_webhooks.ts
11148
- var TicketNoteWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11149
+ var TicketNoteWebhooksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
11149
11150
  constructor(http, pageSize) {
11150
11151
  super(http, {
11151
11152
  key: "ticket_note_webhooks",
@@ -11221,7 +11222,7 @@ var TicketNoteWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11221
11222
  };
11222
11223
 
11223
11224
  // src/resources/ticket_secondary_resources.ts
11224
- var TicketSecondaryResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11225
+ var TicketSecondaryResourcesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
11225
11226
  constructor(http, pageSize) {
11226
11227
  super(http, {
11227
11228
  key: "ticket_secondary_resources",
@@ -11286,9 +11287,9 @@ async function fetchTicket(http, id, operation) {
11286
11287
  });
11287
11288
  const body = res;
11288
11289
  if (body === null || !("item" in body)) {
11289
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11290
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11290
11291
  }
11291
- if (body.item === null || body.item === void 0) throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11292
+ if (body.item === null || body.item === void 0) throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11292
11293
  return body.item;
11293
11294
  }
11294
11295
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -11299,7 +11300,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
11299
11300
  body: { MaxRecords: maxRecords, filter },
11300
11301
  operation
11301
11302
  });
11302
- return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
11303
+ return _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res).items;
11303
11304
  }
11304
11305
  function truncate(text, limit) {
11305
11306
  const full = _nullishCoalesce(text, () => ( ""));
@@ -11309,26 +11310,26 @@ function truncate(text, limit) {
11309
11310
 
11310
11311
  // src/resources/special/tickets/childRead.ts
11311
11312
  function isRouteUnavailable(err) {
11312
- return _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11313
+ return _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11313
11314
  }
11314
11315
  function routeFact(route, path, err) {
11315
11316
  return {
11316
11317
  route,
11317
11318
  path,
11318
- httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11319
+ httpStatus: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11319
11320
  };
11320
11321
  }
11321
11322
  function childDeclaresQuery(resourceKey) {
11322
- return _chunkEDVSWL32cjs.CAPABILITIES.some(
11323
+ return _chunkDCTHO7CQcjs.CAPABILITIES.some(
11323
11324
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
11324
11325
  );
11325
11326
  }
11326
11327
  function planScopedPath(resourceKey, ticketId) {
11327
11328
  if (!childDeclaresQuery(resourceKey)) return null;
11328
- const entry = _chunkLLIB4JGKcjs.RELATIONSHIP_MAP[resourceKey];
11329
+ const entry = _chunkIKPFR6K2cjs.RELATIONSHIP_MAP[resourceKey];
11329
11330
  const parent = entry === void 0 ? null : entry.parent;
11330
11331
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
11331
- const parentPath = _optionalChain([_chunkLLIB4JGKcjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11332
+ const parentPath = _optionalChain([_chunkIKPFR6K2cjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11332
11333
  if (parentPath === null || parentPath === void 0) return null;
11333
11334
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
11334
11335
  }
@@ -11367,14 +11368,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
11367
11368
  break;
11368
11369
  }
11369
11370
  const body = await http.request({ method: "GET", path: target, operation });
11370
- const { items: pageItems, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, body, operation);
11371
+ const { items: pageItems, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, body, operation);
11371
11372
  nextCursor = pageDetails.nextPageUrl;
11372
11373
  pages += 1;
11373
11374
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
11374
11375
  for (const row of window) if (accept(row)) items.push(row);
11375
11376
  if (items.length >= limit) break;
11376
11377
  if (nextCursor === null || pageItems.length === 0) break;
11377
- target = _chunkLLIB4JGKcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11378
+ target = _chunkIKPFR6K2cjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11378
11379
  }
11379
11380
  const capped = items.length >= limit || guard && nextCursor !== null;
11380
11381
  return { items, capped };
@@ -11407,7 +11408,7 @@ var MS = 864e5;
11407
11408
  var SLA_PAGE = 100;
11408
11409
  async function slaHealthCheck(_resource, id, opts = {}, http) {
11409
11410
  void opts;
11410
- const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11411
+ const ticketId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
11411
11412
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
11412
11413
  const rows = await ticketQueryItems(
11413
11414
  http,
@@ -11432,9 +11433,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
11432
11433
  async function summary(_resource, id, opts = {}, http) {
11433
11434
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
11434
11435
  if (!Number.isInteger(limit) || limit < 1) {
11435
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11436
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11436
11437
  }
11437
- const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11438
+ const ticketId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
11438
11439
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
11439
11440
  const desc = truncate(ticket.description, limit);
11440
11441
  const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
@@ -11463,11 +11464,11 @@ async function summary(_resource, id, opts = {}, http) {
11463
11464
  // src/resources/special/tickets/timeline.ts
11464
11465
  function validateTimelineLimits(opts) {
11465
11466
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
11466
- if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11467
+ if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11467
11468
  const bounded = Math.min(limit, 500);
11468
11469
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
11469
11470
  if (!Number.isInteger(textLimit) || textLimit < 1) {
11470
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11471
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11471
11472
  }
11472
11473
  return { bounded, textLimit };
11473
11474
  }
@@ -11519,7 +11520,7 @@ function compareEventDates(a, b) {
11519
11520
  }
11520
11521
  async function timeline(_resource, id, opts = {}, http) {
11521
11522
  const { bounded, textLimit } = validateTimelineLimits(opts);
11522
- const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11523
+ const ticketId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
11523
11524
  await fetchTicket(http, ticketId, "tickets.timeline");
11524
11525
  const dateFilters = (field) => {
11525
11526
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11559,7 +11560,7 @@ async function timeline(_resource, id, opts = {}, http) {
11559
11560
  }
11560
11561
 
11561
11562
  // src/resources/special/tickets/errors.ts
11562
- var QueueRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11563
+ var QueueRequiredError = class extends _chunkIKPFR6K2cjs.AutotaskError {
11563
11564
  constructor(message, options = {}) {
11564
11565
  super(message, {
11565
11566
  code: "QUEUE_REQUIRED",
@@ -11570,13 +11571,13 @@ var QueueRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11570
11571
  this.name = "QueueRequiredError";
11571
11572
  }
11572
11573
  };
11573
- var TicketResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11574
+ var TicketResourceInvalidError = class extends _chunkIKPFR6K2cjs.AutotaskError {
11574
11575
  constructor(message, options = {}) {
11575
11576
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11576
11577
  this.name = "TicketResourceInvalidError";
11577
11578
  }
11578
11579
  };
11579
- var TicketCreateValidationFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11580
+ var TicketCreateValidationFailedError = class extends _chunkIKPFR6K2cjs.AutotaskError {
11580
11581
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
11581
11582
 
11582
11583
  constructor(message, vendorFields, options = {}) {
@@ -11585,7 +11586,7 @@ var TicketCreateValidationFailedError = class extends _chunkLLIB4JGKcjs.Autotask
11585
11586
  this.vendorFields = vendorFields;
11586
11587
  }
11587
11588
  };
11588
- var StatusUnknownError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11589
+ var StatusUnknownError = class extends _chunkIKPFR6K2cjs.AutotaskError {
11589
11590
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
11590
11591
 
11591
11592
  constructor(message, options = {}) {
@@ -11599,7 +11600,7 @@ var StatusUnknownError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11599
11600
  this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
11600
11601
  }
11601
11602
  };
11602
- var StatusFieldsRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11603
+ var StatusFieldsRequiredError = class extends _chunkIKPFR6K2cjs.AutotaskError {
11603
11604
 
11604
11605
 
11605
11606
 
@@ -11622,14 +11623,14 @@ function isPositiveInt(v) {
11622
11623
  return typeof v === "number" && Number.isInteger(v) && v > 0;
11623
11624
  }
11624
11625
  function namedVendorFields(err) {
11625
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11626
- const entries = _nullishCoalesce(_chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11626
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11627
+ const entries = _nullishCoalesce(_chunkIKPFR6K2cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11627
11628
  const out = /* @__PURE__ */ new Set();
11628
11629
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
11629
11630
  return [...out];
11630
11631
  }
11631
11632
  function vendorDetailOf(err) {
11632
- return _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11633
+ return _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? _chunkIKPFR6K2cjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11633
11634
  }
11634
11635
  async function fetchItem(http, path, operation, readOpts) {
11635
11636
  const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _104 => _104.maxRetries]) });
@@ -11650,8 +11651,8 @@ function operationId(res) {
11650
11651
  return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
11651
11652
  }
11652
11653
  function discoveryMerge(err, body, defaults) {
11653
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11654
- const entries = _chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError);
11654
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11655
+ const entries = _chunkIKPFR6K2cjs.parseVendorErrors.call(void 0, err.vendorError);
11655
11656
  if (entries === void 0) return null;
11656
11657
  for (const entry of entries) {
11657
11658
  const field = entry.field;
@@ -11663,7 +11664,7 @@ function discoveryMerge(err, body, defaults) {
11663
11664
  }
11664
11665
  function stepErrorText(code, err) {
11665
11666
  const detail = vendorDetailOf(err);
11666
- const base = _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11667
+ const base = _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11667
11668
  return detail ? `${code}: ${detail}` : `${code}: ${base}`;
11668
11669
  }
11669
11670
 
@@ -11675,43 +11676,43 @@ var DEFAULT_PUBLISH = 1;
11675
11676
  var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
11676
11677
  var SAFE_TICKET_CREATE_DEFAULTS = {};
11677
11678
  function validateOpenInput(params, note, assign) {
11678
- const companyID = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11679
+ const companyID = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11679
11680
  const title = _optionalChain([params, 'optionalAccess', _107 => _107.title]);
11680
11681
  if (typeof title !== "string" || title.trim() === "") {
11681
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11682
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11682
11683
  }
11683
11684
  const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
11684
11685
  const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
11685
11686
  if (!isPositiveInt(priority)) {
11686
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11687
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11687
11688
  }
11688
11689
  if (!isPositiveInt(status)) {
11689
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11690
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11690
11691
  }
11691
11692
  if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
11692
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11693
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11693
11694
  }
11694
11695
  if (note !== void 0) {
11695
11696
  if (typeof note.description !== "string" || note.description.trim() === "") {
11696
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11697
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11697
11698
  }
11698
11699
  if (typeof note.title !== "string" || note.title.trim() === "") {
11699
- throw new (0, _chunkLLIB4JGKcjs.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 });
11700
+ throw new (0, _chunkIKPFR6K2cjs.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 });
11700
11701
  }
11701
11702
  if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
11702
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11703
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11703
11704
  }
11704
11705
  if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
11705
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11706
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11706
11707
  }
11707
11708
  }
11708
- const assignee = assign === void 0 ? void 0 : _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11709
+ const assignee = assign === void 0 ? void 0 : _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11709
11710
  if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
11710
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11711
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11711
11712
  }
11712
11713
  const roleID = _optionalChain([assign, 'optionalAccess', _108 => _108.roleID]);
11713
11714
  if (assign !== void 0 && !isPositiveInt(roleID)) {
11714
- throw new (0, _chunkLLIB4JGKcjs.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 });
11715
+ throw new (0, _chunkIKPFR6K2cjs.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 });
11715
11716
  }
11716
11717
  return { companyID, title, priority, status, assignee, roleID };
11717
11718
  }
@@ -11740,7 +11741,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
11740
11741
  if (assign !== void 0) {
11741
11742
  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).`);
11742
11743
  }
11743
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11744
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
11744
11745
  {
11745
11746
  operation: OP_OPEN,
11746
11747
  method: "POST",
@@ -11780,8 +11781,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11780
11781
  `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}` : ""}`,
11781
11782
  {
11782
11783
  operation: OP_OPEN,
11783
- httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11784
- vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11784
+ httpStatus: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11785
+ vendorError: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11785
11786
  }
11786
11787
  );
11787
11788
  }
@@ -11796,8 +11797,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11796
11797
  named,
11797
11798
  {
11798
11799
  operation: OP_OPEN,
11799
- httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11800
- vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11800
+ httpStatus: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11801
+ vendorError: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11801
11802
  resourceIds: [companyID],
11802
11803
  details: { idRefs: [{ entity: "company", id: companyID }] }
11803
11804
  }
@@ -11822,10 +11823,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
11822
11823
  try {
11823
11824
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
11824
11825
  if (current === null) {
11825
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11826
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11826
11827
  }
11827
11828
  ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
11828
- const merged = _chunkLLIB4JGKcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11829
+ const merged = _chunkIKPFR6K2cjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11829
11830
  merged.id = ticketId;
11830
11831
  await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
11831
11832
  assigned = true;
@@ -11889,7 +11890,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11889
11890
  const ids2 = await readLiveStatusSet(resource);
11890
11891
  if (ids2.size > 0) liveStatus = ids2;
11891
11892
  } catch (err) {
11892
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11893
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11893
11894
  }
11894
11895
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
11895
11896
  _optionalChain([http, 'access', _109 => _109.fieldCache, 'optionalAccess', _110 => _110.invalidate, 'call', _111 => _111("tickets")]);
@@ -11899,7 +11900,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11899
11900
  const freshIds = await readLiveStatusSet(resource);
11900
11901
  if (freshIds.size > 0) freshStatus = freshIds;
11901
11902
  } catch (err) {
11902
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11903
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11903
11904
  freshStatus = null;
11904
11905
  reReadFailed = true;
11905
11906
  }
@@ -11917,7 +11918,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11917
11918
  return { guardDegraded: liveStatus === null };
11918
11919
  }
11919
11920
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
11920
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11921
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
11921
11922
  {
11922
11923
  operation: OP_STATUS,
11923
11924
  method: "PUT",
@@ -11971,7 +11972,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11971
11972
  if (mapEntry === void 0) {
11972
11973
  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).`);
11973
11974
  }
11974
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11975
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
11975
11976
  {
11976
11977
  operation: OP_STATUS,
11977
11978
  method: "PUT",
@@ -11991,7 +11992,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11991
11992
  }
11992
11993
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
11993
11994
  const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _114 => _114.safeDefaults]), () => ( {}));
11994
- const body = _chunkLLIB4JGKcjs.mergePartialBody.call(void 0, current, mergeData);
11995
+ const body = _chunkIKPFR6K2cjs.mergePartialBody.call(void 0, current, mergeData);
11995
11996
  body.id = ticketId;
11996
11997
  let merges = 0;
11997
11998
  for (; ; ) {
@@ -12015,8 +12016,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
12015
12016
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
12016
12017
  {
12017
12018
  operation: OP_STATUS,
12018
- httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
12019
- vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
12019
+ httpStatus: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
12020
+ vendorError: _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
12020
12021
  resourceIds: [ticketId],
12021
12022
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
12022
12023
  }
@@ -12029,7 +12030,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
12029
12030
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
12030
12031
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
12031
12032
  if (verify === null) {
12032
- throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
12033
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
12033
12034
  code: "INVALID_RESPONSE",
12034
12035
  category: "server",
12035
12036
  operation: OP_STATUS,
@@ -12039,7 +12040,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
12039
12040
  }
12040
12041
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
12041
12042
  if (finalStatus !== targetStatus) {
12042
- throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(
12043
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskError)(
12043
12044
  `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)`,
12044
12045
  {
12045
12046
  code: "INVALID_RESPONSE",
@@ -12054,17 +12055,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
12054
12055
  }
12055
12056
  }
12056
12057
  async function changeStatus(resource, id, targetStatus, fields, opts, http) {
12057
- const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
12058
+ const ticketId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
12058
12059
  if (!isPositiveInt(targetStatus)) {
12059
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12060
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12060
12061
  }
12061
12062
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
12062
12063
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
12063
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12064
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12064
12065
  }
12065
12066
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
12066
12067
  if (current === null) {
12067
- throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
12068
+ throw new (0, _chunkIKPFR6K2cjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
12068
12069
  }
12069
12070
  const previousStatus = typeof current.status === "number" ? current.status : null;
12070
12071
  if (previousStatus === targetStatus) {
@@ -12084,7 +12085,7 @@ var DEFAULT_PART_LIMIT = 50;
12084
12085
  function partLimit(value, name) {
12085
12086
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
12086
12087
  if (!Number.isInteger(n) || n < 1) {
12087
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12088
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12088
12089
  }
12089
12090
  return n;
12090
12091
  }
@@ -12097,13 +12098,13 @@ function servedTextRecord(row, textField, limit) {
12097
12098
  return out;
12098
12099
  }
12099
12100
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
12100
- const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS);
12101
+ const builder = _chunkIKPFR6K2cjs.createNamePlan.call(void 0, _chunkIKPFR6K2cjs.TICKET_LABEL_FIELDS);
12101
12102
  const t = ctx.ticket;
12102
12103
  builder.addResource(t["creatorResourceID"]);
12103
12104
  builder.addFk("contract", t["contractID"]);
12104
12105
  builder.addFk("billingCode", t["billingCodeID"]);
12105
12106
  builder.addFk("role", t["assignedResourceRoleID"]);
12106
- const ticketLobPointer = _chunkLLIB4JGKcjs.vendorId.call(void 0, t["organizationalLevelAssociationID"]);
12107
+ const ticketLobPointer = _chunkIKPFR6K2cjs.vendorId.call(void 0, t["organizationalLevelAssociationID"]);
12107
12108
  if (ticketLobPointer !== void 0) {
12108
12109
  builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
12109
12110
  } else {
@@ -12115,20 +12116,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
12115
12116
  builder.addFk("billingCode", e["billingCodeID"]);
12116
12117
  builder.addFk("contract", e["contractID"]);
12117
12118
  }
12118
- const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12119
+ const names = await _chunkIKPFR6K2cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12119
12120
  const ticketRow = { ...ctx.ticket };
12120
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12121
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12122
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12123
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12124
- for (const f of _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS) _chunkLLIB4JGKcjs.addLabelSibling.call(void 0, ticketRow, f, names);
12121
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12122
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12123
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12124
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12125
+ for (const f of _chunkIKPFR6K2cjs.TICKET_LABEL_FIELDS) _chunkIKPFR6K2cjs.addLabelSibling.call(void 0, ticketRow, f, names);
12125
12126
  result.ticket = ticketRow;
12126
12127
  result.timeEntries.items = entriesPart.items.map((e) => {
12127
12128
  const row = { ...e };
12128
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12129
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12130
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12131
- _chunkLLIB4JGKcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
12129
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12130
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12131
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12132
+ _chunkIKPFR6K2cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
12132
12133
  return row;
12133
12134
  });
12134
12135
  result.names = names.section;
@@ -12144,7 +12145,7 @@ async function fullContext(resource, id, opts = {}, http) {
12144
12145
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
12145
12146
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
12146
12147
  const textLimit = partLimit(opts.textLimit, "textLimit");
12147
- const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
12148
+ const ticketId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
12148
12149
  const ctx = await resource.getContext(ticketId);
12149
12150
  const op = "tickets.fullContext";
12150
12151
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -12211,7 +12212,7 @@ var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResource
12211
12212
  function positiveId2(value, name) {
12212
12213
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12213
12214
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12214
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
12215
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
12215
12216
  }
12216
12217
  return n;
12217
12218
  }
@@ -12223,26 +12224,26 @@ async function ticketPage(http, filter, maxRecords, fields) {
12223
12224
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
12224
12225
  operation: OP5
12225
12226
  });
12226
- const page = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP5);
12227
+ const page = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, OP5);
12227
12228
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
12228
12229
  }
12229
12230
  async function forResource(_resource, resourceIDIn, http, opts = {}) {
12230
- if (opts === null || typeof opts !== "object") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: opts must be an object`, { operation: OP5 });
12231
+ if (opts === null || typeof opts !== "object") throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: opts must be an object`, { operation: OP5 });
12231
12232
  const resourceID = positiveId2(resourceIDIn, "resourceID");
12232
12233
  const scope = _nullishCoalesce(opts.scope, () => ( "both"));
12233
12234
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
12234
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP5 });
12235
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP5 });
12235
12236
  }
12236
12237
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
12237
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: openOnly must be a boolean`, { operation: OP5 });
12238
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: openOnly must be a boolean`, { operation: OP5 });
12238
12239
  }
12239
12240
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
12240
12241
  if (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX) {
12241
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP5 });
12242
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP5 });
12242
12243
  }
12243
12244
  const includeFields = _nullishCoalesce(opts.includeFields, () => ( []));
12244
12245
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
12245
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: includeFields must be a list of field names`, { operation: OP5 });
12246
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP5}: includeFields must be a list of field names`, { operation: OP5 });
12246
12247
  }
12247
12248
  const openOnly = opts.openOnly === true;
12248
12249
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS2, ...includeFields])];
@@ -12259,7 +12260,7 @@ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12259
12260
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
12260
12261
  operation: OP5
12261
12262
  });
12262
- const page = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP5);
12263
+ const page = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, OP5);
12263
12264
  for (const row of page.items) if (typeof row.ticketID === "number" && !linkIds.includes(row.ticketID)) linkIds.push(row.ticketID);
12264
12265
  if (page.items.length >= LINK_READ_CAP || page.pageDetails.nextPageUrl !== null) capped = true;
12265
12266
  }
@@ -12316,7 +12317,7 @@ var OP6 = "tickets.lineOfBusiness";
12316
12317
  function positiveId3(value, name) {
12317
12318
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
12318
12319
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12319
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(OP6 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP6 });
12320
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(OP6 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP6 });
12320
12321
  }
12321
12322
  return n;
12322
12323
  }
@@ -12331,25 +12332,25 @@ async function lineOfBusiness2(resource, ticketIdIn, http, associationIdIn) {
12331
12332
  associationSource = "argument";
12332
12333
  } else {
12333
12334
  const ticket = await resource.get(ticketId);
12334
- associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, ticket.organizationalLevelAssociationID);
12335
+ associationId = _chunkIKPFR6K2cjs.vendorId.call(void 0, ticket.organizationalLevelAssociationID);
12335
12336
  if (associationId !== void 0) {
12336
12337
  associationSource = "ticket";
12337
12338
  } else {
12338
- const contractRef = _chunkLLIB4JGKcjs.vendorId.call(void 0, ticket.contractID);
12339
+ const contractRef = _chunkIKPFR6K2cjs.vendorId.call(void 0, ticket.contractID);
12339
12340
  if (contractRef !== void 0) {
12340
12341
  const client = http.client;
12341
12342
  if (client === void 0) {
12342
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(OP6 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP6 });
12343
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(OP6 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP6 });
12343
12344
  }
12344
12345
  try {
12345
12346
  const contract = await client.contracts.get(contractRef);
12346
12347
  contractId = contractRef;
12347
- associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
12348
+ associationId = _chunkIKPFR6K2cjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
12348
12349
  if (associationId !== void 0) associationSource = "contract";
12349
12350
  } catch (e) {
12350
- if (e instanceof _chunkLLIB4JGKcjs.NotFoundError) {
12351
+ if (e instanceof _chunkIKPFR6K2cjs.NotFoundError) {
12351
12352
  contractId = contractRef;
12352
- } else if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && e.code !== "ABORTED") {
12353
+ } else if (_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, e) && e.code !== "ABORTED") {
12353
12354
  contractId = contractRef;
12354
12355
  contractUnread = true;
12355
12356
  } else {
@@ -12370,7 +12371,7 @@ async function lineOfBusiness2(resource, ticketIdIn, http, associationIdIn) {
12370
12371
  markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
12371
12372
  };
12372
12373
  }
12373
- const chain = await _chunkLLIB4JGKcjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP6, onError: "propagate" });
12374
+ const chain = await _chunkIKPFR6K2cjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP6, onError: "propagate" });
12374
12375
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
12375
12376
  return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
12376
12377
  }
@@ -12381,7 +12382,7 @@ async function statusSemantics(_resource, opts = {}, http) {
12381
12382
  }
12382
12383
 
12383
12384
  // src/resources/tickets.ts
12384
- var TicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12385
+ var TicketsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
12385
12386
  constructor(http, pageSize) {
12386
12387
  super(http, {
12387
12388
  key: "tickets",
@@ -12500,7 +12501,7 @@ var TicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12500
12501
  };
12501
12502
 
12502
12503
  // src/resources/ticket_webhooks.ts
12503
- var TicketWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12504
+ var TicketWebhooksResource = class extends _chunkIKPFR6K2cjs.BaseResource {
12504
12505
  constructor(http, pageSize) {
12505
12506
  super(http, {
12506
12507
  key: "ticket_webhooks",
@@ -12575,6 +12576,33 @@ var TicketWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12575
12576
  }
12576
12577
  };
12577
12578
 
12579
+ // src/resources/special/time_entries/posted.ts
12580
+ var isApproved = (entry) => typeof entry.billingApprovalDateTime === "string" && entry.billingApprovalDateTime.trim() !== "";
12581
+ async function postedStateOf(http, entries, op) {
12582
+ const states = /* @__PURE__ */ new Map();
12583
+ const ids2 = [...new Set(entries.map((e) => e.id))];
12584
+ let incomplete = false;
12585
+ for (let c = 0; c < ids2.length; c += _chunkIKPFR6K2cjs.FETCH_BY_IDS_CHUNK_SIZE) {
12586
+ const chunk = ids2.slice(c, c + _chunkIKPFR6K2cjs.FETCH_BY_IDS_CHUNK_SIZE);
12587
+ const res = await http.request({
12588
+ method: "POST",
12589
+ idempotent: true,
12590
+ path: "/V1.0/BillingItems/query",
12591
+ body: { MaxRecords: 500, IncludeFields: ["id", "timeEntryID"], filter: [{ field: "timeEntryID", op: "in", value: chunk }] },
12592
+ operation: op
12593
+ });
12594
+ const { items, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res);
12595
+ const billed = new Set(items.map((i) => i.timeEntryID));
12596
+ const more = pageDetails.nextPageUrl != null;
12597
+ if (more) incomplete = true;
12598
+ for (const id of chunk) {
12599
+ if (billed.has(id)) states.set(id, "posted");
12600
+ else if (!more) states.set(id, "unposted");
12601
+ }
12602
+ }
12603
+ return { states, incomplete };
12604
+ }
12605
+
12578
12606
  // src/resources/special/time_entries/windows.ts
12579
12607
  var DAY_MS2 = 864e5;
12580
12608
  var iso2 = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
@@ -12586,7 +12614,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
12586
12614
  body: { MaxRecords: limit, filter },
12587
12615
  operation
12588
12616
  });
12589
- const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res);
12617
+ const { items, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res);
12590
12618
  return { items, hasMore: pageDetails.nextPageUrl != null };
12591
12619
  }
12592
12620
  async function windowQuery3(_resource, kind, http, opts) {
@@ -12605,7 +12633,7 @@ async function customRange3(_resource, from, to, http, opts) {
12605
12633
  const fromB = customRangeDay(from, "from", void 0, "customRange");
12606
12634
  const toB = customRangeDay(to, "to", void 0, "customRange");
12607
12635
  if (fromB.ms > toB.ms) {
12608
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("customRange: from must not be after to");
12636
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("customRange: from must not be after to");
12609
12637
  }
12610
12638
  const toEndMs = toB.ms + DAY_MS2 - 1;
12611
12639
  const filter = [
@@ -12615,48 +12643,56 @@ async function customRange3(_resource, from, to, http, opts) {
12615
12643
  const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _120 => _120.limit])), "time_entries.customRange", http);
12616
12644
  return items;
12617
12645
  }
12618
- async function postedDateStatusQuery(_resource, mode, http, opts) {
12619
- const filter = [
12620
- { field: "postedDate", op: mode === "posted" ? "exist" : "notExist" }
12621
- ];
12622
- if (_optionalChain([opts, 'optionalAccess', _121 => _121.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12646
+ async function postedStateQuery(_resource, mode, http, opts) {
12623
12647
  const operation = mode === "posted" ? "time_entries.getPosted" : "time_entries.getUnposted";
12624
- const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _122 => _122.limit])), operation, http);
12625
- return items;
12648
+ const window = { from: null, to: null };
12649
+ const filter = [];
12650
+ const fromB = _optionalChain([opts, 'optionalAccess', _121 => _121.dateFrom]) === void 0 ? void 0 : customRangeDay(opts.dateFrom, "from", void 0, operation);
12651
+ const toB = _optionalChain([opts, 'optionalAccess', _122 => _122.dateTo]) === void 0 ? void 0 : customRangeDay(opts.dateTo, "to", void 0, operation);
12652
+ if (fromB && toB && fromB.ms > toB.ms) {
12653
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${operation}: dateFrom (${iso2(fromB.ms)}) must not be after dateTo (${iso2(toB.ms)})`, { operation });
12654
+ }
12655
+ if (fromB) filter.push({ field: "dateWorked", op: "gte", value: window.from = iso2(fromB.ms) });
12656
+ if (toB) filter.push({ field: "dateWorked", op: "lte", value: window.to = iso2(toB.ms + DAY_MS2 - 1) });
12657
+ if (_optionalChain([opts, 'optionalAccess', _123 => _123.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12658
+ const read = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _124 => _124.limit])), operation, http);
12659
+ const { states, incomplete } = await postedStateOf(http, read.items, operation);
12660
+ const items = read.items.filter((e) => states.get(e.id) === mode);
12661
+ const approvedCount = items.filter(isApproved).length;
12662
+ return { items, hasMore: read.hasMore || incomplete, window, approvedCount, unapprovedCount: items.length - approvedCount };
12626
12663
  }
12627
12664
  async function postedWithin(_resource, from, to, http, opts, opLabel = "time_entries.postedWithin") {
12628
12665
  const OP11 = opLabel;
12629
- if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP11);
12666
+ if (_optionalChain([opts, 'optionalAccess', _125 => _125.tz]) !== void 0) validateZone(opts.tz, OP11);
12630
12667
  const fromB = customRangeDay(from, "from", void 0, OP11);
12631
12668
  const toB = customRangeDay(to, "to", void 0, OP11);
12632
12669
  if (fromB.ms > toB.ms) {
12633
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP11}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP11 });
12670
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP11}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP11 });
12634
12671
  }
12635
12672
  const windowToMs = toB.ms + DAY_MS2 - 1;
12636
12673
  const filter = [
12637
12674
  { field: "dateWorked", op: "gte", value: iso2(fromB.ms) },
12638
12675
  { field: "dateWorked", op: "lte", value: iso2(windowToMs) }
12639
12676
  ];
12640
- if (_optionalChain([opts, 'optionalAccess', _124 => _124.posted]) === true) filter.push({ field: "postedDate", op: "exist" });
12641
- else if (_optionalChain([opts, 'optionalAccess', _125 => _125.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
12642
12677
  if (_optionalChain([opts, 'optionalAccess', _126 => _126.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12643
12678
  if (_optionalChain([opts, 'optionalAccess', _127 => _127.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
12644
12679
  const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP11, http);
12680
+ const { states, incomplete } = await postedStateOf(http, items, OP11);
12645
12681
  let postedCount = 0;
12646
- for (const item of items) {
12647
- const postedDate = item.postedDate;
12648
- if (typeof postedDate === "string" ? postedDate.trim() !== "" : postedDate !== null && postedDate !== void 0) {
12649
- postedCount += 1;
12650
- }
12682
+ let unpostedCount = 0;
12683
+ for (const state of states.values()) {
12684
+ if (state === "posted") postedCount += 1;
12685
+ else unpostedCount += 1;
12651
12686
  }
12687
+ const keep = _optionalChain([opts, 'optionalAccess', _129 => _129.posted]) === void 0 ? void 0 : opts.posted ? "posted" : "unposted";
12652
12688
  return {
12653
- items,
12689
+ items: keep === void 0 ? items : items.filter((e) => states.get(e.id) === keep),
12654
12690
  postedCount,
12655
- unpostedCount: items.length - postedCount,
12691
+ unpostedCount,
12656
12692
  window: { from: iso2(fromB.ms), to: iso2(windowToMs) },
12657
12693
  // A live next-page cursor past the bounded read: the counts above cover
12658
12694
  // the returned rows ONLY when this is true (issue #66 AC1 — the 500-row cap case is the general case).
12659
- truncated: hasMore
12695
+ truncated: hasMore || incomplete
12660
12696
  };
12661
12697
  }
12662
12698
  async function dateWorkedWindow(resource, from, to, http, opts) {
@@ -12664,13 +12700,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
12664
12700
  }
12665
12701
 
12666
12702
  // src/resources/special/time_entries/errors.ts
12667
- var ResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12703
+ var ResourceInvalidError = class extends _chunkIKPFR6K2cjs.AutotaskError {
12668
12704
  constructor(message, options = {}) {
12669
12705
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
12670
12706
  this.name = "ResourceInvalidError";
12671
12707
  }
12672
12708
  };
12673
- var AllocationCodeError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12709
+ var AllocationCodeError = class extends _chunkIKPFR6K2cjs.AutotaskError {
12674
12710
  /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
12675
12711
 
12676
12712
  constructor(kind, message, options = {}) {
@@ -12679,7 +12715,7 @@ var AllocationCodeError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12679
12715
  this.kind = kind;
12680
12716
  }
12681
12717
  };
12682
- var NoApplicableAllocationCodeError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12718
+ var NoApplicableAllocationCodeError = class extends _chunkIKPFR6K2cjs.AutotaskError {
12683
12719
  /** The structured blocker details (filters tried + department sets). */
12684
12720
 
12685
12721
  constructor(details, options = {}) {
@@ -12744,7 +12780,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12744
12780
  let pages = 0;
12745
12781
  for (; ; ) {
12746
12782
  if (pages >= PAGE_GUARD) {
12747
- throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12783
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12748
12784
  code: "RESOLUTION_TRUNCATED",
12749
12785
  category: "resolution",
12750
12786
  operation,
@@ -12755,11 +12791,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12755
12791
  const res = await http.request({
12756
12792
  method: "POST",
12757
12793
  idempotent: true,
12758
- path: isFirst ? path : _chunkLLIB4JGKcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12794
+ path: isFirst ? path : _chunkIKPFR6K2cjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12759
12795
  body: { MaxRecords: pageSize, filter },
12760
12796
  operation
12761
12797
  });
12762
- const { items: pageItems, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
12798
+ const { items: pageItems, pageDetails } = _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, operation);
12763
12799
  items.push(...pageItems);
12764
12800
  pages += 1;
12765
12801
  if (items.length >= totalCap) break;
@@ -12876,7 +12912,7 @@ function windowDefaults(params) {
12876
12912
  var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
12877
12913
  var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
12878
12914
  function validateCreateParams(params) {
12879
- const pin = (value, label) => typeof value === "number" ? _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, value, label) : void 0;
12915
+ const pin = (value, label) => typeof value === "number" ? _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, value, label) : void 0;
12880
12916
  const pins = {
12881
12917
  code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
12882
12918
  ticket: pin(params.ticketID, "ticketID"),
@@ -12885,19 +12921,19 @@ function validateCreateParams(params) {
12885
12921
  };
12886
12922
  const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
12887
12923
  if (pinCount > 1) {
12888
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12924
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
12889
12925
  "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)",
12890
12926
  { operation: OP7 }
12891
12927
  );
12892
12928
  }
12893
12929
  if (pins.role !== void 0 && pins.code !== void 0) {
12894
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12930
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
12895
12931
  "createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
12896
12932
  { operation: OP7 }
12897
12933
  );
12898
12934
  }
12899
12935
  if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
12900
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12936
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
12901
12937
  `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
12902
12938
  { operation: OP7 }
12903
12939
  );
@@ -12980,7 +13016,7 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
12980
13016
  if (usedLinkage === "internal" && linkage === "task") {
12981
13017
  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).");
12982
13018
  }
12983
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
13019
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
12984
13020
  {
12985
13021
  operation: OP7,
12986
13022
  method: "POST",
@@ -13020,7 +13056,7 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
13020
13056
  };
13021
13057
  } catch (err) {
13022
13058
  lastError = err;
13023
- const text = _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
13059
+ const text = _chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkIKPFR6K2cjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
13024
13060
  const gate3 = ROLE_REJECTION_PATTERN.test(text);
13025
13061
  if (usedLinkage !== "internal" && gate3) {
13026
13062
  if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
@@ -13040,13 +13076,13 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
13040
13076
  throw err;
13041
13077
  }
13042
13078
  }
13043
- if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, lastError)) {
13079
+ if (_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, lastError)) {
13044
13080
  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.`;
13045
13081
  }
13046
13082
  throw lastError;
13047
13083
  }
13048
13084
  async function createForResource(resource, resourceID, params, opts = {}, http) {
13049
- const rid = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
13085
+ const rid = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, resourceID, "resourceID");
13050
13086
  const pins = validateCreateParams(params);
13051
13087
  await assertResourceActive(http, rid);
13052
13088
  const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
@@ -13059,8 +13095,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
13059
13095
  return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
13060
13096
  }
13061
13097
  function discoveryField(err, body, defaults) {
13062
- if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
13063
- const entries = _chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError);
13098
+ if (!_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
13099
+ const entries = _chunkIKPFR6K2cjs.parseVendorErrors.call(void 0, err.vendorError);
13064
13100
  if (entries === void 0) return null;
13065
13101
  for (const entry of entries) {
13066
13102
  const field = entry.field;
@@ -13079,9 +13115,9 @@ var CONTRACT_SCOPED2 = ["contractID", "contractServiceID", "contractServiceBundl
13079
13115
  async function readTimeEntry(http, id, retries) {
13080
13116
  try {
13081
13117
  const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP8, maxRetries: retries });
13082
- return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _129 => _129.item]), () => ( null));
13118
+ return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _130 => _130.item]), () => ( null));
13083
13119
  } catch (e) {
13084
- if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
13120
+ if (_chunkIKPFR6K2cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
13085
13121
  throw e;
13086
13122
  }
13087
13123
  }
@@ -13147,11 +13183,11 @@ var OP9 = "time_entries.approve";
13147
13183
  var APPROVAL_LEVELS_PATH = "/V1.0/BillingItemApprovalLevels";
13148
13184
  function toIso(value) {
13149
13185
  if (value instanceof Date) {
13150
- if (Number.isNaN(value.getTime())) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13186
+ if (Number.isNaN(value.getTime())) throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13151
13187
  return value.toISOString();
13152
13188
  }
13153
13189
  const parsed = new Date(value);
13154
- if (Number.isNaN(parsed.getTime())) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13190
+ if (Number.isNaN(parsed.getTime())) throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13155
13191
  return parsed.toISOString();
13156
13192
  }
13157
13193
  function toNumber(value) {
@@ -13164,22 +13200,22 @@ function sameInstant(a, b) {
13164
13200
  return !Number.isNaN(left) && left === right;
13165
13201
  }
13166
13202
  async function approve(resource, id, opts = {}, http) {
13167
- const numericId = toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id"));
13203
+ const numericId = toNumber(_chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id"));
13168
13204
  if (opts.approvalLevel !== void 0 && (!Number.isInteger(opts.approvalLevel) || opts.approvalLevel < 1)) {
13169
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13205
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13170
13206
  }
13171
13207
  const approvalLevel = _nullishCoalesce(opts.approvalLevel, () => ( 1));
13172
13208
  const approvalDateTime = toIso(_nullishCoalesce(opts.approvalDateTime, () => ( /* @__PURE__ */ new Date())));
13173
13209
  const entry = await resource.get(numericId);
13174
- const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13210
+ const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkIKPFR6K2cjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13175
13211
  if (approvalResourceID === void 0) {
13176
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
13212
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(
13177
13213
  `time_entries.approve: time entry ${numericId} carries no resourceID and the caller supplied no approvalResourceID \u2014 the vendor requires an approving resource`
13178
13214
  );
13179
13215
  }
13180
13216
  const body = { timeEntryID: numericId, approvalLevel, approvalResourceID, approvalDateTime };
13181
13217
  if (opts.dryRun === true) {
13182
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
13218
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0,
13183
13219
  {
13184
13220
  operation: OP9,
13185
13221
  method: "POST",
@@ -13207,7 +13243,7 @@ async function approve(resource, id, opts = {}, http) {
13207
13243
  operation: OP9,
13208
13244
  maxRetries: opts.maxRetries
13209
13245
  });
13210
- const levelId = toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, created, OP9).id, "billingItemApprovalLevelID"));
13246
+ const levelId = toNumber(_chunkIKPFR6K2cjs.parseIdentifier.call(void 0, _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, created, OP9).id, "billingItemApprovalLevelID"));
13211
13247
  await resource.update(
13212
13248
  numericId,
13213
13249
  { billingApprovalDateTime: approvalDateTime, billingApprovalResourceID: approvalResourceID },
@@ -13237,13 +13273,13 @@ var TICKET_FIELDS3 = ["id", "ticketNumber", "title", "status", "assignedResource
13237
13273
  function positiveId4(value, name) {
13238
13274
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
13239
13275
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
13240
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP10 });
13276
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP10}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP10 });
13241
13277
  }
13242
13278
  return n;
13243
13279
  }
13244
13280
  async function recentTickets(_resource, from, to, http, opts) {
13245
13281
  if (opts === void 0 || opts === null || typeof opts !== "object") {
13246
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP10 });
13282
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP10}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP10 });
13247
13283
  }
13248
13284
  const resourceID = positiveId4(opts.resourceID, "resourceID");
13249
13285
  const companyID = opts.companyID === void 0 ? void 0 : positiveId4(opts.companyID, "companyID");
@@ -13251,7 +13287,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13251
13287
  const fromB = customRangeDay(from, "from", void 0, OP10);
13252
13288
  const toB = customRangeDay(to, "to", void 0, OP10);
13253
13289
  if (fromB.ms > toB.ms) {
13254
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP10 });
13290
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)(`${OP10}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP10 });
13255
13291
  }
13256
13292
  const windowToMs = toB.ms + DAY_MS3 - 1;
13257
13293
  const { items: entries, hasMore } = await queryTimeEntries(
@@ -13290,7 +13326,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13290
13326
  body: { MaxRecords: TICKET_CHUNK2, filter, IncludeFields: TICKET_FIELDS3 },
13291
13327
  operation: OP10
13292
13328
  });
13293
- for (const t of _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP10).items) if (typeof t.id === "number") tickets.set(t.id, t);
13329
+ for (const t of _chunkIKPFR6K2cjs.unwrapItems.call(void 0, res, OP10).items) if (typeof t.id === "number") tickets.set(t.id, t);
13294
13330
  }
13295
13331
  const items = [];
13296
13332
  const unresolvedTicketIDs = [];
@@ -13298,17 +13334,17 @@ async function recentTickets(_resource, from, to, http, opts) {
13298
13334
  for (const [ticketID, g] of groups) {
13299
13335
  const t = tickets.get(ticketID);
13300
13336
  if (t === void 0) unresolvedTicketIDs.push(ticketID);
13301
- if (companyID !== void 0 && _optionalChain([t, 'optionalAccess', _130 => _130.companyID]) !== companyID) {
13337
+ if (companyID !== void 0 && _optionalChain([t, 'optionalAccess', _131 => _131.companyID]) !== companyID) {
13302
13338
  if (t !== void 0) excludedTickets += 1;
13303
13339
  continue;
13304
13340
  }
13305
13341
  items.push({
13306
13342
  ticketID,
13307
- ..._optionalChain([t, 'optionalAccess', _131 => _131.ticketNumber]) !== void 0 ? { ticketNumber: t.ticketNumber } : {},
13308
- ..._optionalChain([t, 'optionalAccess', _132 => _132.title]) !== void 0 ? { title: t.title } : {},
13309
- ..._optionalChain([t, 'optionalAccess', _133 => _133.status]) !== void 0 ? { status: t.status } : {},
13310
- ..._optionalChain([t, 'optionalAccess', _134 => _134.assignedResourceID]) !== void 0 ? { assignedResourceID: t.assignedResourceID } : {},
13311
- ..._optionalChain([t, 'optionalAccess', _135 => _135.companyID]) !== void 0 ? { companyID: t.companyID } : {},
13343
+ ..._optionalChain([t, 'optionalAccess', _132 => _132.ticketNumber]) !== void 0 ? { ticketNumber: t.ticketNumber } : {},
13344
+ ..._optionalChain([t, 'optionalAccess', _133 => _133.title]) !== void 0 ? { title: t.title } : {},
13345
+ ..._optionalChain([t, 'optionalAccess', _134 => _134.status]) !== void 0 ? { status: t.status } : {},
13346
+ ..._optionalChain([t, 'optionalAccess', _135 => _135.assignedResourceID]) !== void 0 ? { assignedResourceID: t.assignedResourceID } : {},
13347
+ ..._optionalChain([t, 'optionalAccess', _136 => _136.companyID]) !== void 0 ? { companyID: t.companyID } : {},
13312
13348
  entryCount: g.entryCount,
13313
13349
  totalHours: Math.round(g.totalHours * 100) / 100,
13314
13350
  lastWorked: g.lastWorked
@@ -13327,7 +13363,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13327
13363
  }
13328
13364
 
13329
13365
  // src/resources/time_entries.ts
13330
- var TimeEntriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13366
+ var TimeEntriesResource = class extends _chunkIKPFR6K2cjs.BaseResource {
13331
13367
  constructor(http, pageSize) {
13332
13368
  super(http, {
13333
13369
  key: "time_entries",
@@ -13411,11 +13447,11 @@ var TimeEntriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13411
13447
  }
13412
13448
  /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */
13413
13449
  getPosted(opts) {
13414
- return postedDateStatusQuery(this, "posted", this.http, opts);
13450
+ return postedStateQuery(this, "posted", this.http, opts);
13415
13451
  }
13416
13452
  /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */
13417
13453
  getUnposted(opts) {
13418
- return postedDateStatusQuery(this, "unposted", this.http, opts);
13454
+ return postedStateQuery(this, "unposted", this.http, opts);
13419
13455
  }
13420
13456
  /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */
13421
13457
  last14(opts) {
@@ -13476,7 +13512,7 @@ var TimeEntriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13476
13512
  };
13477
13513
 
13478
13514
  // src/resources/time_entry_attachments.ts
13479
- var TimeEntryAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13515
+ var TimeEntryAttachmentsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
13480
13516
  constructor(http, pageSize) {
13481
13517
  super(http, {
13482
13518
  key: "time_entry_attachments",
@@ -13539,9 +13575,9 @@ var TimeEntryAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource
13539
13575
 
13540
13576
  // src/resources/special/time_off_requests.ts
13541
13577
  async function approve2(_resource, id, opts = {}, http) {
13542
- const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
13578
+ const numericId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
13543
13579
  if (opts.dryRun === true) {
13544
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
13580
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
13545
13581
  operation: "time_off_requests.approve",
13546
13582
  method: "GET",
13547
13583
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -13557,16 +13593,16 @@ async function approve2(_resource, id, opts = {}, http) {
13557
13593
  operation: "time_off_requests.approve",
13558
13594
  maxRetries: opts.maxRetries
13559
13595
  });
13560
- return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
13596
+ return _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, res);
13561
13597
  }
13562
13598
  async function reject(_resource, id, reason, opts = {}, http) {
13563
- const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
13599
+ const numericId = _chunkIKPFR6K2cjs.parseIdentifier.call(void 0, id, "id");
13564
13600
  const text = reason.trim();
13565
13601
  if (text === "") {
13566
- throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13602
+ throw new (0, _chunkIKPFR6K2cjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13567
13603
  }
13568
13604
  if (opts.dryRun === true) {
13569
- return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
13605
+ return _chunkIKPFR6K2cjs.buildDryRunResult.call(void 0, {
13570
13606
  operation: "time_off_requests.reject",
13571
13607
  method: "POST",
13572
13608
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -13584,11 +13620,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
13584
13620
  operation: "time_off_requests.reject",
13585
13621
  maxRetries: opts.maxRetries
13586
13622
  });
13587
- return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
13623
+ return _chunkIKPFR6K2cjs.unwrapOperation.call(void 0, res);
13588
13624
  }
13589
13625
 
13590
13626
  // src/resources/time_off_requests.ts
13591
- var TimeOffRequestsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13627
+ var TimeOffRequestsResource = class extends _chunkIKPFR6K2cjs.BaseResource {
13592
13628
  constructor(http, pageSize) {
13593
13629
  super(http, {
13594
13630
  key: "time_off_requests",