node-autotask 0.82.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.
- package/CHANGELOG.md +16 -0
- package/MCP_TOOL_CATALOG.json +577 -9
- package/README.md +1 -1
- package/capabilities.json +3194 -881
- package/dist/capabilities-data.js +3448 -1135
- package/dist/capabilities.cjs +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-TZL45TYE.cjs → chunk-36RXJUSA.cjs} +199 -199
- package/dist/{chunk-EFINBMXE.cjs → chunk-4NLWSHCB.cjs} +650 -91
- package/dist/{chunk-HZGCJ2CQ.js → chunk-AWK7FIZD.js} +645 -86
- package/dist/{chunk-EQ6LOII6.js → chunk-HASLVFC7.js} +3 -3
- package/dist/{chunk-5UR4L7SB.cjs → chunk-MVGGHMOB.cjs} +3 -3
- package/dist/{chunk-FYDLVUSN.js → chunk-RWBOJ5WK.js} +7 -2
- package/dist/{chunk-XJQYDJKB.cjs → chunk-SNILYCAV.cjs} +35 -30
- package/dist/{chunk-7PQKFGTI.js → chunk-Z56J7TFC.js} +2 -2
- package/dist/{index-inEhFJaU.d.cts → index-BZItfp_H.d.cts} +151 -1
- package/dist/{index-inEhFJaU.d.ts → index-BZItfp_H.d.ts} +151 -1
- package/dist/{index-Dt1KqDEQ.d.cts → index-DdvYwR2w.d.cts} +95 -84
- package/dist/{index-CW3PJPqH.d.ts → index-f1c_EdAt.d.ts} +95 -84
- 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 +34 -20
- package/docs/RELEASING.md +2 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
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
|
-
|
|
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
|
}
|
|
@@ -5461,6 +5500,22 @@ var RELATIONSHIP_MAP = {
|
|
|
5461
5500
|
"update": true,
|
|
5462
5501
|
"delete": false
|
|
5463
5502
|
}
|
|
5503
|
+
},
|
|
5504
|
+
{
|
|
5505
|
+
"resource": "expense_report_attachments",
|
|
5506
|
+
"apiEntity": "ExpenseReportAttachment",
|
|
5507
|
+
"parentField": "expenseReportID",
|
|
5508
|
+
"parentSegment": "Attachments",
|
|
5509
|
+
"tier": "extended",
|
|
5510
|
+
"workflowResource": false,
|
|
5511
|
+
"specialOps": [],
|
|
5512
|
+
"searchCovers": null,
|
|
5513
|
+
"scopedOps": {
|
|
5514
|
+
"create": true,
|
|
5515
|
+
"query": true,
|
|
5516
|
+
"update": false,
|
|
5517
|
+
"delete": true
|
|
5518
|
+
}
|
|
5464
5519
|
}
|
|
5465
5520
|
],
|
|
5466
5521
|
"naturalKeys": {
|
|
@@ -7147,6 +7202,22 @@ var RELATIONSHIP_MAP = {
|
|
|
7147
7202
|
"group": "B",
|
|
7148
7203
|
"parent": null,
|
|
7149
7204
|
"children": [
|
|
7205
|
+
{
|
|
7206
|
+
"resource": "resource_attachments",
|
|
7207
|
+
"apiEntity": "ResourceAttachment",
|
|
7208
|
+
"parentField": "resourceID",
|
|
7209
|
+
"parentSegment": "Attachments",
|
|
7210
|
+
"tier": "extended",
|
|
7211
|
+
"workflowResource": false,
|
|
7212
|
+
"specialOps": [],
|
|
7213
|
+
"searchCovers": null,
|
|
7214
|
+
"scopedOps": {
|
|
7215
|
+
"create": true,
|
|
7216
|
+
"query": true,
|
|
7217
|
+
"update": false,
|
|
7218
|
+
"delete": true
|
|
7219
|
+
}
|
|
7220
|
+
},
|
|
7150
7221
|
{
|
|
7151
7222
|
"resource": "resource_role_queues",
|
|
7152
7223
|
"apiEntity": "ResourceRoleQueue",
|
|
@@ -10494,6 +10565,201 @@ var RELATIONSHIP_MAP = {
|
|
|
10494
10565
|
},
|
|
10495
10566
|
"deleteBoundary": null,
|
|
10496
10567
|
"markerField": null
|
|
10568
|
+
},
|
|
10569
|
+
"expense_report_attachments": {
|
|
10570
|
+
"resource": "expense_report_attachments",
|
|
10571
|
+
"apiEntity": "ExpenseReportAttachment",
|
|
10572
|
+
"kind": "entity",
|
|
10573
|
+
"path": "ExpenseReportAttachments",
|
|
10574
|
+
"parentScoped": true,
|
|
10575
|
+
"tier": "extended",
|
|
10576
|
+
"workflowResource": false,
|
|
10577
|
+
"group": "B",
|
|
10578
|
+
"parent": {
|
|
10579
|
+
"resource": "expense_reports",
|
|
10580
|
+
"segment": "Attachments",
|
|
10581
|
+
"field": "expenseReportID"
|
|
10582
|
+
},
|
|
10583
|
+
"children": [],
|
|
10584
|
+
"naturalKeys": {
|
|
10585
|
+
"hasSearch": false,
|
|
10586
|
+
"searchCovers": null,
|
|
10587
|
+
"findBy": []
|
|
10588
|
+
},
|
|
10589
|
+
"blindSurfaces": null,
|
|
10590
|
+
"zoneFacts": {
|
|
10591
|
+
"createGuidance": {
|
|
10592
|
+
"createOp": "expense_report_attachments.create",
|
|
10593
|
+
"parentScoped": true,
|
|
10594
|
+
"liveProvenPrefix": [],
|
|
10595
|
+
"unproven": true,
|
|
10596
|
+
"blocker": {
|
|
10597
|
+
"kind": "unknown",
|
|
10598
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
10599
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
10600
|
+
"requires": {
|
|
10601
|
+
"allOf": [
|
|
10602
|
+
"attachmentType",
|
|
10603
|
+
"fullPath",
|
|
10604
|
+
"title",
|
|
10605
|
+
"publish",
|
|
10606
|
+
"data"
|
|
10607
|
+
]
|
|
10608
|
+
}
|
|
10609
|
+
},
|
|
10610
|
+
"requiresByValue": [
|
|
10611
|
+
{
|
|
10612
|
+
"field": "attachmentType",
|
|
10613
|
+
"value": "FILE_ATTACHMENT",
|
|
10614
|
+
"requires": {
|
|
10615
|
+
"allOf": [
|
|
10616
|
+
"data"
|
|
10617
|
+
]
|
|
10618
|
+
}
|
|
10619
|
+
}
|
|
10620
|
+
],
|
|
10621
|
+
"vendorEvidence": [
|
|
10622
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ExpenseReportAttachmentsEntity.htm",
|
|
10623
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
10624
|
+
"Official ExpenseReportAttachments entity documentation and vendored controllers define scoped ExpenseReports attachment routes. This parent does not support nesting or the documented contact-author override. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
|
|
10625
|
+
],
|
|
10626
|
+
"deleteBoundary": {
|
|
10627
|
+
"available": true,
|
|
10628
|
+
"note": null
|
|
10629
|
+
}
|
|
10630
|
+
}
|
|
10631
|
+
},
|
|
10632
|
+
"deleteBoundary": null,
|
|
10633
|
+
"markerField": null
|
|
10634
|
+
},
|
|
10635
|
+
"resource_attachments": {
|
|
10636
|
+
"resource": "resource_attachments",
|
|
10637
|
+
"apiEntity": "ResourceAttachment",
|
|
10638
|
+
"kind": "entity",
|
|
10639
|
+
"path": "ResourceAttachments",
|
|
10640
|
+
"parentScoped": true,
|
|
10641
|
+
"tier": "extended",
|
|
10642
|
+
"workflowResource": false,
|
|
10643
|
+
"group": "B",
|
|
10644
|
+
"parent": {
|
|
10645
|
+
"resource": "resources",
|
|
10646
|
+
"segment": "Attachments",
|
|
10647
|
+
"field": "resourceID"
|
|
10648
|
+
},
|
|
10649
|
+
"children": [],
|
|
10650
|
+
"naturalKeys": {
|
|
10651
|
+
"hasSearch": false,
|
|
10652
|
+
"searchCovers": null,
|
|
10653
|
+
"findBy": []
|
|
10654
|
+
},
|
|
10655
|
+
"blindSurfaces": null,
|
|
10656
|
+
"zoneFacts": {
|
|
10657
|
+
"createGuidance": {
|
|
10658
|
+
"createOp": "resource_attachments.create",
|
|
10659
|
+
"parentScoped": true,
|
|
10660
|
+
"liveProvenPrefix": [],
|
|
10661
|
+
"unproven": true,
|
|
10662
|
+
"blocker": {
|
|
10663
|
+
"kind": "unknown",
|
|
10664
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
10665
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
10666
|
+
"requires": {
|
|
10667
|
+
"allOf": [
|
|
10668
|
+
"attachmentType",
|
|
10669
|
+
"fullPath",
|
|
10670
|
+
"title",
|
|
10671
|
+
"publish",
|
|
10672
|
+
"data"
|
|
10673
|
+
]
|
|
10674
|
+
}
|
|
10675
|
+
},
|
|
10676
|
+
"requiresByValue": [
|
|
10677
|
+
{
|
|
10678
|
+
"field": "attachmentType",
|
|
10679
|
+
"value": "FILE_ATTACHMENT",
|
|
10680
|
+
"requires": {
|
|
10681
|
+
"allOf": [
|
|
10682
|
+
"data"
|
|
10683
|
+
]
|
|
10684
|
+
}
|
|
10685
|
+
}
|
|
10686
|
+
],
|
|
10687
|
+
"vendorEvidence": [
|
|
10688
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ResourceAttachmentsEntity.htm",
|
|
10689
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
10690
|
+
"Official ResourceAttachments entity documentation and vendored controllers define scoped Resources attachment routes. This parent does not support nesting or the documented contact-author override. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
|
|
10691
|
+
],
|
|
10692
|
+
"deleteBoundary": {
|
|
10693
|
+
"available": true,
|
|
10694
|
+
"note": null
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10697
|
+
},
|
|
10698
|
+
"deleteBoundary": null,
|
|
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
|
|
10497
10763
|
}
|
|
10498
10764
|
};
|
|
10499
10765
|
var BLIND_SURFACE_STAMPS = {
|
|
@@ -13418,6 +13684,47 @@ var CREATE_GUIDANCE = {
|
|
|
13418
13684
|
"note": "the vendor defines no DELETE for expense_items (spec-derived: the vendored api-docs.json defines no DELETE on the entity's paths) \u2014 a create cannot be undone through the API; cleanup is UI-only."
|
|
13419
13685
|
}
|
|
13420
13686
|
},
|
|
13687
|
+
{
|
|
13688
|
+
"resource": "expense_report_attachments",
|
|
13689
|
+
"createOp": "expense_report_attachments.create",
|
|
13690
|
+
"parentScoped": true,
|
|
13691
|
+
"liveProvenPrefix": [],
|
|
13692
|
+
"unproven": true,
|
|
13693
|
+
"blocker": {
|
|
13694
|
+
"kind": "unknown",
|
|
13695
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
13696
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
13697
|
+
"requires": {
|
|
13698
|
+
"allOf": [
|
|
13699
|
+
"attachmentType",
|
|
13700
|
+
"fullPath",
|
|
13701
|
+
"title",
|
|
13702
|
+
"publish",
|
|
13703
|
+
"data"
|
|
13704
|
+
]
|
|
13705
|
+
}
|
|
13706
|
+
},
|
|
13707
|
+
"vendorEvidence": [
|
|
13708
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ExpenseReportAttachmentsEntity.htm",
|
|
13709
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
13710
|
+
"Official ExpenseReportAttachments entity documentation and vendored controllers define scoped ExpenseReports attachment routes. This parent does not support nesting or the documented contact-author override. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
|
|
13711
|
+
],
|
|
13712
|
+
"deleteBoundary": {
|
|
13713
|
+
"available": true,
|
|
13714
|
+
"note": null
|
|
13715
|
+
},
|
|
13716
|
+
"requiresByValue": [
|
|
13717
|
+
{
|
|
13718
|
+
"field": "attachmentType",
|
|
13719
|
+
"value": "FILE_ATTACHMENT",
|
|
13720
|
+
"requires": {
|
|
13721
|
+
"allOf": [
|
|
13722
|
+
"data"
|
|
13723
|
+
]
|
|
13724
|
+
}
|
|
13725
|
+
}
|
|
13726
|
+
]
|
|
13727
|
+
},
|
|
13421
13728
|
{
|
|
13422
13729
|
"resource": "expense_reports",
|
|
13423
13730
|
"createOp": "expense_reports.create",
|
|
@@ -14003,6 +14310,47 @@ var CREATE_GUIDANCE = {
|
|
|
14003
14310
|
"note": "the vendor defines no DELETE for quotes (spec-derived: the vendored api-docs.json defines no DELETE on the entity's paths) \u2014 a create cannot be undone through the API; cleanup is UI-only."
|
|
14004
14311
|
}
|
|
14005
14312
|
},
|
|
14313
|
+
{
|
|
14314
|
+
"resource": "resource_attachments",
|
|
14315
|
+
"createOp": "resource_attachments.create",
|
|
14316
|
+
"parentScoped": true,
|
|
14317
|
+
"liveProvenPrefix": [],
|
|
14318
|
+
"unproven": true,
|
|
14319
|
+
"blocker": {
|
|
14320
|
+
"kind": "unknown",
|
|
14321
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
14322
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
14323
|
+
"requires": {
|
|
14324
|
+
"allOf": [
|
|
14325
|
+
"attachmentType",
|
|
14326
|
+
"fullPath",
|
|
14327
|
+
"title",
|
|
14328
|
+
"publish",
|
|
14329
|
+
"data"
|
|
14330
|
+
]
|
|
14331
|
+
}
|
|
14332
|
+
},
|
|
14333
|
+
"vendorEvidence": [
|
|
14334
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ResourceAttachmentsEntity.htm",
|
|
14335
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
14336
|
+
"Official ResourceAttachments entity documentation and vendored controllers define scoped Resources attachment routes. This parent does not support nesting or the documented contact-author override. No update, UDF metadata or data-download endpoint is implemented. Static contract only; no live create."
|
|
14337
|
+
],
|
|
14338
|
+
"deleteBoundary": {
|
|
14339
|
+
"available": true,
|
|
14340
|
+
"note": null
|
|
14341
|
+
},
|
|
14342
|
+
"requiresByValue": [
|
|
14343
|
+
{
|
|
14344
|
+
"field": "attachmentType",
|
|
14345
|
+
"value": "FILE_ATTACHMENT",
|
|
14346
|
+
"requires": {
|
|
14347
|
+
"allOf": [
|
|
14348
|
+
"data"
|
|
14349
|
+
]
|
|
14350
|
+
}
|
|
14351
|
+
}
|
|
14352
|
+
]
|
|
14353
|
+
},
|
|
14006
14354
|
{
|
|
14007
14355
|
"resource": "resource_role_queues",
|
|
14008
14356
|
"createOp": "resource_role_queues.create",
|
|
@@ -14970,7 +15318,7 @@ var CREATE_GUIDANCE = {
|
|
|
14970
15318
|
}
|
|
14971
15319
|
],
|
|
14972
15320
|
"counts": {
|
|
14973
|
-
"total":
|
|
15321
|
+
"total": 114,
|
|
14974
15322
|
"byKind": {
|
|
14975
15323
|
"ok": 41,
|
|
14976
15324
|
"blind-reference": 16,
|
|
@@ -14980,7 +15328,7 @@ var CREATE_GUIDANCE = {
|
|
|
14980
15328
|
"resource-role-pair": 2,
|
|
14981
15329
|
"delete-absent": 0,
|
|
14982
15330
|
"non-mutable": 0,
|
|
14983
|
-
"unknown":
|
|
15331
|
+
"unknown": 38
|
|
14984
15332
|
}
|
|
14985
15333
|
}
|
|
14986
15334
|
};
|
|
@@ -15734,6 +16082,21 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
|
|
|
15734
16082
|
],
|
|
15735
16083
|
"sales_order_attachments": [
|
|
15736
16084
|
"title"
|
|
16085
|
+
],
|
|
16086
|
+
"expense_report_attachments": [
|
|
16087
|
+
"title"
|
|
16088
|
+
],
|
|
16089
|
+
"resource_attachments": [
|
|
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"
|
|
15737
16100
|
]
|
|
15738
16101
|
};
|
|
15739
16102
|
|
|
@@ -16170,6 +16533,74 @@ function credentialShapeExpectation(headers, auth) {
|
|
|
16170
16533
|
|
|
16171
16534
|
// src/http/envelope.ts
|
|
16172
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
|
+
}
|
|
16173
16604
|
function attachEmptyReasonDetails(err) {
|
|
16174
16605
|
if (err.operation === void 0) return;
|
|
16175
16606
|
const dot = err.operation.indexOf(".");
|
|
@@ -16195,7 +16626,7 @@ function attachEmptyReasonDetails(err) {
|
|
|
16195
16626
|
} : {
|
|
16196
16627
|
surface,
|
|
16197
16628
|
kind: "not-found",
|
|
16198
|
-
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)`,
|
|
16199
16630
|
authority: `${resource}.query`,
|
|
16200
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`
|
|
16201
16632
|
};
|
|
@@ -16233,7 +16664,7 @@ function unwrapItem(body, id, operation, entity) {
|
|
|
16233
16664
|
resourceIds: id !== void 0 ? [id] : void 0,
|
|
16234
16665
|
...id !== void 0 && entity !== void 0 ? { details: { idRefs: [{ entity, id }] } } : {},
|
|
16235
16666
|
operation,
|
|
16236
|
-
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."
|
|
16237
16668
|
}
|
|
16238
16669
|
);
|
|
16239
16670
|
attachEmptyReasonDetails(err);
|
|
@@ -16242,8 +16673,9 @@ function unwrapItem(body, id, operation, entity) {
|
|
|
16242
16673
|
return item;
|
|
16243
16674
|
}
|
|
16244
16675
|
function unwrapQueryCount(body, operation) {
|
|
16245
|
-
|
|
16246
|
-
|
|
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 }", {
|
|
16247
16679
|
code: "INVALID_RESPONSE",
|
|
16248
16680
|
category: "server",
|
|
16249
16681
|
operation,
|
|
@@ -16252,7 +16684,7 @@ function unwrapQueryCount(body, operation) {
|
|
|
16252
16684
|
attachEmptyReasonDetails(err);
|
|
16253
16685
|
throw err;
|
|
16254
16686
|
}
|
|
16255
|
-
return
|
|
16687
|
+
return count;
|
|
16256
16688
|
}
|
|
16257
16689
|
function unwrapOperation(body, operation) {
|
|
16258
16690
|
const value = isRecord2(body) ? body.itemId !== void 0 ? body.itemId : body.id : void 0;
|
|
@@ -16606,8 +17038,7 @@ var HttpClient = class {
|
|
|
16606
17038
|
since,
|
|
16607
17039
|
retryAfterMs: s.maintenancePollMs,
|
|
16608
17040
|
httpStatus: status,
|
|
16609
|
-
contentType,
|
|
16610
|
-
bodySnippet: bodySnippet(text, this.redactPersonalData),
|
|
17041
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) },
|
|
16611
17042
|
maintenanceDetected: true
|
|
16612
17043
|
},
|
|
16613
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).`
|
|
@@ -16712,7 +17143,7 @@ var HttpClient = class {
|
|
|
16712
17143
|
return { retry: true };
|
|
16713
17144
|
}
|
|
16714
17145
|
throw new AutotaskNetworkError(
|
|
16715
|
-
`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)}`,
|
|
16716
17147
|
ctx
|
|
16717
17148
|
);
|
|
16718
17149
|
}
|
|
@@ -16733,7 +17164,7 @@ var HttpClient = class {
|
|
|
16733
17164
|
if (err instanceof AutotaskError) throw err;
|
|
16734
17165
|
if (s.signal.aborted || isAbortLike(err)) throw this.interrupted(s);
|
|
16735
17166
|
throw new AutotaskNetworkError(
|
|
16736
|
-
`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)}`,
|
|
16737
17168
|
ctx
|
|
16738
17169
|
);
|
|
16739
17170
|
}
|
|
@@ -16760,10 +17191,11 @@ var HttpClient = class {
|
|
|
16760
17191
|
}
|
|
16761
17192
|
let parsed;
|
|
16762
17193
|
try {
|
|
16763
|
-
parsed =
|
|
17194
|
+
parsed = decodeResponseJson(text, s.auditTarget);
|
|
16764
17195
|
} catch {
|
|
16765
17196
|
return this.handleNonJson2xx(s, res, status, text);
|
|
16766
17197
|
}
|
|
17198
|
+
validateAuditResponse(parsed, s.auditTarget, opts.operation);
|
|
16767
17199
|
return {
|
|
16768
17200
|
done: true,
|
|
16769
17201
|
value: opts.skipResponseRedaction ? parsed : redactResponseBody(parsed, { redactPersonalData: this.redactPersonalData }),
|
|
@@ -16780,13 +17212,12 @@ var HttpClient = class {
|
|
|
16780
17212
|
httpStatus: status,
|
|
16781
17213
|
details: {
|
|
16782
17214
|
httpStatus: status,
|
|
16783
|
-
contentType,
|
|
16784
|
-
bodySnippet: bodySnippet(text, this.redactPersonalData)
|
|
17215
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) }
|
|
16785
17216
|
},
|
|
16786
17217
|
// The content-type is host-sourced (a host-supplied
|
|
16787
17218
|
// baseUrl can serve arbitrary HTML) — capped, never prose;
|
|
16788
17219
|
// the raw snippet rides details only.
|
|
16789
|
-
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).`
|
|
16790
17221
|
}
|
|
16791
17222
|
) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
|
|
16792
17223
|
...ctx,
|
|
@@ -16832,7 +17263,7 @@ var HttpClient = class {
|
|
|
16832
17263
|
nonJsonBody = text;
|
|
16833
17264
|
}
|
|
16834
17265
|
}
|
|
16835
|
-
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);
|
|
16836
17267
|
const nonJsonIsMaintenance = s.maintenancePage;
|
|
16837
17268
|
const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
|
|
16838
17269
|
if (nonJsonIsMaintenance) {
|
|
@@ -16856,9 +17287,12 @@ var HttpClient = class {
|
|
|
16856
17287
|
);
|
|
16857
17288
|
}
|
|
16858
17289
|
if (target !== void 0 && targetViolation === null && target !== this.baseUrl) {
|
|
17290
|
+
const retryUrl = buildUrl(target, s.wirePath);
|
|
17291
|
+
if (s.getQuery) assertGetQueryUrlLength(retryUrl);
|
|
16859
17292
|
s.zoneRetry = { from: this.baseUrl, to: target };
|
|
16860
17293
|
this.repointZoneBase(target);
|
|
16861
|
-
s.url =
|
|
17294
|
+
s.url = retryUrl;
|
|
17295
|
+
s.ctx.url = s.url.split("?", 1)[0];
|
|
16862
17296
|
return RETRY;
|
|
16863
17297
|
}
|
|
16864
17298
|
}
|
|
@@ -16866,10 +17300,11 @@ var HttpClient = class {
|
|
|
16866
17300
|
const err = errorFromStatus(
|
|
16867
17301
|
status,
|
|
16868
17302
|
body,
|
|
16869
|
-
s.url,
|
|
17303
|
+
s.ctx.url,
|
|
16870
17304
|
opts.operation,
|
|
16871
17305
|
this.redactPersonalData,
|
|
16872
|
-
credentialShapeExpectation(s.headers, this.auth)
|
|
17306
|
+
credentialShapeExpectation(s.headers, this.auth),
|
|
17307
|
+
!s.getQuery
|
|
16873
17308
|
);
|
|
16874
17309
|
err.correlationId = s.correlationId;
|
|
16875
17310
|
this.stampMaintenance(s, err);
|
|
@@ -16954,11 +17389,20 @@ var HttpClient = class {
|
|
|
16954
17389
|
async request(opts) {
|
|
16955
17390
|
const method = opts.method;
|
|
16956
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);
|
|
16957
17396
|
const headers = withAuthHeaders(opts.headers, this.auth);
|
|
16958
17397
|
assertCredentialShape(headers, this.auth);
|
|
16959
|
-
|
|
16960
|
-
|
|
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);
|
|
16961
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";
|
|
16962
17406
|
const correlationId = newCorrelationId();
|
|
16963
17407
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
16964
17408
|
const started = Date.now();
|
|
@@ -16966,7 +17410,10 @@ var HttpClient = class {
|
|
|
16966
17410
|
const deadline = new AbortController();
|
|
16967
17411
|
const s = {
|
|
16968
17412
|
opts,
|
|
17413
|
+
wirePath,
|
|
17414
|
+
getQuery,
|
|
16969
17415
|
method,
|
|
17416
|
+
auditTarget,
|
|
16970
17417
|
url,
|
|
16971
17418
|
headers,
|
|
16972
17419
|
bodyText,
|
|
@@ -17007,7 +17454,7 @@ var HttpClient = class {
|
|
|
17007
17454
|
// undefined (the vendor's 204 / empty delete answer; the delete callers
|
|
17008
17455
|
// synthesize the result from the path id).
|
|
17009
17456
|
expectBody: opts.expectBody ?? method !== "DELETE",
|
|
17010
|
-
ctx: { operation: opts.operation, url, correlationId },
|
|
17457
|
+
ctx: { operation: opts.operation, url: url.split("?", 1)[0], correlationId },
|
|
17011
17458
|
lastStatus: void 0,
|
|
17012
17459
|
zoneRetry: void 0,
|
|
17013
17460
|
attempt: 0,
|
|
@@ -17059,19 +17506,30 @@ function isMaintenancePage(status, contentType, text) {
|
|
|
17059
17506
|
return true;
|
|
17060
17507
|
}
|
|
17061
17508
|
}
|
|
17062
|
-
function
|
|
17063
|
-
const operation = opts.operation ?? opts.path;
|
|
17064
|
-
const
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
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);
|
|
17073
17532
|
}
|
|
17074
|
-
if (parsed !== null && typeof parsed === "object") assertNoRelationLeaf(parsed.filter, operation);
|
|
17075
17533
|
}
|
|
17076
17534
|
|
|
17077
17535
|
// src/pagination.ts
|
|
@@ -17091,7 +17549,7 @@ async function* paginate(fetchPage, opts = {}) {
|
|
|
17091
17549
|
}
|
|
17092
17550
|
const p = await fetchPage(page, pageSize);
|
|
17093
17551
|
yield p;
|
|
17094
|
-
if (!p.hasMore || p.items.length === 0) return;
|
|
17552
|
+
if (!p.hasMore || p.items.length === 0 && !opts.continueOnEmpty) return;
|
|
17095
17553
|
page += 1;
|
|
17096
17554
|
}
|
|
17097
17555
|
}
|
|
@@ -17608,7 +18066,7 @@ async function capabilitySets() {
|
|
|
17608
18066
|
const fieldOps = /* @__PURE__ */ new Map();
|
|
17609
18067
|
const udfCapable = /* @__PURE__ */ new Set();
|
|
17610
18068
|
const resources = /* @__PURE__ */ new Set();
|
|
17611
|
-
for (const rec of await
|
|
18069
|
+
for (const rec of await chunkMVGGHMOB_cjs.loadCapabilityRecords()) {
|
|
17612
18070
|
if (rec.resource === "operations") continue;
|
|
17613
18071
|
resources.add(rec.resource);
|
|
17614
18072
|
if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
|
|
@@ -17619,7 +18077,7 @@ async function capabilitySets() {
|
|
|
17619
18077
|
var derivedIndexPromise = null;
|
|
17620
18078
|
function derivedIndexLoad() {
|
|
17621
18079
|
if (derivedIndexPromise === null) {
|
|
17622
|
-
derivedIndexPromise =
|
|
18080
|
+
derivedIndexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
|
|
17623
18081
|
const index = /* @__PURE__ */ new Map();
|
|
17624
18082
|
for (const rec of records) {
|
|
17625
18083
|
const declared = rec.metadata?.derivedFields;
|
|
@@ -18777,10 +19235,14 @@ var MODEL_FIELD_SETS = {
|
|
|
18777
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"],
|
|
18778
19236
|
"countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
|
|
18779
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"],
|
|
18780
19241
|
"departments": ["id", "description", "name", "number", "primaryLocationID"],
|
|
18781
19242
|
"domain_registrars": ["id", "name", "url"],
|
|
18782
19243
|
"expense_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18783
19244
|
"expense_items": ["id", "companyID", "description", "destination", "entertainmentLocation", "expenseCategory", "expenseCurrencyExpenseAmount", "expenseCurrencyID", "expenseDate", "expenseReportID", "glCode", "haveReceipt", "internalCurrencyExpenseAmount", "internalCurrencyReimbursementAmount", "isBillableToCompany", "isReimbursable", "isRejected", "miles", "odometerEnd", "odometerStart", "origin", "paymentType", "projectID", "purchaseOrderNumber", "reimbursementCurrencyReimbursementAmount", "taskID", "ticketID", "workType", "soapParentPropertyId"],
|
|
19245
|
+
"expense_report_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18784
19246
|
"expense_reports": ["id", "amountDue", "approvedDate", "approverID", "departmentNumber", "internalCurrencyCashAdvanceAmount", "internalCurrencyExpenseTotal", "name", "organizationalLevelAssociationID", "quickBooksReferenceNumber", "reimbursementCurrencyAmountDue", "reimbursementCurrencyCashAdvanceAmount", "reimbursementCurrencyID", "rejectionReason", "status", "submit", "submitDate", "submitterID", "weekEnding"],
|
|
18785
19247
|
"holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
|
|
18786
19248
|
"holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
|
|
@@ -18810,6 +19272,7 @@ var MODEL_FIELD_SETS = {
|
|
|
18810
19272
|
"quote_locations": ["id", "address1", "address2", "city", "postalCode", "state"],
|
|
18811
19273
|
"quote_templates": ["id", "calculateTaxSeparately", "createDate", "createdBy", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "description", "displayTaxCategorySuperscripts", "isActive", "lastActivityBy", "lastActivityDate", "name", "numberFormat", "pageLayout", "pageNumberFormat", "showEachTaxInGroup", "showGridHeader", "showTaxCategory", "showVerticalGridLines"],
|
|
18812
19274
|
"quotes": ["id", "approvalStatus", "approvalStatusChangedByResourceID", "approvalStatusChangedDate", "billToLocationID", "calculateTaxSeparately", "comment", "companyID", "contactID", "createDate", "creatorResourceID", "description", "effectiveDate", "expirationDate", "extApprovalContactResponse", "extApprovalResponseDate", "extApprovalResponseSignature", "externalQuoteNumber", "groupByID", "impersonatorCreatorResourceID", "isActive", "lastActivityDate", "lastModifiedBy", "lastPublishedByResourceID", "lastPublishedDateTime", "name", "opportunityID", "paymentTerm", "paymentType", "primaryQuote", "proposalProjectID", "purchaseOrderNumber", "quoteNumber", "quoteTemplateID", "shippingType", "shipToLocationID", "showEachTaxInGroup", "showTaxCategory", "soldToLocationID", "taxRegionID"],
|
|
19275
|
+
"resource_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "resourceID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18813
19276
|
"resource_role_queues": ["id", "queueID", "resourceID", "soapParentPropertyId"],
|
|
18814
19277
|
"resource_roles": ["id", "departmentID", "isActive", "queueID", "resourceID", "roleID", "soapParentPropertyId"],
|
|
18815
19278
|
"resource_skills": ["id", "resourceID", "skillDescription", "skillID", "skillLevel", "soapParentPropertyId"],
|
|
@@ -18890,8 +19353,12 @@ var MODEL_DATE_FIELDS = {
|
|
|
18890
19353
|
"contract_ticket_purchases": ["datePurchased", "endDate", "startDate"],
|
|
18891
19354
|
"contracts": ["endDate", "lastModifiedDateTime", "startDate"],
|
|
18892
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"],
|
|
18893
19359
|
"expense_item_attachments": ["attachDate"],
|
|
18894
19360
|
"expense_items": ["expenseDate"],
|
|
19361
|
+
"expense_report_attachments": ["attachDate"],
|
|
18895
19362
|
"expense_reports": ["approvedDate", "submitDate", "weekEnding"],
|
|
18896
19363
|
"holidays": ["holidayDate"],
|
|
18897
19364
|
"inventory_products": ["createDateTime"],
|
|
@@ -18911,6 +19378,7 @@ var MODEL_DATE_FIELDS = {
|
|
|
18911
19378
|
"purchase_orders": ["cancelDateTime", "createDateTime", "latestEstimatedArrivalDate", "shippingDate", "submitDateTime"],
|
|
18912
19379
|
"quote_templates": ["createDate", "lastActivityDate"],
|
|
18913
19380
|
"quotes": ["approvalStatusChangedDate", "createDate", "effectiveDate", "expirationDate", "extApprovalResponseDate", "lastActivityDate", "lastPublishedDateTime"],
|
|
19381
|
+
"resource_attachments": ["attachDate"],
|
|
18914
19382
|
"resources": ["hireDate"],
|
|
18915
19383
|
"sales_order_attachments": ["attachDate"],
|
|
18916
19384
|
"sales_orders": ["promisedFulfillmentDate", "salesOrderDate"],
|
|
@@ -19287,14 +19755,20 @@ var QueryBase = class {
|
|
|
19287
19755
|
// ------------------------------------------------------------------
|
|
19288
19756
|
// Query walk (wired to the G3 walker; cursor-follow per the pinned wire)
|
|
19289
19757
|
// ------------------------------------------------------------------
|
|
19290
|
-
/**
|
|
19758
|
+
/** Follow the vendor cursor with the initial query method and, for POST, the same QueryModel (issue #118). */
|
|
19291
19759
|
async fetchPage(params, page, pageSize, state2) {
|
|
19292
|
-
if (params.includeFields !== void 0) {
|
|
19760
|
+
if (state2.initialRequest === void 0 && params.includeFields !== void 0) {
|
|
19293
19761
|
params = { ...params, includeFields: params.includeFields.map((field) => normalizeOwnField(this.config.key, field)) };
|
|
19294
19762
|
}
|
|
19295
19763
|
const operation = `${this.config.key}.query`;
|
|
19296
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
|
+
}
|
|
19297
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;
|
|
19298
19772
|
const body2 = await this.http.request({ ...req, operation });
|
|
19299
19773
|
return this.readPage(body2, page, pageSize, state2);
|
|
19300
19774
|
}
|
|
@@ -19306,10 +19780,25 @@ var QueryBase = class {
|
|
|
19306
19780
|
operation
|
|
19307
19781
|
});
|
|
19308
19782
|
}
|
|
19309
|
-
const
|
|
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 });
|
|
19310
19799
|
const res = await this.http.request({
|
|
19311
19800
|
method: "POST",
|
|
19312
|
-
path: cursorToPath(this.http.baseUrl, cursor),
|
|
19801
|
+
path: cursorToPath(this.http.baseUrl, cursor, cursorResource),
|
|
19313
19802
|
body,
|
|
19314
19803
|
operation,
|
|
19315
19804
|
idempotent: true
|
|
@@ -19368,10 +19857,10 @@ var QueryBase = class {
|
|
|
19368
19857
|
const walk = await this.relationWalkParams(rest, `${this.config.key}.query`);
|
|
19369
19858
|
if (walk === void 0) return;
|
|
19370
19859
|
if (!label || client === void 0) {
|
|
19371
|
-
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19860
|
+
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19372
19861
|
return;
|
|
19373
19862
|
}
|
|
19374
|
-
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) })) {
|
|
19375
19864
|
const labelled = await labelRows(client, this.config.key, page.items);
|
|
19376
19865
|
yield* labelled.rows;
|
|
19377
19866
|
}
|
|
@@ -19380,13 +19869,13 @@ var QueryBase = class {
|
|
|
19380
19869
|
async *queryPageIter(params) {
|
|
19381
19870
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19382
19871
|
if (walk === void 0) return;
|
|
19383
|
-
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19872
|
+
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19384
19873
|
}
|
|
19385
19874
|
/** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded; relation filters resolve first, #281). */
|
|
19386
19875
|
async queryAllItems(params) {
|
|
19387
19876
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19388
19877
|
if (walk === void 0) return [];
|
|
19389
|
-
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 });
|
|
19390
19879
|
}
|
|
19391
19880
|
/**
|
|
19392
19881
|
* `queryBounded` — server-side pagination (the MCP query surface): ONE call
|
|
@@ -19397,12 +19886,10 @@ var QueryBase = class {
|
|
|
19397
19886
|
* AutotaskConfigError; it is NOT a page size). The page-1 request uses
|
|
19398
19887
|
* the internal page size min(500, limit) (the `latest` mechanism sizes
|
|
19399
19888
|
* its walk from the matching count). Explicit `walk.maxRows` replaces
|
|
19400
|
-
* the total cap; `limit` then only sizes pages.
|
|
19401
|
-
*
|
|
19402
|
-
*
|
|
19403
|
-
*
|
|
19404
|
-
* page size), so the walk reuses `fetchPage` (the shared cursor machinery)
|
|
19405
|
-
* 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.
|
|
19406
19893
|
* - The 1000-page guard still applies as a SOFT stop: a walk that would
|
|
19407
19894
|
* fetch a 1001st page stops with `hasMore: true` (never a throw — this
|
|
19408
19895
|
* is a bounded read, not the `paginate` generator's error path).
|
|
@@ -19564,7 +20051,7 @@ var QueryBase = class {
|
|
|
19564
20051
|
if (consume === void 0) items.push(...take);
|
|
19565
20052
|
else await consume(take, pages2);
|
|
19566
20053
|
if (fetched >= limit) break;
|
|
19567
|
-
if (!page.hasMore || page.items.length === 0) break;
|
|
20054
|
+
if (!page.hasMore || page.items.length === 0 && !isAuditLogResource(this.config.key)) break;
|
|
19568
20055
|
}
|
|
19569
20056
|
const names = nameNotes.size === 0 ? void 0 : {
|
|
19570
20057
|
note: [...nameNotes].join("; "),
|
|
@@ -19711,13 +20198,17 @@ var QueryBase = class {
|
|
|
19711
20198
|
};
|
|
19712
20199
|
let lo = 0n;
|
|
19713
20200
|
let hi;
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
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;
|
|
19719
20211
|
}
|
|
19720
|
-
lo = t;
|
|
19721
20212
|
}
|
|
19722
20213
|
while (hi - lo > 1n) {
|
|
19723
20214
|
const mid = lo + hi >> 1n;
|
|
@@ -21284,6 +21775,8 @@ var SCOPED_ATTACHMENT_PARENTS = {
|
|
|
21284
21775
|
project_note_attachments: { field: "projectNoteID", name: "project note" },
|
|
21285
21776
|
contract_note_attachments: { field: "contractNoteID", name: "contract note" },
|
|
21286
21777
|
sales_order_attachments: { field: "salesOrderID", name: "sales order" },
|
|
21778
|
+
expense_report_attachments: { field: "expenseReportID", name: "expense report" },
|
|
21779
|
+
resource_attachments: { field: "resourceID", name: "resource" },
|
|
21287
21780
|
task_attachments: { field: "taskID", name: "task" },
|
|
21288
21781
|
task_note_attachments: { field: "taskNoteID", name: "task note" },
|
|
21289
21782
|
configuration_item_attachments: { field: "configurationItemID", name: "configuration item" },
|
|
@@ -21334,6 +21827,8 @@ function admitFileAttachment(resource, data, parentId) {
|
|
|
21334
21827
|
project_attachments: void 0,
|
|
21335
21828
|
contract_note_attachments: void 0,
|
|
21336
21829
|
sales_order_attachments: void 0,
|
|
21830
|
+
expense_report_attachments: void 0,
|
|
21831
|
+
resource_attachments: void 0,
|
|
21337
21832
|
task_note_attachments: "attachedByContactID",
|
|
21338
21833
|
project_note_attachments: "attachedByContactID",
|
|
21339
21834
|
configuration_item_attachments: "parentAttachmentID",
|
|
@@ -22070,6 +22565,36 @@ var SIMPLE_RESOURCES = [
|
|
|
22070
22565
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22071
22566
|
opForms: { get: "global", update: "global" }
|
|
22072
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
|
+
},
|
|
22073
22598
|
{
|
|
22074
22599
|
key: "departments",
|
|
22075
22600
|
accessor: "departments",
|
|
@@ -22121,6 +22646,20 @@ var SIMPLE_RESOURCES = [
|
|
|
22121
22646
|
helpers: { search: false, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22122
22647
|
opForms: { get: "global", create: "scoped", update: "scoped" }
|
|
22123
22648
|
},
|
|
22649
|
+
{
|
|
22650
|
+
key: "expense_report_attachments",
|
|
22651
|
+
accessor: "expenseReportAttachments",
|
|
22652
|
+
resourcePath: "/V1.0/ExpenseReportAttachments",
|
|
22653
|
+
parentScopedPath: "/V1.0/ExpenseReports/{parentId}/Attachments",
|
|
22654
|
+
parentPath: "/V1.0/ExpenseReports",
|
|
22655
|
+
parentField: "expenseReportID",
|
|
22656
|
+
deletable: true,
|
|
22657
|
+
udfCapable: false,
|
|
22658
|
+
attachmentGet: true,
|
|
22659
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
|
|
22660
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22661
|
+
opForms: { get: "scoped", create: "scoped", delete: "scoped" }
|
|
22662
|
+
},
|
|
22124
22663
|
{
|
|
22125
22664
|
key: "expense_reports",
|
|
22126
22665
|
accessor: "expenseReports",
|
|
@@ -22442,6 +22981,20 @@ var SIMPLE_RESOURCES = [
|
|
|
22442
22981
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22443
22982
|
opForms: { get: "global" }
|
|
22444
22983
|
},
|
|
22984
|
+
{
|
|
22985
|
+
key: "resource_attachments",
|
|
22986
|
+
accessor: "resourceAttachments",
|
|
22987
|
+
resourcePath: "/V1.0/ResourceAttachments",
|
|
22988
|
+
parentScopedPath: "/V1.0/Resources/{parentId}/Attachments",
|
|
22989
|
+
parentPath: "/V1.0/Resources",
|
|
22990
|
+
parentField: "resourceID",
|
|
22991
|
+
deletable: true,
|
|
22992
|
+
udfCapable: false,
|
|
22993
|
+
attachmentGet: true,
|
|
22994
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
|
|
22995
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22996
|
+
opForms: { get: "scoped", create: "scoped", delete: "scoped" }
|
|
22997
|
+
},
|
|
22445
22998
|
{
|
|
22446
22999
|
key: "resource_role_queues",
|
|
22447
23000
|
accessor: "resourceRoleQueues",
|
|
@@ -23010,7 +23563,7 @@ var SIMPLE_RESOURCES = [
|
|
|
23010
23563
|
var GenericResource = class extends BaseResource {
|
|
23011
23564
|
constructor(http, config, pageSize) {
|
|
23012
23565
|
super(http, config, pageSize);
|
|
23013
|
-
if (["company_attachments", "company_note_attachments", "configuration_item_attachments", "configuration_item_note_attachments", "contract_note_attachments", "project_attachments", "project_note_attachments", "sales_order_attachments", "task_attachments", "task_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
|
|
23566
|
+
if (["company_attachments", "company_note_attachments", "configuration_item_attachments", "configuration_item_note_attachments", "contract_note_attachments", "expense_report_attachments", "project_attachments", "project_note_attachments", "resource_attachments", "sales_order_attachments", "task_attachments", "task_note_attachments"].includes(config.key)) this.getUdfInfo = async () => {
|
|
23014
23567
|
throw new OperationNotSupportedError(config.key, "getUdfInfo");
|
|
23015
23568
|
};
|
|
23016
23569
|
if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
|
|
@@ -23051,7 +23604,7 @@ var GenericResource = class extends BaseResource {
|
|
|
23051
23604
|
}
|
|
23052
23605
|
async fetchPage(params, page, pageSize, state2) {
|
|
23053
23606
|
const key = this.config.key;
|
|
23054
|
-
if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23607
|
+
if (state2.initialRequest === void 0 && isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23055
23608
|
return super.fetchPage(params, page, pageSize, state2);
|
|
23056
23609
|
}
|
|
23057
23610
|
async countGlobal(params) {
|
|
@@ -24893,7 +25446,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
24893
25446
|
var queryResourceKeysPromise = null;
|
|
24894
25447
|
function queryResourceKeys() {
|
|
24895
25448
|
if (queryResourceKeysPromise === null) {
|
|
24896
|
-
queryResourceKeysPromise =
|
|
25449
|
+
queryResourceKeysPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => {
|
|
24897
25450
|
const s = /* @__PURE__ */ new Set();
|
|
24898
25451
|
for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
|
|
24899
25452
|
return s;
|
|
@@ -25015,7 +25568,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
25015
25568
|
return { top, limit };
|
|
25016
25569
|
}
|
|
25017
25570
|
async function checkFieldNames(resourceKey, conditions, opts, problems) {
|
|
25018
|
-
const records = resourceKey === void 0 ? [] : await
|
|
25571
|
+
const records = resourceKey === void 0 ? [] : await chunkMVGGHMOB_cjs.loadCapabilityRecords();
|
|
25019
25572
|
const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
|
|
25020
25573
|
if (record === void 0) return void 0;
|
|
25021
25574
|
const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
|
|
@@ -25057,6 +25610,9 @@ async function validateAggregate(operation, filter, opts) {
|
|
|
25057
25610
|
const known = await checkFieldNames(resourceKey, conditions, opts, problems);
|
|
25058
25611
|
const groupBy = parseGroupBy(opts, oracles, known, problems);
|
|
25059
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
|
+
}
|
|
25060
25616
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
25061
25617
|
if (problems.length > 0) {
|
|
25062
25618
|
throw new AutotaskConfigError(
|
|
@@ -25367,7 +25923,10 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
|
|
|
25367
25923
|
continue;
|
|
25368
25924
|
}
|
|
25369
25925
|
try {
|
|
25370
|
-
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
|
+
}
|
|
25371
25930
|
} catch {
|
|
25372
25931
|
if (typeof item.id === "string") {
|
|
25373
25932
|
problems.push(
|
|
@@ -25660,7 +26219,7 @@ async function uiLink(client, input) {
|
|
|
25660
26219
|
var indexPromise = null;
|
|
25661
26220
|
function operationIndex() {
|
|
25662
26221
|
if (indexPromise === null) {
|
|
25663
|
-
indexPromise =
|
|
26222
|
+
indexPromise = chunkMVGGHMOB_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
|
|
25664
26223
|
}
|
|
25665
26224
|
return indexPromise;
|
|
25666
26225
|
}
|