node-autotask 0.68.1 → 0.69.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 +12 -0
- package/MCP_TOOL_CATALOG.json +2 -2
- package/README.md +51 -10
- package/capabilities.json +7 -7
- package/dist/capabilities-data.js +6 -6
- package/dist/capabilities.cjs +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-2D2KJOX2.cjs → chunk-24GRFW55.cjs} +236 -222
- package/dist/{chunk-LOLWHPTJ.js → chunk-2BB7OASJ.js} +3 -30
- package/dist/{chunk-S6HEIGGM.js → chunk-AH6WAGPS.js} +80 -66
- package/dist/{chunk-KRQONGLD.cjs → chunk-DPRY3CUJ.cjs} +30 -57
- package/dist/{chunk-XKIRTR37.cjs → chunk-JLBSUZ5B.cjs} +919 -344
- package/dist/{chunk-SGH7F2CH.cjs → chunk-KAZE4WC7.cjs} +3 -3
- package/dist/{chunk-YYHCZRUH.js → chunk-QDBJCGQD.js} +912 -339
- package/dist/{chunk-JCMXQUIC.js → chunk-SCFB5MF3.js} +3 -3
- package/dist/{index-DQ08uOH0.d.ts → index-CxBU31jT.d.ts} +16 -9
- package/dist/{index-mIsdpO5d.d.cts → index-WZ3A8nG6.d.cts} +16 -9
- package/dist/index.cjs +92 -85
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -7
- 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 +2 -2
- package/dist/pool.cjs +12 -12
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +27 -27
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/docs/API.md +77 -16
- package/docs/LIVE-TESTING.md +16 -2
- package/docs/VENDOR-QUIRKS.md +39 -0
- package/docs/performance-finance.md +35 -0
- package/examples/mcp-env-config.ts +3 -4
- 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,
|
|
1
|
+
import { ConfigurationItemsResource, ContactsResource, InventoryProductsResource, QuotesResource, ResourceTimeOffAdditionalResource, ResourceTimeOffBalancesResource, ResourcesResource, ServiceCallsResource, TicketChargesResource, TicketsResource, TimeOffRequestsResource, AuthenticateResource, EntityInformationResource, ModulesResource, ThresholdInformationResource, VersionResource, VersionInformationResource, ZoneInformationResource } from './chunk-AH6WAGPS.js';
|
|
2
|
+
import { resolveConfig, HttpClient, SIMPLE_RESOURCES, GenericResource, CompaniesResource, ContractsResource, InvoicesResource, TimeEntriesResource, runWithSignal, runBounded } from './chunk-QDBJCGQD.js';
|
|
3
3
|
|
|
4
4
|
// src/client.ts
|
|
5
5
|
var AutotaskClient = class {
|
|
@@ -216,34 +216,7 @@ var AutotaskClient = class {
|
|
|
216
216
|
return runWithSignal(signal, fn);
|
|
217
217
|
}
|
|
218
218
|
async batch(fn, items, opts = {}) {
|
|
219
|
-
|
|
220
|
-
if (!Number.isInteger(concurrency) || concurrency <= 0) {
|
|
221
|
-
throw new AutotaskConfigError("batch concurrency must be a positive integer");
|
|
222
|
-
}
|
|
223
|
-
const { signal, settle } = opts;
|
|
224
|
-
const results = new Array(items.length);
|
|
225
|
-
let next = 0;
|
|
226
|
-
let failure;
|
|
227
|
-
const worker = async () => {
|
|
228
|
-
while (failure === void 0 && next < items.length) {
|
|
229
|
-
if (signal?.aborted) {
|
|
230
|
-
failure ??= { error: signal.reason };
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const i = next++;
|
|
234
|
-
try {
|
|
235
|
-
const item = items[i];
|
|
236
|
-
const value = await (signal === void 0 ? fn(item) : runWithSignal(signal, () => fn(item)));
|
|
237
|
-
results[i] = settle ? { status: "fulfilled", value } : value;
|
|
238
|
-
} catch (error) {
|
|
239
|
-
if (settle) results[i] = { status: "rejected", reason: error };
|
|
240
|
-
else failure ??= { error };
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));
|
|
245
|
-
if (failure !== void 0) throw failure.error;
|
|
246
|
-
return results;
|
|
219
|
+
return runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
|
|
247
220
|
}
|
|
248
221
|
};
|
|
249
222
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GenericResource, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError,
|
|
2
|
-
import { loadCapabilityRecords } from './chunk-
|
|
1
|
+
import { GenericResource, readTasks, parseIdentifier, AutotaskConfigError, StaleObjectError, buildDryRunResult, createNamePlan, resolveCompositeNames, addNameSibling, NotFoundError, unwrapItems, ConflictError, clientOf, compositePartLimit, invokeRead, compositePart, openTicketsOfPart, unwrapOperation, unwrapItem, ResolutionError, joinedCompositePart, runMove, resolveTicketStatusSemantics, openStatusFilter, isClosedStatus, vendorId, isAutotaskError, resolveLineOfBusinessChain, cachedRecordGet, uiLinkFor, refuse, queryRows, mergePartialBody, AutotaskError, TICKET_LABEL_FIELDS, addLabelSibling, parseVendorErrors, RELATIONSHIP_MAP, cursorToPath } from './chunk-QDBJCGQD.js';
|
|
2
|
+
import { loadCapabilityRecords } from './chunk-SCFB5MF3.js';
|
|
3
3
|
|
|
4
4
|
// src/resources/special/configuration_items.ts
|
|
5
5
|
async function fetchRecord(http, path, label, readOpts) {
|
|
@@ -92,11 +92,7 @@ async function contextFetchPart(http, entityPath, referenceId, entity) {
|
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
try {
|
|
95
|
-
const res = await http.
|
|
96
|
-
method: "GET",
|
|
97
|
-
path: `${entityPath}/${referenceId}`,
|
|
98
|
-
operation: "configuration_items.profile"
|
|
99
|
-
});
|
|
95
|
+
const res = await cachedRecordGet(http, `${entityPath}/${referenceId}`, "configuration_items.profile");
|
|
100
96
|
const body = res;
|
|
101
97
|
if (body === null || !("item" in body)) {
|
|
102
98
|
throw new NotFoundError(`context part not found (unexpected envelope shape)`, { resourceIds: [referenceId], details: { idRefs: [{ entity, id: referenceId }] } });
|
|
@@ -126,11 +122,13 @@ async function profile(resource, id, opts = {}) {
|
|
|
126
122
|
const relatedLimit = profilePartLimit(opts.relatedLimit, "relatedLimit");
|
|
127
123
|
const ci = await resource.get(id);
|
|
128
124
|
const root = ci;
|
|
129
|
-
const type = await
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
125
|
+
const [type, category, notes, relatedItems, associations] = await readTasks(http, [
|
|
126
|
+
() => contextFetchPart(http, "/V1.0/ConfigurationItemTypes", root["configurationItemType"], "configuration_item_type"),
|
|
127
|
+
() => contextFetchPart(http, "/V1.0/ConfigurationItemCategories", root["configurationItemCategoryID"], "configuration_item_category"),
|
|
128
|
+
() => ciScopedQuery(http, "/V1.0/ConfigurationItemNotes/query", id, noteLimit),
|
|
129
|
+
() => ciScopedQuery(http, "/V1.0/ConfigurationItemRelatedItems/query", id, relatedLimit),
|
|
130
|
+
() => ciScopedQuery(http, "/V1.0/ConfigurationItemBillingProductAssociations/query", id, PROFILE_PART_LIMIT)
|
|
131
|
+
]);
|
|
134
132
|
const productAssociations = {
|
|
135
133
|
items: associations,
|
|
136
134
|
capped: associations.length >= PROFILE_PART_LIMIT,
|
|
@@ -191,9 +189,11 @@ var ConfigurationItemsResource = class extends GenericResource {
|
|
|
191
189
|
async getContext(id) {
|
|
192
190
|
const configurationItem = await this.fetchRecordRaw("/V1.0/ConfigurationItems", id);
|
|
193
191
|
const root = configurationItem;
|
|
194
|
-
const company = await this.
|
|
195
|
-
|
|
196
|
-
|
|
192
|
+
const [company, contact, contract] = await readTasks(this.http, [
|
|
193
|
+
() => this.contextFetch("/V1.0/Companies", root["companyID"]),
|
|
194
|
+
() => this.contextFetch("/V1.0/Contacts", root["contactID"]),
|
|
195
|
+
() => this.contextFetch("/V1.0/Contracts", root["contractID"])
|
|
196
|
+
]);
|
|
197
197
|
return { configurationItem, company, contact, contract };
|
|
198
198
|
}
|
|
199
199
|
/** Node-parity special op (hand-written in src/resources/special/configuration_items.ts). */
|
|
@@ -320,13 +320,10 @@ async function fullProfile(resource, id, opts = {}) {
|
|
|
320
320
|
}
|
|
321
321
|
const fk = typeof row.companyID === "number" && row.companyID > 0 ? row.companyID : null;
|
|
322
322
|
const root = fk === null ? row : await invokeRead(client, "contacts.get", [fk, contactId]);
|
|
323
|
-
const company
|
|
324
|
-
|
|
325
|
-
client,
|
|
326
|
-
|
|
327
|
-
contactId,
|
|
328
|
-
ticketLimit
|
|
329
|
-
);
|
|
323
|
+
const [company, openTickets] = await readTasks(resource.http, [
|
|
324
|
+
async () => fk === null ? { value: null, absent: "NO_FK" } : await compositePart(client, "companies.get", [fk]),
|
|
325
|
+
async () => await openTicketsOfPart(client, "contactID", contactId, ticketLimit)
|
|
326
|
+
]);
|
|
330
327
|
return { root, parts: { company, open_tickets: openTickets } };
|
|
331
328
|
}
|
|
332
329
|
|
|
@@ -586,17 +583,23 @@ async function workload(resource, id, opts = {}) {
|
|
|
586
583
|
const resourceId = parseIdentifier(id, "id");
|
|
587
584
|
const root = await invokeRead(client, "resources.get", [resourceId]);
|
|
588
585
|
const strict = { allowAssumed: false };
|
|
589
|
-
const joined = await
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
586
|
+
const [joined, counted, assignmentBranch, balances, timeOff] = await readTasks(resource.http, [
|
|
587
|
+
() => compositePart(client, "tickets.forResource", [
|
|
588
|
+
resourceId,
|
|
589
|
+
{ openOnly: true, limit: Math.min(ticketLimit, 500), ...strict }
|
|
590
|
+
]),
|
|
591
|
+
() => compositePart(client, "tickets.forResource", [resourceId, { countOnly: true, ...strict }]),
|
|
592
|
+
async () => {
|
|
593
|
+
const assignments2 = await compositePart(client, "service_call_task_resources.query", [
|
|
594
|
+
{ filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: taskLimit }
|
|
595
|
+
]);
|
|
596
|
+
const taskDetails2 = await joinedCompositePart(client, assignments2, "serviceCallTaskID", "service_call_tasks.query", "id", taskLimit, "NO_ASSIGNMENTS");
|
|
597
|
+
return { assignments: assignments2, taskDetails: taskDetails2 };
|
|
598
|
+
},
|
|
599
|
+
() => compositePart(client, "resource_time_off_balances.getByResource", [resourceId]),
|
|
600
|
+
() => compositePart(client, "time_off_requests.query", [
|
|
601
|
+
{ filter: [{ field: "resourceID", op: "eq", value: resourceId }], limit: timeOffLimit }
|
|
602
|
+
])
|
|
600
603
|
]);
|
|
601
604
|
const openTickets = joined.value !== null && typeof joined.value === "object" ? counted.value !== null && typeof counted.value === "object" ? (() => {
|
|
602
605
|
const { primary, secondary, both, open, capped } = counted.value;
|
|
@@ -608,13 +611,7 @@ async function workload(resource, id, opts = {}) {
|
|
|
608
611
|
...joined,
|
|
609
612
|
value: { ...joined.value, totalsAbsent: counted.absent ?? "NO_TOTALS" }
|
|
610
613
|
} : joined;
|
|
611
|
-
const
|
|
612
|
-
assignments.value?.items ?? [],
|
|
613
|
-
"serviceCallTaskID"
|
|
614
|
-
).slice(0, IN_FILTER_CAP);
|
|
615
|
-
const taskDetails = taskIds.length === 0 ? { value: null, absent: "NO_ASSIGNMENTS" } : await compositePart(client, "service_call_tasks.query", [
|
|
616
|
-
{ filter: [{ field: "id", op: "in", value: taskIds }], limit: taskLimit }
|
|
617
|
-
]);
|
|
614
|
+
const { assignments, taskDetails } = assignmentBranch;
|
|
618
615
|
return {
|
|
619
616
|
root,
|
|
620
617
|
parts: {
|
|
@@ -665,19 +662,19 @@ async function fullProfile2(resource, id, opts = {}) {
|
|
|
665
662
|
const taskLimit = compositePartLimit(opts.taskLimit, "taskLimit", OP2);
|
|
666
663
|
const callId = parseIdentifier(id, "id");
|
|
667
664
|
const root = await invokeRead(client, "service_calls.get", [callId]);
|
|
668
|
-
const tickets = await
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
{ filter: [{ field: "serviceCallTaskID", op: "in", value: taskIds }], limit: taskLimit }
|
|
665
|
+
const [tickets, taskBranch] = await readTasks(resource.http, [
|
|
666
|
+
() => compositePart(client, "service_call_tickets.query", [
|
|
667
|
+
{ filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: ticketLimit }
|
|
668
|
+
]),
|
|
669
|
+
async () => {
|
|
670
|
+
const tasks2 = await compositePart(client, "service_call_tasks.query", [
|
|
671
|
+
{ filter: [{ field: "serviceCallID", op: "eq", value: callId }], limit: taskLimit }
|
|
672
|
+
]);
|
|
673
|
+
const resourceAssignments2 = await joinedCompositePart(client, tasks2, "id", "service_call_task_resources.query", "serviceCallTaskID", taskLimit, "NO_TASKS");
|
|
674
|
+
return { tasks: tasks2, resourceAssignments: resourceAssignments2 };
|
|
675
|
+
}
|
|
680
676
|
]);
|
|
677
|
+
const { tasks, resourceAssignments } = taskBranch;
|
|
681
678
|
return {
|
|
682
679
|
root,
|
|
683
680
|
parts: {
|
|
@@ -1225,6 +1222,12 @@ async function forResource(_resource, resourceIDIn, opts = {}) {
|
|
|
1225
1222
|
};
|
|
1226
1223
|
}
|
|
1227
1224
|
|
|
1225
|
+
// src/resources/special/tickets/context.ts
|
|
1226
|
+
function ticketContextValue(ticket, parts) {
|
|
1227
|
+
const [company, contact, resource, project] = parts;
|
|
1228
|
+
return { ticket, company, contact, resource, project };
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1228
1231
|
// src/resources/special/tickets/common.ts
|
|
1229
1232
|
async function fetchTicket(http, id, operation) {
|
|
1230
1233
|
const res = await http.request({
|
|
@@ -1412,17 +1415,23 @@ async function addCompositeNames(http, ctx, entriesPart, result, opts) {
|
|
|
1412
1415
|
};
|
|
1413
1416
|
result.truncated = result.truncated || names.section.truncated;
|
|
1414
1417
|
}
|
|
1415
|
-
async function fullContext(resource, id, opts = {}) {
|
|
1418
|
+
async function fullContext(resource, id, opts = {}, loadContext) {
|
|
1416
1419
|
const http = resource.http;
|
|
1417
1420
|
const noteLimit = partLimit(opts.noteLimit, "noteLimit");
|
|
1418
1421
|
const timeEntryLimit = partLimit(opts.timeEntryLimit, "timeEntryLimit");
|
|
1419
1422
|
const textLimit = partLimit(opts.textLimit, "textLimit");
|
|
1420
1423
|
const ticketId = parseIdentifier(id, "id");
|
|
1421
|
-
const
|
|
1424
|
+
const { ticket, tasks: contextTasks } = await loadContext();
|
|
1422
1425
|
const op = "tickets.fullContext";
|
|
1423
1426
|
const ticketFilter = [{ field: "ticketID", op: "eq", value: ticketId }];
|
|
1424
|
-
const
|
|
1425
|
-
|
|
1427
|
+
const [company, contact, assignedResource, project, notes, entries, attachmentsRead, historiesRead] = await readTasks(http, [
|
|
1428
|
+
...contextTasks,
|
|
1429
|
+
() => ticketChildRead(http, { globalPath: "/V1.0/TicketNotes/query", resourceKey: "ticket_notes", filter: ticketFilter, limit: noteLimit, operation: op }, ticketId),
|
|
1430
|
+
() => ticketChildRead(http, { globalPath: "/V1.0/TimeEntries/query", resourceKey: "time_entries", filter: ticketFilter, limit: timeEntryLimit, operation: op }, ticketId),
|
|
1431
|
+
() => opts.includeAttachments !== false ? ticketChildRead(http, { globalPath: "/V1.0/TicketAttachments/query", resourceKey: "ticket_attachments", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId) : Promise.resolve(void 0),
|
|
1432
|
+
() => opts.includeHistories === true ? ticketChildRead(http, { globalPath: "/V1.0/TicketHistory/query", resourceKey: "ticket_history", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId) : Promise.resolve(void 0)
|
|
1433
|
+
]);
|
|
1434
|
+
const ctx = ticketContextValue(ticket, [company, contact, assignedResource, project]);
|
|
1426
1435
|
const notesRows = notes.items.map((n) => servedTextRecord(n, "description", textLimit));
|
|
1427
1436
|
const notesPart = { items: notesRows, capped: notes.capped };
|
|
1428
1437
|
applyRouteStatus(notesPart, notes);
|
|
@@ -1431,8 +1440,8 @@ async function fullContext(resource, id, opts = {}) {
|
|
|
1431
1440
|
const notesTextTruncated = notesRows.some((n) => n.descriptionTruncated === true);
|
|
1432
1441
|
let attachments = { ids: [], names: [], capped: false };
|
|
1433
1442
|
let attachmentsStatus = "ok";
|
|
1434
|
-
if (
|
|
1435
|
-
const read =
|
|
1443
|
+
if (attachmentsRead !== void 0) {
|
|
1444
|
+
const read = attachmentsRead;
|
|
1436
1445
|
attachmentsStatus = read.status;
|
|
1437
1446
|
attachments = {
|
|
1438
1447
|
ids: read.items.map((r) => Number(r.id)),
|
|
@@ -1461,8 +1470,7 @@ async function fullContext(resource, id, opts = {}) {
|
|
|
1461
1470
|
attachments: attachmentsStatus
|
|
1462
1471
|
}
|
|
1463
1472
|
};
|
|
1464
|
-
if (
|
|
1465
|
-
const historiesRead = await ticketChildRead(http, { globalPath: "/V1.0/TicketHistory/query", resourceKey: "ticket_history", filter: ticketFilter, limit: DEFAULT_PART_LIMIT, operation: op }, ticketId);
|
|
1473
|
+
if (historiesRead !== void 0) {
|
|
1466
1474
|
const historyRows = historiesRead.items.map((h) => servedTextRecord(h, "detail", textLimit));
|
|
1467
1475
|
const part = { items: historyRows, capped: historiesRead.capped };
|
|
1468
1476
|
applyRouteStatus(part, historiesRead);
|
|
@@ -1729,13 +1737,19 @@ var TicketsResource = class extends GenericResource {
|
|
|
1729
1737
|
/** Get the Ticket with its primary context records in one call (each part a single-record
|
|
1730
1738
|
* fetch; no sub-lists; absent/dangling references come back null). */
|
|
1731
1739
|
async getContext(id) {
|
|
1740
|
+
const { ticket, tasks } = await this.readTicketContext(id);
|
|
1741
|
+
return ticketContextValue(ticket, await readTasks(this.http, tasks));
|
|
1742
|
+
}
|
|
1743
|
+
/** Root authority and reusable lazy FK tasks shared by both ticket composites. */
|
|
1744
|
+
async readTicketContext(id) {
|
|
1732
1745
|
const ticket = await this.fetchRecordRaw("/V1.0/Tickets", id, true);
|
|
1733
1746
|
const root = ticket;
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1747
|
+
return { ticket, tasks: [
|
|
1748
|
+
() => this.contextFetch("/V1.0/Companies", root["companyID"]),
|
|
1749
|
+
() => this.contextFetch("/V1.0/Contacts", root["contactID"]),
|
|
1750
|
+
() => this.contextFetch("/V1.0/Resources", root["assignedResourceID"]),
|
|
1751
|
+
() => this.contextFetch("/V1.0/Projects", root["projectID"])
|
|
1752
|
+
] };
|
|
1739
1753
|
}
|
|
1740
1754
|
/** Node-parity special op (hand-written in src/resources/special/tickets/changeStatus.ts). */
|
|
1741
1755
|
changeStatus(id, targetStatus, fields, opts = {}) {
|
|
@@ -1755,7 +1769,7 @@ var TicketsResource = class extends GenericResource {
|
|
|
1755
1769
|
}
|
|
1756
1770
|
/** Node-parity special op (hand-written in src/resources/special/tickets/fullContext.ts). */
|
|
1757
1771
|
fullContext(id, opts) {
|
|
1758
|
-
return fullContext(this, id, opts);
|
|
1772
|
+
return fullContext(this, id, opts, () => this.readTicketContext(id));
|
|
1759
1773
|
}
|
|
1760
1774
|
/** Node-parity special op (hand-written in src/resources/special/tickets/statusSemantics.ts). */
|
|
1761
1775
|
statusSemantics(opts) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk24GRFW55_cjs = require('./chunk-24GRFW55.cjs');
|
|
4
|
+
var chunkJLBSUZ5B_cjs = require('./chunk-JLBSUZ5B.cjs');
|
|
5
5
|
|
|
6
6
|
// src/client.ts
|
|
7
7
|
var AutotaskClient = class {
|
|
@@ -154,34 +154,34 @@ var AutotaskClient = class {
|
|
|
154
154
|
* anything is wired. Construction issues NO request.
|
|
155
155
|
*/
|
|
156
156
|
constructor(options) {
|
|
157
|
-
this.config =
|
|
158
|
-
this.http = new
|
|
157
|
+
this.config = chunkJLBSUZ5B_cjs.resolveConfig(options);
|
|
158
|
+
this.http = new chunkJLBSUZ5B_cjs.HttpClient(this.config);
|
|
159
159
|
this.http.client = this;
|
|
160
|
-
for (const entry of
|
|
161
|
-
this[entry.accessor] = new
|
|
160
|
+
for (const entry of chunkJLBSUZ5B_cjs.SIMPLE_RESOURCES) {
|
|
161
|
+
this[entry.accessor] = new chunkJLBSUZ5B_cjs.GenericResource(this.http, entry, this.config.pageSize);
|
|
162
162
|
}
|
|
163
|
-
this.companies = new
|
|
164
|
-
this.configurationItems = new
|
|
165
|
-
this.contacts = new
|
|
166
|
-
this.contracts = new
|
|
167
|
-
this.inventoryProducts = new
|
|
168
|
-
this.invoices = new
|
|
169
|
-
this.quotes = new
|
|
170
|
-
this.resourceTimeOffAdditional = new
|
|
171
|
-
this.resourceTimeOffBalances = new
|
|
172
|
-
this.resources = new
|
|
173
|
-
this.serviceCalls = new
|
|
174
|
-
this.ticketCharges = new
|
|
175
|
-
this.tickets = new
|
|
176
|
-
this.timeEntries = new
|
|
177
|
-
this.timeOffRequests = new
|
|
178
|
-
this.authenticateResource = new
|
|
179
|
-
this.entityInformation = new
|
|
180
|
-
this.modules = new
|
|
181
|
-
this.thresholdInformation = new
|
|
182
|
-
this.version = new
|
|
183
|
-
this.versionInformation = new
|
|
184
|
-
this.zoneInformation = new
|
|
163
|
+
this.companies = new chunkJLBSUZ5B_cjs.CompaniesResource(this.http, this.config.pageSize);
|
|
164
|
+
this.configurationItems = new chunk24GRFW55_cjs.ConfigurationItemsResource(this.http, this.config.pageSize);
|
|
165
|
+
this.contacts = new chunk24GRFW55_cjs.ContactsResource(this.http, this.config.pageSize);
|
|
166
|
+
this.contracts = new chunkJLBSUZ5B_cjs.ContractsResource(this.http, this.config.pageSize);
|
|
167
|
+
this.inventoryProducts = new chunk24GRFW55_cjs.InventoryProductsResource(this.http, this.config.pageSize);
|
|
168
|
+
this.invoices = new chunkJLBSUZ5B_cjs.InvoicesResource(this.http, this.config.pageSize);
|
|
169
|
+
this.quotes = new chunk24GRFW55_cjs.QuotesResource(this.http, this.config.pageSize);
|
|
170
|
+
this.resourceTimeOffAdditional = new chunk24GRFW55_cjs.ResourceTimeOffAdditionalResource(this.http, this.config.pageSize);
|
|
171
|
+
this.resourceTimeOffBalances = new chunk24GRFW55_cjs.ResourceTimeOffBalancesResource(this.http, this.config.pageSize);
|
|
172
|
+
this.resources = new chunk24GRFW55_cjs.ResourcesResource(this.http, this.config, this.config.pageSize);
|
|
173
|
+
this.serviceCalls = new chunk24GRFW55_cjs.ServiceCallsResource(this.http, this.config.pageSize);
|
|
174
|
+
this.ticketCharges = new chunk24GRFW55_cjs.TicketChargesResource(this.http, this.config.pageSize);
|
|
175
|
+
this.tickets = new chunk24GRFW55_cjs.TicketsResource(this.http, this.config.pageSize);
|
|
176
|
+
this.timeEntries = new chunkJLBSUZ5B_cjs.TimeEntriesResource(this.http, this.config.pageSize);
|
|
177
|
+
this.timeOffRequests = new chunk24GRFW55_cjs.TimeOffRequestsResource(this.http, this.config.pageSize);
|
|
178
|
+
this.authenticateResource = new chunk24GRFW55_cjs.AuthenticateResource(this.http);
|
|
179
|
+
this.entityInformation = new chunk24GRFW55_cjs.EntityInformationResource(this.http);
|
|
180
|
+
this.modules = new chunk24GRFW55_cjs.ModulesResource(this.http);
|
|
181
|
+
this.thresholdInformation = new chunk24GRFW55_cjs.ThresholdInformationResource(this.http);
|
|
182
|
+
this.version = new chunk24GRFW55_cjs.VersionResource(this.http);
|
|
183
|
+
this.versionInformation = new chunk24GRFW55_cjs.VersionInformationResource(this.http);
|
|
184
|
+
this.zoneInformation = new chunk24GRFW55_cjs.ZoneInformationResource(this.http);
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
187
|
* `GET /V1.0/Authenticate` → `AuthTokenResultModel` (as-is). The SDK does
|
|
@@ -215,37 +215,10 @@ var AutotaskClient = class {
|
|
|
215
215
|
* parameter on each: `await client.withSignal(signal, () => invoke(client, ...))`.
|
|
216
216
|
*/
|
|
217
217
|
withSignal(signal, fn) {
|
|
218
|
-
return
|
|
218
|
+
return chunkJLBSUZ5B_cjs.runWithSignal(signal, fn);
|
|
219
219
|
}
|
|
220
220
|
async batch(fn, items, opts = {}) {
|
|
221
|
-
|
|
222
|
-
if (!Number.isInteger(concurrency) || concurrency <= 0) {
|
|
223
|
-
throw new chunkXKIRTR37_cjs.AutotaskConfigError("batch concurrency must be a positive integer");
|
|
224
|
-
}
|
|
225
|
-
const { signal, settle } = opts;
|
|
226
|
-
const results = new Array(items.length);
|
|
227
|
-
let next = 0;
|
|
228
|
-
let failure;
|
|
229
|
-
const worker = async () => {
|
|
230
|
-
while (failure === void 0 && next < items.length) {
|
|
231
|
-
if (signal?.aborted) {
|
|
232
|
-
failure ??= { error: signal.reason };
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
const i = next++;
|
|
236
|
-
try {
|
|
237
|
-
const item = items[i];
|
|
238
|
-
const value = await (signal === void 0 ? fn(item) : chunkXKIRTR37_cjs.runWithSignal(signal, () => fn(item)));
|
|
239
|
-
results[i] = settle ? { status: "fulfilled", value } : value;
|
|
240
|
-
} catch (error) {
|
|
241
|
-
if (settle) results[i] = { status: "rejected", reason: error };
|
|
242
|
-
else failure ??= { error };
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, worker));
|
|
247
|
-
if (failure !== void 0) throw failure.error;
|
|
248
|
-
return results;
|
|
221
|
+
return chunkJLBSUZ5B_cjs.runBounded(fn, items, { ...opts, concurrency: opts.concurrency ?? this.config.maxConcurrent });
|
|
249
222
|
}
|
|
250
223
|
};
|
|
251
224
|
|