node-autotask 0.65.0 → 0.67.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 (34) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/MCP_TOOL_CATALOG.json +34 -14
  3. package/README.md +1 -1
  4. package/capabilities.json +157 -96
  5. package/dist/capabilities-data.js +156 -95
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-N4EO3KAY.js → chunk-4GH73U2I.js} +3 -3
  9. package/dist/{chunk-UHV7SAX6.cjs → chunk-54L7KKUD.cjs} +31 -31
  10. package/dist/{chunk-WKR5IJEC.cjs → chunk-7GBOQ7YA.cjs} +3 -3
  11. package/dist/{chunk-M63TK4ZH.cjs → chunk-C7M7PXLW.cjs} +175 -179
  12. package/dist/{chunk-MXLE2F5G.js → chunk-EXLJHU5W.js} +4 -8
  13. package/dist/{chunk-ULI4UUB3.js → chunk-N7WB65IS.js} +391 -406
  14. package/dist/{chunk-C73NILBZ.js → chunk-UCPSQ6GN.js} +2 -2
  15. package/dist/{chunk-NTHEFYA7.cjs → chunk-VO4ABDZA.cjs} +396 -411
  16. package/dist/{index-vcFKvZqm.d.ts → index-CYlKHo5N.d.ts} +10 -24
  17. package/dist/{index-CRVQBajX.d.cts → index-D_1wP3Je.d.cts} +10 -24
  18. package/dist/index.cjs +84 -84
  19. package/dist/index.d.cts +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +5 -5
  22. package/dist/operations/index.cjs +50 -50
  23. package/dist/operations/index.d.cts +3 -3
  24. package/dist/operations/index.d.ts +3 -3
  25. package/dist/operations/index.js +2 -2
  26. package/dist/pool.cjs +8 -8
  27. package/dist/pool.js +4 -4
  28. package/dist/resources/index.cjs +27 -27
  29. package/dist/resources/index.d.cts +1 -1
  30. package/dist/resources/index.d.ts +1 -1
  31. package/dist/resources/index.js +3 -3
  32. package/docs/API.md +2 -2
  33. package/docs/VENDOR-QUIRKS.md +50 -34
  34. package/package.json +1 -1
@@ -1,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunkNTHEFYA7_cjs = require('./chunk-NTHEFYA7.cjs');
4
- var chunkWKR5IJEC_cjs = require('./chunk-WKR5IJEC.cjs');
3
+ var chunkVO4ABDZA_cjs = require('./chunk-VO4ABDZA.cjs');
4
+ var chunk7GBOQ7YA_cjs = require('./chunk-7GBOQ7YA.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 chunkNTHEFYA7_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
11
+ throw new chunkVO4ABDZA_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 = chunkNTHEFYA7_cjs.parseIdentifier(sourceId, "sourceId");
17
+ const numericSource = chunkVO4ABDZA_cjs.parseIdentifier(sourceId, "sourceId");
18
18
  if (opts?.destinationCompanyId === void 0) {
19
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
19
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
20
20
  }
21
- const destId = chunkNTHEFYA7_cjs.parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
21
+ const destId = chunkVO4ABDZA_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 chunkNTHEFYA7_cjs.AutotaskConfigError("moveConfigurationItem: newReferenceTitle must be non-empty");
31
+ if (opts.newReferenceTitle.trim() === "") throw new chunkVO4ABDZA_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 chunkNTHEFYA7_cjs.StaleObjectError(
37
+ throw new chunkVO4ABDZA_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 chunkNTHEFYA7_cjs.buildDryRunResult({
44
+ return chunkVO4ABDZA_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 chunkNTHEFYA7_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
69
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
70
70
  }
71
71
  let sourceDeactivated = false;
72
72
  if (opts.deactivateSource !== false) {
@@ -85,7 +85,7 @@ var PROFILE_PART_LIMIT = 50;
85
85
  function profilePartLimit(value, name) {
86
86
  const n = value === void 0 ? PROFILE_PART_LIMIT : Math.trunc(value);
87
87
  if (!Number.isInteger(n) || n < 1) {
88
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
88
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
89
89
  }
90
90
  return n;
91
91
  }
@@ -101,14 +101,14 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
101
101
  });
102
102
  const body = res;
103
103
  if (body === null || !("item" in body)) {
104
- throw new chunkNTHEFYA7_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
104
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
105
105
  }
106
106
  if (body.item === null || body.item === void 0) {
107
- throw new chunkNTHEFYA7_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
107
+ throw new chunkVO4ABDZA_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
108
108
  }
109
109
  return body.item;
110
110
  } catch (err) {
111
- if (err instanceof chunkNTHEFYA7_cjs.NotFoundError) return null;
111
+ if (err instanceof chunkVO4ABDZA_cjs.NotFoundError) return null;
112
112
  throw err;
113
113
  }
114
114
  }
@@ -120,7 +120,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
120
120
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
121
121
  operation: "configuration_items.profile"
122
122
  });
123
- return chunkNTHEFYA7_cjs.unwrapItems(res).items;
123
+ return chunkVO4ABDZA_cjs.unwrapItems(res).items;
124
124
  }
125
125
  async function profile(resource, id, opts = {}) {
126
126
  const http = resource.http;
@@ -133,15 +133,11 @@ async function profile(resource, id, opts = {}) {
133
133
  const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
134
134
  const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
135
135
  const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT);
136
- const wallQuirk = chunkNTHEFYA7_cjs.RELATIONSHIP_MAP["configuration_items"]?.zoneFacts?.quirks?.find(
137
- (q) => q.kind === "field-constraint" && q.ops.includes("create") && (q.fields ?? []).includes("productID")
138
- );
139
136
  const productAssociations = {
140
137
  items: associations,
141
138
  capped: associations.length >= PROFILE_PART_LIMIT,
142
- blind: wallQuirk !== void 0
139
+ blind: false
143
140
  };
144
- if (wallQuirk !== void 0) productAssociations.note = wallQuirk.statement;
145
141
  const result = {
146
142
  ci,
147
143
  type,
@@ -155,15 +151,15 @@ async function profile(resource, id, opts = {}) {
155
151
  category: category !== null ? "ok" : "absent",
156
152
  notes: "ok",
157
153
  relatedItems: "ok",
158
- productAssociations: wallQuirk !== void 0 ? "blind" : "ok"
154
+ productAssociations: "ok"
159
155
  }
160
156
  };
161
157
  if (opts.names === true) {
162
- const builder = chunkNTHEFYA7_cjs.createNamePlan();
158
+ const builder = chunkVO4ABDZA_cjs.createNamePlan();
163
159
  builder.addFk("contract", root["contractID"]);
164
- const names = await chunkNTHEFYA7_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
160
+ const names = await chunkVO4ABDZA_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
165
161
  const ciRow = { ...ci };
166
- chunkNTHEFYA7_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
162
+ chunkVO4ABDZA_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
167
163
  result.ci = ciRow;
168
164
  result.names = names.section;
169
165
  }
@@ -171,7 +167,7 @@ async function profile(resource, id, opts = {}) {
171
167
  }
172
168
 
173
169
  // src/resources/configuration_items.ts
174
- var ConfigurationItemsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
170
+ var ConfigurationItemsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
175
171
  constructor(http, pageSize) {
176
172
  super(http, {
177
173
  key: "configuration_items",
@@ -217,23 +213,23 @@ async function fetchRecord2(http, path, label, readOpts) {
217
213
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: readOpts?.maxRetries });
218
214
  const body = res;
219
215
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
220
- throw new chunkNTHEFYA7_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
216
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
221
217
  }
222
218
  return body.item;
223
219
  }
224
220
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}) {
225
221
  const http = _resource.http;
226
- const sourceId = chunkNTHEFYA7_cjs.parseIdentifier(sourceContactId, "sourceContactId");
227
- const destId = chunkNTHEFYA7_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
222
+ const sourceId = chunkVO4ABDZA_cjs.parseIdentifier(sourceContactId, "sourceContactId");
223
+ const destId = chunkVO4ABDZA_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
228
224
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
229
225
  const companyID = source.companyID;
230
226
  if (typeof companyID !== "number" || companyID < 0) {
231
- throw new chunkNTHEFYA7_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
227
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
232
228
  }
233
229
  if (opts.lastModifiedDate !== void 0) {
234
230
  const current = source.lastModifiedDate;
235
231
  if (current !== opts.lastModifiedDate) {
236
- throw new chunkNTHEFYA7_cjs.StaleObjectError(
232
+ throw new chunkVO4ABDZA_cjs.StaleObjectError(
237
233
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
238
234
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
239
235
  );
@@ -255,10 +251,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
255
251
  },
256
252
  operation: "contacts.moveToCompany"
257
253
  });
258
- const items = chunkNTHEFYA7_cjs.unwrapItems(res).items;
254
+ const items = chunkVO4ABDZA_cjs.unwrapItems(res).items;
259
255
  const clash = items.find((c) => String(c.id) !== String(sourceId));
260
256
  if (clash !== void 0) {
261
- throw new chunkNTHEFYA7_cjs.ConflictError(
257
+ throw new chunkVO4ABDZA_cjs.ConflictError(
262
258
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
263
259
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
264
260
  );
@@ -272,7 +268,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
272
268
  if (opts.dryRun === true) {
273
269
  const warnings = [];
274
270
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
275
- return chunkNTHEFYA7_cjs.buildDryRunResult({
271
+ return chunkVO4ABDZA_cjs.buildDryRunResult({
276
272
  operation: "contacts.moveToCompany",
277
273
  method: "POST",
278
274
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -298,7 +294,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
298
294
  const createdBody = created;
299
295
  const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
300
296
  if (typeof newId !== "number") {
301
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
297
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
302
298
  }
303
299
  let sourceDeleted = false;
304
300
  if (opts.deleteSource === true) {
@@ -314,20 +310,20 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
314
310
  }
315
311
  var FULL_PROFILE_OP = "contacts.fullProfile";
316
312
  async function fullProfile(resource, id, opts = {}) {
317
- const client = chunkNTHEFYA7_cjs.clientOf(resource, FULL_PROFILE_OP);
318
- const ticketLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
319
- const contactId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
320
- const envelope = await chunkNTHEFYA7_cjs.invokeRead(client, "contacts.query", [
313
+ const client = chunkVO4ABDZA_cjs.clientOf(resource, FULL_PROFILE_OP);
314
+ const ticketLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
315
+ const contactId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
316
+ const envelope = await chunkVO4ABDZA_cjs.invokeRead(client, "contacts.query", [
321
317
  { filter: [{ field: "id", op: "eq", value: contactId }], limit: 1 }
322
318
  ]);
323
319
  const row = (envelope.items ?? [])[0];
324
320
  if (row === void 0) {
325
- throw new chunkNTHEFYA7_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
321
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
326
322
  }
327
323
  const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
328
- const root = fk === null ? row : await chunkNTHEFYA7_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
329
- const company = fk === null ? { value: null, absent: "NO_FK" } : await chunkNTHEFYA7_cjs.compositePart(client, "companies.get", [fk]);
330
- const openTickets = await chunkNTHEFYA7_cjs.openTicketsOfPart(
324
+ const root = fk === null ? row : await chunkVO4ABDZA_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
325
+ const company = fk === null ? { value: null, absent: "NO_FK" } : await chunkVO4ABDZA_cjs.compositePart(client, "companies.get", [fk]);
326
+ const openTickets = await chunkVO4ABDZA_cjs.openTicketsOfPart(
331
327
  client,
332
328
  "contactID",
333
329
  contactId,
@@ -337,7 +333,7 @@ async function fullProfile(resource, id, opts = {}) {
337
333
  }
338
334
 
339
335
  // src/resources/contacts.ts
340
- var ContactsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
336
+ var ContactsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
341
337
  constructor(http, pageSize) {
342
338
  super(http, {
343
339
  key: "contacts",
@@ -386,10 +382,10 @@ var PATH_SUFFIX = {
386
382
  };
387
383
  async function stockedItems(_resource, kind, parentId, data, opts = {}) {
388
384
  const http = _resource.http;
389
- const numericParent = chunkNTHEFYA7_cjs.parseIdentifier(parentId, "parentId");
385
+ const numericParent = chunkVO4ABDZA_cjs.parseIdentifier(parentId, "parentId");
390
386
  const suffix = PATH_SUFFIX[kind];
391
387
  if (opts.dryRun === true) {
392
- return chunkNTHEFYA7_cjs.buildDryRunResult({
388
+ return chunkVO4ABDZA_cjs.buildDryRunResult({
393
389
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
394
390
  method: "POST",
395
391
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -406,11 +402,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}) {
406
402
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
407
403
  maxRetries: opts.maxRetries
408
404
  });
409
- return chunkNTHEFYA7_cjs.unwrapOperation(res);
405
+ return chunkVO4ABDZA_cjs.unwrapOperation(res);
410
406
  }
411
407
 
412
408
  // src/resources/inventory_products.ts
413
- var InventoryProductsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
409
+ var InventoryProductsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
414
410
  constructor(http, pageSize) {
415
411
  super(http, {
416
412
  key: "inventory_products",
@@ -438,18 +434,18 @@ var InventoryProductsResource = class extends chunkNTHEFYA7_cjs.GenericResource
438
434
  // src/resources/special/quotes.ts
439
435
  var OP = "quotes.withItems";
440
436
  async function withItems(resource, id, opts = {}) {
441
- const client = chunkNTHEFYA7_cjs.clientOf(resource, OP);
442
- const itemLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
443
- const quoteId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
444
- const root = await chunkNTHEFYA7_cjs.invokeRead(client, "quotes.get", [quoteId]);
445
- const items = await chunkNTHEFYA7_cjs.compositePart(client, "quote_items.query", [
437
+ const client = chunkVO4ABDZA_cjs.clientOf(resource, OP);
438
+ const itemLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
439
+ const quoteId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
440
+ const root = await chunkVO4ABDZA_cjs.invokeRead(client, "quotes.get", [quoteId]);
441
+ const items = await chunkVO4ABDZA_cjs.compositePart(client, "quote_items.query", [
446
442
  { filter: [{ field: "quoteID", op: "eq", value: quoteId }], limit: itemLimit }
447
443
  ]);
448
444
  return { root, parts: { items } };
449
445
  }
450
446
 
451
447
  // src/resources/quotes.ts
452
- var QuotesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
448
+ var QuotesResource = class extends chunkVO4ABDZA_cjs.GenericResource {
453
449
  constructor(http, pageSize) {
454
450
  super(http, {
455
451
  key: "quotes",
@@ -475,7 +471,7 @@ var QuotesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
475
471
  // src/resources/special/resource_time_off_additional.ts
476
472
  async function getByResource(_resource, resourceId) {
477
473
  const http = _resource.http;
478
- const numericResource = chunkNTHEFYA7_cjs.parseIdentifier(resourceId, "resourceId");
474
+ const numericResource = chunkVO4ABDZA_cjs.parseIdentifier(resourceId, "resourceId");
479
475
  const res = await http.request({
480
476
  method: "GET",
481
477
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -489,11 +485,11 @@ async function getByResource(_resource, resourceId) {
489
485
  if (typeof item === "object" && !Array.isArray(item)) return [item];
490
486
  }
491
487
  }
492
- return chunkNTHEFYA7_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
488
+ return chunkVO4ABDZA_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
493
489
  }
494
490
 
495
491
  // src/resources/resource_time_off_additional.ts
496
- var ResourceTimeOffAdditionalResource = class extends chunkNTHEFYA7_cjs.GenericResource {
492
+ var ResourceTimeOffAdditionalResource = class extends chunkVO4ABDZA_cjs.GenericResource {
497
493
  constructor(http, pageSize) {
498
494
  super(http, {
499
495
  key: "resource_time_off_additional",
@@ -514,30 +510,30 @@ var ResourceTimeOffAdditionalResource = class extends chunkNTHEFYA7_cjs.GenericR
514
510
  // src/resources/special/resource_time_off_balances.ts
515
511
  async function getByResource2(_resource, resourceId) {
516
512
  const http = _resource.http;
517
- const numericResource = chunkNTHEFYA7_cjs.parseIdentifier(resourceId, "resourceId");
513
+ const numericResource = chunkVO4ABDZA_cjs.parseIdentifier(resourceId, "resourceId");
518
514
  const res = await http.request({
519
515
  method: "GET",
520
516
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
521
517
  operation: "resource_time_off_balances.getByResource"
522
518
  });
523
- return chunkNTHEFYA7_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
519
+ return chunkVO4ABDZA_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
524
520
  }
525
521
  async function getByYear(_resource, resourceId, year) {
526
522
  const http = _resource.http;
527
- const numericResource = chunkNTHEFYA7_cjs.parseIdentifier(resourceId, "resourceId");
523
+ const numericResource = chunkVO4ABDZA_cjs.parseIdentifier(resourceId, "resourceId");
528
524
  if (!Number.isSafeInteger(year) || year < 1) {
529
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
525
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
530
526
  }
531
527
  const res = await http.request({
532
528
  method: "GET",
533
529
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
534
530
  operation: "resource_time_off_balances.getByYear"
535
531
  });
536
- return chunkNTHEFYA7_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
532
+ return chunkVO4ABDZA_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
537
533
  }
538
534
 
539
535
  // src/resources/resource_time_off_balances.ts
540
- var ResourceTimeOffBalancesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
536
+ var ResourceTimeOffBalancesResource = class extends chunkVO4ABDZA_cjs.GenericResource {
541
537
  constructor(http, pageSize) {
542
538
  super(http, {
543
539
  key: "resource_time_off_balances",
@@ -563,7 +559,7 @@ var ResourceTimeOffBalancesResource = class extends chunkNTHEFYA7_cjs.GenericRes
563
559
  async function whoAmI(_resource, userName) {
564
560
  const http = _resource.http;
565
561
  const user = userName.trim();
566
- if (user === "") throw new chunkNTHEFYA7_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
562
+ if (user === "") throw new chunkVO4ABDZA_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
567
563
  const value = user.includes("@") ? user.split("@")[0] ?? "" : user;
568
564
  const res = await http.request({
569
565
  method: "POST",
@@ -572,11 +568,11 @@ async function whoAmI(_resource, userName) {
572
568
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
573
569
  operation: "resources.whoAmI"
574
570
  });
575
- const matches = chunkNTHEFYA7_cjs.unwrapItems(res).items;
571
+ const matches = chunkVO4ABDZA_cjs.unwrapItems(res).items;
576
572
  if (matches.length === 0) return null;
577
573
  if (matches.length > 1) {
578
574
  const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
579
- throw new chunkNTHEFYA7_cjs.ResolutionError(
575
+ throw new chunkVO4ABDZA_cjs.ResolutionError(
580
576
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
581
577
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids, details: { idRefs: ids.map((cid) => ({ entity: "resource", id: cid })) } }
582
578
  );
@@ -585,23 +581,23 @@ async function whoAmI(_resource, userName) {
585
581
  }
586
582
  var WORKLOAD_OP = "resources.workload";
587
583
  async function workload(resource, id, opts = {}) {
588
- const client = chunkNTHEFYA7_cjs.clientOf(resource, WORKLOAD_OP);
589
- const ticketLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
590
- const taskLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
591
- const timeOffLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
592
- const resourceId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
593
- const root = await chunkNTHEFYA7_cjs.invokeRead(client, "resources.get", [resourceId]);
584
+ const client = chunkVO4ABDZA_cjs.clientOf(resource, WORKLOAD_OP);
585
+ const ticketLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
586
+ const taskLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
587
+ const timeOffLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
588
+ const resourceId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
589
+ const root = await chunkVO4ABDZA_cjs.invokeRead(client, "resources.get", [resourceId]);
594
590
  const strict = { allowAssumed: false };
595
- const joined = await chunkNTHEFYA7_cjs.compositePart(client, "tickets.forResource", [
591
+ const joined = await chunkVO4ABDZA_cjs.compositePart(client, "tickets.forResource", [
596
592
  resourceId,
597
593
  { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
598
594
  ]);
599
- const counted = await chunkNTHEFYA7_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]);
600
- const assignments = await chunkNTHEFYA7_cjs.compositePart(client, "service_call_task_resources.query", [
595
+ const counted = await chunkVO4ABDZA_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]);
596
+ const assignments = await chunkVO4ABDZA_cjs.compositePart(client, "service_call_task_resources.query", [
601
597
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
602
598
  ]);
603
- const balances = await chunkNTHEFYA7_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]);
604
- const timeOff = await chunkNTHEFYA7_cjs.compositePart(client, "time_off_requests.query", [
599
+ const balances = await chunkVO4ABDZA_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]);
600
+ const timeOff = await chunkVO4ABDZA_cjs.compositePart(client, "time_off_requests.query", [
605
601
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
606
602
  ]);
607
603
  const openTickets = joined.value !== null && typeof joined.value === "object" ? counted.value !== null && typeof counted.value === "object" ? (() => {
@@ -614,11 +610,11 @@ async function workload(resource, id, opts = {}) {
614
610
  ...joined,
615
611
  value: { ...joined.value, totalsAbsent: counted.absent ?? "NO_TOTALS" }
616
612
  } : joined;
617
- const taskIds = chunkNTHEFYA7_cjs.numericIds(
613
+ const taskIds = chunkVO4ABDZA_cjs.numericIds(
618
614
  assignments.value?.items ?? [],
619
615
  "serviceCallTaskID"
620
- ).slice(0, chunkNTHEFYA7_cjs.IN_FILTER_CAP);
621
- const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await chunkNTHEFYA7_cjs.compositePart(client, "service_call_tasks.query", [
616
+ ).slice(0, chunkVO4ABDZA_cjs.IN_FILTER_CAP);
617
+ const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await chunkVO4ABDZA_cjs.compositePart(client, "service_call_tasks.query", [
622
618
  { filter: [{ field: "id", op: "in", value: taskIds }], limit: taskLimit }
623
619
  ]);
624
620
  return {
@@ -634,7 +630,7 @@ async function workload(resource, id, opts = {}) {
634
630
  }
635
631
 
636
632
  // src/resources/resources.ts
637
- var ResourcesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
633
+ var ResourcesResource = class extends chunkVO4ABDZA_cjs.GenericResource {
638
634
  clientConfig;
639
635
  constructor(http, clientConfig, pageSize) {
640
636
  super(http, {
@@ -666,22 +662,22 @@ var ResourcesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
666
662
  // src/resources/special/service_calls.ts
667
663
  var OP2 = "service_calls.fullProfile";
668
664
  async function fullProfile2(resource, id, opts = {}) {
669
- const client = chunkNTHEFYA7_cjs.clientOf(resource, OP2);
670
- const ticketLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
671
- const taskLimit = chunkNTHEFYA7_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
672
- const callId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
673
- const root = await chunkNTHEFYA7_cjs.invokeRead(client, "service_calls.get", [callId]);
674
- const tickets = await chunkNTHEFYA7_cjs.compositePart(client, "service_call_tickets.query", [
665
+ const client = chunkVO4ABDZA_cjs.clientOf(resource, OP2);
666
+ const ticketLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
667
+ const taskLimit = chunkVO4ABDZA_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
668
+ const callId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
669
+ const root = await chunkVO4ABDZA_cjs.invokeRead(client, "service_calls.get", [callId]);
670
+ const tickets = await chunkVO4ABDZA_cjs.compositePart(client, "service_call_tickets.query", [
675
671
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
676
672
  ]);
677
- const tasks = await chunkNTHEFYA7_cjs.compositePart(client, "service_call_tasks.query", [
673
+ const tasks = await chunkVO4ABDZA_cjs.compositePart(client, "service_call_tasks.query", [
678
674
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
679
675
  ]);
680
- const taskIds = chunkNTHEFYA7_cjs.numericIds(
676
+ const taskIds = chunkVO4ABDZA_cjs.numericIds(
681
677
  tasks.value?.items ?? [],
682
678
  "id"
683
- ).slice(0, chunkNTHEFYA7_cjs.IN_FILTER_CAP);
684
- const resourceAssignments = taskIds.length === 0 ? { value: null, absent: "NO_TASKS" } : await chunkNTHEFYA7_cjs.compositePart(client, "service_call_task_resources.query", [
679
+ ).slice(0, chunkVO4ABDZA_cjs.IN_FILTER_CAP);
680
+ const resourceAssignments = taskIds.length === 0 ? { value: null, absent: "NO_TASKS" } : await chunkVO4ABDZA_cjs.compositePart(client, "service_call_task_resources.query", [
685
681
  { filter: [{ field: "serviceCallTaskID", op: "in", value: taskIds }], limit: taskLimit }
686
682
  ]);
687
683
  return {
@@ -695,7 +691,7 @@ async function fullProfile2(resource, id, opts = {}) {
695
691
  }
696
692
 
697
693
  // src/resources/service_calls.ts
698
- var ServiceCallsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
694
+ var ServiceCallsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
699
695
  constructor(http, pageSize) {
700
696
  super(http, {
701
697
  key: "service_calls",
@@ -717,13 +713,13 @@ var OP3 = "ticket_charges.moveToTicket";
717
713
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
718
714
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
719
715
  async function readCharge(http, id, retries) {
720
- const rows = await chunkNTHEFYA7_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
716
+ const rows = await chunkVO4ABDZA_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
721
717
  return rows[0] ?? null;
722
718
  }
723
719
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
724
720
  if (source.isBilled === true) {
725
- throw chunkNTHEFYA7_cjs.refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
726
- manualAction: { action: "delete_source", uiLink: chunkNTHEFYA7_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
721
+ throw chunkVO4ABDZA_cjs.refuse("MOVE_BLOCKED_BILLED", `${OP3}: ticket charge ${sourceId} is billed \u2014 move it in the Autotask UI`, { sourceId, toTicketId }, OP3, {
722
+ manualAction: { action: "delete_source", uiLink: chunkVO4ABDZA_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
727
723
  });
728
724
  }
729
725
  }
@@ -757,14 +753,14 @@ var SPEC = {
757
753
  ]
758
754
  }),
759
755
  // charges have no ExecuteCommand code: the parent ticket is the closest clickable target
760
- manualLink: (http, source) => typeof source.ticketID === "number" ? chunkNTHEFYA7_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
756
+ manualLink: (http, source) => typeof source.ticketID === "number" ? chunkVO4ABDZA_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
761
757
  };
762
758
  function moveToTicket(resource, sourceId, toTicketId, opts) {
763
- return chunkNTHEFYA7_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
759
+ return chunkVO4ABDZA_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
764
760
  }
765
761
 
766
762
  // src/resources/ticket_charges.ts
767
- var TicketChargesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
763
+ var TicketChargesResource = class extends chunkVO4ABDZA_cjs.GenericResource {
768
764
  constructor(http, pageSize) {
769
765
  super(http, {
770
766
  key: "ticket_charges",
@@ -789,7 +785,7 @@ var TicketChargesResource = class extends chunkNTHEFYA7_cjs.GenericResource {
789
785
  };
790
786
 
791
787
  // src/resources/special/tickets/errors.ts
792
- var StatusUnknownError = class extends chunkNTHEFYA7_cjs.AutotaskError {
788
+ var StatusUnknownError = class extends chunkVO4ABDZA_cjs.AutotaskError {
793
789
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
794
790
  picklistCount;
795
791
  constructor(message, options = {}) {
@@ -803,7 +799,7 @@ var StatusUnknownError = class extends chunkNTHEFYA7_cjs.AutotaskError {
803
799
  this.picklistCount = options.picklistCount ?? 0;
804
800
  }
805
801
  };
806
- var StatusFieldsRequiredError = class extends chunkNTHEFYA7_cjs.AutotaskError {
802
+ var StatusFieldsRequiredError = class extends chunkVO4ABDZA_cjs.AutotaskError {
807
803
  vendorFields;
808
804
  currentStatus;
809
805
  targetStatus;
@@ -825,8 +821,8 @@ function isPositiveInt(v) {
825
821
  return typeof v === "number" && Number.isInteger(v) && v > 0;
826
822
  }
827
823
  function namedVendorFields(err) {
828
- if (!chunkNTHEFYA7_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
829
- const entries = chunkNTHEFYA7_cjs.parseVendorErrors(err.vendorError) ?? [];
824
+ if (!chunkVO4ABDZA_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
825
+ const entries = chunkVO4ABDZA_cjs.parseVendorErrors(err.vendorError) ?? [];
830
826
  const out = /* @__PURE__ */ new Set();
831
827
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
832
828
  return [...out];
@@ -845,8 +841,8 @@ function unwrapItemOrNull(res) {
845
841
  return body.item;
846
842
  }
847
843
  function discoveryMerge(err, body, defaults) {
848
- if (!chunkNTHEFYA7_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
849
- const entries = chunkNTHEFYA7_cjs.parseVendorErrors(err.vendorError);
844
+ if (!chunkVO4ABDZA_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
845
+ const entries = chunkVO4ABDZA_cjs.parseVendorErrors(err.vendorError);
850
846
  if (entries === void 0) return null;
851
847
  for (const entry of entries) {
852
848
  const field = entry.field;
@@ -881,7 +877,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
881
877
  const ids = await readLiveStatusSet(resource);
882
878
  if (ids.size > 0) liveStatus = ids;
883
879
  } catch (err) {
884
- if (!chunkNTHEFYA7_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
880
+ if (!chunkVO4ABDZA_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
885
881
  }
886
882
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
887
883
  http.fieldCache?.invalidate("tickets:");
@@ -891,7 +887,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
891
887
  const freshIds = await readLiveStatusSet(resource);
892
888
  if (freshIds.size > 0) freshStatus = freshIds;
893
889
  } catch (err) {
894
- if (!chunkNTHEFYA7_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
890
+ if (!chunkVO4ABDZA_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
895
891
  freshStatus = null;
896
892
  reReadFailed = true;
897
893
  }
@@ -909,7 +905,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
909
905
  return { guardDegraded: liveStatus === null };
910
906
  }
911
907
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
912
- return chunkNTHEFYA7_cjs.buildDryRunResult(
908
+ return chunkVO4ABDZA_cjs.buildDryRunResult(
913
909
  {
914
910
  operation: OP_STATUS,
915
911
  method: "PUT",
@@ -963,7 +959,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
963
959
  if (mapEntry === void 0) {
964
960
  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).`);
965
961
  }
966
- return chunkNTHEFYA7_cjs.buildDryRunResult(
962
+ return chunkVO4ABDZA_cjs.buildDryRunResult(
967
963
  {
968
964
  operation: OP_STATUS,
969
965
  method: "PUT",
@@ -983,7 +979,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
983
979
  }
984
980
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
985
981
  const safeDefaults = mapEntry?.safeDefaults ?? {};
986
- const body = chunkNTHEFYA7_cjs.mergePartialBody(current, mergeData);
982
+ const body = chunkVO4ABDZA_cjs.mergePartialBody(current, mergeData);
987
983
  body.id = ticketId;
988
984
  let merges = 0;
989
985
  for (; ; ) {
@@ -1007,8 +1003,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1007
1003
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
1008
1004
  {
1009
1005
  operation: OP_STATUS,
1010
- httpStatus: chunkNTHEFYA7_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1011
- vendorError: chunkNTHEFYA7_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1006
+ httpStatus: chunkVO4ABDZA_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1007
+ vendorError: chunkVO4ABDZA_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1012
1008
  resourceIds: [ticketId],
1013
1009
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
1014
1010
  }
@@ -1021,7 +1017,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1021
1017
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1022
1018
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1023
1019
  if (verify === null) {
1024
- throw new chunkNTHEFYA7_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1020
+ throw new chunkVO4ABDZA_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1025
1021
  code: "INVALID_RESPONSE",
1026
1022
  category: "server",
1027
1023
  operation: OP_STATUS,
@@ -1031,7 +1027,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1031
1027
  }
1032
1028
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
1033
1029
  if (finalStatus !== targetStatus) {
1034
- throw new chunkNTHEFYA7_cjs.AutotaskError(
1030
+ throw new chunkVO4ABDZA_cjs.AutotaskError(
1035
1031
  `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)`,
1036
1032
  {
1037
1033
  code: "INVALID_RESPONSE",
@@ -1047,17 +1043,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1047
1043
  }
1048
1044
  async function changeStatus(resource, id, targetStatus, fields, opts) {
1049
1045
  const http = resource.http;
1050
- const ticketId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1046
+ const ticketId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1051
1047
  if (!isPositiveInt(targetStatus)) {
1052
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1048
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1053
1049
  }
1054
1050
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
1055
1051
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
1056
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1052
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1057
1053
  }
1058
1054
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1059
1055
  if (current === null) {
1060
- throw new chunkNTHEFYA7_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1056
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1061
1057
  }
1062
1058
  const previousStatus = typeof current.status === "number" ? current.status : null;
1063
1059
  if (previousStatus === targetStatus) {
@@ -1083,7 +1079,7 @@ var TICKET_FIELDS = ["id", "ticketNumber", "title", "status", "assignedResourceI
1083
1079
  function positiveId(value, name) {
1084
1080
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
1085
1081
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1086
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1082
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1087
1083
  }
1088
1084
  return n;
1089
1085
  }
@@ -1095,7 +1091,7 @@ async function ticketPage(http, filter, maxRecords, fields) {
1095
1091
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
1096
1092
  operation: OP4
1097
1093
  });
1098
- const page = chunkNTHEFYA7_cjs.unwrapItems(res, OP4);
1094
+ const page = chunkVO4ABDZA_cjs.unwrapItems(res, OP4);
1099
1095
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
1100
1096
  }
1101
1097
  async function readLinkIds(http, resourceID, maxPages = 1) {
@@ -1105,11 +1101,11 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1105
1101
  const res = await http.request({
1106
1102
  method: "POST",
1107
1103
  idempotent: true,
1108
- path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkNTHEFYA7_cjs.cursorToPath(http.baseUrl, cursor),
1104
+ path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkVO4ABDZA_cjs.cursorToPath(http.baseUrl, cursor),
1109
1105
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
1110
1106
  operation: OP4
1111
1107
  });
1112
- const page = chunkNTHEFYA7_cjs.unwrapItems(res, OP4);
1108
+ const page = chunkVO4ABDZA_cjs.unwrapItems(res, OP4);
1113
1109
  for (const row of page.items) if (typeof row.ticketID === "number") ids.add(row.ticketID);
1114
1110
  cursor = page.pageDetails.nextPageUrl;
1115
1111
  if (cursor === null || page.items.length === 0) return { ids: [...ids], capped: false };
@@ -1118,35 +1114,35 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1118
1114
  }
1119
1115
  async function forResource(_resource, resourceIDIn, opts = {}) {
1120
1116
  const http = _resource.http;
1121
- if (opts === null || typeof opts !== "object") throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1117
+ if (opts === null || typeof opts !== "object") throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1122
1118
  const resourceID = positiveId(resourceIDIn, "resourceID");
1123
1119
  const scope = opts.scope ?? "both";
1124
1120
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
1125
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1121
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1126
1122
  }
1127
1123
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
1128
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1124
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1129
1125
  }
1130
1126
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
1131
1127
  if (opts.countOnly !== true && (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX)) {
1132
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1128
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1133
1129
  }
1134
1130
  const includeFields = opts.includeFields ?? [];
1135
1131
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
1136
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1132
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1137
1133
  }
1138
1134
  const openOnly = opts.openOnly === true;
1139
1135
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS, ...includeFields])];
1140
1136
  if (opts.countOnly !== void 0 && typeof opts.countOnly !== "boolean") {
1141
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1137
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1142
1138
  }
1143
- const closed = await chunkNTHEFYA7_cjs.resolveTicketStatusSemantics(
1139
+ const closed = await chunkVO4ABDZA_cjs.resolveTicketStatusSemantics(
1144
1140
  http,
1145
1141
  { ...opts.excludeStatusIds === void 0 ? {} : { excludeStatusIds: opts.excludeStatusIds }, ...opts.allowAssumed === void 0 ? {} : { allowAssumed: opts.allowAssumed } },
1146
1142
  OP4
1147
1143
  );
1148
1144
  const closedStatus = { closedIds: closed.closedIds, source: closed.source, note: closed.note };
1149
- const openLeaf = openOnly || opts.countOnly === true ? [chunkNTHEFYA7_cjs.openStatusFilter(closed.closedIds)] : [];
1145
+ const openLeaf = openOnly || opts.countOnly === true ? [chunkVO4ABDZA_cjs.openStatusFilter(closed.closedIds)] : [];
1150
1146
  if (opts.countOnly === true) {
1151
1147
  const primaryCount = scope === "secondary" ? 0 : await _resource.count({ filter: [{ field: "assignedResourceID", op: "eq", value: resourceID }, ...openLeaf] });
1152
1148
  let secondaryCount = 0;
@@ -1160,7 +1156,7 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1160
1156
  const page = await ticketPage(http, [{ field: "id", op: "in", value: chunk }, ...openLeaf], chunk.length, ["id", "status", "assignedResourceID"]);
1161
1157
  const seen = /* @__PURE__ */ new Set();
1162
1158
  for (const t of page.rows) {
1163
- if (typeof t.id !== "number" || seen.has(t.id) || chunkNTHEFYA7_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1159
+ if (typeof t.id !== "number" || seen.has(t.id) || chunkVO4ABDZA_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1164
1160
  seen.add(t.id);
1165
1161
  if (scope === "both" && t.assignedResourceID === resourceID) bothCount++;
1166
1162
  }
@@ -1206,13 +1202,13 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1206
1202
  for (const [id, t] of primary) merged.set(id, t);
1207
1203
  for (const [id, t] of secondary) if (!merged.has(id)) merged.set(id, t);
1208
1204
  let tickets = [...merged.values()];
1209
- if (openOnly) tickets = tickets.filter((t) => !chunkNTHEFYA7_cjs.isClosedStatus(t.status, closed.closedIds));
1205
+ if (openOnly) tickets = tickets.filter((t) => !chunkVO4ABDZA_cjs.isClosedStatus(t.status, closed.closedIds));
1210
1206
  tickets.sort((a, b) => Number(a.id) - Number(b.id));
1211
1207
  if (tickets.length > limit) {
1212
1208
  tickets = tickets.slice(0, limit);
1213
1209
  capped = true;
1214
1210
  }
1215
- const openCount = tickets.filter((t) => !chunkNTHEFYA7_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1211
+ const openCount = tickets.filter((t) => !chunkVO4ABDZA_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1216
1212
  const primaryIds = [...primary.keys()].sort((a, b) => a - b);
1217
1213
  const secondaryIds = [...secondary.keys()].sort((a, b) => a - b);
1218
1214
  const both = primaryIds.filter((id) => secondary.has(id));
@@ -1240,9 +1236,9 @@ async function fetchTicket(http, id, operation) {
1240
1236
  });
1241
1237
  const body = res;
1242
1238
  if (body === null || !("item" in body)) {
1243
- throw new chunkNTHEFYA7_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1239
+ throw new chunkVO4ABDZA_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1244
1240
  }
1245
- if (body.item === null || body.item === void 0) throw new chunkNTHEFYA7_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1241
+ if (body.item === null || body.item === void 0) throw new chunkVO4ABDZA_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1246
1242
  return body.item;
1247
1243
  }
1248
1244
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -1253,7 +1249,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
1253
1249
  body: { MaxRecords: maxRecords, filter },
1254
1250
  operation
1255
1251
  });
1256
- return chunkNTHEFYA7_cjs.unwrapItems(res).items;
1252
+ return chunkVO4ABDZA_cjs.unwrapItems(res).items;
1257
1253
  }
1258
1254
  function truncate(text, limit) {
1259
1255
  const full = text ?? "";
@@ -1263,27 +1259,27 @@ function truncate(text, limit) {
1263
1259
 
1264
1260
  // src/resources/special/tickets/childRead.ts
1265
1261
  function isRouteUnavailable(err) {
1266
- return chunkNTHEFYA7_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1262
+ return chunkVO4ABDZA_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1267
1263
  }
1268
1264
  function routeFact(route, path, err) {
1269
1265
  return {
1270
1266
  route,
1271
1267
  path,
1272
- httpStatus: chunkNTHEFYA7_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1268
+ httpStatus: chunkVO4ABDZA_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1273
1269
  };
1274
1270
  }
1275
1271
  async function childDeclaresQuery(resourceKey) {
1276
- const records = await chunkWKR5IJEC_cjs.loadCapabilityRecords();
1272
+ const records = await chunk7GBOQ7YA_cjs.loadCapabilityRecords();
1277
1273
  return records.some(
1278
1274
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
1279
1275
  );
1280
1276
  }
1281
1277
  async function planScopedPath(resourceKey, ticketId) {
1282
1278
  if (!await childDeclaresQuery(resourceKey)) return null;
1283
- const entry = chunkNTHEFYA7_cjs.RELATIONSHIP_MAP[resourceKey];
1279
+ const entry = chunkVO4ABDZA_cjs.RELATIONSHIP_MAP[resourceKey];
1284
1280
  const parent = entry === void 0 ? null : entry.parent;
1285
1281
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
1286
- const parentPath = chunkNTHEFYA7_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1282
+ const parentPath = chunkVO4ABDZA_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1287
1283
  if (parentPath === null || parentPath === void 0) return null;
1288
1284
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
1289
1285
  }
@@ -1322,14 +1318,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
1322
1318
  break;
1323
1319
  }
1324
1320
  const body = await http.request({ method: "GET", path: target, operation });
1325
- const { items: pageItems, pageDetails } = chunkNTHEFYA7_cjs.unwrapItems(body, operation);
1321
+ const { items: pageItems, pageDetails } = chunkVO4ABDZA_cjs.unwrapItems(body, operation);
1326
1322
  nextCursor = pageDetails.nextPageUrl;
1327
1323
  pages += 1;
1328
1324
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
1329
1325
  for (const row of window) if (accept(row)) items.push(row);
1330
1326
  if (items.length >= limit) break;
1331
1327
  if (nextCursor === null || pageItems.length === 0) break;
1332
- target = chunkNTHEFYA7_cjs.cursorToPath(http.baseUrl, nextCursor);
1328
+ target = chunkVO4ABDZA_cjs.cursorToPath(http.baseUrl, nextCursor);
1333
1329
  }
1334
1330
  const capped = items.length >= limit || guard && nextCursor !== null;
1335
1331
  return { items, capped };
@@ -1362,7 +1358,7 @@ var DEFAULT_PART_LIMIT = 50;
1362
1358
  function partLimit(value, name) {
1363
1359
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
1364
1360
  if (!Number.isInteger(n) || n < 1) {
1365
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1361
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1366
1362
  }
1367
1363
  return n;
1368
1364
  }
@@ -1375,13 +1371,13 @@ function servedTextRecord(row, textField, limit) {
1375
1371
  return out;
1376
1372
  }
1377
1373
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1378
- const builder = chunkNTHEFYA7_cjs.createNamePlan(chunkNTHEFYA7_cjs.TICKET_LABEL_FIELDS);
1374
+ const builder = chunkVO4ABDZA_cjs.createNamePlan(chunkVO4ABDZA_cjs.TICKET_LABEL_FIELDS);
1379
1375
  const t = ctx.ticket;
1380
1376
  builder.addResource(t["creatorResourceID"]);
1381
1377
  builder.addFk("contract", t["contractID"]);
1382
1378
  builder.addFk("billingCode", t["billingCodeID"]);
1383
1379
  builder.addFk("role", t["assignedResourceRoleID"]);
1384
- const ticketLobPointer = chunkNTHEFYA7_cjs.vendorId(t["organizationalLevelAssociationID"]);
1380
+ const ticketLobPointer = chunkVO4ABDZA_cjs.vendorId(t["organizationalLevelAssociationID"]);
1385
1381
  if (ticketLobPointer !== void 0) {
1386
1382
  builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
1387
1383
  } else {
@@ -1393,20 +1389,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1393
1389
  builder.addFk("billingCode", e["billingCodeID"]);
1394
1390
  builder.addFk("contract", e["contractID"]);
1395
1391
  }
1396
- const names = await chunkNTHEFYA7_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1392
+ const names = await chunkVO4ABDZA_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1397
1393
  const ticketRow = { ...ctx.ticket };
1398
- chunkNTHEFYA7_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1399
- chunkNTHEFYA7_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1400
- chunkNTHEFYA7_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1401
- chunkNTHEFYA7_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1402
- for (const f of chunkNTHEFYA7_cjs.TICKET_LABEL_FIELDS) chunkNTHEFYA7_cjs.addLabelSibling(ticketRow, f, names);
1394
+ chunkVO4ABDZA_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1395
+ chunkVO4ABDZA_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1396
+ chunkVO4ABDZA_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1397
+ chunkVO4ABDZA_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1398
+ for (const f of chunkVO4ABDZA_cjs.TICKET_LABEL_FIELDS) chunkVO4ABDZA_cjs.addLabelSibling(ticketRow, f, names);
1403
1399
  result.ticket = ticketRow;
1404
1400
  result.timeEntries.items = entriesPart.items.map((e) => {
1405
1401
  const row = { ...e };
1406
- chunkNTHEFYA7_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1407
- chunkNTHEFYA7_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1408
- chunkNTHEFYA7_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1409
- chunkNTHEFYA7_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1402
+ chunkVO4ABDZA_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1403
+ chunkVO4ABDZA_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1404
+ chunkVO4ABDZA_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1405
+ chunkVO4ABDZA_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1410
1406
  return row;
1411
1407
  });
1412
1408
  result.names = names.section;
@@ -1423,7 +1419,7 @@ async function fullContext(resource, id, opts = {}) {
1423
1419
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
1424
1420
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
1425
1421
  const textLimit = partLimit(opts.textLimit, "textLimit");
1426
- const ticketId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1422
+ const ticketId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1427
1423
  const ctx = await resource.getContext(ticketId);
1428
1424
  const op = "tickets.fullContext";
1429
1425
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1485,7 +1481,7 @@ var OP5 = "tickets.lineOfBusiness";
1485
1481
  function positiveId2(value, name) {
1486
1482
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
1487
1483
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1488
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1484
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1489
1485
  }
1490
1486
  return n;
1491
1487
  }
@@ -1501,25 +1497,25 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1501
1497
  associationSource = "argument";
1502
1498
  } else {
1503
1499
  const ticket = await resource.get(ticketId);
1504
- associationId = chunkNTHEFYA7_cjs.vendorId(ticket.organizationalLevelAssociationID);
1500
+ associationId = chunkVO4ABDZA_cjs.vendorId(ticket.organizationalLevelAssociationID);
1505
1501
  if (associationId !== void 0) {
1506
1502
  associationSource = "ticket";
1507
1503
  } else {
1508
- const contractRef = chunkNTHEFYA7_cjs.vendorId(ticket.contractID);
1504
+ const contractRef = chunkVO4ABDZA_cjs.vendorId(ticket.contractID);
1509
1505
  if (contractRef !== void 0) {
1510
1506
  const client = http.client;
1511
1507
  if (client === void 0) {
1512
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1508
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1513
1509
  }
1514
1510
  try {
1515
1511
  const contract = await client.contracts.get(contractRef);
1516
1512
  contractId = contractRef;
1517
- associationId = chunkNTHEFYA7_cjs.vendorId(contract.organizationalLevelAssociationID);
1513
+ associationId = chunkVO4ABDZA_cjs.vendorId(contract.organizationalLevelAssociationID);
1518
1514
  if (associationId !== void 0) associationSource = "contract";
1519
1515
  } catch (e) {
1520
- if (e instanceof chunkNTHEFYA7_cjs.NotFoundError) {
1516
+ if (e instanceof chunkVO4ABDZA_cjs.NotFoundError) {
1521
1517
  contractId = contractRef;
1522
- } else if (chunkNTHEFYA7_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1518
+ } else if (chunkVO4ABDZA_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1523
1519
  contractId = contractRef;
1524
1520
  contractUnread = true;
1525
1521
  } else {
@@ -1540,7 +1536,7 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1540
1536
  markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
1541
1537
  };
1542
1538
  }
1543
- const chain = await chunkNTHEFYA7_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1539
+ const chain = await chunkVO4ABDZA_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1544
1540
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
1545
1541
  return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
1546
1542
  }
@@ -1550,7 +1546,7 @@ var MS = 864e5;
1550
1546
  var SLA_PAGE = 100;
1551
1547
  async function slaHealthCheck(_resource, id, opts = {}) {
1552
1548
  const http = _resource.http;
1553
- const ticketId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1549
+ const ticketId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1554
1550
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
1555
1551
  const rows = await ticketQueryItems(
1556
1552
  http,
@@ -1576,9 +1572,9 @@ async function summary(_resource, id, opts = {}) {
1576
1572
  const http = _resource.http;
1577
1573
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
1578
1574
  if (!Number.isInteger(limit) || limit < 1) {
1579
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1575
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1580
1576
  }
1581
- const ticketId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1577
+ const ticketId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1582
1578
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
1583
1579
  const desc = truncate(ticket.description, limit);
1584
1580
  const now = opts.now ?? /* @__PURE__ */ new Date();
@@ -1607,17 +1603,17 @@ async function summary(_resource, id, opts = {}) {
1607
1603
  // src/resources/special/tickets/statusSemantics.ts
1608
1604
  async function statusSemantics(_resource, opts = {}) {
1609
1605
  const http = _resource.http;
1610
- return chunkNTHEFYA7_cjs.resolveTicketStatusSemantics(http, opts);
1606
+ return chunkVO4ABDZA_cjs.resolveTicketStatusSemantics(http, opts);
1611
1607
  }
1612
1608
 
1613
1609
  // src/resources/special/tickets/timeline.ts
1614
1610
  function validateTimelineLimits(opts) {
1615
1611
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
1616
- if (!Number.isInteger(limit) || limit < 1) throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1612
+ if (!Number.isInteger(limit) || limit < 1) throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1617
1613
  const bounded = Math.min(limit, 500);
1618
1614
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
1619
1615
  if (!Number.isInteger(textLimit) || textLimit < 1) {
1620
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1616
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1621
1617
  }
1622
1618
  return { bounded, textLimit };
1623
1619
  }
@@ -1670,7 +1666,7 @@ function compareEventDates(a, b) {
1670
1666
  async function timeline(_resource, id, opts = {}) {
1671
1667
  const http = _resource.http;
1672
1668
  const { bounded, textLimit } = validateTimelineLimits(opts);
1673
- const ticketId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1669
+ const ticketId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1674
1670
  await fetchTicket(http, ticketId, "tickets.timeline");
1675
1671
  const dateFilters = (field) => {
1676
1672
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1710,7 +1706,7 @@ async function timeline(_resource, id, opts = {}) {
1710
1706
  }
1711
1707
 
1712
1708
  // src/resources/tickets.ts
1713
- var TicketsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
1709
+ var TicketsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
1714
1710
  constructor(http, pageSize) {
1715
1711
  super(http, {
1716
1712
  key: "tickets",
@@ -1779,9 +1775,9 @@ var TicketsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
1779
1775
  // src/resources/special/time_off_requests.ts
1780
1776
  async function approve(_resource, id, opts = {}) {
1781
1777
  const http = _resource.http;
1782
- const numericId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1778
+ const numericId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1783
1779
  if (opts.dryRun === true) {
1784
- return chunkNTHEFYA7_cjs.buildDryRunResult({
1780
+ return chunkVO4ABDZA_cjs.buildDryRunResult({
1785
1781
  operation: "time_off_requests.approve",
1786
1782
  method: "GET",
1787
1783
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -1797,17 +1793,17 @@ async function approve(_resource, id, opts = {}) {
1797
1793
  operation: "time_off_requests.approve",
1798
1794
  maxRetries: opts.maxRetries
1799
1795
  });
1800
- return chunkNTHEFYA7_cjs.unwrapOperation(res);
1796
+ return chunkVO4ABDZA_cjs.unwrapOperation(res);
1801
1797
  }
1802
1798
  async function reject(_resource, id, reason, opts = {}) {
1803
1799
  const http = _resource.http;
1804
- const numericId = chunkNTHEFYA7_cjs.parseIdentifier(id, "id");
1800
+ const numericId = chunkVO4ABDZA_cjs.parseIdentifier(id, "id");
1805
1801
  const text = reason.trim();
1806
1802
  if (text === "") {
1807
- throw new chunkNTHEFYA7_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1803
+ throw new chunkVO4ABDZA_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1808
1804
  }
1809
1805
  if (opts.dryRun === true) {
1810
- return chunkNTHEFYA7_cjs.buildDryRunResult({
1806
+ return chunkVO4ABDZA_cjs.buildDryRunResult({
1811
1807
  operation: "time_off_requests.reject",
1812
1808
  method: "POST",
1813
1809
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -1825,11 +1821,11 @@ async function reject(_resource, id, reason, opts = {}) {
1825
1821
  operation: "time_off_requests.reject",
1826
1822
  maxRetries: opts.maxRetries
1827
1823
  });
1828
- return chunkNTHEFYA7_cjs.unwrapOperation(res);
1824
+ return chunkVO4ABDZA_cjs.unwrapOperation(res);
1829
1825
  }
1830
1826
 
1831
1827
  // src/resources/time_off_requests.ts
1832
- var TimeOffRequestsResource = class extends chunkNTHEFYA7_cjs.GenericResource {
1828
+ var TimeOffRequestsResource = class extends chunkVO4ABDZA_cjs.GenericResource {
1833
1829
  constructor(http, pageSize) {
1834
1830
  super(http, {
1835
1831
  key: "time_off_requests",