node-autotask 0.32.0 → 0.33.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 +15 -0
- package/MCP_TOOL_CATALOG.json +27 -8
- package/MCP_TOOL_MANIFEST.md +14 -13
- package/N8N_MCP_MANIFEST.json +38 -12
- package/N8N_MCP_MANIFEST.md +10 -9
- package/README.md +1 -1
- package/capabilities.json +1448 -1307
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-QCB4LYKD.cjs → chunk-3LAZZT7V.cjs} +143 -143
- package/dist/{chunk-IKPFR6K2.cjs → chunk-4QN43TRP.cjs} +73 -48
- package/dist/{chunk-FVHPN7ZR.js → chunk-5DS6F6GF.js} +241 -91
- package/dist/{chunk-T6EDJRLT.js → chunk-7WNE5MPG.js} +2 -2
- package/dist/{chunk-R6HLJCI2.js → chunk-MFDQHFGJ.js} +26 -1
- package/dist/{chunk-FTF2FEQ6.cjs → chunk-OO67MRHN.cjs} +765 -615
- package/dist/{chunk-DCTHO7CQ.cjs → chunk-SP2SJJZX.cjs} +1447 -1306
- package/dist/{chunk-M2EGFPGF.js → chunk-VKE56TTN.js} +1447 -1306
- package/dist/{index-Cw4aNNMo.d.ts → index-BaeMHZPk.d.ts} +87 -1
- package/dist/{index-OkbCWcef.d.cts → index-Cq0VsfSz.d.cts} +87 -1
- package/dist/index.cjs +23 -23
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/operations/index.cjs +120 -133
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +3 -16
- 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 +1 -1
- package/package.json +2 -1
|
@@ -43,29 +43,30 @@
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var _chunkIKPFR6K2cjs = require('../chunk-IKPFR6K2.cjs');
|
|
47
46
|
|
|
47
|
+
var _chunk4QN43TRPcjs = require('../chunk-4QN43TRP.cjs');
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
var _chunkSP2SJJZXcjs = require('../chunk-SP2SJJZX.cjs');
|
|
50
51
|
|
|
51
52
|
// src/operations/searchAcrossResources.ts
|
|
52
53
|
var DEFAULT_LIMIT = 25;
|
|
53
54
|
function resourceFor(client, key) {
|
|
54
|
-
return client[
|
|
55
|
+
return client[_chunk4QN43TRPcjs.camelKey.call(void 0, key)];
|
|
55
56
|
}
|
|
56
57
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
57
58
|
const text = query.trim();
|
|
58
59
|
if (text === "") {
|
|
59
|
-
throw new (0,
|
|
60
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
60
61
|
}
|
|
61
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
62
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunk4QN43TRPcjs.WORKFLOW_RESOURCES));
|
|
62
63
|
if (keys.length === 0) {
|
|
63
|
-
throw new (0,
|
|
64
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
64
65
|
}
|
|
65
|
-
const limit =
|
|
66
|
+
const limit = _chunk4QN43TRPcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
66
67
|
const totalLimit = opts.totalLimit;
|
|
67
68
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
68
|
-
throw new (0,
|
|
69
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
69
70
|
}
|
|
70
71
|
const results = [];
|
|
71
72
|
const skipped = [];
|
|
@@ -96,7 +97,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
96
97
|
|
|
97
98
|
// src/operations/resolveAny.ts
|
|
98
99
|
function resourceFor2(client, key) {
|
|
99
|
-
return client[
|
|
100
|
+
return client[_chunk4QN43TRPcjs.camelKey.call(void 0, key)];
|
|
100
101
|
}
|
|
101
102
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
102
103
|
function missCost(identifier) {
|
|
@@ -105,13 +106,13 @@ function missCost(identifier) {
|
|
|
105
106
|
}
|
|
106
107
|
async function resolveAny(client, identifier, opts = {}) {
|
|
107
108
|
if (typeof identifier === "number") {
|
|
108
|
-
|
|
109
|
+
_chunk4QN43TRPcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
109
110
|
} else if (identifier.trim() === "") {
|
|
110
|
-
throw new (0,
|
|
111
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
111
112
|
}
|
|
112
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
113
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunk4QN43TRPcjs.WORKFLOW_RESOURCES));
|
|
113
114
|
if (keys.length === 0) {
|
|
114
|
-
throw new (0,
|
|
115
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
115
116
|
}
|
|
116
117
|
const results = [];
|
|
117
118
|
for (const key of keys) {
|
|
@@ -141,9 +142,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
141
142
|
} catch (err) {
|
|
142
143
|
let code;
|
|
143
144
|
let candidates = [];
|
|
144
|
-
if (err instanceof
|
|
145
|
+
if (err instanceof _chunk4QN43TRPcjs.AutotaskConfigError) {
|
|
145
146
|
code = "CONFIG_ERROR";
|
|
146
|
-
} else if (
|
|
147
|
+
} else if (_chunk4QN43TRPcjs.isAutotaskError.call(void 0, err)) {
|
|
147
148
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
148
149
|
code = err.code;
|
|
149
150
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -170,7 +171,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
170
171
|
// src/operations/aggregate.ts
|
|
171
172
|
var AGGREGATE_TOP_MAX = 100;
|
|
172
173
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
173
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
174
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunk4QN43TRPcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
174
175
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
175
176
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
176
177
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -227,7 +228,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
227
228
|
}
|
|
228
229
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
229
230
|
const s = /* @__PURE__ */ new Set();
|
|
230
|
-
for (const rec of
|
|
231
|
+
for (const rec of _chunkSP2SJJZXcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
231
232
|
return s;
|
|
232
233
|
})();
|
|
233
234
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -263,15 +264,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
263
264
|
return [];
|
|
264
265
|
}
|
|
265
266
|
try {
|
|
266
|
-
return
|
|
267
|
+
return _chunk4QN43TRPcjs.buildFilter.call(void 0, conds).filter;
|
|
267
268
|
} catch (err) {
|
|
268
|
-
problems.push(err instanceof
|
|
269
|
+
problems.push(err instanceof _chunk4QN43TRPcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
269
270
|
return [];
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
function checkOptsBag(opts, problems) {
|
|
273
274
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
274
|
-
throw new (0,
|
|
275
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
275
276
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
276
277
|
{ operation: "operations.aggregate" }
|
|
277
278
|
);
|
|
@@ -351,7 +352,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
351
352
|
if (!Number.isInteger(opts.limit)) {
|
|
352
353
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
353
354
|
} else {
|
|
354
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
355
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunk4QN43TRPcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
355
356
|
}
|
|
356
357
|
}
|
|
357
358
|
return { top, limit };
|
|
@@ -363,14 +364,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
363
364
|
checkOptsBag(opts, problems);
|
|
364
365
|
const oracles = {
|
|
365
366
|
resourceKey,
|
|
366
|
-
fieldSets: resourceKey !== void 0 ?
|
|
367
|
-
dateSets: resourceKey !== void 0 ?
|
|
367
|
+
fieldSets: resourceKey !== void 0 ? _chunk4QN43TRPcjs.MODEL_FIELD_SETS[resourceKey] : void 0,
|
|
368
|
+
dateSets: resourceKey !== void 0 ? _chunk4QN43TRPcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
368
369
|
};
|
|
369
370
|
const groupBy = parseGroupBy(opts, oracles, problems);
|
|
370
371
|
const sum = checkSumFields("sum", opts.sum, oracles, problems);
|
|
371
372
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
372
373
|
if (problems.length > 0) {
|
|
373
|
-
throw new (0,
|
|
374
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
374
375
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
375
376
|
- ` + problems.join("\n- "),
|
|
376
377
|
{ operation: "operations.aggregate" }
|
|
@@ -404,9 +405,9 @@ function foldGroups(items, v) {
|
|
|
404
405
|
}
|
|
405
406
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
406
407
|
const v = validateAggregate(operation, filter, opts);
|
|
407
|
-
const holder = client[
|
|
408
|
+
const holder = client[_chunk4QN43TRPcjs.camelKey.call(void 0, v.resourceKey)];
|
|
408
409
|
if (holder === void 0) {
|
|
409
|
-
throw new (0,
|
|
410
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
410
411
|
operation: "operations.aggregate",
|
|
411
412
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
412
413
|
});
|
|
@@ -440,20 +441,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
440
441
|
async function relationshipMap(client, resourceKey) {
|
|
441
442
|
void client;
|
|
442
443
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
443
|
-
throw new (0,
|
|
444
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
444
445
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
445
446
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
446
447
|
);
|
|
447
448
|
}
|
|
448
449
|
const key = resourceKey.trim();
|
|
449
|
-
const entry =
|
|
450
|
+
const entry = _chunk4QN43TRPcjs.RELATIONSHIP_MAP[key];
|
|
450
451
|
if (entry === void 0) {
|
|
451
|
-
throw new (0,
|
|
452
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
452
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskError)(
|
|
453
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk4QN43TRPcjs.RELATIONSHIP_MAP).length} resources`,
|
|
453
454
|
{
|
|
454
455
|
code: "RESOURCE_UNKNOWN",
|
|
455
456
|
category: "validation",
|
|
456
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
457
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunk4QN43TRPcjs.RELATIONSHIP_ZONE.label} (${_chunk4QN43TRPcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
457
458
|
}
|
|
458
459
|
);
|
|
459
460
|
}
|
|
@@ -470,24 +471,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
470
471
|
async function blindSurfaces(client, opts) {
|
|
471
472
|
void client;
|
|
472
473
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
473
|
-
throw new (0,
|
|
474
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
474
475
|
}
|
|
475
|
-
const inv =
|
|
476
|
+
const inv = _chunk4QN43TRPcjs.BLIND_SURFACE_INVENTORY;
|
|
476
477
|
if (inv === null) {
|
|
477
|
-
throw new (0,
|
|
478
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
478
479
|
}
|
|
479
480
|
let surfaces = inv.surfaces;
|
|
480
481
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
481
482
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
482
483
|
if (key === "") {
|
|
483
|
-
throw new (0,
|
|
484
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
484
485
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
485
486
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
486
487
|
);
|
|
487
488
|
}
|
|
488
489
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
489
|
-
throw new (0,
|
|
490
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
490
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskError)(
|
|
491
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk4QN43TRPcjs.RELATIONSHIP_MAP).length} resources`,
|
|
491
492
|
{
|
|
492
493
|
code: "RESOURCE_UNKNOWN",
|
|
493
494
|
category: "validation",
|
|
@@ -499,7 +500,7 @@ async function blindSurfaces(client, opts) {
|
|
|
499
500
|
}
|
|
500
501
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
501
502
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
502
|
-
throw new (0,
|
|
503
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
503
504
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
504
505
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
505
506
|
);
|
|
@@ -512,51 +513,51 @@ async function blindSurfaces(client, opts) {
|
|
|
512
513
|
// src/operations/probeReachability.ts
|
|
513
514
|
async function probeReachability(client, opts) {
|
|
514
515
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
515
|
-
throw new (0,
|
|
516
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
516
517
|
}
|
|
517
|
-
const defs =
|
|
518
|
+
const defs = _chunk4QN43TRPcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
518
519
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
519
|
-
throw new (0,
|
|
520
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
520
521
|
"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",
|
|
521
522
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
522
523
|
);
|
|
523
524
|
}
|
|
524
525
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
525
526
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
526
|
-
throw new (0,
|
|
527
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
527
528
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
528
529
|
);
|
|
529
530
|
}
|
|
530
531
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
531
532
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
532
|
-
throw new (0,
|
|
533
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
533
534
|
}
|
|
534
535
|
if (cap > defs.hardCap) {
|
|
535
|
-
throw new (0,
|
|
536
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
536
537
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
537
538
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
538
539
|
);
|
|
539
540
|
}
|
|
540
|
-
const inv =
|
|
541
|
+
const inv = _chunk4QN43TRPcjs.BLIND_SURFACE_INVENTORY;
|
|
541
542
|
if (inv === null) {
|
|
542
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
543
544
|
}
|
|
544
545
|
let targets;
|
|
545
546
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
546
547
|
targets = [...defs.defaultTargets];
|
|
547
548
|
} else {
|
|
548
549
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
549
|
-
throw new (0,
|
|
550
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
550
551
|
}
|
|
551
552
|
const seen = /* @__PURE__ */ new Set();
|
|
552
553
|
for (const r of opts.resources) {
|
|
553
554
|
if (typeof r !== "string" || r.trim() === "") {
|
|
554
|
-
throw new (0,
|
|
555
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
555
556
|
}
|
|
556
557
|
const key = r.trim();
|
|
557
558
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
558
559
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
559
|
-
throw new (0,
|
|
560
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskError)(
|
|
560
561
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
561
562
|
{
|
|
562
563
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -570,7 +571,7 @@ async function probeReachability(client, opts) {
|
|
|
570
571
|
targets = [...seen];
|
|
571
572
|
}
|
|
572
573
|
if (targets.length > cap) {
|
|
573
|
-
throw new (0,
|
|
574
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
574
575
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
575
576
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
576
577
|
);
|
|
@@ -580,7 +581,7 @@ async function probeReachability(client, opts) {
|
|
|
580
581
|
for (const resource of targets.sort()) {
|
|
581
582
|
const row = byResource.get(resource);
|
|
582
583
|
if (row === void 0) continue;
|
|
583
|
-
const holder = client[
|
|
584
|
+
const holder = client[_chunk4QN43TRPcjs.camelKey.call(void 0, resource)];
|
|
584
585
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
585
586
|
if (typeof probeFn !== "function") {
|
|
586
587
|
results.push({
|
|
@@ -599,7 +600,7 @@ async function probeReachability(client, opts) {
|
|
|
599
600
|
probe: { ok: true, wire: 1, error: null }
|
|
600
601
|
});
|
|
601
602
|
} catch (err) {
|
|
602
|
-
const code =
|
|
603
|
+
const code = _chunk4QN43TRPcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
603
604
|
const message = err instanceof Error ? err.message : String(err);
|
|
604
605
|
results.push({
|
|
605
606
|
...row,
|
|
@@ -612,20 +613,6 @@ async function probeReachability(client, opts) {
|
|
|
612
613
|
return { results, wireUsed, cap, truncated: false };
|
|
613
614
|
}
|
|
614
615
|
|
|
615
|
-
// src/operations/requiredFields.ts
|
|
616
|
-
function effectiveRequiredFields(record, zoneFacts) {
|
|
617
|
-
const prefix = _optionalChain([zoneFacts, 'optionalAccess', _9 => _9.createGuidance, 'optionalAccess', _10 => _10.liveProvenPrefix]);
|
|
618
|
-
if (Array.isArray(prefix) && prefix.length > 0) {
|
|
619
|
-
return { fields: [...prefix], from: "live-proven" };
|
|
620
|
-
}
|
|
621
|
-
const zoneSet = _optionalChain([zoneFacts, 'optionalAccess', _11 => _11.createRequiredSet]);
|
|
622
|
-
if (Array.isArray(zoneSet) && zoneSet.length > 0) {
|
|
623
|
-
return { fields: [...zoneSet], from: "zone" };
|
|
624
|
-
}
|
|
625
|
-
const spec = _optionalChain([record, 'optionalAccess', _12 => _12.requiredFields]);
|
|
626
|
-
return { fields: Array.isArray(spec) ? [...spec] : [], from: "spec" };
|
|
627
|
-
}
|
|
628
|
-
|
|
629
616
|
// src/operations/createGuidance.ts
|
|
630
617
|
var CREATE_BLOCKER_KINDS = [
|
|
631
618
|
"ok",
|
|
@@ -641,30 +628,30 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
641
628
|
async function createGuidance(client, opts) {
|
|
642
629
|
void client;
|
|
643
630
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
644
|
-
throw new (0,
|
|
631
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
645
632
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
646
633
|
);
|
|
647
634
|
}
|
|
648
|
-
let servedRows =
|
|
635
|
+
let servedRows = _chunk4QN43TRPcjs.CREATE_GUIDANCE.rows.map((row) => ({
|
|
649
636
|
...row,
|
|
650
637
|
// Issue #219 N4: one precedence rule, stated on every row (live-proven >
|
|
651
638
|
// zone > spec). The spec set is not available here (it is a LIVE read) —
|
|
652
639
|
// the helper is handed the plan's two shapes and names the source.
|
|
653
|
-
requiredFields: effectiveRequiredFields(void 0, _nullishCoalesce(_optionalChain([
|
|
640
|
+
requiredFields: _chunk4QN43TRPcjs.effectiveRequiredFields.call(void 0, void 0, _nullishCoalesce(_optionalChain([_chunk4QN43TRPcjs.RELATIONSHIP_MAP, 'access', _9 => _9[row.resource], 'optionalAccess', _10 => _10.zoneFacts]), () => ( null)))
|
|
654
641
|
}));
|
|
655
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
642
|
+
if (_optionalChain([opts, 'optionalAccess', _11 => _11.resources]) !== void 0) {
|
|
656
643
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
657
|
-
throw new (0,
|
|
644
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
658
645
|
}
|
|
659
646
|
const wanted = /* @__PURE__ */ new Set();
|
|
660
647
|
for (const r of opts.resources) {
|
|
661
648
|
if (typeof r !== "string" || r.trim() === "") {
|
|
662
|
-
throw new (0,
|
|
649
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
663
650
|
}
|
|
664
651
|
const key = r.trim();
|
|
665
|
-
if (!
|
|
666
|
-
throw new (0,
|
|
667
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
652
|
+
if (!_chunk4QN43TRPcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
653
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskError)(
|
|
654
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunk4QN43TRPcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
668
655
|
{
|
|
669
656
|
code: "RESOURCE_UNKNOWN",
|
|
670
657
|
category: "validation",
|
|
@@ -676,20 +663,20 @@ async function createGuidance(client, opts) {
|
|
|
676
663
|
}
|
|
677
664
|
servedRows = servedRows.filter((row) => wanted.has(row.resource));
|
|
678
665
|
}
|
|
679
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
666
|
+
if (_optionalChain([opts, 'optionalAccess', _12 => _12.kind]) !== void 0) {
|
|
680
667
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
681
|
-
throw new (0,
|
|
668
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
682
669
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
683
670
|
);
|
|
684
671
|
}
|
|
685
|
-
servedRows = servedRows.filter((row) => _optionalChain([row, 'access',
|
|
672
|
+
servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _13 => _13.blocker, 'optionalAccess', _14 => _14.kind]) === opts.kind);
|
|
686
673
|
}
|
|
687
674
|
return {
|
|
688
|
-
zone:
|
|
689
|
-
label:
|
|
690
|
-
verifiedAt:
|
|
675
|
+
zone: _chunk4QN43TRPcjs.CREATE_GUIDANCE.zone,
|
|
676
|
+
label: _chunk4QN43TRPcjs.CREATE_GUIDANCE.label,
|
|
677
|
+
verifiedAt: _chunk4QN43TRPcjs.CREATE_GUIDANCE.verifiedAt,
|
|
691
678
|
rows: servedRows,
|
|
692
|
-
counts:
|
|
679
|
+
counts: _chunk4QN43TRPcjs.CREATE_GUIDANCE.counts
|
|
693
680
|
};
|
|
694
681
|
}
|
|
695
682
|
|
|
@@ -698,7 +685,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
698
685
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
699
686
|
var RECOVERY_MAX_LIMIT = 100;
|
|
700
687
|
function configError(message, operation, suggestedAction) {
|
|
701
|
-
throw new (0,
|
|
688
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
702
689
|
}
|
|
703
690
|
function parseMatchId(record) {
|
|
704
691
|
const raw = record.id;
|
|
@@ -714,7 +701,7 @@ function parseMatchId(record) {
|
|
|
714
701
|
return { id: null, unsafe: true };
|
|
715
702
|
}
|
|
716
703
|
function validateRecoveryInput(input, operation) {
|
|
717
|
-
if (!
|
|
704
|
+
if (!_chunk4QN43TRPcjs.isRecord.call(void 0, input)) {
|
|
718
705
|
configError(
|
|
719
706
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
720
707
|
operation,
|
|
@@ -748,10 +735,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
748
735
|
return { resource, marker, action };
|
|
749
736
|
}
|
|
750
737
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
751
|
-
const entry =
|
|
738
|
+
const entry = _chunk4QN43TRPcjs.RELATIONSHIP_MAP[resource];
|
|
752
739
|
if (entry === void 0) {
|
|
753
|
-
throw new (0,
|
|
754
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
740
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskError)(
|
|
741
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunk4QN43TRPcjs.RELATIONSHIP_MAP).length} resources`,
|
|
755
742
|
{
|
|
756
743
|
code: "RESOURCE_UNKNOWN",
|
|
757
744
|
category: "validation",
|
|
@@ -760,7 +747,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
760
747
|
}
|
|
761
748
|
);
|
|
762
749
|
}
|
|
763
|
-
const holder = client[
|
|
750
|
+
const holder = client[_chunk4QN43TRPcjs.camelKey.call(void 0, resource)];
|
|
764
751
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
765
752
|
configError(
|
|
766
753
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -771,7 +758,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
771
758
|
return { entry, holder };
|
|
772
759
|
}
|
|
773
760
|
function resolveMarkerField(input, resource, operation) {
|
|
774
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
761
|
+
const field = input.field !== void 0 ? String(input.field) : _chunk4QN43TRPcjs.MARKER_FIELDS[resource];
|
|
775
762
|
if (typeof field !== "string" || field.trim() === "") {
|
|
776
763
|
configError(
|
|
777
764
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -810,7 +797,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
810
797
|
);
|
|
811
798
|
}
|
|
812
799
|
for (const c of input.filter) {
|
|
813
|
-
if (!
|
|
800
|
+
if (!_chunk4QN43TRPcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
814
801
|
configError(
|
|
815
802
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
816
803
|
operation,
|
|
@@ -835,7 +822,7 @@ function resolveLimit(input, operation) {
|
|
|
835
822
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
836
823
|
const deleteMethod = holder.delete;
|
|
837
824
|
if (deleteMethod === void 0) {
|
|
838
|
-
throw new (0,
|
|
825
|
+
throw new (0, _chunk4QN43TRPcjs.DeleteBoundaryError)(
|
|
839
826
|
`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`,
|
|
840
827
|
{
|
|
841
828
|
operation,
|
|
@@ -864,14 +851,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
864
851
|
verify = "still-present";
|
|
865
852
|
}
|
|
866
853
|
} catch (err) {
|
|
867
|
-
if (err instanceof
|
|
854
|
+
if (err instanceof _chunk4QN43TRPcjs.NotFoundError) verify = "not-found";
|
|
868
855
|
else {
|
|
869
856
|
verify = "error";
|
|
870
|
-
code =
|
|
857
|
+
code = _chunk4QN43TRPcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
871
858
|
}
|
|
872
859
|
}
|
|
873
860
|
} catch (err) {
|
|
874
|
-
code =
|
|
861
|
+
code = _chunk4QN43TRPcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
875
862
|
}
|
|
876
863
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
877
864
|
}
|
|
@@ -899,7 +886,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
899
886
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
900
887
|
const extra = resolveExtraFilter(input, operation);
|
|
901
888
|
const limit = resolveLimit(input, operation);
|
|
902
|
-
const boundaryNote =
|
|
889
|
+
const boundaryNote = _chunk4QN43TRPcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
903
890
|
const boundary = {
|
|
904
891
|
available: boundaryNote === void 0,
|
|
905
892
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -911,7 +898,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
911
898
|
};
|
|
912
899
|
const isDelete = action === "delete";
|
|
913
900
|
if (isDelete && boundaryNote !== void 0) {
|
|
914
|
-
throw new (0,
|
|
901
|
+
throw new (0, _chunk4QN43TRPcjs.DeleteBoundaryError)(
|
|
915
902
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
916
903
|
{
|
|
917
904
|
operation,
|
|
@@ -920,10 +907,10 @@ async function recovery(client, input, opts = {}) {
|
|
|
920
907
|
}
|
|
921
908
|
);
|
|
922
909
|
}
|
|
923
|
-
const dryRun = _optionalChain([opts, 'optionalAccess',
|
|
924
|
-
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
910
|
+
const dryRun = _optionalChain([opts, 'optionalAccess', _15 => _15.dryRun]) !== false;
|
|
911
|
+
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _16 => _16.confirm]), () => ( input.confirm));
|
|
925
912
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
926
|
-
throw new (0,
|
|
913
|
+
throw new (0, _chunk4QN43TRPcjs.ConfirmationRequiredError)(
|
|
927
914
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
928
915
|
{
|
|
929
916
|
operation: RECOVERY_CONFIRM,
|
|
@@ -939,7 +926,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
939
926
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
940
927
|
if (query.hasMore) {
|
|
941
928
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
942
|
-
throw new (0,
|
|
929
|
+
throw new (0, _chunk4QN43TRPcjs.RecoveryTruncatedError)(
|
|
943
930
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
944
931
|
{
|
|
945
932
|
operation,
|
|
@@ -968,7 +955,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
968
955
|
return { ...base, simulated: true, dryRun: true };
|
|
969
956
|
}
|
|
970
957
|
if (unsafeId) {
|
|
971
|
-
throw new (0,
|
|
958
|
+
throw new (0, _chunk4QN43TRPcjs.MarkerUnsafeIdError)(
|
|
972
959
|
`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)`,
|
|
973
960
|
{
|
|
974
961
|
operation,
|
|
@@ -986,7 +973,7 @@ function needsConfirmation(record) {
|
|
|
986
973
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
987
974
|
}
|
|
988
975
|
function refuse(message, operation, suggestedAction) {
|
|
989
|
-
throw new (0,
|
|
976
|
+
throw new (0, _chunk4QN43TRPcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
990
977
|
}
|
|
991
978
|
var MODE_BY_EFFECT = {
|
|
992
979
|
read: "read",
|
|
@@ -1032,7 +1019,7 @@ function looseTypeOk(type, value) {
|
|
|
1032
1019
|
case "string[]":
|
|
1033
1020
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1034
1021
|
case "object":
|
|
1035
|
-
return
|
|
1022
|
+
return _chunk4QN43TRPcjs.isRecord.call(void 0, value);
|
|
1036
1023
|
default:
|
|
1037
1024
|
return true;
|
|
1038
1025
|
}
|
|
@@ -1046,12 +1033,12 @@ function declaredArgList(record) {
|
|
|
1046
1033
|
function resolveDispatchArgs(record, argsIn) {
|
|
1047
1034
|
const operation = record.id;
|
|
1048
1035
|
const bad = (message) => {
|
|
1049
|
-
throw new (0,
|
|
1036
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1050
1037
|
};
|
|
1051
1038
|
if (argsIn === void 0 || argsIn === null) return [];
|
|
1052
1039
|
if (Array.isArray(argsIn)) return argsIn;
|
|
1053
1040
|
const byName = argsIn;
|
|
1054
|
-
if (!
|
|
1041
|
+
if (!_chunk4QN43TRPcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1055
1042
|
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1056
1043
|
}
|
|
1057
1044
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
@@ -1072,7 +1059,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1072
1059
|
const bagName = names.find((n) => schema[n].properties);
|
|
1073
1060
|
const surplus = args[names.length];
|
|
1074
1061
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1075
|
-
throw new (0,
|
|
1062
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1076
1063
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1077
1064
|
{
|
|
1078
1065
|
operation,
|
|
@@ -1082,7 +1069,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1082
1069
|
}
|
|
1083
1070
|
const required = names.filter((n) => schema[n].required);
|
|
1084
1071
|
if (args.length < required.length) {
|
|
1085
|
-
throw new (0,
|
|
1072
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1086
1073
|
`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)}`,
|
|
1087
1074
|
{ operation }
|
|
1088
1075
|
);
|
|
@@ -1093,7 +1080,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1093
1080
|
const name = names[i];
|
|
1094
1081
|
const spec = schema[name];
|
|
1095
1082
|
if (!looseTypeOk(spec.type, value)) {
|
|
1096
|
-
throw new (0,
|
|
1083
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1097
1084
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1098
1085
|
{ operation }
|
|
1099
1086
|
);
|
|
@@ -1101,17 +1088,17 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1101
1088
|
}
|
|
1102
1089
|
}
|
|
1103
1090
|
function foldFlattenedOpts(record, toolArgs) {
|
|
1104
|
-
if (!
|
|
1105
|
-
throw new (0,
|
|
1091
|
+
if (!_chunk4QN43TRPcjs.isRecord.call(void 0, toolArgs)) {
|
|
1092
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1106
1093
|
}
|
|
1107
|
-
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access',
|
|
1094
|
+
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _17 => _17.inputSchema, 'optionalAccess', _18 => _18.opts, 'optionalAccess', _19 => _19.properties]), () => ( []))).map((p) => p.name);
|
|
1108
1095
|
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
1109
1096
|
const folded = { ...toolArgs };
|
|
1110
1097
|
for (const k of bagKeys) delete folded[k];
|
|
1111
1098
|
if (folded.opts === null) delete folded.opts;
|
|
1112
1099
|
if (flat.length === 0) return folded;
|
|
1113
1100
|
if (folded.opts !== void 0) {
|
|
1114
|
-
throw new (0,
|
|
1101
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1115
1102
|
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1116
1103
|
{ operation: record.id }
|
|
1117
1104
|
);
|
|
@@ -1172,12 +1159,12 @@ function validateParamsBag(record, args) {
|
|
|
1172
1159
|
if (record.inputSchemaStrict !== true) return;
|
|
1173
1160
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1174
1161
|
if (valid === void 0) return;
|
|
1175
|
-
const bag = _optionalChain([args, 'optionalAccess',
|
|
1176
|
-
if (bag === void 0 || bag === null || !
|
|
1162
|
+
const bag = _optionalChain([args, 'optionalAccess', _20 => _20[0]]);
|
|
1163
|
+
if (bag === void 0 || bag === null || !_chunk4QN43TRPcjs.isRecord.call(void 0, bag)) return;
|
|
1177
1164
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1178
1165
|
if (unknown.length === 0) return;
|
|
1179
1166
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1180
|
-
throw new (0,
|
|
1167
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1181
1168
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1182
1169
|
{
|
|
1183
1170
|
operation: record.id,
|
|
@@ -1191,7 +1178,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1191
1178
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1192
1179
|
if (unknown.length === 0) return;
|
|
1193
1180
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1194
|
-
throw new (0,
|
|
1181
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1195
1182
|
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries; "mode" is internal to the mode wrappers)`,
|
|
1196
1183
|
{
|
|
1197
1184
|
operation,
|
|
@@ -1204,7 +1191,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1204
1191
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1205
1192
|
if (unknown.length === 0) return null;
|
|
1206
1193
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1207
|
-
return new (0,
|
|
1194
|
+
return new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1208
1195
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1209
1196
|
{
|
|
1210
1197
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1214,7 +1201,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1214
1201
|
}
|
|
1215
1202
|
|
|
1216
1203
|
// src/operations/invoke/registry.ts
|
|
1217
|
-
var RECORDS =
|
|
1204
|
+
var RECORDS = _chunkSP2SJJZXcjs.CAPABILITIES;
|
|
1218
1205
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1219
1206
|
|
|
1220
1207
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1233,7 +1220,7 @@ function bufferResult(buf) {
|
|
|
1233
1220
|
function resolveRecord(operation) {
|
|
1234
1221
|
const record = byId.get(operation);
|
|
1235
1222
|
if (record === void 0) {
|
|
1236
|
-
throw new (0,
|
|
1223
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1237
1224
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1238
1225
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1239
1226
|
);
|
|
@@ -1244,16 +1231,16 @@ function governPreRequest(record, operation, opts) {
|
|
|
1244
1231
|
validateInvokeOptions(opts, operation);
|
|
1245
1232
|
const mode = opts.mode;
|
|
1246
1233
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1247
|
-
throw new (0,
|
|
1234
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1248
1235
|
}
|
|
1249
1236
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1250
|
-
throw new (0,
|
|
1237
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1251
1238
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1252
1239
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1253
1240
|
);
|
|
1254
1241
|
}
|
|
1255
1242
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1256
|
-
throw new (0,
|
|
1243
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1257
1244
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1258
1245
|
{ operation }
|
|
1259
1246
|
);
|
|
@@ -1270,7 +1257,7 @@ function operationsHolder(client) {
|
|
|
1270
1257
|
return {
|
|
1271
1258
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1272
1259
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1273
|
-
fetchMany: (items, opts) =>
|
|
1260
|
+
fetchMany: (items, opts) => _chunk4QN43TRPcjs.fetchMany.call(void 0, client, items, opts),
|
|
1274
1261
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1275
1262
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1276
1263
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1280,12 +1267,12 @@ function operationsHolder(client) {
|
|
|
1280
1267
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1281
1268
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1282
1269
|
// typed outcomes reuse the fetchMany shapes).
|
|
1283
|
-
fetchByIds: (items, opts) =>
|
|
1270
|
+
fetchByIds: (items, opts) => _chunk4QN43TRPcjs.fetchByIds.call(void 0, client, items, opts),
|
|
1284
1271
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1285
1272
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1286
1273
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1287
1274
|
// the API user cannot resolve; the name cache (default-on).
|
|
1288
|
-
expandResourceNames: (ids, opts) =>
|
|
1275
|
+
expandResourceNames: (ids, opts) => _chunk4QN43TRPcjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
1289
1276
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1290
1277
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1291
1278
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1295,12 +1282,12 @@ function operationsHolder(client) {
|
|
|
1295
1282
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
1296
1283
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
1297
1284
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
1298
|
-
uiLink: (input) =>
|
|
1285
|
+
uiLink: (input) => _chunk4QN43TRPcjs.uiLink.call(void 0, client, input),
|
|
1299
1286
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
1300
1287
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1301
1288
|
// pre-request; per-resource failures are recorded on the row and
|
|
1302
1289
|
// never abort the call).
|
|
1303
|
-
fieldCatalog: (opts) =>
|
|
1290
|
+
fieldCatalog: (opts) => _chunk4QN43TRPcjs.fieldCatalog.call(void 0, client, opts),
|
|
1304
1291
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1305
1292
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1306
1293
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1310,15 +1297,15 @@ function operationsHolder(client) {
|
|
|
1310
1297
|
}
|
|
1311
1298
|
function resolveHolder(client, record, operation) {
|
|
1312
1299
|
const clientBag = client;
|
|
1313
|
-
let holder = clientBag[
|
|
1300
|
+
let holder = clientBag[_chunk4QN43TRPcjs.camelKey.call(void 0, record.resource)];
|
|
1314
1301
|
if (typeof holder === "function") {
|
|
1315
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
1302
|
+
holder = _nullishCoalesce(clientBag[`${_chunk4QN43TRPcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1316
1303
|
}
|
|
1317
1304
|
if (holder === void 0 && record.resource === "operations") {
|
|
1318
1305
|
holder = operationsHolder(client);
|
|
1319
1306
|
}
|
|
1320
1307
|
if (holder === void 0) {
|
|
1321
|
-
throw new (0,
|
|
1308
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1322
1309
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1323
1310
|
{ operation }
|
|
1324
1311
|
);
|
|
@@ -1371,11 +1358,11 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1371
1358
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1372
1359
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1373
1360
|
const holder = resolveHolder(client, record, operation);
|
|
1374
|
-
if (boundedQuery || countedQuery) await
|
|
1361
|
+
if (boundedQuery || countedQuery) await _chunk4QN43TRPcjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
1375
1362
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1376
1363
|
const method = holder[methodName];
|
|
1377
1364
|
if (typeof method !== "function") {
|
|
1378
|
-
throw new (0,
|
|
1365
|
+
throw new (0, _chunk4QN43TRPcjs.AutotaskConfigError)(
|
|
1379
1366
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1380
1367
|
{ operation }
|
|
1381
1368
|
);
|
|
@@ -1452,4 +1439,4 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1452
1439
|
|
|
1453
1440
|
|
|
1454
1441
|
|
|
1455
|
-
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 =
|
|
1442
|
+
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 = _chunk4QN43TRPcjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunk4QN43TRPcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunk4QN43TRPcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunk4QN43TRPcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunk4QN43TRPcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunk4QN43TRPcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunk4QN43TRPcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunk4QN43TRPcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunk4QN43TRPcjs.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 = _chunk4QN43TRPcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunk4QN43TRPcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunk4QN43TRPcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = _chunk4QN43TRPcjs.effectiveRequiredFields; exports.expandResourceNames = _chunk4QN43TRPcjs.expandResourceNames; exports.fetchByIds = _chunk4QN43TRPcjs.fetchByIds; exports.fetchMany = _chunk4QN43TRPcjs.fetchMany; exports.fieldCatalog = _chunk4QN43TRPcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunk4QN43TRPcjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunk4QN43TRPcjs.resourceForEntityType; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunk4QN43TRPcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunk4QN43TRPcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|