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