node-autotask 0.68.1 → 0.69.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/MCP_TOOL_CATALOG.json +2 -2
  3. package/README.md +51 -10
  4. package/capabilities.json +7 -7
  5. package/dist/capabilities-data.js +6 -6
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-LOLWHPTJ.js → chunk-64BMSXWT.js} +3 -30
  9. package/dist/{chunk-XKIRTR37.cjs → chunk-CLHDTYWO.cjs} +1405 -488
  10. package/dist/{chunk-2D2KJOX2.cjs → chunk-EWXRFHPP.cjs} +236 -222
  11. package/dist/{chunk-YYHCZRUH.js → chunk-FK37JXSJ.js} +1398 -483
  12. package/dist/{chunk-SGH7F2CH.cjs → chunk-KAZE4WC7.cjs} +3 -3
  13. package/dist/{chunk-S6HEIGGM.js → chunk-MMGO3SFL.js} +80 -66
  14. package/dist/{chunk-JCMXQUIC.js → chunk-SCFB5MF3.js} +3 -3
  15. package/dist/{chunk-KRQONGLD.cjs → chunk-WFVLF7EW.cjs} +30 -57
  16. package/dist/{index-mIsdpO5d.d.cts → index-BT_0tTPS.d.cts} +19 -12
  17. package/dist/{index-DQ08uOH0.d.ts → index-Coe7LFLY.d.ts} +19 -12
  18. package/dist/index.cjs +92 -85
  19. package/dist/index.d.cts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +14 -7
  22. package/dist/operations/index.cjs +50 -50
  23. package/dist/operations/index.d.cts +2 -2
  24. package/dist/operations/index.d.ts +2 -2
  25. package/dist/operations/index.js +2 -2
  26. package/dist/pool.cjs +12 -12
  27. package/dist/pool.js +4 -4
  28. package/dist/resources/index.cjs +27 -27
  29. package/dist/resources/index.d.cts +1 -1
  30. package/dist/resources/index.d.ts +1 -1
  31. package/dist/resources/index.js +3 -3
  32. package/docs/API.md +85 -16
  33. package/docs/LIVE-TESTING.md +16 -2
  34. package/docs/VENDOR-QUIRKS.md +39 -0
  35. package/docs/performance-finance.md +35 -0
  36. package/docs/performance-reads.md +63 -0
  37. package/examples/mcp-env-config.ts +3 -4
  38. package/package.json +1 -1
@@ -2,9 +2,9 @@
2
2
 
3
3
  // src/capabilities.ts
4
4
  var CAPABILITY_PLAN_HASHES = {
5
- "B": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70",
6
- "A": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70",
7
- "operations": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70"
5
+ "B": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa",
6
+ "A": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa",
7
+ "operations": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa"
8
8
  };
9
9
  var cached = null;
10
10
  function loadCapabilities() {
@@ -1,5 +1,5 @@
1
- import { GenericResource, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, numericIds, IN_FILTER_CAP, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-YYHCZRUH.js';
2
- import { loadCapabilityRecords } from './chunk-JCMXQUIC.js';
1
+ import { GenericResource, readTasks, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-FK37JXSJ.js';
2
+ import { loadCapabilityRecords } from './chunk-SCFB5MF3.js';
3
3
 
4
4
  // src/resources/special/configuration_items.ts
5
5
  async function fetchRecord(http, path, label, readOpts) {
@@ -92,11 +92,7 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
92
92
  return null;
93
93
  }
94
94
  try {
95
- const res = await http.request({
96
- method: "GET",
97
- path: `${entityPath}/${referenceId}`,
98
- operation: "configuration_items.profile"
99
- });
95
+ const res = await cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
100
96
  const body = res;
101
97
  if (body === null || !("item" in body)) {
102
98
  throw new NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
@@ -126,11 +122,13 @@ async function profile(resource, id, opts = {}) {
126
122
  const relatedLimit = profilePartLimit(opts.relatedLimit, "relatedLimit");
127
123
  const ci = await resource.get(id);
128
124
  const root = ci;
129
- const type = await contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type");
130
- const category = await contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category");
131
- const notes = await ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit);
132
- const relatedItems = await ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit);
133
- const associations = await ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT);
125
+ const [type, category, notes, relatedItems, associations] = await readTasks(http, [
126
+ () => contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type"),
127
+ () => contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category"),
128
+ () => ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit),
129
+ () => ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit),
130
+ () => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT)
131
+ ]);
134
132
  const productAssociations = {
135
133
  items: associations,
136
134
  capped: associations.length >= PROFILE_PART_LIMIT,
@@ -191,9 +189,11 @@ var ConfigurationItemsResource = class extends GenericResource {
191
189
  async getContext(id) {
192
190
  const configurationItem = await this.fetchRecordRaw("/V1.0/ConfigurationItems", id);
193
191
  const root = configurationItem;
194
- const company = await this.contextFetch("/V1.0/Companies", root["companyID"]);
195
- const contact = await this.contextFetch("/V1.0/Contacts", root["contactID"]);
196
- const contract = await this.contextFetch("/V1.0/Contracts", root["contractID"]);
192
+ const [company, contact, contract] = await readTasks(this.http, [
193
+ () => this.contextFetch("/V1.0/Companies", root["companyID"]),
194
+ () => this.contextFetch("/V1.0/Contacts", root["contactID"]),
195
+ () => this.contextFetch("/V1.0/Contracts", root["contractID"])
196
+ ]);
197
197
  return { configurationItem, company, contact, contract };
198
198
  }
199
199
  /** Node-parity special op (hand-written in src/resources/special/configuration_items.ts). */
@@ -320,13 +320,10 @@ async function fullProfile(resource, id, opts = {}) {
320
320
  }
321
321
  const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
322
322
  const root = fk === null ? row : await invokeRead(client, "contacts.get", [fk, contactId]);
323
- const company = fk === null ? { value: null, absent: "NO_FK" } : await compositePart(client, "companies.get", [fk]);
324
- const openTickets = await openTicketsOfPart(
325
- client,
326
- "contactID",
327
- contactId,
328
- ticketLimit
329
- );
323
+ const [company, openTickets] = await readTasks(resource.http, [
324
+ async () => fk === null ? { value: null, absent: "NO_FK" } : await compositePart(client, "companies.get", [fk]),
325
+ async () => await openTicketsOfPart(client, "contactID", contactId, ticketLimit)
326
+ ]);
330
327
  return { root, parts: { company, open_tickets: openTickets } };
331
328
  }
332
329
 
@@ -586,17 +583,23 @@ async function workload(resource, id, opts = {}) {
586
583
  const resourceId = parseIdentifier(id, "id");
587
584
  const root = await invokeRead(client, "resources.get", [resourceId]);
588
585
  const strict = { allowAssumed: false };
589
- const joined = await compositePart(client, "tickets.forResource", [
590
- resourceId,
591
- { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
592
- ]);
593
- const counted = await compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]);
594
- const assignments = await compositePart(client, "service_call_task_resources.query", [
595
- { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
596
- ]);
597
- const balances = await compositePart(client, "resource_time_off_balances.getByResource", [resourceId]);
598
- const timeOff = await compositePart(client, "time_off_requests.query", [
599
- { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
586
+ const [joined, counted, assignmentBranch, balances, timeOff] = await readTasks(resource.http, [
587
+ () => compositePart(client, "tickets.forResource", [
588
+ resourceId,
589
+ { openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
590
+ ]),
591
+ () => compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
592
+ async () => {
593
+ const assignments2 = await compositePart(client, "service_call_task_resources.query", [
594
+ { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
595
+ ]);
596
+ const taskDetails2 = await joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
597
+ return { assignments: assignments2, taskDetails: taskDetails2 };
598
+ },
599
+ () => compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
600
+ () => compositePart(client, "time_off_requests.query", [
601
+ { filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
602
+ ])
600
603
  ]);
601
604
  const openTickets = joined.value !== null && typeof joined.value === "object" ? counted.value !== null && typeof counted.value === "object" ? (() => {
602
605
  const { primary, secondary, both, open, capped } = counted.value;
@@ -608,13 +611,7 @@ async function workload(resource, id, opts = {}) {
608
611
  ...joined,
609
612
  value: { ...joined.value, totalsAbsent: counted.absent ?? "NO_TOTALS" }
610
613
  } : joined;
611
- const taskIds = numericIds(
612
- assignments.value?.items ?? [],
613
- "serviceCallTaskID"
614
- ).slice(0, IN_FILTER_CAP);
615
- const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await compositePart(client, "service_call_tasks.query", [
616
- { filter: [{ field: "id", op: "in", value: taskIds }], limit: taskLimit }
617
- ]);
614
+ const { assignments, taskDetails } = assignmentBranch;
618
615
  return {
619
616
  root,
620
617
  parts: {
@@ -665,19 +662,19 @@ async function fullProfile2(resource, id, opts = {}) {
665
662
  const taskLimit = compositePartLimit(opts.taskLimit, "taskLimit", OP2);
666
663
  const callId = parseIdentifier(id, "id");
667
664
  const root = await invokeRead(client, "service_calls.get", [callId]);
668
- const tickets = await compositePart(client, "service_call_tickets.query", [
669
- { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
670
- ]);
671
- const tasks = await compositePart(client, "service_call_tasks.query", [
672
- { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
673
- ]);
674
- const taskIds = numericIds(
675
- tasks.value?.items ?? [],
676
- "id"
677
- ).slice(0, IN_FILTER_CAP);
678
- const resourceAssignments = taskIds.length === 0 ? { value: null, absent: "NO_TASKS" } : await compositePart(client, "service_call_task_resources.query", [
679
- { filter: [{ field: "serviceCallTaskID", op: "in", value: taskIds }], limit: taskLimit }
665
+ const [tickets, taskBranch] = await readTasks(resource.http, [
666
+ () => compositePart(client, "service_call_tickets.query", [
667
+ { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
668
+ ]),
669
+ async () => {
670
+ const tasks2 = await compositePart(client, "service_call_tasks.query", [
671
+ { filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
672
+ ]);
673
+ const resourceAssignments2 = await joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
674
+ return { tasks: tasks2, resourceAssignments: resourceAssignments2 };
675
+ }
680
676
  ]);
677
+ const { tasks, resourceAssignments } = taskBranch;
681
678
  return {
682
679
  root,
683
680
  parts: {
@@ -1225,6 +1222,12 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
1225
1222
  };
1226
1223
  }
1227
1224
 
1225
+ // src/resources/special/tickets/context.ts
1226
+ function ticketContextValue(ticket, parts) {
1227
+ const [company, contact, resource, project] = parts;
1228
+ return { ticket, company, contact, resource, project };
1229
+ }
1230
+
1228
1231
  // src/resources/special/tickets/common.ts
1229
1232
  async function fetchTicket(http, id, operation) {
1230
1233
  const res = await http.request({
@@ -1412,17 +1415,23 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
1412
1415
  };
1413
1416
  result.truncated = result.truncated || names.section.truncated;
1414
1417
  }
1415
- async function fullContext(resource, id, opts = {}) {
1418
+ async function fullContext(resource, id, opts = {}, loadContext) {
1416
1419
  const http = resource.http;
1417
1420
  const noteLimit = partLimit(opts.noteLimit, "noteLimit");
1418
1421
  const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
1419
1422
  const textLimit = partLimit(opts.textLimit, "textLimit");
1420
1423
  const ticketId = parseIdentifier(id, "id");
1421
- const ctx = await resource.getContext(ticketId);
1424
+ const { ticket, tasks: contextTasks } = await loadContext();
1422
1425
  const op = "tickets.fullContext";
1423
1426
  const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
1424
- const notes = await ticketChildRead(http, { globalPath: "/V1.0/TicketNotes/query", resourceKey: "ticket_notes", filter: ticketFilter, limit: noteLimit, operation: op }, ticketId);
1425
- const entries = await ticketChildRead(http, { globalPath: "/V1.0/TimeEntries/query", resourceKey: "time_entries", filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId);
1427
+ const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await readTasks(http, [
1428
+ ...contextTasks,
1429
+ () => ticketChildRead(http, { globalPath: "/V1.0/TicketNotes/query", resourceKey: "ticket_notes", filter: ticketFilter, limit: noteLimit, operation: op }, ticketId),
1430
+ () => ticketChildRead(http, { globalPath: "/V1.0/TimeEntries/query", resourceKey: "time_entries", filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId),
1431
+ () => opts.includeAttachments !== false ? ticketChildRead(http, { globalPath: "/V1.0/TicketAttachments/query", resourceKey: "ticket_attachments", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId) : Promise.resolve(void 0),
1432
+ () => opts.includeHistories === true ? ticketChildRead(http, { globalPath: "/V1.0/TicketHistory/query", resourceKey: "ticket_history", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId) : Promise.resolve(void 0)
1433
+ ]);
1434
+ const ctx = ticketContextValue(ticket, [company, contact, assignedResource, project]);
1426
1435
  const notesRows = notes.items.map((n) => servedTextRecord(n, "description", textLimit));
1427
1436
  const notesPart = { items: notesRows, capped: notes.capped };
1428
1437
  applyRouteStatus(notesPart, notes);
@@ -1431,8 +1440,8 @@ async function fullContext(resource, id, opts = {}) {
1431
1440
  const notesTextTruncated = notesRows.some((n) => n.descriptionTruncated === true);
1432
1441
  let attachments = { ids: [], names: [], capped: false };
1433
1442
  let attachmentsStatus = "ok";
1434
- if (opts.includeAttachments !== false) {
1435
- const read = await ticketChildRead(http, { globalPath: "/V1.0/TicketAttachments/query", resourceKey: "ticket_attachments", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId);
1443
+ if (attachmentsRead !== void 0) {
1444
+ const read = attachmentsRead;
1436
1445
  attachmentsStatus = read.status;
1437
1446
  attachments = {
1438
1447
  ids: read.items.map((r) => Number(r.id)),
@@ -1461,8 +1470,7 @@ async function fullContext(resource, id, opts = {}) {
1461
1470
  attachments: attachmentsStatus
1462
1471
  }
1463
1472
  };
1464
- if (opts.includeHistories === true) {
1465
- const historiesRead = await ticketChildRead(http, { globalPath: "/V1.0/TicketHistory/query", resourceKey: "ticket_history", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId);
1473
+ if (historiesRead !== void 0) {
1466
1474
  const historyRows = historiesRead.items.map((h) => servedTextRecord(h, "detail", textLimit));
1467
1475
  const part = { items: historyRows, capped: historiesRead.capped };
1468
1476
  applyRouteStatus(part, historiesRead);
@@ -1729,13 +1737,19 @@ var TicketsResource = class extends GenericResource {
1729
1737
  /** Get the Ticket with its primary context records in one call (each part a single-record
1730
1738
  * fetch; no sub-lists; absent/dangling references come back null). */
1731
1739
  async getContext(id) {
1740
+ const { ticket, tasks } = await this.readTicketContext(id);
1741
+ return ticketContextValue(ticket, await readTasks(this.http, tasks));
1742
+ }
1743
+ /** Root authority and reusable lazy FK tasks shared by both ticket composites. */
1744
+ async readTicketContext(id) {
1732
1745
  const ticket = await this.fetchRecordRaw("/V1.0/Tickets", id, true);
1733
1746
  const root = ticket;
1734
- const company = await this.contextFetch("/V1.0/Companies", root["companyID"]);
1735
- const contact = await this.contextFetch("/V1.0/Contacts", root["contactID"]);
1736
- const resource = await this.contextFetch("/V1.0/Resources", root["assignedResourceID"]);
1737
- const project = await this.contextFetch("/V1.0/Projects", root["projectID"]);
1738
- return { ticket, company, contact, resource, project };
1747
+ return { ticket, tasks: [
1748
+ () => this.contextFetch("/V1.0/Companies", root["companyID"]),
1749
+ () => this.contextFetch("/V1.0/Contacts", root["contactID"]),
1750
+ () => this.contextFetch("/V1.0/Resources", root["assignedResourceID"]),
1751
+ () => this.contextFetch("/V1.0/Projects", root["projectID"])
1752
+ ] };
1739
1753
  }
1740
1754
  /** Node-parity special op (hand-written in src/resources/special/tickets/changeStatus.ts). */
1741
1755
  changeStatus(id, targetStatus, fields, opts = {}) {
@@ -1755,7 +1769,7 @@ var TicketsResource = class extends GenericResource {
1755
1769
  }
1756
1770
  /** Node-parity special op (hand-written in src/resources/special/tickets/fullContext.ts). */
1757
1771
  fullContext(id, opts) {
1758
- return fullContext(this, id, opts);
1772
+ return fullContext(this, id, opts, () => this.readTicketContext(id));
1759
1773
  }
1760
1774
  /** Node-parity special op (hand-written in src/resources/special/tickets/statusSemantics.ts). */
1761
1775
  statusSemantics(opts) {
@@ -1,8 +1,8 @@
1
1
  // src/capabilities.ts
2
2
  var CAPABILITY_PLAN_HASHES = {
3
- "B": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70",
4
- "A": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70",
5
- "operations": "04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70"
3
+ "B": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa",
4
+ "A": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa",
5
+ "operations": "959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa"
6
6
  };
7
7
  var cached = null;
8
8
  function loadCapabilities() {
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk2D2KJOX2_cjs = require('./chunk-2D2KJOX2.cjs');
4
- var chunkXKIRTR37_cjs = require('./chunk-XKIRTR37.cjs');
3
+ var chunkEWXRFHPP_cjs = require('./chunk-EWXRFHPP.cjs');
4
+ var chunkCLHDTYWO_cjs = require('./chunk-CLHDTYWO.cjs');
5
5
 
6
6
  // src/client.ts
7
7
  var AutotaskClient = class {
@@ -154,34 +154,34 @@ var AutotaskClient = class {
154
154
  * anything is wired. Construction issues NO request.
155
155
  */
156
156
  constructor(options) {
157
- this.config = chunkXKIRTR37_cjs.resolveConfig(options);
158
- this.http = new chunkXKIRTR37_cjs.HttpClient(this.config);
157
+ this.config = chunkCLHDTYWO_cjs.resolveConfig(options);
158
+ this.http = new chunkCLHDTYWO_cjs.HttpClient(this.config);
159
159
  this.http.client = this;
160
- for (const entry of chunkXKIRTR37_cjs.SIMPLE_RESOURCES) {
161
- this[entry.accessor] = new chunkXKIRTR37_cjs.GenericResource(this.http, entry, this.config.pageSize);
160
+ for (const entry of chunkCLHDTYWO_cjs.SIMPLE_RESOURCES) {
161
+ this[entry.accessor] = new chunkCLHDTYWO_cjs.GenericResource(this.http, entry, this.config.pageSize);
162
162
  }
163
- this.companies = new chunkXKIRTR37_cjs.CompaniesResource(this.http, this.config.pageSize);
164
- this.configurationItems = new chunk2D2KJOX2_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
165
- this.contacts = new chunk2D2KJOX2_cjs.ContactsResource(this.http, this.config.pageSize);
166
- this.contracts = new chunkXKIRTR37_cjs.ContractsResource(this.http, this.config.pageSize);
167
- this.inventoryProducts = new chunk2D2KJOX2_cjs.InventoryProductsResource(this.http, this.config.pageSize);
168
- this.invoices = new chunkXKIRTR37_cjs.InvoicesResource(this.http, this.config.pageSize);
169
- this.quotes = new chunk2D2KJOX2_cjs.QuotesResource(this.http, this.config.pageSize);
170
- this.resourceTimeOffAdditional = new chunk2D2KJOX2_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
171
- this.resourceTimeOffBalances = new chunk2D2KJOX2_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
172
- this.resources = new chunk2D2KJOX2_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
173
- this.serviceCalls = new chunk2D2KJOX2_cjs.ServiceCallsResource(this.http, this.config.pageSize);
174
- this.ticketCharges = new chunk2D2KJOX2_cjs.TicketChargesResource(this.http, this.config.pageSize);
175
- this.tickets = new chunk2D2KJOX2_cjs.TicketsResource(this.http, this.config.pageSize);
176
- this.timeEntries = new chunkXKIRTR37_cjs.TimeEntriesResource(this.http, this.config.pageSize);
177
- this.timeOffRequests = new chunk2D2KJOX2_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
178
- this.authenticateResource = new chunk2D2KJOX2_cjs.AuthenticateResource(this.http);
179
- this.entityInformation = new chunk2D2KJOX2_cjs.EntityInformationResource(this.http);
180
- this.modules = new chunk2D2KJOX2_cjs.ModulesResource(this.http);
181
- this.thresholdInformation = new chunk2D2KJOX2_cjs.ThresholdInformationResource(this.http);
182
- this.version = new chunk2D2KJOX2_cjs.VersionResource(this.http);
183
- this.versionInformation = new chunk2D2KJOX2_cjs.VersionInformationResource(this.http);
184
- this.zoneInformation = new chunk2D2KJOX2_cjs.ZoneInformationResource(this.http);
163
+ this.companies = new chunkCLHDTYWO_cjs.CompaniesResource(this.http, this.config.pageSize);
164
+ this.configurationItems = new chunkEWXRFHPP_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
165
+ this.contacts = new chunkEWXRFHPP_cjs.ContactsResource(this.http, this.config.pageSize);
166
+ this.contracts = new chunkCLHDTYWO_cjs.ContractsResource(this.http, this.config.pageSize);
167
+ this.inventoryProducts = new chunkEWXRFHPP_cjs.InventoryProductsResource(this.http, this.config.pageSize);
168
+ this.invoices = new chunkCLHDTYWO_cjs.InvoicesResource(this.http, this.config.pageSize);
169
+ this.quotes = new chunkEWXRFHPP_cjs.QuotesResource(this.http, this.config.pageSize);
170
+ this.resourceTimeOffAdditional = new chunkEWXRFHPP_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
171
+ this.resourceTimeOffBalances = new chunkEWXRFHPP_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
172
+ this.resources = new chunkEWXRFHPP_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
173
+ this.serviceCalls = new chunkEWXRFHPP_cjs.ServiceCallsResource(this.http, this.config.pageSize);
174
+ this.ticketCharges = new chunkEWXRFHPP_cjs.TicketChargesResource(this.http, this.config.pageSize);
175
+ this.tickets = new chunkEWXRFHPP_cjs.TicketsResource(this.http, this.config.pageSize);
176
+ this.timeEntries = new chunkCLHDTYWO_cjs.TimeEntriesResource(this.http, this.config.pageSize);
177
+ this.timeOffRequests = new chunkEWXRFHPP_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
178
+ this.authenticateResource = new chunkEWXRFHPP_cjs.AuthenticateResource(this.http);
179
+ this.entityInformation = new chunkEWXRFHPP_cjs.EntityInformationResource(this.http);
180
+ this.modules = new chunkEWXRFHPP_cjs.ModulesResource(this.http);
181
+ this.thresholdInformation = new chunkEWXRFHPP_cjs.ThresholdInformationResource(this.http);
182
+ this.version = new chunkEWXRFHPP_cjs.VersionResource(this.http);
183
+ this.versionInformation = new chunkEWXRFHPP_cjs.VersionInformationResource(this.http);
184
+ this.zoneInformation = new chunkEWXRFHPP_cjs.ZoneInformationResource(this.http);
185
185
  }
186
186
  /**
187
187
  * `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
@@ -215,37 +215,10 @@ var AutotaskClient = class {
215
215
  * parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
216
216
  */
217
217
  withSignal(signal, fn) {
218
- return chunkXKIRTR37_cjs.runWithSignal(signal, fn);
218
+ return chunkCLHDTYWO_cjs.runWithSignal(signal, fn);
219
219
  }
220
220
  async batch(fn, items, opts = {}) {
221
- const concurrency = opts.concurrency ?? this.config.maxConcurrent;
222
- if (!Number.isInteger(concurrency) || concurrency <= 0) {
223
- throw new chunkXKIRTR37_cjs.AutotaskConfigError("batch concurrency must be a positive integer");
224
- }
225
- const { signal, settle } = opts;
226
- const results = new Array(items.length);
227
- let next = 0;
228
- let failure;
229
- const worker = async () => {
230
- while (failure === void 0 && next < items.length) {
231
- if (signal?.aborted) {
232
- failure ??= { error: signal.reason };
233
- return;
234
- }
235
- const i = next++;
236
- try {
237
- const item = items[i];
238
- const value = await (signal === void 0 ? fn(item) : chunkXKIRTR37_cjs.runWithSignal(signal, () => fn(item)));
239
- results[i] = settle ? { status: "fulfilled", value } : value;
240
- } catch (error) {
241
- if (settle) results[i] = { status: "rejected", reason: error };
242
- else failure ??= { error };
243
- }
244
- }
245
- };
246
- await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));
247
- if (failure !== void 0) throw failure.error;
248
- return results;
221
+ return chunkCLHDTYWO_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
249
222
  }
250
223
  };
251
224
 
@@ -32,7 +32,7 @@ import { L as Logger } from './logger-B1gYmFre.cjs';
32
32
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
33
33
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
34
34
  *
35
- * planHash: 04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70
35
+ * planHash: 959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa
36
36
  */
37
37
 
38
38
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -278,6 +278,7 @@ declare class TtlCache {
278
278
  private readonly ttlFor;
279
279
  private readonly store;
280
280
  private readonly inflightMap;
281
+ private readonly loads;
281
282
  private epochCounter;
282
283
  constructor(ttlMs: number, options?: TtlCacheOptions);
283
284
  /** The live value (a copy), or `undefined` when absent or expired. */
@@ -383,16 +384,19 @@ interface AutotaskConfig {
383
384
  maintenancePollMs?: number;
384
385
  /** Optional request log sink. Default: no-op. */
385
386
  logger?: Logger;
386
- /** Concurrency guard (API allows <=10 concurrent). Default 10. */
387
+ /** Per-client aggregate concurrency bound across objects. Default 10.
388
+ * The SDK separately enforces a shared ceiling of 3 per object/tracking
389
+ * identifier at one normalized origin; ZoneInformation is exempt. */
387
390
  maxConcurrent?: number;
388
391
  /** Largest response body the transport will read, in bytes. Default 64 MiB; larger responses throw `RESPONSE_TOO_LARGE`. */
389
392
  maxResponseBytes?: number;
390
393
  /**
391
- * Opt-in client-side hourly limiter (API allows 10,000 req/hour): waits
392
- * within the call deadline, else throws `RateLimitError`. Off by default
394
+ * Opt-in client-side hourly limiter (vendor database-wide threshold:
395
+ * 10,000 req/hour across all integrations): waits within the call deadline, else throws `RateLimitError`. Off by default
393
396
  * (the `agent` profile turns it on at AGENT_PROFILE.rateLimit.perHour).
394
- * `perHour: null` is the explicit "disabled" value — the only way to beat
395
- * a profile's value (an ABSENT perHour means "use the profile/default").
397
+ * `perHour: null` disables only this local quota, overriding the profile
398
+ * (an ABSENT perHour means "use the profile/default"). The shared origin
399
+ * ceiling of 10,000 actual sends/hour always remains enabled.
396
400
  */
397
401
  rateLimit?: {
398
402
  perHour?: number | null;
@@ -741,8 +745,8 @@ declare class HttpClient {
741
745
  private readonly maxResponseBytes;
742
746
  /** Local hourly budget (undefined when `rateLimit.perHour` is off). */
743
747
  private readonly hourly;
744
- /** FIFO semaphore bounding in-flight requests to `maxConcurrent`. */
745
- private readonly semaphore;
748
+ /** Client identity for atomic local/object capacity admission. */
749
+ private readonly admission;
746
750
  /** Tenant 429 cooldown gate (issue #6; ON by default). */
747
751
  private readonly cooldownEnabled;
748
752
  private readonly cooldownMaxMs;
@@ -781,8 +785,9 @@ declare class HttpClient {
781
785
  /**
782
786
  * The LOCAL hourly-budget state (the sliding window this client counts):
783
787
  * `{ perHour, used, remaining }` — `undefined` when `rateLimit.perHour`
784
- * is off. The limiter is PER PROCESS (issue #4): it cannot see other
785
- * instances or integrations on the tenant — the tenant-wide count is
788
+ * is off. This optional quota is PER CLIENT (issue #4); the separate
789
+ * always-on origin ceiling is shared within the JavaScript realm. Neither
790
+ * measures external integrations — the vendor-wide count is
786
791
  * `thresholdInformation.get()`.
787
792
  */
788
793
  hourlyBudget(): {
@@ -847,7 +852,7 @@ declare class HttpClient {
847
852
  */
848
853
  private gate;
849
854
  /**
850
- * Take the hourly slot and a semaphore permit, fetch, and read the body.
855
+ * Acquire client/object capacity together, charge the attempt, fetch and read the body.
851
856
  * `retry` when a network error is retriable (already waited); throws the
852
857
  * typed error otherwise. The permit is released on every path.
853
858
  */
@@ -1023,7 +1028,7 @@ interface CompanyFullProfileOptions {
1023
1028
  maxNameReads?: number;
1024
1029
  /** Explicit closed ticket-status ids for the openTickets part, overriding the resolved picklist (a caller decision, reported as source 'picklist'; same as tickets.forResource). */
1025
1030
  excludeStatusIds?: number[];
1026
- /** `false` (default true, unchanged): throw `STATUS_SEMANTICS_UNRESOLVED` instead of falling back to the assumed closed id 5 when the tenant picklist cannot be resolved (issue #244). The throw happens at the openTickets read, after the company and the four other part reads. */
1031
+ /** `false` (default true, unchanged): throw `STATUS_SEMANTICS_UNRESOLVED` instead of falling back to the assumed closed id 5 when the tenant picklist cannot be resolved (issue #244). The throw happens at the openTickets read; started sibling reads settle before it propagates. */
1027
1032
  allowAssumed?: boolean;
1028
1033
  }
1029
1034
  /** One capped list part (a full page sets `capped: true` — more may exist). */
@@ -2194,6 +2199,8 @@ declare class TicketsResource extends GenericResource<Ticket, TicketCreate, Tick
2194
2199
  /** Get the Ticket with its primary context records in one call (each part a single-record
2195
2200
  * fetch; no sub-lists; absent/dangling references come back null). */
2196
2201
  getContext(id: Identifier): Promise<TicketContext>;
2202
+ /** Root authority and reusable lazy FK tasks shared by both ticket composites. */
2203
+ private readTicketContext;
2197
2204
  /** Node-parity special op (hand-written in src/resources/special/tickets/changeStatus.ts). */
2198
2205
  changeStatus(id: Identifier, targetStatus: number, fields?: Record<string, unknown>, opts?: MutationOpts): Promise<TicketChangeStatusResult | TicketChangeStatusNoChange | DryRunResult<Record<string, unknown>>>;
2199
2206
  /** Node-parity special op (hand-written in src/resources/special/tickets/sla.ts). */
@@ -32,7 +32,7 @@ import { L as Logger } from './logger-B1gYmFre.js';
32
32
  * queryBounded noteChars free-text cap (issue #61 — response-side only);
33
33
  * - docs/VENDOR-QUIRKS.md §11.7/§11.8/§11.9/§11.10/§11.11/§11.12 render the same facts.
34
34
  *
35
- * planHash: 04fb614dcdd035a01636e51cf38d8178aeef7c9a1b45faf4af6187875800bd70
35
+ * planHash: 959981d335cfd184d8b4e58074d1ab6997b2db87a62683ed13e99c149f8cd4fa
36
36
  */
37
37
 
38
38
  /** One pinned blind-surface stamp (the result-time sentinel object). */
@@ -278,6 +278,7 @@ declare class TtlCache {
278
278
  private readonly ttlFor;
279
279
  private readonly store;
280
280
  private readonly inflightMap;
281
+ private readonly loads;
281
282
  private epochCounter;
282
283
  constructor(ttlMs: number, options?: TtlCacheOptions);
283
284
  /** The live value (a copy), or `undefined` when absent or expired. */
@@ -383,16 +384,19 @@ interface AutotaskConfig {
383
384
  maintenancePollMs?: number;
384
385
  /** Optional request log sink. Default: no-op. */
385
386
  logger?: Logger;
386
- /** Concurrency guard (API allows <=10 concurrent). Default 10. */
387
+ /** Per-client aggregate concurrency bound across objects. Default 10.
388
+ * The SDK separately enforces a shared ceiling of 3 per object/tracking
389
+ * identifier at one normalized origin; ZoneInformation is exempt. */
387
390
  maxConcurrent?: number;
388
391
  /** Largest response body the transport will read, in bytes. Default 64 MiB; larger responses throw `RESPONSE_TOO_LARGE`. */
389
392
  maxResponseBytes?: number;
390
393
  /**
391
- * Opt-in client-side hourly limiter (API allows 10,000 req/hour): waits
392
- * within the call deadline, else throws `RateLimitError`. Off by default
394
+ * Opt-in client-side hourly limiter (vendor database-wide threshold:
395
+ * 10,000 req/hour across all integrations): waits within the call deadline, else throws `RateLimitError`. Off by default
393
396
  * (the `agent` profile turns it on at AGENT_PROFILE.rateLimit.perHour).
394
- * `perHour: null` is the explicit "disabled" value — the only way to beat
395
- * a profile's value (an ABSENT perHour means "use the profile/default").
397
+ * `perHour: null` disables only this local quota, overriding the profile
398
+ * (an ABSENT perHour means "use the profile/default"). The shared origin
399
+ * ceiling of 10,000 actual sends/hour always remains enabled.
396
400
  */
397
401
  rateLimit?: {
398
402
  perHour?: number | null;
@@ -741,8 +745,8 @@ declare class HttpClient {
741
745
  private readonly maxResponseBytes;
742
746
  /** Local hourly budget (undefined when `rateLimit.perHour` is off). */
743
747
  private readonly hourly;
744
- /** FIFO semaphore bounding in-flight requests to `maxConcurrent`. */
745
- private readonly semaphore;
748
+ /** Client identity for atomic local/object capacity admission. */
749
+ private readonly admission;
746
750
  /** Tenant 429 cooldown gate (issue #6; ON by default). */
747
751
  private readonly cooldownEnabled;
748
752
  private readonly cooldownMaxMs;
@@ -781,8 +785,9 @@ declare class HttpClient {
781
785
  /**
782
786
  * The LOCAL hourly-budget state (the sliding window this client counts):
783
787
  * `{ perHour, used, remaining }` — `undefined` when `rateLimit.perHour`
784
- * is off. The limiter is PER PROCESS (issue #4): it cannot see other
785
- * instances or integrations on the tenant — the tenant-wide count is
788
+ * is off. This optional quota is PER CLIENT (issue #4); the separate
789
+ * always-on origin ceiling is shared within the JavaScript realm. Neither
790
+ * measures external integrations — the vendor-wide count is
786
791
  * `thresholdInformation.get()`.
787
792
  */
788
793
  hourlyBudget(): {
@@ -847,7 +852,7 @@ declare class HttpClient {
847
852
  */
848
853
  private gate;
849
854
  /**
850
- * Take the hourly slot and a semaphore permit, fetch, and read the body.
855
+ * Acquire client/object capacity together, charge the attempt, fetch and read the body.
851
856
  * `retry` when a network error is retriable (already waited); throws the
852
857
  * typed error otherwise. The permit is released on every path.
853
858
  */
@@ -1023,7 +1028,7 @@ interface CompanyFullProfileOptions {
1023
1028
  maxNameReads?: number;
1024
1029
  /** Explicit closed ticket-status ids for the openTickets part, overriding the resolved picklist (a caller decision, reported as source 'picklist'; same as tickets.forResource). */
1025
1030
  excludeStatusIds?: number[];
1026
- /** `false` (default true, unchanged): throw `STATUS_SEMANTICS_UNRESOLVED` instead of falling back to the assumed closed id 5 when the tenant picklist cannot be resolved (issue #244). The throw happens at the openTickets read, after the company and the four other part reads. */
1031
+ /** `false` (default true, unchanged): throw `STATUS_SEMANTICS_UNRESOLVED` instead of falling back to the assumed closed id 5 when the tenant picklist cannot be resolved (issue #244). The throw happens at the openTickets read; started sibling reads settle before it propagates. */
1027
1032
  allowAssumed?: boolean;
1028
1033
  }
1029
1034
  /** One capped list part (a full page sets `capped: true` — more may exist). */
@@ -2194,6 +2199,8 @@ declare class TicketsResource extends GenericResource<Ticket, TicketCreate, Tick
2194
2199
  /** Get the Ticket with its primary context records in one call (each part a single-record
2195
2200
  * fetch; no sub-lists; absent/dangling references come back null). */
2196
2201
  getContext(id: Identifier): Promise<TicketContext>;
2202
+ /** Root authority and reusable lazy FK tasks shared by both ticket composites. */
2203
+ private readTicketContext;
2197
2204
  /** Node-parity special op (hand-written in src/resources/special/tickets/changeStatus.ts). */
2198
2205
  changeStatus(id: Identifier, targetStatus: number, fields?: Record<string, unknown>, opts?: MutationOpts): Promise<TicketChangeStatusResult | TicketChangeStatusNoChange | DryRunResult<Record<string, unknown>>>;
2199
2206
  /** Node-parity special op (hand-written in src/resources/special/tickets/sla.ts). */