node-autotask 0.83.0 → 0.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/MCP_TOOL_CATALOG.json +323 -11
  3. package/README.md +1 -1
  4. package/capabilities.json +1739 -361
  5. package/dist/capabilities-data.js +2463 -1085
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-C2AFRW5M.cjs → chunk-7GNZT7Y7.cjs} +375 -93
  9. package/dist/{chunk-ZKAJVHHZ.js → chunk-EPJG7M5C.js} +42 -7
  10. package/dist/{chunk-DBEAS3IR.js → chunk-GTTAPAGP.js} +3 -3
  11. package/dist/{chunk-HQJLIRXW.js → chunk-HF5YG4TV.js} +5 -2
  12. package/dist/{chunk-QCA5R7QF.cjs → chunk-JCKYM7FD.cjs} +3 -3
  13. package/dist/{chunk-QEMBBAF5.cjs → chunk-JV6MX2U3.cjs} +237 -202
  14. package/dist/{chunk-CV56RIGS.js → chunk-L6YCH2I4.js} +370 -88
  15. package/dist/{chunk-5AHEJCSP.cjs → chunk-PBOH2OHJ.cjs} +33 -30
  16. package/dist/{index-8Hg6dytT.d.cts → index-CCW_EpLg.d.cts} +203 -140
  17. package/dist/{index-8Hg6dytT.d.ts → index-CCW_EpLg.d.ts} +203 -140
  18. package/dist/{index-DxESlIIg.d.cts → index-DkyNXWyt.d.cts} +108 -86
  19. package/dist/{index-nXhYAQOf.d.ts → index-rWcPjRpX.d.ts} +108 -86
  20. package/dist/index.cjs +84 -84
  21. package/dist/index.d.cts +6 -5
  22. package/dist/index.d.ts +6 -5
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +4 -4
  26. package/dist/operations/index.d.ts +4 -4
  27. package/dist/operations/index.js +2 -2
  28. package/dist/pool.cjs +12 -12
  29. package/dist/pool.d.cts +1 -1
  30. package/dist/pool.d.ts +1 -1
  31. package/dist/pool.js +4 -4
  32. package/dist/resources/index.cjs +27 -27
  33. package/dist/resources/index.d.cts +2 -2
  34. package/dist/resources/index.d.ts +2 -2
  35. package/dist/resources/index.js +3 -3
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/docs/API.md +32 -20
  39. package/docs/RELEASING.md +2 -1
  40. package/docs/VENDOR-QUIRKS.md +3 -1
  41. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunkC2AFRW5M_cjs = require('./chunk-C2AFRW5M.cjs');
4
- var chunkQCA5R7QF_cjs = require('./chunk-QCA5R7QF.cjs');
3
+ var chunk7GNZT7Y7_cjs = require('./chunk-7GNZT7Y7.cjs');
4
+ var chunkJCKYM7FD_cjs = require('./chunk-JCKYM7FD.cjs');
5
5
 
6
6
  // src/resources/special/configuration_items.ts
7
7
  async function fetchRecord(http, path, label, readOpts) {
8
8
  const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: readOpts?.maxRetries });
9
9
  const body = res;
10
10
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
11
- throw new chunkC2AFRW5M_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
11
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
12
12
  }
13
13
  return body.item;
14
14
  }
15
15
  async function moveConfigurationItem(_resource, sourceId, opts) {
16
16
  const http = _resource.http;
17
- const numericSource = chunkC2AFRW5M_cjs.parseIdentifier(sourceId, "sourceId");
17
+ const numericSource = chunk7GNZT7Y7_cjs.parseIdentifier(sourceId, "sourceId");
18
18
  if (opts?.destinationCompanyId === void 0) {
19
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
19
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
20
20
  }
21
- const destId = chunkC2AFRW5M_cjs.parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
21
+ const destId = chunk7GNZT7Y7_cjs.parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
22
22
  const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
23
23
  await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
24
24
  const body = { ...source };
@@ -28,20 +28,20 @@ async function moveConfigurationItem(_resource, sourceId, opts) {
28
28
  body.companyID = destId;
29
29
  body.isActive = true;
30
30
  if (opts.newReferenceTitle !== void 0) {
31
- if (opts.newReferenceTitle.trim() === "") throw new chunkC2AFRW5M_cjs.AutotaskConfigError("moveConfigurationItem: newReferenceTitle must be non-empty");
31
+ if (opts.newReferenceTitle.trim() === "") throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("moveConfigurationItem: newReferenceTitle must be non-empty");
32
32
  body.referenceTitle = opts.newReferenceTitle.trim();
33
33
  }
34
34
  if (opts.lastModifiedDate !== void 0) {
35
35
  const current = source.lastModifiedDate;
36
36
  if (current !== opts.lastModifiedDate) {
37
- throw new chunkC2AFRW5M_cjs.StaleObjectError(
37
+ throw new chunk7GNZT7Y7_cjs.StaleObjectError(
38
38
  `moveConfigurationItem: source item ${numericSource} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${current ?? "unknown"})`,
39
39
  { operation: "configuration_items.moveConfigurationItem", resourceIds: [numericSource], details: { idRefs: [{ entity: "configuration_item", id: numericSource }] } }
40
40
  );
41
41
  }
42
42
  }
43
43
  if (opts.dryRun === true) {
44
- return chunkC2AFRW5M_cjs.buildDryRunResult({
44
+ return chunk7GNZT7Y7_cjs.buildDryRunResult({
45
45
  operation: "configuration_items.moveConfigurationItem",
46
46
  method: "POST",
47
47
  path: "/V1.0/ConfigurationItems",
@@ -66,7 +66,7 @@ async function moveConfigurationItem(_resource, sourceId, opts) {
66
66
  const createdBody = created;
67
67
  const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
68
68
  if (typeof newId !== "number") {
69
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
69
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
70
70
  }
71
71
  let sourceDeactivated = false;
72
72
  if (opts.deactivateSource !== false) {
@@ -82,10 +82,15 @@ async function moveConfigurationItem(_resource, sourceId, opts) {
82
82
  return { sourceId: numericSource, newId, destinationCompanyId: destId, sourceDeactivated };
83
83
  }
84
84
  var PROFILE_PART_LIMIT = 50;
85
+ var CI_NAME_FKS = [
86
+ ["contractID", "contract"],
87
+ ["companyID", "company"],
88
+ ["vendorID", "company"]
89
+ ];
85
90
  function profilePartLimit(value, name) {
86
91
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
87
92
  if (!Number.isInteger(n) || n < 1) {
88
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
93
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
89
94
  }
90
95
  return n;
91
96
  }
@@ -94,17 +99,25 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
94
99
  return null;
95
100
  }
96
101
  try {
97
- const res = await chunkC2AFRW5M_cjs.cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
102
+ const res = await chunk7GNZT7Y7_cjs.cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
98
103
  const body = res;
99
104
  if (body === null || !("item" in body)) {
100
- throw new chunkC2AFRW5M_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
105
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
101
106
  }
102
107
  if (body.item === null || body.item === void 0) {
103
- throw new chunkC2AFRW5M_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
108
+ throw new chunk7GNZT7Y7_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
104
109
  }
105
110
  return body.item;
106
111
  } catch (err) {
107
- if (err instanceof chunkC2AFRW5M_cjs.NotFoundError) return null;
112
+ if (err instanceof chunk7GNZT7Y7_cjs.NotFoundError) return null;
113
+ throw err;
114
+ }
115
+ }
116
+ async function degradable(read) {
117
+ try {
118
+ return { value: await read() };
119
+ } catch (err) {
120
+ if (chunk7GNZT7Y7_cjs.isAutotaskError(err) && err.code !== "ABORTED") return { fault: err.code };
108
121
  throw err;
109
122
  }
110
123
  }
@@ -116,21 +129,30 @@ async function ciScopedQuery(http, path, itemID, limit) {
116
129
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
117
130
  operation: "configuration_items.profile"
118
131
  });
119
- return chunkC2AFRW5M_cjs.unwrapItems(res).items;
132
+ return chunk7GNZT7Y7_cjs.unwrapItems(res).items;
120
133
  }
121
134
  async function profile(resource, id, opts = {}) {
122
135
  const http = resource.http;
123
136
  const noteLimit = profilePartLimit(opts.noteLimit, "noteLimit");
124
137
  const relatedLimit = profilePartLimit(opts.relatedLimit, "relatedLimit");
138
+ const subscriptionLimit = profilePartLimit(opts.subscriptionLimit, "subscriptionLimit");
125
139
  const ci = await resource.get(id);
126
140
  const root = ci;
127
- const [type, category, notes, relatedItems, associations] = await chunkC2AFRW5M_cjs.readTasks(http, [
141
+ const productRef = root["productID"] === 0 ? null : root["productID"];
142
+ const [type, category, productRead, notes, relatedItems, associations, subscriptionsRead] = await chunk7GNZT7Y7_cjs.readTasks(http, [
128
143
  () => contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type"),
129
144
  () => contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category"),
145
+ () => degradable(() => contextFetchPart(http, "/V1.0/Products", productRef, "product")),
130
146
  () => ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit),
131
147
  () => ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit),
132
- () => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT)
148
+ () => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT),
149
+ () => degradable(() => ciScopedQuery(http, "/V1.0/Subscriptions/query", id, subscriptionLimit))
133
150
  ]);
151
+ const product = "value" in productRead ? productRead.value : null;
152
+ const subscriptions = "value" in subscriptionsRead ? subscriptionsRead.value : [];
153
+ const unavailable = {};
154
+ if ("fault" in productRead) unavailable.product = productRead.fault;
155
+ if ("fault" in subscriptionsRead) unavailable.subscriptions = subscriptionsRead.fault;
134
156
  const productAssociations = {
135
157
  items: associations,
136
158
  capped: associations.length >= PROFILE_PART_LIMIT,
@@ -140,24 +162,37 @@ async function profile(resource, id, opts = {}) {
140
162
  ci,
141
163
  type,
142
164
  category,
165
+ product,
143
166
  notes: { items: notes, capped: notes.length >= noteLimit },
144
167
  relatedItems: { items: relatedItems, capped: relatedItems.length >= relatedLimit },
145
168
  productAssociations,
169
+ subscriptions: { items: subscriptions, capped: subscriptions.length >= subscriptionLimit },
146
170
  parts: {
147
171
  ci: "ok",
148
172
  type: type !== null ? "ok" : "absent",
149
173
  category: category !== null ? "ok" : "absent",
174
+ product: unavailable.product !== void 0 ? "unavailable" : product !== null ? "ok" : "absent",
150
175
  notes: "ok",
151
176
  relatedItems: "ok",
152
- productAssociations: "ok"
177
+ productAssociations: "ok",
178
+ subscriptions: unavailable.subscriptions !== void 0 ? "unavailable" : "ok"
153
179
  }
154
180
  };
181
+ if (Object.keys(unavailable).length > 0) result.unavailable = unavailable;
155
182
  if (opts.names === true) {
156
- const builder = chunkC2AFRW5M_cjs.createNamePlan();
157
- builder.addFk("contract", root["contractID"]);
158
- const names = await chunkC2AFRW5M_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
183
+ const builder = chunk7GNZT7Y7_cjs.createNamePlan();
184
+ for (const [field, table] of CI_NAME_FKS) builder.addFk(table, root[field]);
185
+ const names = await chunk7GNZT7Y7_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
159
186
  const ciRow = { ...ci };
160
- chunkC2AFRW5M_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
187
+ for (const [field, table] of CI_NAME_FKS) chunk7GNZT7Y7_cjs.addNameSibling(ciRow, field, (v) => names.recordName(table, v));
188
+ if (root["productID"] !== void 0) {
189
+ const raw = product?.["name"];
190
+ const name = typeof raw === "string" && raw.trim() !== "" ? raw : null;
191
+ ciRow["productIDName"] = name;
192
+ if (typeof productRef === "number") {
193
+ names.section.rows[`product:${productRef}`] = "fault" in productRead ? { name: null, blind: false, error: { code: productRead.fault, message: "the product part read faulted" } } : { name, blind: product === null };
194
+ }
195
+ }
161
196
  result.ci = ciRow;
162
197
  result.names = names.section;
163
198
  }
@@ -165,7 +200,7 @@ async function profile(resource, id, opts = {}) {
165
200
  }
166
201
 
167
202
  // src/resources/configuration_items.ts
168
- var ConfigurationItemsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
203
+ var ConfigurationItemsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
169
204
  constructor(http, pageSize) {
170
205
  super(http, {
171
206
  key: "configuration_items",
@@ -191,7 +226,7 @@ var ConfigurationItemsResource = class extends chunkC2AFRW5M_cjs.GenericResource
191
226
  async getContext(id) {
192
227
  const configurationItem = await this.fetchRecordRaw("/V1.0/ConfigurationItems", id);
193
228
  const root = configurationItem;
194
- const [company, contact, contract] = await chunkC2AFRW5M_cjs.readTasks(this.http, [
229
+ const [company, contact, contract] = await chunk7GNZT7Y7_cjs.readTasks(this.http, [
195
230
  () => this.contextFetch("/V1.0/Companies", root["companyID"]),
196
231
  () => this.contextFetch("/V1.0/Contacts", root["contactID"]),
197
232
  () => this.contextFetch("/V1.0/Contracts", root["contractID"])
@@ -213,23 +248,23 @@ async function fetchRecord2(http, path, label, readOpts) {
213
248
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: readOpts?.maxRetries });
214
249
  const body = res;
215
250
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
216
- throw new chunkC2AFRW5M_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
251
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
217
252
  }
218
253
  return body.item;
219
254
  }
220
255
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}) {
221
256
  const http = _resource.http;
222
- const sourceId = chunkC2AFRW5M_cjs.parseIdentifier(sourceContactId, "sourceContactId");
223
- const destId = chunkC2AFRW5M_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
257
+ const sourceId = chunk7GNZT7Y7_cjs.parseIdentifier(sourceContactId, "sourceContactId");
258
+ const destId = chunk7GNZT7Y7_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
224
259
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
225
260
  const companyID = source.companyID;
226
261
  if (typeof companyID !== "number" || companyID < 0) {
227
- throw new chunkC2AFRW5M_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
262
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
228
263
  }
229
264
  if (opts.lastModifiedDate !== void 0) {
230
265
  const current = source.lastModifiedDate;
231
266
  if (current !== opts.lastModifiedDate) {
232
- throw new chunkC2AFRW5M_cjs.StaleObjectError(
267
+ throw new chunk7GNZT7Y7_cjs.StaleObjectError(
233
268
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
234
269
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
235
270
  );
@@ -251,10 +286,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
251
286
  },
252
287
  operation: "contacts.moveToCompany"
253
288
  });
254
- const items = chunkC2AFRW5M_cjs.unwrapItems(res).items;
289
+ const items = chunk7GNZT7Y7_cjs.unwrapItems(res).items;
255
290
  const clash = items.find((c) => String(c.id) !== String(sourceId));
256
291
  if (clash !== void 0) {
257
- throw new chunkC2AFRW5M_cjs.ConflictError(
292
+ throw new chunk7GNZT7Y7_cjs.ConflictError(
258
293
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
259
294
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
260
295
  );
@@ -268,7 +303,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
268
303
  if (opts.dryRun === true) {
269
304
  const warnings = [];
270
305
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
271
- return chunkC2AFRW5M_cjs.buildDryRunResult({
306
+ return chunk7GNZT7Y7_cjs.buildDryRunResult({
272
307
  operation: "contacts.moveToCompany",
273
308
  method: "POST",
274
309
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -294,7 +329,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
294
329
  const createdBody = created;
295
330
  const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
296
331
  if (typeof newId !== "number") {
297
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
332
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
298
333
  }
299
334
  let sourceDeleted = false;
300
335
  if (opts.deleteSource === true) {
@@ -310,27 +345,27 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
310
345
  }
311
346
  var FULL_PROFILE_OP = "contacts.fullProfile";
312
347
  async function fullProfile(resource, id, opts = {}) {
313
- const client = chunkC2AFRW5M_cjs.clientOf(resource, FULL_PROFILE_OP);
314
- const ticketLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
315
- const contactId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
316
- const envelope = await chunkC2AFRW5M_cjs.invokeRead(client, "contacts.query", [
348
+ const client = chunk7GNZT7Y7_cjs.clientOf(resource, FULL_PROFILE_OP);
349
+ const ticketLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
350
+ const contactId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
351
+ const envelope = await chunk7GNZT7Y7_cjs.invokeRead(client, "contacts.query", [
317
352
  { filter: [{ field: "id", op: "eq", value: contactId }], limit: 1 }
318
353
  ]);
319
354
  const row = (envelope.items ?? [])[0];
320
355
  if (row === void 0) {
321
- throw new chunkC2AFRW5M_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
356
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
322
357
  }
323
358
  const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
324
- const root = fk === null ? row : await chunkC2AFRW5M_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
325
- const [company, openTickets] = await chunkC2AFRW5M_cjs.readTasks(resource.http, [
326
- async () => fk === null ? { value: null, absent: "NO_FK" } : await chunkC2AFRW5M_cjs.compositePart(client, "companies.get", [fk]),
327
- async () => await chunkC2AFRW5M_cjs.openTicketsOfPart(client, "contactID", contactId, ticketLimit)
359
+ const root = fk === null ? row : await chunk7GNZT7Y7_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
360
+ const [company, openTickets] = await chunk7GNZT7Y7_cjs.readTasks(resource.http, [
361
+ async () => fk === null ? { value: null, absent: "NO_FK" } : await chunk7GNZT7Y7_cjs.compositePart(client, "companies.get", [fk]),
362
+ async () => await chunk7GNZT7Y7_cjs.openTicketsOfPart(client, "contactID", contactId, ticketLimit)
328
363
  ]);
329
364
  return { root, parts: { company, open_tickets: openTickets } };
330
365
  }
331
366
 
332
367
  // src/resources/contacts.ts
333
- var ContactsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
368
+ var ContactsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
334
369
  constructor(http, pageSize) {
335
370
  super(http, {
336
371
  key: "contacts",
@@ -379,10 +414,10 @@ var PATH_SUFFIX = {
379
414
  };
380
415
  async function stockedItems(_resource, kind, parentId, data, opts = {}) {
381
416
  const http = _resource.http;
382
- const numericParent = chunkC2AFRW5M_cjs.parseIdentifier(parentId, "parentId");
417
+ const numericParent = chunk7GNZT7Y7_cjs.parseIdentifier(parentId, "parentId");
383
418
  const suffix = PATH_SUFFIX[kind];
384
419
  if (opts.dryRun === true) {
385
- return chunkC2AFRW5M_cjs.buildDryRunResult({
420
+ return chunk7GNZT7Y7_cjs.buildDryRunResult({
386
421
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
387
422
  method: "POST",
388
423
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -399,11 +434,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}) {
399
434
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
400
435
  maxRetries: opts.maxRetries
401
436
  });
402
- return chunkC2AFRW5M_cjs.unwrapOperation(res);
437
+ return chunk7GNZT7Y7_cjs.unwrapOperation(res);
403
438
  }
404
439
 
405
440
  // src/resources/inventory_products.ts
406
- var InventoryProductsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
441
+ var InventoryProductsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
407
442
  constructor(http, pageSize) {
408
443
  super(http, {
409
444
  key: "inventory_products",
@@ -431,18 +466,18 @@ var InventoryProductsResource = class extends chunkC2AFRW5M_cjs.GenericResource
431
466
  // src/resources/special/quotes.ts
432
467
  var OP = "quotes.withItems";
433
468
  async function withItems(resource, id, opts = {}) {
434
- const client = chunkC2AFRW5M_cjs.clientOf(resource, OP);
435
- const itemLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
436
- const quoteId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
437
- const root = await chunkC2AFRW5M_cjs.invokeRead(client, "quotes.get", [quoteId]);
438
- const items = await chunkC2AFRW5M_cjs.compositePart(client, "quote_items.query", [
469
+ const client = chunk7GNZT7Y7_cjs.clientOf(resource, OP);
470
+ const itemLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
471
+ const quoteId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
472
+ const root = await chunk7GNZT7Y7_cjs.invokeRead(client, "quotes.get", [quoteId]);
473
+ const items = await chunk7GNZT7Y7_cjs.compositePart(client, "quote_items.query", [
439
474
  { filter: [{ field: "quoteID", op: "eq", value: quoteId }], limit: itemLimit }
440
475
  ]);
441
476
  return { root, parts: { items } };
442
477
  }
443
478
 
444
479
  // src/resources/quotes.ts
445
- var QuotesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
480
+ var QuotesResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
446
481
  constructor(http, pageSize) {
447
482
  super(http, {
448
483
  key: "quotes",
@@ -468,7 +503,7 @@ var QuotesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
468
503
  // src/resources/special/resource_time_off_additional.ts
469
504
  async function getByResource(_resource, resourceId) {
470
505
  const http = _resource.http;
471
- const numericResource = chunkC2AFRW5M_cjs.parseIdentifier(resourceId, "resourceId");
506
+ const numericResource = chunk7GNZT7Y7_cjs.parseIdentifier(resourceId, "resourceId");
472
507
  const res = await http.request({
473
508
  method: "GET",
474
509
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -482,11 +517,11 @@ async function getByResource(_resource, resourceId) {
482
517
  if (typeof item === "object" && !Array.isArray(item)) return [item];
483
518
  }
484
519
  }
485
- return chunkC2AFRW5M_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
520
+ return chunk7GNZT7Y7_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
486
521
  }
487
522
 
488
523
  // src/resources/resource_time_off_additional.ts
489
- var ResourceTimeOffAdditionalResource = class extends chunkC2AFRW5M_cjs.GenericResource {
524
+ var ResourceTimeOffAdditionalResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
490
525
  constructor(http, pageSize) {
491
526
  super(http, {
492
527
  key: "resource_time_off_additional",
@@ -507,30 +542,30 @@ var ResourceTimeOffAdditionalResource = class extends chunkC2AFRW5M_cjs.GenericR
507
542
  // src/resources/special/resource_time_off_balances.ts
508
543
  async function getByResource2(_resource, resourceId) {
509
544
  const http = _resource.http;
510
- const numericResource = chunkC2AFRW5M_cjs.parseIdentifier(resourceId, "resourceId");
545
+ const numericResource = chunk7GNZT7Y7_cjs.parseIdentifier(resourceId, "resourceId");
511
546
  const res = await http.request({
512
547
  method: "GET",
513
548
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
514
549
  operation: "resource_time_off_balances.getByResource"
515
550
  });
516
- return chunkC2AFRW5M_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
551
+ return chunk7GNZT7Y7_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
517
552
  }
518
553
  async function getByYear(_resource, resourceId, year) {
519
554
  const http = _resource.http;
520
- const numericResource = chunkC2AFRW5M_cjs.parseIdentifier(resourceId, "resourceId");
555
+ const numericResource = chunk7GNZT7Y7_cjs.parseIdentifier(resourceId, "resourceId");
521
556
  if (!Number.isSafeInteger(year) || year < 1) {
522
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
557
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
523
558
  }
524
559
  const res = await http.request({
525
560
  method: "GET",
526
561
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
527
562
  operation: "resource_time_off_balances.getByYear"
528
563
  });
529
- return chunkC2AFRW5M_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
564
+ return chunk7GNZT7Y7_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
530
565
  }
531
566
 
532
567
  // src/resources/resource_time_off_balances.ts
533
- var ResourceTimeOffBalancesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
568
+ var ResourceTimeOffBalancesResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
534
569
  constructor(http, pageSize) {
535
570
  super(http, {
536
571
  key: "resource_time_off_balances",
@@ -556,7 +591,7 @@ var ResourceTimeOffBalancesResource = class extends chunkC2AFRW5M_cjs.GenericRes
556
591
  async function whoAmI(_resource, userName) {
557
592
  const http = _resource.http;
558
593
  const user = userName.trim();
559
- if (user === "") throw new chunkC2AFRW5M_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
594
+ if (user === "") throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
560
595
  const value = user.includes("@") ? user.split("@")[0] ?? "" : user;
561
596
  const res = await http.request({
562
597
  method: "POST",
@@ -565,11 +600,11 @@ async function whoAmI(_resource, userName) {
565
600
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
566
601
  operation: "resources.whoAmI"
567
602
  });
568
- const matches = chunkC2AFRW5M_cjs.unwrapItems(res).items;
603
+ const matches = chunk7GNZT7Y7_cjs.unwrapItems(res).items;
569
604
  if (matches.length === 0) return null;
570
605
  if (matches.length > 1) {
571
606
  const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
572
- throw new chunkC2AFRW5M_cjs.ResolutionError(
607
+ throw new chunk7GNZT7Y7_cjs.ResolutionError(
573
608
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
574
609
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids, details: { idRefs: ids.map((cid) => ({ entity: "resource", id: cid })) } }
575
610
  );
@@ -578,28 +613,28 @@ async function whoAmI(_resource, userName) {
578
613
  }
579
614
  var WORKLOAD_OP = "resources.workload";
580
615
  async function workload(resource, id, opts = {}) {
581
- const client = chunkC2AFRW5M_cjs.clientOf(resource, WORKLOAD_OP);
582
- const ticketLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
583
- const taskLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
584
- const timeOffLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
585
- const resourceId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
586
- const root = await chunkC2AFRW5M_cjs.invokeRead(client, "resources.get", [resourceId]);
616
+ const client = chunk7GNZT7Y7_cjs.clientOf(resource, WORKLOAD_OP);
617
+ const ticketLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
618
+ const taskLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
619
+ const timeOffLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
620
+ const resourceId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
621
+ const root = await chunk7GNZT7Y7_cjs.invokeRead(client, "resources.get", [resourceId]);
587
622
  const strict = { allowAssumed: false };
588
- const [joined, counted, assignmentBranch, balances, timeOff] = await chunkC2AFRW5M_cjs.readTasks(resource.http, [
589
- () => chunkC2AFRW5M_cjs.compositePart(client, "tickets.forResource", [
623
+ const [joined, counted, assignmentBranch, balances, timeOff] = await chunk7GNZT7Y7_cjs.readTasks(resource.http, [
624
+ () => chunk7GNZT7Y7_cjs.compositePart(client, "tickets.forResource", [
590
625
  resourceId,
591
626
  { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
592
627
  ]),
593
- () => chunkC2AFRW5M_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
628
+ () => chunk7GNZT7Y7_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
594
629
  async () => {
595
- const assignments2 = await chunkC2AFRW5M_cjs.compositePart(client, "service_call_task_resources.query", [
630
+ const assignments2 = await chunk7GNZT7Y7_cjs.compositePart(client, "service_call_task_resources.query", [
596
631
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
597
632
  ]);
598
- const taskDetails2 = await chunkC2AFRW5M_cjs.joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
633
+ const taskDetails2 = await chunk7GNZT7Y7_cjs.joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
599
634
  return { assignments: assignments2, taskDetails: taskDetails2 };
600
635
  },
601
- () => chunkC2AFRW5M_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
602
- () => chunkC2AFRW5M_cjs.compositePart(client, "time_off_requests.query", [
636
+ () => chunk7GNZT7Y7_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
637
+ () => chunk7GNZT7Y7_cjs.compositePart(client, "time_off_requests.query", [
603
638
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
604
639
  ])
605
640
  ]);
@@ -627,7 +662,7 @@ async function workload(resource, id, opts = {}) {
627
662
  }
628
663
 
629
664
  // src/resources/resources.ts
630
- var ResourcesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
665
+ var ResourcesResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
631
666
  clientConfig;
632
667
  constructor(http, clientConfig, pageSize) {
633
668
  super(http, {
@@ -659,20 +694,20 @@ var ResourcesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
659
694
  // src/resources/special/service_calls.ts
660
695
  var OP2 = "service_calls.fullProfile";
661
696
  async function fullProfile2(resource, id, opts = {}) {
662
- const client = chunkC2AFRW5M_cjs.clientOf(resource, OP2);
663
- const ticketLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
664
- const taskLimit = chunkC2AFRW5M_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
665
- const callId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
666
- const root = await chunkC2AFRW5M_cjs.invokeRead(client, "service_calls.get", [callId]);
667
- const [tickets, taskBranch] = await chunkC2AFRW5M_cjs.readTasks(resource.http, [
668
- () => chunkC2AFRW5M_cjs.compositePart(client, "service_call_tickets.query", [
697
+ const client = chunk7GNZT7Y7_cjs.clientOf(resource, OP2);
698
+ const ticketLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
699
+ const taskLimit = chunk7GNZT7Y7_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
700
+ const callId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
701
+ const root = await chunk7GNZT7Y7_cjs.invokeRead(client, "service_calls.get", [callId]);
702
+ const [tickets, taskBranch] = await chunk7GNZT7Y7_cjs.readTasks(resource.http, [
703
+ () => chunk7GNZT7Y7_cjs.compositePart(client, "service_call_tickets.query", [
669
704
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
670
705
  ]),
671
706
  async () => {
672
- const tasks2 = await chunkC2AFRW5M_cjs.compositePart(client, "service_call_tasks.query", [
707
+ const tasks2 = await chunk7GNZT7Y7_cjs.compositePart(client, "service_call_tasks.query", [
673
708
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
674
709
  ]);
675
- const resourceAssignments2 = await chunkC2AFRW5M_cjs.joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
710
+ const resourceAssignments2 = await chunk7GNZT7Y7_cjs.joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
676
711
  return { tasks: tasks2, resourceAssignments: resourceAssignments2 };
677
712
  }
678
713
  ]);
@@ -688,7 +723,7 @@ async function fullProfile2(resource, id, opts = {}) {
688
723
  }
689
724
 
690
725
  // src/resources/service_calls.ts
691
- var ServiceCallsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
726
+ var ServiceCallsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
692
727
  constructor(http, pageSize) {
693
728
  super(http, {
694
729
  key: "service_calls",
@@ -710,13 +745,13 @@ var OP3 = "ticket_charges.moveToTicket";
710
745
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
711
746
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
712
747
  async function readCharge(http, id, retries) {
713
- const rows = await chunkC2AFRW5M_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
748
+ const rows = await chunk7GNZT7Y7_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
714
749
  return rows[0] ?? null;
715
750
  }
716
751
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
717
752
  if (source.isBilled === true) {
718
- throw chunkC2AFRW5M_cjs.refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
719
- manualAction: { action: "delete_source", uiLink: chunkC2AFRW5M_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
753
+ throw chunk7GNZT7Y7_cjs.refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
754
+ manualAction: { action: "delete_source", uiLink: chunk7GNZT7Y7_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
720
755
  });
721
756
  }
722
757
  }
@@ -750,14 +785,14 @@ var SPEC = {
750
785
  ]
751
786
  }),
752
787
  // charges have no ExecuteCommand code: the parent ticket is the closest clickable target
753
- manualLink: (http, source) => typeof source.ticketID === "number" ? chunkC2AFRW5M_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
788
+ manualLink: (http, source) => typeof source.ticketID === "number" ? chunk7GNZT7Y7_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
754
789
  };
755
790
  function moveToTicket(resource, sourceId, toTicketId, opts) {
756
- return chunkC2AFRW5M_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
791
+ return chunk7GNZT7Y7_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
757
792
  }
758
793
 
759
794
  // src/resources/ticket_charges.ts
760
- var TicketChargesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
795
+ var TicketChargesResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
761
796
  constructor(http, pageSize) {
762
797
  super(http, {
763
798
  key: "ticket_charges",
@@ -782,7 +817,7 @@ var TicketChargesResource = class extends chunkC2AFRW5M_cjs.GenericResource {
782
817
  };
783
818
 
784
819
  // src/resources/special/tickets/errors.ts
785
- var StatusUnknownError = class extends chunkC2AFRW5M_cjs.AutotaskError {
820
+ var StatusUnknownError = class extends chunk7GNZT7Y7_cjs.AutotaskError {
786
821
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
787
822
  picklistCount;
788
823
  constructor(message, options = {}) {
@@ -796,7 +831,7 @@ var StatusUnknownError = class extends chunkC2AFRW5M_cjs.AutotaskError {
796
831
  this.picklistCount = options.picklistCount ?? 0;
797
832
  }
798
833
  };
799
- var StatusFieldsRequiredError = class extends chunkC2AFRW5M_cjs.AutotaskError {
834
+ var StatusFieldsRequiredError = class extends chunk7GNZT7Y7_cjs.AutotaskError {
800
835
  vendorFields;
801
836
  currentStatus;
802
837
  targetStatus;
@@ -818,8 +853,8 @@ function isPositiveInt(v) {
818
853
  return typeof v === "number" && Number.isInteger(v) && v > 0;
819
854
  }
820
855
  function namedVendorFields(err) {
821
- if (!chunkC2AFRW5M_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
822
- const entries = chunkC2AFRW5M_cjs.parseVendorErrors(err.vendorError) ?? [];
856
+ if (!chunk7GNZT7Y7_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
857
+ const entries = chunk7GNZT7Y7_cjs.parseVendorErrors(err.vendorError) ?? [];
823
858
  const out = /* @__PURE__ */ new Set();
824
859
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
825
860
  return [...out];
@@ -838,8 +873,8 @@ function unwrapItemOrNull(res) {
838
873
  return body.item;
839
874
  }
840
875
  function discoveryMerge(err, body, defaults) {
841
- if (!chunkC2AFRW5M_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
842
- const entries = chunkC2AFRW5M_cjs.parseVendorErrors(err.vendorError);
876
+ if (!chunk7GNZT7Y7_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
877
+ const entries = chunk7GNZT7Y7_cjs.parseVendorErrors(err.vendorError);
843
878
  if (entries === void 0) return null;
844
879
  for (const entry of entries) {
845
880
  const field = entry.field;
@@ -874,7 +909,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
874
909
  const ids = await readLiveStatusSet(resource);
875
910
  if (ids.size > 0) liveStatus = ids;
876
911
  } catch (err) {
877
- if (!chunkC2AFRW5M_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
912
+ if (!chunk7GNZT7Y7_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
878
913
  }
879
914
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
880
915
  http.fieldCache?.invalidate("tickets:");
@@ -884,7 +919,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
884
919
  const freshIds = await readLiveStatusSet(resource);
885
920
  if (freshIds.size > 0) freshStatus = freshIds;
886
921
  } catch (err) {
887
- if (!chunkC2AFRW5M_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
922
+ if (!chunk7GNZT7Y7_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
888
923
  freshStatus = null;
889
924
  reReadFailed = true;
890
925
  }
@@ -902,7 +937,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
902
937
  return { guardDegraded: liveStatus === null };
903
938
  }
904
939
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
905
- return chunkC2AFRW5M_cjs.buildDryRunResult(
940
+ return chunk7GNZT7Y7_cjs.buildDryRunResult(
906
941
  {
907
942
  operation: OP_STATUS,
908
943
  method: "PUT",
@@ -956,7 +991,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
956
991
  if (mapEntry === void 0) {
957
992
  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).`);
958
993
  }
959
- return chunkC2AFRW5M_cjs.buildDryRunResult(
994
+ return chunk7GNZT7Y7_cjs.buildDryRunResult(
960
995
  {
961
996
  operation: OP_STATUS,
962
997
  method: "PUT",
@@ -976,7 +1011,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
976
1011
  }
977
1012
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
978
1013
  const safeDefaults = mapEntry?.safeDefaults ?? {};
979
- const body = chunkC2AFRW5M_cjs.mergePartialBody(current, mergeData);
1014
+ const body = chunk7GNZT7Y7_cjs.mergePartialBody(current, mergeData);
980
1015
  body.id = ticketId;
981
1016
  let merges = 0;
982
1017
  for (; ; ) {
@@ -1000,8 +1035,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1000
1035
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
1001
1036
  {
1002
1037
  operation: OP_STATUS,
1003
- httpStatus: chunkC2AFRW5M_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1004
- vendorError: chunkC2AFRW5M_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1038
+ httpStatus: chunk7GNZT7Y7_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1039
+ vendorError: chunk7GNZT7Y7_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1005
1040
  resourceIds: [ticketId],
1006
1041
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
1007
1042
  }
@@ -1014,7 +1049,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1014
1049
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1015
1050
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1016
1051
  if (verify === null) {
1017
- throw new chunkC2AFRW5M_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1052
+ throw new chunk7GNZT7Y7_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1018
1053
  code: "INVALID_RESPONSE",
1019
1054
  category: "server",
1020
1055
  operation: OP_STATUS,
@@ -1024,7 +1059,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1024
1059
  }
1025
1060
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
1026
1061
  if (finalStatus !== targetStatus) {
1027
- throw new chunkC2AFRW5M_cjs.AutotaskError(
1062
+ throw new chunk7GNZT7Y7_cjs.AutotaskError(
1028
1063
  `changeStatus: the post-PUT read-back shows status ${finalStatus ?? "unknown"} (the vendor 200ed the PUT but did not apply ${targetStatus} \u2014 the F-A1 lesson: the 200 proves nothing)`,
1029
1064
  {
1030
1065
  code: "INVALID_RESPONSE",
@@ -1040,17 +1075,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1040
1075
  }
1041
1076
  async function changeStatus(resource, id, targetStatus, fields, opts) {
1042
1077
  const http = resource.http;
1043
- const ticketId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1078
+ const ticketId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1044
1079
  if (!isPositiveInt(targetStatus)) {
1045
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1080
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1046
1081
  }
1047
1082
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
1048
1083
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
1049
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1084
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1050
1085
  }
1051
1086
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1052
1087
  if (current === null) {
1053
- throw new chunkC2AFRW5M_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1088
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1054
1089
  }
1055
1090
  const previousStatus = typeof current.status === "number" ? current.status : null;
1056
1091
  if (previousStatus === targetStatus) {
@@ -1076,7 +1111,7 @@ var TICKET_FIELDS = ["id", "ticketNumber", "title", "status", "assignedResourceI
1076
1111
  function positiveId(value, name) {
1077
1112
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
1078
1113
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1079
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1114
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1080
1115
  }
1081
1116
  return n;
1082
1117
  }
@@ -1088,7 +1123,7 @@ async function ticketPage(http, filter, maxRecords, fields) {
1088
1123
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
1089
1124
  operation: OP4
1090
1125
  });
1091
- const page = chunkC2AFRW5M_cjs.unwrapItems(res, OP4);
1126
+ const page = chunk7GNZT7Y7_cjs.unwrapItems(res, OP4);
1092
1127
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
1093
1128
  }
1094
1129
  async function readLinkIds(http, resourceID, maxPages = 1) {
@@ -1098,11 +1133,11 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1098
1133
  const res = await http.request({
1099
1134
  method: "POST",
1100
1135
  idempotent: true,
1101
- path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkC2AFRW5M_cjs.cursorToPath(http.baseUrl, cursor),
1136
+ path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunk7GNZT7Y7_cjs.cursorToPath(http.baseUrl, cursor),
1102
1137
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
1103
1138
  operation: OP4
1104
1139
  });
1105
- const page = chunkC2AFRW5M_cjs.unwrapItems(res, OP4);
1140
+ const page = chunk7GNZT7Y7_cjs.unwrapItems(res, OP4);
1106
1141
  for (const row of page.items) if (typeof row.ticketID === "number") ids.add(row.ticketID);
1107
1142
  cursor = page.pageDetails.nextPageUrl;
1108
1143
  if (cursor === null || page.items.length === 0) return { ids: [...ids], capped: false };
@@ -1111,35 +1146,35 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1111
1146
  }
1112
1147
  async function forResource(_resource, resourceIDIn, opts = {}) {
1113
1148
  const http = _resource.http;
1114
- if (opts === null || typeof opts !== "object") throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1149
+ if (opts === null || typeof opts !== "object") throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1115
1150
  const resourceID = positiveId(resourceIDIn, "resourceID");
1116
1151
  const scope = opts.scope ?? "both";
1117
1152
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
1118
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1153
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1119
1154
  }
1120
1155
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
1121
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1156
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1122
1157
  }
1123
1158
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
1124
1159
  if (opts.countOnly !== true && (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX)) {
1125
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1160
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1126
1161
  }
1127
1162
  const includeFields = opts.includeFields ?? [];
1128
1163
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
1129
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1164
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1130
1165
  }
1131
1166
  const openOnly = opts.openOnly === true;
1132
1167
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS, ...includeFields])];
1133
1168
  if (opts.countOnly !== void 0 && typeof opts.countOnly !== "boolean") {
1134
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1169
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1135
1170
  }
1136
- const closed = await chunkC2AFRW5M_cjs.resolveTicketStatusSemantics(
1171
+ const closed = await chunk7GNZT7Y7_cjs.resolveTicketStatusSemantics(
1137
1172
  http,
1138
1173
  { ...opts.excludeStatusIds === void 0 ? {} : { excludeStatusIds: opts.excludeStatusIds }, ...opts.allowAssumed === void 0 ? {} : { allowAssumed: opts.allowAssumed } },
1139
1174
  OP4
1140
1175
  );
1141
1176
  const closedStatus = { closedIds: closed.closedIds, source: closed.source, note: closed.note };
1142
- const openLeaf = openOnly || opts.countOnly === true ? [chunkC2AFRW5M_cjs.openStatusFilter(closed.closedIds)] : [];
1177
+ const openLeaf = openOnly || opts.countOnly === true ? [chunk7GNZT7Y7_cjs.openStatusFilter(closed.closedIds)] : [];
1143
1178
  if (opts.countOnly === true) {
1144
1179
  const primaryCount = scope === "secondary" ? 0 : await _resource.count({ filter: [{ field: "assignedResourceID", op: "eq", value: resourceID }, ...openLeaf] });
1145
1180
  let secondaryCount = 0;
@@ -1153,7 +1188,7 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1153
1188
  const page = await ticketPage(http, [{ field: "id", op: "in", value: chunk }, ...openLeaf], chunk.length, ["id", "status", "assignedResourceID"]);
1154
1189
  const seen = /* @__PURE__ */ new Set();
1155
1190
  for (const t of page.rows) {
1156
- if (typeof t.id !== "number" || seen.has(t.id) || chunkC2AFRW5M_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1191
+ if (typeof t.id !== "number" || seen.has(t.id) || chunk7GNZT7Y7_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1157
1192
  seen.add(t.id);
1158
1193
  if (scope === "both" && t.assignedResourceID === resourceID) bothCount++;
1159
1194
  }
@@ -1199,13 +1234,13 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1199
1234
  for (const [id, t] of primary) merged.set(id, t);
1200
1235
  for (const [id, t] of secondary) if (!merged.has(id)) merged.set(id, t);
1201
1236
  let tickets = [...merged.values()];
1202
- if (openOnly) tickets = tickets.filter((t) => !chunkC2AFRW5M_cjs.isClosedStatus(t.status, closed.closedIds));
1237
+ if (openOnly) tickets = tickets.filter((t) => !chunk7GNZT7Y7_cjs.isClosedStatus(t.status, closed.closedIds));
1203
1238
  tickets.sort((a, b) => Number(a.id) - Number(b.id));
1204
1239
  if (tickets.length > limit) {
1205
1240
  tickets = tickets.slice(0, limit);
1206
1241
  capped = true;
1207
1242
  }
1208
- const openCount = tickets.filter((t) => !chunkC2AFRW5M_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1243
+ const openCount = tickets.filter((t) => !chunk7GNZT7Y7_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1209
1244
  const primaryIds = [...primary.keys()].sort((a, b) => a - b);
1210
1245
  const secondaryIds = [...secondary.keys()].sort((a, b) => a - b);
1211
1246
  const both = primaryIds.filter((id) => secondary.has(id));
@@ -1239,9 +1274,9 @@ async function fetchTicket(http, id, operation) {
1239
1274
  });
1240
1275
  const body = res;
1241
1276
  if (body === null || !("item" in body)) {
1242
- throw new chunkC2AFRW5M_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1277
+ throw new chunk7GNZT7Y7_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1243
1278
  }
1244
- if (body.item === null || body.item === void 0) throw new chunkC2AFRW5M_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1279
+ if (body.item === null || body.item === void 0) throw new chunk7GNZT7Y7_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1245
1280
  return body.item;
1246
1281
  }
1247
1282
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -1252,7 +1287,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
1252
1287
  body: { MaxRecords: maxRecords, filter },
1253
1288
  operation
1254
1289
  });
1255
- return chunkC2AFRW5M_cjs.unwrapItems(res).items;
1290
+ return chunk7GNZT7Y7_cjs.unwrapItems(res).items;
1256
1291
  }
1257
1292
  function truncate(text, limit) {
1258
1293
  const full = text ?? "";
@@ -1262,27 +1297,27 @@ function truncate(text, limit) {
1262
1297
 
1263
1298
  // src/resources/special/tickets/childRead.ts
1264
1299
  function isRouteUnavailable(err) {
1265
- return chunkC2AFRW5M_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1300
+ return chunk7GNZT7Y7_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1266
1301
  }
1267
1302
  function routeFact(route, path, err) {
1268
1303
  return {
1269
1304
  route,
1270
1305
  path,
1271
- httpStatus: chunkC2AFRW5M_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1306
+ httpStatus: chunk7GNZT7Y7_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1272
1307
  };
1273
1308
  }
1274
1309
  async function childDeclaresQuery(resourceKey) {
1275
- const records = await chunkQCA5R7QF_cjs.loadCapabilityRecords();
1310
+ const records = await chunkJCKYM7FD_cjs.loadCapabilityRecords();
1276
1311
  return records.some(
1277
1312
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
1278
1313
  );
1279
1314
  }
1280
1315
  async function planScopedPath(resourceKey, ticketId) {
1281
1316
  if (!await childDeclaresQuery(resourceKey)) return null;
1282
- const entry = chunkC2AFRW5M_cjs.RELATIONSHIP_MAP[resourceKey];
1317
+ const entry = chunk7GNZT7Y7_cjs.RELATIONSHIP_MAP[resourceKey];
1283
1318
  const parent = entry === void 0 ? null : entry.parent;
1284
1319
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
1285
- const parentPath = chunkC2AFRW5M_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1320
+ const parentPath = chunk7GNZT7Y7_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1286
1321
  if (parentPath === null || parentPath === void 0) return null;
1287
1322
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
1288
1323
  }
@@ -1321,14 +1356,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
1321
1356
  break;
1322
1357
  }
1323
1358
  const body = await http.request({ method: "GET", path: target, operation });
1324
- const { items: pageItems, pageDetails } = chunkC2AFRW5M_cjs.unwrapItems(body, operation);
1359
+ const { items: pageItems, pageDetails } = chunk7GNZT7Y7_cjs.unwrapItems(body, operation);
1325
1360
  nextCursor = pageDetails.nextPageUrl;
1326
1361
  pages += 1;
1327
1362
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
1328
1363
  for (const row of window) if (accept(row)) items.push(row);
1329
1364
  if (items.length >= limit) break;
1330
1365
  if (nextCursor === null || pageItems.length === 0) break;
1331
- target = chunkC2AFRW5M_cjs.cursorToPath(http.baseUrl, nextCursor);
1366
+ target = chunk7GNZT7Y7_cjs.cursorToPath(http.baseUrl, nextCursor);
1332
1367
  }
1333
1368
  const capped = items.length >= limit || guard && nextCursor !== null;
1334
1369
  return { items, capped };
@@ -1361,7 +1396,7 @@ var DEFAULT_PART_LIMIT = 50;
1361
1396
  function partLimit(value, name) {
1362
1397
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
1363
1398
  if (!Number.isInteger(n) || n < 1) {
1364
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1399
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1365
1400
  }
1366
1401
  return n;
1367
1402
  }
@@ -1374,13 +1409,13 @@ function servedTextRecord(row, textField, limit) {
1374
1409
  return out;
1375
1410
  }
1376
1411
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1377
- const builder = chunkC2AFRW5M_cjs.createNamePlan(chunkC2AFRW5M_cjs.TICKET_LABEL_FIELDS);
1412
+ const builder = chunk7GNZT7Y7_cjs.createNamePlan(chunk7GNZT7Y7_cjs.TICKET_LABEL_FIELDS);
1378
1413
  const t = ctx.ticket;
1379
1414
  builder.addResource(t["creatorResourceID"]);
1380
1415
  builder.addFk("contract", t["contractID"]);
1381
1416
  builder.addFk("billingCode", t["billingCodeID"]);
1382
1417
  builder.addFk("role", t["assignedResourceRoleID"]);
1383
- const ticketLobPointer = chunkC2AFRW5M_cjs.vendorId(t["organizationalLevelAssociationID"]);
1418
+ const ticketLobPointer = chunk7GNZT7Y7_cjs.vendorId(t["organizationalLevelAssociationID"]);
1384
1419
  if (ticketLobPointer !== void 0) {
1385
1420
  builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
1386
1421
  } else {
@@ -1392,20 +1427,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1392
1427
  builder.addFk("billingCode", e["billingCodeID"]);
1393
1428
  builder.addFk("contract", e["contractID"]);
1394
1429
  }
1395
- const names = await chunkC2AFRW5M_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1430
+ const names = await chunk7GNZT7Y7_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1396
1431
  const ticketRow = { ...ctx.ticket };
1397
- chunkC2AFRW5M_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1398
- chunkC2AFRW5M_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1399
- chunkC2AFRW5M_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1400
- chunkC2AFRW5M_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1401
- for (const f of chunkC2AFRW5M_cjs.TICKET_LABEL_FIELDS) chunkC2AFRW5M_cjs.addLabelSibling(ticketRow, f, names);
1432
+ chunk7GNZT7Y7_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1433
+ chunk7GNZT7Y7_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1434
+ chunk7GNZT7Y7_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1435
+ chunk7GNZT7Y7_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1436
+ for (const f of chunk7GNZT7Y7_cjs.TICKET_LABEL_FIELDS) chunk7GNZT7Y7_cjs.addLabelSibling(ticketRow, f, names);
1402
1437
  result.ticket = ticketRow;
1403
1438
  result.timeEntries.items = entriesPart.items.map((e) => {
1404
1439
  const row = { ...e };
1405
- chunkC2AFRW5M_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1406
- chunkC2AFRW5M_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1407
- chunkC2AFRW5M_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1408
- chunkC2AFRW5M_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1440
+ chunk7GNZT7Y7_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1441
+ chunk7GNZT7Y7_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1442
+ chunk7GNZT7Y7_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1443
+ chunk7GNZT7Y7_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1409
1444
  return row;
1410
1445
  });
1411
1446
  result.names = names.section;
@@ -1422,11 +1457,11 @@ async function fullContext(resource, id, opts = {}, loadContext) {
1422
1457
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
1423
1458
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
1424
1459
  const textLimit = partLimit(opts.textLimit, "textLimit");
1425
- const ticketId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1460
+ const ticketId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1426
1461
  const { ticket, tasks: contextTasks } = await loadContext();
1427
1462
  const op = "tickets.fullContext";
1428
1463
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
1429
- const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await chunkC2AFRW5M_cjs.readTasks(http, [
1464
+ const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await chunk7GNZT7Y7_cjs.readTasks(http, [
1430
1465
  ...contextTasks,
1431
1466
  () => ticketChildRead(http, { globalPath: "/V1.0/TicketNotes/query", resourceKey: "ticket_notes", filter: ticketFilter, limit: noteLimit, operation: op }, ticketId),
1432
1467
  () => ticketChildRead(http, { globalPath: "/V1.0/TimeEntries/query", resourceKey: "time_entries", filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId),
@@ -1489,7 +1524,7 @@ var OP5 = "tickets.lineOfBusiness";
1489
1524
  function positiveId2(value, name) {
1490
1525
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
1491
1526
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1492
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1527
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1493
1528
  }
1494
1529
  return n;
1495
1530
  }
@@ -1505,25 +1540,25 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1505
1540
  associationSource = "argument";
1506
1541
  } else {
1507
1542
  const ticket = await resource.get(ticketId);
1508
- associationId = chunkC2AFRW5M_cjs.vendorId(ticket.organizationalLevelAssociationID);
1543
+ associationId = chunk7GNZT7Y7_cjs.vendorId(ticket.organizationalLevelAssociationID);
1509
1544
  if (associationId !== void 0) {
1510
1545
  associationSource = "ticket";
1511
1546
  } else {
1512
- const contractRef = chunkC2AFRW5M_cjs.vendorId(ticket.contractID);
1547
+ const contractRef = chunk7GNZT7Y7_cjs.vendorId(ticket.contractID);
1513
1548
  if (contractRef !== void 0) {
1514
1549
  const client = http.client;
1515
1550
  if (client === void 0) {
1516
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1551
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1517
1552
  }
1518
1553
  try {
1519
1554
  const contract = await client.contracts.get(contractRef);
1520
1555
  contractId = contractRef;
1521
- associationId = chunkC2AFRW5M_cjs.vendorId(contract.organizationalLevelAssociationID);
1556
+ associationId = chunk7GNZT7Y7_cjs.vendorId(contract.organizationalLevelAssociationID);
1522
1557
  if (associationId !== void 0) associationSource = "contract";
1523
1558
  } catch (e) {
1524
- if (e instanceof chunkC2AFRW5M_cjs.NotFoundError) {
1559
+ if (e instanceof chunk7GNZT7Y7_cjs.NotFoundError) {
1525
1560
  contractId = contractRef;
1526
- } else if (chunkC2AFRW5M_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1561
+ } else if (chunk7GNZT7Y7_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1527
1562
  contractId = contractRef;
1528
1563
  contractUnread = true;
1529
1564
  } else {
@@ -1544,7 +1579,7 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1544
1579
  markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
1545
1580
  };
1546
1581
  }
1547
- const chain = await chunkC2AFRW5M_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1582
+ const chain = await chunk7GNZT7Y7_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1548
1583
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
1549
1584
  return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
1550
1585
  }
@@ -1554,7 +1589,7 @@ var MS = 864e5;
1554
1589
  var SLA_PAGE = 100;
1555
1590
  async function slaHealthCheck(_resource, id, opts = {}) {
1556
1591
  const http = _resource.http;
1557
- const ticketId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1592
+ const ticketId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1558
1593
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
1559
1594
  const rows = await ticketQueryItems(
1560
1595
  http,
@@ -1580,9 +1615,9 @@ async function summary(_resource, id, opts = {}) {
1580
1615
  const http = _resource.http;
1581
1616
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
1582
1617
  if (!Number.isInteger(limit) || limit < 1) {
1583
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1618
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1584
1619
  }
1585
- const ticketId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1620
+ const ticketId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1586
1621
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
1587
1622
  const desc = truncate(ticket.description, limit);
1588
1623
  const now = opts.now ?? /* @__PURE__ */ new Date();
@@ -1611,17 +1646,17 @@ async function summary(_resource, id, opts = {}) {
1611
1646
  // src/resources/special/tickets/statusSemantics.ts
1612
1647
  async function statusSemantics(_resource, opts = {}) {
1613
1648
  const http = _resource.http;
1614
- return chunkC2AFRW5M_cjs.resolveTicketStatusSemantics(http, opts);
1649
+ return chunk7GNZT7Y7_cjs.resolveTicketStatusSemantics(http, opts);
1615
1650
  }
1616
1651
 
1617
1652
  // src/resources/special/tickets/timeline.ts
1618
1653
  function validateTimelineLimits(opts) {
1619
1654
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
1620
- if (!Number.isInteger(limit) || limit < 1) throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1655
+ if (!Number.isInteger(limit) || limit < 1) throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1621
1656
  const bounded = Math.min(limit, 500);
1622
1657
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
1623
1658
  if (!Number.isInteger(textLimit) || textLimit < 1) {
1624
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1659
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1625
1660
  }
1626
1661
  return { bounded, textLimit };
1627
1662
  }
@@ -1674,7 +1709,7 @@ function compareEventDates(a, b) {
1674
1709
  async function timeline(_resource, id, opts = {}) {
1675
1710
  const http = _resource.http;
1676
1711
  const { bounded, textLimit } = validateTimelineLimits(opts);
1677
- const ticketId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1712
+ const ticketId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1678
1713
  await fetchTicket(http, ticketId, "tickets.timeline");
1679
1714
  const dateFilters = (field) => {
1680
1715
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1714,7 +1749,7 @@ async function timeline(_resource, id, opts = {}) {
1714
1749
  }
1715
1750
 
1716
1751
  // src/resources/tickets.ts
1717
- var TicketsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1752
+ var TicketsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
1718
1753
  constructor(http, pageSize) {
1719
1754
  super(http, {
1720
1755
  key: "tickets",
@@ -1740,7 +1775,7 @@ var TicketsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1740
1775
  * fetch; no sub-lists; absent/dangling references come back null). */
1741
1776
  async getContext(id) {
1742
1777
  const { ticket, tasks } = await this.readTicketContext(id);
1743
- return ticketContextValue(ticket, await chunkC2AFRW5M_cjs.readTasks(this.http, tasks));
1778
+ return ticketContextValue(ticket, await chunk7GNZT7Y7_cjs.readTasks(this.http, tasks));
1744
1779
  }
1745
1780
  /** Root authority and reusable lazy FK tasks shared by both ticket composites. */
1746
1781
  async readTicketContext(id) {
@@ -1789,9 +1824,9 @@ var TicketsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1789
1824
  // src/resources/special/time_off_requests.ts
1790
1825
  async function approve(_resource, id, opts = {}) {
1791
1826
  const http = _resource.http;
1792
- const numericId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1827
+ const numericId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1793
1828
  if (opts.dryRun === true) {
1794
- return chunkC2AFRW5M_cjs.buildDryRunResult({
1829
+ return chunk7GNZT7Y7_cjs.buildDryRunResult({
1795
1830
  operation: "time_off_requests.approve",
1796
1831
  method: "GET",
1797
1832
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -1807,17 +1842,17 @@ async function approve(_resource, id, opts = {}) {
1807
1842
  operation: "time_off_requests.approve",
1808
1843
  maxRetries: opts.maxRetries
1809
1844
  });
1810
- return chunkC2AFRW5M_cjs.unwrapOperation(res);
1845
+ return chunk7GNZT7Y7_cjs.unwrapOperation(res);
1811
1846
  }
1812
1847
  async function reject(_resource, id, reason, opts = {}) {
1813
1848
  const http = _resource.http;
1814
- const numericId = chunkC2AFRW5M_cjs.parseIdentifier(id, "id");
1849
+ const numericId = chunk7GNZT7Y7_cjs.parseIdentifier(id, "id");
1815
1850
  const text = reason.trim();
1816
1851
  if (text === "") {
1817
- throw new chunkC2AFRW5M_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1852
+ throw new chunk7GNZT7Y7_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1818
1853
  }
1819
1854
  if (opts.dryRun === true) {
1820
- return chunkC2AFRW5M_cjs.buildDryRunResult({
1855
+ return chunk7GNZT7Y7_cjs.buildDryRunResult({
1821
1856
  operation: "time_off_requests.reject",
1822
1857
  method: "POST",
1823
1858
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -1835,11 +1870,11 @@ async function reject(_resource, id, reason, opts = {}) {
1835
1870
  operation: "time_off_requests.reject",
1836
1871
  maxRetries: opts.maxRetries
1837
1872
  });
1838
- return chunkC2AFRW5M_cjs.unwrapOperation(res);
1873
+ return chunk7GNZT7Y7_cjs.unwrapOperation(res);
1839
1874
  }
1840
1875
 
1841
1876
  // src/resources/time_off_requests.ts
1842
- var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1877
+ var TimeOffRequestsResource = class extends chunk7GNZT7Y7_cjs.GenericResource {
1843
1878
  constructor(http, pageSize) {
1844
1879
  super(http, {
1845
1880
  key: "time_off_requests",
@@ -1856,13 +1891,13 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1856
1891
  }
1857
1892
  async get(id, opts) {
1858
1893
  if (typeof opts === "number" || typeof opts === "string") {
1859
- throw new chunkC2AFRW5M_cjs.OperationNotSupportedError("time_off_requests", "get");
1894
+ throw new chunk7GNZT7Y7_cjs.OperationNotSupportedError("time_off_requests", "get");
1860
1895
  }
1861
1896
  return super.get(id, opts);
1862
1897
  }
1863
1898
  async create(a, b, c = {}) {
1864
- if (typeof a !== "number" && typeof a !== "string") throw new chunkC2AFRW5M_cjs.OperationNotSupportedError("time_off_requests", "create");
1865
- const parentId = chunkC2AFRW5M_cjs.parseIdentifier(a, "parentId");
1899
+ if (typeof a !== "number" && typeof a !== "string") throw new chunk7GNZT7Y7_cjs.OperationNotSupportedError("time_off_requests", "create");
1900
+ const parentId = chunk7GNZT7Y7_cjs.parseIdentifier(a, "parentId");
1866
1901
  if (typeof parentId !== "number") throw this.writeError("create", "parentId cannot be represented safely in the numeric resourceID create body; this is an SDK create-body limit, not a vendor record-id maximum");
1867
1902
  const data = this.writePayload(b, "create");
1868
1903
  const opts = { ...c };
@@ -1872,9 +1907,9 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1872
1907
  return super.create(parentId, { ...data, resourceID: parentId }, opts);
1873
1908
  }
1874
1909
  async update(a, b, c, d = {}) {
1875
- if (typeof b !== "number" && typeof b !== "string") throw new chunkC2AFRW5M_cjs.OperationNotSupportedError("time_off_requests", "update");
1876
- const parentId = chunkC2AFRW5M_cjs.parseIdentifier(a, "parentId");
1877
- const id = chunkC2AFRW5M_cjs.parseIdentifier(b, "id");
1910
+ if (typeof b !== "number" && typeof b !== "string") throw new chunk7GNZT7Y7_cjs.OperationNotSupportedError("time_off_requests", "update");
1911
+ const parentId = chunk7GNZT7Y7_cjs.parseIdentifier(a, "parentId");
1912
+ const id = chunk7GNZT7Y7_cjs.parseIdentifier(b, "id");
1878
1913
  const data = this.writePayload(c, "update");
1879
1914
  const opts = { ...d };
1880
1915
  await this.guardWriteStatus(data.status, "Canceled", "update");
@@ -1893,39 +1928,39 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1893
1928
  }
1894
1929
  async getScopedRaw(parentId, id, fresh = false) {
1895
1930
  const current = await super.getScopedRaw(parentId, id, fresh);
1896
- if (current.resourceID === void 0 || chunkC2AFRW5M_cjs.parseIdentifier(current.resourceID, "resourceID") !== parentId) {
1931
+ if (current.resourceID === void 0 || chunk7GNZT7Y7_cjs.parseIdentifier(current.resourceID, "resourceID") !== parentId) {
1897
1932
  throw this.writeError("update", "the current request resourceID must match parentId");
1898
1933
  }
1899
- if (chunkC2AFRW5M_cjs.parseIdentifier(current.id, "id") !== id) {
1934
+ if (chunk7GNZT7Y7_cjs.parseIdentifier(current.id, "id") !== id) {
1900
1935
  throw this.writeError("update", "the current request id must match the requested id");
1901
1936
  }
1902
1937
  return current;
1903
1938
  }
1904
1939
  async createIfNotExists(..._args) {
1905
- throw new chunkC2AFRW5M_cjs.OperationNotSupportedError("time_off_requests", "createIfNotExists");
1940
+ throw new chunk7GNZT7Y7_cjs.OperationNotSupportedError("time_off_requests", "createIfNotExists");
1906
1941
  }
1907
1942
  // Cancellation permits status only; never replace a full model through PUT fallback.
1908
1943
  putFallbackEligible(_err) {
1909
1944
  return false;
1910
1945
  }
1911
1946
  writeError(operation, detail) {
1912
- return new chunkC2AFRW5M_cjs.AutotaskConfigError(`time_off_requests.${operation}: ${detail}`, { operation: `time_off_requests.${operation}` });
1947
+ return new chunk7GNZT7Y7_cjs.AutotaskConfigError(`time_off_requests.${operation}: ${detail}`, { operation: `time_off_requests.${operation}` });
1913
1948
  }
1914
1949
  writePayload(value, operation) {
1915
- if (!chunkC2AFRW5M_cjs.isRecord(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw this.writeError(operation, "supply a plain object");
1950
+ if (!chunk7GNZT7Y7_cjs.isRecord(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) throw this.writeError(operation, "supply a plain object");
1916
1951
  const allowed = operation === "create" ? ["hours", "requestDate", "resourceID", "status", "timeOffRequestType"] : ["status"];
1917
1952
  for (const key of Object.keys(value)) if (!allowed.includes(key)) throw this.writeError(operation, operation === "update" ? "cancellation accepts status only" : `${key} is not a supported create field`);
1918
1953
  if (typeof value.status !== "number" || !Number.isSafeInteger(value.status)) throw this.writeError(operation, "status must be a numeric picklist id");
1919
1954
  if (operation === "create") {
1920
1955
  if (typeof value.hours !== "number" || !Number.isFinite(value.hours) || value.hours < -24 || value.hours > 24) throw this.writeError(operation, "hours must be a finite decimal in the documented range -24 to 24");
1921
1956
  const date = value.requestDate;
1922
- if (typeof date !== "string" || !chunkC2AFRW5M_cjs.isDateYMD(date.slice(0, 10)) || date.length !== 10 && (!/^T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(date.slice(10)) || !Number.isFinite(Date.parse(date)))) {
1957
+ if (typeof date !== "string" || !chunk7GNZT7Y7_cjs.isDateYMD(date.slice(0, 10)) || date.length !== 10 && (!/^T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(date.slice(10)) || !Number.isFinite(Date.parse(date)))) {
1923
1958
  throw this.writeError(operation, "requestDate must be an ISO calendar date or timestamp for the single requested day");
1924
1959
  }
1925
1960
  if (typeof value.timeOffRequestType !== "number" || !Number.isSafeInteger(value.timeOffRequestType)) throw this.writeError(operation, "timeOffRequestType must be a numeric picklist id");
1926
1961
  if (value.resourceID !== void 0) {
1927
1962
  if (typeof value.resourceID !== "number") throw this.writeError(operation, "resourceID must be a numeric identifier");
1928
- chunkC2AFRW5M_cjs.parseIdentifier(value.resourceID, "resourceID");
1963
+ chunk7GNZT7Y7_cjs.parseIdentifier(value.resourceID, "resourceID");
1929
1964
  }
1930
1965
  }
1931
1966
  return { ...value, status: value.status };
@@ -1935,11 +1970,11 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1935
1970
  try {
1936
1971
  fields = await this.cachedMeta("fields", `${this.resourcePath}/entityInformation/fields`, "time_off_requests.getFieldInfo", (body) => this.unwrapFields(body, "FieldInformationResultModel"), true);
1937
1972
  } catch (error) {
1938
- if (chunkC2AFRW5M_cjs.isAutotaskError(error) && error.code === "ABORTED") throw error;
1939
- if ((error instanceof chunkC2AFRW5M_cjs.RateLimitError || error instanceof chunkC2AFRW5M_cjs.MaintenanceError) && error.notSent === true) throw error;
1973
+ if (chunk7GNZT7Y7_cjs.isAutotaskError(error) && error.code === "ABORTED") throw error;
1974
+ if ((error instanceof chunk7GNZT7Y7_cjs.RateLimitError || error instanceof chunk7GNZT7Y7_cjs.MaintenanceError) && error.notSent === true) throw error;
1940
1975
  const detail = `status requires readable current field metadata for ${label}`;
1941
- if (!chunkC2AFRW5M_cjs.isAutotaskError(error)) throw this.writeError(operation, detail);
1942
- const safe = new chunkC2AFRW5M_cjs.AutotaskError(`time_off_requests.${operation}: ${detail}`, {
1976
+ if (!chunk7GNZT7Y7_cjs.isAutotaskError(error)) throw this.writeError(operation, detail);
1977
+ const safe = new chunk7GNZT7Y7_cjs.AutotaskError(`time_off_requests.${operation}: ${detail}`, {
1943
1978
  code: error.code,
1944
1979
  category: error.category,
1945
1980
  correlationId: error.correlationId,
@@ -1949,14 +1984,14 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1949
1984
  retryable: error.retryable,
1950
1985
  suggestedAction: error.suggestedAction,
1951
1986
  url: error.url,
1952
- ...error instanceof chunkC2AFRW5M_cjs.MaintenanceError ? { details: {
1987
+ ...error instanceof chunk7GNZT7Y7_cjs.MaintenanceError ? { details: {
1953
1988
  since: error.details?.since,
1954
1989
  retryAfterMs: error.details?.retryAfterMs
1955
1990
  } } : {}
1956
1991
  });
1957
1992
  Object.setPrototypeOf(safe, Object.getPrototypeOf(error));
1958
1993
  safe.name = error.name;
1959
- if (error instanceof chunkC2AFRW5M_cjs.RateLimitError || error instanceof chunkC2AFRW5M_cjs.MaintenanceError) {
1994
+ if (error instanceof chunk7GNZT7Y7_cjs.RateLimitError || error instanceof chunk7GNZT7Y7_cjs.MaintenanceError) {
1960
1995
  Object.assign(safe, { retryAfter: error.retryAfter, notSent: error.notSent });
1961
1996
  }
1962
1997
  throw safe;
@@ -1966,11 +2001,11 @@ var TimeOffRequestsResource = class extends chunkC2AFRW5M_cjs.GenericResource {
1966
2001
  }
1967
2002
  guardChoice(fields, name, id, operation, label) {
1968
2003
  const unavailable = () => this.writeError(operation, `${name} requires an unambiguous active exposed ${label ?? "request-type"} picklist value; inspect time_off_requests.getFieldInfo`);
1969
- const rows = fields.filter((field) => chunkC2AFRW5M_cjs.isRecord(field) && field.name === name);
2004
+ const rows = fields.filter((field) => chunk7GNZT7Y7_cjs.isRecord(field) && field.name === name);
1970
2005
  if (rows.length !== 1 || rows[0].isPickList !== true || !Array.isArray(rows[0].picklistValues)) throw unavailable();
1971
2006
  const values = rows[0].picklistValues;
1972
- const numeric = (value) => chunkC2AFRW5M_cjs.isRecord(value) && typeof value.value === "string" && /^-?\d+$/.test(value.value) && Number.isSafeInteger(Number(value.value));
1973
- const named = label === void 0 ? values.filter((value) => numeric(value) && Number(value.value) === id) : values.filter((value) => chunkC2AFRW5M_cjs.isRecord(value) && typeof value.label === "string" && value.label.trim().toLowerCase() === label.toLowerCase());
2007
+ const numeric = (value) => chunk7GNZT7Y7_cjs.isRecord(value) && typeof value.value === "string" && /^-?\d+$/.test(value.value) && Number.isSafeInteger(Number(value.value));
2008
+ const named = label === void 0 ? values.filter((value) => numeric(value) && Number(value.value) === id) : values.filter((value) => chunk7GNZT7Y7_cjs.isRecord(value) && typeof value.label === "string" && value.label.trim().toLowerCase() === label.toLowerCase());
1974
2009
  if (named.length !== 1 || !numeric(named[0]) || named[0].isActive !== true || Number(named[0].value) !== id) throw unavailable();
1975
2010
  if (values.filter((value) => numeric(value) && Number(value.value) === id).length !== 1) throw unavailable();
1976
2011
  }