node-autotask 0.69.0 → 0.70.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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkJLBSUZ5B_cjs = require('./chunk-JLBSUZ5B.cjs');
3
+ var chunkYRRTE2NF_cjs = require('./chunk-YRRTE2NF.cjs');
4
4
  var chunkKAZE4WC7_cjs = require('./chunk-KAZE4WC7.cjs');
5
5
 
6
6
  // src/resources/special/configuration_items.ts
@@ -8,17 +8,17 @@ 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 chunkJLBSUZ5B_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
11
+ throw new chunkYRRTE2NF_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 = chunkJLBSUZ5B_cjs.parseIdentifier(sourceId, "sourceId");
17
+ const numericSource = chunkYRRTE2NF_cjs.parseIdentifier(sourceId, "sourceId");
18
18
  if (opts?.destinationCompanyId === void 0) {
19
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
19
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
20
20
  }
21
- const destId = chunkJLBSUZ5B_cjs.parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
21
+ const destId = chunkYRRTE2NF_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 chunkJLBSUZ5B_cjs.AutotaskConfigError("moveConfigurationItem: newReferenceTitle must be non-empty");
31
+ if (opts.newReferenceTitle.trim() === "") throw new chunkYRRTE2NF_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 chunkJLBSUZ5B_cjs.StaleObjectError(
37
+ throw new chunkYRRTE2NF_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 chunkJLBSUZ5B_cjs.buildDryRunResult({
44
+ return chunkYRRTE2NF_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 chunkJLBSUZ5B_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
69
+ throw new chunkYRRTE2NF_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 chunkJLBSUZ5B_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
88
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
89
89
  }
90
90
  return n;
91
91
  }
@@ -94,17 +94,17 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
94
94
  return null;
95
95
  }
96
96
  try {
97
- const res = await chunkJLBSUZ5B_cjs.cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
97
+ const res = await chunkYRRTE2NF_cjs.cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
98
98
  const body = res;
99
99
  if (body === null || !("item" in body)) {
100
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
100
+ throw new chunkYRRTE2NF_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
101
101
  }
102
102
  if (body.item === null || body.item === void 0) {
103
- throw new chunkJLBSUZ5B_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
103
+ throw new chunkYRRTE2NF_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
104
104
  }
105
105
  return body.item;
106
106
  } catch (err) {
107
- if (err instanceof chunkJLBSUZ5B_cjs.NotFoundError) return null;
107
+ if (err instanceof chunkYRRTE2NF_cjs.NotFoundError) return null;
108
108
  throw err;
109
109
  }
110
110
  }
@@ -116,7 +116,7 @@ async function ciScopedQuery(http, path, itemID, limit) {
116
116
  body: { MaxRecords: limit, filter: [{ field: "configurationItemID", op: "eq", value: itemID }] },
117
117
  operation: "configuration_items.profile"
118
118
  });
119
- return chunkJLBSUZ5B_cjs.unwrapItems(res).items;
119
+ return chunkYRRTE2NF_cjs.unwrapItems(res).items;
120
120
  }
121
121
  async function profile(resource, id, opts = {}) {
122
122
  const http = resource.http;
@@ -124,7 +124,7 @@ async function profile(resource, id, opts = {}) {
124
124
  const relatedLimit = profilePartLimit(opts.relatedLimit, "relatedLimit");
125
125
  const ci = await resource.get(id);
126
126
  const root = ci;
127
- const [type, category, notes, relatedItems, associations] = await chunkJLBSUZ5B_cjs.readTasks(http, [
127
+ const [type, category, notes, relatedItems, associations] = await chunkYRRTE2NF_cjs.readTasks(http, [
128
128
  () => contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type"),
129
129
  () => contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category"),
130
130
  () => ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit),
@@ -153,11 +153,11 @@ async function profile(resource, id, opts = {}) {
153
153
  }
154
154
  };
155
155
  if (opts.names === true) {
156
- const builder = chunkJLBSUZ5B_cjs.createNamePlan();
156
+ const builder = chunkYRRTE2NF_cjs.createNamePlan();
157
157
  builder.addFk("contract", root["contractID"]);
158
- const names = await chunkJLBSUZ5B_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
158
+ const names = await chunkYRRTE2NF_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
159
159
  const ciRow = { ...ci };
160
- chunkJLBSUZ5B_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
160
+ chunkYRRTE2NF_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
161
161
  result.ci = ciRow;
162
162
  result.names = names.section;
163
163
  }
@@ -165,7 +165,7 @@ async function profile(resource, id, opts = {}) {
165
165
  }
166
166
 
167
167
  // src/resources/configuration_items.ts
168
- var ConfigurationItemsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
168
+ var ConfigurationItemsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
169
169
  constructor(http, pageSize) {
170
170
  super(http, {
171
171
  key: "configuration_items",
@@ -191,7 +191,7 @@ var ConfigurationItemsResource = class extends chunkJLBSUZ5B_cjs.GenericResource
191
191
  async getContext(id) {
192
192
  const configurationItem = await this.fetchRecordRaw("/V1.0/ConfigurationItems", id);
193
193
  const root = configurationItem;
194
- const [company, contact, contract] = await chunkJLBSUZ5B_cjs.readTasks(this.http, [
194
+ const [company, contact, contract] = await chunkYRRTE2NF_cjs.readTasks(this.http, [
195
195
  () => this.contextFetch("/V1.0/Companies", root["companyID"]),
196
196
  () => this.contextFetch("/V1.0/Contacts", root["contactID"]),
197
197
  () => this.contextFetch("/V1.0/Contracts", root["contractID"])
@@ -213,23 +213,23 @@ async function fetchRecord2(http, path, label, readOpts) {
213
213
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: readOpts?.maxRetries });
214
214
  const body = res;
215
215
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
216
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
216
+ throw new chunkYRRTE2NF_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
217
217
  }
218
218
  return body.item;
219
219
  }
220
220
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}) {
221
221
  const http = _resource.http;
222
- const sourceId = chunkJLBSUZ5B_cjs.parseIdentifier(sourceContactId, "sourceContactId");
223
- const destId = chunkJLBSUZ5B_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
222
+ const sourceId = chunkYRRTE2NF_cjs.parseIdentifier(sourceContactId, "sourceContactId");
223
+ const destId = chunkYRRTE2NF_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
224
224
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
225
225
  const companyID = source.companyID;
226
226
  if (typeof companyID !== "number" || companyID < 0) {
227
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
227
+ throw new chunkYRRTE2NF_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
228
228
  }
229
229
  if (opts.lastModifiedDate !== void 0) {
230
230
  const current = source.lastModifiedDate;
231
231
  if (current !== opts.lastModifiedDate) {
232
- throw new chunkJLBSUZ5B_cjs.StaleObjectError(
232
+ throw new chunkYRRTE2NF_cjs.StaleObjectError(
233
233
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
234
234
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
235
235
  );
@@ -251,10 +251,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
251
251
  },
252
252
  operation: "contacts.moveToCompany"
253
253
  });
254
- const items = chunkJLBSUZ5B_cjs.unwrapItems(res).items;
254
+ const items = chunkYRRTE2NF_cjs.unwrapItems(res).items;
255
255
  const clash = items.find((c) => String(c.id) !== String(sourceId));
256
256
  if (clash !== void 0) {
257
- throw new chunkJLBSUZ5B_cjs.ConflictError(
257
+ throw new chunkYRRTE2NF_cjs.ConflictError(
258
258
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
259
259
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
260
260
  );
@@ -268,7 +268,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
268
268
  if (opts.dryRun === true) {
269
269
  const warnings = [];
270
270
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
271
- return chunkJLBSUZ5B_cjs.buildDryRunResult({
271
+ return chunkYRRTE2NF_cjs.buildDryRunResult({
272
272
  operation: "contacts.moveToCompany",
273
273
  method: "POST",
274
274
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -294,7 +294,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
294
294
  const createdBody = created;
295
295
  const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
296
296
  if (typeof newId !== "number") {
297
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
297
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
298
298
  }
299
299
  let sourceDeleted = false;
300
300
  if (opts.deleteSource === true) {
@@ -310,27 +310,27 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
310
310
  }
311
311
  var FULL_PROFILE_OP = "contacts.fullProfile";
312
312
  async function fullProfile(resource, id, opts = {}) {
313
- const client = chunkJLBSUZ5B_cjs.clientOf(resource, FULL_PROFILE_OP);
314
- const ticketLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
315
- const contactId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
316
- const envelope = await chunkJLBSUZ5B_cjs.invokeRead(client, "contacts.query", [
313
+ const client = chunkYRRTE2NF_cjs.clientOf(resource, FULL_PROFILE_OP);
314
+ const ticketLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
315
+ const contactId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
316
+ const envelope = await chunkYRRTE2NF_cjs.invokeRead(client, "contacts.query", [
317
317
  { filter: [{ field: "id", op: "eq", value: contactId }], limit: 1 }
318
318
  ]);
319
319
  const row = (envelope.items ?? [])[0];
320
320
  if (row === void 0) {
321
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
321
+ throw new chunkYRRTE2NF_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
322
322
  }
323
323
  const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
324
- const root = fk === null ? row : await chunkJLBSUZ5B_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
325
- const [company, openTickets] = await chunkJLBSUZ5B_cjs.readTasks(resource.http, [
326
- async () => fk === null ? { value: null, absent: "NO_FK" } : await chunkJLBSUZ5B_cjs.compositePart(client, "companies.get", [fk]),
327
- async () => await chunkJLBSUZ5B_cjs.openTicketsOfPart(client, "contactID", contactId, ticketLimit)
324
+ const root = fk === null ? row : await chunkYRRTE2NF_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
325
+ const [company, openTickets] = await chunkYRRTE2NF_cjs.readTasks(resource.http, [
326
+ async () => fk === null ? { value: null, absent: "NO_FK" } : await chunkYRRTE2NF_cjs.compositePart(client, "companies.get", [fk]),
327
+ async () => await chunkYRRTE2NF_cjs.openTicketsOfPart(client, "contactID", contactId, ticketLimit)
328
328
  ]);
329
329
  return { root, parts: { company, open_tickets: openTickets } };
330
330
  }
331
331
 
332
332
  // src/resources/contacts.ts
333
- var ContactsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
333
+ var ContactsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
334
334
  constructor(http, pageSize) {
335
335
  super(http, {
336
336
  key: "contacts",
@@ -379,10 +379,10 @@ var PATH_SUFFIX = {
379
379
  };
380
380
  async function stockedItems(_resource, kind, parentId, data, opts = {}) {
381
381
  const http = _resource.http;
382
- const numericParent = chunkJLBSUZ5B_cjs.parseIdentifier(parentId, "parentId");
382
+ const numericParent = chunkYRRTE2NF_cjs.parseIdentifier(parentId, "parentId");
383
383
  const suffix = PATH_SUFFIX[kind];
384
384
  if (opts.dryRun === true) {
385
- return chunkJLBSUZ5B_cjs.buildDryRunResult({
385
+ return chunkYRRTE2NF_cjs.buildDryRunResult({
386
386
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
387
387
  method: "POST",
388
388
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -399,11 +399,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}) {
399
399
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
400
400
  maxRetries: opts.maxRetries
401
401
  });
402
- return chunkJLBSUZ5B_cjs.unwrapOperation(res);
402
+ return chunkYRRTE2NF_cjs.unwrapOperation(res);
403
403
  }
404
404
 
405
405
  // src/resources/inventory_products.ts
406
- var InventoryProductsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
406
+ var InventoryProductsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
407
407
  constructor(http, pageSize) {
408
408
  super(http, {
409
409
  key: "inventory_products",
@@ -431,18 +431,18 @@ var InventoryProductsResource = class extends chunkJLBSUZ5B_cjs.GenericResource
431
431
  // src/resources/special/quotes.ts
432
432
  var OP = "quotes.withItems";
433
433
  async function withItems(resource, id, opts = {}) {
434
- const client = chunkJLBSUZ5B_cjs.clientOf(resource, OP);
435
- const itemLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
436
- const quoteId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
437
- const root = await chunkJLBSUZ5B_cjs.invokeRead(client, "quotes.get", [quoteId]);
438
- const items = await chunkJLBSUZ5B_cjs.compositePart(client, "quote_items.query", [
434
+ const client = chunkYRRTE2NF_cjs.clientOf(resource, OP);
435
+ const itemLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
436
+ const quoteId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
437
+ const root = await chunkYRRTE2NF_cjs.invokeRead(client, "quotes.get", [quoteId]);
438
+ const items = await chunkYRRTE2NF_cjs.compositePart(client, "quote_items.query", [
439
439
  { filter: [{ field: "quoteID", op: "eq", value: quoteId }], limit: itemLimit }
440
440
  ]);
441
441
  return { root, parts: { items } };
442
442
  }
443
443
 
444
444
  // src/resources/quotes.ts
445
- var QuotesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
445
+ var QuotesResource = class extends chunkYRRTE2NF_cjs.GenericResource {
446
446
  constructor(http, pageSize) {
447
447
  super(http, {
448
448
  key: "quotes",
@@ -468,7 +468,7 @@ var QuotesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
468
468
  // src/resources/special/resource_time_off_additional.ts
469
469
  async function getByResource(_resource, resourceId) {
470
470
  const http = _resource.http;
471
- const numericResource = chunkJLBSUZ5B_cjs.parseIdentifier(resourceId, "resourceId");
471
+ const numericResource = chunkYRRTE2NF_cjs.parseIdentifier(resourceId, "resourceId");
472
472
  const res = await http.request({
473
473
  method: "GET",
474
474
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -482,11 +482,11 @@ async function getByResource(_resource, resourceId) {
482
482
  if (typeof item === "object" && !Array.isArray(item)) return [item];
483
483
  }
484
484
  }
485
- return chunkJLBSUZ5B_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
485
+ return chunkYRRTE2NF_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
486
486
  }
487
487
 
488
488
  // src/resources/resource_time_off_additional.ts
489
- var ResourceTimeOffAdditionalResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
489
+ var ResourceTimeOffAdditionalResource = class extends chunkYRRTE2NF_cjs.GenericResource {
490
490
  constructor(http, pageSize) {
491
491
  super(http, {
492
492
  key: "resource_time_off_additional",
@@ -507,30 +507,30 @@ var ResourceTimeOffAdditionalResource = class extends chunkJLBSUZ5B_cjs.GenericR
507
507
  // src/resources/special/resource_time_off_balances.ts
508
508
  async function getByResource2(_resource, resourceId) {
509
509
  const http = _resource.http;
510
- const numericResource = chunkJLBSUZ5B_cjs.parseIdentifier(resourceId, "resourceId");
510
+ const numericResource = chunkYRRTE2NF_cjs.parseIdentifier(resourceId, "resourceId");
511
511
  const res = await http.request({
512
512
  method: "GET",
513
513
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
514
514
  operation: "resource_time_off_balances.getByResource"
515
515
  });
516
- return chunkJLBSUZ5B_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
516
+ return chunkYRRTE2NF_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
517
517
  }
518
518
  async function getByYear(_resource, resourceId, year) {
519
519
  const http = _resource.http;
520
- const numericResource = chunkJLBSUZ5B_cjs.parseIdentifier(resourceId, "resourceId");
520
+ const numericResource = chunkYRRTE2NF_cjs.parseIdentifier(resourceId, "resourceId");
521
521
  if (!Number.isSafeInteger(year) || year < 1) {
522
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
522
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
523
523
  }
524
524
  const res = await http.request({
525
525
  method: "GET",
526
526
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
527
527
  operation: "resource_time_off_balances.getByYear"
528
528
  });
529
- return chunkJLBSUZ5B_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
529
+ return chunkYRRTE2NF_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
530
530
  }
531
531
 
532
532
  // src/resources/resource_time_off_balances.ts
533
- var ResourceTimeOffBalancesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
533
+ var ResourceTimeOffBalancesResource = class extends chunkYRRTE2NF_cjs.GenericResource {
534
534
  constructor(http, pageSize) {
535
535
  super(http, {
536
536
  key: "resource_time_off_balances",
@@ -556,7 +556,7 @@ var ResourceTimeOffBalancesResource = class extends chunkJLBSUZ5B_cjs.GenericRes
556
556
  async function whoAmI(_resource, userName) {
557
557
  const http = _resource.http;
558
558
  const user = userName.trim();
559
- if (user === "") throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
559
+ if (user === "") throw new chunkYRRTE2NF_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
560
560
  const value = user.includes("@") ? user.split("@")[0] ?? "" : user;
561
561
  const res = await http.request({
562
562
  method: "POST",
@@ -565,11 +565,11 @@ async function whoAmI(_resource, userName) {
565
565
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
566
566
  operation: "resources.whoAmI"
567
567
  });
568
- const matches = chunkJLBSUZ5B_cjs.unwrapItems(res).items;
568
+ const matches = chunkYRRTE2NF_cjs.unwrapItems(res).items;
569
569
  if (matches.length === 0) return null;
570
570
  if (matches.length > 1) {
571
571
  const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
572
- throw new chunkJLBSUZ5B_cjs.ResolutionError(
572
+ throw new chunkYRRTE2NF_cjs.ResolutionError(
573
573
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
574
574
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids, details: { idRefs: ids.map((cid) => ({ entity: "resource", id: cid })) } }
575
575
  );
@@ -578,28 +578,28 @@ async function whoAmI(_resource, userName) {
578
578
  }
579
579
  var WORKLOAD_OP = "resources.workload";
580
580
  async function workload(resource, id, opts = {}) {
581
- const client = chunkJLBSUZ5B_cjs.clientOf(resource, WORKLOAD_OP);
582
- const ticketLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
583
- const taskLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
584
- const timeOffLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
585
- const resourceId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
586
- const root = await chunkJLBSUZ5B_cjs.invokeRead(client, "resources.get", [resourceId]);
581
+ const client = chunkYRRTE2NF_cjs.clientOf(resource, WORKLOAD_OP);
582
+ const ticketLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
583
+ const taskLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
584
+ const timeOffLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
585
+ const resourceId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
586
+ const root = await chunkYRRTE2NF_cjs.invokeRead(client, "resources.get", [resourceId]);
587
587
  const strict = { allowAssumed: false };
588
- const [joined, counted, assignmentBranch, balances, timeOff] = await chunkJLBSUZ5B_cjs.readTasks(resource.http, [
589
- () => chunkJLBSUZ5B_cjs.compositePart(client, "tickets.forResource", [
588
+ const [joined, counted, assignmentBranch, balances, timeOff] = await chunkYRRTE2NF_cjs.readTasks(resource.http, [
589
+ () => chunkYRRTE2NF_cjs.compositePart(client, "tickets.forResource", [
590
590
  resourceId,
591
591
  { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
592
592
  ]),
593
- () => chunkJLBSUZ5B_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
593
+ () => chunkYRRTE2NF_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
594
594
  async () => {
595
- const assignments2 = await chunkJLBSUZ5B_cjs.compositePart(client, "service_call_task_resources.query", [
595
+ const assignments2 = await chunkYRRTE2NF_cjs.compositePart(client, "service_call_task_resources.query", [
596
596
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
597
597
  ]);
598
- const taskDetails2 = await chunkJLBSUZ5B_cjs.joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
598
+ const taskDetails2 = await chunkYRRTE2NF_cjs.joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
599
599
  return { assignments: assignments2, taskDetails: taskDetails2 };
600
600
  },
601
- () => chunkJLBSUZ5B_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
602
- () => chunkJLBSUZ5B_cjs.compositePart(client, "time_off_requests.query", [
601
+ () => chunkYRRTE2NF_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
602
+ () => chunkYRRTE2NF_cjs.compositePart(client, "time_off_requests.query", [
603
603
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
604
604
  ])
605
605
  ]);
@@ -627,7 +627,7 @@ async function workload(resource, id, opts = {}) {
627
627
  }
628
628
 
629
629
  // src/resources/resources.ts
630
- var ResourcesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
630
+ var ResourcesResource = class extends chunkYRRTE2NF_cjs.GenericResource {
631
631
  clientConfig;
632
632
  constructor(http, clientConfig, pageSize) {
633
633
  super(http, {
@@ -659,20 +659,20 @@ var ResourcesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
659
659
  // src/resources/special/service_calls.ts
660
660
  var OP2 = "service_calls.fullProfile";
661
661
  async function fullProfile2(resource, id, opts = {}) {
662
- const client = chunkJLBSUZ5B_cjs.clientOf(resource, OP2);
663
- const ticketLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
664
- const taskLimit = chunkJLBSUZ5B_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
665
- const callId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
666
- const root = await chunkJLBSUZ5B_cjs.invokeRead(client, "service_calls.get", [callId]);
667
- const [tickets, taskBranch] = await chunkJLBSUZ5B_cjs.readTasks(resource.http, [
668
- () => chunkJLBSUZ5B_cjs.compositePart(client, "service_call_tickets.query", [
662
+ const client = chunkYRRTE2NF_cjs.clientOf(resource, OP2);
663
+ const ticketLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
664
+ const taskLimit = chunkYRRTE2NF_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
665
+ const callId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
666
+ const root = await chunkYRRTE2NF_cjs.invokeRead(client, "service_calls.get", [callId]);
667
+ const [tickets, taskBranch] = await chunkYRRTE2NF_cjs.readTasks(resource.http, [
668
+ () => chunkYRRTE2NF_cjs.compositePart(client, "service_call_tickets.query", [
669
669
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
670
670
  ]),
671
671
  async () => {
672
- const tasks2 = await chunkJLBSUZ5B_cjs.compositePart(client, "service_call_tasks.query", [
672
+ const tasks2 = await chunkYRRTE2NF_cjs.compositePart(client, "service_call_tasks.query", [
673
673
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
674
674
  ]);
675
- const resourceAssignments2 = await chunkJLBSUZ5B_cjs.joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
675
+ const resourceAssignments2 = await chunkYRRTE2NF_cjs.joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
676
676
  return { tasks: tasks2, resourceAssignments: resourceAssignments2 };
677
677
  }
678
678
  ]);
@@ -688,7 +688,7 @@ async function fullProfile2(resource, id, opts = {}) {
688
688
  }
689
689
 
690
690
  // src/resources/service_calls.ts
691
- var ServiceCallsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
691
+ var ServiceCallsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
692
692
  constructor(http, pageSize) {
693
693
  super(http, {
694
694
  key: "service_calls",
@@ -710,13 +710,13 @@ var OP3 = "ticket_charges.moveToTicket";
710
710
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
711
711
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
712
712
  async function readCharge(http, id, retries) {
713
- const rows = await chunkJLBSUZ5B_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
713
+ const rows = await chunkYRRTE2NF_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
714
714
  return rows[0] ?? null;
715
715
  }
716
716
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
717
717
  if (source.isBilled === true) {
718
- throw chunkJLBSUZ5B_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: chunkJLBSUZ5B_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
718
+ throw chunkYRRTE2NF_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: chunkYRRTE2NF_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
720
720
  });
721
721
  }
722
722
  }
@@ -750,14 +750,14 @@ var SPEC = {
750
750
  ]
751
751
  }),
752
752
  // charges have no ExecuteCommand code: the parent ticket is the closest clickable target
753
- manualLink: (http, source) => typeof source.ticketID === "number" ? chunkJLBSUZ5B_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
753
+ manualLink: (http, source) => typeof source.ticketID === "number" ? chunkYRRTE2NF_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
754
754
  };
755
755
  function moveToTicket(resource, sourceId, toTicketId, opts) {
756
- return chunkJLBSUZ5B_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
756
+ return chunkYRRTE2NF_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
757
757
  }
758
758
 
759
759
  // src/resources/ticket_charges.ts
760
- var TicketChargesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
760
+ var TicketChargesResource = class extends chunkYRRTE2NF_cjs.GenericResource {
761
761
  constructor(http, pageSize) {
762
762
  super(http, {
763
763
  key: "ticket_charges",
@@ -782,7 +782,7 @@ var TicketChargesResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
782
782
  };
783
783
 
784
784
  // src/resources/special/tickets/errors.ts
785
- var StatusUnknownError = class extends chunkJLBSUZ5B_cjs.AutotaskError {
785
+ var StatusUnknownError = class extends chunkYRRTE2NF_cjs.AutotaskError {
786
786
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
787
787
  picklistCount;
788
788
  constructor(message, options = {}) {
@@ -796,7 +796,7 @@ var StatusUnknownError = class extends chunkJLBSUZ5B_cjs.AutotaskError {
796
796
  this.picklistCount = options.picklistCount ?? 0;
797
797
  }
798
798
  };
799
- var StatusFieldsRequiredError = class extends chunkJLBSUZ5B_cjs.AutotaskError {
799
+ var StatusFieldsRequiredError = class extends chunkYRRTE2NF_cjs.AutotaskError {
800
800
  vendorFields;
801
801
  currentStatus;
802
802
  targetStatus;
@@ -818,8 +818,8 @@ function isPositiveInt(v) {
818
818
  return typeof v === "number" && Number.isInteger(v) && v > 0;
819
819
  }
820
820
  function namedVendorFields(err) {
821
- if (!chunkJLBSUZ5B_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
822
- const entries = chunkJLBSUZ5B_cjs.parseVendorErrors(err.vendorError) ?? [];
821
+ if (!chunkYRRTE2NF_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
822
+ const entries = chunkYRRTE2NF_cjs.parseVendorErrors(err.vendorError) ?? [];
823
823
  const out = /* @__PURE__ */ new Set();
824
824
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
825
825
  return [...out];
@@ -838,8 +838,8 @@ function unwrapItemOrNull(res) {
838
838
  return body.item;
839
839
  }
840
840
  function discoveryMerge(err, body, defaults) {
841
- if (!chunkJLBSUZ5B_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
842
- const entries = chunkJLBSUZ5B_cjs.parseVendorErrors(err.vendorError);
841
+ if (!chunkYRRTE2NF_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
842
+ const entries = chunkYRRTE2NF_cjs.parseVendorErrors(err.vendorError);
843
843
  if (entries === void 0) return null;
844
844
  for (const entry of entries) {
845
845
  const field = entry.field;
@@ -874,7 +874,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
874
874
  const ids = await readLiveStatusSet(resource);
875
875
  if (ids.size > 0) liveStatus = ids;
876
876
  } catch (err) {
877
- if (!chunkJLBSUZ5B_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
877
+ if (!chunkYRRTE2NF_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
878
878
  }
879
879
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
880
880
  http.fieldCache?.invalidate("tickets:");
@@ -884,7 +884,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
884
884
  const freshIds = await readLiveStatusSet(resource);
885
885
  if (freshIds.size > 0) freshStatus = freshIds;
886
886
  } catch (err) {
887
- if (!chunkJLBSUZ5B_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
887
+ if (!chunkYRRTE2NF_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
888
888
  freshStatus = null;
889
889
  reReadFailed = true;
890
890
  }
@@ -902,7 +902,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
902
902
  return { guardDegraded: liveStatus === null };
903
903
  }
904
904
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
905
- return chunkJLBSUZ5B_cjs.buildDryRunResult(
905
+ return chunkYRRTE2NF_cjs.buildDryRunResult(
906
906
  {
907
907
  operation: OP_STATUS,
908
908
  method: "PUT",
@@ -956,7 +956,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
956
956
  if (mapEntry === void 0) {
957
957
  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
958
  }
959
- return chunkJLBSUZ5B_cjs.buildDryRunResult(
959
+ return chunkYRRTE2NF_cjs.buildDryRunResult(
960
960
  {
961
961
  operation: OP_STATUS,
962
962
  method: "PUT",
@@ -976,7 +976,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
976
976
  }
977
977
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
978
978
  const safeDefaults = mapEntry?.safeDefaults ?? {};
979
- const body = chunkJLBSUZ5B_cjs.mergePartialBody(current, mergeData);
979
+ const body = chunkYRRTE2NF_cjs.mergePartialBody(current, mergeData);
980
980
  body.id = ticketId;
981
981
  let merges = 0;
982
982
  for (; ; ) {
@@ -1000,8 +1000,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1000
1000
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
1001
1001
  {
1002
1002
  operation: OP_STATUS,
1003
- httpStatus: chunkJLBSUZ5B_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1004
- vendorError: chunkJLBSUZ5B_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1003
+ httpStatus: chunkYRRTE2NF_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1004
+ vendorError: chunkYRRTE2NF_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1005
1005
  resourceIds: [ticketId],
1006
1006
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
1007
1007
  }
@@ -1014,7 +1014,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1014
1014
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1015
1015
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1016
1016
  if (verify === null) {
1017
- throw new chunkJLBSUZ5B_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1017
+ throw new chunkYRRTE2NF_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1018
1018
  code: "INVALID_RESPONSE",
1019
1019
  category: "server",
1020
1020
  operation: OP_STATUS,
@@ -1024,7 +1024,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1024
1024
  }
1025
1025
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
1026
1026
  if (finalStatus !== targetStatus) {
1027
- throw new chunkJLBSUZ5B_cjs.AutotaskError(
1027
+ throw new chunkYRRTE2NF_cjs.AutotaskError(
1028
1028
  `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
1029
  {
1030
1030
  code: "INVALID_RESPONSE",
@@ -1040,17 +1040,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1040
1040
  }
1041
1041
  async function changeStatus(resource, id, targetStatus, fields, opts) {
1042
1042
  const http = resource.http;
1043
- const ticketId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1043
+ const ticketId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1044
1044
  if (!isPositiveInt(targetStatus)) {
1045
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1045
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1046
1046
  }
1047
1047
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
1048
1048
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
1049
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1049
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1050
1050
  }
1051
1051
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1052
1052
  if (current === null) {
1053
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1053
+ throw new chunkYRRTE2NF_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
1054
  }
1055
1055
  const previousStatus = typeof current.status === "number" ? current.status : null;
1056
1056
  if (previousStatus === targetStatus) {
@@ -1076,7 +1076,7 @@ var TICKET_FIELDS = ["id", "ticketNumber", "title", "status", "assignedResourceI
1076
1076
  function positiveId(value, name) {
1077
1077
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
1078
1078
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1079
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1079
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1080
1080
  }
1081
1081
  return n;
1082
1082
  }
@@ -1088,7 +1088,7 @@ async function ticketPage(http, filter, maxRecords, fields) {
1088
1088
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
1089
1089
  operation: OP4
1090
1090
  });
1091
- const page = chunkJLBSUZ5B_cjs.unwrapItems(res, OP4);
1091
+ const page = chunkYRRTE2NF_cjs.unwrapItems(res, OP4);
1092
1092
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
1093
1093
  }
1094
1094
  async function readLinkIds(http, resourceID, maxPages = 1) {
@@ -1098,11 +1098,11 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1098
1098
  const res = await http.request({
1099
1099
  method: "POST",
1100
1100
  idempotent: true,
1101
- path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkJLBSUZ5B_cjs.cursorToPath(http.baseUrl, cursor),
1101
+ path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkYRRTE2NF_cjs.cursorToPath(http.baseUrl, cursor),
1102
1102
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
1103
1103
  operation: OP4
1104
1104
  });
1105
- const page = chunkJLBSUZ5B_cjs.unwrapItems(res, OP4);
1105
+ const page = chunkYRRTE2NF_cjs.unwrapItems(res, OP4);
1106
1106
  for (const row of page.items) if (typeof row.ticketID === "number") ids.add(row.ticketID);
1107
1107
  cursor = page.pageDetails.nextPageUrl;
1108
1108
  if (cursor === null || page.items.length === 0) return { ids: [...ids], capped: false };
@@ -1111,35 +1111,35 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1111
1111
  }
1112
1112
  async function forResource(_resource, resourceIDIn, opts = {}) {
1113
1113
  const http = _resource.http;
1114
- if (opts === null || typeof opts !== "object") throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1114
+ if (opts === null || typeof opts !== "object") throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1115
1115
  const resourceID = positiveId(resourceIDIn, "resourceID");
1116
1116
  const scope = opts.scope ?? "both";
1117
1117
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
1118
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1118
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1119
1119
  }
1120
1120
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
1121
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1121
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1122
1122
  }
1123
1123
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
1124
1124
  if (opts.countOnly !== true && (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX)) {
1125
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1125
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1126
1126
  }
1127
1127
  const includeFields = opts.includeFields ?? [];
1128
1128
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
1129
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1129
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1130
1130
  }
1131
1131
  const openOnly = opts.openOnly === true;
1132
1132
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS, ...includeFields])];
1133
1133
  if (opts.countOnly !== void 0 && typeof opts.countOnly !== "boolean") {
1134
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1134
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1135
1135
  }
1136
- const closed = await chunkJLBSUZ5B_cjs.resolveTicketStatusSemantics(
1136
+ const closed = await chunkYRRTE2NF_cjs.resolveTicketStatusSemantics(
1137
1137
  http,
1138
1138
  { ...opts.excludeStatusIds === void 0 ? {} : { excludeStatusIds: opts.excludeStatusIds }, ...opts.allowAssumed === void 0 ? {} : { allowAssumed: opts.allowAssumed } },
1139
1139
  OP4
1140
1140
  );
1141
1141
  const closedStatus = { closedIds: closed.closedIds, source: closed.source, note: closed.note };
1142
- const openLeaf = openOnly || opts.countOnly === true ? [chunkJLBSUZ5B_cjs.openStatusFilter(closed.closedIds)] : [];
1142
+ const openLeaf = openOnly || opts.countOnly === true ? [chunkYRRTE2NF_cjs.openStatusFilter(closed.closedIds)] : [];
1143
1143
  if (opts.countOnly === true) {
1144
1144
  const primaryCount = scope === "secondary" ? 0 : await _resource.count({ filter: [{ field: "assignedResourceID", op: "eq", value: resourceID }, ...openLeaf] });
1145
1145
  let secondaryCount = 0;
@@ -1153,7 +1153,7 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1153
1153
  const page = await ticketPage(http, [{ field: "id", op: "in", value: chunk }, ...openLeaf], chunk.length, ["id", "status", "assignedResourceID"]);
1154
1154
  const seen = /* @__PURE__ */ new Set();
1155
1155
  for (const t of page.rows) {
1156
- if (typeof t.id !== "number" || seen.has(t.id) || chunkJLBSUZ5B_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1156
+ if (typeof t.id !== "number" || seen.has(t.id) || chunkYRRTE2NF_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1157
1157
  seen.add(t.id);
1158
1158
  if (scope === "both" && t.assignedResourceID === resourceID) bothCount++;
1159
1159
  }
@@ -1199,13 +1199,13 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1199
1199
  for (const [id, t] of primary) merged.set(id, t);
1200
1200
  for (const [id, t] of secondary) if (!merged.has(id)) merged.set(id, t);
1201
1201
  let tickets = [...merged.values()];
1202
- if (openOnly) tickets = tickets.filter((t) => !chunkJLBSUZ5B_cjs.isClosedStatus(t.status, closed.closedIds));
1202
+ if (openOnly) tickets = tickets.filter((t) => !chunkYRRTE2NF_cjs.isClosedStatus(t.status, closed.closedIds));
1203
1203
  tickets.sort((a, b) => Number(a.id) - Number(b.id));
1204
1204
  if (tickets.length > limit) {
1205
1205
  tickets = tickets.slice(0, limit);
1206
1206
  capped = true;
1207
1207
  }
1208
- const openCount = tickets.filter((t) => !chunkJLBSUZ5B_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1208
+ const openCount = tickets.filter((t) => !chunkYRRTE2NF_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1209
1209
  const primaryIds = [...primary.keys()].sort((a, b) => a - b);
1210
1210
  const secondaryIds = [...secondary.keys()].sort((a, b) => a - b);
1211
1211
  const both = primaryIds.filter((id) => secondary.has(id));
@@ -1239,9 +1239,9 @@ async function fetchTicket(http, id, operation) {
1239
1239
  });
1240
1240
  const body = res;
1241
1241
  if (body === null || !("item" in body)) {
1242
- throw new chunkJLBSUZ5B_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1242
+ throw new chunkYRRTE2NF_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1243
1243
  }
1244
- if (body.item === null || body.item === void 0) throw new chunkJLBSUZ5B_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1244
+ if (body.item === null || body.item === void 0) throw new chunkYRRTE2NF_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1245
1245
  return body.item;
1246
1246
  }
1247
1247
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -1252,7 +1252,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
1252
1252
  body: { MaxRecords: maxRecords, filter },
1253
1253
  operation
1254
1254
  });
1255
- return chunkJLBSUZ5B_cjs.unwrapItems(res).items;
1255
+ return chunkYRRTE2NF_cjs.unwrapItems(res).items;
1256
1256
  }
1257
1257
  function truncate(text, limit) {
1258
1258
  const full = text ?? "";
@@ -1262,13 +1262,13 @@ function truncate(text, limit) {
1262
1262
 
1263
1263
  // src/resources/special/tickets/childRead.ts
1264
1264
  function isRouteUnavailable(err) {
1265
- return chunkJLBSUZ5B_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1265
+ return chunkYRRTE2NF_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1266
1266
  }
1267
1267
  function routeFact(route, path, err) {
1268
1268
  return {
1269
1269
  route,
1270
1270
  path,
1271
- httpStatus: chunkJLBSUZ5B_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1271
+ httpStatus: chunkYRRTE2NF_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1272
1272
  };
1273
1273
  }
1274
1274
  async function childDeclaresQuery(resourceKey) {
@@ -1279,10 +1279,10 @@ async function childDeclaresQuery(resourceKey) {
1279
1279
  }
1280
1280
  async function planScopedPath(resourceKey, ticketId) {
1281
1281
  if (!await childDeclaresQuery(resourceKey)) return null;
1282
- const entry = chunkJLBSUZ5B_cjs.RELATIONSHIP_MAP[resourceKey];
1282
+ const entry = chunkYRRTE2NF_cjs.RELATIONSHIP_MAP[resourceKey];
1283
1283
  const parent = entry === void 0 ? null : entry.parent;
1284
1284
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
1285
- const parentPath = chunkJLBSUZ5B_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1285
+ const parentPath = chunkYRRTE2NF_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1286
1286
  if (parentPath === null || parentPath === void 0) return null;
1287
1287
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
1288
1288
  }
@@ -1321,14 +1321,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
1321
1321
  break;
1322
1322
  }
1323
1323
  const body = await http.request({ method: "GET", path: target, operation });
1324
- const { items: pageItems, pageDetails } = chunkJLBSUZ5B_cjs.unwrapItems(body, operation);
1324
+ const { items: pageItems, pageDetails } = chunkYRRTE2NF_cjs.unwrapItems(body, operation);
1325
1325
  nextCursor = pageDetails.nextPageUrl;
1326
1326
  pages += 1;
1327
1327
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
1328
1328
  for (const row of window) if (accept(row)) items.push(row);
1329
1329
  if (items.length >= limit) break;
1330
1330
  if (nextCursor === null || pageItems.length === 0) break;
1331
- target = chunkJLBSUZ5B_cjs.cursorToPath(http.baseUrl, nextCursor);
1331
+ target = chunkYRRTE2NF_cjs.cursorToPath(http.baseUrl, nextCursor);
1332
1332
  }
1333
1333
  const capped = items.length >= limit || guard && nextCursor !== null;
1334
1334
  return { items, capped };
@@ -1361,7 +1361,7 @@ var DEFAULT_PART_LIMIT = 50;
1361
1361
  function partLimit(value, name) {
1362
1362
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
1363
1363
  if (!Number.isInteger(n) || n < 1) {
1364
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1364
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1365
1365
  }
1366
1366
  return n;
1367
1367
  }
@@ -1374,13 +1374,13 @@ function servedTextRecord(row, textField, limit) {
1374
1374
  return out;
1375
1375
  }
1376
1376
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1377
- const builder = chunkJLBSUZ5B_cjs.createNamePlan(chunkJLBSUZ5B_cjs.TICKET_LABEL_FIELDS);
1377
+ const builder = chunkYRRTE2NF_cjs.createNamePlan(chunkYRRTE2NF_cjs.TICKET_LABEL_FIELDS);
1378
1378
  const t = ctx.ticket;
1379
1379
  builder.addResource(t["creatorResourceID"]);
1380
1380
  builder.addFk("contract", t["contractID"]);
1381
1381
  builder.addFk("billingCode", t["billingCodeID"]);
1382
1382
  builder.addFk("role", t["assignedResourceRoleID"]);
1383
- const ticketLobPointer = chunkJLBSUZ5B_cjs.vendorId(t["organizationalLevelAssociationID"]);
1383
+ const ticketLobPointer = chunkYRRTE2NF_cjs.vendorId(t["organizationalLevelAssociationID"]);
1384
1384
  if (ticketLobPointer !== void 0) {
1385
1385
  builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
1386
1386
  } else {
@@ -1392,20 +1392,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1392
1392
  builder.addFk("billingCode", e["billingCodeID"]);
1393
1393
  builder.addFk("contract", e["contractID"]);
1394
1394
  }
1395
- const names = await chunkJLBSUZ5B_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1395
+ const names = await chunkYRRTE2NF_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1396
1396
  const ticketRow = { ...ctx.ticket };
1397
- chunkJLBSUZ5B_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1398
- chunkJLBSUZ5B_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1399
- chunkJLBSUZ5B_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1400
- chunkJLBSUZ5B_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1401
- for (const f of chunkJLBSUZ5B_cjs.TICKET_LABEL_FIELDS) chunkJLBSUZ5B_cjs.addLabelSibling(ticketRow, f, names);
1397
+ chunkYRRTE2NF_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1398
+ chunkYRRTE2NF_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1399
+ chunkYRRTE2NF_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1400
+ chunkYRRTE2NF_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1401
+ for (const f of chunkYRRTE2NF_cjs.TICKET_LABEL_FIELDS) chunkYRRTE2NF_cjs.addLabelSibling(ticketRow, f, names);
1402
1402
  result.ticket = ticketRow;
1403
1403
  result.timeEntries.items = entriesPart.items.map((e) => {
1404
1404
  const row = { ...e };
1405
- chunkJLBSUZ5B_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1406
- chunkJLBSUZ5B_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1407
- chunkJLBSUZ5B_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1408
- chunkJLBSUZ5B_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1405
+ chunkYRRTE2NF_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1406
+ chunkYRRTE2NF_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1407
+ chunkYRRTE2NF_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1408
+ chunkYRRTE2NF_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1409
1409
  return row;
1410
1410
  });
1411
1411
  result.names = names.section;
@@ -1422,11 +1422,11 @@ async function fullContext(resource, id, opts = {}, loadContext) {
1422
1422
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
1423
1423
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
1424
1424
  const textLimit = partLimit(opts.textLimit, "textLimit");
1425
- const ticketId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1425
+ const ticketId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1426
1426
  const { ticket, tasks: contextTasks } = await loadContext();
1427
1427
  const op = "tickets.fullContext";
1428
1428
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
1429
- const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await chunkJLBSUZ5B_cjs.readTasks(http, [
1429
+ const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await chunkYRRTE2NF_cjs.readTasks(http, [
1430
1430
  ...contextTasks,
1431
1431
  () => ticketChildRead(http, { globalPath: "/V1.0/TicketNotes/query", resourceKey: "ticket_notes", filter: ticketFilter, limit: noteLimit, operation: op }, ticketId),
1432
1432
  () => ticketChildRead(http, { globalPath: "/V1.0/TimeEntries/query", resourceKey: "time_entries", filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId),
@@ -1489,7 +1489,7 @@ var OP5 = "tickets.lineOfBusiness";
1489
1489
  function positiveId2(value, name) {
1490
1490
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
1491
1491
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1492
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1492
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1493
1493
  }
1494
1494
  return n;
1495
1495
  }
@@ -1505,25 +1505,25 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1505
1505
  associationSource = "argument";
1506
1506
  } else {
1507
1507
  const ticket = await resource.get(ticketId);
1508
- associationId = chunkJLBSUZ5B_cjs.vendorId(ticket.organizationalLevelAssociationID);
1508
+ associationId = chunkYRRTE2NF_cjs.vendorId(ticket.organizationalLevelAssociationID);
1509
1509
  if (associationId !== void 0) {
1510
1510
  associationSource = "ticket";
1511
1511
  } else {
1512
- const contractRef = chunkJLBSUZ5B_cjs.vendorId(ticket.contractID);
1512
+ const contractRef = chunkYRRTE2NF_cjs.vendorId(ticket.contractID);
1513
1513
  if (contractRef !== void 0) {
1514
1514
  const client = http.client;
1515
1515
  if (client === void 0) {
1516
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1516
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1517
1517
  }
1518
1518
  try {
1519
1519
  const contract = await client.contracts.get(contractRef);
1520
1520
  contractId = contractRef;
1521
- associationId = chunkJLBSUZ5B_cjs.vendorId(contract.organizationalLevelAssociationID);
1521
+ associationId = chunkYRRTE2NF_cjs.vendorId(contract.organizationalLevelAssociationID);
1522
1522
  if (associationId !== void 0) associationSource = "contract";
1523
1523
  } catch (e) {
1524
- if (e instanceof chunkJLBSUZ5B_cjs.NotFoundError) {
1524
+ if (e instanceof chunkYRRTE2NF_cjs.NotFoundError) {
1525
1525
  contractId = contractRef;
1526
- } else if (chunkJLBSUZ5B_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1526
+ } else if (chunkYRRTE2NF_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1527
1527
  contractId = contractRef;
1528
1528
  contractUnread = true;
1529
1529
  } else {
@@ -1544,7 +1544,7 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1544
1544
  markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
1545
1545
  };
1546
1546
  }
1547
- const chain = await chunkJLBSUZ5B_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1547
+ const chain = await chunkYRRTE2NF_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1548
1548
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
1549
1549
  return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
1550
1550
  }
@@ -1554,7 +1554,7 @@ var MS = 864e5;
1554
1554
  var SLA_PAGE = 100;
1555
1555
  async function slaHealthCheck(_resource, id, opts = {}) {
1556
1556
  const http = _resource.http;
1557
- const ticketId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1557
+ const ticketId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1558
1558
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
1559
1559
  const rows = await ticketQueryItems(
1560
1560
  http,
@@ -1580,9 +1580,9 @@ async function summary(_resource, id, opts = {}) {
1580
1580
  const http = _resource.http;
1581
1581
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
1582
1582
  if (!Number.isInteger(limit) || limit < 1) {
1583
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1583
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1584
1584
  }
1585
- const ticketId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1585
+ const ticketId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1586
1586
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
1587
1587
  const desc = truncate(ticket.description, limit);
1588
1588
  const now = opts.now ?? /* @__PURE__ */ new Date();
@@ -1611,17 +1611,17 @@ async function summary(_resource, id, opts = {}) {
1611
1611
  // src/resources/special/tickets/statusSemantics.ts
1612
1612
  async function statusSemantics(_resource, opts = {}) {
1613
1613
  const http = _resource.http;
1614
- return chunkJLBSUZ5B_cjs.resolveTicketStatusSemantics(http, opts);
1614
+ return chunkYRRTE2NF_cjs.resolveTicketStatusSemantics(http, opts);
1615
1615
  }
1616
1616
 
1617
1617
  // src/resources/special/tickets/timeline.ts
1618
1618
  function validateTimelineLimits(opts) {
1619
1619
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
1620
- if (!Number.isInteger(limit) || limit < 1) throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1620
+ if (!Number.isInteger(limit) || limit < 1) throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1621
1621
  const bounded = Math.min(limit, 500);
1622
1622
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
1623
1623
  if (!Number.isInteger(textLimit) || textLimit < 1) {
1624
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1624
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1625
1625
  }
1626
1626
  return { bounded, textLimit };
1627
1627
  }
@@ -1674,7 +1674,7 @@ function compareEventDates(a, b) {
1674
1674
  async function timeline(_resource, id, opts = {}) {
1675
1675
  const http = _resource.http;
1676
1676
  const { bounded, textLimit } = validateTimelineLimits(opts);
1677
- const ticketId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1677
+ const ticketId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1678
1678
  await fetchTicket(http, ticketId, "tickets.timeline");
1679
1679
  const dateFilters = (field) => {
1680
1680
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1714,7 +1714,7 @@ async function timeline(_resource, id, opts = {}) {
1714
1714
  }
1715
1715
 
1716
1716
  // src/resources/tickets.ts
1717
- var TicketsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
1717
+ var TicketsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
1718
1718
  constructor(http, pageSize) {
1719
1719
  super(http, {
1720
1720
  key: "tickets",
@@ -1740,7 +1740,7 @@ var TicketsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
1740
1740
  * fetch; no sub-lists; absent/dangling references come back null). */
1741
1741
  async getContext(id) {
1742
1742
  const { ticket, tasks } = await this.readTicketContext(id);
1743
- return ticketContextValue(ticket, await chunkJLBSUZ5B_cjs.readTasks(this.http, tasks));
1743
+ return ticketContextValue(ticket, await chunkYRRTE2NF_cjs.readTasks(this.http, tasks));
1744
1744
  }
1745
1745
  /** Root authority and reusable lazy FK tasks shared by both ticket composites. */
1746
1746
  async readTicketContext(id) {
@@ -1789,9 +1789,9 @@ var TicketsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
1789
1789
  // src/resources/special/time_off_requests.ts
1790
1790
  async function approve(_resource, id, opts = {}) {
1791
1791
  const http = _resource.http;
1792
- const numericId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1792
+ const numericId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1793
1793
  if (opts.dryRun === true) {
1794
- return chunkJLBSUZ5B_cjs.buildDryRunResult({
1794
+ return chunkYRRTE2NF_cjs.buildDryRunResult({
1795
1795
  operation: "time_off_requests.approve",
1796
1796
  method: "GET",
1797
1797
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -1807,17 +1807,17 @@ async function approve(_resource, id, opts = {}) {
1807
1807
  operation: "time_off_requests.approve",
1808
1808
  maxRetries: opts.maxRetries
1809
1809
  });
1810
- return chunkJLBSUZ5B_cjs.unwrapOperation(res);
1810
+ return chunkYRRTE2NF_cjs.unwrapOperation(res);
1811
1811
  }
1812
1812
  async function reject(_resource, id, reason, opts = {}) {
1813
1813
  const http = _resource.http;
1814
- const numericId = chunkJLBSUZ5B_cjs.parseIdentifier(id, "id");
1814
+ const numericId = chunkYRRTE2NF_cjs.parseIdentifier(id, "id");
1815
1815
  const text = reason.trim();
1816
1816
  if (text === "") {
1817
- throw new chunkJLBSUZ5B_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1817
+ throw new chunkYRRTE2NF_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1818
1818
  }
1819
1819
  if (opts.dryRun === true) {
1820
- return chunkJLBSUZ5B_cjs.buildDryRunResult({
1820
+ return chunkYRRTE2NF_cjs.buildDryRunResult({
1821
1821
  operation: "time_off_requests.reject",
1822
1822
  method: "POST",
1823
1823
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -1835,11 +1835,11 @@ async function reject(_resource, id, reason, opts = {}) {
1835
1835
  operation: "time_off_requests.reject",
1836
1836
  maxRetries: opts.maxRetries
1837
1837
  });
1838
- return chunkJLBSUZ5B_cjs.unwrapOperation(res);
1838
+ return chunkYRRTE2NF_cjs.unwrapOperation(res);
1839
1839
  }
1840
1840
 
1841
1841
  // src/resources/time_off_requests.ts
1842
- var TimeOffRequestsResource = class extends chunkJLBSUZ5B_cjs.GenericResource {
1842
+ var TimeOffRequestsResource = class extends chunkYRRTE2NF_cjs.GenericResource {
1843
1843
  constructor(http, pageSize) {
1844
1844
  super(http, {
1845
1845
  key: "time_off_requests",