node-autotask 0.61.0 → 0.62.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,24 +1,24 @@
1
1
  'use strict';
2
2
 
3
- var chunk4SEIDMF6_cjs = require('./chunk-4SEIDMF6.cjs');
4
- var chunkTE7RUKU2_cjs = require('./chunk-TE7RUKU2.cjs');
3
+ var chunkVDYUG6RK_cjs = require('./chunk-VDYUG6RK.cjs');
4
+ var chunkODPM4YVG_cjs = require('./chunk-ODPM4YVG.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 chunk4SEIDMF6_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
11
+ throw new chunkVDYUG6RK_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 = chunk4SEIDMF6_cjs.parseIdentifier(sourceId, "sourceId");
17
+ const numericSource = chunkVDYUG6RK_cjs.parseIdentifier(sourceId, "sourceId");
18
18
  if (opts?.destinationCompanyId === void 0) {
19
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
19
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
20
20
  }
21
- const destId = chunk4SEIDMF6_cjs.parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
21
+ const destId = chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.AutotaskConfigError("moveConfigurationItem: newReferenceTitle must be non-empty");
31
+ if (opts.newReferenceTitle.trim() === "") throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.StaleObjectError(
37
+ throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.buildDryRunResult({
44
+ return chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.AutotaskConfigError("moveConfigurationItem: vendor create response has no itemId");
69
+ throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.AutotaskConfigError(`profile: ${name} must be an integer >= 1 (got ${String(value)})`);
88
+ throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
104
+ throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.NotFoundError("context part not found", { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
107
+ throw new chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.NotFoundError) return null;
111
+ if (err instanceof chunkVDYUG6RK_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 chunk4SEIDMF6_cjs.unwrapItems(res).items;
123
+ return chunkVDYUG6RK_cjs.unwrapItems(res).items;
124
124
  }
125
125
  async function profile(resource, id, opts = {}) {
126
126
  const http = resource.http;
@@ -133,7 +133,7 @@ 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 = chunk4SEIDMF6_cjs.RELATIONSHIP_MAP["configuration_items"]?.zoneFacts?.quirks?.find(
136
+ const wallQuirk = chunkVDYUG6RK_cjs.RELATIONSHIP_MAP["configuration_items"]?.zoneFacts?.quirks?.find(
137
137
  (q) => q.kind === "field-constraint" && q.ops.includes("create") && (q.fields ?? []).includes("productID")
138
138
  );
139
139
  const productAssociations = {
@@ -159,11 +159,11 @@ async function profile(resource, id, opts = {}) {
159
159
  }
160
160
  };
161
161
  if (opts.names === true) {
162
- const builder = chunk4SEIDMF6_cjs.createNamePlan();
162
+ const builder = chunkVDYUG6RK_cjs.createNamePlan();
163
163
  builder.addFk("contract", root["contractID"]);
164
- const names = await chunk4SEIDMF6_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
164
+ const names = await chunkVDYUG6RK_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
165
165
  const ciRow = { ...ci };
166
- chunk4SEIDMF6_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
166
+ chunkVDYUG6RK_cjs.addNameSibling(ciRow, "contractID", (v) => names.recordName("contract", v));
167
167
  result.ci = ciRow;
168
168
  result.names = names.section;
169
169
  }
@@ -171,7 +171,7 @@ async function profile(resource, id, opts = {}) {
171
171
  }
172
172
 
173
173
  // src/resources/configuration_items.ts
174
- var ConfigurationItemsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
174
+ var ConfigurationItemsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
175
175
  constructor(http, pageSize) {
176
176
  super(http, {
177
177
  key: "configuration_items",
@@ -217,23 +217,23 @@ async function fetchRecord2(http, path, label, readOpts) {
217
217
  const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: readOpts?.maxRetries });
218
218
  const body = res;
219
219
  if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
220
- throw new chunk4SEIDMF6_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
220
+ throw new chunkVDYUG6RK_cjs.NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
221
221
  }
222
222
  return body.item;
223
223
  }
224
224
  async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}) {
225
225
  const http = _resource.http;
226
- const sourceId = chunk4SEIDMF6_cjs.parseIdentifier(sourceContactId, "sourceContactId");
227
- const destId = chunk4SEIDMF6_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
226
+ const sourceId = chunkVDYUG6RK_cjs.parseIdentifier(sourceContactId, "sourceContactId");
227
+ const destId = chunkVDYUG6RK_cjs.parseIdentifier(destinationCompanyId, "destinationCompanyId");
228
228
  const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
229
229
  const companyID = source.companyID;
230
230
  if (typeof companyID !== "number" || companyID < 0) {
231
- throw new chunk4SEIDMF6_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
231
+ throw new chunkVDYUG6RK_cjs.NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
232
232
  }
233
233
  if (opts.lastModifiedDate !== void 0) {
234
234
  const current = source.lastModifiedDate;
235
235
  if (current !== opts.lastModifiedDate) {
236
- throw new chunk4SEIDMF6_cjs.StaleObjectError(
236
+ throw new chunkVDYUG6RK_cjs.StaleObjectError(
237
237
  `moveToCompany: source contact ${sourceId} was modified since the snapshot (expected lastModifiedDate ${opts.lastModifiedDate}, current ${typeof current === "string" ? current : "unknown"})`,
238
238
  { operation: "contacts.moveToCompany", resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
239
239
  );
@@ -255,10 +255,10 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
255
255
  },
256
256
  operation: "contacts.moveToCompany"
257
257
  });
258
- const items = chunk4SEIDMF6_cjs.unwrapItems(res).items;
258
+ const items = chunkVDYUG6RK_cjs.unwrapItems(res).items;
259
259
  const clash = items.find((c) => String(c.id) !== String(sourceId));
260
260
  if (clash !== void 0) {
261
- throw new chunk4SEIDMF6_cjs.ConflictError(
261
+ throw new chunkVDYUG6RK_cjs.ConflictError(
262
262
  `Contact email "${email}" already exists under company ${destId} (contact ${String(clash.id)}); aborting the move`,
263
263
  { resourceIds: [sourceId, destId], details: { idRefs: [{ entity: "contact", id: sourceId }, { entity: "company", id: destId }] } }
264
264
  );
@@ -272,7 +272,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
272
272
  if (opts.dryRun === true) {
273
273
  const warnings = [];
274
274
  if (opts.deleteSource === true) warnings.push("the source contact will be deleted after the move");
275
- return chunk4SEIDMF6_cjs.buildDryRunResult({
275
+ return chunkVDYUG6RK_cjs.buildDryRunResult({
276
276
  operation: "contacts.moveToCompany",
277
277
  method: "POST",
278
278
  path: `/V1.0/Companies/${destId}/Contacts`,
@@ -298,7 +298,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
298
298
  const createdBody = created;
299
299
  const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
300
300
  if (typeof newId !== "number") {
301
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
301
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError("contacts.moveToCompany: vendor create response has no itemId");
302
302
  }
303
303
  let sourceDeleted = false;
304
304
  if (opts.deleteSource === true) {
@@ -314,20 +314,20 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
314
314
  }
315
315
  var FULL_PROFILE_OP = "contacts.fullProfile";
316
316
  async function fullProfile(resource, id, opts = {}) {
317
- const client = chunk4SEIDMF6_cjs.clientOf(resource, FULL_PROFILE_OP);
318
- const ticketLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
319
- const contactId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
320
- const envelope = await chunk4SEIDMF6_cjs.invokeRead(client, "contacts.query", [
317
+ const client = chunkVDYUG6RK_cjs.clientOf(resource, FULL_PROFILE_OP);
318
+ const ticketLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", FULL_PROFILE_OP);
319
+ const contactId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
320
+ const envelope = await chunkVDYUG6RK_cjs.invokeRead(client, "contacts.query", [
321
321
  { filter: [{ field: "id", op: "eq", value: contactId }], limit: 1 }
322
322
  ]);
323
323
  const row = (envelope.items ?? [])[0];
324
324
  if (row === void 0) {
325
- throw new chunk4SEIDMF6_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
325
+ throw new chunkVDYUG6RK_cjs.NotFoundError(`Contact ${contactId} not found`, { operation: "contacts.get", httpStatus: 404 });
326
326
  }
327
327
  const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
328
- const root = fk === null ? row : await chunk4SEIDMF6_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
329
- const company = fk === null ? { value: null, absent: "NO_FK" } : await chunk4SEIDMF6_cjs.compositePart(client, "companies.get", [fk]);
330
- const openTickets = await chunk4SEIDMF6_cjs.openTicketsOfPart(
328
+ const root = fk === null ? row : await chunkVDYUG6RK_cjs.invokeRead(client, "contacts.get", [fk, contactId]);
329
+ const company = fk === null ? { value: null, absent: "NO_FK" } : await chunkVDYUG6RK_cjs.compositePart(client, "companies.get", [fk]);
330
+ const openTickets = await chunkVDYUG6RK_cjs.openTicketsOfPart(
331
331
  client,
332
332
  "contactID",
333
333
  contactId,
@@ -337,7 +337,7 @@ async function fullProfile(resource, id, opts = {}) {
337
337
  }
338
338
 
339
339
  // src/resources/contacts.ts
340
- var ContactsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
340
+ var ContactsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
341
341
  constructor(http, pageSize) {
342
342
  super(http, {
343
343
  key: "contacts",
@@ -386,10 +386,10 @@ var PATH_SUFFIX = {
386
386
  };
387
387
  async function stockedItems(_resource, kind, parentId, data, opts = {}) {
388
388
  const http = _resource.http;
389
- const numericParent = chunk4SEIDMF6_cjs.parseIdentifier(parentId, "parentId");
389
+ const numericParent = chunkVDYUG6RK_cjs.parseIdentifier(parentId, "parentId");
390
390
  const suffix = PATH_SUFFIX[kind];
391
391
  if (opts.dryRun === true) {
392
- return chunk4SEIDMF6_cjs.buildDryRunResult({
392
+ return chunkVDYUG6RK_cjs.buildDryRunResult({
393
393
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
394
394
  method: "POST",
395
395
  path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
@@ -406,11 +406,11 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}) {
406
406
  operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
407
407
  maxRetries: opts.maxRetries
408
408
  });
409
- return chunk4SEIDMF6_cjs.unwrapOperation(res);
409
+ return chunkVDYUG6RK_cjs.unwrapOperation(res);
410
410
  }
411
411
 
412
412
  // src/resources/inventory_products.ts
413
- var InventoryProductsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
413
+ var InventoryProductsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
414
414
  constructor(http, pageSize) {
415
415
  super(http, {
416
416
  key: "inventory_products",
@@ -438,18 +438,18 @@ var InventoryProductsResource = class extends chunk4SEIDMF6_cjs.GenericResource
438
438
  // src/resources/special/quotes.ts
439
439
  var OP = "quotes.withItems";
440
440
  async function withItems(resource, id, opts = {}) {
441
- const client = chunk4SEIDMF6_cjs.clientOf(resource, OP);
442
- const itemLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
443
- const quoteId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
444
- const root = await chunk4SEIDMF6_cjs.invokeRead(client, "quotes.get", [quoteId]);
445
- const items = await chunk4SEIDMF6_cjs.compositePart(client, "quote_items.query", [
441
+ const client = chunkVDYUG6RK_cjs.clientOf(resource, OP);
442
+ const itemLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.itemLimit, "itemLimit", OP);
443
+ const quoteId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
444
+ const root = await chunkVDYUG6RK_cjs.invokeRead(client, "quotes.get", [quoteId]);
445
+ const items = await chunkVDYUG6RK_cjs.compositePart(client, "quote_items.query", [
446
446
  { filter: [{ field: "quoteID", op: "eq", value: quoteId }], limit: itemLimit }
447
447
  ]);
448
448
  return { root, parts: { items } };
449
449
  }
450
450
 
451
451
  // src/resources/quotes.ts
452
- var QuotesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
452
+ var QuotesResource = class extends chunkVDYUG6RK_cjs.GenericResource {
453
453
  constructor(http, pageSize) {
454
454
  super(http, {
455
455
  key: "quotes",
@@ -475,7 +475,7 @@ var QuotesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
475
475
  // src/resources/special/resource_time_off_additional.ts
476
476
  async function getByResource(_resource, resourceId) {
477
477
  const http = _resource.http;
478
- const numericResource = chunk4SEIDMF6_cjs.parseIdentifier(resourceId, "resourceId");
478
+ const numericResource = chunkVDYUG6RK_cjs.parseIdentifier(resourceId, "resourceId");
479
479
  const res = await http.request({
480
480
  method: "GET",
481
481
  path: `/V1.0/Resources/${numericResource}/TimeOffAdditional`,
@@ -489,11 +489,11 @@ async function getByResource(_resource, resourceId) {
489
489
  if (typeof item === "object" && !Array.isArray(item)) return [item];
490
490
  }
491
491
  }
492
- return chunk4SEIDMF6_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
492
+ return chunkVDYUG6RK_cjs.unwrapItems(res, "resource_time_off_additional.getByResource").items;
493
493
  }
494
494
 
495
495
  // src/resources/resource_time_off_additional.ts
496
- var ResourceTimeOffAdditionalResource = class extends chunk4SEIDMF6_cjs.GenericResource {
496
+ var ResourceTimeOffAdditionalResource = class extends chunkVDYUG6RK_cjs.GenericResource {
497
497
  constructor(http, pageSize) {
498
498
  super(http, {
499
499
  key: "resource_time_off_additional",
@@ -514,30 +514,30 @@ var ResourceTimeOffAdditionalResource = class extends chunk4SEIDMF6_cjs.GenericR
514
514
  // src/resources/special/resource_time_off_balances.ts
515
515
  async function getByResource2(_resource, resourceId) {
516
516
  const http = _resource.http;
517
- const numericResource = chunk4SEIDMF6_cjs.parseIdentifier(resourceId, "resourceId");
517
+ const numericResource = chunkVDYUG6RK_cjs.parseIdentifier(resourceId, "resourceId");
518
518
  const res = await http.request({
519
519
  method: "GET",
520
520
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances`,
521
521
  operation: "resource_time_off_balances.getByResource"
522
522
  });
523
- return chunk4SEIDMF6_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
523
+ return chunkVDYUG6RK_cjs.unwrapItems(res, "resource_time_off_balances.getByResource").items;
524
524
  }
525
525
  async function getByYear(_resource, resourceId, year) {
526
526
  const http = _resource.http;
527
- const numericResource = chunk4SEIDMF6_cjs.parseIdentifier(resourceId, "resourceId");
527
+ const numericResource = chunkVDYUG6RK_cjs.parseIdentifier(resourceId, "resourceId");
528
528
  if (!Number.isSafeInteger(year) || year < 1) {
529
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
529
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError("getByYear: year must be a positive integer");
530
530
  }
531
531
  const res = await http.request({
532
532
  method: "GET",
533
533
  path: `/V1.0/Resources/${numericResource}/TimeOffBalances/${year}`,
534
534
  operation: "resource_time_off_balances.getByYear"
535
535
  });
536
- return chunk4SEIDMF6_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
536
+ return chunkVDYUG6RK_cjs.unwrapItem(res, year, "resource_time_off_balances.getByYear", "resource_time_off_balance");
537
537
  }
538
538
 
539
539
  // src/resources/resource_time_off_balances.ts
540
- var ResourceTimeOffBalancesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
540
+ var ResourceTimeOffBalancesResource = class extends chunkVDYUG6RK_cjs.GenericResource {
541
541
  constructor(http, pageSize) {
542
542
  super(http, {
543
543
  key: "resource_time_off_balances",
@@ -563,7 +563,7 @@ var ResourceTimeOffBalancesResource = class extends chunk4SEIDMF6_cjs.GenericRes
563
563
  async function whoAmI(_resource, userName) {
564
564
  const http = _resource.http;
565
565
  const user = userName.trim();
566
- if (user === "") throw new chunk4SEIDMF6_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
566
+ if (user === "") throw new chunkVDYUG6RK_cjs.AutotaskConfigError("whoAmI: the configured UserName is empty");
567
567
  const value = user.includes("@") ? user.split("@")[0] ?? "" : user;
568
568
  const res = await http.request({
569
569
  method: "POST",
@@ -572,11 +572,11 @@ async function whoAmI(_resource, userName) {
572
572
  body: { MaxRecords: 2, filter: [{ field: "userName", op: "eq", value }] },
573
573
  operation: "resources.whoAmI"
574
574
  });
575
- const matches = chunk4SEIDMF6_cjs.unwrapItems(res).items;
575
+ const matches = chunkVDYUG6RK_cjs.unwrapItems(res).items;
576
576
  if (matches.length === 0) return null;
577
577
  if (matches.length > 1) {
578
578
  const ids = matches.map((m) => m.id).filter((id) => typeof id === "number");
579
- throw new chunk4SEIDMF6_cjs.ResolutionError(
579
+ throw new chunkVDYUG6RK_cjs.ResolutionError(
580
580
  `whoAmI: "${value}" is ambiguous (matched ${matches.length} resources)`,
581
581
  { code: "RESOLUTION_AMBIGUOUS", resourceIds: ids, details: { idRefs: ids.map((cid) => ({ entity: "resource", id: cid })) } }
582
582
  );
@@ -585,23 +585,23 @@ async function whoAmI(_resource, userName) {
585
585
  }
586
586
  var WORKLOAD_OP = "resources.workload";
587
587
  async function workload(resource, id, opts = {}) {
588
- const client = chunk4SEIDMF6_cjs.clientOf(resource, WORKLOAD_OP);
589
- const ticketLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
590
- const taskLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
591
- const timeOffLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
592
- const resourceId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
593
- const root = await chunk4SEIDMF6_cjs.invokeRead(client, "resources.get", [resourceId]);
588
+ const client = chunkVDYUG6RK_cjs.clientOf(resource, WORKLOAD_OP);
589
+ const ticketLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", WORKLOAD_OP);
590
+ const taskLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.taskLimit, "taskLimit", WORKLOAD_OP);
591
+ const timeOffLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.timeOffLimit, "timeOffLimit", WORKLOAD_OP);
592
+ const resourceId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
593
+ const root = await chunkVDYUG6RK_cjs.invokeRead(client, "resources.get", [resourceId]);
594
594
  const strict = { allowAssumed: false };
595
- const joined = await chunk4SEIDMF6_cjs.compositePart(client, "tickets.forResource", [
595
+ const joined = await chunkVDYUG6RK_cjs.compositePart(client, "tickets.forResource", [
596
596
  resourceId,
597
597
  { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
598
598
  ]);
599
- const counted = await chunk4SEIDMF6_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]);
600
- const assignments = await chunk4SEIDMF6_cjs.compositePart(client, "service_call_task_resources.query", [
599
+ const counted = await chunkVDYUG6RK_cjs.compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]);
600
+ const assignments = await chunkVDYUG6RK_cjs.compositePart(client, "service_call_task_resources.query", [
601
601
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
602
602
  ]);
603
- const balances = await chunk4SEIDMF6_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]);
604
- const timeOff = await chunk4SEIDMF6_cjs.compositePart(client, "time_off_requests.query", [
603
+ const balances = await chunkVDYUG6RK_cjs.compositePart(client, "resource_time_off_balances.getByResource", [resourceId]);
604
+ const timeOff = await chunkVDYUG6RK_cjs.compositePart(client, "time_off_requests.query", [
605
605
  { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
606
606
  ]);
607
607
  const openTickets = joined.value !== null && typeof joined.value === "object" ? counted.value !== null && typeof counted.value === "object" ? (() => {
@@ -614,11 +614,11 @@ async function workload(resource, id, opts = {}) {
614
614
  ...joined,
615
615
  value: { ...joined.value, totalsAbsent: counted.absent ?? "NO_TOTALS" }
616
616
  } : joined;
617
- const taskIds = chunk4SEIDMF6_cjs.numericIds(
617
+ const taskIds = chunkVDYUG6RK_cjs.numericIds(
618
618
  assignments.value?.items ?? [],
619
619
  "serviceCallTaskID"
620
- ).slice(0, chunk4SEIDMF6_cjs.IN_FILTER_CAP);
621
- const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await chunk4SEIDMF6_cjs.compositePart(client, "service_call_tasks.query", [
620
+ ).slice(0, chunkVDYUG6RK_cjs.IN_FILTER_CAP);
621
+ const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await chunkVDYUG6RK_cjs.compositePart(client, "service_call_tasks.query", [
622
622
  { filter: [{ field: "id", op: "in", value: taskIds }], limit: taskLimit }
623
623
  ]);
624
624
  return {
@@ -634,7 +634,7 @@ async function workload(resource, id, opts = {}) {
634
634
  }
635
635
 
636
636
  // src/resources/resources.ts
637
- var ResourcesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
637
+ var ResourcesResource = class extends chunkVDYUG6RK_cjs.GenericResource {
638
638
  clientConfig;
639
639
  constructor(http, clientConfig, pageSize) {
640
640
  super(http, {
@@ -666,22 +666,22 @@ var ResourcesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
666
666
  // src/resources/special/service_calls.ts
667
667
  var OP2 = "service_calls.fullProfile";
668
668
  async function fullProfile2(resource, id, opts = {}) {
669
- const client = chunk4SEIDMF6_cjs.clientOf(resource, OP2);
670
- const ticketLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
671
- const taskLimit = chunk4SEIDMF6_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
672
- const callId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
673
- const root = await chunk4SEIDMF6_cjs.invokeRead(client, "service_calls.get", [callId]);
674
- const tickets = await chunk4SEIDMF6_cjs.compositePart(client, "service_call_tickets.query", [
669
+ const client = chunkVDYUG6RK_cjs.clientOf(resource, OP2);
670
+ const ticketLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.ticketLimit, "ticketLimit", OP2);
671
+ const taskLimit = chunkVDYUG6RK_cjs.compositePartLimit(opts.taskLimit, "taskLimit", OP2);
672
+ const callId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
673
+ const root = await chunkVDYUG6RK_cjs.invokeRead(client, "service_calls.get", [callId]);
674
+ const tickets = await chunkVDYUG6RK_cjs.compositePart(client, "service_call_tickets.query", [
675
675
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
676
676
  ]);
677
- const tasks = await chunk4SEIDMF6_cjs.compositePart(client, "service_call_tasks.query", [
677
+ const tasks = await chunkVDYUG6RK_cjs.compositePart(client, "service_call_tasks.query", [
678
678
  { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
679
679
  ]);
680
- const taskIds = chunk4SEIDMF6_cjs.numericIds(
680
+ const taskIds = chunkVDYUG6RK_cjs.numericIds(
681
681
  tasks.value?.items ?? [],
682
682
  "id"
683
- ).slice(0, chunk4SEIDMF6_cjs.IN_FILTER_CAP);
684
- const resourceAssignments = taskIds.length === 0 ? { value: null, absent: "NO_TASKS" } : await chunk4SEIDMF6_cjs.compositePart(client, "service_call_task_resources.query", [
683
+ ).slice(0, chunkVDYUG6RK_cjs.IN_FILTER_CAP);
684
+ const resourceAssignments = taskIds.length === 0 ? { value: null, absent: "NO_TASKS" } : await chunkVDYUG6RK_cjs.compositePart(client, "service_call_task_resources.query", [
685
685
  { filter: [{ field: "serviceCallTaskID", op: "in", value: taskIds }], limit: taskLimit }
686
686
  ]);
687
687
  return {
@@ -695,7 +695,7 @@ async function fullProfile2(resource, id, opts = {}) {
695
695
  }
696
696
 
697
697
  // src/resources/service_calls.ts
698
- var ServiceCallsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
698
+ var ServiceCallsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
699
699
  constructor(http, pageSize) {
700
700
  super(http, {
701
701
  key: "service_calls",
@@ -717,13 +717,13 @@ var OP3 = "ticket_charges.moveToTicket";
717
717
  var COPY = ["name", "description", "chargeType", "billingCodeID", "productID", "unitQuantity", "unitCost", "unitPrice", "datePurchased", "isBillableToCompany", "notes", "purchaseOrderNumber", "internalPurchaseOrderNumber"];
718
718
  var CONTRACT_SCOPED = ["contractServiceID", "contractServiceBundleID"];
719
719
  async function readCharge(http, id, retries) {
720
- const rows = await chunk4SEIDMF6_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
720
+ const rows = await chunkVDYUG6RK_cjs.queryRows(http, "TicketCharges", [{ field: "id", op: "eq", value: id }], OP3, retries);
721
721
  return rows[0] ?? null;
722
722
  }
723
723
  async function checkSource({ http, source, sourceId, sourceTicketId, toTicketId }) {
724
724
  if (source.isBilled === true) {
725
- throw chunk4SEIDMF6_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: chunk4SEIDMF6_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
725
+ throw chunkVDYUG6RK_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: chunkVDYUG6RK_cjs.uiLinkFor(http, "tickets", sourceTicketId), reason: "billed charges are not moved by the API (the ticket link opens its charges)" }
727
727
  });
728
728
  }
729
729
  }
@@ -757,14 +757,14 @@ var SPEC = {
757
757
  ]
758
758
  }),
759
759
  // charges have no ExecuteCommand code: the parent ticket is the closest clickable target
760
- manualLink: (http, source) => typeof source.ticketID === "number" ? chunk4SEIDMF6_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
760
+ manualLink: (http, source) => typeof source.ticketID === "number" ? chunkVDYUG6RK_cjs.uiLinkFor(http, "tickets", source.ticketID) : null
761
761
  };
762
762
  function moveToTicket(resource, sourceId, toTicketId, opts) {
763
- return chunk4SEIDMF6_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
763
+ return chunkVDYUG6RK_cjs.runMove(resource.http, SPEC, sourceId, toTicketId, opts);
764
764
  }
765
765
 
766
766
  // src/resources/ticket_charges.ts
767
- var TicketChargesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
767
+ var TicketChargesResource = class extends chunkVDYUG6RK_cjs.GenericResource {
768
768
  constructor(http, pageSize) {
769
769
  super(http, {
770
770
  key: "ticket_charges",
@@ -789,7 +789,7 @@ var TicketChargesResource = class extends chunk4SEIDMF6_cjs.GenericResource {
789
789
  };
790
790
 
791
791
  // src/resources/special/tickets/errors.ts
792
- var StatusUnknownError = class extends chunk4SEIDMF6_cjs.AutotaskError {
792
+ var StatusUnknownError = class extends chunkVDYUG6RK_cjs.AutotaskError {
793
793
  /** The live picklist size (the message names it; the values + labels are via operations.fieldCatalog with labels: true). */
794
794
  picklistCount;
795
795
  constructor(message, options = {}) {
@@ -803,7 +803,7 @@ var StatusUnknownError = class extends chunk4SEIDMF6_cjs.AutotaskError {
803
803
  this.picklistCount = options.picklistCount ?? 0;
804
804
  }
805
805
  };
806
- var StatusFieldsRequiredError = class extends chunk4SEIDMF6_cjs.AutotaskError {
806
+ var StatusFieldsRequiredError = class extends chunkVDYUG6RK_cjs.AutotaskError {
807
807
  vendorFields;
808
808
  currentStatus;
809
809
  targetStatus;
@@ -825,8 +825,8 @@ function isPositiveInt(v) {
825
825
  return typeof v === "number" && Number.isInteger(v) && v > 0;
826
826
  }
827
827
  function namedVendorFields(err) {
828
- if (!chunk4SEIDMF6_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
829
- const entries = chunk4SEIDMF6_cjs.parseVendorErrors(err.vendorError) ?? [];
828
+ if (!chunkVDYUG6RK_cjs.isAutotaskError(err) || err.vendorError === void 0) return [];
829
+ const entries = chunkVDYUG6RK_cjs.parseVendorErrors(err.vendorError) ?? [];
830
830
  const out = /* @__PURE__ */ new Set();
831
831
  for (const e of entries) if (e.field !== void 0) out.add(e.field);
832
832
  return [...out];
@@ -845,8 +845,8 @@ function unwrapItemOrNull(res) {
845
845
  return body.item;
846
846
  }
847
847
  function discoveryMerge(err, body, defaults) {
848
- if (!chunk4SEIDMF6_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
849
- const entries = chunk4SEIDMF6_cjs.parseVendorErrors(err.vendorError);
848
+ if (!chunkVDYUG6RK_cjs.isAutotaskError(err) || err.vendorError === void 0) return null;
849
+ const entries = chunkVDYUG6RK_cjs.parseVendorErrors(err.vendorError);
850
850
  if (entries === void 0) return null;
851
851
  for (const entry of entries) {
852
852
  const field = entry.field;
@@ -881,7 +881,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
881
881
  const ids = await readLiveStatusSet(resource);
882
882
  if (ids.size > 0) liveStatus = ids;
883
883
  } catch (err) {
884
- if (!chunk4SEIDMF6_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
884
+ if (!chunkVDYUG6RK_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
885
885
  }
886
886
  if (liveStatus !== null && !liveStatus.has(targetStatus)) {
887
887
  http.fieldCache?.invalidate("tickets:");
@@ -891,7 +891,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
891
891
  const freshIds = await readLiveStatusSet(resource);
892
892
  if (freshIds.size > 0) freshStatus = freshIds;
893
893
  } catch (err) {
894
- if (!chunk4SEIDMF6_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
894
+ if (!chunkVDYUG6RK_cjs.isAutotaskError(err) || err.code === "ABORTED") throw err;
895
895
  freshStatus = null;
896
896
  reReadFailed = true;
897
897
  }
@@ -909,7 +909,7 @@ async function guardTargetStatus(resource, http, targetStatus) {
909
909
  return { guardDegraded: liveStatus === null };
910
910
  }
911
911
  function noChangeDryRun(http, ticketId, targetStatus, guardDegraded) {
912
- return chunk4SEIDMF6_cjs.buildDryRunResult(
912
+ return chunkVDYUG6RK_cjs.buildDryRunResult(
913
913
  {
914
914
  operation: OP_STATUS,
915
915
  method: "PUT",
@@ -963,7 +963,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
963
963
  if (mapEntry === void 0) {
964
964
  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
965
  }
966
- return chunk4SEIDMF6_cjs.buildDryRunResult(
966
+ return chunkVDYUG6RK_cjs.buildDryRunResult(
967
967
  {
968
968
  operation: OP_STATUS,
969
969
  method: "PUT",
@@ -983,7 +983,7 @@ function mergeDryRun(http, ticketId, targetStatus, guardDegraded, filled, mapEnt
983
983
  }
984
984
  async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStatus, current, mergeData, mapEntry, filled, opts) {
985
985
  const safeDefaults = mapEntry?.safeDefaults ?? {};
986
- const body = chunk4SEIDMF6_cjs.mergePartialBody(current, mergeData);
986
+ const body = chunkVDYUG6RK_cjs.mergePartialBody(current, mergeData);
987
987
  body.id = ticketId;
988
988
  let merges = 0;
989
989
  for (; ; ) {
@@ -1007,8 +1007,8 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1007
1007
  { vendorFields: named, currentStatus: previousStatus, targetStatus, currentValues },
1008
1008
  {
1009
1009
  operation: OP_STATUS,
1010
- httpStatus: chunk4SEIDMF6_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1011
- vendorError: chunk4SEIDMF6_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1010
+ httpStatus: chunkVDYUG6RK_cjs.isAutotaskError(err) ? err.httpStatus : void 0,
1011
+ vendorError: chunkVDYUG6RK_cjs.isAutotaskError(err) ? err.vendorError : void 0,
1012
1012
  resourceIds: [ticketId],
1013
1013
  details: { idRefs: [{ entity: "ticket", id: ticketId }] }
1014
1014
  }
@@ -1021,7 +1021,7 @@ async function putStatusWithDiscovery(http, ticketId, targetStatus, previousStat
1021
1021
  async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1022
1022
  const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1023
1023
  if (verify === null) {
1024
- throw new chunk4SEIDMF6_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1024
+ throw new chunkVDYUG6RK_cjs.AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
1025
1025
  code: "INVALID_RESPONSE",
1026
1026
  category: "server",
1027
1027
  operation: OP_STATUS,
@@ -1031,7 +1031,7 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1031
1031
  }
1032
1032
  const finalStatus = typeof verify.status === "number" ? verify.status : null;
1033
1033
  if (finalStatus !== targetStatus) {
1034
- throw new chunk4SEIDMF6_cjs.AutotaskError(
1034
+ throw new chunkVDYUG6RK_cjs.AutotaskError(
1035
1035
  `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
1036
  {
1037
1037
  code: "INVALID_RESPONSE",
@@ -1047,17 +1047,17 @@ async function verifyStatusApplied(http, ticketId, targetStatus, opts) {
1047
1047
  }
1048
1048
  async function changeStatus(resource, id, targetStatus, fields, opts) {
1049
1049
  const http = resource.http;
1050
- const ticketId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1050
+ const ticketId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1051
1051
  if (!isPositiveInt(targetStatus)) {
1052
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1052
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`changeStatus: targetStatus must be a positive integer (got ${String(targetStatus)})`, { operation: OP_STATUS });
1053
1053
  }
1054
1054
  const { guardDegraded } = await guardTargetStatus(resource, http, targetStatus);
1055
1055
  if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
1056
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1056
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
1057
1057
  }
1058
1058
  const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
1059
1059
  if (current === null) {
1060
- throw new chunk4SEIDMF6_cjs.NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId], details: { idRefs: [{ entity: "ticket", id: ticketId }] } });
1060
+ throw new chunkVDYUG6RK_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
1061
  }
1062
1062
  const previousStatus = typeof current.status === "number" ? current.status : null;
1063
1063
  if (previousStatus === targetStatus) {
@@ -1083,7 +1083,7 @@ var TICKET_FIELDS = ["id", "ticketNumber", "title", "status", "assignedResourceI
1083
1083
  function positiveId(value, name) {
1084
1084
  const n = typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : value;
1085
1085
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1086
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1086
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: ${name} must be a positive integer id (got ${String(value)})`, { operation: OP4 });
1087
1087
  }
1088
1088
  return n;
1089
1089
  }
@@ -1095,7 +1095,7 @@ async function ticketPage(http, filter, maxRecords, fields) {
1095
1095
  body: { MaxRecords: maxRecords, filter, IncludeFields: fields },
1096
1096
  operation: OP4
1097
1097
  });
1098
- const page = chunk4SEIDMF6_cjs.unwrapItems(res, OP4);
1098
+ const page = chunkVDYUG6RK_cjs.unwrapItems(res, OP4);
1099
1099
  return { rows: page.items, more: page.pageDetails.nextPageUrl !== null };
1100
1100
  }
1101
1101
  async function readLinkIds(http, resourceID, maxPages = 1) {
@@ -1105,11 +1105,11 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1105
1105
  const res = await http.request({
1106
1106
  method: "POST",
1107
1107
  idempotent: true,
1108
- path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunk4SEIDMF6_cjs.cursorToPath(http.baseUrl, cursor),
1108
+ path: cursor === null ? "/V1.0/TicketSecondaryResources/query" : chunkVDYUG6RK_cjs.cursorToPath(http.baseUrl, cursor),
1109
1109
  body: { MaxRecords: LINK_READ_CAP, filter: [{ field: "resourceID", op: "eq", value: resourceID }], IncludeFields: ["ticketID"] },
1110
1110
  operation: OP4
1111
1111
  });
1112
- const page = chunk4SEIDMF6_cjs.unwrapItems(res, OP4);
1112
+ const page = chunkVDYUG6RK_cjs.unwrapItems(res, OP4);
1113
1113
  for (const row of page.items) if (typeof row.ticketID === "number") ids.add(row.ticketID);
1114
1114
  cursor = page.pageDetails.nextPageUrl;
1115
1115
  if (cursor === null || page.items.length === 0) return { ids: [...ids], capped: false };
@@ -1118,35 +1118,35 @@ async function readLinkIds(http, resourceID, maxPages = 1) {
1118
1118
  }
1119
1119
  async function forResource(_resource, resourceIDIn, opts = {}) {
1120
1120
  const http = _resource.http;
1121
- if (opts === null || typeof opts !== "object") throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1121
+ if (opts === null || typeof opts !== "object") throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: opts must be an object`, { operation: OP4 });
1122
1122
  const resourceID = positiveId(resourceIDIn, "resourceID");
1123
1123
  const scope = opts.scope ?? "both";
1124
1124
  if (scope !== "primary" && scope !== "secondary" && scope !== "both") {
1125
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1125
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: scope must be 'primary', 'secondary' or 'both' (got ${JSON.stringify(opts.scope)})`, { operation: OP4 });
1126
1126
  }
1127
1127
  if (opts.openOnly !== void 0 && typeof opts.openOnly !== "boolean") {
1128
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1128
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: openOnly must be a boolean`, { operation: OP4 });
1129
1129
  }
1130
1130
  const limit = opts.limit === void 0 ? LIMIT_DEFAULT : opts.limit;
1131
1131
  if (opts.countOnly !== true && (!Number.isInteger(limit) || limit < 1 || limit > LIMIT_MAX)) {
1132
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1132
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: limit must be an integer 1-${LIMIT_MAX} (got ${String(opts.limit)})`, { operation: OP4 });
1133
1133
  }
1134
1134
  const includeFields = opts.includeFields ?? [];
1135
1135
  if (!Array.isArray(includeFields) || includeFields.some((f) => typeof f !== "string" || f.length === 0)) {
1136
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1136
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: includeFields must be a list of field names`, { operation: OP4 });
1137
1137
  }
1138
1138
  const openOnly = opts.openOnly === true;
1139
1139
  const fields = [.../* @__PURE__ */ new Set([...TICKET_FIELDS, ...includeFields])];
1140
1140
  if (opts.countOnly !== void 0 && typeof opts.countOnly !== "boolean") {
1141
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1141
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`${OP4}: countOnly must be a boolean`, { operation: OP4 });
1142
1142
  }
1143
- const closed = await chunk4SEIDMF6_cjs.resolveTicketStatusSemantics(
1143
+ const closed = await chunkVDYUG6RK_cjs.resolveTicketStatusSemantics(
1144
1144
  http,
1145
1145
  { ...opts.excludeStatusIds === void 0 ? {} : { excludeStatusIds: opts.excludeStatusIds }, ...opts.allowAssumed === void 0 ? {} : { allowAssumed: opts.allowAssumed } },
1146
1146
  OP4
1147
1147
  );
1148
1148
  const closedStatus = { closedIds: closed.closedIds, source: closed.source, note: closed.note };
1149
- const openLeaf = openOnly || opts.countOnly === true ? [chunk4SEIDMF6_cjs.openStatusFilter(closed.closedIds)] : [];
1149
+ const openLeaf = openOnly || opts.countOnly === true ? [chunkVDYUG6RK_cjs.openStatusFilter(closed.closedIds)] : [];
1150
1150
  if (opts.countOnly === true) {
1151
1151
  const primaryCount = scope === "secondary" ? 0 : await _resource.count({ filter: [{ field: "assignedResourceID", op: "eq", value: resourceID }, ...openLeaf] });
1152
1152
  let secondaryCount = 0;
@@ -1160,7 +1160,7 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1160
1160
  const page = await ticketPage(http, [{ field: "id", op: "in", value: chunk }, ...openLeaf], chunk.length, ["id", "status", "assignedResourceID"]);
1161
1161
  const seen = /* @__PURE__ */ new Set();
1162
1162
  for (const t of page.rows) {
1163
- if (typeof t.id !== "number" || seen.has(t.id) || chunk4SEIDMF6_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1163
+ if (typeof t.id !== "number" || seen.has(t.id) || chunkVDYUG6RK_cjs.isClosedStatus(t.status, closed.closedIds)) continue;
1164
1164
  seen.add(t.id);
1165
1165
  if (scope === "both" && t.assignedResourceID === resourceID) bothCount++;
1166
1166
  }
@@ -1206,13 +1206,13 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1206
1206
  for (const [id, t] of primary) merged.set(id, t);
1207
1207
  for (const [id, t] of secondary) if (!merged.has(id)) merged.set(id, t);
1208
1208
  let tickets = [...merged.values()];
1209
- if (openOnly) tickets = tickets.filter((t) => !chunk4SEIDMF6_cjs.isClosedStatus(t.status, closed.closedIds));
1209
+ if (openOnly) tickets = tickets.filter((t) => !chunkVDYUG6RK_cjs.isClosedStatus(t.status, closed.closedIds));
1210
1210
  tickets.sort((a, b) => Number(a.id) - Number(b.id));
1211
1211
  if (tickets.length > limit) {
1212
1212
  tickets = tickets.slice(0, limit);
1213
1213
  capped = true;
1214
1214
  }
1215
- const openCount = tickets.filter((t) => !chunk4SEIDMF6_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1215
+ const openCount = tickets.filter((t) => !chunkVDYUG6RK_cjs.isClosedStatus(t.status, closed.closedIds)).length;
1216
1216
  const primaryIds = [...primary.keys()].sort((a, b) => a - b);
1217
1217
  const secondaryIds = [...secondary.keys()].sort((a, b) => a - b);
1218
1218
  const both = primaryIds.filter((id) => secondary.has(id));
@@ -1240,9 +1240,9 @@ async function fetchTicket(http, id, operation) {
1240
1240
  });
1241
1241
  const body = res;
1242
1242
  if (body === null || !("item" in body)) {
1243
- throw new chunk4SEIDMF6_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1243
+ throw new chunkVDYUG6RK_cjs.NotFoundError(`Ticket ${id} not found (unexpected envelope shape)`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1244
1244
  }
1245
- if (body.item === null || body.item === void 0) throw new chunk4SEIDMF6_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1245
+ if (body.item === null || body.item === void 0) throw new chunkVDYUG6RK_cjs.NotFoundError(`Ticket ${id} not found`, { resourceIds: [id], details: { idRefs: [{ entity: "ticket", id }] } });
1246
1246
  return body.item;
1247
1247
  }
1248
1248
  async function ticketQueryItems(http, path, filter, maxRecords, operation) {
@@ -1253,7 +1253,7 @@ async function ticketQueryItems(http, path, filter, maxRecords, operation) {
1253
1253
  body: { MaxRecords: maxRecords, filter },
1254
1254
  operation
1255
1255
  });
1256
- return chunk4SEIDMF6_cjs.unwrapItems(res).items;
1256
+ return chunkVDYUG6RK_cjs.unwrapItems(res).items;
1257
1257
  }
1258
1258
  function truncate(text, limit) {
1259
1259
  const full = text ?? "";
@@ -1263,27 +1263,27 @@ function truncate(text, limit) {
1263
1263
 
1264
1264
  // src/resources/special/tickets/childRead.ts
1265
1265
  function isRouteUnavailable(err) {
1266
- return chunk4SEIDMF6_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1266
+ return chunkVDYUG6RK_cjs.isAutotaskError(err) && (err.httpStatus === 404 || err.httpStatus === 500);
1267
1267
  }
1268
1268
  function routeFact(route, path, err) {
1269
1269
  return {
1270
1270
  route,
1271
1271
  path,
1272
- httpStatus: chunk4SEIDMF6_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1272
+ httpStatus: chunkVDYUG6RK_cjs.isAutotaskError(err) && typeof err.httpStatus === "number" ? err.httpStatus : null
1273
1273
  };
1274
1274
  }
1275
1275
  async function childDeclaresQuery(resourceKey) {
1276
- const records = await chunkTE7RUKU2_cjs.loadCapabilityRecords();
1276
+ const records = await chunkODPM4YVG_cjs.loadCapabilityRecords();
1277
1277
  return records.some(
1278
1278
  (c) => c.id === `${resourceKey}.query` && (c.status === "implemented" || c.status === "tested")
1279
1279
  );
1280
1280
  }
1281
1281
  async function planScopedPath(resourceKey, ticketId) {
1282
1282
  if (!await childDeclaresQuery(resourceKey)) return null;
1283
- const entry = chunk4SEIDMF6_cjs.RELATIONSHIP_MAP[resourceKey];
1283
+ const entry = chunkVDYUG6RK_cjs.RELATIONSHIP_MAP[resourceKey];
1284
1284
  const parent = entry === void 0 ? null : entry.parent;
1285
1285
  if (parent === null || parent.resource !== "tickets" || parent.segment === null || parent.field === null) return null;
1286
- const parentPath = chunk4SEIDMF6_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1286
+ const parentPath = chunkVDYUG6RK_cjs.RELATIONSHIP_MAP[parent.resource]?.path;
1287
1287
  if (parentPath === null || parentPath === void 0) return null;
1288
1288
  return `/V1.0/${parentPath}/${ticketId}/${parent.segment}`;
1289
1289
  }
@@ -1322,14 +1322,14 @@ async function scopedCollectionRead(http, startPath, limit, operation, accept) {
1322
1322
  break;
1323
1323
  }
1324
1324
  const body = await http.request({ method: "GET", path: target, operation });
1325
- const { items: pageItems, pageDetails } = chunk4SEIDMF6_cjs.unwrapItems(body, operation);
1325
+ const { items: pageItems, pageDetails } = chunkVDYUG6RK_cjs.unwrapItems(body, operation);
1326
1326
  nextCursor = pageDetails.nextPageUrl;
1327
1327
  pages += 1;
1328
1328
  const window = pageItems.slice(0, Math.max(0, limit - items.length));
1329
1329
  for (const row of window) if (accept(row)) items.push(row);
1330
1330
  if (items.length >= limit) break;
1331
1331
  if (nextCursor === null || pageItems.length === 0) break;
1332
- target = chunk4SEIDMF6_cjs.cursorToPath(http.baseUrl, nextCursor);
1332
+ target = chunkVDYUG6RK_cjs.cursorToPath(http.baseUrl, nextCursor);
1333
1333
  }
1334
1334
  const capped = items.length >= limit || guard && nextCursor !== null;
1335
1335
  return { items, capped };
@@ -1362,7 +1362,7 @@ var DEFAULT_PART_LIMIT = 50;
1362
1362
  function partLimit(value, name) {
1363
1363
  const n = value === void 0 ? DEFAULT_PART_LIMIT : Math.trunc(value);
1364
1364
  if (!Number.isInteger(n) || n < 1) {
1365
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1365
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`fullContext: ${name} must be an integer >= 1 (got ${String(value)})`);
1366
1366
  }
1367
1367
  return n;
1368
1368
  }
@@ -1375,13 +1375,13 @@ function servedTextRecord(row, textField, limit) {
1375
1375
  return out;
1376
1376
  }
1377
1377
  async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1378
- const builder = chunk4SEIDMF6_cjs.createNamePlan(chunk4SEIDMF6_cjs.TICKET_LABEL_FIELDS);
1378
+ const builder = chunkVDYUG6RK_cjs.createNamePlan(chunkVDYUG6RK_cjs.TICKET_LABEL_FIELDS);
1379
1379
  const t = ctx.ticket;
1380
1380
  builder.addResource(t["creatorResourceID"]);
1381
1381
  builder.addFk("contract", t["contractID"]);
1382
1382
  builder.addFk("billingCode", t["billingCodeID"]);
1383
1383
  builder.addFk("role", t["assignedResourceRoleID"]);
1384
- const ticketLobPointer = chunk4SEIDMF6_cjs.vendorId(t["organizationalLevelAssociationID"]);
1384
+ const ticketLobPointer = chunkVDYUG6RK_cjs.vendorId(t["organizationalLevelAssociationID"]);
1385
1385
  if (ticketLobPointer !== void 0) {
1386
1386
  builder.addLineOfBusiness(ticketLobPointer, { source: "ticket" });
1387
1387
  } else {
@@ -1393,20 +1393,20 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1393
1393
  builder.addFk("billingCode", e["billingCodeID"]);
1394
1394
  builder.addFk("contract", e["contractID"]);
1395
1395
  }
1396
- const names = await chunk4SEIDMF6_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1396
+ const names = await chunkVDYUG6RK_cjs.resolveCompositeNames(http, builder.plan(), { maxNameReads: opts.maxNameReads });
1397
1397
  const ticketRow = { ...ctx.ticket };
1398
- chunk4SEIDMF6_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1399
- chunk4SEIDMF6_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1400
- chunk4SEIDMF6_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1401
- chunk4SEIDMF6_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1402
- for (const f of chunk4SEIDMF6_cjs.TICKET_LABEL_FIELDS) chunk4SEIDMF6_cjs.addLabelSibling(ticketRow, f, names);
1398
+ chunkVDYUG6RK_cjs.addNameSibling(ticketRow, "creatorResourceID", (v) => names.resourceName(v));
1399
+ chunkVDYUG6RK_cjs.addNameSibling(ticketRow, "contractID", (v) => names.recordName("contract", v));
1400
+ chunkVDYUG6RK_cjs.addNameSibling(ticketRow, "billingCodeID", (v) => names.recordName("billingCode", v));
1401
+ chunkVDYUG6RK_cjs.addNameSibling(ticketRow, "assignedResourceRoleID", (v) => names.recordName("role", v));
1402
+ for (const f of chunkVDYUG6RK_cjs.TICKET_LABEL_FIELDS) chunkVDYUG6RK_cjs.addLabelSibling(ticketRow, f, names);
1403
1403
  result.ticket = ticketRow;
1404
1404
  result.timeEntries.items = entriesPart.items.map((e) => {
1405
1405
  const row = { ...e };
1406
- chunk4SEIDMF6_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1407
- chunk4SEIDMF6_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1408
- chunk4SEIDMF6_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1409
- chunk4SEIDMF6_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1406
+ chunkVDYUG6RK_cjs.addNameSibling(row, "resourceID", (v) => names.resourceName(v));
1407
+ chunkVDYUG6RK_cjs.addNameSibling(row, "roleID", (v) => names.recordName("role", v));
1408
+ chunkVDYUG6RK_cjs.addNameSibling(row, "billingCodeID", (v) => names.recordName("billingCode", v));
1409
+ chunkVDYUG6RK_cjs.addNameSibling(row, "contractID", (v) => names.recordName("contract", v));
1410
1410
  return row;
1411
1411
  });
1412
1412
  result.names = names.section;
@@ -1423,7 +1423,7 @@ async function fullContext(resource, id, opts = {}) {
1423
1423
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
1424
1424
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
1425
1425
  const textLimit = partLimit(opts.textLimit, "textLimit");
1426
- const ticketId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1426
+ const ticketId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1427
1427
  const ctx = await resource.getContext(ticketId);
1428
1428
  const op = "tickets.fullContext";
1429
1429
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1485,7 +1485,7 @@ var OP5 = "tickets.lineOfBusiness";
1485
1485
  function positiveId2(value, name) {
1486
1486
  const n = typeof value === "string" && /^[0-9]+$/.test(value.trim()) ? Number(value) : value;
1487
1487
  if (typeof n !== "number" || !Number.isSafeInteger(n) || n < 1) {
1488
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1488
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(OP5 + ": " + name + " must be a positive integer id (got " + String(value) + ")", { operation: OP5 });
1489
1489
  }
1490
1490
  return n;
1491
1491
  }
@@ -1501,25 +1501,25 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1501
1501
  associationSource = "argument";
1502
1502
  } else {
1503
1503
  const ticket = await resource.get(ticketId);
1504
- associationId = chunk4SEIDMF6_cjs.vendorId(ticket.organizationalLevelAssociationID);
1504
+ associationId = chunkVDYUG6RK_cjs.vendorId(ticket.organizationalLevelAssociationID);
1505
1505
  if (associationId !== void 0) {
1506
1506
  associationSource = "ticket";
1507
1507
  } else {
1508
- const contractRef = chunk4SEIDMF6_cjs.vendorId(ticket.contractID);
1508
+ const contractRef = chunkVDYUG6RK_cjs.vendorId(ticket.contractID);
1509
1509
  if (contractRef !== void 0) {
1510
1510
  const client = http.client;
1511
1511
  if (client === void 0) {
1512
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1512
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(OP5 + ": the transport is not wired to an AutotaskClient (the composite must run through the client)", { operation: OP5 });
1513
1513
  }
1514
1514
  try {
1515
1515
  const contract = await client.contracts.get(contractRef);
1516
1516
  contractId = contractRef;
1517
- associationId = chunk4SEIDMF6_cjs.vendorId(contract.organizationalLevelAssociationID);
1517
+ associationId = chunkVDYUG6RK_cjs.vendorId(contract.organizationalLevelAssociationID);
1518
1518
  if (associationId !== void 0) associationSource = "contract";
1519
1519
  } catch (e) {
1520
- if (e instanceof chunk4SEIDMF6_cjs.NotFoundError) {
1520
+ if (e instanceof chunkVDYUG6RK_cjs.NotFoundError) {
1521
1521
  contractId = contractRef;
1522
- } else if (chunk4SEIDMF6_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1522
+ } else if (chunkVDYUG6RK_cjs.isAutotaskError(e) && e.code !== "ABORTED") {
1523
1523
  contractId = contractRef;
1524
1524
  contractUnread = true;
1525
1525
  } else {
@@ -1540,7 +1540,7 @@ async function lineOfBusiness(resource, ticketIdIn, associationIdIn) {
1540
1540
  markers: { association: contractUnread ? "unresolved" : "missing", organizationalLevel2: "missing", organizationalLevel1: "missing" }
1541
1541
  };
1542
1542
  }
1543
- const chain = await chunk4SEIDMF6_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1543
+ const chain = await chunkVDYUG6RK_cjs.resolveLineOfBusinessChain(http, associationId, { budget: 3, operation: OP5, onError: "propagate" });
1544
1544
  const { association, organizationalLevel2, organizationalLevel1, markers } = chain.lineOfBusiness;
1545
1545
  return { ticketId, associationSource, contractId, association, organizationalLevel2, organizationalLevel1, markers };
1546
1546
  }
@@ -1550,7 +1550,7 @@ var MS = 864e5;
1550
1550
  var SLA_PAGE = 100;
1551
1551
  async function slaHealthCheck(_resource, id, opts = {}) {
1552
1552
  const http = _resource.http;
1553
- const ticketId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1553
+ const ticketId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1554
1554
  await fetchTicket(http, ticketId, "tickets.slaHealthCheck");
1555
1555
  const rows = await ticketQueryItems(
1556
1556
  http,
@@ -1576,9 +1576,9 @@ async function summary(_resource, id, opts = {}) {
1576
1576
  const http = _resource.http;
1577
1577
  const limit = opts.summaryTextLimit === void 0 ? 500 : Math.trunc(opts.summaryTextLimit);
1578
1578
  if (!Number.isInteger(limit) || limit < 1) {
1579
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1579
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`summaryTextLimit must be an integer >= 1 (got ${String(opts.summaryTextLimit)})`);
1580
1580
  }
1581
- const ticketId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1581
+ const ticketId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1582
1582
  const ticket = await fetchTicket(http, ticketId, "tickets.summary");
1583
1583
  const desc = truncate(ticket.description, limit);
1584
1584
  const now = opts.now ?? /* @__PURE__ */ new Date();
@@ -1607,17 +1607,17 @@ async function summary(_resource, id, opts = {}) {
1607
1607
  // src/resources/special/tickets/statusSemantics.ts
1608
1608
  async function statusSemantics(_resource, opts = {}) {
1609
1609
  const http = _resource.http;
1610
- return chunk4SEIDMF6_cjs.resolveTicketStatusSemantics(http, opts);
1610
+ return chunkVDYUG6RK_cjs.resolveTicketStatusSemantics(http, opts);
1611
1611
  }
1612
1612
 
1613
1613
  // src/resources/special/tickets/timeline.ts
1614
1614
  function validateTimelineLimits(opts) {
1615
1615
  const limit = opts.limit === void 0 ? 100 : Math.trunc(opts.limit);
1616
- if (!Number.isInteger(limit) || limit < 1) throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1616
+ if (!Number.isInteger(limit) || limit < 1) throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`limit must be an integer >= 1 (got ${String(opts.limit)})`);
1617
1617
  const bounded = Math.min(limit, 500);
1618
1618
  const textLimit = opts.textLimit === void 0 ? 500 : Math.trunc(opts.textLimit);
1619
1619
  if (!Number.isInteger(textLimit) || textLimit < 1) {
1620
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1620
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError(`textLimit must be an integer >= 1 (got ${String(opts.textLimit)})`);
1621
1621
  }
1622
1622
  return { bounded, textLimit };
1623
1623
  }
@@ -1670,7 +1670,7 @@ function compareEventDates(a, b) {
1670
1670
  async function timeline(_resource, id, opts = {}) {
1671
1671
  const http = _resource.http;
1672
1672
  const { bounded, textLimit } = validateTimelineLimits(opts);
1673
- const ticketId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1673
+ const ticketId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1674
1674
  await fetchTicket(http, ticketId, "tickets.timeline");
1675
1675
  const dateFilters = (field) => {
1676
1676
  const f = [{ field: "ticketID", op: "eq", value: ticketId }];
@@ -1710,7 +1710,7 @@ async function timeline(_resource, id, opts = {}) {
1710
1710
  }
1711
1711
 
1712
1712
  // src/resources/tickets.ts
1713
- var TicketsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
1713
+ var TicketsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
1714
1714
  constructor(http, pageSize) {
1715
1715
  super(http, {
1716
1716
  key: "tickets",
@@ -1779,9 +1779,9 @@ var TicketsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
1779
1779
  // src/resources/special/time_off_requests.ts
1780
1780
  async function approve(_resource, id, opts = {}) {
1781
1781
  const http = _resource.http;
1782
- const numericId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1782
+ const numericId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1783
1783
  if (opts.dryRun === true) {
1784
- return chunk4SEIDMF6_cjs.buildDryRunResult({
1784
+ return chunkVDYUG6RK_cjs.buildDryRunResult({
1785
1785
  operation: "time_off_requests.approve",
1786
1786
  method: "GET",
1787
1787
  path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
@@ -1797,17 +1797,17 @@ async function approve(_resource, id, opts = {}) {
1797
1797
  operation: "time_off_requests.approve",
1798
1798
  maxRetries: opts.maxRetries
1799
1799
  });
1800
- return chunk4SEIDMF6_cjs.unwrapOperation(res);
1800
+ return chunkVDYUG6RK_cjs.unwrapOperation(res);
1801
1801
  }
1802
1802
  async function reject(_resource, id, reason, opts = {}) {
1803
1803
  const http = _resource.http;
1804
- const numericId = chunk4SEIDMF6_cjs.parseIdentifier(id, "id");
1804
+ const numericId = chunkVDYUG6RK_cjs.parseIdentifier(id, "id");
1805
1805
  const text = reason.trim();
1806
1806
  if (text === "") {
1807
- throw new chunk4SEIDMF6_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1807
+ throw new chunkVDYUG6RK_cjs.AutotaskConfigError("reject: a non-empty reason is required (vendor TimeOffRequestRejectModel)");
1808
1808
  }
1809
1809
  if (opts.dryRun === true) {
1810
- return chunk4SEIDMF6_cjs.buildDryRunResult({
1810
+ return chunkVDYUG6RK_cjs.buildDryRunResult({
1811
1811
  operation: "time_off_requests.reject",
1812
1812
  method: "POST",
1813
1813
  path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
@@ -1825,11 +1825,11 @@ async function reject(_resource, id, reason, opts = {}) {
1825
1825
  operation: "time_off_requests.reject",
1826
1826
  maxRetries: opts.maxRetries
1827
1827
  });
1828
- return chunk4SEIDMF6_cjs.unwrapOperation(res);
1828
+ return chunkVDYUG6RK_cjs.unwrapOperation(res);
1829
1829
  }
1830
1830
 
1831
1831
  // src/resources/time_off_requests.ts
1832
- var TimeOffRequestsResource = class extends chunk4SEIDMF6_cjs.GenericResource {
1832
+ var TimeOffRequestsResource = class extends chunkVDYUG6RK_cjs.GenericResource {
1833
1833
  constructor(http, pageSize) {
1834
1834
  super(http, {
1835
1835
  key: "time_off_requests",