node-autotask 0.38.0 → 0.39.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 +24 -0
- package/MCP_TOOL_CATALOG.json +2 -2
- package/MCP_TOOL_MANIFEST.md +7 -7
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +1460 -1429
- package/capabilities.schema.json +2 -1
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +4 -4
- package/dist/capabilities.d.ts +4 -4
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-DCTUBUIZ.cjs → chunk-73QNAEAF.cjs} +143 -143
- package/dist/{chunk-IY3WCPCK.js → chunk-CQXB7KAO.js} +2 -2
- package/dist/{chunk-U3K6IDKB.js → chunk-GDSCYY2G.js} +1459 -1428
- package/dist/{chunk-7FNKFNIJ.cjs → chunk-GIVYTQ6R.cjs} +285 -285
- package/dist/{chunk-IY5QZZVF.cjs → chunk-LB34VFQY.cjs} +254 -143
- package/dist/{chunk-KPYXO7F5.js → chunk-LDTJNLX7.js} +2 -2
- package/dist/{chunk-4QHGCYEI.js → chunk-LN3HQQBR.js} +136 -25
- package/dist/{chunk-73JMTV4O.cjs → chunk-VR6RYXTD.cjs} +1459 -1428
- package/dist/{index-Q-4HQEEb.d.ts → index-C-Oqef4y.d.cts} +7170 -52
- package/dist/{index-BFbUB5YD.d.cts → index-C-Oqef4y.d.ts} +7170 -52
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +181 -177
- package/dist/operations/index.d.cts +3 -172
- package/dist/operations/index.d.ts +3 -172
- package/dist/operations/index.js +6 -2
- package/dist/pool.cjs +9 -9
- package/dist/pool.d.cts +1 -2
- package/dist/pool.d.ts +1 -2
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +1 -2
- package/dist/resources/index.d.ts +1 -2
- package/dist/resources/index.js +3 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/API.md +63 -8
- package/package.json +1 -1
- package/dist/index-BQVStxwi.d.cts +0 -6893
- package/dist/index-BQVStxwi.d.ts +0 -6893
|
@@ -67,30 +67,32 @@
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
var _chunkIY5QZZVFcjs = require('../chunk-IY5QZZVF.cjs');
|
|
71
70
|
|
|
72
71
|
|
|
73
|
-
var
|
|
72
|
+
var _chunkLB34VFQYcjs = require('../chunk-LB34VFQY.cjs');
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
var _chunkVR6RYXTDcjs = require('../chunk-VR6RYXTD.cjs');
|
|
74
76
|
require('../chunk-MJTKK3QG.cjs');
|
|
75
77
|
|
|
76
78
|
// src/operations/searchAcrossResources.ts
|
|
77
79
|
var DEFAULT_LIMIT = 25;
|
|
78
80
|
function resourceFor(client, key) {
|
|
79
|
-
return client[
|
|
81
|
+
return client[_chunkLB34VFQYcjs.camelKey.call(void 0, key)];
|
|
80
82
|
}
|
|
81
83
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
82
84
|
const text = query.trim();
|
|
83
85
|
if (text === "") {
|
|
84
|
-
throw new (0,
|
|
86
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
85
87
|
}
|
|
86
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
88
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkLB34VFQYcjs.WORKFLOW_RESOURCES));
|
|
87
89
|
if (keys.length === 0) {
|
|
88
|
-
throw new (0,
|
|
90
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
89
91
|
}
|
|
90
|
-
const limit =
|
|
92
|
+
const limit = _chunkLB34VFQYcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
91
93
|
const totalLimit = opts.totalLimit;
|
|
92
94
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
93
|
-
throw new (0,
|
|
95
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
94
96
|
}
|
|
95
97
|
const results = [];
|
|
96
98
|
const skipped = [];
|
|
@@ -121,7 +123,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
121
123
|
|
|
122
124
|
// src/operations/resolveAny.ts
|
|
123
125
|
function resourceFor2(client, key) {
|
|
124
|
-
return client[
|
|
126
|
+
return client[_chunkLB34VFQYcjs.camelKey.call(void 0, key)];
|
|
125
127
|
}
|
|
126
128
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
127
129
|
function missCost(identifier) {
|
|
@@ -130,13 +132,13 @@ function missCost(identifier) {
|
|
|
130
132
|
}
|
|
131
133
|
async function resolveAny(client, identifier, opts = {}) {
|
|
132
134
|
if (typeof identifier === "number") {
|
|
133
|
-
|
|
135
|
+
_chunkLB34VFQYcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
134
136
|
} else if (identifier.trim() === "") {
|
|
135
|
-
throw new (0,
|
|
137
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
136
138
|
}
|
|
137
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
139
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkLB34VFQYcjs.WORKFLOW_RESOURCES));
|
|
138
140
|
if (keys.length === 0) {
|
|
139
|
-
throw new (0,
|
|
141
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
140
142
|
}
|
|
141
143
|
const results = [];
|
|
142
144
|
for (const key of keys) {
|
|
@@ -166,9 +168,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
166
168
|
} catch (err) {
|
|
167
169
|
let code;
|
|
168
170
|
let candidates = [];
|
|
169
|
-
if (err instanceof
|
|
171
|
+
if (err instanceof _chunkLB34VFQYcjs.AutotaskConfigError) {
|
|
170
172
|
code = "CONFIG_ERROR";
|
|
171
|
-
} else if (
|
|
173
|
+
} else if (_chunkLB34VFQYcjs.isAutotaskError.call(void 0, err)) {
|
|
172
174
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
173
175
|
code = err.code;
|
|
174
176
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -195,7 +197,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
195
197
|
// src/operations/aggregate.ts
|
|
196
198
|
var AGGREGATE_TOP_MAX = 100;
|
|
197
199
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
198
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
200
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunkLB34VFQYcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
199
201
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
200
202
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
201
203
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -252,7 +254,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
252
254
|
}
|
|
253
255
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
254
256
|
const s = /* @__PURE__ */ new Set();
|
|
255
|
-
for (const rec of
|
|
257
|
+
for (const rec of _chunkVR6RYXTDcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
256
258
|
return s;
|
|
257
259
|
})();
|
|
258
260
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit", "names"];
|
|
@@ -288,15 +290,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
288
290
|
return [];
|
|
289
291
|
}
|
|
290
292
|
try {
|
|
291
|
-
return
|
|
293
|
+
return _chunkLB34VFQYcjs.buildFilter.call(void 0, conds).filter;
|
|
292
294
|
} catch (err) {
|
|
293
|
-
problems.push(err instanceof
|
|
295
|
+
problems.push(err instanceof _chunkLB34VFQYcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
294
296
|
return [];
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
299
|
function checkOptsBag(opts, problems) {
|
|
298
300
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
299
|
-
throw new (0,
|
|
301
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
300
302
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
301
303
|
{ operation: "operations.aggregate" }
|
|
302
304
|
);
|
|
@@ -360,18 +362,18 @@ function parseTopAndLimit(opts, problems) {
|
|
|
360
362
|
if (!Number.isInteger(opts.limit)) {
|
|
361
363
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
362
364
|
} else {
|
|
363
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
365
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunkLB34VFQYcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
364
366
|
}
|
|
365
367
|
}
|
|
366
368
|
return { top, limit };
|
|
367
369
|
}
|
|
368
370
|
async function checkFieldNames(resourceKey, conditions, opts, problems) {
|
|
369
|
-
const record = resourceKey === void 0 ? void 0 :
|
|
371
|
+
const record = resourceKey === void 0 ? void 0 : _chunkVR6RYXTDcjs.CAPABILITIES.find((r) => r.resource === resourceKey && r.operation === "query");
|
|
370
372
|
if (record === void 0) return void 0;
|
|
371
373
|
const strings = (v) => Array.isArray(v) ? v.filter((f) => typeof f === "string" && f.trim() !== "") : [];
|
|
372
374
|
const groupBy = strings(opts.groupBy);
|
|
373
|
-
const found = await
|
|
374
|
-
filter:
|
|
375
|
+
const found = await _chunkLB34VFQYcjs.findUnknownFieldNames.call(void 0, record, void 0, {
|
|
376
|
+
filter: _chunkLB34VFQYcjs.collectFilterFieldNames.call(void 0, conditions),
|
|
375
377
|
groupBy: groupBy.map((f) => f.split("@")[0]),
|
|
376
378
|
sum: strings(opts.sum)
|
|
377
379
|
});
|
|
@@ -395,14 +397,14 @@ async function validateAggregate(operation, filter, opts) {
|
|
|
395
397
|
checkOptsBag(opts, problems);
|
|
396
398
|
const oracles = {
|
|
397
399
|
resourceKey,
|
|
398
|
-
dateSets: resourceKey !== void 0 ?
|
|
400
|
+
dateSets: resourceKey !== void 0 ? _chunkLB34VFQYcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
399
401
|
};
|
|
400
402
|
const known = await checkFieldNames(resourceKey, conditions, opts, problems);
|
|
401
403
|
const groupBy = parseGroupBy(opts, oracles, known, problems);
|
|
402
404
|
const sum = checkSumFields("sum", opts.sum, problems);
|
|
403
405
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
404
406
|
if (problems.length > 0) {
|
|
405
|
-
throw new (0,
|
|
407
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
406
408
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
407
409
|
- ` + problems.join("\n- "),
|
|
408
410
|
{ operation: "operations.aggregate" }
|
|
@@ -436,9 +438,9 @@ function foldGroups(items, v) {
|
|
|
436
438
|
}
|
|
437
439
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
438
440
|
const v = await validateAggregate(operation, filter, opts);
|
|
439
|
-
const holder = client[
|
|
441
|
+
const holder = client[_chunkLB34VFQYcjs.camelKey.call(void 0, v.resourceKey)];
|
|
440
442
|
if (holder === void 0) {
|
|
441
|
-
throw new (0,
|
|
443
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
442
444
|
operation: "operations.aggregate",
|
|
443
445
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
444
446
|
});
|
|
@@ -455,7 +457,7 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
455
457
|
const res = await holder.queryBounded({ filter: wireFilter, limit: v.limit });
|
|
456
458
|
const sorted = foldGroups(res.items, v);
|
|
457
459
|
const top = sorted.slice(0, v.top);
|
|
458
|
-
const labelled = opts.names === false || v.groupBy.length === 0 ? void 0 : await
|
|
460
|
+
const labelled = opts.names === false || v.groupBy.length === 0 ? void 0 : await _chunkLB34VFQYcjs.labelRows.call(void 0, client, v.resourceKey, top.map((g) => g.key));
|
|
459
461
|
const result = {
|
|
460
462
|
mode: v.groupBy.length > 0 ? "group" : "sum",
|
|
461
463
|
groups: top.map((g, i) => ({ key: _nullishCoalesce(_optionalChain([labelled, 'optionalAccess', _3 => _3.rows, 'access', _4 => _4[i]]), () => ( g.key)), count: g.count, ...g.sums !== void 0 ? { sums: g.sums } : {} })),
|
|
@@ -486,10 +488,10 @@ var DEFAULT_CONTRACT_TYPE_RE = /^\s*(recurring|fixed)\b/i;
|
|
|
486
488
|
var CONTRACTS_PATH = "/V1.0/Contracts";
|
|
487
489
|
var COMPANIES_PATH = "/V1.0/Companies";
|
|
488
490
|
var BILLING_ITEMS_PATH = "/V1.0/BillingItems";
|
|
489
|
-
var LINE_TYPE_FIELDS = ["billingItemType", "timeEntryID", "expenseItemID", ...
|
|
490
|
-
var isLabour = (line) =>
|
|
491
|
+
var LINE_TYPE_FIELDS = ["billingItemType", "timeEntryID", "expenseItemID", ..._chunkLB34VFQYcjs.CHARGE_LINE_FKS, ..._chunkLB34VFQYcjs.SERVICE_LINE_FKS];
|
|
492
|
+
var isLabour = (line) => _chunkLB34VFQYcjs.billingLineType.call(void 0, line) === "labour";
|
|
491
493
|
function picklistKey(c, dim, path, field, raw, missing) {
|
|
492
|
-
const id =
|
|
494
|
+
const id = _chunkLB34VFQYcjs.num.call(void 0, raw);
|
|
493
495
|
if (id === 0) return { id: null, label: missing };
|
|
494
496
|
const label = _optionalChain([c, 'access', _6 => _6.labels, 'access', _7 => _7[path], 'optionalAccess', _8 => _8.get, 'call', _9 => _9(field), 'optionalAccess', _10 => _10.get, 'call', _11 => _11(id)]);
|
|
495
497
|
if (label === void 0) {
|
|
@@ -512,7 +514,7 @@ var DIMENSIONS = {
|
|
|
512
514
|
},
|
|
513
515
|
company: {
|
|
514
516
|
joins: { companies: ["companyName"] },
|
|
515
|
-
key: (c) => ({ id:
|
|
517
|
+
key: (c) => ({ id: _chunkLB34VFQYcjs.num.call(void 0, c.line["companyID"]), name: String(_nullishCoalesce(_optionalChain([c, 'access', _14 => _14.company, 'optionalAccess', _15 => _15["companyName"]]), () => ( ""))) })
|
|
516
518
|
},
|
|
517
519
|
month: {
|
|
518
520
|
key: (c) => ({ id: c.invoice.month })
|
|
@@ -520,11 +522,11 @@ var DIMENSIONS = {
|
|
|
520
522
|
billingItemKind: {
|
|
521
523
|
lineFields: LINE_TYPE_FIELDS,
|
|
522
524
|
picklist: BILLING_ITEMS_PATH,
|
|
523
|
-
key: (c) =>
|
|
525
|
+
key: (c) => _chunkLB34VFQYcjs.num.call(void 0, c.line["billingItemType"]) === 0 ? { id: _chunkLB34VFQYcjs.billingLineType.call(void 0, c.line), label: _chunkLB34VFQYcjs.billingLineType.call(void 0, c.line) } : picklistKey(c, "billingItemKind", BILLING_ITEMS_PATH, "billingItemType", c.line["billingItemType"], "other")
|
|
524
526
|
},
|
|
525
527
|
contract: {
|
|
526
528
|
joins: { contracts: ["contractName"] },
|
|
527
|
-
key: (c) => ({ id:
|
|
529
|
+
key: (c) => ({ id: _chunkLB34VFQYcjs.num.call(void 0, c.line["contractID"]), name: String(_nullishCoalesce(c.contract["contractName"], () => ( ""))) })
|
|
528
530
|
},
|
|
529
531
|
// Per line (no contract-pointer fallback): association → level2 (the Line of Business, `name`) + level1 (the division).
|
|
530
532
|
lineOfBusiness: {
|
|
@@ -532,11 +534,11 @@ var DIMENSIONS = {
|
|
|
532
534
|
joins: { organizationalLevelAssociations: [], organizationalLevel1s: [], organizationalLevel2s: [] },
|
|
533
535
|
unresolved: "unresolvedAssociations",
|
|
534
536
|
key: (c) => {
|
|
535
|
-
const id =
|
|
537
|
+
const id = _chunkLB34VFQYcjs.num.call(void 0, c.line["organizationalLevelAssociationID"]);
|
|
536
538
|
if (id === 0) return { id: null, label: "no LOB assigned" };
|
|
537
539
|
const a = c.joined.organizationalLevelAssociations.get(id);
|
|
538
|
-
const l1 = c.joined.organizationalLevel1s.get(
|
|
539
|
-
const l2 = c.joined.organizationalLevel2s.get(
|
|
540
|
+
const l1 = c.joined.organizationalLevel1s.get(_chunkLB34VFQYcjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _16 => _16["organizationalLevel1ID"]])));
|
|
541
|
+
const l2 = c.joined.organizationalLevel2s.get(_chunkLB34VFQYcjs.num.call(void 0, _optionalChain([a, 'optionalAccess', _17 => _17["organizationalLevel2ID"]])));
|
|
540
542
|
if (l1 === void 0 || l2 === void 0) return "unresolvedAssociations";
|
|
541
543
|
return { id, name: String(_nullishCoalesce(l2["name"], () => ( ""))), division: String(_nullishCoalesce(l1["name"], () => ( ""))) };
|
|
542
544
|
}
|
|
@@ -547,9 +549,9 @@ var DIMENSIONS = {
|
|
|
547
549
|
joins: { timeEntries: [], resources: [] },
|
|
548
550
|
unresolved: "unresolvedTimeEntries",
|
|
549
551
|
key: (c) => {
|
|
550
|
-
const te =
|
|
552
|
+
const te = _chunkLB34VFQYcjs.num.call(void 0, c.line["timeEntryID"]);
|
|
551
553
|
if (!isLabour(c.line) || te === 0) return { id: null, label: "n/a" };
|
|
552
|
-
const id =
|
|
554
|
+
const id = _chunkLB34VFQYcjs.num.call(void 0, _optionalChain([c, 'access', _18 => _18.joined, 'access', _19 => _19.timeEntries, 'access', _20 => _20.get, 'call', _21 => _21(te), 'optionalAccess', _22 => _22["resourceID"]]));
|
|
553
555
|
const r = c.joined.resources.get(id);
|
|
554
556
|
if (r === void 0) return "unresolvedTimeEntries";
|
|
555
557
|
return { id, name: `${String(_nullishCoalesce(r["firstName"], () => ( "")))} ${String(_nullishCoalesce(r["lastName"], () => ( "")))}`.trim() };
|
|
@@ -560,58 +562,58 @@ var DIMENSIONS = {
|
|
|
560
562
|
joins: { billingCodes: [] },
|
|
561
563
|
unresolved: "unresolvedBillingCodes",
|
|
562
564
|
key: (c) => {
|
|
563
|
-
const id =
|
|
565
|
+
const id = _chunkLB34VFQYcjs.num.call(void 0, c.line["billingCodeID"]);
|
|
564
566
|
if (id === 0) return { id: null, label: "none" };
|
|
565
567
|
const b = c.joined.billingCodes.get(id);
|
|
566
568
|
return b === void 0 ? "unresolvedBillingCodes" : { id, name: String(_nullishCoalesce(b["name"], () => ( ""))) };
|
|
567
569
|
}
|
|
568
570
|
}
|
|
569
571
|
};
|
|
570
|
-
var fk = (rows, field) => [...rows].map((r) =>
|
|
572
|
+
var fk = (rows, field) => [...rows].map((r) => _chunkLB34VFQYcjs.num.call(void 0, r[field]));
|
|
571
573
|
var ONE_CHUNK = (idChunks) => Math.min(1, idChunks);
|
|
572
574
|
var JOINS = {
|
|
573
575
|
contracts: {
|
|
574
|
-
make: (http) => new (0,
|
|
576
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.ContractsResource)(http, PAGE),
|
|
575
577
|
fields: ["id", "contractType", "contractCategory"],
|
|
576
578
|
ids: (lines) => fk(lines, "contractID")
|
|
577
579
|
},
|
|
578
580
|
companies: {
|
|
579
|
-
make: (http) => new (0,
|
|
581
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.CompaniesResource)(http, PAGE),
|
|
580
582
|
fields: ["id"],
|
|
581
583
|
ids: (lines) => fk(lines, "companyID")
|
|
582
584
|
},
|
|
583
585
|
organizationalLevelAssociations: {
|
|
584
|
-
make: (http) => new (0,
|
|
586
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.OrganizationalLevelAssociationsResource)(http, PAGE),
|
|
585
587
|
fields: ["id", "organizationalLevel1ID", "organizationalLevel2ID"],
|
|
586
588
|
ids: (lines) => fk(lines, "organizationalLevelAssociationID")
|
|
587
589
|
},
|
|
588
590
|
organizationalLevel1s: {
|
|
589
|
-
make: (http) => new (0,
|
|
591
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.OrganizationalLevel1sResource)(http, PAGE),
|
|
590
592
|
fields: ["id", "name"],
|
|
591
593
|
ids: (_, j) => fk(j["organizationalLevelAssociations"].values(), "organizationalLevel1ID"),
|
|
592
594
|
chunks: ONE_CHUNK
|
|
593
595
|
},
|
|
594
596
|
organizationalLevel2s: {
|
|
595
|
-
make: (http) => new (0,
|
|
597
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.OrganizationalLevel2sResource)(http, PAGE),
|
|
596
598
|
fields: ["id", "name"],
|
|
597
599
|
ids: (_, j) => fk(j["organizationalLevelAssociations"].values(), "organizationalLevel2ID"),
|
|
598
600
|
chunks: ONE_CHUNK
|
|
599
601
|
},
|
|
600
602
|
timeEntries: {
|
|
601
|
-
make: (http) => new (0,
|
|
603
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.TimeEntriesResource)(http, PAGE),
|
|
602
604
|
fields: ["id", "resourceID"],
|
|
603
605
|
ids: (lines) => fk(lines.filter(isLabour), "timeEntryID"),
|
|
604
606
|
// One time entry per labour line: the line count is the upper bound (labour share unknown pre-walk).
|
|
605
607
|
chunks: (_, lines) => pages(lines)
|
|
606
608
|
},
|
|
607
609
|
resources: {
|
|
608
|
-
make: (http, client) => new (0,
|
|
610
|
+
make: (http, client) => new (0, _chunkLB34VFQYcjs.ResourcesResource)(http, client.config, PAGE),
|
|
609
611
|
fields: ["id", "firstName", "lastName"],
|
|
610
612
|
ids: (_, j) => fk(j["timeEntries"].values(), "resourceID"),
|
|
611
613
|
chunks: ONE_CHUNK
|
|
612
614
|
},
|
|
613
615
|
billingCodes: {
|
|
614
|
-
make: (http) => new (0,
|
|
616
|
+
make: (http) => new (0, _chunkLB34VFQYcjs.BillingCodesResource)(http, PAGE),
|
|
615
617
|
fields: ["id", "name"],
|
|
616
618
|
ids: (lines) => fk(lines, "billingCodeID")
|
|
617
619
|
}
|
|
@@ -646,7 +648,7 @@ function checkInt(name, v, def, max, problems) {
|
|
|
646
648
|
}
|
|
647
649
|
function validate(opts) {
|
|
648
650
|
if (typeof opts !== "object" || opts === null || Array.isArray(opts)) {
|
|
649
|
-
throw new (0,
|
|
651
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("revenueRollup: opts must be the options object { <scope>, dateFrom, dateTo, ... } (zero wire was issued)", { operation: OP });
|
|
650
652
|
}
|
|
651
653
|
const o = opts;
|
|
652
654
|
const problems = [];
|
|
@@ -663,12 +665,12 @@ function validate(opts) {
|
|
|
663
665
|
if (scopeKind === "tenantWide" && o.tenantWide !== true) problems.push("tenantWide must be exactly true");
|
|
664
666
|
}
|
|
665
667
|
const { dateFrom, dateTo } = o;
|
|
666
|
-
if (!
|
|
668
|
+
if (!_chunkLB34VFQYcjs.isDateYMD.call(void 0, dateFrom) || !_chunkLB34VFQYcjs.isDateYMD.call(void 0, dateTo)) {
|
|
667
669
|
problems.push("dateFrom and dateTo are both required as YYYY-MM-DD (the window is inclusive, whole UTC days)");
|
|
668
670
|
} else if (dateFrom > dateTo) {
|
|
669
671
|
problems.push(`dateFrom ${dateFrom} is after dateTo ${dateTo}`);
|
|
670
|
-
} else if (
|
|
671
|
-
problems.push(`the window spans ${
|
|
672
|
+
} else if (_chunkLB34VFQYcjs.monthsInWindow.call(void 0, dateFrom, dateTo) > _chunkLB34VFQYcjs.PROFITABILITY_MAX_WINDOW_MONTHS) {
|
|
673
|
+
problems.push(`the window spans ${_chunkLB34VFQYcjs.monthsInWindow.call(void 0, dateFrom, dateTo)} months; the cap is ${_chunkLB34VFQYcjs.PROFITABILITY_MAX_WINDOW_MONTHS}`);
|
|
672
674
|
}
|
|
673
675
|
let groupBy = [...DEFAULT_GROUP_BY];
|
|
674
676
|
if (o.groupBy !== void 0) {
|
|
@@ -695,7 +697,7 @@ function validate(opts) {
|
|
|
695
697
|
};
|
|
696
698
|
if (o.includeNonChargeable !== void 0 && typeof o.includeNonChargeable !== "boolean") problems.push("includeNonChargeable must be a boolean");
|
|
697
699
|
if (problems.length > 0) {
|
|
698
|
-
throw new (0,
|
|
700
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`revenueRollup: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
699
701
|
- ${problems.join("\n- ")}`, { operation: OP });
|
|
700
702
|
}
|
|
701
703
|
return v;
|
|
@@ -713,7 +715,7 @@ function resolveSelector(name, sel, values) {
|
|
|
713
715
|
}
|
|
714
716
|
function unmatched(name, what, values) {
|
|
715
717
|
const live = [...values].map(([id, l]) => `${id} ${l}`).join("; ") || "(the picklist serves no values)";
|
|
716
|
-
return new (0,
|
|
718
|
+
return new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`revenueRollup: ${name}: ${what}. Live values (id label): ${live}`, {
|
|
717
719
|
operation: OP,
|
|
718
720
|
suggestedAction: `Pass ${name} as ids or exact labels from the live list.`
|
|
719
721
|
});
|
|
@@ -724,10 +726,10 @@ var chunk = (a) => {
|
|
|
724
726
|
for (let i = 0; i < a.length; i += PAGE) out.push(a.slice(i, i + PAGE));
|
|
725
727
|
return out;
|
|
726
728
|
};
|
|
727
|
-
var byId = (rows) => [...new Map(rows.map((r) => [
|
|
728
|
-
var cents = (v) => Math.round(
|
|
729
|
-
var revC = (line) => cents(
|
|
730
|
-
var extC = (line) => cents(
|
|
729
|
+
var byId = (rows) => [...new Map(rows.map((r) => [_chunkLB34VFQYcjs.num.call(void 0, r["id"]), r])).values()];
|
|
730
|
+
var cents = (v) => Math.round(_chunkLB34VFQYcjs.num.call(void 0, v) * 100);
|
|
731
|
+
var revC = (line) => cents(_chunkLB34VFQYcjs.internalAmount.call(void 0, line, "internalCurrencyTotalAmount", "totalAmount"));
|
|
732
|
+
var extC = (line) => cents(_chunkLB34VFQYcjs.internalAmount.call(void 0, line, "internalCurrencyExtendedPrice", "extendedPrice"));
|
|
731
733
|
var INTERNAL_FIELDS = ["internalCurrencyTotalAmount", "internalCurrencyExtendedPrice"];
|
|
732
734
|
var lacksInternal = (line) => INTERNAL_FIELDS.some((k) => !Number.isFinite(line[k]));
|
|
733
735
|
var money = (c) => c / 100;
|
|
@@ -738,7 +740,7 @@ async function collect(res, filter, includeFields) {
|
|
|
738
740
|
return out;
|
|
739
741
|
}
|
|
740
742
|
function blindCount() {
|
|
741
|
-
return new (0,
|
|
743
|
+
return new (0, _chunkLB34VFQYcjs.AutotaskError)("revenueRollup: a gate count came back blind (unknown, not zero); the roll-up cannot be sized", {
|
|
742
744
|
code: "INVALID_RESPONSE",
|
|
743
745
|
category: "server",
|
|
744
746
|
operation: OP,
|
|
@@ -748,7 +750,7 @@ function blindCount() {
|
|
|
748
750
|
}
|
|
749
751
|
function countMismatch(what, streamed, counted, rows) {
|
|
750
752
|
const rowNote = rows !== void 0 && rows !== streamed ? ` (${rows} rows)` : "";
|
|
751
|
-
return new (0,
|
|
753
|
+
return new (0, _chunkLB34VFQYcjs.AutotaskError)(`revenueRollup: the ${what} stream returned ${streamed} distinct ids${rowNote} but the gate count was ${counted} (the data changed mid-walk or a page dropped rows); the fold was discarded`, {
|
|
752
754
|
code: "INVALID_RESPONSE",
|
|
753
755
|
category: "server",
|
|
754
756
|
operation: OP,
|
|
@@ -757,7 +759,7 @@ function countMismatch(what, streamed, counted, rows) {
|
|
|
757
759
|
});
|
|
758
760
|
}
|
|
759
761
|
function budgetError(message, details, suggestedAction) {
|
|
760
|
-
return new (0,
|
|
762
|
+
return new (0, _chunkLB34VFQYcjs.AutotaskError)(message, { code: "BUDGET_EXCEEDED", category: "policy", operation: OP, details, suggestedAction });
|
|
761
763
|
}
|
|
762
764
|
function lastMonthsFrom(dateTo, months) {
|
|
763
765
|
return new Date(Date.UTC(Number(dateTo.slice(0, 4)), Number(dateTo.slice(5, 7)) - months, 1)).toISOString().slice(0, 10);
|
|
@@ -790,7 +792,7 @@ async function revenueRollup(client, opts) {
|
|
|
790
792
|
const groupDims = v.groupBy.map((d) => DIMENSIONS[d]);
|
|
791
793
|
const paths = [.../* @__PURE__ */ new Set([CONTRACTS_PATH, ...groupDims.flatMap((d) => d.picklist ? [d.picklist] : [])])];
|
|
792
794
|
const labels = {};
|
|
793
|
-
for (const p of paths) labels[p] = await
|
|
795
|
+
for (const p of paths) labels[p] = await _chunkLB34VFQYcjs.readPicklists.call(void 0, http, p, OP);
|
|
794
796
|
const contractLabels = labels[CONTRACTS_PATH];
|
|
795
797
|
const typeValues = _nullishCoalesce(contractLabels.get("contractType"), () => ( /* @__PURE__ */ new Map()));
|
|
796
798
|
const inTypes = v.contractTypes ? resolveSelector("contractTypes", v.contractTypes, typeValues) : new Map([...typeValues].filter(([, l]) => DEFAULT_CONTRACT_TYPE_RE.test(l)));
|
|
@@ -799,23 +801,23 @@ async function revenueRollup(client, opts) {
|
|
|
799
801
|
let scopeIds = v.scopeIds;
|
|
800
802
|
if (v.scopeKind === "ownerResourceID") {
|
|
801
803
|
const owned = /* @__PURE__ */ new Set();
|
|
802
|
-
for await (const c of new (0,
|
|
803
|
-
const id =
|
|
804
|
+
for await (const c of new (0, _chunkLB34VFQYcjs.CompaniesResource)(http, PAGE).query({ filter: [{ field: "ownerResourceID", op: "eq", value: v.ownerResourceID }], includeFields: ["id"], maxRecords: PAGE, names: false })) {
|
|
805
|
+
const id = _chunkLB34VFQYcjs.num.call(void 0, c.id);
|
|
804
806
|
if (id > 0) owned.add(id);
|
|
805
807
|
if (owned.size > SCOPE_IDS_MAX) break;
|
|
806
808
|
}
|
|
807
809
|
scopeIds = [...owned].sort((a, b) => a - b);
|
|
808
810
|
if (scopeIds.length === 0 || scopeIds.length > SCOPE_IDS_MAX) {
|
|
809
|
-
throw new (0,
|
|
811
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
810
812
|
`revenueRollup: ownerResourceID ${v.ownerResourceID} resolves to ${scopeIds.length > SCOPE_IDS_MAX ? `more than ${SCOPE_IDS_MAX}` : 0} companies (companies.query; 1..${SCOPE_IDS_MAX} supported)`,
|
|
811
813
|
{ operation: OP, suggestedAction: "Pass companyIDs explicitly, or tenantWide: true." }
|
|
812
814
|
);
|
|
813
815
|
}
|
|
814
816
|
}
|
|
815
817
|
const scopeCond = scopeIds === void 0 ? [] : [{ field: v.scopeKind === "contractIDs" ? "contractID" : "companyID", op: "in", value: scopeIds }];
|
|
816
|
-
const invoices = new (0,
|
|
817
|
-
const billingItems = new (0,
|
|
818
|
-
const windowOn = (field) => [{ field, op: "gte", value: v.dateFrom }, { field, op: "lt", value:
|
|
818
|
+
const invoices = new (0, _chunkLB34VFQYcjs.InvoicesResource)(http, PAGE);
|
|
819
|
+
const billingItems = new (0, _chunkLB34VFQYcjs.BillingItemsResource)(http, PAGE);
|
|
820
|
+
const windowOn = (field) => [{ field, op: "gte", value: v.dateFrom }, { field, op: "lt", value: _chunkLB34VFQYcjs.dayAfter.call(void 0, v.dateTo) }];
|
|
819
821
|
const invoiceFilter = (voided2) => [...windowOn("invoiceDateTime"), { field: "isVoided", op: "eq", value: voided2 }];
|
|
820
822
|
const withVoided = v.scopeKind !== "contractIDs";
|
|
821
823
|
const voidedFilter = [...invoiceFilter(true), ...scopeIds !== void 0 && withVoided ? [{ field: "companyID", op: "in", value: scopeIds }] : []];
|
|
@@ -839,7 +841,7 @@ async function revenueRollup(client, opts) {
|
|
|
839
841
|
const invoiceRows = await collect(invoices, invoiceFilter(false), ["id", "invoiceTotal", "invoiceDateTime", "companyID"]);
|
|
840
842
|
const invoiceById = /* @__PURE__ */ new Map();
|
|
841
843
|
for (const r of invoiceRows) {
|
|
842
|
-
invoiceById.set(
|
|
844
|
+
invoiceById.set(_chunkLB34VFQYcjs.num.call(void 0, r["id"]), { total: cents(r["invoiceTotal"]), month: String(_nullishCoalesce(r["invoiceDateTime"], () => ( ""))).slice(0, 7), companyID: _chunkLB34VFQYcjs.num.call(void 0, r["companyID"]) });
|
|
843
845
|
}
|
|
844
846
|
if (invoiceById.size !== nInvoices) throw countMismatch("invoice", invoiceById.size, nInvoices, invoiceRows.length);
|
|
845
847
|
const voided = withVoided ? byId(await collect(invoices, voidedFilter, ["id", "invoiceTotal"])) : void 0;
|
|
@@ -853,13 +855,13 @@ async function revenueRollup(client, opts) {
|
|
|
853
855
|
if (rows.length !== n) throw countMismatch("line", rows.length, n);
|
|
854
856
|
return rows;
|
|
855
857
|
}, chunk(ids), { concurrency: CONCURRENCY })).flat();
|
|
856
|
-
const orphan = lines.find((l) => !invoiceById.has(
|
|
858
|
+
const orphan = lines.find((l) => !invoiceById.has(_chunkLB34VFQYcjs.num.call(void 0, l["invoiceID"])));
|
|
857
859
|
if (orphan !== void 0) {
|
|
858
|
-
throw new (0,
|
|
860
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(`revenueRollup: billing line ${_chunkLB34VFQYcjs.num.call(void 0, orphan["id"])} belongs to invoice ${_chunkLB34VFQYcjs.num.call(void 0, orphan["invoiceID"])}, which is not among the ${invoiceById.size} streamed invoices; the fold was discarded`, {
|
|
859
861
|
code: "INVALID_RESPONSE",
|
|
860
862
|
category: "server",
|
|
861
863
|
operation: OP,
|
|
862
|
-
details: { reason: "orphan_line", lineID:
|
|
864
|
+
details: { reason: "orphan_line", lineID: _chunkLB34VFQYcjs.num.call(void 0, orphan["id"]), invoiceID: _chunkLB34VFQYcjs.num.call(void 0, orphan["invoiceID"]) },
|
|
863
865
|
suggestedAction: "Retry the call."
|
|
864
866
|
});
|
|
865
867
|
}
|
|
@@ -873,12 +875,12 @@ async function revenueRollup(client, opts) {
|
|
|
873
875
|
const fields = [.../* @__PURE__ */ new Set([...spec.fields, ...groupDims.flatMap((d) => _nullishCoalesce(_optionalChain([d, 'access', _25 => _25.joins, 'optionalAccess', _26 => _26[j]]), () => ( [])))])];
|
|
874
876
|
const want = [...new Set(spec.ids(all, joined))].filter((id) => id > 0).sort((a, b) => a - b);
|
|
875
877
|
const rows = await client.batch((c) => collect(res, [{ field: "id", op: "in", value: c }], fields), chunk(want), { concurrency: CONCURRENCY });
|
|
876
|
-
for (const r of rows.flat()) joined[j].set(
|
|
878
|
+
for (const r of rows.flat()) joined[j].set(_chunkLB34VFQYcjs.num.call(void 0, r["id"]), r);
|
|
877
879
|
}
|
|
878
880
|
return fold(v, { invoiceById, voided, lines, uninvoiced, joined, labels, inTypes, inCategories, scopeIds, calls, estimate });
|
|
879
881
|
}
|
|
880
882
|
function refusal(v, estimate, fixed, scopeIds, joinCount) {
|
|
881
|
-
const months =
|
|
883
|
+
const months = _chunkLB34VFQYcjs.monthsInWindow.call(void 0, v.dateFrom, v.dateTo);
|
|
882
884
|
const variable = estimate - fixed;
|
|
883
885
|
const fitMonths = Math.floor((v.budget - fixed) * months / variable);
|
|
884
886
|
const suggestions = [];
|
|
@@ -974,15 +976,15 @@ function fold(v, f) {
|
|
|
974
976
|
const zeroTotal = amt();
|
|
975
977
|
const zeroIds = /* @__PURE__ */ new Set();
|
|
976
978
|
const locate = (line, invoice) => {
|
|
977
|
-
const contractID =
|
|
979
|
+
const contractID = _chunkLB34VFQYcjs.num.call(void 0, line["contractID"]);
|
|
978
980
|
if (contractID === 0) return { bucket: uncontracted, unresolved: false };
|
|
979
981
|
const contract = f.joined.contracts.get(contractID);
|
|
980
982
|
if (contract === void 0) return { bucket: unresolvedContracts, unresolved: true };
|
|
981
|
-
const type =
|
|
983
|
+
const type = _chunkLB34VFQYcjs.num.call(void 0, contract["contractType"]);
|
|
982
984
|
if (!f.inTypes.has(type)) return { bucket: slot(otherTypes, typeLabel(type)), unresolved: false };
|
|
983
|
-
const cat =
|
|
985
|
+
const cat = _chunkLB34VFQYcjs.num.call(void 0, contract["contractCategory"]);
|
|
984
986
|
if (f.inCategories !== void 0 && !f.inCategories.has(cat)) return { bucket: slot(otherCats, cat === 0 ? "uncategorised" : catLabel(cat)), unresolved: false };
|
|
985
|
-
const company = f.joined.companies.get(
|
|
987
|
+
const company = f.joined.companies.get(_chunkLB34VFQYcjs.num.call(void 0, line["companyID"]));
|
|
986
988
|
if (needCompany && company === void 0) return { bucket: unresolvedCompanies, unresolved: true };
|
|
987
989
|
const ctx = { line, invoice, contract, company, joined: f.joined, labels: f.labels, unlabelled };
|
|
988
990
|
const keys = {};
|
|
@@ -1002,7 +1004,7 @@ function fold(v, f) {
|
|
|
1002
1004
|
return { cell };
|
|
1003
1005
|
};
|
|
1004
1006
|
for (const line of f.lines) {
|
|
1005
|
-
const invoiceID =
|
|
1007
|
+
const invoiceID = _chunkLB34VFQYcjs.num.call(void 0, line["invoiceID"]);
|
|
1006
1008
|
const invoice = f.invoiceById.get(invoiceID);
|
|
1007
1009
|
lineTotals.set(invoiceID, (_nullishCoalesce(lineTotals.get(invoiceID), () => ( 0))) + cents(line["totalAmount"]));
|
|
1008
1010
|
const c = revC(line);
|
|
@@ -1023,9 +1025,9 @@ function fold(v, f) {
|
|
|
1023
1025
|
cell.creditLines += 1;
|
|
1024
1026
|
}
|
|
1025
1027
|
cell.included += extC(line) - c;
|
|
1026
|
-
cell.contracts.add(
|
|
1028
|
+
cell.contracts.add(_chunkLB34VFQYcjs.num.call(void 0, line["contractID"]));
|
|
1027
1029
|
cell.items += 1;
|
|
1028
|
-
allContracts.add(
|
|
1030
|
+
allContracts.add(_chunkLB34VFQYcjs.num.call(void 0, line["contractID"]));
|
|
1029
1031
|
if (byLob && cell.keys.lineOfBusiness.id === null) add(noPointer, c);
|
|
1030
1032
|
const k = v.nonChargeable ? ncClass(line) : void 0;
|
|
1031
1033
|
if (k) ncAdd(cell.nc, k, line);
|
|
@@ -1033,7 +1035,7 @@ function fold(v, f) {
|
|
|
1033
1035
|
for (const line of f.uninvoiced) {
|
|
1034
1036
|
const k = ncClass(line);
|
|
1035
1037
|
if (!k) continue;
|
|
1036
|
-
const at = locate(line, { total: 0, month: String(_nullishCoalesce(line["itemDate"], () => ( ""))).slice(0, 7), companyID:
|
|
1038
|
+
const at = locate(line, { total: 0, month: String(_nullishCoalesce(line["itemDate"], () => ( ""))).slice(0, 7), companyID: _chunkLB34VFQYcjs.num.call(void 0, line["companyID"]) });
|
|
1037
1039
|
if ("cell" in at) ncAdd(at.cell.nc, k, line);
|
|
1038
1040
|
else if (at.unresolved) add(unresolvedNc, extC(line));
|
|
1039
1041
|
}
|
|
@@ -1143,20 +1145,20 @@ function slot(m, k) {
|
|
|
1143
1145
|
async function relationshipMap(client, resourceKey) {
|
|
1144
1146
|
void client;
|
|
1145
1147
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
1146
|
-
throw new (0,
|
|
1148
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1147
1149
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
1148
1150
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
1149
1151
|
);
|
|
1150
1152
|
}
|
|
1151
1153
|
const key = resourceKey.trim();
|
|
1152
|
-
const entry =
|
|
1154
|
+
const entry = _chunkLB34VFQYcjs.RELATIONSHIP_MAP[key];
|
|
1153
1155
|
if (entry === void 0) {
|
|
1154
|
-
throw new (0,
|
|
1155
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
1156
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(
|
|
1157
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkLB34VFQYcjs.RELATIONSHIP_MAP).length} resources`,
|
|
1156
1158
|
{
|
|
1157
1159
|
code: "RESOURCE_UNKNOWN",
|
|
1158
1160
|
category: "validation",
|
|
1159
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
1161
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkLB34VFQYcjs.RELATIONSHIP_ZONE.label} (${_chunkLB34VFQYcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
1160
1162
|
}
|
|
1161
1163
|
);
|
|
1162
1164
|
}
|
|
@@ -1173,24 +1175,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
1173
1175
|
async function blindSurfaces(client, opts) {
|
|
1174
1176
|
void client;
|
|
1175
1177
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1176
|
-
throw new (0,
|
|
1178
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
1177
1179
|
}
|
|
1178
|
-
const inv =
|
|
1180
|
+
const inv = _chunkLB34VFQYcjs.BLIND_SURFACE_INVENTORY;
|
|
1179
1181
|
if (inv === null) {
|
|
1180
|
-
throw new (0,
|
|
1182
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
1181
1183
|
}
|
|
1182
1184
|
let surfaces = inv.surfaces;
|
|
1183
1185
|
if (_optionalChain([opts, 'optionalAccess', _32 => _32.resource]) !== void 0) {
|
|
1184
1186
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
1185
1187
|
if (key === "") {
|
|
1186
|
-
throw new (0,
|
|
1188
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1187
1189
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
1188
1190
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
1189
1191
|
);
|
|
1190
1192
|
}
|
|
1191
1193
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
1192
|
-
throw new (0,
|
|
1193
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
1194
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(
|
|
1195
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkLB34VFQYcjs.RELATIONSHIP_MAP).length} resources`,
|
|
1194
1196
|
{
|
|
1195
1197
|
code: "RESOURCE_UNKNOWN",
|
|
1196
1198
|
category: "validation",
|
|
@@ -1202,7 +1204,7 @@ async function blindSurfaces(client, opts) {
|
|
|
1202
1204
|
}
|
|
1203
1205
|
if (_optionalChain([opts, 'optionalAccess', _33 => _33.kind]) !== void 0) {
|
|
1204
1206
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
1205
|
-
throw new (0,
|
|
1207
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1206
1208
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
1207
1209
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
1208
1210
|
);
|
|
@@ -1215,51 +1217,51 @@ async function blindSurfaces(client, opts) {
|
|
|
1215
1217
|
// src/operations/probeReachability.ts
|
|
1216
1218
|
async function probeReachability(client, opts) {
|
|
1217
1219
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1218
|
-
throw new (0,
|
|
1220
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
1219
1221
|
}
|
|
1220
|
-
const defs =
|
|
1222
|
+
const defs = _chunkLB34VFQYcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
1221
1223
|
if (_optionalChain([opts, 'optionalAccess', _34 => _34.confirmProbe]) !== true) {
|
|
1222
|
-
throw new (0,
|
|
1224
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1223
1225
|
"probeReachability: confirmProbe: true is required \u2014 the op deliberately fans out read wire across the tenant (one bounded query per surface); pass confirmProbe: true to run it",
|
|
1224
1226
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
1225
1227
|
);
|
|
1226
1228
|
}
|
|
1227
1229
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _35 => _35.limit]), () => ( defs.limitDefault));
|
|
1228
1230
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
1229
|
-
throw new (0,
|
|
1231
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1230
1232
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
1231
1233
|
);
|
|
1232
1234
|
}
|
|
1233
1235
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _36 => _36.maxWireCalls]), () => ( defs.defaultCap));
|
|
1234
1236
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
1235
|
-
throw new (0,
|
|
1237
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
1236
1238
|
}
|
|
1237
1239
|
if (cap > defs.hardCap) {
|
|
1238
|
-
throw new (0,
|
|
1240
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1239
1241
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
1240
1242
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
1241
1243
|
);
|
|
1242
1244
|
}
|
|
1243
|
-
const inv =
|
|
1245
|
+
const inv = _chunkLB34VFQYcjs.BLIND_SURFACE_INVENTORY;
|
|
1244
1246
|
if (inv === null) {
|
|
1245
|
-
throw new (0,
|
|
1247
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
1246
1248
|
}
|
|
1247
1249
|
let targets;
|
|
1248
1250
|
if (_optionalChain([opts, 'optionalAccess', _37 => _37.resources]) === void 0) {
|
|
1249
1251
|
targets = [...defs.defaultTargets];
|
|
1250
1252
|
} else {
|
|
1251
1253
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
1252
|
-
throw new (0,
|
|
1254
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
1253
1255
|
}
|
|
1254
1256
|
const seen = /* @__PURE__ */ new Set();
|
|
1255
1257
|
for (const r of opts.resources) {
|
|
1256
1258
|
if (typeof r !== "string" || r.trim() === "") {
|
|
1257
|
-
throw new (0,
|
|
1259
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
1258
1260
|
}
|
|
1259
1261
|
const key = r.trim();
|
|
1260
1262
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
1261
1263
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
1262
|
-
throw new (0,
|
|
1264
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(
|
|
1263
1265
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
1264
1266
|
{
|
|
1265
1267
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -1273,7 +1275,7 @@ async function probeReachability(client, opts) {
|
|
|
1273
1275
|
targets = [...seen];
|
|
1274
1276
|
}
|
|
1275
1277
|
if (targets.length > cap) {
|
|
1276
|
-
throw new (0,
|
|
1278
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1277
1279
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
1278
1280
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
1279
1281
|
);
|
|
@@ -1283,7 +1285,7 @@ async function probeReachability(client, opts) {
|
|
|
1283
1285
|
for (const resource of targets.sort()) {
|
|
1284
1286
|
const row = byResource.get(resource);
|
|
1285
1287
|
if (row === void 0) continue;
|
|
1286
|
-
const holder = client[
|
|
1288
|
+
const holder = client[_chunkLB34VFQYcjs.camelKey.call(void 0, resource)];
|
|
1287
1289
|
const probeFn = _optionalChain([holder, 'optionalAccess', _38 => _38.queryBounded]);
|
|
1288
1290
|
if (typeof probeFn !== "function") {
|
|
1289
1291
|
results.push({
|
|
@@ -1302,7 +1304,7 @@ async function probeReachability(client, opts) {
|
|
|
1302
1304
|
probe: { ok: true, wire: 1, error: null }
|
|
1303
1305
|
});
|
|
1304
1306
|
} catch (err) {
|
|
1305
|
-
const code =
|
|
1307
|
+
const code = _chunkLB34VFQYcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
1306
1308
|
const message = err instanceof Error ? err.message : String(err);
|
|
1307
1309
|
results.push({
|
|
1308
1310
|
...row,
|
|
@@ -1330,30 +1332,30 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
1330
1332
|
async function createGuidance(client, opts) {
|
|
1331
1333
|
void client;
|
|
1332
1334
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
1333
|
-
throw new (0,
|
|
1335
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1334
1336
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
1335
1337
|
);
|
|
1336
1338
|
}
|
|
1337
|
-
let servedRows =
|
|
1339
|
+
let servedRows = _chunkLB34VFQYcjs.CREATE_GUIDANCE.rows.map((row) => ({
|
|
1338
1340
|
...row,
|
|
1339
1341
|
// Issue #219 N4: one precedence rule, stated on every row (live-proven >
|
|
1340
1342
|
// zone > spec). The spec set is not available here (it is a LIVE read) —
|
|
1341
1343
|
// the helper is handed the plan's two shapes and names the source.
|
|
1342
|
-
requiredFields:
|
|
1344
|
+
requiredFields: _chunkLB34VFQYcjs.effectiveRequiredFields.call(void 0, void 0, _nullishCoalesce(_optionalChain([_chunkLB34VFQYcjs.RELATIONSHIP_MAP, 'access', _40 => _40[row.resource], 'optionalAccess', _41 => _41.zoneFacts]), () => ( null)))
|
|
1343
1345
|
}));
|
|
1344
1346
|
if (_optionalChain([opts, 'optionalAccess', _42 => _42.resources]) !== void 0) {
|
|
1345
1347
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
1346
|
-
throw new (0,
|
|
1348
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
1347
1349
|
}
|
|
1348
1350
|
const wanted = /* @__PURE__ */ new Set();
|
|
1349
1351
|
for (const r of opts.resources) {
|
|
1350
1352
|
if (typeof r !== "string" || r.trim() === "") {
|
|
1351
|
-
throw new (0,
|
|
1353
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
1352
1354
|
}
|
|
1353
1355
|
const key = r.trim();
|
|
1354
|
-
if (!
|
|
1355
|
-
throw new (0,
|
|
1356
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
1356
|
+
if (!_chunkLB34VFQYcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
1357
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(
|
|
1358
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkLB34VFQYcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
1357
1359
|
{
|
|
1358
1360
|
code: "RESOURCE_UNKNOWN",
|
|
1359
1361
|
category: "validation",
|
|
@@ -1367,18 +1369,18 @@ async function createGuidance(client, opts) {
|
|
|
1367
1369
|
}
|
|
1368
1370
|
if (_optionalChain([opts, 'optionalAccess', _43 => _43.kind]) !== void 0) {
|
|
1369
1371
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
1370
|
-
throw new (0,
|
|
1372
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1371
1373
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
1372
1374
|
);
|
|
1373
1375
|
}
|
|
1374
1376
|
servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _44 => _44.blocker, 'optionalAccess', _45 => _45.kind]) === opts.kind);
|
|
1375
1377
|
}
|
|
1376
1378
|
return {
|
|
1377
|
-
zone:
|
|
1378
|
-
label:
|
|
1379
|
-
verifiedAt:
|
|
1379
|
+
zone: _chunkLB34VFQYcjs.CREATE_GUIDANCE.zone,
|
|
1380
|
+
label: _chunkLB34VFQYcjs.CREATE_GUIDANCE.label,
|
|
1381
|
+
verifiedAt: _chunkLB34VFQYcjs.CREATE_GUIDANCE.verifiedAt,
|
|
1380
1382
|
rows: servedRows,
|
|
1381
|
-
counts:
|
|
1383
|
+
counts: _chunkLB34VFQYcjs.CREATE_GUIDANCE.counts
|
|
1382
1384
|
};
|
|
1383
1385
|
}
|
|
1384
1386
|
|
|
@@ -1387,7 +1389,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
1387
1389
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
1388
1390
|
var RECOVERY_MAX_LIMIT = 100;
|
|
1389
1391
|
function configError(message, operation, suggestedAction) {
|
|
1390
|
-
throw new (0,
|
|
1392
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
1391
1393
|
}
|
|
1392
1394
|
function parseMatchId(record) {
|
|
1393
1395
|
const raw = record.id;
|
|
@@ -1403,7 +1405,7 @@ function parseMatchId(record) {
|
|
|
1403
1405
|
return { id: null, unsafe: true };
|
|
1404
1406
|
}
|
|
1405
1407
|
function validateRecoveryInput(input, operation) {
|
|
1406
|
-
if (!
|
|
1408
|
+
if (!_chunkLB34VFQYcjs.isRecord.call(void 0, input)) {
|
|
1407
1409
|
configError(
|
|
1408
1410
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
1409
1411
|
operation,
|
|
@@ -1437,10 +1439,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
1437
1439
|
return { resource, marker, action };
|
|
1438
1440
|
}
|
|
1439
1441
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
1440
|
-
const entry =
|
|
1442
|
+
const entry = _chunkLB34VFQYcjs.RELATIONSHIP_MAP[resource];
|
|
1441
1443
|
if (entry === void 0) {
|
|
1442
|
-
throw new (0,
|
|
1443
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
1444
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskError)(
|
|
1445
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkLB34VFQYcjs.RELATIONSHIP_MAP).length} resources`,
|
|
1444
1446
|
{
|
|
1445
1447
|
code: "RESOURCE_UNKNOWN",
|
|
1446
1448
|
category: "validation",
|
|
@@ -1449,7 +1451,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
1449
1451
|
}
|
|
1450
1452
|
);
|
|
1451
1453
|
}
|
|
1452
|
-
const holder = client[
|
|
1454
|
+
const holder = client[_chunkLB34VFQYcjs.camelKey.call(void 0, resource)];
|
|
1453
1455
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
1454
1456
|
configError(
|
|
1455
1457
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -1460,7 +1462,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
1460
1462
|
return { entry, holder };
|
|
1461
1463
|
}
|
|
1462
1464
|
function resolveMarkerField(input, resource, operation) {
|
|
1463
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
1465
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkLB34VFQYcjs.MARKER_FIELDS[resource];
|
|
1464
1466
|
if (typeof field !== "string" || field.trim() === "") {
|
|
1465
1467
|
configError(
|
|
1466
1468
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -1499,7 +1501,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
1499
1501
|
);
|
|
1500
1502
|
}
|
|
1501
1503
|
for (const c of input.filter) {
|
|
1502
|
-
if (!
|
|
1504
|
+
if (!_chunkLB34VFQYcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
1503
1505
|
configError(
|
|
1504
1506
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
1505
1507
|
operation,
|
|
@@ -1524,7 +1526,7 @@ function resolveLimit(input, operation) {
|
|
|
1524
1526
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
1525
1527
|
const deleteMethod = holder.delete;
|
|
1526
1528
|
if (deleteMethod === void 0) {
|
|
1527
|
-
throw new (0,
|
|
1529
|
+
throw new (0, _chunkLB34VFQYcjs.DeleteBoundaryError)(
|
|
1528
1530
|
`recovery: ${resource} has no delete method on the client \u2014 the boundary is marked available in the plan but the typed delete surface is missing`,
|
|
1529
1531
|
{
|
|
1530
1532
|
operation,
|
|
@@ -1553,14 +1555,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
1553
1555
|
verify = "still-present";
|
|
1554
1556
|
}
|
|
1555
1557
|
} catch (err) {
|
|
1556
|
-
if (err instanceof
|
|
1558
|
+
if (err instanceof _chunkLB34VFQYcjs.NotFoundError) verify = "not-found";
|
|
1557
1559
|
else {
|
|
1558
1560
|
verify = "error";
|
|
1559
|
-
code =
|
|
1561
|
+
code = _chunkLB34VFQYcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
1560
1562
|
}
|
|
1561
1563
|
}
|
|
1562
1564
|
} catch (err) {
|
|
1563
|
-
code =
|
|
1565
|
+
code = _chunkLB34VFQYcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
1564
1566
|
}
|
|
1565
1567
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
1566
1568
|
}
|
|
@@ -1588,7 +1590,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1588
1590
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
1589
1591
|
const extra = resolveExtraFilter(input, operation);
|
|
1590
1592
|
const limit = resolveLimit(input, operation);
|
|
1591
|
-
const boundaryNote =
|
|
1593
|
+
const boundaryNote = _chunkLB34VFQYcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
1592
1594
|
const boundary = {
|
|
1593
1595
|
available: boundaryNote === void 0,
|
|
1594
1596
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -1600,7 +1602,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1600
1602
|
};
|
|
1601
1603
|
const isDelete = action === "delete";
|
|
1602
1604
|
if (isDelete && boundaryNote !== void 0) {
|
|
1603
|
-
throw new (0,
|
|
1605
|
+
throw new (0, _chunkLB34VFQYcjs.DeleteBoundaryError)(
|
|
1604
1606
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
1605
1607
|
{
|
|
1606
1608
|
operation,
|
|
@@ -1612,7 +1614,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1612
1614
|
const dryRun = _optionalChain([opts, 'optionalAccess', _46 => _46.dryRun]) !== false;
|
|
1613
1615
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _47 => _47.confirm]), () => ( input.confirm));
|
|
1614
1616
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
1615
|
-
throw new (0,
|
|
1617
|
+
throw new (0, _chunkLB34VFQYcjs.ConfirmationRequiredError)(
|
|
1616
1618
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
1617
1619
|
{
|
|
1618
1620
|
operation: RECOVERY_CONFIRM,
|
|
@@ -1628,7 +1630,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1628
1630
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
1629
1631
|
if (query.hasMore) {
|
|
1630
1632
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
1631
|
-
throw new (0,
|
|
1633
|
+
throw new (0, _chunkLB34VFQYcjs.RecoveryTruncatedError)(
|
|
1632
1634
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
1633
1635
|
{
|
|
1634
1636
|
operation,
|
|
@@ -1657,7 +1659,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1657
1659
|
return { ...base, simulated: true, dryRun: true };
|
|
1658
1660
|
}
|
|
1659
1661
|
if (unsafeId) {
|
|
1660
|
-
throw new (0,
|
|
1662
|
+
throw new (0, _chunkLB34VFQYcjs.MarkerUnsafeIdError)(
|
|
1661
1663
|
`recovery: ${unsafeIds.length} of ${matches.length} match(es) on ${resource} have ids beyond Number.MAX_SAFE_INTEGER \u2014 they CANNOT be addressed through the SDK's typed delete surface (zero DELETE wire was issued)`,
|
|
1662
1664
|
{
|
|
1663
1665
|
operation,
|
|
@@ -1675,7 +1677,7 @@ function needsConfirmation(record) {
|
|
|
1675
1677
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
1676
1678
|
}
|
|
1677
1679
|
function refuse(message, operation, suggestedAction) {
|
|
1678
|
-
throw new (0,
|
|
1680
|
+
throw new (0, _chunkLB34VFQYcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
1679
1681
|
}
|
|
1680
1682
|
var MODE_BY_EFFECT = {
|
|
1681
1683
|
read: "read",
|
|
@@ -1721,7 +1723,7 @@ function looseTypeOk(type, value) {
|
|
|
1721
1723
|
case "string[]":
|
|
1722
1724
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1723
1725
|
case "object":
|
|
1724
|
-
return
|
|
1726
|
+
return _chunkLB34VFQYcjs.isRecord.call(void 0, value);
|
|
1725
1727
|
default:
|
|
1726
1728
|
return true;
|
|
1727
1729
|
}
|
|
@@ -1735,12 +1737,12 @@ function declaredArgList(record) {
|
|
|
1735
1737
|
function resolveDispatchArgs(record, argsIn) {
|
|
1736
1738
|
const operation = record.id;
|
|
1737
1739
|
const bad = (message) => {
|
|
1738
|
-
throw new (0,
|
|
1740
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1739
1741
|
};
|
|
1740
1742
|
if (argsIn === void 0 || argsIn === null) return [];
|
|
1741
1743
|
if (Array.isArray(argsIn)) return argsIn;
|
|
1742
1744
|
const byName = argsIn;
|
|
1743
|
-
if (!
|
|
1745
|
+
if (!_chunkLB34VFQYcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1744
1746
|
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1745
1747
|
}
|
|
1746
1748
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
@@ -1761,7 +1763,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1761
1763
|
const bagName = names.find((n) => schema[n].properties);
|
|
1762
1764
|
const surplus = args[names.length];
|
|
1763
1765
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1764
|
-
throw new (0,
|
|
1766
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1765
1767
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1766
1768
|
{
|
|
1767
1769
|
operation,
|
|
@@ -1771,7 +1773,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1771
1773
|
}
|
|
1772
1774
|
const required = names.filter((n) => schema[n].required);
|
|
1773
1775
|
if (args.length < required.length) {
|
|
1774
|
-
throw new (0,
|
|
1776
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1775
1777
|
`invoke: "${operation}" requires ${required.length} positional arg(s) (${required.map((n) => `${n}: ${schema[n].type}`).join(", ")}) but only ${args.length} were passed \u2014 declared args: ${declaredArgList(record)}`,
|
|
1776
1778
|
{ operation }
|
|
1777
1779
|
);
|
|
@@ -1782,7 +1784,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1782
1784
|
const name = names[i];
|
|
1783
1785
|
const spec = schema[name];
|
|
1784
1786
|
if (!looseTypeOk(spec.type, value)) {
|
|
1785
|
-
throw new (0,
|
|
1787
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1786
1788
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1787
1789
|
{ operation }
|
|
1788
1790
|
);
|
|
@@ -1790,8 +1792,8 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1790
1792
|
}
|
|
1791
1793
|
}
|
|
1792
1794
|
function foldFlattenedOpts(record, toolArgs) {
|
|
1793
|
-
if (!
|
|
1794
|
-
throw new (0,
|
|
1795
|
+
if (!_chunkLB34VFQYcjs.isRecord.call(void 0, toolArgs)) {
|
|
1796
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1795
1797
|
}
|
|
1796
1798
|
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _48 => _48.inputSchema, 'optionalAccess', _49 => _49.opts, 'optionalAccess', _50 => _50.properties]), () => ( []))).map((p) => p.name);
|
|
1797
1799
|
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
@@ -1800,7 +1802,7 @@ function foldFlattenedOpts(record, toolArgs) {
|
|
|
1800
1802
|
if (folded.opts === null) delete folded.opts;
|
|
1801
1803
|
if (flat.length === 0) return folded;
|
|
1802
1804
|
if (folded.opts !== void 0) {
|
|
1803
|
-
throw new (0,
|
|
1805
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1804
1806
|
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1805
1807
|
{ operation: record.id }
|
|
1806
1808
|
);
|
|
@@ -1862,11 +1864,11 @@ function validateParamsBag(record, args) {
|
|
|
1862
1864
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1863
1865
|
if (valid === void 0) return;
|
|
1864
1866
|
const bag = _optionalChain([args, 'optionalAccess', _51 => _51[0]]);
|
|
1865
|
-
if (bag === void 0 || bag === null || !
|
|
1867
|
+
if (bag === void 0 || bag === null || !_chunkLB34VFQYcjs.isRecord.call(void 0, bag)) return;
|
|
1866
1868
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1867
1869
|
if (unknown.length === 0) return;
|
|
1868
1870
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1869
|
-
throw new (0,
|
|
1871
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1870
1872
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1871
1873
|
{
|
|
1872
1874
|
operation: record.id,
|
|
@@ -1878,16 +1880,16 @@ function validateGetBag(record, args) {
|
|
|
1878
1880
|
if (record.kind !== "primitive" || record.operation !== "get") return;
|
|
1879
1881
|
const at = Object.keys(_nullishCoalesce(record.inputSchema, () => ( {}))).indexOf("opts");
|
|
1880
1882
|
const bag = at < 0 ? void 0 : _optionalChain([args, 'optionalAccess', _52 => _52[at]]);
|
|
1881
|
-
if (bag === void 0 || bag === null || !
|
|
1883
|
+
if (bag === void 0 || bag === null || !_chunkLB34VFQYcjs.isRecord.call(void 0, bag)) return;
|
|
1882
1884
|
const unknown = Object.keys(bag).filter((k) => k !== "fresh");
|
|
1883
1885
|
if (unknown.length > 0) {
|
|
1884
|
-
throw new (0,
|
|
1886
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1885
1887
|
`invoke: "${record.id}" opts bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: fresh)`,
|
|
1886
1888
|
{ operation: record.id, suggestedAction: "Pass only { fresh?: boolean }." }
|
|
1887
1889
|
);
|
|
1888
1890
|
}
|
|
1889
1891
|
if (bag.fresh !== void 0 && typeof bag.fresh !== "boolean") {
|
|
1890
|
-
throw new (0,
|
|
1892
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1891
1893
|
`invoke: fresh must be a boolean (got ${typeof bag.fresh}) \u2014 "${record.id}" was not issued`,
|
|
1892
1894
|
{ operation: record.id, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
|
|
1893
1895
|
);
|
|
@@ -1899,7 +1901,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1899
1901
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1900
1902
|
if (unknown.length === 0) return;
|
|
1901
1903
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1902
|
-
throw new (0,
|
|
1904
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1903
1905
|
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries, fresh; "mode" is internal to the mode wrappers)`,
|
|
1904
1906
|
{
|
|
1905
1907
|
operation,
|
|
@@ -1912,7 +1914,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1912
1914
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1913
1915
|
if (unknown.length === 0) return null;
|
|
1914
1916
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1915
|
-
return new (0,
|
|
1917
|
+
return new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1916
1918
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1917
1919
|
{
|
|
1918
1920
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1922,7 +1924,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1922
1924
|
}
|
|
1923
1925
|
|
|
1924
1926
|
// src/operations/invoke/registry.ts
|
|
1925
|
-
var RECORDS =
|
|
1927
|
+
var RECORDS = _chunkVR6RYXTDcjs.CAPABILITIES;
|
|
1926
1928
|
var byId2 = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1927
1929
|
|
|
1928
1930
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1941,7 +1943,7 @@ function bufferResult(buf) {
|
|
|
1941
1943
|
function resolveRecord(operation) {
|
|
1942
1944
|
const record = byId2.get(operation);
|
|
1943
1945
|
if (record === void 0) {
|
|
1944
|
-
throw new (0,
|
|
1946
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1945
1947
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1946
1948
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1947
1949
|
);
|
|
@@ -1952,30 +1954,30 @@ function governPreRequest(record, operation, opts) {
|
|
|
1952
1954
|
validateInvokeOptions(opts, operation);
|
|
1953
1955
|
const mode = opts.mode;
|
|
1954
1956
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1955
|
-
throw new (0,
|
|
1957
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1956
1958
|
}
|
|
1957
1959
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1958
|
-
throw new (0,
|
|
1960
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1959
1961
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1960
1962
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1961
1963
|
);
|
|
1962
1964
|
}
|
|
1963
1965
|
if (opts.fresh !== void 0) {
|
|
1964
1966
|
if (typeof opts.fresh !== "boolean") {
|
|
1965
|
-
throw new (0,
|
|
1967
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1966
1968
|
`invoke: fresh must be a boolean (got ${typeof opts.fresh}) \u2014 "${operation}" was not issued`,
|
|
1967
1969
|
{ operation, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
|
|
1968
1970
|
);
|
|
1969
1971
|
}
|
|
1970
1972
|
if (record.effect !== "read" || record.kind !== "primitive" || record.operation !== "get" || !("opts" in (_nullishCoalesce(record.inputSchema, () => ( {}))))) {
|
|
1971
|
-
throw new (0,
|
|
1973
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1972
1974
|
`invoke: fresh applies only to a single-record "<resource>.get" read \u2014 "${operation}" was not issued`,
|
|
1973
1975
|
{ operation, suggestedAction: "Drop the fresh option (only <resource>.get consults the read cache per call)." }
|
|
1974
1976
|
);
|
|
1975
1977
|
}
|
|
1976
1978
|
}
|
|
1977
1979
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1978
|
-
throw new (0,
|
|
1980
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
1979
1981
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1980
1982
|
{ operation }
|
|
1981
1983
|
);
|
|
@@ -1992,7 +1994,7 @@ function operationsHolder(client) {
|
|
|
1992
1994
|
return {
|
|
1993
1995
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1994
1996
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1995
|
-
fetchMany: (items, opts) =>
|
|
1997
|
+
fetchMany: (items, opts) => _chunkLB34VFQYcjs.fetchMany.call(void 0, client, items, opts),
|
|
1996
1998
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1997
1999
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1998
2000
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -2004,12 +2006,12 @@ function operationsHolder(client) {
|
|
|
2004
2006
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
2005
2007
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
2006
2008
|
// typed outcomes reuse the fetchMany shapes).
|
|
2007
|
-
fetchByIds: (items, opts) =>
|
|
2009
|
+
fetchByIds: (items, opts) => _chunkLB34VFQYcjs.fetchByIds.call(void 0, client, items, opts),
|
|
2008
2010
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
2009
2011
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
2010
2012
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
2011
2013
|
// the API user cannot resolve; the name cache (default-on).
|
|
2012
|
-
expandResourceNames: (ids, opts) =>
|
|
2014
|
+
expandResourceNames: (ids, opts) => _chunkLB34VFQYcjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
2013
2015
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
2014
2016
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
2015
2017
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -2019,12 +2021,12 @@ function operationsHolder(client) {
|
|
|
2019
2021
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
2020
2022
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
2021
2023
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
2022
|
-
uiLink: (input) =>
|
|
2024
|
+
uiLink: (input) => _chunkLB34VFQYcjs.uiLink.call(void 0, client, input),
|
|
2023
2025
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
2024
2026
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
2025
2027
|
// pre-request; per-resource failures are recorded on the row and
|
|
2026
2028
|
// never abort the call).
|
|
2027
|
-
fieldCatalog: (opts) =>
|
|
2029
|
+
fieldCatalog: (opts) => _chunkLB34VFQYcjs.fieldCatalog.call(void 0, client, opts),
|
|
2028
2030
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
2029
2031
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
2030
2032
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -2034,15 +2036,15 @@ function operationsHolder(client) {
|
|
|
2034
2036
|
}
|
|
2035
2037
|
function resolveHolder(client, record, operation) {
|
|
2036
2038
|
const clientBag = client;
|
|
2037
|
-
let holder = clientBag[
|
|
2039
|
+
let holder = clientBag[_chunkLB34VFQYcjs.camelKey.call(void 0, record.resource)];
|
|
2038
2040
|
if (typeof holder === "function") {
|
|
2039
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
2041
|
+
holder = _nullishCoalesce(clientBag[`${_chunkLB34VFQYcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
2040
2042
|
}
|
|
2041
2043
|
if (holder === void 0 && record.resource === "operations") {
|
|
2042
2044
|
holder = operationsHolder(client);
|
|
2043
2045
|
}
|
|
2044
2046
|
if (holder === void 0) {
|
|
2045
|
-
throw new (0,
|
|
2047
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
2046
2048
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
2047
2049
|
{ operation }
|
|
2048
2050
|
);
|
|
@@ -2102,12 +2104,12 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
2102
2104
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
2103
2105
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
2104
2106
|
const holder = resolveHolder(client, record, operation);
|
|
2105
|
-
if (boundedQuery || countedQuery) await
|
|
2106
|
-
const labelQuery = boundedQuery &&
|
|
2107
|
+
if (boundedQuery || countedQuery) await _chunkLB34VFQYcjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
2108
|
+
const labelQuery = boundedQuery && _chunkLB34VFQYcjs.readNamesOpt.call(void 0, _optionalChain([args, 'access', _53 => _53[0], 'optionalAccess', _54 => _54["names"]]), `invoke: "${record.id}" params bag`);
|
|
2107
2109
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
2108
2110
|
const method = holder[methodName];
|
|
2109
2111
|
if (typeof method !== "function") {
|
|
2110
|
-
throw new (0,
|
|
2112
|
+
throw new (0, _chunkLB34VFQYcjs.AutotaskConfigError)(
|
|
2111
2113
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
2112
2114
|
{ operation }
|
|
2113
2115
|
);
|
|
@@ -2119,7 +2121,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
2119
2121
|
const result = await method.apply(holder, callArgs);
|
|
2120
2122
|
if (labelQuery && Array.isArray(_optionalChain([result, 'optionalAccess', _55 => _55.items]))) {
|
|
2121
2123
|
const bounded = result;
|
|
2122
|
-
const labelled = await
|
|
2124
|
+
const labelled = await _chunkLB34VFQYcjs.labelRows.call(void 0, client, record.resource, bounded.items);
|
|
2123
2125
|
return { ...bounded, items: labelled.rows, ...labelled.names !== void 0 ? { names: labelled.names } : {} };
|
|
2124
2126
|
}
|
|
2125
2127
|
return Buffer.isBuffer(result) ? bufferResult(result) : result;
|
|
@@ -2191,4 +2193,6 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
2191
2193
|
|
|
2192
2194
|
|
|
2193
2195
|
|
|
2194
|
-
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.ENTITY_TYPE_TO_RESOURCE = _chunkLB34VFQYcjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunkLB34VFQYcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkLB34VFQYcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkLB34VFQYcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkLB34VFQYcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkLB34VFQYcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkLB34VFQYcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkLB34VFQYcjs.MAX_FIELD_CATALOG_WIRE; exports.MIN_FIELD_CATALOG_MAX_BYTES = _chunkLB34VFQYcjs.MIN_FIELD_CATALOG_MAX_BYTES; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_CATALOG_UNAVAILABLE_NOTE = _chunkLB34VFQYcjs.PICKLIST_CATALOG_UNAVAILABLE_NOTE; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkLB34VFQYcjs.PICKLIST_VALUE_NOT_SERVED_NOTE; exports.RECOVERY_CONFIRM = RECOVERY_CONFIRM; exports.RECOVERY_DEFAULT_LIMIT = RECOVERY_DEFAULT_LIMIT; exports.RECOVERY_MAX_LIMIT = RECOVERY_MAX_LIMIT; exports.UI_LINK_ENTITIES = _chunkLB34VFQYcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunkLB34VFQYcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunkLB34VFQYcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = _chunkLB34VFQYcjs.effectiveRequiredFields; exports.expandResourceNames = _chunkLB34VFQYcjs.expandResourceNames; exports.fetchByIds = _chunkLB34VFQYcjs.fetchByIds; exports.fetchMany = _chunkLB34VFQYcjs.fetchMany; exports.fieldCatalog = _chunkLB34VFQYcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunkLB34VFQYcjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunkLB34VFQYcjs.resourceForEntityType; exports.revenueRollup = revenueRollup; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunkLB34VFQYcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunkLB34VFQYcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|