node-autotask 0.24.0 → 0.25.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.
@@ -38,13 +38,13 @@
38
38
 
39
39
 
40
40
 
41
- var _chunkLVBFLSPLcjs = require('./chunk-LVBFLSPL.cjs');
41
+ var _chunk2H7YI54Bcjs = require('./chunk-2H7YI54B.cjs');
42
42
 
43
43
 
44
- var _chunk4VAC2Z55cjs = require('./chunk-4VAC2Z55.cjs');
44
+ var _chunkWBMRACCVcjs = require('./chunk-WBMRACCV.cjs');
45
45
 
46
46
  // src/resources/appointments.ts
47
- var AppointmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
47
+ var AppointmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
48
48
  constructor(http, pageSize) {
49
49
  super(http, {
50
50
  key: "appointments",
@@ -129,7 +129,7 @@ var AuthenticateResource = class {
129
129
  };
130
130
 
131
131
  // src/resources/billing_codes.ts
132
- var BillingCodesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
132
+ var BillingCodesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
133
133
  constructor(http, pageSize) {
134
134
  super(http, {
135
135
  key: "billing_codes",
@@ -179,7 +179,7 @@ var MAX_LIMIT = 500;
179
179
  function clampWindowLimit(limit) {
180
180
  const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
181
181
  if (!Number.isInteger(n) || n < 1) {
182
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
182
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
183
183
  }
184
184
  return Math.min(n, MAX_LIMIT);
185
185
  }
@@ -225,7 +225,7 @@ function wallParts(tz, ms) {
225
225
  }
226
226
  }
227
227
  if (weekday < 0 || [w.y, w.m, w.d, w.h, w.mi, w.s].some((v) => v === void 0 || Number.isNaN(v))) {
228
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
228
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
229
229
  }
230
230
  return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
231
231
  }
@@ -252,7 +252,7 @@ function localDayEndMs(y, m, d, tz) {
252
252
  }
253
253
  function validateZone(tz, opName = "dateWindow") {
254
254
  if (typeof tz !== "string" || tz.length === 0) {
255
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
255
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
256
256
  `${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
257
257
  { operation: opName }
258
258
  );
@@ -260,7 +260,7 @@ function validateZone(tz, opName = "dateWindow") {
260
260
  try {
261
261
  new Intl.DateTimeFormat("en-US", { timeZone: tz });
262
262
  } catch (e2) {
263
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
263
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
264
264
  `${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
265
265
  { operation: opName }
266
266
  );
@@ -420,13 +420,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
420
420
  body: { MaxRecords: limit, filter },
421
421
  operation
422
422
  });
423
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
423
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
424
424
  }
425
425
  var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
426
426
  function customRangeDay(value, label, zone, opName) {
427
427
  const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
428
428
  if (!m) {
429
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
429
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
430
430
  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)})`,
431
431
  { operation: opName }
432
432
  );
@@ -438,7 +438,7 @@ function customRangeDay(value, label, zone, opName) {
438
438
  const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
439
439
  const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
440
440
  if (!Number.isFinite(ms)) {
441
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
441
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
442
442
  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)})`,
443
443
  { operation: opName }
444
444
  );
@@ -449,7 +449,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
449
449
  const fromB = customRangeDay(from, "from", zone, operation);
450
450
  const toB = customRangeDay(to, "to", zone, operation);
451
451
  if (fromB.ms > toB.ms) {
452
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
452
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
453
453
  `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
454
454
  { operation }
455
455
  );
@@ -466,7 +466,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
466
466
  body: { MaxRecords: limit, filter },
467
467
  operation
468
468
  });
469
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
469
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
470
470
  }
471
471
 
472
472
  // src/resources/special/billing_items.ts
@@ -499,7 +499,7 @@ async function customRange(_resource, from, to, http, opts) {
499
499
  }
500
500
 
501
501
  // src/resources/billing_items.ts
502
- var BillingItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
502
+ var BillingItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
503
503
  constructor(http, pageSize) {
504
504
  super(http, {
505
505
  key: "billing_items",
@@ -601,7 +601,7 @@ var BillingItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
601
601
  };
602
602
 
603
603
  // src/resources/change_request_links.ts
604
- var ChangeRequestLinksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
604
+ var ChangeRequestLinksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
605
605
  constructor(http, pageSize) {
606
606
  super(http, {
607
607
  key: "change_request_links",
@@ -655,7 +655,7 @@ var ChangeRequestLinksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
655
655
  };
656
656
 
657
657
  // src/resources/checklist_libraries.ts
658
- var ChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
658
+ var ChecklistLibrariesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
659
659
  constructor(http, pageSize) {
660
660
  super(http, {
661
661
  key: "checklist_libraries",
@@ -729,7 +729,7 @@ var ChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
729
729
  };
730
730
 
731
731
  // src/resources/checklist_library_checklist_items.ts
732
- var ChecklistLibraryChecklistItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
732
+ var ChecklistLibraryChecklistItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
733
733
  constructor(http, pageSize) {
734
734
  super(http, {
735
735
  key: "checklist_library_checklist_items",
@@ -795,7 +795,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkLVBFLSPLcjs.Bas
795
795
  };
796
796
 
797
797
  // src/resources/classification_icons.ts
798
- var ClassificationIconsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
798
+ var ClassificationIconsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
799
799
  constructor(http, pageSize) {
800
800
  super(http, {
801
801
  key: "classification_icons",
@@ -902,7 +902,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
902
902
  body,
903
903
  operation
904
904
  });
905
- const { items, pageDetails } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, operation);
905
+ const { items, pageDetails } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, operation);
906
906
  const capped = items.length >= limit;
907
907
  return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
908
908
  }
@@ -912,7 +912,7 @@ var DEFAULT_LIMIT2 = 25;
912
912
  var MAX_LIMIT2 = 500;
913
913
  function clampLimit(limit) {
914
914
  const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
915
- if (!Number.isInteger(n) || n < 1) throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
915
+ if (!Number.isInteger(n) || n < 1) throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
916
916
  return Math.min(n, MAX_LIMIT2);
917
917
  }
918
918
 
@@ -925,7 +925,7 @@ async function queryCompanies(http, filter, limit) {
925
925
  body: { MaxRecords: limit, filter },
926
926
  operation: "companies.searchByDomain"
927
927
  });
928
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
928
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
929
929
  }
930
930
  async function queryContacts(http, filter, limit) {
931
931
  const res = await http.request({
@@ -935,7 +935,7 @@ async function queryContacts(http, filter, limit) {
935
935
  body: { MaxRecords: limit, filter },
936
936
  operation: "companies.searchByDomain"
937
937
  });
938
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
938
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
939
939
  }
940
940
  async function fetchCompanies(http, ids2, limit) {
941
941
  const out = [];
@@ -950,7 +950,7 @@ async function fetchCompanies(http, ids2, limit) {
950
950
  const item = body && "item" in body ? body.item : null;
951
951
  if (item) out.push(item);
952
952
  } catch (err) {
953
- if (err instanceof _chunkLVBFLSPLcjs.NotFoundError) continue;
953
+ if (err instanceof _chunk2H7YI54Bcjs.NotFoundError) continue;
954
954
  throw err;
955
955
  }
956
956
  }
@@ -958,7 +958,7 @@ async function fetchCompanies(http, ids2, limit) {
958
958
  }
959
959
  async function searchByDomain(_resource, domain, opts = {}, http) {
960
960
  const text = domain.trim();
961
- if (text === "") throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("searchByDomain: empty domain");
961
+ if (text === "") throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("searchByDomain: empty domain");
962
962
  const limit = clampLimit(opts.limit);
963
963
  const filter = [{ field: "webAddress", op: "contains", value: text }];
964
964
  const direct = await queryCompanies(http, filter, limit);
@@ -972,7 +972,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
972
972
  const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
973
973
  const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
974
974
  if (name === "" && email === "" && website === "") {
975
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
975
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
976
976
  }
977
977
  const limit = clampLimit(opts.limit);
978
978
  const found = /* @__PURE__ */ new Map();
@@ -1001,23 +1001,23 @@ async function familyChildPage(http, parentID) {
1001
1001
  path: "/V1.0/Companies/query",
1002
1002
  body: {
1003
1003
  MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
1004
- filter: _chunkLVBFLSPLcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1004
+ filter: _chunk2H7YI54Bcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1005
1005
  },
1006
1006
  operation: "companies.search"
1007
1007
  });
1008
- const { items, pageDetails } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, "companies.search");
1008
+ const { items, pageDetails } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, "companies.search");
1009
1009
  return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
1010
1010
  }
1011
1011
  function assertSearchWithDetailOpts(opts) {
1012
1012
  if (opts === void 0) return;
1013
1013
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
1014
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1014
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1015
1015
  operation: "companies.searchWithDetail"
1016
1016
  });
1017
1017
  }
1018
1018
  for (const key of Object.keys(opts)) {
1019
1019
  if (key !== "limit") {
1020
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
1020
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
1021
1021
  `companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
1022
1022
  { operation: "companies.searchWithDetail" }
1023
1023
  );
@@ -1026,32 +1026,32 @@ function assertSearchWithDetailOpts(opts) {
1026
1026
  }
1027
1027
  async function searchWithFamily(_resource, query, opts = {}, http) {
1028
1028
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1029
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1029
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1030
1030
  }
1031
1031
  for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
1032
1032
  if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
1033
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
1033
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
1034
1034
  `companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
1035
1035
  { operation: "companies.search" }
1036
1036
  );
1037
1037
  }
1038
1038
  }
1039
1039
  if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
1040
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1040
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1041
1041
  operation: "companies.search"
1042
1042
  });
1043
1043
  }
1044
1044
  const text = query.trim();
1045
- if (text === "") throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1046
- const limit = opts.limit === void 0 ? 25 : _chunkLVBFLSPLcjs.clampPageSize.call(void 0, opts.limit);
1045
+ if (text === "") throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1046
+ const limit = opts.limit === void 0 ? 25 : _chunk2H7YI54Bcjs.clampPageSize.call(void 0, opts.limit);
1047
1047
  const res = await http.request({
1048
1048
  method: "POST",
1049
1049
  idempotent: true,
1050
1050
  path: "/V1.0/Companies/query",
1051
- body: { MaxRecords: limit, filter: _chunkLVBFLSPLcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1051
+ body: { MaxRecords: limit, filter: _chunk2H7YI54Bcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1052
1052
  operation: "companies.search"
1053
1053
  });
1054
- const hits = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, "companies.search").items;
1054
+ const hits = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, "companies.search").items;
1055
1055
  if (opts.includeFamily !== true) return hits;
1056
1056
  const rows = [];
1057
1057
  for (const hit of hits) {
@@ -1071,7 +1071,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
1071
1071
  }
1072
1072
 
1073
1073
  // src/resources/special/companies/errors.ts
1074
- var OwnerResourceRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
1074
+ var OwnerResourceRequiredError = class extends _chunk2H7YI54Bcjs.AutotaskError {
1075
1075
  constructor(message, options = {}) {
1076
1076
  super(message, {
1077
1077
  code: "OWNER_RESOURCE_REQUIRED",
@@ -1082,13 +1082,13 @@ var OwnerResourceRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
1082
1082
  this.name = "OwnerResourceRequiredError";
1083
1083
  }
1084
1084
  };
1085
- var CompanyResourceInvalidError = class extends _chunkLVBFLSPLcjs.AutotaskError {
1085
+ var CompanyResourceInvalidError = class extends _chunk2H7YI54Bcjs.AutotaskError {
1086
1086
  constructor(message, options = {}) {
1087
1087
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
1088
1088
  this.name = "CompanyResourceInvalidError";
1089
1089
  }
1090
1090
  };
1091
- var CompanyCreateFailedError = class extends _chunkLVBFLSPLcjs.AutotaskError {
1091
+ var CompanyCreateFailedError = class extends _chunk2H7YI54Bcjs.AutotaskError {
1092
1092
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
1093
1093
 
1094
1094
  constructor(message, vendorFields, options = {}) {
@@ -1107,23 +1107,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
1107
1107
  var SAFE_COMPANY_CREATE_DEFAULTS = {};
1108
1108
  function validateUpsertInput(companyName, params) {
1109
1109
  if (typeof companyName !== "string" || companyName.trim() === "") {
1110
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1110
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1111
1111
  }
1112
1112
  if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
1113
- throw new (0, _chunkLVBFLSPLcjs.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 });
1113
+ throw new (0, _chunk2H7YI54Bcjs.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 });
1114
1114
  }
1115
1115
  const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
1116
1116
  if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
1117
- throw new (0, _chunkLVBFLSPLcjs.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 });
1117
+ throw new (0, _chunk2H7YI54Bcjs.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 });
1118
1118
  }
1119
1119
  const owner = params.ownerResourceID;
1120
1120
  if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
1121
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1121
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1122
1122
  }
1123
1123
  return { companyType, owner };
1124
1124
  }
1125
1125
  function existsDryRun(http, companyName, match) {
1126
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
1126
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
1127
1127
  {
1128
1128
  operation: OP_UPSERT_NAME,
1129
1129
  method: "POST",
@@ -1149,7 +1149,7 @@ function createDryRun(http, body, owner) {
1149
1149
  "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"
1150
1150
  );
1151
1151
  }
1152
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
1152
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
1153
1153
  {
1154
1154
  operation: OP_UPSERT_NAME,
1155
1155
  method: "POST",
@@ -1194,8 +1194,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1194
1194
  sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
1195
1195
  };
1196
1196
  } catch (err) {
1197
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1198
- const named = (_nullishCoalesce(_chunkLVBFLSPLcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1197
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1198
+ const named = (_nullishCoalesce(_chunk2H7YI54Bcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1199
1199
  const seen = /* @__PURE__ */ new Set();
1200
1200
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
1201
1201
  const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
@@ -1209,7 +1209,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1209
1209
  }
1210
1210
  continue;
1211
1211
  }
1212
- const detail = _chunkLVBFLSPLcjs.formatVendorDetail.call(void 0, err.vendorError);
1212
+ const detail = _chunk2H7YI54Bcjs.formatVendorDetail.call(void 0, err.vendorError);
1213
1213
  throw new CompanyCreateFailedError(
1214
1214
  `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}` : ""}`,
1215
1215
  unique,
@@ -1270,30 +1270,30 @@ var LOCATION_LIMIT_MAX = 500;
1270
1270
  function locationLimit(value) {
1271
1271
  if (value === void 0) return PROFILE_PART_LIMIT;
1272
1272
  if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
1273
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1273
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1274
1274
  }
1275
1275
  return value;
1276
1276
  }
1277
1277
  function validateProjection(fields) {
1278
1278
  if (fields === void 0) return {};
1279
1279
  if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
1280
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1280
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1281
1281
  }
1282
1282
  const out = {};
1283
1283
  for (const [part, list] of Object.entries(fields)) {
1284
1284
  if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
1285
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1285
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1286
1286
  }
1287
1287
  if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
1288
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1288
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1289
1289
  }
1290
1290
  const names = [...new Set(list)];
1291
1291
  const entity = PART_ENTITY[part];
1292
- const known = _nullishCoalesce(_chunkLVBFLSPLcjs.MODEL_FIELD_SETS[entity], () => ( []));
1292
+ const known = _nullishCoalesce(_chunk2H7YI54Bcjs.MODEL_FIELD_SETS[entity], () => ( []));
1293
1293
  const unknown = names.filter((n) => !known.includes(n));
1294
1294
  if (unknown.length > 0) {
1295
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
1296
- `fullProfile: fields.${part} has unknown field name(s) ${_chunkLVBFLSPLcjs.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`
1295
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
1296
+ `fullProfile: fields.${part} has unknown field name(s) ${_chunk2H7YI54Bcjs.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`
1297
1297
  );
1298
1298
  }
1299
1299
  out[part] = names;
@@ -1310,7 +1310,7 @@ function project(items, names) {
1310
1310
  function profilePartLimit(value, name) {
1311
1311
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
1312
1312
  if (!Number.isInteger(n) || n < 1) {
1313
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1313
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1314
1314
  }
1315
1315
  return n;
1316
1316
  }
@@ -1322,7 +1322,7 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
1322
1322
  body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
1323
1323
  operation: "companies.fullProfile"
1324
1324
  });
1325
- return project(_chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items, includeFields);
1325
+ return project(_chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items, includeFields);
1326
1326
  }
1327
1327
  async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1328
1328
  const openRows = await (async () => {
@@ -1337,7 +1337,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1337
1337
  },
1338
1338
  operation: "companies.fullProfile"
1339
1339
  });
1340
- return project(_chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items, includeFields);
1340
+ return project(_chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items, includeFields);
1341
1341
  })();
1342
1342
  let openTickets = {
1343
1343
  items: openRows,
@@ -1346,7 +1346,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1346
1346
  note: OPEN_TICKETS_NOTE
1347
1347
  };
1348
1348
  if (openRows.length === 0) {
1349
- const stamp = _chunkLVBFLSPLcjs.blindStampFor.call(void 0, _optionalChain([_chunkLVBFLSPLcjs.BLIND_SURFACE_STAMPS, 'access', _19 => _19["tickets"], 'optionalAccess', _20 => _20.query]), [
1349
+ const stamp = _chunk2H7YI54Bcjs.blindStampFor.call(void 0, _optionalChain([_chunk2H7YI54Bcjs.BLIND_SURFACE_STAMPS, 'access', _19 => _19["tickets"], 'optionalAccess', _20 => _20.query]), [
1350
1350
  { field: "companyID", op: "eq", value: companyID },
1351
1351
  { field: "status", op: "noteq", value: 5 }
1352
1352
  ]);
@@ -1363,7 +1363,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1363
1363
  return openTickets;
1364
1364
  }
1365
1365
  async function addProfileNames(http, company, openTickets, projects, result, opts) {
1366
- const builder = _chunkLVBFLSPLcjs.createNamePlan.call(void 0, _chunkLVBFLSPLcjs.TICKET_LABEL_FIELDS);
1366
+ const builder = _chunk2H7YI54Bcjs.createNamePlan.call(void 0, _chunk2H7YI54Bcjs.TICKET_LABEL_FIELDS);
1367
1367
  const c = company;
1368
1368
  builder.addResource(c["ownerResourceID"]);
1369
1369
  builder.addResource(c["createdByResourceID"]);
@@ -1380,20 +1380,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1380
1380
  builder.addResource(r["creatorResourceID"]);
1381
1381
  builder.addFk("contract", r["contractID"]);
1382
1382
  }
1383
- const names = await _chunkLVBFLSPLcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1383
+ const names = await _chunk2H7YI54Bcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1384
1384
  const companyRow = { ...company };
1385
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1386
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1385
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1386
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1387
1387
  result.company = companyRow;
1388
1388
  result.openTickets = {
1389
1389
  ...openTickets,
1390
1390
  items: openTickets.items.map((row) => {
1391
1391
  const r = { ...row };
1392
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1393
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1394
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1395
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1396
- for (const f of _chunkLVBFLSPLcjs.TICKET_LABEL_FIELDS) _chunkLVBFLSPLcjs.addLabelSibling.call(void 0, r, f, names);
1392
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1393
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1394
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1395
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1396
+ for (const f of _chunk2H7YI54Bcjs.TICKET_LABEL_FIELDS) _chunk2H7YI54Bcjs.addLabelSibling.call(void 0, r, f, names);
1397
1397
  return r;
1398
1398
  })
1399
1399
  };
@@ -1401,9 +1401,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1401
1401
  ...result.projects,
1402
1402
  items: result.projects.items.map((row) => {
1403
1403
  const r = { ...row };
1404
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1405
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1406
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1404
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1405
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1406
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1407
1407
  return r;
1408
1408
  })
1409
1409
  };
@@ -1416,7 +1416,7 @@ async function fullProfile(resource, id, opts = {}, http) {
1416
1416
  const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
1417
1417
  const locLimit = locationLimit(opts.locationLimit);
1418
1418
  const proj = validateProjection(opts.fields);
1419
- const companyID = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
1419
+ const companyID = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
1420
1420
  const company = await resource.get(companyID);
1421
1421
  const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
1422
1422
  const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
@@ -1463,7 +1463,7 @@ var UNBILLED_WORK_OPT_KEYS = [
1463
1463
  var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
1464
1464
  function validateUnbilledWorkOptions(companyId, opts) {
1465
1465
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1466
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
1466
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
1467
1467
  `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
1468
1468
  { operation: "companies.unbilledWork" }
1469
1469
  );
@@ -1492,7 +1492,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1492
1492
  try {
1493
1493
  limit = clampLimit(opts.limit);
1494
1494
  } catch (err) {
1495
- problems.push(err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1495
+ problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1496
1496
  limit = 50;
1497
1497
  }
1498
1498
  if (source === "date_range") {
@@ -1507,9 +1507,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
1507
1507
  problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
1508
1508
  } else {
1509
1509
  try {
1510
- _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1510
+ _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1511
1511
  } catch (err) {
1512
- problems.push(err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1512
+ problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1513
1513
  }
1514
1514
  }
1515
1515
  }
@@ -1519,20 +1519,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
1519
1519
  } else {
1520
1520
  opts.ticketIds.forEach((tid, i) => {
1521
1521
  try {
1522
- _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1522
+ _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1523
1523
  } catch (err) {
1524
- problems.push(err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1524
+ problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1525
1525
  }
1526
1526
  });
1527
1527
  }
1528
1528
  }
1529
1529
  try {
1530
- _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, companyId, "companyId");
1530
+ _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, companyId, "companyId");
1531
1531
  } catch (err) {
1532
- problems.push(err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1532
+ problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1533
1533
  }
1534
1534
  if (problems.length > 0) {
1535
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
1535
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
1536
1536
  `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
1537
1537
  - ` + problems.join("\n- "),
1538
1538
  { operation: "companies.unbilledWork" }
@@ -1561,7 +1561,7 @@ function capJoinSet(ids2, cap) {
1561
1561
  }
1562
1562
  function unbilledWorkPartStatus(key, conditions, items) {
1563
1563
  if (items.length !== 0) return { status: "ok" };
1564
- const stamp = _chunkLVBFLSPLcjs.blindStampFor.call(void 0, _optionalChain([_chunkLVBFLSPLcjs.BLIND_SURFACE_STAMPS, 'access', _21 => _21[key], 'optionalAccess', _22 => _22.query]), conditions);
1564
+ const stamp = _chunk2H7YI54Bcjs.blindStampFor.call(void 0, _optionalChain([_chunk2H7YI54Bcjs.BLIND_SURFACE_STAMPS, 'access', _21 => _21[key], 'optionalAccess', _22 => _22.query]), conditions);
1565
1565
  if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
1566
1566
  return {
1567
1567
  status: "ok",
@@ -1581,7 +1581,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
1581
1581
  parentStatus = "ok";
1582
1582
  companyIds.push(num(parent.id));
1583
1583
  } catch (err) {
1584
- if (err instanceof _chunkLVBFLSPLcjs.NotFoundError) parent = null;
1584
+ if (err instanceof _chunk2H7YI54Bcjs.NotFoundError) parent = null;
1585
1585
  else throw err;
1586
1586
  }
1587
1587
  }
@@ -1619,14 +1619,14 @@ async function readBillingPart(http, v, companyIds) {
1619
1619
  if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
1620
1620
  if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
1621
1621
  }
1622
- const billingFields = _chunkLVBFLSPLcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1622
+ const billingFields = _chunk2H7YI54Bcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1623
1623
  const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
1624
1624
  const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP, billingIncludeFields);
1625
1625
  let billingItems = billingRaw.items;
1626
1626
  let billingNoteCharsTruncated = 0;
1627
1627
  if (v.includeNotes) {
1628
- const noteFields = (_nullishCoalesce(_chunkLVBFLSPLcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1629
- [billingItems, billingNoteCharsTruncated] = _chunkLVBFLSPLcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1628
+ const noteFields = (_nullishCoalesce(_chunk2H7YI54Bcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1629
+ [billingItems, billingNoteCharsTruncated] = _chunk2H7YI54Bcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1630
1630
  }
1631
1631
  const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
1632
1632
  const billingItemsPart = {
@@ -1670,7 +1670,7 @@ async function readTimePart(http, v, join) {
1670
1670
  let cappedItems = entries;
1671
1671
  let noteCharsTruncated = 0;
1672
1672
  if (v.includeNotes) {
1673
- [cappedItems, noteCharsTruncated] = _chunkLVBFLSPLcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1673
+ [cappedItems, noteCharsTruncated] = _chunk2H7YI54Bcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1674
1674
  }
1675
1675
  const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
1676
1676
  timePart = {
@@ -1758,7 +1758,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
1758
1758
  }
1759
1759
  async function unbilledWork(resource, companyId, opts = {}, http) {
1760
1760
  const v = validateUnbilledWorkOptions(companyId, opts);
1761
- const id = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, companyId, "companyId");
1761
+ const id = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, companyId, "companyId");
1762
1762
  const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
1763
1763
  const join = await readJoinSets(http, companyIds, v);
1764
1764
  const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
@@ -1785,7 +1785,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
1785
1785
  }
1786
1786
 
1787
1787
  // src/resources/companies.ts
1788
- var CompaniesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
1788
+ var CompaniesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
1789
1789
  constructor(http, pageSize) {
1790
1790
  super(http, {
1791
1791
  key: "companies",
@@ -1892,7 +1892,7 @@ var CompaniesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
1892
1892
  };
1893
1893
 
1894
1894
  // src/resources/company_alerts.ts
1895
- var CompanyAlertsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
1895
+ var CompanyAlertsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
1896
1896
  constructor(http, pageSize) {
1897
1897
  super(http, {
1898
1898
  key: "company_alerts",
@@ -1958,7 +1958,7 @@ var CompanyAlertsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
1958
1958
  };
1959
1959
 
1960
1960
  // src/resources/company_locations.ts
1961
- var CompanyLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
1961
+ var CompanyLocationsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
1962
1962
  constructor(http, pageSize) {
1963
1963
  super(http, {
1964
1964
  key: "company_locations",
@@ -2029,7 +2029,7 @@ var CompanyLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2029
2029
  };
2030
2030
 
2031
2031
  // src/resources/company_notes.ts
2032
- var CompanyNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2032
+ var CompanyNotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2033
2033
  constructor(http, pageSize) {
2034
2034
  super(http, {
2035
2035
  key: "company_notes",
@@ -2094,7 +2094,7 @@ var CompanyNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2094
2094
  };
2095
2095
 
2096
2096
  // src/resources/company_site_configurations.ts
2097
- var CompanySiteConfigurationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2097
+ var CompanySiteConfigurationsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2098
2098
  constructor(http, pageSize) {
2099
2099
  super(http, {
2100
2100
  key: "company_site_configurations",
@@ -2145,7 +2145,7 @@ var CompanySiteConfigurationsResource = class extends _chunkLVBFLSPLcjs.BaseReso
2145
2145
  };
2146
2146
 
2147
2147
  // src/resources/company_webhooks.ts
2148
- var CompanyWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2148
+ var CompanyWebhooksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2149
2149
  constructor(http, pageSize) {
2150
2150
  super(http, {
2151
2151
  key: "company_webhooks",
@@ -2221,7 +2221,7 @@ var CompanyWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2221
2221
  };
2222
2222
 
2223
2223
  // src/resources/configuration_item_billing_product_associations.ts
2224
- var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2224
+ var ConfigurationItemBillingProductAssociationsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2225
2225
  constructor(http, pageSize) {
2226
2226
  super(http, {
2227
2227
  key: "configuration_item_billing_product_associations",
@@ -2287,7 +2287,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkLV
2287
2287
  };
2288
2288
 
2289
2289
  // src/resources/configuration_item_categories.ts
2290
- var ConfigurationItemCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2290
+ var ConfigurationItemCategoriesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2291
2291
  constructor(http, pageSize) {
2292
2292
  super(http, {
2293
2293
  key: "configuration_item_categories",
@@ -2354,7 +2354,7 @@ var ConfigurationItemCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseRe
2354
2354
  };
2355
2355
 
2356
2356
  // src/resources/configuration_item_category_udf_associations.ts
2357
- var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2357
+ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2358
2358
  constructor(http, pageSize) {
2359
2359
  super(http, {
2360
2360
  key: "configuration_item_category_udf_associations",
@@ -2420,7 +2420,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkLVBFL
2420
2420
  };
2421
2421
 
2422
2422
  // src/resources/configuration_item_dns_records.ts
2423
- var ConfigurationItemDnsRecordsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2423
+ var ConfigurationItemDnsRecordsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2424
2424
  constructor(http, pageSize) {
2425
2425
  super(http, {
2426
2426
  key: "configuration_item_dns_records",
@@ -2469,7 +2469,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkLVBFLSPLcjs.BaseRe
2469
2469
  };
2470
2470
 
2471
2471
  // src/resources/configuration_item_notes.ts
2472
- var ConfigurationItemNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2472
+ var ConfigurationItemNotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2473
2473
  constructor(http, pageSize) {
2474
2474
  super(http, {
2475
2475
  key: "configuration_item_notes",
@@ -2528,7 +2528,7 @@ var ConfigurationItemNotesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
2528
2528
  };
2529
2529
 
2530
2530
  // src/resources/configuration_item_related_items.ts
2531
- var ConfigurationItemRelatedItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2531
+ var ConfigurationItemRelatedItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2532
2532
  constructor(http, pageSize) {
2533
2533
  super(http, {
2534
2534
  key: "configuration_item_related_items",
@@ -2589,16 +2589,16 @@ async function fetchRecord(http, path, label, readOpts) {
2589
2589
  const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _27 => _27.maxRetries]) });
2590
2590
  const body = res;
2591
2591
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
2592
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2592
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2593
2593
  }
2594
2594
  return body.item;
2595
2595
  }
2596
2596
  async function moveConfigurationItem(_resource, sourceId, opts, http) {
2597
- const numericSource = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2597
+ const numericSource = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2598
2598
  if (_optionalChain([opts, 'optionalAccess', _28 => _28.destinationCompanyId]) === void 0) {
2599
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2599
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2600
2600
  }
2601
- const destId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2601
+ const destId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2602
2602
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
2603
2603
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
2604
2604
  const body = { ...source };
@@ -2608,20 +2608,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2608
2608
  body.companyID = destId;
2609
2609
  body.isActive = true;
2610
2610
  if (opts.newReferenceTitle !== void 0) {
2611
- if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2611
+ if (opts.newReferenceTitle.trim() === "") throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2612
2612
  body.referenceTitle = opts.newReferenceTitle.trim();
2613
2613
  }
2614
2614
  if (opts.lastModifiedDate !== void 0) {
2615
2615
  const current = source.lastModifiedDate;
2616
2616
  if (current !== opts.lastModifiedDate) {
2617
- throw new (0, _chunkLVBFLSPLcjs.StaleObjectError)(
2617
+ throw new (0, _chunk2H7YI54Bcjs.StaleObjectError)(
2618
2618
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
2619
2619
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
2620
2620
  );
2621
2621
  }
2622
2622
  }
2623
2623
  if (opts.dryRun === true) {
2624
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
2624
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
2625
2625
  operation: "configuration_items.moveConfigurationItem",
2626
2626
  method: "POST",
2627
2627
  path: "/V1.0/ConfigurationItems",
@@ -2646,7 +2646,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2646
2646
  const createdBody = created;
2647
2647
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
2648
2648
  if (typeof newId !== "number") {
2649
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2649
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2650
2650
  }
2651
2651
  let sourceDeactivated = false;
2652
2652
  if (opts.deactivateSource !== false) {
@@ -2665,7 +2665,7 @@ var PROFILE_PART_LIMIT2 = 50;
2665
2665
  function profilePartLimit2(value, name) {
2666
2666
  const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
2667
2667
  if (!Number.isInteger(n) || n < 1) {
2668
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2668
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2669
2669
  }
2670
2670
  return n;
2671
2671
  }
@@ -2681,14 +2681,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
2681
2681
  });
2682
2682
  const body = res;
2683
2683
  if (body === null || !("item" in body)) {
2684
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2684
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2685
2685
  }
2686
2686
  if (body.item === null || body.item === void 0) {
2687
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2687
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2688
2688
  }
2689
2689
  return body.item;
2690
2690
  } catch (err) {
2691
- if (err instanceof _chunkLVBFLSPLcjs.NotFoundError) return null;
2691
+ if (err instanceof _chunk2H7YI54Bcjs.NotFoundError) return null;
2692
2692
  throw err;
2693
2693
  }
2694
2694
  }
@@ -2700,7 +2700,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
2700
2700
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
2701
2701
  operation: "configuration_items.profile"
2702
2702
  });
2703
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
2703
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
2704
2704
  }
2705
2705
  async function profile(resource, id, opts = {}, http) {
2706
2706
  const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
@@ -2712,7 +2712,7 @@ async function profile(resource, id, opts = {}, http) {
2712
2712
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
2713
2713
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
2714
2714
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
2715
- const wallQuirk = _optionalChain([_chunkLVBFLSPLcjs.RELATIONSHIP_MAP, 'access', _29 => _29["configuration_items"], 'optionalAccess', _30 => _30.zoneFacts, 'optionalAccess', _31 => _31.quirks, 'optionalAccess', _32 => _32.find, 'call', _33 => _33((q) => q.startsWith("product wall"))]);
2715
+ const wallQuirk = _optionalChain([_chunk2H7YI54Bcjs.RELATIONSHIP_MAP, 'access', _29 => _29["configuration_items"], 'optionalAccess', _30 => _30.zoneFacts, 'optionalAccess', _31 => _31.quirks, 'optionalAccess', _32 => _32.find, 'call', _33 => _33((q) => q.startsWith("product wall"))]);
2716
2716
  const productAssociations = {
2717
2717
  items: associations,
2718
2718
  capped: associations.length >= PROFILE_PART_LIMIT2,
@@ -2736,11 +2736,11 @@ async function profile(resource, id, opts = {}, http) {
2736
2736
  }
2737
2737
  };
2738
2738
  if (opts.names === true) {
2739
- const builder = _chunkLVBFLSPLcjs.createNamePlan.call(void 0, );
2739
+ const builder = _chunk2H7YI54Bcjs.createNamePlan.call(void 0, );
2740
2740
  builder.addFk("contract", root["contractID"]);
2741
- const names = await _chunkLVBFLSPLcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2741
+ const names = await _chunk2H7YI54Bcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2742
2742
  const ciRow = { ...ci };
2743
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2743
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2744
2744
  result.ci = ciRow;
2745
2745
  result.names = names.section;
2746
2746
  }
@@ -2748,7 +2748,7 @@ async function profile(resource, id, opts = {}, http) {
2748
2748
  }
2749
2749
 
2750
2750
  // src/resources/configuration_items.ts
2751
- var ConfigurationItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2751
+ var ConfigurationItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2752
2752
  constructor(http, pageSize) {
2753
2753
  super(http, {
2754
2754
  key: "configuration_items",
@@ -2837,7 +2837,7 @@ var ConfigurationItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2837
2837
  };
2838
2838
 
2839
2839
  // src/resources/configuration_item_ssl_subject_alternative_names.ts
2840
- var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2840
+ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2841
2841
  constructor(http, pageSize) {
2842
2842
  super(http, {
2843
2843
  key: "configuration_item_ssl_subject_alternative_names",
@@ -2900,7 +2900,7 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkLV
2900
2900
  };
2901
2901
 
2902
2902
  // src/resources/configuration_item_types.ts
2903
- var ConfigurationItemTypesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2903
+ var ConfigurationItemTypesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2904
2904
  constructor(http, pageSize) {
2905
2905
  super(http, {
2906
2906
  key: "configuration_item_types",
@@ -2974,7 +2974,7 @@ var ConfigurationItemTypesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
2974
2974
  };
2975
2975
 
2976
2976
  // src/resources/configuration_item_webhooks.ts
2977
- var ConfigurationItemWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
2977
+ var ConfigurationItemWebhooksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
2978
2978
  constructor(http, pageSize) {
2979
2979
  super(http, {
2980
2980
  key: "configuration_item_webhooks",
@@ -3050,7 +3050,7 @@ var ConfigurationItemWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseReso
3050
3050
  };
3051
3051
 
3052
3052
  // src/resources/contact_group_contacts.ts
3053
- var ContactGroupContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3053
+ var ContactGroupContactsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3054
3054
  constructor(http, pageSize) {
3055
3055
  super(http, {
3056
3056
  key: "contact_group_contacts",
@@ -3104,7 +3104,7 @@ var ContactGroupContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource
3104
3104
  };
3105
3105
 
3106
3106
  // src/resources/contact_groups.ts
3107
- var ContactGroupsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3107
+ var ContactGroupsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3108
3108
  constructor(http, pageSize) {
3109
3109
  super(http, {
3110
3110
  key: "contact_groups",
@@ -3182,22 +3182,22 @@ async function fetchRecord2(http, path, label, readOpts) {
3182
3182
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _39 => _39.maxRetries]) });
3183
3183
  const body = res;
3184
3184
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
3185
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3185
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3186
3186
  }
3187
3187
  return body.item;
3188
3188
  }
3189
3189
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
3190
- const sourceId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3191
- const destId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3190
+ const sourceId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3191
+ const destId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3192
3192
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
3193
3193
  const companyID = source.companyID;
3194
3194
  if (typeof companyID !== "number" || companyID < 0) {
3195
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3195
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3196
3196
  }
3197
3197
  if (opts.lastModifiedDate !== void 0) {
3198
3198
  const current = source.lastModifiedDate;
3199
3199
  if (current !== opts.lastModifiedDate) {
3200
- throw new (0, _chunkLVBFLSPLcjs.StaleObjectError)(
3200
+ throw new (0, _chunk2H7YI54Bcjs.StaleObjectError)(
3201
3201
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
3202
3202
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3203
3203
  );
@@ -3219,10 +3219,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3219
3219
  },
3220
3220
  operation: "contacts.moveToCompany"
3221
3221
  });
3222
- const items = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
3222
+ const items = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
3223
3223
  const clash = items.find((c) => String(c.id) !== String(sourceId));
3224
3224
  if (clash !== void 0) {
3225
- throw new (0, _chunkLVBFLSPLcjs.ConflictError)(
3225
+ throw new (0, _chunk2H7YI54Bcjs.ConflictError)(
3226
3226
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
3227
3227
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3228
3228
  );
@@ -3236,7 +3236,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3236
3236
  if (opts.dryRun === true) {
3237
3237
  const warnings = [];
3238
3238
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
3239
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
3239
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
3240
3240
  operation: "contacts.moveToCompany",
3241
3241
  method: "POST",
3242
3242
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -3262,7 +3262,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3262
3262
  const createdBody = created;
3263
3263
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
3264
3264
  if (typeof newId !== "number") {
3265
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3265
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3266
3266
  }
3267
3267
  let sourceDeleted = false;
3268
3268
  if (opts.deleteSource === true) {
@@ -3281,7 +3281,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
3281
3281
  var EMAIL_SHAPE = /^.+@.+/;
3282
3282
  var SAFE_CONTACT_CREATE_DEFAULTS = {};
3283
3283
  var DEDUP_LIMIT = 10;
3284
- var CompanyNotFoundError = class extends _chunkLVBFLSPLcjs.AutotaskError {
3284
+ var CompanyNotFoundError = class extends _chunk2H7YI54Bcjs.AutotaskError {
3285
3285
  constructor(message, options = {}) {
3286
3286
  super(message, {
3287
3287
  code: "COMPANY_NOT_FOUND",
@@ -3292,7 +3292,7 @@ var CompanyNotFoundError = class extends _chunkLVBFLSPLcjs.AutotaskError {
3292
3292
  this.name = "CompanyNotFoundError";
3293
3293
  }
3294
3294
  };
3295
- var ContactCreateFailedError = class extends _chunkLVBFLSPLcjs.AutotaskError {
3295
+ var ContactCreateFailedError = class extends _chunk2H7YI54Bcjs.AutotaskError {
3296
3296
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
3297
3297
 
3298
3298
  constructor(message, vendorFields, options = {}) {
@@ -3302,25 +3302,25 @@ var ContactCreateFailedError = class extends _chunkLVBFLSPLcjs.AutotaskError {
3302
3302
  }
3303
3303
  };
3304
3304
  async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3305
- const cid = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, companyID, "companyID");
3305
+ const cid = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, companyID, "companyID");
3306
3306
  if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
3307
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
3307
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
3308
3308
  `upsertByEmail: email must be a non-empty string with the @ shape (a non-empty local part + a non-empty domain; got ${JSON.stringify(email)})`,
3309
3309
  { operation: OP_UPSERT_EMAIL }
3310
3310
  );
3311
3311
  }
3312
3312
  if (extra !== void 0) {
3313
3313
  if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
3314
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
3314
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
3315
3315
  `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)})`,
3316
3316
  { operation: OP_UPSERT_EMAIL }
3317
3317
  );
3318
3318
  }
3319
3319
  if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
3320
- throw new (0, _chunkLVBFLSPLcjs.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 });
3320
+ throw new (0, _chunk2H7YI54Bcjs.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 });
3321
3321
  }
3322
3322
  if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
3323
- throw new (0, _chunkLVBFLSPLcjs.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 });
3323
+ throw new (0, _chunk2H7YI54Bcjs.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 });
3324
3324
  }
3325
3325
  }
3326
3326
  const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
@@ -3341,7 +3341,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3341
3341
  const match = q.items[0];
3342
3342
  if (match !== void 0) {
3343
3343
  if (opts.dryRun === true) {
3344
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
3344
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
3345
3345
  {
3346
3346
  operation: OP_UPSERT_EMAIL,
3347
3347
  method: "POST",
@@ -3371,7 +3371,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3371
3371
  isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
3372
3372
  };
3373
3373
  if (opts.dryRun === true) {
3374
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
3374
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
3375
3375
  {
3376
3376
  operation: OP_UPSERT_EMAIL,
3377
3377
  method: "POST",
@@ -3394,8 +3394,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3394
3394
  const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
3395
3395
  return { id: created.id, created: true };
3396
3396
  } catch (err) {
3397
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3398
- const named = (_nullishCoalesce(_chunkLVBFLSPLcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3397
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3398
+ const named = (_nullishCoalesce(_chunk2H7YI54Bcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3399
3399
  const seen = /* @__PURE__ */ new Set();
3400
3400
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
3401
3401
  const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
@@ -3409,7 +3409,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3409
3409
  }
3410
3410
  continue;
3411
3411
  }
3412
- const detail = _chunkLVBFLSPLcjs.formatVendorDetail.call(void 0, err.vendorError);
3412
+ const detail = _chunk2H7YI54Bcjs.formatVendorDetail.call(void 0, err.vendorError);
3413
3413
  throw new ContactCreateFailedError(
3414
3414
  `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}` : ""}`,
3415
3415
  unique,
@@ -3426,7 +3426,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3426
3426
  }
3427
3427
 
3428
3428
  // src/resources/contacts.ts
3429
- var ContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3429
+ var ContactsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3430
3430
  constructor(http, pageSize) {
3431
3431
  super(http, {
3432
3432
  key: "contacts",
@@ -3518,7 +3518,7 @@ var ContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3518
3518
  };
3519
3519
 
3520
3520
  // src/resources/contact_webhooks.ts
3521
- var ContactWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3521
+ var ContactWebhooksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3522
3522
  constructor(http, pageSize) {
3523
3523
  super(http, {
3524
3524
  key: "contact_webhooks",
@@ -3594,7 +3594,7 @@ var ContactWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3594
3594
  };
3595
3595
 
3596
3596
  // src/resources/contract_billing_rules.ts
3597
- var ContractBillingRulesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3597
+ var ContractBillingRulesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3598
3598
  constructor(http, pageSize) {
3599
3599
  super(http, {
3600
3600
  key: "contract_billing_rules",
@@ -3660,7 +3660,7 @@ var ContractBillingRulesResource = class extends _chunkLVBFLSPLcjs.BaseResource
3660
3660
  };
3661
3661
 
3662
3662
  // src/resources/contract_block_hour_factors.ts
3663
- var ContractBlockHourFactorsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3663
+ var ContractBlockHourFactorsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3664
3664
  constructor(http, pageSize) {
3665
3665
  super(http, {
3666
3666
  key: "contract_block_hour_factors",
@@ -3719,7 +3719,7 @@ var ContractBlockHourFactorsResource = class extends _chunkLVBFLSPLcjs.BaseResou
3719
3719
  };
3720
3720
 
3721
3721
  // src/resources/contract_blocks.ts
3722
- var ContractBlocksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3722
+ var ContractBlocksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3723
3723
  constructor(http, pageSize) {
3724
3724
  super(http, {
3725
3725
  key: "contract_blocks",
@@ -3778,7 +3778,7 @@ var ContractBlocksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3778
3778
  };
3779
3779
 
3780
3780
  // src/resources/contract_charges.ts
3781
- var ContractChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3781
+ var ContractChargesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3782
3782
  constructor(http, pageSize) {
3783
3783
  super(http, {
3784
3784
  key: "contract_charges",
@@ -3849,7 +3849,7 @@ var ContractChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3849
3849
  };
3850
3850
 
3851
3851
  // src/resources/contract_exclusion_billing_codes.ts
3852
- var ContractExclusionBillingCodesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3852
+ var ContractExclusionBillingCodesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3853
3853
  constructor(http, pageSize) {
3854
3854
  super(http, {
3855
3855
  key: "contract_exclusion_billing_codes",
@@ -3906,7 +3906,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkLVBFLSPLcjs.Base
3906
3906
  };
3907
3907
 
3908
3908
  // src/resources/contract_exclusion_roles.ts
3909
- var ContractExclusionRolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3909
+ var ContractExclusionRolesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3910
3910
  constructor(http, pageSize) {
3911
3911
  super(http, {
3912
3912
  key: "contract_exclusion_roles",
@@ -3963,7 +3963,7 @@ var ContractExclusionRolesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
3963
3963
  };
3964
3964
 
3965
3965
  // src/resources/contract_exclusion_set_excluded_roles.ts
3966
- var ContractExclusionSetExcludedRolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
3966
+ var ContractExclusionSetExcludedRolesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
3967
3967
  constructor(http, pageSize) {
3968
3968
  super(http, {
3969
3969
  key: "contract_exclusion_set_excluded_roles",
@@ -4020,7 +4020,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkLVBFLSPLcjs.
4020
4020
  };
4021
4021
 
4022
4022
  // src/resources/contract_exclusion_set_excluded_work_types.ts
4023
- var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4023
+ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4024
4024
  constructor(http, pageSize) {
4025
4025
  super(http, {
4026
4026
  key: "contract_exclusion_set_excluded_work_types",
@@ -4077,7 +4077,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkLVBFLSPL
4077
4077
  };
4078
4078
 
4079
4079
  // src/resources/contract_exclusion_sets.ts
4080
- var ContractExclusionSetsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4080
+ var ContractExclusionSetsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4081
4081
  constructor(http, pageSize) {
4082
4082
  super(http, {
4083
4083
  key: "contract_exclusion_sets",
@@ -4151,7 +4151,7 @@ var ContractExclusionSetsResource = class extends _chunkLVBFLSPLcjs.BaseResource
4151
4151
  };
4152
4152
 
4153
4153
  // src/resources/contract_milestones.ts
4154
- var ContractMilestonesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4154
+ var ContractMilestonesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4155
4155
  constructor(http, pageSize) {
4156
4156
  super(http, {
4157
4157
  key: "contract_milestones",
@@ -4210,7 +4210,7 @@ var ContractMilestonesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4210
4210
  };
4211
4211
 
4212
4212
  // src/resources/contract_notes.ts
4213
- var ContractNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4213
+ var ContractNotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4214
4214
  constructor(http, pageSize) {
4215
4215
  super(http, {
4216
4216
  key: "contract_notes",
@@ -4269,7 +4269,7 @@ var ContractNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4269
4269
  };
4270
4270
 
4271
4271
  // src/resources/contract_rates.ts
4272
- var ContractRatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4272
+ var ContractRatesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4273
4273
  constructor(http, pageSize) {
4274
4274
  super(http, {
4275
4275
  key: "contract_rates",
@@ -4328,7 +4328,7 @@ var ContractRatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4328
4328
  };
4329
4329
 
4330
4330
  // src/resources/contract_retainers.ts
4331
- var ContractRetainersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4331
+ var ContractRetainersResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4332
4332
  constructor(http, pageSize) {
4333
4333
  super(http, {
4334
4334
  key: "contract_retainers",
@@ -4387,7 +4387,7 @@ var ContractRetainersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4387
4387
  };
4388
4388
 
4389
4389
  // src/resources/contract_role_costs.ts
4390
- var ContractRoleCostsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4390
+ var ContractRoleCostsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4391
4391
  constructor(http, pageSize) {
4392
4392
  super(http, {
4393
4393
  key: "contract_role_costs",
@@ -4446,7 +4446,7 @@ var ContractRoleCostsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4446
4446
  };
4447
4447
 
4448
4448
  // src/resources/contract_service_adjustments.ts
4449
- var ContractServiceAdjustmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4449
+ var ContractServiceAdjustmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4450
4450
  constructor(http, pageSize) {
4451
4451
  super(http, {
4452
4452
  key: "contract_service_adjustments",
@@ -4480,7 +4480,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkLVBFLSPLcjs.BaseRes
4480
4480
  };
4481
4481
 
4482
4482
  // src/resources/contract_service_bundle_adjustments.ts
4483
- var ContractServiceBundleAdjustmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4483
+ var ContractServiceBundleAdjustmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4484
4484
  constructor(http, pageSize) {
4485
4485
  super(http, {
4486
4486
  key: "contract_service_bundle_adjustments",
@@ -4514,7 +4514,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkLVBFLSPLcjs.B
4514
4514
  };
4515
4515
 
4516
4516
  // src/resources/contract_service_bundles.ts
4517
- var ContractServiceBundlesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4517
+ var ContractServiceBundlesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4518
4518
  constructor(http, pageSize) {
4519
4519
  super(http, {
4520
4520
  key: "contract_service_bundles",
@@ -4573,7 +4573,7 @@ var ContractServiceBundlesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
4573
4573
  };
4574
4574
 
4575
4575
  // src/resources/contract_service_bundle_units.ts
4576
- var ContractServiceBundleUnitsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4576
+ var ContractServiceBundleUnitsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4577
4577
  constructor(http, pageSize) {
4578
4578
  super(http, {
4579
4579
  key: "contract_service_bundle_units",
@@ -4615,7 +4615,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkLVBFLSPLcjs.BaseRes
4615
4615
  };
4616
4616
 
4617
4617
  // src/resources/contract_services.ts
4618
- var ContractServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4618
+ var ContractServicesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4619
4619
  constructor(http, pageSize) {
4620
4620
  super(http, {
4621
4621
  key: "contract_services",
@@ -4674,7 +4674,7 @@ var ContractServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4674
4674
  };
4675
4675
 
4676
4676
  // src/resources/contract_service_units.ts
4677
- var ContractServiceUnitsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
4677
+ var ContractServiceUnitsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
4678
4678
  constructor(http, pageSize) {
4679
4679
  super(http, {
4680
4680
  key: "contract_service_units",
@@ -4942,7 +4942,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
4942
4942
  // src/resources/special/contracts/profitability.validate.ts
4943
4943
  function validateProfitabilityOptions(contractId, opts) {
4944
4944
  if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
4945
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
4945
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
4946
4946
  `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})`,
4947
4947
  { operation: "contracts.profitability" }
4948
4948
  );
@@ -5019,12 +5019,12 @@ function validateProfitabilityOptions(contractId, opts) {
5019
5019
  }
5020
5020
  }
5021
5021
  try {
5022
- _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, contractId, "contractId");
5022
+ _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, contractId, "contractId");
5023
5023
  } catch (err) {
5024
- problems.push(err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5024
+ problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5025
5025
  }
5026
5026
  if (problems.length > 0) {
5027
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
5027
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
5028
5028
  `profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
5029
5029
  - ` + problems.join("\n- "),
5030
5030
  { operation: "contracts.profitability" }
@@ -5073,23 +5073,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5073
5073
  const byKey = /* @__PURE__ */ new Map();
5074
5074
  const misses = [];
5075
5075
  const notes = [];
5076
- for (let c = 0; c < unique.length; c += _chunkLVBFLSPLcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5077
- const chunk = unique.slice(c, c + _chunkLVBFLSPLcjs.FETCH_BY_IDS_CHUNK_SIZE);
5076
+ for (let c = 0; c < unique.length; c += _chunk2H7YI54Bcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5077
+ const chunk = unique.slice(c, c + _chunk2H7YI54Bcjs.FETCH_BY_IDS_CHUNK_SIZE);
5078
5078
  const chunkKeys = new Set(chunk);
5079
5079
  try {
5080
5080
  const body = {
5081
- MaxRecords: _chunkLVBFLSPLcjs.FETCH_BY_IDS_CHUNK_SIZE,
5081
+ MaxRecords: _chunk2H7YI54Bcjs.FETCH_BY_IDS_CHUNK_SIZE,
5082
5082
  filter: [{ field: "id", op: "in", value: chunk }],
5083
5083
  IncludeFields: fields
5084
5084
  };
5085
5085
  const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
5086
- const { items: rows } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, operation);
5086
+ const { items: rows } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, operation);
5087
5087
  for (const row of rows) {
5088
5088
  const k = num(row.id);
5089
5089
  if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
5090
5090
  }
5091
5091
  } catch (err) {
5092
- const code = err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.code : "SERVER_ERROR";
5092
+ const code = err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.code : "SERVER_ERROR";
5093
5093
  for (const k of chunk) {
5094
5094
  if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
5095
5095
  }
@@ -5099,11 +5099,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5099
5099
  for (const k of queryMissed) {
5100
5100
  try {
5101
5101
  const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
5102
- byKey.set(k, _chunkLVBFLSPLcjs.unwrapItem.call(void 0, res, k, operation, entity));
5102
+ byKey.set(k, _chunk2H7YI54Bcjs.unwrapItem.call(void 0, res, k, operation, entity));
5103
5103
  } catch (err) {
5104
- if (err instanceof _chunkLVBFLSPLcjs.NotFoundError) {
5104
+ if (err instanceof _chunk2H7YI54Bcjs.NotFoundError) {
5105
5105
  misses.push({ id: k, code: "NOT_FOUND", message: err.message });
5106
- } else if (err instanceof _chunkLVBFLSPLcjs.AutotaskError) {
5106
+ } else if (err instanceof _chunk2H7YI54Bcjs.AutotaskError) {
5107
5107
  misses.push({ id: k, code: err.code, message: err.message });
5108
5108
  } else {
5109
5109
  misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
@@ -5157,7 +5157,7 @@ async function degradable(read) {
5157
5157
  try {
5158
5158
  return await read();
5159
5159
  } catch (err) {
5160
- if (!(err instanceof _chunkLVBFLSPLcjs.AutotaskError)) throw err;
5160
+ if (!(err instanceof _chunk2H7YI54Bcjs.AutotaskError)) throw err;
5161
5161
  return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
5162
5162
  }
5163
5163
  }
@@ -5177,7 +5177,7 @@ var stampPart = (key, raw, conditions, extraNotes) => {
5177
5177
  status: st.status,
5178
5178
  blindSurface: st.blindSurface,
5179
5179
  note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
5180
- emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkLVBFLSPLcjs.EMPTY_REASON_STAMPS, 'access', _47 => _47[key], 'optionalAccess', _48 => _48.query]) : void 0
5180
+ emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunk2H7YI54Bcjs.EMPTY_REASON_STAMPS, 'access', _47 => _47[key], 'optionalAccess', _48 => _48.query]) : void 0
5181
5181
  };
5182
5182
  };
5183
5183
  function appendWiresNote(wires, note) {
@@ -5185,7 +5185,7 @@ function appendWiresNote(wires, note) {
5185
5185
  }
5186
5186
  function makeFetchCtx(rawHttp, v, contractId, budget) {
5187
5187
  const OP6 = PROFITABILITY_OP;
5188
- const id = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, contractId, "contractId");
5188
+ const id = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, contractId, "contractId");
5189
5189
  const idNum = typeof id === "number" ? id : Number(id);
5190
5190
  const wires = { issued: 0, requests: 0, budget };
5191
5191
  const toExcl = dayAfter(v.dateTo);
@@ -5223,12 +5223,12 @@ async function fetchCustomer(ctx, companyID) {
5223
5223
  path: `/V1.0/Companies/${companyID}`,
5224
5224
  operation: ctx.OP
5225
5225
  });
5226
- const item = _chunkLVBFLSPLcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5226
+ const item = _chunk2H7YI54Bcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5227
5227
  customer = _nullishCoalesce(item, () => ( null));
5228
5228
  customerStatus = "ok";
5229
5229
  } catch (err) {
5230
- if (!(err instanceof _chunkLVBFLSPLcjs.AutotaskError)) throw err;
5231
- if (!(err instanceof _chunkLVBFLSPLcjs.NotFoundError)) {
5230
+ if (!(err instanceof _chunk2H7YI54Bcjs.AutotaskError)) throw err;
5231
+ if (!(err instanceof _chunk2H7YI54Bcjs.NotFoundError)) {
5232
5232
  customerStatus = "absent";
5233
5233
  customerAbsent = err.code;
5234
5234
  }
@@ -5244,7 +5244,7 @@ async function resolveContractType(ctx, contractType) {
5244
5244
  try {
5245
5245
  contractTypeLabel = await _asyncNullishCoalesce(await _asyncOptionalChain([(await readPicklists(ctx.http, "/V1.0/Contracts", ctx.OP)), 'access', async _49 => _49.get, 'call', async _50 => _50("contractType"), 'optionalAccess', async _51 => _51.get, 'call', async _52 => _52(contractType)]), async () => ( null));
5246
5246
  } catch (err) {
5247
- if (!(err instanceof _chunkLVBFLSPLcjs.AutotaskError)) throw err;
5247
+ if (!(err instanceof _chunk2H7YI54Bcjs.AutotaskError)) throw err;
5248
5248
  }
5249
5249
  }
5250
5250
  const contractTypeKnown = contractTypeLabel !== null;
@@ -5306,8 +5306,8 @@ async function fetchInvoices(ctx, billingRows) {
5306
5306
  if (invoiceIds.length === 0) {
5307
5307
  return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
5308
5308
  }
5309
- const capped = capJoinSet2(invoiceIds, _chunkLVBFLSPLcjs.FETCH_BY_IDS_MAX_ITEMS);
5310
- if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkLVBFLSPLcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5309
+ const capped = capJoinSet2(invoiceIds, _chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS);
5310
+ if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5311
5311
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
5312
5312
  ctx.wires.issued += 1;
5313
5313
  return {
@@ -5353,7 +5353,7 @@ async function readOpenStatusSet(ctx) {
5353
5353
  }
5354
5354
  }
5355
5355
  } catch (err) {
5356
- statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkLVBFLSPLcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5356
+ statusNote = `the tickets.status field catalog read failed (${err instanceof _chunk2H7YI54Bcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5357
5357
  }
5358
5358
  return { openStatusSet, statusNote };
5359
5359
  }
@@ -5376,8 +5376,8 @@ async function fetchResources(ctx, entries) {
5376
5376
  if (resourceIds.length === 0) {
5377
5377
  return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
5378
5378
  }
5379
- const capped = capJoinSet2(resourceIds, _chunkLVBFLSPLcjs.FETCH_BY_IDS_MAX_ITEMS);
5380
- if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkLVBFLSPLcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5379
+ const capped = capJoinSet2(resourceIds, _chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS);
5380
+ if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5381
5381
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
5382
5382
  ctx.wires.issued += 1;
5383
5383
  for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
@@ -5444,7 +5444,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
5444
5444
  try {
5445
5445
  return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
5446
5446
  } catch (err) {
5447
- if (!(err instanceof _chunkLVBFLSPLcjs.AutotaskError)) throw err;
5447
+ if (!(err instanceof _chunk2H7YI54Bcjs.AutotaskError)) throw err;
5448
5448
  return null;
5449
5449
  }
5450
5450
  }
@@ -5461,7 +5461,7 @@ async function fetchSubscriptions(ctx, cis) {
5461
5461
  cancelledSubs
5462
5462
  };
5463
5463
  }
5464
- const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkLVBFLSPLcjs.FETCH_BY_IDS_MAX_ITEMS);
5464
+ const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS);
5465
5465
  const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
5466
5466
  const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
5467
5467
  const subscriptions = raw.items;
@@ -6146,7 +6146,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
6146
6146
  }
6147
6147
 
6148
6148
  // src/resources/contracts.ts
6149
- var ContractsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6149
+ var ContractsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6150
6150
  constructor(http, pageSize) {
6151
6151
  super(http, {
6152
6152
  key: "contracts",
@@ -6217,7 +6217,7 @@ var ContractsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6217
6217
  };
6218
6218
 
6219
6219
  // src/resources/contract_ticket_purchases.ts
6220
- var ContractTicketPurchasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6220
+ var ContractTicketPurchasesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6221
6221
  constructor(http, pageSize) {
6222
6222
  super(http, {
6223
6223
  key: "contract_ticket_purchases",
@@ -6276,7 +6276,7 @@ var ContractTicketPurchasesResource = class extends _chunkLVBFLSPLcjs.BaseResour
6276
6276
  };
6277
6277
 
6278
6278
  // src/resources/countries.ts
6279
- var CountriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6279
+ var CountriesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6280
6280
  constructor(http, pageSize) {
6281
6281
  super(http, {
6282
6282
  key: "countries",
@@ -6335,7 +6335,7 @@ var CountriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6335
6335
  };
6336
6336
 
6337
6337
  // src/resources/departments.ts
6338
- var DepartmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6338
+ var DepartmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6339
6339
  constructor(http, pageSize) {
6340
6340
  super(http, {
6341
6341
  key: "departments",
@@ -6402,7 +6402,7 @@ var DepartmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6402
6402
  };
6403
6403
 
6404
6404
  // src/resources/domain_registrars.ts
6405
- var DomainRegistrarsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6405
+ var DomainRegistrarsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6406
6406
  constructor(http, pageSize) {
6407
6407
  super(http, {
6408
6408
  key: "domain_registrars",
@@ -6485,7 +6485,7 @@ var EntityInformationResource = class {
6485
6485
  };
6486
6486
 
6487
6487
  // src/resources/expense_item_attachments.ts
6488
- var ExpenseItemAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6488
+ var ExpenseItemAttachmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6489
6489
  constructor(http, pageSize) {
6490
6490
  super(http, {
6491
6491
  key: "expense_item_attachments",
@@ -6547,7 +6547,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResourc
6547
6547
  };
6548
6548
 
6549
6549
  // src/resources/expense_items.ts
6550
- var ExpenseItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6550
+ var ExpenseItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6551
6551
  constructor(http, pageSize) {
6552
6552
  super(http, {
6553
6553
  key: "expense_items",
@@ -6606,7 +6606,7 @@ var ExpenseItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6606
6606
  };
6607
6607
 
6608
6608
  // src/resources/expense_reports.ts
6609
- var ExpenseReportsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6609
+ var ExpenseReportsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6610
6610
  constructor(http, pageSize) {
6611
6611
  super(http, {
6612
6612
  key: "expense_reports",
@@ -6673,7 +6673,7 @@ var ExpenseReportsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6673
6673
  };
6674
6674
 
6675
6675
  // src/resources/holiday_sets.ts
6676
- var HolidaySetsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6676
+ var HolidaySetsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6677
6677
  constructor(http, pageSize) {
6678
6678
  super(http, {
6679
6679
  key: "holiday_sets",
@@ -6742,7 +6742,7 @@ var HolidaySetsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6742
6742
  };
6743
6743
 
6744
6744
  // src/resources/holidays.ts
6745
- var HolidaysResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6745
+ var HolidaysResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6746
6746
  constructor(http, pageSize) {
6747
6747
  super(http, {
6748
6748
  key: "holidays",
@@ -6814,10 +6814,10 @@ var PATH_SUFFIX = {
6814
6814
  transfer: "StockedItemsTransfer"
6815
6815
  };
6816
6816
  async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6817
- const numericParent = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, parentId, "parentId");
6817
+ const numericParent = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, parentId, "parentId");
6818
6818
  const suffix = PATH_SUFFIX[kind];
6819
6819
  if (opts.dryRun === true) {
6820
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
6820
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
6821
6821
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6822
6822
  method: "POST",
6823
6823
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -6834,11 +6834,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6834
6834
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6835
6835
  maxRetries: opts.maxRetries
6836
6836
  });
6837
- return _chunkLVBFLSPLcjs.unwrapOperation.call(void 0, res);
6837
+ return _chunk2H7YI54Bcjs.unwrapOperation.call(void 0, res);
6838
6838
  }
6839
6839
 
6840
6840
  // src/resources/inventory_products.ts
6841
- var InventoryProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6841
+ var InventoryProductsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6842
6842
  constructor(http, pageSize) {
6843
6843
  super(http, {
6844
6844
  key: "inventory_products",
@@ -6920,7 +6920,7 @@ var InventoryProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6920
6920
 
6921
6921
  // src/resources/special/invoices.ts
6922
6922
  async function markup(_resource, id, format, http) {
6923
- const numericId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
6923
+ const numericId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
6924
6924
  const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
6925
6925
  const res = await http.request({
6926
6926
  method: "GET",
@@ -6929,7 +6929,7 @@ async function markup(_resource, id, format, http) {
6929
6929
  });
6930
6930
  const body = res;
6931
6931
  if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
6932
- throw new (0, _chunkLVBFLSPLcjs.AutotaskError)(
6932
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
6933
6933
  `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
6934
6934
  { code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
6935
6935
  );
@@ -6937,13 +6937,13 @@ async function markup(_resource, id, format, http) {
6937
6937
  return body.invoiceMarkup;
6938
6938
  }
6939
6939
  async function pdf(_resource, id, http) {
6940
- const numericId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
6940
+ const numericId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
6941
6941
  const res = await http.request({
6942
6942
  method: "GET",
6943
6943
  path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
6944
6944
  operation: "invoices.pdf"
6945
6945
  });
6946
- return _chunkLVBFLSPLcjs.decodeFileData.call(void 0, res);
6946
+ return _chunk2H7YI54Bcjs.decodeFileData.call(void 0, res);
6947
6947
  }
6948
6948
  async function windowQuery2(_resource, kind, http, opts) {
6949
6949
  const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _70 => _70.now]), () => ( /* @__PURE__ */ new Date()));
@@ -6974,7 +6974,7 @@ async function customRange2(_resource, from, to, http, opts) {
6974
6974
  }
6975
6975
 
6976
6976
  // src/resources/invoices.ts
6977
- var InvoicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
6977
+ var InvoicesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
6978
6978
  constructor(http, pageSize) {
6979
6979
  super(http, {
6980
6980
  key: "invoices",
@@ -7104,7 +7104,7 @@ var ModulesResource = class {
7104
7104
  };
7105
7105
 
7106
7106
  // src/resources/notification_history.ts
7107
- var NotificationHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7107
+ var NotificationHistoryResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7108
7108
  constructor(http, pageSize) {
7109
7109
  super(http, {
7110
7110
  key: "notification_history",
@@ -7143,7 +7143,7 @@ var NotificationHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7143
7143
  };
7144
7144
 
7145
7145
  // src/resources/opportunities.ts
7146
- var OpportunitiesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7146
+ var OpportunitiesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7147
7147
  constructor(http, pageSize) {
7148
7148
  super(http, {
7149
7149
  key: "opportunities",
@@ -7205,7 +7205,7 @@ var OpportunitiesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7205
7205
  };
7206
7206
 
7207
7207
  // src/resources/opportunity_attachments.ts
7208
- var OpportunityAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7208
+ var OpportunityAttachmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7209
7209
  constructor(http, pageSize) {
7210
7210
  super(http, {
7211
7211
  key: "opportunity_attachments",
@@ -7267,7 +7267,7 @@ var OpportunityAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResourc
7267
7267
  };
7268
7268
 
7269
7269
  // src/resources/opportunity_categories.ts
7270
- var OpportunityCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7270
+ var OpportunityCategoriesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7271
7271
  constructor(http, pageSize) {
7272
7272
  super(http, {
7273
7273
  key: "opportunity_categories",
@@ -7326,7 +7326,7 @@ var OpportunityCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource
7326
7326
  };
7327
7327
 
7328
7328
  // src/resources/phases.ts
7329
- var PhasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7329
+ var PhasesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7330
7330
  constructor(http, pageSize) {
7331
7331
  super(http, {
7332
7332
  key: "phases",
@@ -7385,7 +7385,7 @@ var PhasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7385
7385
  };
7386
7386
 
7387
7387
  // src/resources/products.ts
7388
- var ProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7388
+ var ProductsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7389
7389
  constructor(http, pageSize) {
7390
7390
  super(http, {
7391
7391
  key: "products",
@@ -7452,7 +7452,7 @@ var ProductsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7452
7452
  };
7453
7453
 
7454
7454
  // src/resources/product_vendors.ts
7455
- var ProductVendorsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7455
+ var ProductVendorsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7456
7456
  constructor(http, pageSize) {
7457
7457
  super(http, {
7458
7458
  key: "product_vendors",
@@ -7511,7 +7511,7 @@ var ProductVendorsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7511
7511
  };
7512
7512
 
7513
7513
  // src/resources/project_charges.ts
7514
- var ProjectChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7514
+ var ProjectChargesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7515
7515
  constructor(http, pageSize) {
7516
7516
  super(http, {
7517
7517
  key: "project_charges",
@@ -7582,7 +7582,7 @@ var ProjectChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7582
7582
  };
7583
7583
 
7584
7584
  // src/resources/project_notes.ts
7585
- var ProjectNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7585
+ var ProjectNotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7586
7586
  constructor(http, pageSize) {
7587
7587
  super(http, {
7588
7588
  key: "project_notes",
@@ -7641,7 +7641,7 @@ var ProjectNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7641
7641
  };
7642
7642
 
7643
7643
  // src/resources/projects.ts
7644
- var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7644
+ var ProjectsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7645
7645
  constructor(http, pageSize) {
7646
7646
  super(http, {
7647
7647
  key: "projects",
@@ -7718,13 +7718,13 @@ var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7718
7718
  const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
7719
7719
  const result = { project: project2, company, opportunity, leadResource };
7720
7720
  if (opts.names === true) {
7721
- const builder = _chunkLVBFLSPLcjs.createNamePlan.call(void 0, );
7721
+ const builder = _chunk2H7YI54Bcjs.createNamePlan.call(void 0, );
7722
7722
  builder.addResource(root["creatorResourceID"]);
7723
7723
  builder.addFk("contract", root["contractID"]);
7724
- const names = await _chunkLVBFLSPLcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
7724
+ const names = await _chunk2H7YI54Bcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
7725
7725
  const row = { ...project2 };
7726
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
7727
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
7726
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
7727
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
7728
7728
  result.project = row;
7729
7729
  result.names = names.section;
7730
7730
  }
@@ -7733,7 +7733,7 @@ var ProjectsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7733
7733
  };
7734
7734
 
7735
7735
  // src/resources/purchase_approvals.ts
7736
- var PurchaseApprovalsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7736
+ var PurchaseApprovalsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7737
7737
  constructor(http, pageSize) {
7738
7738
  super(http, {
7739
7739
  key: "purchase_approvals",
@@ -7787,7 +7787,7 @@ var PurchaseApprovalsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7787
7787
  };
7788
7788
 
7789
7789
  // src/resources/purchase_order_item_receiving.ts
7790
- var PurchaseOrderItemReceivingResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7790
+ var PurchaseOrderItemReceivingResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7791
7791
  constructor(http, pageSize) {
7792
7792
  super(http, {
7793
7793
  key: "purchase_order_item_receiving",
@@ -7837,7 +7837,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkLVBFLSPLcjs.BaseRes
7837
7837
  };
7838
7838
 
7839
7839
  // src/resources/purchase_order_items.ts
7840
- var PurchaseOrderItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7840
+ var PurchaseOrderItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7841
7841
  constructor(http, pageSize) {
7842
7842
  super(http, {
7843
7843
  key: "purchase_order_items",
@@ -7896,7 +7896,7 @@ var PurchaseOrderItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7896
7896
  };
7897
7897
 
7898
7898
  // src/resources/purchase_orders.ts
7899
- var PurchaseOrdersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7899
+ var PurchaseOrdersResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7900
7900
  constructor(http, pageSize) {
7901
7901
  super(http, {
7902
7902
  key: "purchase_orders",
@@ -7958,7 +7958,7 @@ var PurchaseOrdersResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7958
7958
  };
7959
7959
 
7960
7960
  // src/resources/quote_items.ts
7961
- var QuoteItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
7961
+ var QuoteItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
7962
7962
  constructor(http, pageSize) {
7963
7963
  super(http, {
7964
7964
  key: "quote_items",
@@ -8029,7 +8029,7 @@ var QuoteItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8029
8029
  };
8030
8030
 
8031
8031
  // src/resources/quote_locations.ts
8032
- var QuoteLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8032
+ var QuoteLocationsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8033
8033
  constructor(http, pageSize) {
8034
8034
  super(http, {
8035
8035
  key: "quote_locations",
@@ -8094,7 +8094,7 @@ var QuoteLocationsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8094
8094
  };
8095
8095
 
8096
8096
  // src/resources/quotes.ts
8097
- var QuotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8097
+ var QuotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8098
8098
  constructor(http, pageSize) {
8099
8099
  super(http, {
8100
8100
  key: "quotes",
@@ -8161,7 +8161,7 @@ var QuotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8161
8161
  };
8162
8162
 
8163
8163
  // src/resources/quote_templates.ts
8164
- var QuoteTemplatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8164
+ var QuoteTemplatesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8165
8165
  constructor(http, pageSize) {
8166
8166
  super(http, {
8167
8167
  key: "quote_templates",
@@ -8205,7 +8205,7 @@ var QuoteTemplatesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8205
8205
  };
8206
8206
 
8207
8207
  // src/resources/resource_role_queues.ts
8208
- var ResourceRoleQueuesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8208
+ var ResourceRoleQueuesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8209
8209
  constructor(http, pageSize) {
8210
8210
  super(http, {
8211
8211
  key: "resource_role_queues",
@@ -8264,7 +8264,7 @@ var ResourceRoleQueuesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8264
8264
  };
8265
8265
 
8266
8266
  // src/resources/resource_roles.ts
8267
- var ResourceRolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8267
+ var ResourceRolesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8268
8268
  constructor(http, pageSize) {
8269
8269
  super(http, {
8270
8270
  key: "resource_roles",
@@ -8306,7 +8306,7 @@ var ResourceRolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8306
8306
  };
8307
8307
 
8308
8308
  // src/resources/resource_skills.ts
8309
- var ResourceSkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8309
+ var ResourceSkillsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8310
8310
  constructor(http, pageSize) {
8311
8311
  super(http, {
8312
8312
  key: "resource_skills",
@@ -8360,16 +8360,16 @@ var ResourceSkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8360
8360
  var MAX_TRANSFER_IDS = 500;
8361
8361
  function requirePositiveIds(ids2, label) {
8362
8362
  if (!Array.isArray(ids2) || ids2.length === 0) {
8363
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8363
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8364
8364
  }
8365
8365
  if (ids2.length > MAX_TRANSFER_IDS) {
8366
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8366
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8367
8367
  }
8368
8368
  const out = [];
8369
8369
  for (const raw of ids2) {
8370
- const id = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8370
+ const id = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8371
8371
  if (typeof id === "number" && id < 1) {
8372
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8372
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8373
8373
  }
8374
8374
  out.push(id);
8375
8375
  }
@@ -8377,7 +8377,7 @@ function requirePositiveIds(ids2, label) {
8377
8377
  }
8378
8378
  async function whoAmI(_resource, userName, http) {
8379
8379
  const user = userName.trim();
8380
- if (user === "") throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8380
+ if (user === "") throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8381
8381
  const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
8382
8382
  const res = await http.request({
8383
8383
  method: "POST",
@@ -8386,11 +8386,11 @@ async function whoAmI(_resource, userName, http) {
8386
8386
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
8387
8387
  operation: "resources.whoAmI"
8388
8388
  });
8389
- const matches = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
8389
+ const matches = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
8390
8390
  if (matches.length === 0) return null;
8391
8391
  if (matches.length > 1) {
8392
8392
  const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
8393
- throw new (0, _chunkLVBFLSPLcjs.ResolutionError)(
8393
+ throw new (0, _chunk2H7YI54Bcjs.ResolutionError)(
8394
8394
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
8395
8395
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
8396
8396
  );
@@ -8399,9 +8399,9 @@ async function whoAmI(_resource, userName, http) {
8399
8399
  }
8400
8400
  async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
8401
8401
  const ids2 = requirePositiveIds(companyIds, "transferOwnership");
8402
- const destination = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8402
+ const destination = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8403
8403
  if (typeof destination === "number" && destination < 1) {
8404
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8404
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8405
8405
  }
8406
8406
  const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _82 => _82.dryRun]), () => ( true));
8407
8407
  const changes = [];
@@ -8414,7 +8414,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8414
8414
  operation: "resources.transferOwnership",
8415
8415
  maxRetries: _optionalChain([opts, 'optionalAccess', _83 => _83.maxRetries])
8416
8416
  });
8417
- const company = _chunkLVBFLSPLcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8417
+ const company = _chunk2H7YI54Bcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8418
8418
  const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
8419
8419
  changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
8420
8420
  if (!dryRun) {
@@ -8425,13 +8425,13 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8425
8425
  operation: "resources.transferOwnership",
8426
8426
  maxRetries: _optionalChain([opts, 'optionalAccess', _84 => _84.maxRetries])
8427
8427
  });
8428
- _chunkLVBFLSPLcjs.unwrapOperation.call(void 0, update);
8428
+ _chunk2H7YI54Bcjs.unwrapOperation.call(void 0, update);
8429
8429
  applied.push(id);
8430
8430
  }
8431
8431
  } catch (err) {
8432
- if (!dryRun && err instanceof _chunkLVBFLSPLcjs.AutotaskError) {
8432
+ if (!dryRun && err instanceof _chunk2H7YI54Bcjs.AutotaskError) {
8433
8433
  err.resourceIds = [id];
8434
- err.details = _chunkLVBFLSPLcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8434
+ err.details = _chunk2H7YI54Bcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8435
8435
  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).`;
8436
8436
  }
8437
8437
  throw err;
@@ -8440,7 +8440,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8440
8440
  if (dryRun) {
8441
8441
  const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
8442
8442
  return {
8443
- ..._chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
8443
+ ..._chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
8444
8444
  operation: "resources.transferOwnership",
8445
8445
  method: "PUT",
8446
8446
  path: "/V1.0/Companies",
@@ -8464,7 +8464,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8464
8464
  }
8465
8465
 
8466
8466
  // src/resources/resources.ts
8467
- var ResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8467
+ var ResourcesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8468
8468
 
8469
8469
  constructor(http, clientConfig, pageSize) {
8470
8470
  super(http, {
@@ -8537,7 +8537,7 @@ var ResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8537
8537
 
8538
8538
  // src/resources/special/resource_time_off_additional.ts
8539
8539
  async function getByResource(_resource, resourceId, http) {
8540
- const numericResource = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8540
+ const numericResource = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8541
8541
  const res = await http.request({
8542
8542
  method: "GET",
8543
8543
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -8551,11 +8551,11 @@ async function getByResource(_resource, resourceId, http) {
8551
8551
  if (typeof item === "object" && !Array.isArray(item)) return [item];
8552
8552
  }
8553
8553
  }
8554
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8554
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8555
8555
  }
8556
8556
 
8557
8557
  // src/resources/resource_time_off_additional.ts
8558
- var ResourceTimeOffAdditionalResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8558
+ var ResourceTimeOffAdditionalResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8559
8559
  constructor(http, pageSize) {
8560
8560
  super(http, {
8561
8561
  key: "resource_time_off_additional",
@@ -8594,7 +8594,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkLVBFLSPLcjs.BaseReso
8594
8594
  };
8595
8595
 
8596
8596
  // src/resources/resource_time_off_approvers.ts
8597
- var ResourceTimeOffApproversResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8597
+ var ResourceTimeOffApproversResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8598
8598
  constructor(http, pageSize) {
8599
8599
  super(http, {
8600
8600
  key: "resource_time_off_approvers",
@@ -8637,29 +8637,29 @@ var ResourceTimeOffApproversResource = class extends _chunkLVBFLSPLcjs.BaseResou
8637
8637
 
8638
8638
  // src/resources/special/resource_time_off_balances.ts
8639
8639
  async function getByResource2(_resource, resourceId, http) {
8640
- const numericResource = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8640
+ const numericResource = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8641
8641
  const res = await http.request({
8642
8642
  method: "GET",
8643
8643
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
8644
8644
  operation: "resource_time_off_balances.getByResource"
8645
8645
  });
8646
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8646
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8647
8647
  }
8648
8648
  async function getByYear(_resource, resourceId, year, http) {
8649
- const numericResource = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8649
+ const numericResource = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8650
8650
  if (!Number.isSafeInteger(year) || year < 1) {
8651
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8651
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8652
8652
  }
8653
8653
  const res = await http.request({
8654
8654
  method: "GET",
8655
8655
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
8656
8656
  operation: "resource_time_off_balances.getByYear"
8657
8657
  });
8658
- return _chunkLVBFLSPLcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
8658
+ return _chunk2H7YI54Bcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
8659
8659
  }
8660
8660
 
8661
8661
  // src/resources/resource_time_off_balances.ts
8662
- var ResourceTimeOffBalancesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8662
+ var ResourceTimeOffBalancesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8663
8663
  constructor(http, pageSize) {
8664
8664
  super(http, {
8665
8665
  key: "resource_time_off_balances",
@@ -8697,7 +8697,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkLVBFLSPLcjs.BaseResour
8697
8697
  };
8698
8698
 
8699
8699
  // src/resources/roles.ts
8700
- var RolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8700
+ var RolesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8701
8701
  constructor(http, pageSize) {
8702
8702
  super(http, {
8703
8703
  key: "roles",
@@ -8764,7 +8764,7 @@ var RolesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8764
8764
  };
8765
8765
 
8766
8766
  // src/resources/service_calls.ts
8767
- var ServiceCallsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8767
+ var ServiceCallsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8768
8768
  constructor(http, pageSize) {
8769
8769
  super(http, {
8770
8770
  key: "service_calls",
@@ -8833,7 +8833,7 @@ var ServiceCallsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8833
8833
  };
8834
8834
 
8835
8835
  // src/resources/service_call_task_resources.ts
8836
- var ServiceCallTaskResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8836
+ var ServiceCallTaskResourcesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8837
8837
  constructor(http, pageSize) {
8838
8838
  super(http, {
8839
8839
  key: "service_call_task_resources",
@@ -8890,7 +8890,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResou
8890
8890
  };
8891
8891
 
8892
8892
  // src/resources/service_call_tasks.ts
8893
- var ServiceCallTasksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8893
+ var ServiceCallTasksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8894
8894
  constructor(http, pageSize) {
8895
8895
  super(http, {
8896
8896
  key: "service_call_tasks",
@@ -8947,7 +8947,7 @@ var ServiceCallTasksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8947
8947
  };
8948
8948
 
8949
8949
  // src/resources/service_call_ticket_resources.ts
8950
- var ServiceCallTicketResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
8950
+ var ServiceCallTicketResourcesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
8951
8951
  constructor(http, pageSize) {
8952
8952
  super(http, {
8953
8953
  key: "service_call_ticket_resources",
@@ -9004,7 +9004,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkLVBFLSPLcjs.BaseRes
9004
9004
  };
9005
9005
 
9006
9006
  // src/resources/service_call_tickets.ts
9007
- var ServiceCallTicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9007
+ var ServiceCallTicketsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9008
9008
  constructor(http, pageSize) {
9009
9009
  super(http, {
9010
9010
  key: "service_call_tickets",
@@ -9061,7 +9061,7 @@ var ServiceCallTicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9061
9061
  };
9062
9062
 
9063
9063
  // src/resources/service_level_agreement_results.ts
9064
- var ServiceLevelAgreementResultsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9064
+ var ServiceLevelAgreementResultsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9065
9065
  constructor(http, pageSize) {
9066
9066
  super(http, {
9067
9067
  key: "service_level_agreement_results",
@@ -9100,7 +9100,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkLVBFLSPLcjs.BaseR
9100
9100
  };
9101
9101
 
9102
9102
  // src/resources/services.ts
9103
- var ServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9103
+ var ServicesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9104
9104
  constructor(http, pageSize) {
9105
9105
  super(http, {
9106
9106
  key: "services",
@@ -9168,7 +9168,7 @@ var ServicesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9168
9168
  };
9169
9169
 
9170
9170
  // src/resources/skills.ts
9171
- var SkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9171
+ var SkillsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9172
9172
  constructor(http, pageSize) {
9173
9173
  super(http, {
9174
9174
  key: "skills",
@@ -9212,7 +9212,7 @@ var SkillsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9212
9212
  };
9213
9213
 
9214
9214
  // src/resources/subscription_periods.ts
9215
- var SubscriptionPeriodsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9215
+ var SubscriptionPeriodsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9216
9216
  constructor(http, pageSize) {
9217
9217
  super(http, {
9218
9218
  key: "subscription_periods",
@@ -9251,7 +9251,7 @@ var SubscriptionPeriodsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9251
9251
  };
9252
9252
 
9253
9253
  // src/resources/subscriptions.ts
9254
- var SubscriptionsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9254
+ var SubscriptionsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9255
9255
  constructor(http, pageSize) {
9256
9256
  super(http, {
9257
9257
  key: "subscriptions",
@@ -9320,7 +9320,7 @@ var SubscriptionsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9320
9320
  };
9321
9321
 
9322
9322
  // src/resources/survey_results.ts
9323
- var SurveyResultsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9323
+ var SurveyResultsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9324
9324
  constructor(http, pageSize) {
9325
9325
  super(http, {
9326
9326
  key: "survey_results",
@@ -9359,7 +9359,7 @@ var SurveyResultsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9359
9359
  };
9360
9360
 
9361
9361
  // src/resources/surveys.ts
9362
- var SurveysResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9362
+ var SurveysResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9363
9363
  constructor(http, pageSize) {
9364
9364
  super(http, {
9365
9365
  key: "surveys",
@@ -9403,7 +9403,7 @@ var SurveysResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9403
9403
  };
9404
9404
 
9405
9405
  // src/resources/tag_aliases.ts
9406
- var TagAliasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9406
+ var TagAliasesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9407
9407
  constructor(http, pageSize) {
9408
9408
  super(http, {
9409
9409
  key: "tag_aliases",
@@ -9460,7 +9460,7 @@ var TagAliasesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9460
9460
  };
9461
9461
 
9462
9462
  // src/resources/tag_groups.ts
9463
- var TagGroupsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9463
+ var TagGroupsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9464
9464
  constructor(http, pageSize) {
9465
9465
  super(http, {
9466
9466
  key: "tag_groups",
@@ -9529,7 +9529,7 @@ var TagGroupsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9529
9529
  };
9530
9530
 
9531
9531
  // src/resources/tags.ts
9532
- var TagsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9532
+ var TagsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9533
9533
  constructor(http, pageSize) {
9534
9534
  super(http, {
9535
9535
  key: "tags",
@@ -9598,7 +9598,7 @@ var TagsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9598
9598
  };
9599
9599
 
9600
9600
  // src/resources/task_secondary_resources.ts
9601
- var TaskSecondaryResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9601
+ var TaskSecondaryResourcesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9602
9602
  constructor(http, pageSize) {
9603
9603
  super(http, {
9604
9604
  key: "task_secondary_resources",
@@ -9655,7 +9655,7 @@ var TaskSecondaryResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResourc
9655
9655
  };
9656
9656
 
9657
9657
  // src/resources/tasks.ts
9658
- var TasksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9658
+ var TasksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9659
9659
  constructor(http, pageSize) {
9660
9660
  super(http, {
9661
9661
  key: "tasks",
@@ -9743,7 +9743,7 @@ var ThresholdInformationResource = class {
9743
9743
  };
9744
9744
 
9745
9745
  // src/resources/ticket_additional_configuration_items.ts
9746
- var TicketAdditionalConfigurationItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9746
+ var TicketAdditionalConfigurationItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9747
9747
  constructor(http, pageSize) {
9748
9748
  super(http, {
9749
9749
  key: "ticket_additional_configuration_items",
@@ -9800,7 +9800,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkLVBFLSPLcjs
9800
9800
  };
9801
9801
 
9802
9802
  // src/resources/ticket_additional_contacts.ts
9803
- var TicketAdditionalContactsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9803
+ var TicketAdditionalContactsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9804
9804
  constructor(http, pageSize) {
9805
9805
  super(http, {
9806
9806
  key: "ticket_additional_contacts",
@@ -9857,7 +9857,7 @@ var TicketAdditionalContactsResource = class extends _chunkLVBFLSPLcjs.BaseResou
9857
9857
  };
9858
9858
 
9859
9859
  // src/resources/ticket_attachments.ts
9860
- var TicketAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9860
+ var TicketAttachmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9861
9861
  constructor(http, pageSize) {
9862
9862
  super(http, {
9863
9863
  key: "ticket_attachments",
@@ -9919,7 +9919,7 @@ var TicketAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9919
9919
  };
9920
9920
 
9921
9921
  // src/resources/ticket_categories.ts
9922
- var TicketCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9922
+ var TicketCategoriesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9923
9923
  constructor(http, pageSize) {
9924
9924
  super(http, {
9925
9925
  key: "ticket_categories",
@@ -9978,7 +9978,7 @@ var TicketCategoriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9978
9978
  };
9979
9979
 
9980
9980
  // src/resources/ticket_category_field_defaults.ts
9981
- var TicketCategoryFieldDefaultsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
9981
+ var TicketCategoryFieldDefaultsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
9982
9982
  constructor(http, pageSize) {
9983
9983
  super(http, {
9984
9984
  key: "ticket_category_field_defaults",
@@ -10020,7 +10020,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkLVBFLSPLcjs.BaseRe
10020
10020
  };
10021
10021
 
10022
10022
  // src/resources/ticket_change_request_approvals.ts
10023
- var TicketChangeRequestApprovalsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10023
+ var TicketChangeRequestApprovalsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10024
10024
  constructor(http, pageSize) {
10025
10025
  super(http, {
10026
10026
  key: "ticket_change_request_approvals",
@@ -10081,10 +10081,10 @@ var _crypto = require('crypto');
10081
10081
  var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
10082
10082
  var TICKET_COMPLETE_STATUS = 5;
10083
10083
  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";
10084
- var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkLVBFLSPLcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10084
+ var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunk2H7YI54Bcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10085
10085
  async function queryRows(http, resource, filter, operation, retries) {
10086
10086
  const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
10087
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
10087
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
10088
10088
  }
10089
10089
  function sameValue(a, b) {
10090
10090
  if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
@@ -10104,7 +10104,7 @@ async function readTicket(http, id, retries, operation) {
10104
10104
  const item = _optionalChain([res, 'optionalAccess', _92 => _92.item]);
10105
10105
  return _nullishCoalesce(item, () => ( null));
10106
10106
  } catch (e) {
10107
- if (_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10107
+ if (_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10108
10108
  throw e;
10109
10109
  }
10110
10110
  }
@@ -10125,7 +10125,7 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
10125
10125
  }
10126
10126
  }
10127
10127
  const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
10128
- if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10128
+ if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10129
10129
  const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
10130
10130
  if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
10131
10131
  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") });
@@ -10160,17 +10160,17 @@ async function assertNoTwin(ctx, payload) {
10160
10160
  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 });
10161
10161
  }
10162
10162
  }
10163
- var statusOf = (e) => _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10163
+ var statusOf = (e) => _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10164
10164
  async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10165
10165
  const op = spec.operation;
10166
- const sourceId = Number(_chunkLVBFLSPLcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10167
- const toTicketId = Number(_chunkLVBFLSPLcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10166
+ const sourceId = Number(_chunk2H7YI54Bcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10167
+ const toTicketId = Number(_chunk2H7YI54Bcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10168
10168
  if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
10169
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10169
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10170
10170
  }
10171
10171
  const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
10172
10172
  if (opts.dryRun === true) {
10173
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
10173
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
10174
10174
  {
10175
10175
  operation: op,
10176
10176
  method: "POST",
@@ -10195,22 +10195,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10195
10195
  let newId;
10196
10196
  try {
10197
10197
  const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
10198
- newId = Number(_chunkLVBFLSPLcjs.unwrapOperation.call(void 0, created, op).id);
10198
+ newId = Number(_chunk2H7YI54Bcjs.unwrapOperation.call(void 0, created, op).id);
10199
10199
  } catch (e) {
10200
10200
  const status = statusOf(e);
10201
10201
  if (status !== void 0 && status >= 400 && status < 500) {
10202
- throw new (0, _chunkLVBFLSPLcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10202
+ throw new (0, _chunk2H7YI54Bcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10203
10203
  }
10204
- throw new (0, _chunkLVBFLSPLcjs.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 } });
10204
+ throw new (0, _chunk2H7YI54Bcjs.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 } });
10205
10205
  }
10206
10206
  const rollback = async (code, message) => {
10207
10207
  try {
10208
10208
  await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
10209
10209
  } catch (re) {
10210
10210
  const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
10211
- throw new (0, _chunkLVBFLSPLcjs.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 } });
10211
+ throw new (0, _chunk2H7YI54Bcjs.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 } });
10212
10212
  }
10213
- throw new (0, _chunkLVBFLSPLcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10213
+ throw new (0, _chunk2H7YI54Bcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10214
10214
  };
10215
10215
  const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
10216
10216
  if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
@@ -10239,14 +10239,14 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10239
10239
  };
10240
10240
  }
10241
10241
  if (status === void 0) {
10242
- throw new (0, _chunkLVBFLSPLcjs.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 } });
10242
+ throw new (0, _chunk2H7YI54Bcjs.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 } });
10243
10243
  }
10244
10244
  return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
10245
10245
  }
10246
10246
  return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
10247
10247
  }
10248
10248
  function uiLinkFor(http, entity, id) {
10249
- return _nullishCoalesce(_chunkLVBFLSPLcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10249
+ return _nullishCoalesce(_chunk2H7YI54Bcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10250
10250
  }
10251
10251
 
10252
10252
  // src/resources/special/ticket_charges.ts
@@ -10301,7 +10301,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
10301
10301
  }
10302
10302
 
10303
10303
  // src/resources/ticket_charges.ts
10304
- var TicketChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10304
+ var TicketChargesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10305
10305
  constructor(http, pageSize) {
10306
10306
  super(http, {
10307
10307
  key: "ticket_charges",
@@ -10376,7 +10376,7 @@ var TicketChargesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10376
10376
  };
10377
10377
 
10378
10378
  // src/resources/ticket_checklist_items.ts
10379
- var TicketChecklistItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10379
+ var TicketChecklistItemsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10380
10380
  constructor(http, pageSize) {
10381
10381
  super(http, {
10382
10382
  key: "ticket_checklist_items",
@@ -10442,7 +10442,7 @@ var TicketChecklistItemsResource = class extends _chunkLVBFLSPLcjs.BaseResource
10442
10442
  };
10443
10443
 
10444
10444
  // src/resources/ticket_checklist_libraries.ts
10445
- var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10445
+ var TicketChecklistLibrariesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10446
10446
  constructor(http, pageSize) {
10447
10447
  super(http, {
10448
10448
  key: "ticket_checklist_libraries",
@@ -10466,9 +10466,9 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
10466
10466
  * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
10467
10467
  * surface — no documents read op — and never issues the POST). */
10468
10468
  async attachToDocument(documentID, data, opts = {}) {
10469
- const n = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, documentID, "documentID");
10469
+ const n = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, documentID, "documentID");
10470
10470
  if (opts.dryRun === true) {
10471
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
10471
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
10472
10472
  operation: "ticket_checklist_libraries.attachToDocument",
10473
10473
  method: "POST",
10474
10474
  path: `/V1.0/Documents/${n}/ChecklistLibraries`,
@@ -10486,7 +10486,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
10486
10486
  operation: "ticket_checklist_libraries.attachToDocument",
10487
10487
  maxRetries: opts.maxRetries
10488
10488
  });
10489
- return _chunkLVBFLSPLcjs.unwrapOperation.call(void 0, res);
10489
+ return _chunk2H7YI54Bcjs.unwrapOperation.call(void 0, res);
10490
10490
  }
10491
10491
  /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
10492
10492
  * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
@@ -10502,7 +10502,7 @@ var TicketChecklistLibrariesResource = class extends _chunkLVBFLSPLcjs.BaseResou
10502
10502
  };
10503
10503
 
10504
10504
  // src/resources/ticket_history.ts
10505
- var TicketHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10505
+ var TicketHistoryResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10506
10506
  constructor(http, pageSize) {
10507
10507
  super(http, {
10508
10508
  key: "ticket_history",
@@ -10541,7 +10541,7 @@ var TicketHistoryResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10541
10541
  };
10542
10542
 
10543
10543
  // src/resources/ticket_note_attachments.ts
10544
- var TicketNoteAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10544
+ var TicketNoteAttachmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10545
10545
  constructor(http, pageSize) {
10546
10546
  super(http, {
10547
10547
  key: "ticket_note_attachments",
@@ -10603,7 +10603,7 @@ var TicketNoteAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource
10603
10603
  };
10604
10604
 
10605
10605
  // src/resources/ticket_notes.ts
10606
- var TicketNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10606
+ var TicketNotesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10607
10607
  constructor(http, pageSize) {
10608
10608
  super(http, {
10609
10609
  key: "ticket_notes",
@@ -10662,7 +10662,7 @@ var TicketNotesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10662
10662
  };
10663
10663
 
10664
10664
  // src/resources/ticket_note_webhooks.ts
10665
- var TicketNoteWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10665
+ var TicketNoteWebhooksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10666
10666
  constructor(http, pageSize) {
10667
10667
  super(http, {
10668
10668
  key: "ticket_note_webhooks",
@@ -10738,7 +10738,7 @@ var TicketNoteWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10738
10738
  };
10739
10739
 
10740
10740
  // src/resources/ticket_secondary_resources.ts
10741
- var TicketSecondaryResourcesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
10741
+ var TicketSecondaryResourcesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
10742
10742
  constructor(http, pageSize) {
10743
10743
  super(http, {
10744
10744
  key: "ticket_secondary_resources",
@@ -10803,9 +10803,9 @@ async function fetchTicket(http, id, operation) {
10803
10803
  });
10804
10804
  const body = res;
10805
10805
  if (body === null || !("item" in body)) {
10806
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10806
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10807
10807
  }
10808
- if (body.item === null || body.item === void 0) throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10808
+ if (body.item === null || body.item === void 0) throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10809
10809
  return body.item;
10810
10810
  }
10811
10811
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -10816,7 +10816,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
10816
10816
  body: { MaxRecords: maxRecords, filter },
10817
10817
  operation
10818
10818
  });
10819
- return _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res).items;
10819
+ return _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res).items;
10820
10820
  }
10821
10821
  function truncate(text, limit) {
10822
10822
  const full = _nullishCoalesce(text, () => ( ""));
@@ -10826,26 +10826,26 @@ function truncate(text, limit) {
10826
10826
 
10827
10827
  // src/resources/special/tickets/childRead.ts
10828
10828
  function isRouteUnavailable(err) {
10829
- return _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
10829
+ return _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
10830
10830
  }
10831
10831
  function routeFact(route, path, err) {
10832
10832
  return {
10833
10833
  route,
10834
10834
  path,
10835
- httpStatus: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
10835
+ httpStatus: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
10836
10836
  };
10837
10837
  }
10838
10838
  function childDeclaresQuery(resourceKey) {
10839
- return _chunk4VAC2Z55cjs.CAPABILITIES.some(
10839
+ return _chunkWBMRACCVcjs.CAPABILITIES.some(
10840
10840
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
10841
10841
  );
10842
10842
  }
10843
10843
  function planScopedPath(resourceKey, ticketId) {
10844
10844
  if (!childDeclaresQuery(resourceKey)) return null;
10845
- const entry = _chunkLVBFLSPLcjs.RELATIONSHIP_MAP[resourceKey];
10845
+ const entry = _chunk2H7YI54Bcjs.RELATIONSHIP_MAP[resourceKey];
10846
10846
  const parent = entry === void 0 ? null : entry.parent;
10847
10847
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
10848
- const parentPath = _optionalChain([_chunkLVBFLSPLcjs.RELATIONSHIP_MAP, 'access', _96 => _96[parent.resource], 'optionalAccess', _97 => _97.path]);
10848
+ const parentPath = _optionalChain([_chunk2H7YI54Bcjs.RELATIONSHIP_MAP, 'access', _96 => _96[parent.resource], 'optionalAccess', _97 => _97.path]);
10849
10849
  if (parentPath === null || parentPath === void 0) return null;
10850
10850
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
10851
10851
  }
@@ -10884,14 +10884,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
10884
10884
  break;
10885
10885
  }
10886
10886
  const body = await http.request({ method: "GET", path: target, operation });
10887
- const { items: pageItems, pageDetails } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, body, operation);
10887
+ const { items: pageItems, pageDetails } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, body, operation);
10888
10888
  nextCursor = pageDetails.nextPageUrl;
10889
10889
  pages += 1;
10890
10890
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
10891
10891
  for (const row of window) if (accept(row)) items.push(row);
10892
10892
  if (items.length >= limit) break;
10893
10893
  if (nextCursor === null || pageItems.length === 0) break;
10894
- target = _chunkLVBFLSPLcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
10894
+ target = _chunk2H7YI54Bcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
10895
10895
  }
10896
10896
  const capped = items.length >= limit || guard && nextCursor !== null;
10897
10897
  return { items, capped };
@@ -10924,7 +10924,7 @@ var MS = 864e5;
10924
10924
  var SLA_PAGE = 100;
10925
10925
  async function slaHealthCheck(_resource, id, opts = {}, http) {
10926
10926
  void opts;
10927
- const ticketId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
10927
+ const ticketId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
10928
10928
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
10929
10929
  const rows = await ticketQueryItems(
10930
10930
  http,
@@ -10949,9 +10949,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
10949
10949
  async function summary(_resource, id, opts = {}, http) {
10950
10950
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
10951
10951
  if (!Number.isInteger(limit) || limit < 1) {
10952
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
10952
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
10953
10953
  }
10954
- const ticketId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
10954
+ const ticketId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
10955
10955
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
10956
10956
  const desc = truncate(ticket.description, limit);
10957
10957
  const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
@@ -10980,11 +10980,11 @@ async function summary(_resource, id, opts = {}, http) {
10980
10980
  // src/resources/special/tickets/timeline.ts
10981
10981
  function validateTimelineLimits(opts) {
10982
10982
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
10983
- if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
10983
+ if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
10984
10984
  const bounded = Math.min(limit, 500);
10985
10985
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
10986
10986
  if (!Number.isInteger(textLimit) || textLimit < 1) {
10987
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
10987
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
10988
10988
  }
10989
10989
  return { bounded, textLimit };
10990
10990
  }
@@ -11036,7 +11036,7 @@ function compareEventDates(a, b) {
11036
11036
  }
11037
11037
  async function timeline(_resource, id, opts = {}, http) {
11038
11038
  const { bounded, textLimit } = validateTimelineLimits(opts);
11039
- const ticketId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
11039
+ const ticketId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
11040
11040
  await fetchTicket(http, ticketId, "tickets.timeline");
11041
11041
  const dateFilters = (field) => {
11042
11042
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11076,7 +11076,7 @@ async function timeline(_resource, id, opts = {}, http) {
11076
11076
  }
11077
11077
 
11078
11078
  // src/resources/special/tickets/errors.ts
11079
- var QueueRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11079
+ var QueueRequiredError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11080
11080
  constructor(message, options = {}) {
11081
11081
  super(message, {
11082
11082
  code: "QUEUE_REQUIRED",
@@ -11087,13 +11087,13 @@ var QueueRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11087
11087
  this.name = "QueueRequiredError";
11088
11088
  }
11089
11089
  };
11090
- var TicketResourceInvalidError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11090
+ var TicketResourceInvalidError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11091
11091
  constructor(message, options = {}) {
11092
11092
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11093
11093
  this.name = "TicketResourceInvalidError";
11094
11094
  }
11095
11095
  };
11096
- var TicketCreateValidationFailedError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11096
+ var TicketCreateValidationFailedError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11097
11097
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
11098
11098
 
11099
11099
  constructor(message, vendorFields, options = {}) {
@@ -11102,7 +11102,7 @@ var TicketCreateValidationFailedError = class extends _chunkLVBFLSPLcjs.Autotask
11102
11102
  this.vendorFields = vendorFields;
11103
11103
  }
11104
11104
  };
11105
- var StatusUnknownError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11105
+ var StatusUnknownError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11106
11106
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
11107
11107
 
11108
11108
  constructor(message, options = {}) {
@@ -11116,7 +11116,7 @@ var StatusUnknownError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11116
11116
  this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
11117
11117
  }
11118
11118
  };
11119
- var StatusFieldsRequiredError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11119
+ var StatusFieldsRequiredError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11120
11120
 
11121
11121
 
11122
11122
 
@@ -11139,14 +11139,14 @@ function isPositiveInt(v) {
11139
11139
  return typeof v === "number" && Number.isInteger(v) && v > 0;
11140
11140
  }
11141
11141
  function namedVendorFields(err) {
11142
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11143
- const entries = _nullishCoalesce(_chunkLVBFLSPLcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11142
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11143
+ const entries = _nullishCoalesce(_chunk2H7YI54Bcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11144
11144
  const out = /* @__PURE__ */ new Set();
11145
11145
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
11146
11146
  return [...out];
11147
11147
  }
11148
11148
  function vendorDetailOf(err) {
11149
- return _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? _chunkLVBFLSPLcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11149
+ return _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? _chunk2H7YI54Bcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11150
11150
  }
11151
11151
  async function fetchItem(http, path, operation, readOpts) {
11152
11152
  const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _98 => _98.maxRetries]) });
@@ -11167,8 +11167,8 @@ function operationId(res) {
11167
11167
  return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
11168
11168
  }
11169
11169
  function discoveryMerge(err, body, defaults) {
11170
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11171
- const entries = _chunkLVBFLSPLcjs.parseVendorErrors.call(void 0, err.vendorError);
11170
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11171
+ const entries = _chunk2H7YI54Bcjs.parseVendorErrors.call(void 0, err.vendorError);
11172
11172
  if (entries === void 0) return null;
11173
11173
  for (const entry of entries) {
11174
11174
  const field = entry.field;
@@ -11180,7 +11180,7 @@ function discoveryMerge(err, body, defaults) {
11180
11180
  }
11181
11181
  function stepErrorText(code, err) {
11182
11182
  const detail = vendorDetailOf(err);
11183
- const base = _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11183
+ const base = _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11184
11184
  return detail ? `${code}: ${detail}` : `${code}: ${base}`;
11185
11185
  }
11186
11186
 
@@ -11192,43 +11192,43 @@ var DEFAULT_PUBLISH = 1;
11192
11192
  var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
11193
11193
  var SAFE_TICKET_CREATE_DEFAULTS = {};
11194
11194
  function validateOpenInput(params, note, assign) {
11195
- const companyID = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _100 => _100.companyID]), "params.companyID");
11195
+ const companyID = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _100 => _100.companyID]), "params.companyID");
11196
11196
  const title = _optionalChain([params, 'optionalAccess', _101 => _101.title]);
11197
11197
  if (typeof title !== "string" || title.trim() === "") {
11198
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11198
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11199
11199
  }
11200
11200
  const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
11201
11201
  const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
11202
11202
  if (!isPositiveInt(priority)) {
11203
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11203
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11204
11204
  }
11205
11205
  if (!isPositiveInt(status)) {
11206
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11206
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11207
11207
  }
11208
11208
  if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
11209
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11209
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11210
11210
  }
11211
11211
  if (note !== void 0) {
11212
11212
  if (typeof note.description !== "string" || note.description.trim() === "") {
11213
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11213
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11214
11214
  }
11215
11215
  if (typeof note.title !== "string" || note.title.trim() === "") {
11216
- throw new (0, _chunkLVBFLSPLcjs.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 });
11216
+ throw new (0, _chunk2H7YI54Bcjs.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 });
11217
11217
  }
11218
11218
  if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
11219
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11219
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11220
11220
  }
11221
11221
  if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
11222
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11222
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11223
11223
  }
11224
11224
  }
11225
- const assignee = assign === void 0 ? void 0 : _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11225
+ const assignee = assign === void 0 ? void 0 : _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11226
11226
  if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
11227
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11227
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11228
11228
  }
11229
11229
  const roleID = _optionalChain([assign, 'optionalAccess', _102 => _102.roleID]);
11230
11230
  if (assign !== void 0 && !isPositiveInt(roleID)) {
11231
- throw new (0, _chunkLVBFLSPLcjs.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 });
11231
+ throw new (0, _chunk2H7YI54Bcjs.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 });
11232
11232
  }
11233
11233
  return { companyID, title, priority, status, assignee, roleID };
11234
11234
  }
@@ -11257,7 +11257,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
11257
11257
  if (assign !== void 0) {
11258
11258
  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).`);
11259
11259
  }
11260
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
11260
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
11261
11261
  {
11262
11262
  operation: OP_OPEN,
11263
11263
  method: "POST",
@@ -11297,8 +11297,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11297
11297
  `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}` : ""}`,
11298
11298
  {
11299
11299
  operation: OP_OPEN,
11300
- httpStatus: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11301
- vendorError: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11300
+ httpStatus: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11301
+ vendorError: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11302
11302
  }
11303
11303
  );
11304
11304
  }
@@ -11313,8 +11313,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11313
11313
  named,
11314
11314
  {
11315
11315
  operation: OP_OPEN,
11316
- httpStatus: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11317
- vendorError: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11316
+ httpStatus: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11317
+ vendorError: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11318
11318
  resourceIds: [companyID],
11319
11319
  details: { idRefs: [{ entity: "company", id: companyID }] }
11320
11320
  }
@@ -11339,10 +11339,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
11339
11339
  try {
11340
11340
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
11341
11341
  if (current === null) {
11342
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11342
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11343
11343
  }
11344
11344
  ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
11345
- const merged = _chunkLVBFLSPLcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11345
+ const merged = _chunk2H7YI54Bcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11346
11346
  merged.id = ticketId;
11347
11347
  await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
11348
11348
  assigned = true;
@@ -11406,7 +11406,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11406
11406
  const ids2 = await readLiveStatusSet(resource);
11407
11407
  if (ids2.size > 0) liveStatus = ids2;
11408
11408
  } catch (err) {
11409
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11409
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11410
11410
  }
11411
11411
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
11412
11412
  _optionalChain([http, 'access', _103 => _103.fieldCache, 'optionalAccess', _104 => _104.invalidate, 'call', _105 => _105("tickets")]);
@@ -11416,7 +11416,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11416
11416
  const freshIds = await readLiveStatusSet(resource);
11417
11417
  if (freshIds.size > 0) freshStatus = freshIds;
11418
11418
  } catch (err) {
11419
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11419
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11420
11420
  freshStatus = null;
11421
11421
  reReadFailed = true;
11422
11422
  }
@@ -11434,7 +11434,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11434
11434
  return { guardDegraded: liveStatus === null };
11435
11435
  }
11436
11436
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
11437
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
11437
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
11438
11438
  {
11439
11439
  operation: OP_STATUS,
11440
11440
  method: "PUT",
@@ -11488,7 +11488,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11488
11488
  if (mapEntry === void 0) {
11489
11489
  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).`);
11490
11490
  }
11491
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
11491
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
11492
11492
  {
11493
11493
  operation: OP_STATUS,
11494
11494
  method: "PUT",
@@ -11508,7 +11508,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11508
11508
  }
11509
11509
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
11510
11510
  const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _108 => _108.safeDefaults]), () => ( {}));
11511
- const body = _chunkLVBFLSPLcjs.mergePartialBody.call(void 0, current, mergeData);
11511
+ const body = _chunk2H7YI54Bcjs.mergePartialBody.call(void 0, current, mergeData);
11512
11512
  body.id = ticketId;
11513
11513
  let merges = 0;
11514
11514
  for (; ; ) {
@@ -11532,8 +11532,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11532
11532
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
11533
11533
  {
11534
11534
  operation: OP_STATUS,
11535
- httpStatus: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11536
- vendorError: _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11535
+ httpStatus: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11536
+ vendorError: _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11537
11537
  resourceIds: [ticketId],
11538
11538
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
11539
11539
  }
@@ -11546,7 +11546,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11546
11546
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11547
11547
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11548
11548
  if (verify === null) {
11549
- throw new (0, _chunkLVBFLSPLcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11549
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11550
11550
  code: "INVALID_RESPONSE",
11551
11551
  category: "server",
11552
11552
  operation: OP_STATUS,
@@ -11556,7 +11556,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11556
11556
  }
11557
11557
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
11558
11558
  if (finalStatus !== targetStatus) {
11559
- throw new (0, _chunkLVBFLSPLcjs.AutotaskError)(
11559
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
11560
11560
  `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)`,
11561
11561
  {
11562
11562
  code: "INVALID_RESPONSE",
@@ -11571,17 +11571,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11571
11571
  }
11572
11572
  }
11573
11573
  async function changeStatus(resource, id, targetStatus, fields, opts, http) {
11574
- const ticketId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
11574
+ const ticketId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
11575
11575
  if (!isPositiveInt(targetStatus)) {
11576
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
11576
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
11577
11577
  }
11578
11578
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
11579
11579
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
11580
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
11580
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
11581
11581
  }
11582
11582
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11583
11583
  if (current === null) {
11584
- throw new (0, _chunkLVBFLSPLcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11584
+ throw new (0, _chunk2H7YI54Bcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11585
11585
  }
11586
11586
  const previousStatus = typeof current.status === "number" ? current.status : null;
11587
11587
  if (previousStatus === targetStatus) {
@@ -11601,7 +11601,7 @@ var DEFAULT_PART_LIMIT = 50;
11601
11601
  function partLimit(value, name) {
11602
11602
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
11603
11603
  if (!Number.isInteger(n) || n < 1) {
11604
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
11604
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
11605
11605
  }
11606
11606
  return n;
11607
11607
  }
@@ -11614,7 +11614,7 @@ function servedTextRecord(row, textField, limit) {
11614
11614
  return out;
11615
11615
  }
11616
11616
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
11617
- const builder = _chunkLVBFLSPLcjs.createNamePlan.call(void 0, _chunkLVBFLSPLcjs.TICKET_LABEL_FIELDS);
11617
+ const builder = _chunk2H7YI54Bcjs.createNamePlan.call(void 0, _chunk2H7YI54Bcjs.TICKET_LABEL_FIELDS);
11618
11618
  const t = ctx.ticket;
11619
11619
  builder.addResource(t["creatorResourceID"]);
11620
11620
  builder.addFk("contract", t["contractID"]);
@@ -11626,20 +11626,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
11626
11626
  builder.addFk("billingCode", e["billingCodeID"]);
11627
11627
  builder.addFk("contract", e["contractID"]);
11628
11628
  }
11629
- const names = await _chunkLVBFLSPLcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
11629
+ const names = await _chunk2H7YI54Bcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
11630
11630
  const ticketRow = { ...ctx.ticket };
11631
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
11632
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
11633
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
11634
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
11635
- for (const f of _chunkLVBFLSPLcjs.TICKET_LABEL_FIELDS) _chunkLVBFLSPLcjs.addLabelSibling.call(void 0, ticketRow, f, names);
11631
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
11632
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
11633
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
11634
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
11635
+ for (const f of _chunk2H7YI54Bcjs.TICKET_LABEL_FIELDS) _chunk2H7YI54Bcjs.addLabelSibling.call(void 0, ticketRow, f, names);
11636
11636
  result.ticket = ticketRow;
11637
11637
  result.timeEntries.items = entriesPart.items.map((e) => {
11638
11638
  const row = { ...e };
11639
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
11640
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
11641
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
11642
- _chunkLVBFLSPLcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
11639
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
11640
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
11641
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
11642
+ _chunk2H7YI54Bcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
11643
11643
  return row;
11644
11644
  });
11645
11645
  result.names = names.section;
@@ -11649,7 +11649,7 @@ async function fullContext(resource, id, opts = {}, http) {
11649
11649
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
11650
11650
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
11651
11651
  const textLimit = partLimit(opts.textLimit, "textLimit");
11652
- const ticketId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
11652
+ const ticketId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
11653
11653
  const ctx = await resource.getContext(ticketId);
11654
11654
  const op = "tickets.fullContext";
11655
11655
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11707,7 +11707,7 @@ async function fullContext(resource, id, opts = {}, http) {
11707
11707
  }
11708
11708
 
11709
11709
  // src/resources/tickets.ts
11710
- var TicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
11710
+ var TicketsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
11711
11711
  constructor(http, pageSize) {
11712
11712
  super(http, {
11713
11713
  key: "tickets",
@@ -11814,7 +11814,7 @@ var TicketsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
11814
11814
  };
11815
11815
 
11816
11816
  // src/resources/ticket_webhooks.ts
11817
- var TicketWebhooksResource = class extends _chunkLVBFLSPLcjs.BaseResource {
11817
+ var TicketWebhooksResource = class extends _chunk2H7YI54Bcjs.BaseResource {
11818
11818
  constructor(http, pageSize) {
11819
11819
  super(http, {
11820
11820
  key: "ticket_webhooks",
@@ -11900,7 +11900,7 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
11900
11900
  body: { MaxRecords: limit, filter },
11901
11901
  operation
11902
11902
  });
11903
- const { items, pageDetails } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res);
11903
+ const { items, pageDetails } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res);
11904
11904
  return { items, hasMore: pageDetails.nextPageUrl != null };
11905
11905
  }
11906
11906
  async function windowQuery3(_resource, kind, http, opts) {
@@ -11919,7 +11919,7 @@ async function customRange3(_resource, from, to, http, opts) {
11919
11919
  const fromB = customRangeDay(from, "from", void 0, "customRange");
11920
11920
  const toB = customRangeDay(to, "to", void 0, "customRange");
11921
11921
  if (fromB.ms > toB.ms) {
11922
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("customRange: from must not be after to");
11922
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("customRange: from must not be after to");
11923
11923
  }
11924
11924
  const toEndMs = toB.ms + DAY_MS2 - 1;
11925
11925
  const filter = [
@@ -11944,7 +11944,7 @@ async function postedWithin(_resource, from, to, http, opts, opLabel = "time_ent
11944
11944
  const fromB = customRangeDay(from, "from", void 0, OP6);
11945
11945
  const toB = customRangeDay(to, "to", void 0, OP6);
11946
11946
  if (fromB.ms > toB.ms) {
11947
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${OP6}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP6 });
11947
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${OP6}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP6 });
11948
11948
  }
11949
11949
  const windowToMs = toB.ms + DAY_MS2 - 1;
11950
11950
  const filter = [
@@ -11978,13 +11978,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
11978
11978
  }
11979
11979
 
11980
11980
  // src/resources/special/time_entries/errors.ts
11981
- var ResourceInvalidError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11981
+ var ResourceInvalidError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11982
11982
  constructor(message, options = {}) {
11983
11983
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11984
11984
  this.name = "ResourceInvalidError";
11985
11985
  }
11986
11986
  };
11987
- var AllocationCodeError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11987
+ var AllocationCodeError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11988
11988
  /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
11989
11989
 
11990
11990
  constructor(kind, message, options = {}) {
@@ -11993,7 +11993,7 @@ var AllocationCodeError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11993
11993
  this.kind = kind;
11994
11994
  }
11995
11995
  };
11996
- var NoApplicableAllocationCodeError = class extends _chunkLVBFLSPLcjs.AutotaskError {
11996
+ var NoApplicableAllocationCodeError = class extends _chunk2H7YI54Bcjs.AutotaskError {
11997
11997
  /** The structured blocker details (filters tried + department sets). */
11998
11998
 
11999
11999
  constructor(details, options = {}) {
@@ -12058,7 +12058,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12058
12058
  let pages = 0;
12059
12059
  for (; ; ) {
12060
12060
  if (pages >= PAGE_GUARD) {
12061
- throw new (0, _chunkLVBFLSPLcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12061
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12062
12062
  code: "RESOLUTION_TRUNCATED",
12063
12063
  category: "resolution",
12064
12064
  operation,
@@ -12069,11 +12069,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12069
12069
  const res = await http.request({
12070
12070
  method: "POST",
12071
12071
  idempotent: true,
12072
- path: isFirst ? path : _chunkLVBFLSPLcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12072
+ path: isFirst ? path : _chunk2H7YI54Bcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12073
12073
  body: { MaxRecords: pageSize, filter },
12074
12074
  operation
12075
12075
  });
12076
- const { items: pageItems, pageDetails } = _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, operation);
12076
+ const { items: pageItems, pageDetails } = _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, operation);
12077
12077
  items.push(...pageItems);
12078
12078
  pages += 1;
12079
12079
  if (items.length >= totalCap) break;
@@ -12190,7 +12190,7 @@ function windowDefaults(params) {
12190
12190
  var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
12191
12191
  var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
12192
12192
  function validateCreateParams(params) {
12193
- const pin = (value, label) => typeof value === "number" ? _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, value, label) : void 0;
12193
+ const pin = (value, label) => typeof value === "number" ? _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, value, label) : void 0;
12194
12194
  const pins = {
12195
12195
  code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
12196
12196
  ticket: pin(params.ticketID, "ticketID"),
@@ -12199,19 +12199,19 @@ function validateCreateParams(params) {
12199
12199
  };
12200
12200
  const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
12201
12201
  if (pinCount > 1) {
12202
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
12202
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
12203
12203
  "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)",
12204
12204
  { operation: OP3 }
12205
12205
  );
12206
12206
  }
12207
12207
  if (pins.role !== void 0 && pins.code !== void 0) {
12208
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
12208
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
12209
12209
  "createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
12210
12210
  { operation: OP3 }
12211
12211
  );
12212
12212
  }
12213
12213
  if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
12214
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(
12214
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
12215
12215
  `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
12216
12216
  { operation: OP3 }
12217
12217
  );
@@ -12294,7 +12294,7 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
12294
12294
  if (usedLinkage === "internal" && linkage === "task") {
12295
12295
  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).");
12296
12296
  }
12297
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0,
12297
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0,
12298
12298
  {
12299
12299
  operation: OP3,
12300
12300
  method: "POST",
@@ -12334,7 +12334,7 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12334
12334
  };
12335
12335
  } catch (err) {
12336
12336
  lastError = err;
12337
- const text = _chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkLVBFLSPLcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12337
+ const text = _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunk2H7YI54Bcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12338
12338
  const gate3 = ROLE_REJECTION_PATTERN.test(text);
12339
12339
  if (usedLinkage !== "internal" && gate3) {
12340
12340
  if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
@@ -12354,13 +12354,13 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12354
12354
  throw err;
12355
12355
  }
12356
12356
  }
12357
- if (_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, lastError)) {
12357
+ if (_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, lastError)) {
12358
12358
  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.`;
12359
12359
  }
12360
12360
  throw lastError;
12361
12361
  }
12362
12362
  async function createForResource(resource, resourceID, params, opts = {}, http) {
12363
- const rid = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12363
+ const rid = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12364
12364
  const pins = validateCreateParams(params);
12365
12365
  await assertResourceActive(http, rid);
12366
12366
  const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
@@ -12373,8 +12373,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
12373
12373
  return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
12374
12374
  }
12375
12375
  function discoveryField(err, body, defaults) {
12376
- if (!_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12377
- const entries = _chunkLVBFLSPLcjs.parseVendorErrors.call(void 0, err.vendorError);
12376
+ if (!_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12377
+ const entries = _chunk2H7YI54Bcjs.parseVendorErrors.call(void 0, err.vendorError);
12378
12378
  if (entries === void 0) return null;
12379
12379
  for (const entry of entries) {
12380
12380
  const field = entry.field;
@@ -12395,7 +12395,7 @@ async function readTimeEntry(http, id, retries) {
12395
12395
  const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP4, maxRetries: retries });
12396
12396
  return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _123 => _123.item]), () => ( null));
12397
12397
  } catch (e) {
12398
- if (_chunkLVBFLSPLcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
12398
+ if (_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
12399
12399
  throw e;
12400
12400
  }
12401
12401
  }
@@ -12464,13 +12464,13 @@ var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResource
12464
12464
  function positiveId(value, name) {
12465
12465
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12466
12466
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12467
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
12467
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
12468
12468
  }
12469
12469
  return n;
12470
12470
  }
12471
12471
  async function recentTickets(_resource, from, to, http, opts) {
12472
12472
  if (opts === void 0 || opts === null || typeof opts !== "object") {
12473
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${OP5}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP5 });
12473
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${OP5}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP5 });
12474
12474
  }
12475
12475
  const resourceID = positiveId(opts.resourceID, "resourceID");
12476
12476
  const companyID = opts.companyID === void 0 ? void 0 : positiveId(opts.companyID, "companyID");
@@ -12478,7 +12478,7 @@ async function recentTickets(_resource, from, to, http, opts) {
12478
12478
  const fromB = customRangeDay(from, "from", void 0, OP5);
12479
12479
  const toB = customRangeDay(to, "to", void 0, OP5);
12480
12480
  if (fromB.ms > toB.ms) {
12481
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)(`${OP5}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP5 });
12481
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`${OP5}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP5 });
12482
12482
  }
12483
12483
  const windowToMs = toB.ms + DAY_MS3 - 1;
12484
12484
  const { items: entries, hasMore } = await queryTimeEntries(
@@ -12517,7 +12517,7 @@ async function recentTickets(_resource, from, to, http, opts) {
12517
12517
  body: { MaxRecords: TICKET_CHUNK, filter, IncludeFields: TICKET_FIELDS2 },
12518
12518
  operation: OP5
12519
12519
  });
12520
- for (const t of _chunkLVBFLSPLcjs.unwrapItems.call(void 0, res, OP5).items) if (typeof t.id === "number") tickets.set(t.id, t);
12520
+ for (const t of _chunk2H7YI54Bcjs.unwrapItems.call(void 0, res, OP5).items) if (typeof t.id === "number") tickets.set(t.id, t);
12521
12521
  }
12522
12522
  const items = [];
12523
12523
  const unresolvedTicketIDs = [];
@@ -12554,7 +12554,7 @@ async function recentTickets(_resource, from, to, http, opts) {
12554
12554
  }
12555
12555
 
12556
12556
  // src/resources/time_entries.ts
12557
- var TimeEntriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
12557
+ var TimeEntriesResource = class extends _chunk2H7YI54Bcjs.BaseResource {
12558
12558
  constructor(http, pageSize) {
12559
12559
  super(http, {
12560
12560
  key: "time_entries",
@@ -12699,7 +12699,7 @@ var TimeEntriesResource = class extends _chunkLVBFLSPLcjs.BaseResource {
12699
12699
  };
12700
12700
 
12701
12701
  // src/resources/time_entry_attachments.ts
12702
- var TimeEntryAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
12702
+ var TimeEntryAttachmentsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
12703
12703
  constructor(http, pageSize) {
12704
12704
  super(http, {
12705
12705
  key: "time_entry_attachments",
@@ -12762,9 +12762,9 @@ var TimeEntryAttachmentsResource = class extends _chunkLVBFLSPLcjs.BaseResource
12762
12762
 
12763
12763
  // src/resources/special/time_off_requests.ts
12764
12764
  async function approve(_resource, id, opts = {}, http) {
12765
- const numericId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
12765
+ const numericId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
12766
12766
  if (opts.dryRun === true) {
12767
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
12767
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
12768
12768
  operation: "time_off_requests.approve",
12769
12769
  method: "GET",
12770
12770
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -12780,16 +12780,16 @@ async function approve(_resource, id, opts = {}, http) {
12780
12780
  operation: "time_off_requests.approve",
12781
12781
  maxRetries: opts.maxRetries
12782
12782
  });
12783
- return _chunkLVBFLSPLcjs.unwrapOperation.call(void 0, res);
12783
+ return _chunk2H7YI54Bcjs.unwrapOperation.call(void 0, res);
12784
12784
  }
12785
12785
  async function reject(_resource, id, reason, opts = {}, http) {
12786
- const numericId = _chunkLVBFLSPLcjs.parseIdentifier.call(void 0, id, "id");
12786
+ const numericId = _chunk2H7YI54Bcjs.parseIdentifier.call(void 0, id, "id");
12787
12787
  const text = reason.trim();
12788
12788
  if (text === "") {
12789
- throw new (0, _chunkLVBFLSPLcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
12789
+ throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
12790
12790
  }
12791
12791
  if (opts.dryRun === true) {
12792
- return _chunkLVBFLSPLcjs.buildDryRunResult.call(void 0, {
12792
+ return _chunk2H7YI54Bcjs.buildDryRunResult.call(void 0, {
12793
12793
  operation: "time_off_requests.reject",
12794
12794
  method: "POST",
12795
12795
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -12807,11 +12807,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
12807
12807
  operation: "time_off_requests.reject",
12808
12808
  maxRetries: opts.maxRetries
12809
12809
  });
12810
- return _chunkLVBFLSPLcjs.unwrapOperation.call(void 0, res);
12810
+ return _chunk2H7YI54Bcjs.unwrapOperation.call(void 0, res);
12811
12811
  }
12812
12812
 
12813
12813
  // src/resources/time_off_requests.ts
12814
- var TimeOffRequestsResource = class extends _chunkLVBFLSPLcjs.BaseResource {
12814
+ var TimeOffRequestsResource = class extends _chunk2H7YI54Bcjs.BaseResource {
12815
12815
  constructor(http, pageSize) {
12816
12816
  super(http, {
12817
12817
  key: "time_off_requests",