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,4 +1,4 @@
|
|
|
1
|
-
import { loadCapabilityRecords } from './chunk-
|
|
1
|
+
import { loadCapabilityRecords } from './chunk-HASLVFC7.js';
|
|
2
2
|
import { NoopLogger, REDACTED, deepMarkUntrusted, wrapUntrusted } from './chunk-7NKB4UXV.js';
|
|
3
3
|
import { randomUUID, createHash } from 'crypto';
|
|
4
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
@@ -402,13 +402,14 @@ function suggestedActionForStatus(status) {
|
|
|
402
402
|
return status >= 500 ? "The SDK already retried per its policy. A repeated 500 on one entity while others work usually means the API user lacks permission on that entity \u2014 ask the Autotask admin to grant it; otherwise retry once more at most." : void 0;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential) {
|
|
405
|
+
function errorFromStatus(status, body, url, operation, redactPersonalData = true, credential, includeVendorDetails = true) {
|
|
406
406
|
const safeBody = redactResponseBody(body, { redactPersonalData });
|
|
407
|
-
|
|
407
|
+
const exposedBody = includeVendorDetails ? safeBody : void 0;
|
|
408
|
+
let detail = formatVendorDetail(exposedBody);
|
|
408
409
|
if (detail !== void 0 && detail.length > VENDOR_BODY_SUFFIX_LIMIT) {
|
|
409
410
|
detail = detail.slice(0, VENDOR_BODY_SUFFIX_LIMIT);
|
|
410
411
|
}
|
|
411
|
-
const suffix = detail === void 0 ? vendorBodySuffix(
|
|
412
|
+
const suffix = detail === void 0 ? vendorBodySuffix(exposedBody) : void 0;
|
|
412
413
|
const message = detail ?? (suffix !== void 0 ? `${statusDefaultMessage(status)}: ${suffix}` : statusDefaultMessage(status));
|
|
413
414
|
const shape = errorShapeForStatus(status);
|
|
414
415
|
const Ctor = shape?.Ctor ?? AutotaskError;
|
|
@@ -419,10 +420,10 @@ function errorFromStatus(status, body, url, operation, redactPersonalData = true
|
|
|
419
420
|
const credentialDetails = status === 401 ? credentialDiagnosticDetails(credential) : void 0;
|
|
420
421
|
const extraDetails = mergeDetails(void 0, credentialDetails);
|
|
421
422
|
const err = new Ctor(message, {
|
|
422
|
-
code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) ? vendorCodeCandidate : code,
|
|
423
|
+
code: vendorCodeCandidate !== void 0 && isMachineCode(vendorCodeCandidate) && (includeVendorDetails || vendorCodeCandidate.toLowerCase() === "itgenatr005") ? vendorCodeCandidate : code,
|
|
423
424
|
...category !== void 0 ? { category } : {},
|
|
424
425
|
httpStatus: status,
|
|
425
|
-
vendorError:
|
|
426
|
+
vendorError: exposedBody,
|
|
426
427
|
url,
|
|
427
428
|
operation,
|
|
428
429
|
retryable: status === 429 || status >= 500,
|
|
@@ -1441,6 +1442,11 @@ function resolveConfig(config) {
|
|
|
1441
1442
|
|
|
1442
1443
|
// src/http/types.ts
|
|
1443
1444
|
var IDEMPOTENT_METHODS = ["GET", "PUT", "DELETE"];
|
|
1445
|
+
var AUDIT_DECIMAL_ID = /^(?:0|[1-9]\d{0,18})$/;
|
|
1446
|
+
var MAX_AUDIT_ID = "9223372036854775807";
|
|
1447
|
+
function isAuditDecimalId(id) {
|
|
1448
|
+
return AUDIT_DECIMAL_ID.test(id) && (id.length < MAX_AUDIT_ID.length || id <= MAX_AUDIT_ID);
|
|
1449
|
+
}
|
|
1444
1450
|
function isRecord2(value) {
|
|
1445
1451
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1446
1452
|
}
|
|
@@ -1638,17 +1644,39 @@ function refusedFilterShape(filter) {
|
|
|
1638
1644
|
if (t === "object" || t === "function") return "an object";
|
|
1639
1645
|
return t === "string" ? "a string" : `a ${t}`;
|
|
1640
1646
|
}
|
|
1641
|
-
function
|
|
1647
|
+
function assertQueryFilterForWire(conditions, operation, auditIds) {
|
|
1642
1648
|
if (!Array.isArray(conditions)) return;
|
|
1643
|
-
for (const
|
|
1644
|
-
if (!isRecord2(
|
|
1645
|
-
|
|
1646
|
-
|
|
1649
|
+
for (const input of conditions) {
|
|
1650
|
+
if (!isRecord2(input)) continue;
|
|
1651
|
+
const c = auditIds ? {} : input;
|
|
1652
|
+
if (auditIds) {
|
|
1653
|
+
for (const [key, value] of Object.entries(input)) {
|
|
1654
|
+
const lower = key.toLowerCase();
|
|
1655
|
+
if (!["op", "field", "value", "items", "udf"].includes(lower)) continue;
|
|
1656
|
+
if (Object.hasOwn(c, lower)) {
|
|
1657
|
+
throw new AutotaskConfigError("Audit filter predicates must provide each field once.", { operation });
|
|
1658
|
+
}
|
|
1659
|
+
c[lower] = value;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
if (Array.isArray(c.items)) assertQueryFilterForWire(c.items, operation, auditIds);
|
|
1663
|
+
if (c.udf === true || typeof c.field !== "string") continue;
|
|
1664
|
+
if (c.field.includes(".")) {
|
|
1647
1665
|
throw new AutotaskConfigError(
|
|
1648
1666
|
`${operation}: filter field "${c.field}" is a relation filter that was not resolved on this path \u2014 the request was not issued`,
|
|
1649
1667
|
{ operation, suggestedAction: "Use a query surface that resolves relation filters (query, queryAll, queryBounded, count, operations.aggregate), or filter by the <relation>ID field directly." }
|
|
1650
1668
|
);
|
|
1651
1669
|
}
|
|
1670
|
+
if (auditIds && c.field.trim().toLowerCase() === "id") {
|
|
1671
|
+
const values = Array.isArray(c.value) ? c.value : [c.value];
|
|
1672
|
+
if (c.value === void 0 && (c.op === "exist" || c.op === "notExist")) continue;
|
|
1673
|
+
if (values.length === 0 || values.some((value) => typeof value === "number" ? !Number.isSafeInteger(value) || value < 0 : typeof value !== "string" || !isAuditDecimalId(value))) {
|
|
1674
|
+
throw new AutotaskConfigError(`${operation}: audit log ID filters require a safe integer or an exact decimal string.`, {
|
|
1675
|
+
operation,
|
|
1676
|
+
suggestedAction: "Pass each large ID as an exact decimal string."
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1652
1680
|
}
|
|
1653
1681
|
}
|
|
1654
1682
|
|
|
@@ -1665,14 +1693,14 @@ function assertSafePath(path) {
|
|
|
1665
1693
|
return decoded === "." || decoded === ".." || /[/\\]/.test(decoded);
|
|
1666
1694
|
});
|
|
1667
1695
|
if (bad) {
|
|
1668
|
-
throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: not a plain absolute API path (dot segment, '#', '\\', control character or missing leading '/')`);
|
|
1696
|
+
throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.split("?", 1)[0].slice(0, 200))}: not a plain absolute API path (dot segment, '#', '\\', control character or missing leading '/')`);
|
|
1669
1697
|
}
|
|
1670
1698
|
}
|
|
1671
1699
|
function buildUrl(baseUrl, path, query) {
|
|
1672
1700
|
assertSafePath(path);
|
|
1673
1701
|
let url = baseUrl + path;
|
|
1674
1702
|
if (new URL(url).origin !== new URL(baseUrl).origin) {
|
|
1675
|
-
throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.slice(0, 200))}: it leaves the configured origin`);
|
|
1703
|
+
throw new AutotaskConfigError(`Refused request path ${JSON.stringify(path.split("?", 1)[0].slice(0, 200))}: it leaves the configured origin`);
|
|
1676
1704
|
}
|
|
1677
1705
|
if (query !== void 0) {
|
|
1678
1706
|
const params = new URLSearchParams();
|
|
@@ -1681,11 +1709,11 @@ function buildUrl(baseUrl, path, query) {
|
|
|
1681
1709
|
params.set(key, String(value));
|
|
1682
1710
|
}
|
|
1683
1711
|
const qs = params.toString();
|
|
1684
|
-
if (qs.length > 0) url +=
|
|
1712
|
+
if (qs.length > 0) url += `${path.includes("?") ? "&" : "?"}${qs}`;
|
|
1685
1713
|
}
|
|
1686
1714
|
return url;
|
|
1687
1715
|
}
|
|
1688
|
-
function cursorToPath(baseUrl, cursor) {
|
|
1716
|
+
function cursorToPath(baseUrl, cursor, resourcePath) {
|
|
1689
1717
|
const base = new URL(baseUrl);
|
|
1690
1718
|
let url;
|
|
1691
1719
|
try {
|
|
@@ -1698,6 +1726,18 @@ function cursorToPath(baseUrl, cursor) {
|
|
|
1698
1726
|
}
|
|
1699
1727
|
const basePath = base.pathname.replace(/\/+$/, "");
|
|
1700
1728
|
const path = basePath !== "" && url.pathname.startsWith(`${basePath}/`) ? url.pathname.slice(basePath.length) : url.pathname;
|
|
1729
|
+
if (resourcePath !== void 0) {
|
|
1730
|
+
let route;
|
|
1731
|
+
try {
|
|
1732
|
+
route = decodeURIComponent(path).toLowerCase().replace(/\/$/, "");
|
|
1733
|
+
} catch {
|
|
1734
|
+
throw new ResponseRejectedError("Refused the pagination cursor: invalid path encoding.");
|
|
1735
|
+
}
|
|
1736
|
+
const query = `${resourcePath.toLowerCase()}/query`;
|
|
1737
|
+
if (route !== query && route !== `${query}/next`) {
|
|
1738
|
+
throw new ResponseRejectedError("Refused the pagination cursor outside the original query route.");
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1701
1741
|
return path + url.search;
|
|
1702
1742
|
}
|
|
1703
1743
|
function buildQueryBody(params) {
|
|
@@ -1714,6 +1754,16 @@ function effectiveIncludeFields(params) {
|
|
|
1714
1754
|
if (params.includeFields === void 0) return void 0;
|
|
1715
1755
|
return params.includeFields.includes("id") ? params.includeFields : [...params.includeFields, "id"];
|
|
1716
1756
|
}
|
|
1757
|
+
function assertGetQueryUrlLength(url) {
|
|
1758
|
+
const length = new URL(url).href.length;
|
|
1759
|
+
if (length > MAX_GET_LENGTH) {
|
|
1760
|
+
throw new QueryTooLongError(`GET query URL is ${length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`);
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
function buildQueryGetRequest(baseUrl, path, query) {
|
|
1764
|
+
assertGetQueryUrlLength(buildUrl(baseUrl, path, query));
|
|
1765
|
+
return { method: "GET", path, query };
|
|
1766
|
+
}
|
|
1717
1767
|
function buildQueryRequest(baseUrl, resourcePath, params) {
|
|
1718
1768
|
const queryPath = `${resourcePath}/query`;
|
|
1719
1769
|
if (params.via === "get") {
|
|
@@ -1724,18 +1774,7 @@ function buildQueryRequest(baseUrl, resourcePath, params) {
|
|
|
1724
1774
|
if (filter !== void 0) search.filter = filter.filter;
|
|
1725
1775
|
if (params.maxRecords !== void 0) search.maxRecords = params.maxRecords;
|
|
1726
1776
|
if (includeFields !== void 0) search.includeFields = includeFields;
|
|
1727
|
-
|
|
1728
|
-
method: "GET",
|
|
1729
|
-
path: queryPath,
|
|
1730
|
-
query: { search: JSON.stringify(search) }
|
|
1731
|
-
};
|
|
1732
|
-
const url = buildUrl(baseUrl, queryPath, req.query);
|
|
1733
|
-
if (url.length > MAX_GET_LENGTH) {
|
|
1734
|
-
throw new QueryTooLongError(
|
|
1735
|
-
`GET query URL is ${url.length} chars; the vendor GET cap is ${MAX_GET_LENGTH}`
|
|
1736
|
-
);
|
|
1737
|
-
}
|
|
1738
|
-
return req;
|
|
1777
|
+
return buildQueryGetRequest(baseUrl, queryPath, { search: JSON.stringify(search) });
|
|
1739
1778
|
}
|
|
1740
1779
|
return { method: "POST", path: queryPath, body: buildQueryBody(params), idempotent: true };
|
|
1741
1780
|
}
|
|
@@ -5459,6 +5498,22 @@ var RELATIONSHIP_MAP = {
|
|
|
5459
5498
|
"update": true,
|
|
5460
5499
|
"delete": false
|
|
5461
5500
|
}
|
|
5501
|
+
},
|
|
5502
|
+
{
|
|
5503
|
+
"resource": "expense_report_attachments",
|
|
5504
|
+
"apiEntity": "ExpenseReportAttachment",
|
|
5505
|
+
"parentField": "expenseReportID",
|
|
5506
|
+
"parentSegment": "Attachments",
|
|
5507
|
+
"tier": "extended",
|
|
5508
|
+
"workflowResource": false,
|
|
5509
|
+
"specialOps": [],
|
|
5510
|
+
"searchCovers": null,
|
|
5511
|
+
"scopedOps": {
|
|
5512
|
+
"create": true,
|
|
5513
|
+
"query": true,
|
|
5514
|
+
"update": false,
|
|
5515
|
+
"delete": true
|
|
5516
|
+
}
|
|
5462
5517
|
}
|
|
5463
5518
|
],
|
|
5464
5519
|
"naturalKeys": {
|
|
@@ -7145,6 +7200,22 @@ var RELATIONSHIP_MAP = {
|
|
|
7145
7200
|
"group": "B",
|
|
7146
7201
|
"parent": null,
|
|
7147
7202
|
"children": [
|
|
7203
|
+
{
|
|
7204
|
+
"resource": "resource_attachments",
|
|
7205
|
+
"apiEntity": "ResourceAttachment",
|
|
7206
|
+
"parentField": "resourceID",
|
|
7207
|
+
"parentSegment": "Attachments",
|
|
7208
|
+
"tier": "extended",
|
|
7209
|
+
"workflowResource": false,
|
|
7210
|
+
"specialOps": [],
|
|
7211
|
+
"searchCovers": null,
|
|
7212
|
+
"scopedOps": {
|
|
7213
|
+
"create": true,
|
|
7214
|
+
"query": true,
|
|
7215
|
+
"update": false,
|
|
7216
|
+
"delete": true
|
|
7217
|
+
}
|
|
7218
|
+
},
|
|
7148
7219
|
{
|
|
7149
7220
|
"resource": "resource_role_queues",
|
|
7150
7221
|
"apiEntity": "ResourceRoleQueue",
|
|
@@ -10492,6 +10563,201 @@ var RELATIONSHIP_MAP = {
|
|
|
10492
10563
|
},
|
|
10493
10564
|
"deleteBoundary": null,
|
|
10494
10565
|
"markerField": null
|
|
10566
|
+
},
|
|
10567
|
+
"expense_report_attachments": {
|
|
10568
|
+
"resource": "expense_report_attachments",
|
|
10569
|
+
"apiEntity": "ExpenseReportAttachment",
|
|
10570
|
+
"kind": "entity",
|
|
10571
|
+
"path": "ExpenseReportAttachments",
|
|
10572
|
+
"parentScoped": true,
|
|
10573
|
+
"tier": "extended",
|
|
10574
|
+
"workflowResource": false,
|
|
10575
|
+
"group": "B",
|
|
10576
|
+
"parent": {
|
|
10577
|
+
"resource": "expense_reports",
|
|
10578
|
+
"segment": "Attachments",
|
|
10579
|
+
"field": "expenseReportID"
|
|
10580
|
+
},
|
|
10581
|
+
"children": [],
|
|
10582
|
+
"naturalKeys": {
|
|
10583
|
+
"hasSearch": false,
|
|
10584
|
+
"searchCovers": null,
|
|
10585
|
+
"findBy": []
|
|
10586
|
+
},
|
|
10587
|
+
"blindSurfaces": null,
|
|
10588
|
+
"zoneFacts": {
|
|
10589
|
+
"createGuidance": {
|
|
10590
|
+
"createOp": "expense_report_attachments.create",
|
|
10591
|
+
"parentScoped": true,
|
|
10592
|
+
"liveProvenPrefix": [],
|
|
10593
|
+
"unproven": true,
|
|
10594
|
+
"blocker": {
|
|
10595
|
+
"kind": "unknown",
|
|
10596
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
10597
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
10598
|
+
"requires": {
|
|
10599
|
+
"allOf": [
|
|
10600
|
+
"attachmentType",
|
|
10601
|
+
"fullPath",
|
|
10602
|
+
"title",
|
|
10603
|
+
"publish",
|
|
10604
|
+
"data"
|
|
10605
|
+
]
|
|
10606
|
+
}
|
|
10607
|
+
},
|
|
10608
|
+
"requiresByValue": [
|
|
10609
|
+
{
|
|
10610
|
+
"field": "attachmentType",
|
|
10611
|
+
"value": "FILE_ATTACHMENT",
|
|
10612
|
+
"requires": {
|
|
10613
|
+
"allOf": [
|
|
10614
|
+
"data"
|
|
10615
|
+
]
|
|
10616
|
+
}
|
|
10617
|
+
}
|
|
10618
|
+
],
|
|
10619
|
+
"vendorEvidence": [
|
|
10620
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ExpenseReportAttachmentsEntity.htm",
|
|
10621
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
10622
|
+
"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."
|
|
10623
|
+
],
|
|
10624
|
+
"deleteBoundary": {
|
|
10625
|
+
"available": true,
|
|
10626
|
+
"note": null
|
|
10627
|
+
}
|
|
10628
|
+
}
|
|
10629
|
+
},
|
|
10630
|
+
"deleteBoundary": null,
|
|
10631
|
+
"markerField": null
|
|
10632
|
+
},
|
|
10633
|
+
"resource_attachments": {
|
|
10634
|
+
"resource": "resource_attachments",
|
|
10635
|
+
"apiEntity": "ResourceAttachment",
|
|
10636
|
+
"kind": "entity",
|
|
10637
|
+
"path": "ResourceAttachments",
|
|
10638
|
+
"parentScoped": true,
|
|
10639
|
+
"tier": "extended",
|
|
10640
|
+
"workflowResource": false,
|
|
10641
|
+
"group": "B",
|
|
10642
|
+
"parent": {
|
|
10643
|
+
"resource": "resources",
|
|
10644
|
+
"segment": "Attachments",
|
|
10645
|
+
"field": "resourceID"
|
|
10646
|
+
},
|
|
10647
|
+
"children": [],
|
|
10648
|
+
"naturalKeys": {
|
|
10649
|
+
"hasSearch": false,
|
|
10650
|
+
"searchCovers": null,
|
|
10651
|
+
"findBy": []
|
|
10652
|
+
},
|
|
10653
|
+
"blindSurfaces": null,
|
|
10654
|
+
"zoneFacts": {
|
|
10655
|
+
"createGuidance": {
|
|
10656
|
+
"createOp": "resource_attachments.create",
|
|
10657
|
+
"parentScoped": true,
|
|
10658
|
+
"liveProvenPrefix": [],
|
|
10659
|
+
"unproven": true,
|
|
10660
|
+
"blocker": {
|
|
10661
|
+
"kind": "unknown",
|
|
10662
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
10663
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
10664
|
+
"requires": {
|
|
10665
|
+
"allOf": [
|
|
10666
|
+
"attachmentType",
|
|
10667
|
+
"fullPath",
|
|
10668
|
+
"title",
|
|
10669
|
+
"publish",
|
|
10670
|
+
"data"
|
|
10671
|
+
]
|
|
10672
|
+
}
|
|
10673
|
+
},
|
|
10674
|
+
"requiresByValue": [
|
|
10675
|
+
{
|
|
10676
|
+
"field": "attachmentType",
|
|
10677
|
+
"value": "FILE_ATTACHMENT",
|
|
10678
|
+
"requires": {
|
|
10679
|
+
"allOf": [
|
|
10680
|
+
"data"
|
|
10681
|
+
]
|
|
10682
|
+
}
|
|
10683
|
+
}
|
|
10684
|
+
],
|
|
10685
|
+
"vendorEvidence": [
|
|
10686
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ResourceAttachmentsEntity.htm",
|
|
10687
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
10688
|
+
"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."
|
|
10689
|
+
],
|
|
10690
|
+
"deleteBoundary": {
|
|
10691
|
+
"available": true,
|
|
10692
|
+
"note": null
|
|
10693
|
+
}
|
|
10694
|
+
}
|
|
10695
|
+
},
|
|
10696
|
+
"deleteBoundary": null,
|
|
10697
|
+
"markerField": null
|
|
10698
|
+
},
|
|
10699
|
+
"deleted_task_activity_logs": {
|
|
10700
|
+
"resource": "deleted_task_activity_logs",
|
|
10701
|
+
"apiEntity": "DeletedTaskActivityLog",
|
|
10702
|
+
"kind": "entity",
|
|
10703
|
+
"path": "DeletedTaskActivityLogs",
|
|
10704
|
+
"parentScoped": false,
|
|
10705
|
+
"tier": "advanced",
|
|
10706
|
+
"workflowResource": false,
|
|
10707
|
+
"group": "B",
|
|
10708
|
+
"parent": null,
|
|
10709
|
+
"children": [],
|
|
10710
|
+
"naturalKeys": {
|
|
10711
|
+
"hasSearch": false,
|
|
10712
|
+
"searchCovers": null,
|
|
10713
|
+
"findBy": []
|
|
10714
|
+
},
|
|
10715
|
+
"blindSurfaces": null,
|
|
10716
|
+
"zoneFacts": null,
|
|
10717
|
+
"deleteBoundary": null,
|
|
10718
|
+
"markerField": null
|
|
10719
|
+
},
|
|
10720
|
+
"deleted_ticket_activity_logs": {
|
|
10721
|
+
"resource": "deleted_ticket_activity_logs",
|
|
10722
|
+
"apiEntity": "DeletedTicketActivityLog",
|
|
10723
|
+
"kind": "entity",
|
|
10724
|
+
"path": "DeletedTicketActivityLogs",
|
|
10725
|
+
"parentScoped": false,
|
|
10726
|
+
"tier": "advanced",
|
|
10727
|
+
"workflowResource": false,
|
|
10728
|
+
"group": "B",
|
|
10729
|
+
"parent": null,
|
|
10730
|
+
"children": [],
|
|
10731
|
+
"naturalKeys": {
|
|
10732
|
+
"hasSearch": false,
|
|
10733
|
+
"searchCovers": null,
|
|
10734
|
+
"findBy": []
|
|
10735
|
+
},
|
|
10736
|
+
"blindSurfaces": null,
|
|
10737
|
+
"zoneFacts": null,
|
|
10738
|
+
"deleteBoundary": null,
|
|
10739
|
+
"markerField": null
|
|
10740
|
+
},
|
|
10741
|
+
"deleted_ticket_logs": {
|
|
10742
|
+
"resource": "deleted_ticket_logs",
|
|
10743
|
+
"apiEntity": "DeletedTicketLog",
|
|
10744
|
+
"kind": "entity",
|
|
10745
|
+
"path": "DeletedTicketLogs",
|
|
10746
|
+
"parentScoped": false,
|
|
10747
|
+
"tier": "advanced",
|
|
10748
|
+
"workflowResource": false,
|
|
10749
|
+
"group": "B",
|
|
10750
|
+
"parent": null,
|
|
10751
|
+
"children": [],
|
|
10752
|
+
"naturalKeys": {
|
|
10753
|
+
"hasSearch": false,
|
|
10754
|
+
"searchCovers": null,
|
|
10755
|
+
"findBy": []
|
|
10756
|
+
},
|
|
10757
|
+
"blindSurfaces": null,
|
|
10758
|
+
"zoneFacts": null,
|
|
10759
|
+
"deleteBoundary": null,
|
|
10760
|
+
"markerField": null
|
|
10495
10761
|
}
|
|
10496
10762
|
};
|
|
10497
10763
|
var BLIND_SURFACE_STAMPS = {
|
|
@@ -13416,6 +13682,47 @@ var CREATE_GUIDANCE = {
|
|
|
13416
13682
|
"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."
|
|
13417
13683
|
}
|
|
13418
13684
|
},
|
|
13685
|
+
{
|
|
13686
|
+
"resource": "expense_report_attachments",
|
|
13687
|
+
"createOp": "expense_report_attachments.create",
|
|
13688
|
+
"parentScoped": true,
|
|
13689
|
+
"liveProvenPrefix": [],
|
|
13690
|
+
"unproven": true,
|
|
13691
|
+
"blocker": {
|
|
13692
|
+
"kind": "unknown",
|
|
13693
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
13694
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
13695
|
+
"requires": {
|
|
13696
|
+
"allOf": [
|
|
13697
|
+
"attachmentType",
|
|
13698
|
+
"fullPath",
|
|
13699
|
+
"title",
|
|
13700
|
+
"publish",
|
|
13701
|
+
"data"
|
|
13702
|
+
]
|
|
13703
|
+
}
|
|
13704
|
+
},
|
|
13705
|
+
"vendorEvidence": [
|
|
13706
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ExpenseReportAttachmentsEntity.htm",
|
|
13707
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
13708
|
+
"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."
|
|
13709
|
+
],
|
|
13710
|
+
"deleteBoundary": {
|
|
13711
|
+
"available": true,
|
|
13712
|
+
"note": null
|
|
13713
|
+
},
|
|
13714
|
+
"requiresByValue": [
|
|
13715
|
+
{
|
|
13716
|
+
"field": "attachmentType",
|
|
13717
|
+
"value": "FILE_ATTACHMENT",
|
|
13718
|
+
"requires": {
|
|
13719
|
+
"allOf": [
|
|
13720
|
+
"data"
|
|
13721
|
+
]
|
|
13722
|
+
}
|
|
13723
|
+
}
|
|
13724
|
+
]
|
|
13725
|
+
},
|
|
13419
13726
|
{
|
|
13420
13727
|
"resource": "expense_reports",
|
|
13421
13728
|
"createOp": "expense_reports.create",
|
|
@@ -14001,6 +14308,47 @@ var CREATE_GUIDANCE = {
|
|
|
14001
14308
|
"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."
|
|
14002
14309
|
}
|
|
14003
14310
|
},
|
|
14311
|
+
{
|
|
14312
|
+
"resource": "resource_attachments",
|
|
14313
|
+
"createOp": "resource_attachments.create",
|
|
14314
|
+
"parentScoped": true,
|
|
14315
|
+
"liveProvenPrefix": [],
|
|
14316
|
+
"unproven": true,
|
|
14317
|
+
"blocker": {
|
|
14318
|
+
"kind": "unknown",
|
|
14319
|
+
"message": "Attachment creation is documented; valid input remains subject to API-user permissions and vendor validation.",
|
|
14320
|
+
"remedy": "Read the current field and picklist metadata, supply the named parent id, and preview the attachment before applying.",
|
|
14321
|
+
"requires": {
|
|
14322
|
+
"allOf": [
|
|
14323
|
+
"attachmentType",
|
|
14324
|
+
"fullPath",
|
|
14325
|
+
"title",
|
|
14326
|
+
"publish",
|
|
14327
|
+
"data"
|
|
14328
|
+
]
|
|
14329
|
+
}
|
|
14330
|
+
},
|
|
14331
|
+
"vendorEvidence": [
|
|
14332
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/ResourceAttachmentsEntity.htm",
|
|
14333
|
+
"https://www.autotask.net/help/developerhelp/content/apis/REST/API_Calls/REST_Attachments.htm",
|
|
14334
|
+
"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."
|
|
14335
|
+
],
|
|
14336
|
+
"deleteBoundary": {
|
|
14337
|
+
"available": true,
|
|
14338
|
+
"note": null
|
|
14339
|
+
},
|
|
14340
|
+
"requiresByValue": [
|
|
14341
|
+
{
|
|
14342
|
+
"field": "attachmentType",
|
|
14343
|
+
"value": "FILE_ATTACHMENT",
|
|
14344
|
+
"requires": {
|
|
14345
|
+
"allOf": [
|
|
14346
|
+
"data"
|
|
14347
|
+
]
|
|
14348
|
+
}
|
|
14349
|
+
}
|
|
14350
|
+
]
|
|
14351
|
+
},
|
|
14004
14352
|
{
|
|
14005
14353
|
"resource": "resource_role_queues",
|
|
14006
14354
|
"createOp": "resource_role_queues.create",
|
|
@@ -14968,7 +15316,7 @@ var CREATE_GUIDANCE = {
|
|
|
14968
15316
|
}
|
|
14969
15317
|
],
|
|
14970
15318
|
"counts": {
|
|
14971
|
-
"total":
|
|
15319
|
+
"total": 114,
|
|
14972
15320
|
"byKind": {
|
|
14973
15321
|
"ok": 41,
|
|
14974
15322
|
"blind-reference": 16,
|
|
@@ -14978,7 +15326,7 @@ var CREATE_GUIDANCE = {
|
|
|
14978
15326
|
"resource-role-pair": 2,
|
|
14979
15327
|
"delete-absent": 0,
|
|
14980
15328
|
"non-mutable": 0,
|
|
14981
|
-
"unknown":
|
|
15329
|
+
"unknown": 38
|
|
14982
15330
|
}
|
|
14983
15331
|
}
|
|
14984
15332
|
};
|
|
@@ -15732,6 +16080,21 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
|
|
|
15732
16080
|
],
|
|
15733
16081
|
"sales_order_attachments": [
|
|
15734
16082
|
"title"
|
|
16083
|
+
],
|
|
16084
|
+
"expense_report_attachments": [
|
|
16085
|
+
"title"
|
|
16086
|
+
],
|
|
16087
|
+
"resource_attachments": [
|
|
16088
|
+
"title"
|
|
16089
|
+
],
|
|
16090
|
+
"deleted_task_activity_logs": [
|
|
16091
|
+
"noteOrAttachmentTitle"
|
|
16092
|
+
],
|
|
16093
|
+
"deleted_ticket_activity_logs": [
|
|
16094
|
+
"noteOrAttachmentTitle"
|
|
16095
|
+
],
|
|
16096
|
+
"deleted_ticket_logs": [
|
|
16097
|
+
"ticketTitle"
|
|
15735
16098
|
]
|
|
15736
16099
|
};
|
|
15737
16100
|
|
|
@@ -16168,6 +16531,74 @@ function credentialShapeExpectation(headers, auth) {
|
|
|
16168
16531
|
|
|
16169
16532
|
// src/http/envelope.ts
|
|
16170
16533
|
var INVALID_SHAPE_ACTION = "Report the unexpected response shape; verify baseUrl points at the REST API.";
|
|
16534
|
+
var AUDIT_READ_PATH = /^\/v1\.0\/(DeletedTaskActivityLogs|DeletedTicketActivityLogs|DeletedTicketLogs)\/(query\/(?:next|previous|count)|[^/?]+)\/?(?:\?.*)?$/i;
|
|
16535
|
+
function isAuditLogResource(resource) {
|
|
16536
|
+
return /^(deleted_task_activity_logs|deleted_ticket_activity_logs|deleted_ticket_logs)$/.test(resource);
|
|
16537
|
+
}
|
|
16538
|
+
function isDeletedAuditRead(operation) {
|
|
16539
|
+
const [resource = "", verb, suffix] = operation?.split(".") ?? [];
|
|
16540
|
+
return suffix === void 0 && (verb === "get" || verb === "query") && isAuditLogResource(resource);
|
|
16541
|
+
}
|
|
16542
|
+
function auditReadTarget(path, operation) {
|
|
16543
|
+
const match = AUDIT_READ_PATH.exec(path);
|
|
16544
|
+
const target = match?.[2]?.toLowerCase();
|
|
16545
|
+
if (target === "query" || target === "query/next" || target === "query/previous") return "query";
|
|
16546
|
+
if (target === "entityinformation") return void 0;
|
|
16547
|
+
if (target === "query/count") return target;
|
|
16548
|
+
if (target !== void 0 && !isAuditDecimalId(target)) {
|
|
16549
|
+
throw new AutotaskConfigError("Audit log ID must be a non-negative signed 64-bit integer.", { operation });
|
|
16550
|
+
}
|
|
16551
|
+
return target;
|
|
16552
|
+
}
|
|
16553
|
+
function decodeResponseJson(text, auditTarget) {
|
|
16554
|
+
if (auditTarget === void 0) return JSON.parse(text);
|
|
16555
|
+
if (auditTarget === "query/count") {
|
|
16556
|
+
return JSON.parse(text, (key, value, context) => key === "queryCount" && typeof value === "number" && !isAuditDecimalId(context?.source ?? "") ? null : value);
|
|
16557
|
+
}
|
|
16558
|
+
const idTokens = /* @__PURE__ */ new WeakMap();
|
|
16559
|
+
const body = JSON.parse(text, function(key, value, context) {
|
|
16560
|
+
if (key === "id" && typeof value === "number" && context?.source !== void 0) {
|
|
16561
|
+
idTokens.set(this, context.source);
|
|
16562
|
+
}
|
|
16563
|
+
return value;
|
|
16564
|
+
});
|
|
16565
|
+
const rows = isRecord2(body) ? auditTarget === "query" ? body.items : [body.item] : void 0;
|
|
16566
|
+
if (Array.isArray(rows)) {
|
|
16567
|
+
for (const row of rows) {
|
|
16568
|
+
if (!isRecord2(row) || typeof row.id !== "number") continue;
|
|
16569
|
+
const token = idTokens.get(row);
|
|
16570
|
+
if (token === void 0 || !isAuditDecimalId(token)) row.id = null;
|
|
16571
|
+
else if (!Number.isSafeInteger(row.id)) row.id = token;
|
|
16572
|
+
}
|
|
16573
|
+
}
|
|
16574
|
+
return body;
|
|
16575
|
+
}
|
|
16576
|
+
function isAuditItem(item) {
|
|
16577
|
+
if (!isRecord2(item)) return false;
|
|
16578
|
+
const { id } = item;
|
|
16579
|
+
return typeof id === "number" ? Number.isSafeInteger(id) && id >= 0 : typeof id === "string" && isAuditDecimalId(id);
|
|
16580
|
+
}
|
|
16581
|
+
function isAuditPage(body) {
|
|
16582
|
+
if (!Array.isArray(body.items) || !isRecord2(body.pageDetails)) return false;
|
|
16583
|
+
const { nextPageUrl } = body.pageDetails;
|
|
16584
|
+
return (nextPageUrl === null || typeof nextPageUrl === "string" && nextPageUrl.trim() !== "") && body.items.every(isAuditItem);
|
|
16585
|
+
}
|
|
16586
|
+
function validateAuditResponse(body, target, operation) {
|
|
16587
|
+
if (target === void 0) return;
|
|
16588
|
+
if (target === "query/count") {
|
|
16589
|
+
unwrapQueryCount(body, operation);
|
|
16590
|
+
return;
|
|
16591
|
+
}
|
|
16592
|
+
const valid = isRecord2(body) && (target === "query" ? isAuditPage(body) : body.item === null || isAuditItem(body.item) && String(body.item.id) === target);
|
|
16593
|
+
if (!valid) {
|
|
16594
|
+
throw new AutotaskError("Expected a valid audit log response for the requested path.", {
|
|
16595
|
+
code: "INVALID_RESPONSE",
|
|
16596
|
+
category: "server",
|
|
16597
|
+
operation,
|
|
16598
|
+
suggestedAction: INVALID_SHAPE_ACTION
|
|
16599
|
+
});
|
|
16600
|
+
}
|
|
16601
|
+
}
|
|
16171
16602
|
function attachEmptyReasonDetails(err) {
|
|
16172
16603
|
if (err.operation === void 0) return;
|
|
16173
16604
|
const dot = err.operation.indexOf(".");
|
|
@@ -16193,7 +16624,7 @@ function attachEmptyReasonDetails(err) {
|
|
|
16193
16624
|
} : {
|
|
16194
16625
|
surface,
|
|
16195
16626
|
kind: "not-found",
|
|
16196
|
-
note: `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
|
|
16627
|
+
note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : `no ${resource} record exists at this id (a miss is the data, not an error condition)`,
|
|
16197
16628
|
authority: `${resource}.query`,
|
|
16198
16629
|
remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface \u2014 do not retry the same get`
|
|
16199
16630
|
};
|
|
@@ -16231,7 +16662,7 @@ function unwrapItem(body, id, operation, entity) {
|
|
|
16231
16662
|
resourceIds: id !== void 0 ? [id] : void 0,
|
|
16232
16663
|
...id !== void 0 && entity !== void 0 ? { details: { idRefs: [{ entity, id }] } } : {},
|
|
16233
16664
|
operation,
|
|
16234
|
-
suggestedAction: "Verify the id, or resolve the record by name first."
|
|
16665
|
+
suggestedAction: isDeletedAuditRead(operation) ? "Verify the log ID and check API-user access." : "Verify the id, or resolve the record by name first."
|
|
16235
16666
|
}
|
|
16236
16667
|
);
|
|
16237
16668
|
attachEmptyReasonDetails(err);
|
|
@@ -16240,8 +16671,9 @@ function unwrapItem(body, id, operation, entity) {
|
|
|
16240
16671
|
return item;
|
|
16241
16672
|
}
|
|
16242
16673
|
function unwrapQueryCount(body, operation) {
|
|
16243
|
-
|
|
16244
|
-
|
|
16674
|
+
const count = isRecord2(body) ? body.queryCount : void 0;
|
|
16675
|
+
if (typeof count !== "number" || !Number.isInteger(count) || count < 0 || count > 2147483647) {
|
|
16676
|
+
const err = new AutotaskError("Expected the count envelope { queryCount: non-negative int32 }", {
|
|
16245
16677
|
code: "INVALID_RESPONSE",
|
|
16246
16678
|
category: "server",
|
|
16247
16679
|
operation,
|
|
@@ -16250,7 +16682,7 @@ function unwrapQueryCount(body, operation) {
|
|
|
16250
16682
|
attachEmptyReasonDetails(err);
|
|
16251
16683
|
throw err;
|
|
16252
16684
|
}
|
|
16253
|
-
return
|
|
16685
|
+
return count;
|
|
16254
16686
|
}
|
|
16255
16687
|
function unwrapOperation(body, operation) {
|
|
16256
16688
|
const value = isRecord2(body) ? body.itemId !== void 0 ? body.itemId : body.id : void 0;
|
|
@@ -16604,8 +17036,7 @@ var HttpClient = class {
|
|
|
16604
17036
|
since,
|
|
16605
17037
|
retryAfterMs: s.maintenancePollMs,
|
|
16606
17038
|
httpStatus: status,
|
|
16607
|
-
contentType,
|
|
16608
|
-
bodySnippet: bodySnippet(text, this.redactPersonalData),
|
|
17039
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) },
|
|
16609
17040
|
maintenanceDetected: true
|
|
16610
17041
|
},
|
|
16611
17042
|
suggestedAction: unknownWrite ? `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).` : `The Autotask zone is in its maintenance window (since ${since}); retry after the window (windows usually last 30-90 min).`
|
|
@@ -16710,7 +17141,7 @@ var HttpClient = class {
|
|
|
16710
17141
|
return { retry: true };
|
|
16711
17142
|
}
|
|
16712
17143
|
throw new AutotaskNetworkError(
|
|
16713
|
-
`Network error during ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
|
|
17144
|
+
`Network error during ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
|
|
16714
17145
|
ctx
|
|
16715
17146
|
);
|
|
16716
17147
|
}
|
|
@@ -16731,7 +17162,7 @@ var HttpClient = class {
|
|
|
16731
17162
|
if (err instanceof AutotaskError) throw err;
|
|
16732
17163
|
if (s.signal.aborted || isAbortLike(err)) throw this.interrupted(s);
|
|
16733
17164
|
throw new AutotaskNetworkError(
|
|
16734
|
-
`Network error reading the response of ${method} ${opts.path}: ${err instanceof Error ? err.message : String(err)}`,
|
|
17165
|
+
`Network error reading the response of ${method} ${opts.path}: ${s.url.includes("?") ? "transport failure" : err instanceof Error ? err.message : String(err)}`,
|
|
16735
17166
|
ctx
|
|
16736
17167
|
);
|
|
16737
17168
|
}
|
|
@@ -16758,10 +17189,11 @@ var HttpClient = class {
|
|
|
16758
17189
|
}
|
|
16759
17190
|
let parsed;
|
|
16760
17191
|
try {
|
|
16761
|
-
parsed =
|
|
17192
|
+
parsed = decodeResponseJson(text, s.auditTarget);
|
|
16762
17193
|
} catch {
|
|
16763
17194
|
return this.handleNonJson2xx(s, res, status, text);
|
|
16764
17195
|
}
|
|
17196
|
+
validateAuditResponse(parsed, s.auditTarget, opts.operation);
|
|
16765
17197
|
return {
|
|
16766
17198
|
done: true,
|
|
16767
17199
|
value: opts.skipResponseRedaction ? parsed : redactResponseBody(parsed, { redactPersonalData: this.redactPersonalData }),
|
|
@@ -16778,13 +17210,12 @@ var HttpClient = class {
|
|
|
16778
17210
|
httpStatus: status,
|
|
16779
17211
|
details: {
|
|
16780
17212
|
httpStatus: status,
|
|
16781
|
-
contentType,
|
|
16782
|
-
bodySnippet: bodySnippet(text, this.redactPersonalData)
|
|
17213
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text, this.redactPersonalData) }
|
|
16783
17214
|
},
|
|
16784
17215
|
// The content-type is host-sourced (a host-supplied
|
|
16785
17216
|
// baseUrl can serve arbitrary HTML) — capped, never prose;
|
|
16786
17217
|
// the raw snippet rides details only.
|
|
16787
|
-
suggestedAction: retriable5xx ? `The zone answered with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the zone is likely in a maintenance window \u2014 retry after the window, or verify baseUrl points at the REST API.` : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect \u2014 verify the record before re-issuing (writes are never auto-retried).`
|
|
17218
|
+
suggestedAction: method === "GET" || retriable5xx ? `The zone answered with a non-JSON body (content-type: ${s.getQuery ? "non-JSON" : contentType.slice(0, 100)}); the zone is likely in a maintenance window \u2014 retry after the window, or verify baseUrl points at the REST API.` : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect \u2014 verify the record before re-issuing (writes are never auto-retried).`
|
|
16788
17219
|
}
|
|
16789
17220
|
) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
|
|
16790
17221
|
...ctx,
|
|
@@ -16830,7 +17261,7 @@ var HttpClient = class {
|
|
|
16830
17261
|
nonJsonBody = text;
|
|
16831
17262
|
}
|
|
16832
17263
|
}
|
|
16833
|
-
const nonJsonSnippet = nonJsonBody === void 0 ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
|
|
17264
|
+
const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
|
|
16834
17265
|
const nonJsonIsMaintenance = s.maintenancePage;
|
|
16835
17266
|
const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
|
|
16836
17267
|
if (nonJsonIsMaintenance) {
|
|
@@ -16854,9 +17285,12 @@ var HttpClient = class {
|
|
|
16854
17285
|
);
|
|
16855
17286
|
}
|
|
16856
17287
|
if (target !== void 0 && targetViolation === null && target !== this.baseUrl) {
|
|
17288
|
+
const retryUrl = buildUrl(target, s.wirePath);
|
|
17289
|
+
if (s.getQuery) assertGetQueryUrlLength(retryUrl);
|
|
16857
17290
|
s.zoneRetry = { from: this.baseUrl, to: target };
|
|
16858
17291
|
this.repointZoneBase(target);
|
|
16859
|
-
s.url =
|
|
17292
|
+
s.url = retryUrl;
|
|
17293
|
+
s.ctx.url = s.url.split("?", 1)[0];
|
|
16860
17294
|
return RETRY;
|
|
16861
17295
|
}
|
|
16862
17296
|
}
|
|
@@ -16864,10 +17298,11 @@ var HttpClient = class {
|
|
|
16864
17298
|
const err = errorFromStatus(
|
|
16865
17299
|
status,
|
|
16866
17300
|
body,
|
|
16867
|
-
s.url,
|
|
17301
|
+
s.ctx.url,
|
|
16868
17302
|
opts.operation,
|
|
16869
17303
|
this.redactPersonalData,
|
|
16870
|
-
credentialShapeExpectation(s.headers, this.auth)
|
|
17304
|
+
credentialShapeExpectation(s.headers, this.auth),
|
|
17305
|
+
!s.getQuery
|
|
16871
17306
|
);
|
|
16872
17307
|
err.correlationId = s.correlationId;
|
|
16873
17308
|
this.stampMaintenance(s, err);
|
|
@@ -16952,11 +17387,20 @@ var HttpClient = class {
|
|
|
16952
17387
|
async request(opts) {
|
|
16953
17388
|
const method = opts.method;
|
|
16954
17389
|
const url = buildUrl(this.baseUrl, opts.path, opts.query);
|
|
17390
|
+
const wirePath = url.slice(this.baseUrl.length);
|
|
17391
|
+
const path = wirePath.split("?", 1)[0];
|
|
17392
|
+
const route = decodeURIComponent(path);
|
|
17393
|
+
const auditTarget = auditReadTarget(route, opts.operation);
|
|
16955
17394
|
const headers = withAuthHeaders(opts.headers, this.auth);
|
|
16956
17395
|
assertCredentialShape(headers, this.auth);
|
|
16957
|
-
|
|
16958
|
-
|
|
17396
|
+
const requestUrl = new URL(url);
|
|
17397
|
+
const queryRoute = /\/query(?:\/|$)/i.test(route);
|
|
17398
|
+
const getQuery = method === "GET" && queryRoute && requestUrl.search !== "";
|
|
17399
|
+
if (getQuery) assertGetQueryUrlLength(url);
|
|
16959
17400
|
const bodyText = opts.body !== void 0 ? JSON.stringify(opts.body) : void 0;
|
|
17401
|
+
if (queryRoute) assertQueryFilters(opts, requestUrl, auditTarget === "query" || auditTarget === "query/count", bodyText);
|
|
17402
|
+
opts = { ...opts, path };
|
|
17403
|
+
if (bodyText !== void 0) headers["Content-Type"] = "application/json";
|
|
16960
17404
|
const correlationId = newCorrelationId();
|
|
16961
17405
|
const timeoutMs = opts.timeoutMs ?? this.timeoutMs;
|
|
16962
17406
|
const started = Date.now();
|
|
@@ -16964,7 +17408,10 @@ var HttpClient = class {
|
|
|
16964
17408
|
const deadline = new AbortController();
|
|
16965
17409
|
const s = {
|
|
16966
17410
|
opts,
|
|
17411
|
+
wirePath,
|
|
17412
|
+
getQuery,
|
|
16967
17413
|
method,
|
|
17414
|
+
auditTarget,
|
|
16968
17415
|
url,
|
|
16969
17416
|
headers,
|
|
16970
17417
|
bodyText,
|
|
@@ -17005,7 +17452,7 @@ var HttpClient = class {
|
|
|
17005
17452
|
// undefined (the vendor's 204 / empty delete answer; the delete callers
|
|
17006
17453
|
// synthesize the result from the path id).
|
|
17007
17454
|
expectBody: opts.expectBody ?? method !== "DELETE",
|
|
17008
|
-
ctx: { operation: opts.operation, url, correlationId },
|
|
17455
|
+
ctx: { operation: opts.operation, url: url.split("?", 1)[0], correlationId },
|
|
17009
17456
|
lastStatus: void 0,
|
|
17010
17457
|
zoneRetry: void 0,
|
|
17011
17458
|
attempt: 0,
|
|
@@ -17057,19 +17504,30 @@ function isMaintenancePage(status, contentType, text) {
|
|
|
17057
17504
|
return true;
|
|
17058
17505
|
}
|
|
17059
17506
|
}
|
|
17060
|
-
function
|
|
17061
|
-
const operation = opts.operation ?? opts.path;
|
|
17062
|
-
const
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17507
|
+
function assertQueryFilters(opts, url, auditIds, bodyText) {
|
|
17508
|
+
const operation = opts.operation ?? opts.path.split("?", 1)[0];
|
|
17509
|
+
const validate7 = (value) => {
|
|
17510
|
+
if (value === null || typeof value !== "object") return;
|
|
17511
|
+
for (const [key, filter] of Object.entries(value)) {
|
|
17512
|
+
if (key.toLowerCase() === "filter") assertQueryFilterForWire(filter, operation, auditIds);
|
|
17513
|
+
}
|
|
17514
|
+
};
|
|
17515
|
+
const parse = (json) => auditIds ? JSON.parse(
|
|
17516
|
+
json,
|
|
17517
|
+
(_key, value, context) => typeof value === "number" && context?.source !== void 0 && !isAuditDecimalId(context.source) ? null : value
|
|
17518
|
+
) : JSON.parse(json);
|
|
17519
|
+
validate7(auditIds && bodyText !== void 0 ? parse(bodyText) : opts.body);
|
|
17520
|
+
for (const [key, search] of url.searchParams) {
|
|
17521
|
+
if (key.toLowerCase() !== "search") continue;
|
|
17522
|
+
let parsed;
|
|
17523
|
+
try {
|
|
17524
|
+
parsed = parse(search);
|
|
17525
|
+
} catch {
|
|
17526
|
+
if (auditIds) throw new AutotaskConfigError("Expected a JSON search object for the audit query.", { operation });
|
|
17527
|
+
continue;
|
|
17528
|
+
}
|
|
17529
|
+
validate7(parsed);
|
|
17071
17530
|
}
|
|
17072
|
-
if (parsed !== null && typeof parsed === "object") assertNoRelationLeaf(parsed.filter, operation);
|
|
17073
17531
|
}
|
|
17074
17532
|
|
|
17075
17533
|
// src/pagination.ts
|
|
@@ -17089,7 +17547,7 @@ async function* paginate(fetchPage, opts = {}) {
|
|
|
17089
17547
|
}
|
|
17090
17548
|
const p = await fetchPage(page, pageSize);
|
|
17091
17549
|
yield p;
|
|
17092
|
-
if (!p.hasMore || p.items.length === 0) return;
|
|
17550
|
+
if (!p.hasMore || p.items.length === 0 && !opts.continueOnEmpty) return;
|
|
17093
17551
|
page += 1;
|
|
17094
17552
|
}
|
|
17095
17553
|
}
|
|
@@ -18775,10 +19233,14 @@ var MODEL_FIELD_SETS = {
|
|
|
18775
19233
|
"contracts": ["id", "billingPreference", "billToCompanyContactID", "billToCompanyID", "companyID", "contactID", "contactName", "contractCategory", "contractExclusionSetID", "contractName", "contractNumber", "contractPeriodType", "contractType", "description", "endDate", "estimatedCost", "estimatedHours", "estimatedRevenue", "exclusionContractID", "internalCurrencyOverageBillingRate", "internalCurrencySetupFee", "isCompliant", "isDefaultContract", "lastModifiedDateTime", "opportunityID", "organizationalLevelAssociationID", "overageBillingRate", "purchaseOrderNumber", "renewedContractID", "serviceLevelAgreementID", "setupFee", "setupFeeBillingCodeID", "startDate", "status", "timeReportingRequiresStartAndStopTimes", "userDefinedFields"],
|
|
18776
19234
|
"countries": ["id", "addressFormatID", "countryCode", "displayName", "invoiceTemplateID", "isActive", "isDefaultCountry", "name", "purchaseOrderTemplateID", "quoteTemplateID"],
|
|
18777
19235
|
"currencies": ["id", "currencyNegativeFormat", "currencyPositiveFormat", "description", "displaySymbol", "exchangeRate", "isActive", "isInternalCurrency", "lastModifiedDateTime", "name", "updateResourceId"],
|
|
19236
|
+
"deleted_task_activity_logs": ["id", "typeID", "taskID", "taskNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
|
|
19237
|
+
"deleted_ticket_activity_logs": ["id", "typeID", "ticketID", "ticketNumber", "noteOrAttachmentTitle", "createdByResourceID", "activityDateTime", "startDateTime", "endDateTime", "hoursWorked", "deletedByResourceID", "deletedDateTime"],
|
|
19238
|
+
"deleted_ticket_logs": ["id", "ticketID", "ticketNumber", "ticketTitle", "deletedByResourceID", "deletedDateTime"],
|
|
18778
19239
|
"departments": ["id", "description", "name", "number", "primaryLocationID"],
|
|
18779
19240
|
"domain_registrars": ["id", "name", "url"],
|
|
18780
19241
|
"expense_item_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18781
19242
|
"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"],
|
|
19243
|
+
"expense_report_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "expenseItemID", "expenseReportID", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18782
19244
|
"expense_reports": ["id", "amountDue", "approvedDate", "approverID", "departmentNumber", "internalCurrencyCashAdvanceAmount", "internalCurrencyExpenseTotal", "name", "organizationalLevelAssociationID", "quickBooksReferenceNumber", "reimbursementCurrencyAmountDue", "reimbursementCurrencyCashAdvanceAmount", "reimbursementCurrencyID", "rejectionReason", "status", "submit", "submitDate", "submitterID", "weekEnding"],
|
|
18783
19245
|
"holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
|
|
18784
19246
|
"holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
|
|
@@ -18808,6 +19270,7 @@ var MODEL_FIELD_SETS = {
|
|
|
18808
19270
|
"quote_locations": ["id", "address1", "address2", "city", "postalCode", "state"],
|
|
18809
19271
|
"quote_templates": ["id", "calculateTaxSeparately", "createDate", "createdBy", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "description", "displayTaxCategorySuperscripts", "isActive", "lastActivityBy", "lastActivityDate", "name", "numberFormat", "pageLayout", "pageNumberFormat", "showEachTaxInGroup", "showGridHeader", "showTaxCategory", "showVerticalGridLines"],
|
|
18810
19272
|
"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"],
|
|
19273
|
+
"resource_attachments": ["id", "attachDate", "attachedByContactID", "attachedByResourceID", "attachmentType", "contentType", "creatorType", "fileSize", "fullPath", "impersonatorCreatorResourceID", "opportunityID", "parentID", "publish", "resourceID", "title", "data", "parentType", "soapParentPropertyId", "isTaskAttachment"],
|
|
18811
19274
|
"resource_role_queues": ["id", "queueID", "resourceID", "soapParentPropertyId"],
|
|
18812
19275
|
"resource_roles": ["id", "departmentID", "isActive", "queueID", "resourceID", "roleID", "soapParentPropertyId"],
|
|
18813
19276
|
"resource_skills": ["id", "resourceID", "skillDescription", "skillID", "skillLevel", "soapParentPropertyId"],
|
|
@@ -18888,8 +19351,12 @@ var MODEL_DATE_FIELDS = {
|
|
|
18888
19351
|
"contract_ticket_purchases": ["datePurchased", "endDate", "startDate"],
|
|
18889
19352
|
"contracts": ["endDate", "lastModifiedDateTime", "startDate"],
|
|
18890
19353
|
"currencies": ["lastModifiedDateTime"],
|
|
19354
|
+
"deleted_task_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
|
|
19355
|
+
"deleted_ticket_activity_logs": ["activityDateTime", "startDateTime", "endDateTime", "deletedDateTime"],
|
|
19356
|
+
"deleted_ticket_logs": ["deletedDateTime"],
|
|
18891
19357
|
"expense_item_attachments": ["attachDate"],
|
|
18892
19358
|
"expense_items": ["expenseDate"],
|
|
19359
|
+
"expense_report_attachments": ["attachDate"],
|
|
18893
19360
|
"expense_reports": ["approvedDate", "submitDate", "weekEnding"],
|
|
18894
19361
|
"holidays": ["holidayDate"],
|
|
18895
19362
|
"inventory_products": ["createDateTime"],
|
|
@@ -18909,6 +19376,7 @@ var MODEL_DATE_FIELDS = {
|
|
|
18909
19376
|
"purchase_orders": ["cancelDateTime", "createDateTime", "latestEstimatedArrivalDate", "shippingDate", "submitDateTime"],
|
|
18910
19377
|
"quote_templates": ["createDate", "lastActivityDate"],
|
|
18911
19378
|
"quotes": ["approvalStatusChangedDate", "createDate", "effectiveDate", "expirationDate", "extApprovalResponseDate", "lastActivityDate", "lastPublishedDateTime"],
|
|
19379
|
+
"resource_attachments": ["attachDate"],
|
|
18912
19380
|
"resources": ["hireDate"],
|
|
18913
19381
|
"sales_order_attachments": ["attachDate"],
|
|
18914
19382
|
"sales_orders": ["promisedFulfillmentDate", "salesOrderDate"],
|
|
@@ -19285,14 +19753,20 @@ var QueryBase = class {
|
|
|
19285
19753
|
// ------------------------------------------------------------------
|
|
19286
19754
|
// Query walk (wired to the G3 walker; cursor-follow per the pinned wire)
|
|
19287
19755
|
// ------------------------------------------------------------------
|
|
19288
|
-
/**
|
|
19756
|
+
/** Follow the vendor cursor with the initial query method and, for POST, the same QueryModel (issue #118). */
|
|
19289
19757
|
async fetchPage(params, page, pageSize, state2) {
|
|
19290
|
-
if (params.includeFields !== void 0) {
|
|
19758
|
+
if (state2.initialRequest === void 0 && params.includeFields !== void 0) {
|
|
19291
19759
|
params = { ...params, includeFields: params.includeFields.map((field) => normalizeOwnField(this.config.key, field)) };
|
|
19292
19760
|
}
|
|
19293
19761
|
const operation = `${this.config.key}.query`;
|
|
19294
19762
|
if (page === 1) {
|
|
19763
|
+
const filter = normalizedConditions(params.filter);
|
|
19764
|
+
if (filter !== void 0 && isAuditLogResource(this.config.key)) {
|
|
19765
|
+
assertQueryFilterForWire(normalizeInValues(filter), operation, true);
|
|
19766
|
+
}
|
|
19295
19767
|
const req = buildQueryRequest(this.http.baseUrl, this.resourcePath, { ...params, maxRecords: pageSize });
|
|
19768
|
+
if (req.body !== void 0) req.body = JSON.parse(JSON.stringify(req.body));
|
|
19769
|
+
state2.initialRequest = req;
|
|
19296
19770
|
const body2 = await this.http.request({ ...req, operation });
|
|
19297
19771
|
return this.readPage(body2, page, pageSize, state2);
|
|
19298
19772
|
}
|
|
@@ -19304,10 +19778,25 @@ var QueryBase = class {
|
|
|
19304
19778
|
operation
|
|
19305
19779
|
});
|
|
19306
19780
|
}
|
|
19307
|
-
const
|
|
19781
|
+
const cursorResource = isAuditLogResource(this.config.key) ? this.resourcePath : void 0;
|
|
19782
|
+
if (state2.initialRequest?.method === "GET") {
|
|
19783
|
+
const path = cursorToPath(this.http.baseUrl, cursor, cursorResource);
|
|
19784
|
+
const separator = path.indexOf("?");
|
|
19785
|
+
const route = separator < 0 ? path : path.slice(0, separator);
|
|
19786
|
+
const cursorParams = new URLSearchParams(separator < 0 ? "" : path.slice(separator + 1));
|
|
19787
|
+
const search = state2.initialRequest.query?.search;
|
|
19788
|
+
for (const key of [...cursorParams.keys()]) {
|
|
19789
|
+
if (key.toLowerCase() === "search") cursorParams.delete(key);
|
|
19790
|
+
}
|
|
19791
|
+
if (typeof search === "string") cursorParams.set("search", search);
|
|
19792
|
+
const req = buildQueryGetRequest(this.http.baseUrl, route + "?" + cursorParams.toString());
|
|
19793
|
+
const body2 = await this.http.request({ ...req, operation });
|
|
19794
|
+
return this.readPage(body2, page, pageSize, state2);
|
|
19795
|
+
}
|
|
19796
|
+
const body = state2.initialRequest?.body ?? buildQueryBody({ ...params, maxRecords: pageSize });
|
|
19308
19797
|
const res = await this.http.request({
|
|
19309
19798
|
method: "POST",
|
|
19310
|
-
path: cursorToPath(this.http.baseUrl, cursor),
|
|
19799
|
+
path: cursorToPath(this.http.baseUrl, cursor, cursorResource),
|
|
19311
19800
|
body,
|
|
19312
19801
|
operation,
|
|
19313
19802
|
idempotent: true
|
|
@@ -19366,10 +19855,10 @@ var QueryBase = class {
|
|
|
19366
19855
|
const walk = await this.relationWalkParams(rest, `${this.config.key}.query`);
|
|
19367
19856
|
if (walk === void 0) return;
|
|
19368
19857
|
if (!label || client === void 0) {
|
|
19369
|
-
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19858
|
+
yield* paginateItems(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19370
19859
|
return;
|
|
19371
19860
|
}
|
|
19372
|
-
for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) })) {
|
|
19861
|
+
for await (const page of paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) })) {
|
|
19373
19862
|
const labelled = await labelRows(client, this.config.key, page.items);
|
|
19374
19863
|
yield* labelled.rows;
|
|
19375
19864
|
}
|
|
@@ -19378,13 +19867,13 @@ var QueryBase = class {
|
|
|
19378
19867
|
async *queryPageIter(params) {
|
|
19379
19868
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19380
19869
|
if (walk === void 0) return;
|
|
19381
|
-
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk) });
|
|
19870
|
+
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key) });
|
|
19382
19871
|
}
|
|
19383
19872
|
/** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded; relation filters resolve first, #281). */
|
|
19384
19873
|
async queryAllItems(params) {
|
|
19385
19874
|
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
19386
19875
|
if (walk === void 0) return [];
|
|
19387
|
-
return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), maxRecords: walk.maxTotalRecords });
|
|
19876
|
+
return collectAll(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: isAuditLogResource(this.config.key), maxRecords: walk.maxTotalRecords });
|
|
19388
19877
|
}
|
|
19389
19878
|
/**
|
|
19390
19879
|
* `queryBounded` — server-side pagination (the MCP query surface): ONE call
|
|
@@ -19395,12 +19884,10 @@ var QueryBase = class {
|
|
|
19395
19884
|
* AutotaskConfigError; it is NOT a page size). The page-1 request uses
|
|
19396
19885
|
* the internal page size min(500, limit) (the `latest` mechanism sizes
|
|
19397
19886
|
* its walk from the matching count). Explicit `walk.maxRows` replaces
|
|
19398
|
-
* the total cap; `limit` then only sizes pages.
|
|
19399
|
-
*
|
|
19400
|
-
*
|
|
19401
|
-
*
|
|
19402
|
-
* page size), so the walk reuses `fetchPage` (the shared cursor machinery)
|
|
19403
|
-
* with a per-walk closure state (walks never share state).
|
|
19887
|
+
* the total cap; `limit` then only sizes pages. Continuations follow the
|
|
19888
|
+
* cursor with the initial method. POST keeps the same QueryModel body
|
|
19889
|
+
* across pages (issue #118). GET combines the cursor with the original search.
|
|
19890
|
+
* Each walk keeps its own request and cursor state.
|
|
19404
19891
|
* - The 1000-page guard still applies as a SOFT stop: a walk that would
|
|
19405
19892
|
* fetch a 1001st page stops with `hasMore: true` (never a throw — this
|
|
19406
19893
|
* is a bounded read, not the `paginate` generator's error path).
|
|
@@ -19562,7 +20049,7 @@ var QueryBase = class {
|
|
|
19562
20049
|
if (consume === void 0) items.push(...take);
|
|
19563
20050
|
else await consume(take, pages2);
|
|
19564
20051
|
if (fetched >= limit) break;
|
|
19565
|
-
if (!page.hasMore || page.items.length === 0) break;
|
|
20052
|
+
if (!page.hasMore || page.items.length === 0 && !isAuditLogResource(this.config.key)) break;
|
|
19566
20053
|
}
|
|
19567
20054
|
const names = nameNotes.size === 0 ? void 0 : {
|
|
19568
20055
|
note: [...nameNotes].join("; "),
|
|
@@ -19709,13 +20196,17 @@ var QueryBase = class {
|
|
|
19709
20196
|
};
|
|
19710
20197
|
let lo = 0n;
|
|
19711
20198
|
let hi;
|
|
19712
|
-
|
|
19713
|
-
|
|
19714
|
-
|
|
19715
|
-
|
|
19716
|
-
|
|
20199
|
+
if (isAuditLogResource(this.config.key)) {
|
|
20200
|
+
hi = BigInt(MAX_AUDIT_ID);
|
|
20201
|
+
} else {
|
|
20202
|
+
for (let t = 1n; ; t = t << 1n) {
|
|
20203
|
+
spend();
|
|
20204
|
+
if (await this.countAboveId(baseConds, t) <= latest) {
|
|
20205
|
+
hi = t;
|
|
20206
|
+
break;
|
|
20207
|
+
}
|
|
20208
|
+
lo = t;
|
|
19717
20209
|
}
|
|
19718
|
-
lo = t;
|
|
19719
20210
|
}
|
|
19720
20211
|
while (hi - lo > 1n) {
|
|
19721
20212
|
const mid = lo + hi >> 1n;
|
|
@@ -21282,6 +21773,8 @@ var SCOPED_ATTACHMENT_PARENTS = {
|
|
|
21282
21773
|
project_note_attachments: { field: "projectNoteID", name: "project note" },
|
|
21283
21774
|
contract_note_attachments: { field: "contractNoteID", name: "contract note" },
|
|
21284
21775
|
sales_order_attachments: { field: "salesOrderID", name: "sales order" },
|
|
21776
|
+
expense_report_attachments: { field: "expenseReportID", name: "expense report" },
|
|
21777
|
+
resource_attachments: { field: "resourceID", name: "resource" },
|
|
21285
21778
|
task_attachments: { field: "taskID", name: "task" },
|
|
21286
21779
|
task_note_attachments: { field: "taskNoteID", name: "task note" },
|
|
21287
21780
|
configuration_item_attachments: { field: "configurationItemID", name: "configuration item" },
|
|
@@ -21332,6 +21825,8 @@ function admitFileAttachment(resource, data, parentId) {
|
|
|
21332
21825
|
project_attachments: void 0,
|
|
21333
21826
|
contract_note_attachments: void 0,
|
|
21334
21827
|
sales_order_attachments: void 0,
|
|
21828
|
+
expense_report_attachments: void 0,
|
|
21829
|
+
resource_attachments: void 0,
|
|
21335
21830
|
task_note_attachments: "attachedByContactID",
|
|
21336
21831
|
project_note_attachments: "attachedByContactID",
|
|
21337
21832
|
configuration_item_attachments: "parentAttachmentID",
|
|
@@ -22068,6 +22563,36 @@ var SIMPLE_RESOURCES = [
|
|
|
22068
22563
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22069
22564
|
opForms: { get: "global", update: "global" }
|
|
22070
22565
|
},
|
|
22566
|
+
{
|
|
22567
|
+
key: "deleted_task_activity_logs",
|
|
22568
|
+
accessor: "deletedTaskActivityLogs",
|
|
22569
|
+
resourcePath: "/V1.0/DeletedTaskActivityLogs",
|
|
22570
|
+
deletable: false,
|
|
22571
|
+
udfCapable: false,
|
|
22572
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22573
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22574
|
+
opForms: { get: "global" }
|
|
22575
|
+
},
|
|
22576
|
+
{
|
|
22577
|
+
key: "deleted_ticket_activity_logs",
|
|
22578
|
+
accessor: "deletedTicketActivityLogs",
|
|
22579
|
+
resourcePath: "/V1.0/DeletedTicketActivityLogs",
|
|
22580
|
+
deletable: false,
|
|
22581
|
+
udfCapable: false,
|
|
22582
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22583
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22584
|
+
opForms: { get: "global" }
|
|
22585
|
+
},
|
|
22586
|
+
{
|
|
22587
|
+
key: "deleted_ticket_logs",
|
|
22588
|
+
accessor: "deletedTicketLogs",
|
|
22589
|
+
resourcePath: "/V1.0/DeletedTicketLogs",
|
|
22590
|
+
deletable: false,
|
|
22591
|
+
udfCapable: false,
|
|
22592
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
22593
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22594
|
+
opForms: { get: "global" }
|
|
22595
|
+
},
|
|
22071
22596
|
{
|
|
22072
22597
|
key: "departments",
|
|
22073
22598
|
accessor: "departments",
|
|
@@ -22119,6 +22644,20 @@ var SIMPLE_RESOURCES = [
|
|
|
22119
22644
|
helpers: { search: false, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22120
22645
|
opForms: { get: "global", create: "scoped", update: "scoped" }
|
|
22121
22646
|
},
|
|
22647
|
+
{
|
|
22648
|
+
key: "expense_report_attachments",
|
|
22649
|
+
accessor: "expenseReportAttachments",
|
|
22650
|
+
resourcePath: "/V1.0/ExpenseReportAttachments",
|
|
22651
|
+
parentScopedPath: "/V1.0/ExpenseReports/{parentId}/Attachments",
|
|
22652
|
+
parentPath: "/V1.0/ExpenseReports",
|
|
22653
|
+
parentField: "expenseReportID",
|
|
22654
|
+
deletable: true,
|
|
22655
|
+
udfCapable: false,
|
|
22656
|
+
attachmentGet: true,
|
|
22657
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
|
|
22658
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22659
|
+
opForms: { get: "scoped", create: "scoped", delete: "scoped" }
|
|
22660
|
+
},
|
|
22122
22661
|
{
|
|
22123
22662
|
key: "expense_reports",
|
|
22124
22663
|
accessor: "expenseReports",
|
|
@@ -22440,6 +22979,20 @@ var SIMPLE_RESOURCES = [
|
|
|
22440
22979
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22441
22980
|
opForms: { get: "global" }
|
|
22442
22981
|
},
|
|
22982
|
+
{
|
|
22983
|
+
key: "resource_attachments",
|
|
22984
|
+
accessor: "resourceAttachments",
|
|
22985
|
+
resourcePath: "/V1.0/ResourceAttachments",
|
|
22986
|
+
parentScopedPath: "/V1.0/Resources/{parentId}/Attachments",
|
|
22987
|
+
parentPath: "/V1.0/Resources",
|
|
22988
|
+
parentField: "resourceID",
|
|
22989
|
+
deletable: true,
|
|
22990
|
+
udfCapable: false,
|
|
22991
|
+
attachmentGet: true,
|
|
22992
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: false, delete: true, getEntityInfo: true, getFieldInfo: true, getUdfInfo: false, download: false },
|
|
22993
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
22994
|
+
opForms: { get: "scoped", create: "scoped", delete: "scoped" }
|
|
22995
|
+
},
|
|
22443
22996
|
{
|
|
22444
22997
|
key: "resource_role_queues",
|
|
22445
22998
|
accessor: "resourceRoleQueues",
|
|
@@ -23008,7 +23561,7 @@ var SIMPLE_RESOURCES = [
|
|
|
23008
23561
|
var GenericResource = class extends BaseResource {
|
|
23009
23562
|
constructor(http, config, pageSize) {
|
|
23010
23563
|
super(http, config, pageSize);
|
|
23011
|
-
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 () => {
|
|
23564
|
+
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 () => {
|
|
23012
23565
|
throw new OperationNotSupportedError(config.key, "getUdfInfo");
|
|
23013
23566
|
};
|
|
23014
23567
|
if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors"].includes(config.key)) this.createIfNotExists = async () => {
|
|
@@ -23049,7 +23602,7 @@ var GenericResource = class extends BaseResource {
|
|
|
23049
23602
|
}
|
|
23050
23603
|
async fetchPage(params, page, pageSize, state2) {
|
|
23051
23604
|
const key = this.config.key;
|
|
23052
|
-
if (isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23605
|
+
if (state2.initialRequest === void 0 && isScopedAttachmentResource(key)) admitScopedAttachmentQuery(key, params);
|
|
23053
23606
|
return super.fetchPage(params, page, pageSize, state2);
|
|
23054
23607
|
}
|
|
23055
23608
|
async countGlobal(params) {
|
|
@@ -25055,6 +25608,9 @@ async function validateAggregate(operation, filter, opts) {
|
|
|
25055
25608
|
const known = await checkFieldNames(resourceKey, conditions, opts, problems);
|
|
25056
25609
|
const groupBy = parseGroupBy(opts, oracles, known, problems);
|
|
25057
25610
|
const sum = checkSumFields("sum", opts.sum, problems);
|
|
25611
|
+
if (resourceKey !== void 0 && isAuditLogResource(resourceKey) && sum.some((field) => field.toLowerCase() === "id")) {
|
|
25612
|
+
problems.push("sum: audit log IDs are exact identifiers. Use groupBy for IDs or count for record totals.");
|
|
25613
|
+
}
|
|
25058
25614
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
25059
25615
|
if (problems.length > 0) {
|
|
25060
25616
|
throw new AutotaskConfigError(
|
|
@@ -25365,7 +25921,10 @@ function validateFetchManyItems(items, cap, opName = "fetchByIds", capRef = `FET
|
|
|
25365
25921
|
continue;
|
|
25366
25922
|
}
|
|
25367
25923
|
try {
|
|
25368
|
-
parseIdentifier(item.id, `${at}.id`);
|
|
25924
|
+
const id = parseIdentifier(item.id, `${at}.id`);
|
|
25925
|
+
if (isAuditLogResource(resourceKey) && !isAuditDecimalId(String(id))) {
|
|
25926
|
+
problems.push(`${at}.id: audit log ID must be a non-negative signed 64-bit integer`);
|
|
25927
|
+
}
|
|
25369
25928
|
} catch {
|
|
25370
25929
|
if (typeof item.id === "string") {
|
|
25371
25930
|
problems.push(
|