node-autotask 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/MCP_TOOL_CATALOG.json +941 -14
  3. package/MCP_TOOL_MANIFEST.md +71 -16
  4. package/N8N_MCP_MANIFEST.json +91 -10
  5. package/N8N_MCP_MANIFEST.md +14 -11
  6. package/README.md +11 -9
  7. package/capabilities.json +13623 -7738
  8. package/capabilities.schema.json +125 -0
  9. package/dist/capabilities.cjs +2 -2
  10. package/dist/capabilities.js +1 -1
  11. package/dist/{chunk-QXWIQ67O.js → chunk-6EQSXYRW.js} +13622 -7737
  12. package/dist/{chunk-HQGE4WAV.cjs → chunk-D5IVS6GY.cjs} +1054 -235
  13. package/dist/{chunk-5OGJTS2E.cjs → chunk-GUY2KK7U.cjs} +157 -136
  14. package/dist/{chunk-SSUECUVN.js → chunk-IRVZGW5K.js} +947 -128
  15. package/dist/{chunk-7DOSJS6S.js → chunk-O2D7KDDD.js} +23 -2
  16. package/dist/{chunk-VVQ6NJYZ.js → chunk-SYX6EWMT.js} +694 -76
  17. package/dist/{chunk-SG4LIVMG.cjs → chunk-WYKGD5UD.cjs} +1189 -571
  18. package/dist/{chunk-WM6E5O55.cjs → chunk-ZEGMVEF3.cjs} +13622 -7737
  19. package/dist/{index-CKYr0unq.d.cts → index-CORcZUNm.d.cts} +457 -50
  20. package/dist/{index-1zBdJIEy.d.cts → index-DQ9NgraW.d.cts} +281 -1
  21. package/dist/{index-1zBdJIEy.d.ts → index-DQ9NgraW.d.ts} +281 -1
  22. package/dist/{index-C8QH3BkP.d.ts → index-DXuV04zM.d.ts} +457 -50
  23. package/dist/index.cjs +44 -24
  24. package/dist/index.d.cts +11 -5
  25. package/dist/index.d.ts +11 -5
  26. package/dist/index.js +26 -6
  27. package/dist/operations/index.cjs +147 -120
  28. package/dist/operations/index.d.cts +136 -7
  29. package/dist/operations/index.d.ts +136 -7
  30. package/dist/operations/index.js +33 -6
  31. package/dist/pool.cjs +42 -9
  32. package/dist/pool.d.cts +14 -3
  33. package/dist/pool.d.ts +14 -3
  34. package/dist/pool.js +38 -5
  35. package/dist/resources/index.cjs +19 -5
  36. package/dist/resources/index.d.cts +2 -2
  37. package/dist/resources/index.d.ts +2 -2
  38. package/dist/resources/index.js +18 -4
  39. package/dist/types/index.cjs +1 -1
  40. package/dist/types/index.d.cts +1 -1
  41. package/dist/types/index.d.ts +1 -1
  42. package/dist/types/index.js +1 -1
  43. package/docs/API.md +246 -10
  44. package/examples/mcp/schemas.ts +16 -7
  45. package/package.json +1 -1
  46. /package/dist/{chunk-S643FDOR.cjs → chunk-IXF7AKOJ.cjs} +0 -0
  47. /package/dist/{chunk-2TWKEB2L.js → chunk-RMG55JTF.js} +0 -0
  48. /package/dist/{chunk-W3K5BEVY.cjs → chunk-SDYRQFGL.cjs} +0 -0
  49. /package/dist/{chunk-EBCHCNPK.js → chunk-WLTLB2ND.js} +0 -0
@@ -38,13 +38,13 @@
38
38
 
39
39
 
40
40
 
41
- var _chunkHQGE4WAVcjs = require('./chunk-HQGE4WAV.cjs');
41
+ var _chunkD5IVS6GYcjs = require('./chunk-D5IVS6GY.cjs');
42
42
 
43
43
 
44
- var _chunkWM6E5O55cjs = require('./chunk-WM6E5O55.cjs');
44
+ var _chunkZEGMVEF3cjs = require('./chunk-ZEGMVEF3.cjs');
45
45
 
46
46
  // src/resources/appointments.ts
47
- var AppointmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
47
+ var AppointmentsResource = class extends _chunkD5IVS6GYcjs.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 _chunkHQGE4WAVcjs.BaseResource {
132
+ var BillingCodesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
133
133
  constructor(http, pageSize) {
134
134
  super(http, {
135
135
  key: "billing_codes",
@@ -172,6 +172,42 @@ var BillingCodesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
172
172
  }
173
173
  };
174
174
 
175
+ // src/resources/billing_item_approval_levels.ts
176
+ var BillingItemApprovalLevelsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
177
+ constructor(http, pageSize) {
178
+ super(http, {
179
+ key: "billing_item_approval_levels",
180
+ resourcePath: "/V1.0/BillingItemApprovalLevels",
181
+ deletable: false,
182
+ udfCapable: false
183
+ }, pageSize);
184
+ }
185
+ /** Query BillingItemApprovalLevel records with the G3 filter surface (server-side JSON filter). */
186
+ query(params) {
187
+ return this.queryItems(params);
188
+ }
189
+ /** Get every BillingItemApprovalLevel record (the MCP-preferred read; 1000-page guarded). */
190
+ async queryAll(params) {
191
+ return this.queryAllItems(params);
192
+ }
193
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
194
+ async count(params) {
195
+ return this.countGlobal(params);
196
+ }
197
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
198
+ async get(id) {
199
+ return this.getGlobal(id);
200
+ }
201
+ /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the
202
+ * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the
203
+ * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;
204
+ * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */
205
+ async create(data, opts = {}) {
206
+ if (opts.dryRun === true) return this.runCreateDryRun(data);
207
+ return this.createGlobal(data, opts);
208
+ }
209
+ };
210
+
175
211
  // src/resources/special/dateWindow.ts
176
212
  var DAY_MS = 864e5;
177
213
  var DEFAULT_LIMIT = 500;
@@ -179,7 +215,7 @@ var MAX_LIMIT = 500;
179
215
  function clampWindowLimit(limit) {
180
216
  const n = limit === void 0 ? DEFAULT_LIMIT : Math.trunc(limit);
181
217
  if (!Number.isInteger(n) || n < 1) {
182
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
218
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
183
219
  }
184
220
  return Math.min(n, MAX_LIMIT);
185
221
  }
@@ -225,7 +261,7 @@ function wallParts(tz, ms) {
225
261
  }
226
262
  }
227
263
  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, _chunkHQGE4WAVcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
264
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`dateWindow: could not read the wall-clock parts for timezone "${tz}" (the Intl format returned an incomplete or unmapped part)`);
229
265
  }
230
266
  return { y: w.y, m: w.m, d: w.d, h: w.h, mi: w.mi, s: w.s, weekday };
231
267
  }
@@ -252,7 +288,7 @@ function localDayEndMs(y, m, d, tz) {
252
288
  }
253
289
  function validateZone(tz, opName = "dateWindow") {
254
290
  if (typeof tz !== "string" || tz.length === 0) {
255
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
291
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
256
292
  `${opName}: tz must be a non-empty IANA timezone string (got ${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
257
293
  { operation: opName }
258
294
  );
@@ -260,7 +296,7 @@ function validateZone(tz, opName = "dateWindow") {
260
296
  try {
261
297
  new Intl.DateTimeFormat("en-US", { timeZone: tz });
262
298
  } catch (e2) {
263
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
299
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
264
300
  `${opName}: tz is not a valid IANA timezone (${JSON.stringify(tz)}; e.g. 'Australia/Sydney' \u2014 omitted tz = UTC)`,
265
301
  { operation: opName }
266
302
  );
@@ -420,13 +456,13 @@ async function dateWindowQuery(http, path, field, kind, limit, operation, now, t
420
456
  body: { MaxRecords: limit, filter },
421
457
  operation
422
458
  });
423
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
459
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
424
460
  }
425
461
  var isoUtc = (ms) => new Date(ms).toISOString().slice(0, 19) + "Z";
426
462
  function customRangeDay(value, label, zone, opName) {
427
463
  const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
428
464
  if (!m) {
429
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
465
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
430
466
  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
467
  { operation: opName }
432
468
  );
@@ -438,7 +474,7 @@ function customRangeDay(value, label, zone, opName) {
438
474
  const real = probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
439
475
  const ms = !real ? NaN : zone === void 0 ? Date.UTC(y, mo - 1, d) : localDayStartMs(y, mo, d, zone);
440
476
  if (!Number.isFinite(ms)) {
441
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
477
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
442
478
  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
479
  { operation: opName }
444
480
  );
@@ -449,7 +485,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
449
485
  const fromB = customRangeDay(from, "from", zone, operation);
450
486
  const toB = customRangeDay(to, "to", zone, operation);
451
487
  if (fromB.ms > toB.ms) {
452
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
488
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
453
489
  `${operation}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`,
454
490
  { operation }
455
491
  );
@@ -466,7 +502,7 @@ async function customRangeQuery(http, path, field, from, to, limit, operation, z
466
502
  body: { MaxRecords: limit, filter },
467
503
  operation
468
504
  });
469
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
505
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
470
506
  }
471
507
 
472
508
  // src/resources/special/billing_items.ts
@@ -499,7 +535,7 @@ async function customRange(_resource, from, to, http, opts) {
499
535
  }
500
536
 
501
537
  // src/resources/billing_items.ts
502
- var BillingItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
538
+ var BillingItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
503
539
  constructor(http, pageSize) {
504
540
  super(http, {
505
541
  key: "billing_items",
@@ -601,7 +637,7 @@ var BillingItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
601
637
  };
602
638
 
603
639
  // src/resources/change_request_links.ts
604
- var ChangeRequestLinksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
640
+ var ChangeRequestLinksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
605
641
  constructor(http, pageSize) {
606
642
  super(http, {
607
643
  key: "change_request_links",
@@ -655,7 +691,7 @@ var ChangeRequestLinksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
655
691
  };
656
692
 
657
693
  // src/resources/checklist_libraries.ts
658
- var ChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
694
+ var ChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
659
695
  constructor(http, pageSize) {
660
696
  super(http, {
661
697
  key: "checklist_libraries",
@@ -729,7 +765,7 @@ var ChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
729
765
  };
730
766
 
731
767
  // src/resources/checklist_library_checklist_items.ts
732
- var ChecklistLibraryChecklistItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
768
+ var ChecklistLibraryChecklistItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
733
769
  constructor(http, pageSize) {
734
770
  super(http, {
735
771
  key: "checklist_library_checklist_items",
@@ -795,7 +831,7 @@ var ChecklistLibraryChecklistItemsResource = class extends _chunkHQGE4WAVcjs.Bas
795
831
  };
796
832
 
797
833
  // src/resources/classification_icons.ts
798
- var ClassificationIconsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
834
+ var ClassificationIconsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
799
835
  constructor(http, pageSize) {
800
836
  super(http, {
801
837
  key: "classification_icons",
@@ -902,7 +938,7 @@ async function boundedPart(http, path, conditions, limit, operation, includeFiel
902
938
  body,
903
939
  operation
904
940
  });
905
- const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
941
+ const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
906
942
  const capped = items.length >= limit;
907
943
  return { items, capped, hasMore: capped && pageDetails.nextPageUrl != null };
908
944
  }
@@ -912,7 +948,7 @@ var DEFAULT_LIMIT2 = 25;
912
948
  var MAX_LIMIT2 = 500;
913
949
  function clampLimit(limit) {
914
950
  const n = limit === void 0 ? DEFAULT_LIMIT2 : Math.trunc(limit);
915
- if (!Number.isInteger(n) || n < 1) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
951
+ if (!Number.isInteger(n) || n < 1) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(limit)})`);
916
952
  return Math.min(n, MAX_LIMIT2);
917
953
  }
918
954
 
@@ -925,7 +961,7 @@ async function queryCompanies(http, filter, limit) {
925
961
  body: { MaxRecords: limit, filter },
926
962
  operation: "companies.searchByDomain"
927
963
  });
928
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
964
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
929
965
  }
930
966
  async function queryContacts(http, filter, limit) {
931
967
  const res = await http.request({
@@ -935,7 +971,7 @@ async function queryContacts(http, filter, limit) {
935
971
  body: { MaxRecords: limit, filter },
936
972
  operation: "companies.searchByDomain"
937
973
  });
938
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
974
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
939
975
  }
940
976
  async function fetchCompanies(http, ids2, limit) {
941
977
  const out = [];
@@ -950,7 +986,7 @@ async function fetchCompanies(http, ids2, limit) {
950
986
  const item = body && "item" in body ? body.item : null;
951
987
  if (item) out.push(item);
952
988
  } catch (err) {
953
- if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) continue;
989
+ if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) continue;
954
990
  throw err;
955
991
  }
956
992
  }
@@ -958,7 +994,7 @@ async function fetchCompanies(http, ids2, limit) {
958
994
  }
959
995
  async function searchByDomain(_resource, domain, opts = {}, http) {
960
996
  const text = domain.trim();
961
- if (text === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("searchByDomain: empty domain");
997
+ if (text === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("searchByDomain: empty domain");
962
998
  const limit = clampLimit(opts.limit);
963
999
  const filter = [{ field: "webAddress", op: "contains", value: text }];
964
1000
  const direct = await queryCompanies(http, filter, limit);
@@ -972,7 +1008,7 @@ async function searchByIdentity(_resource, identity, opts = {}, http) {
972
1008
  const email = _nullishCoalesce(_optionalChain([identity, 'access', _12 => _12.email, 'optionalAccess', _13 => _13.trim, 'call', _14 => _14()]), () => ( ""));
973
1009
  const website = _nullishCoalesce(_optionalChain([identity, 'access', _15 => _15.website, 'optionalAccess', _16 => _16.trim, 'call', _17 => _17()]), () => ( ""));
974
1010
  if (name === "" && email === "" && website === "") {
975
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
1011
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("searchByIdentity: at least one of companyName / email / website is required");
976
1012
  }
977
1013
  const limit = clampLimit(opts.limit);
978
1014
  const found = /* @__PURE__ */ new Map();
@@ -1001,23 +1037,23 @@ async function familyChildPage(http, parentID) {
1001
1037
  path: "/V1.0/Companies/query",
1002
1038
  body: {
1003
1039
  MaxRecords: COMPANIES_FAMILY_CHILD_CAP,
1004
- filter: _chunkHQGE4WAVcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1040
+ filter: _chunkD5IVS6GYcjs.buildFilter.call(void 0, [{ field: "parentCompanyID", op: "eq", value: parentID }]).filter
1005
1041
  },
1006
1042
  operation: "companies.search"
1007
1043
  });
1008
- const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "companies.search");
1044
+ const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "companies.search");
1009
1045
  return { rows: items, hasNext: pageDetails.nextPageUrl !== null };
1010
1046
  }
1011
1047
  function assertSearchWithDetailOpts(opts) {
1012
1048
  if (opts === void 0) return;
1013
1049
  if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
1014
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1050
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("companies.searchWithDetail: opts must be an object { limit?: number }", {
1015
1051
  operation: "companies.searchWithDetail"
1016
1052
  });
1017
1053
  }
1018
1054
  for (const key of Object.keys(opts)) {
1019
1055
  if (key !== "limit") {
1020
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
1056
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1021
1057
  `companies.searchWithDetail: unknown opts key "${key}" \u2014 the bag is closed: limit (includeFamily is a companies.search option)`,
1022
1058
  { operation: "companies.searchWithDetail" }
1023
1059
  );
@@ -1026,32 +1062,32 @@ function assertSearchWithDetailOpts(opts) {
1026
1062
  }
1027
1063
  async function searchWithFamily(_resource, query, opts = {}, http) {
1028
1064
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1029
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1065
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("companies.search: opts must be an object { limit?: number, includeFamily?: boolean }");
1030
1066
  }
1031
1067
  for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
1032
1068
  if (!COMPANY_SEARCH_OPT_KEYS.includes(key)) {
1033
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
1069
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1034
1070
  `companies.search: unknown opts key "${key}" \u2014 the bag is closed: ${COMPANY_SEARCH_OPT_KEYS.join(", ")}`,
1035
1071
  { operation: "companies.search" }
1036
1072
  );
1037
1073
  }
1038
1074
  }
1039
1075
  if (opts.includeFamily !== void 0 && typeof opts.includeFamily !== "boolean") {
1040
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1076
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`companies.search: opts.includeFamily must be a boolean (got ${String(opts.includeFamily)})`, {
1041
1077
  operation: "companies.search"
1042
1078
  });
1043
1079
  }
1044
1080
  const text = query.trim();
1045
- if (text === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1046
- const limit = opts.limit === void 0 ? 25 : _chunkHQGE4WAVcjs.clampPageSize.call(void 0, opts.limit);
1081
+ if (text === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("search: empty query", { operation: "companies.search" });
1082
+ const limit = opts.limit === void 0 ? 25 : _chunkD5IVS6GYcjs.clampPageSize.call(void 0, opts.limit);
1047
1083
  const res = await http.request({
1048
1084
  method: "POST",
1049
1085
  idempotent: true,
1050
1086
  path: "/V1.0/Companies/query",
1051
- body: { MaxRecords: limit, filter: _chunkHQGE4WAVcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1087
+ body: { MaxRecords: limit, filter: _chunkD5IVS6GYcjs.buildFilter.call(void 0, [{ field: "companyName", op: "contains", value: text }]).filter },
1052
1088
  operation: "companies.search"
1053
1089
  });
1054
- const hits = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "companies.search").items;
1090
+ const hits = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "companies.search").items;
1055
1091
  if (opts.includeFamily !== true) return hits;
1056
1092
  const rows = [];
1057
1093
  for (const hit of hits) {
@@ -1071,7 +1107,7 @@ async function searchWithFamily(_resource, query, opts = {}, http) {
1071
1107
  }
1072
1108
 
1073
1109
  // src/resources/special/companies/errors.ts
1074
- var OwnerResourceRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
1110
+ var OwnerResourceRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1075
1111
  constructor(message, options = {}) {
1076
1112
  super(message, {
1077
1113
  code: "OWNER_RESOURCE_REQUIRED",
@@ -1082,13 +1118,13 @@ var OwnerResourceRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
1082
1118
  this.name = "OwnerResourceRequiredError";
1083
1119
  }
1084
1120
  };
1085
- var CompanyResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
1121
+ var CompanyResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1086
1122
  constructor(message, options = {}) {
1087
1123
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
1088
1124
  this.name = "CompanyResourceInvalidError";
1089
1125
  }
1090
1126
  };
1091
- var CompanyCreateFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
1127
+ var CompanyCreateFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
1092
1128
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
1093
1129
 
1094
1130
  constructor(message, vendorFields, options = {}) {
@@ -1107,23 +1143,23 @@ var BLIND_SURFACE_CAVEAT = "dedup only covers companies this API user can enumer
1107
1143
  var SAFE_COMPANY_CREATE_DEFAULTS = {};
1108
1144
  function validateUpsertInput(companyName, params) {
1109
1145
  if (typeof companyName !== "string" || companyName.trim() === "") {
1110
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1146
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByName: companyName is required (a non-empty string)", { operation: OP_UPSERT_NAME });
1111
1147
  }
1112
1148
  if (typeof _optionalChain([params, 'optionalAccess', _18 => _18.phone]) !== "string" || params.phone.trim() === "") {
1113
- throw new (0, _chunkHQGE4WAVcjs.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 });
1149
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByName: params.phone is required (a non-empty string \u2014 the ww29 live-required set is { companyName, companyType, phone, ownerResourceID })", { operation: OP_UPSERT_NAME });
1114
1150
  }
1115
1151
  const companyType = _nullishCoalesce(params.companyType, () => ( DEFAULT_COMPANY_TYPE));
1116
1152
  if (typeof companyType !== "number" || !Number.isSafeInteger(companyType) || companyType < 1) {
1117
- throw new (0, _chunkHQGE4WAVcjs.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 });
1153
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`upsertByName: params.companyType must be a positive integer picklist value (got ${String(params.companyType)}; default 1 \u2014 the ww29-proven value)`, { operation: OP_UPSERT_NAME });
1118
1154
  }
1119
1155
  const owner = params.ownerResourceID;
1120
1156
  if (owner !== void 0 && (typeof owner !== "number" || !Number.isSafeInteger(owner) || owner < 1)) {
1121
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1157
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`upsertByName: params.ownerResourceID must be a positive integer (got ${String(owner)})`, { operation: OP_UPSERT_NAME });
1122
1158
  }
1123
1159
  return { companyType, owner };
1124
1160
  }
1125
1161
  function existsDryRun(http, companyName, match) {
1126
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
1162
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
1127
1163
  {
1128
1164
  operation: OP_UPSERT_NAME,
1129
1165
  method: "POST",
@@ -1149,7 +1185,7 @@ function createDryRun(http, body, owner) {
1149
1185
  "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
1186
  );
1151
1187
  }
1152
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
1188
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
1153
1189
  {
1154
1190
  operation: OP_UPSERT_NAME,
1155
1191
  method: "POST",
@@ -1194,8 +1230,8 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1194
1230
  sideEffects: ['vendor auto-creates a "Primary Address" location under the new company (UI-only cleanup \u2014 the delete 405 gap, \xA711.5)']
1195
1231
  };
1196
1232
  } catch (err) {
1197
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1198
- const named = (_nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1233
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
1234
+ const named = (_nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
1199
1235
  const seen = /* @__PURE__ */ new Set();
1200
1236
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
1201
1237
  const hasDefault = unique.some((f) => SAFE_COMPANY_CREATE_DEFAULTS[f] !== void 0);
@@ -1209,7 +1245,7 @@ async function createWithDiscovery(resource, body, owner, caveat, opts) {
1209
1245
  }
1210
1246
  continue;
1211
1247
  }
1212
- const detail = _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError);
1248
+ const detail = _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError);
1213
1249
  throw new CompanyCreateFailedError(
1214
1250
  `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
1251
  unique,
@@ -1255,6 +1291,82 @@ async function upsertByName(resource, companyName, params, opts, http) {
1255
1291
  return createWithDiscovery(resource, body, owner, caveat, opts);
1256
1292
  }
1257
1293
 
1294
+ // src/resources/special/_shared/ticketStatus.ts
1295
+ var ASSUMED_CLOSED_STATUS_ID = 5;
1296
+ var CLOSED_STATUS_LABELS = ["complete", "completed", "closed", "cancelled", "canceled", "resolved"];
1297
+ var OP = "tickets.statusSemantics";
1298
+ function picklistOf(fields) {
1299
+ if (!Array.isArray(fields)) return [];
1300
+ const status = fields.find((f) => typeof _optionalChain([f, 'optionalAccess', _19 => _19.name]) === "string" && f.name.toLowerCase() === "status");
1301
+ if (status === void 0 || status.isPickList !== true || !Array.isArray(status.picklistValues)) return [];
1302
+ const out = [];
1303
+ for (const v of status.picklistValues) {
1304
+ const id = Number(_optionalChain([v, 'optionalAccess', _20 => _20.value]));
1305
+ if (!Number.isSafeInteger(id)) continue;
1306
+ out.push({ id, label: typeof v.label === "string" ? v.label : "" });
1307
+ }
1308
+ return out;
1309
+ }
1310
+ async function readFields(http, fresh) {
1311
+ const cache = http.fieldCache;
1312
+ const key = "tickets";
1313
+ if (!fresh && cache !== void 0) {
1314
+ const shared = cache.inflight(key, "fields");
1315
+ if (shared !== void 0) return await shared;
1316
+ const hit = cache.get(key, "fields");
1317
+ if (hit !== void 0) return hit;
1318
+ }
1319
+ const res = await http.request({ method: "GET", path: "/V1.0/Tickets/entityInformation/fields", operation: OP, maxRetries: 0 });
1320
+ const fields = _optionalChain([res, 'optionalAccess', _21 => _21.fields]);
1321
+ if (!Array.isArray(fields)) {
1322
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskError)("Expected the FieldInformationResultModel envelope { fields: [] }; got a different shape", { code: "INVALID_RESPONSE", category: "server" });
1323
+ }
1324
+ _optionalChain([cache, 'optionalAccess', _22 => _22.set, 'call', _23 => _23(key, "fields", fields)]);
1325
+ return fields;
1326
+ }
1327
+ function assumed(excludeStatusIds) {
1328
+ const closedIds = excludeStatusIds === void 0 ? [ASSUMED_CLOSED_STATUS_ID] : [...excludeStatusIds];
1329
+ return {
1330
+ picklist: [],
1331
+ closedIds,
1332
+ source: "assumed",
1333
+ assumedId: ASSUMED_CLOSED_STATUS_ID,
1334
+ note: `closed = status ${closedIds.join(", ")} \u2014 ASSUMED, not read from the tenant: the Tickets status picklist could not be resolved, so the historical id ${ASSUMED_CLOSED_STATUS_ID} stands in (fix: expose the Tickets field catalog to this API user, or pass excludeStatusIds)`
1335
+ };
1336
+ }
1337
+ async function resolveTicketStatusSemantics(http, opts = {}) {
1338
+ if (opts.excludeStatusIds !== void 0) {
1339
+ const closedIds2 = [...new Set(opts.excludeStatusIds.map((id) => Number(id)))];
1340
+ if (closedIds2.length === 0 || closedIds2.some((id) => !Number.isSafeInteger(id) || id < 1)) {
1341
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`excludeStatusIds must be a non-empty list of positive status ids (got ${JSON.stringify(opts.excludeStatusIds)})`, { operation: OP });
1342
+ }
1343
+ return { picklist: [], closedIds: closedIds2, source: "picklist", note: `closed = status ${closedIds2.join(", ")} \u2014 supplied by the caller` };
1344
+ }
1345
+ let fields;
1346
+ try {
1347
+ fields = await readFields(http, opts.fresh === true);
1348
+ } catch (e) {
1349
+ if (e instanceof _chunkD5IVS6GYcjs.AutotaskError && e.code === "ABORTED") throw e;
1350
+ return assumed();
1351
+ }
1352
+ const picklist = picklistOf(fields);
1353
+ const closedIds = picklist.filter((v) => CLOSED_STATUS_LABELS.includes(v.label.trim().toLowerCase())).map((v) => v.id);
1354
+ if (closedIds.length === 0) return assumed();
1355
+ const labels = picklist.filter((v) => closedIds.includes(v.id)).map((v) => `${v.id} ${v.label}`).join(", ");
1356
+ return {
1357
+ picklist,
1358
+ closedIds,
1359
+ source: "picklist",
1360
+ note: `closed = status not in [${closedIds.join(", ")}] (${labels}) \u2014 resolved from the tenant's Tickets status picklist`
1361
+ };
1362
+ }
1363
+ function openStatusFilter(closedIds) {
1364
+ return closedIds.length === 1 ? { field: "status", op: "noteq", value: closedIds[0] } : { field: "status", op: "notIn", value: [...closedIds] };
1365
+ }
1366
+ function isClosedStatus(status, closedIds) {
1367
+ return typeof status === "number" && closedIds.includes(status);
1368
+ }
1369
+
1258
1370
  // src/resources/special/companies/fullProfile.ts
1259
1371
  var FULL_PROFILE_PROJECTABLE_PARTS = ["locations", "contacts", "notes", "projects", "openTickets"];
1260
1372
  var PART_ENTITY = {
@@ -1264,36 +1376,36 @@ var PART_ENTITY = {
1264
1376
  projects: "projects",
1265
1377
  openTickets: "tickets"
1266
1378
  };
1267
- var OPEN_TICKETS_NOTE = "open = status != 5 (Complete) \u2014 the ww29 ticket-status picklist has no Closed value; tickets in any other status count as open";
1379
+ var OPEN_TICKETS_NOTE = "open = status != 5 (Complete) \u2014 ASSUMED: the tenant Tickets status picklist could not be read, so id 5 is the fallback closed id; tickets in any other status count as open";
1268
1380
  var PROFILE_PART_LIMIT = 50;
1269
1381
  var LOCATION_LIMIT_MAX = 500;
1270
1382
  function locationLimit(value) {
1271
1383
  if (value === void 0) return PROFILE_PART_LIMIT;
1272
1384
  if (!Number.isInteger(value) || value < 1 || value > LOCATION_LIMIT_MAX) {
1273
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1385
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: locationLimit must be an integer 1-${LOCATION_LIMIT_MAX} (got ${String(value)})`);
1274
1386
  }
1275
1387
  return value;
1276
1388
  }
1277
1389
  function validateProjection(fields) {
1278
1390
  if (fields === void 0) return {};
1279
1391
  if (fields === null || typeof fields !== "object" || Array.isArray(fields)) {
1280
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1392
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("fullProfile: fields must be an object keyed by part name");
1281
1393
  }
1282
1394
  const out = {};
1283
1395
  for (const [part, list] of Object.entries(fields)) {
1284
1396
  if (!FULL_PROFILE_PROJECTABLE_PARTS.includes(part)) {
1285
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1397
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: fields has unknown part "${part.slice(0, 40)}" \u2014 projectable parts: ${FULL_PROFILE_PROJECTABLE_PARTS.join(", ")}`);
1286
1398
  }
1287
1399
  if (!Array.isArray(list) || list.length === 0 || list.some((n) => typeof n !== "string" || n.length === 0)) {
1288
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1400
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: fields.${part} must be a non-empty array of field-name strings`);
1289
1401
  }
1290
1402
  const names = [...new Set(list)];
1291
1403
  const entity = PART_ENTITY[part];
1292
- const known = _nullishCoalesce(_chunkHQGE4WAVcjs.MODEL_FIELD_SETS[entity], () => ( []));
1404
+ const known = _nullishCoalesce(_chunkD5IVS6GYcjs.MODEL_FIELD_SETS[entity], () => ( []));
1293
1405
  const unknown = names.filter((n) => !known.includes(n));
1294
1406
  if (unknown.length > 0) {
1295
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
1296
- `fullProfile: fields.${part} has unknown field name(s) ${_chunkHQGE4WAVcjs.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`
1407
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1408
+ `fullProfile: fields.${part} has unknown field name(s) ${_chunkD5IVS6GYcjs.formatUnknownNameList.call(void 0, unknown)} against the vendored spec for ${entity} (${known.length} fields; operations.fieldCatalog resources: ["${entity}"] lists the live set) \u2014 no request was issued`
1297
1409
  );
1298
1410
  }
1299
1411
  out[part] = names;
@@ -1310,7 +1422,7 @@ function project(items, names) {
1310
1422
  function profilePartLimit(value, name) {
1311
1423
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
1312
1424
  if (!Number.isInteger(n) || n < 1) {
1313
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1425
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullProfile: ${name} must be an integer >= 1 (got ${String(value)})`);
1314
1426
  }
1315
1427
  return n;
1316
1428
  }
@@ -1322,9 +1434,11 @@ async function scopedCompanyQuery(http, path, companyID, limit, includeFields) {
1322
1434
  body: { MaxRecords: limit, filter: [{ field: "companyID", op: "eq", value: companyID }], ...includeFields ? { IncludeFields: includeFields } : {} },
1323
1435
  operation: "companies.fullProfile"
1324
1436
  });
1325
- return project(_chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items, includeFields);
1437
+ return project(_chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items, includeFields);
1326
1438
  }
1327
1439
  async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1440
+ const semantics = await resolveTicketStatusSemantics(http);
1441
+ const openLeaf = openStatusFilter(semantics.closedIds);
1328
1442
  const openRows = await (async () => {
1329
1443
  const res = await http.request({
1330
1444
  method: "POST",
@@ -1332,30 +1446,31 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1332
1446
  path: "/V1.0/Tickets/query",
1333
1447
  body: {
1334
1448
  MaxRecords: ticketLimit,
1335
- filter: [{ field: "companyID", op: "eq", value: companyID }, { field: "status", op: "noteq", value: 5 }],
1449
+ filter: [{ field: "companyID", op: "eq", value: companyID }, openLeaf],
1336
1450
  ...includeFields ? { IncludeFields: includeFields } : {}
1337
1451
  },
1338
1452
  operation: "companies.fullProfile"
1339
1453
  });
1340
- return project(_chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items, includeFields);
1454
+ return project(_chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items, includeFields);
1341
1455
  })();
1456
+ const closedStatus = { closedIds: semantics.closedIds, source: semantics.source, note: semantics.note };
1457
+ const partNote = semantics.source === "assumed" ? OPEN_TICKETS_NOTE : semantics.note;
1342
1458
  let openTickets = {
1343
1459
  items: openRows,
1344
1460
  capped: openRows.length >= ticketLimit,
1345
1461
  blind: false,
1346
- note: OPEN_TICKETS_NOTE
1462
+ note: partNote,
1463
+ closedStatus
1347
1464
  };
1348
1465
  if (openRows.length === 0) {
1349
- const stamp = _chunkHQGE4WAVcjs.blindStampFor.call(void 0, _optionalChain([_chunkHQGE4WAVcjs.BLIND_SURFACE_STAMPS, 'access', _19 => _19["tickets"], 'optionalAccess', _20 => _20.query]), [
1350
- { field: "companyID", op: "eq", value: companyID },
1351
- { field: "status", op: "noteq", value: 5 }
1352
- ]);
1466
+ const stamp = _chunkD5IVS6GYcjs.blindStampFor.call(void 0, _optionalChain([_chunkD5IVS6GYcjs.BLIND_SURFACE_STAMPS, 'access', _24 => _24["tickets"], 'optionalAccess', _25 => _25.query]), [{ field: "companyID", op: "eq", value: companyID }, openLeaf]);
1353
1467
  if (stamp !== void 0) {
1354
1468
  openTickets = {
1355
1469
  items: openRows,
1356
1470
  capped: openRows.length >= ticketLimit,
1357
1471
  blind: true,
1358
- note: `${stamp.note} ${OPEN_TICKETS_NOTE}`,
1472
+ note: `${stamp.note} ${partNote}`,
1473
+ closedStatus,
1359
1474
  blindSurface: stamp
1360
1475
  };
1361
1476
  }
@@ -1363,7 +1478,7 @@ async function readOpenTickets(http, companyID, ticketLimit, includeFields) {
1363
1478
  return openTickets;
1364
1479
  }
1365
1480
  async function addProfileNames(http, company, openTickets, projects, result, opts) {
1366
- const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS);
1481
+ const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS);
1367
1482
  const c = company;
1368
1483
  builder.addResource(c["ownerResourceID"]);
1369
1484
  builder.addResource(c["createdByResourceID"]);
@@ -1380,20 +1495,20 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1380
1495
  builder.addResource(r["creatorResourceID"]);
1381
1496
  builder.addFk("contract", r["contractID"]);
1382
1497
  }
1383
- const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1498
+ const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
1384
1499
  const companyRow = { ...company };
1385
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1386
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1500
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, companyRow, "ownerResourceID", (v) => names.resourceName(v));
1501
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, companyRow, "createdByResourceID", (v) => names.resourceName(v));
1387
1502
  result.company = companyRow;
1388
1503
  result.openTickets = {
1389
1504
  ...openTickets,
1390
1505
  items: openTickets.items.map((row) => {
1391
1506
  const r = { ...row };
1392
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1393
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1394
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1395
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1396
- for (const f of _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS) _chunkHQGE4WAVcjs.addLabelSibling.call(void 0, r, f, names);
1507
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1508
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1509
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "billingCodeID", (v) => names.recordName("billingCode", v));
1510
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "assignedResourceRoleID", (v) => names.recordName("role", v));
1511
+ for (const f of _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS) _chunkD5IVS6GYcjs.addLabelSibling.call(void 0, r, f, names);
1397
1512
  return r;
1398
1513
  })
1399
1514
  };
@@ -1401,9 +1516,9 @@ async function addProfileNames(http, company, openTickets, projects, result, opt
1401
1516
  ...result.projects,
1402
1517
  items: result.projects.items.map((row) => {
1403
1518
  const r = { ...row };
1404
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1405
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1406
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1519
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "projectLeadResourceID", (v) => names.resourceName(v));
1520
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "creatorResourceID", (v) => names.resourceName(v));
1521
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, r, "contractID", (v) => names.recordName("contract", v));
1407
1522
  return r;
1408
1523
  })
1409
1524
  };
@@ -1416,7 +1531,7 @@ async function fullProfile(resource, id, opts = {}, http) {
1416
1531
  const projectLimit = profilePartLimit(opts.projectLimit, "projectLimit");
1417
1532
  const locLimit = locationLimit(opts.locationLimit);
1418
1533
  const proj = validateProjection(opts.fields);
1419
- const companyID = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
1534
+ const companyID = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
1420
1535
  const company = await resource.get(companyID);
1421
1536
  const locations = await scopedCompanyQuery(http, "/V1.0/CompanyLocations/query", companyID, locLimit, proj.locations);
1422
1537
  const contacts = await scopedCompanyQuery(http, "/V1.0/Contacts/query", companyID, contactLimit, proj.contacts);
@@ -1463,7 +1578,7 @@ var UNBILLED_WORK_OPT_KEYS = [
1463
1578
  var UNBILLED_WORK_SOURCE_SET = ["posted_uninvoiced", "invoice", "date_range", "tickets"];
1464
1579
  function validateUnbilledWorkOptions(companyId, opts) {
1465
1580
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
1466
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
1581
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1467
1582
  `unbilledWork: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
1468
1583
  { operation: "companies.unbilledWork" }
1469
1584
  );
@@ -1492,7 +1607,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1492
1607
  try {
1493
1608
  limit = clampLimit(opts.limit);
1494
1609
  } catch (err) {
1495
- problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1610
+ problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : `limit must be an integer >= 1 (got ${String(opts.limit)})`);
1496
1611
  limit = 50;
1497
1612
  }
1498
1613
  if (source === "date_range") {
@@ -1507,9 +1622,9 @@ function validateUnbilledWorkOptions(companyId, opts) {
1507
1622
  problems.push('invoiceId is required (the vendor invoice id) when source is "invoice"');
1508
1623
  } else {
1509
1624
  try {
1510
- _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1625
+ _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.invoiceId, "opts.invoiceId");
1511
1626
  } catch (err) {
1512
- problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1627
+ problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "invoiceId must be a vendor numeric id");
1513
1628
  }
1514
1629
  }
1515
1630
  }
@@ -1519,20 +1634,20 @@ function validateUnbilledWorkOptions(companyId, opts) {
1519
1634
  } else {
1520
1635
  opts.ticketIds.forEach((tid, i) => {
1521
1636
  try {
1522
- _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1637
+ _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, tid, `opts.ticketIds[${i}]`);
1523
1638
  } catch (err) {
1524
- problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1639
+ problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : `ticketIds[${i}] must be a vendor numeric id`);
1525
1640
  }
1526
1641
  });
1527
1642
  }
1528
1643
  }
1529
1644
  try {
1530
- _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyId, "companyId");
1645
+ _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyId, "companyId");
1531
1646
  } catch (err) {
1532
- problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1647
+ problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "companyId must be a vendor numeric id");
1533
1648
  }
1534
1649
  if (problems.length > 0) {
1535
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
1650
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
1536
1651
  `unbilledWork: ${problems.length} problem(s) found pre-request (zero wire was issued)
1537
1652
  - ` + problems.join("\n- "),
1538
1653
  { operation: "companies.unbilledWork" }
@@ -1553,7 +1668,7 @@ function validateUnbilledWorkOptions(companyId, opts) {
1553
1668
  }
1554
1669
 
1555
1670
  // src/resources/special/companies/unbilledWork.ts
1556
- var OP = "companies.unbilledWork";
1671
+ var OP2 = "companies.unbilledWork";
1557
1672
  function capJoinSet(ids2, cap) {
1558
1673
  const sorted = [...new Set(ids2)].sort((a, b) => a - b);
1559
1674
  if (sorted.length <= cap) return { ids: sorted, truncated: false };
@@ -1561,7 +1676,7 @@ function capJoinSet(ids2, cap) {
1561
1676
  }
1562
1677
  function unbilledWorkPartStatus(key, conditions, items) {
1563
1678
  if (items.length !== 0) return { status: "ok" };
1564
- const stamp = _chunkHQGE4WAVcjs.blindStampFor.call(void 0, _optionalChain([_chunkHQGE4WAVcjs.BLIND_SURFACE_STAMPS, 'access', _21 => _21[key], 'optionalAccess', _22 => _22.query]), conditions);
1679
+ const stamp = _chunkD5IVS6GYcjs.blindStampFor.call(void 0, _optionalChain([_chunkD5IVS6GYcjs.BLIND_SURFACE_STAMPS, 'access', _26 => _26[key], 'optionalAccess', _27 => _27.query]), conditions);
1565
1680
  if (stamp !== void 0) return { status: "blind", blindSurface: stamp, note: stamp.note };
1566
1681
  return {
1567
1682
  status: "ok",
@@ -1581,7 +1696,7 @@ async function readCompanyAndParent(resource, id, includeParent) {
1581
1696
  parentStatus = "ok";
1582
1697
  companyIds.push(num(parent.id));
1583
1698
  } catch (err) {
1584
- if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) parent = null;
1699
+ if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) parent = null;
1585
1700
  else throw err;
1586
1701
  }
1587
1702
  }
@@ -1590,14 +1705,14 @@ async function readCompanyAndParent(resource, id, includeParent) {
1590
1705
  }
1591
1706
  async function readJoinSets(http, companyIds, v) {
1592
1707
  const ticketsCond = [{ field: "companyID", op: "in", value: companyIds }];
1593
- const ticketsRaw = await boundedPart(http, "/V1.0/Tickets/query", ticketsCond, v.limit, OP);
1708
+ const ticketsRaw = await boundedPart(http, "/V1.0/Tickets/query", ticketsCond, v.limit, OP2);
1594
1709
  const projectsCond = [{ field: "companyID", op: "in", value: companyIds }];
1595
- const projectsRaw = await boundedPart(http, "/V1.0/Projects/query", projectsCond, v.limit, OP);
1710
+ const projectsRaw = await boundedPart(http, "/V1.0/Projects/query", projectsCond, v.limit, OP2);
1596
1711
  const projectIds = projectsRaw.items.map((p) => num(p.id)).filter((n) => n > 0);
1597
1712
  let taskIds = [];
1598
1713
  let tasksHasMore = false;
1599
1714
  if (projectIds.length > 0) {
1600
- const tasksRaw = await boundedPart(http, "/V1.0/Tasks/query", [{ field: "projectID", op: "in", value: projectIds }], v.limit, OP);
1715
+ const tasksRaw = await boundedPart(http, "/V1.0/Tasks/query", [{ field: "projectID", op: "in", value: projectIds }], v.limit, OP2);
1601
1716
  taskIds = tasksRaw.items.map((t) => num(t.id)).filter((n) => n > 0);
1602
1717
  tasksHasMore = tasksRaw.hasMore;
1603
1718
  }
@@ -1619,14 +1734,14 @@ async function readBillingPart(http, v, companyIds) {
1619
1734
  if (v.dateFrom !== void 0) billingConditions.push({ field: "itemDate", op: "gte", value: v.dateFrom });
1620
1735
  if (v.dateTo !== void 0) billingConditions.push({ field: "itemDate", op: "lte", value: v.dateTo });
1621
1736
  }
1622
- const billingFields = _chunkHQGE4WAVcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1737
+ const billingFields = _chunkD5IVS6GYcjs.resolveFieldsPreset.call(void 0, "billing_join", "billing_items");
1623
1738
  const billingIncludeFields = [...billingFields, "id", ...v.includeNotes ? ["description"] : []];
1624
- const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP, billingIncludeFields);
1739
+ const billingRaw = await boundedPart(http, "/V1.0/BillingItems/query", billingConditions, v.limit, OP2, billingIncludeFields);
1625
1740
  let billingItems = billingRaw.items;
1626
1741
  let billingNoteCharsTruncated = 0;
1627
1742
  if (v.includeNotes) {
1628
- const noteFields = (_nullishCoalesce(_chunkHQGE4WAVcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1629
- [billingItems, billingNoteCharsTruncated] = _chunkHQGE4WAVcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1743
+ const noteFields = (_nullishCoalesce(_chunkD5IVS6GYcjs.UNTRUSTED_FIELDS_BY_RESOURCE["billing_items"], () => ( []))).filter((f) => billingIncludeFields.includes(f));
1744
+ [billingItems, billingNoteCharsTruncated] = _chunkD5IVS6GYcjs.truncateNoteChars.call(void 0, billingRaw.items, v.noteChars, noteFields);
1630
1745
  }
1631
1746
  const billingSt = unbilledWorkPartStatus("billing_items", billingConditions, billingRaw.items);
1632
1747
  const billingItemsPart = {
@@ -1665,12 +1780,12 @@ async function readTimePart(http, v, join) {
1665
1780
  if (v.dateFrom !== void 0) timeConditions.push({ field: "dateWorked", op: "gte", value: v.dateFrom });
1666
1781
  if (v.dateTo !== void 0) timeConditions.push({ field: "dateWorked", op: "lte", value: v.dateTo });
1667
1782
  const timeFields = ["taskID", "ticketID", "hoursWorked", "dateWorked", "id", ...v.includeNotes ? ["summaryNotes"] : []];
1668
- const raw = await boundedPart(http, "/V1.0/TimeEntries/query", timeConditions, v.limit, OP, timeFields);
1783
+ const raw = await boundedPart(http, "/V1.0/TimeEntries/query", timeConditions, v.limit, OP2, timeFields);
1669
1784
  entries = raw.items;
1670
1785
  let cappedItems = entries;
1671
1786
  let noteCharsTruncated = 0;
1672
1787
  if (v.includeNotes) {
1673
- [cappedItems, noteCharsTruncated] = _chunkHQGE4WAVcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1788
+ [cappedItems, noteCharsTruncated] = _chunkD5IVS6GYcjs.truncateNoteChars.call(void 0, entries, v.noteChars, ["summaryNotes"]);
1674
1789
  }
1675
1790
  const st = unbilledWorkPartStatus("time_entries", timeConditions, entries);
1676
1791
  timePart = {
@@ -1758,7 +1873,7 @@ function unpostedAndWarnings(v, billingItems, entries, entryByTimeId) {
1758
1873
  }
1759
1874
  async function unbilledWork(resource, companyId, opts = {}, http) {
1760
1875
  const v = validateUnbilledWorkOptions(companyId, opts);
1761
- const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyId, "companyId");
1876
+ const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyId, "companyId");
1762
1877
  const { company, parent, parentStatus, companyIds } = await readCompanyAndParent(resource, id, v.includeParent);
1763
1878
  const join = await readJoinSets(http, companyIds, v);
1764
1879
  const { billingItems, billingSt, billingItemsPart } = await readBillingPart(http, v, companyIds);
@@ -1785,7 +1900,7 @@ async function unbilledWork(resource, companyId, opts = {}, http) {
1785
1900
  }
1786
1901
 
1787
1902
  // src/resources/companies.ts
1788
- var CompaniesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
1903
+ var CompaniesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
1789
1904
  constructor(http, pageSize) {
1790
1905
  super(http, {
1791
1906
  key: "companies",
@@ -1892,7 +2007,7 @@ var CompaniesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
1892
2007
  };
1893
2008
 
1894
2009
  // src/resources/company_alerts.ts
1895
- var CompanyAlertsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2010
+ var CompanyAlertsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
1896
2011
  constructor(http, pageSize) {
1897
2012
  super(http, {
1898
2013
  key: "company_alerts",
@@ -1958,7 +2073,7 @@ var CompanyAlertsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
1958
2073
  };
1959
2074
 
1960
2075
  // src/resources/company_locations.ts
1961
- var CompanyLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2076
+ var CompanyLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
1962
2077
  constructor(http, pageSize) {
1963
2078
  super(http, {
1964
2079
  key: "company_locations",
@@ -2024,12 +2139,12 @@ var CompanyLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2024
2139
  /** Search CompanyLocation records: bounded contains on name (no vendor free-text search exists);
2025
2140
  * limit defaults to 25, max 500. */
2026
2141
  async search(query, opts) {
2027
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _23 => _23.limit]) });
2142
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _28 => _28.limit]) });
2028
2143
  }
2029
2144
  };
2030
2145
 
2031
2146
  // src/resources/company_notes.ts
2032
- var CompanyNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2147
+ var CompanyNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2033
2148
  constructor(http, pageSize) {
2034
2149
  super(http, {
2035
2150
  key: "company_notes",
@@ -2089,12 +2204,12 @@ var CompanyNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2089
2204
  /** Search CompanyNote records: bounded contains on name (no vendor free-text search exists);
2090
2205
  * limit defaults to 25, max 500. */
2091
2206
  async search(query, opts) {
2092
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _24 => _24.limit]) });
2207
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _29 => _29.limit]) });
2093
2208
  }
2094
2209
  };
2095
2210
 
2096
2211
  // src/resources/company_site_configurations.ts
2097
- var CompanySiteConfigurationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2212
+ var CompanySiteConfigurationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2098
2213
  constructor(http, pageSize) {
2099
2214
  super(http, {
2100
2215
  key: "company_site_configurations",
@@ -2145,7 +2260,7 @@ var CompanySiteConfigurationsResource = class extends _chunkHQGE4WAVcjs.BaseReso
2145
2260
  };
2146
2261
 
2147
2262
  // src/resources/company_webhooks.ts
2148
- var CompanyWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2263
+ var CompanyWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2149
2264
  constructor(http, pageSize) {
2150
2265
  super(http, {
2151
2266
  key: "company_webhooks",
@@ -2216,12 +2331,12 @@ var CompanyWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2216
2331
  /** Search CompanyWebhook records: bounded contains on name (no vendor free-text search exists);
2217
2332
  * limit defaults to 25, max 500. */
2218
2333
  async search(query, opts) {
2219
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _25 => _25.limit]) });
2334
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _30 => _30.limit]) });
2220
2335
  }
2221
2336
  };
2222
2337
 
2223
2338
  // src/resources/configuration_item_billing_product_associations.ts
2224
- var ConfigurationItemBillingProductAssociationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2339
+ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2225
2340
  constructor(http, pageSize) {
2226
2341
  super(http, {
2227
2342
  key: "configuration_item_billing_product_associations",
@@ -2287,7 +2402,7 @@ var ConfigurationItemBillingProductAssociationsResource = class extends _chunkHQ
2287
2402
  };
2288
2403
 
2289
2404
  // src/resources/configuration_item_categories.ts
2290
- var ConfigurationItemCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2405
+ var ConfigurationItemCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2291
2406
  constructor(http, pageSize) {
2292
2407
  super(http, {
2293
2408
  key: "configuration_item_categories",
@@ -2349,12 +2464,12 @@ var ConfigurationItemCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseRe
2349
2464
  /** Search ConfigurationItemCategory records: bounded contains on name (no vendor free-text search exists);
2350
2465
  * limit defaults to 25, max 500. */
2351
2466
  async search(query, opts) {
2352
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _26 => _26.limit]) });
2467
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _31 => _31.limit]) });
2353
2468
  }
2354
2469
  };
2355
2470
 
2356
2471
  // src/resources/configuration_item_category_udf_associations.ts
2357
- var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2472
+ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2358
2473
  constructor(http, pageSize) {
2359
2474
  super(http, {
2360
2475
  key: "configuration_item_category_udf_associations",
@@ -2420,7 +2535,7 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends _chunkHQGE4
2420
2535
  };
2421
2536
 
2422
2537
  // src/resources/configuration_item_dns_records.ts
2423
- var ConfigurationItemDnsRecordsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2538
+ var ConfigurationItemDnsRecordsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2424
2539
  constructor(http, pageSize) {
2425
2540
  super(http, {
2426
2541
  key: "configuration_item_dns_records",
@@ -2469,7 +2584,7 @@ var ConfigurationItemDnsRecordsResource = class extends _chunkHQGE4WAVcjs.BaseRe
2469
2584
  };
2470
2585
 
2471
2586
  // src/resources/configuration_item_notes.ts
2472
- var ConfigurationItemNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2587
+ var ConfigurationItemNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2473
2588
  constructor(http, pageSize) {
2474
2589
  super(http, {
2475
2590
  key: "configuration_item_notes",
@@ -2528,7 +2643,7 @@ var ConfigurationItemNotesResource = class extends _chunkHQGE4WAVcjs.BaseResourc
2528
2643
  };
2529
2644
 
2530
2645
  // src/resources/configuration_item_related_items.ts
2531
- var ConfigurationItemRelatedItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2646
+ var ConfigurationItemRelatedItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2532
2647
  constructor(http, pageSize) {
2533
2648
  super(http, {
2534
2649
  key: "configuration_item_related_items",
@@ -2586,19 +2701,19 @@ var ConfigurationItemRelatedItemsResource = class extends _chunkHQGE4WAVcjs.Base
2586
2701
 
2587
2702
  // src/resources/special/configuration_items.ts
2588
2703
  async function fetchRecord(http, path, label, readOpts) {
2589
- const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _27 => _27.maxRetries]) });
2704
+ const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: _optionalChain([readOpts, 'optionalAccess', _32 => _32.maxRetries]) });
2590
2705
  const body = res;
2591
2706
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
2592
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2707
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
2593
2708
  }
2594
2709
  return body.item;
2595
2710
  }
2596
2711
  async function moveConfigurationItem(_resource, sourceId, opts, http) {
2597
- const numericSource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2598
- if (_optionalChain([opts, 'optionalAccess', _28 => _28.destinationCompanyId]) === void 0) {
2599
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2712
+ const numericSource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceId, "sourceId");
2713
+ if (_optionalChain([opts, 'optionalAccess', _33 => _33.destinationCompanyId]) === void 0) {
2714
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: destinationCompanyId is required");
2600
2715
  }
2601
- const destId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2716
+ const destId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.destinationCompanyId, "destinationCompanyId");
2602
2717
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
2603
2718
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
2604
2719
  const body = { ...source };
@@ -2608,20 +2723,20 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2608
2723
  body.companyID = destId;
2609
2724
  body.isActive = true;
2610
2725
  if (opts.newReferenceTitle !== void 0) {
2611
- if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2726
+ if (opts.newReferenceTitle.trim() === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: newReferenceTitle must be non-empty");
2612
2727
  body.referenceTitle = opts.newReferenceTitle.trim();
2613
2728
  }
2614
2729
  if (opts.lastModifiedDate !== void 0) {
2615
2730
  const current = source.lastModifiedDate;
2616
2731
  if (current !== opts.lastModifiedDate) {
2617
- throw new (0, _chunkHQGE4WAVcjs.StaleObjectError)(
2732
+ throw new (0, _chunkD5IVS6GYcjs.StaleObjectError)(
2618
2733
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${_nullishCoalesce(current, () => ( "unknown"))})`,
2619
2734
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
2620
2735
  );
2621
2736
  }
2622
2737
  }
2623
2738
  if (opts.dryRun === true) {
2624
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
2739
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
2625
2740
  operation: "configuration_items.moveConfigurationItem",
2626
2741
  method: "POST",
2627
2742
  path: "/V1.0/ConfigurationItems",
@@ -2646,7 +2761,7 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
2646
2761
  const createdBody = created;
2647
2762
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
2648
2763
  if (typeof newId !== "number") {
2649
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2764
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("moveConfigurationItem: vendor create response has no itemId");
2650
2765
  }
2651
2766
  let sourceDeactivated = false;
2652
2767
  if (opts.deactivateSource !== false) {
@@ -2665,7 +2780,7 @@ var PROFILE_PART_LIMIT2 = 50;
2665
2780
  function profilePartLimit2(value, name) {
2666
2781
  const n = value === void 0 ? PROFILE_PART_LIMIT2 : Math.trunc(value);
2667
2782
  if (!Number.isInteger(n) || n < 1) {
2668
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2783
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
2669
2784
  }
2670
2785
  return n;
2671
2786
  }
@@ -2681,14 +2796,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
2681
2796
  });
2682
2797
  const body = res;
2683
2798
  if (body === null || !("item" in body)) {
2684
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2799
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2685
2800
  }
2686
2801
  if (body.item === null || body.item === void 0) {
2687
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2802
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
2688
2803
  }
2689
2804
  return body.item;
2690
2805
  } catch (err) {
2691
- if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) return null;
2806
+ if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) return null;
2692
2807
  throw err;
2693
2808
  }
2694
2809
  }
@@ -2700,7 +2815,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
2700
2815
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
2701
2816
  operation: "configuration_items.profile"
2702
2817
  });
2703
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
2818
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
2704
2819
  }
2705
2820
  async function profile(resource, id, opts = {}, http) {
2706
2821
  const noteLimit = profilePartLimit2(opts.noteLimit, "noteLimit");
@@ -2712,7 +2827,7 @@ async function profile(resource, id, opts = {}, http) {
2712
2827
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
2713
2828
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
2714
2829
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT2);
2715
- const wallQuirk = _optionalChain([_chunkHQGE4WAVcjs.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"))]);
2830
+ const wallQuirk = _optionalChain([_chunkD5IVS6GYcjs.RELATIONSHIP_MAP, 'access', _34 => _34["configuration_items"], 'optionalAccess', _35 => _35.zoneFacts, 'optionalAccess', _36 => _36.quirks, 'optionalAccess', _37 => _37.find, 'call', _38 => _38((q) => q.startsWith("product wall"))]);
2716
2831
  const productAssociations = {
2717
2832
  items: associations,
2718
2833
  capped: associations.length >= PROFILE_PART_LIMIT2,
@@ -2736,11 +2851,11 @@ async function profile(resource, id, opts = {}, http) {
2736
2851
  }
2737
2852
  };
2738
2853
  if (opts.names === true) {
2739
- const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, );
2854
+ const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, );
2740
2855
  builder.addFk("contract", root["contractID"]);
2741
- const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2856
+ const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
2742
2857
  const ciRow = { ...ci };
2743
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2858
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ciRow, "contractID", (v) => names.recordName("contract", v));
2744
2859
  result.ci = ciRow;
2745
2860
  result.names = names.section;
2746
2861
  }
@@ -2748,7 +2863,7 @@ async function profile(resource, id, opts = {}, http) {
2748
2863
  }
2749
2864
 
2750
2865
  // src/resources/configuration_items.ts
2751
- var ConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2866
+ var ConfigurationItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2752
2867
  constructor(http, pageSize) {
2753
2868
  super(http, {
2754
2869
  key: "configuration_items",
@@ -2814,7 +2929,7 @@ var ConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2814
2929
  /** Search ConfigurationItem records: bounded contains on referenceTitle (no vendor free-text search exists);
2815
2930
  * limit defaults to 25, max 500. */
2816
2931
  async search(query, opts) {
2817
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _34 => _34.limit]) });
2932
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _39 => _39.limit]) });
2818
2933
  }
2819
2934
  /** Get the ConfigurationItem with its primary context records in one call (each part a single-record
2820
2935
  * fetch; no sub-lists; absent/dangling references come back null). */
@@ -2837,7 +2952,7 @@ var ConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2837
2952
  };
2838
2953
 
2839
2954
  // src/resources/configuration_item_ssl_subject_alternative_names.ts
2840
- var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
2955
+ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2841
2956
  constructor(http, pageSize) {
2842
2957
  super(http, {
2843
2958
  key: "configuration_item_ssl_subject_alternative_names",
@@ -2895,12 +3010,12 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends _chunkHQ
2895
3010
  /** Search ConfigurationItemSslSubjectAlternativeName records: bounded contains on name (no vendor free-text search exists);
2896
3011
  * limit defaults to 25, max 500. */
2897
3012
  async search(query, opts) {
2898
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _35 => _35.limit]) });
3013
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _40 => _40.limit]) });
2899
3014
  }
2900
3015
  };
2901
3016
 
2902
3017
  // src/resources/configuration_item_types.ts
2903
- var ConfigurationItemTypesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3018
+ var ConfigurationItemTypesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2904
3019
  constructor(http, pageSize) {
2905
3020
  super(http, {
2906
3021
  key: "configuration_item_types",
@@ -2969,12 +3084,12 @@ var ConfigurationItemTypesResource = class extends _chunkHQGE4WAVcjs.BaseResourc
2969
3084
  /** Search ConfigurationItemType records: bounded contains on name (no vendor free-text search exists);
2970
3085
  * limit defaults to 25, max 500. */
2971
3086
  async search(query, opts) {
2972
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _36 => _36.limit]) });
3087
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _41 => _41.limit]) });
2973
3088
  }
2974
3089
  };
2975
3090
 
2976
3091
  // src/resources/configuration_item_webhooks.ts
2977
- var ConfigurationItemWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3092
+ var ConfigurationItemWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
2978
3093
  constructor(http, pageSize) {
2979
3094
  super(http, {
2980
3095
  key: "configuration_item_webhooks",
@@ -3045,12 +3160,12 @@ var ConfigurationItemWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseReso
3045
3160
  /** Search ConfigurationItemWebhook records: bounded contains on name (no vendor free-text search exists);
3046
3161
  * limit defaults to 25, max 500. */
3047
3162
  async search(query, opts) {
3048
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _37 => _37.limit]) });
3163
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _42 => _42.limit]) });
3049
3164
  }
3050
3165
  };
3051
3166
 
3052
3167
  // src/resources/contact_group_contacts.ts
3053
- var ContactGroupContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3168
+ var ContactGroupContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3054
3169
  constructor(http, pageSize) {
3055
3170
  super(http, {
3056
3171
  key: "contact_group_contacts",
@@ -3104,7 +3219,7 @@ var ContactGroupContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource
3104
3219
  };
3105
3220
 
3106
3221
  // src/resources/contact_groups.ts
3107
- var ContactGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3222
+ var ContactGroupsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3108
3223
  constructor(http, pageSize) {
3109
3224
  super(http, {
3110
3225
  key: "contact_groups",
@@ -3173,31 +3288,31 @@ var ContactGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3173
3288
  /** Search ContactGroups records: bounded contains on name (no vendor free-text search exists);
3174
3289
  * limit defaults to 25, max 500. */
3175
3290
  async search(query, opts) {
3176
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _38 => _38.limit]) });
3291
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _43 => _43.limit]) });
3177
3292
  }
3178
3293
  };
3179
3294
 
3180
3295
  // src/resources/special/contacts.ts
3181
3296
  async function fetchRecord2(http, path, label, readOpts) {
3182
- const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _39 => _39.maxRetries]) });
3297
+ const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: _optionalChain([readOpts, 'optionalAccess', _44 => _44.maxRetries]) });
3183
3298
  const body = res;
3184
3299
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
3185
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3300
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
3186
3301
  }
3187
3302
  return body.item;
3188
3303
  }
3189
3304
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
3190
- const sourceId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3191
- const destId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3305
+ const sourceId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceContactId, "sourceContactId");
3306
+ const destId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, destinationCompanyId, "destinationCompanyId");
3192
3307
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
3193
3308
  const companyID = source.companyID;
3194
3309
  if (typeof companyID !== "number" || companyID < 0) {
3195
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3310
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
3196
3311
  }
3197
3312
  if (opts.lastModifiedDate !== void 0) {
3198
3313
  const current = source.lastModifiedDate;
3199
3314
  if (current !== opts.lastModifiedDate) {
3200
- throw new (0, _chunkHQGE4WAVcjs.StaleObjectError)(
3315
+ throw new (0, _chunkD5IVS6GYcjs.StaleObjectError)(
3201
3316
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
3202
3317
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3203
3318
  );
@@ -3219,10 +3334,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3219
3334
  },
3220
3335
  operation: "contacts.moveToCompany"
3221
3336
  });
3222
- const items = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
3337
+ const items = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
3223
3338
  const clash = items.find((c) => String(c.id) !== String(sourceId));
3224
3339
  if (clash !== void 0) {
3225
- throw new (0, _chunkHQGE4WAVcjs.ConflictError)(
3340
+ throw new (0, _chunkD5IVS6GYcjs.ConflictError)(
3226
3341
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
3227
3342
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
3228
3343
  );
@@ -3236,7 +3351,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3236
3351
  if (opts.dryRun === true) {
3237
3352
  const warnings = [];
3238
3353
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
3239
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
3354
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
3240
3355
  operation: "contacts.moveToCompany",
3241
3356
  method: "POST",
3242
3357
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -3262,7 +3377,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
3262
3377
  const createdBody = created;
3263
3378
  const newId = createdBody !== null ? _nullishCoalesce(createdBody.itemId, () => ( createdBody.id)) : void 0;
3264
3379
  if (typeof newId !== "number") {
3265
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3380
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("contacts.moveToCompany: vendor create response has no itemId");
3266
3381
  }
3267
3382
  let sourceDeleted = false;
3268
3383
  if (opts.deleteSource === true) {
@@ -3281,7 +3396,7 @@ var UPSERT_MAX_DISCOVERY_MERGES = 3;
3281
3396
  var EMAIL_SHAPE = /^.+@.+/;
3282
3397
  var SAFE_CONTACT_CREATE_DEFAULTS = {};
3283
3398
  var DEDUP_LIMIT = 10;
3284
- var CompanyNotFoundError = class extends _chunkHQGE4WAVcjs.AutotaskError {
3399
+ var CompanyNotFoundError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3285
3400
  constructor(message, options = {}) {
3286
3401
  super(message, {
3287
3402
  code: "COMPANY_NOT_FOUND",
@@ -3292,7 +3407,7 @@ var CompanyNotFoundError = class extends _chunkHQGE4WAVcjs.AutotaskError {
3292
3407
  this.name = "CompanyNotFoundError";
3293
3408
  }
3294
3409
  };
3295
- var ContactCreateFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
3410
+ var ContactCreateFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
3296
3411
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
3297
3412
 
3298
3413
  constructor(message, vendorFields, options = {}) {
@@ -3302,25 +3417,25 @@ var ContactCreateFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
3302
3417
  }
3303
3418
  };
3304
3419
  async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3305
- const cid = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, companyID, "companyID");
3420
+ const cid = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, companyID, "companyID");
3306
3421
  if (typeof email !== "string" || !EMAIL_SHAPE.test(email)) {
3307
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
3422
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
3308
3423
  `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
3424
  { operation: OP_UPSERT_EMAIL }
3310
3425
  );
3311
3426
  }
3312
3427
  if (extra !== void 0) {
3313
3428
  if (extra.isActive !== void 0 && typeof extra.isActive !== "boolean" && extra.isActive !== 0 && extra.isActive !== 1) {
3314
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
3429
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
3315
3430
  `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
3431
  { operation: OP_UPSERT_EMAIL }
3317
3432
  );
3318
3433
  }
3319
3434
  if (extra.firstName !== void 0 && (typeof extra.firstName !== "string" || extra.firstName === "")) {
3320
- throw new (0, _chunkHQGE4WAVcjs.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 });
3435
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByEmail: extra.firstName must be a non-empty string (or omitted \u2014 the node defaults it to the email local-part)", { operation: OP_UPSERT_EMAIL });
3321
3436
  }
3322
3437
  if (extra.lastName !== void 0 && typeof extra.lastName !== "string") {
3323
- throw new (0, _chunkHQGE4WAVcjs.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 });
3438
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
3324
3439
  }
3325
3440
  }
3326
3441
  const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
@@ -3341,7 +3456,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3341
3456
  const match = q.items[0];
3342
3457
  if (match !== void 0) {
3343
3458
  if (opts.dryRun === true) {
3344
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
3459
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
3345
3460
  {
3346
3461
  operation: OP_UPSERT_EMAIL,
3347
3462
  method: "POST",
@@ -3362,16 +3477,16 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3362
3477
  return { id: Number(match.id), created: false, existing: match };
3363
3478
  }
3364
3479
  const localPart = email.split("@")[0];
3365
- const isActive = _optionalChain([extra, 'optionalAccess', _40 => _40.isActive]) === void 0 ? true : extra.isActive;
3480
+ const isActive = _optionalChain([extra, 'optionalAccess', _45 => _45.isActive]) === void 0 ? true : extra.isActive;
3366
3481
  const body = {
3367
3482
  emailAddress: email,
3368
3483
  companyID: cid,
3369
- firstName: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _41 => _41.firstName]), () => ( localPart)),
3370
- lastName: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _42 => _42.lastName]), () => ( "Unknown")),
3484
+ firstName: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _46 => _46.firstName]), () => ( localPart)),
3485
+ lastName: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _47 => _47.lastName]), () => ( "Unknown")),
3371
3486
  isActive: typeof isActive === "boolean" ? isActive ? 1 : 0 : isActive
3372
3487
  };
3373
3488
  if (opts.dryRun === true) {
3374
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
3489
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
3375
3490
  {
3376
3491
  operation: OP_UPSERT_EMAIL,
3377
3492
  method: "POST",
@@ -3394,8 +3509,8 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3394
3509
  const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
3395
3510
  return { id: created.id, created: true };
3396
3511
  } catch (err) {
3397
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3398
- const named = (_nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3512
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) throw err;
3513
+ const named = (_nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []))).map((e) => e.field).filter((f) => f !== void 0);
3399
3514
  const seen = /* @__PURE__ */ new Set();
3400
3515
  const unique = [...named].filter((f) => seen.has(f) ? false : (seen.add(f), true));
3401
3516
  const hasDefault = unique.some((f) => SAFE_CONTACT_CREATE_DEFAULTS[f] !== void 0);
@@ -3409,7 +3524,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3409
3524
  }
3410
3525
  continue;
3411
3526
  }
3412
- const detail = _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError);
3527
+ const detail = _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError);
3413
3528
  throw new ContactCreateFailedError(
3414
3529
  `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
3530
  unique,
@@ -3426,7 +3541,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
3426
3541
  }
3427
3542
 
3428
3543
  // src/resources/contacts.ts
3429
- var ContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3544
+ var ContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3430
3545
  constructor(http, pageSize) {
3431
3546
  super(http, {
3432
3547
  key: "contacts",
@@ -3497,7 +3612,7 @@ var ContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3497
3612
  /** Search Contact records: bounded contains on firstName + lastName (no vendor free-text search exists);
3498
3613
  * limit defaults to 25, max 500. */
3499
3614
  async search(query, opts) {
3500
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _43 => _43.limit]) });
3615
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _48 => _48.limit]) });
3501
3616
  }
3502
3617
  /** Get the Contact with its primary context records in one call (each part a single-record
3503
3618
  * fetch; no sub-lists; absent/dangling references come back null). */
@@ -3518,7 +3633,7 @@ var ContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3518
3633
  };
3519
3634
 
3520
3635
  // src/resources/contact_webhooks.ts
3521
- var ContactWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3636
+ var ContactWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3522
3637
  constructor(http, pageSize) {
3523
3638
  super(http, {
3524
3639
  key: "contact_webhooks",
@@ -3589,12 +3704,12 @@ var ContactWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3589
3704
  /** Search ContactWebhook records: bounded contains on name (no vendor free-text search exists);
3590
3705
  * limit defaults to 25, max 500. */
3591
3706
  async search(query, opts) {
3592
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _44 => _44.limit]) });
3707
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _49 => _49.limit]) });
3593
3708
  }
3594
3709
  };
3595
3710
 
3596
3711
  // src/resources/contract_billing_rules.ts
3597
- var ContractBillingRulesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3712
+ var ContractBillingRulesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3598
3713
  constructor(http, pageSize) {
3599
3714
  super(http, {
3600
3715
  key: "contract_billing_rules",
@@ -3660,7 +3775,7 @@ var ContractBillingRulesResource = class extends _chunkHQGE4WAVcjs.BaseResource
3660
3775
  };
3661
3776
 
3662
3777
  // src/resources/contract_block_hour_factors.ts
3663
- var ContractBlockHourFactorsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3778
+ var ContractBlockHourFactorsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3664
3779
  constructor(http, pageSize) {
3665
3780
  super(http, {
3666
3781
  key: "contract_block_hour_factors",
@@ -3719,7 +3834,7 @@ var ContractBlockHourFactorsResource = class extends _chunkHQGE4WAVcjs.BaseResou
3719
3834
  };
3720
3835
 
3721
3836
  // src/resources/contract_blocks.ts
3722
- var ContractBlocksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3837
+ var ContractBlocksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3723
3838
  constructor(http, pageSize) {
3724
3839
  super(http, {
3725
3840
  key: "contract_blocks",
@@ -3778,7 +3893,7 @@ var ContractBlocksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3778
3893
  };
3779
3894
 
3780
3895
  // src/resources/contract_charges.ts
3781
- var ContractChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3896
+ var ContractChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3782
3897
  constructor(http, pageSize) {
3783
3898
  super(http, {
3784
3899
  key: "contract_charges",
@@ -3844,12 +3959,12 @@ var ContractChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3844
3959
  /** Search ContractCharge records: bounded contains on name (no vendor free-text search exists);
3845
3960
  * limit defaults to 25, max 500. */
3846
3961
  async search(query, opts) {
3847
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _45 => _45.limit]) });
3962
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _50 => _50.limit]) });
3848
3963
  }
3849
3964
  };
3850
3965
 
3851
3966
  // src/resources/contract_exclusion_billing_codes.ts
3852
- var ContractExclusionBillingCodesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
3967
+ var ContractExclusionBillingCodesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3853
3968
  constructor(http, pageSize) {
3854
3969
  super(http, {
3855
3970
  key: "contract_exclusion_billing_codes",
@@ -3906,7 +4021,7 @@ var ContractExclusionBillingCodesResource = class extends _chunkHQGE4WAVcjs.Base
3906
4021
  };
3907
4022
 
3908
4023
  // src/resources/contract_exclusion_roles.ts
3909
- var ContractExclusionRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4024
+ var ContractExclusionRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3910
4025
  constructor(http, pageSize) {
3911
4026
  super(http, {
3912
4027
  key: "contract_exclusion_roles",
@@ -3963,7 +4078,7 @@ var ContractExclusionRolesResource = class extends _chunkHQGE4WAVcjs.BaseResourc
3963
4078
  };
3964
4079
 
3965
4080
  // src/resources/contract_exclusion_set_excluded_roles.ts
3966
- var ContractExclusionSetExcludedRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4081
+ var ContractExclusionSetExcludedRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
3967
4082
  constructor(http, pageSize) {
3968
4083
  super(http, {
3969
4084
  key: "contract_exclusion_set_excluded_roles",
@@ -4020,7 +4135,7 @@ var ContractExclusionSetExcludedRolesResource = class extends _chunkHQGE4WAVcjs.
4020
4135
  };
4021
4136
 
4022
4137
  // src/resources/contract_exclusion_set_excluded_work_types.ts
4023
- var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4138
+ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4024
4139
  constructor(http, pageSize) {
4025
4140
  super(http, {
4026
4141
  key: "contract_exclusion_set_excluded_work_types",
@@ -4077,7 +4192,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends _chunkHQGE4WAV
4077
4192
  };
4078
4193
 
4079
4194
  // src/resources/contract_exclusion_sets.ts
4080
- var ContractExclusionSetsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4195
+ var ContractExclusionSetsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4081
4196
  constructor(http, pageSize) {
4082
4197
  super(http, {
4083
4198
  key: "contract_exclusion_sets",
@@ -4146,12 +4261,12 @@ var ContractExclusionSetsResource = class extends _chunkHQGE4WAVcjs.BaseResource
4146
4261
  /** Search ContractExclusionSets records: bounded contains on name (no vendor free-text search exists);
4147
4262
  * limit defaults to 25, max 500. */
4148
4263
  async search(query, opts) {
4149
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _46 => _46.limit]) });
4264
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _51 => _51.limit]) });
4150
4265
  }
4151
4266
  };
4152
4267
 
4153
4268
  // src/resources/contract_milestones.ts
4154
- var ContractMilestonesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4269
+ var ContractMilestonesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4155
4270
  constructor(http, pageSize) {
4156
4271
  super(http, {
4157
4272
  key: "contract_milestones",
@@ -4210,7 +4325,7 @@ var ContractMilestonesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4210
4325
  };
4211
4326
 
4212
4327
  // src/resources/contract_notes.ts
4213
- var ContractNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4328
+ var ContractNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4214
4329
  constructor(http, pageSize) {
4215
4330
  super(http, {
4216
4331
  key: "contract_notes",
@@ -4269,7 +4384,7 @@ var ContractNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4269
4384
  };
4270
4385
 
4271
4386
  // src/resources/contract_rates.ts
4272
- var ContractRatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4387
+ var ContractRatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4273
4388
  constructor(http, pageSize) {
4274
4389
  super(http, {
4275
4390
  key: "contract_rates",
@@ -4328,7 +4443,7 @@ var ContractRatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4328
4443
  };
4329
4444
 
4330
4445
  // src/resources/contract_retainers.ts
4331
- var ContractRetainersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4446
+ var ContractRetainersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4332
4447
  constructor(http, pageSize) {
4333
4448
  super(http, {
4334
4449
  key: "contract_retainers",
@@ -4387,7 +4502,7 @@ var ContractRetainersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4387
4502
  };
4388
4503
 
4389
4504
  // src/resources/contract_role_costs.ts
4390
- var ContractRoleCostsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4505
+ var ContractRoleCostsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4391
4506
  constructor(http, pageSize) {
4392
4507
  super(http, {
4393
4508
  key: "contract_role_costs",
@@ -4446,7 +4561,7 @@ var ContractRoleCostsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4446
4561
  };
4447
4562
 
4448
4563
  // src/resources/contract_service_adjustments.ts
4449
- var ContractServiceAdjustmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4564
+ var ContractServiceAdjustmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4450
4565
  constructor(http, pageSize) {
4451
4566
  super(http, {
4452
4567
  key: "contract_service_adjustments",
@@ -4480,7 +4595,7 @@ var ContractServiceAdjustmentsResource = class extends _chunkHQGE4WAVcjs.BaseRes
4480
4595
  };
4481
4596
 
4482
4597
  // src/resources/contract_service_bundle_adjustments.ts
4483
- var ContractServiceBundleAdjustmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4598
+ var ContractServiceBundleAdjustmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4484
4599
  constructor(http, pageSize) {
4485
4600
  super(http, {
4486
4601
  key: "contract_service_bundle_adjustments",
@@ -4514,7 +4629,7 @@ var ContractServiceBundleAdjustmentsResource = class extends _chunkHQGE4WAVcjs.B
4514
4629
  };
4515
4630
 
4516
4631
  // src/resources/contract_service_bundles.ts
4517
- var ContractServiceBundlesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4632
+ var ContractServiceBundlesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4518
4633
  constructor(http, pageSize) {
4519
4634
  super(http, {
4520
4635
  key: "contract_service_bundles",
@@ -4573,7 +4688,7 @@ var ContractServiceBundlesResource = class extends _chunkHQGE4WAVcjs.BaseResourc
4573
4688
  };
4574
4689
 
4575
4690
  // src/resources/contract_service_bundle_units.ts
4576
- var ContractServiceBundleUnitsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4691
+ var ContractServiceBundleUnitsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4577
4692
  constructor(http, pageSize) {
4578
4693
  super(http, {
4579
4694
  key: "contract_service_bundle_units",
@@ -4615,7 +4730,7 @@ var ContractServiceBundleUnitsResource = class extends _chunkHQGE4WAVcjs.BaseRes
4615
4730
  };
4616
4731
 
4617
4732
  // src/resources/contract_services.ts
4618
- var ContractServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4733
+ var ContractServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4619
4734
  constructor(http, pageSize) {
4620
4735
  super(http, {
4621
4736
  key: "contract_services",
@@ -4674,7 +4789,7 @@ var ContractServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4674
4789
  };
4675
4790
 
4676
4791
  // src/resources/contract_service_units.ts
4677
- var ContractServiceUnitsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
4792
+ var ContractServiceUnitsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
4678
4793
  constructor(http, pageSize) {
4679
4794
  super(http, {
4680
4795
  key: "contract_service_units",
@@ -4942,7 +5057,7 @@ function buildCostRateResolution(ctx, entries, entryResolution) {
4942
5057
  // src/resources/special/contracts/profitability.validate.ts
4943
5058
  function validateProfitabilityOptions(contractId, opts) {
4944
5059
  if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
4945
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
5060
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
4946
5061
  `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
5062
  { operation: "contracts.profitability" }
4948
5063
  );
@@ -5019,12 +5134,12 @@ function validateProfitabilityOptions(contractId, opts) {
5019
5134
  }
5020
5135
  }
5021
5136
  try {
5022
- _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, contractId, "contractId");
5137
+ _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, contractId, "contractId");
5023
5138
  } catch (err) {
5024
- problems.push(err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5139
+ problems.push(err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.message : "contractId must be a vendor numeric id");
5025
5140
  }
5026
5141
  if (problems.length > 0) {
5027
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
5142
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
5028
5143
  `profitability: ${problems.length} problem(s) found pre-request (zero wire was issued)
5029
5144
  - ` + problems.join("\n- "),
5030
5145
  { operation: "contracts.profitability" }
@@ -5073,23 +5188,23 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5073
5188
  const byKey = /* @__PURE__ */ new Map();
5074
5189
  const misses = [];
5075
5190
  const notes = [];
5076
- for (let c = 0; c < unique.length; c += _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5077
- const chunk = unique.slice(c, c + _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE);
5191
+ for (let c = 0; c < unique.length; c += _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE) {
5192
+ const chunk = unique.slice(c, c + _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE);
5078
5193
  const chunkKeys = new Set(chunk);
5079
5194
  try {
5080
5195
  const body = {
5081
- MaxRecords: _chunkHQGE4WAVcjs.FETCH_BY_IDS_CHUNK_SIZE,
5196
+ MaxRecords: _chunkD5IVS6GYcjs.FETCH_BY_IDS_CHUNK_SIZE,
5082
5197
  filter: [{ field: "id", op: "in", value: chunk }],
5083
5198
  IncludeFields: fields
5084
5199
  };
5085
5200
  const res = await http.request({ method: "POST", idempotent: true, path: `${entityPath}/query`, body, operation });
5086
- const { items: rows } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
5201
+ const { items: rows } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
5087
5202
  for (const row of rows) {
5088
5203
  const k = num(row.id);
5089
5204
  if (k > 0 && chunkKeys.has(k)) byKey.set(k, row);
5090
5205
  }
5091
5206
  } catch (err) {
5092
- const code = err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.code : "SERVER_ERROR";
5207
+ const code = err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.code : "SERVER_ERROR";
5093
5208
  for (const k of chunk) {
5094
5209
  if (!byKey.has(k) && !misses.some((m) => m.id === k)) misses.push({ id: k, code, message: err instanceof Error ? err.message : String(err) });
5095
5210
  }
@@ -5099,11 +5214,11 @@ async function fetchByIdsPart(http, entityPath, ids2, fields, operation, entity)
5099
5214
  for (const k of queryMissed) {
5100
5215
  try {
5101
5216
  const res = await http.request({ method: "GET", path: `${entityPath}/${k}`, operation });
5102
- byKey.set(k, _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, k, operation, entity));
5217
+ byKey.set(k, _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, k, operation, entity));
5103
5218
  } catch (err) {
5104
- if (err instanceof _chunkHQGE4WAVcjs.NotFoundError) {
5219
+ if (err instanceof _chunkD5IVS6GYcjs.NotFoundError) {
5105
5220
  misses.push({ id: k, code: "NOT_FOUND", message: err.message });
5106
- } else if (err instanceof _chunkHQGE4WAVcjs.AutotaskError) {
5221
+ } else if (err instanceof _chunkD5IVS6GYcjs.AutotaskError) {
5107
5222
  misses.push({ id: k, code: err.code, message: err.message });
5108
5223
  } else {
5109
5224
  misses.push({ id: k, code: "SERVER_ERROR", message: err instanceof Error ? err.message : String(err) });
@@ -5157,7 +5272,7 @@ async function degradable(read) {
5157
5272
  try {
5158
5273
  return await read();
5159
5274
  } catch (err) {
5160
- if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
5275
+ if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5161
5276
  return { items: [], capped: false, hasMore: false, absent: err.code, absentMessage: err.message };
5162
5277
  }
5163
5278
  }
@@ -5177,15 +5292,15 @@ var stampPart = (key, raw, conditions, extraNotes) => {
5177
5292
  status: st.status,
5178
5293
  blindSurface: st.blindSurface,
5179
5294
  note: [st.note, ..._nullishCoalesce(extraNotes, () => ( []))].filter(Boolean).join(" | ") || void 0,
5180
- emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkHQGE4WAVcjs.EMPTY_REASON_STAMPS, 'access', _47 => _47[key], 'optionalAccess', _48 => _48.query]) : void 0
5295
+ emptyReason: raw.items.length === 0 && st.status === "ok" ? _optionalChain([_chunkD5IVS6GYcjs.EMPTY_REASON_STAMPS, 'access', _52 => _52[key], 'optionalAccess', _53 => _53.query]) : void 0
5181
5296
  };
5182
5297
  };
5183
5298
  function appendWiresNote(wires, note) {
5184
5299
  wires.note = (wires.note ? wires.note + " | " : "") + note;
5185
5300
  }
5186
5301
  function makeFetchCtx(rawHttp, v, contractId, budget) {
5187
- const OP6 = PROFITABILITY_OP;
5188
- const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, contractId, "contractId");
5302
+ const OP9 = PROFITABILITY_OP;
5303
+ const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, contractId, "contractId");
5189
5304
  const idNum = typeof id === "number" ? id : Number(id);
5190
5305
  const wires = { issued: 0, requests: 0, budget };
5191
5306
  const toExcl = dayAfter(v.dateTo);
@@ -5196,19 +5311,19 @@ function makeFetchCtx(rawHttp, v, contractId, budget) {
5196
5311
  } };
5197
5312
  const readPart = (path, conditions, fields) => {
5198
5313
  wires.issued += 1;
5199
- return degradable(() => boundedPart(http, path, conditions, v.limit, OP6, fields));
5314
+ return degradable(() => boundedPart(http, path, conditions, v.limit, OP9, fields));
5200
5315
  };
5201
5316
  const truncatedMonths = {};
5202
5317
  const windowedPart = async (name, key, path, cond, fields, dateField) => {
5203
5318
  const first = await readPart(path, cond, fields);
5204
5319
  if (first.absent !== void 0 || !first.hasMore) return { part: stampPart(key, first, cond), rows: first.items };
5205
- const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP6, fields, dateField, v.dateFrom, v.dateTo, wires));
5320
+ const wp = await degradable(() => expandByMonth(http, path, cond, v.limit, OP9, fields, dateField, v.dateFrom, v.dateTo, wires));
5206
5321
  if (!("truncatedMonths" in wp)) return { part: stampPart(key, wp, cond), rows: [] };
5207
5322
  const { truncatedMonths: tm, ...part } = wp;
5208
5323
  truncatedMonths[name] = tm;
5209
5324
  return { part, rows: wp.items };
5210
5325
  };
5211
- return { v, OP: OP6, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5326
+ return { v, OP: OP9, id, idNum, rawHttp, http, wires, windowOn, readPart, windowedPart, truncatedMonths };
5212
5327
  }
5213
5328
 
5214
5329
  // src/resources/special/contracts/profitability.stages.ts
@@ -5223,12 +5338,12 @@ async function fetchCustomer(ctx, companyID) {
5223
5338
  path: `/V1.0/Companies/${companyID}`,
5224
5339
  operation: ctx.OP
5225
5340
  });
5226
- const item = _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5341
+ const item = _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, companyID, ctx.OP, "company");
5227
5342
  customer = _nullishCoalesce(item, () => ( null));
5228
5343
  customerStatus = "ok";
5229
5344
  } catch (err) {
5230
- if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
5231
- if (!(err instanceof _chunkHQGE4WAVcjs.NotFoundError)) {
5345
+ if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5346
+ if (!(err instanceof _chunkD5IVS6GYcjs.NotFoundError)) {
5232
5347
  customerStatus = "absent";
5233
5348
  customerAbsent = err.code;
5234
5349
  }
@@ -5242,9 +5357,9 @@ async function resolveContractType(ctx, contractType) {
5242
5357
  if (contractType > 0) {
5243
5358
  ctx.wires.issued += 1;
5244
5359
  try {
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));
5360
+ contractTypeLabel = await _asyncNullishCoalesce(await _asyncOptionalChain([(await readPicklists(ctx.http, "/V1.0/Contracts", ctx.OP)), 'access', async _54 => _54.get, 'call', async _55 => _55("contractType"), 'optionalAccess', async _56 => _56.get, 'call', async _57 => _57(contractType)]), async () => ( null));
5246
5361
  } catch (err) {
5247
- if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
5362
+ if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5248
5363
  }
5249
5364
  }
5250
5365
  const contractTypeKnown = contractTypeLabel !== null;
@@ -5253,7 +5368,7 @@ async function resolveContractType(ctx, contractType) {
5253
5368
  return { contractTypeLabel, contractTypeKnown, isBlockHours, isTimeAndMaterials };
5254
5369
  }
5255
5370
  async function fetchRoot(ctx, resource) {
5256
- const contractCached = _optionalChain([ctx, 'access', _53 => _53.rawHttp, 'access', _54 => _54.readCache, 'optionalAccess', _55 => _55.get, 'call', _56 => _56(`/V1.0/Contracts/${ctx.id}`)]) !== void 0;
5371
+ const contractCached = _optionalChain([ctx, 'access', _58 => _58.rawHttp, 'access', _59 => _59.readCache, 'optionalAccess', _60 => _60.get, 'call', _61 => _61(`/V1.0/Contracts/${ctx.id}`)]) !== void 0;
5257
5372
  const contract = await resource.get(ctx.id);
5258
5373
  ctx.wires.issued += 1;
5259
5374
  if (!contractCached) ctx.wires.requests += 1;
@@ -5306,8 +5421,8 @@ async function fetchInvoices(ctx, billingRows) {
5306
5421
  if (invoiceIds.length === 0) {
5307
5422
  return { invoicesPart: skipPart("skipped: the billing part has no invoiceIDs (zero wire)"), invoices: [] };
5308
5423
  }
5309
- const capped = capJoinSet2(invoiceIds, _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
5310
- if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5424
+ const capped = capJoinSet2(invoiceIds, _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5425
+ if (capped.truncated) appendWiresNote(ctx.wires, `invoiceJoinTruncated: the join set is capped at ${_chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} invoice ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5311
5426
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Invoices", capped.ids, ["id", "invoiceNumber", "invoiceTotal", "paidDate", "isVoided", "dueDate"], ctx.OP, "invoice");
5312
5427
  ctx.wires.issued += 1;
5313
5428
  return {
@@ -5353,7 +5468,7 @@ async function readOpenStatusSet(ctx) {
5353
5468
  }
5354
5469
  }
5355
5470
  } catch (err) {
5356
- statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkHQGE4WAVcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5471
+ statusNote = `the tickets.status field catalog read failed (${err instanceof _chunkD5IVS6GYcjs.AutotaskError ? err.code : "SERVER_ERROR"}: ${err instanceof Error ? err.message : String(err)}) \u2014 the open-status labels are unavailable`;
5357
5472
  }
5358
5473
  return { openStatusSet, statusNote };
5359
5474
  }
@@ -5376,8 +5491,8 @@ async function fetchResources(ctx, entries) {
5376
5491
  if (resourceIds.length === 0) {
5377
5492
  return { resourcesPart: skipPart("skipped: the time part has no resourceIDs (zero wire)"), resources: [], resourceMissIds };
5378
5493
  }
5379
- const capped = capJoinSet2(resourceIds, _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
5380
- if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5494
+ const capped = capJoinSet2(resourceIds, _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5495
+ if (capped.truncated) appendWiresNote(ctx.wires, `resourceJoinTruncated: the join set is capped at ${_chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS} of ${capped.total} resource ids (the fetch-by-ids cap) \u2014 the figures cover the returned set only`);
5381
5496
  const fb = await fetchByIdsPart(ctx.http, "/V1.0/Resources", capped.ids, ["id", "internalCost", "firstName", "lastName", "isActive", "userType"], ctx.OP, "resource");
5382
5497
  ctx.wires.issued += 1;
5383
5498
  for (const m of fb.misses) if (m.code === "NOT_FOUND") resourceMissIds.add(m.id);
@@ -5444,7 +5559,7 @@ async function readSubscriptionLabels(ctx, subscriptions) {
5444
5559
  try {
5445
5560
  return await readPicklists(ctx.http, "/V1.0/Subscriptions", ctx.OP);
5446
5561
  } catch (err) {
5447
- if (!(err instanceof _chunkHQGE4WAVcjs.AutotaskError)) throw err;
5562
+ if (!(err instanceof _chunkD5IVS6GYcjs.AutotaskError)) throw err;
5448
5563
  return null;
5449
5564
  }
5450
5565
  }
@@ -5461,17 +5576,17 @@ async function fetchSubscriptions(ctx, cis) {
5461
5576
  cancelledSubs
5462
5577
  };
5463
5578
  }
5464
- const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkHQGE4WAVcjs.FETCH_BY_IDS_MAX_ITEMS);
5579
+ const ciIds = capJoinSet2(cis.map((c) => num(c["id"])).filter((n) => n > 0), _chunkD5IVS6GYcjs.FETCH_BY_IDS_MAX_ITEMS);
5465
5580
  const subCond = [{ field: "configurationItemID", op: "in", value: ciIds.ids }];
5466
5581
  const raw = await ctx.readPart("/V1.0/Subscriptions/query", subCond, ["id", "subscriptionName", "configurationItemID", "periodCost", "periodPrice", "periodType", "effectiveDate", "expirationDate", "status", "totalCost"]);
5467
5582
  const subscriptions = raw.items;
5468
5583
  const labels = await readSubscriptionLabels(ctx, subscriptions);
5469
5584
  for (const x of subscriptions) {
5470
5585
  const sid = num(x["id"]);
5471
- const periodLabel = _optionalChain([labels, 'optionalAccess', _57 => _57.get, 'call', _58 => _58("periodType"), 'optionalAccess', _59 => _59.get, 'call', _60 => _60(num(x["periodType"]))]);
5586
+ const periodLabel = _optionalChain([labels, 'optionalAccess', _62 => _62.get, 'call', _63 => _63("periodType"), 'optionalAccess', _64 => _64.get, 'call', _65 => _65(num(x["periodType"]))]);
5472
5587
  subFactor.set(sid, periodMonthlyFactor(x["periodType"], periodLabel));
5473
5588
  if (isOneTimePeriod(x["periodType"], periodLabel)) oneTimeSubs.add(sid);
5474
- const statusLabel = _optionalChain([labels, 'optionalAccess', _61 => _61.get, 'call', _62 => _62("status"), 'optionalAccess', _63 => _63.get, 'call', _64 => _64(num(x["status"]))]);
5589
+ const statusLabel = _optionalChain([labels, 'optionalAccess', _66 => _66.get, 'call', _67 => _67("status"), 'optionalAccess', _68 => _68.get, 'call', _69 => _69(num(x["status"]))]);
5475
5590
  const notActive = statusLabel !== void 0 ? NOT_ACTIVE_LABEL_RE.test(statusLabel) : labels === null && SUBSCRIPTION_NOT_ACTIVE_STATUS_IDS.has(num(x["status"]));
5476
5591
  if (notActive) cancelledSubs.add(sid);
5477
5592
  }
@@ -6146,7 +6261,7 @@ async function profitability(resource, contractId, opts, rawHttp) {
6146
6261
  }
6147
6262
 
6148
6263
  // src/resources/contracts.ts
6149
- var ContractsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6264
+ var ContractsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6150
6265
  constructor(http, pageSize) {
6151
6266
  super(http, {
6152
6267
  key: "contracts",
@@ -6208,7 +6323,7 @@ var ContractsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6208
6323
  /** Search Contract records: bounded contains on contractName (no vendor free-text search exists);
6209
6324
  * limit defaults to 25, max 500. */
6210
6325
  async search(query, opts) {
6211
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _65 => _65.limit]) });
6326
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _70 => _70.limit]) });
6212
6327
  }
6213
6328
  /** Node-parity special op (hand-written in src/resources/special/contracts.ts). */
6214
6329
  profitability(id, opts) {
@@ -6217,7 +6332,7 @@ var ContractsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6217
6332
  };
6218
6333
 
6219
6334
  // src/resources/contract_ticket_purchases.ts
6220
- var ContractTicketPurchasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6335
+ var ContractTicketPurchasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6221
6336
  constructor(http, pageSize) {
6222
6337
  super(http, {
6223
6338
  key: "contract_ticket_purchases",
@@ -6276,7 +6391,7 @@ var ContractTicketPurchasesResource = class extends _chunkHQGE4WAVcjs.BaseResour
6276
6391
  };
6277
6392
 
6278
6393
  // src/resources/countries.ts
6279
- var CountriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6394
+ var CountriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6280
6395
  constructor(http, pageSize) {
6281
6396
  super(http, {
6282
6397
  key: "countries",
@@ -6330,12 +6445,12 @@ var CountriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6330
6445
  /** Search Country records: bounded contains on name (no vendor free-text search exists);
6331
6446
  * limit defaults to 25, max 500. */
6332
6447
  async search(query, opts) {
6333
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _66 => _66.limit]) });
6448
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _71 => _71.limit]) });
6334
6449
  }
6335
6450
  };
6336
6451
 
6337
6452
  // src/resources/currencies.ts
6338
- var CurrenciesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6453
+ var CurrenciesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6339
6454
  constructor(http, pageSize) {
6340
6455
  super(http, {
6341
6456
  key: "currencies",
@@ -6374,12 +6489,12 @@ var CurrenciesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6374
6489
  /** Search Currency records: bounded contains on name (no vendor free-text search exists);
6375
6490
  * limit defaults to 25, max 500. */
6376
6491
  async search(query, opts) {
6377
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _67 => _67.limit]) });
6492
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _72 => _72.limit]) });
6378
6493
  }
6379
6494
  };
6380
6495
 
6381
6496
  // src/resources/departments.ts
6382
- var DepartmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6497
+ var DepartmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6383
6498
  constructor(http, pageSize) {
6384
6499
  super(http, {
6385
6500
  key: "departments",
@@ -6441,12 +6556,12 @@ var DepartmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6441
6556
  /** Search Department records: bounded contains on name (no vendor free-text search exists);
6442
6557
  * limit defaults to 25, max 500. */
6443
6558
  async search(query, opts) {
6444
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _68 => _68.limit]) });
6559
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _73 => _73.limit]) });
6445
6560
  }
6446
6561
  };
6447
6562
 
6448
6563
  // src/resources/domain_registrars.ts
6449
- var DomainRegistrarsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6564
+ var DomainRegistrarsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6450
6565
  constructor(http, pageSize) {
6451
6566
  super(http, {
6452
6567
  key: "domain_registrars",
@@ -6508,7 +6623,7 @@ var DomainRegistrarsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6508
6623
  /** Search DomainRegistrar records: bounded contains on name (no vendor free-text search exists);
6509
6624
  * limit defaults to 25, max 500. */
6510
6625
  async search(query, opts) {
6511
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _69 => _69.limit]) });
6626
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _74 => _74.limit]) });
6512
6627
  }
6513
6628
  };
6514
6629
 
@@ -6529,7 +6644,7 @@ var EntityInformationResource = class {
6529
6644
  };
6530
6645
 
6531
6646
  // src/resources/expense_item_attachments.ts
6532
- var ExpenseItemAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6647
+ var ExpenseItemAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6533
6648
  constructor(http, pageSize) {
6534
6649
  super(http, {
6535
6650
  key: "expense_item_attachments",
@@ -6591,7 +6706,7 @@ var ExpenseItemAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResourc
6591
6706
  };
6592
6707
 
6593
6708
  // src/resources/expense_items.ts
6594
- var ExpenseItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6709
+ var ExpenseItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6595
6710
  constructor(http, pageSize) {
6596
6711
  super(http, {
6597
6712
  key: "expense_items",
@@ -6650,7 +6765,7 @@ var ExpenseItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6650
6765
  };
6651
6766
 
6652
6767
  // src/resources/expense_reports.ts
6653
- var ExpenseReportsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6768
+ var ExpenseReportsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6654
6769
  constructor(http, pageSize) {
6655
6770
  super(http, {
6656
6771
  key: "expense_reports",
@@ -6712,12 +6827,12 @@ var ExpenseReportsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6712
6827
  /** Search ExpenseReport records: bounded contains on name (no vendor free-text search exists);
6713
6828
  * limit defaults to 25, max 500. */
6714
6829
  async search(query, opts) {
6715
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _70 => _70.limit]) });
6830
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _75 => _75.limit]) });
6716
6831
  }
6717
6832
  };
6718
6833
 
6719
6834
  // src/resources/holiday_sets.ts
6720
- var HolidaySetsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6835
+ var HolidaySetsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6721
6836
  constructor(http, pageSize) {
6722
6837
  super(http, {
6723
6838
  key: "holiday_sets",
@@ -6786,7 +6901,7 @@ var HolidaySetsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6786
6901
  };
6787
6902
 
6788
6903
  // src/resources/holidays.ts
6789
- var HolidaysResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6904
+ var HolidaysResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6790
6905
  constructor(http, pageSize) {
6791
6906
  super(http, {
6792
6907
  key: "holidays",
@@ -6858,10 +6973,10 @@ var PATH_SUFFIX = {
6858
6973
  transfer: "StockedItemsTransfer"
6859
6974
  };
6860
6975
  async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6861
- const numericParent = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, parentId, "parentId");
6976
+ const numericParent = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, parentId, "parentId");
6862
6977
  const suffix = PATH_SUFFIX[kind];
6863
6978
  if (opts.dryRun === true) {
6864
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
6979
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
6865
6980
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6866
6981
  method: "POST",
6867
6982
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -6878,11 +6993,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
6878
6993
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
6879
6994
  maxRetries: opts.maxRetries
6880
6995
  });
6881
- return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
6996
+ return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
6882
6997
  }
6883
6998
 
6884
6999
  // src/resources/inventory_products.ts
6885
- var InventoryProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7000
+ var InventoryProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
6886
7001
  constructor(http, pageSize) {
6887
7002
  super(http, {
6888
7003
  key: "inventory_products",
@@ -6964,7 +7079,7 @@ var InventoryProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
6964
7079
 
6965
7080
  // src/resources/special/invoices.ts
6966
7081
  async function markup(_resource, id, format, http) {
6967
- const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
7082
+ const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
6968
7083
  const suffix = format === "html" ? "InvoiceMarkupHtml" : "InvoiceMarkupXml";
6969
7084
  const res = await http.request({
6970
7085
  method: "GET",
@@ -6973,7 +7088,7 @@ async function markup(_resource, id, format, http) {
6973
7088
  });
6974
7089
  const body = res;
6975
7090
  if (body === null || typeof body !== "object" || typeof body.invoiceMarkup !== "string") {
6976
- throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(
7091
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(
6977
7092
  `Expected the InvoiceMarkupResultModel envelope { invoiceMarkup: string } for invoice ${numericId}; got a different shape`,
6978
7093
  { code: "INVALID_RESPONSE", category: "server", resourceIds: [numericId], details: { idRefs: [{ entity: "invoice", id: numericId }] } }
6979
7094
  );
@@ -6981,44 +7096,44 @@ async function markup(_resource, id, format, http) {
6981
7096
  return body.invoiceMarkup;
6982
7097
  }
6983
7098
  async function pdf(_resource, id, http) {
6984
- const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
7099
+ const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
6985
7100
  const res = await http.request({
6986
7101
  method: "GET",
6987
7102
  path: `/V1.0/Invoices/${numericId}/InvoicePdf`,
6988
7103
  operation: "invoices.pdf"
6989
7104
  });
6990
- return _chunkHQGE4WAVcjs.decodeFileData.call(void 0, res);
7105
+ return _chunkD5IVS6GYcjs.decodeFileData.call(void 0, res);
6991
7106
  }
6992
7107
  async function windowQuery2(_resource, kind, http, opts) {
6993
- const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _71 => _71.now]), () => ( /* @__PURE__ */ new Date()));
6994
- const tz = _optionalChain([opts, 'optionalAccess', _72 => _72.tz]) === void 0 ? void 0 : validateZone(opts.tz, `invoices.${kind}`);
7108
+ const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _76 => _76.now]), () => ( /* @__PURE__ */ new Date()));
7109
+ const tz = _optionalChain([opts, 'optionalAccess', _77 => _77.tz]) === void 0 ? void 0 : validateZone(opts.tz, `invoices.${kind}`);
6995
7110
  return dateWindowQuery(
6996
7111
  http,
6997
7112
  "/V1.0/Invoices/query",
6998
7113
  "invoiceDateTime",
6999
7114
  kind,
7000
- clampWindowLimit(_optionalChain([opts, 'optionalAccess', _73 => _73.limit])),
7115
+ clampWindowLimit(_optionalChain([opts, 'optionalAccess', _78 => _78.limit])),
7001
7116
  `invoices.${kind}`,
7002
7117
  now,
7003
7118
  tz
7004
7119
  );
7005
7120
  }
7006
7121
  async function customRange2(_resource, from, to, http, opts) {
7007
- const zone = _optionalChain([opts, 'optionalAccess', _74 => _74.tz]) === void 0 ? void 0 : validateZone(opts.tz, "invoices.customRange");
7122
+ const zone = _optionalChain([opts, 'optionalAccess', _79 => _79.tz]) === void 0 ? void 0 : validateZone(opts.tz, "invoices.customRange");
7008
7123
  return customRangeQuery(
7009
7124
  http,
7010
7125
  "/V1.0/Invoices/query",
7011
7126
  "invoiceDateTime",
7012
7127
  from,
7013
7128
  to,
7014
- clampWindowLimit(_optionalChain([opts, 'optionalAccess', _75 => _75.limit])),
7129
+ clampWindowLimit(_optionalChain([opts, 'optionalAccess', _80 => _80.limit])),
7015
7130
  "invoices.customRange",
7016
7131
  zone
7017
7132
  );
7018
7133
  }
7019
7134
 
7020
7135
  // src/resources/invoices.ts
7021
- var InvoicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7136
+ var InvoicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7022
7137
  constructor(http, pageSize) {
7023
7138
  super(http, {
7024
7139
  key: "invoices",
@@ -7131,6 +7246,34 @@ var InvoicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7131
7246
  }
7132
7247
  };
7133
7248
 
7249
+ // src/resources/invoice_templates.ts
7250
+ var InvoiceTemplatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7251
+ constructor(http, pageSize) {
7252
+ super(http, {
7253
+ key: "invoice_templates",
7254
+ resourcePath: "/V1.0/InvoiceTemplates",
7255
+ deletable: false,
7256
+ udfCapable: false
7257
+ }, pageSize);
7258
+ }
7259
+ /** Query InvoiceTemplate records with the G3 filter surface (server-side JSON filter). */
7260
+ query(params) {
7261
+ return this.queryItems(params);
7262
+ }
7263
+ /** Get every InvoiceTemplate record (the MCP-preferred read; 1000-page guarded). */
7264
+ async queryAll(params) {
7265
+ return this.queryAllItems(params);
7266
+ }
7267
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
7268
+ async count(params) {
7269
+ return this.countGlobal(params);
7270
+ }
7271
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
7272
+ async get(id) {
7273
+ return this.getGlobal(id);
7274
+ }
7275
+ };
7276
+
7134
7277
  // src/resources/modules.ts
7135
7278
  var ModulesResource = class {
7136
7279
 
@@ -7148,7 +7291,7 @@ var ModulesResource = class {
7148
7291
  };
7149
7292
 
7150
7293
  // src/resources/notification_history.ts
7151
- var NotificationHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7294
+ var NotificationHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7152
7295
  constructor(http, pageSize) {
7153
7296
  super(http, {
7154
7297
  key: "notification_history",
@@ -7187,7 +7330,7 @@ var NotificationHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7187
7330
  };
7188
7331
 
7189
7332
  // src/resources/opportunities.ts
7190
- var OpportunitiesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7333
+ var OpportunitiesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7191
7334
  constructor(http, pageSize) {
7192
7335
  super(http, {
7193
7336
  key: "opportunities",
@@ -7249,7 +7392,7 @@ var OpportunitiesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7249
7392
  };
7250
7393
 
7251
7394
  // src/resources/opportunity_attachments.ts
7252
- var OpportunityAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7395
+ var OpportunityAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7253
7396
  constructor(http, pageSize) {
7254
7397
  super(http, {
7255
7398
  key: "opportunity_attachments",
@@ -7311,7 +7454,7 @@ var OpportunityAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResourc
7311
7454
  };
7312
7455
 
7313
7456
  // src/resources/opportunity_categories.ts
7314
- var OpportunityCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7457
+ var OpportunityCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7315
7458
  constructor(http, pageSize) {
7316
7459
  super(http, {
7317
7460
  key: "opportunity_categories",
@@ -7365,12 +7508,165 @@ var OpportunityCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource
7365
7508
  /** Search OpportunityCategory records: bounded contains on name (no vendor free-text search exists);
7366
7509
  * limit defaults to 25, max 500. */
7367
7510
  async search(query, opts) {
7368
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _76 => _76.limit]) });
7511
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _81 => _81.limit]) });
7512
+ }
7513
+ };
7514
+
7515
+ // src/resources/organizational_level1s.ts
7516
+ var OrganizationalLevel1sResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7517
+ constructor(http, pageSize) {
7518
+ super(http, {
7519
+ key: "organizational_level1s",
7520
+ resourcePath: "/V1.0/OrganizationalLevel1s",
7521
+ deletable: false,
7522
+ udfCapable: false,
7523
+ collectionUpdate: true
7524
+ // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
7525
+ }, pageSize);
7526
+ }
7527
+ /** Query OrganizationalLevel1 records with the G3 filter surface (server-side JSON filter). */
7528
+ query(params) {
7529
+ return this.queryItems(params);
7530
+ }
7531
+ /** Get every OrganizationalLevel1 record (the MCP-preferred read; 1000-page guarded). */
7532
+ async queryAll(params) {
7533
+ return this.queryAllItems(params);
7534
+ }
7535
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
7536
+ async count(params) {
7537
+ return this.countGlobal(params);
7538
+ }
7539
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
7540
+ async get(id) {
7541
+ return this.getGlobal(id);
7542
+ }
7543
+ /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the
7544
+ * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the
7545
+ * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;
7546
+ * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */
7547
+ async create(data, opts = {}) {
7548
+ if (opts.dryRun === true) return this.runCreateDryRun(data);
7549
+ return this.createGlobal(data, opts);
7550
+ }
7551
+ /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor
7552
+ * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a
7553
+ * partial body is merged into the CURRENT record first: one fresh GET (which also serves the
7554
+ * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the
7555
+ * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends
7556
+ * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).
7557
+ * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed
7558
+ * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that
7559
+ * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */
7560
+ async update(id, data, opts = {}) {
7561
+ if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);
7562
+ return this.updateGlobal(id, data, opts);
7563
+ }
7564
+ };
7565
+
7566
+ // src/resources/organizational_level2s.ts
7567
+ var OrganizationalLevel2sResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7568
+ constructor(http, pageSize) {
7569
+ super(http, {
7570
+ key: "organizational_level2s",
7571
+ resourcePath: "/V1.0/OrganizationalLevel2s",
7572
+ deletable: false,
7573
+ udfCapable: false,
7574
+ collectionUpdate: true
7575
+ // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
7576
+ }, pageSize);
7577
+ }
7578
+ /** Query OrganizationalLevel2 records with the G3 filter surface (server-side JSON filter). */
7579
+ query(params) {
7580
+ return this.queryItems(params);
7581
+ }
7582
+ /** Get every OrganizationalLevel2 record (the MCP-preferred read; 1000-page guarded). */
7583
+ async queryAll(params) {
7584
+ return this.queryAllItems(params);
7585
+ }
7586
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
7587
+ async count(params) {
7588
+ return this.countGlobal(params);
7589
+ }
7590
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
7591
+ async get(id) {
7592
+ return this.getGlobal(id);
7593
+ }
7594
+ /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the
7595
+ * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the
7596
+ * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;
7597
+ * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */
7598
+ async create(data, opts = {}) {
7599
+ if (opts.dryRun === true) return this.runCreateDryRun(data);
7600
+ return this.createGlobal(data, opts);
7601
+ }
7602
+ /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor
7603
+ * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a
7604
+ * partial body is merged into the CURRENT record first: one fresh GET (which also serves the
7605
+ * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the
7606
+ * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends
7607
+ * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).
7608
+ * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed
7609
+ * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that
7610
+ * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */
7611
+ async update(id, data, opts = {}) {
7612
+ if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);
7613
+ return this.updateGlobal(id, data, opts);
7614
+ }
7615
+ };
7616
+
7617
+ // src/resources/organizational_level_associations.ts
7618
+ var OrganizationalLevelAssociationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7619
+ constructor(http, pageSize) {
7620
+ super(http, {
7621
+ key: "organizational_level_associations",
7622
+ resourcePath: "/V1.0/OrganizationalLevelAssociations",
7623
+ deletable: false,
7624
+ udfCapable: false,
7625
+ collectionUpdate: true
7626
+ // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
7627
+ }, pageSize);
7628
+ }
7629
+ /** Query OrganizationalLevelAssociation records with the G3 filter surface (server-side JSON filter). */
7630
+ query(params) {
7631
+ return this.queryItems(params);
7632
+ }
7633
+ /** Get every OrganizationalLevelAssociation record (the MCP-preferred read; 1000-page guarded). */
7634
+ async queryAll(params) {
7635
+ return this.queryAllItems(params);
7636
+ }
7637
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
7638
+ async count(params) {
7639
+ return this.countGlobal(params);
7640
+ }
7641
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
7642
+ async get(id) {
7643
+ return this.getGlobal(id);
7644
+ }
7645
+ /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the
7646
+ * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the
7647
+ * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;
7648
+ * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */
7649
+ async create(data, opts = {}) {
7650
+ if (opts.dryRun === true) return this.runCreateDryRun(data);
7651
+ return this.createGlobal(data, opts);
7652
+ }
7653
+ /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor
7654
+ * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a
7655
+ * partial body is merged into the CURRENT record first: one fresh GET (which also serves the
7656
+ * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the
7657
+ * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends
7658
+ * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).
7659
+ * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed
7660
+ * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that
7661
+ * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */
7662
+ async update(id, data, opts = {}) {
7663
+ if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);
7664
+ return this.updateGlobal(id, data, opts);
7369
7665
  }
7370
7666
  };
7371
7667
 
7372
7668
  // src/resources/phases.ts
7373
- var PhasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7669
+ var PhasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7374
7670
  constructor(http, pageSize) {
7375
7671
  super(http, {
7376
7672
  key: "phases",
@@ -7429,7 +7725,7 @@ var PhasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7429
7725
  };
7430
7726
 
7431
7727
  // src/resources/products.ts
7432
- var ProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7728
+ var ProductsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7433
7729
  constructor(http, pageSize) {
7434
7730
  super(http, {
7435
7731
  key: "products",
@@ -7491,12 +7787,12 @@ var ProductsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7491
7787
  /** Search Product records: bounded contains on name (no vendor free-text search exists);
7492
7788
  * limit defaults to 25, max 500. */
7493
7789
  async search(query, opts) {
7494
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _77 => _77.limit]) });
7790
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _82 => _82.limit]) });
7495
7791
  }
7496
7792
  };
7497
7793
 
7498
7794
  // src/resources/product_vendors.ts
7499
- var ProductVendorsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7795
+ var ProductVendorsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7500
7796
  constructor(http, pageSize) {
7501
7797
  super(http, {
7502
7798
  key: "product_vendors",
@@ -7555,7 +7851,7 @@ var ProductVendorsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7555
7851
  };
7556
7852
 
7557
7853
  // src/resources/project_charges.ts
7558
- var ProjectChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7854
+ var ProjectChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7559
7855
  constructor(http, pageSize) {
7560
7856
  super(http, {
7561
7857
  key: "project_charges",
@@ -7621,12 +7917,12 @@ var ProjectChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7621
7917
  /** Search ProjectCharge records: bounded contains on name (no vendor free-text search exists);
7622
7918
  * limit defaults to 25, max 500. */
7623
7919
  async search(query, opts) {
7624
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _78 => _78.limit]) });
7920
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _83 => _83.limit]) });
7625
7921
  }
7626
7922
  };
7627
7923
 
7628
7924
  // src/resources/project_notes.ts
7629
- var ProjectNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7925
+ var ProjectNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7630
7926
  constructor(http, pageSize) {
7631
7927
  super(http, {
7632
7928
  key: "project_notes",
@@ -7685,7 +7981,7 @@ var ProjectNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7685
7981
  };
7686
7982
 
7687
7983
  // src/resources/projects.ts
7688
- var ProjectsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7984
+ var ProjectsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7689
7985
  constructor(http, pageSize) {
7690
7986
  super(http, {
7691
7987
  key: "projects",
@@ -7747,7 +8043,7 @@ var ProjectsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7747
8043
  /** Search Project records: bounded contains on projectName (no vendor free-text search exists);
7748
8044
  * limit defaults to 25, max 500. */
7749
8045
  async search(query, opts) {
7750
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _79 => _79.limit]) });
8046
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _84 => _84.limit]) });
7751
8047
  }
7752
8048
  /** Get the Project with its primary context records in one call (each part a single-record
7753
8049
  * fetch; no sub-lists; absent/dangling references come back null). `names: true` (issue #77)
@@ -7762,13 +8058,13 @@ var ProjectsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7762
8058
  const leadResource = await this.contextFetch("/V1.0/Resources", root["projectLeadResourceID"]);
7763
8059
  const result = { project: project2, company, opportunity, leadResource };
7764
8060
  if (opts.names === true) {
7765
- const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, );
8061
+ const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, );
7766
8062
  builder.addResource(root["creatorResourceID"]);
7767
8063
  builder.addFk("contract", root["contractID"]);
7768
- const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
8064
+ const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, this.http, builder.plan(), { maxNameReads: opts.maxNameReads });
7769
8065
  const row = { ...project2 };
7770
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
7771
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
8066
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "creatorResourceID", (v) => names.resourceName(v));
8067
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
7772
8068
  result.project = row;
7773
8069
  result.names = names.section;
7774
8070
  }
@@ -7777,7 +8073,7 @@ var ProjectsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7777
8073
  };
7778
8074
 
7779
8075
  // src/resources/purchase_approvals.ts
7780
- var PurchaseApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8076
+ var PurchaseApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7781
8077
  constructor(http, pageSize) {
7782
8078
  super(http, {
7783
8079
  key: "purchase_approvals",
@@ -7831,7 +8127,7 @@ var PurchaseApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7831
8127
  };
7832
8128
 
7833
8129
  // src/resources/purchase_order_item_receiving.ts
7834
- var PurchaseOrderItemReceivingResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8130
+ var PurchaseOrderItemReceivingResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7835
8131
  constructor(http, pageSize) {
7836
8132
  super(http, {
7837
8133
  key: "purchase_order_item_receiving",
@@ -7881,7 +8177,7 @@ var PurchaseOrderItemReceivingResource = class extends _chunkHQGE4WAVcjs.BaseRes
7881
8177
  };
7882
8178
 
7883
8179
  // src/resources/purchase_order_items.ts
7884
- var PurchaseOrderItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8180
+ var PurchaseOrderItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7885
8181
  constructor(http, pageSize) {
7886
8182
  super(http, {
7887
8183
  key: "purchase_order_items",
@@ -7940,7 +8236,7 @@ var PurchaseOrderItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
7940
8236
  };
7941
8237
 
7942
8238
  // src/resources/purchase_orders.ts
7943
- var PurchaseOrdersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8239
+ var PurchaseOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
7944
8240
  constructor(http, pageSize) {
7945
8241
  super(http, {
7946
8242
  key: "purchase_orders",
@@ -8002,7 +8298,7 @@ var PurchaseOrdersResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8002
8298
  };
8003
8299
 
8004
8300
  // src/resources/quote_items.ts
8005
- var QuoteItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8301
+ var QuoteItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8006
8302
  constructor(http, pageSize) {
8007
8303
  super(http, {
8008
8304
  key: "quote_items",
@@ -8068,12 +8364,12 @@ var QuoteItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8068
8364
  /** Search QuoteItem records: bounded contains on name (no vendor free-text search exists);
8069
8365
  * limit defaults to 25, max 500. */
8070
8366
  async search(query, opts) {
8071
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _80 => _80.limit]) });
8367
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _85 => _85.limit]) });
8072
8368
  }
8073
8369
  };
8074
8370
 
8075
8371
  // src/resources/quote_locations.ts
8076
- var QuoteLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8372
+ var QuoteLocationsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8077
8373
  constructor(http, pageSize) {
8078
8374
  super(http, {
8079
8375
  key: "quote_locations",
@@ -8138,7 +8434,7 @@ var QuoteLocationsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8138
8434
  };
8139
8435
 
8140
8436
  // src/resources/quotes.ts
8141
- var QuotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8437
+ var QuotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8142
8438
  constructor(http, pageSize) {
8143
8439
  super(http, {
8144
8440
  key: "quotes",
@@ -8200,12 +8496,12 @@ var QuotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8200
8496
  /** Search Quote records: bounded contains on name (no vendor free-text search exists);
8201
8497
  * limit defaults to 25, max 500. */
8202
8498
  async search(query, opts) {
8203
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _81 => _81.limit]) });
8499
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _86 => _86.limit]) });
8204
8500
  }
8205
8501
  };
8206
8502
 
8207
8503
  // src/resources/quote_templates.ts
8208
- var QuoteTemplatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8504
+ var QuoteTemplatesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8209
8505
  constructor(http, pageSize) {
8210
8506
  super(http, {
8211
8507
  key: "quote_templates",
@@ -8244,12 +8540,12 @@ var QuoteTemplatesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8244
8540
  /** Search QuoteTemplate records: bounded contains on name (no vendor free-text search exists);
8245
8541
  * limit defaults to 25, max 500. */
8246
8542
  async search(query, opts) {
8247
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _82 => _82.limit]) });
8543
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _87 => _87.limit]) });
8248
8544
  }
8249
8545
  };
8250
8546
 
8251
8547
  // src/resources/resource_role_queues.ts
8252
- var ResourceRoleQueuesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8548
+ var ResourceRoleQueuesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8253
8549
  constructor(http, pageSize) {
8254
8550
  super(http, {
8255
8551
  key: "resource_role_queues",
@@ -8308,7 +8604,7 @@ var ResourceRoleQueuesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8308
8604
  };
8309
8605
 
8310
8606
  // src/resources/resource_roles.ts
8311
- var ResourceRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8607
+ var ResourceRolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8312
8608
  constructor(http, pageSize) {
8313
8609
  super(http, {
8314
8610
  key: "resource_roles",
@@ -8350,7 +8646,7 @@ var ResourceRolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8350
8646
  };
8351
8647
 
8352
8648
  // src/resources/resource_skills.ts
8353
- var ResourceSkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8649
+ var ResourceSkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8354
8650
  constructor(http, pageSize) {
8355
8651
  super(http, {
8356
8652
  key: "resource_skills",
@@ -8404,16 +8700,16 @@ var ResourceSkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8404
8700
  var MAX_TRANSFER_IDS = 500;
8405
8701
  function requirePositiveIds(ids2, label) {
8406
8702
  if (!Array.isArray(ids2) || ids2.length === 0) {
8407
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8703
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: at least one positive integer id is required`);
8408
8704
  }
8409
8705
  if (ids2.length > MAX_TRANSFER_IDS) {
8410
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8706
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: at most ${MAX_TRANSFER_IDS} ids are accepted (bounded fan-out)`);
8411
8707
  }
8412
8708
  const out = [];
8413
8709
  for (const raw of ids2) {
8414
- const id = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8710
+ const id = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, raw, `${label} id`);
8415
8711
  if (typeof id === "number" && id < 1) {
8416
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8712
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${label}: every id must be a positive integer (got ${String(raw)})`);
8417
8713
  }
8418
8714
  out.push(id);
8419
8715
  }
@@ -8421,7 +8717,7 @@ function requirePositiveIds(ids2, label) {
8421
8717
  }
8422
8718
  async function whoAmI(_resource, userName, http) {
8423
8719
  const user = userName.trim();
8424
- if (user === "") throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8720
+ if (user === "") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("whoAmI: the configured UserName is empty");
8425
8721
  const value = user.includes("@") ? _nullishCoalesce(user.split("@")[0], () => ( "")) : user;
8426
8722
  const res = await http.request({
8427
8723
  method: "POST",
@@ -8430,11 +8726,11 @@ async function whoAmI(_resource, userName, http) {
8430
8726
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
8431
8727
  operation: "resources.whoAmI"
8432
8728
  });
8433
- const matches = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
8729
+ const matches = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
8434
8730
  if (matches.length === 0) return null;
8435
8731
  if (matches.length > 1) {
8436
8732
  const ids2 = matches.map((m) => m.id).filter((id) => typeof id === "number");
8437
- throw new (0, _chunkHQGE4WAVcjs.ResolutionError)(
8733
+ throw new (0, _chunkD5IVS6GYcjs.ResolutionError)(
8438
8734
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
8439
8735
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids2, details: { idRefs: ids2.map((cid) => ({ entity: "resource", id: cid })) } }
8440
8736
  );
@@ -8443,11 +8739,11 @@ async function whoAmI(_resource, userName, http) {
8443
8739
  }
8444
8740
  async function transferOwnership(_resource, companyIds, destinationResourceId, http, opts) {
8445
8741
  const ids2 = requirePositiveIds(companyIds, "transferOwnership");
8446
- const destination = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8742
+ const destination = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, destinationResourceId, "destinationResourceId");
8447
8743
  if (typeof destination === "number" && destination < 1) {
8448
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8744
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("transferOwnership: destinationResourceId must be a positive integer");
8449
8745
  }
8450
- const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _83 => _83.dryRun]), () => ( true));
8746
+ const dryRun = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _88 => _88.dryRun]), () => ( true));
8451
8747
  const changes = [];
8452
8748
  const applied = [];
8453
8749
  for (const id of ids2) {
@@ -8456,9 +8752,9 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8456
8752
  method: "GET",
8457
8753
  path: `/V1.0/Companies/${id}`,
8458
8754
  operation: "resources.transferOwnership",
8459
- maxRetries: _optionalChain([opts, 'optionalAccess', _84 => _84.maxRetries])
8755
+ maxRetries: _optionalChain([opts, 'optionalAccess', _89 => _89.maxRetries])
8460
8756
  });
8461
- const company = _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8757
+ const company = _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, id, void 0, "company");
8462
8758
  const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
8463
8759
  changes.push({ id, fromOwnerResourceID: current, toOwnerResourceID: destination });
8464
8760
  if (!dryRun) {
@@ -8467,15 +8763,15 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8467
8763
  path: "/V1.0/Companies",
8468
8764
  body: { id, ownerResourceID: destination },
8469
8765
  operation: "resources.transferOwnership",
8470
- maxRetries: _optionalChain([opts, 'optionalAccess', _85 => _85.maxRetries])
8766
+ maxRetries: _optionalChain([opts, 'optionalAccess', _90 => _90.maxRetries])
8471
8767
  });
8472
- _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, update);
8768
+ _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, update);
8473
8769
  applied.push(id);
8474
8770
  }
8475
8771
  } catch (err) {
8476
- if (!dryRun && err instanceof _chunkHQGE4WAVcjs.AutotaskError) {
8772
+ if (!dryRun && err instanceof _chunkD5IVS6GYcjs.AutotaskError) {
8477
8773
  err.resourceIds = [id];
8478
- err.details = _chunkHQGE4WAVcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8774
+ err.details = _chunkD5IVS6GYcjs.mergeDetails.call(void 0, err.details, { idRefs: [{ entity: "company", id }] });
8479
8775
  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).`;
8480
8776
  }
8481
8777
  throw err;
@@ -8484,7 +8780,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8484
8780
  if (dryRun) {
8485
8781
  const anyChange = changes.some((c) => c.fromOwnerResourceID !== c.toOwnerResourceID);
8486
8782
  return {
8487
- ..._chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
8783
+ ..._chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
8488
8784
  operation: "resources.transferOwnership",
8489
8785
  method: "PUT",
8490
8786
  path: "/V1.0/Companies",
@@ -8508,7 +8804,7 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
8508
8804
  }
8509
8805
 
8510
8806
  // src/resources/resources.ts
8511
- var ResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8807
+ var ResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8512
8808
 
8513
8809
  constructor(http, clientConfig, pageSize) {
8514
8810
  super(http, {
@@ -8567,7 +8863,7 @@ var ResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8567
8863
  /** Search Resource records: bounded contains on firstName + lastName (no vendor free-text search exists);
8568
8864
  * limit defaults to 25, max 500. */
8569
8865
  async search(query, opts) {
8570
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _86 => _86.limit]) });
8866
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _91 => _91.limit]) });
8571
8867
  }
8572
8868
  /** Node-parity special op (hand-written in src/resources/special/resources.ts). */
8573
8869
  transferOwnership(sourceResourceIds, destinationResourceId, opts = {}) {
@@ -8581,7 +8877,7 @@ var ResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8581
8877
 
8582
8878
  // src/resources/special/resource_time_off_additional.ts
8583
8879
  async function getByResource(_resource, resourceId, http) {
8584
- const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8880
+ const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8585
8881
  const res = await http.request({
8586
8882
  method: "GET",
8587
8883
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -8595,11 +8891,11 @@ async function getByResource(_resource, resourceId, http) {
8595
8891
  if (typeof item === "object" && !Array.isArray(item)) return [item];
8596
8892
  }
8597
8893
  }
8598
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8894
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "resource_time_off_additional.getByResource").items;
8599
8895
  }
8600
8896
 
8601
8897
  // src/resources/resource_time_off_additional.ts
8602
- var ResourceTimeOffAdditionalResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8898
+ var ResourceTimeOffAdditionalResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8603
8899
  constructor(http, pageSize) {
8604
8900
  super(http, {
8605
8901
  key: "resource_time_off_additional",
@@ -8638,7 +8934,7 @@ var ResourceTimeOffAdditionalResource = class extends _chunkHQGE4WAVcjs.BaseReso
8638
8934
  };
8639
8935
 
8640
8936
  // src/resources/resource_time_off_approvers.ts
8641
- var ResourceTimeOffApproversResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8937
+ var ResourceTimeOffApproversResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8642
8938
  constructor(http, pageSize) {
8643
8939
  super(http, {
8644
8940
  key: "resource_time_off_approvers",
@@ -8681,29 +8977,29 @@ var ResourceTimeOffApproversResource = class extends _chunkHQGE4WAVcjs.BaseResou
8681
8977
 
8682
8978
  // src/resources/special/resource_time_off_balances.ts
8683
8979
  async function getByResource2(_resource, resourceId, http) {
8684
- const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8980
+ const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8685
8981
  const res = await http.request({
8686
8982
  method: "GET",
8687
8983
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
8688
8984
  operation: "resource_time_off_balances.getByResource"
8689
8985
  });
8690
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8986
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, "resource_time_off_balances.getByResource").items;
8691
8987
  }
8692
8988
  async function getByYear(_resource, resourceId, year, http) {
8693
- const numericResource = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8989
+ const numericResource = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceId, "resourceId");
8694
8990
  if (!Number.isSafeInteger(year) || year < 1) {
8695
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8991
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("getByYear: year must be a positive integer");
8696
8992
  }
8697
8993
  const res = await http.request({
8698
8994
  method: "GET",
8699
8995
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
8700
8996
  operation: "resource_time_off_balances.getByYear"
8701
8997
  });
8702
- return _chunkHQGE4WAVcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
8998
+ return _chunkD5IVS6GYcjs.unwrapItem.call(void 0, res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
8703
8999
  }
8704
9000
 
8705
9001
  // src/resources/resource_time_off_balances.ts
8706
- var ResourceTimeOffBalancesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9002
+ var ResourceTimeOffBalancesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8707
9003
  constructor(http, pageSize) {
8708
9004
  super(http, {
8709
9005
  key: "resource_time_off_balances",
@@ -8741,7 +9037,7 @@ var ResourceTimeOffBalancesResource = class extends _chunkHQGE4WAVcjs.BaseResour
8741
9037
  };
8742
9038
 
8743
9039
  // src/resources/roles.ts
8744
- var RolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9040
+ var RolesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8745
9041
  constructor(http, pageSize) {
8746
9042
  super(http, {
8747
9043
  key: "roles",
@@ -8803,12 +9099,55 @@ var RolesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8803
9099
  /** Search Role records: bounded contains on name (no vendor free-text search exists);
8804
9100
  * limit defaults to 25, max 500. */
8805
9101
  async search(query, opts) {
8806
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _87 => _87.limit]) });
9102
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _92 => _92.limit]) });
9103
+ }
9104
+ };
9105
+
9106
+ // src/resources/sales_orders.ts
9107
+ var SalesOrdersResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9108
+ constructor(http, pageSize) {
9109
+ super(http, {
9110
+ key: "sales_orders",
9111
+ resourcePath: "/V1.0/SalesOrders",
9112
+ deletable: false,
9113
+ udfCapable: true,
9114
+ collectionUpdate: true
9115
+ // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
9116
+ }, pageSize);
9117
+ }
9118
+ /** Query SalesOrder records with the G3 filter surface (server-side JSON filter). */
9119
+ query(params) {
9120
+ return this.queryItems(params);
9121
+ }
9122
+ /** Get every SalesOrder record (the MCP-preferred read; 1000-page guarded). */
9123
+ async queryAll(params) {
9124
+ return this.queryAllItems(params);
9125
+ }
9126
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
9127
+ async count(params) {
9128
+ return this.countGlobal(params);
9129
+ }
9130
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
9131
+ async get(id) {
9132
+ return this.getGlobal(id);
9133
+ }
9134
+ /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor
9135
+ * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a
9136
+ * partial body is merged into the CURRENT record first: one fresh GET (which also serves the
9137
+ * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the
9138
+ * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends
9139
+ * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).
9140
+ * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed
9141
+ * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that
9142
+ * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */
9143
+ async update(id, data, opts = {}) {
9144
+ if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);
9145
+ return this.updateGlobal(id, data, opts);
8807
9146
  }
8808
9147
  };
8809
9148
 
8810
9149
  // src/resources/service_calls.ts
8811
- var ServiceCallsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9150
+ var ServiceCallsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8812
9151
  constructor(http, pageSize) {
8813
9152
  super(http, {
8814
9153
  key: "service_calls",
@@ -8877,7 +9216,7 @@ var ServiceCallsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8877
9216
  };
8878
9217
 
8879
9218
  // src/resources/service_call_task_resources.ts
8880
- var ServiceCallTaskResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9219
+ var ServiceCallTaskResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8881
9220
  constructor(http, pageSize) {
8882
9221
  super(http, {
8883
9222
  key: "service_call_task_resources",
@@ -8934,7 +9273,7 @@ var ServiceCallTaskResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResou
8934
9273
  };
8935
9274
 
8936
9275
  // src/resources/service_call_tasks.ts
8937
- var ServiceCallTasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9276
+ var ServiceCallTasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8938
9277
  constructor(http, pageSize) {
8939
9278
  super(http, {
8940
9279
  key: "service_call_tasks",
@@ -8991,7 +9330,7 @@ var ServiceCallTasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
8991
9330
  };
8992
9331
 
8993
9332
  // src/resources/service_call_ticket_resources.ts
8994
- var ServiceCallTicketResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9333
+ var ServiceCallTicketResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
8995
9334
  constructor(http, pageSize) {
8996
9335
  super(http, {
8997
9336
  key: "service_call_ticket_resources",
@@ -9048,7 +9387,7 @@ var ServiceCallTicketResourcesResource = class extends _chunkHQGE4WAVcjs.BaseRes
9048
9387
  };
9049
9388
 
9050
9389
  // src/resources/service_call_tickets.ts
9051
- var ServiceCallTicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9390
+ var ServiceCallTicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9052
9391
  constructor(http, pageSize) {
9053
9392
  super(http, {
9054
9393
  key: "service_call_tickets",
@@ -9105,7 +9444,7 @@ var ServiceCallTicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9105
9444
  };
9106
9445
 
9107
9446
  // src/resources/service_level_agreement_results.ts
9108
- var ServiceLevelAgreementResultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9447
+ var ServiceLevelAgreementResultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9109
9448
  constructor(http, pageSize) {
9110
9449
  super(http, {
9111
9450
  key: "service_level_agreement_results",
@@ -9144,7 +9483,7 @@ var ServiceLevelAgreementResultsResource = class extends _chunkHQGE4WAVcjs.BaseR
9144
9483
  };
9145
9484
 
9146
9485
  // src/resources/services.ts
9147
- var ServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9486
+ var ServicesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9148
9487
  constructor(http, pageSize) {
9149
9488
  super(http, {
9150
9489
  key: "services",
@@ -9207,12 +9546,12 @@ var ServicesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9207
9546
  /** Search Service records: bounded contains on name (no vendor free-text search exists);
9208
9547
  * limit defaults to 25, max 500. */
9209
9548
  async search(query, opts) {
9210
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _88 => _88.limit]) });
9549
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _93 => _93.limit]) });
9211
9550
  }
9212
9551
  };
9213
9552
 
9214
9553
  // src/resources/skills.ts
9215
- var SkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9554
+ var SkillsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9216
9555
  constructor(http, pageSize) {
9217
9556
  super(http, {
9218
9557
  key: "skills",
@@ -9251,12 +9590,12 @@ var SkillsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9251
9590
  /** Search Skill records: bounded contains on name (no vendor free-text search exists);
9252
9591
  * limit defaults to 25, max 500. */
9253
9592
  async search(query, opts) {
9254
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _89 => _89.limit]) });
9593
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _94 => _94.limit]) });
9255
9594
  }
9256
9595
  };
9257
9596
 
9258
9597
  // src/resources/subscription_periods.ts
9259
- var SubscriptionPeriodsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9598
+ var SubscriptionPeriodsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9260
9599
  constructor(http, pageSize) {
9261
9600
  super(http, {
9262
9601
  key: "subscription_periods",
@@ -9295,7 +9634,7 @@ var SubscriptionPeriodsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9295
9634
  };
9296
9635
 
9297
9636
  // src/resources/subscriptions.ts
9298
- var SubscriptionsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9637
+ var SubscriptionsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9299
9638
  constructor(http, pageSize) {
9300
9639
  super(http, {
9301
9640
  key: "subscriptions",
@@ -9364,7 +9703,7 @@ var SubscriptionsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9364
9703
  };
9365
9704
 
9366
9705
  // src/resources/survey_results.ts
9367
- var SurveyResultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9706
+ var SurveyResultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9368
9707
  constructor(http, pageSize) {
9369
9708
  super(http, {
9370
9709
  key: "survey_results",
@@ -9403,7 +9742,7 @@ var SurveyResultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9403
9742
  };
9404
9743
 
9405
9744
  // src/resources/surveys.ts
9406
- var SurveysResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9745
+ var SurveysResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9407
9746
  constructor(http, pageSize) {
9408
9747
  super(http, {
9409
9748
  key: "surveys",
@@ -9442,12 +9781,12 @@ var SurveysResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9442
9781
  /** Search Survey records: bounded contains on name (no vendor free-text search exists);
9443
9782
  * limit defaults to 25, max 500. */
9444
9783
  async search(query, opts) {
9445
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _90 => _90.limit]) });
9784
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _95 => _95.limit]) });
9446
9785
  }
9447
9786
  };
9448
9787
 
9449
9788
  // src/resources/tag_aliases.ts
9450
- var TagAliasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9789
+ var TagAliasesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9451
9790
  constructor(http, pageSize) {
9452
9791
  super(http, {
9453
9792
  key: "tag_aliases",
@@ -9504,7 +9843,7 @@ var TagAliasesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9504
9843
  };
9505
9844
 
9506
9845
  // src/resources/tag_groups.ts
9507
- var TagGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9846
+ var TagGroupsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9508
9847
  constructor(http, pageSize) {
9509
9848
  super(http, {
9510
9849
  key: "tag_groups",
@@ -9573,7 +9912,7 @@ var TagGroupsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9573
9912
  };
9574
9913
 
9575
9914
  // src/resources/tags.ts
9576
- var TagsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9915
+ var TagsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9577
9916
  constructor(http, pageSize) {
9578
9917
  super(http, {
9579
9918
  key: "tags",
@@ -9642,7 +9981,7 @@ var TagsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9642
9981
  };
9643
9982
 
9644
9983
  // src/resources/task_secondary_resources.ts
9645
- var TaskSecondaryResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9984
+ var TaskSecondaryResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9646
9985
  constructor(http, pageSize) {
9647
9986
  super(http, {
9648
9987
  key: "task_secondary_resources",
@@ -9699,7 +10038,7 @@ var TaskSecondaryResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResourc
9699
10038
  };
9700
10039
 
9701
10040
  // src/resources/tasks.ts
9702
- var TasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10041
+ var TasksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9703
10042
  constructor(http, pageSize) {
9704
10043
  super(http, {
9705
10044
  key: "tasks",
@@ -9758,7 +10097,58 @@ var TasksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9758
10097
  /** Search Task records: bounded contains on title (no vendor free-text search exists);
9759
10098
  * limit defaults to 25, max 500. */
9760
10099
  async search(query, opts) {
9761
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _91 => _91.limit]) });
10100
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _96 => _96.limit]) });
10101
+ }
10102
+ };
10103
+
10104
+ // src/resources/tax_regions.ts
10105
+ var TaxRegionsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10106
+ constructor(http, pageSize) {
10107
+ super(http, {
10108
+ key: "tax_regions",
10109
+ resourcePath: "/V1.0/TaxRegions",
10110
+ deletable: false,
10111
+ udfCapable: false,
10112
+ collectionUpdate: true
10113
+ // D1: the spec's item path is GET-only — confirmed updates PUT the collection (id in the body)
10114
+ }, pageSize);
10115
+ }
10116
+ /** Query TaxRegion records with the G3 filter surface (server-side JSON filter). */
10117
+ query(params) {
10118
+ return this.queryItems(params);
10119
+ }
10120
+ /** Get every TaxRegion record (the MCP-preferred read; 1000-page guarded). */
10121
+ async queryAll(params) {
10122
+ return this.queryAllItems(params);
10123
+ }
10124
+ /** Count matching records (queryCount envelope unwrapped to a plain number). */
10125
+ async count(params) {
10126
+ return this.countGlobal(params);
10127
+ }
10128
+ /** Get one record by id (item envelope; item: null → NotFoundError). */
10129
+ async get(id) {
10130
+ return this.getGlobal(id);
10131
+ }
10132
+ /** Create a record (OperationResultModel → { id}). `dryRun: true` returns the
10133
+ * pinned envelope (section 19.3) and never issues the create. A 2xx that is not the
10134
+ * specced envelope runs the plan-pinned marker recovery (issue #13 — one bounded read;
10135
+ * `recoverIdFromMarker: false` restores the pre-recovery behaviour). */
10136
+ async create(data, opts = {}) {
10137
+ if (opts.dryRun === true) return this.runCreateDryRun(data);
10138
+ return this.createGlobal(data, opts);
10139
+ }
10140
+ /** Update a record (PUT on the COLLECTION — the vendored spec's item path is GET-only; the vendor
10141
+ * keys the record by the id in the body). The vendor validates the FULL model on this route (V2), so a
10142
+ * partial body is merged into the CURRENT record first: one fresh GET (which also serves the
10143
+ * stale-object guard's read) then the collection PUT of the merged model — an explicit null in the
10144
+ * caller body sends null; an omitted field keeps the current value. `raw: true` in the opts bag sends
10145
+ * the body as-is (full model or intentional partial — the compatibility escape hatch; no merge read).
10146
+ * `dryRun: true` returns the pinned envelope whose `data` is the merged body (the exact confirmed
10147
+ * wire) with the best-effort diff, from that same single read; a caller-supplied lastModifiedDate that
10148
+ * mismatches the vendor's current value throws STALE_OBJECT before the mutation. */
10149
+ async update(id, data, opts = {}) {
10150
+ if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts);
10151
+ return this.updateGlobal(id, data, opts);
9762
10152
  }
9763
10153
  };
9764
10154
 
@@ -9787,7 +10177,7 @@ var ThresholdInformationResource = class {
9787
10177
  };
9788
10178
 
9789
10179
  // src/resources/ticket_additional_configuration_items.ts
9790
- var TicketAdditionalConfigurationItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10180
+ var TicketAdditionalConfigurationItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9791
10181
  constructor(http, pageSize) {
9792
10182
  super(http, {
9793
10183
  key: "ticket_additional_configuration_items",
@@ -9844,7 +10234,7 @@ var TicketAdditionalConfigurationItemsResource = class extends _chunkHQGE4WAVcjs
9844
10234
  };
9845
10235
 
9846
10236
  // src/resources/ticket_additional_contacts.ts
9847
- var TicketAdditionalContactsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10237
+ var TicketAdditionalContactsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9848
10238
  constructor(http, pageSize) {
9849
10239
  super(http, {
9850
10240
  key: "ticket_additional_contacts",
@@ -9901,7 +10291,7 @@ var TicketAdditionalContactsResource = class extends _chunkHQGE4WAVcjs.BaseResou
9901
10291
  };
9902
10292
 
9903
10293
  // src/resources/ticket_attachments.ts
9904
- var TicketAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10294
+ var TicketAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9905
10295
  constructor(http, pageSize) {
9906
10296
  super(http, {
9907
10297
  key: "ticket_attachments",
@@ -9963,7 +10353,7 @@ var TicketAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
9963
10353
  };
9964
10354
 
9965
10355
  // src/resources/ticket_categories.ts
9966
- var TicketCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10356
+ var TicketCategoriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
9967
10357
  constructor(http, pageSize) {
9968
10358
  super(http, {
9969
10359
  key: "ticket_categories",
@@ -10017,12 +10407,12 @@ var TicketCategoriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10017
10407
  /** Search TicketCategory records: bounded contains on name (no vendor free-text search exists);
10018
10408
  * limit defaults to 25, max 500. */
10019
10409
  async search(query, opts) {
10020
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _92 => _92.limit]) });
10410
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _97 => _97.limit]) });
10021
10411
  }
10022
10412
  };
10023
10413
 
10024
10414
  // src/resources/ticket_category_field_defaults.ts
10025
- var TicketCategoryFieldDefaultsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10415
+ var TicketCategoryFieldDefaultsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10026
10416
  constructor(http, pageSize) {
10027
10417
  super(http, {
10028
10418
  key: "ticket_category_field_defaults",
@@ -10064,7 +10454,7 @@ var TicketCategoryFieldDefaultsResource = class extends _chunkHQGE4WAVcjs.BaseRe
10064
10454
  };
10065
10455
 
10066
10456
  // src/resources/ticket_change_request_approvals.ts
10067
- var TicketChangeRequestApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10457
+ var TicketChangeRequestApprovalsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10068
10458
  constructor(http, pageSize) {
10069
10459
  super(http, {
10070
10460
  key: "ticket_change_request_approvals",
@@ -10123,12 +10513,11 @@ var TicketChangeRequestApprovalsResource = class extends _chunkHQGE4WAVcjs.BaseR
10123
10513
  // src/resources/special/_shared/move-engine.ts
10124
10514
  var _crypto = require('crypto');
10125
10515
  var MOVE_SOURCE_AGE_DEFAULT_DAYS = 14;
10126
- var TICKET_COMPLETE_STATUS = 5;
10127
10516
  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";
10128
- var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10517
+ var refuse = (code, message, ids2, operation, extra = {}) => new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(message, { code, operation, details: { status: "failed", ...ids2, ...extra } });
10129
10518
  async function queryRows(http, resource, filter, operation, retries) {
10130
10519
  const res = await http.request({ method: "POST", idempotent: true, path: `/V1.0/${resource}/query`, body: { MaxRecords: 5, filter }, operation, maxRetries: retries });
10131
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
10520
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
10132
10521
  }
10133
10522
  function sameValue(a, b) {
10134
10523
  if (a === null || a === void 0 || a === "") return b === null || b === void 0 || b === "";
@@ -10145,10 +10534,10 @@ function sameValue(a, b) {
10145
10534
  async function readTicket(http, id, retries, operation) {
10146
10535
  try {
10147
10536
  const res = await http.request({ method: "GET", path: `/V1.0/Tickets/${id}`, operation, maxRetries: retries });
10148
- const item = _optionalChain([res, 'optionalAccess', _93 => _93.item]);
10537
+ const item = _optionalChain([res, 'optionalAccess', _98 => _98.item]);
10149
10538
  return _nullishCoalesce(item, () => ( null));
10150
10539
  } catch (e) {
10151
- if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10540
+ if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
10152
10541
  throw e;
10153
10542
  }
10154
10543
  }
@@ -10169,20 +10558,28 @@ async function preview(http, spec, sourceId, toTicketId, opts) {
10169
10558
  }
10170
10559
  }
10171
10560
  const cap = opts.maxSourceAgeDays === void 0 ? MOVE_SOURCE_AGE_DEFAULT_DAYS : Math.min(MOVE_SOURCE_AGE_DEFAULT_DAYS, opts.maxSourceAgeDays);
10172
- if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10561
+ if (!Number.isFinite(cap) || cap < 0) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${op}: maxSourceAgeDays must be a number >= 0`);
10173
10562
  const when = Date.parse(String(_nullishCoalesce(source[spec.dateField], () => ( ""))));
10174
10563
  if (!Number.isFinite(when) || Date.now() - when > cap * 864e5) {
10175
10564
  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") });
10176
10565
  }
10177
10566
  const target = await readTicket(http, toTicketId, opts.maxRetries, op);
10178
10567
  if (target === null) throw refuse("MOVE_TARGET_MISSING", `${op}: target ticket ${toTicketId} does not exist`, ids2, op);
10179
- if (target.status === TICKET_COMPLETE_STATUS || target.completedDate !== void 0 && target.completedDate !== null) {
10180
- throw refuse("MOVE_TARGET_CLOSED", `${op}: target ticket ${toTicketId} is closed (status 5 or completed)`, ids2, op);
10568
+ const closedStatus = await resolveTicketStatusSemantics(http);
10569
+ if (isClosedStatus(target.status, closedStatus.closedIds) || target.completedDate !== void 0 && target.completedDate !== null) {
10570
+ throw refuse(
10571
+ "MOVE_TARGET_CLOSED",
10572
+ `${op}: target ticket ${toTicketId} is closed (status in [${closedStatus.closedIds.join(", ")}] or completed) \u2014 closed ids ${closedStatus.source === "assumed" ? "ASSUMED (the tenant status picklist could not be read)" : "resolved from the tenant Tickets status picklist"}`,
10573
+ ids2,
10574
+ op,
10575
+ { closedStatusIds: closedStatus.closedIds, closedStatusSource: closedStatus.source }
10576
+ );
10181
10577
  }
10182
10578
  const origin = await readTicket(http, sourceTicketId, opts.maxRetries, op);
10183
10579
  const facts = {
10580
+ closedStatus: { closedIds: closedStatus.closedIds, source: closedStatus.source, note: closedStatus.note },
10184
10581
  sourceTicketId,
10185
- sourceCompanyID: _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _94 => _94.companyID]), () => ( null)),
10582
+ sourceCompanyID: _nullishCoalesce(_optionalChain([origin, 'optionalAccess', _99 => _99.companyID]), () => ( null)),
10186
10583
  targetCompanyID: _nullishCoalesce(target.companyID, () => ( null)),
10187
10584
  companyChanged: origin === null ? null : origin.companyID !== target.companyID,
10188
10585
  contractChanged: origin === null ? null : (_nullishCoalesce(origin.contractID, () => ( null))) !== (_nullishCoalesce(target.contractID, () => ( null)))
@@ -10204,17 +10601,17 @@ async function assertNoTwin(ctx, payload) {
10204
10601
  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 });
10205
10602
  }
10206
10603
  }
10207
- var statusOf = (e) => _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10604
+ var statusOf = (e) => _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) ? e.httpStatus : void 0;
10208
10605
  async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10209
10606
  const op = spec.operation;
10210
- const sourceId = Number(_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10211
- const toTicketId = Number(_chunkHQGE4WAVcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10607
+ const sourceId = Number(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, sourceIdIn, "sourceId"));
10608
+ const toTicketId = Number(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, toTicketIn, "toTicketId"));
10212
10609
  if (!Number.isSafeInteger(sourceId) || !Number.isSafeInteger(toTicketId)) {
10213
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10610
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${op}: sourceId and toTicketId must be safe integers`);
10214
10611
  }
10215
10612
  const { ctx, payload } = await preview(http, spec, sourceId, toTicketId, opts);
10216
10613
  if (opts.dryRun === true) {
10217
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
10614
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
10218
10615
  {
10219
10616
  operation: op,
10220
10617
  method: "POST",
@@ -10239,22 +10636,22 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10239
10636
  let newId;
10240
10637
  try {
10241
10638
  const created = await http.request({ method: "POST", path: spec.createPath(toTicketId), body: payload, operation: op, maxRetries: 0 });
10242
- newId = Number(_chunkHQGE4WAVcjs.unwrapOperation.call(void 0, created, op).id);
10639
+ newId = Number(_chunkD5IVS6GYcjs.unwrapOperation.call(void 0, created, op).id);
10243
10640
  } catch (e) {
10244
10641
  const status = statusOf(e);
10245
10642
  if (status !== void 0 && status >= 400 && status < 500) {
10246
- throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10643
+ throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the vendor refused the create \u2014 nothing changed`, { code: "MOVE_CREATE_REFUSED", operation: op, httpStatus: status, details: { status: "failed", ...ids2 } });
10247
10644
  }
10248
- throw new (0, _chunkHQGE4WAVcjs.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 } });
10645
+ throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the create outcome is unknown (never resent) \u2014 check the target ticket for a new ${spec.entity} before retrying; the twin check blocks a second create`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2 } });
10249
10646
  }
10250
10647
  const rollback = async (code, message) => {
10251
10648
  try {
10252
10649
  await http.request({ method: "DELETE", path: spec.deletePath(newId, toTicketId), operation: op, maxRetries: 0 });
10253
10650
  } catch (re) {
10254
10651
  const unreadable = statusOf(re) === void 0 || (_nullishCoalesce(statusOf(re), () => ( 0))) >= 500;
10255
- throw new (0, _chunkHQGE4WAVcjs.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 } });
10652
+ throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: ${message}; rolling back the new ${spec.entity} ${newId} FAILED \u2014 both records exist`, { code: unreadable ? "MOVE_UNKNOWN" : "MOVE_PARTIAL", operation: op, details: { status: unreadable ? "unknown" : "partial", ...ids2, newId, reason: code } });
10256
10653
  }
10257
- throw new (0, _chunkHQGE4WAVcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10654
+ throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: ${message}; the new ${spec.entity} ${newId} was rolled back, the source is unchanged`, { code, operation: op, details: { status: "failed", ...ids2, newId } });
10258
10655
  };
10259
10656
  const fresh = await spec.readById(http, newId, toTicketId).catch(() => null);
10260
10657
  if (fresh === null) return rollback("MOVE_VERIFY_FAILED", "the new record could not be read back");
@@ -10283,33 +10680,33 @@ async function runMove(http, spec, sourceIdIn, toTicketIn, opts = {}) {
10283
10680
  };
10284
10681
  }
10285
10682
  if (status === void 0) {
10286
- throw new (0, _chunkHQGE4WAVcjs.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 } });
10683
+ throw new (0, _chunkD5IVS6GYcjs.MoveRefusedError)(`${op}: the source delete outcome is unknown (never resent) \u2014 re-read the source: absent means the move completed`, { code: "MOVE_UNKNOWN", operation: op, details: { status: "unknown", ...ids2, newId } });
10287
10684
  }
10288
10685
  return rollback("MOVE_SOURCE_DELETE_FAILED", `the source delete failed (HTTP ${status})`);
10289
10686
  }
10290
10687
  return { status: "moved", sourceId, newId, correlationId, snapshot: ctx.source, facts: ctx.facts };
10291
10688
  }
10292
10689
  function uiLinkFor(http, entity, id) {
10293
- return _nullishCoalesce(_chunkHQGE4WAVcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10690
+ return _nullishCoalesce(_chunkD5IVS6GYcjs.buildUiLink.call(void 0, { entity, id, baseUrl: http.baseUrl }), () => ( null));
10294
10691
  }
10295
10692
 
10296
10693
  // src/resources/special/ticket_charges.ts
10297
- var OP2 = "ticket_charges.moveToTicket";
10694
+ var OP3 = "ticket_charges.moveToTicket";
10298
10695
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
10299
10696
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
10300
10697
  async function readCharge(http, id, retries) {
10301
- const rows = await queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP2, retries);
10698
+ const rows = await queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
10302
10699
  return _nullishCoalesce(rows[0], () => ( null));
10303
10700
  }
10304
10701
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
10305
10702
  if (source.isBilled === true) {
10306
- throw refuse("MOVE_BLOCKED_BILLED", `${OP2}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP2, {
10703
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
10307
10704
  manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
10308
10705
  });
10309
10706
  }
10310
10707
  }
10311
10708
  var SPEC = {
10312
- operation: OP2,
10709
+ operation: OP3,
10313
10710
  entity: "ticket_charge",
10314
10711
  readSource: readCharge,
10315
10712
  sourceTicketId: (s) => typeof s.ticketID === "number" ? s.ticketID : null,
@@ -10345,7 +10742,7 @@ function moveToTicket(_resource, sourceId, toTicketId, opts, http) {
10345
10742
  }
10346
10743
 
10347
10744
  // src/resources/ticket_charges.ts
10348
- var TicketChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10745
+ var TicketChargesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10349
10746
  constructor(http, pageSize) {
10350
10747
  super(http, {
10351
10748
  key: "ticket_charges",
@@ -10411,7 +10808,7 @@ var TicketChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10411
10808
  /** Search TicketCharge records: bounded contains on name (no vendor free-text search exists);
10412
10809
  * limit defaults to 25, max 500. */
10413
10810
  async search(query, opts) {
10414
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _95 => _95.limit]) });
10811
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _100 => _100.limit]) });
10415
10812
  }
10416
10813
  /** Node-parity special op (hand-written in src/resources/special/ticket_charges.ts). */
10417
10814
  moveToTicket(sourceId, toTicketId, opts = {}) {
@@ -10420,7 +10817,7 @@ var TicketChargesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10420
10817
  };
10421
10818
 
10422
10819
  // src/resources/ticket_checklist_items.ts
10423
- var TicketChecklistItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10820
+ var TicketChecklistItemsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10424
10821
  constructor(http, pageSize) {
10425
10822
  super(http, {
10426
10823
  key: "ticket_checklist_items",
@@ -10486,7 +10883,7 @@ var TicketChecklistItemsResource = class extends _chunkHQGE4WAVcjs.BaseResource
10486
10883
  };
10487
10884
 
10488
10885
  // src/resources/ticket_checklist_libraries.ts
10489
- var TicketChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10886
+ var TicketChecklistLibrariesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10490
10887
  constructor(http, pageSize) {
10491
10888
  super(http, {
10492
10889
  key: "ticket_checklist_libraries",
@@ -10510,9 +10907,9 @@ var TicketChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResou
10510
10907
  * `dryRun: true` returns the pinned envelope (document existence is unverifiable in the MVP
10511
10908
  * surface — no documents read op — and never issues the POST). */
10512
10909
  async attachToDocument(documentID, data, opts = {}) {
10513
- const n = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, documentID, "documentID");
10910
+ const n = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, documentID, "documentID");
10514
10911
  if (opts.dryRun === true) {
10515
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
10912
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
10516
10913
  operation: "ticket_checklist_libraries.attachToDocument",
10517
10914
  method: "POST",
10518
10915
  path: `/V1.0/Documents/${n}/ChecklistLibraries`,
@@ -10530,7 +10927,7 @@ var TicketChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResou
10530
10927
  operation: "ticket_checklist_libraries.attachToDocument",
10531
10928
  maxRetries: opts.maxRetries
10532
10929
  });
10533
- return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
10930
+ return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
10534
10931
  }
10535
10932
  /** Resolve a TicketChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
10536
10933
  * from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
@@ -10546,7 +10943,7 @@ var TicketChecklistLibrariesResource = class extends _chunkHQGE4WAVcjs.BaseResou
10546
10943
  };
10547
10944
 
10548
10945
  // src/resources/ticket_history.ts
10549
- var TicketHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10946
+ var TicketHistoryResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10550
10947
  constructor(http, pageSize) {
10551
10948
  super(http, {
10552
10949
  key: "ticket_history",
@@ -10585,7 +10982,7 @@ var TicketHistoryResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10585
10982
  };
10586
10983
 
10587
10984
  // src/resources/ticket_note_attachments.ts
10588
- var TicketNoteAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10985
+ var TicketNoteAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10589
10986
  constructor(http, pageSize) {
10590
10987
  super(http, {
10591
10988
  key: "ticket_note_attachments",
@@ -10647,7 +11044,7 @@ var TicketNoteAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource
10647
11044
  };
10648
11045
 
10649
11046
  // src/resources/ticket_notes.ts
10650
- var TicketNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
11047
+ var TicketNotesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10651
11048
  constructor(http, pageSize) {
10652
11049
  super(http, {
10653
11050
  key: "ticket_notes",
@@ -10706,7 +11103,7 @@ var TicketNotesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10706
11103
  };
10707
11104
 
10708
11105
  // src/resources/ticket_note_webhooks.ts
10709
- var TicketNoteWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
11106
+ var TicketNoteWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10710
11107
  constructor(http, pageSize) {
10711
11108
  super(http, {
10712
11109
  key: "ticket_note_webhooks",
@@ -10777,12 +11174,12 @@ var TicketNoteWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
10777
11174
  /** Search TicketNoteWebhook records: bounded contains on name (no vendor free-text search exists);
10778
11175
  * limit defaults to 25, max 500. */
10779
11176
  async search(query, opts) {
10780
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _96 => _96.limit]) });
11177
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _101 => _101.limit]) });
10781
11178
  }
10782
11179
  };
10783
11180
 
10784
11181
  // src/resources/ticket_secondary_resources.ts
10785
- var TicketSecondaryResourcesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
11182
+ var TicketSecondaryResourcesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
10786
11183
  constructor(http, pageSize) {
10787
11184
  super(http, {
10788
11185
  key: "ticket_secondary_resources",
@@ -10847,9 +11244,9 @@ async function fetchTicket(http, id, operation) {
10847
11244
  });
10848
11245
  const body = res;
10849
11246
  if (body === null || !("item" in body)) {
10850
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11247
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10851
11248
  }
10852
- if (body.item === null || body.item === void 0) throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
11249
+ if (body.item === null || body.item === void 0) throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
10853
11250
  return body.item;
10854
11251
  }
10855
11252
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -10860,7 +11257,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
10860
11257
  body: { MaxRecords: maxRecords, filter },
10861
11258
  operation
10862
11259
  });
10863
- return _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res).items;
11260
+ return _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res).items;
10864
11261
  }
10865
11262
  function truncate(text, limit) {
10866
11263
  const full = _nullishCoalesce(text, () => ( ""));
@@ -10870,26 +11267,26 @@ function truncate(text, limit) {
10870
11267
 
10871
11268
  // src/resources/special/tickets/childRead.ts
10872
11269
  function isRouteUnavailable(err) {
10873
- return _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
11270
+ return _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) && (err.httpStatus === 404 || err.httpStatus === 500);
10874
11271
  }
10875
11272
  function routeFact(route, path, err) {
10876
11273
  return {
10877
11274
  route,
10878
11275
  path,
10879
- httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
11276
+ httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) && typeof err.httpStatus === "number" ? err.httpStatus : null
10880
11277
  };
10881
11278
  }
10882
11279
  function childDeclaresQuery(resourceKey) {
10883
- return _chunkWM6E5O55cjs.CAPABILITIES.some(
11280
+ return _chunkZEGMVEF3cjs.CAPABILITIES.some(
10884
11281
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
10885
11282
  );
10886
11283
  }
10887
11284
  function planScopedPath(resourceKey, ticketId) {
10888
11285
  if (!childDeclaresQuery(resourceKey)) return null;
10889
- const entry = _chunkHQGE4WAVcjs.RELATIONSHIP_MAP[resourceKey];
11286
+ const entry = _chunkD5IVS6GYcjs.RELATIONSHIP_MAP[resourceKey];
10890
11287
  const parent = entry === void 0 ? null : entry.parent;
10891
11288
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
10892
- const parentPath = _optionalChain([_chunkHQGE4WAVcjs.RELATIONSHIP_MAP, 'access', _97 => _97[parent.resource], 'optionalAccess', _98 => _98.path]);
11289
+ const parentPath = _optionalChain([_chunkD5IVS6GYcjs.RELATIONSHIP_MAP, 'access', _102 => _102[parent.resource], 'optionalAccess', _103 => _103.path]);
10893
11290
  if (parentPath === null || parentPath === void 0) return null;
10894
11291
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
10895
11292
  }
@@ -10928,14 +11325,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
10928
11325
  break;
10929
11326
  }
10930
11327
  const body = await http.request({ method: "GET", path: target, operation });
10931
- const { items: pageItems, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, body, operation);
11328
+ const { items: pageItems, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, body, operation);
10932
11329
  nextCursor = pageDetails.nextPageUrl;
10933
11330
  pages += 1;
10934
11331
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
10935
11332
  for (const row of window) if (accept(row)) items.push(row);
10936
11333
  if (items.length >= limit) break;
10937
11334
  if (nextCursor === null || pageItems.length === 0) break;
10938
- target = _chunkHQGE4WAVcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
11335
+ target = _chunkD5IVS6GYcjs.cursorToPath.call(void 0, http.baseUrl, nextCursor);
10939
11336
  }
10940
11337
  const capped = items.length >= limit || guard && nextCursor !== null;
10941
11338
  return { items, capped };
@@ -10968,7 +11365,7 @@ var MS = 864e5;
10968
11365
  var SLA_PAGE = 100;
10969
11366
  async function slaHealthCheck(_resource, id, opts = {}, http) {
10970
11367
  void opts;
10971
- const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
11368
+ const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
10972
11369
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
10973
11370
  const rows = await ticketQueryItems(
10974
11371
  http,
@@ -10993,9 +11390,9 @@ async function slaHealthCheck(_resource, id, opts = {}, http) {
10993
11390
  async function summary(_resource, id, opts = {}, http) {
10994
11391
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
10995
11392
  if (!Number.isInteger(limit) || limit < 1) {
10996
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
11393
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
10997
11394
  }
10998
- const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
11395
+ const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
10999
11396
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
11000
11397
  const desc = truncate(ticket.description, limit);
11001
11398
  const now = _nullishCoalesce(opts.now, () => ( /* @__PURE__ */ new Date()));
@@ -11024,11 +11421,11 @@ async function summary(_resource, id, opts = {}, http) {
11024
11421
  // src/resources/special/tickets/timeline.ts
11025
11422
  function validateTimelineLimits(opts) {
11026
11423
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
11027
- if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11424
+ if (!Number.isInteger(limit) || limit < 1) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
11028
11425
  const bounded = Math.min(limit, 500);
11029
11426
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
11030
11427
  if (!Number.isInteger(textLimit) || textLimit < 1) {
11031
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11428
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
11032
11429
  }
11033
11430
  return { bounded, textLimit };
11034
11431
  }
@@ -11080,7 +11477,7 @@ function compareEventDates(a, b) {
11080
11477
  }
11081
11478
  async function timeline(_resource, id, opts = {}, http) {
11082
11479
  const { bounded, textLimit } = validateTimelineLimits(opts);
11083
- const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
11480
+ const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11084
11481
  await fetchTicket(http, ticketId, "tickets.timeline");
11085
11482
  const dateFilters = (field) => {
11086
11483
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11120,7 +11517,7 @@ async function timeline(_resource, id, opts = {}, http) {
11120
11517
  }
11121
11518
 
11122
11519
  // src/resources/special/tickets/errors.ts
11123
- var QueueRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11520
+ var QueueRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11124
11521
  constructor(message, options = {}) {
11125
11522
  super(message, {
11126
11523
  code: "QUEUE_REQUIRED",
@@ -11131,13 +11528,13 @@ var QueueRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11131
11528
  this.name = "QueueRequiredError";
11132
11529
  }
11133
11530
  };
11134
- var TicketResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11531
+ var TicketResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11135
11532
  constructor(message, options = {}) {
11136
11533
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
11137
11534
  this.name = "TicketResourceInvalidError";
11138
11535
  }
11139
11536
  };
11140
- var TicketCreateValidationFailedError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11537
+ var TicketCreateValidationFailedError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11141
11538
  /** The vendor-named fields (empty when the 500 body named nothing parseable). */
11142
11539
 
11143
11540
  constructor(message, vendorFields, options = {}) {
@@ -11146,7 +11543,7 @@ var TicketCreateValidationFailedError = class extends _chunkHQGE4WAVcjs.Autotask
11146
11543
  this.vendorFields = vendorFields;
11147
11544
  }
11148
11545
  };
11149
- var StatusUnknownError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11546
+ var StatusUnknownError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11150
11547
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
11151
11548
 
11152
11549
  constructor(message, options = {}) {
@@ -11160,7 +11557,7 @@ var StatusUnknownError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11160
11557
  this.picklistCount = _nullishCoalesce(options.picklistCount, () => ( 0));
11161
11558
  }
11162
11559
  };
11163
- var StatusFieldsRequiredError = class extends _chunkHQGE4WAVcjs.AutotaskError {
11560
+ var StatusFieldsRequiredError = class extends _chunkD5IVS6GYcjs.AutotaskError {
11164
11561
 
11165
11562
 
11166
11563
 
@@ -11183,21 +11580,21 @@ function isPositiveInt(v) {
11183
11580
  return typeof v === "number" && Number.isInteger(v) && v > 0;
11184
11581
  }
11185
11582
  function namedVendorFields(err) {
11186
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11187
- const entries = _nullishCoalesce(_chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11583
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return [];
11584
+ const entries = _nullishCoalesce(_chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError), () => ( []));
11188
11585
  const out = /* @__PURE__ */ new Set();
11189
11586
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
11190
11587
  return [...out];
11191
11588
  }
11192
11589
  function vendorDetailOf(err) {
11193
- return _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? _chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11590
+ return _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? _chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError) : void 0;
11194
11591
  }
11195
11592
  async function fetchItem(http, path, operation, readOpts) {
11196
- const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _99 => _99.maxRetries]) });
11593
+ const res = await http.request({ method: "GET", path, operation, maxRetries: _optionalChain([readOpts, 'optionalAccess', _104 => _104.maxRetries]) });
11197
11594
  return unwrapItemOrNull(res);
11198
11595
  }
11199
11596
  async function fetchItemUnredacted(http, path, operation, readOpts) {
11200
- const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true, maxRetries: _optionalChain([readOpts, 'optionalAccess', _100 => _100.maxRetries]) });
11597
+ const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true, maxRetries: _optionalChain([readOpts, 'optionalAccess', _105 => _105.maxRetries]) });
11201
11598
  return unwrapItemOrNull(res);
11202
11599
  }
11203
11600
  function unwrapItemOrNull(res) {
@@ -11211,8 +11608,8 @@ function operationId(res) {
11211
11608
  return typeof body.itemId === "number" ? body.itemId : typeof body.id === "number" ? body.id : void 0;
11212
11609
  }
11213
11610
  function discoveryMerge(err, body, defaults) {
11214
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11215
- const entries = _chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError);
11611
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
11612
+ const entries = _chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError);
11216
11613
  if (entries === void 0) return null;
11217
11614
  for (const entry of entries) {
11218
11615
  const field = entry.field;
@@ -11224,7 +11621,7 @@ function discoveryMerge(err, body, defaults) {
11224
11621
  }
11225
11622
  function stepErrorText(code, err) {
11226
11623
  const detail = vendorDetailOf(err);
11227
- const base = _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11624
+ const base = _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.message : String(err);
11228
11625
  return detail ? `${code}: ${detail}` : `${code}: ${base}`;
11229
11626
  }
11230
11627
 
@@ -11236,43 +11633,43 @@ var DEFAULT_PUBLISH = 1;
11236
11633
  var PUBLISH_VALUES = /* @__PURE__ */ new Set([1, 2, 4]);
11237
11634
  var SAFE_TICKET_CREATE_DEFAULTS = {};
11238
11635
  function validateOpenInput(params, note, assign) {
11239
- const companyID = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _101 => _101.companyID]), "params.companyID");
11240
- const title = _optionalChain([params, 'optionalAccess', _102 => _102.title]);
11636
+ const companyID = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, _optionalChain([params, 'optionalAccess', _106 => _106.companyID]), "params.companyID");
11637
+ const title = _optionalChain([params, 'optionalAccess', _107 => _107.title]);
11241
11638
  if (typeof title !== "string" || title.trim() === "") {
11242
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11639
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: params.title is required (a non-empty string)", { operation: OP_OPEN });
11243
11640
  }
11244
11641
  const priority = _nullishCoalesce(params.priority, () => ( DEFAULT_TICKET_PRIORITY));
11245
11642
  const status = _nullishCoalesce(params.status, () => ( DEFAULT_TICKET_STATUS));
11246
11643
  if (!isPositiveInt(priority)) {
11247
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11644
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.priority must be a positive integer (got ${String(params.priority)})`, { operation: OP_OPEN });
11248
11645
  }
11249
11646
  if (!isPositiveInt(status)) {
11250
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11647
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.status must be a positive integer (got ${String(params.status)})`, { operation: OP_OPEN });
11251
11648
  }
11252
11649
  if (params.queueID !== void 0 && !isPositiveInt(params.queueID)) {
11253
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11650
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: params.queueID must be a positive integer (got ${String(params.queueID)})`, { operation: OP_OPEN });
11254
11651
  }
11255
11652
  if (note !== void 0) {
11256
11653
  if (typeof note.description !== "string" || note.description.trim() === "") {
11257
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11654
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: note.description is required (a non-empty string)", { operation: OP_OPEN });
11258
11655
  }
11259
11656
  if (typeof note.title !== "string" || note.title.trim() === "") {
11260
- throw new (0, _chunkHQGE4WAVcjs.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 });
11657
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: note.title is required (a non-empty string) \u2014 the ww29 scoped note create 500s without it (S12-A live-verified: Missing Required Field: title; the S11-B proven note body is { title, description, noteType: 1, publish: 1 })", { operation: OP_OPEN });
11261
11658
  }
11262
11659
  if (note.noteType !== void 0 && !isPositiveInt(note.noteType)) {
11263
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11660
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.noteType must be a positive integer (got ${String(note.noteType)})`, { operation: OP_OPEN });
11264
11661
  }
11265
11662
  if (note.publish !== void 0 && !PUBLISH_VALUES.has(note.publish)) {
11266
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11663
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: note.publish must be an integer picklist value 1/2/4 (got ${String(note.publish)} \u2014 NOT a boolean)`, { operation: OP_OPEN });
11267
11664
  }
11268
11665
  }
11269
- const assignee = assign === void 0 ? void 0 : _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11666
+ const assignee = assign === void 0 ? void 0 : _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, assign.resourceID, "assign.resourceID");
11270
11667
  if (assign !== void 0 && assignee !== void 0 && (typeof assignee === "number" ? assignee < 1 : false)) {
11271
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11668
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`openWithNoteAndAssign: assign.resourceID must be a positive integer (got ${String(assignee)})`, { operation: OP_OPEN });
11272
11669
  }
11273
- const roleID = _optionalChain([assign, 'optionalAccess', _103 => _103.roleID]);
11670
+ const roleID = _optionalChain([assign, 'optionalAccess', _108 => _108.roleID]);
11274
11671
  if (assign !== void 0 && !isPositiveInt(roleID)) {
11275
- throw new (0, _chunkHQGE4WAVcjs.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 });
11672
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("openWithNoteAndAssign: assign.roleID is required (a positive integer) \u2014 the ww29 vendor requires BOTH assignedResourceID and assignedResourceRoleID when assigning a resource (S12-A live-verified: Data violation: When assigning a Resource, you must assign both a assignedResourceID and assignedResourceRoleID)", { operation: OP_OPEN });
11276
11673
  }
11277
11674
  return { companyID, title, priority, status, assignee, roleID };
11278
11675
  }
@@ -11301,7 +11698,7 @@ function openDryRun(http, v, params, assign, body, noteBody) {
11301
11698
  if (assign !== void 0) {
11302
11699
  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).`);
11303
11700
  }
11304
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
11701
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11305
11702
  {
11306
11703
  operation: OP_OPEN,
11307
11704
  method: "POST",
@@ -11341,8 +11738,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11341
11738
  `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}` : ""}`,
11342
11739
  {
11343
11740
  operation: OP_OPEN,
11344
- httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11345
- vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11741
+ httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11742
+ vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0
11346
11743
  }
11347
11744
  );
11348
11745
  }
@@ -11357,8 +11754,8 @@ async function createTicketWithDiscovery(resource, params, companyID, body, step
11357
11754
  named,
11358
11755
  {
11359
11756
  operation: OP_OPEN,
11360
- httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11361
- vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11757
+ httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11758
+ vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11362
11759
  resourceIds: [companyID],
11363
11760
  details: { idRefs: [{ entity: "company", id: companyID }] }
11364
11761
  }
@@ -11383,10 +11780,10 @@ async function assignStep(http, ticketId, assignee, roleID, opts, steps) {
11383
11780
  try {
11384
11781
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
11385
11782
  if (current === null) {
11386
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11783
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11387
11784
  }
11388
11785
  ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
11389
- const merged = _chunkHQGE4WAVcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11786
+ const merged = _chunkD5IVS6GYcjs.mergePartialBody.call(void 0, current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
11390
11787
  merged.id = ticketId;
11391
11788
  await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
11392
11789
  assigned = true;
@@ -11450,17 +11847,17 @@ async function guardTargetStatus(resource, http, targetStatus) {
11450
11847
  const ids2 = await readLiveStatusSet(resource);
11451
11848
  if (ids2.size > 0) liveStatus = ids2;
11452
11849
  } catch (err) {
11453
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11850
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11454
11851
  }
11455
11852
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
11456
- _optionalChain([http, 'access', _104 => _104.fieldCache, 'optionalAccess', _105 => _105.invalidate, 'call', _106 => _106("tickets")]);
11853
+ _optionalChain([http, 'access', _109 => _109.fieldCache, 'optionalAccess', _110 => _110.invalidate, 'call', _111 => _111("tickets")]);
11457
11854
  let freshStatus = null;
11458
11855
  let reReadFailed = false;
11459
11856
  try {
11460
11857
  const freshIds = await readLiveStatusSet(resource);
11461
11858
  if (freshIds.size > 0) freshStatus = freshIds;
11462
11859
  } catch (err) {
11463
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11860
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
11464
11861
  freshStatus = null;
11465
11862
  reReadFailed = true;
11466
11863
  }
@@ -11478,7 +11875,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
11478
11875
  return { guardDegraded: liveStatus === null };
11479
11876
  }
11480
11877
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
11481
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
11878
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11482
11879
  {
11483
11880
  operation: OP_STATUS,
11484
11881
  method: "PUT",
@@ -11509,7 +11906,7 @@ function resolveMergeData(ticketId, targetStatus, previousStatus, current, field
11509
11906
  for (const field of mapEntry.requiredFields) {
11510
11907
  if (mergeData[field] !== void 0) continue;
11511
11908
  if (current[field] !== null && current[field] !== void 0) continue;
11512
- const safe = _optionalChain([mapEntry, 'access', _107 => _107.safeDefaults, 'optionalAccess', _108 => _108[field]]);
11909
+ const safe = _optionalChain([mapEntry, 'access', _112 => _112.safeDefaults, 'optionalAccess', _113 => _113[field]]);
11513
11910
  if (safe === void 0) {
11514
11911
  throw new StatusFieldsRequiredError(
11515
11912
  `changeStatus: status ${targetStatus} requires the field '${field}' and the live-discovered map has no proven-safe default for it \u2014 the op is safe-without-the-map (never a blind full update): supply the value in fields and retry`,
@@ -11532,7 +11929,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11532
11929
  if (mapEntry === void 0) {
11533
11930
  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).`);
11534
11931
  }
11535
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
11932
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
11536
11933
  {
11537
11934
  operation: OP_STATUS,
11538
11935
  method: "PUT",
@@ -11551,8 +11948,8 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
11551
11948
  );
11552
11949
  }
11553
11950
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
11554
- const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _109 => _109.safeDefaults]), () => ( {}));
11555
- const body = _chunkHQGE4WAVcjs.mergePartialBody.call(void 0, current, mergeData);
11951
+ const safeDefaults = _nullishCoalesce(_optionalChain([mapEntry, 'optionalAccess', _114 => _114.safeDefaults]), () => ( {}));
11952
+ const body = _chunkD5IVS6GYcjs.mergePartialBody.call(void 0, current, mergeData);
11556
11953
  body.id = ticketId;
11557
11954
  let merges = 0;
11558
11955
  for (; ; ) {
@@ -11576,8 +11973,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11576
11973
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
11577
11974
  {
11578
11975
  operation: OP_STATUS,
11579
- httpStatus: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11580
- vendorError: _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11976
+ httpStatus: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.httpStatus : void 0,
11977
+ vendorError: _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? err.vendorError : void 0,
11581
11978
  resourceIds: [ticketId],
11582
11979
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
11583
11980
  }
@@ -11590,7 +11987,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
11590
11987
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11591
11988
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11592
11989
  if (verify === null) {
11593
- throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11990
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
11594
11991
  code: "INVALID_RESPONSE",
11595
11992
  category: "server",
11596
11993
  operation: OP_STATUS,
@@ -11600,7 +11997,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11600
11997
  }
11601
11998
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
11602
11999
  if (finalStatus !== targetStatus) {
11603
- throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(
12000
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(
11604
12001
  `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)`,
11605
12002
  {
11606
12003
  code: "INVALID_RESPONSE",
@@ -11615,17 +12012,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
11615
12012
  }
11616
12013
  }
11617
12014
  async function changeStatus(resource, id, targetStatus, fields, opts, http) {
11618
- const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
12015
+ const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11619
12016
  if (!isPositiveInt(targetStatus)) {
11620
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
12017
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
11621
12018
  }
11622
12019
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
11623
12020
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
11624
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
12021
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
11625
12022
  }
11626
12023
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
11627
12024
  if (current === null) {
11628
- throw new (0, _chunkHQGE4WAVcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
12025
+ throw new (0, _chunkD5IVS6GYcjs.NotFoundError)(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
11629
12026
  }
11630
12027
  const previousStatus = typeof current.status === "number" ? current.status : null;
11631
12028
  if (previousStatus === targetStatus) {
@@ -11645,7 +12042,7 @@ var DEFAULT_PART_LIMIT = 50;
11645
12042
  function partLimit(value, name) {
11646
12043
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
11647
12044
  if (!Number.isInteger(n) || n < 1) {
11648
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
12045
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
11649
12046
  }
11650
12047
  return n;
11651
12048
  }
@@ -11658,7 +12055,7 @@ function servedTextRecord(row, textField, limit) {
11658
12055
  return out;
11659
12056
  }
11660
12057
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
11661
- const builder = _chunkHQGE4WAVcjs.createNamePlan.call(void 0, _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS);
12058
+ const builder = _chunkD5IVS6GYcjs.createNamePlan.call(void 0, _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS);
11662
12059
  const t = ctx.ticket;
11663
12060
  builder.addResource(t["creatorResourceID"]);
11664
12061
  builder.addFk("contract", t["contractID"]);
@@ -11670,20 +12067,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
11670
12067
  builder.addFk("billingCode", e["billingCodeID"]);
11671
12068
  builder.addFk("contract", e["contractID"]);
11672
12069
  }
11673
- const names = await _chunkHQGE4WAVcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
12070
+ const names = await _chunkD5IVS6GYcjs.resolveCompositeNames.call(void 0, http, builder.plan(), { maxNameReads: opts.maxNameReads });
11674
12071
  const ticketRow = { ...ctx.ticket };
11675
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
11676
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
11677
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
11678
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
11679
- for (const f of _chunkHQGE4WAVcjs.TICKET_LABEL_FIELDS) _chunkHQGE4WAVcjs.addLabelSibling.call(void 0, ticketRow, f, names);
12072
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "creatorResourceID", (v) => names.resourceName(v));
12073
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "contractID", (v) => names.recordName("contract", v));
12074
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
12075
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
12076
+ for (const f of _chunkD5IVS6GYcjs.TICKET_LABEL_FIELDS) _chunkD5IVS6GYcjs.addLabelSibling.call(void 0, ticketRow, f, names);
11680
12077
  result.ticket = ticketRow;
11681
12078
  result.timeEntries.items = entriesPart.items.map((e) => {
11682
12079
  const row = { ...e };
11683
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
11684
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
11685
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
11686
- _chunkHQGE4WAVcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
12080
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "resourceID", (v) => names.resourceName(v));
12081
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "roleID", (v) => names.recordName("role", v));
12082
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "billingCodeID", (v) => names.recordName("billingCode", v));
12083
+ _chunkD5IVS6GYcjs.addNameSibling.call(void 0, row, "contractID", (v) => names.recordName("contract", v));
11687
12084
  return row;
11688
12085
  });
11689
12086
  result.names = names.section;
@@ -11693,7 +12090,7 @@ async function fullContext(resource, id, opts = {}, http) {
11693
12090
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
11694
12091
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
11695
12092
  const textLimit = partLimit(opts.textLimit, "textLimit");
11696
- const ticketId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
12093
+ const ticketId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
11697
12094
  const ctx = await resource.getContext(ticketId);
11698
12095
  const op = "tickets.fullContext";
11699
12096
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -11750,8 +12147,123 @@ async function fullContext(resource, id, opts = {}, http) {
11750
12147
  return result;
11751
12148
  }
11752
12149
 
12150
+ // src/resources/special/tickets/forResource.ts
12151
+ var OP4 = "tickets.forResource";
12152
+ var TICKET_CHUNK = 100;
12153
+ var LIMIT_DEFAULT = 100;
12154
+ var LIMIT_MAX = 500;
12155
+ var LINK_READ_CAP = 500;
12156
+ var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
12157
+ function positiveId(value, name) {
12158
+ const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12159
+ if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12160
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
12161
+ }
12162
+ return n;
12163
+ }
12164
+ async function ticketPage(http, filter, maxRecords, fields) {
12165
+ const res = await http.request({
12166
+ method: "POST",
12167
+ idempotent: true,
12168
+ path: "/V1.0/Tickets/query",
12169
+ body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
12170
+ operation: OP4
12171
+ });
12172
+ const page = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP4);
12173
+ return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
12174
+ }
12175
+ async function forResource(_resource, resourceIDIn, http, opts = {}) {
12176
+ if (opts === null || typeof opts !== "object") throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: opts must be an object`, { operation: OP4 });
12177
+ const resourceID = positiveId(resourceIDIn, "resourceID");
12178
+ const scope = _nullishCoalesce(opts.scope, () => ( "both"));
12179
+ if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
12180
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
12181
+ }
12182
+ if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
12183
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
12184
+ }
12185
+ const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
12186
+ if (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX) {
12187
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
12188
+ }
12189
+ const includeFields = _nullishCoalesce(opts.includeFields, () => ( []));
12190
+ if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
12191
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
12192
+ }
12193
+ const openOnly = opts.openOnly === true;
12194
+ const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS2, ...includeFields])];
12195
+ const closed = await resolveTicketStatusSemantics(http, opts.excludeStatusIds === void 0 ? {} : { excludeStatusIds: opts.excludeStatusIds });
12196
+ const closedStatus = { closedIds: closed.closedIds, source: closed.source, note: closed.note };
12197
+ const openLeaf = openOnly ? [openStatusFilter(closed.closedIds)] : [];
12198
+ const linkIds = [];
12199
+ let capped = false;
12200
+ if (scope !== "primary") {
12201
+ const res = await http.request({
12202
+ method: "POST",
12203
+ idempotent: true,
12204
+ path: "/V1.0/TicketSecondaryResources/query",
12205
+ body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
12206
+ operation: OP4
12207
+ });
12208
+ const page = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP4);
12209
+ for (const row of page.items) if (typeof row.ticketID === "number" && !linkIds.includes(row.ticketID)) linkIds.push(row.ticketID);
12210
+ if (page.items.length >= LINK_READ_CAP || page.pageDetails.nextPageUrl !== null) capped = true;
12211
+ }
12212
+ const primary = /* @__PURE__ */ new Map();
12213
+ if (scope !== "secondary") {
12214
+ const page = await ticketPage(http, [{ field: "assignedResourceID", op: "eq", value: resourceID }, ...openLeaf], limit, fields);
12215
+ if (page.more || page.rows.length >= limit) capped = true;
12216
+ for (const t of page.rows) if (typeof t.id === "number") primary.set(t.id, t);
12217
+ }
12218
+ const secondary = /* @__PURE__ */ new Map();
12219
+ const unresolvedIds = [];
12220
+ for (let c = 0; c < linkIds.length; c += TICKET_CHUNK) {
12221
+ const chunk = linkIds.slice(c, c + TICKET_CHUNK);
12222
+ const page = await ticketPage(http, [{ field: "id", op: "in", value: chunk }, ...openLeaf], chunk.length, fields);
12223
+ const seen = /* @__PURE__ */ new Set();
12224
+ for (const t of page.rows) {
12225
+ if (typeof t.id !== "number") continue;
12226
+ secondary.set(t.id, t);
12227
+ seen.add(t.id);
12228
+ }
12229
+ for (const id of chunk) if (!seen.has(id)) unresolvedIds.push(id);
12230
+ }
12231
+ const merged = /* @__PURE__ */ new Map();
12232
+ for (const [id, t] of primary) merged.set(id, t);
12233
+ for (const [id, t] of secondary) if (!merged.has(id)) merged.set(id, t);
12234
+ let tickets = [...merged.values()];
12235
+ if (openOnly) tickets = tickets.filter((t) => !isClosedStatus(t.status, closed.closedIds));
12236
+ tickets.sort((a, b) => Number(a.id) - Number(b.id));
12237
+ if (tickets.length > limit) {
12238
+ tickets = tickets.slice(0, limit);
12239
+ capped = true;
12240
+ }
12241
+ const openCount = tickets.filter((t) => !isClosedStatus(t.status, closed.closedIds)).length;
12242
+ const primaryIds = [...primary.keys()].sort((a, b) => a - b);
12243
+ const secondaryIds = [...secondary.keys()].sort((a, b) => a - b);
12244
+ const both = primaryIds.filter((id) => secondary.has(id));
12245
+ return {
12246
+ resourceID,
12247
+ scope,
12248
+ openOnly,
12249
+ tickets,
12250
+ primaryIds,
12251
+ secondaryIds,
12252
+ bothIds: both,
12253
+ counts: { primary: primaryIds.length, secondary: secondaryIds.length, both: both.length, open: openCount },
12254
+ capped,
12255
+ unresolvedIds: unresolvedIds.sort((a, b) => a - b),
12256
+ closedStatus
12257
+ };
12258
+ }
12259
+
12260
+ // src/resources/special/tickets/statusSemantics.ts
12261
+ async function statusSemantics(_resource, opts = {}, http) {
12262
+ return resolveTicketStatusSemantics(http, opts);
12263
+ }
12264
+
11753
12265
  // src/resources/tickets.ts
11754
- var TicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
12266
+ var TicketsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11755
12267
  constructor(http, pageSize) {
11756
12268
  super(http, {
11757
12269
  key: "tickets",
@@ -11855,10 +12367,18 @@ var TicketsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
11855
12367
  fullContext(id, opts) {
11856
12368
  return fullContext(this, id, opts, this.http);
11857
12369
  }
12370
+ /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */
12371
+ statusSemantics(opts) {
12372
+ return statusSemantics(this, opts, this.http);
12373
+ }
12374
+ /** Node-parity special op (hand-written in src/resources/special/tickets.ts). */
12375
+ forResource(resourceID, opts) {
12376
+ return forResource(this, resourceID, this.http, opts);
12377
+ }
11858
12378
  };
11859
12379
 
11860
12380
  // src/resources/ticket_webhooks.ts
11861
- var TicketWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
12381
+ var TicketWebhooksResource = class extends _chunkD5IVS6GYcjs.BaseResource {
11862
12382
  constructor(http, pageSize) {
11863
12383
  super(http, {
11864
12384
  key: "ticket_webhooks",
@@ -11929,7 +12449,7 @@ var TicketWebhooksResource = class extends _chunkHQGE4WAVcjs.BaseResource {
11929
12449
  /** Search TicketWebhook records: bounded contains on name (no vendor free-text search exists);
11930
12450
  * limit defaults to 25, max 500. */
11931
12451
  async search(query, opts) {
11932
- return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _110 => _110.limit]) });
12452
+ return this.searchBase(query, { limit: _optionalChain([opts, 'optionalAccess', _115 => _115.limit]) });
11933
12453
  }
11934
12454
  };
11935
12455
 
@@ -11944,62 +12464,62 @@ async function queryTimeEntries(_resource, filter, limit, operation, http) {
11944
12464
  body: { MaxRecords: limit, filter },
11945
12465
  operation
11946
12466
  });
11947
- const { items, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res);
12467
+ const { items, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res);
11948
12468
  return { items, hasMore: pageDetails.nextPageUrl != null };
11949
12469
  }
11950
12470
  async function windowQuery3(_resource, kind, http, opts) {
11951
- const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _111 => _111.now]), () => ( /* @__PURE__ */ new Date()));
11952
- const tz = _optionalChain([opts, 'optionalAccess', _112 => _112.tz]) === void 0 ? void 0 : validateZone(opts.tz, `time_entries.${kind}`);
12471
+ const now = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _116 => _116.now]), () => ( /* @__PURE__ */ new Date()));
12472
+ const tz = _optionalChain([opts, 'optionalAccess', _117 => _117.tz]) === void 0 ? void 0 : validateZone(opts.tz, `time_entries.${kind}`);
11953
12473
  const { from, to } = dateOnlyWindowBounds(kind, now, tz);
11954
12474
  const filter = [
11955
12475
  { field: "dateWorked", op: "gte", value: from },
11956
12476
  { field: "dateWorked", op: "lte", value: to }
11957
12477
  ];
11958
- const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _113 => _113.limit])), `time_entries.${kind}`, http);
12478
+ const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _118 => _118.limit])), `time_entries.${kind}`, http);
11959
12479
  return items;
11960
12480
  }
11961
12481
  async function customRange3(_resource, from, to, http, opts) {
11962
- if (_optionalChain([opts, 'optionalAccess', _114 => _114.tz]) !== void 0) validateZone(opts.tz, "time_entries.customRange");
12482
+ if (_optionalChain([opts, 'optionalAccess', _119 => _119.tz]) !== void 0) validateZone(opts.tz, "time_entries.customRange");
11963
12483
  const fromB = customRangeDay(from, "from", void 0, "customRange");
11964
12484
  const toB = customRangeDay(to, "to", void 0, "customRange");
11965
12485
  if (fromB.ms > toB.ms) {
11966
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("customRange: from must not be after to");
12486
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("customRange: from must not be after to");
11967
12487
  }
11968
12488
  const toEndMs = toB.ms + DAY_MS2 - 1;
11969
12489
  const filter = [
11970
12490
  { field: "dateWorked", op: "gte", value: iso2(fromB.ms) },
11971
12491
  { field: "dateWorked", op: "lte", value: iso2(toEndMs) }
11972
12492
  ];
11973
- const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _115 => _115.limit])), "time_entries.customRange", http);
12493
+ const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _120 => _120.limit])), "time_entries.customRange", http);
11974
12494
  return items;
11975
12495
  }
11976
12496
  async function postedDateStatusQuery(_resource, mode, http, opts) {
11977
12497
  const filter = [
11978
12498
  { field: "postedDate", op: mode === "posted" ? "exist" : "notExist" }
11979
12499
  ];
11980
- if (_optionalChain([opts, 'optionalAccess', _116 => _116.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12500
+ if (_optionalChain([opts, 'optionalAccess', _121 => _121.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
11981
12501
  const operation = mode === "posted" ? "time_entries.getPosted" : "time_entries.getUnposted";
11982
- const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _117 => _117.limit])), operation, http);
12502
+ const { items } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _122 => _122.limit])), operation, http);
11983
12503
  return items;
11984
12504
  }
11985
12505
  async function postedWithin(_resource, from, to, http, opts, opLabel = "time_entries.postedWithin") {
11986
- const OP6 = opLabel;
11987
- if (_optionalChain([opts, 'optionalAccess', _118 => _118.tz]) !== void 0) validateZone(opts.tz, OP6);
11988
- const fromB = customRangeDay(from, "from", void 0, OP6);
11989
- const toB = customRangeDay(to, "to", void 0, OP6);
12506
+ const OP9 = opLabel;
12507
+ if (_optionalChain([opts, 'optionalAccess', _123 => _123.tz]) !== void 0) validateZone(opts.tz, OP9);
12508
+ const fromB = customRangeDay(from, "from", void 0, OP9);
12509
+ const toB = customRangeDay(to, "to", void 0, OP9);
11990
12510
  if (fromB.ms > toB.ms) {
11991
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP6}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP6 });
12511
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP9}: from (${iso2(fromB.ms)}) must not be after to (${iso2(toB.ms)})`, { operation: OP9 });
11992
12512
  }
11993
12513
  const windowToMs = toB.ms + DAY_MS2 - 1;
11994
12514
  const filter = [
11995
12515
  { field: "dateWorked", op: "gte", value: iso2(fromB.ms) },
11996
12516
  { field: "dateWorked", op: "lte", value: iso2(windowToMs) }
11997
12517
  ];
11998
- if (_optionalChain([opts, 'optionalAccess', _119 => _119.posted]) === true) filter.push({ field: "postedDate", op: "exist" });
11999
- else if (_optionalChain([opts, 'optionalAccess', _120 => _120.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
12000
- if (_optionalChain([opts, 'optionalAccess', _121 => _121.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12001
- if (_optionalChain([opts, 'optionalAccess', _122 => _122.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
12002
- const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _123 => _123.limit])), OP6, http);
12518
+ if (_optionalChain([opts, 'optionalAccess', _124 => _124.posted]) === true) filter.push({ field: "postedDate", op: "exist" });
12519
+ else if (_optionalChain([opts, 'optionalAccess', _125 => _125.posted]) === false) filter.push({ field: "postedDate", op: "notExist" });
12520
+ if (_optionalChain([opts, 'optionalAccess', _126 => _126.ticketID]) !== void 0) filter.push({ field: "ticketID", op: "eq", value: opts.ticketID });
12521
+ if (_optionalChain([opts, 'optionalAccess', _127 => _127.resourceID]) !== void 0) filter.push({ field: "resourceID", op: "eq", value: opts.resourceID });
12522
+ const { items, hasMore } = await queryTimeEntries(_resource, filter, clampWindowLimit(_optionalChain([opts, 'optionalAccess', _128 => _128.limit])), OP9, http);
12003
12523
  let postedCount = 0;
12004
12524
  for (const item of items) {
12005
12525
  const postedDate = item.postedDate;
@@ -12022,13 +12542,13 @@ async function dateWorkedWindow(resource, from, to, http, opts) {
12022
12542
  }
12023
12543
 
12024
12544
  // src/resources/special/time_entries/errors.ts
12025
- var ResourceInvalidError = class extends _chunkHQGE4WAVcjs.AutotaskError {
12545
+ var ResourceInvalidError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12026
12546
  constructor(message, options = {}) {
12027
12547
  super(message, { code: "RESOURCE_INVALID", category: "validation", ...options });
12028
12548
  this.name = "ResourceInvalidError";
12029
12549
  }
12030
12550
  };
12031
- var AllocationCodeError = class extends _chunkHQGE4WAVcjs.AutotaskError {
12551
+ var AllocationCodeError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12032
12552
  /** The failure kind (the machine code is `ALLOCATION_CODE_<KIND>`). */
12033
12553
 
12034
12554
  constructor(kind, message, options = {}) {
@@ -12037,7 +12557,7 @@ var AllocationCodeError = class extends _chunkHQGE4WAVcjs.AutotaskError {
12037
12557
  this.kind = kind;
12038
12558
  }
12039
12559
  };
12040
- var NoApplicableAllocationCodeError = class extends _chunkHQGE4WAVcjs.AutotaskError {
12560
+ var NoApplicableAllocationCodeError = class extends _chunkD5IVS6GYcjs.AutotaskError {
12041
12561
  /** The structured blocker details (filters tried + department sets). */
12042
12562
 
12043
12563
  constructor(details, options = {}) {
@@ -12102,7 +12622,7 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12102
12622
  let pages = 0;
12103
12623
  for (; ; ) {
12104
12624
  if (pages >= PAGE_GUARD) {
12105
- throw new (0, _chunkHQGE4WAVcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12625
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskError)(`createForResource: the ${path} walk hit the ${PAGE_GUARD}-page guard`, {
12106
12626
  code: "RESOLUTION_TRUNCATED",
12107
12627
  category: "resolution",
12108
12628
  operation,
@@ -12113,11 +12633,11 @@ async function boundedQuery(http, path, filter, totalCap, operation) {
12113
12633
  const res = await http.request({
12114
12634
  method: "POST",
12115
12635
  idempotent: true,
12116
- path: isFirst ? path : _chunkHQGE4WAVcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12636
+ path: isFirst ? path : _chunkD5IVS6GYcjs.cursorToPath.call(void 0, http.baseUrl, cursor),
12117
12637
  body: { MaxRecords: pageSize, filter },
12118
12638
  operation
12119
12639
  });
12120
- const { items: pageItems, pageDetails } = _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, operation);
12640
+ const { items: pageItems, pageDetails } = _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, operation);
12121
12641
  items.push(...pageItems);
12122
12642
  pages += 1;
12123
12643
  if (items.length >= totalCap) break;
@@ -12209,7 +12729,7 @@ async function resolveCode(http, family, familyLabel2, pinnedId, departments, op
12209
12729
  }
12210
12730
 
12211
12731
  // src/resources/special/time_entries/createForResource.ts
12212
- var OP3 = "time_entries.createForResource";
12732
+ var OP5 = "time_entries.createForResource";
12213
12733
  var PARAM_KEYS = /* @__PURE__ */ new Set([
12214
12734
  "internallAllocationCodeID",
12215
12735
  "ticketID",
@@ -12234,7 +12754,7 @@ function windowDefaults(params) {
12234
12754
  var familyOf = (l) => l === "internal" ? USE_TYPE_INTERNAL : USE_TYPE_GENERAL;
12235
12755
  var familyLabel = (f) => f === USE_TYPE_GENERAL ? "General Allocation Code" : "Internal Allocation Code";
12236
12756
  function validateCreateParams(params) {
12237
- const pin = (value, label) => typeof value === "number" ? _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, value, label) : void 0;
12757
+ const pin = (value, label) => typeof value === "number" ? _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, value, label) : void 0;
12238
12758
  const pins = {
12239
12759
  code: pin(params.internallAllocationCodeID, "internallAllocationCodeID"),
12240
12760
  ticket: pin(params.ticketID, "ticketID"),
@@ -12243,32 +12763,32 @@ function validateCreateParams(params) {
12243
12763
  };
12244
12764
  const pinCount = [pins.code, pins.ticket, pins.task].filter((v) => v !== void 0).length;
12245
12765
  if (pinCount > 1) {
12246
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
12766
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12247
12767
  "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)",
12248
- { operation: OP3 }
12768
+ { operation: OP5 }
12249
12769
  );
12250
12770
  }
12251
12771
  if (pins.role !== void 0 && pins.code !== void 0) {
12252
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
12772
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12253
12773
  "createForResource: a pinned roleID is only meaningful with the task/ticket linkage (internallAllocationCodeID pins the internal linkage and owns the code) \u2014 drop one",
12254
- { operation: OP3 }
12774
+ { operation: OP5 }
12255
12775
  );
12256
12776
  }
12257
12777
  if (params.hoursWorked !== void 0 && (typeof params.hoursWorked !== "number" || !Number.isFinite(params.hoursWorked) || params.hoursWorked <= 0)) {
12258
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(
12778
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
12259
12779
  `createForResource: hoursWorked must be a positive finite number (got ${String(params.hoursWorked)})`,
12260
- { operation: OP3 }
12780
+ { operation: OP5 }
12261
12781
  );
12262
12782
  }
12263
12783
  return pins;
12264
12784
  }
12265
12785
  async function assertResourceActive(http, rid) {
12266
- const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP3);
12786
+ const rec = await fetchItem2(http, `/V1.0/Resources/${rid}`, OP5);
12267
12787
  if (rec === null) {
12268
12788
  throw new ResourceInvalidError(`Resource ${rid} was not found \u2014 a time entry cannot attach to a missing resource`, {
12269
12789
  resourceIds: [rid],
12270
12790
  details: { idRefs: [{ entity: "resource", id: rid }] },
12271
- operation: OP3,
12791
+ operation: OP5,
12272
12792
  category: "not_found",
12273
12793
  suggestedAction: "Resolve the resource id (resources.get / resources.search) and retry."
12274
12794
  });
@@ -12277,7 +12797,7 @@ async function assertResourceActive(http, rid) {
12277
12797
  throw new ResourceInvalidError(`Resource ${rid} is not active (isActive !== true) \u2014 the vendor would reject a time entry for an inactive resource`, {
12278
12798
  resourceIds: [rid],
12279
12799
  details: { idRefs: [{ entity: "resource", id: rid }] },
12280
- operation: OP3,
12800
+ operation: OP5,
12281
12801
  suggestedAction: "Activate the resource or pick an active one."
12282
12802
  });
12283
12803
  }
@@ -12287,11 +12807,11 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12287
12807
  const pinnedForCode = pins.code !== void 0 ? pins.code : pins.role;
12288
12808
  let code = null;
12289
12809
  const familiesTried = [];
12290
- code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP3);
12810
+ code = await resolveCode(http, familyOf(linkage), familyLabel(familyOf(linkage)), pinnedForCode, departments, OP5);
12291
12811
  familiesTried.push({ family: familyOf(linkage), label: familyLabel(familyOf(linkage)), filters: [{ field: "useType", op: "eq", value: familyOf(linkage) }, { field: "isActive", op: "eq", value: true }] });
12292
12812
  if (code === null && linkage === "task" && pins.role === void 0) {
12293
12813
  usedLinkage = "internal";
12294
- code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP3);
12814
+ code = await resolveCode(http, USE_TYPE_INTERNAL, familyLabel(USE_TYPE_INTERNAL), void 0, departments, OP5);
12295
12815
  familiesTried.push({ family: USE_TYPE_INTERNAL, label: familyLabel(USE_TYPE_INTERNAL), filters: [{ field: "useType", op: "eq", value: USE_TYPE_INTERNAL }, { field: "isActive", op: "eq", value: true }] });
12296
12816
  }
12297
12817
  if (code === null) {
@@ -12301,7 +12821,7 @@ async function resolveAllocationCode(http, rid, linkage, pins, departments) {
12301
12821
  families: familiesTried,
12302
12822
  resourceDepartments: [...departments].sort((a, b) => a - b)
12303
12823
  },
12304
- { operation: OP3 }
12824
+ { operation: OP5 }
12305
12825
  );
12306
12826
  }
12307
12827
  const resolvedCode = codeInfo(code);
@@ -12338,9 +12858,9 @@ function createDryRun2(http, rid, body, linkage, usedLinkage, resolvedCode) {
12338
12858
  if (usedLinkage === "internal" && linkage === "task") {
12339
12859
  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).");
12340
12860
  }
12341
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0,
12861
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
12342
12862
  {
12343
- operation: OP3,
12863
+ operation: OP5,
12344
12864
  method: "POST",
12345
12865
  path: "/V1.0/TimeEntries",
12346
12866
  ids: [rid],
@@ -12378,11 +12898,11 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12378
12898
  };
12379
12899
  } catch (err) {
12380
12900
  lastError = err;
12381
- const text = _chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkHQGE4WAVcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12901
+ const text = _chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) ? `${_nullishCoalesce(_chunkD5IVS6GYcjs.formatVendorDetail.call(void 0, err.vendorError), () => ( ""))} ${err.message}` : "";
12382
12902
  const gate3 = ROLE_REJECTION_PATTERN.test(text);
12383
12903
  if (usedLinkage !== "internal" && gate3) {
12384
12904
  if (!taskRoleFetched && usedLinkage === "task" && pins.task !== void 0) {
12385
- const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP3);
12905
+ const task = await fetchItem2(http, `/V1.0/Tasks/${pins.task}`, OP5);
12386
12906
  taskRoleFetched = true;
12387
12907
  if (task !== null) pushLadder(task.assignedResourceRoleID);
12388
12908
  }
@@ -12398,17 +12918,17 @@ async function createWithAttempts(resource, http, opts, body, defaults, pins, us
12398
12918
  throw err;
12399
12919
  }
12400
12920
  }
12401
- if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, lastError)) {
12921
+ if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, lastError)) {
12402
12922
  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.`;
12403
12923
  }
12404
12924
  throw lastError;
12405
12925
  }
12406
12926
  async function createForResource(resource, resourceID, params, opts = {}, http) {
12407
- const rid = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12927
+ const rid = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, resourceID, "resourceID");
12408
12928
  const pins = validateCreateParams(params);
12409
12929
  await assertResourceActive(http, rid);
12410
12930
  const linkage = pins.code !== void 0 ? "internal" : pins.ticket !== void 0 ? "ticket" : pins.task !== void 0 ? "task" : "internal";
12411
- const roleRows = await resourceRoleRows(http, rid, OP3);
12931
+ const roleRows = await resourceRoleRows(http, rid, OP5);
12412
12932
  const departments = roleRows.departments;
12413
12933
  const { usedLinkage, resolvedCode } = await resolveAllocationCode(http, rid, linkage, pins, departments);
12414
12934
  const defaults = windowDefaults(params);
@@ -12417,8 +12937,8 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
12417
12937
  return createWithAttempts(resource, http, opts, body, defaults, pins, usedLinkage, resolvedCode, roleRows);
12418
12938
  }
12419
12939
  function discoveryField(err, body, defaults) {
12420
- if (!_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12421
- const entries = _chunkHQGE4WAVcjs.parseVendorErrors.call(void 0, err.vendorError);
12940
+ if (!_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, err) || err.vendorError === void 0) return null;
12941
+ const entries = _chunkD5IVS6GYcjs.parseVendorErrors.call(void 0, err.vendorError);
12422
12942
  if (entries === void 0) return null;
12423
12943
  for (const entry of entries) {
12424
12944
  const field = entry.field;
@@ -12431,42 +12951,42 @@ function discoveryField(err, body, defaults) {
12431
12951
  }
12432
12952
 
12433
12953
  // src/resources/special/time_entries/move.ts
12434
- var OP4 = "time_entries.moveToTicket";
12954
+ var OP6 = "time_entries.moveToTicket";
12435
12955
  var COPY2 = ["resourceID", "roleID", "billingCodeID", "dateWorked", "startDateTime", "endDateTime", "hoursWorked", "offsetHours", "summaryNotes", "internalNotes", "isNonBillable", "showOnInvoice"];
12436
12956
  var CONTRACT_SCOPED2 = ["contractID", "contractServiceID", "contractServiceBundleID"];
12437
12957
  async function readTimeEntry(http, id, retries) {
12438
12958
  try {
12439
- const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP4, maxRetries: retries });
12440
- return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _124 => _124.item]), () => ( null));
12959
+ const res = await http.request({ method: "GET", path: `/V1.0/TimeEntries/${id}`, operation: OP6, maxRetries: retries });
12960
+ return _nullishCoalesce(_optionalChain([res, 'optionalAccess', _129 => _129.item]), () => ( null));
12441
12961
  } catch (e) {
12442
- if (_chunkHQGE4WAVcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
12962
+ if (_chunkD5IVS6GYcjs.isAutotaskError.call(void 0, e) && (e.httpStatus === 404 || e.code === "NOT_FOUND")) return null;
12443
12963
  throw e;
12444
12964
  }
12445
12965
  }
12446
12966
  async function checkSource2({ http, source, sourceId, toTicketId, retries }) {
12447
12967
  const ids2 = { sourceId, toTicketId };
12448
12968
  if (source.taskID !== null && source.taskID !== void 0) {
12449
- throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP4}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP4);
12969
+ throw refuse("MOVE_SOURCE_UNSUPPORTED", `${OP6}: time entry ${sourceId} is on a task \u2014 only ticket time entries are moved`, ids2, OP6);
12450
12970
  }
12451
12971
  if (source.billingApprovalDateTime || source.billingApprovalResourceID || source.billingApprovalLevelMostRecent) {
12452
- throw refuse("MOVE_BLOCKED_APPROVED", `${OP4}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP4, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
12972
+ throw refuse("MOVE_BLOCKED_APPROVED", `${OP6}: time entry ${sourceId} has billing approval set \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "approved entries are not moved by the API" } });
12453
12973
  }
12454
12974
  let billing;
12455
12975
  try {
12456
- billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP4, retries);
12976
+ billing = await queryRows(http, "BillingItems", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP6, retries);
12457
12977
  } catch (e3) {
12458
- throw refuse("MOVE_BLOCKED_BILLED", `${OP4}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP4, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
12978
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP6}: the billing items of time entry ${sourceId} could not be read \u2014 refused (fails closed)`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billing state unreadable" } });
12459
12979
  }
12460
12980
  if (billing.some((b) => b.invoiceID || b.postedDate)) {
12461
- throw refuse("MOVE_BLOCKED_BILLED", `${OP4}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP4, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
12981
+ throw refuse("MOVE_BLOCKED_BILLED", `${OP6}: time entry ${sourceId} is billed or posted \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "billed entries are not moved by the API" } });
12462
12982
  }
12463
- const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP4, retries);
12983
+ const attachments = await queryRows(http, "TimeEntryAttachments", [{ field: "timeEntryID", op: "eq", value: sourceId }], OP6, retries);
12464
12984
  if (attachments.length > 0) {
12465
- throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP4}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP4, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
12985
+ throw refuse("MOVE_BLOCKED_ATTACHMENTS", `${OP6}: time entry ${sourceId} has attachments, which a delete would destroy \u2014 move it in the Autotask UI`, ids2, OP6, { manualAction: { action: "delete_source", uiLink: uiLinkFor(http, "time_entries", sourceId), reason: "entries with attachments are not moved by the API" } });
12466
12986
  }
12467
12987
  }
12468
12988
  var SPEC2 = {
12469
- operation: OP4,
12989
+ operation: OP6,
12470
12990
  entity: "time_entry",
12471
12991
  readSource: readTimeEntry,
12472
12992
  sourceTicketId: (s) => typeof s.ticketID === "number" ? s.ticketID : null,
@@ -12500,29 +13020,116 @@ function moveToTicket2(_resource, sourceId, toTicketId, opts, http) {
12500
13020
  return runMove(http, SPEC2, sourceId, toTicketId, opts);
12501
13021
  }
12502
13022
 
13023
+ // src/resources/special/time_entries/approve.ts
13024
+ var OP7 = "time_entries.approve";
13025
+ var APPROVAL_LEVELS_PATH = "/V1.0/BillingItemApprovalLevels";
13026
+ function toIso(value) {
13027
+ if (value instanceof Date) {
13028
+ if (Number.isNaN(value.getTime())) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("time_entries.approve: approvalDateTime is an invalid Date");
13029
+ return value.toISOString();
13030
+ }
13031
+ const parsed = new Date(value);
13032
+ if (Number.isNaN(parsed.getTime())) throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`time_entries.approve: approvalDateTime "${value}" is not a parseable date`);
13033
+ return parsed.toISOString();
13034
+ }
13035
+ function toNumber(value) {
13036
+ return typeof value === "number" ? value : Number(value);
13037
+ }
13038
+ function sameInstant(a, b) {
13039
+ if (typeof a !== "string" || a === "") return false;
13040
+ const left = new Date(a).getTime();
13041
+ const right = new Date(b).getTime();
13042
+ return !Number.isNaN(left) && left === right;
13043
+ }
13044
+ async function approve(resource, id, opts = {}, http) {
13045
+ const numericId = toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id"));
13046
+ if (opts.approvalLevel !== void 0 && (!Number.isInteger(opts.approvalLevel) || opts.approvalLevel < 1)) {
13047
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`time_entries.approve: approvalLevel must be a positive integer (got ${String(opts.approvalLevel)})`);
13048
+ }
13049
+ const approvalLevel = _nullishCoalesce(opts.approvalLevel, () => ( 1));
13050
+ const approvalDateTime = toIso(_nullishCoalesce(opts.approvalDateTime, () => ( /* @__PURE__ */ new Date())));
13051
+ const entry = await resource.get(numericId);
13052
+ const approvalResourceID = opts.approvalResourceID === void 0 ? entry.resourceID : toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, opts.approvalResourceID, "approvalResourceID"));
13053
+ if (approvalResourceID === void 0) {
13054
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(
13055
+ `time_entries.approve: time entry ${numericId} carries no resourceID and the caller supplied no approvalResourceID \u2014 the vendor requires an approving resource`
13056
+ );
13057
+ }
13058
+ const body = { timeEntryID: numericId, approvalLevel, approvalResourceID, approvalDateTime };
13059
+ if (opts.dryRun === true) {
13060
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0,
13061
+ {
13062
+ operation: OP7,
13063
+ method: "POST",
13064
+ path: APPROVAL_LEVELS_PATH,
13065
+ ids: [numericId],
13066
+ checks: [
13067
+ { name: "input-validation", ok: true },
13068
+ { name: "time-entry-exists", ok: true }
13069
+ ],
13070
+ impact: { affected: 1, scope: "single-record", reversible: false },
13071
+ warnings: [
13072
+ "two calls: POST the BillingItemApprovalLevels record, then PUT the time entry (billingApprovalDateTime + billingApprovalResourceID) \u2014 the vendor sets BillingApprovalLevelMostRecent from the create but not these two fields",
13073
+ "approval is not posting: the API exposes no post action on BillingItems, so the entry stays unposted until a vendor workflow posts it",
13074
+ `approvalResourceID ${approvalResourceID} is not existence-checked by the dry run`
13075
+ ],
13076
+ data: body
13077
+ },
13078
+ { redactPersonalData: http.redactPersonalData }
13079
+ );
13080
+ }
13081
+ const created = await http.request({
13082
+ method: "POST",
13083
+ path: APPROVAL_LEVELS_PATH,
13084
+ body,
13085
+ operation: OP7,
13086
+ maxRetries: opts.maxRetries
13087
+ });
13088
+ const levelId = toNumber(_chunkD5IVS6GYcjs.parseIdentifier.call(void 0, _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, created, OP7).id, "billingItemApprovalLevelID"));
13089
+ await resource.update(
13090
+ numericId,
13091
+ { billingApprovalDateTime: approvalDateTime, billingApprovalResourceID: approvalResourceID },
13092
+ { maxRetries: opts.maxRetries, lastModifiedDate: _nullishCoalesce(opts.lastModifiedDate, () => ( entry.lastModifiedDateTime)) }
13093
+ );
13094
+ const fresh = await resource.get(numericId);
13095
+ const persisted = sameInstant(fresh.billingApprovalDateTime, approvalDateTime) && fresh.billingApprovalResourceID === approvalResourceID;
13096
+ return {
13097
+ timeEntryID: numericId,
13098
+ billingItemApprovalLevelID: levelId,
13099
+ approvalLevel,
13100
+ approvalResourceID,
13101
+ approvalDateTime,
13102
+ billingApprovalLevelMostRecent: _nullishCoalesce(fresh.billingApprovalLevelMostRecent, () => ( null)),
13103
+ billingApprovalDateTime: _nullishCoalesce(fresh.billingApprovalDateTime, () => ( null)),
13104
+ billingApprovalResourceID: _nullishCoalesce(fresh.billingApprovalResourceID, () => ( null)),
13105
+ status: persisted ? "approved" : "approval_fields_not_persisted",
13106
+ persisted
13107
+ };
13108
+ }
13109
+
12503
13110
  // src/resources/special/time_entries/recentTickets.ts
12504
- var OP5 = "time_entries.recentTickets";
13111
+ var OP8 = "time_entries.recentTickets";
12505
13112
  var DAY_MS3 = 864e5;
12506
- var TICKET_CHUNK = 100;
12507
- var TICKET_FIELDS2 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
12508
- function positiveId(value, name) {
13113
+ var TICKET_CHUNK2 = 100;
13114
+ var TICKET_FIELDS3 = ["id", "ticketNumber", "title", "status", "assignedResourceID", "companyID"];
13115
+ function positiveId2(value, name) {
12509
13116
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
12510
13117
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
12511
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP5 });
13118
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP8 });
12512
13119
  }
12513
13120
  return n;
12514
13121
  }
12515
13122
  async function recentTickets(_resource, from, to, http, opts) {
12516
13123
  if (opts === void 0 || opts === null || typeof opts !== "object") {
12517
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP5 });
13124
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: opts { resourceID, companyID?, tz?, limit? } is required`, { operation: OP8 });
12518
13125
  }
12519
- const resourceID = positiveId(opts.resourceID, "resourceID");
12520
- const companyID = opts.companyID === void 0 ? void 0 : positiveId(opts.companyID, "companyID");
12521
- if (opts.tz !== void 0) validateZone(opts.tz, OP5);
12522
- const fromB = customRangeDay(from, "from", void 0, OP5);
12523
- const toB = customRangeDay(to, "to", void 0, OP5);
13126
+ const resourceID = positiveId2(opts.resourceID, "resourceID");
13127
+ const companyID = opts.companyID === void 0 ? void 0 : positiveId2(opts.companyID, "companyID");
13128
+ if (opts.tz !== void 0) validateZone(opts.tz, OP8);
13129
+ const fromB = customRangeDay(from, "from", void 0, OP8);
13130
+ const toB = customRangeDay(to, "to", void 0, OP8);
12524
13131
  if (fromB.ms > toB.ms) {
12525
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)(`${OP5}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP5 });
13132
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)(`${OP8}: from (${isoUtc(fromB.ms)}) must not be after to (${isoUtc(toB.ms)})`, { operation: OP8 });
12526
13133
  }
12527
13134
  const windowToMs = toB.ms + DAY_MS3 - 1;
12528
13135
  const { items: entries, hasMore } = await queryTimeEntries(
@@ -12533,7 +13140,7 @@ async function recentTickets(_resource, from, to, http, opts) {
12533
13140
  { field: "resourceID", op: "eq", value: resourceID }
12534
13141
  ],
12535
13142
  clampWindowLimit(opts.limit),
12536
- OP5,
13143
+ OP8,
12537
13144
  http
12538
13145
  );
12539
13146
  const groups = /* @__PURE__ */ new Map();
@@ -12551,17 +13158,17 @@ async function recentTickets(_resource, from, to, http, opts) {
12551
13158
  }
12552
13159
  const ids2 = [...groups.keys()];
12553
13160
  const tickets = /* @__PURE__ */ new Map();
12554
- for (let c = 0; c < ids2.length; c += TICKET_CHUNK) {
12555
- const chunk = ids2.slice(c, c + TICKET_CHUNK);
13161
+ for (let c = 0; c < ids2.length; c += TICKET_CHUNK2) {
13162
+ const chunk = ids2.slice(c, c + TICKET_CHUNK2);
12556
13163
  const filter = [{ field: "id", op: "in", value: chunk }];
12557
13164
  const res = await http.request({
12558
13165
  method: "POST",
12559
13166
  idempotent: true,
12560
13167
  path: "/V1.0/Tickets/query",
12561
- body: { MaxRecords: TICKET_CHUNK, filter, IncludeFields: TICKET_FIELDS2 },
12562
- operation: OP5
13168
+ body: { MaxRecords: TICKET_CHUNK2, filter, IncludeFields: TICKET_FIELDS3 },
13169
+ operation: OP8
12563
13170
  });
12564
- for (const t of _chunkHQGE4WAVcjs.unwrapItems.call(void 0, res, OP5).items) if (typeof t.id === "number") tickets.set(t.id, t);
13171
+ for (const t of _chunkD5IVS6GYcjs.unwrapItems.call(void 0, res, OP8).items) if (typeof t.id === "number") tickets.set(t.id, t);
12565
13172
  }
12566
13173
  const items = [];
12567
13174
  const unresolvedTicketIDs = [];
@@ -12569,17 +13176,17 @@ async function recentTickets(_resource, from, to, http, opts) {
12569
13176
  for (const [ticketID, g] of groups) {
12570
13177
  const t = tickets.get(ticketID);
12571
13178
  if (t === void 0) unresolvedTicketIDs.push(ticketID);
12572
- if (companyID !== void 0 && _optionalChain([t, 'optionalAccess', _125 => _125.companyID]) !== companyID) {
13179
+ if (companyID !== void 0 && _optionalChain([t, 'optionalAccess', _130 => _130.companyID]) !== companyID) {
12573
13180
  if (t !== void 0) excludedTickets += 1;
12574
13181
  continue;
12575
13182
  }
12576
13183
  items.push({
12577
13184
  ticketID,
12578
- ..._optionalChain([t, 'optionalAccess', _126 => _126.ticketNumber]) !== void 0 ? { ticketNumber: t.ticketNumber } : {},
12579
- ..._optionalChain([t, 'optionalAccess', _127 => _127.title]) !== void 0 ? { title: t.title } : {},
12580
- ..._optionalChain([t, 'optionalAccess', _128 => _128.status]) !== void 0 ? { status: t.status } : {},
12581
- ..._optionalChain([t, 'optionalAccess', _129 => _129.assignedResourceID]) !== void 0 ? { assignedResourceID: t.assignedResourceID } : {},
12582
- ..._optionalChain([t, 'optionalAccess', _130 => _130.companyID]) !== void 0 ? { companyID: t.companyID } : {},
13185
+ ..._optionalChain([t, 'optionalAccess', _131 => _131.ticketNumber]) !== void 0 ? { ticketNumber: t.ticketNumber } : {},
13186
+ ..._optionalChain([t, 'optionalAccess', _132 => _132.title]) !== void 0 ? { title: t.title } : {},
13187
+ ..._optionalChain([t, 'optionalAccess', _133 => _133.status]) !== void 0 ? { status: t.status } : {},
13188
+ ..._optionalChain([t, 'optionalAccess', _134 => _134.assignedResourceID]) !== void 0 ? { assignedResourceID: t.assignedResourceID } : {},
13189
+ ..._optionalChain([t, 'optionalAccess', _135 => _135.companyID]) !== void 0 ? { companyID: t.companyID } : {},
12583
13190
  entryCount: g.entryCount,
12584
13191
  totalHours: Math.round(g.totalHours * 100) / 100,
12585
13192
  lastWorked: g.lastWorked
@@ -12598,7 +13205,7 @@ async function recentTickets(_resource, from, to, http, opts) {
12598
13205
  }
12599
13206
 
12600
13207
  // src/resources/time_entries.ts
12601
- var TimeEntriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
13208
+ var TimeEntriesResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12602
13209
  constructor(http, pageSize) {
12603
13210
  super(http, {
12604
13211
  key: "time_entries",
@@ -12665,6 +13272,10 @@ var TimeEntriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
12665
13272
  return this.resolveBase(identifier);
12666
13273
  }
12667
13274
  /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */
13275
+ approve(id, opts = {}) {
13276
+ return approve(this, id, opts, this.http);
13277
+ }
13278
+ /** Node-parity special op (hand-written in src/resources/special/time_entries.ts). */
12668
13279
  createForResource(resourceID, params, opts = {}) {
12669
13280
  return createForResource(this, resourceID, params, opts, this.http);
12670
13281
  }
@@ -12743,7 +13354,7 @@ var TimeEntriesResource = class extends _chunkHQGE4WAVcjs.BaseResource {
12743
13354
  };
12744
13355
 
12745
13356
  // src/resources/time_entry_attachments.ts
12746
- var TimeEntryAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
13357
+ var TimeEntryAttachmentsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12747
13358
  constructor(http, pageSize) {
12748
13359
  super(http, {
12749
13360
  key: "time_entry_attachments",
@@ -12805,10 +13416,10 @@ var TimeEntryAttachmentsResource = class extends _chunkHQGE4WAVcjs.BaseResource
12805
13416
  };
12806
13417
 
12807
13418
  // src/resources/special/time_off_requests.ts
12808
- async function approve(_resource, id, opts = {}, http) {
12809
- const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
13419
+ async function approve2(_resource, id, opts = {}, http) {
13420
+ const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
12810
13421
  if (opts.dryRun === true) {
12811
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
13422
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
12812
13423
  operation: "time_off_requests.approve",
12813
13424
  method: "GET",
12814
13425
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -12824,16 +13435,16 @@ async function approve(_resource, id, opts = {}, http) {
12824
13435
  operation: "time_off_requests.approve",
12825
13436
  maxRetries: opts.maxRetries
12826
13437
  });
12827
- return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
13438
+ return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
12828
13439
  }
12829
13440
  async function reject(_resource, id, reason, opts = {}, http) {
12830
- const numericId = _chunkHQGE4WAVcjs.parseIdentifier.call(void 0, id, "id");
13441
+ const numericId = _chunkD5IVS6GYcjs.parseIdentifier.call(void 0, id, "id");
12831
13442
  const text = reason.trim();
12832
13443
  if (text === "") {
12833
- throw new (0, _chunkHQGE4WAVcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
13444
+ throw new (0, _chunkD5IVS6GYcjs.AutotaskConfigError)("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
12834
13445
  }
12835
13446
  if (opts.dryRun === true) {
12836
- return _chunkHQGE4WAVcjs.buildDryRunResult.call(void 0, {
13447
+ return _chunkD5IVS6GYcjs.buildDryRunResult.call(void 0, {
12837
13448
  operation: "time_off_requests.reject",
12838
13449
  method: "POST",
12839
13450
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -12851,11 +13462,11 @@ async function reject(_resource, id, reason, opts = {}, http) {
12851
13462
  operation: "time_off_requests.reject",
12852
13463
  maxRetries: opts.maxRetries
12853
13464
  });
12854
- return _chunkHQGE4WAVcjs.unwrapOperation.call(void 0, res);
13465
+ return _chunkD5IVS6GYcjs.unwrapOperation.call(void 0, res);
12855
13466
  }
12856
13467
 
12857
13468
  // src/resources/time_off_requests.ts
12858
- var TimeOffRequestsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
13469
+ var TimeOffRequestsResource = class extends _chunkD5IVS6GYcjs.BaseResource {
12859
13470
  constructor(http, pageSize) {
12860
13471
  super(http, {
12861
13472
  key: "time_off_requests",
@@ -12893,7 +13504,7 @@ var TimeOffRequestsResource = class extends _chunkHQGE4WAVcjs.BaseResource {
12893
13504
  }
12894
13505
  /** Node-parity special op (hand-written in src/resources/special/time_off_requests.ts). */
12895
13506
  approve(id, opts = {}) {
12896
- return approve(this, id, opts, this.http);
13507
+ return approve2(this, id, opts, this.http);
12897
13508
  }
12898
13509
  /** Node-parity special op (hand-written in src/resources/special/time_off_requests.ts). */
12899
13510
  reject(id, reason, opts = {}) {
@@ -13091,4 +13702,11 @@ var ZoneInformationResource = class {
13091
13702
 
13092
13703
 
13093
13704
 
13094
- exports.AppointmentsResource = AppointmentsResource; exports.AuthenticateResource = AuthenticateResource; exports.BillingCodesResource = BillingCodesResource; exports.BillingItemsResource = BillingItemsResource; exports.ChangeRequestLinksResource = ChangeRequestLinksResource; exports.ChecklistLibrariesResource = ChecklistLibrariesResource; exports.ChecklistLibraryChecklistItemsResource = ChecklistLibraryChecklistItemsResource; exports.ClassificationIconsResource = ClassificationIconsResource; exports.CompaniesResource = CompaniesResource; exports.CompanyAlertsResource = CompanyAlertsResource; exports.CompanyLocationsResource = CompanyLocationsResource; exports.CompanyNotesResource = CompanyNotesResource; exports.CompanySiteConfigurationsResource = CompanySiteConfigurationsResource; exports.CompanyWebhooksResource = CompanyWebhooksResource; exports.ConfigurationItemBillingProductAssociationsResource = ConfigurationItemBillingProductAssociationsResource; exports.ConfigurationItemCategoriesResource = ConfigurationItemCategoriesResource; exports.ConfigurationItemCategoryUdfAssociationsResource = ConfigurationItemCategoryUdfAssociationsResource; exports.ConfigurationItemDnsRecordsResource = ConfigurationItemDnsRecordsResource; exports.ConfigurationItemNotesResource = ConfigurationItemNotesResource; exports.ConfigurationItemRelatedItemsResource = ConfigurationItemRelatedItemsResource; exports.ConfigurationItemsResource = ConfigurationItemsResource; exports.ConfigurationItemSslSubjectAlternativeNamesResource = ConfigurationItemSslSubjectAlternativeNamesResource; exports.ConfigurationItemTypesResource = ConfigurationItemTypesResource; exports.ConfigurationItemWebhooksResource = ConfigurationItemWebhooksResource; exports.ContactGroupContactsResource = ContactGroupContactsResource; exports.ContactGroupsResource = ContactGroupsResource; exports.ContactsResource = ContactsResource; exports.ContactWebhooksResource = ContactWebhooksResource; exports.ContractBillingRulesResource = ContractBillingRulesResource; exports.ContractBlockHourFactorsResource = ContractBlockHourFactorsResource; exports.ContractBlocksResource = ContractBlocksResource; exports.ContractChargesResource = ContractChargesResource; exports.ContractExclusionBillingCodesResource = ContractExclusionBillingCodesResource; exports.ContractExclusionRolesResource = ContractExclusionRolesResource; exports.ContractExclusionSetExcludedRolesResource = ContractExclusionSetExcludedRolesResource; exports.ContractExclusionSetExcludedWorkTypesResource = ContractExclusionSetExcludedWorkTypesResource; exports.ContractExclusionSetsResource = ContractExclusionSetsResource; exports.ContractMilestonesResource = ContractMilestonesResource; exports.ContractNotesResource = ContractNotesResource; exports.ContractRatesResource = ContractRatesResource; exports.ContractRetainersResource = ContractRetainersResource; exports.ContractRoleCostsResource = ContractRoleCostsResource; exports.ContractServiceAdjustmentsResource = ContractServiceAdjustmentsResource; exports.ContractServiceBundleAdjustmentsResource = ContractServiceBundleAdjustmentsResource; exports.ContractServiceBundlesResource = ContractServiceBundlesResource; exports.ContractServiceBundleUnitsResource = ContractServiceBundleUnitsResource; exports.ContractServicesResource = ContractServicesResource; exports.ContractServiceUnitsResource = ContractServiceUnitsResource; exports.ContractsResource = ContractsResource; exports.ContractTicketPurchasesResource = ContractTicketPurchasesResource; exports.CountriesResource = CountriesResource; exports.CurrenciesResource = CurrenciesResource; exports.DepartmentsResource = DepartmentsResource; exports.DomainRegistrarsResource = DomainRegistrarsResource; exports.EntityInformationResource = EntityInformationResource; exports.ExpenseItemAttachmentsResource = ExpenseItemAttachmentsResource; exports.ExpenseItemsResource = ExpenseItemsResource; exports.ExpenseReportsResource = ExpenseReportsResource; exports.HolidaySetsResource = HolidaySetsResource; exports.HolidaysResource = HolidaysResource; exports.InventoryProductsResource = InventoryProductsResource; exports.InvoicesResource = InvoicesResource; exports.ModulesResource = ModulesResource; exports.NotificationHistoryResource = NotificationHistoryResource; exports.OpportunitiesResource = OpportunitiesResource; exports.OpportunityAttachmentsResource = OpportunityAttachmentsResource; exports.OpportunityCategoriesResource = OpportunityCategoriesResource; exports.PhasesResource = PhasesResource; exports.ProductsResource = ProductsResource; exports.ProductVendorsResource = ProductVendorsResource; exports.ProjectChargesResource = ProjectChargesResource; exports.ProjectNotesResource = ProjectNotesResource; exports.ProjectsResource = ProjectsResource; exports.PurchaseApprovalsResource = PurchaseApprovalsResource; exports.PurchaseOrderItemReceivingResource = PurchaseOrderItemReceivingResource; exports.PurchaseOrderItemsResource = PurchaseOrderItemsResource; exports.PurchaseOrdersResource = PurchaseOrdersResource; exports.QuoteItemsResource = QuoteItemsResource; exports.QuoteLocationsResource = QuoteLocationsResource; exports.QuotesResource = QuotesResource; exports.QuoteTemplatesResource = QuoteTemplatesResource; exports.ResourceRoleQueuesResource = ResourceRoleQueuesResource; exports.ResourceRolesResource = ResourceRolesResource; exports.ResourceSkillsResource = ResourceSkillsResource; exports.ResourcesResource = ResourcesResource; exports.ResourceTimeOffAdditionalResource = ResourceTimeOffAdditionalResource; exports.ResourceTimeOffApproversResource = ResourceTimeOffApproversResource; exports.ResourceTimeOffBalancesResource = ResourceTimeOffBalancesResource; exports.RolesResource = RolesResource; exports.ServiceCallsResource = ServiceCallsResource; exports.ServiceCallTaskResourcesResource = ServiceCallTaskResourcesResource; exports.ServiceCallTasksResource = ServiceCallTasksResource; exports.ServiceCallTicketResourcesResource = ServiceCallTicketResourcesResource; exports.ServiceCallTicketsResource = ServiceCallTicketsResource; exports.ServiceLevelAgreementResultsResource = ServiceLevelAgreementResultsResource; exports.ServicesResource = ServicesResource; exports.SkillsResource = SkillsResource; exports.SubscriptionPeriodsResource = SubscriptionPeriodsResource; exports.SubscriptionsResource = SubscriptionsResource; exports.SurveyResultsResource = SurveyResultsResource; exports.SurveysResource = SurveysResource; exports.TagAliasesResource = TagAliasesResource; exports.TagGroupsResource = TagGroupsResource; exports.TagsResource = TagsResource; exports.TaskSecondaryResourcesResource = TaskSecondaryResourcesResource; exports.TasksResource = TasksResource; exports.ThresholdInformationResource = ThresholdInformationResource; exports.TicketAdditionalConfigurationItemsResource = TicketAdditionalConfigurationItemsResource; exports.TicketAdditionalContactsResource = TicketAdditionalContactsResource; exports.TicketAttachmentsResource = TicketAttachmentsResource; exports.TicketCategoriesResource = TicketCategoriesResource; exports.TicketCategoryFieldDefaultsResource = TicketCategoryFieldDefaultsResource; exports.TicketChangeRequestApprovalsResource = TicketChangeRequestApprovalsResource; exports.TicketChargesResource = TicketChargesResource; exports.TicketChecklistItemsResource = TicketChecklistItemsResource; exports.TicketChecklistLibrariesResource = TicketChecklistLibrariesResource; exports.TicketHistoryResource = TicketHistoryResource; exports.TicketNoteAttachmentsResource = TicketNoteAttachmentsResource; exports.TicketNotesResource = TicketNotesResource; exports.TicketNoteWebhooksResource = TicketNoteWebhooksResource; exports.TicketSecondaryResourcesResource = TicketSecondaryResourcesResource; exports.TicketsResource = TicketsResource; exports.TicketWebhooksResource = TicketWebhooksResource; exports.TimeEntriesResource = TimeEntriesResource; exports.TimeEntryAttachmentsResource = TimeEntryAttachmentsResource; exports.TimeOffRequestsResource = TimeOffRequestsResource; exports.VersionInformationResource = VersionInformationResource; exports.VersionResource = VersionResource; exports.ZoneInformationResource = ZoneInformationResource;
13705
+
13706
+
13707
+
13708
+
13709
+
13710
+
13711
+
13712
+ exports.AppointmentsResource = AppointmentsResource; exports.AuthenticateResource = AuthenticateResource; exports.BillingCodesResource = BillingCodesResource; exports.BillingItemApprovalLevelsResource = BillingItemApprovalLevelsResource; exports.BillingItemsResource = BillingItemsResource; exports.ChangeRequestLinksResource = ChangeRequestLinksResource; exports.ChecklistLibrariesResource = ChecklistLibrariesResource; exports.ChecklistLibraryChecklistItemsResource = ChecklistLibraryChecklistItemsResource; exports.ClassificationIconsResource = ClassificationIconsResource; exports.CompaniesResource = CompaniesResource; exports.CompanyAlertsResource = CompanyAlertsResource; exports.CompanyLocationsResource = CompanyLocationsResource; exports.CompanyNotesResource = CompanyNotesResource; exports.CompanySiteConfigurationsResource = CompanySiteConfigurationsResource; exports.CompanyWebhooksResource = CompanyWebhooksResource; exports.ConfigurationItemBillingProductAssociationsResource = ConfigurationItemBillingProductAssociationsResource; exports.ConfigurationItemCategoriesResource = ConfigurationItemCategoriesResource; exports.ConfigurationItemCategoryUdfAssociationsResource = ConfigurationItemCategoryUdfAssociationsResource; exports.ConfigurationItemDnsRecordsResource = ConfigurationItemDnsRecordsResource; exports.ConfigurationItemNotesResource = ConfigurationItemNotesResource; exports.ConfigurationItemRelatedItemsResource = ConfigurationItemRelatedItemsResource; exports.ConfigurationItemsResource = ConfigurationItemsResource; exports.ConfigurationItemSslSubjectAlternativeNamesResource = ConfigurationItemSslSubjectAlternativeNamesResource; exports.ConfigurationItemTypesResource = ConfigurationItemTypesResource; exports.ConfigurationItemWebhooksResource = ConfigurationItemWebhooksResource; exports.ContactGroupContactsResource = ContactGroupContactsResource; exports.ContactGroupsResource = ContactGroupsResource; exports.ContactsResource = ContactsResource; exports.ContactWebhooksResource = ContactWebhooksResource; exports.ContractBillingRulesResource = ContractBillingRulesResource; exports.ContractBlockHourFactorsResource = ContractBlockHourFactorsResource; exports.ContractBlocksResource = ContractBlocksResource; exports.ContractChargesResource = ContractChargesResource; exports.ContractExclusionBillingCodesResource = ContractExclusionBillingCodesResource; exports.ContractExclusionRolesResource = ContractExclusionRolesResource; exports.ContractExclusionSetExcludedRolesResource = ContractExclusionSetExcludedRolesResource; exports.ContractExclusionSetExcludedWorkTypesResource = ContractExclusionSetExcludedWorkTypesResource; exports.ContractExclusionSetsResource = ContractExclusionSetsResource; exports.ContractMilestonesResource = ContractMilestonesResource; exports.ContractNotesResource = ContractNotesResource; exports.ContractRatesResource = ContractRatesResource; exports.ContractRetainersResource = ContractRetainersResource; exports.ContractRoleCostsResource = ContractRoleCostsResource; exports.ContractServiceAdjustmentsResource = ContractServiceAdjustmentsResource; exports.ContractServiceBundleAdjustmentsResource = ContractServiceBundleAdjustmentsResource; exports.ContractServiceBundlesResource = ContractServiceBundlesResource; exports.ContractServiceBundleUnitsResource = ContractServiceBundleUnitsResource; exports.ContractServicesResource = ContractServicesResource; exports.ContractServiceUnitsResource = ContractServiceUnitsResource; exports.ContractsResource = ContractsResource; exports.ContractTicketPurchasesResource = ContractTicketPurchasesResource; exports.CountriesResource = CountriesResource; exports.CurrenciesResource = CurrenciesResource; exports.DepartmentsResource = DepartmentsResource; exports.DomainRegistrarsResource = DomainRegistrarsResource; exports.EntityInformationResource = EntityInformationResource; exports.ExpenseItemAttachmentsResource = ExpenseItemAttachmentsResource; exports.ExpenseItemsResource = ExpenseItemsResource; exports.ExpenseReportsResource = ExpenseReportsResource; exports.HolidaySetsResource = HolidaySetsResource; exports.HolidaysResource = HolidaysResource; exports.InventoryProductsResource = InventoryProductsResource; exports.InvoicesResource = InvoicesResource; exports.InvoiceTemplatesResource = InvoiceTemplatesResource; exports.ModulesResource = ModulesResource; exports.NotificationHistoryResource = NotificationHistoryResource; exports.OpportunitiesResource = OpportunitiesResource; exports.OpportunityAttachmentsResource = OpportunityAttachmentsResource; exports.OpportunityCategoriesResource = OpportunityCategoriesResource; exports.OrganizationalLevel1sResource = OrganizationalLevel1sResource; exports.OrganizationalLevel2sResource = OrganizationalLevel2sResource; exports.OrganizationalLevelAssociationsResource = OrganizationalLevelAssociationsResource; exports.PhasesResource = PhasesResource; exports.ProductsResource = ProductsResource; exports.ProductVendorsResource = ProductVendorsResource; exports.ProjectChargesResource = ProjectChargesResource; exports.ProjectNotesResource = ProjectNotesResource; exports.ProjectsResource = ProjectsResource; exports.PurchaseApprovalsResource = PurchaseApprovalsResource; exports.PurchaseOrderItemReceivingResource = PurchaseOrderItemReceivingResource; exports.PurchaseOrderItemsResource = PurchaseOrderItemsResource; exports.PurchaseOrdersResource = PurchaseOrdersResource; exports.QuoteItemsResource = QuoteItemsResource; exports.QuoteLocationsResource = QuoteLocationsResource; exports.QuotesResource = QuotesResource; exports.QuoteTemplatesResource = QuoteTemplatesResource; exports.ResourceRoleQueuesResource = ResourceRoleQueuesResource; exports.ResourceRolesResource = ResourceRolesResource; exports.ResourceSkillsResource = ResourceSkillsResource; exports.ResourcesResource = ResourcesResource; exports.ResourceTimeOffAdditionalResource = ResourceTimeOffAdditionalResource; exports.ResourceTimeOffApproversResource = ResourceTimeOffApproversResource; exports.ResourceTimeOffBalancesResource = ResourceTimeOffBalancesResource; exports.RolesResource = RolesResource; exports.SalesOrdersResource = SalesOrdersResource; exports.ServiceCallsResource = ServiceCallsResource; exports.ServiceCallTaskResourcesResource = ServiceCallTaskResourcesResource; exports.ServiceCallTasksResource = ServiceCallTasksResource; exports.ServiceCallTicketResourcesResource = ServiceCallTicketResourcesResource; exports.ServiceCallTicketsResource = ServiceCallTicketsResource; exports.ServiceLevelAgreementResultsResource = ServiceLevelAgreementResultsResource; exports.ServicesResource = ServicesResource; exports.SkillsResource = SkillsResource; exports.SubscriptionPeriodsResource = SubscriptionPeriodsResource; exports.SubscriptionsResource = SubscriptionsResource; exports.SurveyResultsResource = SurveyResultsResource; exports.SurveysResource = SurveysResource; exports.TagAliasesResource = TagAliasesResource; exports.TagGroupsResource = TagGroupsResource; exports.TagsResource = TagsResource; exports.TaskSecondaryResourcesResource = TaskSecondaryResourcesResource; exports.TasksResource = TasksResource; exports.TaxRegionsResource = TaxRegionsResource; exports.ThresholdInformationResource = ThresholdInformationResource; exports.TicketAdditionalConfigurationItemsResource = TicketAdditionalConfigurationItemsResource; exports.TicketAdditionalContactsResource = TicketAdditionalContactsResource; exports.TicketAttachmentsResource = TicketAttachmentsResource; exports.TicketCategoriesResource = TicketCategoriesResource; exports.TicketCategoryFieldDefaultsResource = TicketCategoryFieldDefaultsResource; exports.TicketChangeRequestApprovalsResource = TicketChangeRequestApprovalsResource; exports.TicketChargesResource = TicketChargesResource; exports.TicketChecklistItemsResource = TicketChecklistItemsResource; exports.TicketChecklistLibrariesResource = TicketChecklistLibrariesResource; exports.TicketHistoryResource = TicketHistoryResource; exports.TicketNoteAttachmentsResource = TicketNoteAttachmentsResource; exports.TicketNotesResource = TicketNotesResource; exports.TicketNoteWebhooksResource = TicketNoteWebhooksResource; exports.TicketSecondaryResourcesResource = TicketSecondaryResourcesResource; exports.TicketsResource = TicketsResource; exports.TicketWebhooksResource = TicketWebhooksResource; exports.TimeEntriesResource = TimeEntriesResource; exports.TimeEntryAttachmentsResource = TimeEntryAttachmentsResource; exports.TimeOffRequestsResource = TimeOffRequestsResource; exports.VersionInformationResource = VersionInformationResource; exports.VersionResource = VersionResource; exports.ZoneInformationResource = ZoneInformationResource;