node-autotask 0.12.1 → 0.14.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/ARCHITECTURE.md +36 -7
- package/MCP_TOOL_CATALOG.json +4 -3
- package/MCP_TOOL_MANIFEST.md +5 -5
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/README.md +6 -5
- package/capabilities.json +3537 -4144
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +8 -4
- package/dist/capabilities.d.ts +8 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-PPTAMCFA.js → chunk-2ZZOTJ2C.js} +2 -2
- package/dist/{chunk-36PG2IU2.cjs → chunk-5QMXECLN.cjs} +594 -574
- package/dist/{chunk-CSRCMBZ2.cjs → chunk-EWMG3HHU.cjs} +3536 -4143
- package/dist/{chunk-PGQIGE63.cjs → chunk-FCJUM42E.cjs} +135 -135
- package/dist/{chunk-P35GFG2H.js → chunk-IYN2BHVW.js} +172 -152
- package/dist/{chunk-NACI2NDF.js → chunk-JIDR3NPV.js} +3536 -4143
- package/dist/{chunk-ZOA5HUFX.js → chunk-KA6UU26H.js} +35 -23
- package/dist/{chunk-IHRXVIUU.cjs → chunk-XSIY3WRR.cjs} +40 -28
- package/dist/{index-DZfd9Gt7.d.cts → index-oiwPuJOG.d.cts} +100 -36
- package/dist/{index-UilX3PFL.d.ts → index-zt1KXThi.d.ts} +100 -36
- package/dist/index.cjs +62 -20
- package/dist/index.d.cts +83 -3
- package/dist/index.d.ts +83 -3
- package/dist/index.js +47 -5
- package/dist/operations/index.cjs +110 -107
- package/dist/operations/index.d.cts +9 -2
- package/dist/operations/index.d.ts +9 -2
- package/dist/operations/index.js +9 -6
- package/dist/pool.cjs +8 -8
- 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 +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/dist/untrusted.cjs +3 -1
- package/dist/untrusted.d.cts +9 -4
- package/dist/untrusted.d.ts +9 -4
- package/dist/untrusted.js +3 -1
- package/docs/API.md +146 -28
- package/docs/LIVE-TESTING.md +1 -1
- package/package.json +2 -2
|
@@ -33,10 +33,10 @@ import {
|
|
|
33
33
|
unwrapItem,
|
|
34
34
|
unwrapItems,
|
|
35
35
|
unwrapOperation
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-KA6UU26H.js";
|
|
37
37
|
import {
|
|
38
38
|
CAPABILITIES
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-JIDR3NPV.js";
|
|
40
40
|
|
|
41
41
|
// src/resources/appointments.ts
|
|
42
42
|
var AppointmentsResource = class extends BaseResource {
|
|
@@ -92,7 +92,7 @@ var AppointmentsResource = class extends BaseResource {
|
|
|
92
92
|
async delete(id, opts = {}) {
|
|
93
93
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
94
94
|
await this.guardStaleBeforeMutation(id, opts, "appointments.delete");
|
|
95
|
-
return this.deleteGlobal(id);
|
|
95
|
+
return this.deleteGlobal(id, opts);
|
|
96
96
|
}
|
|
97
97
|
/** Resolve a Appointment from a numeric id (or, where the vendor indexes a primary text field,
|
|
98
98
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -626,7 +626,7 @@ var ChangeRequestLinksResource = class extends BaseResource {
|
|
|
626
626
|
async delete(id, opts = {}) {
|
|
627
627
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
628
628
|
await this.guardStaleBeforeMutation(id, opts, "change_request_links.delete");
|
|
629
|
-
return this.deleteGlobal(id);
|
|
629
|
+
return this.deleteGlobal(id, opts);
|
|
630
630
|
}
|
|
631
631
|
/** Resolve a ChangeRequestLink from a numeric id (or, where the vendor indexes a primary text field,
|
|
632
632
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -696,7 +696,7 @@ var ChecklistLibrariesResource = class extends BaseResource {
|
|
|
696
696
|
async delete(id, opts = {}) {
|
|
697
697
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
698
698
|
await this.guardStaleBeforeMutation(id, opts, "checklist_libraries.delete");
|
|
699
|
-
return this.deleteGlobal(id);
|
|
699
|
+
return this.deleteGlobal(id, opts);
|
|
700
700
|
}
|
|
701
701
|
/** Resolve a ChecklistLibrary from a numeric id (or, where the vendor indexes a primary text field,
|
|
702
702
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -759,14 +759,14 @@ var ChecklistLibraryChecklistItemsResource = class extends BaseResource {
|
|
|
759
759
|
async update(parentId, id, data, opts = {}) {
|
|
760
760
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
761
761
|
await this.guardStaleBeforeMutation(id, opts, "checklist_library_checklist_items.update", parentId);
|
|
762
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
762
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
763
763
|
}
|
|
764
764
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
765
765
|
* envelope and never issues the delete. */
|
|
766
766
|
async delete(parentId, id, opts = {}) {
|
|
767
767
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
768
768
|
await this.guardStaleBeforeMutation(id, opts, "checklist_library_checklist_items.delete", parentId);
|
|
769
|
-
return this.deleteScopedRaw(parentId, id);
|
|
769
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
770
770
|
}
|
|
771
771
|
/** Resolve a ChecklistLibraryChecklistItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
772
772
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -1114,7 +1114,7 @@ async function upsertByName(resource, companyName, params, opts, http) {
|
|
|
1114
1114
|
let merges = 0;
|
|
1115
1115
|
for (; ; ) {
|
|
1116
1116
|
try {
|
|
1117
|
-
const created = await resource.create(body, {});
|
|
1117
|
+
const created = await resource.create(body, { maxRetries: opts.maxRetries });
|
|
1118
1118
|
return {
|
|
1119
1119
|
id: created.id,
|
|
1120
1120
|
created: true,
|
|
@@ -1762,14 +1762,14 @@ var CompanyAlertsResource = class extends BaseResource {
|
|
|
1762
1762
|
async update(parentId, id, data, opts = {}) {
|
|
1763
1763
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
1764
1764
|
await this.guardStaleBeforeMutation(id, opts, "company_alerts.update", parentId);
|
|
1765
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
1765
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
1766
1766
|
}
|
|
1767
1767
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
1768
1768
|
* envelope and never issues the delete. */
|
|
1769
1769
|
async delete(parentId, id, opts = {}) {
|
|
1770
1770
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
1771
1771
|
await this.guardStaleBeforeMutation(id, opts, "company_alerts.delete", parentId);
|
|
1772
|
-
return this.deleteScopedRaw(parentId, id);
|
|
1772
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
1773
1773
|
}
|
|
1774
1774
|
/** Resolve a CompanyAlert from a numeric id (or, where the vendor indexes a primary text field,
|
|
1775
1775
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -1829,14 +1829,14 @@ var CompanyLocationsResource = class extends BaseResource {
|
|
|
1829
1829
|
async update(parentId, id, data, opts = {}) {
|
|
1830
1830
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
1831
1831
|
await this.guardStaleBeforeMutation(id, opts, "company_locations.update", parentId);
|
|
1832
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
1832
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
1833
1833
|
}
|
|
1834
1834
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
1835
1835
|
* envelope and never issues the delete. */
|
|
1836
1836
|
async delete(parentId, id, opts = {}) {
|
|
1837
1837
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
1838
1838
|
await this.guardStaleBeforeMutation(id, opts, "company_locations.delete", parentId);
|
|
1839
|
-
return this.deleteScopedRaw(parentId, id);
|
|
1839
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
1840
1840
|
}
|
|
1841
1841
|
/** Resolve a CompanyLocation from a numeric id (or, where the vendor indexes a primary text field,
|
|
1842
1842
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -1901,7 +1901,7 @@ var CompanyNotesResource = class extends BaseResource {
|
|
|
1901
1901
|
async update(parentId, id, data, opts = {}) {
|
|
1902
1902
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
1903
1903
|
await this.guardStaleBeforeMutation(id, opts, "company_notes.update", parentId);
|
|
1904
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
1904
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
1905
1905
|
}
|
|
1906
1906
|
/** Resolve a CompanyNote from a numeric id (or, where the vendor indexes a primary text field,
|
|
1907
1907
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -1956,7 +1956,7 @@ var CompanySiteConfigurationsResource = class extends BaseResource {
|
|
|
1956
1956
|
async update(parentId, id, data, opts = {}) {
|
|
1957
1957
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
1958
1958
|
await this.guardStaleBeforeMutation(id, opts, "company_site_configurations.update", parentId);
|
|
1959
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
1959
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
1960
1960
|
}
|
|
1961
1961
|
/** Resolve a CompanySiteConfigurations from a numeric id (or, where the vendor indexes a primary text field,
|
|
1962
1962
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2028,7 +2028,7 @@ var CompanyWebhooksResource = class extends BaseResource {
|
|
|
2028
2028
|
async delete(id, opts = {}) {
|
|
2029
2029
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
2030
2030
|
await this.guardStaleBeforeMutation(id, opts, "company_webhooks.delete");
|
|
2031
|
-
return this.deleteGlobal(id);
|
|
2031
|
+
return this.deleteGlobal(id, opts);
|
|
2032
2032
|
}
|
|
2033
2033
|
/** Resolve a CompanyWebhook from a numeric id (or, where the vendor indexes a primary text field,
|
|
2034
2034
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -2091,14 +2091,14 @@ var ConfigurationItemBillingProductAssociationsResource = class extends BaseReso
|
|
|
2091
2091
|
async update(parentId, id, data, opts = {}) {
|
|
2092
2092
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
2093
2093
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_billing_product_associations.update", parentId);
|
|
2094
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
2094
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
2095
2095
|
}
|
|
2096
2096
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
2097
2097
|
* envelope and never issues the delete. */
|
|
2098
2098
|
async delete(parentId, id, opts = {}) {
|
|
2099
2099
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
2100
2100
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_billing_product_associations.delete", parentId);
|
|
2101
|
-
return this.deleteScopedRaw(parentId, id);
|
|
2101
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
2102
2102
|
}
|
|
2103
2103
|
/** Resolve a ConfigurationItemBillingProductAssociations from a numeric id (or, where the vendor indexes a primary text field,
|
|
2104
2104
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2224,14 +2224,14 @@ var ConfigurationItemCategoryUdfAssociationsResource = class extends BaseResourc
|
|
|
2224
2224
|
async update(parentId, id, data, opts = {}) {
|
|
2225
2225
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
2226
2226
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_category_udf_associations.update", parentId);
|
|
2227
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
2227
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
2228
2228
|
}
|
|
2229
2229
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
2230
2230
|
* envelope and never issues the delete. */
|
|
2231
2231
|
async delete(parentId, id, opts = {}) {
|
|
2232
2232
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
2233
2233
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_category_udf_associations.delete", parentId);
|
|
2234
|
-
return this.deleteScopedRaw(parentId, id);
|
|
2234
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
2235
2235
|
}
|
|
2236
2236
|
/** Resolve a ConfigurationItemCategoryUdfAssociation from a numeric id (or, where the vendor indexes a primary text field,
|
|
2237
2237
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2280,7 +2280,7 @@ var ConfigurationItemDnsRecordsResource = class extends BaseResource {
|
|
|
2280
2280
|
async delete(parentId, id, opts = {}) {
|
|
2281
2281
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
2282
2282
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_dns_records.delete", parentId);
|
|
2283
|
-
return this.deleteScopedRaw(parentId, id);
|
|
2283
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
2284
2284
|
}
|
|
2285
2285
|
/** Resolve a ConfigurationItemDnsRecord from a numeric id (or, where the vendor indexes a primary text field,
|
|
2286
2286
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2339,7 +2339,7 @@ var ConfigurationItemNotesResource = class extends BaseResource {
|
|
|
2339
2339
|
async update(parentId, id, data, opts = {}) {
|
|
2340
2340
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
2341
2341
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_notes.update", parentId);
|
|
2342
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
2342
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
2343
2343
|
}
|
|
2344
2344
|
/** Resolve a ConfigurationItemNote from a numeric id (or, where the vendor indexes a primary text field,
|
|
2345
2345
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2396,7 +2396,7 @@ var ConfigurationItemRelatedItemsResource = class extends BaseResource {
|
|
|
2396
2396
|
async delete(parentId, id, opts = {}) {
|
|
2397
2397
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
2398
2398
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_related_items.delete", parentId);
|
|
2399
|
-
return this.deleteScopedRaw(parentId, id);
|
|
2399
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
2400
2400
|
}
|
|
2401
2401
|
/** Resolve a ConfigurationItemRelatedItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
2402
2402
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2412,8 +2412,8 @@ var ConfigurationItemRelatedItemsResource = class extends BaseResource {
|
|
|
2412
2412
|
};
|
|
2413
2413
|
|
|
2414
2414
|
// src/resources/special/configuration_items.ts
|
|
2415
|
-
async function fetchRecord(http, path, label) {
|
|
2416
|
-
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem" });
|
|
2415
|
+
async function fetchRecord(http, path, label, readOpts) {
|
|
2416
|
+
const res = await http.request({ method: "GET", path, operation: "configuration_items.moveConfigurationItem", maxRetries: readOpts?.maxRetries });
|
|
2417
2417
|
const body = res;
|
|
2418
2418
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
2419
2419
|
throw new NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
@@ -2426,8 +2426,8 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2426
2426
|
throw new AutotaskConfigError("moveConfigurationItem: destinationCompanyId is required");
|
|
2427
2427
|
}
|
|
2428
2428
|
const destId = parseIdentifier(opts.destinationCompanyId, "destinationCompanyId");
|
|
2429
|
-
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}
|
|
2430
|
-
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}
|
|
2429
|
+
const source = await fetchRecord(http, `/V1.0/ConfigurationItems/${numericSource}`, `Configuration item ${numericSource}`, { maxRetries: opts.maxRetries });
|
|
2430
|
+
await fetchRecord(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
|
|
2431
2431
|
const body = { ...source };
|
|
2432
2432
|
delete body.id;
|
|
2433
2433
|
delete body.soapParentPropertyId;
|
|
@@ -2467,7 +2467,8 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2467
2467
|
method: "POST",
|
|
2468
2468
|
path: "/V1.0/ConfigurationItems",
|
|
2469
2469
|
body,
|
|
2470
|
-
operation: "configuration_items.moveConfigurationItem"
|
|
2470
|
+
operation: "configuration_items.moveConfigurationItem",
|
|
2471
|
+
maxRetries: opts.maxRetries
|
|
2471
2472
|
});
|
|
2472
2473
|
const createdBody = created;
|
|
2473
2474
|
const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
|
|
@@ -2480,7 +2481,8 @@ async function moveConfigurationItem(_resource, sourceId, opts, http) {
|
|
|
2480
2481
|
method: "PUT",
|
|
2481
2482
|
path: "/V1.0/ConfigurationItems",
|
|
2482
2483
|
body: { id: numericSource, isActive: false },
|
|
2483
|
-
operation: "configuration_items.moveConfigurationItem"
|
|
2484
|
+
operation: "configuration_items.moveConfigurationItem",
|
|
2485
|
+
maxRetries: opts.maxRetries
|
|
2484
2486
|
});
|
|
2485
2487
|
sourceDeactivated = true;
|
|
2486
2488
|
}
|
|
@@ -2698,14 +2700,14 @@ var ConfigurationItemSslSubjectAlternativeNamesResource = class extends BaseReso
|
|
|
2698
2700
|
async update(parentId, id, data, opts = {}) {
|
|
2699
2701
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
2700
2702
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_ssl_subject_alternative_names.update", parentId);
|
|
2701
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
2703
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
2702
2704
|
}
|
|
2703
2705
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
2704
2706
|
* envelope and never issues the delete. */
|
|
2705
2707
|
async delete(parentId, id, opts = {}) {
|
|
2706
2708
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
2707
2709
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_ssl_subject_alternative_names.delete", parentId);
|
|
2708
|
-
return this.deleteScopedRaw(parentId, id);
|
|
2710
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
2709
2711
|
}
|
|
2710
2712
|
/** Resolve a ConfigurationItemSslSubjectAlternativeName from a numeric id (or, where the vendor indexes a primary text field,
|
|
2711
2713
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -2779,7 +2781,7 @@ var ConfigurationItemTypesResource = class extends BaseResource {
|
|
|
2779
2781
|
async delete(id, opts = {}) {
|
|
2780
2782
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
2781
2783
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_types.delete");
|
|
2782
|
-
return this.deleteGlobal(id);
|
|
2784
|
+
return this.deleteGlobal(id, opts);
|
|
2783
2785
|
}
|
|
2784
2786
|
/** Resolve a ConfigurationItemType from a numeric id (or, where the vendor indexes a primary text field,
|
|
2785
2787
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -2855,7 +2857,7 @@ var ConfigurationItemWebhooksResource = class extends BaseResource {
|
|
|
2855
2857
|
async delete(id, opts = {}) {
|
|
2856
2858
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
2857
2859
|
await this.guardStaleBeforeMutation(id, opts, "configuration_item_webhooks.delete");
|
|
2858
|
-
return this.deleteGlobal(id);
|
|
2860
|
+
return this.deleteGlobal(id, opts);
|
|
2859
2861
|
}
|
|
2860
2862
|
/** Resolve a ConfigurationItemWebhook from a numeric id (or, where the vendor indexes a primary text field,
|
|
2861
2863
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -2913,7 +2915,7 @@ var ContactGroupContactsResource = class extends BaseResource {
|
|
|
2913
2915
|
async delete(id, opts = {}) {
|
|
2914
2916
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
2915
2917
|
await this.guardStaleBeforeMutation(id, opts, "contact_group_contacts.delete");
|
|
2916
|
-
return this.deleteGlobal(id);
|
|
2918
|
+
return this.deleteGlobal(id, opts);
|
|
2917
2919
|
}
|
|
2918
2920
|
/** Resolve a ContactGroupContacts from a numeric id (or, where the vendor indexes a primary text field,
|
|
2919
2921
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -2983,7 +2985,7 @@ var ContactGroupsResource = class extends BaseResource {
|
|
|
2983
2985
|
async delete(id, opts = {}) {
|
|
2984
2986
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
2985
2987
|
await this.guardStaleBeforeMutation(id, opts, "contact_groups.delete");
|
|
2986
|
-
return this.deleteGlobal(id);
|
|
2988
|
+
return this.deleteGlobal(id, opts);
|
|
2987
2989
|
}
|
|
2988
2990
|
/** Resolve a ContactGroups from a numeric id (or, where the vendor indexes a primary text field,
|
|
2989
2991
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -3003,8 +3005,8 @@ var ContactGroupsResource = class extends BaseResource {
|
|
|
3003
3005
|
};
|
|
3004
3006
|
|
|
3005
3007
|
// src/resources/special/contacts.ts
|
|
3006
|
-
async function fetchRecord2(http, path, label) {
|
|
3007
|
-
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany" });
|
|
3008
|
+
async function fetchRecord2(http, path, label, readOpts) {
|
|
3009
|
+
const res = await http.request({ method: "GET", path, operation: "contacts.moveToCompany", maxRetries: readOpts?.maxRetries });
|
|
3008
3010
|
const body = res;
|
|
3009
3011
|
if (body === null || !("item" in body) || body.item === null || body.item === void 0) {
|
|
3010
3012
|
throw new NotFoundError(`${label} not found`, { code: "NOT_FOUND", category: "not_found" });
|
|
@@ -3014,7 +3016,7 @@ async function fetchRecord2(http, path, label) {
|
|
|
3014
3016
|
async function moveToCompany(_resource, sourceContactId, destinationCompanyId, opts = {}, http) {
|
|
3015
3017
|
const sourceId = parseIdentifier(sourceContactId, "sourceContactId");
|
|
3016
3018
|
const destId = parseIdentifier(destinationCompanyId, "destinationCompanyId");
|
|
3017
|
-
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}
|
|
3019
|
+
const source = await fetchRecord2(http, `/V1.0/Contacts/${sourceId}`, `Contact ${sourceId}`, { maxRetries: opts.maxRetries });
|
|
3018
3020
|
const companyID = source.companyID;
|
|
3019
3021
|
if (typeof companyID !== "number" || companyID < 0) {
|
|
3020
3022
|
throw new NotFoundError(`Contact ${sourceId} has no companyID (cannot scope the source delete)`);
|
|
@@ -3028,7 +3030,7 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3028
3030
|
);
|
|
3029
3031
|
}
|
|
3030
3032
|
}
|
|
3031
|
-
await fetchRecord2(http, `/V1.0/Companies/${destId}`, `Company ${destId}
|
|
3033
|
+
await fetchRecord2(http, `/V1.0/Companies/${destId}`, `Company ${destId}`, { maxRetries: opts.maxRetries });
|
|
3032
3034
|
const email = typeof source.emailAddress === "string" ? source.emailAddress : "";
|
|
3033
3035
|
if (email !== "") {
|
|
3034
3036
|
const res = await http.request({
|
|
@@ -3081,7 +3083,8 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3081
3083
|
method: "POST",
|
|
3082
3084
|
path: `/V1.0/Companies/${destId}/Contacts`,
|
|
3083
3085
|
body,
|
|
3084
|
-
operation: "contacts.moveToCompany"
|
|
3086
|
+
operation: "contacts.moveToCompany",
|
|
3087
|
+
maxRetries: opts.maxRetries
|
|
3085
3088
|
});
|
|
3086
3089
|
const createdBody = created;
|
|
3087
3090
|
const newId = createdBody !== null ? createdBody.itemId ?? createdBody.id : void 0;
|
|
@@ -3093,7 +3096,8 @@ async function moveToCompany(_resource, sourceContactId, destinationCompanyId, o
|
|
|
3093
3096
|
await http.request({
|
|
3094
3097
|
method: "DELETE",
|
|
3095
3098
|
path: `/V1.0/Companies/${companyID}/Contacts/${sourceId}`,
|
|
3096
|
-
operation: "contacts.moveToCompany"
|
|
3099
|
+
operation: "contacts.moveToCompany",
|
|
3100
|
+
maxRetries: opts.maxRetries
|
|
3097
3101
|
});
|
|
3098
3102
|
sourceDeleted = true;
|
|
3099
3103
|
}
|
|
@@ -3146,7 +3150,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3146
3150
|
throw new AutotaskConfigError("upsertByEmail: extra.lastName must be a string (or omitted \u2014 the node defaults it to the non-empty neutral value Unknown)", { operation: OP_UPSERT_EMAIL });
|
|
3147
3151
|
}
|
|
3148
3152
|
}
|
|
3149
|
-
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL });
|
|
3153
|
+
const parentRes = await http.request({ method: "GET", path: `/V1.0/Companies/${cid}`, operation: OP_UPSERT_EMAIL, maxRetries: opts.maxRetries });
|
|
3150
3154
|
const parentBody = parentRes;
|
|
3151
3155
|
if (parentBody === null || !("item" in parentBody) || parentBody.item === null || parentBody.item === void 0) {
|
|
3152
3156
|
throw new CompanyNotFoundError(
|
|
@@ -3214,7 +3218,7 @@ async function upsertByEmail(resource, companyID, email, extra, opts, http) {
|
|
|
3214
3218
|
let merges = 0;
|
|
3215
3219
|
for (; ; ) {
|
|
3216
3220
|
try {
|
|
3217
|
-
const created = await resource.create(cid, body, {});
|
|
3221
|
+
const created = await resource.create(cid, body, { maxRetries: opts.maxRetries });
|
|
3218
3222
|
return { id: created.id, created: true };
|
|
3219
3223
|
} catch (err) {
|
|
3220
3224
|
if (!isAutotaskError(err) || err.vendorError === void 0) throw err;
|
|
@@ -3293,14 +3297,14 @@ var ContactsResource = class extends BaseResource {
|
|
|
3293
3297
|
async update(parentId, id, data, opts = {}) {
|
|
3294
3298
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
3295
3299
|
await this.guardStaleBeforeMutation(id, opts, "contacts.update", parentId);
|
|
3296
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
3300
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
3297
3301
|
}
|
|
3298
3302
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
3299
3303
|
* envelope and never issues the delete. */
|
|
3300
3304
|
async delete(parentId, id, opts = {}) {
|
|
3301
3305
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3302
3306
|
await this.guardStaleBeforeMutation(id, opts, "contacts.delete", parentId);
|
|
3303
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3307
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3304
3308
|
}
|
|
3305
3309
|
/** Resolve a Contact from a numeric id (or, where the vendor indexes a primary text field,
|
|
3306
3310
|
* from an exact match on firstName / lastName). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -3396,7 +3400,7 @@ var ContactWebhooksResource = class extends BaseResource {
|
|
|
3396
3400
|
async delete(id, opts = {}) {
|
|
3397
3401
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
3398
3402
|
await this.guardStaleBeforeMutation(id, opts, "contact_webhooks.delete");
|
|
3399
|
-
return this.deleteGlobal(id);
|
|
3403
|
+
return this.deleteGlobal(id, opts);
|
|
3400
3404
|
}
|
|
3401
3405
|
/** Resolve a ContactWebhook from a numeric id (or, where the vendor indexes a primary text field,
|
|
3402
3406
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -3459,14 +3463,14 @@ var ContractBillingRulesResource = class extends BaseResource {
|
|
|
3459
3463
|
async update(parentId, id, data, opts = {}) {
|
|
3460
3464
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
3461
3465
|
await this.guardStaleBeforeMutation(id, opts, "contract_billing_rules.update", parentId);
|
|
3462
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
3466
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
3463
3467
|
}
|
|
3464
3468
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
3465
3469
|
* envelope and never issues the delete. */
|
|
3466
3470
|
async delete(parentId, id, opts = {}) {
|
|
3467
3471
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3468
3472
|
await this.guardStaleBeforeMutation(id, opts, "contract_billing_rules.delete", parentId);
|
|
3469
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3473
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3470
3474
|
}
|
|
3471
3475
|
/** Resolve a ContractBillingRule from a numeric id (or, where the vendor indexes a primary text field,
|
|
3472
3476
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3525,7 +3529,7 @@ var ContractBlockHourFactorsResource = class extends BaseResource {
|
|
|
3525
3529
|
async update(parentId, id, data, opts = {}) {
|
|
3526
3530
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
3527
3531
|
await this.guardStaleBeforeMutation(id, opts, "contract_block_hour_factors.update", parentId);
|
|
3528
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
3532
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
3529
3533
|
}
|
|
3530
3534
|
/** Resolve a ContractBlockHourFactor from a numeric id (or, where the vendor indexes a primary text field,
|
|
3531
3535
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3584,7 +3588,7 @@ var ContractBlocksResource = class extends BaseResource {
|
|
|
3584
3588
|
async update(parentId, id, data, opts = {}) {
|
|
3585
3589
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
3586
3590
|
await this.guardStaleBeforeMutation(id, opts, "contract_blocks.update", parentId);
|
|
3587
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
3591
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
3588
3592
|
}
|
|
3589
3593
|
/** Resolve a ContractBlock from a numeric id (or, where the vendor indexes a primary text field,
|
|
3590
3594
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3644,14 +3648,14 @@ var ContractChargesResource = class extends BaseResource {
|
|
|
3644
3648
|
async update(parentId, id, data, opts = {}) {
|
|
3645
3649
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
3646
3650
|
await this.guardStaleBeforeMutation(id, opts, "contract_charges.update", parentId);
|
|
3647
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
3651
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
3648
3652
|
}
|
|
3649
3653
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
3650
3654
|
* envelope and never issues the delete. */
|
|
3651
3655
|
async delete(parentId, id, opts = {}) {
|
|
3652
3656
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3653
3657
|
await this.guardStaleBeforeMutation(id, opts, "contract_charges.delete", parentId);
|
|
3654
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3658
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3655
3659
|
}
|
|
3656
3660
|
/** Resolve a ContractCharge from a numeric id (or, where the vendor indexes a primary text field,
|
|
3657
3661
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -3712,7 +3716,7 @@ var ContractExclusionBillingCodesResource = class extends BaseResource {
|
|
|
3712
3716
|
async delete(parentId, id, opts = {}) {
|
|
3713
3717
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3714
3718
|
await this.guardStaleBeforeMutation(id, opts, "contract_exclusion_billing_codes.delete", parentId);
|
|
3715
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3719
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3716
3720
|
}
|
|
3717
3721
|
/** Resolve a ContractExclusionBillingCode from a numeric id (or, where the vendor indexes a primary text field,
|
|
3718
3722
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3769,7 +3773,7 @@ var ContractExclusionRolesResource = class extends BaseResource {
|
|
|
3769
3773
|
async delete(parentId, id, opts = {}) {
|
|
3770
3774
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3771
3775
|
await this.guardStaleBeforeMutation(id, opts, "contract_exclusion_roles.delete", parentId);
|
|
3772
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3776
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3773
3777
|
}
|
|
3774
3778
|
/** Resolve a ContractExclusionRoles from a numeric id (or, where the vendor indexes a primary text field,
|
|
3775
3779
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3826,7 +3830,7 @@ var ContractExclusionSetExcludedRolesResource = class extends BaseResource {
|
|
|
3826
3830
|
async delete(parentId, id, opts = {}) {
|
|
3827
3831
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3828
3832
|
await this.guardStaleBeforeMutation(id, opts, "contract_exclusion_set_excluded_roles.delete", parentId);
|
|
3829
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3833
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3830
3834
|
}
|
|
3831
3835
|
/** Resolve a ContractExclusionSetExcludedRoles from a numeric id (or, where the vendor indexes a primary text field,
|
|
3832
3836
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3883,7 +3887,7 @@ var ContractExclusionSetExcludedWorkTypesResource = class extends BaseResource {
|
|
|
3883
3887
|
async delete(parentId, id, opts = {}) {
|
|
3884
3888
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
3885
3889
|
await this.guardStaleBeforeMutation(id, opts, "contract_exclusion_set_excluded_work_types.delete", parentId);
|
|
3886
|
-
return this.deleteScopedRaw(parentId, id);
|
|
3890
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
3887
3891
|
}
|
|
3888
3892
|
/** Resolve a ContractExclusionSetExcludedWorkTypes from a numeric id (or, where the vendor indexes a primary text field,
|
|
3889
3893
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -3953,7 +3957,7 @@ var ContractExclusionSetsResource = class extends BaseResource {
|
|
|
3953
3957
|
async delete(id, opts = {}) {
|
|
3954
3958
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
3955
3959
|
await this.guardStaleBeforeMutation(id, opts, "contract_exclusion_sets.delete");
|
|
3956
|
-
return this.deleteGlobal(id);
|
|
3960
|
+
return this.deleteGlobal(id, opts);
|
|
3957
3961
|
}
|
|
3958
3962
|
/** Resolve a ContractExclusionSets from a numeric id (or, where the vendor indexes a primary text field,
|
|
3959
3963
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -4016,7 +4020,7 @@ var ContractMilestonesResource = class extends BaseResource {
|
|
|
4016
4020
|
async update(parentId, id, data, opts = {}) {
|
|
4017
4021
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4018
4022
|
await this.guardStaleBeforeMutation(id, opts, "contract_milestones.update", parentId);
|
|
4019
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4023
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4020
4024
|
}
|
|
4021
4025
|
/** Resolve a ContractMilestone from a numeric id (or, where the vendor indexes a primary text field,
|
|
4022
4026
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4075,7 +4079,7 @@ var ContractNotesResource = class extends BaseResource {
|
|
|
4075
4079
|
async update(parentId, id, data, opts = {}) {
|
|
4076
4080
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4077
4081
|
await this.guardStaleBeforeMutation(id, opts, "contract_notes.update", parentId);
|
|
4078
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4082
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4079
4083
|
}
|
|
4080
4084
|
/** Resolve a ContractNote from a numeric id (or, where the vendor indexes a primary text field,
|
|
4081
4085
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4134,7 +4138,7 @@ var ContractRatesResource = class extends BaseResource {
|
|
|
4134
4138
|
async update(parentId, id, data, opts = {}) {
|
|
4135
4139
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4136
4140
|
await this.guardStaleBeforeMutation(id, opts, "contract_rates.update", parentId);
|
|
4137
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4141
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4138
4142
|
}
|
|
4139
4143
|
/** Resolve a ContractRate from a numeric id (or, where the vendor indexes a primary text field,
|
|
4140
4144
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4193,7 +4197,7 @@ var ContractRetainersResource = class extends BaseResource {
|
|
|
4193
4197
|
async update(parentId, id, data, opts = {}) {
|
|
4194
4198
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4195
4199
|
await this.guardStaleBeforeMutation(id, opts, "contract_retainers.update", parentId);
|
|
4196
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4200
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4197
4201
|
}
|
|
4198
4202
|
/** Resolve a ContractRetainers from a numeric id (or, where the vendor indexes a primary text field,
|
|
4199
4203
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4252,7 +4256,7 @@ var ContractRoleCostsResource = class extends BaseResource {
|
|
|
4252
4256
|
async update(parentId, id, data, opts = {}) {
|
|
4253
4257
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4254
4258
|
await this.guardStaleBeforeMutation(id, opts, "contract_role_costs.update", parentId);
|
|
4255
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4259
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4256
4260
|
}
|
|
4257
4261
|
/** Resolve a ContractRoleCosts from a numeric id (or, where the vendor indexes a primary text field,
|
|
4258
4262
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4379,7 +4383,7 @@ var ContractServiceBundlesResource = class extends BaseResource {
|
|
|
4379
4383
|
async update(parentId, id, data, opts = {}) {
|
|
4380
4384
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4381
4385
|
await this.guardStaleBeforeMutation(id, opts, "contract_service_bundles.update", parentId);
|
|
4382
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4386
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4383
4387
|
}
|
|
4384
4388
|
/** Resolve a ContractServiceBundle from a numeric id (or, where the vendor indexes a primary text field,
|
|
4385
4389
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4480,7 +4484,7 @@ var ContractServicesResource = class extends BaseResource {
|
|
|
4480
4484
|
async update(parentId, id, data, opts = {}) {
|
|
4481
4485
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
4482
4486
|
await this.guardStaleBeforeMutation(id, opts, "contract_services.update", parentId);
|
|
4483
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
4487
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
4484
4488
|
}
|
|
4485
4489
|
/** Resolve a ContractService from a numeric id (or, where the vendor indexes a primary text field,
|
|
4486
4490
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -4549,7 +4553,8 @@ var PROFITABILITY_OPT_KEYS = [
|
|
|
4549
4553
|
"groupByActivity",
|
|
4550
4554
|
"staleAfterDays",
|
|
4551
4555
|
"maxTicketsForJoin",
|
|
4552
|
-
"limit"
|
|
4556
|
+
"limit",
|
|
4557
|
+
"includeRows"
|
|
4553
4558
|
];
|
|
4554
4559
|
var LABOUR_METHOD_SET = [
|
|
4555
4560
|
"billing_item_our_cost",
|
|
@@ -4688,7 +4693,7 @@ function dateToDay(v) {
|
|
|
4688
4693
|
function validateProfitabilityOptions(contractId, opts) {
|
|
4689
4694
|
if (opts === void 0 || (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
4690
4695
|
throw new AutotaskConfigError(
|
|
4691
|
-
`profitability: opts
|
|
4696
|
+
`profitability: opts is required \u2014 the options object with dateFrom and dateTo (YYYY-MM-DD) (got ${opts === void 0 ? "undefined" : Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
4692
4697
|
{ operation: "contracts.profitability" }
|
|
4693
4698
|
);
|
|
4694
4699
|
}
|
|
@@ -4728,7 +4733,7 @@ function validateProfitabilityOptions(contractId, opts) {
|
|
|
4728
4733
|
if (method === "provided" && rate === null) {
|
|
4729
4734
|
problems.push(`labourRatePerHour is required (finite number >= 0) when labourCostMethod is "provided" (got ${String(opts.labourRatePerHour)})`);
|
|
4730
4735
|
}
|
|
4731
|
-
for (const key of ["includeRecurringCosts", "includeUnbilledRevenue", "groupByActivity"]) {
|
|
4736
|
+
for (const key of ["includeRecurringCosts", "includeUnbilledRevenue", "groupByActivity", "includeRows"]) {
|
|
4732
4737
|
const v = opts[key];
|
|
4733
4738
|
if (v !== void 0 && typeof v !== "boolean") problems.push(`${key} must be a boolean (got ${String(v)})`);
|
|
4734
4739
|
}
|
|
@@ -4786,7 +4791,8 @@ function validateProfitabilityOptions(contractId, opts) {
|
|
|
4786
4791
|
groupByActivity: opts.groupByActivity ?? true,
|
|
4787
4792
|
staleAfterDays: stale,
|
|
4788
4793
|
maxTicketsForJoin: mtj,
|
|
4789
|
-
limit
|
|
4794
|
+
limit,
|
|
4795
|
+
includeRows: opts.includeRows ?? false
|
|
4790
4796
|
};
|
|
4791
4797
|
}
|
|
4792
4798
|
async function boundedPart2(http, path, conditions, limit, operation, includeFields) {
|
|
@@ -4985,7 +4991,7 @@ function dedupeSortCap(ids, limit) {
|
|
|
4985
4991
|
return [...new Set(ids)].sort((a, b) => Number(a) - Number(b)).slice(0, limit);
|
|
4986
4992
|
}
|
|
4987
4993
|
async function profitability(resource, contractId, opts, rawHttp) {
|
|
4988
|
-
const v = validateProfitabilityOptions(contractId, opts
|
|
4994
|
+
const v = validateProfitabilityOptions(contractId, opts);
|
|
4989
4995
|
const OP2 = "contracts.profitability";
|
|
4990
4996
|
const id = parseIdentifier(contractId, "contractId");
|
|
4991
4997
|
const idNum = typeof id === "number" ? id : Number(id);
|
|
@@ -5403,17 +5409,20 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5403
5409
|
else labourTotal += r.cost ?? 0;
|
|
5404
5410
|
}
|
|
5405
5411
|
const unposted = mEntries.filter((e) => e["isNonBillable"] !== true && !billedByEntryId.has(num2(e["id"])));
|
|
5406
|
-
const
|
|
5412
|
+
const hoursMissing = unposted.some((e) => typeof e["hoursToBill"] !== "number" || !Number.isFinite(e["hoursToBill"]));
|
|
5413
|
+
const hoursPart = hoursMissing ? { entries: unposted.length, hours: null, hoursAbsent: "HOURS_TO_BILL_MISSING" } : { entries: unposted.length, hours: unposted.reduce((a, e) => a + Math.max(0, num2(e["hoursToBill"])), 0) };
|
|
5407
5414
|
let unpostedTime;
|
|
5408
5415
|
if (!contractTypeKnown) {
|
|
5409
|
-
unpostedTime = {
|
|
5416
|
+
unpostedTime = { ...hoursPart, value: null, absent: "CONTRACT_TYPE_UNKNOWN" };
|
|
5410
5417
|
} else if (!isTimeAndMaterials) {
|
|
5411
|
-
unpostedTime = {
|
|
5418
|
+
unpostedTime = { ...hoursPart, value: null, absent: "NOT_TIME_AND_MATERIALS_CONTRACT" };
|
|
5412
5419
|
} else if (unposted.some((e) => !contractRateByRole.has(num2(e["roleID"])))) {
|
|
5413
|
-
unpostedTime = {
|
|
5420
|
+
unpostedTime = { ...hoursPart, value: null, absent: "NO_CONTRACT_RATE" };
|
|
5421
|
+
} else if (hoursMissing) {
|
|
5422
|
+
unpostedTime = { ...hoursPart, value: null, absent: "HOURS_TO_BILL_MISSING" };
|
|
5414
5423
|
} else {
|
|
5415
5424
|
const value = unposted.reduce((a, e) => a + Math.max(0, num2(e["hoursToBill"])) * contractRateByRole.get(num2(e["roleID"])), 0);
|
|
5416
|
-
unpostedTime = {
|
|
5425
|
+
unpostedTime = { ...hoursPart, value };
|
|
5417
5426
|
}
|
|
5418
5427
|
let toolingVendor = subscriptionsPart.status === "skipped" || subscriptionsPart.status === "absent" ? null : 0;
|
|
5419
5428
|
if (toolingVendor !== null) {
|
|
@@ -5725,6 +5734,11 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5725
5734
|
const purchasedHours = blocks.reduce((a, b) => a + num2(b["hours"]), 0);
|
|
5726
5735
|
const approvedHours = blocks.reduce((a, b) => a + num2(b["hoursApproved"]), 0);
|
|
5727
5736
|
const includedHours = !contractTypeKnown ? { value: null, absent: "CONTRACT_TYPE_UNKNOWN" } : !isBlockHours ? { value: null, absent: "NOT_BLOCK_HOURS_CONTRACT" } : blocksPart.status === "absent" ? { value: null, absent: blocksPart.absent } : { value: { purchased: purchasedHours, approved: approvedHours, remaining: purchasedHours - approvedHours } };
|
|
5737
|
+
const rows = (part) => {
|
|
5738
|
+
if (v.includeRows) return part;
|
|
5739
|
+
const { items, ...stamps } = part;
|
|
5740
|
+
return { ...stamps, rows_fetched: items.length };
|
|
5741
|
+
};
|
|
5728
5742
|
return {
|
|
5729
5743
|
contract,
|
|
5730
5744
|
customer,
|
|
@@ -5763,22 +5777,22 @@ async function profitability(resource, contractId, opts, rawHttp) {
|
|
|
5763
5777
|
configurationItems: configurationItemsPart.status,
|
|
5764
5778
|
subscriptions: subscriptionsPart.status
|
|
5765
5779
|
},
|
|
5766
|
-
contractServices: servicesPart,
|
|
5767
|
-
contractServiceUnits: unitsPart,
|
|
5768
|
-
contractCharges: chargesPart,
|
|
5769
|
-
contractRoleCosts: roleCostsPart,
|
|
5770
|
-
contractRates: ratesPart,
|
|
5771
|
-
contractBlocks: blocksPart,
|
|
5772
|
-
billingItems,
|
|
5773
|
-
invoices: invoicesPart,
|
|
5774
|
-
timeEntries,
|
|
5775
|
-
ticketsActivity: ticketsActivityPart,
|
|
5776
|
-
ticketsOpen: ticketsOpenPart,
|
|
5777
|
-
resources: resourcesPart,
|
|
5778
|
-
expenses: expensesPart,
|
|
5779
|
-
miscodingProbe: probePart,
|
|
5780
|
-
configurationItems: configurationItemsPart,
|
|
5781
|
-
subscriptions: subscriptionsPart,
|
|
5780
|
+
contractServices: rows(servicesPart),
|
|
5781
|
+
contractServiceUnits: rows(unitsPart),
|
|
5782
|
+
contractCharges: rows(chargesPart),
|
|
5783
|
+
contractRoleCosts: rows(roleCostsPart),
|
|
5784
|
+
contractRates: rows(ratesPart),
|
|
5785
|
+
contractBlocks: rows(blocksPart),
|
|
5786
|
+
billingItems: rows(billingItems),
|
|
5787
|
+
invoices: rows(invoicesPart),
|
|
5788
|
+
timeEntries: rows(timeEntries),
|
|
5789
|
+
ticketsActivity: rows(ticketsActivityPart),
|
|
5790
|
+
ticketsOpen: rows(ticketsOpenPart),
|
|
5791
|
+
resources: rows(resourcesPart),
|
|
5792
|
+
expenses: rows(expensesPart),
|
|
5793
|
+
miscodingProbe: rows(probePart),
|
|
5794
|
+
configurationItems: rows(configurationItemsPart),
|
|
5795
|
+
subscriptions: rows(subscriptionsPart),
|
|
5782
5796
|
wires: { issued: wires.issued, requests: wires.requests, budget: wires.budget, note: wires.note }
|
|
5783
5797
|
};
|
|
5784
5798
|
}
|
|
@@ -5898,7 +5912,7 @@ var ContractTicketPurchasesResource = class extends BaseResource {
|
|
|
5898
5912
|
async update(parentId, id, data, opts = {}) {
|
|
5899
5913
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
5900
5914
|
await this.guardStaleBeforeMutation(id, opts, "contract_ticket_purchases.update", parentId);
|
|
5901
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
5915
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
5902
5916
|
}
|
|
5903
5917
|
/** Resolve a ContractTicketPurchases from a numeric id (or, where the vendor indexes a primary text field,
|
|
5904
5918
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -6165,7 +6179,7 @@ var ExpenseItemAttachmentsResource = class extends BaseResource {
|
|
|
6165
6179
|
async delete(parentId, id, opts = {}) {
|
|
6166
6180
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
6167
6181
|
await this.guardStaleBeforeMutation(id, opts, "expense_item_attachments.delete", parentId);
|
|
6168
|
-
return this.deleteScopedModel(parentId, id);
|
|
6182
|
+
return this.deleteScopedModel(parentId, id, opts);
|
|
6169
6183
|
}
|
|
6170
6184
|
/** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */
|
|
6171
6185
|
async download(parentId, id) {
|
|
@@ -6228,7 +6242,7 @@ var ExpenseItemsResource = class extends BaseResource {
|
|
|
6228
6242
|
async update(parentId, id, data, opts = {}) {
|
|
6229
6243
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
6230
6244
|
await this.guardStaleBeforeMutation(id, opts, "expense_items.update", parentId);
|
|
6231
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
6245
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
6232
6246
|
}
|
|
6233
6247
|
/** Resolve a ExpenseItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
6234
6248
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -6364,7 +6378,7 @@ var HolidaySetsResource = class extends BaseResource {
|
|
|
6364
6378
|
async delete(id, opts = {}) {
|
|
6365
6379
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
6366
6380
|
await this.guardStaleBeforeMutation(id, opts, "holiday_sets.delete");
|
|
6367
|
-
return this.deleteGlobal(id);
|
|
6381
|
+
return this.deleteGlobal(id, opts);
|
|
6368
6382
|
}
|
|
6369
6383
|
/** Resolve a HolidaySet from a numeric id (or, where the vendor indexes a primary text field,
|
|
6370
6384
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -6423,14 +6437,14 @@ var HolidaysResource = class extends BaseResource {
|
|
|
6423
6437
|
async update(parentId, id, data, opts = {}) {
|
|
6424
6438
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
6425
6439
|
await this.guardStaleBeforeMutation(id, opts, "holidays.update", parentId);
|
|
6426
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
6440
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
6427
6441
|
}
|
|
6428
6442
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
6429
6443
|
* envelope and never issues the delete. */
|
|
6430
6444
|
async delete(parentId, id, opts = {}) {
|
|
6431
6445
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
6432
6446
|
await this.guardStaleBeforeMutation(id, opts, "holidays.delete", parentId);
|
|
6433
|
-
return this.deleteScopedRaw(parentId, id);
|
|
6447
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
6434
6448
|
}
|
|
6435
6449
|
/** Resolve a Holiday from a numeric id (or, where the vendor indexes a primary text field,
|
|
6436
6450
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -6469,7 +6483,8 @@ async function stockedItems(_resource, kind, parentId, data, opts = {}, http) {
|
|
|
6469
6483
|
method: "POST",
|
|
6470
6484
|
path: `/V1.0/InventoryProducts/${numericParent}/${suffix}`,
|
|
6471
6485
|
body: data,
|
|
6472
|
-
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}
|
|
6486
|
+
operation: `inventory_products.stockedItems${suffix.slice("StockedItems".length)}`,
|
|
6487
|
+
maxRetries: opts.maxRetries
|
|
6473
6488
|
});
|
|
6474
6489
|
return unwrapOperation(res);
|
|
6475
6490
|
}
|
|
@@ -6528,7 +6543,7 @@ var InventoryProductsResource = class extends BaseResource {
|
|
|
6528
6543
|
async delete(id, opts = {}) {
|
|
6529
6544
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
6530
6545
|
await this.guardStaleBeforeMutation(id, opts, "inventory_products.delete");
|
|
6531
|
-
return this.deleteGlobal(id);
|
|
6546
|
+
return this.deleteGlobal(id, opts);
|
|
6532
6547
|
}
|
|
6533
6548
|
/** Resolve a InventoryProduct from a numeric id (or, where the vendor indexes a primary text field,
|
|
6534
6549
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -6884,7 +6899,7 @@ var OpportunityAttachmentsResource = class extends BaseResource {
|
|
|
6884
6899
|
async delete(parentId, id, opts = {}) {
|
|
6885
6900
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
6886
6901
|
await this.guardStaleBeforeMutation(id, opts, "opportunity_attachments.delete", parentId);
|
|
6887
|
-
return this.deleteScopedModel(parentId, id);
|
|
6902
|
+
return this.deleteScopedModel(parentId, id, opts);
|
|
6888
6903
|
}
|
|
6889
6904
|
/** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */
|
|
6890
6905
|
async download(parentId, id) {
|
|
@@ -7006,7 +7021,7 @@ var PhasesResource = class extends BaseResource {
|
|
|
7006
7021
|
async update(parentId, id, data, opts = {}) {
|
|
7007
7022
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7008
7023
|
await this.guardStaleBeforeMutation(id, opts, "phases.update", parentId);
|
|
7009
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7024
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7010
7025
|
}
|
|
7011
7026
|
/** Resolve a Phase from a numeric id (or, where the vendor indexes a primary text field,
|
|
7012
7027
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -7132,7 +7147,7 @@ var ProductVendorsResource = class extends BaseResource {
|
|
|
7132
7147
|
async update(parentId, id, data, opts = {}) {
|
|
7133
7148
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7134
7149
|
await this.guardStaleBeforeMutation(id, opts, "product_vendors.update", parentId);
|
|
7135
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7150
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7136
7151
|
}
|
|
7137
7152
|
/** Resolve a ProductVendors from a numeric id (or, where the vendor indexes a primary text field,
|
|
7138
7153
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -7192,14 +7207,14 @@ var ProjectChargesResource = class extends BaseResource {
|
|
|
7192
7207
|
async update(parentId, id, data, opts = {}) {
|
|
7193
7208
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7194
7209
|
await this.guardStaleBeforeMutation(id, opts, "project_charges.update", parentId);
|
|
7195
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7210
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7196
7211
|
}
|
|
7197
7212
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
7198
7213
|
* envelope and never issues the delete. */
|
|
7199
7214
|
async delete(parentId, id, opts = {}) {
|
|
7200
7215
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
7201
7216
|
await this.guardStaleBeforeMutation(id, opts, "project_charges.delete", parentId);
|
|
7202
|
-
return this.deleteScopedRaw(parentId, id);
|
|
7217
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
7203
7218
|
}
|
|
7204
7219
|
/** Resolve a ProjectCharge from a numeric id (or, where the vendor indexes a primary text field,
|
|
7205
7220
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -7262,7 +7277,7 @@ var ProjectNotesResource = class extends BaseResource {
|
|
|
7262
7277
|
async update(parentId, id, data, opts = {}) {
|
|
7263
7278
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7264
7279
|
await this.guardStaleBeforeMutation(id, opts, "project_notes.update", parentId);
|
|
7265
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7280
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7266
7281
|
}
|
|
7267
7282
|
/** Resolve a ProjectNote from a numeric id (or, where the vendor indexes a primary text field,
|
|
7268
7283
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -7517,7 +7532,7 @@ var PurchaseOrderItemsResource = class extends BaseResource {
|
|
|
7517
7532
|
async update(parentId, id, data, opts = {}) {
|
|
7518
7533
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7519
7534
|
await this.guardStaleBeforeMutation(id, opts, "purchase_order_items.update", parentId);
|
|
7520
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7535
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7521
7536
|
}
|
|
7522
7537
|
/** Resolve a PurchaseOrderItems from a numeric id (or, where the vendor indexes a primary text field,
|
|
7523
7538
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -7639,14 +7654,14 @@ var QuoteItemsResource = class extends BaseResource {
|
|
|
7639
7654
|
async update(parentId, id, data, opts = {}) {
|
|
7640
7655
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7641
7656
|
await this.guardStaleBeforeMutation(id, opts, "quote_items.update", parentId);
|
|
7642
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7657
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7643
7658
|
}
|
|
7644
7659
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
7645
7660
|
* envelope and never issues the delete. */
|
|
7646
7661
|
async delete(parentId, id, opts = {}) {
|
|
7647
7662
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
7648
7663
|
await this.guardStaleBeforeMutation(id, opts, "quote_items.delete", parentId);
|
|
7649
|
-
return this.deleteScopedRaw(parentId, id);
|
|
7664
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
7650
7665
|
}
|
|
7651
7666
|
/** Resolve a QuoteItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
7652
7667
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -7885,7 +7900,7 @@ var ResourceRoleQueuesResource = class extends BaseResource {
|
|
|
7885
7900
|
async update(parentId, id, data, opts = {}) {
|
|
7886
7901
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7887
7902
|
await this.guardStaleBeforeMutation(id, opts, "resource_role_queues.update", parentId);
|
|
7888
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7903
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7889
7904
|
}
|
|
7890
7905
|
/** Resolve a ResourceRoleQueue from a numeric id (or, where the vendor indexes a primary text field,
|
|
7891
7906
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -7978,7 +7993,7 @@ var ResourceSkillsResource = class extends BaseResource {
|
|
|
7978
7993
|
async update(parentId, id, data, opts = {}) {
|
|
7979
7994
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
7980
7995
|
await this.guardStaleBeforeMutation(id, opts, "resource_skills.update", parentId);
|
|
7981
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
7996
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
7982
7997
|
}
|
|
7983
7998
|
/** Resolve a ResourceSkill from a numeric id (or, where the vendor indexes a primary text field,
|
|
7984
7999
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8048,7 +8063,8 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8048
8063
|
const res = await http.request({
|
|
8049
8064
|
method: "GET",
|
|
8050
8065
|
path: `/V1.0/Companies/${id}`,
|
|
8051
|
-
operation: "resources.transferOwnership"
|
|
8066
|
+
operation: "resources.transferOwnership",
|
|
8067
|
+
maxRetries: opts?.maxRetries
|
|
8052
8068
|
});
|
|
8053
8069
|
const company = unwrapItem(res, id);
|
|
8054
8070
|
const current = typeof company.ownerResourceID === "number" ? company.ownerResourceID : null;
|
|
@@ -8058,7 +8074,8 @@ async function transferOwnership(_resource, companyIds, destinationResourceId, h
|
|
|
8058
8074
|
method: "PUT",
|
|
8059
8075
|
path: "/V1.0/Companies",
|
|
8060
8076
|
body: { id, ownerResourceID: destination },
|
|
8061
|
-
operation: "resources.transferOwnership"
|
|
8077
|
+
operation: "resources.transferOwnership",
|
|
8078
|
+
maxRetries: opts?.maxRetries
|
|
8062
8079
|
});
|
|
8063
8080
|
unwrapOperation(update);
|
|
8064
8081
|
applied.push(id);
|
|
@@ -8208,7 +8225,7 @@ var ResourceTimeOffAdditionalResource = class extends BaseResource {
|
|
|
8208
8225
|
async update(parentId, id, data, opts = {}) {
|
|
8209
8226
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
8210
8227
|
await this.guardStaleBeforeMutation(id, opts, "resource_time_off_additional.update", parentId);
|
|
8211
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
8228
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
8212
8229
|
}
|
|
8213
8230
|
/** Resolve a ResourceTimeOffAdditional from a numeric id (or, where the vendor indexes a primary text field,
|
|
8214
8231
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8451,7 +8468,7 @@ var ServiceCallsResource = class extends BaseResource {
|
|
|
8451
8468
|
async delete(id, opts = {}) {
|
|
8452
8469
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
8453
8470
|
await this.guardStaleBeforeMutation(id, opts, "service_calls.delete");
|
|
8454
|
-
return this.deleteGlobal(id);
|
|
8471
|
+
return this.deleteGlobal(id, opts);
|
|
8455
8472
|
}
|
|
8456
8473
|
/** Resolve a ServiceCall from a numeric id (or, where the vendor indexes a primary text field,
|
|
8457
8474
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8508,7 +8525,7 @@ var ServiceCallTaskResourcesResource = class extends BaseResource {
|
|
|
8508
8525
|
async delete(parentId, id, opts = {}) {
|
|
8509
8526
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
8510
8527
|
await this.guardStaleBeforeMutation(id, opts, "service_call_task_resources.delete", parentId);
|
|
8511
|
-
return this.deleteScopedRaw(parentId, id);
|
|
8528
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
8512
8529
|
}
|
|
8513
8530
|
/** Resolve a ServiceCallTaskResource from a numeric id (or, where the vendor indexes a primary text field,
|
|
8514
8531
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8565,7 +8582,7 @@ var ServiceCallTasksResource = class extends BaseResource {
|
|
|
8565
8582
|
async delete(parentId, id, opts = {}) {
|
|
8566
8583
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
8567
8584
|
await this.guardStaleBeforeMutation(id, opts, "service_call_tasks.delete", parentId);
|
|
8568
|
-
return this.deleteScopedRaw(parentId, id);
|
|
8585
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
8569
8586
|
}
|
|
8570
8587
|
/** Resolve a ServiceCallTask from a numeric id (or, where the vendor indexes a primary text field,
|
|
8571
8588
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8622,7 +8639,7 @@ var ServiceCallTicketResourcesResource = class extends BaseResource {
|
|
|
8622
8639
|
async delete(parentId, id, opts = {}) {
|
|
8623
8640
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
8624
8641
|
await this.guardStaleBeforeMutation(id, opts, "service_call_ticket_resources.delete", parentId);
|
|
8625
|
-
return this.deleteScopedRaw(parentId, id);
|
|
8642
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
8626
8643
|
}
|
|
8627
8644
|
/** Resolve a ServiceCallTicketResource from a numeric id (or, where the vendor indexes a primary text field,
|
|
8628
8645
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8679,7 +8696,7 @@ var ServiceCallTicketsResource = class extends BaseResource {
|
|
|
8679
8696
|
async delete(parentId, id, opts = {}) {
|
|
8680
8697
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
8681
8698
|
await this.guardStaleBeforeMutation(id, opts, "service_call_tickets.delete", parentId);
|
|
8682
|
-
return this.deleteScopedRaw(parentId, id);
|
|
8699
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
8683
8700
|
}
|
|
8684
8701
|
/** Resolve a ServiceCallTicket from a numeric id (or, where the vendor indexes a primary text field,
|
|
8685
8702
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -8938,7 +8955,7 @@ var SubscriptionsResource = class extends BaseResource {
|
|
|
8938
8955
|
async delete(id, opts = {}) {
|
|
8939
8956
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
8940
8957
|
await this.guardStaleBeforeMutation(id, opts, "subscriptions.delete");
|
|
8941
|
-
return this.deleteGlobal(id);
|
|
8958
|
+
return this.deleteGlobal(id, opts);
|
|
8942
8959
|
}
|
|
8943
8960
|
/** Resolve a Subscription from a numeric id (or, where the vendor indexes a primary text field,
|
|
8944
8961
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9078,7 +9095,7 @@ var TagAliasesResource = class extends BaseResource {
|
|
|
9078
9095
|
async delete(parentId, id, opts = {}) {
|
|
9079
9096
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9080
9097
|
await this.guardStaleBeforeMutation(id, opts, "tag_aliases.delete", parentId);
|
|
9081
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9098
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9082
9099
|
}
|
|
9083
9100
|
/** Resolve a TagAlias from a numeric id (or, where the vendor indexes a primary text field,
|
|
9084
9101
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9147,7 +9164,7 @@ var TagGroupsResource = class extends BaseResource {
|
|
|
9147
9164
|
async delete(id, opts = {}) {
|
|
9148
9165
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
9149
9166
|
await this.guardStaleBeforeMutation(id, opts, "tag_groups.delete");
|
|
9150
|
-
return this.deleteGlobal(id);
|
|
9167
|
+
return this.deleteGlobal(id, opts);
|
|
9151
9168
|
}
|
|
9152
9169
|
/** Resolve a TagGroup from a numeric id (or, where the vendor indexes a primary text field,
|
|
9153
9170
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9216,7 +9233,7 @@ var TagsResource = class extends BaseResource {
|
|
|
9216
9233
|
async delete(id, opts = {}) {
|
|
9217
9234
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
9218
9235
|
await this.guardStaleBeforeMutation(id, opts, "tags.delete");
|
|
9219
|
-
return this.deleteGlobal(id);
|
|
9236
|
+
return this.deleteGlobal(id, opts);
|
|
9220
9237
|
}
|
|
9221
9238
|
/** Resolve a Tag from a numeric id (or, where the vendor indexes a primary text field,
|
|
9222
9239
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9273,7 +9290,7 @@ var TaskSecondaryResourcesResource = class extends BaseResource {
|
|
|
9273
9290
|
async delete(parentId, id, opts = {}) {
|
|
9274
9291
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9275
9292
|
await this.guardStaleBeforeMutation(id, opts, "task_secondary_resources.delete", parentId);
|
|
9276
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9293
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9277
9294
|
}
|
|
9278
9295
|
/** Resolve a TaskSecondaryResource from a numeric id (or, where the vendor indexes a primary text field,
|
|
9279
9296
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9333,7 +9350,7 @@ var TasksResource = class extends BaseResource {
|
|
|
9333
9350
|
async update(parentId, id, data, opts = {}) {
|
|
9334
9351
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
9335
9352
|
await this.guardStaleBeforeMutation(id, opts, "tasks.update", parentId);
|
|
9336
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
9353
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
9337
9354
|
}
|
|
9338
9355
|
/** Resolve a Task from a numeric id (or, where the vendor indexes a primary text field,
|
|
9339
9356
|
* from an exact match on title). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -9418,7 +9435,7 @@ var TicketAdditionalConfigurationItemsResource = class extends BaseResource {
|
|
|
9418
9435
|
async delete(parentId, id, opts = {}) {
|
|
9419
9436
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9420
9437
|
await this.guardStaleBeforeMutation(id, opts, "ticket_additional_configuration_items.delete", parentId);
|
|
9421
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9438
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9422
9439
|
}
|
|
9423
9440
|
/** Resolve a TicketAdditionalConfigurationItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
9424
9441
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9475,7 +9492,7 @@ var TicketAdditionalContactsResource = class extends BaseResource {
|
|
|
9475
9492
|
async delete(parentId, id, opts = {}) {
|
|
9476
9493
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9477
9494
|
await this.guardStaleBeforeMutation(id, opts, "ticket_additional_contacts.delete", parentId);
|
|
9478
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9495
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9479
9496
|
}
|
|
9480
9497
|
/** Resolve a TicketAdditionalContact from a numeric id (or, where the vendor indexes a primary text field,
|
|
9481
9498
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9533,7 +9550,7 @@ var TicketAttachmentsResource = class extends BaseResource {
|
|
|
9533
9550
|
async delete(parentId, id, opts = {}) {
|
|
9534
9551
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9535
9552
|
await this.guardStaleBeforeMutation(id, opts, "ticket_attachments.delete", parentId);
|
|
9536
|
-
return this.deleteScopedModel(parentId, id);
|
|
9553
|
+
return this.deleteScopedModel(parentId, id, opts);
|
|
9537
9554
|
}
|
|
9538
9555
|
/** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */
|
|
9539
9556
|
async download(parentId, id) {
|
|
@@ -9695,7 +9712,7 @@ var TicketChangeRequestApprovalsResource = class extends BaseResource {
|
|
|
9695
9712
|
async delete(parentId, id, opts = {}) {
|
|
9696
9713
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9697
9714
|
await this.guardStaleBeforeMutation(id, opts, "ticket_change_request_approvals.delete", parentId);
|
|
9698
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9715
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9699
9716
|
}
|
|
9700
9717
|
/** Resolve a TicketChangeRequestApproval from a numeric id (or, where the vendor indexes a primary text field,
|
|
9701
9718
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9755,14 +9772,14 @@ var TicketChargesResource = class extends BaseResource {
|
|
|
9755
9772
|
async update(parentId, id, data, opts = {}) {
|
|
9756
9773
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
9757
9774
|
await this.guardStaleBeforeMutation(id, opts, "ticket_charges.update", parentId);
|
|
9758
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
9775
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
9759
9776
|
}
|
|
9760
9777
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
9761
9778
|
* envelope and never issues the delete. */
|
|
9762
9779
|
async delete(parentId, id, opts = {}) {
|
|
9763
9780
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9764
9781
|
await this.guardStaleBeforeMutation(id, opts, "ticket_charges.delete", parentId);
|
|
9765
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9782
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9766
9783
|
}
|
|
9767
9784
|
/** Resolve a TicketCharge from a numeric id (or, where the vendor indexes a primary text field,
|
|
9768
9785
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -9825,14 +9842,14 @@ var TicketChecklistItemsResource = class extends BaseResource {
|
|
|
9825
9842
|
async update(parentId, id, data, opts = {}) {
|
|
9826
9843
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
9827
9844
|
await this.guardStaleBeforeMutation(id, opts, "ticket_checklist_items.update", parentId);
|
|
9828
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
9845
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
9829
9846
|
}
|
|
9830
9847
|
/** Delete a record under the parent (OperationResultModel → { id}). `dryRun: true` returns the pinned
|
|
9831
9848
|
* envelope and never issues the delete. */
|
|
9832
9849
|
async delete(parentId, id, opts = {}) {
|
|
9833
9850
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9834
9851
|
await this.guardStaleBeforeMutation(id, opts, "ticket_checklist_items.delete", parentId);
|
|
9835
|
-
return this.deleteScopedRaw(parentId, id);
|
|
9852
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
9836
9853
|
}
|
|
9837
9854
|
/** Resolve a TicketChecklistItem from a numeric id (or, where the vendor indexes a primary text field,
|
|
9838
9855
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -9889,7 +9906,8 @@ var TicketChecklistLibrariesResource = class extends BaseResource {
|
|
|
9889
9906
|
method: "POST",
|
|
9890
9907
|
path: `/V1.0/Documents/${n}/ChecklistLibraries`,
|
|
9891
9908
|
body: { ...data },
|
|
9892
|
-
operation: "ticket_checklist_libraries.attachToDocument"
|
|
9909
|
+
operation: "ticket_checklist_libraries.attachToDocument",
|
|
9910
|
+
maxRetries: opts.maxRetries
|
|
9893
9911
|
});
|
|
9894
9912
|
return unwrapOperation(res);
|
|
9895
9913
|
}
|
|
@@ -9988,7 +10006,7 @@ var TicketNoteAttachmentsResource = class extends BaseResource {
|
|
|
9988
10006
|
async delete(parentId, id, opts = {}) {
|
|
9989
10007
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
9990
10008
|
await this.guardStaleBeforeMutation(id, opts, "ticket_note_attachments.delete", parentId);
|
|
9991
|
-
return this.deleteScopedModel(parentId, id);
|
|
10009
|
+
return this.deleteScopedModel(parentId, id, opts);
|
|
9992
10010
|
}
|
|
9993
10011
|
/** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */
|
|
9994
10012
|
async download(parentId, id) {
|
|
@@ -10051,7 +10069,7 @@ var TicketNotesResource = class extends BaseResource {
|
|
|
10051
10069
|
async update(parentId, id, data, opts = {}) {
|
|
10052
10070
|
if (opts.dryRun === true) return this.runUpdateDryRun(id, data, opts, parentId);
|
|
10053
10071
|
await this.guardStaleBeforeMutation(id, opts, "ticket_notes.update", parentId);
|
|
10054
|
-
return this.updateScopedRaw(parentId, id, data);
|
|
10072
|
+
return this.updateScopedRaw(parentId, id, data, opts);
|
|
10055
10073
|
}
|
|
10056
10074
|
/** Resolve a TicketNote from a numeric id (or, where the vendor indexes a primary text field,
|
|
10057
10075
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -10123,7 +10141,7 @@ var TicketNoteWebhooksResource = class extends BaseResource {
|
|
|
10123
10141
|
async delete(id, opts = {}) {
|
|
10124
10142
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
10125
10143
|
await this.guardStaleBeforeMutation(id, opts, "ticket_note_webhooks.delete");
|
|
10126
|
-
return this.deleteGlobal(id);
|
|
10144
|
+
return this.deleteGlobal(id, opts);
|
|
10127
10145
|
}
|
|
10128
10146
|
/** Resolve a TicketNoteWebhook from a numeric id (or, where the vendor indexes a primary text field,
|
|
10129
10147
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -10184,7 +10202,7 @@ var TicketSecondaryResourcesResource = class extends BaseResource {
|
|
|
10184
10202
|
async delete(parentId, id, opts = {}) {
|
|
10185
10203
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
10186
10204
|
await this.guardStaleBeforeMutation(id, opts, "ticket_secondary_resources.delete", parentId);
|
|
10187
|
-
return this.deleteScopedRaw(parentId, id);
|
|
10205
|
+
return this.deleteScopedRaw(parentId, id, opts);
|
|
10188
10206
|
}
|
|
10189
10207
|
/** Resolve a TicketSecondaryResource from a numeric id (or, where the vendor indexes a primary text field,
|
|
10190
10208
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -10481,12 +10499,12 @@ function namedVendorFields(err) {
|
|
|
10481
10499
|
function vendorDetailOf(err) {
|
|
10482
10500
|
return isAutotaskError(err) ? formatVendorDetail(err.vendorError) : void 0;
|
|
10483
10501
|
}
|
|
10484
|
-
async function fetchItem(http, path, operation) {
|
|
10485
|
-
const res = await http.request({ method: "GET", path, operation });
|
|
10502
|
+
async function fetchItem(http, path, operation, readOpts) {
|
|
10503
|
+
const res = await http.request({ method: "GET", path, operation, maxRetries: readOpts?.maxRetries });
|
|
10486
10504
|
return unwrapItemOrNull(res);
|
|
10487
10505
|
}
|
|
10488
|
-
async function fetchItemUnredacted(http, path, operation) {
|
|
10489
|
-
const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true });
|
|
10506
|
+
async function fetchItemUnredacted(http, path, operation, readOpts) {
|
|
10507
|
+
const res = await http.request({ method: "GET", path, operation, skipResponseRedaction: true, maxRetries: readOpts?.maxRetries });
|
|
10490
10508
|
return unwrapItemOrNull(res);
|
|
10491
10509
|
}
|
|
10492
10510
|
function unwrapItemOrNull(res) {
|
|
@@ -10589,7 +10607,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10589
10607
|
}
|
|
10590
10608
|
if (assign !== void 0 && assignee !== void 0) {
|
|
10591
10609
|
const rid = assignee;
|
|
10592
|
-
const rec = await fetchItem(http, `/V1.0/Resources/${rid}`, OP_OPEN);
|
|
10610
|
+
const rec = await fetchItem(http, `/V1.0/Resources/${rid}`, OP_OPEN, { maxRetries: opts.maxRetries });
|
|
10593
10611
|
if (rec === null) {
|
|
10594
10612
|
throw new TicketResourceInvalidError(
|
|
10595
10613
|
`openWithNoteAndAssign: assignee resource ${assignee} was not found (resources.get returned item: null \u2014 the resources table is blind to the API user; get is the authority)`,
|
|
@@ -10688,7 +10706,7 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10688
10706
|
let noteId = null;
|
|
10689
10707
|
if (noteBody !== null) {
|
|
10690
10708
|
try {
|
|
10691
|
-
const res = await http.request({ method: "POST", path: `/V1.0/Tickets/${ticketId}/Notes`, body: noteBody, operation: OP_OPEN });
|
|
10709
|
+
const res = await http.request({ method: "POST", path: `/V1.0/Tickets/${ticketId}/Notes`, body: noteBody, operation: OP_OPEN, maxRetries: opts.maxRetries });
|
|
10692
10710
|
noteId = operationId(res) ?? null;
|
|
10693
10711
|
steps.push({ name: "note", ok: true });
|
|
10694
10712
|
} catch (err) {
|
|
@@ -10699,14 +10717,14 @@ async function openWithNoteAndAssign(resource, params, note, assign, opts, http)
|
|
|
10699
10717
|
let ticketNumber = null;
|
|
10700
10718
|
if (assign !== void 0) {
|
|
10701
10719
|
try {
|
|
10702
|
-
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN);
|
|
10720
|
+
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_OPEN, { maxRetries: opts.maxRetries });
|
|
10703
10721
|
if (current === null) {
|
|
10704
10722
|
throw new NotFoundError(`openWithNoteAndAssign: ticket ${ticketId} vanished between the create and the assign merge read`, { operation: OP_OPEN, resourceIds: [ticketId] });
|
|
10705
10723
|
}
|
|
10706
10724
|
ticketNumber = typeof current.ticketNumber === "string" ? current.ticketNumber : null;
|
|
10707
10725
|
const merged = mergePartialBody(current, { id: ticketId, assignedResourceID: assignee, assignedResourceRoleID: roleID });
|
|
10708
10726
|
merged.id = ticketId;
|
|
10709
|
-
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN });
|
|
10727
|
+
await http.request({ method: "PUT", path: "/V1.0/Tickets", body: merged, operation: OP_OPEN, maxRetries: opts.maxRetries });
|
|
10710
10728
|
assigned = true;
|
|
10711
10729
|
steps.push({ name: "assign", ok: true });
|
|
10712
10730
|
} catch (err) {
|
|
@@ -10806,7 +10824,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10806
10824
|
if (fields !== void 0 && (typeof fields !== "object" || fields === null || Array.isArray(fields))) {
|
|
10807
10825
|
throw new AutotaskConfigError("changeStatus: fields must be a plain object of ticket fields (or omitted)", { operation: OP_STATUS });
|
|
10808
10826
|
}
|
|
10809
|
-
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);
|
|
10827
|
+
const current = await fetchItemUnredacted(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10810
10828
|
if (current === null) {
|
|
10811
10829
|
throw new NotFoundError(`changeStatus: ticket ${ticketId} was not found (tickets.get returned item: null)`, { operation: OP_STATUS, resourceIds: [ticketId] });
|
|
10812
10830
|
}
|
|
@@ -10891,7 +10909,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10891
10909
|
let merges = 0;
|
|
10892
10910
|
for (; ; ) {
|
|
10893
10911
|
try {
|
|
10894
|
-
await http.request({ method: "PUT", path: "/V1.0/Tickets", body, operation: OP_STATUS });
|
|
10912
|
+
await http.request({ method: "PUT", path: "/V1.0/Tickets", body, operation: OP_STATUS, maxRetries: opts.maxRetries });
|
|
10895
10913
|
break;
|
|
10896
10914
|
} catch (err) {
|
|
10897
10915
|
const named = namedVendorFields(err);
|
|
@@ -10919,7 +10937,7 @@ async function changeStatus(resource, id, targetStatus, fields, opts, http) {
|
|
|
10919
10937
|
throw err;
|
|
10920
10938
|
}
|
|
10921
10939
|
}
|
|
10922
|
-
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS);
|
|
10940
|
+
const verify = await fetchItem(http, `/V1.0/Tickets/${ticketId}`, OP_STATUS, { maxRetries: opts.maxRetries });
|
|
10923
10941
|
if (verify === null) {
|
|
10924
10942
|
throw new AutotaskError(`changeStatus: the post-PUT read-back found no ticket ${ticketId} (the PUT 200ed but the record is gone)`, {
|
|
10925
10943
|
code: "INVALID_RESPONSE",
|
|
@@ -11215,7 +11233,7 @@ var TicketWebhooksResource = class extends BaseResource {
|
|
|
11215
11233
|
async delete(id, opts = {}) {
|
|
11216
11234
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
11217
11235
|
await this.guardStaleBeforeMutation(id, opts, "ticket_webhooks.delete");
|
|
11218
|
-
return this.deleteGlobal(id);
|
|
11236
|
+
return this.deleteGlobal(id, opts);
|
|
11219
11237
|
}
|
|
11220
11238
|
/** Resolve a TicketWebhook from a numeric id (or, where the vendor indexes a primary text field,
|
|
11221
11239
|
* from an exact match on name). A numeric id miss throws NOT_FOUND; a complete
|
|
@@ -11653,7 +11671,7 @@ async function createForResource(resource, resourceID, params, opts = {}, http)
|
|
|
11653
11671
|
for (let attempt = 1; attempt <= MAX_CREATE_ATTEMPTS; attempt += 1) {
|
|
11654
11672
|
if (usedLinkage !== "internal") body.roleID = roleCandidates[Math.min(attempt, roleCandidates.length) - 1];
|
|
11655
11673
|
try {
|
|
11656
|
-
const created = await resource.create(body, {});
|
|
11674
|
+
const created = await resource.create(body, { maxRetries: opts.maxRetries });
|
|
11657
11675
|
return {
|
|
11658
11676
|
id: created.id,
|
|
11659
11677
|
linkage: usedLinkage,
|
|
@@ -11756,7 +11774,7 @@ var TimeEntriesResource = class extends BaseResource {
|
|
|
11756
11774
|
async delete(id, opts = {}) {
|
|
11757
11775
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts);
|
|
11758
11776
|
await this.guardStaleBeforeMutation(id, opts, "time_entries.delete");
|
|
11759
|
-
return this.deleteGlobal(id);
|
|
11777
|
+
return this.deleteGlobal(id, opts);
|
|
11760
11778
|
}
|
|
11761
11779
|
/** Resolve a TimeEntry from a numeric id (or, where the vendor indexes a primary text field,
|
|
11762
11780
|
* from a numeric id — this resource has no primary text field). A numeric id miss throws NOT_FOUND;
|
|
@@ -11882,7 +11900,7 @@ var TimeEntryAttachmentsResource = class extends BaseResource {
|
|
|
11882
11900
|
async delete(parentId, id, opts = {}) {
|
|
11883
11901
|
if (opts.dryRun === true) return this.runDeleteDryRun(id, opts, parentId);
|
|
11884
11902
|
await this.guardStaleBeforeMutation(id, opts, "time_entry_attachments.delete", parentId);
|
|
11885
|
-
return this.deleteScopedModel(parentId, id);
|
|
11903
|
+
return this.deleteScopedModel(parentId, id, opts);
|
|
11886
11904
|
}
|
|
11887
11905
|
/** Download the attachment bytes (GET .../{id}/data; node-proven path, quirk #9) → Buffer. */
|
|
11888
11906
|
async download(parentId, id) {
|
|
@@ -11918,7 +11936,8 @@ async function approve(_resource, id, opts = {}, http) {
|
|
|
11918
11936
|
const res = await http.request({
|
|
11919
11937
|
method: "GET",
|
|
11920
11938
|
path: `/V1.0/TimeOffRequests/${numericId}/Approve`,
|
|
11921
|
-
operation: "time_off_requests.approve"
|
|
11939
|
+
operation: "time_off_requests.approve",
|
|
11940
|
+
maxRetries: opts.maxRetries
|
|
11922
11941
|
});
|
|
11923
11942
|
return unwrapOperation(res);
|
|
11924
11943
|
}
|
|
@@ -11944,7 +11963,8 @@ async function reject(_resource, id, reason, opts = {}, http) {
|
|
|
11944
11963
|
method: "POST",
|
|
11945
11964
|
path: `/V1.0/TimeOffRequests/${numericId}/Reject`,
|
|
11946
11965
|
body: { timeOffRequestID: numericId, reason: text },
|
|
11947
|
-
operation: "time_off_requests.reject"
|
|
11966
|
+
operation: "time_off_requests.reject",
|
|
11967
|
+
maxRetries: opts.maxRetries
|
|
11948
11968
|
});
|
|
11949
11969
|
return unwrapOperation(res);
|
|
11950
11970
|
}
|