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,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkQCA5R7QF_cjs = require('./chunk-QCA5R7QF.cjs');
3
+ var chunkMVGGHMOB_cjs = require('./chunk-MVGGHMOB.cjs');
4
4
  var chunkBD4AUGCJ_cjs = require('./chunk-BD4AUGCJ.cjs');
5
5
  var crypto = require('crypto');
6
6
  var async_hooks = require('async_hooks');
@@ -404,13 +404,14 @@ function suggestedActionForStatus(status) {
404
404
  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;
405
405
  }
406
406
  }
407
- function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential) {
407
+ function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential, includeVendorDetails = true) {
408
408
  const safeBody = redactResponseBody(body, { redactPersonalData });
409
- let detail = formatVendorDetail(safeBody);
409
+ const exposedBody = includeVendorDetails ? safeBody : void 0;
410
+ let detail = formatVendorDetail(exposedBody);
410
411
  if (detail !== void 0 && detail.length > VENDOR_BODY_SUFFIX_LIMIT) {
411
412
  detail = detail.slice(0, VENDOR_BODY_SUFFIX_LIMIT);
412
413
  }
413
- const suffix = detail === void 0 ? vendorBodySuffix(safeBody) : void 0;
414
+ const suffix = detail === void 0 ? vendorBodySuffix(exposedBody) : void 0;
414
415
  const message = detail ?? (suffix !== void 0 ? `${statusDefaultMessage(status)}: ${suffix}` : statusDefaultMessage(status));
415
416
  const shape = errorShapeForStatus(status);
416
417
  const Ctor = shape?.Ctor ?? AutotaskError;
@@ -421,10 +422,10 @@ function errorFromStatus(status, body, url, operation, redactPersonalData = true
421
422
  const credentialDetails = status === 401 ? credentialDiagnosticDetails(credential) : void 0;
422
423
  const extraDetails = mergeDetails(void 0, credentialDetails);
423
424
  const err = new Ctor(message, {
424
- code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) ? vendorCodeCandidate : code,
425
+ code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) && (includeVendorDetails || vendorCodeCandidate.toLowerCase() === "itgenatr005") ? vendorCodeCandidate : code,
425
426
  ...category !== void 0 ? { category } : {},
426
427
  httpStatus: status,
427
- vendorError: safeBody,
428
+ vendorError: exposedBody,
428
429
  url,
429
430
  operation,
430
431
  retryable: status === 429 || status >= 500,
@@ -1443,6 +1444,11 @@ function resolveConfig(config) {
1443
1444
 
1444
1445
  // src/http/types.ts
1445
1446
  var IDEMPOTENT_METHODS = ["GET", "PUT", "DELETE"];
1447
+ var AUDIT_DECIMAL_ID = /^(?:0|[1-9]\d{0,18})$/;
1448
+ var MAX_AUDIT_ID = "9223372036854775807";
1449
+ function isAuditDecimalId(id) {
1450
+ return AUDIT_DECIMAL_ID.test(id) && (id.length < MAX_AUDIT_ID.length || id <= MAX_AUDIT_ID);
1451
+ }
1446
1452
  function isRecord2(value) {
1447
1453
  return typeof value === "object" && value !== null && !Array.isArray(value);
1448
1454
  }
@@ -1640,17 +1646,39 @@ function refusedFilterShape(filter) {
1640
1646
  if (t === "object" || t === "function") return "an object";
1641
1647
  return t === "string" ? "a string" : `a ${t}`;
1642
1648
  }
1643
- function assertNoRelationLeaf(conditions, operation) {
1649
+ function assertQueryFilterForWire(conditions, operation, auditIds) {
1644
1650
  if (!Array.isArray(conditions)) return;
1645
- for (const c of conditions) {
1646
- if (!isRecord2(c)) continue;
1647
- if (Array.isArray(c.items)) assertNoRelationLeaf(c.items, operation);
1648
- else if (c.udf !== true && typeof c.field === "string" && c.field.includes(".")) {
1651
+ for (const input of conditions) {
1652
+ if (!isRecord2(input)) continue;
1653
+ const c = auditIds ? {} : input;
1654
+ if (auditIds) {
1655
+ for (const [key, value] of Object.entries(input)) {
1656
+ const lower = key.toLowerCase();
1657
+ if (!["op", "field", "value", "items", "udf"].includes(lower)) continue;
1658
+ if (Object.hasOwn(c, lower)) {
1659
+ throw new AutotaskConfigError("Audit filter predicates must provide each field once.", { operation });
1660
+ }
1661
+ c[lower] = value;
1662
+ }
1663
+ }
1664
+ if (Array.isArray(c.items)) assertQueryFilterForWire(c.items, operation, auditIds);
1665
+ if (c.udf === true || typeof c.field !== "string") continue;
1666
+ if (c.field.includes(".")) {
1649
1667
  throw new AutotaskConfigError(
1650
1668
  `${operation}: filter field "${c.field}" is a relation filter that was not resolved on this path \u2014 the request was not issued`,
1651
1669
  { operation, suggestedAction: "Use a query surface that resolves relation filters (query, queryAll, queryBounded, count, operations.aggregate), or filter by the <relation>ID field directly." }
1652
1670
  );
1653
1671
  }
1672
+ if (auditIds && c.field.trim().toLowerCase() === "id") {
1673
+ const values = Array.isArray(c.value) ? c.value : [c.value];
1674
+ if (c.value === void 0 && (c.op === "exist" || c.op === "notExist")) continue;
1675
+ if (values.length === 0 || values.some((value) => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !isAuditDecimalId(value))) {
1676
+ throw new AutotaskConfigError(`${operation}: audit log ID filters require a safe integer or an exact decimal string.`, {
1677
+ operation,
1678
+ suggestedAction: "Pass each large ID as an exact decimal string."
1679
+ });
1680
+ }
1681
+ }
1654
1682
  }
1655
1683
  }
1656
1684
 
@@ -1667,14 +1695,14 @@ function assertSafePath(path) {
1667
1695
  return decoded === "." || decoded === ".." || /[/\\]/.test(decoded);
1668
1696
  });
1669
1697
  if (bad) {
1670
- 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 '/')`);
1698
+ 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 '/')`);
1671
1699
  }
1672
1700
  }
1673
1701
  function buildUrl(baseUrl, path, query) {
1674
1702
  assertSafePath(path);
1675
1703
  let url = baseUrl + path;
1676
1704
  if (new URL(url).origin !== new URL(baseUrl).origin) {
1677
- throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: it leaves the configured origin`);
1705
+ throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.split("?", 1)[0].slice(0, 200))}: it leaves the configured origin`);
1678
1706
  }
1679
1707
  if (query !== void 0) {
1680
1708
  const params = new URLSearchParams();
@@ -1683,11 +1711,11 @@ function buildUrl(baseUrl, path, query) {
1683
1711
  params.set(key, String(value));
1684
1712
  }
1685
1713
  const qs = params.toString();
1686
- if (qs.length > 0) url += `?${qs}`;
1714
+ if (qs.length > 0) url += `${path.includes("?") ? "&" : "?"}${qs}`;
1687
1715
  }
1688
1716
  return url;
1689
1717
  }
1690
- function cursorToPath(baseUrl, cursor) {
1718
+ function cursorToPath(baseUrl, cursor, resourcePath) {
1691
1719
  const base = new URL(baseUrl);
1692
1720
  let url;
1693
1721
  try {
@@ -1700,6 +1728,18 @@ function cursorToPath(baseUrl, cursor) {
1700
1728
  }
1701
1729
  const basePath = base.pathname.replace(/\/+$/, "");
1702
1730
  const path = basePath !== "" && url.pathname.startsWith(`${basePath}/`) ? url.pathname.slice(basePath.length) : url.pathname;
1731
+ if (resourcePath !== void 0) {
1732
+ let route;
1733
+ try {
1734
+ route = decodeURIComponent(path).toLowerCase().replace(/\/$/, "");
1735
+ } catch {
1736
+ throw new ResponseRejectedError("Refused the pagination cursor: invalid path encoding.");
1737
+ }
1738
+ const query = `${resourcePath.toLowerCase()}/query`;
1739
+ if (route !== query && route !== `${query}/next`) {
1740
+ throw new ResponseRejectedError("Refused the pagination cursor outside the original query route.");
1741
+ }
1742
+ }
1703
1743
  return path + url.search;
1704
1744
  }
1705
1745
  function buildQueryBody(params) {
@@ -1716,6 +1756,16 @@ function effectiveIncludeFields(params) {
1716
1756
  if (params.includeFields === void 0) return void 0;
1717
1757
  return params.includeFields.includes("id") ? params.includeFields : [...params.includeFields, "id"];
1718
1758
  }
1759
+ function assertGetQueryUrlLength(url) {
1760
+ const length = new URL(url).href.length;
1761
+ if (length > MAX_GET_LENGTH) {
1762
+ throw new QueryTooLongError(`GET query URL is ${length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`);
1763
+ }
1764
+ }
1765
+ function buildQueryGetRequest(baseUrl, path, query) {
1766
+ assertGetQueryUrlLength(buildUrl(baseUrl, path, query));
1767
+ return { method: "GET", path, query };
1768
+ }
1719
1769
  function buildQueryRequest(baseUrl, resourcePath, params) {
1720
1770
  const queryPath = `${resourcePath}/query`;
1721
1771
  if (params.via === "get") {
@@ -1726,18 +1776,7 @@ function buildQueryRequest(baseUrl, resourcePath, params) {
1726
1776
  if (filter !== void 0) search.filter = filter.filter;
1727
1777
  if (params.maxRecords !== void 0) search.maxRecords = params.maxRecords;
1728
1778
  if (includeFields !== void 0) search.includeFields = includeFields;
1729
- const req = {
1730
- method: "GET",
1731
- path: queryPath,
1732
- query: { search: JSON.stringify(search) }
1733
- };
1734
- const url = buildUrl(baseUrl, queryPath, req.query);
1735
- if (url.length > MAX_GET_LENGTH) {
1736
- throw new QueryTooLongError(
1737
- `GET query URL is ${url.length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`
1738
- );
1739
- }
1740
- return req;
1779
+ return buildQueryGetRequest(baseUrl, queryPath, { search: JSON.stringify(search) });
1741
1780
  }
1742
1781
  return { method: "POST", path: queryPath, body: buildQueryBody(params), idempotent: true };
1743
1782
  }
@@ -10658,6 +10697,69 @@ var RELATIONSHIP_MAP = {
10658
10697
  },
10659
10698
  "deleteBoundary": null,
10660
10699
  "markerField": null
10700
+ },
10701
+ "deleted_task_activity_logs": {
10702
+ "resource": "deleted_task_activity_logs",
10703
+ "apiEntity": "DeletedTaskActivityLog",
10704
+ "kind": "entity",
10705
+ "path": "DeletedTaskActivityLogs",
10706
+ "parentScoped": false,
10707
+ "tier": "advanced",
10708
+ "workflowResource": false,
10709
+ "group": "B",
10710
+ "parent": null,
10711
+ "children": [],
10712
+ "naturalKeys": {
10713
+ "hasSearch": false,
10714
+ "searchCovers": null,
10715
+ "findBy": []
10716
+ },
10717
+ "blindSurfaces": null,
10718
+ "zoneFacts": null,
10719
+ "deleteBoundary": null,
10720
+ "markerField": null
10721
+ },
10722
+ "deleted_ticket_activity_logs": {
10723
+ "resource": "deleted_ticket_activity_logs",
10724
+ "apiEntity": "DeletedTicketActivityLog",
10725
+ "kind": "entity",
10726
+ "path": "DeletedTicketActivityLogs",
10727
+ "parentScoped": false,
10728
+ "tier": "advanced",
10729
+ "workflowResource": false,
10730
+ "group": "B",
10731
+ "parent": null,
10732
+ "children": [],
10733
+ "naturalKeys": {
10734
+ "hasSearch": false,
10735
+ "searchCovers": null,
10736
+ "findBy": []
10737
+ },
10738
+ "blindSurfaces": null,
10739
+ "zoneFacts": null,
10740
+ "deleteBoundary": null,
10741
+ "markerField": null
10742
+ },
10743
+ "deleted_ticket_logs": {
10744
+ "resource": "deleted_ticket_logs",
10745
+ "apiEntity": "DeletedTicketLog",
10746
+ "kind": "entity",
10747
+ "path": "DeletedTicketLogs",
10748
+ "parentScoped": false,
10749
+ "tier": "advanced",
10750
+ "workflowResource": false,
10751
+ "group": "B",
10752
+ "parent": null,
10753
+ "children": [],
10754
+ "naturalKeys": {
10755
+ "hasSearch": false,
10756
+ "searchCovers": null,
10757
+ "findBy": []
10758
+ },
10759
+ "blindSurfaces": null,
10760
+ "zoneFacts": null,
10761
+ "deleteBoundary": null,
10762
+ "markerField": null
10661
10763
  }
10662
10764
  };
10663
10765
  var BLIND_SURFACE_STAMPS = {
@@ -15986,6 +16088,15 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
15986
16088
  ],
15987
16089
  "resource_attachments": [
15988
16090
  "title"
16091
+ ],
16092
+ "deleted_task_activity_logs": [
16093
+ "noteOrAttachmentTitle"
16094
+ ],
16095
+ "deleted_ticket_activity_logs": [
16096
+ "noteOrAttachmentTitle"
16097
+ ],
16098
+ "deleted_ticket_logs": [
16099
+ "ticketTitle"
15989
16100
  ]
15990
16101
  };
15991
16102
 
@@ -16422,6 +16533,74 @@ function credentialShapeExpectation(headers, auth) {
16422
16533
 
16423
16534
  // src/http/envelope.ts
16424
16535
  var INVALID_SHAPE_ACTION = "Report the unexpected response shape; verify baseUrl points at the REST API.";
16536
+ var AUDIT_READ_PATH = /^\/v1\.0\/(DeletedTaskActivityLogs|DeletedTicketActivityLogs|DeletedTicketLogs)\/(query\/(?:next|previous|count)|[^/?]+)\/?(?:\?.*)?$/i;
16537
+ function isAuditLogResource(resource) {
16538
+ return /^(deleted_task_activity_logs|deleted_ticket_activity_logs|deleted_ticket_logs)$/.test(resource);
16539
+ }
16540
+ function isDeletedAuditRead(operation) {
16541
+ const [resource = "", verb, suffix] = operation?.split(".") ?? [];
16542
+ return suffix === void 0 && (verb === "get" || verb === "query") && isAuditLogResource(resource);
16543
+ }
16544
+ function auditReadTarget(path, operation) {
16545
+ const match = AUDIT_READ_PATH.exec(path);
16546
+ const target = match?.[2]?.toLowerCase();
16547
+ if (target === "query" || target === "query/next" || target === "query/previous") return "query";
16548
+ if (target === "entityinformation") return void 0;
16549
+ if (target === "query/count") return target;
16550
+ if (target !== void 0 && !isAuditDecimalId(target)) {
16551
+ throw new AutotaskConfigError("Audit log ID must be a non-negative signed 64-bit integer.", { operation });
16552
+ }
16553
+ return target;
16554
+ }
16555
+ function decodeResponseJson(text, auditTarget) {
16556
+ if (auditTarget === void 0) return JSON.parse(text);
16557
+ if (auditTarget === "query/count") {
16558
+ return JSON.parse(text, (key, value, context) => key === "queryCount" && typeof value === "number" && !isAuditDecimalId(context?.source ?? "") ? null : value);
16559
+ }
16560
+ const idTokens = /* @__PURE__ */ new WeakMap();
16561
+ const body = JSON.parse(text, function(key, value, context) {
16562
+ if (key === "id" && typeof value === "number" && context?.source !== void 0) {
16563
+ idTokens.set(this, context.source);
16564
+ }
16565
+ return value;
16566
+ });
16567
+ const rows = isRecord2(body) ? auditTarget === "query" ? body.items : [body.item] : void 0;
16568
+ if (Array.isArray(rows)) {
16569
+ for (const row of rows) {
16570
+ if (!isRecord2(row) || typeof row.id !== "number") continue;
16571
+ const token = idTokens.get(row);
16572
+ if (token === void 0 || !isAuditDecimalId(token)) row.id = null;
16573
+ else if (!Number.isSafeInteger(row.id)) row.id = token;
16574
+ }
16575
+ }
16576
+ return body;
16577
+ }
16578
+ function isAuditItem(item) {
16579
+ if (!isRecord2(item)) return false;
16580
+ const { id } = item;
16581
+ return typeof id === "number" ? Number.isSafeInteger(id) && id >= 0 : typeof id === "string" && isAuditDecimalId(id);
16582
+ }
16583
+ function isAuditPage(body) {
16584
+ if (!Array.isArray(body.items) || !isRecord2(body.pageDetails)) return false;
16585
+ const { nextPageUrl } = body.pageDetails;
16586
+ return (nextPageUrl === null || typeof nextPageUrl === "string" && nextPageUrl.trim() !== "") && body.items.every(isAuditItem);
16587
+ }
16588
+ function validateAuditResponse(body, target, operation) {
16589
+ if (target === void 0) return;
16590
+ if (target === "query/count") {
16591
+ unwrapQueryCount(body, operation);
16592
+ return;
16593
+ }
16594
+ const valid = isRecord2(body) && (target === "query" ? isAuditPage(body) : body.item === null || isAuditItem(body.item) && String(body.item.id) === target);
16595
+ if (!valid) {
16596
+ throw new AutotaskError("Expected a valid audit log response for the requested path.", {
16597
+ code: "INVALID_RESPONSE",
16598
+ category: "server",
16599
+ operation,
16600
+ suggestedAction: INVALID_SHAPE_ACTION
16601
+ });
16602
+ }
16603
+ }
16425
16604
  function attachEmptyReasonDetails(err) {
16426
16605
  if (err.operation === void 0) return;
16427
16606
  const dot = err.operation.indexOf(".");
@@ -16447,7 +16626,7 @@ function attachEmptyReasonDetails(err) {
16447
16626
  } : {
16448
16627
  surface,
16449
16628
  kind: "not-found",
16450
- note: `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
16629
+ 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)`,
16451
16630
  authority: `${resource}.query`,
16452
16631
  remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface \u2014 do not retry the same get`
16453
16632
  };
@@ -16485,7 +16664,7 @@ function unwrapItem(body, id, operation, entity) {
16485
16664
  resourceIds: id !== void 0 ? [id] : void 0,
16486
16665
  ...id !== void 0 && entity !== void 0 ? { details: { idRefs: [{ entity, id }] } } : {},
16487
16666
  operation,
16488
- suggestedAction: "Verify the id, or resolve the record by name first."
16667
+ suggestedAction: isDeletedAuditRead(operation) ? "Verify the log ID and check API-user access." : "Verify the id, or resolve the record by name first."
16489
16668
  }
16490
16669
  );
16491
16670
  attachEmptyReasonDetails(err);
@@ -16494,8 +16673,9 @@ function unwrapItem(body, id, operation, entity) {
16494
16673
  return item;
16495
16674
  }
16496
16675
  function unwrapQueryCount(body, operation) {
16497
- if (!isRecord2(body) || typeof body.queryCount !== "number") {
16498
- const err = new AutotaskError("Expected the count envelope { queryCount: number }; got a different shape", {
16676
+ const count = isRecord2(body) ? body.queryCount : void 0;
16677
+ if (typeof count !== "number" || !Number.isInteger(count) || count < 0 || count > 2147483647) {
16678
+ const err = new AutotaskError("Expected the count envelope { queryCount: non-negative int32 }", {
16499
16679
  code: "INVALID_RESPONSE",
16500
16680
  category: "server",
16501
16681
  operation,
@@ -16504,7 +16684,7 @@ function unwrapQueryCount(body, operation) {
16504
16684
  attachEmptyReasonDetails(err);
16505
16685
  throw err;
16506
16686
  }
16507
- return body.queryCount;
16687
+ return count;
16508
16688
  }
16509
16689
  function unwrapOperation(body, operation) {
16510
16690
  const value = isRecord2(body) ? body.itemId !== void 0 ? body.itemId : body.id : void 0;
@@ -16858,8 +17038,7 @@ var HttpClient = class {
16858
17038
  since,
16859
17039
  retryAfterMs: s.maintenancePollMs,
16860
17040
  httpStatus: status,
16861
- contentType,
16862
- bodySnippet: bodySnippet(text, this.redactPersonalData),
17041
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) },
16863
17042
  maintenanceDetected: true
16864
17043
  },
16865
17044
  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).`
@@ -16964,7 +17143,7 @@ var HttpClient = class {
16964
17143
  return { retry: true };
16965
17144
  }
16966
17145
  throw new AutotaskNetworkError(
16967
- `Network error during ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
17146
+ `Network error during ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
16968
17147
  ctx
16969
17148
  );
16970
17149
  }
@@ -16985,7 +17164,7 @@ var HttpClient = class {
16985
17164
  if (err instanceof AutotaskError) throw err;
16986
17165
  if (s.signal.aborted || isAbortLike(err)) throw this.interrupted(s);
16987
17166
  throw new AutotaskNetworkError(
16988
- `Network error reading the response of ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
17167
+ `Network error reading the response of ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
16989
17168
  ctx
16990
17169
  );
16991
17170
  }
@@ -17012,10 +17191,11 @@ var HttpClient = class {
17012
17191
  }
17013
17192
  let parsed;
17014
17193
  try {
17015
- parsed = JSON.parse(text);
17194
+ parsed = decodeResponseJson(text, s.auditTarget);
17016
17195
  } catch {
17017
17196
  return this.handleNonJson2xx(s, res, status, text);
17018
17197
  }
17198
+ validateAuditResponse(parsed, s.auditTarget, opts.operation);
17019
17199
  return {
17020
17200
  done: true,
17021
17201
  value: opts.skipResponseRedaction ? parsed : redactResponseBody(parsed, { redactPersonalData: this.redactPersonalData }),
@@ -17032,13 +17212,12 @@ var HttpClient = class {
17032
17212
  httpStatus: status,
17033
17213
  details: {
17034
17214
  httpStatus: status,
17035
- contentType,
17036
- bodySnippet: bodySnippet(text, this.redactPersonalData)
17215
+ ...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) }
17037
17216
  },
17038
17217
  // The content-type is host-sourced (a host-supplied
17039
17218
  // baseUrl can serve arbitrary HTML) — capped, never prose;
17040
17219
  // the raw snippet rides details only.
17041
- 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).`
17220
+ 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).`
17042
17221
  }
17043
17222
  ) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
17044
17223
  ...ctx,
@@ -17084,7 +17263,7 @@ var HttpClient = class {
17084
17263
  nonJsonBody = text;
17085
17264
  }
17086
17265
  }
17087
- const nonJsonSnippet = nonJsonBody === void 0 ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
17266
+ const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
17088
17267
  const nonJsonIsMaintenance = s.maintenancePage;
17089
17268
  const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
17090
17269
  if (nonJsonIsMaintenance) {
@@ -17108,9 +17287,12 @@ var HttpClient = class {
17108
17287
  );
17109
17288
  }
17110
17289
  if (target !== void 0 && targetViolation === null && target !== this.baseUrl) {
17290
+ const retryUrl = buildUrl(target, s.wirePath);
17291
+ if (s.getQuery) assertGetQueryUrlLength(retryUrl);
17111
17292
  s.zoneRetry = { from: this.baseUrl, to: target };
17112
17293
  this.repointZoneBase(target);
17113
- s.url = buildUrl(this.baseUrl, opts.path, opts.query);
17294
+ s.url = retryUrl;
17295
+ s.ctx.url = s.url.split("?", 1)[0];
17114
17296
  return RETRY;
17115
17297
  }
17116
17298
  }
@@ -17118,10 +17300,11 @@ var HttpClient = class {
17118
17300
  const err = errorFromStatus(
17119
17301
  status,
17120
17302
  body,
17121
- s.url,
17303
+ s.ctx.url,
17122
17304
  opts.operation,
17123
17305
  this.redactPersonalData,
17124
- credentialShapeExpectation(s.headers, this.auth)
17306
+ credentialShapeExpectation(s.headers, this.auth),
17307
+ !s.getQuery
17125
17308
  );
17126
17309
  err.correlationId = s.correlationId;
17127
17310
  this.stampMaintenance(s, err);
@@ -17206,11 +17389,20 @@ var HttpClient = class {
17206
17389
  async request(opts) {
17207
17390
  const method = opts.method;
17208
17391
  const url = buildUrl(this.baseUrl, opts.path, opts.query);
17392
+ const wirePath = url.slice(this.baseUrl.length);
17393
+ const path = wirePath.split("?", 1)[0];
17394
+ const route = decodeURIComponent(path);
17395
+ const auditTarget = auditReadTarget(route, opts.operation);
17209
17396
  const headers = withAuthHeaders(opts.headers, this.auth);
17210
17397
  assertCredentialShape(headers, this.auth);
17211
- if (opts.path.includes("/query")) assertNoQueryRelationLeaf(opts);
17212
- if (opts.body !== void 0) headers["Content-Type"] = "application/json";
17398
+ const requestUrl = new URL(url);
17399
+ const queryRoute = /\/query(?:\/|$)/i.test(route);
17400
+ const getQuery = method === "GET" && queryRoute && requestUrl.search !== "";
17401
+ if (getQuery) assertGetQueryUrlLength(url);
17213
17402
  const bodyText = opts.body !== void 0 ? JSON.stringify(opts.body) : void 0;
17403
+ if (queryRoute) assertQueryFilters(opts, requestUrl, auditTarget === "query" || auditTarget === "query/count", bodyText);
17404
+ opts = { ...opts, path };
17405
+ if (bodyText !== void 0) headers["Content-Type"] = "application/json";
17214
17406
  const correlationId = newCorrelationId();
17215
17407
  const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
17216
17408
  const started = Date.now();
@@ -17218,7 +17410,10 @@ var HttpClient = class {
17218
17410
  const deadline = new AbortController();
17219
17411
  const s = {
17220
17412
  opts,
17413
+ wirePath,
17414
+ getQuery,
17221
17415
  method,
17416
+ auditTarget,
17222
17417
  url,
17223
17418
  headers,
17224
17419
  bodyText,
@@ -17259,7 +17454,7 @@ var HttpClient = class {
17259
17454
  // undefined (the vendor's 204 / empty delete answer; the delete callers
17260
17455
  // synthesize the result from the path id).
17261
17456
  expectBody: opts.expectBody ?? method !== "DELETE",
17262
- ctx: { operation: opts.operation, url, correlationId },
17457
+ ctx: { operation: opts.operation, url: url.split("?", 1)[0], correlationId },
17263
17458
  lastStatus: void 0,
17264
17459
  zoneRetry: void 0,
17265
17460
  attempt: 0,
@@ -17311,19 +17506,30 @@ function isMaintenancePage(status, contentType, text) {
17311
17506
  return true;
17312
17507
  }
17313
17508
  }
17314
- function assertNoQueryRelationLeaf(opts) {
17315
- const operation = opts.operation ?? opts.path;
17316
- const body = opts.body;
17317
- if (body !== null && typeof body === "object") assertNoRelationLeaf(body.filter, operation);
17318
- const search = opts.query?.["search"];
17319
- if (typeof search !== "string") return;
17320
- let parsed;
17321
- try {
17322
- parsed = JSON.parse(search);
17323
- } catch {
17324
- return;
17509
+ function assertQueryFilters(opts, url, auditIds, bodyText) {
17510
+ const operation = opts.operation ?? opts.path.split("?", 1)[0];
17511
+ const validate7 = (value) => {
17512
+ if (value === null || typeof value !== "object") return;
17513
+ for (const [key, filter] of Object.entries(value)) {
17514
+ if (key.toLowerCase() === "filter") assertQueryFilterForWire(filter, operation, auditIds);
17515
+ }
17516
+ };
17517
+ const parse = (json) => auditIds ? JSON.parse(
17518
+ json,
17519
+ (_key, value, context) => typeof value === "number" && context?.source !== void 0 && !isAuditDecimalId(context.source) ? null : value
17520
+ ) : JSON.parse(json);
17521
+ validate7(auditIds && bodyText !== void 0 ? parse(bodyText) : opts.body);
17522
+ for (const [key, search] of url.searchParams) {
17523
+ if (key.toLowerCase() !== "search") continue;
17524
+ let parsed;
17525
+ try {
17526
+ parsed = parse(search);
17527
+ } catch {
17528
+ if (auditIds) throw new AutotaskConfigError("Expected a JSON search object for the audit query.", { operation });
17529
+ continue;
17530
+ }
17531
+ validate7(parsed);
17325
17532
  }
17326
- if (parsed !== null && typeof parsed === "object") assertNoRelationLeaf(parsed.filter, operation);
17327
17533
  }
17328
17534
 
17329
17535
  // src/pagination.ts
@@ -17343,7 +17549,7 @@ async function* paginate(fetchPage, opts = {}) {
17343
17549
  }
17344
17550
  const p = await fetchPage(page, pageSize);
17345
17551
  yield p;
17346
- if (!p.hasMore || p.items.length === 0) return;
17552
+ if (!p.hasMore || p.items.length === 0 && !opts.continueOnEmpty) return;
17347
17553
  page += 1;
17348
17554
  }
17349
17555
  }
@@ -17860,7 +18066,7 @@ async function capabilitySets() {
17860
18066
  const fieldOps = /* @__PURE__ */ new Map();
17861
18067
  const udfCapable = /* @__PURE__ */ new Set();
17862
18068
  const resources = /* @__PURE__ */ new Set();
17863
- for (const rec of await chunkQCA5R7QF_cjs.loadCapabilityRecords()) {
18069
+ for (const rec of await chunkMVGGHMOB_cjs.loadCapabilityRecords()) {
17864
18070
  if (rec.resource === "operations") continue;
17865
18071
  resources.add(rec.resource);
17866
18072
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -17871,7 +18077,7 @@ async function capabilitySets() {
17871
18077
  var derivedIndexPromise = null;
17872
18078
  function derivedIndexLoad() {
17873
18079
  if (derivedIndexPromise === null) {
17874
- derivedIndexPromise = chunkQCA5R7QF_cjs.loadCapabilityRecords().then((records) => {
18080
+ derivedIndexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
17875
18081
  const index = /* @__PURE__ */ new Map();
17876
18082
  for (const rec of records) {
17877
18083
  const declared = rec.metadata?.derivedFields;
@@ -19029,6 +19235,9 @@ var MODEL_FIELD_SETS = {
19029
19235
  "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"],
19030
19236
  "countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
19031
19237
  "currencies": ["id", "currencyNegativeFormat", "currencyPositiveFormat", "description", "displaySymbol", "exchangeRate", "isActive", "isInternalCurrency", "lastModifiedDateTime", "name", "updateResourceId"],
19238
+ "deleted_task_activity_logs": ["id", "typeID", "taskID", "taskNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
19239
+ "deleted_ticket_activity_logs": ["id", "typeID", "ticketID", "ticketNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
19240
+ "deleted_ticket_logs": ["id", "ticketID", "ticketNumber", "ticketTitle", "deletedByResourceID", "deletedDateTime"],
19032
19241
  "departments": ["id", "description", "name", "number", "primaryLocationID"],
19033
19242
  "domain_registrars": ["id", "name", "url"],
19034
19243
  "expense_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
@@ -19144,6 +19353,9 @@ var MODEL_DATE_FIELDS = {
19144
19353
  "contract_ticket_purchases": ["datePurchased", "endDate", "startDate"],
19145
19354
  "contracts": ["endDate", "lastModifiedDateTime", "startDate"],
19146
19355
  "currencies": ["lastModifiedDateTime"],
19356
+ "deleted_task_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
19357
+ "deleted_ticket_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
19358
+ "deleted_ticket_logs": ["deletedDateTime"],
19147
19359
  "expense_item_attachments": ["attachDate"],
19148
19360
  "expense_items": ["expenseDate"],
19149
19361
  "expense_report_attachments": ["attachDate"],
@@ -19543,14 +19755,20 @@ var QueryBase = class {
19543
19755
  // ------------------------------------------------------------------
19544
19756
  // Query walk (wired to the G3 walker; cursor-follow per the pinned wire)
19545
19757
  // ------------------------------------------------------------------
19546
- /** One page fetch: page 1 POSTs the QueryModel body; later pages POST the same body (`buildQueryBody`) to the absolute cursor (issue #118). */
19758
+ /** Follow the vendor cursor with the initial query method and, for POST, the same QueryModel (issue #118). */
19547
19759
  async fetchPage(params, page, pageSize, state2) {
19548
- if (params.includeFields !== void 0) {
19760
+ if (state2.initialRequest === void 0 && params.includeFields !== void 0) {
19549
19761
  params = { ...params, includeFields: params.includeFields.map((field) => normalizeOwnField(this.config.key, field)) };
19550
19762
  }
19551
19763
  const operation = `${this.config.key}.query`;
19552
19764
  if (page === 1) {
19765
+ const filter = normalizedConditions(params.filter);
19766
+ if (filter !== void 0 && isAuditLogResource(this.config.key)) {
19767
+ assertQueryFilterForWire(normalizeInValues(filter), operation, true);
19768
+ }
19553
19769
  const req = buildQueryRequest(this.http.baseUrl, this.resourcePath, { ...params, maxRecords: pageSize });
19770
+ if (req.body !== void 0) req.body = JSON.parse(JSON.stringify(req.body));
19771
+ state2.initialRequest = req;
19554
19772
  const body2 = await this.http.request({ ...req, operation });
19555
19773
  return this.readPage(body2, page, pageSize, state2);
19556
19774
  }
@@ -19562,10 +19780,25 @@ var QueryBase = class {
19562
19780
  operation
19563
19781
  });
19564
19782
  }
19565
- const body = buildQueryBody({ ...params, maxRecords: pageSize });
19783
+ const cursorResource = isAuditLogResource(this.config.key) ? this.resourcePath : void 0;
19784
+ if (state2.initialRequest?.method === "GET") {
19785
+ const path = cursorToPath(this.http.baseUrl, cursor, cursorResource);
19786
+ const separator = path.indexOf("?");
19787
+ const route = separator < 0 ? path : path.slice(0, separator);
19788
+ const cursorParams = new URLSearchParams(separator < 0 ? "" : path.slice(separator + 1));
19789
+ const search = state2.initialRequest.query?.search;
19790
+ for (const key of [...cursorParams.keys()]) {
19791
+ if (key.toLowerCase() === "search") cursorParams.delete(key);
19792
+ }
19793
+ if (typeof search === "string") cursorParams.set("search", search);
19794
+ const req = buildQueryGetRequest(this.http.baseUrl, route + "?" + cursorParams.toString());
19795
+ const body2 = await this.http.request({ ...req, operation });
19796
+ return this.readPage(body2, page, pageSize, state2);
19797
+ }
19798
+ const body = state2.initialRequest?.body ?? buildQueryBody({ ...params, maxRecords: pageSize });
19566
19799
  const res = await this.http.request({
19567
19800
  method: "POST",
19568
- path: cursorToPath(this.http.baseUrl, cursor),
19801
+ path: cursorToPath(this.http.baseUrl, cursor, cursorResource),
19569
19802
  body,
19570
19803
  operation,
19571
19804
  idempotent: true
@@ -19624,10 +19857,10 @@ var QueryBase = class {
19624
19857
  const walk = await this.relationWalkParams(rest, `${this.config.key}.query`);
19625
19858
  if (walk === void 0) return;
19626
19859
  if (!label || client === void 0) {
19627
- yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
19860
+ yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
19628
19861
  return;
19629
19862
  }
19630
- for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) })) {
19863
+ for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) })) {
19631
19864
  const labelled = await labelRows(client, this.config.key, page.items);
19632
19865
  yield* labelled.rows;
19633
19866
  }
@@ -19636,13 +19869,13 @@ var QueryBase = class {
19636
19869
  async *queryPageIter(params) {
19637
19870
  const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
19638
19871
  if (walk === void 0) return;
19639
- yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
19872
+ yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
19640
19873
  }
19641
19874
  /** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded; relation filters resolve first, #281). */
19642
19875
  async queryAllItems(params) {
19643
19876
  const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
19644
19877
  if (walk === void 0) return [];
19645
- return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), maxRecords: walk.maxTotalRecords });
19878
+ return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key), maxRecords: walk.maxTotalRecords });
19646
19879
  }
19647
19880
  /**
19648
19881
  * `queryBounded` — server-side pagination (the MCP query surface): ONE call
@@ -19653,12 +19886,10 @@ var QueryBase = class {
19653
19886
  * AutotaskConfigError; it is NOT a page size). The page-1 request uses
19654
19887
  * the internal page size min(500, limit) (the `latest` mechanism sizes
19655
19888
  * its walk from the matching count). Explicit `walk.maxRows` replaces
19656
- * the total cap; `limit` then only sizes pages. Every follow-up page POSTs the
19657
- * SAME QueryModel body (`buildQueryBody`: MaxRecords, IncludeFields and
19658
- * the preserved filter) to the absolute cursor (issue #118 — the vendor
19659
- * honours IncludeFields there and ignores MaxRecords, serving its own
19660
- * page size), so the walk reuses `fetchPage` (the shared cursor machinery)
19661
- * with a per-walk closure state (walks never share state).
19889
+ * the total cap; `limit` then only sizes pages. Continuations follow the
19890
+ * cursor with the initial method. POST keeps the same QueryModel body
19891
+ * across pages (issue #118). GET combines the cursor with the original search.
19892
+ * Each walk keeps its own request and cursor state.
19662
19893
  * - The 1000-page guard still applies as a SOFT stop: a walk that would
19663
19894
  * fetch a 1001st page stops with `hasMore: true` (never a throw — this
19664
19895
  * is a bounded read, not the `paginate` generator's error path).
@@ -19820,7 +20051,7 @@ var QueryBase = class {
19820
20051
  if (consume === void 0) items.push(...take);
19821
20052
  else await consume(take, pages2);
19822
20053
  if (fetched >= limit) break;
19823
- if (!page.hasMore || page.items.length === 0) break;
20054
+ if (!page.hasMore || page.items.length === 0 && !isAuditLogResource(this.config.key)) break;
19824
20055
  }
19825
20056
  const names = nameNotes.size === 0 ? void 0 : {
19826
20057
  note: [...nameNotes].join("; "),
@@ -19967,13 +20198,17 @@ var QueryBase = class {
19967
20198
  };
19968
20199
  let lo = 0n;
19969
20200
  let hi;
19970
- for (let t = 1n; ; t = t << 1n) {
19971
- spend();
19972
- if (await this.countAboveId(baseConds, t) <= latest) {
19973
- hi = t;
19974
- break;
20201
+ if (isAuditLogResource(this.config.key)) {
20202
+ hi = BigInt(MAX_AUDIT_ID);
20203
+ } else {
20204
+ for (let t = 1n; ; t = t << 1n) {
20205
+ spend();
20206
+ if (await this.countAboveId(baseConds, t) <= latest) {
20207
+ hi = t;
20208
+ break;
20209
+ }
20210
+ lo = t;
19975
20211
  }
19976
- lo = t;
19977
20212
  }
19978
20213
  while (hi - lo > 1n) {
19979
20214
  const mid = lo + hi >> 1n;
@@ -22330,6 +22565,36 @@ var SIMPLE_RESOURCES = [
22330
22565
  helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22331
22566
  opForms: { get: "global", update: "global" }
22332
22567
  },
22568
+ {
22569
+ key: "deleted_task_activity_logs",
22570
+ accessor: "deletedTaskActivityLogs",
22571
+ resourcePath: "/V1.0/DeletedTaskActivityLogs",
22572
+ deletable: false,
22573
+ udfCapable: false,
22574
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22575
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22576
+ opForms: { get: "global" }
22577
+ },
22578
+ {
22579
+ key: "deleted_ticket_activity_logs",
22580
+ accessor: "deletedTicketActivityLogs",
22581
+ resourcePath: "/V1.0/DeletedTicketActivityLogs",
22582
+ deletable: false,
22583
+ udfCapable: false,
22584
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22585
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22586
+ opForms: { get: "global" }
22587
+ },
22588
+ {
22589
+ key: "deleted_ticket_logs",
22590
+ accessor: "deletedTicketLogs",
22591
+ resourcePath: "/V1.0/DeletedTicketLogs",
22592
+ deletable: false,
22593
+ udfCapable: false,
22594
+ ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
22595
+ helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
22596
+ opForms: { get: "global" }
22597
+ },
22333
22598
  {
22334
22599
  key: "departments",
22335
22600
  accessor: "departments",
@@ -23339,7 +23604,7 @@ var GenericResource = class extends BaseResource {
23339
23604
  }
23340
23605
  async fetchPage(params, page, pageSize, state2) {
23341
23606
  const key = this.config.key;
23342
- if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
23607
+ if (state2.initialRequest === void 0 && isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
23343
23608
  return super.fetchPage(params, page, pageSize, state2);
23344
23609
  }
23345
23610
  async countGlobal(params) {
@@ -25181,7 +25446,7 @@ function dateBucketLabel(value, bucket) {
25181
25446
  var queryResourceKeysPromise = null;
25182
25447
  function queryResourceKeys() {
25183
25448
  if (queryResourceKeysPromise === null) {
25184
- queryResourceKeysPromise = chunkQCA5R7QF_cjs.loadCapabilityRecords().then((records) => {
25449
+ queryResourceKeysPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
25185
25450
  const s = /* @__PURE__ */ new Set();
25186
25451
  for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
25187
25452
  return s;
@@ -25303,7 +25568,7 @@ function parseTopAndLimit(opts, problems) {
25303
25568
  return { top, limit };
25304
25569
  }
25305
25570
  async function checkFieldNames(resourceKey, conditions, opts, problems) {
25306
- const records = resourceKey === void 0 ? [] : await chunkQCA5R7QF_cjs.loadCapabilityRecords();
25571
+ const records = resourceKey === void 0 ? [] : await chunkMVGGHMOB_cjs.loadCapabilityRecords();
25307
25572
  const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
25308
25573
  if (record === void 0) return void 0;
25309
25574
  const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
@@ -25345,6 +25610,9 @@ async function validateAggregate(operation, filter, opts) {
25345
25610
  const known = await checkFieldNames(resourceKey, conditions, opts, problems);
25346
25611
  const groupBy = parseGroupBy(opts, oracles, known, problems);
25347
25612
  const sum = checkSumFields("sum", opts.sum, problems);
25613
+ if (resourceKey !== void 0 && isAuditLogResource(resourceKey) && sum.some((field) => field.toLowerCase() === "id")) {
25614
+ problems.push("sum: audit log IDs are exact identifiers. Use groupBy for IDs or count for record totals.");
25615
+ }
25348
25616
  const { top, limit } = parseTopAndLimit(opts, problems);
25349
25617
  if (problems.length > 0) {
25350
25618
  throw new AutotaskConfigError(
@@ -25655,7 +25923,10 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
25655
25923
  continue;
25656
25924
  }
25657
25925
  try {
25658
- parseIdentifier(item.id, `${at}.id`);
25926
+ const id = parseIdentifier(item.id, `${at}.id`);
25927
+ if (isAuditLogResource(resourceKey) && !isAuditDecimalId(String(id))) {
25928
+ problems.push(`${at}.id: audit log ID must be a non-negative signed 64-bit integer`);
25929
+ }
25659
25930
  } catch {
25660
25931
  if (typeof item.id === "string") {
25661
25932
  problems.push(
@@ -25948,7 +26219,7 @@ async function uiLink(client, input) {
25948
26219
  var indexPromise = null;
25949
26220
  function operationIndex() {
25950
26221
  if (indexPromise === null) {
25951
- indexPromise = chunkQCA5R7QF_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
26222
+ indexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
25952
26223
  }
25953
26224
  return indexPromise;
25954
26225
  }