node-autotask 0.90.0 → 0.92.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 +8 -0
- package/MCP_TOOL_CATALOG.json +360 -9
- package/README.md +1 -1
- package/capabilities.json +2022 -655
- package/dist/capabilities-data.js +2021 -654
- package/dist/capabilities.cjs +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-K5X4BPQC.js → chunk-2MC3LDZU.js} +3 -3
- package/dist/{chunk-4CI27SCM.cjs → chunk-ATDGRAX2.cjs} +33 -30
- package/dist/{chunk-HU6OGAPI.js → chunk-ELAU2MT5.js} +5 -2
- package/dist/{chunk-OI6E5XQA.cjs → chunk-H24SV774.cjs} +473 -122
- package/dist/{chunk-D7MJC7HA.cjs → chunk-JPZ7M7QI.cjs} +200 -200
- package/dist/{chunk-CY6USWUY.js → chunk-NQNAEA23.js} +468 -117
- package/dist/{chunk-ZLMYYO7R.cjs → chunk-QXJQIZCT.cjs} +3 -3
- package/dist/{chunk-Q73VQSUP.js → chunk-XAOWO42G.js} +2 -2
- package/dist/{index-4jmitXBs.d.cts → index-B9y5IwT1.d.cts} +115 -1
- package/dist/{index-4jmitXBs.d.ts → index-B9y5IwT1.d.ts} +115 -1
- package/dist/{index-DWyJAad_.d.ts → index-U7Lepdm2.d.ts} +10 -5
- package/dist/{index-BEqbDuMk.d.cts → index-lWek2NrV.d.cts} +10 -5
- package/dist/index.cjs +85 -85
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/operations/index.cjs +51 -51
- package/dist/operations/index.d.cts +6 -4
- package/dist/operations/index.d.ts +6 -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 +5 -2
- package/examples/mcp/manifest.ts +1 -1
- package/examples/mcp/tools-mode.ts +15 -6
- package/examples/mcp/tools-read.ts +8 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQXJQIZCT_cjs = require('./chunk-QXJQIZCT.cjs');
|
|
4
4
|
var chunkCM5O672I_cjs = require('./chunk-CM5O672I.cjs');
|
|
5
5
|
var crypto = require('crypto');
|
|
6
6
|
var async_hooks = require('async_hooks');
|
|
@@ -253,6 +253,7 @@ var SECRET_RESPONSE_FIELDS = [
|
|
|
253
253
|
// IntegrationVendorInsightModel, IntegrationVendorWidgetModel
|
|
254
254
|
];
|
|
255
255
|
var PERSONAL_RESPONSE_FIELDS = [
|
|
256
|
+
"additionalAddressInfo",
|
|
256
257
|
"additionalAddressInformation",
|
|
257
258
|
"additionalBillToAddressInformation",
|
|
258
259
|
"additionalShipToAddressInformation",
|
|
@@ -1587,6 +1588,11 @@ function countUdfConditions(conditions) {
|
|
|
1587
1588
|
}
|
|
1588
1589
|
return n;
|
|
1589
1590
|
}
|
|
1591
|
+
function assertSupportedUdfConditions(conditions, operation) {
|
|
1592
|
+
if (operation.startsWith("inventory_items.") && conditions !== void 0 && countUdfConditions(conditions) > 0) {
|
|
1593
|
+
throw new AutotaskConfigError("InventoryItems has no record UDFs. Filter on its documented fields.", { operation });
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1590
1596
|
function serializeFilter(filter) {
|
|
1591
1597
|
return JSON.stringify(filter);
|
|
1592
1598
|
}
|
|
@@ -10966,6 +10972,65 @@ var RELATIONSHIP_MAP = {
|
|
|
10966
10972
|
"deleteBoundary": null,
|
|
10967
10973
|
"markerField": null
|
|
10968
10974
|
},
|
|
10975
|
+
"inventory_items": {
|
|
10976
|
+
"resource": "inventory_items",
|
|
10977
|
+
"apiEntity": "InventoryItem",
|
|
10978
|
+
"kind": "entity",
|
|
10979
|
+
"path": "InventoryItems",
|
|
10980
|
+
"parentScoped": false,
|
|
10981
|
+
"tier": "extended",
|
|
10982
|
+
"workflowResource": false,
|
|
10983
|
+
"group": "A",
|
|
10984
|
+
"parent": null,
|
|
10985
|
+
"children": [],
|
|
10986
|
+
"naturalKeys": {
|
|
10987
|
+
"hasSearch": false,
|
|
10988
|
+
"searchCovers": null,
|
|
10989
|
+
"findBy": []
|
|
10990
|
+
},
|
|
10991
|
+
"blindSurfaces": null,
|
|
10992
|
+
"zoneFacts": {
|
|
10993
|
+
"createRequiredSet": [
|
|
10994
|
+
"inventoryLocationID",
|
|
10995
|
+
"productID",
|
|
10996
|
+
"quantityMinimum",
|
|
10997
|
+
"quantityMaximum",
|
|
10998
|
+
"quantityOnHand"
|
|
10999
|
+
],
|
|
11000
|
+
"createGuidance": {
|
|
11001
|
+
"createOp": "inventory_items.create",
|
|
11002
|
+
"parentScoped": false,
|
|
11003
|
+
"liveProvenPrefix": [],
|
|
11004
|
+
"unproven": true,
|
|
11005
|
+
"blocker": {
|
|
11006
|
+
"kind": "unknown",
|
|
11007
|
+
"message": "Inventory access, an active location, a visible product and a unique product-location pair are required.",
|
|
11008
|
+
"remedy": "Read product and location metadata, supply the required quantities and preview before apply.",
|
|
11009
|
+
"requires": {
|
|
11010
|
+
"allOf": [
|
|
11011
|
+
"inventoryLocationID",
|
|
11012
|
+
"productID",
|
|
11013
|
+
"quantityMinimum",
|
|
11014
|
+
"quantityMaximum",
|
|
11015
|
+
"quantityOnHand"
|
|
11016
|
+
]
|
|
11017
|
+
}
|
|
11018
|
+
},
|
|
11019
|
+
"vendorEvidence": [
|
|
11020
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryItemsEntity.htm"
|
|
11021
|
+
],
|
|
11022
|
+
"deleteBoundary": {
|
|
11023
|
+
"available": false,
|
|
11024
|
+
"note": "The specification defines no public DELETE for InventoryItems."
|
|
11025
|
+
}
|
|
11026
|
+
}
|
|
11027
|
+
},
|
|
11028
|
+
"deleteBoundary": {
|
|
11029
|
+
"note": "The specification defines no public DELETE for InventoryItems. A created item cannot be removed through that API.",
|
|
11030
|
+
"proof": "spec-derived"
|
|
11031
|
+
},
|
|
11032
|
+
"markerField": null
|
|
11033
|
+
},
|
|
10969
11034
|
"inventory_locations": {
|
|
10970
11035
|
"resource": "inventory_locations",
|
|
10971
11036
|
"apiEntity": "InventoryLocation",
|
|
@@ -11018,6 +11083,48 @@ var RELATIONSHIP_MAP = {
|
|
|
11018
11083
|
"proof": "spec-derived"
|
|
11019
11084
|
},
|
|
11020
11085
|
"markerField": null
|
|
11086
|
+
},
|
|
11087
|
+
"internal_locations": {
|
|
11088
|
+
"resource": "internal_locations",
|
|
11089
|
+
"apiEntity": "InternalLocation",
|
|
11090
|
+
"kind": "entity",
|
|
11091
|
+
"path": "InternalLocations",
|
|
11092
|
+
"parentScoped": false,
|
|
11093
|
+
"tier": "extended",
|
|
11094
|
+
"workflowResource": false,
|
|
11095
|
+
"group": "B",
|
|
11096
|
+
"parent": null,
|
|
11097
|
+
"children": [],
|
|
11098
|
+
"naturalKeys": {
|
|
11099
|
+
"hasSearch": false,
|
|
11100
|
+
"searchCovers": null,
|
|
11101
|
+
"findBy": []
|
|
11102
|
+
},
|
|
11103
|
+
"blindSurfaces": null,
|
|
11104
|
+
"zoneFacts": null,
|
|
11105
|
+
"deleteBoundary": null,
|
|
11106
|
+
"markerField": null
|
|
11107
|
+
},
|
|
11108
|
+
"shipping_types": {
|
|
11109
|
+
"resource": "shipping_types",
|
|
11110
|
+
"apiEntity": "ShippingType",
|
|
11111
|
+
"kind": "entity",
|
|
11112
|
+
"path": "ShippingTypes",
|
|
11113
|
+
"parentScoped": false,
|
|
11114
|
+
"tier": "extended",
|
|
11115
|
+
"workflowResource": false,
|
|
11116
|
+
"group": "B",
|
|
11117
|
+
"parent": null,
|
|
11118
|
+
"children": [],
|
|
11119
|
+
"naturalKeys": {
|
|
11120
|
+
"hasSearch": false,
|
|
11121
|
+
"searchCovers": null,
|
|
11122
|
+
"findBy": []
|
|
11123
|
+
},
|
|
11124
|
+
"blindSurfaces": null,
|
|
11125
|
+
"zoneFacts": null,
|
|
11126
|
+
"deleteBoundary": null,
|
|
11127
|
+
"markerField": null
|
|
11021
11128
|
}
|
|
11022
11129
|
};
|
|
11023
11130
|
var BLIND_SURFACE_STAMPS = {
|
|
@@ -11130,6 +11237,7 @@ var DELETE_BOUNDARY_NOTES = {
|
|
|
11130
11237
|
"user_defined_field_list_items": "the vendor defines no DELETE for user_defined_field_list_items (spec-derived: the vendored api-docs.json defines no DELETE on the standalone or parent-scoped ListItems paths) \u2014 a picklist value cannot be deleted through the API; deactivation is via isActive (vendor soft-removal); hard cleanup is UI-only.",
|
|
11131
11238
|
"task_notes": "The vendor defines no DELETE for task_notes (spec-derived); a created task note cannot be removed through the public API.",
|
|
11132
11239
|
"time_off_requests": "The vendor defines no DELETE for time-off requests; cancel through time_off_requests.update using the Canceled status from exposed field metadata. Cancellation is leave management, not timesheet unposting.",
|
|
11240
|
+
"inventory_items": "The specification defines no public DELETE for InventoryItems. A created item cannot be removed through that API.",
|
|
11133
11241
|
"inventory_locations": "The vendor defines no DELETE for inventory_locations (spec-derived); a created inventory location cannot be removed through the public API."
|
|
11134
11242
|
};
|
|
11135
11243
|
var RESPONSE_DRIFT_MARKERS = {
|
|
@@ -14057,6 +14165,34 @@ var CREATE_GUIDANCE = {
|
|
|
14057
14165
|
"note": null
|
|
14058
14166
|
}
|
|
14059
14167
|
},
|
|
14168
|
+
{
|
|
14169
|
+
"resource": "inventory_items",
|
|
14170
|
+
"createOp": "inventory_items.create",
|
|
14171
|
+
"parentScoped": false,
|
|
14172
|
+
"liveProvenPrefix": [],
|
|
14173
|
+
"unproven": true,
|
|
14174
|
+
"blocker": {
|
|
14175
|
+
"kind": "unknown",
|
|
14176
|
+
"message": "Inventory access, an active location, a visible product and a unique product-location pair are required.",
|
|
14177
|
+
"remedy": "Read product and location metadata, supply the required quantities and preview before apply.",
|
|
14178
|
+
"requires": {
|
|
14179
|
+
"allOf": [
|
|
14180
|
+
"inventoryLocationID",
|
|
14181
|
+
"productID",
|
|
14182
|
+
"quantityMinimum",
|
|
14183
|
+
"quantityMaximum",
|
|
14184
|
+
"quantityOnHand"
|
|
14185
|
+
]
|
|
14186
|
+
}
|
|
14187
|
+
},
|
|
14188
|
+
"vendorEvidence": [
|
|
14189
|
+
"https://www.autotask.net/help/developerhelp/Content/APIs/REST/Entities/InventoryItemsEntity.htm"
|
|
14190
|
+
],
|
|
14191
|
+
"deleteBoundary": {
|
|
14192
|
+
"available": false,
|
|
14193
|
+
"note": "The specification defines no public DELETE for InventoryItems."
|
|
14194
|
+
}
|
|
14195
|
+
},
|
|
14060
14196
|
{
|
|
14061
14197
|
"resource": "inventory_locations",
|
|
14062
14198
|
"createOp": "inventory_locations.create",
|
|
@@ -15662,7 +15798,7 @@ var CREATE_GUIDANCE = {
|
|
|
15662
15798
|
}
|
|
15663
15799
|
],
|
|
15664
15800
|
"counts": {
|
|
15665
|
-
"total":
|
|
15801
|
+
"total": 118,
|
|
15666
15802
|
"byKind": {
|
|
15667
15803
|
"ok": 41,
|
|
15668
15804
|
"blind-reference": 16,
|
|
@@ -15672,7 +15808,7 @@ var CREATE_GUIDANCE = {
|
|
|
15672
15808
|
"resource-role-pair": 2,
|
|
15673
15809
|
"delete-absent": 0,
|
|
15674
15810
|
"non-mutable": 0,
|
|
15675
|
-
"unknown":
|
|
15811
|
+
"unknown": 42
|
|
15676
15812
|
}
|
|
15677
15813
|
}
|
|
15678
15814
|
};
|
|
@@ -16452,8 +16588,22 @@ var UNTRUSTED_FIELDS_BY_RESOURCE = {
|
|
|
16452
16588
|
"referenceLink",
|
|
16453
16589
|
"title"
|
|
16454
16590
|
],
|
|
16591
|
+
"inventory_items": [
|
|
16592
|
+
"bin",
|
|
16593
|
+
"referenceNumber"
|
|
16594
|
+
],
|
|
16455
16595
|
"inventory_locations": [
|
|
16456
16596
|
"locationName"
|
|
16597
|
+
],
|
|
16598
|
+
"internal_locations": [
|
|
16599
|
+
"additionalAddressInfo",
|
|
16600
|
+
"country",
|
|
16601
|
+
"name",
|
|
16602
|
+
"timeZone"
|
|
16603
|
+
],
|
|
16604
|
+
"shipping_types": [
|
|
16605
|
+
"description",
|
|
16606
|
+
"name"
|
|
16457
16607
|
]
|
|
16458
16608
|
};
|
|
16459
16609
|
|
|
@@ -16913,9 +17063,9 @@ function isKnowledgeBaseRootResource(resource) {
|
|
|
16913
17063
|
return resource === "knowledge_base_categories" || resource === "knowledge_base_articles";
|
|
16914
17064
|
}
|
|
16915
17065
|
function isExactRecordResource(resource) {
|
|
16916
|
-
return resource === "inventory_locations" || isKnowledgeBaseRootResource(resource);
|
|
17066
|
+
return resource === "inventory_locations" || resource === "inventory_items" || resource === "internal_locations" || resource === "shipping_types" || isKnowledgeBaseRootResource(resource);
|
|
16917
17067
|
}
|
|
16918
|
-
var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
|
|
17068
|
+
var EXACT_RECORD_PATH = /^\/v1\.0\/(?:InventoryLocations|InventoryItems|InternalLocations|ShippingTypes|KnowledgeBaseArticles|KnowledgeBaseCategories(?:\/\d+\/KnowledgeBaseArticles)?)(?:\/(query(?:\/(?:next|previous|count))?|\d+))?\/?$/i;
|
|
16919
17069
|
function exactRecordResponseTarget(path, method, operation) {
|
|
16920
17070
|
const match = EXACT_RECORD_PATH.exec(path);
|
|
16921
17071
|
if (match === null) return void 0;
|
|
@@ -16937,6 +17087,9 @@ function receiptId(body) {
|
|
|
16937
17087
|
function isNonNegativeInt64(id) {
|
|
16938
17088
|
return typeof id === "number" ? Number.isSafeInteger(id) && id >= 0 : typeof id === "string" && isAuditDecimalId(id);
|
|
16939
17089
|
}
|
|
17090
|
+
function isSignedInt64Token(token) {
|
|
17091
|
+
return token.startsWith("-") ? /^-[0-9]{1,19}$/.test(token) && BigInt(token) >= -9223372036854775808n : isAuditDecimalId(token);
|
|
17092
|
+
}
|
|
16940
17093
|
function validateExactRecordResponse(body, target, path, method, requestBody, operation) {
|
|
16941
17094
|
const invalid = (message) => {
|
|
16942
17095
|
throw new AutotaskError(message, { code: "INVALID_RESPONSE", category: "server", operation, suggestedAction: INVALID_SHAPE_ACTION });
|
|
@@ -16977,7 +17130,7 @@ function validateExactRecordResponse(body, target, path, method, requestBody, op
|
|
|
16977
17130
|
return invalid("Expected an item envelope with a valid record ID");
|
|
16978
17131
|
}
|
|
16979
17132
|
const entity = parts.at(-2)?.toLowerCase();
|
|
16980
|
-
const resource = entity === "inventorylocations" ? "inventory location" : entity === "knowledgebasearticles" ? "article" : "category";
|
|
17133
|
+
const resource = entity === "inventorylocations" ? "inventory location" : entity === "knowledgebasearticles" ? "article" : entity === "knowledgebasecategories" ? "category" : "record";
|
|
16981
17134
|
if (String(id) !== expectedId) {
|
|
16982
17135
|
throw new AutotaskConfigError(`returned ${resource} id must match the requested id`, { operation });
|
|
16983
17136
|
}
|
|
@@ -16999,7 +17152,7 @@ function serializeExactRecordUpdate(body, operation) {
|
|
|
16999
17152
|
const { rawJSON } = JSON;
|
|
17000
17153
|
return JSON.stringify({ ...body, id: rawJSON(body.id) });
|
|
17001
17154
|
}
|
|
17002
|
-
function decodeResponseJson(text, auditTarget, recordTarget) {
|
|
17155
|
+
function decodeResponseJson(text, auditTarget, recordTarget, path) {
|
|
17003
17156
|
const target = auditTarget ?? recordTarget;
|
|
17004
17157
|
if (target === void 0) return JSON.parse(text);
|
|
17005
17158
|
if (target === "query/count") {
|
|
@@ -17007,10 +17160,13 @@ function decodeResponseJson(text, auditTarget, recordTarget) {
|
|
|
17007
17160
|
}
|
|
17008
17161
|
const idTokens = /* @__PURE__ */ new WeakMap();
|
|
17009
17162
|
const receiptTokens = /* @__PURE__ */ new WeakMap();
|
|
17163
|
+
const holidaySetTokens = /* @__PURE__ */ new WeakMap();
|
|
17164
|
+
const internalLocations = path !== void 0 && /^\/v1\.0\/InternalLocations\//i.test(path);
|
|
17010
17165
|
const body = JSON.parse(text, function(key, value, context) {
|
|
17011
17166
|
if (typeof value === "number" && context?.source !== void 0) {
|
|
17012
17167
|
if (key === "id") idTokens.set(this, context.source);
|
|
17013
17168
|
if (key === "itemId" && target === "mutation") receiptTokens.set(this, context.source);
|
|
17169
|
+
if (internalLocations && key === "holidaySetId") holidaySetTokens.set(this, context.source);
|
|
17014
17170
|
}
|
|
17015
17171
|
return value;
|
|
17016
17172
|
});
|
|
@@ -17018,6 +17174,10 @@ function decodeResponseJson(text, auditTarget, recordTarget) {
|
|
|
17018
17174
|
if (Array.isArray(rows)) {
|
|
17019
17175
|
for (const row of rows) {
|
|
17020
17176
|
if (!isRecord2(row)) continue;
|
|
17177
|
+
const holidaySet = holidaySetTokens.get(row);
|
|
17178
|
+
if (holidaySet !== void 0 && !Number.isSafeInteger(row.holidaySetId) && isSignedInt64Token(holidaySet)) {
|
|
17179
|
+
row.holidaySetId = holidaySet;
|
|
17180
|
+
}
|
|
17021
17181
|
const key = target === "mutation" && ownField(row, "itemId") !== void 0 ? "itemId" : "id";
|
|
17022
17182
|
const value = ownField(row, key);
|
|
17023
17183
|
if (typeof value !== "number") continue;
|
|
@@ -17077,7 +17237,7 @@ function attachEmptyReasonDetails(err) {
|
|
|
17077
17237
|
} : {
|
|
17078
17238
|
surface,
|
|
17079
17239
|
kind: "not-found",
|
|
17080
|
-
note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : resource === "knowledge_base_articles" ? "No published article 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)`,
|
|
17240
|
+
note: isDeletedAuditRead(surface) ? "No audit log entry at this ID was visible to this API user." : resource === "internal_locations" || resource === "shipping_types" || resource === "inventory_items" ? "No record at this ID was visible to this API user." : resource === "knowledge_base_articles" ? "No published article 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)`,
|
|
17081
17241
|
authority: `${resource}.query`,
|
|
17082
17242
|
remedy: `query the ${resource} collection (a bounded queryBounded walk) or verify the id from the authority surface \u2014 do not retry the same get`
|
|
17083
17243
|
};
|
|
@@ -17643,7 +17803,7 @@ var HttpClient = class {
|
|
|
17643
17803
|
}
|
|
17644
17804
|
let parsed;
|
|
17645
17805
|
try {
|
|
17646
|
-
parsed = decodeResponseJson(text, s.auditTarget, s.recordTarget);
|
|
17806
|
+
parsed = decodeResponseJson(text, s.auditTarget, s.recordTarget, decodeURIComponent(s.opts.path));
|
|
17647
17807
|
} catch {
|
|
17648
17808
|
return this.handleNonJson2xx(s, res, status, text);
|
|
17649
17809
|
}
|
|
@@ -17868,7 +18028,7 @@ var HttpClient = class {
|
|
|
17868
18028
|
if (queryRoute) {
|
|
17869
18029
|
const audit = auditTarget === "query" || auditTarget === "query/count";
|
|
17870
18030
|
const exactRecord = recordTarget === "query" || recordTarget === "query/count";
|
|
17871
|
-
const recordLabel = /^\/v1\.0\/InventoryLocations\//i.test(route) ? "inventory location" : "Knowledge Base record";
|
|
18031
|
+
const recordLabel = /^\/v1\.0\/InventoryLocations\//i.test(route) ? "inventory location" : /^\/v1\.0\/KnowledgeBase/i.test(route) ? "Knowledge Base record" : "record";
|
|
17872
18032
|
const exactIdLabel = audit ? "audit log" : exactRecord ? recordLabel : void 0;
|
|
17873
18033
|
assertQueryFilters(opts, requestUrl, bodyText, exactIdLabel);
|
|
17874
18034
|
}
|
|
@@ -18466,13 +18626,13 @@ async function runBounded(fn, items, opts) {
|
|
|
18466
18626
|
const results = new Array(items.length);
|
|
18467
18627
|
let next = 0;
|
|
18468
18628
|
let failure;
|
|
18469
|
-
const
|
|
18629
|
+
const fail5 = (error, index) => {
|
|
18470
18630
|
if (failure === void 0 || opts.orderedErrors === true && index < failure.index) failure = { error, index };
|
|
18471
18631
|
};
|
|
18472
18632
|
const worker = async () => {
|
|
18473
18633
|
while (failure === void 0 && next < items.length) {
|
|
18474
18634
|
if (signal?.aborted) {
|
|
18475
|
-
|
|
18635
|
+
fail5(signal.reason, -1);
|
|
18476
18636
|
return;
|
|
18477
18637
|
}
|
|
18478
18638
|
const i = next++;
|
|
@@ -18482,7 +18642,7 @@ async function runBounded(fn, items, opts) {
|
|
|
18482
18642
|
results[i] = settle ? { status: "fulfilled", value } : value;
|
|
18483
18643
|
} catch (error) {
|
|
18484
18644
|
if (settle) results[i] = { status: "rejected", reason: error };
|
|
18485
|
-
else
|
|
18645
|
+
else fail5(error, i);
|
|
18486
18646
|
}
|
|
18487
18647
|
}
|
|
18488
18648
|
};
|
|
@@ -18538,7 +18698,7 @@ async function capabilitySets() {
|
|
|
18538
18698
|
const fieldOps = /* @__PURE__ */ new Map();
|
|
18539
18699
|
const udfCapable = /* @__PURE__ */ new Set();
|
|
18540
18700
|
const resources = /* @__PURE__ */ new Set();
|
|
18541
|
-
for (const rec of await
|
|
18701
|
+
for (const rec of await chunkQXJQIZCT_cjs.loadCapabilityRecords()) {
|
|
18542
18702
|
if (rec.resource === "operations") continue;
|
|
18543
18703
|
resources.add(rec.resource);
|
|
18544
18704
|
if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
|
|
@@ -18549,7 +18709,7 @@ async function capabilitySets() {
|
|
|
18549
18709
|
var derivedIndexPromise = null;
|
|
18550
18710
|
function derivedIndexLoad() {
|
|
18551
18711
|
if (derivedIndexPromise === null) {
|
|
18552
|
-
derivedIndexPromise =
|
|
18712
|
+
derivedIndexPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => {
|
|
18553
18713
|
const index = /* @__PURE__ */ new Map();
|
|
18554
18714
|
for (const rec of records) {
|
|
18555
18715
|
const declared = rec.metadata?.derivedFields;
|
|
@@ -18936,7 +19096,7 @@ function truncateNoteChars(items, cap, fields) {
|
|
|
18936
19096
|
const copy = { ...item };
|
|
18937
19097
|
for (const field of fields) {
|
|
18938
19098
|
const v = copy[field];
|
|
18939
|
-
if (typeof v === "string" && v.length > cap) {
|
|
19099
|
+
if (typeof v === "string" && v !== chunkCM5O672I_cjs.REDACTED && v.length > cap) {
|
|
18940
19100
|
const end = cap > 0 && (v.charCodeAt(cap - 1) & 64512) === 55296 ? cap - 1 : cap;
|
|
18941
19101
|
copy[field] = v.slice(0, end) + noteCharsTruncationMarker(v.length - end);
|
|
18942
19102
|
truncated += 1;
|
|
@@ -19955,6 +20115,108 @@ function checkInventoryLocationCurrent(value, current, id) {
|
|
|
19955
20115
|
if (Object.hasOwn(value, "isActive") && value.isActive === false && (!Object.hasOwn(current, "isDefault") || current.isDefault !== false)) fail("inactivation requires a fresh current isDefault value explicitly false; default or unknown locations cannot be inactivated");
|
|
19956
20116
|
}
|
|
19957
20117
|
|
|
20118
|
+
// src/resources/special/inventoryItems.ts
|
|
20119
|
+
var REFERENCES = ["inventoryLocationID", "productID"];
|
|
20120
|
+
var QUANTITIES = ["quantityMinimum", "quantityMaximum", "quantityOnHand"];
|
|
20121
|
+
var TEXT_FIELDS = ["bin", "referenceNumber"];
|
|
20122
|
+
var MUTATION_OPTIONS = ["dryRun", "lastModifiedDate", "maxRetries", "raw", "verifyPersisted"];
|
|
20123
|
+
function fail2(message) {
|
|
20124
|
+
throw new AutotaskConfigError(`inventory_items: ${message}`);
|
|
20125
|
+
}
|
|
20126
|
+
function own(record, field) {
|
|
20127
|
+
return Object.hasOwn(record, field) ? record[field] : void 0;
|
|
20128
|
+
}
|
|
20129
|
+
function int32(value, label, minimum = -2147483648) {
|
|
20130
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < minimum || value > 2147483647) {
|
|
20131
|
+
fail2(`${label} must be an integer between ${minimum} and 2147483647`);
|
|
20132
|
+
}
|
|
20133
|
+
return value;
|
|
20134
|
+
}
|
|
20135
|
+
function inventoryItemId(value) {
|
|
20136
|
+
const id = parseIdentifier(value, "inventory_items: id");
|
|
20137
|
+
if (!isAuditDecimalId(String(id))) fail2("id must fit a signed 64-bit integer");
|
|
20138
|
+
return id;
|
|
20139
|
+
}
|
|
20140
|
+
function admitInventoryItem(value, creating) {
|
|
20141
|
+
if (!isRecord2(value) || ![Object.prototype, null].includes(Object.getPrototypeOf(value))) fail2("data must be a plain record");
|
|
20142
|
+
const body = { ...value };
|
|
20143
|
+
const writable = [...QUANTITIES, ...TEXT_FIELDS, ...creating ? REFERENCES : []];
|
|
20144
|
+
for (const field of Object.keys(body)) {
|
|
20145
|
+
if (!writable.some((name) => name === field)) fail2(`${field} is not a writable InventoryItems field on ${creating ? "create" : "update"}`);
|
|
20146
|
+
}
|
|
20147
|
+
if (!creating && Object.keys(body).length === 0) fail2("update must contain a writable field");
|
|
20148
|
+
if (creating) for (const field of REFERENCES) int32(own(body, field), field, 1);
|
|
20149
|
+
for (const field of QUANTITIES) {
|
|
20150
|
+
const nonnegative = field === "quantityMinimum" || creating && field === "quantityOnHand";
|
|
20151
|
+
if (creating || Object.hasOwn(body, field)) int32(own(body, field), field, nonnegative ? 0 : void 0);
|
|
20152
|
+
}
|
|
20153
|
+
for (const field of TEXT_FIELDS) {
|
|
20154
|
+
const text = own(body, field);
|
|
20155
|
+
if (Object.hasOwn(body, field) && (typeof text !== "string" || text.length > 50)) fail2(`${field} must be a string of at most 50 characters`);
|
|
20156
|
+
}
|
|
20157
|
+
assertQuantityRange(own(body, "quantityMinimum"), own(body, "quantityMaximum"));
|
|
20158
|
+
return body;
|
|
20159
|
+
}
|
|
20160
|
+
function snapshotInventoryItemOptions(value) {
|
|
20161
|
+
if (value !== void 0 && !isRecord2(value)) fail2("options must be an object");
|
|
20162
|
+
const options = value ?? {};
|
|
20163
|
+
for (const key of MUTATION_OPTIONS) {
|
|
20164
|
+
if (key in options && !Object.hasOwn(options, key)) fail2(`${key} must be an own option`);
|
|
20165
|
+
}
|
|
20166
|
+
const result = snapshotMutationOptions(Object.fromEntries(MUTATION_OPTIONS.map((key) => [key, own(options, key)])));
|
|
20167
|
+
if (result.lastModifiedDate !== void 0) fail2("no documented stale timestamp is available");
|
|
20168
|
+
if (result.raw !== void 0 && result.raw !== false) fail2("raw updates are unsupported");
|
|
20169
|
+
if (result.maxRetries !== void 0 && (!Number.isSafeInteger(result.maxRetries) || result.maxRetries < 0)) fail2("maxRetries must be a nonnegative safe integer");
|
|
20170
|
+
if (result.verifyPersisted !== void 0 && typeof result.verifyPersisted !== "boolean") fail2("verifyPersisted must be a boolean");
|
|
20171
|
+
return result;
|
|
20172
|
+
}
|
|
20173
|
+
function assertQuantityRange(minimum, maximum) {
|
|
20174
|
+
if (typeof minimum === "number" && typeof maximum === "number" && maximum < minimum) fail2("quantityMaximum must be at least quantityMinimum");
|
|
20175
|
+
}
|
|
20176
|
+
function exactItem(value, id, label) {
|
|
20177
|
+
if (!isRecord2(value)) fail2(`${label} must be a record`);
|
|
20178
|
+
const returned = own(value, "id");
|
|
20179
|
+
if (typeof returned !== "string" && (typeof returned !== "number" || !Number.isSafeInteger(returned))) fail2(`${label} requires its own exact id`);
|
|
20180
|
+
if (String(returned) !== String(id)) fail2(`${label} id must match the requested id`);
|
|
20181
|
+
return value;
|
|
20182
|
+
}
|
|
20183
|
+
async function productIsSerialized(http, id, checkedBaseUrl, maxRetries) {
|
|
20184
|
+
const operation = "products.get";
|
|
20185
|
+
const body = await http.request({ method: "GET", path: `/V1.0/Products/${id}`, operation, maxRetries, checkedBaseUrl });
|
|
20186
|
+
const product = exactItem(unwrapItem(body, id, operation, "product"), id, "product");
|
|
20187
|
+
const serialized = own(product, "isSerialized");
|
|
20188
|
+
if (typeof serialized !== "boolean") fail2("product requires a fresh boolean isSerialized fact");
|
|
20189
|
+
return serialized;
|
|
20190
|
+
}
|
|
20191
|
+
async function guardInventoryItemCreate(http, data, checkedBaseUrl, maxRetries) {
|
|
20192
|
+
const locationId = data.inventoryLocationID;
|
|
20193
|
+
const operation = "inventory_locations.get";
|
|
20194
|
+
const body = await http.request({ method: "GET", path: `/V1.0/InventoryLocations/${locationId}`, operation, maxRetries, checkedBaseUrl });
|
|
20195
|
+
const location = exactItem(unwrapItem(body, locationId, operation, "inventory_location"), locationId, "inventory location");
|
|
20196
|
+
if (own(location, "isActive") !== true) fail2("inventory location requires a fresh isActive value explicitly true");
|
|
20197
|
+
if (await productIsSerialized(http, data.productID, checkedBaseUrl, maxRetries) && data.quantityOnHand !== 0) {
|
|
20198
|
+
fail2("quantityOnHand must be zero when creating an item for a serialized product");
|
|
20199
|
+
}
|
|
20200
|
+
}
|
|
20201
|
+
async function checkInventoryItemCurrent(http, data, current, id, checkedBaseUrl, maxRetries) {
|
|
20202
|
+
const item = exactItem(current, id, "current record");
|
|
20203
|
+
const minimum = own(data, "quantityMinimum");
|
|
20204
|
+
const maximum = own(data, "quantityMaximum");
|
|
20205
|
+
if (minimum !== void 0 || maximum !== void 0) {
|
|
20206
|
+
assertQuantityRange(
|
|
20207
|
+
minimum ?? int32(own(item, "quantityMinimum"), "current quantityMinimum", 0),
|
|
20208
|
+
maximum ?? int32(own(item, "quantityMaximum"), "current quantityMaximum")
|
|
20209
|
+
);
|
|
20210
|
+
}
|
|
20211
|
+
const onHand = own(data, "quantityOnHand");
|
|
20212
|
+
if (typeof onHand !== "number") return;
|
|
20213
|
+
const picked = int32(own(item, "quantityPicked"), "current quantityPicked");
|
|
20214
|
+
const reserved = int32(own(item, "quantityReserved"), "current quantityReserved");
|
|
20215
|
+
if (onHand < picked + reserved) fail2("quantityOnHand must be at least quantityPicked plus quantityReserved");
|
|
20216
|
+
const productId = int32(own(item, "productID"), "current productID", 1);
|
|
20217
|
+
if (await productIsSerialized(http, productId, checkedBaseUrl, maxRetries)) fail2("quantityOnHand is read-only on update for a serialized product");
|
|
20218
|
+
}
|
|
20219
|
+
|
|
19958
20220
|
// src/resources/base/types.ts
|
|
19959
20221
|
var BOUNDED_QUERY_DEFAULT_LIMIT = 500;
|
|
19960
20222
|
var BOUNDED_QUERY_MAX_LIMIT = 2500;
|
|
@@ -20121,6 +20383,8 @@ var MODEL_FIELD_SETS = {
|
|
|
20121
20383
|
"expense_reports": ["id", "amountDue", "approvedDate", "approverID", "departmentNumber", "internalCurrencyCashAdvanceAmount", "internalCurrencyExpenseTotal", "name", "organizationalLevelAssociationID", "quickBooksReferenceNumber", "reimbursementCurrencyAmountDue", "reimbursementCurrencyCashAdvanceAmount", "reimbursementCurrencyID", "rejectionReason", "status", "submit", "submitDate", "submitterID", "weekEnding"],
|
|
20122
20384
|
"holiday_sets": ["id", "holidaySetDescription", "holidaySetName"],
|
|
20123
20385
|
"holidays": ["id", "holidayDate", "holidayName", "holidaySetID", "soapParentPropertyId"],
|
|
20386
|
+
"internal_locations": ["id", "additionalAddressInfo", "address1", "address2", "city", "country", "holidaySetId", "isDefault", "name", "postalCode", "state", "timeZone"],
|
|
20387
|
+
"inventory_items": ["id", "backOrderQuantity", "bin", "impersonatorCreatorResourceID", "inventoryLocationID", "productID", "quantityMaximum", "quantityMinimum", "quantityOnHand", "quantityOnOrder", "quantityPicked", "quantityReserved", "referenceNumber"],
|
|
20124
20388
|
"inventory_locations": ["id", "impersonatorCreatorResourceID", "isActive", "isDefault", "locationName", "resourceID"],
|
|
20125
20389
|
"inventory_products": ["id", "availableUnits", "backOrderQuantity", "bin", "createDateTime", "createdByResourceID", "inventoryLocationID", "onHandUnits", "pickedUnits", "productID", "quantityMaximum", "quantityMinimum", "referenceNumber", "reservedUnits", "unitsOnOrder"],
|
|
20126
20390
|
"invoice_templates": ["id", "coveredByBlockRetainerContractLabel", "coveredByRecurringServiceFixedPricePerTicketContractLabel", "currencyNegativeFormat", "currencyPositiveFormat", "dateFormat", "displayFixedPriceContractLabor", "displayRecurringServiceContractLabor", "displaySeparateLineItemForEachTax", "displayTaxCategory", "displayTaxCategorySuperscripts", "displayZeroAmountRecurringServicesAndBundles", "groupBy", "itemizeItemsInEachGroup", "itemizeServicesAndBundles", "name", "nonBillableLaborLabel", "numberFormat", "pageLayout", "pageNumberFormat", "paymentTerms", "rateCostExpression", "showGridHeader", "showVerticalGridLines", "sortBy", "timeFormat"],
|
|
@@ -20167,6 +20431,7 @@ var MODEL_FIELD_SETS = {
|
|
|
20167
20431
|
"service_calls": ["id", "cancelationNoticeHours", "canceledByResourceID", "canceledDateTime", "companyID", "companyLocationID", "createDateTime", "creatorResourceID", "description", "duration", "endDateTime", "impersonatorCreatorResourceID", "isComplete", "lastModifiedDateTime", "startDateTime", "status"],
|
|
20168
20432
|
"service_level_agreement_results": ["id", "firstResponseElapsedHours", "firstResponseInitiatingResourceID", "firstResponseResourceID", "isFirstResponseMet", "isResolutionMet", "isResolutionPlanMet", "resolutionElapsedHours", "resolutionPlanElapsedHours", "resolutionPlanResourceID", "resolutionResourceID", "serviceLevelAgreementName", "ticketID", "soapParentPropertyId"],
|
|
20169
20433
|
"services": ["id", "billingCodeID", "createDate", "creatorResourceID", "description", "invoiceDescription", "isActive", "lastModifiedDate", "markupRate", "name", "periodType", "serviceLevelAgreementID", "unitCost", "unitPrice", "updateResourceID", "vendorCompanyID", "manufacturerServiceProvider", "manufacturerServiceProviderProductNumber", "catalogNumberPartNumber", "sku", "internalID", "externalID", "url", "userDefinedFields"],
|
|
20434
|
+
"shipping_types": ["id", "billingCodeID", "description", "isActive", "name"],
|
|
20170
20435
|
"skills": ["id", "categoryID", "description", "isActive", "name"],
|
|
20171
20436
|
"subscription_periods": ["id", "periodCost", "periodDate", "periodPrice", "postedDate", "purchaseOrderNumber", "subscriptionID", "soapParentPropertyId"],
|
|
20172
20437
|
"subscriptions": ["id", "configurationItemID", "description", "effectiveDate", "expirationDate", "impersonatorCreatorResourceID", "materialCodeID", "organizationalLevelAssociationID", "periodCost", "periodPrice", "periodType", "purchaseOrderNumber", "status", "subscriptionName", "totalCost", "totalPrice", "vendorID", "userDefinedFields"],
|
|
@@ -20361,27 +20626,28 @@ function validateRelationLeaves(resourceKey, conditions, op) {
|
|
|
20361
20626
|
assertUndottedUdfField(c, op);
|
|
20362
20627
|
const field = c.field;
|
|
20363
20628
|
const [rel, sub, ...rest] = field.split(".");
|
|
20364
|
-
const
|
|
20629
|
+
const fail5 = (why) => {
|
|
20365
20630
|
throw new AutotaskConfigError(`${op}: relation filter "${field}" ${why} \u2014 the request was not issued`, {
|
|
20366
20631
|
operation: op,
|
|
20367
20632
|
suggestedAction: valid.length > 0 ? `Use ${valid.map((r) => `${r}.<${RELATION_TARGETS[r].resource} field>`).join(" or ")} (one hop; field names from operations.fieldCatalog).` : `${resourceKey} has no relation filters; filter on its own fields.`
|
|
20368
20633
|
});
|
|
20369
20634
|
};
|
|
20370
20635
|
if (selfPrefixes(resourceKey).includes(rel)) {
|
|
20371
|
-
if (rest.length > 0 || !sub)
|
|
20636
|
+
if (rest.length > 0 || !sub) fail5("is not <resource>.<field> (multi-hop relations are not supported)");
|
|
20372
20637
|
continue;
|
|
20373
20638
|
}
|
|
20374
|
-
if (rest.length > 0 || !sub)
|
|
20375
|
-
if (!valid.includes(rel))
|
|
20639
|
+
if (rest.length > 0 || !sub) fail5("is not <relation>.<field> (multi-hop relations are not supported)");
|
|
20640
|
+
if (!valid.includes(rel)) fail5(`names an unknown relation for ${resourceKey} (valid: ${valid.join(", ") || "none"})`);
|
|
20376
20641
|
const parentFields = MODEL_FIELD_SETS[RELATION_TARGETS[rel].resource];
|
|
20377
20642
|
if (parentFields !== void 0 && modelFieldLookup(RELATION_TARGETS[rel].resource)?.(sub) !== true) {
|
|
20378
|
-
|
|
20643
|
+
fail5(`names a field unknown on ${RELATION_TARGETS[rel].resource}`);
|
|
20379
20644
|
}
|
|
20380
20645
|
}
|
|
20381
20646
|
};
|
|
20382
20647
|
walk(conditions);
|
|
20383
20648
|
}
|
|
20384
20649
|
async function rewriteRelationFilters(http, resourceKey, conditions, op) {
|
|
20650
|
+
assertSupportedUdfConditions(conditions, op);
|
|
20385
20651
|
if (!hasRelationConditions(conditions)) return void 0;
|
|
20386
20652
|
const conds = conditions;
|
|
20387
20653
|
validateRelationLeaves(resourceKey, conds, op);
|
|
@@ -20470,11 +20736,14 @@ var ROW_FK_TABLES = {
|
|
|
20470
20736
|
configurationItemCategoryID: "configurationItemCategory"
|
|
20471
20737
|
};
|
|
20472
20738
|
var isResourceFkField = (field) => field === "resourceID" || field.endsWith("ResourceID");
|
|
20739
|
+
function rowFkTable(resourceKey, field) {
|
|
20740
|
+
return resourceKey === "shipping_types" && field === "billingCodeID" ? void 0 : ROW_FK_TABLES[field];
|
|
20741
|
+
}
|
|
20473
20742
|
function rowNamePlan(rows, resourceKey, picklistFields = []) {
|
|
20474
20743
|
const builder = createNamePlan(picklistFields, resourceKey);
|
|
20475
20744
|
for (const row of rows) {
|
|
20476
20745
|
for (const [field, value] of Object.entries(row)) {
|
|
20477
|
-
const table =
|
|
20746
|
+
const table = rowFkTable(resourceKey, field);
|
|
20478
20747
|
if (table !== void 0) builder.addFk(table, value);
|
|
20479
20748
|
else if (isResourceFkField(field)) builder.addResource(value);
|
|
20480
20749
|
}
|
|
@@ -20512,7 +20781,7 @@ async function labelRows(client, resourceKey, rows) {
|
|
|
20512
20781
|
if (!isAutotaskError(err) || err.code === "ABORTED") throw err;
|
|
20513
20782
|
}
|
|
20514
20783
|
}
|
|
20515
|
-
const labelled = (field) => picklistFields.includes(field) ||
|
|
20784
|
+
const labelled = (field) => picklistFields.includes(field) || rowFkTable(resourceKey, field) !== void 0 || isResourceFkField(field);
|
|
20516
20785
|
if (![...keys].some(labelled)) return { rows: [...rows] };
|
|
20517
20786
|
const plan = rowNamePlan(rows, resourceKey, picklistFields);
|
|
20518
20787
|
const names = plan.resourceIds.length === 0 && plan.recordFks.length === 0 && picklistFields.length === 0 ? void 0 : await resolveCompositeNames(client.http, plan);
|
|
@@ -20521,7 +20790,7 @@ async function labelRows(client, resourceKey, rows) {
|
|
|
20521
20790
|
for (const [field, value] of Object.entries(row)) {
|
|
20522
20791
|
const has2 = value !== null && value !== void 0 && names !== void 0;
|
|
20523
20792
|
if (picklistFields.includes(field)) r[`${field}Label`] = has2 ? names.labelFor(field, value) : null;
|
|
20524
|
-
const table =
|
|
20793
|
+
const table = rowFkTable(resourceKey, field);
|
|
20525
20794
|
const set = has2 && (table === "company" || value !== 0 && value !== "0");
|
|
20526
20795
|
if (table !== void 0) r[`${field}Name`] = set && isVendorId(value) ? untrustedName(names.recordName(table, value)) : null;
|
|
20527
20796
|
else if (isResourceFkField(field)) r[`${field}Name`] = set && isVendorId(value) ? untrustedName(names.resourceName(value)) : null;
|
|
@@ -20731,11 +21000,13 @@ var QueryBase = class {
|
|
|
20731
21000
|
walkPageSize(params) {
|
|
20732
21001
|
return clampPageSize(params?.maxRecords ?? this.defaultPageSize);
|
|
20733
21002
|
}
|
|
21003
|
+
/** Capture mutable input for Knowledge Base and InventoryItems reads. */
|
|
20734
21004
|
snapshotKnowledgeBaseQuery(params) {
|
|
20735
|
-
|
|
21005
|
+
const knowledgeBase = isKnowledgeBaseRootResource(this.config.key);
|
|
21006
|
+
if ((knowledgeBase || this.config.key === "inventory_items") && isRecord2(params)) {
|
|
20736
21007
|
const captured = snapshotQueryBag(params, QUERY_BAG_KEYS);
|
|
20737
21008
|
const conditions = Array.isArray(captured.filter) ? captured.filter : captured.filter?.filter;
|
|
20738
|
-
if (conditions?.length === 0) delete captured.filter;
|
|
21009
|
+
if (knowledgeBase && conditions?.length === 0) delete captured.filter;
|
|
20739
21010
|
return captured;
|
|
20740
21011
|
}
|
|
20741
21012
|
return params;
|
|
@@ -20776,7 +21047,7 @@ var QueryBase = class {
|
|
|
20776
21047
|
}
|
|
20777
21048
|
/** Stream page objects (the resource `queryPages` surface; relation filters resolve first, #281). */
|
|
20778
21049
|
async *queryPageIter(params) {
|
|
20779
|
-
const walk = await this.relationWalkParams(params, `${this.config.key}.query`);
|
|
21050
|
+
const walk = await this.relationWalkParams(this.snapshotKnowledgeBaseQuery(params), `${this.config.key}.query`);
|
|
20780
21051
|
if (walk === void 0) return;
|
|
20781
21052
|
yield* paginate(this.pageFetcher(walk), { pageSize: this.walkPageSize(walk), continueOnEmpty: this.continueAcrossEmptyPage() });
|
|
20782
21053
|
}
|
|
@@ -21813,26 +22084,26 @@ var MetaBase = class _MetaBase extends QueryBase {
|
|
|
21813
22084
|
|
|
21814
22085
|
// src/resources/special/knowledgeBaseCategories.ts
|
|
21815
22086
|
function admitKnowledgeBaseCategory(data, creating, staleToken) {
|
|
21816
|
-
const
|
|
22087
|
+
const fail5 = (message) => {
|
|
21817
22088
|
throw new AutotaskConfigError(`knowledge_base_categories: ${message}`);
|
|
21818
22089
|
};
|
|
21819
|
-
if (!creating && staleToken !== void 0)
|
|
21820
|
-
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data)))
|
|
22090
|
+
if (!creating && staleToken !== void 0) fail5("no documented stale timestamp is available");
|
|
22091
|
+
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
|
|
21821
22092
|
const body = { ...data };
|
|
21822
|
-
for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field))
|
|
22093
|
+
for (const field of Object.keys(body)) if (!["name", "description", "parentCategoryID"].includes(field)) fail5(`${field} is not a writable KnowledgeBaseCategories field`);
|
|
21823
22094
|
for (const [field, max] of [["name", 50], ["description", 1e3]]) {
|
|
21824
22095
|
const value = body[field];
|
|
21825
|
-
if (value !== void 0 && (typeof value !== "string" || value.length > max))
|
|
22096
|
+
if (value !== void 0 && (typeof value !== "string" || value.length > max)) fail5(`${field} must be a string of at most ${max} characters`);
|
|
21826
22097
|
}
|
|
21827
|
-
if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === ""))
|
|
21828
|
-
if (creating && body.parentCategoryID === void 0)
|
|
22098
|
+
if ((creating || body.name !== void 0) && (typeof body.name !== "string" || body.name.trim() === "")) fail5("name is required");
|
|
22099
|
+
if (creating && body.parentCategoryID === void 0) fail5("parentCategoryID is required; choose a documented visible category rather than guessing a root id");
|
|
21829
22100
|
const parent = body.parentCategoryID;
|
|
21830
22101
|
if (parent !== void 0) {
|
|
21831
|
-
if (typeof parent !== "number") return
|
|
22102
|
+
if (typeof parent !== "number") return fail5("parentCategoryID must be a numeric identifier");
|
|
21832
22103
|
parseIdentifier(parent, "parentCategoryID");
|
|
21833
|
-
if (parent > 2147483647)
|
|
22104
|
+
if (parent > 2147483647) fail5("parentCategoryID must fit a signed 32-bit integer");
|
|
21834
22105
|
}
|
|
21835
|
-
if (!creating && !Object.values(body).some((value) => value !== void 0))
|
|
22106
|
+
if (!creating && !Object.values(body).some((value) => value !== void 0)) fail5("update must contain a writable field");
|
|
21836
22107
|
return body;
|
|
21837
22108
|
}
|
|
21838
22109
|
function categoryReplacement(body) {
|
|
@@ -21846,45 +22117,45 @@ function categoryReplacement(body) {
|
|
|
21846
22117
|
}
|
|
21847
22118
|
|
|
21848
22119
|
// src/resources/special/knowledgeBaseArticles.ts
|
|
21849
|
-
function
|
|
22120
|
+
function fail3(detail) {
|
|
21850
22121
|
throw new AutotaskConfigError(`knowledge_base_articles: ${detail}`);
|
|
21851
22122
|
}
|
|
21852
22123
|
function reference(value, name) {
|
|
21853
|
-
if (typeof value !== "number")
|
|
22124
|
+
if (typeof value !== "number") fail3(`${name} must be a numeric identifier`);
|
|
21854
22125
|
parseIdentifier(value, name);
|
|
21855
|
-
if (value > 2147483647)
|
|
22126
|
+
if (value > 2147483647) fail3(`${name} must fit a signed 32-bit integer`);
|
|
21856
22127
|
return value;
|
|
21857
22128
|
}
|
|
21858
22129
|
function articleParent(value) {
|
|
21859
22130
|
const parent = parseIdentifier(value, "parentId");
|
|
21860
|
-
if (typeof parent !== "number" || parent > 2147483647)
|
|
21861
|
-
if (parent === 0)
|
|
22131
|
+
if (typeof parent !== "number" || parent > 2147483647) fail3("parentId must fit a signed 32-bit category identifier");
|
|
22132
|
+
if (parent === 0) fail3("parentId must name an article category");
|
|
21862
22133
|
return parent;
|
|
21863
22134
|
}
|
|
21864
22135
|
function admitArticle(data, parentId, creating) {
|
|
21865
22136
|
const parent = articleParent(parentId);
|
|
21866
|
-
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data)))
|
|
22137
|
+
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail3("data must be a plain record");
|
|
21867
22138
|
const body = { ...data };
|
|
21868
22139
|
const allowed = ["articleCategoryID", "publish", "title", "errorCodes", "keywords", "referenceLink", "isActive"];
|
|
21869
22140
|
for (const key of Object.keys(body)) {
|
|
21870
|
-
if (!allowed.includes(key))
|
|
22141
|
+
if (!allowed.includes(key)) fail3(`${key} is not a writable article root field`);
|
|
21871
22142
|
if (key !== "articleCategoryID" && body[key] === void 0) delete body[key];
|
|
21872
22143
|
}
|
|
21873
22144
|
for (const [field, max] of [["title", 200], ["errorCodes", 200], ["keywords", 300], ["referenceLink", 500]]) {
|
|
21874
|
-
if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max))
|
|
21875
|
-
}
|
|
21876
|
-
if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim()))
|
|
21877
|
-
if (!creating && Object.hasOwn(body, "articleCategoryID"))
|
|
21878
|
-
if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent))
|
|
21879
|
-
if ((creating || Object.hasOwn(body, "publish")) && (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish) || body.publish < -2147483648 || body.publish > 2147483647))
|
|
21880
|
-
if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean")
|
|
21881
|
-
if (!creating && !Object.keys(body).length)
|
|
22145
|
+
if (Object.hasOwn(body, field) && (typeof body[field] !== "string" || body[field].length > max)) fail3(`${field} must be a string of at most ${max} characters`);
|
|
22146
|
+
}
|
|
22147
|
+
if ((creating || Object.hasOwn(body, "title")) && (typeof body.title !== "string" || !body.title.trim())) fail3("title is required and cannot be blank");
|
|
22148
|
+
if (!creating && Object.hasOwn(body, "articleCategoryID")) fail3("articleCategoryID is read-only after creation");
|
|
22149
|
+
if (creating && String(reference(body.articleCategoryID, "articleCategoryID")) !== String(parent)) fail3("articleCategoryID must match parentId");
|
|
22150
|
+
if ((creating || Object.hasOwn(body, "publish")) && (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish) || body.publish < -2147483648 || body.publish > 2147483647)) fail3("publish must be an int32 from current field metadata");
|
|
22151
|
+
if (Object.hasOwn(body, "isActive") && typeof body.isActive !== "boolean") fail3("isActive must be boolean");
|
|
22152
|
+
if (!creating && !Object.keys(body).length) fail3("update must contain a writable field");
|
|
21882
22153
|
return body;
|
|
21883
22154
|
}
|
|
21884
22155
|
async function guardArticle(http, parentId, id, maxRetries) {
|
|
21885
22156
|
const parent = articleParent(parentId);
|
|
21886
22157
|
const target = id === void 0 ? void 0 : parseIdentifier(id, "id");
|
|
21887
|
-
if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target))))
|
|
22158
|
+
if (target !== void 0 && (target === 0 || !isAuditDecimalId(String(target)))) fail3("id must name an article within the signed 64-bit range");
|
|
21888
22159
|
unwrapItem(await http.request({ method: "GET", path: `/V1.0/KnowledgeBaseCategories/${parent}`, operation: "knowledge_base_categories.get", maxRetries }), parent, "knowledge_base_categories.get", "article_category");
|
|
21889
22160
|
if (target !== void 0) {
|
|
21890
22161
|
return unwrapItem(await http.request({ method: "GET", path: `/V1.0/KnowledgeBaseCategories/${parent}/KnowledgeBaseArticles/${target}`, operation: "knowledge_base_articles.get", maxRetries }), target, "knowledge_base_articles.get", "article");
|
|
@@ -21893,7 +22164,7 @@ async function guardArticle(http, parentId, id, maxRetries) {
|
|
|
21893
22164
|
}
|
|
21894
22165
|
function assertArticlePublish(data, fields) {
|
|
21895
22166
|
if (!Object.hasOwn(data, "publish")) return;
|
|
21896
|
-
const unavailable = () =>
|
|
22167
|
+
const unavailable = () => fail3("publish requires an unambiguous active value in current field metadata");
|
|
21897
22168
|
if (!Array.isArray(fields)) unavailable();
|
|
21898
22169
|
const rows = fields.filter((field) => isRecord2(field) && field.name === "publish");
|
|
21899
22170
|
if (rows.length !== 1 || rows[0].isPickList !== true || rows[0].isReadOnly !== false || !Array.isArray(rows[0].picklistValues)) unavailable();
|
|
@@ -21927,14 +22198,15 @@ var MutationBase = class extends MetaBase {
|
|
|
21927
22198
|
return body;
|
|
21928
22199
|
}
|
|
21929
22200
|
/** `POST /V1.0/<E>` → `{ id }` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
|
|
21930
|
-
async createGlobal(data, opts = {}) {
|
|
22201
|
+
async createGlobal(data, opts = {}, checkedBaseUrl) {
|
|
21931
22202
|
const body = this.normalizeMutationBody(data);
|
|
21932
22203
|
const res = await this.http.request({
|
|
21933
22204
|
method: "POST",
|
|
21934
22205
|
path: this.resourcePath,
|
|
21935
22206
|
body,
|
|
21936
22207
|
operation: `${this.config.key}.create`,
|
|
21937
|
-
maxRetries: opts.maxRetries
|
|
22208
|
+
maxRetries: opts.maxRetries,
|
|
22209
|
+
...checkedBaseUrl === void 0 ? {} : { checkedBaseUrl, maintenanceMaxWaitMs: 0 }
|
|
21938
22210
|
});
|
|
21939
22211
|
return this.unwrapCreateOperation(res, body, opts);
|
|
21940
22212
|
}
|
|
@@ -22106,11 +22378,12 @@ var MutationBase = class extends MetaBase {
|
|
|
22106
22378
|
const stored = parentId === void 0 ? await this.getGlobal(id, true, maxRetries, checkedBaseUrl) : this.config.attachmentGet === true ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true, maxRetries);
|
|
22107
22379
|
const submitted = data;
|
|
22108
22380
|
const persisted = stored;
|
|
22109
|
-
|
|
22110
|
-
|
|
22381
|
+
const inventory = this.config.key === "inventory_locations" || this.config.key === "inventory_items";
|
|
22382
|
+
if (inventory) {
|
|
22383
|
+
if (!Object.hasOwn(persisted, "id")) throw new AutotaskConfigError(`${this.config.key}: persisted record requires its own id`);
|
|
22111
22384
|
validateExactRecordResponse({ item: persisted }, "item", `${this.resourcePath}/${parseIdentifier(id, "id")}`, "GET", void 0, `${this.config.key}.get`);
|
|
22112
22385
|
}
|
|
22113
|
-
const notPersisted =
|
|
22386
|
+
const notPersisted = inventory ? Object.keys(submitted).filter((field) => !Object.hasOwn(persisted, field) || submitted[field] !== persisted[field]) : notPersistedFields(submitted, persisted);
|
|
22114
22387
|
return { ...result, notPersisted };
|
|
22115
22388
|
} catch (err) {
|
|
22116
22389
|
return { ...result, persistedCheckFailed: err instanceof AutotaskError ? err.code : `UNKNOWN (${err instanceof Error ? err.name : typeof err})` };
|
|
@@ -22497,7 +22770,7 @@ var MutationBase = class extends MetaBase {
|
|
|
22497
22770
|
const method = scopedUpdate || partialCollection !== void 0 ? "PATCH" : "PUT";
|
|
22498
22771
|
let current;
|
|
22499
22772
|
try {
|
|
22500
|
-
current = currentRecord ?? (parentId === void 0 ? await this.getGlobal(id, true, this.config.key === "knowledge_base_categories" || partialCollection !== void 0 ? opts.maxRetries : void 0) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true));
|
|
22773
|
+
current = currentRecord ?? (parentId === void 0 ? await this.getGlobal(id, true, this.config.key === "knowledge_base_categories" || partialCollection !== void 0 ? opts.maxRetries : void 0, partialCollection?.checkedBaseUrl) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true));
|
|
22501
22774
|
} catch (err) {
|
|
22502
22775
|
if (err instanceof NotFoundError) {
|
|
22503
22776
|
const reasons = EMPTY_REASON_STAMPS[this.config.key];
|
|
@@ -22523,7 +22796,7 @@ var MutationBase = class extends MetaBase {
|
|
|
22523
22796
|
throw err;
|
|
22524
22797
|
}
|
|
22525
22798
|
checks.push({ name: "current-record-exists", ok: true });
|
|
22526
|
-
partialCollection
|
|
22799
|
+
if (partialCollection !== void 0) await partialCollection.checkCurrent(current);
|
|
22527
22800
|
if (this.staleObjectCheck(current, opts, operation)) {
|
|
22528
22801
|
checks.push({ name: "stale-check", ok: true });
|
|
22529
22802
|
}
|
|
@@ -22605,34 +22878,34 @@ var BaseResource = class extends MutationBase {
|
|
|
22605
22878
|
};
|
|
22606
22879
|
|
|
22607
22880
|
// src/resources/special/taskPredecessors.ts
|
|
22608
|
-
function
|
|
22881
|
+
function fail4(detail) {
|
|
22609
22882
|
throw new AutotaskConfigError(`task_predecessors: ${detail}`);
|
|
22610
22883
|
}
|
|
22611
22884
|
function numeric(value, field) {
|
|
22612
|
-
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0)
|
|
22885
|
+
if (typeof value !== "number" || !Number.isSafeInteger(value) || value <= 0) fail4(`${field} must be a positive numeric identifier`);
|
|
22613
22886
|
return value;
|
|
22614
22887
|
}
|
|
22615
22888
|
function predecessorParent(value) {
|
|
22616
22889
|
const parent = parseIdentifier(value, "parentId");
|
|
22617
|
-
if (parent === 0)
|
|
22890
|
+
if (parent === 0) fail4("parentId must name a successor task");
|
|
22618
22891
|
return parent;
|
|
22619
22892
|
}
|
|
22620
22893
|
function assertPredecessorBinding(value, parentId, id) {
|
|
22621
|
-
if (!isRecord2(value))
|
|
22622
|
-
if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId)))
|
|
22894
|
+
if (!isRecord2(value)) fail4("the returned record must establish id and successorTaskID parent");
|
|
22895
|
+
if (String(parseIdentifier(value.id, "record.id")) !== String(parseIdentifier(id, "id")) || String(parseIdentifier(value.successorTaskID, "record.successorTaskID")) !== String(predecessorParent(parentId))) fail4("the returned record must match id and successorTaskID parent");
|
|
22623
22896
|
}
|
|
22624
22897
|
function admitTaskPredecessor(data, parentId, creating) {
|
|
22625
22898
|
const parent = predecessorParent(parentId);
|
|
22626
|
-
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data)))
|
|
22899
|
+
if (!isRecord2(data) || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail4("data must be a plain record");
|
|
22627
22900
|
const payload = { ...data };
|
|
22628
22901
|
const allowed = creating ? ["predecessorTaskID", "successorTaskID", "lagDays"] : ["lagDays"];
|
|
22629
|
-
if (Object.keys(payload).some((key) => !allowed.includes(key)))
|
|
22630
|
-
if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647))
|
|
22902
|
+
if (Object.keys(payload).some((key) => !allowed.includes(key))) fail4(creating ? "only predecessorTaskID, successorTaskID and lagDays are writable on create" : "only lagDays can be updated");
|
|
22903
|
+
if ((!creating || payload.lagDays !== void 0) && (typeof payload.lagDays !== "number" || !Number.isInteger(payload.lagDays) || payload.lagDays < -2147483648 || payload.lagDays > 2147483647)) fail4("lagDays must be an int32 integer");
|
|
22631
22904
|
if (creating) {
|
|
22632
22905
|
const successor = numeric(payload.successorTaskID, "successorTaskID");
|
|
22633
22906
|
const predecessor = numeric(payload.predecessorTaskID, "predecessorTaskID");
|
|
22634
|
-
if (String(successor) !== String(parent))
|
|
22635
|
-
if (predecessor === successor)
|
|
22907
|
+
if (String(successor) !== String(parent)) fail4("successorTaskID must match parentId");
|
|
22908
|
+
if (predecessor === successor) fail4("predecessorTaskID and successorTaskID must be distinct");
|
|
22636
22909
|
}
|
|
22637
22910
|
return payload;
|
|
22638
22911
|
}
|
|
@@ -22641,50 +22914,50 @@ async function guardTaskPredecessor(http, parentId, id, data) {
|
|
|
22641
22914
|
let row = data;
|
|
22642
22915
|
if (id !== void 0) {
|
|
22643
22916
|
const target = parseIdentifier(id, "id");
|
|
22644
|
-
if (target === 0)
|
|
22917
|
+
if (target === 0) fail4("id must name a predecessor relationship");
|
|
22645
22918
|
row = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${parent}/Predecessors/${target}`, operation: "task_predecessors.get" }), target, "task_predecessors.get", "task_predecessor");
|
|
22646
22919
|
assertPredecessorBinding(row, parent, target);
|
|
22647
22920
|
}
|
|
22648
22921
|
const predecessor = numeric(row?.predecessorTaskID, "predecessorTaskID");
|
|
22649
22922
|
const successor = numeric(row?.successorTaskID, "successorTaskID");
|
|
22650
|
-
if (predecessor === successor)
|
|
22923
|
+
if (predecessor === successor) fail4("predecessorTaskID and successorTaskID must be distinct");
|
|
22651
22924
|
const projects = [];
|
|
22652
22925
|
for (const taskId of [predecessor, successor]) {
|
|
22653
22926
|
const task = unwrapItem(await http.request({ method: "GET", path: `/V1.0/Tasks/${taskId}`, operation: "tasks.get" }), taskId, "tasks.get", "task");
|
|
22654
|
-
if (String(parseIdentifier(task.id, "task.id")) !== String(taskId))
|
|
22927
|
+
if (String(parseIdentifier(task.id, "task.id")) !== String(taskId)) fail4("the returned task must match its requested id");
|
|
22655
22928
|
projects.push(numeric(task.projectID, "task.projectID"));
|
|
22656
22929
|
}
|
|
22657
|
-
if (projects[0] !== projects[1])
|
|
22930
|
+
if (projects[0] !== projects[1]) fail4("predecessor and successor tasks must belong to the same project");
|
|
22658
22931
|
}
|
|
22659
22932
|
|
|
22660
22933
|
// src/resources/special/taskNotes.ts
|
|
22661
22934
|
var WRITABLE = /* @__PURE__ */ new Set(["id", "itemId", "createdByContactID", "description", "noteType", "publish", "taskID", "title"]);
|
|
22662
22935
|
function admitTaskNote(data, parentId, creating) {
|
|
22663
22936
|
const parent = parseIdentifier(parentId, "parentId");
|
|
22664
|
-
const
|
|
22937
|
+
const fail5 = (message) => {
|
|
22665
22938
|
throw new AutotaskConfigError(`task_notes: ${message}`);
|
|
22666
22939
|
};
|
|
22667
|
-
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
22940
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) fail5("data must be a record");
|
|
22668
22941
|
const body = data;
|
|
22669
|
-
for (const key of Object.keys(body)) if (!WRITABLE.has(key))
|
|
22942
|
+
for (const key of Object.keys(body)) if (!WRITABLE.has(key)) fail5(`${key} is not a writable TaskNotes field`);
|
|
22670
22943
|
for (const [field, maximum] of [["description", 3200], ["title", 250]]) {
|
|
22671
22944
|
const value = body[field];
|
|
22672
|
-
if (value !== void 0 && (typeof value !== "string" || value.length > maximum))
|
|
22945
|
+
if (value !== void 0 && (typeof value !== "string" || value.length > maximum)) fail5(`${field} must be a string of at most ${maximum} characters`);
|
|
22673
22946
|
}
|
|
22674
|
-
if (creating && (typeof body.description !== "string" || body.description.trim() === ""))
|
|
22947
|
+
if (creating && (typeof body.description !== "string" || body.description.trim() === "")) fail5("description is required");
|
|
22675
22948
|
for (const field of ["noteType", "publish"]) {
|
|
22676
22949
|
const value = body[field];
|
|
22677
|
-
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value)))
|
|
22950
|
+
if ((creating || value !== void 0) && (typeof value !== "number" || !Number.isSafeInteger(value))) fail5(`${field} must be an integer from the current field metadata`);
|
|
22678
22951
|
}
|
|
22679
|
-
if (creating && body.taskID === void 0)
|
|
22952
|
+
if (creating && body.taskID === void 0) fail5("taskID is required in the create body and must match parentId");
|
|
22680
22953
|
for (const field of ["createdByContactID", "taskID"]) {
|
|
22681
22954
|
if (body[field] !== void 0) {
|
|
22682
|
-
if (typeof body[field] !== "number")
|
|
22955
|
+
if (typeof body[field] !== "number") fail5(`${field} must be a numeric identifier`);
|
|
22683
22956
|
const id = parseIdentifier(body[field], field);
|
|
22684
|
-
if (field === "taskID" && String(id) !== String(parent))
|
|
22957
|
+
if (field === "taskID" && String(id) !== String(parent)) fail5("taskID must match the parentId path argument");
|
|
22685
22958
|
}
|
|
22686
22959
|
}
|
|
22687
|
-
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId"))
|
|
22960
|
+
if (!creating && !Object.keys(body).some((key) => key !== "id" && key !== "itemId")) fail5("update must contain a writable field");
|
|
22688
22961
|
}
|
|
22689
22962
|
|
|
22690
22963
|
// src/operations/invoke/fieldSuggest.ts
|
|
@@ -22819,8 +23092,8 @@ function collectFilterFieldNames(conditions, resourceKey, operation = `${resourc
|
|
|
22819
23092
|
continue;
|
|
22820
23093
|
}
|
|
22821
23094
|
if (resourceKey !== void 0) {
|
|
22822
|
-
const
|
|
22823
|
-
if (
|
|
23095
|
+
const own2 = normalizeOwnField(resourceKey, cond.field);
|
|
23096
|
+
if (own2 !== cond.field) out.push(own2);
|
|
22824
23097
|
}
|
|
22825
23098
|
}
|
|
22826
23099
|
}
|
|
@@ -22912,6 +23185,7 @@ async function validateQueryFieldNames(record, holder, args) {
|
|
|
22912
23185
|
let filterNames;
|
|
22913
23186
|
if (bag["filter"] !== void 0) {
|
|
22914
23187
|
const conditions = normalizedConditions(bag["filter"]);
|
|
23188
|
+
assertSupportedUdfConditions(conditions, record.id);
|
|
22915
23189
|
filterNames = collectFilterFieldNames(conditions ?? [], record.resource, record.id);
|
|
22916
23190
|
}
|
|
22917
23191
|
if (fieldCheck === false) return;
|
|
@@ -22954,38 +23228,38 @@ function isBase64(value) {
|
|
|
22954
23228
|
}
|
|
22955
23229
|
function admitTaskAttachment(data, parentId) {
|
|
22956
23230
|
const parent = parseIdentifier(parentId, "parentId");
|
|
22957
|
-
const
|
|
23231
|
+
const fail5 = (message) => {
|
|
22958
23232
|
throw new AutotaskConfigError(`task_attachments: ${message}`);
|
|
22959
23233
|
};
|
|
22960
|
-
if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data)))
|
|
23234
|
+
if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
|
|
22961
23235
|
const body = data;
|
|
22962
|
-
for (const field of Object.keys(body)) if (!WRITABLE2.has(field))
|
|
23236
|
+
for (const field of Object.keys(body)) if (!WRITABLE2.has(field)) fail5(`${field} is not a supported create field`);
|
|
22963
23237
|
for (const field of ["attachmentType", "fullPath", "title"]) {
|
|
22964
|
-
if (typeof body[field] !== "string" || body[field].trim() === "")
|
|
23238
|
+
if (typeof body[field] !== "string" || body[field].trim() === "") fail5(`${field} is required and must be a non-empty string`);
|
|
22965
23239
|
}
|
|
22966
|
-
if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish))
|
|
23240
|
+
if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail5("publish must be an integer from current field metadata");
|
|
22967
23241
|
for (const field of ["data", "contentType"]) {
|
|
22968
|
-
if (body[field] !== void 0 && typeof body[field] !== "string")
|
|
23242
|
+
if (body[field] !== void 0 && typeof body[field] !== "string") fail5(`${field} must be a string`);
|
|
22969
23243
|
}
|
|
22970
23244
|
if (body.attachmentType === "FILE_ATTACHMENT") {
|
|
22971
|
-
if (typeof body.data !== "string" || body.data === "") return
|
|
22972
|
-
if (!isBase64(body.data))
|
|
23245
|
+
if (typeof body.data !== "string" || body.data === "") return fail5("FILE_ATTACHMENT requires non-empty base64 data");
|
|
23246
|
+
if (!isBase64(body.data)) fail5("FILE_ATTACHMENT data must be base64 encoded");
|
|
22973
23247
|
}
|
|
22974
23248
|
if (body.taskID !== void 0) {
|
|
22975
|
-
if (typeof body.taskID !== "number")
|
|
22976
|
-
if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent))
|
|
23249
|
+
if (typeof body.taskID !== "number") fail5("taskID must be a numeric identifier");
|
|
23250
|
+
if (String(parseIdentifier(body.taskID, "taskID")) !== String(parent)) fail5("taskID must match the parentId path argument");
|
|
22977
23251
|
}
|
|
22978
23252
|
if (body.parentAttachmentID !== void 0) {
|
|
22979
|
-
if (typeof body.parentAttachmentID !== "number")
|
|
23253
|
+
if (typeof body.parentAttachmentID !== "number") fail5("parentAttachmentID must be a numeric identifier");
|
|
22980
23254
|
parseIdentifier(body.parentAttachmentID, "parentAttachmentID");
|
|
22981
23255
|
}
|
|
22982
23256
|
}
|
|
22983
23257
|
function admitFileAttachment(resource, data, parentId) {
|
|
22984
23258
|
parseIdentifier(parentId, "parentId");
|
|
22985
|
-
const
|
|
23259
|
+
const fail5 = (message) => {
|
|
22986
23260
|
throw new AutotaskConfigError(`${resource}: ${message}`);
|
|
22987
23261
|
};
|
|
22988
|
-
if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data)))
|
|
23262
|
+
if (data === null || typeof data !== "object" || ![Object.prototype, null].includes(Object.getPrototypeOf(data))) fail5("data must be a plain record");
|
|
22989
23263
|
const body = data;
|
|
22990
23264
|
const reference2 = {
|
|
22991
23265
|
project_attachments: void 0,
|
|
@@ -22998,20 +23272,20 @@ function admitFileAttachment(resource, data, parentId) {
|
|
|
22998
23272
|
configuration_item_attachments: "parentAttachmentID",
|
|
22999
23273
|
configuration_item_note_attachments: void 0
|
|
23000
23274
|
}[resource];
|
|
23001
|
-
for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2)
|
|
23002
|
-
if (body.attachmentType !== "FILE_ATTACHMENT")
|
|
23275
|
+
for (const field of Object.keys(body)) if (!FILE_WRITABLE.has(field) && field !== reference2) fail5(`${field} is not a supported create field`);
|
|
23276
|
+
if (body.attachmentType !== "FILE_ATTACHMENT") fail5("attachmentType must explicitly be FILE_ATTACHMENT; other attachment types are unsupported");
|
|
23003
23277
|
const maxLength = resource === "project_attachments" ? void 0 : 255;
|
|
23004
23278
|
for (const field of ["fullPath", "title"]) {
|
|
23005
23279
|
const value = body[field];
|
|
23006
23280
|
const requirement = `${field} is required and must be a nonblank string${maxLength === void 0 ? "" : ` of at most ${maxLength} characters`}`;
|
|
23007
|
-
if (typeof value !== "string" || value.trim() === "") return
|
|
23008
|
-
if (maxLength !== void 0 && value.length > maxLength)
|
|
23281
|
+
if (typeof value !== "string" || value.trim() === "") return fail5(requirement);
|
|
23282
|
+
if (maxLength !== void 0 && value.length > maxLength) fail5(requirement);
|
|
23009
23283
|
}
|
|
23010
|
-
if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish))
|
|
23011
|
-
if (typeof body.data !== "string" || !isBase64(body.data))
|
|
23284
|
+
if (typeof body.publish !== "number" || !Number.isSafeInteger(body.publish)) fail5("publish must be an integer from current field metadata");
|
|
23285
|
+
if (typeof body.data !== "string" || !isBase64(body.data)) fail5("FILE_ATTACHMENT requires nonempty base64 data");
|
|
23012
23286
|
if (reference2 !== void 0 && body[reference2] !== void 0) {
|
|
23013
|
-
if (typeof body[reference2] !== "number")
|
|
23014
|
-
if (parseIdentifier(body[reference2], reference2) === 0)
|
|
23287
|
+
if (typeof body[reference2] !== "number") fail5(`${reference2} must be a numeric identifier`);
|
|
23288
|
+
if (parseIdentifier(body[reference2], reference2) === 0) fail5(`${reference2} must be positive`);
|
|
23015
23289
|
}
|
|
23016
23290
|
}
|
|
23017
23291
|
function admitScopedAttachmentQuery(resource, params) {
|
|
@@ -23860,6 +24134,26 @@ var SIMPLE_RESOURCES = [
|
|
|
23860
24134
|
helpers: { search: false, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
23861
24135
|
opForms: { get: "scoped", create: "scoped", update: "scoped", delete: "scoped" }
|
|
23862
24136
|
},
|
|
24137
|
+
{
|
|
24138
|
+
key: "internal_locations",
|
|
24139
|
+
accessor: "internalLocations",
|
|
24140
|
+
resourcePath: "/V1.0/InternalLocations",
|
|
24141
|
+
deletable: false,
|
|
24142
|
+
udfCapable: false,
|
|
24143
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
24144
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
24145
|
+
opForms: { get: "global" }
|
|
24146
|
+
},
|
|
24147
|
+
{
|
|
24148
|
+
key: "inventory_items",
|
|
24149
|
+
accessor: "inventoryItems",
|
|
24150
|
+
resourcePath: "/V1.0/InventoryItems",
|
|
24151
|
+
deletable: false,
|
|
24152
|
+
udfCapable: false,
|
|
24153
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: true, update: true, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
24154
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
24155
|
+
opForms: { get: "global", create: "global", update: "global" }
|
|
24156
|
+
},
|
|
23863
24157
|
{
|
|
23864
24158
|
key: "inventory_locations",
|
|
23865
24159
|
accessor: "inventoryLocations",
|
|
@@ -24358,6 +24652,16 @@ var SIMPLE_RESOURCES = [
|
|
|
24358
24652
|
helpers: { search: true, resolve: true, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
24359
24653
|
opForms: { get: "global", create: "global", update: "global" }
|
|
24360
24654
|
},
|
|
24655
|
+
{
|
|
24656
|
+
key: "shipping_types",
|
|
24657
|
+
accessor: "shippingTypes",
|
|
24658
|
+
resourcePath: "/V1.0/ShippingTypes",
|
|
24659
|
+
deletable: false,
|
|
24660
|
+
udfCapable: false,
|
|
24661
|
+
ops: { query: true, queryAll: false, count: true, get: true, create: false, update: false, delete: false, getEntityInfo: true, getFieldInfo: true, getUdfInfo: true },
|
|
24662
|
+
helpers: { search: false, resolve: false, getContext: false, createIfNotExists: false, attachToDocument: false, findBy: [] },
|
|
24663
|
+
opForms: { get: "global" }
|
|
24664
|
+
},
|
|
24361
24665
|
{
|
|
24362
24666
|
key: "skills",
|
|
24363
24667
|
accessor: "skills",
|
|
@@ -24765,7 +25069,7 @@ var GenericResource = class extends BaseResource {
|
|
|
24765
25069
|
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 () => {
|
|
24766
25070
|
throw new OperationNotSupportedError(config.key, "getUdfInfo");
|
|
24767
25071
|
};
|
|
24768
|
-
if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles", "inventory_locations"].includes(config.key)) this.createIfNotExists = async () => {
|
|
25072
|
+
if (config.ops?.create === false || isScopedAttachmentResource(config.key) || ["company_attachments", "task_predecessors", "knowledge_base_articles", "inventory_locations", "inventory_items"].includes(config.key)) this.createIfNotExists = async () => {
|
|
24769
25073
|
throw new OperationNotSupportedError(config.key, "createIfNotExists");
|
|
24770
25074
|
};
|
|
24771
25075
|
if (config.key === "knowledge_base_categories") {
|
|
@@ -24880,6 +25184,20 @@ var GenericResource = class extends BaseResource {
|
|
|
24880
25184
|
return this.createScopedRaw(parentId, data2, opts2);
|
|
24881
25185
|
}
|
|
24882
25186
|
if (this.config.opForms?.create === "scoped") throw new OperationNotSupportedError(this.config.key, "create");
|
|
25187
|
+
if (this.config.key === "inventory_items") {
|
|
25188
|
+
const body = admitInventoryItem(a, true);
|
|
25189
|
+
const opts2 = snapshotInventoryItemOptions(b);
|
|
25190
|
+
const checkedBaseUrl = this.http.baseUrl;
|
|
25191
|
+
try {
|
|
25192
|
+
await guardInventoryItemCreate(this.http, body, checkedBaseUrl, opts2.maxRetries);
|
|
25193
|
+
} catch (error) {
|
|
25194
|
+
if (error instanceof AutotaskError) Object.assign(error, { notSent: true });
|
|
25195
|
+
throw error;
|
|
25196
|
+
}
|
|
25197
|
+
if (opts2.dryRun === true) return this.runCreateDryRun(body);
|
|
25198
|
+
const result = await this.createGlobal(body, opts2, checkedBaseUrl);
|
|
25199
|
+
return this.withPersistedCheck(result, body, opts2, result.id, void 0, checkedBaseUrl);
|
|
25200
|
+
}
|
|
24883
25201
|
const data = this.config.key === "knowledge_base_categories" ? admitKnowledgeBaseCategory(a, true) : this.config.key === "inventory_locations" ? admitInventoryLocation(a, true) : a;
|
|
24884
25202
|
const supplied = b;
|
|
24885
25203
|
const opts = ["knowledge_base_categories", "inventory_locations"].includes(this.config.key) ? snapshotMutationOptions(supplied) : supplied ?? {};
|
|
@@ -24908,6 +25226,21 @@ var GenericResource = class extends BaseResource {
|
|
|
24908
25226
|
return this.updateScopedRaw(parentId, id2, data2, opts2);
|
|
24909
25227
|
}
|
|
24910
25228
|
if (this.config.opForms?.update === "scoped") throw new OperationNotSupportedError(this.config.key, "update");
|
|
25229
|
+
if (this.config.key === "inventory_items") {
|
|
25230
|
+
const id2 = inventoryItemId(a);
|
|
25231
|
+
const body = admitInventoryItem(b, false);
|
|
25232
|
+
const opts2 = snapshotInventoryItemOptions(c);
|
|
25233
|
+
const checkedBaseUrl = this.http.baseUrl;
|
|
25234
|
+
const checkCurrent = (current) => checkInventoryItemCurrent(this.http, body, current, id2, checkedBaseUrl, opts2.maxRetries);
|
|
25235
|
+
if (opts2.dryRun === true) return this.runUpdateDryRun(id2, body, opts2, void 0, void 0, { checkCurrent, checkedBaseUrl });
|
|
25236
|
+
try {
|
|
25237
|
+
await checkCurrent(await this.getGlobal(id2, true, opts2.maxRetries, checkedBaseUrl));
|
|
25238
|
+
} catch (error) {
|
|
25239
|
+
if (error instanceof AutotaskError) Object.assign(error, { notSent: true });
|
|
25240
|
+
throw error;
|
|
25241
|
+
}
|
|
25242
|
+
return this.updateGlobal(id2, body, opts2, "PATCH", checkedBaseUrl);
|
|
25243
|
+
}
|
|
24911
25244
|
const category = this.config.key === "knowledge_base_categories";
|
|
24912
25245
|
const location = this.config.key === "inventory_locations";
|
|
24913
25246
|
const id = category || location ? parseIdentifier(a, "id") : a;
|
|
@@ -26619,7 +26952,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
26619
26952
|
var queryResourceKeysPromise = null;
|
|
26620
26953
|
function queryResourceKeys() {
|
|
26621
26954
|
if (queryResourceKeysPromise === null) {
|
|
26622
|
-
queryResourceKeysPromise =
|
|
26955
|
+
queryResourceKeysPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => {
|
|
26623
26956
|
const s = /* @__PURE__ */ new Set();
|
|
26624
26957
|
for (const rec of records) if (rec.operation === "query") s.add(rec.resource);
|
|
26625
26958
|
return s;
|
|
@@ -26741,7 +27074,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
26741
27074
|
return { top, limit };
|
|
26742
27075
|
}
|
|
26743
27076
|
async function checkFieldNames(resourceKey, conditions, opts, problems) {
|
|
26744
|
-
const records = resourceKey === void 0 ? [] : await
|
|
27077
|
+
const records = resourceKey === void 0 ? [] : await chunkQXJQIZCT_cjs.loadCapabilityRecords();
|
|
26745
27078
|
const record = resourceKey === void 0 ? void 0 : records.find((r) => r.resource === resourceKey && r.operation === "query");
|
|
26746
27079
|
if (record === void 0) return void 0;
|
|
26747
27080
|
const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
|
|
@@ -26850,6 +27183,7 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
26850
27183
|
const labelled = !label || v.groupBy.length === 0 ? void 0 : await labelRows(client, v.resourceKey, top.map((g) => g.key));
|
|
26851
27184
|
const result = {
|
|
26852
27185
|
mode: v.groupBy.length > 0 ? "group" : "sum",
|
|
27186
|
+
...v.resourceKey === "inventory_items" ? { resource: v.resourceKey } : {},
|
|
26853
27187
|
groups: top.map((g, i) => ({ key: labelled?.rows[i] ?? g.key, count: g.count, ...g.sums !== void 0 ? { sums: g.sums } : {} })),
|
|
26854
27188
|
totalGroups: sorted.length,
|
|
26855
27189
|
groupsTruncated: sorted.length > top.length,
|
|
@@ -27236,7 +27570,7 @@ async function uiLink(client, input) {
|
|
|
27236
27570
|
var indexPromise = null;
|
|
27237
27571
|
function operationIndex() {
|
|
27238
27572
|
if (indexPromise === null) {
|
|
27239
|
-
indexPromise =
|
|
27573
|
+
indexPromise = chunkQXJQIZCT_cjs.loadCapabilityRecords().then((records) => new Map(records.map((r) => [r.id, r])));
|
|
27240
27574
|
}
|
|
27241
27575
|
return indexPromise;
|
|
27242
27576
|
}
|
|
@@ -27249,15 +27583,32 @@ async function sanitiseResult(client, result, operation) {
|
|
|
27249
27583
|
{ suggestedAction: "Pass the operation key the result came from \u2014 the registry id, not the resource key." }
|
|
27250
27584
|
);
|
|
27251
27585
|
}
|
|
27252
|
-
const
|
|
27586
|
+
const records = await operationIndex();
|
|
27587
|
+
const record = records.get(operation);
|
|
27253
27588
|
if (record === void 0) {
|
|
27254
27589
|
throw new AutotaskConfigError(
|
|
27255
27590
|
`sanitiseResult: unknown operation "${operation.slice(0, 60)}" \u2014 it is not in the capability registry`,
|
|
27256
27591
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
27257
27592
|
);
|
|
27258
27593
|
}
|
|
27259
|
-
const
|
|
27260
|
-
|
|
27594
|
+
const names = record.metadata.untrustedFields;
|
|
27595
|
+
const fields = Array.isArray(names) ? names : [];
|
|
27596
|
+
const inventoryAggregate = operation === "operations.aggregate" && result.resource === "inventory_items";
|
|
27597
|
+
const projected = chunkCM5O672I_cjs.deepMarkUntrusted(result, inventoryAggregate ? [...fields, "referenceNumber"] : fields);
|
|
27598
|
+
if (operation === "operations.searchAcrossResources") return wrapReferenceRows(projected, "matches");
|
|
27599
|
+
if (operation === "operations.fetchByIds") return wrapReferenceRows(projected, "value");
|
|
27600
|
+
if (operation === "operations.resolveAny") {
|
|
27601
|
+
const wrapped = wrapReferenceRows(projected, "value");
|
|
27602
|
+
return isRecord2(wrapped.contains) ? { ...wrapped, contains: wrapReferenceRows(wrapped.contains, "matches") } : wrapped;
|
|
27603
|
+
}
|
|
27604
|
+
return projected;
|
|
27605
|
+
}
|
|
27606
|
+
function wrapReferenceRows(result, field) {
|
|
27607
|
+
if (!Array.isArray(result.results)) return result;
|
|
27608
|
+
return { ...result, results: result.results.map((row) => {
|
|
27609
|
+
if (!isRecord2(row) || typeof row.resource !== "string" || !Object.hasOwn(row, field) || !row.resource.split("_").every(Boolean) || camelKey(row.resource) !== "inventoryItems") return row;
|
|
27610
|
+
return { ...row, [field]: chunkCM5O672I_cjs.deepMarkUntrusted(row[field], ["referenceNumber"]) };
|
|
27611
|
+
}) };
|
|
27261
27612
|
}
|
|
27262
27613
|
|
|
27263
27614
|
// src/resources/special/invoices.ts
|
|
@@ -28660,18 +29011,18 @@ async function fetchExpenses(ctx, join, entries) {
|
|
|
28660
29011
|
const gaps = [...task.gaps];
|
|
28661
29012
|
const timeTruncated = ctx.truncatedMonths["timeEntries"];
|
|
28662
29013
|
if (timeTruncated !== void 0 && timeTruncated.length > 0) gaps.push(`time entries truncated in ${timeTruncated.join(", ")}, so a no-contract ticket or task their missing rows reference is not joined`);
|
|
28663
|
-
const
|
|
29014
|
+
const own2 = [
|
|
28664
29015
|
...tasks.ids.length > 0 ? [{ field: "taskID", op: "in", value: tasks.ids }] : [],
|
|
28665
29016
|
...task.projectIds.length > 0 ? [{ field: "projectID", op: "in", value: task.projectIds }] : []
|
|
28666
29017
|
];
|
|
28667
29018
|
const orOf = (keys) => [keys.length === 1 ? keys[0] : { op: "or", items: keys }, ...ctx.windowOn("expenseDate")];
|
|
28668
|
-
const expCond = orOf([{ field: "ticketID", op: "exist" }, ...
|
|
29019
|
+
const expCond = orOf([{ field: "ticketID", op: "exist" }, ...own2]);
|
|
28669
29020
|
const shared = ctx.sharedExpenses;
|
|
28670
29021
|
let raw;
|
|
28671
|
-
if (shared &&
|
|
29022
|
+
if (shared && own2.length === 0) {
|
|
28672
29023
|
raw = { items: [], capped: false, hasMore: false };
|
|
28673
29024
|
} else {
|
|
28674
|
-
const read = await ctx.windowedPart("expenses", "expense_items", "/V1.0/ExpenseItems/query", shared ? orOf(
|
|
29025
|
+
const read = await ctx.windowedPart("expenses", "expense_items", "/V1.0/ExpenseItems/query", shared ? orOf(own2) : expCond, EXPENSE_FIELDS, "expenseDate", EXPENSE_PAGE);
|
|
28675
29026
|
raw = read.part;
|
|
28676
29027
|
raw.items = read.rows;
|
|
28677
29028
|
}
|
|
@@ -29572,16 +29923,16 @@ function latchingHttp(raw, spend) {
|
|
|
29572
29923
|
}
|
|
29573
29924
|
};
|
|
29574
29925
|
observeRecordReadFailures(http, latch);
|
|
29575
|
-
const
|
|
29926
|
+
const fail5 = (err) => {
|
|
29576
29927
|
latch(err);
|
|
29577
29928
|
throw err;
|
|
29578
29929
|
};
|
|
29579
29930
|
http.request = (o) => {
|
|
29580
29931
|
if (fatal) throw fatal;
|
|
29581
29932
|
try {
|
|
29582
|
-
return counted.request({ ...o, signal: o.signal ?? signal }).catch(
|
|
29933
|
+
return counted.request({ ...o, signal: o.signal ?? signal }).catch(fail5);
|
|
29583
29934
|
} catch (err) {
|
|
29584
|
-
return
|
|
29935
|
+
return fail5(err);
|
|
29585
29936
|
}
|
|
29586
29937
|
};
|
|
29587
29938
|
return { http, fatal: () => fatal, signal };
|