node-autotask 0.93.0 → 0.93.1
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/dist/{chunk-X7FGWEZ2.cjs → chunk-I75N5VVE.cjs} +200 -200
- package/dist/{chunk-3SURRIOQ.js → chunk-L7SWLH3U.js} +2 -2
- package/dist/{chunk-FCQPZAIK.js → chunk-NDGMPMCW.js} +1 -1
- package/dist/{chunk-ZIBH42H3.cjs → chunk-NRO2NJAZ.cjs} +9 -1
- package/dist/{chunk-2FM7MRK2.cjs → chunk-RYPG3K4Y.cjs} +30 -30
- package/dist/{chunk-HJKI5VVJ.js → chunk-TWQQ3EER.js} +9 -1
- package/dist/index.cjs +85 -85
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +50 -50
- package/dist/operations/index.d.cts +6 -0
- package/dist/operations/index.d.ts +6 -0
- package/dist/operations/index.js +1 -1
- package/dist/pool.cjs +23 -14
- package/dist/pool.d.cts +9 -6
- package/dist/pool.d.ts +9 -6
- package/dist/pool.js +16 -7
- package/dist/resources/index.cjs +26 -26
- package/dist/resources/index.js +2 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-
|
|
2
|
-
import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-
|
|
1
|
+
import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-NDGMPMCW.js';
|
|
2
|
+
import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-TWQQ3EER.js';
|
|
3
3
|
|
|
4
4
|
// src/client.ts
|
|
5
5
|
var AutotaskClient = class {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GenericResource, readTasks, OperationNotSupportedError, rejectInventoryFactsOption, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-
|
|
1
|
+
import { GenericResource, readTasks, OperationNotSupportedError, rejectInventoryFactsOption, parseIdentifier, AutotaskConfigError, isRecord, isDateYMD, isAutotaskError, RateLimitError, MaintenanceError, AutotaskError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-TWQQ3EER.js';
|
|
2
2
|
import { loadCapabilityRecords } from './chunk-DCISF6AG.js';
|
|
3
3
|
|
|
4
4
|
// src/resources/special/configuration_items.ts
|
|
@@ -19529,6 +19529,7 @@ function kindFetches(holder, resource) {
|
|
|
19529
19529
|
udf: () => holder?.getUdfInfo?.() ?? Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))
|
|
19530
19530
|
};
|
|
19531
19531
|
}
|
|
19532
|
+
var KIND_OPERATIONS = { info: "getEntityInfo", fields: "getFieldInfo", udf: "getUdfInfo" };
|
|
19532
19533
|
function catalogProjector(kind, ctx) {
|
|
19533
19534
|
if (ctx.compact) {
|
|
19534
19535
|
const keepValues = ctx.labels && ctx.fieldsFilter !== void 0;
|
|
@@ -19584,6 +19585,11 @@ async function sweepResource(ctx, resource, tally, reads) {
|
|
|
19584
19585
|
} else if (peek.age !== null) ages.push(peek.age);
|
|
19585
19586
|
if (outcome.status === "rejected") {
|
|
19586
19587
|
const error = outcome.reason;
|
|
19588
|
+
const { category, httpStatus } = error;
|
|
19589
|
+
const operation = `${resource}.${KIND_OPERATIONS[kind]}`;
|
|
19590
|
+
if (category === "auth" && error.operation === operation && (httpStatus === 401 || httpStatus === 403) && (tally.authFailure === void 0 || httpStatus < tally.authFailure.httpStatus)) {
|
|
19591
|
+
tally.authFailure = { httpStatus, operation };
|
|
19592
|
+
}
|
|
19587
19593
|
if (row.error === null) row.error = { code: error.code, message: error.message };
|
|
19588
19594
|
continue;
|
|
19589
19595
|
}
|
|
@@ -19666,6 +19672,7 @@ async function fieldCatalog(client, opts) {
|
|
|
19666
19672
|
ttlMs: cache?.ttlMs ?? null,
|
|
19667
19673
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19668
19674
|
rows,
|
|
19675
|
+
...tally.authFailure === void 0 ? {} : { authFailure: tally.authFailure },
|
|
19669
19676
|
wireUsed: tally.wireUsed,
|
|
19670
19677
|
cap: MAX_FIELD_CATALOG_WIRE,
|
|
19671
19678
|
truncated: false,
|
|
@@ -32119,7 +32126,8 @@ async function guardUnscopedQueryWalk(holder, operation, bag) {
|
|
|
32119
32126
|
counted = await holder.count({ filter: conditions === void 0 ? void 0 : conditions });
|
|
32120
32127
|
} catch (err) {
|
|
32121
32128
|
const code = err?.code;
|
|
32122
|
-
|
|
32129
|
+
const denied = isAutotaskError(err) && err.category === "auth" && (err.httpStatus === 401 || err.httpStatus === 403);
|
|
32130
|
+
if (denied || typeof code === "string" && PROPAGATE_CODES.has(code)) throw err;
|
|
32123
32131
|
const label = typeof code === "string" && /^[A-Z][A-Z_]{2,40}$/.test(code) ? ` (${code})` : "";
|
|
32124
32132
|
return { note: `scope check skipped: the pre-flight count failed${label}; this unscoped walk was not guarded.` };
|
|
32125
32133
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkI75N5VVE_cjs = require('./chunk-I75N5VVE.cjs');
|
|
4
|
+
var chunkNRO2NJAZ_cjs = require('./chunk-NRO2NJAZ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/client.ts
|
|
7
7
|
var AutotaskClient = class {
|
|
@@ -180,34 +180,34 @@ var AutotaskClient = class {
|
|
|
180
180
|
* anything is wired. Construction issues NO request.
|
|
181
181
|
*/
|
|
182
182
|
constructor(options) {
|
|
183
|
-
this.config =
|
|
184
|
-
this.http = new
|
|
183
|
+
this.config = chunkNRO2NJAZ_cjs.resolveConfig(options);
|
|
184
|
+
this.http = new chunkNRO2NJAZ_cjs.HttpClient(this.config);
|
|
185
185
|
this.http.client = this;
|
|
186
|
-
for (const entry of
|
|
187
|
-
this[entry.accessor] = new
|
|
186
|
+
for (const entry of chunkNRO2NJAZ_cjs.SIMPLE_RESOURCES) {
|
|
187
|
+
this[entry.accessor] = new chunkNRO2NJAZ_cjs.GenericResource(this.http, entry, this.config.pageSize);
|
|
188
188
|
}
|
|
189
|
-
this.companies = new
|
|
190
|
-
this.configurationItems = new
|
|
191
|
-
this.contacts = new
|
|
192
|
-
this.contracts = new
|
|
193
|
-
this.inventoryProducts = new
|
|
194
|
-
this.invoices = new
|
|
195
|
-
this.quotes = new
|
|
196
|
-
this.resourceTimeOffAdditional = new
|
|
197
|
-
this.resourceTimeOffBalances = new
|
|
198
|
-
this.resources = new
|
|
199
|
-
this.serviceCalls = new
|
|
200
|
-
this.ticketCharges = new
|
|
201
|
-
this.tickets = new
|
|
202
|
-
this.timeEntries = new
|
|
203
|
-
this.timeOffRequests = new
|
|
204
|
-
this.authenticateResource = new
|
|
205
|
-
this.entityInformation = new
|
|
206
|
-
this.modules = new
|
|
207
|
-
this.thresholdInformation = new
|
|
208
|
-
this.version = new
|
|
209
|
-
this.versionInformation = new
|
|
210
|
-
this.zoneInformation = new
|
|
189
|
+
this.companies = new chunkNRO2NJAZ_cjs.CompaniesResource(this.http, this.config.pageSize);
|
|
190
|
+
this.configurationItems = new chunkI75N5VVE_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
|
|
191
|
+
this.contacts = new chunkI75N5VVE_cjs.ContactsResource(this.http, this.config.pageSize);
|
|
192
|
+
this.contracts = new chunkNRO2NJAZ_cjs.ContractsResource(this.http, this.config.pageSize);
|
|
193
|
+
this.inventoryProducts = new chunkI75N5VVE_cjs.InventoryProductsResource(this.http, this.config.pageSize);
|
|
194
|
+
this.invoices = new chunkNRO2NJAZ_cjs.InvoicesResource(this.http, this.config.pageSize);
|
|
195
|
+
this.quotes = new chunkI75N5VVE_cjs.QuotesResource(this.http, this.config.pageSize);
|
|
196
|
+
this.resourceTimeOffAdditional = new chunkI75N5VVE_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
|
|
197
|
+
this.resourceTimeOffBalances = new chunkI75N5VVE_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
|
|
198
|
+
this.resources = new chunkI75N5VVE_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
|
|
199
|
+
this.serviceCalls = new chunkI75N5VVE_cjs.ServiceCallsResource(this.http, this.config.pageSize);
|
|
200
|
+
this.ticketCharges = new chunkI75N5VVE_cjs.TicketChargesResource(this.http, this.config.pageSize);
|
|
201
|
+
this.tickets = new chunkI75N5VVE_cjs.TicketsResource(this.http, this.config.pageSize);
|
|
202
|
+
this.timeEntries = new chunkNRO2NJAZ_cjs.TimeEntriesResource(this.http, this.config.pageSize);
|
|
203
|
+
this.timeOffRequests = new chunkI75N5VVE_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
|
|
204
|
+
this.authenticateResource = new chunkI75N5VVE_cjs.AuthenticateResource(this.http);
|
|
205
|
+
this.entityInformation = new chunkI75N5VVE_cjs.EntityInformationResource(this.http);
|
|
206
|
+
this.modules = new chunkI75N5VVE_cjs.ModulesResource(this.http);
|
|
207
|
+
this.thresholdInformation = new chunkI75N5VVE_cjs.ThresholdInformationResource(this.http);
|
|
208
|
+
this.version = new chunkI75N5VVE_cjs.VersionResource(this.http);
|
|
209
|
+
this.versionInformation = new chunkI75N5VVE_cjs.VersionInformationResource(this.http);
|
|
210
|
+
this.zoneInformation = new chunkI75N5VVE_cjs.ZoneInformationResource(this.http);
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
|
|
@@ -241,10 +241,10 @@ var AutotaskClient = class {
|
|
|
241
241
|
* parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
|
|
242
242
|
*/
|
|
243
243
|
withSignal(signal, fn) {
|
|
244
|
-
return
|
|
244
|
+
return chunkNRO2NJAZ_cjs.runWithSignal(signal, fn);
|
|
245
245
|
}
|
|
246
246
|
async batch(fn, items, opts = {}) {
|
|
247
|
-
return
|
|
247
|
+
return chunkNRO2NJAZ_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
|
|
248
248
|
}
|
|
249
249
|
};
|
|
250
250
|
|
|
@@ -19527,6 +19527,7 @@ function kindFetches(holder, resource) {
|
|
|
19527
19527
|
udf: () => holder?.getUdfInfo?.() ?? Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))
|
|
19528
19528
|
};
|
|
19529
19529
|
}
|
|
19530
|
+
var KIND_OPERATIONS = { info: "getEntityInfo", fields: "getFieldInfo", udf: "getUdfInfo" };
|
|
19530
19531
|
function catalogProjector(kind, ctx) {
|
|
19531
19532
|
if (ctx.compact) {
|
|
19532
19533
|
const keepValues = ctx.labels && ctx.fieldsFilter !== void 0;
|
|
@@ -19582,6 +19583,11 @@ async function sweepResource(ctx, resource, tally, reads) {
|
|
|
19582
19583
|
} else if (peek.age !== null) ages.push(peek.age);
|
|
19583
19584
|
if (outcome.status === "rejected") {
|
|
19584
19585
|
const error = outcome.reason;
|
|
19586
|
+
const { category, httpStatus } = error;
|
|
19587
|
+
const operation = `${resource}.${KIND_OPERATIONS[kind]}`;
|
|
19588
|
+
if (category === "auth" && error.operation === operation && (httpStatus === 401 || httpStatus === 403) && (tally.authFailure === void 0 || httpStatus < tally.authFailure.httpStatus)) {
|
|
19589
|
+
tally.authFailure = { httpStatus, operation };
|
|
19590
|
+
}
|
|
19585
19591
|
if (row.error === null) row.error = { code: error.code, message: error.message };
|
|
19586
19592
|
continue;
|
|
19587
19593
|
}
|
|
@@ -19664,6 +19670,7 @@ async function fieldCatalog(client, opts) {
|
|
|
19664
19670
|
ttlMs: cache?.ttlMs ?? null,
|
|
19665
19671
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19666
19672
|
rows,
|
|
19673
|
+
...tally.authFailure === void 0 ? {} : { authFailure: tally.authFailure },
|
|
19667
19674
|
wireUsed: tally.wireUsed,
|
|
19668
19675
|
cap: MAX_FIELD_CATALOG_WIRE,
|
|
19669
19676
|
truncated: false,
|
|
@@ -32117,7 +32124,8 @@ async function guardUnscopedQueryWalk(holder, operation, bag) {
|
|
|
32117
32124
|
counted = await holder.count({ filter: conditions === void 0 ? void 0 : conditions });
|
|
32118
32125
|
} catch (err) {
|
|
32119
32126
|
const code = err?.code;
|
|
32120
|
-
|
|
32127
|
+
const denied = isAutotaskError(err) && err.category === "auth" && (err.httpStatus === 401 || err.httpStatus === 403);
|
|
32128
|
+
if (denied || typeof code === "string" && PROPAGATE_CODES.has(code)) throw err;
|
|
32121
32129
|
const label = typeof code === "string" && /^[A-Z][A-Z_]{2,40}$/.test(code) ? ` (${code})` : "";
|
|
32122
32130
|
return { note: `scope check skipped: the pre-flight count failed${label}; this unscoped walk was not guarded.` };
|
|
32123
32131
|
}
|