node-autotask 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/MCP_TOOL_CATALOG.json +321 -9
  3. package/README.md +1 -1
  4. package/capabilities.json +1570 -209
  5. package/dist/capabilities-data.js +2294 -933
  6. package/dist/capabilities.cjs +4 -4
  7. package/dist/capabilities.js +1 -1
  8. package/dist/{chunk-QEMBBAF5.cjs → chunk-36RXJUSA.cjs} +199 -199
  9. package/dist/{chunk-C2AFRW5M.cjs → chunk-4NLWSHCB.cjs} +359 -88
  10. package/dist/{chunk-CV56RIGS.js → chunk-AWK7FIZD.js} +354 -83
  11. package/dist/{chunk-DBEAS3IR.js → chunk-HASLVFC7.js} +3 -3
  12. package/dist/{chunk-QCA5R7QF.cjs → chunk-MVGGHMOB.cjs} +3 -3
  13. package/dist/{chunk-HQJLIRXW.js → chunk-RWBOJ5WK.js} +5 -2
  14. package/dist/{chunk-5AHEJCSP.cjs → chunk-SNILYCAV.cjs} +33 -30
  15. package/dist/{chunk-ZKAJVHHZ.js → chunk-Z56J7TFC.js} +2 -2
  16. package/dist/{index-8Hg6dytT.d.cts → index-BZItfp_H.d.cts} +64 -1
  17. package/dist/{index-8Hg6dytT.d.ts → index-BZItfp_H.d.ts} +64 -1
  18. package/dist/{index-DxESlIIg.d.cts → index-DdvYwR2w.d.cts} +93 -84
  19. package/dist/{index-nXhYAQOf.d.ts → index-f1c_EdAt.d.ts} +93 -84
  20. package/dist/index.cjs +84 -84
  21. package/dist/index.d.cts +6 -5
  22. package/dist/index.d.ts +6 -5
  23. package/dist/index.js +5 -5
  24. package/dist/operations/index.cjs +51 -51
  25. package/dist/operations/index.d.cts +4 -4
  26. package/dist/operations/index.d.ts +4 -4
  27. package/dist/operations/index.js +2 -2
  28. package/dist/pool.cjs +12 -12
  29. package/dist/pool.d.cts +1 -1
  30. package/dist/pool.d.ts +1 -1
  31. package/dist/pool.js +4 -4
  32. package/dist/resources/index.cjs +27 -27
  33. package/dist/resources/index.d.cts +2 -2
  34. package/dist/resources/index.d.ts +2 -2
  35. package/dist/resources/index.js +3 -3
  36. package/dist/types/index.d.cts +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/docs/API.md +32 -20
  39. package/docs/RELEASING.md +2 -1
  40. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { loadCapabilityRecords } from './chunk-DBEAS3IR.js';
1
+ import { loadCapabilityRecords } from './chunk-HASLVFC7.js';
2
2
  import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-7NKB4UXV.js';
3
3
  import { randomUUID, createHash } from 'crypto';
4
4
  import { AsyncLocalStorage } from 'async_hooks';
@@ -402,13 +402,14 @@ function suggestedActionForStatus(status) {
402
402
  return status >= 500 ? "The SDK already retried per its policy. A repeated 500 on one entity while others work usually means the API user lacks permission on that entity \u2014 ask the Autotask admin to grant it; otherwise retry once more at most." : void 0;
403
403
  }
404
404
  }
405
- function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential) {
405
+ function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential, includeVendorDetails = true) {
406
406
  const safeBody = redactResponseBody(body, { redactPersonalData });
407
- let detail = formatVendorDetail(safeBody);
407
+ const exposedBody = includeVendorDetails ? safeBody : void 0;
408
+ let detail = formatVendorDetail(exposedBody);
408
409
  if (detail !== void 0 && detail.length > VENDOR_BODY_SUFFIX_LIMIT) {
409
410
  detail = detail.slice(0, VENDOR_BODY_SUFFIX_LIMIT);
410
411
  }
411
- const suffix = detail === void 0 ? vendorBodySuffix(safeBody) : void 0;
412
+ const suffix = detail === void 0 ? vendorBodySuffix(exposedBody) : void 0;
412
413
  const message = detail ?? (suffix !== void 0 ? `${statusDefaultMessage(status)}: ${suffix}` : statusDefaultMessage(status));
413
414
  const shape = errorShapeForStatus(status);
414
415
  const Ctor = shape?.Ctor ?? AutotaskError;
@@ -419,10 +420,10 @@ function errorFromStatus(status, body, url, operation, redactPersonalData = true
419
420
  const credentialDetails = status === 401 ? credentialDiagnosticDetails(credential) : void 0;
420
421
  const extraDetails = mergeDetails(void 0, credentialDetails);
421
422
  const err = new Ctor(message, {
422
- code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) ? vendorCodeCandidate : code,
423
+ code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) && (includeVendorDetails || vendorCodeCandidate.toLowerCase() === "itgenatr005") ? vendorCodeCandidate : code,
423
424
  ...category !== void 0 ? { category } : {},
424
425
  httpStatus: status,
425
- vendorError: safeBody,
426
+ vendorError: exposedBody,
426
427
  url,
427
428
  operation,
428
429
  retryable: status === 429 || status >= 500,
@@ -1441,6 +1442,11 @@ function resolveConfig(config) {
1441
1442
 
1442
1443
  // src/http/types.ts
1443
1444
  var IDEMPOTENT_METHODS = ["GET", "PUT", "DELETE"];
1445
+ var AUDIT_DECIMAL_ID = /^(?:0|[1-9]\d{0,18})$/;
1446
+ var MAX_AUDIT_ID = "9223372036854775807";
1447
+ function isAuditDecimalId(id) {
1448
+ return AUDIT_DECIMAL_ID.test(id) && (id.length < MAX_AUDIT_ID.length || id <= MAX_AUDIT_ID);
1449
+ }
1444
1450
  function isRecord2(value) {
1445
1451
  return typeof value === "object" && value !== null && !Array.isArray(value);
1446
1452
  }
@@ -1638,17 +1644,39 @@ function refusedFilterShape(filter) {
1638
1644
  if (t === "object" || t === "function") return "an object";
1639
1645
  return t === "string" ? "a string" : `a ${t}`;
1640
1646
  }
1641
- function assertNoRelationLeaf(conditions, operation) {
1647
+ function assertQueryFilterForWire(conditions, operation, auditIds) {
1642
1648
  if (!Array.isArray(conditions)) return;
1643
- for (const c of conditions) {
1644
- if (!isRecord2(c)) continue;
1645
- if (Array.isArray(c.items)) assertNoRelationLeaf(c.items, operation);
1646
- else if (c.udf !== true && typeof c.field === "string" && c.field.includes(".")) {
1649
+ for (const input of conditions) {
1650
+ if (!isRecord2(input)) continue;
1651
+ const c = auditIds ? {} : input;
1652
+ if (auditIds) {
1653
+ for (const [key, value] of Object.entries(input)) {
1654
+ const lower = key.toLowerCase();
1655
+ if (!["op", "field", "value", "items", "udf"].includes(lower)) continue;
1656
+ if (Object.hasOwn(c, lower)) {
1657
+ throw new AutotaskConfigError("Audit filter predicates must provide each field once.", { operation });
1658
+ }
1659
+ c[lower] = value;
1660
+ }
1661
+ }
1662
+ if (Array.isArray(c.items)) assertQueryFilterForWire(c.items, operation, auditIds);
1663
+ if (c.udf === true || typeof c.field !== "string") continue;
1664
+ if (c.field.includes(".")) {
1647
1665
  throw new AutotaskConfigError(
1648
1666
  `${operation}: filter field "${c.field}" is a relation filter that was not resolved on this path \u2014 the request was not issued`,
1649
1667
  { operation, suggestedAction: "Use a query surface that resolves relation filters (query, queryAll, queryBounded, count, operations.aggregate), or filter by the <relation>ID field directly." }
1650
1668
  );
1651
1669
  }
1670
+ if (auditIds && c.field.trim().toLowerCase() === "id") {
1671
+ const values = Array.isArray(c.value) ? c.value : [c.value];
1672
+ if (c.value === void 0 && (c.op === "exist" || c.op === "notExist")) continue;
1673
+ if (values.length === 0 || values.some((value) => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !isAuditDecimalId(value))) {
1674
+ throw new AutotaskConfigError(`${operation}: audit log ID filters require a safe integer or an exact decimal string.`, {
1675
+ operation,
1676
+ suggestedAction: "Pass each large ID as an exact decimal string."
1677
+ });
1678
+ }
1679
+ }
1652
1680
  }
1653
1681
  }
1654
1682
 
@@ -1665,14 +1693,14 @@ function assertSafePath(path) {
1665
1693
  return decoded === "." || decoded === ".." || /[/\\]/.test(decoded);
1666
1694
  });
1667
1695
  if (bad) {
1668
- throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: not a plain absolute API path (dot segment, '#', '\\', control character or missing leading '/')`);
1696
+ throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.split("?", 1)[0].slice(0, 200))}: not a plain absolute API path (dot segment, '#', '\\', control character or missing leading '/')`);
1669
1697
  }
1670
1698
  }
1671
1699
  function buildUrl(baseUrl, path, query) {
1672
1700
  assertSafePath(path);
1673
1701
  let url = baseUrl + path;
1674
1702
  if (new URL(url).origin !== new URL(baseUrl).origin) {
1675
- throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: it leaves the configured origin`);
1703
+ throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.split("?", 1)[0].slice(0, 200))}: it leaves the configured origin`);
1676
1704
  }
1677
1705
  if (query !== void 0) {
1678
1706
  const params = new URLSearchParams();
@@ -1681,11 +1709,11 @@ function buildUrl(baseUrl, path, query) {
1681
1709
  params.set(key, String(value));
1682
1710
  }
1683
1711
  const qs = params.toString();
1684
- if (qs.length > 0) url += `?${qs}`;
1712
+ if (qs.length > 0) url += `${path.includes("?") ? "&" : "?"}${qs}`;
1685
1713
  }
1686
1714
  return url;
1687
1715
  }
1688
- function cursorToPath(baseUrl, cursor) {
1716
+ function cursorToPath(baseUrl, cursor, resourcePath) {
1689
1717
  const base = new URL(baseUrl);
1690
1718
  let url;
1691
1719
  try {
@@ -1698,6 +1726,18 @@ function cursorToPath(baseUrl, cursor) {
1698
1726
  }
1699
1727
  const basePath = base.pathname.replace(/\/+$/, "");
1700
1728
  const path = basePath !== "" && url.pathname.startsWith(`${basePath}/`) ? url.pathname.slice(basePath.length) : url.pathname;
1729
+ if (resourcePath !== void 0) {
1730
+ let route;
1731
+ try {
1732
+ route = decodeURIComponent(path).toLowerCase().replace(/\/$/, "");
1733
+ } catch {
1734
+ throw new ResponseRejectedError("Refused the pagination cursor: invalid path encoding.");
1735
+ }
1736
+ const query = `${resourcePath.toLowerCase()}/query`;
1737
+ if (route !== query && route !== `${query}/next`) {
1738
+ throw new ResponseRejectedError("Refused the pagination cursor outside the original query route.");
1739
+ }
1740
+ }
1701
1741
  return path + url.search;
1702
1742
  }
1703
1743
  function buildQueryBody(params) {
@@ -1714,6 +1754,16 @@ function effectiveIncludeFields(params) {
1714
1754
  if (params.includeFields === void 0) return void 0;
1715
1755
  return params.includeFields.includes("id") ? params.includeFields : [...params.includeFields, "id"];
1716
1756
  }
1757
+ function assertGetQueryUrlLength(url) {
1758
+ const length = new URL(url).href.length;
1759
+ if (length > MAX_GET_LENGTH) {
1760
+ throw new QueryTooLongError(`GET query URL is ${length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`);
1761
+ }
1762
+ }
1763
+ function buildQueryGetRequest(baseUrl, path, query) {
1764
+ assertGetQueryUrlLength(buildUrl(baseUrl, path, query));
1765
+ return { method: "GET", path, query };
1766
+ }
1717
1767
  function buildQueryRequest(baseUrl, resourcePath, params) {
1718
1768
  const queryPath = `${resourcePath}/query`;
1719
1769
  if (params.via === "get") {
@@ -1724,18 +1774,7 @@ function buildQueryRequest(baseUrl, resourcePath, params) {
1724
1774
  if (filter !== void 0) search.filter = filter.filter;
1725
1775
  if (params.maxRecords !== void 0) search.maxRecords = params.maxRecords;
1726
1776
  if (includeFields !== void 0) search.includeFields = includeFields;
1727
- const req = {
1728
- method: "GET",
1729
- path: queryPath,
1730
- query: { search: JSON.stringify(search) }
1731
- };
1732
- const url = buildUrl(baseUrl, queryPath, req.query);
1733
- if (url.length > MAX_GET_LENGTH) {
1734
- throw new QueryTooLongError(
1735
- `GET query URL is ${url.length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`
1736
- );
1737
- }
1738
- return req;
1777
+ return buildQueryGetRequest(baseUrl, queryPath, { search: JSON.stringify(search) });
1739
1778
  }
1740
1779
  return { method: "POST", path: queryPath, body: buildQueryBody(params), idempotent: true };
1741
1780
  }
@@ -10656,6 +10695,69 @@ var RELATIONSHIP_MAP = {
10656
10695
  },
10657
10696
  "deleteBoundary": null,
10658
10697
  "markerField": null
10698
+ },
10699
+ "deleted_task_activity_logs": {
10700
+ "resource": "deleted_task_activity_logs",
10701
+ "apiEntity": "DeletedTaskActivityLog",
10702
+ "kind": "entity",
10703
+ "path": "DeletedTaskActivityLogs",
10704
+ "parentScoped": false,
10705
+ "tier": "advanced",
10706
+ "workflowResource": false,
10707
+ "group": "B",
10708
+ "parent": null,
10709
+ "children": [],
10710
+ "naturalKeys": {
10711
+ "hasSearch": false,
10712
+ "searchCovers": null,
10713
+ "findBy": []
10714
+ },
10715
+ "blindSurfaces": null,
10716
+ "zoneFacts": null,
10717
+ "deleteBoundary": null,
10718
+ "markerField": null
10719
+ },
10720
+ "deleted_ticket_activity_logs": {
10721
+ "resource": "deleted_ticket_activity_logs",
10722
+ "apiEntity": "DeletedTicketActivityLog",
10723
+ "kind": "entity",
10724
+ "path": "DeletedTicketActivityLogs",
10725
+ "parentScoped": false,
10726
+ "tier": "advanced",
10727
+ "workflowResource": false,
10728
+ "group": "B",
10729
+ "parent": null,
10730
+ "children": [],
10731
+ "naturalKeys": {
10732
+ "hasSearch": false,
10733
+ "searchCovers": null,
10734
+ "findBy": []
10735
+ },
10736
+ "blindSurfaces": null,
10737
+ "zoneFacts": null,
10738
+ "deleteBoundary": null,
10739
+ "markerField": null
10740
+ },
10741
+ "deleted_ticket_logs": {
10742
+ "resource": "deleted_ticket_logs",
10743
+ "apiEntity": "DeletedTicketLog",
10744
+ "kind": "entity",
10745
+ "path": "DeletedTicketLogs",
10746
+ "parentScoped": false,
10747
+ "tier": "advanced",
10748
+ "workflowResource": false,
10749
+ "group": "B",
10750
+ "parent": null,
10751
+ "children": [],
10752
+ "naturalKeys": {
10753
+ "hasSearch": false,
10754
+ "searchCovers": null,
10755
+ "findBy": []
10756
+ },
10757
+ "blindSurfaces": null,
10758
+ "zoneFacts": null,
10759
+ "deleteBoundary": null,
10760
+ "markerField": null
10659
10761
  }
10660
10762
  };
10661
10763
  var BLIND_SURFACE_STAMPS = {
@@ -15984,6 +16086,15 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
15984
16086
  ],
15985
16087
  "resource_attachments": [
15986
16088
  "title"
16089
+ ],
16090
+ "deleted_task_activity_logs": [
16091
+ "noteOrAttachmentTitle"
16092
+ ],
16093
+ "deleted_ticket_activity_logs": [
16094
+ "noteOrAttachmentTitle"
16095
+ ],
16096
+ "deleted_ticket_logs": [
16097
+ "ticketTitle"
15987
16098
  ]
15988
16099
  };
15989
16100
 
@@ -16420,6 +16531,74 @@ function credentialShapeExpectation(headers, auth) {
16420
16531
 
16421
16532
  // src/http/envelope.ts
16422
16533
  var INVALID_SHAPE_ACTION = "Report the unexpected response shape; verify baseUrl points at the REST API.";
16534
+ var AUDIT_READ_PATH = /^\/v1\.0\/(DeletedTaskActivityLogs|DeletedTicketActivityLogs|DeletedTicketLogs)\/(query\/(?:next|previous|count)|[^/?]+)\/?(?:\?.*)?$/i;
16535
+ function isAuditLogResource(resource) {
16536
+ return /^(deleted_task_activity_logs|deleted_ticket_activity_logs|deleted_ticket_logs)$/.test(resource);
16537
+ }
16538
+ function isDeletedAuditRead(operation) {
16539
+ const [resource = "", verb, suffix] = operation?.split(".") ?? [];
16540
+ return suffix === void 0 && (verb === "get" || verb === "query") && isAuditLogResource(resource);
16541
+ }
16542
+ function auditReadTarget(path, operation) {
16543
+ const match = AUDIT_READ_PATH.exec(path);
16544
+ const target = match?.[2]?.toLowerCase();
16545
+ if (target === "query" || target === "query/next" || target === "query/previous") return "query";
16546
+ if (target === "entityinformation") return void 0;
16547
+ if (target === "query/count") return target;
16548
+ if (target !== void 0 && !isAuditDecimalId(target)) {
16549
+ throw new AutotaskConfigError("Audit log ID must be a non-negative signed 64-bit integer.", { operation });
16550
+ }
16551
+ return target;
16552
+ }
16553
+ function decodeResponseJson(text, auditTarget) {
16554
+ if (auditTarget === void 0) return JSON.parse(text);
16555
+ if (auditTarget === "query/count") {
16556
+ return JSON.parse(text, (key, value, context) => key === "queryCount" && typeof value === "number" && !isAuditDecimalId(context?.source ?? "") ? null : value);
16557
+ }
16558
+ const idTokens = /* @__PURE__ */ new WeakMap();
16559
+ const body = JSON.parse(text, function(key, value, context) {
16560
+ if (key === "id" && typeof value === "number" && context?.source !== void 0) {
16561
+ idTokens.set(this, context.source);
16562
+ }
16563
+ return value;
16564
+ });
16565
+ const rows = isRecord2(body) ? auditTarget === "query" ? body.items : [body.item] : void 0;
16566
+ if (Array.isArray(rows)) {
16567
+ for (const row of rows) {
16568
+ if (!isRecord2(row) || typeof row.id !== "number") continue;
16569
+ const token = idTokens.get(row);
16570
+ if (token === void 0 || !isAuditDecimalId(token)) row.id = null;
16571
+ else if (!Number.isSafeInteger(row.id)) row.id = token;
16572
+ }
16573
+ }
16574
+ return body;
16575
+ }
16576
+ function isAuditItem(item) {
16577
+ if (!isRecord2(item)) return false;
16578
+ const { id } = item;
16579
+ return typeof id === "number" ? Number.isSafeInteger(id) && id >= 0 : typeof id === "string" && isAuditDecimalId(id);
16580
+ }
16581
+ function isAuditPage(body) {
16582
+ if (!Array.isArray(body.items) || !isRecord2(body.pageDetails)) return false;
16583
+ const { nextPageUrl } = body.pageDetails;
16584
+ return (nextPageUrl === null || typeof nextPageUrl === "string" && nextPageUrl.trim() !== "") && body.items.every(isAuditItem);
16585
+ }
16586
+ function validateAuditResponse(body, target, operation) {
16587
+ if (target === void 0) return;
16588
+ if (target === "query/count") {
16589
+ unwrapQueryCount(body, operation);
16590
+ return;
16591
+ }
16592
+ const valid = isRecord2(body) && (target === "query" ? isAuditPage(body) : body.item === null || isAuditItem(body.item) && String(body.item.id) === target);
16593
+ if (!valid) {
16594
+ throw new AutotaskError("Expected a valid audit log response for the requested path.", {
16595
+ code: "INVALID_RESPONSE",
16596
+ category: "server",
16597
+ operation,
16598
+ suggestedAction: INVALID_SHAPE_ACTION
16599
+ });
16600
+ }
16601
+ }
16423
16602
  function attachEmptyReasonDetails(err) {
16424
16603
  if (err.operation === void 0) return;
16425
16604
  const dot = err.operation.indexOf(".");
@@ -16445,7 +16624,7 @@ function attachEmptyReasonDetails(err) {
16445
16624
  } : {
16446
16625
  surface,
16447
16626
  kind: "not-found",
16448
- note: `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
16627
+ note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
16449
16628
  authority: `${resource}.query`,
16450
16629
  remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface \u2014 do not retry the same get`
16451
16630
  };
@@ -16483,7 +16662,7 @@ function unwrapItem(body, id, operation, entity) {
16483
16662
  resourceIds: id !== void 0 ? [id] : void 0,
16484
16663
  ...id !== void 0 && entity !== void 0 ? { details: { idRefs: [{ entity, id }] } } : {},
16485
16664
  operation,
16486
- suggestedAction: "Verify the id, or resolve the record by name first."
16665
+ suggestedAction: isDeletedAuditRead(operation) ? "Verify the log ID and check API-user access." : "Verify the id, or resolve the record by name first."
16487
16666
  }
16488
16667
  );
16489
16668
  attachEmptyReasonDetails(err);
@@ -16492,8 +16671,9 @@ function unwrapItem(body, id, operation, entity) {
16492
16671
  return item;
16493
16672
  }
16494
16673
  function unwrapQueryCount(body, operation) {
16495
- if (!isRecord2(body) || typeof body.queryCount !== "number") {
16496
- const err = new AutotaskError("Expected the count envelope { queryCount: number }; got a different shape", {
16674
+ const count = isRecord2(body) ? body.queryCount : void 0;
16675
+ if (typeof count !== "number" || !Number.isInteger(count) || count < 0 || count > 2147483647) {
16676
+ const err = new AutotaskError("Expected the count envelope { queryCount: non-negative int32 }", {
16497
16677
  code: "INVALID_RESPONSE",
16498
16678
  category: "server",
16499
16679
  operation,
@@ -16502,7 +16682,7 @@ function unwrapQueryCount(body, operation) {
16502
16682
  attachEmptyReasonDetails(err);
16503
16683
  throw err;
16504
16684
  }
16505
- return body.queryCount;
16685
+ return count;
16506
16686
  }
16507
16687
  function unwrapOperation(body, operation) {
16508
16688
  const value = isRecord2(body) ? body.itemId !== void 0 ? body.itemId : body.id : void 0;
@@ -16856,8 +17036,7 @@ var HttpClient = class {
16856
17036
  since,
16857
17037
  retryAfterMs: s.maintenancePollMs,
16858
17038
  httpStatus: status,
16859
- contentType,
16860
- bodySnippet: bodySnippet(text, this.redactPersonalData),
17039
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) },
16861
17040
  maintenanceDetected: true
16862
17041
  },
16863
17042
  suggestedAction: unknownWrite ? `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).` : `The Autotask zone is in its maintenance window (since ${since}); retry after the window (windows usually last 30-90 min).`
@@ -16962,7 +17141,7 @@ var HttpClient = class {
16962
17141
  return { retry: true };
16963
17142
  }
16964
17143
  throw new AutotaskNetworkError(
16965
- `Network error during ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
17144
+ `Network error during ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
16966
17145
  ctx
16967
17146
  );
16968
17147
  }
@@ -16983,7 +17162,7 @@ var HttpClient = class {
16983
17162
  if (err instanceof AutotaskError) throw err;
16984
17163
  if (s.signal.aborted || isAbortLike(err)) throw this.interrupted(s);
16985
17164
  throw new AutotaskNetworkError(
16986
- `Network error reading the response of ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
17165
+ `Network error reading the response of ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
16987
17166
  ctx
16988
17167
  );
16989
17168
  }
@@ -17010,10 +17189,11 @@ var HttpClient = class {
17010
17189
  }
17011
17190
  let parsed;
17012
17191
  try {
17013
- parsed = JSON.parse(text);
17192
+ parsed = decodeResponseJson(text, s.auditTarget);
17014
17193
  } catch {
17015
17194
  return this.handleNonJson2xx(s, res, status, text);
17016
17195
  }
17196
+ validateAuditResponse(parsed, s.auditTarget, opts.operation);
17017
17197
  return {
17018
17198
  done: true,
17019
17199
  value: opts.skipResponseRedaction ? parsed : redactResponseBody(parsed, { redactPersonalData: this.redactPersonalData }),
@@ -17030,13 +17210,12 @@ var HttpClient = class {
17030
17210
  httpStatus: status,
17031
17211
  details: {
17032
17212
  httpStatus: status,
17033
- contentType,
17034
- bodySnippet: bodySnippet(text, this.redactPersonalData)
17213
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) }
17035
17214
  },
17036
17215
  // The content-type is host-sourced (a host-supplied
17037
17216
  // baseUrl can serve arbitrary HTML) — capped, never prose;
17038
17217
  // the raw snippet rides details only.
17039
- suggestedAction: retriable5xx ? `The zone answered with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the zone is likely in a maintenance window \u2014 retry after the window, or verify baseUrl points at the REST API.` : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect \u2014 verify the record before re-issuing (writes are never auto-retried).`
17218
+ suggestedAction: method === "GET" || retriable5xx ? `The zone answered with a non-JSON body (content-type: ${s.getQuery ? "non-JSON" : contentType.slice(0, 100)}); the zone is likely in a maintenance window \u2014 retry after the window, or verify baseUrl points at the REST API.` : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect \u2014 verify the record before re-issuing (writes are never auto-retried).`
17040
17219
  }
17041
17220
  ) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
17042
17221
  ...ctx,
@@ -17082,7 +17261,7 @@ var HttpClient = class {
17082
17261
  nonJsonBody = text;
17083
17262
  }
17084
17263
  }
17085
- const nonJsonSnippet = nonJsonBody === void 0 ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
17264
+ const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
17086
17265
  const nonJsonIsMaintenance = s.maintenancePage;
17087
17266
  const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
17088
17267
  if (nonJsonIsMaintenance) {
@@ -17106,9 +17285,12 @@ var HttpClient = class {
17106
17285
  );
17107
17286
  }
17108
17287
  if (target !== void 0 && targetViolation === null && target !== this.baseUrl) {
17288
+ const retryUrl = buildUrl(target, s.wirePath);
17289
+ if (s.getQuery) assertGetQueryUrlLength(retryUrl);
17109
17290
  s.zoneRetry = { from: this.baseUrl, to: target };
17110
17291
  this.repointZoneBase(target);
17111
- s.url = buildUrl(this.baseUrl, opts.path, opts.query);
17292
+ s.url = retryUrl;
17293
+ s.ctx.url = s.url.split("?", 1)[0];
17112
17294
  return RETRY;
17113
17295
  }
17114
17296
  }
@@ -17116,10 +17298,11 @@ var HttpClient = class {
17116
17298
  const err = errorFromStatus(
17117
17299
  status,
17118
17300
  body,
17119
- s.url,
17301
+ s.ctx.url,
17120
17302
  opts.operation,
17121
17303
  this.redactPersonalData,
17122
- credentialShapeExpectation(s.headers, this.auth)
17304
+ credentialShapeExpectation(s.headers, this.auth),
17305
+ !s.getQuery
17123
17306
  );
17124
17307
  err.correlationId = s.correlationId;
17125
17308
  this.stampMaintenance(s, err);
@@ -17204,11 +17387,20 @@ var HttpClient = class {
17204
17387
  async request(opts) {
17205
17388
  const method = opts.method;
17206
17389
  const url = buildUrl(this.baseUrl, opts.path, opts.query);
17390
+ const wirePath = url.slice(this.baseUrl.length);
17391
+ const path = wirePath.split("?", 1)[0];
17392
+ const route = decodeURIComponent(path);
17393
+ const auditTarget = auditReadTarget(route, opts.operation);
17207
17394
  const headers = withAuthHeaders(opts.headers, this.auth);
17208
17395
  assertCredentialShape(headers, this.auth);
17209
- if (opts.path.includes("/query")) assertNoQueryRelationLeaf(opts);
17210
- if (opts.body !== void 0) headers["Content-Type"] = "application/json";
17396
+ const requestUrl = new URL(url);
17397
+ const queryRoute = /\/query(?:\/|$)/i.test(route);
17398
+ const getQuery = method === "GET" && queryRoute && requestUrl.search !== "";
17399
+ if (getQuery) assertGetQueryUrlLength(url);
17211
17400
  const bodyText = opts.body !== void 0 ? JSON.stringify(opts.body) : void 0;
17401
+ if (queryRoute) assertQueryFilters(opts, requestUrl, auditTarget === "query" || auditTarget === "query/count", bodyText);
17402
+ opts = { ...opts, path };
17403
+ if (bodyText !== void 0) headers["Content-Type"] = "application/json";
17212
17404
  const correlationId = newCorrelationId();
17213
17405
  const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
17214
17406
  const started = Date.now();
@@ -17216,7 +17408,10 @@ var HttpClient = class {
17216
17408
  const deadline = new AbortController();
17217
17409
  const s = {
17218
17410
  opts,
17411
+ wirePath,
17412
+ getQuery,
17219
17413
  method,
17414
+ auditTarget,
17220
17415
  url,
17221
17416
  headers,
17222
17417
  bodyText,
@@ -17257,7 +17452,7 @@ var HttpClient = class {
17257
17452
  // undefined (the vendor's 204 / empty delete answer; the delete callers
17258
17453
  // synthesize the result from the path id).
17259
17454
  expectBody: opts.expectBody ?? method !== "DELETE",
17260
- ctx: { operation: opts.operation, url, correlationId },
17455
+ ctx: { operation: opts.operation, url: url.split("?", 1)[0], correlationId },
17261
17456
  lastStatus: void 0,
17262
17457
  zoneRetry: void 0,
17263
17458
  attempt: 0,
@@ -17309,19 +17504,30 @@ function isMaintenancePage(status, contentType, text) {
17309
17504
  return true;
17310
17505
  }
17311
17506
  }
17312
- function assertNoQueryRelationLeaf(opts) {
17313
- const operation = opts.operation ?? opts.path;
17314
- const body = opts.body;
17315
- if (body !== null && typeof body === "object") assertNoRelationLeaf(body.filter, operation);
17316
- const search = opts.query?.["search"];
17317
- if (typeof search !== "string") return;
17318
- let parsed;
17319
- try {
17320
- parsed = JSON.parse(search);
17321
- } catch {
17322
- return;
17507
+ function assertQueryFilters(opts, url, auditIds, bodyText) {
17508
+ const operation = opts.operation ?? opts.path.split("?", 1)[0];
17509
+ const validate7 = (value) => {
17510
+ if (value === null || typeof value !== "object") return;
17511
+ for (const [key, filter] of Object.entries(value)) {
17512
+ if (key.toLowerCase() === "filter") assertQueryFilterForWire(filter, operation, auditIds);
17513
+ }
17514
+ };
17515
+ const parse = (json) => auditIds ? JSON.parse(
17516
+ json,
17517
+ (_key, value, context) => typeof value === "number" && context?.source !== void 0 && !isAuditDecimalId(context.source) ? null : value
17518
+ ) : JSON.parse(json);
17519
+ validate7(auditIds && bodyText !== void 0 ? parse(bodyText) : opts.body);
17520
+ for (const [key, search] of url.searchParams) {
17521
+ if (key.toLowerCase() !== "search") continue;
17522
+ let parsed;
17523
+ try {
17524
+ parsed = parse(search);
17525
+ } catch {
17526
+ if (auditIds) throw new AutotaskConfigError("Expected a JSON search object for the audit query.", { operation });
17527
+ continue;
17528
+ }
17529
+ validate7(parsed);
17323
17530
  }
17324
- if (parsed !== null && typeof parsed === "object") assertNoRelationLeaf(parsed.filter, operation);
17325
17531
  }
17326
17532
 
17327
17533
  // src/pagination.ts
@@ -17341,7 +17547,7 @@ async function* paginate(fetchPage, opts = {}) {
17341
17547
  }
17342
17548
  const p = await fetchPage(page, pageSize);
17343
17549
  yield p;
17344
- if (!p.hasMore || p.items.length === 0) return;
17550
+ if (!p.hasMore || p.items.length === 0 && !opts.continueOnEmpty) return;
17345
17551
  page += 1;
17346
17552
  }
17347
17553
  }
@@ -19027,6 +19233,9 @@ var MODEL_FIELD_SETS = {
19027
19233
  "contracts": ["id", "billingPreference", "billToCompanyContactID", "billToCompanyID", "companyID", "contactID", "contactName", "contractCategory", "contractExclusionSetID", "contractName", "contractNumber", "contractPeriodType", "contractType", "description", "endDate", "estimatedCost", "estimatedHours", "estimatedRevenue", "exclusionContractID", "internalCurrencyOverageBillingRate", "internalCurrencySetupFee", "isCompliant", "isDefaultContract", "lastModifiedDateTime", "opportunityID", "organizationalLevelAssociationID", "overageBillingRate", "purchaseOrderNumber", "renewedContractID", "serviceLevelAgreementID", "setupFee", "setupFeeBillingCodeID", "startDate", "status", "timeReportingRequiresStartAndStopTimes", "userDefinedFields"],
19028
19234
  "countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
19029
19235
  "currencies": ["id", "currencyNegativeFormat", "currencyPositiveFormat", "description", "displaySymbol", "exchangeRate", "isActive", "isInternalCurrency", "lastModifiedDateTime", "name", "updateResourceId"],
19236
+ "deleted_task_activity_logs": ["id", "typeID", "taskID", "taskNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
19237
+ "deleted_ticket_activity_logs": ["id", "typeID", "ticketID", "ticketNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
19238
+ "deleted_ticket_logs": ["id", "ticketID", "ticketNumber", "ticketTitle", "deletedByResourceID", "deletedDateTime"],
19030
19239
  "departments": ["id", "description", "name", "number", "primaryLocationID"],
19031
19240
  "domain_registrars": ["id", "name", "url"],
19032
19241
  "expense_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
@@ -19142,6 +19351,9 @@ var MODEL_DATE_FIELDS = {
19142
19351
  "contract_ticket_purchases": ["datePurchased", "endDate", "startDate"],
19143
19352
  "contracts": ["endDate", "lastModifiedDateTime", "startDate"],
19144
19353
  "currencies": ["lastModifiedDateTime"],
19354
+ "deleted_task_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
19355
+ "deleted_ticket_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
19356
+ "deleted_ticket_logs": ["deletedDateTime"],
19145
19357
  "expense_item_attachments": ["attachDate"],
19146
19358
  "expense_items": ["expenseDate"],
19147
19359
  "expense_report_attachments": ["attachDate"],
@@ -19541,14 +19753,20 @@ var QueryBase = class {
19541
19753
  // ------------------------------------------------------------------
19542
19754
  // Query walk (wired to the G3 walker; cursor-follow per the pinned wire)
19543
19755
  // ------------------------------------------------------------------
19544
- /** One page fetch: page 1 POSTs the QueryModel body; later pages POST the same body (`buildQueryBody`) to the absolute cursor (issue #118). */
19756
+ /** Follow the vendor cursor with the initial query method and, for POST, the same QueryModel (issue #118). */
19545
19757
  async fetchPage(params, page, pageSize, state2) {
19546
- if (params.includeFields !== void 0) {
19758
+ if (state2.initialRequest === void 0 && params.includeFields !== void 0) {
19547
19759
  params = { ...params, includeFields: params.includeFields.map((field) => normalizeOwnField(this.config.key, field)) };
19548
19760
  }
19549
19761
  const operation = `${this.config.key}.query`;
19550
19762
  if (page === 1) {
19763
+ const filter = normalizedConditions(params.filter);
19764
+ if (filter !== void 0 && isAuditLogResource(this.config.key)) {
19765
+ assertQueryFilterForWire(normalizeInValues(filter), operation, true);
19766
+ }
19551
19767
  const req = buildQueryRequest(this.http.baseUrl, this.resourcePath, { ...params, maxRecords: pageSize });
19768
+ if (req.body !== void 0) req.body = JSON.parse(JSON.stringify(req.body));
19769
+ state2.initialRequest = req;
19552
19770
  const body2 = await this.http.request({ ...req, operation });
19553
19771
  return this.readPage(body2, page, pageSize, state2);
19554
19772
  }
@@ -19560,10 +19778,25 @@ var QueryBase = class {
19560
19778
  operation
19561
19779
  });
19562
19780
  }
19563
- const body = buildQueryBody({ ...params, maxRecords: pageSize });
19781
+ const cursorResource = isAuditLogResource(this.config.key) ? this.resourcePath : void 0;
19782
+ if (state2.initialRequest?.method === "GET") {
19783
+ const path = cursorToPath(this.http.baseUrl, cursor, cursorResource);
19784
+ const separator = path.indexOf("?");
19785
+ const route = separator < 0 ? path : path.slice(0, separator);
19786
+ const cursorParams = new URLSearchParams(separator < 0 ? "" : path.slice(separator + 1));
19787
+ const search = state2.initialRequest.query?.search;
19788
+ for (const key of [...cursorParams.keys()]) {
19789
+ if (key.toLowerCase() === "search") cursorParams.delete(key);
19790
+ }
19791
+ if (typeof search === "string") cursorParams.set("search", search);
19792
+ const req = buildQueryGetRequest(this.http.baseUrl, route + "?" + cursorParams.toString());
19793
+ const body2 = await this.http.request({ ...req, operation });
19794
+ return this.readPage(body2, page, pageSize, state2);
19795
+ }
19796
+ const body = state2.initialRequest?.body ?? buildQueryBody({ ...params, maxRecords: pageSize });
19564
19797
  const res = await this.http.request({
19565
19798
  method: "POST",
19566
- path: cursorToPath(this.http.baseUrl, cursor),
19799
+ path: cursorToPath(this.http.baseUrl, cursor, cursorResource),
19567
19800
  body,
19568
19801
  operation,
19569
19802
  idempotent: true
@@ -19622,10 +19855,10 @@ var QueryBase = class {
19622
19855
  const walk = await this.relationWalkParams(rest, `${this.config.key}.query`);
19623
19856
  if (walk === void 0) return;
19624
19857
  if (!label || client === void 0) {
19625
- yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
19858
+ yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
19626
19859
  return;
19627
19860
  }
19628
- for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) })) {
19861
+ for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) })) {
19629
19862
  const labelled = await labelRows(client, this.config.key, page.items);
19630
19863
  yield* labelled.rows;
19631
19864
  }
@@ -19634,13 +19867,13 @@ var QueryBase = class {
19634
19867
  async *queryPageIter(params) {
19635
19868
  const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
19636
19869
  if (walk === void 0) return;
19637
- yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
19870
+ yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
19638
19871
  }
19639
19872
  /** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded; relation filters resolve first, #281). */
19640
19873
  async queryAllItems(params) {
19641
19874
  const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
19642
19875
  if (walk === void 0) return [];
19643
- return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), maxRecords: walk.maxTotalRecords });
19876
+ return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key), maxRecords: walk.maxTotalRecords });
19644
19877
  }
19645
19878
  /**
19646
19879
  * `queryBounded` — server-side pagination (the MCP query surface): ONE call
@@ -19651,12 +19884,10 @@ var QueryBase = class {
19651
19884
  * AutotaskConfigError; it is NOT a page size). The page-1 request uses
19652
19885
  * the internal page size min(500, limit) (the `latest` mechanism sizes
19653
19886
  * its walk from the matching count). Explicit `walk.maxRows` replaces
19654
- * the total cap; `limit` then only sizes pages. Every follow-up page POSTs the
19655
- * SAME QueryModel body (`buildQueryBody`: MaxRecords, IncludeFields and
19656
- * the preserved filter) to the absolute cursor (issue #118 — the vendor
19657
- * honours IncludeFields there and ignores MaxRecords, serving its own
19658
- * page size), so the walk reuses `fetchPage` (the shared cursor machinery)
19659
- * with a per-walk closure state (walks never share state).
19887
+ * the total cap; `limit` then only sizes pages. Continuations follow the
19888
+ * cursor with the initial method. POST keeps the same QueryModel body
19889
+ * across pages (issue #118). GET combines the cursor with the original search.
19890
+ * Each walk keeps its own request and cursor state.
19660
19891
  * - The 1000-page guard still applies as a SOFT stop: a walk that would
19661
19892
  * fetch a 1001st page stops with `hasMore: true` (never a throw — this
19662
19893
  * is a bounded read, not the `paginate` generator's error path).
@@ -19818,7 +20049,7 @@ var QueryBase = class {
19818
20049
  if (consume === void 0) items.push(...take);
19819
20050
  else await consume(take, pages2);
19820
20051
  if (fetched >= limit) break;
19821
- if (!page.hasMore || page.items.length === 0) break;
20052
+ if (!page.hasMore || page.items.length === 0 && !isAuditLogResource(this.config.key)) break;
19822
20053
  }
19823
20054
  const names = nameNotes.size === 0 ? void 0 : {
19824
20055
  note: [...nameNotes].join("; "),
@@ -19965,13 +20196,17 @@ var QueryBase = class {
19965
20196
  };
19966
20197
  let lo = 0n;
19967
20198
  let hi;
19968
- for (let t = 1n; ; t = t << 1n) {
19969
- spend();
19970
- if (await this.countAboveId(baseConds, t) <= latest) {
19971
- hi = t;
19972
- break;
20199
+ if (isAuditLogResource(this.config.key)) {
20200
+ hi = BigInt(MAX_AUDIT_ID);
20201
+ } else {
20202
+ for (let t = 1n; ; t = t << 1n) {
20203
+ spend();
20204
+ if (await this.countAboveId(baseConds, t) <= latest) {
20205
+ hi = t;
20206
+ break;
20207
+ }
20208
+ lo = t;
19973
20209
  }
19974
- lo = t;
19975
20210
  }
19976
20211
  while (hi - lo > 1n) {
19977
20212
  const mid = lo + hi >> 1n;
@@ -22328,6 +22563,36 @@ var SIMPLE_RESOURCES = [
22328
22563
  helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22329
22564
  opForms: { get: "global", update: "global" }
22330
22565
  },
22566
+ {
22567
+ key: "deleted_task_activity_logs",
22568
+ accessor: "deletedTaskActivityLogs",
22569
+ resourcePath: "/V1.0/DeletedTaskActivityLogs",
22570
+ deletable: false,
22571
+ udfCapable: false,
22572
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22573
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22574
+ opForms: { get: "global" }
22575
+ },
22576
+ {
22577
+ key: "deleted_ticket_activity_logs",
22578
+ accessor: "deletedTicketActivityLogs",
22579
+ resourcePath: "/V1.0/DeletedTicketActivityLogs",
22580
+ deletable: false,
22581
+ udfCapable: false,
22582
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22583
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22584
+ opForms: { get: "global" }
22585
+ },
22586
+ {
22587
+ key: "deleted_ticket_logs",
22588
+ accessor: "deletedTicketLogs",
22589
+ resourcePath: "/V1.0/DeletedTicketLogs",
22590
+ deletable: false,
22591
+ udfCapable: false,
22592
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22593
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22594
+ opForms: { get: "global" }
22595
+ },
22331
22596
  {
22332
22597
  key: "departments",
22333
22598
  accessor: "departments",
@@ -23337,7 +23602,7 @@ var GenericResource = class extends BaseResource {
23337
23602
  }
23338
23603
  async fetchPage(params, page, pageSize, state2) {
23339
23604
  const key = this.config.key;
23340
- if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
23605
+ if (state2.initialRequest === void 0 && isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
23341
23606
  return super.fetchPage(params, page, pageSize, state2);
23342
23607
  }
23343
23608
  async countGlobal(params) {
@@ -25343,6 +25608,9 @@ async function validateAggregate(operation, filter, opts) {
25343
25608
  const known = await checkFieldNames(resourceKey, conditions, opts, problems);
25344
25609
  const groupBy = parseGroupBy(opts, oracles, known, problems);
25345
25610
  const sum = checkSumFields("sum", opts.sum, problems);
25611
+ if (resourceKey !== void 0 && isAuditLogResource(resourceKey) && sum.some((field) => field.toLowerCase() === "id")) {
25612
+ problems.push("sum: audit log IDs are exact identifiers. Use groupBy for IDs or count for record totals.");
25613
+ }
25346
25614
  const { top, limit } = parseTopAndLimit(opts, problems);
25347
25615
  if (problems.length > 0) {
25348
25616
  throw new AutotaskConfigError(
@@ -25653,7 +25921,10 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
25653
25921
  continue;
25654
25922
  }
25655
25923
  try {
25656
- parseIdentifier(item.id, `${at}.id`);
25924
+ const id = parseIdentifier(item.id, `${at}.id`);
25925
+ if (isAuditLogResource(resourceKey) && !isAuditDecimalId(String(id))) {
25926
+ problems.push(`${at}.id: audit log ID must be a non-negative signed 64-bit integer`);
25927
+ }
25657
25928
  } catch {
25658
25929
  if (typeof item.id === "string") {
25659
25930
  problems.push(