node-autotask 0.27.0 → 0.29.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 +49 -0
- package/MCP_TOOL_CATALOG.json +63 -8
- package/MCP_TOOL_MANIFEST.md +14 -11
- package/N8N_MCP_MANIFEST.json +84 -5
- package/N8N_MCP_MANIFEST.md +10 -7
- package/README.md +1 -2
- package/capabilities.json +1774 -1308
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-UHTZLUDE.cjs → chunk-APXBBN3D.cjs} +143 -143
- package/dist/{chunk-5GGCSRT4.cjs → chunk-BNIOQEKP.cjs} +840 -586
- package/dist/{chunk-ZJ4ONAQF.cjs → chunk-IKWHRUQ5.cjs} +97 -6
- package/dist/{chunk-42ZUISDH.js → chunk-KVT5V7SA.js} +93 -2
- package/dist/{chunk-5CC7LGNM.cjs → chunk-PY45RBQ2.cjs} +1773 -1307
- package/dist/{chunk-ZGTFVZL5.js → chunk-T4SZGOJB.js} +333 -79
- package/dist/{chunk-F7FVOXPQ.js → chunk-WKP442HS.js} +1773 -1307
- package/dist/{chunk-GURC52J7.js → chunk-X4TUU2Y6.js} +2 -2
- package/dist/{index-BIWy9m-a.d.ts → index-6_i-__sN.d.ts} +103 -3
- package/dist/{index-DQ9NgraW.d.cts → index-BGZ1Mhbh.d.cts} +105 -82
- package/dist/{index-DQ9NgraW.d.ts → index-BGZ1Mhbh.d.ts} +105 -82
- package/dist/{index-D4XYtn4s.d.cts → index-BZkfUU59.d.cts} +103 -3
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +112 -112
- package/dist/operations/index.d.cts +4 -4
- package/dist/operations/index.d.ts +4 -4
- package/dist/operations/index.js +2 -2
- package/dist/pool.cjs +9 -9
- package/dist/pool.d.cts +2 -2
- package/dist/pool.d.ts +2 -2
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +3 -3
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/docs/API.md +40 -3
- package/package.json +1 -1
|
@@ -43,29 +43,29 @@
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkIKWHRUQ5cjs = require('../chunk-IKWHRUQ5.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
var
|
|
49
|
+
var _chunkPY45RBQ2cjs = require('../chunk-PY45RBQ2.cjs');
|
|
50
50
|
|
|
51
51
|
// src/operations/searchAcrossResources.ts
|
|
52
52
|
var DEFAULT_LIMIT = 25;
|
|
53
53
|
function resourceFor(client, key) {
|
|
54
|
-
return client[
|
|
54
|
+
return client[_chunkIKWHRUQ5cjs.camelKey.call(void 0, key)];
|
|
55
55
|
}
|
|
56
56
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
57
57
|
const text = query.trim();
|
|
58
58
|
if (text === "") {
|
|
59
|
-
throw new (0,
|
|
59
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
60
60
|
}
|
|
61
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
61
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkIKWHRUQ5cjs.WORKFLOW_RESOURCES));
|
|
62
62
|
if (keys.length === 0) {
|
|
63
|
-
throw new (0,
|
|
63
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
64
64
|
}
|
|
65
|
-
const limit =
|
|
65
|
+
const limit = _chunkIKWHRUQ5cjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
66
66
|
const totalLimit = opts.totalLimit;
|
|
67
67
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
68
|
-
throw new (0,
|
|
68
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
69
69
|
}
|
|
70
70
|
const results = [];
|
|
71
71
|
const skipped = [];
|
|
@@ -96,7 +96,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
96
96
|
|
|
97
97
|
// src/operations/resolveAny.ts
|
|
98
98
|
function resourceFor2(client, key) {
|
|
99
|
-
return client[
|
|
99
|
+
return client[_chunkIKWHRUQ5cjs.camelKey.call(void 0, key)];
|
|
100
100
|
}
|
|
101
101
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
102
102
|
function missCost(identifier) {
|
|
@@ -105,13 +105,13 @@ function missCost(identifier) {
|
|
|
105
105
|
}
|
|
106
106
|
async function resolveAny(client, identifier, opts = {}) {
|
|
107
107
|
if (typeof identifier === "number") {
|
|
108
|
-
|
|
108
|
+
_chunkIKWHRUQ5cjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
109
109
|
} else if (identifier.trim() === "") {
|
|
110
|
-
throw new (0,
|
|
110
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
111
111
|
}
|
|
112
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
112
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkIKWHRUQ5cjs.WORKFLOW_RESOURCES));
|
|
113
113
|
if (keys.length === 0) {
|
|
114
|
-
throw new (0,
|
|
114
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
115
115
|
}
|
|
116
116
|
const results = [];
|
|
117
117
|
for (const key of keys) {
|
|
@@ -141,9 +141,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
141
141
|
} catch (err) {
|
|
142
142
|
let code;
|
|
143
143
|
let candidates = [];
|
|
144
|
-
if (err instanceof
|
|
144
|
+
if (err instanceof _chunkIKWHRUQ5cjs.AutotaskConfigError) {
|
|
145
145
|
code = "CONFIG_ERROR";
|
|
146
|
-
} else if (
|
|
146
|
+
} else if (_chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err)) {
|
|
147
147
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
148
148
|
code = err.code;
|
|
149
149
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -170,7 +170,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
170
170
|
// src/operations/aggregate.ts
|
|
171
171
|
var AGGREGATE_TOP_MAX = 100;
|
|
172
172
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
173
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
173
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunkIKWHRUQ5cjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
174
174
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
175
175
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
176
176
|
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 +227,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
227
227
|
}
|
|
228
228
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
229
229
|
const s = /* @__PURE__ */ new Set();
|
|
230
|
-
for (const rec of
|
|
230
|
+
for (const rec of _chunkPY45RBQ2cjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
231
231
|
return s;
|
|
232
232
|
})();
|
|
233
233
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -263,15 +263,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
263
263
|
return [];
|
|
264
264
|
}
|
|
265
265
|
try {
|
|
266
|
-
return
|
|
266
|
+
return _chunkIKWHRUQ5cjs.buildFilter.call(void 0, conds).filter;
|
|
267
267
|
} catch (err) {
|
|
268
|
-
problems.push(err instanceof
|
|
268
|
+
problems.push(err instanceof _chunkIKWHRUQ5cjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
269
269
|
return [];
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
function checkOptsBag(opts, problems) {
|
|
273
273
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
274
|
-
throw new (0,
|
|
274
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
275
275
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
276
276
|
{ operation: "operations.aggregate" }
|
|
277
277
|
);
|
|
@@ -351,7 +351,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
351
351
|
if (!Number.isInteger(opts.limit)) {
|
|
352
352
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
353
353
|
} else {
|
|
354
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
354
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunkIKWHRUQ5cjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
return { top, limit };
|
|
@@ -363,14 +363,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
363
363
|
checkOptsBag(opts, problems);
|
|
364
364
|
const oracles = {
|
|
365
365
|
resourceKey,
|
|
366
|
-
fieldSets: resourceKey !== void 0 ?
|
|
367
|
-
dateSets: resourceKey !== void 0 ?
|
|
366
|
+
fieldSets: resourceKey !== void 0 ? _chunkIKWHRUQ5cjs.MODEL_FIELD_SETS[resourceKey] : void 0,
|
|
367
|
+
dateSets: resourceKey !== void 0 ? _chunkIKWHRUQ5cjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
368
368
|
};
|
|
369
369
|
const groupBy = parseGroupBy(opts, oracles, problems);
|
|
370
370
|
const sum = checkSumFields("sum", opts.sum, oracles, problems);
|
|
371
371
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
372
372
|
if (problems.length > 0) {
|
|
373
|
-
throw new (0,
|
|
373
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
374
374
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
375
375
|
- ` + problems.join("\n- "),
|
|
376
376
|
{ operation: "operations.aggregate" }
|
|
@@ -404,9 +404,9 @@ function foldGroups(items, v) {
|
|
|
404
404
|
}
|
|
405
405
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
406
406
|
const v = validateAggregate(operation, filter, opts);
|
|
407
|
-
const holder = client[
|
|
407
|
+
const holder = client[_chunkIKWHRUQ5cjs.camelKey.call(void 0, v.resourceKey)];
|
|
408
408
|
if (holder === void 0) {
|
|
409
|
-
throw new (0,
|
|
409
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
410
410
|
operation: "operations.aggregate",
|
|
411
411
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
412
412
|
});
|
|
@@ -440,20 +440,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
440
440
|
async function relationshipMap(client, resourceKey) {
|
|
441
441
|
void client;
|
|
442
442
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
443
|
-
throw new (0,
|
|
443
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
444
444
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
445
445
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
446
446
|
);
|
|
447
447
|
}
|
|
448
448
|
const key = resourceKey.trim();
|
|
449
|
-
const entry =
|
|
449
|
+
const entry = _chunkIKWHRUQ5cjs.RELATIONSHIP_MAP[key];
|
|
450
450
|
if (entry === void 0) {
|
|
451
|
-
throw new (0,
|
|
452
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
451
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
|
|
452
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP).length} resources`,
|
|
453
453
|
{
|
|
454
454
|
code: "RESOURCE_UNKNOWN",
|
|
455
455
|
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 ${
|
|
456
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkIKWHRUQ5cjs.RELATIONSHIP_ZONE.label} (${_chunkIKWHRUQ5cjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
457
457
|
}
|
|
458
458
|
);
|
|
459
459
|
}
|
|
@@ -470,24 +470,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
470
470
|
async function blindSurfaces(client, opts) {
|
|
471
471
|
void client;
|
|
472
472
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
473
|
-
throw new (0,
|
|
473
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
474
474
|
}
|
|
475
|
-
const inv =
|
|
475
|
+
const inv = _chunkIKWHRUQ5cjs.BLIND_SURFACE_INVENTORY;
|
|
476
476
|
if (inv === null) {
|
|
477
|
-
throw new (0,
|
|
477
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
478
478
|
}
|
|
479
479
|
let surfaces = inv.surfaces;
|
|
480
480
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
481
481
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
482
482
|
if (key === "") {
|
|
483
|
-
throw new (0,
|
|
483
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
484
484
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
485
485
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
486
486
|
);
|
|
487
487
|
}
|
|
488
488
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
489
|
-
throw new (0,
|
|
490
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
489
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
|
|
490
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP).length} resources`,
|
|
491
491
|
{
|
|
492
492
|
code: "RESOURCE_UNKNOWN",
|
|
493
493
|
category: "validation",
|
|
@@ -499,7 +499,7 @@ async function blindSurfaces(client, opts) {
|
|
|
499
499
|
}
|
|
500
500
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
501
501
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
502
|
-
throw new (0,
|
|
502
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
503
503
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
504
504
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
505
505
|
);
|
|
@@ -512,51 +512,51 @@ async function blindSurfaces(client, opts) {
|
|
|
512
512
|
// src/operations/probeReachability.ts
|
|
513
513
|
async function probeReachability(client, opts) {
|
|
514
514
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
515
|
-
throw new (0,
|
|
515
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
516
516
|
}
|
|
517
|
-
const defs =
|
|
517
|
+
const defs = _chunkIKWHRUQ5cjs.REACHABILITY_PROBE_DEFAULTS;
|
|
518
518
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
519
|
-
throw new (0,
|
|
519
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
520
520
|
"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
521
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
522
522
|
);
|
|
523
523
|
}
|
|
524
524
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
525
525
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
526
|
-
throw new (0,
|
|
526
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
527
527
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
528
528
|
);
|
|
529
529
|
}
|
|
530
530
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
531
531
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
532
|
-
throw new (0,
|
|
532
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
533
533
|
}
|
|
534
534
|
if (cap > defs.hardCap) {
|
|
535
|
-
throw new (0,
|
|
535
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
536
536
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
537
537
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
538
538
|
);
|
|
539
539
|
}
|
|
540
|
-
const inv =
|
|
540
|
+
const inv = _chunkIKWHRUQ5cjs.BLIND_SURFACE_INVENTORY;
|
|
541
541
|
if (inv === null) {
|
|
542
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
543
543
|
}
|
|
544
544
|
let targets;
|
|
545
545
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
546
546
|
targets = [...defs.defaultTargets];
|
|
547
547
|
} else {
|
|
548
548
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
549
|
-
throw new (0,
|
|
549
|
+
throw new (0, _chunkIKWHRUQ5cjs.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
550
|
}
|
|
551
551
|
const seen = /* @__PURE__ */ new Set();
|
|
552
552
|
for (const r of opts.resources) {
|
|
553
553
|
if (typeof r !== "string" || r.trim() === "") {
|
|
554
|
-
throw new (0,
|
|
554
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
555
555
|
}
|
|
556
556
|
const key = r.trim();
|
|
557
557
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
558
558
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
559
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
|
|
560
560
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
561
561
|
{
|
|
562
562
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -570,7 +570,7 @@ async function probeReachability(client, opts) {
|
|
|
570
570
|
targets = [...seen];
|
|
571
571
|
}
|
|
572
572
|
if (targets.length > cap) {
|
|
573
|
-
throw new (0,
|
|
573
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
574
574
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
575
575
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
576
576
|
);
|
|
@@ -580,7 +580,7 @@ async function probeReachability(client, opts) {
|
|
|
580
580
|
for (const resource of targets.sort()) {
|
|
581
581
|
const row = byResource.get(resource);
|
|
582
582
|
if (row === void 0) continue;
|
|
583
|
-
const holder = client[
|
|
583
|
+
const holder = client[_chunkIKWHRUQ5cjs.camelKey.call(void 0, resource)];
|
|
584
584
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
585
585
|
if (typeof probeFn !== "function") {
|
|
586
586
|
results.push({
|
|
@@ -599,7 +599,7 @@ async function probeReachability(client, opts) {
|
|
|
599
599
|
probe: { ok: true, wire: 1, error: null }
|
|
600
600
|
});
|
|
601
601
|
} catch (err) {
|
|
602
|
-
const code =
|
|
602
|
+
const code = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
603
603
|
const message = err instanceof Error ? err.message : String(err);
|
|
604
604
|
results.push({
|
|
605
605
|
...row,
|
|
@@ -641,30 +641,30 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
641
641
|
async function createGuidance(client, opts) {
|
|
642
642
|
void client;
|
|
643
643
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
644
|
-
throw new (0,
|
|
644
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
645
645
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
646
646
|
);
|
|
647
647
|
}
|
|
648
|
-
let servedRows =
|
|
648
|
+
let servedRows = _chunkIKWHRUQ5cjs.CREATE_GUIDANCE.rows.map((row) => ({
|
|
649
649
|
...row,
|
|
650
650
|
// Issue #219 N4: one precedence rule, stated on every row (live-proven >
|
|
651
651
|
// zone > spec). The spec set is not available here (it is a LIVE read) —
|
|
652
652
|
// the helper is handed the plan's two shapes and names the source.
|
|
653
|
-
requiredFields: effectiveRequiredFields(void 0, _nullishCoalesce(_optionalChain([
|
|
653
|
+
requiredFields: effectiveRequiredFields(void 0, _nullishCoalesce(_optionalChain([_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP, 'access', _13 => _13[row.resource], 'optionalAccess', _14 => _14.zoneFacts]), () => ( null)))
|
|
654
654
|
}));
|
|
655
655
|
if (_optionalChain([opts, 'optionalAccess', _15 => _15.resources]) !== void 0) {
|
|
656
656
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
657
|
-
throw new (0,
|
|
657
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
658
658
|
}
|
|
659
659
|
const wanted = /* @__PURE__ */ new Set();
|
|
660
660
|
for (const r of opts.resources) {
|
|
661
661
|
if (typeof r !== "string" || r.trim() === "") {
|
|
662
|
-
throw new (0,
|
|
662
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
663
663
|
}
|
|
664
664
|
const key = r.trim();
|
|
665
|
-
if (!
|
|
666
|
-
throw new (0,
|
|
667
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
665
|
+
if (!_chunkIKWHRUQ5cjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
666
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
|
|
667
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkIKWHRUQ5cjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
668
668
|
{
|
|
669
669
|
code: "RESOURCE_UNKNOWN",
|
|
670
670
|
category: "validation",
|
|
@@ -678,18 +678,18 @@ async function createGuidance(client, opts) {
|
|
|
678
678
|
}
|
|
679
679
|
if (_optionalChain([opts, 'optionalAccess', _16 => _16.kind]) !== void 0) {
|
|
680
680
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
681
|
-
throw new (0,
|
|
681
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
682
682
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
683
683
|
);
|
|
684
684
|
}
|
|
685
685
|
servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _17 => _17.blocker, 'optionalAccess', _18 => _18.kind]) === opts.kind);
|
|
686
686
|
}
|
|
687
687
|
return {
|
|
688
|
-
zone:
|
|
689
|
-
label:
|
|
690
|
-
verifiedAt:
|
|
688
|
+
zone: _chunkIKWHRUQ5cjs.CREATE_GUIDANCE.zone,
|
|
689
|
+
label: _chunkIKWHRUQ5cjs.CREATE_GUIDANCE.label,
|
|
690
|
+
verifiedAt: _chunkIKWHRUQ5cjs.CREATE_GUIDANCE.verifiedAt,
|
|
691
691
|
rows: servedRows,
|
|
692
|
-
counts:
|
|
692
|
+
counts: _chunkIKWHRUQ5cjs.CREATE_GUIDANCE.counts
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
|
|
@@ -698,7 +698,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
698
698
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
699
699
|
var RECOVERY_MAX_LIMIT = 100;
|
|
700
700
|
function configError(message, operation, suggestedAction) {
|
|
701
|
-
throw new (0,
|
|
701
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
702
702
|
}
|
|
703
703
|
function parseMatchId(record) {
|
|
704
704
|
const raw = record.id;
|
|
@@ -714,7 +714,7 @@ function parseMatchId(record) {
|
|
|
714
714
|
return { id: null, unsafe: true };
|
|
715
715
|
}
|
|
716
716
|
function validateRecoveryInput(input, operation) {
|
|
717
|
-
if (!
|
|
717
|
+
if (!_chunkIKWHRUQ5cjs.isRecord.call(void 0, input)) {
|
|
718
718
|
configError(
|
|
719
719
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
720
720
|
operation,
|
|
@@ -748,10 +748,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
748
748
|
return { resource, marker, action };
|
|
749
749
|
}
|
|
750
750
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
751
|
-
const entry =
|
|
751
|
+
const entry = _chunkIKWHRUQ5cjs.RELATIONSHIP_MAP[resource];
|
|
752
752
|
if (entry === void 0) {
|
|
753
|
-
throw new (0,
|
|
754
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
753
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskError)(
|
|
754
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkIKWHRUQ5cjs.RELATIONSHIP_MAP).length} resources`,
|
|
755
755
|
{
|
|
756
756
|
code: "RESOURCE_UNKNOWN",
|
|
757
757
|
category: "validation",
|
|
@@ -760,7 +760,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
760
760
|
}
|
|
761
761
|
);
|
|
762
762
|
}
|
|
763
|
-
const holder = client[
|
|
763
|
+
const holder = client[_chunkIKWHRUQ5cjs.camelKey.call(void 0, resource)];
|
|
764
764
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
765
765
|
configError(
|
|
766
766
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -771,7 +771,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
771
771
|
return { entry, holder };
|
|
772
772
|
}
|
|
773
773
|
function resolveMarkerField(input, resource, operation) {
|
|
774
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
774
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkIKWHRUQ5cjs.MARKER_FIELDS[resource];
|
|
775
775
|
if (typeof field !== "string" || field.trim() === "") {
|
|
776
776
|
configError(
|
|
777
777
|
`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 +810,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
810
810
|
);
|
|
811
811
|
}
|
|
812
812
|
for (const c of input.filter) {
|
|
813
|
-
if (!
|
|
813
|
+
if (!_chunkIKWHRUQ5cjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
814
814
|
configError(
|
|
815
815
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
816
816
|
operation,
|
|
@@ -835,7 +835,7 @@ function resolveLimit(input, operation) {
|
|
|
835
835
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
836
836
|
const deleteMethod = holder.delete;
|
|
837
837
|
if (deleteMethod === void 0) {
|
|
838
|
-
throw new (0,
|
|
838
|
+
throw new (0, _chunkIKWHRUQ5cjs.DeleteBoundaryError)(
|
|
839
839
|
`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
840
|
{
|
|
841
841
|
operation,
|
|
@@ -864,14 +864,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
864
864
|
verify = "still-present";
|
|
865
865
|
}
|
|
866
866
|
} catch (err) {
|
|
867
|
-
if (err instanceof
|
|
867
|
+
if (err instanceof _chunkIKWHRUQ5cjs.NotFoundError) verify = "not-found";
|
|
868
868
|
else {
|
|
869
869
|
verify = "error";
|
|
870
|
-
code =
|
|
870
|
+
code = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
873
|
} catch (err) {
|
|
874
|
-
code =
|
|
874
|
+
code = _chunkIKWHRUQ5cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
875
875
|
}
|
|
876
876
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
877
877
|
}
|
|
@@ -899,7 +899,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
899
899
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
900
900
|
const extra = resolveExtraFilter(input, operation);
|
|
901
901
|
const limit = resolveLimit(input, operation);
|
|
902
|
-
const boundaryNote =
|
|
902
|
+
const boundaryNote = _chunkIKWHRUQ5cjs.DELETE_BOUNDARY_NOTES[resource];
|
|
903
903
|
const boundary = {
|
|
904
904
|
available: boundaryNote === void 0,
|
|
905
905
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -911,7 +911,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
911
911
|
};
|
|
912
912
|
const isDelete = action === "delete";
|
|
913
913
|
if (isDelete && boundaryNote !== void 0) {
|
|
914
|
-
throw new (0,
|
|
914
|
+
throw new (0, _chunkIKWHRUQ5cjs.DeleteBoundaryError)(
|
|
915
915
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
916
916
|
{
|
|
917
917
|
operation,
|
|
@@ -923,7 +923,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
923
923
|
const dryRun = _optionalChain([opts, 'optionalAccess', _19 => _19.dryRun]) !== false;
|
|
924
924
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _20 => _20.confirm]), () => ( input.confirm));
|
|
925
925
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
926
|
-
throw new (0,
|
|
926
|
+
throw new (0, _chunkIKWHRUQ5cjs.ConfirmationRequiredError)(
|
|
927
927
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
928
928
|
{
|
|
929
929
|
operation: RECOVERY_CONFIRM,
|
|
@@ -939,7 +939,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
939
939
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
940
940
|
if (query.hasMore) {
|
|
941
941
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
942
|
-
throw new (0,
|
|
942
|
+
throw new (0, _chunkIKWHRUQ5cjs.RecoveryTruncatedError)(
|
|
943
943
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
944
944
|
{
|
|
945
945
|
operation,
|
|
@@ -968,7 +968,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
968
968
|
return { ...base, simulated: true, dryRun: true };
|
|
969
969
|
}
|
|
970
970
|
if (unsafeId) {
|
|
971
|
-
throw new (0,
|
|
971
|
+
throw new (0, _chunkIKWHRUQ5cjs.MarkerUnsafeIdError)(
|
|
972
972
|
`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
973
|
{
|
|
974
974
|
operation,
|
|
@@ -986,7 +986,7 @@ function needsConfirmation(record) {
|
|
|
986
986
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
987
987
|
}
|
|
988
988
|
function refuse(message, operation, suggestedAction) {
|
|
989
|
-
throw new (0,
|
|
989
|
+
throw new (0, _chunkIKWHRUQ5cjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
990
990
|
}
|
|
991
991
|
var MODE_BY_EFFECT = {
|
|
992
992
|
read: "read",
|
|
@@ -1032,7 +1032,7 @@ function looseTypeOk(type, value) {
|
|
|
1032
1032
|
case "string[]":
|
|
1033
1033
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1034
1034
|
case "object":
|
|
1035
|
-
return
|
|
1035
|
+
return _chunkIKWHRUQ5cjs.isRecord.call(void 0, value);
|
|
1036
1036
|
default:
|
|
1037
1037
|
return true;
|
|
1038
1038
|
}
|
|
@@ -1046,12 +1046,12 @@ function declaredArgList(record) {
|
|
|
1046
1046
|
function resolveDispatchArgs(record, argsIn) {
|
|
1047
1047
|
const operation = record.id;
|
|
1048
1048
|
const bad = (message) => {
|
|
1049
|
-
throw new (0,
|
|
1049
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1050
1050
|
};
|
|
1051
1051
|
if (argsIn === void 0 || argsIn === null) return [];
|
|
1052
1052
|
if (Array.isArray(argsIn)) return argsIn;
|
|
1053
1053
|
const byName = argsIn;
|
|
1054
|
-
if (!
|
|
1054
|
+
if (!_chunkIKWHRUQ5cjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1055
1055
|
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1056
1056
|
}
|
|
1057
1057
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
@@ -1072,7 +1072,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1072
1072
|
const bagName = names.find((n) => schema[n].properties);
|
|
1073
1073
|
const surplus = args[names.length];
|
|
1074
1074
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1075
|
-
throw new (0,
|
|
1075
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1076
1076
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1077
1077
|
{
|
|
1078
1078
|
operation,
|
|
@@ -1082,7 +1082,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1082
1082
|
}
|
|
1083
1083
|
const required = names.filter((n) => schema[n].required);
|
|
1084
1084
|
if (args.length < required.length) {
|
|
1085
|
-
throw new (0,
|
|
1085
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1086
1086
|
`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
1087
|
{ operation }
|
|
1088
1088
|
);
|
|
@@ -1093,7 +1093,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1093
1093
|
const name = names[i];
|
|
1094
1094
|
const spec = schema[name];
|
|
1095
1095
|
if (!looseTypeOk(spec.type, value)) {
|
|
1096
|
-
throw new (0,
|
|
1096
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1097
1097
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1098
1098
|
{ operation }
|
|
1099
1099
|
);
|
|
@@ -1101,8 +1101,8 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
1103
|
function foldFlattenedOpts(record, toolArgs) {
|
|
1104
|
-
if (!
|
|
1105
|
-
throw new (0,
|
|
1104
|
+
if (!_chunkIKWHRUQ5cjs.isRecord.call(void 0, toolArgs)) {
|
|
1105
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1106
1106
|
}
|
|
1107
1107
|
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _21 => _21.inputSchema, 'optionalAccess', _22 => _22.opts, 'optionalAccess', _23 => _23.properties]), () => ( []))).map((p) => p.name);
|
|
1108
1108
|
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
@@ -1111,7 +1111,7 @@ function foldFlattenedOpts(record, toolArgs) {
|
|
|
1111
1111
|
if (folded.opts === null) delete folded.opts;
|
|
1112
1112
|
if (flat.length === 0) return folded;
|
|
1113
1113
|
if (folded.opts !== void 0) {
|
|
1114
|
-
throw new (0,
|
|
1114
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1115
1115
|
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1116
1116
|
{ operation: record.id }
|
|
1117
1117
|
);
|
|
@@ -1173,11 +1173,11 @@ function validateParamsBag(record, args) {
|
|
|
1173
1173
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1174
1174
|
if (valid === void 0) return;
|
|
1175
1175
|
const bag = _optionalChain([args, 'optionalAccess', _24 => _24[0]]);
|
|
1176
|
-
if (bag === void 0 || bag === null || !
|
|
1176
|
+
if (bag === void 0 || bag === null || !_chunkIKWHRUQ5cjs.isRecord.call(void 0, bag)) return;
|
|
1177
1177
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1178
1178
|
if (unknown.length === 0) return;
|
|
1179
1179
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1180
|
-
throw new (0,
|
|
1180
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1181
1181
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1182
1182
|
{
|
|
1183
1183
|
operation: record.id,
|
|
@@ -1191,7 +1191,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1191
1191
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1192
1192
|
if (unknown.length === 0) return;
|
|
1193
1193
|
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,
|
|
1194
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1195
1195
|
`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
1196
|
{
|
|
1197
1197
|
operation,
|
|
@@ -1204,7 +1204,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1204
1204
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1205
1205
|
if (unknown.length === 0) return null;
|
|
1206
1206
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1207
|
-
return new (0,
|
|
1207
|
+
return new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1208
1208
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1209
1209
|
{
|
|
1210
1210
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1214,7 +1214,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
|
|
1216
1216
|
// src/operations/invoke/registry.ts
|
|
1217
|
-
var RECORDS =
|
|
1217
|
+
var RECORDS = _chunkPY45RBQ2cjs.CAPABILITIES;
|
|
1218
1218
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1219
1219
|
|
|
1220
1220
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1233,7 +1233,7 @@ function bufferResult(buf) {
|
|
|
1233
1233
|
function resolveRecord(operation) {
|
|
1234
1234
|
const record = byId.get(operation);
|
|
1235
1235
|
if (record === void 0) {
|
|
1236
|
-
throw new (0,
|
|
1236
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1237
1237
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1238
1238
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1239
1239
|
);
|
|
@@ -1244,16 +1244,16 @@ function governPreRequest(record, operation, opts) {
|
|
|
1244
1244
|
validateInvokeOptions(opts, operation);
|
|
1245
1245
|
const mode = opts.mode;
|
|
1246
1246
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1247
|
-
throw new (0,
|
|
1247
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1248
1248
|
}
|
|
1249
1249
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1250
|
-
throw new (0,
|
|
1250
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1251
1251
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1252
1252
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1253
1253
|
);
|
|
1254
1254
|
}
|
|
1255
1255
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1256
|
-
throw new (0,
|
|
1256
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1257
1257
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1258
1258
|
{ operation }
|
|
1259
1259
|
);
|
|
@@ -1270,7 +1270,7 @@ function operationsHolder(client) {
|
|
|
1270
1270
|
return {
|
|
1271
1271
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1272
1272
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1273
|
-
fetchMany: (items, opts) =>
|
|
1273
|
+
fetchMany: (items, opts) => _chunkIKWHRUQ5cjs.fetchMany.call(void 0, client, items, opts),
|
|
1274
1274
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1275
1275
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1276
1276
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1280,12 +1280,12 @@ function operationsHolder(client) {
|
|
|
1280
1280
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1281
1281
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1282
1282
|
// typed outcomes reuse the fetchMany shapes).
|
|
1283
|
-
fetchByIds: (items, opts) =>
|
|
1283
|
+
fetchByIds: (items, opts) => _chunkIKWHRUQ5cjs.fetchByIds.call(void 0, client, items, opts),
|
|
1284
1284
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1285
1285
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1286
1286
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1287
1287
|
// the API user cannot resolve; the name cache (default-on).
|
|
1288
|
-
expandResourceNames: (ids, opts) =>
|
|
1288
|
+
expandResourceNames: (ids, opts) => _chunkIKWHRUQ5cjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
1289
1289
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1290
1290
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1291
1291
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1295,12 +1295,12 @@ function operationsHolder(client) {
|
|
|
1295
1295
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
1296
1296
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
1297
1297
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
1298
|
-
uiLink: (input) =>
|
|
1298
|
+
uiLink: (input) => _chunkIKWHRUQ5cjs.uiLink.call(void 0, client, input),
|
|
1299
1299
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
1300
1300
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1301
1301
|
// pre-request; per-resource failures are recorded on the row and
|
|
1302
1302
|
// never abort the call).
|
|
1303
|
-
fieldCatalog: (opts) =>
|
|
1303
|
+
fieldCatalog: (opts) => _chunkIKWHRUQ5cjs.fieldCatalog.call(void 0, client, opts),
|
|
1304
1304
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1305
1305
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1306
1306
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1310,15 +1310,15 @@ function operationsHolder(client) {
|
|
|
1310
1310
|
}
|
|
1311
1311
|
function resolveHolder(client, record, operation) {
|
|
1312
1312
|
const clientBag = client;
|
|
1313
|
-
let holder = clientBag[
|
|
1313
|
+
let holder = clientBag[_chunkIKWHRUQ5cjs.camelKey.call(void 0, record.resource)];
|
|
1314
1314
|
if (typeof holder === "function") {
|
|
1315
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
1315
|
+
holder = _nullishCoalesce(clientBag[`${_chunkIKWHRUQ5cjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1316
1316
|
}
|
|
1317
1317
|
if (holder === void 0 && record.resource === "operations") {
|
|
1318
1318
|
holder = operationsHolder(client);
|
|
1319
1319
|
}
|
|
1320
1320
|
if (holder === void 0) {
|
|
1321
|
-
throw new (0,
|
|
1321
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1322
1322
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1323
1323
|
{ operation }
|
|
1324
1324
|
);
|
|
@@ -1371,11 +1371,11 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1371
1371
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1372
1372
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1373
1373
|
const holder = resolveHolder(client, record, operation);
|
|
1374
|
-
if (boundedQuery || countedQuery) await
|
|
1374
|
+
if (boundedQuery || countedQuery) await _chunkIKWHRUQ5cjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
1375
1375
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1376
1376
|
const method = holder[methodName];
|
|
1377
1377
|
if (typeof method !== "function") {
|
|
1378
|
-
throw new (0,
|
|
1378
|
+
throw new (0, _chunkIKWHRUQ5cjs.AutotaskConfigError)(
|
|
1379
1379
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1380
1380
|
{ operation }
|
|
1381
1381
|
);
|
|
@@ -1452,4 +1452,4 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1452
1452
|
|
|
1453
1453
|
|
|
1454
1454
|
|
|
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 =
|
|
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 = _chunkIKWHRUQ5cjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunkIKWHRUQ5cjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkIKWHRUQ5cjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkIKWHRUQ5cjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkIKWHRUQ5cjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkIKWHRUQ5cjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkIKWHRUQ5cjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkIKWHRUQ5cjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkIKWHRUQ5cjs.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 = _chunkIKWHRUQ5cjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunkIKWHRUQ5cjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunkIKWHRUQ5cjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = effectiveRequiredFields; exports.expandResourceNames = _chunkIKWHRUQ5cjs.expandResourceNames; exports.fetchByIds = _chunkIKWHRUQ5cjs.fetchByIds; exports.fetchMany = _chunkIKWHRUQ5cjs.fetchMany; exports.fieldCatalog = _chunkIKWHRUQ5cjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunkIKWHRUQ5cjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunkIKWHRUQ5cjs.resourceForEntityType; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunkIKWHRUQ5cjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunkIKWHRUQ5cjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|