node-autotask 0.83.0 → 0.85.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.
- package/CHANGELOG.md +17 -0
- package/MCP_TOOL_CATALOG.json +323 -11
- package/README.md +1 -1
- package/capabilities.json +1739 -361
- package/dist/capabilities-data.js +2463 -1085
- package/dist/capabilities.cjs +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-C2AFRW5M.cjs → chunk-7GNZT7Y7.cjs} +375 -93
- package/dist/{chunk-ZKAJVHHZ.js → chunk-EPJG7M5C.js} +42 -7
- package/dist/{chunk-DBEAS3IR.js → chunk-GTTAPAGP.js} +3 -3
- package/dist/{chunk-HQJLIRXW.js → chunk-HF5YG4TV.js} +5 -2
- package/dist/{chunk-QCA5R7QF.cjs → chunk-JCKYM7FD.cjs} +3 -3
- package/dist/{chunk-QEMBBAF5.cjs → chunk-JV6MX2U3.cjs} +237 -202
- package/dist/{chunk-CV56RIGS.js → chunk-L6YCH2I4.js} +370 -88
- package/dist/{chunk-5AHEJCSP.cjs → chunk-PBOH2OHJ.cjs} +33 -30
- package/dist/{index-8Hg6dytT.d.cts → index-CCW_EpLg.d.cts} +203 -140
- package/dist/{index-8Hg6dytT.d.ts → index-CCW_EpLg.d.ts} +203 -140
- package/dist/{index-DxESlIIg.d.cts → index-DkyNXWyt.d.cts} +108 -86
- package/dist/{index-nXhYAQOf.d.ts → index-rWcPjRpX.d.ts} +108 -86
- package/dist/index.cjs +84 -84
- package/dist/index.d.cts +6 -5
- package/dist/index.d.ts +6 -5
- package/dist/index.js +5 -5
- package/dist/operations/index.cjs +51 -51
- package/dist/operations/index.d.cts +4 -4
- package/dist/operations/index.d.ts +4 -4
- package/dist/operations/index.js +2 -2
- package/dist/pool.cjs +12 -12
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +27 -27
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/API.md +32 -20
- package/docs/RELEASING.md +2 -1
- package/docs/VENDOR-QUIRKS.md +3 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkJCKYM7FD_cjs = require('./chunk-JCKYM7FD.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
|
-
|
|
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(
|
|
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:
|
|
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
|
|
1649
|
+
function assertQueryFilterForWire(conditions, operation, auditIds) {
|
|
1644
1650
|
if (!Array.isArray(conditions)) return;
|
|
1645
|
-
for (const
|
|
1646
|
-
if (!isRecord2(
|
|
1647
|
-
|
|
1648
|
-
|
|
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 +=
|
|
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
|
-
|
|
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
|
-
|
|
16498
|
-
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
17212
|
-
|
|
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
|
|
17315
|
-
const operation = opts.operation ?? opts.path;
|
|
17316
|
-
const
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
|
|
17320
|
-
|
|
17321
|
-
|
|
17322
|
-
|
|
17323
|
-
|
|
17324
|
-
|
|
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
|
|
18069
|
+
for (const rec of await chunkJCKYM7FD_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 =
|
|
18080
|
+
derivedIndexPromise = chunkJCKYM7FD_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;
|
|
@@ -18660,21 +18866,27 @@ var FK_TABLE_PATH = {
|
|
|
18660
18866
|
billingCode: "/V1.0/BillingCodes",
|
|
18661
18867
|
contract: "/V1.0/Contracts",
|
|
18662
18868
|
company: "/V1.0/Companies",
|
|
18663
|
-
ticket: "/V1.0/Tickets"
|
|
18869
|
+
ticket: "/V1.0/Tickets",
|
|
18870
|
+
product: "/V1.0/Products",
|
|
18871
|
+
configurationItemCategory: "/V1.0/ConfigurationItemCategories"
|
|
18664
18872
|
};
|
|
18665
18873
|
var FK_GET_OPERATION = {
|
|
18666
18874
|
role: "roles.get",
|
|
18667
18875
|
billingCode: "billing_codes.get",
|
|
18668
18876
|
contract: "contracts.get",
|
|
18669
18877
|
company: "companies.get",
|
|
18670
|
-
ticket: "tickets.get"
|
|
18878
|
+
ticket: "tickets.get",
|
|
18879
|
+
product: "products.get",
|
|
18880
|
+
configurationItemCategory: "configuration_item_categories.get"
|
|
18671
18881
|
};
|
|
18672
18882
|
var FK_NAME_FIELD = {
|
|
18673
18883
|
role: "name",
|
|
18674
18884
|
billingCode: "name",
|
|
18675
18885
|
contract: "contractName",
|
|
18676
18886
|
company: "companyName",
|
|
18677
|
-
ticket: "ticketNumber"
|
|
18887
|
+
ticket: "ticketNumber",
|
|
18888
|
+
product: "name",
|
|
18889
|
+
configurationItemCategory: "name"
|
|
18678
18890
|
};
|
|
18679
18891
|
function fkName(record, table) {
|
|
18680
18892
|
if (table === "ticket") {
|
|
@@ -18749,7 +18961,9 @@ async function resolveCompositeNames(http, plan, opts = {}) {
|
|
|
18749
18961
|
billingCode: client.billingCodes,
|
|
18750
18962
|
contract: client.contracts,
|
|
18751
18963
|
company: client.companies,
|
|
18752
|
-
ticket: client.tickets
|
|
18964
|
+
ticket: client.tickets,
|
|
18965
|
+
product: client.products,
|
|
18966
|
+
configurationItemCategory: client.configurationItemCategories
|
|
18753
18967
|
};
|
|
18754
18968
|
for (const fk2 of plan.recordFks) {
|
|
18755
18969
|
const key = `${fk2.table}:${fk2.id}`;
|
|
@@ -19029,6 +19243,9 @@ var MODEL_FIELD_SETS = {
|
|
|
19029
19243
|
"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
19244
|
"countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
|
|
19031
19245
|
"currencies": ["id", "currencyNegativeFormat", "currencyPositiveFormat", "description", "displaySymbol", "exchangeRate", "isActive", "isInternalCurrency", "lastModifiedDateTime", "name", "updateResourceId"],
|
|
19246
|
+
"deleted_task_activity_logs": ["id", "typeID", "taskID", "taskNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
|
|
19247
|
+
"deleted_ticket_activity_logs": ["id", "typeID", "ticketID", "ticketNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
|
|
19248
|
+
"deleted_ticket_logs": ["id", "ticketID", "ticketNumber", "ticketTitle", "deletedByResourceID", "deletedDateTime"],
|
|
19032
19249
|
"departments": ["id", "description", "name", "number", "primaryLocationID"],
|
|
19033
19250
|
"domain_registrars": ["id", "name", "url"],
|
|
19034
19251
|
"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 +19361,9 @@ var MODEL_DATE_FIELDS = {
|
|
|
19144
19361
|
"contract_ticket_purchases": ["datePurchased", "endDate", "startDate"],
|
|
19145
19362
|
"contracts": ["endDate", "lastModifiedDateTime", "startDate"],
|
|
19146
19363
|
"currencies": ["lastModifiedDateTime"],
|
|
19364
|
+
"deleted_task_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
|
|
19365
|
+
"deleted_ticket_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
|
|
19366
|
+
"deleted_ticket_logs": ["deletedDateTime"],
|
|
19147
19367
|
"expense_item_attachments": ["attachDate"],
|
|
19148
19368
|
"expense_items": ["expenseDate"],
|
|
19149
19369
|
"expense_report_attachments": ["attachDate"],
|
|
@@ -19373,7 +19593,10 @@ var ROW_FK_TABLES = {
|
|
|
19373
19593
|
contractID: "contract",
|
|
19374
19594
|
ticketID: "ticket",
|
|
19375
19595
|
roleID: "role",
|
|
19376
|
-
billingCodeID: "billingCode"
|
|
19596
|
+
billingCodeID: "billingCode",
|
|
19597
|
+
productID: "product",
|
|
19598
|
+
vendorID: "company",
|
|
19599
|
+
configurationItemCategoryID: "configurationItemCategory"
|
|
19377
19600
|
};
|
|
19378
19601
|
var isResourceFkField = (field) => field === "resourceID" || field.endsWith("ResourceID");
|
|
19379
19602
|
function rowNamePlan(rows, resourceKey, picklistFields = []) {
|
|
@@ -19543,14 +19766,20 @@ var QueryBase = class {
|
|
|
19543
19766
|
// ------------------------------------------------------------------
|
|
19544
19767
|
// Query walk (wired to the G3 walker; cursor-follow per the pinned wire)
|
|
19545
19768
|
// ------------------------------------------------------------------
|
|
19546
|
-
/**
|
|
19769
|
+
/** Follow the vendor cursor with the initial query method and, for POST, the same QueryModel (issue #118). */
|
|
19547
19770
|
async fetchPage(params, page, pageSize, state2) {
|
|
19548
|
-
if (params.includeFields !== void 0) {
|
|
19771
|
+
if (state2.initialRequest === void 0 && params.includeFields !== void 0) {
|
|
19549
19772
|
params = { ...params, includeFields: params.includeFields.map((field) => normalizeOwnField(this.config.key, field)) };
|
|
19550
19773
|
}
|
|
19551
19774
|
const operation = `${this.config.key}.query`;
|
|
19552
19775
|
if (page === 1) {
|
|
19776
|
+
const filter = normalizedConditions(params.filter);
|
|
19777
|
+
if (filter !== void 0 && isAuditLogResource(this.config.key)) {
|
|
19778
|
+
assertQueryFilterForWire(normalizeInValues(filter), operation, true);
|
|
19779
|
+
}
|
|
19553
19780
|
const req = buildQueryRequest(this.http.baseUrl, this.resourcePath, { ...params, maxRecords: pageSize });
|
|
19781
|
+
if (req.body !== void 0) req.body = JSON.parse(JSON.stringify(req.body));
|
|
19782
|
+
state2.initialRequest = req;
|
|
19554
19783
|
const body2 = await this.http.request({ ...req, operation });
|
|
19555
19784
|
return this.readPage(body2, page, pageSize, state2);
|
|
19556
19785
|
}
|
|
@@ -19562,10 +19791,25 @@ var QueryBase = class {
|
|
|
19562
19791
|
operation
|
|
19563
19792
|
});
|
|
19564
19793
|
}
|
|
19565
|
-
const
|
|
19794
|
+
const cursorResource = isAuditLogResource(this.config.key) ? this.resourcePath : void 0;
|
|
19795
|
+
if (state2.initialRequest?.method === "GET") {
|
|
19796
|
+
const path = cursorToPath(this.http.baseUrl, cursor, cursorResource);
|
|
19797
|
+
const separator = path.indexOf("?");
|
|
19798
|
+
const route = separator < 0 ? path : path.slice(0, separator);
|
|
19799
|
+
const cursorParams = new URLSearchParams(separator < 0 ? "" : path.slice(separator + 1));
|
|
19800
|
+
const search = state2.initialRequest.query?.search;
|
|
19801
|
+
for (const key of [...cursorParams.keys()]) {
|
|
19802
|
+
if (key.toLowerCase() === "search") cursorParams.delete(key);
|
|
19803
|
+
}
|
|
19804
|
+
if (typeof search === "string") cursorParams.set("search", search);
|
|
19805
|
+
const req = buildQueryGetRequest(this.http.baseUrl, route + "?" + cursorParams.toString());
|
|
19806
|
+
const body2 = await this.http.request({ ...req, operation });
|
|
19807
|
+
return this.readPage(body2, page, pageSize, state2);
|
|
19808
|
+
}
|
|
19809
|
+
const body = state2.initialRequest?.body ?? buildQueryBody({ ...params, maxRecords: pageSize });
|
|
19566
19810
|
const res = await this.http.request({
|
|
19567
19811
|
method: "POST",
|
|
19568
|
-
path: cursorToPath(this.http.baseUrl, cursor),
|
|
19812
|
+
path: cursorToPath(this.http.baseUrl, cursor, cursorResource),
|
|
19569
19813
|
body,
|
|
19570
19814
|
operation,
|
|
19571
19815
|
idempotent: true
|
|
@@ -19624,10 +19868,10 @@ var QueryBase = class {
|
|
|
19624
19868
|
const walk = await this.relationWalkParams(rest, `${this.config.key}.query`);
|
|
19625
19869
|
if (walk === void 0) return;
|
|
19626
19870
|
if (!label || client === void 0) {
|
|
19627
|
-
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19871
|
+
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19628
19872
|
return;
|
|
19629
19873
|
}
|
|
19630
|
-
for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) })) {
|
|
19874
|
+
for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) })) {
|
|
19631
19875
|
const labelled = await labelRows(client, this.config.key, page.items);
|
|
19632
19876
|
yield* labelled.rows;
|
|
19633
19877
|
}
|
|
@@ -19636,13 +19880,13 @@ var QueryBase = class {
|
|
|
19636
19880
|
async *queryPageIter(params) {
|
|
19637
19881
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19638
19882
|
if (walk === void 0) return;
|
|
19639
|
-
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19883
|
+
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19640
19884
|
}
|
|
19641
19885
|
/** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded; relation filters resolve first, #281). */
|
|
19642
19886
|
async queryAllItems(params) {
|
|
19643
19887
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19644
19888
|
if (walk === void 0) return [];
|
|
19645
|
-
return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), maxRecords: walk.maxTotalRecords });
|
|
19889
|
+
return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key), maxRecords: walk.maxTotalRecords });
|
|
19646
19890
|
}
|
|
19647
19891
|
/**
|
|
19648
19892
|
* `queryBounded` — server-side pagination (the MCP query surface): ONE call
|
|
@@ -19653,12 +19897,10 @@ var QueryBase = class {
|
|
|
19653
19897
|
* AutotaskConfigError; it is NOT a page size). The page-1 request uses
|
|
19654
19898
|
* the internal page size min(500, limit) (the `latest` mechanism sizes
|
|
19655
19899
|
* its walk from the matching count). Explicit `walk.maxRows` replaces
|
|
19656
|
-
* the total cap; `limit` then only sizes pages.
|
|
19657
|
-
*
|
|
19658
|
-
*
|
|
19659
|
-
*
|
|
19660
|
-
* page size), so the walk reuses `fetchPage` (the shared cursor machinery)
|
|
19661
|
-
* with a per-walk closure state (walks never share state).
|
|
19900
|
+
* the total cap; `limit` then only sizes pages. Continuations follow the
|
|
19901
|
+
* cursor with the initial method. POST keeps the same QueryModel body
|
|
19902
|
+
* across pages (issue #118). GET combines the cursor with the original search.
|
|
19903
|
+
* Each walk keeps its own request and cursor state.
|
|
19662
19904
|
* - The 1000-page guard still applies as a SOFT stop: a walk that would
|
|
19663
19905
|
* fetch a 1001st page stops with `hasMore: true` (never a throw — this
|
|
19664
19906
|
* is a bounded read, not the `paginate` generator's error path).
|
|
@@ -19820,7 +20062,7 @@ var QueryBase = class {
|
|
|
19820
20062
|
if (consume === void 0) items.push(...take);
|
|
19821
20063
|
else await consume(take, pages2);
|
|
19822
20064
|
if (fetched >= limit) break;
|
|
19823
|
-
if (!page.hasMore || page.items.length === 0) break;
|
|
20065
|
+
if (!page.hasMore || page.items.length === 0 && !isAuditLogResource(this.config.key)) break;
|
|
19824
20066
|
}
|
|
19825
20067
|
const names = nameNotes.size === 0 ? void 0 : {
|
|
19826
20068
|
note: [...nameNotes].join("; "),
|
|
@@ -19967,13 +20209,17 @@ var QueryBase = class {
|
|
|
19967
20209
|
};
|
|
19968
20210
|
let lo = 0n;
|
|
19969
20211
|
let hi;
|
|
19970
|
-
|
|
19971
|
-
|
|
19972
|
-
|
|
19973
|
-
|
|
19974
|
-
|
|
20212
|
+
if (isAuditLogResource(this.config.key)) {
|
|
20213
|
+
hi = BigInt(MAX_AUDIT_ID);
|
|
20214
|
+
} else {
|
|
20215
|
+
for (let t = 1n; ; t = t << 1n) {
|
|
20216
|
+
spend();
|
|
20217
|
+
if (await this.countAboveId(baseConds, t) <= latest) {
|
|
20218
|
+
hi = t;
|
|
20219
|
+
break;
|
|
20220
|
+
}
|
|
20221
|
+
lo = t;
|
|
19975
20222
|
}
|
|
19976
|
-
lo = t;
|
|
19977
20223
|
}
|
|
19978
20224
|
while (hi - lo > 1n) {
|
|
19979
20225
|
const mid = lo + hi >> 1n;
|
|
@@ -22330,6 +22576,36 @@ var SIMPLE_RESOURCES = [
|
|
|
22330
22576
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22331
22577
|
opForms: { get: "global", update: "global" }
|
|
22332
22578
|
},
|
|
22579
|
+
{
|
|
22580
|
+
key: "deleted_task_activity_logs",
|
|
22581
|
+
accessor: "deletedTaskActivityLogs",
|
|
22582
|
+
resourcePath: "/V1.0/DeletedTaskActivityLogs",
|
|
22583
|
+
deletable: false,
|
|
22584
|
+
udfCapable: false,
|
|
22585
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22586
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22587
|
+
opForms: { get: "global" }
|
|
22588
|
+
},
|
|
22589
|
+
{
|
|
22590
|
+
key: "deleted_ticket_activity_logs",
|
|
22591
|
+
accessor: "deletedTicketActivityLogs",
|
|
22592
|
+
resourcePath: "/V1.0/DeletedTicketActivityLogs",
|
|
22593
|
+
deletable: false,
|
|
22594
|
+
udfCapable: false,
|
|
22595
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22596
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22597
|
+
opForms: { get: "global" }
|
|
22598
|
+
},
|
|
22599
|
+
{
|
|
22600
|
+
key: "deleted_ticket_logs",
|
|
22601
|
+
accessor: "deletedTicketLogs",
|
|
22602
|
+
resourcePath: "/V1.0/DeletedTicketLogs",
|
|
22603
|
+
deletable: false,
|
|
22604
|
+
udfCapable: false,
|
|
22605
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22606
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22607
|
+
opForms: { get: "global" }
|
|
22608
|
+
},
|
|
22333
22609
|
{
|
|
22334
22610
|
key: "departments",
|
|
22335
22611
|
accessor: "departments",
|
|
@@ -23339,7 +23615,7 @@ var GenericResource = class extends BaseResource {
|
|
|
23339
23615
|
}
|
|
23340
23616
|
async fetchPage(params, page, pageSize, state2) {
|
|
23341
23617
|
const key = this.config.key;
|
|
23342
|
-
if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23618
|
+
if (state2.initialRequest === void 0 && isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23343
23619
|
return super.fetchPage(params, page, pageSize, state2);
|
|
23344
23620
|
}
|
|
23345
23621
|
async countGlobal(params) {
|
|
@@ -25181,7 +25457,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
25181
25457
|
var queryResourceKeysPromise = null;
|
|
25182
25458
|
function queryResourceKeys() {
|
|
25183
25459
|
if (queryResourceKeysPromise === null) {
|
|
25184
|
-
queryResourceKeysPromise =
|
|
25460
|
+
queryResourceKeysPromise = chunkJCKYM7FD_cjs.loadCapabilityRecords().then((records) => {
|
|
25185
25461
|
const s = /* @__PURE__ */ new Set();
|
|
25186
25462
|
for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
|
|
25187
25463
|
return s;
|
|
@@ -25303,7 +25579,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
25303
25579
|
return { top, limit };
|
|
25304
25580
|
}
|
|
25305
25581
|
async function checkFieldNames(resourceKey, conditions, opts, problems) {
|
|
25306
|
-
const records = resourceKey === void 0 ? [] : await
|
|
25582
|
+
const records = resourceKey === void 0 ? [] : await chunkJCKYM7FD_cjs.loadCapabilityRecords();
|
|
25307
25583
|
const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
|
|
25308
25584
|
if (record === void 0) return void 0;
|
|
25309
25585
|
const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
|
|
@@ -25345,6 +25621,9 @@ async function validateAggregate(operation, filter, opts) {
|
|
|
25345
25621
|
const known = await checkFieldNames(resourceKey, conditions, opts, problems);
|
|
25346
25622
|
const groupBy = parseGroupBy(opts, oracles, known, problems);
|
|
25347
25623
|
const sum = checkSumFields("sum", opts.sum, problems);
|
|
25624
|
+
if (resourceKey !== void 0 && isAuditLogResource(resourceKey) && sum.some((field) => field.toLowerCase() === "id")) {
|
|
25625
|
+
problems.push("sum: audit log IDs are exact identifiers. Use groupBy for IDs or count for record totals.");
|
|
25626
|
+
}
|
|
25348
25627
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
25349
25628
|
if (problems.length > 0) {
|
|
25350
25629
|
throw new AutotaskConfigError(
|
|
@@ -25655,7 +25934,10 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
|
|
|
25655
25934
|
continue;
|
|
25656
25935
|
}
|
|
25657
25936
|
try {
|
|
25658
|
-
parseIdentifier(item.id, `${at}.id`);
|
|
25937
|
+
const id = parseIdentifier(item.id, `${at}.id`);
|
|
25938
|
+
if (isAuditLogResource(resourceKey) && !isAuditDecimalId(String(id))) {
|
|
25939
|
+
problems.push(`${at}.id: audit log ID must be a non-negative signed 64-bit integer`);
|
|
25940
|
+
}
|
|
25659
25941
|
} catch {
|
|
25660
25942
|
if (typeof item.id === "string") {
|
|
25661
25943
|
problems.push(
|
|
@@ -25948,7 +26230,7 @@ async function uiLink(client, input) {
|
|
|
25948
26230
|
var indexPromise = null;
|
|
25949
26231
|
function operationIndex() {
|
|
25950
26232
|
if (indexPromise === null) {
|
|
25951
|
-
indexPromise =
|
|
26233
|
+
indexPromise = chunkJCKYM7FD_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
|
|
25952
26234
|
}
|
|
25953
26235
|
return indexPromise;
|
|
25954
26236
|
}
|