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