node-autotask 0.29.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/MCP_TOOL_CATALOG.json +28 -9
  3. package/MCP_TOOL_MANIFEST.md +12 -11
  4. package/N8N_MCP_MANIFEST.json +3 -3
  5. package/N8N_MCP_MANIFEST.md +4 -4
  6. package/README.md +1 -1
  7. package/capabilities.json +1462 -1303
  8. package/dist/capabilities.cjs +2 -2
  9. package/dist/capabilities.js +1 -1
  10. package/dist/{chunk-X4TUU2Y6.js → chunk-2ETR5GSO.js} +2 -2
  11. package/dist/{chunk-PY45RBQ2.cjs → chunk-EDVSWL32.cjs} +1461 -1302
  12. package/dist/{chunk-APXBBN3D.cjs → chunk-L4TDVUJM.cjs} +143 -143
  13. package/dist/{chunk-IKWHRUQ5.cjs → chunk-LLIB4JGK.cjs} +52 -9
  14. package/dist/{chunk-T4SZGOJB.js → chunk-P4PC32RJ.js} +157 -80
  15. package/dist/{chunk-KVT5V7SA.js → chunk-QQPCJT2L.js} +49 -6
  16. package/dist/{chunk-BNIOQEKP.cjs → chunk-RS7QMPRO.cjs} +589 -512
  17. package/dist/{chunk-WKP442HS.js → chunk-TZC4ZAA6.js} +1461 -1302
  18. package/dist/{index-BZkfUU59.d.cts → index-B9VNv-EP.d.cts} +30 -3
  19. package/dist/{index-BGZ1Mhbh.d.cts → index-CJ36PwRG.d.cts} +6 -1
  20. package/dist/{index-BGZ1Mhbh.d.ts → index-CJ36PwRG.d.ts} +6 -1
  21. package/dist/{index-6_i-__sN.d.ts → index-DkpaFqyu.d.ts} +30 -3
  22. package/dist/index.cjs +22 -22
  23. package/dist/index.d.cts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +4 -4
  26. package/dist/operations/index.cjs +112 -112
  27. package/dist/operations/index.d.cts +4 -4
  28. package/dist/operations/index.d.ts +4 -4
  29. package/dist/operations/index.js +2 -2
  30. package/dist/pool.cjs +9 -9
  31. package/dist/pool.d.cts +2 -2
  32. package/dist/pool.d.ts +2 -2
  33. package/dist/pool.js +4 -4
  34. package/dist/resources/index.cjs +4 -4
  35. package/dist/resources/index.d.cts +2 -2
  36. package/dist/resources/index.d.ts +2 -2
  37. package/dist/resources/index.js +3 -3
  38. package/dist/types/index.d.cts +1 -1
  39. package/dist/types/index.d.ts +1 -1
  40. package/docs/API.md +1 -1
  41. package/package.json +1 -1
@@ -40,13 +40,13 @@
40
40
 
41
41
 
42
42
 
43
- var _chunkIKWHRUQ5cjs = require('./chunk-IKWHRUQ5.cjs');
43
+ var _chunkLLIB4JGKcjs = require('./chunk-LLIB4JGK.cjs');
44
44
 
45
45
 
46
- var _chunkPY45RBQ2cjs = require('./chunk-PY45RBQ2.cjs');
46
+ var _chunkEDVSWL32cjs = require('./chunk-EDVSWL32.cjs');
47
47
 
48
48
  // src/resources/appointments.ts
49
- var AppointmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
49
+ var AppointmentsResource = class extends _chunkLLIB4JGKcjs.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 _chunkIKWHRUQ5cjs.BaseResource {
134
+ var BillingCodesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
135
135
  constructor(http, pageSize) {
136
136
  super(http, {
137
137
  key: "billing_codes",
@@ -175,7 +175,7 @@ var BillingCodesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
175
175
  };
176
176
 
177
177
  // src/resources/billing_item_approval_levels.ts
178
- var BillingItemApprovalLevelsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
178
+ var BillingItemApprovalLevelsResource = class extends _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
220
+ throw new (0, _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.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, _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
293
+ throw new (0, _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
301
+ throw new (0, _chunkLLIB4JGKcjs.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
  );
@@ -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 _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
461
+ return _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
467
+ throw new (0, _chunkLLIB4JGKcjs.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, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
479
+ throw new (0, _chunkLLIB4JGKcjs.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
  );
@@ -487,7 +487,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
487
487
  const fromB = customRangeDay(from, "from", zone, operation);
488
488
  const toB = customRangeDay(to, "to", zone, operation);
489
489
  if (fromB.ms > toB.ms) {
490
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
490
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
491
491
  `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
492
492
  { operation }
493
493
  );
@@ -504,7 +504,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
504
504
  body: { MaxRecords: limit, filter },
505
505
  operation
506
506
  });
507
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
507
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
508
508
  }
509
509
 
510
510
  // src/resources/special/billing_items.ts
@@ -537,7 +537,7 @@ async function customRange(_resource, from, to, http, opts) {
537
537
  }
538
538
 
539
539
  // src/resources/billing_items.ts
540
- var BillingItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
540
+ var BillingItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
541
541
  constructor(http, pageSize) {
542
542
  super(http, {
543
543
  key: "billing_items",
@@ -639,7 +639,7 @@ var BillingItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
639
639
  };
640
640
 
641
641
  // src/resources/change_request_links.ts
642
- var ChangeRequestLinksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
642
+ var ChangeRequestLinksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
643
643
  constructor(http, pageSize) {
644
644
  super(http, {
645
645
  key: "change_request_links",
@@ -693,7 +693,7 @@ var ChangeRequestLinksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
693
693
  };
694
694
 
695
695
  // src/resources/checklist_libraries.ts
696
- var ChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
696
+ var ChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
697
697
  constructor(http, pageSize) {
698
698
  super(http, {
699
699
  key: "checklist_libraries",
@@ -767,7 +767,7 @@ var ChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
767
767
  };
768
768
 
769
769
  // src/resources/checklist_library_checklist_items.ts
770
- var ChecklistLibraryChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
770
+ var ChecklistLibraryChecklistItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
771
771
  constructor(http, pageSize) {
772
772
  super(http, {
773
773
  key: "checklist_library_checklist_items",
@@ -833,7 +833,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.Bas
833
833
  };
834
834
 
835
835
  // src/resources/classification_icons.ts
836
- var ClassificationIconsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
836
+ var ClassificationIconsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
837
837
  constructor(http, pageSize) {
838
838
  super(http, {
839
839
  key: "classification_icons",
@@ -940,7 +940,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
940
940
  body,
941
941
  operation
942
942
  });
943
- const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
943
+ const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
944
944
  const capped = items.length >= limit;
945
945
  return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
946
946
  }
@@ -950,7 +950,7 @@ var DEFAULT_LIMIT2 = 25;
950
950
  var MAX_LIMIT2 = 500;
951
951
  function clampLimit(limit) {
952
952
  const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
953
- if (!Number.isInteger(n) || n < 1) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
953
+ if (!Number.isInteger(n) || n < 1) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
954
954
  return Math.min(n, MAX_LIMIT2);
955
955
  }
956
956
 
@@ -963,7 +963,7 @@ async function queryCompanies(http, filter, limit) {
963
963
  body: { MaxRecords: limit, filter },
964
964
  operation: "companies.searchByDomain"
965
965
  });
966
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
966
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
967
967
  }
968
968
  async function queryContacts(http, filter, limit) {
969
969
  const res = await http.request({
@@ -973,7 +973,7 @@ async function queryContacts(http, filter, limit) {
973
973
  body: { MaxRecords: limit, filter },
974
974
  operation: "companies.searchByDomain"
975
975
  });
976
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
976
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
977
977
  }
978
978
  async function fetchCompanies(http, ids2, limit) {
979
979
  const out = [];
@@ -988,7 +988,7 @@ async function fetchCompanies(http, ids2, limit) {
988
988
  const item = body && "item" in body ? body.item : null;
989
989
  if (item) out.push(item);
990
990
  } catch (err) {
991
- if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) continue;
991
+ if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) continue;
992
992
  throw err;
993
993
  }
994
994
  }
@@ -996,7 +996,7 @@ async function fetchCompanies(http, ids2, limit) {
996
996
  }
997
997
  async function searchByDomain(_resource, domain, opts = {}, http) {
998
998
  const text = domain.trim();
999
- if (text === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchByDomain: empty domain");
999
+ if (text === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("searchByDomain: empty domain");
1000
1000
  const limit = clampLimit(opts.limit);
1001
1001
  const filter = [{ field: "webAddress", op: "contains", value: text }];
1002
1002
  const direct = await queryCompanies(http, filter, limit);
@@ -1010,7 +1010,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
1010
1010
  const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
1011
1011
  const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
1012
1012
  if (name === "" && email === "" && website === "") {
1013
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1013
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1014
1014
  }
1015
1015
  const limit = clampLimit(opts.limit);
1016
1016
  const found = /* @__PURE__ */ new Map();
@@ -1039,23 +1039,23 @@ async function familyChildPage(http, parentID) {
1039
1039
  path: "/V1.0/Companies/query",
1040
1040
  body: {
1041
1041
  MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
1042
- filter: _chunkIKWHRUQ5cjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1042
+ filter: _chunkLLIB4JGKcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1043
1043
  },
1044
1044
  operation: "companies.search"
1045
1045
  });
1046
- const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "companies.search");
1046
+ const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "companies.search");
1047
1047
  return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
1048
1048
  }
1049
1049
  function assertSearchWithDetailOpts(opts) {
1050
1050
  if (opts === void 0) return;
1051
1051
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
1052
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1052
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1053
1053
  operation: "companies.searchWithDetail"
1054
1054
  });
1055
1055
  }
1056
1056
  for (const key of Object.keys(opts)) {
1057
1057
  if (key !== "limit") {
1058
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1058
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1059
1059
  `companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
1060
1060
  { operation: "companies.searchWithDetail" }
1061
1061
  );
@@ -1064,32 +1064,32 @@ function assertSearchWithDetailOpts(opts) {
1064
1064
  }
1065
1065
  async function searchWithFamily(_resource, query, opts = {}, http) {
1066
1066
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1067
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1067
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1068
1068
  }
1069
1069
  for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
1070
1070
  if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
1071
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1071
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1072
1072
  `companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
1073
1073
  { operation: "companies.search" }
1074
1074
  );
1075
1075
  }
1076
1076
  }
1077
1077
  if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
1078
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1078
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1079
1079
  operation: "companies.search"
1080
1080
  });
1081
1081
  }
1082
1082
  const text = query.trim();
1083
- if (text === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1084
- const limit = opts.limit === void 0 ? 25 : _chunkIKWHRUQ5cjs.clampPageSize.call(void 0, opts.limit);
1083
+ 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);
1085
1085
  const res = await http.request({
1086
1086
  method: "POST",
1087
1087
  idempotent: true,
1088
1088
  path: "/V1.0/Companies/query",
1089
- body: { MaxRecords: limit, filter: _chunkIKWHRUQ5cjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1089
+ body: { MaxRecords: limit, filter: _chunkLLIB4JGKcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1090
1090
  operation: "companies.search"
1091
1091
  });
1092
- const hits = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "companies.search").items;
1092
+ const hits = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "companies.search").items;
1093
1093
  if (opts.includeFamily !== true) return hits;
1094
1094
  const rows = [];
1095
1095
  for (const hit of hits) {
@@ -1109,7 +1109,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
1109
1109
  }
1110
1110
 
1111
1111
  // src/resources/special/companies/errors.ts
1112
- var OwnerResourceRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1112
+ var OwnerResourceRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1113
1113
  constructor(message, options = {}) {
1114
1114
  super(message, {
1115
1115
  code: "OWNER_RESOURCE_REQUIRED",
@@ -1120,13 +1120,13 @@ var OwnerResourceRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1120
1120
  this.name = "OwnerResourceRequiredError";
1121
1121
  }
1122
1122
  };
1123
- var CompanyResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1123
+ var CompanyResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1124
1124
  constructor(message, options = {}) {
1125
1125
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
1126
1126
  this.name = "CompanyResourceInvalidError";
1127
1127
  }
1128
1128
  };
1129
- var CompanyCreateFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
1129
+ var CompanyCreateFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
1130
1130
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
1131
1131
 
1132
1132
  constructor(message, vendorFields, options = {}) {
@@ -1145,23 +1145,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
1145
1145
  var SAFE_COMPANY_CREATE_DEFAULTS = {};
1146
1146
  function validateUpsertInput(companyName, params) {
1147
1147
  if (typeof companyName !== "string" || companyName.trim() === "") {
1148
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1148
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1149
1149
  }
1150
1150
  if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
1151
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByName: params.phone is required (a non-empty string \u2014 the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })", { operation: OP_UPSERT_NAME });
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
1152
  }
1153
1153
  const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
1154
1154
  if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
1155
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 \u2014 the ww29-proven value)`, { operation: OP_UPSERT_NAME });
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
1156
  }
1157
1157
  const owner = params.ownerResourceID;
1158
1158
  if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
1159
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1159
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1160
1160
  }
1161
1161
  return { companyType, owner };
1162
1162
  }
1163
1163
  function existsDryRun(http, companyName, match) {
1164
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
1164
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
1165
1165
  {
1166
1166
  operation: OP_UPSERT_NAME,
1167
1167
  method: "POST",
@@ -1187,7 +1187,7 @@ function createDryRun(http, body, owner) {
1187
1187
  "ownerResourceID is REQUIRED on the apply path (the vendor requires it; the node cannot enumerate candidates \u2014 the resources table is blind to this API user (count/query return 0)): the apply throws the typed OWNER_RESOURCE_REQUIRED if it is still absent"
1188
1188
  );
1189
1189
  }
1190
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
1190
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
1191
1191
  {
1192
1192
  operation: OP_UPSERT_NAME,
1193
1193
  method: "POST",
@@ -1232,8 +1232,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1232
1232
  sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
1233
1233
  };
1234
1234
  } catch (err) {
1235
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1236
- const named = (_nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1235
+ 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);
1237
1237
  const seen = /* @__PURE__ */ new Set();
1238
1238
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
1239
1239
  const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
@@ -1247,7 +1247,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1247
1247
  }
1248
1248
  continue;
1249
1249
  }
1250
- const detail = _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError);
1250
+ const detail = _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError);
1251
1251
  throw new CompanyCreateFailedError(
1252
1252
  `upsertByName: the vendor rejected the company create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the ww29 required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
1253
1253
  unique,
@@ -1321,7 +1321,7 @@ async function readFields(http, fresh) {
1321
1321
  const res = await http.request({ method: "GET", path: "/V1.0/Tickets/entityInformation/fields", operation: OP, maxRetries: 0 });
1322
1322
  const fields = _optionalChain([res, 'optionalAccess', _21 => _21.fields]);
1323
1323
  if (!Array.isArray(fields)) {
1324
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1324
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1325
1325
  }
1326
1326
  _optionalChain([cache, 'optionalAccess', _22 => _22.set, 'call', _23 => _23(key, "fields", fields)]);
1327
1327
  return fields;
@@ -1340,7 +1340,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1340
1340
  if (opts.excludeStatusIds !== void 0) {
1341
1341
  const closedIds2 = [...new Set(opts.excludeStatusIds.map((id) => Number(id)))];
1342
1342
  if (closedIds2.length === 0 || closedIds2.some((id) => !Number.isSafeInteger(id) || id < 1)) {
1343
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
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
1344
  }
1345
1345
  return { picklist: [], closedIds: closedIds2, source: "picklist", note: `closed = status ${closedIds2.join(", ")} \u2014 supplied by the caller` };
1346
1346
  }
@@ -1348,7 +1348,7 @@ async function resolveTicketStatusSemantics(http, opts = {}) {
1348
1348
  try {
1349
1349
  fields = await readFields(http, opts.fresh === true);
1350
1350
  } catch (e) {
1351
- if (e instanceof _chunkIKWHRUQ5cjs.AutotaskError && e.code === "ABORTED") throw e;
1351
+ if (e instanceof _chunkLLIB4JGKcjs.AutotaskError && e.code === "ABORTED") throw e;
1352
1352
  return assumed();
1353
1353
  }
1354
1354
  const picklist = picklistOf(fields);
@@ -1384,30 +1384,30 @@ var LOCATION_LIMIT_MAX = 500;
1384
1384
  function locationLimit(value) {
1385
1385
  if (value === void 0) return PROFILE_PART_LIMIT;
1386
1386
  if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
1387
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1387
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1388
1388
  }
1389
1389
  return value;
1390
1390
  }
1391
1391
  function validateProjection(fields) {
1392
1392
  if (fields === void 0) return {};
1393
1393
  if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
1394
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1394
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1395
1395
  }
1396
1396
  const out = {};
1397
1397
  for (const [part, list] of Object.entries(fields)) {
1398
1398
  if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
1399
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1399
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1400
1400
  }
1401
1401
  if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
1402
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1402
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1403
1403
  }
1404
1404
  const names = [...new Set(list)];
1405
1405
  const entity = PART_ENTITY[part];
1406
- const known = _nullishCoalesce(_chunkIKWHRUQ5cjs.MODEL_FIELD_SETS[entity], () => ( []));
1406
+ const known = _nullishCoalesce(_chunkLLIB4JGKcjs.MODEL_FIELD_SETS[entity], () => ( []));
1407
1407
  const unknown = names.filter((n) => !known.includes(n));
1408
1408
  if (unknown.length > 0) {
1409
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1410
- `fullProfile: fields.${part} has unknown field name(s) ${_chunkIKWHRUQ5cjs.formatUnknownNameList.call(void 0, unknown)} against the vendored spec for ${entity} (${known.length} fields; operations.fieldCatalog resources: ["${entity}"] lists the live set) \u2014 no request was issued`
1409
+ 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`
1411
1411
  );
1412
1412
  }
1413
1413
  out[part] = names;
@@ -1424,7 +1424,7 @@ function project(items, names) {
1424
1424
  function profilePartLimit(value, name) {
1425
1425
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
1426
1426
  if (!Number.isInteger(n) || n < 1) {
1427
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1427
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1428
1428
  }
1429
1429
  return n;
1430
1430
  }
@@ -1436,7 +1436,7 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
1436
1436
  body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
1437
1437
  operation: "companies.fullProfile"
1438
1438
  });
1439
- return project(_chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items, includeFields);
1439
+ return project(_chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items, includeFields);
1440
1440
  }
1441
1441
  async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1442
1442
  const semantics = await resolveTicketStatusSemantics(http);
@@ -1453,7 +1453,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1453
1453
  },
1454
1454
  operation: "companies.fullProfile"
1455
1455
  });
1456
- return project(_chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items, includeFields);
1456
+ return project(_chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items, includeFields);
1457
1457
  })();
1458
1458
  const closedStatus = { closedIds: semantics.closedIds, source: semantics.source, note: semantics.note };
1459
1459
  const partNote = semantics.source === "assumed" ? OPEN_TICKETS_NOTE : semantics.note;
@@ -1465,7 +1465,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1465
1465
  closedStatus
1466
1466
  };
1467
1467
  if (openRows.length === 0) {
1468
- const stamp = _chunkIKWHRUQ5cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKWHRUQ5cjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
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
1469
  if (stamp !== void 0) {
1470
1470
  openTickets = {
1471
1471
  items: openRows,
@@ -1480,7 +1480,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1480
1480
  return openTickets;
1481
1481
  }
1482
1482
  async function addProfileNames(http, company, openTickets, projects, result, opts) {
1483
- const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS);
1483
+ const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS);
1484
1484
  const c = company;
1485
1485
  builder.addResource(c["ownerResourceID"]);
1486
1486
  builder.addResource(c["createdByResourceID"]);
@@ -1497,20 +1497,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1497
1497
  builder.addResource(r["creatorResourceID"]);
1498
1498
  builder.addFk("contract", r["contractID"]);
1499
1499
  }
1500
- const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1500
+ const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1501
1501
  const companyRow = { ...company };
1502
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1503
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1502
+ _chunkLLIB4JGKcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1503
+ _chunkLLIB4JGKcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1504
1504
  result.company = companyRow;
1505
1505
  result.openTickets = {
1506
1506
  ...openTickets,
1507
1507
  items: openTickets.items.map((row) => {
1508
1508
  const r = { ...row };
1509
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1510
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1511
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1512
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1513
- for (const f of _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS) _chunkIKWHRUQ5cjs.addLabelSibling.call(void 0, r, f, names);
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);
1514
1514
  return r;
1515
1515
  })
1516
1516
  };
@@ -1518,9 +1518,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1518
1518
  ...result.projects,
1519
1519
  items: result.projects.items.map((row) => {
1520
1520
  const r = { ...row };
1521
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1522
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1523
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
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));
1524
1524
  return r;
1525
1525
  })
1526
1526
  };
@@ -1533,7 +1533,7 @@ async function fullProfile(resource, id, opts = {}, http) {
1533
1533
  const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
1534
1534
  const locLimit = locationLimit(opts.locationLimit);
1535
1535
  const proj = validateProjection(opts.fields);
1536
- const companyID = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
1536
+ const companyID = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
1537
1537
  const company = await resource.get(companyID);
1538
1538
  const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
1539
1539
  const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
@@ -1580,7 +1580,7 @@ var UNBILLED_WORK_OPT_KEYS = [
1580
1580
  var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
1581
1581
  function validateUnbilledWorkOptions(companyId, opts) {
1582
1582
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1583
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1583
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1584
1584
  `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
1585
1585
  { operation: "companies.unbilledWork" }
1586
1586
  );
@@ -1609,7 +1609,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1609
1609
  try {
1610
1610
  limit = clampLimit(opts.limit);
1611
1611
  } catch (err) {
1612
- problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1612
+ problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1613
1613
  limit = 50;
1614
1614
  }
1615
1615
  if (source === "date_range") {
@@ -1624,9 +1624,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
1624
1624
  problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
1625
1625
  } else {
1626
1626
  try {
1627
- _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1627
+ _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1628
1628
  } catch (err) {
1629
- problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1629
+ problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1630
1630
  }
1631
1631
  }
1632
1632
  }
@@ -1636,20 +1636,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
1636
1636
  } else {
1637
1637
  opts.ticketIds.forEach((tid, i) => {
1638
1638
  try {
1639
- _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1639
+ _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1640
1640
  } catch (err) {
1641
- problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1641
+ problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1642
1642
  }
1643
1643
  });
1644
1644
  }
1645
1645
  }
1646
1646
  try {
1647
- _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyId, "companyId");
1647
+ _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyId, "companyId");
1648
1648
  } catch (err) {
1649
- problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1649
+ problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1650
1650
  }
1651
1651
  if (problems.length > 0) {
1652
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
1652
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
1653
1653
  `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
1654
1654
  - ` + problems.join("\n- "),
1655
1655
  { operation: "companies.unbilledWork" }
@@ -1678,7 +1678,7 @@ function capJoinSet(ids2, cap) {
1678
1678
  }
1679
1679
  function unbilledWorkPartStatus(key, conditions, items) {
1680
1680
  if (items.length !== 0) return { status: "ok" };
1681
- const stamp = _chunkIKWHRUQ5cjs.blindStampFor.call(void 0, _optionalChain([_chunkIKWHRUQ5cjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1681
+ const stamp = _chunkLLIB4JGKcjs.blindStampFor.call(void 0, _optionalChain([_chunkLLIB4JGKcjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1682
1682
  if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
1683
1683
  return {
1684
1684
  status: "ok",
@@ -1698,7 +1698,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
1698
1698
  parentStatus = "ok";
1699
1699
  companyIds.push(num(parent.id));
1700
1700
  } catch (err) {
1701
- if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) parent = null;
1701
+ if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) parent = null;
1702
1702
  else throw err;
1703
1703
  }
1704
1704
  }
@@ -1736,14 +1736,14 @@ async function readBillingPart(http, v, companyIds) {
1736
1736
  if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
1737
1737
  if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
1738
1738
  }
1739
- const billingFields = _chunkIKWHRUQ5cjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1739
+ const billingFields = _chunkLLIB4JGKcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1740
1740
  const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
1741
1741
  const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP2, billingIncludeFields);
1742
1742
  let billingItems = billingRaw.items;
1743
1743
  let billingNoteCharsTruncated = 0;
1744
1744
  if (v.includeNotes) {
1745
- const noteFields = (_nullishCoalesce(_chunkIKWHRUQ5cjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1746
- [billingItems, billingNoteCharsTruncated] = _chunkIKWHRUQ5cjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1745
+ 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);
1747
1747
  }
1748
1748
  const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
1749
1749
  const billingItemsPart = {
@@ -1787,7 +1787,7 @@ async function readTimePart(http, v, join) {
1787
1787
  let cappedItems = entries;
1788
1788
  let noteCharsTruncated = 0;
1789
1789
  if (v.includeNotes) {
1790
- [cappedItems, noteCharsTruncated] = _chunkIKWHRUQ5cjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1790
+ [cappedItems, noteCharsTruncated] = _chunkLLIB4JGKcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1791
1791
  }
1792
1792
  const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
1793
1793
  timePart = {
@@ -1875,7 +1875,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
1875
1875
  }
1876
1876
  async function unbilledWork(resource, companyId, opts = {}, http) {
1877
1877
  const v = validateUnbilledWorkOptions(companyId, opts);
1878
- const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyId, "companyId");
1878
+ const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyId, "companyId");
1879
1879
  const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
1880
1880
  const join = await readJoinSets(http, companyIds, v);
1881
1881
  const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
@@ -1902,7 +1902,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
1902
1902
  }
1903
1903
 
1904
1904
  // src/resources/companies.ts
1905
- var CompaniesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
1905
+ var CompaniesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
1906
1906
  constructor(http, pageSize) {
1907
1907
  super(http, {
1908
1908
  key: "companies",
@@ -2009,7 +2009,7 @@ var CompaniesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2009
2009
  };
2010
2010
 
2011
2011
  // src/resources/company_alerts.ts
2012
- var CompanyAlertsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2012
+ var CompanyAlertsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2013
2013
  constructor(http, pageSize) {
2014
2014
  super(http, {
2015
2015
  key: "company_alerts",
@@ -2075,7 +2075,7 @@ var CompanyAlertsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2075
2075
  };
2076
2076
 
2077
2077
  // src/resources/company_locations.ts
2078
- var CompanyLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2078
+ var CompanyLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2079
2079
  constructor(http, pageSize) {
2080
2080
  super(http, {
2081
2081
  key: "company_locations",
@@ -2146,7 +2146,7 @@ var CompanyLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2146
2146
  };
2147
2147
 
2148
2148
  // src/resources/company_notes.ts
2149
- var CompanyNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2149
+ var CompanyNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2150
2150
  constructor(http, pageSize) {
2151
2151
  super(http, {
2152
2152
  key: "company_notes",
@@ -2211,7 +2211,7 @@ var CompanyNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2211
2211
  };
2212
2212
 
2213
2213
  // src/resources/company_site_configurations.ts
2214
- var CompanySiteConfigurationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2214
+ var CompanySiteConfigurationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2215
2215
  constructor(http, pageSize) {
2216
2216
  super(http, {
2217
2217
  key: "company_site_configurations",
@@ -2262,7 +2262,7 @@ var CompanySiteConfigurationsResource = class extends _chunkIKWHRUQ5cjs.BaseReso
2262
2262
  };
2263
2263
 
2264
2264
  // src/resources/company_webhooks.ts
2265
- var CompanyWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2265
+ var CompanyWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2266
2266
  constructor(http, pageSize) {
2267
2267
  super(http, {
2268
2268
  key: "company_webhooks",
@@ -2338,7 +2338,7 @@ var CompanyWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2338
2338
  };
2339
2339
 
2340
2340
  // src/resources/configuration_item_billing_product_associations.ts
2341
- var ConfigurationItemBillingProductAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2341
+ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2342
2342
  constructor(http, pageSize) {
2343
2343
  super(http, {
2344
2344
  key: "configuration_item_billing_product_associations",
@@ -2404,7 +2404,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkIK
2404
2404
  };
2405
2405
 
2406
2406
  // src/resources/configuration_item_categories.ts
2407
- var ConfigurationItemCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2407
+ var ConfigurationItemCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2408
2408
  constructor(http, pageSize) {
2409
2409
  super(http, {
2410
2410
  key: "configuration_item_categories",
@@ -2471,7 +2471,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseRe
2471
2471
  };
2472
2472
 
2473
2473
  // src/resources/configuration_item_category_udf_associations.ts
2474
- var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2474
+ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2475
2475
  constructor(http, pageSize) {
2476
2476
  super(http, {
2477
2477
  key: "configuration_item_category_udf_associations",
@@ -2537,7 +2537,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkIKWHR
2537
2537
  };
2538
2538
 
2539
2539
  // src/resources/configuration_item_dns_records.ts
2540
- var ConfigurationItemDnsRecordsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2540
+ var ConfigurationItemDnsRecordsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2541
2541
  constructor(http, pageSize) {
2542
2542
  super(http, {
2543
2543
  key: "configuration_item_dns_records",
@@ -2586,7 +2586,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkIKWHRUQ5cjs.BaseRe
2586
2586
  };
2587
2587
 
2588
2588
  // src/resources/configuration_item_notes.ts
2589
- var ConfigurationItemNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2589
+ var ConfigurationItemNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2590
2590
  constructor(http, pageSize) {
2591
2591
  super(http, {
2592
2592
  key: "configuration_item_notes",
@@ -2645,7 +2645,7 @@ var ConfigurationItemNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
2645
2645
  };
2646
2646
 
2647
2647
  // src/resources/configuration_item_related_items.ts
2648
- var ConfigurationItemRelatedItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2648
+ var ConfigurationItemRelatedItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2649
2649
  constructor(http, pageSize) {
2650
2650
  super(http, {
2651
2651
  key: "configuration_item_related_items",
@@ -2706,16 +2706,16 @@ async function fetchRecord(http, path, label, readOpts) {
2706
2706
  const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _32 => _32.maxRetries]) });
2707
2707
  const body = res;
2708
2708
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
2709
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2709
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2710
2710
  }
2711
2711
  return body.item;
2712
2712
  }
2713
2713
  async function moveConfigurationItem(_resource, sourceId, opts, http) {
2714
- const numericSource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2714
+ const numericSource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2715
2715
  if (_optionalChain([opts, 'optionalAccess', _33 => _33.destinationCompanyId]) === void 0) {
2716
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2716
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2717
2717
  }
2718
- const destId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2718
+ const destId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2719
2719
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
2720
2720
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
2721
2721
  const body = { ...source };
@@ -2725,20 +2725,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2725
2725
  body.companyID = destId;
2726
2726
  body.isActive = true;
2727
2727
  if (opts.newReferenceTitle !== void 0) {
2728
- if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2728
+ if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2729
2729
  body.referenceTitle = opts.newReferenceTitle.trim();
2730
2730
  }
2731
2731
  if (opts.lastModifiedDate !== void 0) {
2732
2732
  const current = source.lastModifiedDate;
2733
2733
  if (current !== opts.lastModifiedDate) {
2734
- throw new (0, _chunkIKWHRUQ5cjs.StaleObjectError)(
2734
+ throw new (0, _chunkLLIB4JGKcjs.StaleObjectError)(
2735
2735
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
2736
2736
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
2737
2737
  );
2738
2738
  }
2739
2739
  }
2740
2740
  if (opts.dryRun === true) {
2741
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
2741
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
2742
2742
  operation: "configuration_items.moveConfigurationItem",
2743
2743
  method: "POST",
2744
2744
  path: "/V1.0/ConfigurationItems",
@@ -2763,7 +2763,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2763
2763
  const createdBody = created;
2764
2764
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
2765
2765
  if (typeof newId !== "number") {
2766
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2766
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2767
2767
  }
2768
2768
  let sourceDeactivated = false;
2769
2769
  if (opts.deactivateSource !== false) {
@@ -2782,7 +2782,7 @@ var PROFILE_PART_LIMIT2 = 50;
2782
2782
  function profilePartLimit2(value, name) {
2783
2783
  const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
2784
2784
  if (!Number.isInteger(n) || n < 1) {
2785
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2785
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2786
2786
  }
2787
2787
  return n;
2788
2788
  }
@@ -2798,14 +2798,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
2798
2798
  });
2799
2799
  const body = res;
2800
2800
  if (body === null || !("item" in body)) {
2801
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2801
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2802
2802
  }
2803
2803
  if (body.item === null || body.item === void 0) {
2804
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2804
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2805
2805
  }
2806
2806
  return body.item;
2807
2807
  } catch (err) {
2808
- if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) return null;
2808
+ if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) return null;
2809
2809
  throw err;
2810
2810
  }
2811
2811
  }
@@ -2817,7 +2817,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
2817
2817
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
2818
2818
  operation: "configuration_items.profile"
2819
2819
  });
2820
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
2820
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
2821
2821
  }
2822
2822
  async function profile(resource, id, opts = {}, http) {
2823
2823
  const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
@@ -2829,7 +2829,7 @@ async function profile(resource, id, opts = {}, http) {
2829
2829
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
2830
2830
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
2831
2831
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
2832
- const wallQuirk = _optionalChain([_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP, 'access', _34 => _34["configuration_items"], 'optionalAccess', _35 => _35.zoneFacts, 'optionalAccess', _36 => _36.quirks, 'optionalAccess', _37 => _37.find, 'call', _38 => _38((q) => q.startsWith("product wall"))]);
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
2833
  const productAssociations = {
2834
2834
  items: associations,
2835
2835
  capped: associations.length >= PROFILE_PART_LIMIT2,
@@ -2853,11 +2853,11 @@ async function profile(resource, id, opts = {}, http) {
2853
2853
  }
2854
2854
  };
2855
2855
  if (opts.names === true) {
2856
- const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, );
2856
+ const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, );
2857
2857
  builder.addFk("contract", root["contractID"]);
2858
- const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2858
+ const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2859
2859
  const ciRow = { ...ci };
2860
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2860
+ _chunkLLIB4JGKcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2861
2861
  result.ci = ciRow;
2862
2862
  result.names = names.section;
2863
2863
  }
@@ -2865,7 +2865,7 @@ async function profile(resource, id, opts = {}, http) {
2865
2865
  }
2866
2866
 
2867
2867
  // src/resources/configuration_items.ts
2868
- var ConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2868
+ var ConfigurationItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2869
2869
  constructor(http, pageSize) {
2870
2870
  super(http, {
2871
2871
  key: "configuration_items",
@@ -2954,7 +2954,7 @@ var ConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2954
2954
  };
2955
2955
 
2956
2956
  // src/resources/configuration_item_ssl_subject_alternative_names.ts
2957
- var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
2957
+ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
2958
2958
  constructor(http, pageSize) {
2959
2959
  super(http, {
2960
2960
  key: "configuration_item_ssl_subject_alternative_names",
@@ -3017,7 +3017,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkIK
3017
3017
  };
3018
3018
 
3019
3019
  // src/resources/configuration_item_types.ts
3020
- var ConfigurationItemTypesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3020
+ var ConfigurationItemTypesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3021
3021
  constructor(http, pageSize) {
3022
3022
  super(http, {
3023
3023
  key: "configuration_item_types",
@@ -3091,7 +3091,7 @@ var ConfigurationItemTypesResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
3091
3091
  };
3092
3092
 
3093
3093
  // src/resources/configuration_item_webhooks.ts
3094
- var ConfigurationItemWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3094
+ var ConfigurationItemWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3095
3095
  constructor(http, pageSize) {
3096
3096
  super(http, {
3097
3097
  key: "configuration_item_webhooks",
@@ -3167,7 +3167,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseReso
3167
3167
  };
3168
3168
 
3169
3169
  // src/resources/contact_group_contacts.ts
3170
- var ContactGroupContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3170
+ var ContactGroupContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3171
3171
  constructor(http, pageSize) {
3172
3172
  super(http, {
3173
3173
  key: "contact_group_contacts",
@@ -3221,7 +3221,7 @@ var ContactGroupContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
3221
3221
  };
3222
3222
 
3223
3223
  // src/resources/contact_groups.ts
3224
- var ContactGroupsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3224
+ var ContactGroupsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3225
3225
  constructor(http, pageSize) {
3226
3226
  super(http, {
3227
3227
  key: "contact_groups",
@@ -3299,22 +3299,22 @@ async function fetchRecord2(http, path, label, readOpts) {
3299
3299
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _44 => _44.maxRetries]) });
3300
3300
  const body = res;
3301
3301
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
3302
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3302
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3303
3303
  }
3304
3304
  return body.item;
3305
3305
  }
3306
3306
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
3307
- const sourceId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3308
- const destId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3307
+ const sourceId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3308
+ const destId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3309
3309
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
3310
3310
  const companyID = source.companyID;
3311
3311
  if (typeof companyID !== "number" || companyID < 0) {
3312
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3312
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3313
3313
  }
3314
3314
  if (opts.lastModifiedDate !== void 0) {
3315
3315
  const current = source.lastModifiedDate;
3316
3316
  if (current !== opts.lastModifiedDate) {
3317
- throw new (0, _chunkIKWHRUQ5cjs.StaleObjectError)(
3317
+ throw new (0, _chunkLLIB4JGKcjs.StaleObjectError)(
3318
3318
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
3319
3319
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3320
3320
  );
@@ -3336,10 +3336,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3336
3336
  },
3337
3337
  operation: "contacts.moveToCompany"
3338
3338
  });
3339
- const items = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
3339
+ const items = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
3340
3340
  const clash = items.find((c) => String(c.id) !== String(sourceId));
3341
3341
  if (clash !== void 0) {
3342
- throw new (0, _chunkIKWHRUQ5cjs.ConflictError)(
3342
+ throw new (0, _chunkLLIB4JGKcjs.ConflictError)(
3343
3343
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
3344
3344
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3345
3345
  );
@@ -3353,7 +3353,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3353
3353
  if (opts.dryRun === true) {
3354
3354
  const warnings = [];
3355
3355
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
3356
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
3356
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
3357
3357
  operation: "contacts.moveToCompany",
3358
3358
  method: "POST",
3359
3359
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -3379,7 +3379,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3379
3379
  const createdBody = created;
3380
3380
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
3381
3381
  if (typeof newId !== "number") {
3382
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3382
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3383
3383
  }
3384
3384
  let sourceDeleted = false;
3385
3385
  if (opts.deleteSource === true) {
@@ -3398,7 +3398,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
3398
3398
  var EMAIL_SHAPE = /^.+@.+/;
3399
3399
  var SAFE_CONTACT_CREATE_DEFAULTS = {};
3400
3400
  var DEDUP_LIMIT = 10;
3401
- var CompanyNotFoundError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3401
+ var CompanyNotFoundError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3402
3402
  constructor(message, options = {}) {
3403
3403
  super(message, {
3404
3404
  code: "COMPANY_NOT_FOUND",
@@ -3409,7 +3409,7 @@ var CompanyNotFoundError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3409
3409
  this.name = "CompanyNotFoundError";
3410
3410
  }
3411
3411
  };
3412
- var ContactCreateFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3412
+ var ContactCreateFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
3413
3413
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
3414
3414
 
3415
3415
  constructor(message, vendorFields, options = {}) {
@@ -3419,25 +3419,25 @@ var ContactCreateFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
3419
3419
  }
3420
3420
  };
3421
3421
  async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3422
- const cid = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, companyID, "companyID");
3422
+ const cid = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, companyID, "companyID");
3423
3423
  if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
3424
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
3424
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
3425
3425
  `upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
3426
3426
  { operation: OP_UPSERT_EMAIL }
3427
3427
  );
3428
3428
  }
3429
3429
  if (extra !== void 0) {
3430
3430
  if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
3431
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
3431
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
3432
3432
  `upsertByEmail: extra.isActive must be a boolean (mapped to the zone-correct number 1/0) or a raw 0/1 number (got ${String(extra.isActive)})`,
3433
3433
  { operation: OP_UPSERT_EMAIL }
3434
3434
  );
3435
3435
  }
3436
3436
  if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
3437
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByEmail: extra.firstName must be a non-empty string (or omitted \u2014 the node defaults it to the email local-part)", { operation: OP_UPSERT_EMAIL });
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
3438
  }
3439
3439
  if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
3440
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
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
3441
  }
3442
3442
  }
3443
3443
  const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
@@ -3458,7 +3458,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3458
3458
  const match = q.items[0];
3459
3459
  if (match !== void 0) {
3460
3460
  if (opts.dryRun === true) {
3461
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
3461
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
3462
3462
  {
3463
3463
  operation: OP_UPSERT_EMAIL,
3464
3464
  method: "POST",
@@ -3488,7 +3488,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3488
3488
  isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
3489
3489
  };
3490
3490
  if (opts.dryRun === true) {
3491
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
3491
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
3492
3492
  {
3493
3493
  operation: OP_UPSERT_EMAIL,
3494
3494
  method: "POST",
@@ -3511,8 +3511,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3511
3511
  const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
3512
3512
  return { id: created.id, created: true };
3513
3513
  } catch (err) {
3514
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3515
- const named = (_nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3514
+ 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);
3516
3516
  const seen = /* @__PURE__ */ new Set();
3517
3517
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
3518
3518
  const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
@@ -3526,7 +3526,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3526
3526
  }
3527
3527
  continue;
3528
3528
  }
3529
- const detail = _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError);
3529
+ const detail = _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError);
3530
3530
  throw new ContactCreateFailedError(
3531
3531
  `upsertByEmail: the vendor rejected the contact create${unique.length > 0 ? ` naming field(s) ${unique.join(", ")}` : ""} (no proven-safe default \u2014 the required set is fully filled by the node)${detail ? ` \u2014 ${detail}` : ""}`,
3532
3532
  unique,
@@ -3543,7 +3543,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3543
3543
  }
3544
3544
 
3545
3545
  // src/resources/contacts.ts
3546
- var ContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3546
+ var ContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3547
3547
  constructor(http, pageSize) {
3548
3548
  super(http, {
3549
3549
  key: "contacts",
@@ -3635,7 +3635,7 @@ var ContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3635
3635
  };
3636
3636
 
3637
3637
  // src/resources/contact_webhooks.ts
3638
- var ContactWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3638
+ var ContactWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3639
3639
  constructor(http, pageSize) {
3640
3640
  super(http, {
3641
3641
  key: "contact_webhooks",
@@ -3711,7 +3711,7 @@ var ContactWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3711
3711
  };
3712
3712
 
3713
3713
  // src/resources/contract_billing_rules.ts
3714
- var ContractBillingRulesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3714
+ var ContractBillingRulesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3715
3715
  constructor(http, pageSize) {
3716
3716
  super(http, {
3717
3717
  key: "contract_billing_rules",
@@ -3777,7 +3777,7 @@ var ContractBillingRulesResource = class extends _chunkIKWHRUQ5cjs.BaseResource
3777
3777
  };
3778
3778
 
3779
3779
  // src/resources/contract_block_hour_factors.ts
3780
- var ContractBlockHourFactorsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3780
+ var ContractBlockHourFactorsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3781
3781
  constructor(http, pageSize) {
3782
3782
  super(http, {
3783
3783
  key: "contract_block_hour_factors",
@@ -3836,7 +3836,7 @@ var ContractBlockHourFactorsResource = class extends _chunkIKWHRUQ5cjs.BaseResou
3836
3836
  };
3837
3837
 
3838
3838
  // src/resources/contract_blocks.ts
3839
- var ContractBlocksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3839
+ var ContractBlocksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3840
3840
  constructor(http, pageSize) {
3841
3841
  super(http, {
3842
3842
  key: "contract_blocks",
@@ -3895,7 +3895,7 @@ var ContractBlocksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3895
3895
  };
3896
3896
 
3897
3897
  // src/resources/contract_charges.ts
3898
- var ContractChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3898
+ var ContractChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3899
3899
  constructor(http, pageSize) {
3900
3900
  super(http, {
3901
3901
  key: "contract_charges",
@@ -3966,7 +3966,7 @@ var ContractChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3966
3966
  };
3967
3967
 
3968
3968
  // src/resources/contract_exclusion_billing_codes.ts
3969
- var ContractExclusionBillingCodesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
3969
+ var ContractExclusionBillingCodesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
3970
3970
  constructor(http, pageSize) {
3971
3971
  super(http, {
3972
3972
  key: "contract_exclusion_billing_codes",
@@ -4023,7 +4023,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkIKWHRUQ5cjs.Base
4023
4023
  };
4024
4024
 
4025
4025
  // src/resources/contract_exclusion_roles.ts
4026
- var ContractExclusionRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4026
+ var ContractExclusionRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4027
4027
  constructor(http, pageSize) {
4028
4028
  super(http, {
4029
4029
  key: "contract_exclusion_roles",
@@ -4080,7 +4080,7 @@ var ContractExclusionRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
4080
4080
  };
4081
4081
 
4082
4082
  // src/resources/contract_exclusion_set_excluded_roles.ts
4083
- var ContractExclusionSetExcludedRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4083
+ var ContractExclusionSetExcludedRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4084
4084
  constructor(http, pageSize) {
4085
4085
  super(http, {
4086
4086
  key: "contract_exclusion_set_excluded_roles",
@@ -4137,7 +4137,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkIKWHRUQ5cjs.
4137
4137
  };
4138
4138
 
4139
4139
  // src/resources/contract_exclusion_set_excluded_work_types.ts
4140
- var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4140
+ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4141
4141
  constructor(http, pageSize) {
4142
4142
  super(http, {
4143
4143
  key: "contract_exclusion_set_excluded_work_types",
@@ -4194,7 +4194,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkIKWHRUQ5
4194
4194
  };
4195
4195
 
4196
4196
  // src/resources/contract_exclusion_sets.ts
4197
- var ContractExclusionSetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4197
+ var ContractExclusionSetsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4198
4198
  constructor(http, pageSize) {
4199
4199
  super(http, {
4200
4200
  key: "contract_exclusion_sets",
@@ -4268,7 +4268,7 @@ var ContractExclusionSetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
4268
4268
  };
4269
4269
 
4270
4270
  // src/resources/contract_milestones.ts
4271
- var ContractMilestonesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4271
+ var ContractMilestonesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4272
4272
  constructor(http, pageSize) {
4273
4273
  super(http, {
4274
4274
  key: "contract_milestones",
@@ -4327,7 +4327,7 @@ var ContractMilestonesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4327
4327
  };
4328
4328
 
4329
4329
  // src/resources/contract_notes.ts
4330
- var ContractNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4330
+ var ContractNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4331
4331
  constructor(http, pageSize) {
4332
4332
  super(http, {
4333
4333
  key: "contract_notes",
@@ -4386,7 +4386,7 @@ var ContractNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4386
4386
  };
4387
4387
 
4388
4388
  // src/resources/contract_rates.ts
4389
- var ContractRatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4389
+ var ContractRatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4390
4390
  constructor(http, pageSize) {
4391
4391
  super(http, {
4392
4392
  key: "contract_rates",
@@ -4445,7 +4445,7 @@ var ContractRatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4445
4445
  };
4446
4446
 
4447
4447
  // src/resources/contract_retainers.ts
4448
- var ContractRetainersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4448
+ var ContractRetainersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4449
4449
  constructor(http, pageSize) {
4450
4450
  super(http, {
4451
4451
  key: "contract_retainers",
@@ -4504,7 +4504,7 @@ var ContractRetainersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4504
4504
  };
4505
4505
 
4506
4506
  // src/resources/contract_role_costs.ts
4507
- var ContractRoleCostsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4507
+ var ContractRoleCostsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4508
4508
  constructor(http, pageSize) {
4509
4509
  super(http, {
4510
4510
  key: "contract_role_costs",
@@ -4563,7 +4563,7 @@ var ContractRoleCostsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4563
4563
  };
4564
4564
 
4565
4565
  // src/resources/contract_service_adjustments.ts
4566
- var ContractServiceAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4566
+ var ContractServiceAdjustmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4567
4567
  constructor(http, pageSize) {
4568
4568
  super(http, {
4569
4569
  key: "contract_service_adjustments",
@@ -4597,7 +4597,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.BaseRes
4597
4597
  };
4598
4598
 
4599
4599
  // src/resources/contract_service_bundle_adjustments.ts
4600
- var ContractServiceBundleAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4600
+ var ContractServiceBundleAdjustmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4601
4601
  constructor(http, pageSize) {
4602
4602
  super(http, {
4603
4603
  key: "contract_service_bundle_adjustments",
@@ -4631,7 +4631,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkIKWHRUQ5cjs.B
4631
4631
  };
4632
4632
 
4633
4633
  // src/resources/contract_service_bundles.ts
4634
- var ContractServiceBundlesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4634
+ var ContractServiceBundlesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4635
4635
  constructor(http, pageSize) {
4636
4636
  super(http, {
4637
4637
  key: "contract_service_bundles",
@@ -4690,7 +4690,7 @@ var ContractServiceBundlesResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
4690
4690
  };
4691
4691
 
4692
4692
  // src/resources/contract_service_bundle_units.ts
4693
- var ContractServiceBundleUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4693
+ var ContractServiceBundleUnitsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4694
4694
  constructor(http, pageSize) {
4695
4695
  super(http, {
4696
4696
  key: "contract_service_bundle_units",
@@ -4732,7 +4732,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseRes
4732
4732
  };
4733
4733
 
4734
4734
  // src/resources/contract_services.ts
4735
- var ContractServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4735
+ var ContractServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4736
4736
  constructor(http, pageSize) {
4737
4737
  super(http, {
4738
4738
  key: "contract_services",
@@ -4791,7 +4791,7 @@ var ContractServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4791
4791
  };
4792
4792
 
4793
4793
  // src/resources/contract_service_units.ts
4794
- var ContractServiceUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
4794
+ var ContractServiceUnitsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
4795
4795
  constructor(http, pageSize) {
4796
4796
  super(http, {
4797
4797
  key: "contract_service_units",
@@ -4832,6 +4832,42 @@ var ContractServiceUnitsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
4832
4832
  }
4833
4833
  };
4834
4834
 
4835
+ // src/resources/special/contracts/lineOfBusiness.ts
4836
+ var OP3 = "contracts.lineOfBusiness";
4837
+ function positiveId(value, name) {
4838
+ const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
4839
+ 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
+ }
4842
+ return n;
4843
+ }
4844
+ async function lineOfBusiness(resource, contractIdIn, http, associationIdIn) {
4845
+ const contractId = positiveId(contractIdIn, "contractId");
4846
+ let associationId;
4847
+ let associationSource;
4848
+ if (associationIdIn !== void 0) {
4849
+ associationId = positiveId(associationIdIn, "associationId");
4850
+ associationSource = "argument";
4851
+ } else {
4852
+ associationSource = "contract";
4853
+ const contract = await resource.get(contractId);
4854
+ associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
4855
+ }
4856
+ if (associationId === void 0) {
4857
+ return {
4858
+ contractId,
4859
+ associationSource,
4860
+ association: null,
4861
+ organizationalLevel2: null,
4862
+ organizationalLevel1: null,
4863
+ markers: { association: "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
4864
+ };
4865
+ }
4866
+ const chain = await _chunkLLIB4JGKcjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP3, onError: "propagate" });
4867
+ const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
4868
+ return { contractId, associationSource, association, organizationalLevel2, organizationalLevel1, markers };
4869
+ }
4870
+
4835
4871
  // src/resources/special/contracts/profitability.constants.ts
4836
4872
  var PROFITABILITY_OPT_KEYS = [
4837
4873
  "dateFrom",
@@ -5059,7 +5095,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
5059
5095
  // src/resources/special/contracts/profitability.validate.ts
5060
5096
  function validateProfitabilityOptions(contractId, opts) {
5061
5097
  if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
5062
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
5098
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
5063
5099
  `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})`,
5064
5100
  { operation: "contracts.profitability" }
5065
5101
  );
@@ -5136,12 +5172,12 @@ function validateProfitabilityOptions(contractId, opts) {
5136
5172
  }
5137
5173
  }
5138
5174
  try {
5139
- _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, contractId, "contractId");
5175
+ _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, contractId, "contractId");
5140
5176
  } catch (err) {
5141
- problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5177
+ problems.push(err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5142
5178
  }
5143
5179
  if (problems.length > 0) {
5144
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
5180
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
5145
5181
  `profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
5146
5182
  - ` + problems.join("\n- "),
5147
5183
  { operation: "contracts.profitability" }
@@ -5190,23 +5226,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5190
5226
  const byKey = /* @__PURE__ */ new Map();
5191
5227
  const misses = [];
5192
5228
  const notes = [];
5193
- for (let c = 0; c < unique.length; c += _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE) {
5194
- const chunk = unique.slice(c, c + _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE);
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);
5195
5231
  const chunkKeys = new Set(chunk);
5196
5232
  try {
5197
5233
  const body = {
5198
- MaxRecords: _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE,
5234
+ MaxRecords: _chunkLLIB4JGKcjs.FETCH_BY_IDS_CHUNK_SIZE,
5199
5235
  filter: [{ field: "id", op: "in", value: chunk }],
5200
5236
  IncludeFields: fields
5201
5237
  };
5202
5238
  const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
5203
- const { items: rows } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
5239
+ const { items: rows } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
5204
5240
  for (const row of rows) {
5205
5241
  const k = num(row.id);
5206
5242
  if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
5207
5243
  }
5208
5244
  } catch (err) {
5209
- const code = err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.code : "SERVER_ERROR";
5245
+ const code = err instanceof _chunkLLIB4JGKcjs.AutotaskError ? err.code : "SERVER_ERROR";
5210
5246
  for (const k of chunk) {
5211
5247
  if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
5212
5248
  }
@@ -5216,11 +5252,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5216
5252
  for (const k of queryMissed) {
5217
5253
  try {
5218
5254
  const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
5219
- byKey.set(k, _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, k, operation, entity));
5255
+ byKey.set(k, _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, k, operation, entity));
5220
5256
  } catch (err) {
5221
- if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) {
5257
+ if (err instanceof _chunkLLIB4JGKcjs.NotFoundError) {
5222
5258
  misses.push({ id: k, code: "NOT_FOUND", message: err.message });
5223
- } else if (err instanceof _chunkIKWHRUQ5cjs.AutotaskError) {
5259
+ } else if (err instanceof _chunkLLIB4JGKcjs.AutotaskError) {
5224
5260
  misses.push({ id: k, code: err.code, message: err.message });
5225
5261
  } else {
5226
5262
  misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
@@ -5274,7 +5310,7 @@ async function degradable(read) {
5274
5310
  try {
5275
5311
  return await read();
5276
5312
  } catch (err) {
5277
- if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5313
+ if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5278
5314
  return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
5279
5315
  }
5280
5316
  }
@@ -5294,15 +5330,15 @@ var stampPart = (key, raw, conditions, extraNotes) => {
5294
5330
  status: st.status,
5295
5331
  blindSurface: st.blindSurface,
5296
5332
  note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
5297
- emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkIKWHRUQ5cjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5333
+ emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkLLIB4JGKcjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5298
5334
  };
5299
5335
  };
5300
5336
  function appendWiresNote(wires, note) {
5301
5337
  wires.note = (wires.note ? wires.note + " | " : "") + note;
5302
5338
  }
5303
5339
  function makeFetchCtx(rawHttp, v, contractId, budget) {
5304
- const OP10 = PROFITABILITY_OP;
5305
- const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, contractId, "contractId");
5340
+ const OP11 = PROFITABILITY_OP;
5341
+ const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, contractId, "contractId");
5306
5342
  const idNum = typeof id === "number" ? id : Number(id);
5307
5343
  const wires = { issued: 0, requests: 0, budget };
5308
5344
  const toExcl = dayAfter(v.dateTo);
@@ -5313,19 +5349,19 @@ function makeFetchCtx(rawHttp, v, contractId, budget) {
5313
5349
  } };
5314
5350
  const readPart = (path, conditions, fields) => {
5315
5351
  wires.issued += 1;
5316
- return degradable(() => boundedPart(http, path, conditions, v.limit, OP10, fields));
5352
+ return degradable(() => boundedPart(http, path, conditions, v.limit, OP11, fields));
5317
5353
  };
5318
5354
  const truncatedMonths = {};
5319
5355
  const windowedPart = async (name, key, path, cond, fields, dateField) => {
5320
5356
  const first = await readPart(path, cond, fields);
5321
5357
  if (first.absent !== void 0 || !first.hasMore) return { part: stampPart(key, first, cond), rows: first.items };
5322
- const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP10, fields, dateField, v.dateFrom, v.dateTo, wires));
5358
+ const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP11, fields, dateField, v.dateFrom, v.dateTo, wires));
5323
5359
  if (!("truncatedMonths" in wp)) return { part: stampPart(key, wp, cond), rows: [] };
5324
5360
  const { truncatedMonths: tm, ...part } = wp;
5325
5361
  truncatedMonths[name] = tm;
5326
5362
  return { part, rows: wp.items };
5327
5363
  };
5328
- return { v, OP: OP10, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5364
+ return { v, OP: OP11, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5329
5365
  }
5330
5366
 
5331
5367
  // src/resources/special/contracts/profitability.stages.ts
@@ -5340,12 +5376,12 @@ async function fetchCustomer(ctx, companyID) {
5340
5376
  path: `/V1.0/Companies/${companyID}`,
5341
5377
  operation: ctx.OP
5342
5378
  });
5343
- const item = _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5379
+ const item = _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5344
5380
  customer = _nullishCoalesce(item, () => ( null));
5345
5381
  customerStatus = "ok";
5346
5382
  } catch (err) {
5347
- if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5348
- if (!(err instanceof _chunkIKWHRUQ5cjs.NotFoundError)) {
5383
+ if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5384
+ if (!(err instanceof _chunkLLIB4JGKcjs.NotFoundError)) {
5349
5385
  customerStatus = "absent";
5350
5386
  customerAbsent = err.code;
5351
5387
  }
@@ -5361,7 +5397,7 @@ async function resolveContractType(ctx, contractType) {
5361
5397
  try {
5362
5398
  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));
5363
5399
  } catch (err) {
5364
- if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5400
+ if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5365
5401
  }
5366
5402
  }
5367
5403
  const contractTypeKnown = contractTypeLabel !== null;
@@ -5423,8 +5459,8 @@ async function fetchInvoices(ctx, billingRows) {
5423
5459
  if (invoiceIds.length === 0) {
5424
5460
  return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
5425
5461
  }
5426
- const capped = capJoinSet2(invoiceIds, _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5427
- if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
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`);
5428
5464
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
5429
5465
  ctx.wires.issued += 1;
5430
5466
  return {
@@ -5470,7 +5506,7 @@ async function readOpenStatusSet(ctx) {
5470
5506
  }
5471
5507
  }
5472
5508
  } catch (err) {
5473
- statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkIKWHRUQ5cjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
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`;
5474
5510
  }
5475
5511
  return { openStatusSet, statusNote };
5476
5512
  }
@@ -5493,8 +5529,8 @@ async function fetchResources(ctx, entries) {
5493
5529
  if (resourceIds.length === 0) {
5494
5530
  return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
5495
5531
  }
5496
- const capped = capJoinSet2(resourceIds, _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5497
- if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
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`);
5498
5534
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
5499
5535
  ctx.wires.issued += 1;
5500
5536
  for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
@@ -5561,7 +5597,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
5561
5597
  try {
5562
5598
  return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
5563
5599
  } catch (err) {
5564
- if (!(err instanceof _chunkIKWHRUQ5cjs.AutotaskError)) throw err;
5600
+ if (!(err instanceof _chunkLLIB4JGKcjs.AutotaskError)) throw err;
5565
5601
  return null;
5566
5602
  }
5567
5603
  }
@@ -5578,7 +5614,7 @@ async function fetchSubscriptions(ctx, cis) {
5578
5614
  cancelledSubs
5579
5615
  };
5580
5616
  }
5581
- const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS);
5617
+ const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkLLIB4JGKcjs.FETCH_BY_IDS_MAX_ITEMS);
5582
5618
  const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
5583
5619
  const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
5584
5620
  const subscriptions = raw.items;
@@ -6263,7 +6299,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
6263
6299
  }
6264
6300
 
6265
6301
  // src/resources/contracts.ts
6266
- var ContractsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6302
+ var ContractsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6267
6303
  constructor(http, pageSize) {
6268
6304
  super(http, {
6269
6305
  key: "contracts",
@@ -6331,10 +6367,14 @@ var ContractsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6331
6367
  profitability(id, opts) {
6332
6368
  return profitability(this, id, opts, this.http);
6333
6369
  }
6370
+ /** Node-parity special op (hand-written in src/resources/special/contracts.ts). */
6371
+ lineOfBusiness(contractId, associationId) {
6372
+ return lineOfBusiness(this, contractId, this.http, associationId);
6373
+ }
6334
6374
  };
6335
6375
 
6336
6376
  // src/resources/contract_ticket_purchases.ts
6337
- var ContractTicketPurchasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6377
+ var ContractTicketPurchasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6338
6378
  constructor(http, pageSize) {
6339
6379
  super(http, {
6340
6380
  key: "contract_ticket_purchases",
@@ -6393,7 +6433,7 @@ var ContractTicketPurchasesResource = class extends _chunkIKWHRUQ5cjs.BaseResour
6393
6433
  };
6394
6434
 
6395
6435
  // src/resources/countries.ts
6396
- var CountriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6436
+ var CountriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6397
6437
  constructor(http, pageSize) {
6398
6438
  super(http, {
6399
6439
  key: "countries",
@@ -6452,7 +6492,7 @@ var CountriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6452
6492
  };
6453
6493
 
6454
6494
  // src/resources/currencies.ts
6455
- var CurrenciesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6495
+ var CurrenciesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6456
6496
  constructor(http, pageSize) {
6457
6497
  super(http, {
6458
6498
  key: "currencies",
@@ -6496,7 +6536,7 @@ var CurrenciesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6496
6536
  };
6497
6537
 
6498
6538
  // src/resources/departments.ts
6499
- var DepartmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6539
+ var DepartmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6500
6540
  constructor(http, pageSize) {
6501
6541
  super(http, {
6502
6542
  key: "departments",
@@ -6563,7 +6603,7 @@ var DepartmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6563
6603
  };
6564
6604
 
6565
6605
  // src/resources/domain_registrars.ts
6566
- var DomainRegistrarsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6606
+ var DomainRegistrarsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6567
6607
  constructor(http, pageSize) {
6568
6608
  super(http, {
6569
6609
  key: "domain_registrars",
@@ -6646,7 +6686,7 @@ var EntityInformationResource = class {
6646
6686
  };
6647
6687
 
6648
6688
  // src/resources/expense_item_attachments.ts
6649
- var ExpenseItemAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6689
+ var ExpenseItemAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6650
6690
  constructor(http, pageSize) {
6651
6691
  super(http, {
6652
6692
  key: "expense_item_attachments",
@@ -6708,7 +6748,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
6708
6748
  };
6709
6749
 
6710
6750
  // src/resources/expense_items.ts
6711
- var ExpenseItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6751
+ var ExpenseItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6712
6752
  constructor(http, pageSize) {
6713
6753
  super(http, {
6714
6754
  key: "expense_items",
@@ -6767,7 +6807,7 @@ var ExpenseItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6767
6807
  };
6768
6808
 
6769
6809
  // src/resources/expense_reports.ts
6770
- var ExpenseReportsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6810
+ var ExpenseReportsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6771
6811
  constructor(http, pageSize) {
6772
6812
  super(http, {
6773
6813
  key: "expense_reports",
@@ -6834,7 +6874,7 @@ var ExpenseReportsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6834
6874
  };
6835
6875
 
6836
6876
  // src/resources/holiday_sets.ts
6837
- var HolidaySetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6877
+ var HolidaySetsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6838
6878
  constructor(http, pageSize) {
6839
6879
  super(http, {
6840
6880
  key: "holiday_sets",
@@ -6903,7 +6943,7 @@ var HolidaySetsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6903
6943
  };
6904
6944
 
6905
6945
  // src/resources/holidays.ts
6906
- var HolidaysResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
6946
+ var HolidaysResource = class extends _chunkLLIB4JGKcjs.BaseResource {
6907
6947
  constructor(http, pageSize) {
6908
6948
  super(http, {
6909
6949
  key: "holidays",
@@ -6975,10 +7015,10 @@ var PATH_SUFFIX = {
6975
7015
  transfer: "StockedItemsTransfer"
6976
7016
  };
6977
7017
  async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6978
- const numericParent = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, parentId, "parentId");
7018
+ const numericParent = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, parentId, "parentId");
6979
7019
  const suffix = PATH_SUFFIX[kind];
6980
7020
  if (opts.dryRun === true) {
6981
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
7021
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
6982
7022
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6983
7023
  method: "POST",
6984
7024
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -6995,11 +7035,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6995
7035
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6996
7036
  maxRetries: opts.maxRetries
6997
7037
  });
6998
- return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
7038
+ return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
6999
7039
  }
7000
7040
 
7001
7041
  // src/resources/inventory_products.ts
7002
- var InventoryProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7042
+ var InventoryProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7003
7043
  constructor(http, pageSize) {
7004
7044
  super(http, {
7005
7045
  key: "inventory_products",
@@ -7081,7 +7121,7 @@ var InventoryProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7081
7121
 
7082
7122
  // src/resources/special/invoices.ts
7083
7123
  async function markup(_resource, id, format, http) {
7084
- const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
7124
+ const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
7085
7125
  const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
7086
7126
  const res = await http.request({
7087
7127
  method: "GET",
@@ -7090,7 +7130,7 @@ async function markup(_resource, id, format, http) {
7090
7130
  });
7091
7131
  const body = res;
7092
7132
  if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
7093
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
7133
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(
7094
7134
  `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
7095
7135
  { code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
7096
7136
  );
@@ -7098,13 +7138,13 @@ async function markup(_resource, id, format, http) {
7098
7138
  return body.invoiceMarkup;
7099
7139
  }
7100
7140
  async function pdf(_resource, id, http) {
7101
- const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
7141
+ const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
7102
7142
  const res = await http.request({
7103
7143
  method: "GET",
7104
7144
  path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
7105
7145
  operation: "invoices.pdf"
7106
7146
  });
7107
- return _chunkIKWHRUQ5cjs.decodeFileData.call(void 0, res);
7147
+ return _chunkLLIB4JGKcjs.decodeFileData.call(void 0, res);
7108
7148
  }
7109
7149
  async function windowQuery2(_resource, kind, http, opts) {
7110
7150
  const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _76 => _76.now]), () => ( /* @__PURE__ */ new Date()));
@@ -7135,7 +7175,7 @@ async function customRange2(_resource, from, to, http, opts) {
7135
7175
  }
7136
7176
 
7137
7177
  // src/resources/invoices.ts
7138
- var InvoicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7178
+ var InvoicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7139
7179
  constructor(http, pageSize) {
7140
7180
  super(http, {
7141
7181
  key: "invoices",
@@ -7249,7 +7289,7 @@ var InvoicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7249
7289
  };
7250
7290
 
7251
7291
  // src/resources/invoice_templates.ts
7252
- var InvoiceTemplatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7292
+ var InvoiceTemplatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7253
7293
  constructor(http, pageSize) {
7254
7294
  super(http, {
7255
7295
  key: "invoice_templates",
@@ -7293,7 +7333,7 @@ var ModulesResource = class {
7293
7333
  };
7294
7334
 
7295
7335
  // src/resources/notification_history.ts
7296
- var NotificationHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7336
+ var NotificationHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7297
7337
  constructor(http, pageSize) {
7298
7338
  super(http, {
7299
7339
  key: "notification_history",
@@ -7332,7 +7372,7 @@ var NotificationHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7332
7372
  };
7333
7373
 
7334
7374
  // src/resources/opportunities.ts
7335
- var OpportunitiesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7375
+ var OpportunitiesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7336
7376
  constructor(http, pageSize) {
7337
7377
  super(http, {
7338
7378
  key: "opportunities",
@@ -7394,7 +7434,7 @@ var OpportunitiesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7394
7434
  };
7395
7435
 
7396
7436
  // src/resources/opportunity_attachments.ts
7397
- var OpportunityAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7437
+ var OpportunityAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7398
7438
  constructor(http, pageSize) {
7399
7439
  super(http, {
7400
7440
  key: "opportunity_attachments",
@@ -7456,7 +7496,7 @@ var OpportunityAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
7456
7496
  };
7457
7497
 
7458
7498
  // src/resources/opportunity_categories.ts
7459
- var OpportunityCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7499
+ var OpportunityCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7460
7500
  constructor(http, pageSize) {
7461
7501
  super(http, {
7462
7502
  key: "opportunity_categories",
@@ -7515,7 +7555,7 @@ var OpportunityCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource
7515
7555
  };
7516
7556
 
7517
7557
  // src/resources/organizational_level1s.ts
7518
- var OrganizationalLevel1sResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7558
+ var OrganizationalLevel1sResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7519
7559
  constructor(http, pageSize) {
7520
7560
  super(http, {
7521
7561
  key: "organizational_level1s",
@@ -7566,7 +7606,7 @@ var OrganizationalLevel1sResource = class extends _chunkIKWHRUQ5cjs.BaseResource
7566
7606
  };
7567
7607
 
7568
7608
  // src/resources/organizational_level2s.ts
7569
- var OrganizationalLevel2sResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7609
+ var OrganizationalLevel2sResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7570
7610
  constructor(http, pageSize) {
7571
7611
  super(http, {
7572
7612
  key: "organizational_level2s",
@@ -7617,7 +7657,7 @@ var OrganizationalLevel2sResource = class extends _chunkIKWHRUQ5cjs.BaseResource
7617
7657
  };
7618
7658
 
7619
7659
  // src/resources/organizational_level_associations.ts
7620
- var OrganizationalLevelAssociationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7660
+ var OrganizationalLevelAssociationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7621
7661
  constructor(http, pageSize) {
7622
7662
  super(http, {
7623
7663
  key: "organizational_level_associations",
@@ -7668,7 +7708,7 @@ var OrganizationalLevelAssociationsResource = class extends _chunkIKWHRUQ5cjs.Ba
7668
7708
  };
7669
7709
 
7670
7710
  // src/resources/phases.ts
7671
- var PhasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7711
+ var PhasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7672
7712
  constructor(http, pageSize) {
7673
7713
  super(http, {
7674
7714
  key: "phases",
@@ -7727,7 +7767,7 @@ var PhasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7727
7767
  };
7728
7768
 
7729
7769
  // src/resources/products.ts
7730
- var ProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7770
+ var ProductsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7731
7771
  constructor(http, pageSize) {
7732
7772
  super(http, {
7733
7773
  key: "products",
@@ -7794,7 +7834,7 @@ var ProductsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7794
7834
  };
7795
7835
 
7796
7836
  // src/resources/product_vendors.ts
7797
- var ProductVendorsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7837
+ var ProductVendorsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7798
7838
  constructor(http, pageSize) {
7799
7839
  super(http, {
7800
7840
  key: "product_vendors",
@@ -7853,7 +7893,7 @@ var ProductVendorsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7853
7893
  };
7854
7894
 
7855
7895
  // src/resources/project_charges.ts
7856
- var ProjectChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7896
+ var ProjectChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7857
7897
  constructor(http, pageSize) {
7858
7898
  super(http, {
7859
7899
  key: "project_charges",
@@ -7924,7 +7964,7 @@ var ProjectChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7924
7964
  };
7925
7965
 
7926
7966
  // src/resources/project_notes.ts
7927
- var ProjectNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7967
+ var ProjectNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7928
7968
  constructor(http, pageSize) {
7929
7969
  super(http, {
7930
7970
  key: "project_notes",
@@ -7983,7 +8023,7 @@ var ProjectNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
7983
8023
  };
7984
8024
 
7985
8025
  // src/resources/projects.ts
7986
- var ProjectsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8026
+ var ProjectsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
7987
8027
  constructor(http, pageSize) {
7988
8028
  super(http, {
7989
8029
  key: "projects",
@@ -8060,13 +8100,13 @@ var ProjectsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8060
8100
  const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
8061
8101
  const result = { project: project2, company, opportunity, leadResource };
8062
8102
  if (opts.names === true) {
8063
- const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, );
8103
+ const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, );
8064
8104
  builder.addResource(root["creatorResourceID"]);
8065
8105
  builder.addFk("contract", root["contractID"]);
8066
- const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8106
+ const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8067
8107
  const row = { ...project2 };
8068
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8069
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
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));
8070
8110
  result.project = row;
8071
8111
  result.names = names.section;
8072
8112
  }
@@ -8075,7 +8115,7 @@ var ProjectsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8075
8115
  };
8076
8116
 
8077
8117
  // src/resources/purchase_approvals.ts
8078
- var PurchaseApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8118
+ var PurchaseApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8079
8119
  constructor(http, pageSize) {
8080
8120
  super(http, {
8081
8121
  key: "purchase_approvals",
@@ -8129,7 +8169,7 @@ var PurchaseApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8129
8169
  };
8130
8170
 
8131
8171
  // src/resources/purchase_order_item_receiving.ts
8132
- var PurchaseOrderItemReceivingResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8172
+ var PurchaseOrderItemReceivingResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8133
8173
  constructor(http, pageSize) {
8134
8174
  super(http, {
8135
8175
  key: "purchase_order_item_receiving",
@@ -8179,7 +8219,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkIKWHRUQ5cjs.BaseRes
8179
8219
  };
8180
8220
 
8181
8221
  // src/resources/purchase_order_items.ts
8182
- var PurchaseOrderItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8222
+ var PurchaseOrderItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8183
8223
  constructor(http, pageSize) {
8184
8224
  super(http, {
8185
8225
  key: "purchase_order_items",
@@ -8238,7 +8278,7 @@ var PurchaseOrderItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8238
8278
  };
8239
8279
 
8240
8280
  // src/resources/purchase_orders.ts
8241
- var PurchaseOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8281
+ var PurchaseOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8242
8282
  constructor(http, pageSize) {
8243
8283
  super(http, {
8244
8284
  key: "purchase_orders",
@@ -8300,7 +8340,7 @@ var PurchaseOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8300
8340
  };
8301
8341
 
8302
8342
  // src/resources/quote_items.ts
8303
- var QuoteItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8343
+ var QuoteItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8304
8344
  constructor(http, pageSize) {
8305
8345
  super(http, {
8306
8346
  key: "quote_items",
@@ -8371,7 +8411,7 @@ var QuoteItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8371
8411
  };
8372
8412
 
8373
8413
  // src/resources/quote_locations.ts
8374
- var QuoteLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8414
+ var QuoteLocationsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8375
8415
  constructor(http, pageSize) {
8376
8416
  super(http, {
8377
8417
  key: "quote_locations",
@@ -8436,7 +8476,7 @@ var QuoteLocationsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8436
8476
  };
8437
8477
 
8438
8478
  // src/resources/quotes.ts
8439
- var QuotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8479
+ var QuotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8440
8480
  constructor(http, pageSize) {
8441
8481
  super(http, {
8442
8482
  key: "quotes",
@@ -8503,7 +8543,7 @@ var QuotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8503
8543
  };
8504
8544
 
8505
8545
  // src/resources/quote_templates.ts
8506
- var QuoteTemplatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8546
+ var QuoteTemplatesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8507
8547
  constructor(http, pageSize) {
8508
8548
  super(http, {
8509
8549
  key: "quote_templates",
@@ -8547,7 +8587,7 @@ var QuoteTemplatesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8547
8587
  };
8548
8588
 
8549
8589
  // src/resources/resource_role_queues.ts
8550
- var ResourceRoleQueuesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8590
+ var ResourceRoleQueuesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8551
8591
  constructor(http, pageSize) {
8552
8592
  super(http, {
8553
8593
  key: "resource_role_queues",
@@ -8606,7 +8646,7 @@ var ResourceRoleQueuesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8606
8646
  };
8607
8647
 
8608
8648
  // src/resources/resource_roles.ts
8609
- var ResourceRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8649
+ var ResourceRolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8610
8650
  constructor(http, pageSize) {
8611
8651
  super(http, {
8612
8652
  key: "resource_roles",
@@ -8648,7 +8688,7 @@ var ResourceRolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8648
8688
  };
8649
8689
 
8650
8690
  // src/resources/resource_skills.ts
8651
- var ResourceSkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8691
+ var ResourceSkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8652
8692
  constructor(http, pageSize) {
8653
8693
  super(http, {
8654
8694
  key: "resource_skills",
@@ -8702,16 +8742,16 @@ var ResourceSkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8702
8742
  var MAX_TRANSFER_IDS = 500;
8703
8743
  function requirePositiveIds(ids2, label) {
8704
8744
  if (!Array.isArray(ids2) || ids2.length === 0) {
8705
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8745
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8706
8746
  }
8707
8747
  if (ids2.length > MAX_TRANSFER_IDS) {
8708
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8748
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8709
8749
  }
8710
8750
  const out = [];
8711
8751
  for (const raw of ids2) {
8712
- const id = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, raw, `${label} id`);
8752
+ const id = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8713
8753
  if (typeof id === "number" && id < 1) {
8714
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8754
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8715
8755
  }
8716
8756
  out.push(id);
8717
8757
  }
@@ -8719,7 +8759,7 @@ function requirePositiveIds(ids2, label) {
8719
8759
  }
8720
8760
  async function whoAmI(_resource, userName, http) {
8721
8761
  const user = userName.trim();
8722
- if (user === "") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8762
+ if (user === "") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8723
8763
  const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
8724
8764
  const res = await http.request({
8725
8765
  method: "POST",
@@ -8728,11 +8768,11 @@ async function whoAmI(_resource, userName, http) {
8728
8768
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
8729
8769
  operation: "resources.whoAmI"
8730
8770
  });
8731
- const matches = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
8771
+ const matches = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
8732
8772
  if (matches.length === 0) return null;
8733
8773
  if (matches.length > 1) {
8734
8774
  const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
8735
- throw new (0, _chunkIKWHRUQ5cjs.ResolutionError)(
8775
+ throw new (0, _chunkLLIB4JGKcjs.ResolutionError)(
8736
8776
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
8737
8777
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
8738
8778
  );
@@ -8741,9 +8781,9 @@ async function whoAmI(_resource, userName, http) {
8741
8781
  }
8742
8782
  async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
8743
8783
  const ids2 = requirePositiveIds(companyIds, "transferOwnership");
8744
- const destination = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8784
+ const destination = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8745
8785
  if (typeof destination === "number" && destination < 1) {
8746
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8786
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8747
8787
  }
8748
8788
  const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _88 => _88.dryRun]), () => ( true));
8749
8789
  const changes = [];
@@ -8756,7 +8796,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8756
8796
  operation: "resources.transferOwnership",
8757
8797
  maxRetries: _optionalChain([opts, 'optionalAccess', _89 => _89.maxRetries])
8758
8798
  });
8759
- const company = _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, id, void 0, "company");
8799
+ const company = _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8760
8800
  const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
8761
8801
  changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
8762
8802
  if (!dryRun) {
@@ -8767,13 +8807,13 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8767
8807
  operation: "resources.transferOwnership",
8768
8808
  maxRetries: _optionalChain([opts, 'optionalAccess', _90 => _90.maxRetries])
8769
8809
  });
8770
- _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, update);
8810
+ _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, update);
8771
8811
  applied.push(id);
8772
8812
  }
8773
8813
  } catch (err) {
8774
- if (!dryRun && err instanceof _chunkIKWHRUQ5cjs.AutotaskError) {
8814
+ if (!dryRun && err instanceof _chunkLLIB4JGKcjs.AutotaskError) {
8775
8815
  err.resourceIds = [id];
8776
- err.details = _chunkIKWHRUQ5cjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8816
+ err.details = _chunkLLIB4JGKcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8777
8817
  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).`;
8778
8818
  }
8779
8819
  throw err;
@@ -8782,7 +8822,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8782
8822
  if (dryRun) {
8783
8823
  const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
8784
8824
  return {
8785
- ..._chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
8825
+ ..._chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
8786
8826
  operation: "resources.transferOwnership",
8787
8827
  method: "PUT",
8788
8828
  path: "/V1.0/Companies",
@@ -8806,7 +8846,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8806
8846
  }
8807
8847
 
8808
8848
  // src/resources/resources.ts
8809
- var ResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8849
+ var ResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8810
8850
 
8811
8851
  constructor(http, clientConfig, pageSize) {
8812
8852
  super(http, {
@@ -8879,7 +8919,7 @@ var ResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8879
8919
 
8880
8920
  // src/resources/special/resource_time_off_additional.ts
8881
8921
  async function getByResource(_resource, resourceId, http) {
8882
- const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8922
+ const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8883
8923
  const res = await http.request({
8884
8924
  method: "GET",
8885
8925
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -8893,11 +8933,11 @@ async function getByResource(_resource, resourceId, http) {
8893
8933
  if (typeof item === "object" && !Array.isArray(item)) return [item];
8894
8934
  }
8895
8935
  }
8896
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8936
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8897
8937
  }
8898
8938
 
8899
8939
  // src/resources/resource_time_off_additional.ts
8900
- var ResourceTimeOffAdditionalResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8940
+ var ResourceTimeOffAdditionalResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8901
8941
  constructor(http, pageSize) {
8902
8942
  super(http, {
8903
8943
  key: "resource_time_off_additional",
@@ -8936,7 +8976,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkIKWHRUQ5cjs.BaseReso
8936
8976
  };
8937
8977
 
8938
8978
  // src/resources/resource_time_off_approvers.ts
8939
- var ResourceTimeOffApproversResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
8979
+ var ResourceTimeOffApproversResource = class extends _chunkLLIB4JGKcjs.BaseResource {
8940
8980
  constructor(http, pageSize) {
8941
8981
  super(http, {
8942
8982
  key: "resource_time_off_approvers",
@@ -8979,29 +9019,29 @@ var ResourceTimeOffApproversResource = class extends _chunkIKWHRUQ5cjs.BaseResou
8979
9019
 
8980
9020
  // src/resources/special/resource_time_off_balances.ts
8981
9021
  async function getByResource2(_resource, resourceId, http) {
8982
- const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9022
+ const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8983
9023
  const res = await http.request({
8984
9024
  method: "GET",
8985
9025
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
8986
9026
  operation: "resource_time_off_balances.getByResource"
8987
9027
  });
8988
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
9028
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8989
9029
  }
8990
9030
  async function getByYear(_resource, resourceId, year, http) {
8991
- const numericResource = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceId, "resourceId");
9031
+ const numericResource = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8992
9032
  if (!Number.isSafeInteger(year) || year < 1) {
8993
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("getByYear: year must be a positive integer");
9033
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8994
9034
  }
8995
9035
  const res = await http.request({
8996
9036
  method: "GET",
8997
9037
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
8998
9038
  operation: "resource_time_off_balances.getByYear"
8999
9039
  });
9000
- return _chunkIKWHRUQ5cjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
9040
+ return _chunkLLIB4JGKcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
9001
9041
  }
9002
9042
 
9003
9043
  // src/resources/resource_time_off_balances.ts
9004
- var ResourceTimeOffBalancesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9044
+ var ResourceTimeOffBalancesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9005
9045
  constructor(http, pageSize) {
9006
9046
  super(http, {
9007
9047
  key: "resource_time_off_balances",
@@ -9039,7 +9079,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkIKWHRUQ5cjs.BaseResour
9039
9079
  };
9040
9080
 
9041
9081
  // src/resources/roles.ts
9042
- var RolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9082
+ var RolesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9043
9083
  constructor(http, pageSize) {
9044
9084
  super(http, {
9045
9085
  key: "roles",
@@ -9106,7 +9146,7 @@ var RolesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9106
9146
  };
9107
9147
 
9108
9148
  // src/resources/sales_orders.ts
9109
- var SalesOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9149
+ var SalesOrdersResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9110
9150
  constructor(http, pageSize) {
9111
9151
  super(http, {
9112
9152
  key: "sales_orders",
@@ -9149,7 +9189,7 @@ var SalesOrdersResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9149
9189
  };
9150
9190
 
9151
9191
  // src/resources/service_calls.ts
9152
- var ServiceCallsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9192
+ var ServiceCallsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9153
9193
  constructor(http, pageSize) {
9154
9194
  super(http, {
9155
9195
  key: "service_calls",
@@ -9218,7 +9258,7 @@ var ServiceCallsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9218
9258
  };
9219
9259
 
9220
9260
  // src/resources/service_call_task_resources.ts
9221
- var ServiceCallTaskResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9261
+ var ServiceCallTaskResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9222
9262
  constructor(http, pageSize) {
9223
9263
  super(http, {
9224
9264
  key: "service_call_task_resources",
@@ -9275,7 +9315,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResou
9275
9315
  };
9276
9316
 
9277
9317
  // src/resources/service_call_tasks.ts
9278
- var ServiceCallTasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9318
+ var ServiceCallTasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9279
9319
  constructor(http, pageSize) {
9280
9320
  super(http, {
9281
9321
  key: "service_call_tasks",
@@ -9332,7 +9372,7 @@ var ServiceCallTasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9332
9372
  };
9333
9373
 
9334
9374
  // src/resources/service_call_ticket_resources.ts
9335
- var ServiceCallTicketResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9375
+ var ServiceCallTicketResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9336
9376
  constructor(http, pageSize) {
9337
9377
  super(http, {
9338
9378
  key: "service_call_ticket_resources",
@@ -9389,7 +9429,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseRes
9389
9429
  };
9390
9430
 
9391
9431
  // src/resources/service_call_tickets.ts
9392
- var ServiceCallTicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9432
+ var ServiceCallTicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9393
9433
  constructor(http, pageSize) {
9394
9434
  super(http, {
9395
9435
  key: "service_call_tickets",
@@ -9446,7 +9486,7 @@ var ServiceCallTicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9446
9486
  };
9447
9487
 
9448
9488
  // src/resources/service_level_agreement_results.ts
9449
- var ServiceLevelAgreementResultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9489
+ var ServiceLevelAgreementResultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9450
9490
  constructor(http, pageSize) {
9451
9491
  super(http, {
9452
9492
  key: "service_level_agreement_results",
@@ -9485,7 +9525,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkIKWHRUQ5cjs.BaseR
9485
9525
  };
9486
9526
 
9487
9527
  // src/resources/services.ts
9488
- var ServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9528
+ var ServicesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9489
9529
  constructor(http, pageSize) {
9490
9530
  super(http, {
9491
9531
  key: "services",
@@ -9553,7 +9593,7 @@ var ServicesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9553
9593
  };
9554
9594
 
9555
9595
  // src/resources/skills.ts
9556
- var SkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9596
+ var SkillsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9557
9597
  constructor(http, pageSize) {
9558
9598
  super(http, {
9559
9599
  key: "skills",
@@ -9597,7 +9637,7 @@ var SkillsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9597
9637
  };
9598
9638
 
9599
9639
  // src/resources/subscription_periods.ts
9600
- var SubscriptionPeriodsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9640
+ var SubscriptionPeriodsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9601
9641
  constructor(http, pageSize) {
9602
9642
  super(http, {
9603
9643
  key: "subscription_periods",
@@ -9636,7 +9676,7 @@ var SubscriptionPeriodsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9636
9676
  };
9637
9677
 
9638
9678
  // src/resources/subscriptions.ts
9639
- var SubscriptionsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9679
+ var SubscriptionsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9640
9680
  constructor(http, pageSize) {
9641
9681
  super(http, {
9642
9682
  key: "subscriptions",
@@ -9705,7 +9745,7 @@ var SubscriptionsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9705
9745
  };
9706
9746
 
9707
9747
  // src/resources/survey_results.ts
9708
- var SurveyResultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9748
+ var SurveyResultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9709
9749
  constructor(http, pageSize) {
9710
9750
  super(http, {
9711
9751
  key: "survey_results",
@@ -9744,7 +9784,7 @@ var SurveyResultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9744
9784
  };
9745
9785
 
9746
9786
  // src/resources/surveys.ts
9747
- var SurveysResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9787
+ var SurveysResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9748
9788
  constructor(http, pageSize) {
9749
9789
  super(http, {
9750
9790
  key: "surveys",
@@ -9788,7 +9828,7 @@ var SurveysResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9788
9828
  };
9789
9829
 
9790
9830
  // src/resources/tag_aliases.ts
9791
- var TagAliasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9831
+ var TagAliasesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9792
9832
  constructor(http, pageSize) {
9793
9833
  super(http, {
9794
9834
  key: "tag_aliases",
@@ -9845,7 +9885,7 @@ var TagAliasesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9845
9885
  };
9846
9886
 
9847
9887
  // src/resources/tag_groups.ts
9848
- var TagGroupsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9888
+ var TagGroupsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9849
9889
  constructor(http, pageSize) {
9850
9890
  super(http, {
9851
9891
  key: "tag_groups",
@@ -9914,7 +9954,7 @@ var TagGroupsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9914
9954
  };
9915
9955
 
9916
9956
  // src/resources/tags.ts
9917
- var TagsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9957
+ var TagsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9918
9958
  constructor(http, pageSize) {
9919
9959
  super(http, {
9920
9960
  key: "tags",
@@ -9983,7 +10023,7 @@ var TagsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
9983
10023
  };
9984
10024
 
9985
10025
  // src/resources/task_secondary_resources.ts
9986
- var TaskSecondaryResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10026
+ var TaskSecondaryResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
9987
10027
  constructor(http, pageSize) {
9988
10028
  super(http, {
9989
10029
  key: "task_secondary_resources",
@@ -10040,7 +10080,7 @@ var TaskSecondaryResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResourc
10040
10080
  };
10041
10081
 
10042
10082
  // src/resources/tasks.ts
10043
- var TasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10083
+ var TasksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10044
10084
  constructor(http, pageSize) {
10045
10085
  super(http, {
10046
10086
  key: "tasks",
@@ -10104,7 +10144,7 @@ var TasksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10104
10144
  };
10105
10145
 
10106
10146
  // src/resources/tax_regions.ts
10107
- var TaxRegionsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10147
+ var TaxRegionsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10108
10148
  constructor(http, pageSize) {
10109
10149
  super(http, {
10110
10150
  key: "tax_regions",
@@ -10179,7 +10219,7 @@ var ThresholdInformationResource = class {
10179
10219
  };
10180
10220
 
10181
10221
  // src/resources/ticket_additional_configuration_items.ts
10182
- var TicketAdditionalConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10222
+ var TicketAdditionalConfigurationItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10183
10223
  constructor(http, pageSize) {
10184
10224
  super(http, {
10185
10225
  key: "ticket_additional_configuration_items",
@@ -10236,7 +10276,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkIKWHRUQ5cjs
10236
10276
  };
10237
10277
 
10238
10278
  // src/resources/ticket_additional_contacts.ts
10239
- var TicketAdditionalContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10279
+ var TicketAdditionalContactsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10240
10280
  constructor(http, pageSize) {
10241
10281
  super(http, {
10242
10282
  key: "ticket_additional_contacts",
@@ -10293,7 +10333,7 @@ var TicketAdditionalContactsResource = class extends _chunkIKWHRUQ5cjs.BaseResou
10293
10333
  };
10294
10334
 
10295
10335
  // src/resources/ticket_attachments.ts
10296
- var TicketAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10336
+ var TicketAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10297
10337
  constructor(http, pageSize) {
10298
10338
  super(http, {
10299
10339
  key: "ticket_attachments",
@@ -10355,7 +10395,7 @@ var TicketAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10355
10395
  };
10356
10396
 
10357
10397
  // src/resources/ticket_categories.ts
10358
- var TicketCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10398
+ var TicketCategoriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10359
10399
  constructor(http, pageSize) {
10360
10400
  super(http, {
10361
10401
  key: "ticket_categories",
@@ -10414,7 +10454,7 @@ var TicketCategoriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10414
10454
  };
10415
10455
 
10416
10456
  // src/resources/ticket_category_field_defaults.ts
10417
- var TicketCategoryFieldDefaultsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10457
+ var TicketCategoryFieldDefaultsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10418
10458
  constructor(http, pageSize) {
10419
10459
  super(http, {
10420
10460
  key: "ticket_category_field_defaults",
@@ -10456,7 +10496,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkIKWHRUQ5cjs.BaseRe
10456
10496
  };
10457
10497
 
10458
10498
  // src/resources/ticket_change_request_approvals.ts
10459
- var TicketChangeRequestApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10499
+ var TicketChangeRequestApprovalsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10460
10500
  constructor(http, pageSize) {
10461
10501
  super(http, {
10462
10502
  key: "ticket_change_request_approvals",
@@ -10516,10 +10556,10 @@ var TicketChangeRequestApprovalsResource = class extends _chunkIKWHRUQ5cjs.BaseR
10516
10556
  var _crypto = require('crypto');
10517
10557
  var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
10518
10558
  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";
10519
- var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10559
+ var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkLLIB4JGKcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10520
10560
  async function queryRows(http, resource, filter, operation, retries) {
10521
10561
  const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
10522
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
10562
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
10523
10563
  }
10524
10564
  function sameValue(a, b) {
10525
10565
  if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
@@ -10539,7 +10579,7 @@ async function readTicket(http, id, retries, operation) {
10539
10579
  const item = _optionalChain([res, 'optionalAccess', _98 => _98.item]);
10540
10580
  return _nullishCoalesce(item, () => ( null));
10541
10581
  } catch (e) {
10542
- if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10582
+ if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10543
10583
  throw e;
10544
10584
  }
10545
10585
  }
@@ -10560,7 +10600,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
10560
10600
  }
10561
10601
  }
10562
10602
  const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
10563
- if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10603
+ if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10564
10604
  const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
10565
10605
  if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
10566
10606
  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") });
@@ -10603,17 +10643,17 @@ async function assertNoTwin(ctx, payload) {
10603
10643
  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 });
10604
10644
  }
10605
10645
  }
10606
- var statusOf = (e) => _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10646
+ var statusOf = (e) => _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10607
10647
  async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10608
10648
  const op = spec.operation;
10609
- const sourceId = Number(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10610
- const toTicketId = Number(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10649
+ const sourceId = Number(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10650
+ const toTicketId = Number(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10611
10651
  if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
10612
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10652
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10613
10653
  }
10614
10654
  const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
10615
10655
  if (opts.dryRun === true) {
10616
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
10656
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
10617
10657
  {
10618
10658
  operation: op,
10619
10659
  method: "POST",
@@ -10638,22 +10678,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10638
10678
  let newId;
10639
10679
  try {
10640
10680
  const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
10641
- newId = Number(_chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, created, op).id);
10681
+ newId = Number(_chunkLLIB4JGKcjs.unwrapOperation.call(void 0, created, op).id);
10642
10682
  } catch (e) {
10643
10683
  const status = statusOf(e);
10644
10684
  if (status !== void 0 && status >= 400 && status < 500) {
10645
- throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
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 } });
10646
10686
  }
10647
- throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the create outcome is unknown (never resent) \u2014 check the target ticket for a new ${spec.entity} before retrying; the twin check blocks a second create`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2 } });
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 } });
10648
10688
  }
10649
10689
  const rollback = async (code, message) => {
10650
10690
  try {
10651
10691
  await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
10652
10692
  } catch (re) {
10653
10693
  const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
10654
- throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: ${message}; rolling back the new ${spec.entity} ${newId} FAILED \u2014 both records exist`, { code: unreadable ? "MOVE_UNKNOWN" : "MOVE_PARTIAL", operation: op, details: { status: unreadable ? "unknown" : "partial", ...ids2, newId, reason: code } });
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 } });
10655
10695
  }
10656
- throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
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 } });
10657
10697
  };
10658
10698
  const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
10659
10699
  if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
@@ -10682,33 +10722,33 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10682
10722
  };
10683
10723
  }
10684
10724
  if (status === void 0) {
10685
- throw new (0, _chunkIKWHRUQ5cjs.MoveRefusedError)(`${op}: the source delete outcome is unknown (never resent) \u2014 re-read the source: absent means the move completed`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2, newId } });
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 } });
10686
10726
  }
10687
10727
  return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
10688
10728
  }
10689
10729
  return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
10690
10730
  }
10691
10731
  function uiLinkFor(http, entity, id) {
10692
- return _nullishCoalesce(_chunkIKWHRUQ5cjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10732
+ return _nullishCoalesce(_chunkLLIB4JGKcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10693
10733
  }
10694
10734
 
10695
10735
  // src/resources/special/ticket_charges.ts
10696
- var OP3 = "ticket_charges.moveToTicket";
10736
+ var OP4 = "ticket_charges.moveToTicket";
10697
10737
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
10698
10738
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
10699
10739
  async function readCharge(http, id, retries) {
10700
- const rows = await queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
10740
+ const rows = await queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP4, retries);
10701
10741
  return _nullishCoalesce(rows[0], () => ( null));
10702
10742
  }
10703
10743
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
10704
10744
  if (source.isBilled === true) {
10705
- throw refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
10745
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP4}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP4, {
10706
10746
  manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
10707
10747
  });
10708
10748
  }
10709
10749
  }
10710
10750
  var SPEC = {
10711
- operation: OP3,
10751
+ operation: OP4,
10712
10752
  entity: "ticket_charge",
10713
10753
  readSource: readCharge,
10714
10754
  sourceTicketId: (s) => typeof s.ticketID === "number" ? s.ticketID : null,
@@ -10744,7 +10784,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
10744
10784
  }
10745
10785
 
10746
10786
  // src/resources/ticket_charges.ts
10747
- var TicketChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10787
+ var TicketChargesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10748
10788
  constructor(http, pageSize) {
10749
10789
  super(http, {
10750
10790
  key: "ticket_charges",
@@ -10819,7 +10859,7 @@ var TicketChargesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10819
10859
  };
10820
10860
 
10821
10861
  // src/resources/ticket_checklist_items.ts
10822
- var TicketChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10862
+ var TicketChecklistItemsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10823
10863
  constructor(http, pageSize) {
10824
10864
  super(http, {
10825
10865
  key: "ticket_checklist_items",
@@ -10885,7 +10925,7 @@ var TicketChecklistItemsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
10885
10925
  };
10886
10926
 
10887
10927
  // src/resources/ticket_checklist_libraries.ts
10888
- var TicketChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10928
+ var TicketChecklistLibrariesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10889
10929
  constructor(http, pageSize) {
10890
10930
  super(http, {
10891
10931
  key: "ticket_checklist_libraries",
@@ -10909,9 +10949,9 @@ var TicketChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResou
10909
10949
  * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
10910
10950
  * surface — no documents read op — and never issues the POST). */
10911
10951
  async attachToDocument(documentID, data, opts = {}) {
10912
- const n = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, documentID, "documentID");
10952
+ const n = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, documentID, "documentID");
10913
10953
  if (opts.dryRun === true) {
10914
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
10954
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
10915
10955
  operation: "ticket_checklist_libraries.attachToDocument",
10916
10956
  method: "POST",
10917
10957
  path: `/V1.0/Documents/${n}/ChecklistLibraries`,
@@ -10929,7 +10969,7 @@ var TicketChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResou
10929
10969
  operation: "ticket_checklist_libraries.attachToDocument",
10930
10970
  maxRetries: opts.maxRetries
10931
10971
  });
10932
- return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
10972
+ return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
10933
10973
  }
10934
10974
  /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
10935
10975
  * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
@@ -10945,7 +10985,7 @@ var TicketChecklistLibrariesResource = class extends _chunkIKWHRUQ5cjs.BaseResou
10945
10985
  };
10946
10986
 
10947
10987
  // src/resources/ticket_history.ts
10948
- var TicketHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10988
+ var TicketHistoryResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10949
10989
  constructor(http, pageSize) {
10950
10990
  super(http, {
10951
10991
  key: "ticket_history",
@@ -10984,7 +11024,7 @@ var TicketHistoryResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
10984
11024
  };
10985
11025
 
10986
11026
  // src/resources/ticket_note_attachments.ts
10987
- var TicketNoteAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11027
+ var TicketNoteAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
10988
11028
  constructor(http, pageSize) {
10989
11029
  super(http, {
10990
11030
  key: "ticket_note_attachments",
@@ -11046,7 +11086,7 @@ var TicketNoteAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
11046
11086
  };
11047
11087
 
11048
11088
  // src/resources/ticket_notes.ts
11049
- var TicketNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11089
+ var TicketNotesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11050
11090
  constructor(http, pageSize) {
11051
11091
  super(http, {
11052
11092
  key: "ticket_notes",
@@ -11105,7 +11145,7 @@ var TicketNotesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11105
11145
  };
11106
11146
 
11107
11147
  // src/resources/ticket_note_webhooks.ts
11108
- var TicketNoteWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11148
+ var TicketNoteWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11109
11149
  constructor(http, pageSize) {
11110
11150
  super(http, {
11111
11151
  key: "ticket_note_webhooks",
@@ -11181,7 +11221,7 @@ var TicketNoteWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11181
11221
  };
11182
11222
 
11183
11223
  // src/resources/ticket_secondary_resources.ts
11184
- var TicketSecondaryResourcesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
11224
+ var TicketSecondaryResourcesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
11185
11225
  constructor(http, pageSize) {
11186
11226
  super(http, {
11187
11227
  key: "ticket_secondary_resources",
@@ -11246,9 +11286,9 @@ async function fetchTicket(http, id, operation) {
11246
11286
  });
11247
11287
  const body = res;
11248
11288
  if (body === null || !("item" in body)) {
11249
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11289
+ throw new (0, _chunkLLIB4JGKcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11250
11290
  }
11251
- if (body.item === null || body.item === void 0) throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
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 }] } });
11252
11292
  return body.item;
11253
11293
  }
11254
11294
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -11259,7 +11299,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
11259
11299
  body: { MaxRecords: maxRecords, filter },
11260
11300
  operation
11261
11301
  });
11262
- return _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res).items;
11302
+ return _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res).items;
11263
11303
  }
11264
11304
  function truncate(text, limit) {
11265
11305
  const full = _nullishCoalesce(text, () => ( ""));
@@ -11269,26 +11309,26 @@ function truncate(text, limit) {
11269
11309
 
11270
11310
  // src/resources/special/tickets/childRead.ts
11271
11311
  function isRouteUnavailable(err) {
11272
- return _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11312
+ return _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11273
11313
  }
11274
11314
  function routeFact(route, path, err) {
11275
11315
  return {
11276
11316
  route,
11277
11317
  path,
11278
- httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11318
+ httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11279
11319
  };
11280
11320
  }
11281
11321
  function childDeclaresQuery(resourceKey) {
11282
- return _chunkPY45RBQ2cjs.CAPABILITIES.some(
11322
+ return _chunkEDVSWL32cjs.CAPABILITIES.some(
11283
11323
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
11284
11324
  );
11285
11325
  }
11286
11326
  function planScopedPath(resourceKey, ticketId) {
11287
11327
  if (!childDeclaresQuery(resourceKey)) return null;
11288
- const entry = _chunkIKWHRUQ5cjs.RELATIONSHIP_MAP[resourceKey];
11328
+ const entry = _chunkLLIB4JGKcjs.RELATIONSHIP_MAP[resourceKey];
11289
11329
  const parent = entry === void 0 ? null : entry.parent;
11290
11330
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
11291
- const parentPath = _optionalChain([_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11331
+ const parentPath = _optionalChain([_chunkLLIB4JGKcjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
11292
11332
  if (parentPath === null || parentPath === void 0) return null;
11293
11333
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
11294
11334
  }
@@ -11327,14 +11367,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
11327
11367
  break;
11328
11368
  }
11329
11369
  const body = await http.request({ method: "GET", path: target, operation });
11330
- const { items: pageItems, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, body, operation);
11370
+ const { items: pageItems, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, body, operation);
11331
11371
  nextCursor = pageDetails.nextPageUrl;
11332
11372
  pages += 1;
11333
11373
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
11334
11374
  for (const row of window) if (accept(row)) items.push(row);
11335
11375
  if (items.length >= limit) break;
11336
11376
  if (nextCursor === null || pageItems.length === 0) break;
11337
- target = _chunkIKWHRUQ5cjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11377
+ target = _chunkLLIB4JGKcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11338
11378
  }
11339
11379
  const capped = items.length >= limit || guard && nextCursor !== null;
11340
11380
  return { items, capped };
@@ -11367,7 +11407,7 @@ var MS = 864e5;
11367
11407
  var SLA_PAGE = 100;
11368
11408
  async function slaHealthCheck(_resource, id, opts = {}, http) {
11369
11409
  void opts;
11370
- const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11410
+ const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11371
11411
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
11372
11412
  const rows = await ticketQueryItems(
11373
11413
  http,
@@ -11392,9 +11432,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
11392
11432
  async function summary(_resource, id, opts = {}, http) {
11393
11433
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
11394
11434
  if (!Number.isInteger(limit) || limit < 1) {
11395
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11435
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11396
11436
  }
11397
- const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11437
+ const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11398
11438
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
11399
11439
  const desc = truncate(ticket.description, limit);
11400
11440
  const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
@@ -11423,11 +11463,11 @@ async function summary(_resource, id, opts = {}, http) {
11423
11463
  // src/resources/special/tickets/timeline.ts
11424
11464
  function validateTimelineLimits(opts) {
11425
11465
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
11426
- if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11466
+ if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11427
11467
  const bounded = Math.min(limit, 500);
11428
11468
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
11429
11469
  if (!Number.isInteger(textLimit) || textLimit < 1) {
11430
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11470
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11431
11471
  }
11432
11472
  return { bounded, textLimit };
11433
11473
  }
@@ -11479,7 +11519,7 @@ function compareEventDates(a, b) {
11479
11519
  }
11480
11520
  async function timeline(_resource, id, opts = {}, http) {
11481
11521
  const { bounded, textLimit } = validateTimelineLimits(opts);
11482
- const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
11522
+ const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
11483
11523
  await fetchTicket(http, ticketId, "tickets.timeline");
11484
11524
  const dateFilters = (field) => {
11485
11525
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11519,7 +11559,7 @@ async function timeline(_resource, id, opts = {}, http) {
11519
11559
  }
11520
11560
 
11521
11561
  // src/resources/special/tickets/errors.ts
11522
- var QueueRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11562
+ var QueueRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11523
11563
  constructor(message, options = {}) {
11524
11564
  super(message, {
11525
11565
  code: "QUEUE_REQUIRED",
@@ -11530,13 +11570,13 @@ var QueueRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11530
11570
  this.name = "QueueRequiredError";
11531
11571
  }
11532
11572
  };
11533
- var TicketResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11573
+ var TicketResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11534
11574
  constructor(message, options = {}) {
11535
11575
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11536
11576
  this.name = "TicketResourceInvalidError";
11537
11577
  }
11538
11578
  };
11539
- var TicketCreateValidationFailedError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11579
+ var TicketCreateValidationFailedError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11540
11580
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
11541
11581
 
11542
11582
  constructor(message, vendorFields, options = {}) {
@@ -11545,7 +11585,7 @@ var TicketCreateValidationFailedError = class extends _chunkIKWHRUQ5cjs.Autotask
11545
11585
  this.vendorFields = vendorFields;
11546
11586
  }
11547
11587
  };
11548
- var StatusUnknownError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11588
+ var StatusUnknownError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11549
11589
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
11550
11590
 
11551
11591
  constructor(message, options = {}) {
@@ -11559,7 +11599,7 @@ var StatusUnknownError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11559
11599
  this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
11560
11600
  }
11561
11601
  };
11562
- var StatusFieldsRequiredError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
11602
+ var StatusFieldsRequiredError = class extends _chunkLLIB4JGKcjs.AutotaskError {
11563
11603
 
11564
11604
 
11565
11605
 
@@ -11582,14 +11622,14 @@ function isPositiveInt(v) {
11582
11622
  return typeof v === "number" && Number.isInteger(v) && v > 0;
11583
11623
  }
11584
11624
  function namedVendorFields(err) {
11585
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11586
- const entries = _nullishCoalesce(_chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11625
+ if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11626
+ const entries = _nullishCoalesce(_chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11587
11627
  const out = /* @__PURE__ */ new Set();
11588
11628
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
11589
11629
  return [...out];
11590
11630
  }
11591
11631
  function vendorDetailOf(err) {
11592
- return _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? _chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11632
+ return _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? _chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11593
11633
  }
11594
11634
  async function fetchItem(http, path, operation, readOpts) {
11595
11635
  const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _104 => _104.maxRetries]) });
@@ -11610,8 +11650,8 @@ function operationId(res) {
11610
11650
  return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
11611
11651
  }
11612
11652
  function discoveryMerge(err, body, defaults) {
11613
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11614
- const entries = _chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError);
11653
+ if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11654
+ const entries = _chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError);
11615
11655
  if (entries === void 0) return null;
11616
11656
  for (const entry of entries) {
11617
11657
  const field = entry.field;
@@ -11623,7 +11663,7 @@ function discoveryMerge(err, body, defaults) {
11623
11663
  }
11624
11664
  function stepErrorText(code, err) {
11625
11665
  const detail = vendorDetailOf(err);
11626
- const base = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11666
+ const base = _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11627
11667
  return detail ? `${code}: ${detail}` : `${code}: ${base}`;
11628
11668
  }
11629
11669
 
@@ -11635,43 +11675,43 @@ var DEFAULT_PUBLISH = 1;
11635
11675
  var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
11636
11676
  var SAFE_TICKET_CREATE_DEFAULTS = {};
11637
11677
  function validateOpenInput(params, note, assign) {
11638
- const companyID = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11678
+ const companyID = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11639
11679
  const title = _optionalChain([params, 'optionalAccess', _107 => _107.title]);
11640
11680
  if (typeof title !== "string" || title.trim() === "") {
11641
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11681
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11642
11682
  }
11643
11683
  const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
11644
11684
  const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
11645
11685
  if (!isPositiveInt(priority)) {
11646
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11686
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11647
11687
  }
11648
11688
  if (!isPositiveInt(status)) {
11649
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11689
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11650
11690
  }
11651
11691
  if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
11652
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11692
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11653
11693
  }
11654
11694
  if (note !== void 0) {
11655
11695
  if (typeof note.description !== "string" || note.description.trim() === "") {
11656
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11696
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11657
11697
  }
11658
11698
  if (typeof note.title !== "string" || note.title.trim() === "") {
11659
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: note.title is required (a non-empty string) \u2014 the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })", { operation: OP_OPEN });
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 });
11660
11700
  }
11661
11701
  if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
11662
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11702
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11663
11703
  }
11664
11704
  if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
11665
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
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 });
11666
11706
  }
11667
11707
  }
11668
- const assignee = assign === void 0 ? void 0 : _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11708
+ const assignee = assign === void 0 ? void 0 : _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11669
11709
  if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
11670
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11710
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11671
11711
  }
11672
11712
  const roleID = _optionalChain([assign, 'optionalAccess', _108 => _108.roleID]);
11673
11713
  if (assign !== void 0 && !isPositiveInt(roleID)) {
11674
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("openWithNoteAndAssign: assign.roleID is required (a positive integer) \u2014 the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)", { operation: OP_OPEN });
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 });
11675
11715
  }
11676
11716
  return { companyID, title, priority, status, assignee, roleID };
11677
11717
  }
@@ -11700,7 +11740,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
11700
11740
  if (assign !== void 0) {
11701
11741
  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).`);
11702
11742
  }
11703
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11743
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11704
11744
  {
11705
11745
  operation: OP_OPEN,
11706
11746
  method: "POST",
@@ -11740,8 +11780,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11740
11780
  `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}` : ""}`,
11741
11781
  {
11742
11782
  operation: OP_OPEN,
11743
- httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11744
- vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11783
+ httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11784
+ vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11745
11785
  }
11746
11786
  );
11747
11787
  }
@@ -11756,8 +11796,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11756
11796
  named,
11757
11797
  {
11758
11798
  operation: OP_OPEN,
11759
- httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11760
- vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11799
+ httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11800
+ vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11761
11801
  resourceIds: [companyID],
11762
11802
  details: { idRefs: [{ entity: "company", id: companyID }] }
11763
11803
  }
@@ -11782,10 +11822,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
11782
11822
  try {
11783
11823
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
11784
11824
  if (current === null) {
11785
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
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 }] } });
11786
11826
  }
11787
11827
  ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
11788
- const merged = _chunkIKWHRUQ5cjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11828
+ const merged = _chunkLLIB4JGKcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11789
11829
  merged.id = ticketId;
11790
11830
  await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
11791
11831
  assigned = true;
@@ -11849,7 +11889,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11849
11889
  const ids2 = await readLiveStatusSet(resource);
11850
11890
  if (ids2.size > 0) liveStatus = ids2;
11851
11891
  } catch (err) {
11852
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11892
+ if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11853
11893
  }
11854
11894
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
11855
11895
  _optionalChain([http, 'access', _109 => _109.fieldCache, 'optionalAccess', _110 => _110.invalidate, 'call', _111 => _111("tickets")]);
@@ -11859,7 +11899,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11859
11899
  const freshIds = await readLiveStatusSet(resource);
11860
11900
  if (freshIds.size > 0) freshStatus = freshIds;
11861
11901
  } catch (err) {
11862
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11902
+ if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11863
11903
  freshStatus = null;
11864
11904
  reReadFailed = true;
11865
11905
  }
@@ -11877,7 +11917,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11877
11917
  return { guardDegraded: liveStatus === null };
11878
11918
  }
11879
11919
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
11880
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11920
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11881
11921
  {
11882
11922
  operation: OP_STATUS,
11883
11923
  method: "PUT",
@@ -11931,7 +11971,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11931
11971
  if (mapEntry === void 0) {
11932
11972
  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).`);
11933
11973
  }
11934
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
11974
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
11935
11975
  {
11936
11976
  operation: OP_STATUS,
11937
11977
  method: "PUT",
@@ -11951,7 +11991,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11951
11991
  }
11952
11992
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
11953
11993
  const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _114 => _114.safeDefaults]), () => ( {}));
11954
- const body = _chunkIKWHRUQ5cjs.mergePartialBody.call(void 0, current, mergeData);
11994
+ const body = _chunkLLIB4JGKcjs.mergePartialBody.call(void 0, current, mergeData);
11955
11995
  body.id = ticketId;
11956
11996
  let merges = 0;
11957
11997
  for (; ; ) {
@@ -11975,8 +12015,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11975
12015
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
11976
12016
  {
11977
12017
  operation: OP_STATUS,
11978
- httpStatus: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11979
- vendorError: _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
12018
+ httpStatus: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
12019
+ vendorError: _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11980
12020
  resourceIds: [ticketId],
11981
12021
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
11982
12022
  }
@@ -11989,7 +12029,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11989
12029
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11990
12030
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11991
12031
  if (verify === null) {
11992
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
12032
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11993
12033
  code: "INVALID_RESPONSE",
11994
12034
  category: "server",
11995
12035
  operation: OP_STATUS,
@@ -11999,7 +12039,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11999
12039
  }
12000
12040
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
12001
12041
  if (finalStatus !== targetStatus) {
12002
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
12042
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(
12003
12043
  `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)`,
12004
12044
  {
12005
12045
  code: "INVALID_RESPONSE",
@@ -12014,17 +12054,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
12014
12054
  }
12015
12055
  }
12016
12056
  async function changeStatus(resource, id, targetStatus, fields, opts, http) {
12017
- const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
12057
+ const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
12018
12058
  if (!isPositiveInt(targetStatus)) {
12019
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12059
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12020
12060
  }
12021
12061
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
12022
12062
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
12023
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12063
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12024
12064
  }
12025
12065
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
12026
12066
  if (current === null) {
12027
- throw new (0, _chunkIKWHRUQ5cjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
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 }] } });
12028
12068
  }
12029
12069
  const previousStatus = typeof current.status === "number" ? current.status : null;
12030
12070
  if (previousStatus === targetStatus) {
@@ -12044,7 +12084,7 @@ var DEFAULT_PART_LIMIT = 50;
12044
12084
  function partLimit(value, name) {
12045
12085
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
12046
12086
  if (!Number.isInteger(n) || n < 1) {
12047
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12087
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12048
12088
  }
12049
12089
  return n;
12050
12090
  }
@@ -12057,33 +12097,38 @@ function servedTextRecord(row, textField, limit) {
12057
12097
  return out;
12058
12098
  }
12059
12099
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
12060
- const builder = _chunkIKWHRUQ5cjs.createNamePlan.call(void 0, _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS);
12100
+ const builder = _chunkLLIB4JGKcjs.createNamePlan.call(void 0, _chunkLLIB4JGKcjs.TICKET_LABEL_FIELDS);
12061
12101
  const t = ctx.ticket;
12062
12102
  builder.addResource(t["creatorResourceID"]);
12063
12103
  builder.addFk("contract", t["contractID"]);
12064
12104
  builder.addFk("billingCode", t["billingCodeID"]);
12065
12105
  builder.addFk("role", t["assignedResourceRoleID"]);
12066
- builder.addLineOfBusiness(t["organizationalLevelAssociationID"]);
12106
+ const ticketLobPointer = _chunkLLIB4JGKcjs.vendorId.call(void 0, t["organizationalLevelAssociationID"]);
12107
+ if (ticketLobPointer !== void 0) {
12108
+ builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
12109
+ } else {
12110
+ builder.addLineOfBusinessFromContract(t["contractID"]);
12111
+ }
12067
12112
  for (const e of entriesPart.items) {
12068
12113
  builder.addResource(e["resourceID"]);
12069
12114
  builder.addFk("role", e["roleID"]);
12070
12115
  builder.addFk("billingCode", e["billingCodeID"]);
12071
12116
  builder.addFk("contract", e["contractID"]);
12072
12117
  }
12073
- const names = await _chunkIKWHRUQ5cjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12118
+ const names = await _chunkLLIB4JGKcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12074
12119
  const ticketRow = { ...ctx.ticket };
12075
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12076
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12077
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12078
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12079
- for (const f of _chunkIKWHRUQ5cjs.TICKET_LABEL_FIELDS) _chunkIKWHRUQ5cjs.addLabelSibling.call(void 0, ticketRow, f, names);
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);
12080
12125
  result.ticket = ticketRow;
12081
12126
  result.timeEntries.items = entriesPart.items.map((e) => {
12082
12127
  const row = { ...e };
12083
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12084
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12085
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12086
- _chunkIKWHRUQ5cjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
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));
12087
12132
  return row;
12088
12133
  });
12089
12134
  result.names = names.section;
@@ -12099,7 +12144,7 @@ async function fullContext(resource, id, opts = {}, http) {
12099
12144
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
12100
12145
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
12101
12146
  const textLimit = partLimit(opts.textLimit, "textLimit");
12102
- const ticketId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
12147
+ const ticketId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
12103
12148
  const ctx = await resource.getContext(ticketId);
12104
12149
  const op = "tickets.fullContext";
12105
12150
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -12157,16 +12202,16 @@ async function fullContext(resource, id, opts = {}, http) {
12157
12202
  }
12158
12203
 
12159
12204
  // src/resources/special/tickets/forResource.ts
12160
- var OP4 = "tickets.forResource";
12205
+ var OP5 = "tickets.forResource";
12161
12206
  var TICKET_CHUNK = 100;
12162
12207
  var LIMIT_DEFAULT = 100;
12163
12208
  var LIMIT_MAX = 500;
12164
12209
  var LINK_READ_CAP = 500;
12165
12210
  var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
12166
- function positiveId(value, name) {
12211
+ function positiveId2(value, name) {
12167
12212
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12168
12213
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12169
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
12214
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
12170
12215
  }
12171
12216
  return n;
12172
12217
  }
@@ -12176,28 +12221,28 @@ async function ticketPage(http, filter, maxRecords, fields) {
12176
12221
  idempotent: true,
12177
12222
  path: "/V1.0/Tickets/query",
12178
12223
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
12179
- operation: OP4
12224
+ operation: OP5
12180
12225
  });
12181
- const page = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP4);
12226
+ const page = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP5);
12182
12227
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
12183
12228
  }
12184
12229
  async function forResource(_resource, resourceIDIn, http, opts = {}) {
12185
- if (opts === null || typeof opts !== "object") throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: opts must be an object`, { operation: OP4 });
12186
- const resourceID = positiveId(resourceIDIn, "resourceID");
12230
+ if (opts === null || typeof opts !== "object") throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: opts must be an object`, { operation: OP5 });
12231
+ const resourceID = positiveId2(resourceIDIn, "resourceID");
12187
12232
  const scope = _nullishCoalesce(opts.scope, () => ( "both"));
12188
12233
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
12189
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
12234
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP5 });
12190
12235
  }
12191
12236
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
12192
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
12237
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: openOnly must be a boolean`, { operation: OP5 });
12193
12238
  }
12194
12239
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
12195
12240
  if (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX) {
12196
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
12241
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP5 });
12197
12242
  }
12198
12243
  const includeFields = _nullishCoalesce(opts.includeFields, () => ( []));
12199
12244
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
12200
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
12245
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP5}: includeFields must be a list of field names`, { operation: OP5 });
12201
12246
  }
12202
12247
  const openOnly = opts.openOnly === true;
12203
12248
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS2, ...includeFields])];
@@ -12212,9 +12257,9 @@ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12212
12257
  idempotent: true,
12213
12258
  path: "/V1.0/TicketSecondaryResources/query",
12214
12259
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
12215
- operation: OP4
12260
+ operation: OP5
12216
12261
  });
12217
- const page = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP4);
12262
+ const page = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP5);
12218
12263
  for (const row of page.items) if (typeof row.ticketID === "number" && !linkIds.includes(row.ticketID)) linkIds.push(row.ticketID);
12219
12264
  if (page.items.length >= LINK_READ_CAP || page.pageDetails.nextPageUrl !== null) capped = true;
12220
12265
  }
@@ -12267,35 +12312,67 @@ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12267
12312
  }
12268
12313
 
12269
12314
  // src/resources/special/tickets/lineOfBusiness.ts
12270
- var OP5 = "tickets.lineOfBusiness";
12271
- function positiveId2(value, name) {
12315
+ var OP6 = "tickets.lineOfBusiness";
12316
+ function positiveId3(value, name) {
12272
12317
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
12273
12318
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12274
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
12319
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(OP6 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP6 });
12275
12320
  }
12276
12321
  return n;
12277
12322
  }
12278
- async function lineOfBusiness(resource, ticketIdIn, http, associationIdIn) {
12279
- const ticketId = positiveId2(ticketIdIn, "ticketId");
12323
+ async function lineOfBusiness2(resource, ticketIdIn, http, associationIdIn) {
12324
+ const ticketId = positiveId3(ticketIdIn, "ticketId");
12280
12325
  let associationId;
12326
+ let associationSource = null;
12327
+ let contractId = null;
12328
+ let contractUnread = false;
12281
12329
  if (associationIdIn !== void 0) {
12282
- associationId = positiveId2(associationIdIn, "associationId");
12330
+ associationId = positiveId3(associationIdIn, "associationId");
12331
+ associationSource = "argument";
12283
12332
  } else {
12284
12333
  const ticket = await resource.get(ticketId);
12285
- associationId = _chunkIKWHRUQ5cjs.vendorId.call(void 0, ticket.organizationalLevelAssociationID);
12334
+ associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, ticket.organizationalLevelAssociationID);
12335
+ if (associationId !== void 0) {
12336
+ associationSource = "ticket";
12337
+ } else {
12338
+ const contractRef = _chunkLLIB4JGKcjs.vendorId.call(void 0, ticket.contractID);
12339
+ if (contractRef !== void 0) {
12340
+ const client = http.client;
12341
+ 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
+ }
12344
+ try {
12345
+ const contract = await client.contracts.get(contractRef);
12346
+ contractId = contractRef;
12347
+ associationId = _chunkLLIB4JGKcjs.vendorId.call(void 0, contract.organizationalLevelAssociationID);
12348
+ if (associationId !== void 0) associationSource = "contract";
12349
+ } catch (e) {
12350
+ if (e instanceof _chunkLLIB4JGKcjs.NotFoundError) {
12351
+ contractId = contractRef;
12352
+ } else if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && e.code !== "ABORTED") {
12353
+ contractId = contractRef;
12354
+ contractUnread = true;
12355
+ } else {
12356
+ throw e;
12357
+ }
12358
+ }
12359
+ }
12360
+ }
12286
12361
  }
12287
12362
  if (associationId === void 0) {
12288
12363
  return {
12289
12364
  ticketId,
12365
+ associationSource,
12366
+ contractId,
12290
12367
  association: null,
12291
12368
  organizationalLevel2: null,
12292
12369
  organizationalLevel1: null,
12293
- markers: { association: "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
12370
+ markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
12294
12371
  };
12295
12372
  }
12296
- const chain = await _chunkIKWHRUQ5cjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
12373
+ const chain = await _chunkLLIB4JGKcjs.resolveLineOfBusinessChain.call(void 0, http, associationId, { budget: 3, operation: OP6, onError: "propagate" });
12297
12374
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
12298
- return { ticketId, association, organizationalLevel2, organizationalLevel1, markers };
12375
+ return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
12299
12376
  }
12300
12377
 
12301
12378
  // src/resources/special/tickets/statusSemantics.ts
@@ -12304,7 +12381,7 @@ async function statusSemantics(_resource, opts = {}, http) {
12304
12381
  }
12305
12382
 
12306
12383
  // src/resources/tickets.ts
12307
- var TicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
12384
+ var TicketsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12308
12385
  constructor(http, pageSize) {
12309
12386
  super(http, {
12310
12387
  key: "tickets",
@@ -12418,12 +12495,12 @@ var TicketsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
12418
12495
  }
12419
12496
  /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */
12420
12497
  lineOfBusiness(ticketId, associationId) {
12421
- return lineOfBusiness(this, ticketId, this.http, associationId);
12498
+ return lineOfBusiness2(this, ticketId, this.http, associationId);
12422
12499
  }
12423
12500
  };
12424
12501
 
12425
12502
  // src/resources/ticket_webhooks.ts
12426
- var TicketWebhooksResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
12503
+ var TicketWebhooksResource = class extends _chunkLLIB4JGKcjs.BaseResource {
12427
12504
  constructor(http, pageSize) {
12428
12505
  super(http, {
12429
12506
  key: "ticket_webhooks",
@@ -12509,7 +12586,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
12509
12586
  body: { MaxRecords: limit, filter },
12510
12587
  operation
12511
12588
  });
12512
- const { items, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res);
12589
+ const { items, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res);
12513
12590
  return { items, hasMore: pageDetails.nextPageUrl != null };
12514
12591
  }
12515
12592
  async function windowQuery3(_resource, kind, http, opts) {
@@ -12528,7 +12605,7 @@ async function customRange3(_resource, from, to, http, opts) {
12528
12605
  const fromB = customRangeDay(from, "from", void 0, "customRange");
12529
12606
  const toB = customRangeDay(to, "to", void 0, "customRange");
12530
12607
  if (fromB.ms > toB.ms) {
12531
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("customRange: from must not be after to");
12608
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("customRange: from must not be after to");
12532
12609
  }
12533
12610
  const toEndMs = toB.ms + DAY_MS2 - 1;
12534
12611
  const filter = [
@@ -12548,12 +12625,12 @@ async function postedDateStatusQuery(_resource, mode, http, opts) {
12548
12625
  return items;
12549
12626
  }
12550
12627
  async function postedWithin(_resource, from, to, http, opts, opLabel = "time_entries.postedWithin") {
12551
- const OP10 = opLabel;
12552
- if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP10);
12553
- const fromB = customRangeDay(from, "from", void 0, OP10);
12554
- const toB = customRangeDay(to, "to", void 0, OP10);
12628
+ const OP11 = opLabel;
12629
+ if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP11);
12630
+ const fromB = customRangeDay(from, "from", void 0, OP11);
12631
+ const toB = customRangeDay(to, "to", void 0, OP11);
12555
12632
  if (fromB.ms > toB.ms) {
12556
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP10}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP10 });
12633
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP11}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP11 });
12557
12634
  }
12558
12635
  const windowToMs = toB.ms + DAY_MS2 - 1;
12559
12636
  const filter = [
@@ -12564,7 +12641,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
12564
12641
  else if (_optionalChain([opts, 'optionalAccess', _125 => _125.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
12565
12642
  if (_optionalChain([opts, 'optionalAccess', _126 => _126.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12566
12643
  if (_optionalChain([opts, 'optionalAccess', _127 => _127.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
12567
- const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP10, http);
12644
+ const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP11, http);
12568
12645
  let postedCount = 0;
12569
12646
  for (const item of items) {
12570
12647
  const postedDate = item.postedDate;
@@ -12587,13 +12664,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
12587
12664
  }
12588
12665
 
12589
12666
  // src/resources/special/time_entries/errors.ts
12590
- var ResourceInvalidError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12667
+ var ResourceInvalidError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12591
12668
  constructor(message, options = {}) {
12592
12669
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
12593
12670
  this.name = "ResourceInvalidError";
12594
12671
  }
12595
12672
  };
12596
- var AllocationCodeError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12673
+ var AllocationCodeError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12597
12674
  /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
12598
12675
 
12599
12676
  constructor(kind, message, options = {}) {
@@ -12602,7 +12679,7 @@ var AllocationCodeError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12602
12679
  this.kind = kind;
12603
12680
  }
12604
12681
  };
12605
- var NoApplicableAllocationCodeError = class extends _chunkIKWHRUQ5cjs.AutotaskError {
12682
+ var NoApplicableAllocationCodeError = class extends _chunkLLIB4JGKcjs.AutotaskError {
12606
12683
  /** The structured blocker details (filters tried + department sets). */
12607
12684
 
12608
12685
  constructor(details, options = {}) {
@@ -12667,7 +12744,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12667
12744
  let pages = 0;
12668
12745
  for (; ; ) {
12669
12746
  if (pages >= PAGE_GUARD) {
12670
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12747
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12671
12748
  code: "RESOLUTION_TRUNCATED",
12672
12749
  category: "resolution",
12673
12750
  operation,
@@ -12678,11 +12755,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12678
12755
  const res = await http.request({
12679
12756
  method: "POST",
12680
12757
  idempotent: true,
12681
- path: isFirst ? path : _chunkIKWHRUQ5cjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12758
+ path: isFirst ? path : _chunkLLIB4JGKcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12682
12759
  body: { MaxRecords: pageSize, filter },
12683
12760
  operation
12684
12761
  });
12685
- const { items: pageItems, pageDetails } = _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, operation);
12762
+ const { items: pageItems, pageDetails } = _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, operation);
12686
12763
  items.push(...pageItems);
12687
12764
  pages += 1;
12688
12765
  if (items.length >= totalCap) break;
@@ -12774,7 +12851,7 @@ async function resolveCode(http, family, familyLabel2, pinnedId, departments, op
12774
12851
  }
12775
12852
 
12776
12853
  // src/resources/special/time_entries/createForResource.ts
12777
- var OP6 = "time_entries.createForResource";
12854
+ var OP7 = "time_entries.createForResource";
12778
12855
  var PARAM_KEYS = /* @__PURE__ */ new Set([
12779
12856
  "internallAllocationCodeID",
12780
12857
  "ticketID",
@@ -12799,7 +12876,7 @@ function windowDefaults(params) {
12799
12876
  var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
12800
12877
  var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
12801
12878
  function validateCreateParams(params) {
12802
- const pin = (value, label) => typeof value === "number" ? _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, value, label) : void 0;
12879
+ const pin = (value, label) => typeof value === "number" ? _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, value, label) : void 0;
12803
12880
  const pins = {
12804
12881
  code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
12805
12882
  ticket: pin(params.ticketID, "ticketID"),
@@ -12808,32 +12885,32 @@ function validateCreateParams(params) {
12808
12885
  };
12809
12886
  const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
12810
12887
  if (pinCount > 1) {
12811
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12888
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12812
12889
  "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)",
12813
- { operation: OP6 }
12890
+ { operation: OP7 }
12814
12891
  );
12815
12892
  }
12816
12893
  if (pins.role !== void 0 && pins.code !== void 0) {
12817
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12894
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12818
12895
  "createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
12819
- { operation: OP6 }
12896
+ { operation: OP7 }
12820
12897
  );
12821
12898
  }
12822
12899
  if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
12823
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
12900
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
12824
12901
  `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
12825
- { operation: OP6 }
12902
+ { operation: OP7 }
12826
12903
  );
12827
12904
  }
12828
12905
  return pins;
12829
12906
  }
12830
12907
  async function assertResourceActive(http, rid) {
12831
- const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP6);
12908
+ const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP7);
12832
12909
  if (rec === null) {
12833
12910
  throw new ResourceInvalidError(`Resource ${rid} was not found \u2014 a time entry cannot attach to a missing resource`, {
12834
12911
  resourceIds: [rid],
12835
12912
  details: { idRefs: [{ entity: "resource", id: rid }] },
12836
- operation: OP6,
12913
+ operation: OP7,
12837
12914
  category: "not_found",
12838
12915
  suggestedAction: "Resolve the resource id (resources.get / resources.search) and retry."
12839
12916
  });
@@ -12842,7 +12919,7 @@ async function assertResourceActive(http, rid) {
12842
12919
  throw new ResourceInvalidError(`Resource ${rid} is not active (isActive !== true) \u2014 the vendor would reject a time entry for an inactive resource`, {
12843
12920
  resourceIds: [rid],
12844
12921
  details: { idRefs: [{ entity: "resource", id: rid }] },
12845
- operation: OP6,
12922
+ operation: OP7,
12846
12923
  suggestedAction: "Activate the resource or pick an active one."
12847
12924
  });
12848
12925
  }
@@ -12852,11 +12929,11 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12852
12929
  const pinnedForCode = pins.code !== void 0 ? pins.code : pins.role;
12853
12930
  let code = null;
12854
12931
  const familiesTried = [];
12855
- code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP6);
12932
+ code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP7);
12856
12933
  familiesTried.push({ family: familyOf(linkage), label: familyLabel(familyOf(linkage)), filters: [{ field: "useType", op: "eq", value: familyOf(linkage) }, { field: "isActive", op: "eq", value: true }] });
12857
12934
  if (code === null && linkage === "task" && pins.role === void 0) {
12858
12935
  usedLinkage = "internal";
12859
- code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP6);
12936
+ code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP7);
12860
12937
  familiesTried.push({ family: USE_TYPE_INTERNAL, label: familyLabel(USE_TYPE_INTERNAL), filters: [{ field: "useType", op: "eq", value: USE_TYPE_INTERNAL }, { field: "isActive", op: "eq", value: true }] });
12861
12938
  }
12862
12939
  if (code === null) {
@@ -12866,7 +12943,7 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12866
12943
  families: familiesTried,
12867
12944
  resourceDepartments: [...departments].sort((a, b) => a - b)
12868
12945
  },
12869
- { operation: OP6 }
12946
+ { operation: OP7 }
12870
12947
  );
12871
12948
  }
12872
12949
  const resolvedCode = codeInfo(code);
@@ -12903,9 +12980,9 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
12903
12980
  if (usedLinkage === "internal" && linkage === "task") {
12904
12981
  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).");
12905
12982
  }
12906
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
12983
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
12907
12984
  {
12908
- operation: OP6,
12985
+ operation: OP7,
12909
12986
  method: "POST",
12910
12987
  path: "/V1.0/TimeEntries",
12911
12988
  ids: [rid],
@@ -12943,11 +13020,11 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12943
13020
  };
12944
13021
  } catch (err) {
12945
13022
  lastError = err;
12946
- const text = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkIKWHRUQ5cjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
13023
+ const text = _chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkLLIB4JGKcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12947
13024
  const gate3 = ROLE_REJECTION_PATTERN.test(text);
12948
13025
  if (usedLinkage !== "internal" && gate3) {
12949
13026
  if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
12950
- const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP6);
13027
+ const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP7);
12951
13028
  taskRoleFetched = true;
12952
13029
  if (task !== null) pushLadder(task.assignedResourceRoleID);
12953
13030
  }
@@ -12963,17 +13040,17 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12963
13040
  throw err;
12964
13041
  }
12965
13042
  }
12966
- if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, lastError)) {
13043
+ if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, lastError)) {
12967
13044
  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.`;
12968
13045
  }
12969
13046
  throw lastError;
12970
13047
  }
12971
13048
  async function createForResource(resource, resourceID, params, opts = {}, http) {
12972
- const rid = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, resourceID, "resourceID");
13049
+ const rid = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12973
13050
  const pins = validateCreateParams(params);
12974
13051
  await assertResourceActive(http, rid);
12975
13052
  const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
12976
- const roleRows = await resourceRoleRows(http, rid, OP6);
13053
+ const roleRows = await resourceRoleRows(http, rid, OP7);
12977
13054
  const departments = roleRows.departments;
12978
13055
  const { usedLinkage, resolvedCode } = await resolveAllocationCode(http, rid, linkage, pins, departments);
12979
13056
  const defaults = windowDefaults(params);
@@ -12982,8 +13059,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
12982
13059
  return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
12983
13060
  }
12984
13061
  function discoveryField(err, body, defaults) {
12985
- if (!_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12986
- const entries = _chunkIKWHRUQ5cjs.parseVendorErrors.call(void 0, err.vendorError);
13062
+ if (!_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
13063
+ const entries = _chunkLLIB4JGKcjs.parseVendorErrors.call(void 0, err.vendorError);
12987
13064
  if (entries === void 0) return null;
12988
13065
  for (const entry of entries) {
12989
13066
  const field = entry.field;
@@ -12996,42 +13073,42 @@ function discoveryField(err, body, defaults) {
12996
13073
  }
12997
13074
 
12998
13075
  // src/resources/special/time_entries/move.ts
12999
- var OP7 = "time_entries.moveToTicket";
13076
+ var OP8 = "time_entries.moveToTicket";
13000
13077
  var COPY2 = ["resourceID", "roleID", "billingCodeID", "dateWorked", "startDateTime", "endDateTime", "hoursWorked", "offsetHours", "summaryNotes", "internalNotes", "isNonBillable", "showOnInvoice"];
13001
13078
  var CONTRACT_SCOPED2 = ["contractID", "contractServiceID", "contractServiceBundleID"];
13002
13079
  async function readTimeEntry(http, id, retries) {
13003
13080
  try {
13004
- const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP7, maxRetries: retries });
13081
+ const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP8, maxRetries: retries });
13005
13082
  return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _129 => _129.item]), () => ( null));
13006
13083
  } catch (e) {
13007
- if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
13084
+ if (_chunkLLIB4JGKcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
13008
13085
  throw e;
13009
13086
  }
13010
13087
  }
13011
13088
  async function checkSource2({ http, source, sourceId, toTicketId, retries }) {
13012
13089
  const ids2 = { sourceId, toTicketId };
13013
13090
  if (source.taskID !== null && source.taskID !== void 0) {
13014
- throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP7}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP7);
13091
+ throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP8}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP8);
13015
13092
  }
13016
13093
  if (source.billingApprovalDateTime || source.billingApprovalResourceID || source.billingApprovalLevelMostRecent) {
13017
- throw refuse("MOVE_BLOCKED_APPROVED", `${OP7}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
13094
+ throw refuse("MOVE_BLOCKED_APPROVED", `${OP8}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP8, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
13018
13095
  }
13019
13096
  let billing;
13020
13097
  try {
13021
- billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP7, retries);
13098
+ billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP8, retries);
13022
13099
  } catch (e3) {
13023
- throw refuse("MOVE_BLOCKED_BILLED", `${OP7}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
13100
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP8}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP8, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
13024
13101
  }
13025
13102
  if (billing.some((b) => b.invoiceID || b.postedDate)) {
13026
- throw refuse("MOVE_BLOCKED_BILLED", `${OP7}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
13103
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP8}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP8, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
13027
13104
  }
13028
- const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP7, retries);
13105
+ const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP8, retries);
13029
13106
  if (attachments.length > 0) {
13030
- throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP7}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP7, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
13107
+ throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP8}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP8, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
13031
13108
  }
13032
13109
  }
13033
13110
  var SPEC2 = {
13034
- operation: OP7,
13111
+ operation: OP8,
13035
13112
  entity: "time_entry",
13036
13113
  readSource: readTimeEntry,
13037
13114
  sourceTicketId: (s) => typeof s.ticketID === "number" ? s.ticketID : null,
@@ -13066,15 +13143,15 @@ function moveToTicket2(_resource, sourceId, toTicketId, opts, http) {
13066
13143
  }
13067
13144
 
13068
13145
  // src/resources/special/time_entries/approve.ts
13069
- var OP8 = "time_entries.approve";
13146
+ var OP9 = "time_entries.approve";
13070
13147
  var APPROVAL_LEVELS_PATH = "/V1.0/BillingItemApprovalLevels";
13071
13148
  function toIso(value) {
13072
13149
  if (value instanceof Date) {
13073
- if (Number.isNaN(value.getTime())) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13150
+ if (Number.isNaN(value.getTime())) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13074
13151
  return value.toISOString();
13075
13152
  }
13076
13153
  const parsed = new Date(value);
13077
- if (Number.isNaN(parsed.getTime())) throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13154
+ if (Number.isNaN(parsed.getTime())) throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13078
13155
  return parsed.toISOString();
13079
13156
  }
13080
13157
  function toNumber(value) {
@@ -13087,24 +13164,24 @@ function sameInstant(a, b) {
13087
13164
  return !Number.isNaN(left) && left === right;
13088
13165
  }
13089
13166
  async function approve(resource, id, opts = {}, http) {
13090
- const numericId = toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id"));
13167
+ const numericId = toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id"));
13091
13168
  if (opts.approvalLevel !== void 0 && (!Number.isInteger(opts.approvalLevel) || opts.approvalLevel < 1)) {
13092
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13169
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13093
13170
  }
13094
13171
  const approvalLevel = _nullishCoalesce(opts.approvalLevel, () => ( 1));
13095
13172
  const approvalDateTime = toIso(_nullishCoalesce(opts.approvalDateTime, () => ( /* @__PURE__ */ new Date())));
13096
13173
  const entry = await resource.get(numericId);
13097
- const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13174
+ const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13098
13175
  if (approvalResourceID === void 0) {
13099
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
13176
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(
13100
13177
  `time_entries.approve: time entry ${numericId} carries no resourceID and the caller supplied no approvalResourceID \u2014 the vendor requires an approving resource`
13101
13178
  );
13102
13179
  }
13103
13180
  const body = { timeEntryID: numericId, approvalLevel, approvalResourceID, approvalDateTime };
13104
13181
  if (opts.dryRun === true) {
13105
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0,
13182
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0,
13106
13183
  {
13107
- operation: OP8,
13184
+ operation: OP9,
13108
13185
  method: "POST",
13109
13186
  path: APPROVAL_LEVELS_PATH,
13110
13187
  ids: [numericId],
@@ -13127,10 +13204,10 @@ async function approve(resource, id, opts = {}, http) {
13127
13204
  method: "POST",
13128
13205
  path: APPROVAL_LEVELS_PATH,
13129
13206
  body,
13130
- operation: OP8,
13207
+ operation: OP9,
13131
13208
  maxRetries: opts.maxRetries
13132
13209
  });
13133
- const levelId = toNumber(_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, created, OP8).id, "billingItemApprovalLevelID"));
13210
+ const levelId = toNumber(_chunkLLIB4JGKcjs.parseIdentifier.call(void 0, _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, created, OP9).id, "billingItemApprovalLevelID"));
13134
13211
  await resource.update(
13135
13212
  numericId,
13136
13213
  { billingApprovalDateTime: approvalDateTime, billingApprovalResourceID: approvalResourceID },
@@ -13153,28 +13230,28 @@ async function approve(resource, id, opts = {}, http) {
13153
13230
  }
13154
13231
 
13155
13232
  // src/resources/special/time_entries/recentTickets.ts
13156
- var OP9 = "time_entries.recentTickets";
13233
+ var OP10 = "time_entries.recentTickets";
13157
13234
  var DAY_MS3 = 864e5;
13158
13235
  var TICKET_CHUNK2 = 100;
13159
13236
  var TICKET_FIELDS3 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
13160
- function positiveId3(value, name) {
13237
+ function positiveId4(value, name) {
13161
13238
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
13162
13239
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
13163
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP9 });
13240
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP10 });
13164
13241
  }
13165
13242
  return n;
13166
13243
  }
13167
13244
  async function recentTickets(_resource, from, to, http, opts) {
13168
13245
  if (opts === void 0 || opts === null || typeof opts !== "object") {
13169
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP9 });
13246
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP10 });
13170
13247
  }
13171
- const resourceID = positiveId3(opts.resourceID, "resourceID");
13172
- const companyID = opts.companyID === void 0 ? void 0 : positiveId3(opts.companyID, "companyID");
13173
- if (opts.tz !== void 0) validateZone(opts.tz, OP9);
13174
- const fromB = customRangeDay(from, "from", void 0, OP9);
13175
- const toB = customRangeDay(to, "to", void 0, OP9);
13248
+ const resourceID = positiveId4(opts.resourceID, "resourceID");
13249
+ const companyID = opts.companyID === void 0 ? void 0 : positiveId4(opts.companyID, "companyID");
13250
+ if (opts.tz !== void 0) validateZone(opts.tz, OP10);
13251
+ const fromB = customRangeDay(from, "from", void 0, OP10);
13252
+ const toB = customRangeDay(to, "to", void 0, OP10);
13176
13253
  if (fromB.ms > toB.ms) {
13177
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`${OP9}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP9 });
13254
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)(`${OP10}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP10 });
13178
13255
  }
13179
13256
  const windowToMs = toB.ms + DAY_MS3 - 1;
13180
13257
  const { items: entries, hasMore } = await queryTimeEntries(
@@ -13185,7 +13262,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13185
13262
  { field: "resourceID", op: "eq", value: resourceID }
13186
13263
  ],
13187
13264
  clampWindowLimit(opts.limit),
13188
- OP9,
13265
+ OP10,
13189
13266
  http
13190
13267
  );
13191
13268
  const groups = /* @__PURE__ */ new Map();
@@ -13211,9 +13288,9 @@ async function recentTickets(_resource, from, to, http, opts) {
13211
13288
  idempotent: true,
13212
13289
  path: "/V1.0/Tickets/query",
13213
13290
  body: { MaxRecords: TICKET_CHUNK2, filter, IncludeFields: TICKET_FIELDS3 },
13214
- operation: OP9
13291
+ operation: OP10
13215
13292
  });
13216
- for (const t of _chunkIKWHRUQ5cjs.unwrapItems.call(void 0, res, OP9).items) if (typeof t.id === "number") tickets.set(t.id, t);
13293
+ for (const t of _chunkLLIB4JGKcjs.unwrapItems.call(void 0, res, OP10).items) if (typeof t.id === "number") tickets.set(t.id, t);
13217
13294
  }
13218
13295
  const items = [];
13219
13296
  const unresolvedTicketIDs = [];
@@ -13250,7 +13327,7 @@ async function recentTickets(_resource, from, to, http, opts) {
13250
13327
  }
13251
13328
 
13252
13329
  // src/resources/time_entries.ts
13253
- var TimeEntriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13330
+ var TimeEntriesResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13254
13331
  constructor(http, pageSize) {
13255
13332
  super(http, {
13256
13333
  key: "time_entries",
@@ -13399,7 +13476,7 @@ var TimeEntriesResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13399
13476
  };
13400
13477
 
13401
13478
  // src/resources/time_entry_attachments.ts
13402
- var TimeEntryAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13479
+ var TimeEntryAttachmentsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13403
13480
  constructor(http, pageSize) {
13404
13481
  super(http, {
13405
13482
  key: "time_entry_attachments",
@@ -13462,9 +13539,9 @@ var TimeEntryAttachmentsResource = class extends _chunkIKWHRUQ5cjs.BaseResource
13462
13539
 
13463
13540
  // src/resources/special/time_off_requests.ts
13464
13541
  async function approve2(_resource, id, opts = {}, http) {
13465
- const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
13542
+ const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
13466
13543
  if (opts.dryRun === true) {
13467
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
13544
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
13468
13545
  operation: "time_off_requests.approve",
13469
13546
  method: "GET",
13470
13547
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -13480,16 +13557,16 @@ async function approve2(_resource, id, opts = {}, http) {
13480
13557
  operation: "time_off_requests.approve",
13481
13558
  maxRetries: opts.maxRetries
13482
13559
  });
13483
- return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
13560
+ return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
13484
13561
  }
13485
13562
  async function reject(_resource, id, reason, opts = {}, http) {
13486
- const numericId = _chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, id, "id");
13563
+ const numericId = _chunkLLIB4JGKcjs.parseIdentifier.call(void 0, id, "id");
13487
13564
  const text = reason.trim();
13488
13565
  if (text === "") {
13489
- throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13566
+ throw new (0, _chunkLLIB4JGKcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13490
13567
  }
13491
13568
  if (opts.dryRun === true) {
13492
- return _chunkIKWHRUQ5cjs.buildDryRunResult.call(void 0, {
13569
+ return _chunkLLIB4JGKcjs.buildDryRunResult.call(void 0, {
13493
13570
  operation: "time_off_requests.reject",
13494
13571
  method: "POST",
13495
13572
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -13507,11 +13584,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
13507
13584
  operation: "time_off_requests.reject",
13508
13585
  maxRetries: opts.maxRetries
13509
13586
  });
13510
- return _chunkIKWHRUQ5cjs.unwrapOperation.call(void 0, res);
13587
+ return _chunkLLIB4JGKcjs.unwrapOperation.call(void 0, res);
13511
13588
  }
13512
13589
 
13513
13590
  // src/resources/time_off_requests.ts
13514
- var TimeOffRequestsResource = class extends _chunkIKWHRUQ5cjs.BaseResource {
13591
+ var TimeOffRequestsResource = class extends _chunkLLIB4JGKcjs.BaseResource {
13515
13592
  constructor(http, pageSize) {
13516
13593
  super(http, {
13517
13594
  key: "time_off_requests",