node-autotask 0.88.1 → 0.89.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 +6 -0
- package/README.md +3 -4
- package/dist/{chunk-JVVE4XEN.js → chunk-2PWAWWWM.js} +2 -2
- package/dist/{chunk-33UVHMFN.js → chunk-4EIN7AZJ.js} +2 -2
- package/dist/{chunk-JHDT4O7N.cjs → chunk-4MPQ5CDB.cjs} +199 -199
- package/dist/{chunk-DSHWQMF2.cjs → chunk-BRU7TZOD.cjs} +30 -30
- package/dist/{chunk-KM7ITBOT.js → chunk-OVIYLMGB.js} +8 -9
- package/dist/{chunk-YTOBU3Z6.cjs → chunk-YAXEPESA.cjs} +8 -9
- package/dist/{index-XDIy_GvD.d.cts → index-CoTtEn8U.d.cts} +5 -10
- package/dist/{index-GSA44LRd.d.ts → index-Wh6bLfv_.d.ts} +5 -10
- package/dist/index.cjs +84 -84
- package/dist/index.d.cts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +50 -50
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +1 -1
- package/dist/pool.cjs +11 -11
- package/dist/pool.js +3 -3
- package/dist/resources/index.cjs +26 -26
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +2 -2
- package/docs/API.md +17 -29
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4MPQ5CDB_cjs = require('./chunk-4MPQ5CDB.cjs');
|
|
4
|
+
var chunkYAXEPESA_cjs = require('./chunk-YAXEPESA.cjs');
|
|
5
5
|
|
|
6
6
|
// src/client.ts
|
|
7
7
|
var AutotaskClient = class {
|
|
@@ -175,34 +175,34 @@ var AutotaskClient = class {
|
|
|
175
175
|
* anything is wired. Construction issues NO request.
|
|
176
176
|
*/
|
|
177
177
|
constructor(options) {
|
|
178
|
-
this.config =
|
|
179
|
-
this.http = new
|
|
178
|
+
this.config = chunkYAXEPESA_cjs.resolveConfig(options);
|
|
179
|
+
this.http = new chunkYAXEPESA_cjs.HttpClient(this.config);
|
|
180
180
|
this.http.client = this;
|
|
181
|
-
for (const entry of
|
|
182
|
-
this[entry.accessor] = new
|
|
181
|
+
for (const entry of chunkYAXEPESA_cjs.SIMPLE_RESOURCES) {
|
|
182
|
+
this[entry.accessor] = new chunkYAXEPESA_cjs.GenericResource(this.http, entry, this.config.pageSize);
|
|
183
183
|
}
|
|
184
|
-
this.companies = new
|
|
185
|
-
this.configurationItems = new
|
|
186
|
-
this.contacts = new
|
|
187
|
-
this.contracts = new
|
|
188
|
-
this.inventoryProducts = new
|
|
189
|
-
this.invoices = new
|
|
190
|
-
this.quotes = new
|
|
191
|
-
this.resourceTimeOffAdditional = new
|
|
192
|
-
this.resourceTimeOffBalances = new
|
|
193
|
-
this.resources = new
|
|
194
|
-
this.serviceCalls = new
|
|
195
|
-
this.ticketCharges = new
|
|
196
|
-
this.tickets = new
|
|
197
|
-
this.timeEntries = new
|
|
198
|
-
this.timeOffRequests = new
|
|
199
|
-
this.authenticateResource = new
|
|
200
|
-
this.entityInformation = new
|
|
201
|
-
this.modules = new
|
|
202
|
-
this.thresholdInformation = new
|
|
203
|
-
this.version = new
|
|
204
|
-
this.versionInformation = new
|
|
205
|
-
this.zoneInformation = new
|
|
184
|
+
this.companies = new chunkYAXEPESA_cjs.CompaniesResource(this.http, this.config.pageSize);
|
|
185
|
+
this.configurationItems = new chunk4MPQ5CDB_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
|
|
186
|
+
this.contacts = new chunk4MPQ5CDB_cjs.ContactsResource(this.http, this.config.pageSize);
|
|
187
|
+
this.contracts = new chunkYAXEPESA_cjs.ContractsResource(this.http, this.config.pageSize);
|
|
188
|
+
this.inventoryProducts = new chunk4MPQ5CDB_cjs.InventoryProductsResource(this.http, this.config.pageSize);
|
|
189
|
+
this.invoices = new chunkYAXEPESA_cjs.InvoicesResource(this.http, this.config.pageSize);
|
|
190
|
+
this.quotes = new chunk4MPQ5CDB_cjs.QuotesResource(this.http, this.config.pageSize);
|
|
191
|
+
this.resourceTimeOffAdditional = new chunk4MPQ5CDB_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
|
|
192
|
+
this.resourceTimeOffBalances = new chunk4MPQ5CDB_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
|
|
193
|
+
this.resources = new chunk4MPQ5CDB_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
|
|
194
|
+
this.serviceCalls = new chunk4MPQ5CDB_cjs.ServiceCallsResource(this.http, this.config.pageSize);
|
|
195
|
+
this.ticketCharges = new chunk4MPQ5CDB_cjs.TicketChargesResource(this.http, this.config.pageSize);
|
|
196
|
+
this.tickets = new chunk4MPQ5CDB_cjs.TicketsResource(this.http, this.config.pageSize);
|
|
197
|
+
this.timeEntries = new chunkYAXEPESA_cjs.TimeEntriesResource(this.http, this.config.pageSize);
|
|
198
|
+
this.timeOffRequests = new chunk4MPQ5CDB_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
|
|
199
|
+
this.authenticateResource = new chunk4MPQ5CDB_cjs.AuthenticateResource(this.http);
|
|
200
|
+
this.entityInformation = new chunk4MPQ5CDB_cjs.EntityInformationResource(this.http);
|
|
201
|
+
this.modules = new chunk4MPQ5CDB_cjs.ModulesResource(this.http);
|
|
202
|
+
this.thresholdInformation = new chunk4MPQ5CDB_cjs.ThresholdInformationResource(this.http);
|
|
203
|
+
this.version = new chunk4MPQ5CDB_cjs.VersionResource(this.http);
|
|
204
|
+
this.versionInformation = new chunk4MPQ5CDB_cjs.VersionInformationResource(this.http);
|
|
205
|
+
this.zoneInformation = new chunk4MPQ5CDB_cjs.ZoneInformationResource(this.http);
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
|
|
@@ -236,10 +236,10 @@ var AutotaskClient = class {
|
|
|
236
236
|
* parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
|
|
237
237
|
*/
|
|
238
238
|
withSignal(signal, fn) {
|
|
239
|
-
return
|
|
239
|
+
return chunkYAXEPESA_cjs.runWithSignal(signal, fn);
|
|
240
240
|
}
|
|
241
241
|
async batch(fn, items, opts = {}) {
|
|
242
|
-
return
|
|
242
|
+
return chunkYAXEPESA_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
245
|
|
|
@@ -400,7 +400,7 @@ function suggestedActionForStatus(status) {
|
|
|
400
400
|
return status >= 500 ? "The SDK already retried per its policy. A repeated 500 on one entity while others work usually means the API user lacks permission on that entity \u2014 ask the Autotask admin to grant it; otherwise retry once more at most." : void 0;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
function errorFromStatus(status, body, url, operation, redactPersonalData =
|
|
403
|
+
function errorFromStatus(status, body, url, operation, redactPersonalData = false, credential, includeVendorDetails = true) {
|
|
404
404
|
const safeBody = redactResponseBody(body, { redactPersonalData });
|
|
405
405
|
const exposedBody = includeVendorDetails ? safeBody : void 0;
|
|
406
406
|
let detail = formatVendorDetail(exposedBody);
|
|
@@ -1395,7 +1395,7 @@ function resolveConfig(config) {
|
|
|
1395
1395
|
const rateLimit = resolveRateLimit(config, agent);
|
|
1396
1396
|
const cooldown = resolveCooldown(config);
|
|
1397
1397
|
const resolution = resolveResolution(config, agent);
|
|
1398
|
-
const redactPersonalData = config.redactPersonalData ??
|
|
1398
|
+
const redactPersonalData = config.redactPersonalData ?? false;
|
|
1399
1399
|
const caches = resolveCaches(config);
|
|
1400
1400
|
const update = { putFallback: config.update?.putFallback === true };
|
|
1401
1401
|
const reResolveZoneOn401 = config.reResolveZoneOn401 === true;
|
|
@@ -1985,9 +1985,8 @@ function isJsonMediaType(header) {
|
|
|
1985
1985
|
const mediaType = header.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
1986
1986
|
return mediaType.startsWith("application/json") || mediaType.endsWith("+json");
|
|
1987
1987
|
}
|
|
1988
|
-
function bodySnippet(text
|
|
1989
|
-
|
|
1990
|
-
return redactResponseBody(bytes, { redactPersonalData });
|
|
1988
|
+
function bodySnippet(text) {
|
|
1989
|
+
return Buffer.from(text, "utf8").subarray(0, 256).toString("utf8");
|
|
1991
1990
|
}
|
|
1992
1991
|
|
|
1993
1992
|
// src/http/limits.ts
|
|
@@ -17475,7 +17474,7 @@ var HttpClient = class {
|
|
|
17475
17474
|
since,
|
|
17476
17475
|
retryAfterMs: s.maintenancePollMs,
|
|
17477
17476
|
httpStatus: status,
|
|
17478
|
-
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text
|
|
17477
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) },
|
|
17479
17478
|
maintenanceDetected: true
|
|
17480
17479
|
},
|
|
17481
17480
|
suggestedAction: unknownWrite ? `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).` : `The Autotask zone is in its maintenance window (since ${since}); retry after the window (windows usually last 30-90 min).`
|
|
@@ -17653,7 +17652,7 @@ var HttpClient = class {
|
|
|
17653
17652
|
httpStatus: status,
|
|
17654
17653
|
details: {
|
|
17655
17654
|
httpStatus: status,
|
|
17656
|
-
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text
|
|
17655
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) }
|
|
17657
17656
|
},
|
|
17658
17657
|
// The content-type is host-sourced (a host-supplied
|
|
17659
17658
|
// baseUrl can serve arbitrary HTML) — capped, never prose;
|
|
@@ -17704,7 +17703,7 @@ var HttpClient = class {
|
|
|
17704
17703
|
nonJsonBody = text;
|
|
17705
17704
|
}
|
|
17706
17705
|
}
|
|
17707
|
-
const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody
|
|
17706
|
+
const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody);
|
|
17708
17707
|
const nonJsonIsMaintenance = s.maintenancePage;
|
|
17709
17708
|
const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
|
|
17710
17709
|
if (nonJsonIsMaintenance) {
|
|
@@ -18947,7 +18946,7 @@ function attachUpdateTargetMissReason(err, key) {
|
|
|
18947
18946
|
if (pinned === void 0) return;
|
|
18948
18947
|
err.details = { ...err.details ?? {}, emptyReason: pinned };
|
|
18949
18948
|
}
|
|
18950
|
-
function buildDryRunResult(spec, policy
|
|
18949
|
+
function buildDryRunResult(spec, policy) {
|
|
18951
18950
|
if (spec.operation === "") {
|
|
18952
18951
|
throw new AutotaskConfigError("dry-run: the operation name is required");
|
|
18953
18952
|
}
|
|
@@ -402,7 +402,7 @@ function suggestedActionForStatus(status) {
|
|
|
402
402
|
return status >= 500 ? "The SDK already retried per its policy. A repeated 500 on one entity while others work usually means the API user lacks permission on that entity \u2014 ask the Autotask admin to grant it; otherwise retry once more at most." : void 0;
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function errorFromStatus(status, body, url, operation, redactPersonalData =
|
|
405
|
+
function errorFromStatus(status, body, url, operation, redactPersonalData = false, credential, includeVendorDetails = true) {
|
|
406
406
|
const safeBody = redactResponseBody(body, { redactPersonalData });
|
|
407
407
|
const exposedBody = includeVendorDetails ? safeBody : void 0;
|
|
408
408
|
let detail = formatVendorDetail(exposedBody);
|
|
@@ -1397,7 +1397,7 @@ function resolveConfig(config) {
|
|
|
1397
1397
|
const rateLimit = resolveRateLimit(config, agent);
|
|
1398
1398
|
const cooldown = resolveCooldown(config);
|
|
1399
1399
|
const resolution = resolveResolution(config, agent);
|
|
1400
|
-
const redactPersonalData = config.redactPersonalData ??
|
|
1400
|
+
const redactPersonalData = config.redactPersonalData ?? false;
|
|
1401
1401
|
const caches = resolveCaches(config);
|
|
1402
1402
|
const update = { putFallback: config.update?.putFallback === true };
|
|
1403
1403
|
const reResolveZoneOn401 = config.reResolveZoneOn401 === true;
|
|
@@ -1987,9 +1987,8 @@ function isJsonMediaType(header) {
|
|
|
1987
1987
|
const mediaType = header.split(";")[0]?.trim().toLowerCase() ?? "";
|
|
1988
1988
|
return mediaType.startsWith("application/json") || mediaType.endsWith("+json");
|
|
1989
1989
|
}
|
|
1990
|
-
function bodySnippet(text
|
|
1991
|
-
|
|
1992
|
-
return redactResponseBody(bytes, { redactPersonalData });
|
|
1990
|
+
function bodySnippet(text) {
|
|
1991
|
+
return Buffer.from(text, "utf8").subarray(0, 256).toString("utf8");
|
|
1993
1992
|
}
|
|
1994
1993
|
|
|
1995
1994
|
// src/http/limits.ts
|
|
@@ -17477,7 +17476,7 @@ var HttpClient = class {
|
|
|
17477
17476
|
since,
|
|
17478
17477
|
retryAfterMs: s.maintenancePollMs,
|
|
17479
17478
|
httpStatus: status,
|
|
17480
|
-
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text
|
|
17479
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) },
|
|
17481
17480
|
maintenanceDetected: true
|
|
17482
17481
|
},
|
|
17483
17482
|
suggestedAction: unknownWrite ? `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).` : `The Autotask zone is in its maintenance window (since ${since}); retry after the window (windows usually last 30-90 min).`
|
|
@@ -17655,7 +17654,7 @@ var HttpClient = class {
|
|
|
17655
17654
|
httpStatus: status,
|
|
17656
17655
|
details: {
|
|
17657
17656
|
httpStatus: status,
|
|
17658
|
-
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text
|
|
17657
|
+
...s.getQuery ? {} : { contentType, bodySnippet: bodySnippet(text) }
|
|
17659
17658
|
},
|
|
17660
17659
|
// The content-type is host-sourced (a host-supplied
|
|
17661
17660
|
// baseUrl can serve arbitrary HTML) — capped, never prose;
|
|
@@ -17706,7 +17705,7 @@ var HttpClient = class {
|
|
|
17706
17705
|
nonJsonBody = text;
|
|
17707
17706
|
}
|
|
17708
17707
|
}
|
|
17709
|
-
const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody
|
|
17708
|
+
const nonJsonSnippet = nonJsonBody === void 0 || s.getQuery ? void 0 : bodySnippet(nonJsonBody);
|
|
17710
17709
|
const nonJsonIsMaintenance = s.maintenancePage;
|
|
17711
17710
|
const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
|
|
17712
17711
|
if (nonJsonIsMaintenance) {
|
|
@@ -18949,7 +18948,7 @@ function attachUpdateTargetMissReason(err, key) {
|
|
|
18949
18948
|
if (pinned === void 0) return;
|
|
18950
18949
|
err.details = { ...err.details ?? {}, emptyReason: pinned };
|
|
18951
18950
|
}
|
|
18952
|
-
function buildDryRunResult(spec, policy
|
|
18951
|
+
function buildDryRunResult(spec, policy) {
|
|
18953
18952
|
if (spec.operation === "") {
|
|
18954
18953
|
throw new AutotaskConfigError("dry-run: the operation name is required");
|
|
18955
18954
|
}
|
|
@@ -520,16 +520,11 @@ interface AutotaskConfig {
|
|
|
520
520
|
*/
|
|
521
521
|
onAudit?: (event: AuditEvent) => void;
|
|
522
522
|
/**
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* SECRET class (`password`, `secretKey`, `secret`) is ALWAYS redacted
|
|
529
|
-
* regardless of this flag: the SDK is the only permission boundary (the
|
|
530
|
-
* vendor API has no read-only key), so credential values never cross the
|
|
531
|
-
* SDK boundary in a response. Request bodies are never redacted
|
|
532
|
-
* (credentials travel in writes by design). See docs/API.md section 10.
|
|
523
|
+
* Redact personal and business-sensitive fields in parsed response bodies
|
|
524
|
+
* and dry-run results. Defaults to `false`, which returns those field
|
|
525
|
+
* values as received. Set `true` to redact them. Structured secret fields
|
|
526
|
+
* (`password`, `secretKey`, `secret`) are redacted under either policy.
|
|
527
|
+
* See docs/API.md section 10.
|
|
533
528
|
*/
|
|
534
529
|
redactPersonalData?: boolean;
|
|
535
530
|
/**
|
|
@@ -520,16 +520,11 @@ interface AutotaskConfig {
|
|
|
520
520
|
*/
|
|
521
521
|
onAudit?: (event: AuditEvent) => void;
|
|
522
522
|
/**
|
|
523
|
-
*
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* SECRET class (`password`, `secretKey`, `secret`) is ALWAYS redacted
|
|
529
|
-
* regardless of this flag: the SDK is the only permission boundary (the
|
|
530
|
-
* vendor API has no read-only key), so credential values never cross the
|
|
531
|
-
* SDK boundary in a response. Request bodies are never redacted
|
|
532
|
-
* (credentials travel in writes by design). See docs/API.md section 10.
|
|
523
|
+
* Redact personal and business-sensitive fields in parsed response bodies
|
|
524
|
+
* and dry-run results. Defaults to `false`, which returns those field
|
|
525
|
+
* values as received. Set `true` to redact them. Structured secret fields
|
|
526
|
+
* (`password`, `secretKey`, `secret`) are redacted under either policy.
|
|
527
|
+
* See docs/API.md section 10.
|
|
533
528
|
*/
|
|
534
529
|
redactPersonalData?: boolean;
|
|
535
530
|
/**
|