node-autotask 0.23.0 → 0.25.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 +33 -0
- package/MCP_TOOL_CATALOG.json +29 -8
- package/MCP_TOOL_MANIFEST.md +15 -14
- package/N8N_MCP_MANIFEST.json +48 -9
- package/N8N_MCP_MANIFEST.md +8 -7
- package/README.md +2 -2
- package/capabilities.json +1901 -1715
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +4 -1
- package/dist/capabilities.d.ts +4 -1
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-D5TVBI4U.cjs → chunk-2H7YI54B.cjs} +28 -3
- package/dist/{chunk-PVUUOM5G.js → chunk-6PIJ6AZG.js} +167 -57
- package/dist/{chunk-OGNUI3UR.js → chunk-EFR2XWRX.js} +1900 -1714
- package/dist/{chunk-TTQB537V.cjs → chunk-FKJ77K6Z.cjs} +135 -135
- package/dist/{chunk-B5SNZ3TZ.js → chunk-VUGZKP33.js} +27 -2
- package/dist/{chunk-JUO3URUI.cjs → chunk-WBMRACCV.cjs} +1900 -1714
- package/dist/{chunk-VYFO2N5F.js → chunk-XUB3S6AM.js} +2 -2
- package/dist/{chunk-N27NUB4R.cjs → chunk-Z5L7Q33V.cjs} +627 -517
- package/dist/{index-NC-x-bYl.d.cts → index-C0OwQhon.d.cts} +55 -4
- package/dist/{index-DBoX-Dnk.d.ts → index-CZ94y401.d.ts} +55 -4
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +147 -108
- package/dist/operations/index.d.cts +17 -7
- package/dist/operations/index.d.ts +17 -7
- package/dist/operations/index.js +42 -3
- package/dist/pool.cjs +8 -8
- 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 +49 -11
- package/package.json +1 -1
|
@@ -40,29 +40,29 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunk2H7YI54Bcjs = require('../chunk-2H7YI54B.cjs');
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkWBMRACCVcjs = require('../chunk-WBMRACCV.cjs');
|
|
47
47
|
|
|
48
48
|
// src/operations/searchAcrossResources.ts
|
|
49
49
|
var DEFAULT_LIMIT = 25;
|
|
50
50
|
function resourceFor(client, key) {
|
|
51
|
-
return client[
|
|
51
|
+
return client[_chunk2H7YI54Bcjs.camelKey.call(void 0, key)];
|
|
52
52
|
}
|
|
53
53
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
54
54
|
const text = query.trim();
|
|
55
55
|
if (text === "") {
|
|
56
|
-
throw new (0,
|
|
56
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
57
57
|
}
|
|
58
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
58
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunk2H7YI54Bcjs.WORKFLOW_RESOURCES));
|
|
59
59
|
if (keys.length === 0) {
|
|
60
|
-
throw new (0,
|
|
60
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
61
61
|
}
|
|
62
|
-
const limit =
|
|
62
|
+
const limit = _chunk2H7YI54Bcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
63
63
|
const totalLimit = opts.totalLimit;
|
|
64
64
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
65
|
-
throw new (0,
|
|
65
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
66
66
|
}
|
|
67
67
|
const results = [];
|
|
68
68
|
const skipped = [];
|
|
@@ -93,7 +93,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
93
93
|
|
|
94
94
|
// src/operations/resolveAny.ts
|
|
95
95
|
function resourceFor2(client, key) {
|
|
96
|
-
return client[
|
|
96
|
+
return client[_chunk2H7YI54Bcjs.camelKey.call(void 0, key)];
|
|
97
97
|
}
|
|
98
98
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
99
99
|
function missCost(identifier) {
|
|
@@ -102,13 +102,13 @@ function missCost(identifier) {
|
|
|
102
102
|
}
|
|
103
103
|
async function resolveAny(client, identifier, opts = {}) {
|
|
104
104
|
if (typeof identifier === "number") {
|
|
105
|
-
|
|
105
|
+
_chunk2H7YI54Bcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
106
106
|
} else if (identifier.trim() === "") {
|
|
107
|
-
throw new (0,
|
|
107
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
108
108
|
}
|
|
109
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
109
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunk2H7YI54Bcjs.WORKFLOW_RESOURCES));
|
|
110
110
|
if (keys.length === 0) {
|
|
111
|
-
throw new (0,
|
|
111
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
112
112
|
}
|
|
113
113
|
const results = [];
|
|
114
114
|
for (const key of keys) {
|
|
@@ -138,9 +138,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
138
138
|
} catch (err) {
|
|
139
139
|
let code;
|
|
140
140
|
let candidates = [];
|
|
141
|
-
if (err instanceof
|
|
141
|
+
if (err instanceof _chunk2H7YI54Bcjs.AutotaskConfigError) {
|
|
142
142
|
code = "CONFIG_ERROR";
|
|
143
|
-
} else if (
|
|
143
|
+
} else if (_chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err)) {
|
|
144
144
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
145
145
|
code = err.code;
|
|
146
146
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -167,7 +167,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
167
167
|
// src/operations/aggregate.ts
|
|
168
168
|
var AGGREGATE_TOP_MAX = 100;
|
|
169
169
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
170
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
170
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunk2H7YI54Bcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
171
171
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
172
172
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
173
173
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -224,7 +224,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
224
224
|
}
|
|
225
225
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
226
226
|
const s = /* @__PURE__ */ new Set();
|
|
227
|
-
for (const rec of
|
|
227
|
+
for (const rec of _chunkWBMRACCVcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
228
228
|
return s;
|
|
229
229
|
})();
|
|
230
230
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -260,15 +260,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
260
260
|
return [];
|
|
261
261
|
}
|
|
262
262
|
try {
|
|
263
|
-
return
|
|
263
|
+
return _chunk2H7YI54Bcjs.buildFilter.call(void 0, conds).filter;
|
|
264
264
|
} catch (err) {
|
|
265
|
-
problems.push(err instanceof
|
|
265
|
+
problems.push(err instanceof _chunk2H7YI54Bcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
266
266
|
return [];
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
function checkOptsBag(opts, problems) {
|
|
270
270
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
271
|
-
throw new (0,
|
|
271
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
272
272
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
273
273
|
{ operation: "operations.aggregate" }
|
|
274
274
|
);
|
|
@@ -348,7 +348,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
348
348
|
if (!Number.isInteger(opts.limit)) {
|
|
349
349
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
350
350
|
} else {
|
|
351
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
351
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunk2H7YI54Bcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
return { top, limit };
|
|
@@ -360,14 +360,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
360
360
|
checkOptsBag(opts, problems);
|
|
361
361
|
const oracles = {
|
|
362
362
|
resourceKey,
|
|
363
|
-
fieldSets: resourceKey !== void 0 ?
|
|
364
|
-
dateSets: resourceKey !== void 0 ?
|
|
363
|
+
fieldSets: resourceKey !== void 0 ? _chunk2H7YI54Bcjs.MODEL_FIELD_SETS[resourceKey] : void 0,
|
|
364
|
+
dateSets: resourceKey !== void 0 ? _chunk2H7YI54Bcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
365
365
|
};
|
|
366
366
|
const groupBy = parseGroupBy(opts, oracles, problems);
|
|
367
367
|
const sum = checkSumFields("sum", opts.sum, oracles, problems);
|
|
368
368
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
369
369
|
if (problems.length > 0) {
|
|
370
|
-
throw new (0,
|
|
370
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
371
371
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
372
372
|
- ` + problems.join("\n- "),
|
|
373
373
|
{ operation: "operations.aggregate" }
|
|
@@ -401,9 +401,9 @@ function foldGroups(items, v) {
|
|
|
401
401
|
}
|
|
402
402
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
403
403
|
const v = validateAggregate(operation, filter, opts);
|
|
404
|
-
const holder = client[
|
|
404
|
+
const holder = client[_chunk2H7YI54Bcjs.camelKey.call(void 0, v.resourceKey)];
|
|
405
405
|
if (holder === void 0) {
|
|
406
|
-
throw new (0,
|
|
406
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
407
407
|
operation: "operations.aggregate",
|
|
408
408
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
409
409
|
});
|
|
@@ -437,20 +437,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
437
437
|
async function relationshipMap(client, resourceKey) {
|
|
438
438
|
void client;
|
|
439
439
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
440
|
-
throw new (0,
|
|
440
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
441
441
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
442
442
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
443
443
|
);
|
|
444
444
|
}
|
|
445
445
|
const key = resourceKey.trim();
|
|
446
|
-
const entry =
|
|
446
|
+
const entry = _chunk2H7YI54Bcjs.RELATIONSHIP_MAP[key];
|
|
447
447
|
if (entry === void 0) {
|
|
448
|
-
throw new (0,
|
|
449
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
448
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
|
|
449
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk2H7YI54Bcjs.RELATIONSHIP_MAP).length} resources`,
|
|
450
450
|
{
|
|
451
451
|
code: "RESOURCE_UNKNOWN",
|
|
452
452
|
category: "validation",
|
|
453
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
453
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunk2H7YI54Bcjs.RELATIONSHIP_ZONE.label} (${_chunk2H7YI54Bcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
454
454
|
}
|
|
455
455
|
);
|
|
456
456
|
}
|
|
@@ -467,24 +467,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
467
467
|
async function blindSurfaces(client, opts) {
|
|
468
468
|
void client;
|
|
469
469
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
470
|
-
throw new (0,
|
|
470
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
471
471
|
}
|
|
472
|
-
const inv =
|
|
472
|
+
const inv = _chunk2H7YI54Bcjs.BLIND_SURFACE_INVENTORY;
|
|
473
473
|
if (inv === null) {
|
|
474
|
-
throw new (0,
|
|
474
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
475
475
|
}
|
|
476
476
|
let surfaces = inv.surfaces;
|
|
477
477
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
478
478
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
479
479
|
if (key === "") {
|
|
480
|
-
throw new (0,
|
|
480
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
481
481
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
482
482
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
483
483
|
);
|
|
484
484
|
}
|
|
485
485
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
486
|
-
throw new (0,
|
|
487
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
486
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
|
|
487
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunk2H7YI54Bcjs.RELATIONSHIP_MAP).length} resources`,
|
|
488
488
|
{
|
|
489
489
|
code: "RESOURCE_UNKNOWN",
|
|
490
490
|
category: "validation",
|
|
@@ -496,7 +496,7 @@ async function blindSurfaces(client, opts) {
|
|
|
496
496
|
}
|
|
497
497
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
498
498
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
499
|
-
throw new (0,
|
|
499
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
500
500
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
501
501
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
502
502
|
);
|
|
@@ -509,51 +509,51 @@ async function blindSurfaces(client, opts) {
|
|
|
509
509
|
// src/operations/probeReachability.ts
|
|
510
510
|
async function probeReachability(client, opts) {
|
|
511
511
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
512
|
-
throw new (0,
|
|
512
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
513
513
|
}
|
|
514
|
-
const defs =
|
|
514
|
+
const defs = _chunk2H7YI54Bcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
515
515
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
516
|
-
throw new (0,
|
|
516
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
517
517
|
"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",
|
|
518
518
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
521
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
522
522
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
523
|
-
throw new (0,
|
|
523
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
524
524
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
525
525
|
);
|
|
526
526
|
}
|
|
527
527
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
528
528
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
529
|
-
throw new (0,
|
|
529
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
530
530
|
}
|
|
531
531
|
if (cap > defs.hardCap) {
|
|
532
|
-
throw new (0,
|
|
532
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
533
533
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
534
534
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
535
535
|
);
|
|
536
536
|
}
|
|
537
|
-
const inv =
|
|
537
|
+
const inv = _chunk2H7YI54Bcjs.BLIND_SURFACE_INVENTORY;
|
|
538
538
|
if (inv === null) {
|
|
539
|
-
throw new (0,
|
|
539
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
540
540
|
}
|
|
541
541
|
let targets;
|
|
542
542
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
543
543
|
targets = [...defs.defaultTargets];
|
|
544
544
|
} else {
|
|
545
545
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
546
|
-
throw new (0,
|
|
546
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
547
547
|
}
|
|
548
548
|
const seen = /* @__PURE__ */ new Set();
|
|
549
549
|
for (const r of opts.resources) {
|
|
550
550
|
if (typeof r !== "string" || r.trim() === "") {
|
|
551
|
-
throw new (0,
|
|
551
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
552
552
|
}
|
|
553
553
|
const key = r.trim();
|
|
554
554
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
555
555
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
556
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
|
|
557
557
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
558
558
|
{
|
|
559
559
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -567,7 +567,7 @@ async function probeReachability(client, opts) {
|
|
|
567
567
|
targets = [...seen];
|
|
568
568
|
}
|
|
569
569
|
if (targets.length > cap) {
|
|
570
|
-
throw new (0,
|
|
570
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
571
571
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
572
572
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
573
573
|
);
|
|
@@ -577,7 +577,7 @@ async function probeReachability(client, opts) {
|
|
|
577
577
|
for (const resource of targets.sort()) {
|
|
578
578
|
const row = byResource.get(resource);
|
|
579
579
|
if (row === void 0) continue;
|
|
580
|
-
const holder = client[
|
|
580
|
+
const holder = client[_chunk2H7YI54Bcjs.camelKey.call(void 0, resource)];
|
|
581
581
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
582
582
|
if (typeof probeFn !== "function") {
|
|
583
583
|
results.push({
|
|
@@ -596,7 +596,7 @@ async function probeReachability(client, opts) {
|
|
|
596
596
|
probe: { ok: true, wire: 1, error: null }
|
|
597
597
|
});
|
|
598
598
|
} catch (err) {
|
|
599
|
-
const code =
|
|
599
|
+
const code = _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
600
600
|
const message = err instanceof Error ? err.message : String(err);
|
|
601
601
|
results.push({
|
|
602
602
|
...row,
|
|
@@ -624,24 +624,24 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
624
624
|
async function createGuidance(client, opts) {
|
|
625
625
|
void client;
|
|
626
626
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
627
|
-
throw new (0,
|
|
627
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
628
628
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
629
629
|
);
|
|
630
630
|
}
|
|
631
|
-
let rows =
|
|
631
|
+
let rows = _chunk2H7YI54Bcjs.CREATE_GUIDANCE.rows;
|
|
632
632
|
if (_optionalChain([opts, 'optionalAccess', _9 => _9.resources]) !== void 0) {
|
|
633
633
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
634
|
-
throw new (0,
|
|
634
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
635
635
|
}
|
|
636
636
|
const wanted = /* @__PURE__ */ new Set();
|
|
637
637
|
for (const r of opts.resources) {
|
|
638
638
|
if (typeof r !== "string" || r.trim() === "") {
|
|
639
|
-
throw new (0,
|
|
639
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
640
640
|
}
|
|
641
641
|
const key = r.trim();
|
|
642
|
-
if (!
|
|
643
|
-
throw new (0,
|
|
644
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
642
|
+
if (!_chunk2H7YI54Bcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
643
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
|
|
644
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunk2H7YI54Bcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
645
645
|
{
|
|
646
646
|
code: "RESOURCE_UNKNOWN",
|
|
647
647
|
category: "validation",
|
|
@@ -655,18 +655,18 @@ async function createGuidance(client, opts) {
|
|
|
655
655
|
}
|
|
656
656
|
if (_optionalChain([opts, 'optionalAccess', _10 => _10.kind]) !== void 0) {
|
|
657
657
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
658
|
-
throw new (0,
|
|
658
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
659
659
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
660
660
|
);
|
|
661
661
|
}
|
|
662
662
|
rows = rows.filter((row) => _optionalChain([row, 'access', _11 => _11.blocker, 'optionalAccess', _12 => _12.kind]) === opts.kind);
|
|
663
663
|
}
|
|
664
664
|
return {
|
|
665
|
-
zone:
|
|
666
|
-
label:
|
|
667
|
-
verifiedAt:
|
|
665
|
+
zone: _chunk2H7YI54Bcjs.CREATE_GUIDANCE.zone,
|
|
666
|
+
label: _chunk2H7YI54Bcjs.CREATE_GUIDANCE.label,
|
|
667
|
+
verifiedAt: _chunk2H7YI54Bcjs.CREATE_GUIDANCE.verifiedAt,
|
|
668
668
|
rows,
|
|
669
|
-
counts:
|
|
669
|
+
counts: _chunk2H7YI54Bcjs.CREATE_GUIDANCE.counts
|
|
670
670
|
};
|
|
671
671
|
}
|
|
672
672
|
|
|
@@ -675,7 +675,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
675
675
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
676
676
|
var RECOVERY_MAX_LIMIT = 100;
|
|
677
677
|
function configError(message, operation, suggestedAction) {
|
|
678
|
-
throw new (0,
|
|
678
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
679
679
|
}
|
|
680
680
|
function parseMatchId(record) {
|
|
681
681
|
const raw = record.id;
|
|
@@ -691,7 +691,7 @@ function parseMatchId(record) {
|
|
|
691
691
|
return { id: null, unsafe: true };
|
|
692
692
|
}
|
|
693
693
|
function validateRecoveryInput(input, operation) {
|
|
694
|
-
if (!
|
|
694
|
+
if (!_chunk2H7YI54Bcjs.isRecord.call(void 0, input)) {
|
|
695
695
|
configError(
|
|
696
696
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
697
697
|
operation,
|
|
@@ -725,10 +725,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
725
725
|
return { resource, marker, action };
|
|
726
726
|
}
|
|
727
727
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
728
|
-
const entry =
|
|
728
|
+
const entry = _chunk2H7YI54Bcjs.RELATIONSHIP_MAP[resource];
|
|
729
729
|
if (entry === void 0) {
|
|
730
|
-
throw new (0,
|
|
731
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
730
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskError)(
|
|
731
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunk2H7YI54Bcjs.RELATIONSHIP_MAP).length} resources`,
|
|
732
732
|
{
|
|
733
733
|
code: "RESOURCE_UNKNOWN",
|
|
734
734
|
category: "validation",
|
|
@@ -737,7 +737,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
737
737
|
}
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
|
-
const holder = client[
|
|
740
|
+
const holder = client[_chunk2H7YI54Bcjs.camelKey.call(void 0, resource)];
|
|
741
741
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
742
742
|
configError(
|
|
743
743
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -748,7 +748,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
748
748
|
return { entry, holder };
|
|
749
749
|
}
|
|
750
750
|
function resolveMarkerField(input, resource, operation) {
|
|
751
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
751
|
+
const field = input.field !== void 0 ? String(input.field) : _chunk2H7YI54Bcjs.MARKER_FIELDS[resource];
|
|
752
752
|
if (typeof field !== "string" || field.trim() === "") {
|
|
753
753
|
configError(
|
|
754
754
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -787,7 +787,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
787
787
|
);
|
|
788
788
|
}
|
|
789
789
|
for (const c of input.filter) {
|
|
790
|
-
if (!
|
|
790
|
+
if (!_chunk2H7YI54Bcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
791
791
|
configError(
|
|
792
792
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
793
793
|
operation,
|
|
@@ -812,7 +812,7 @@ function resolveLimit(input, operation) {
|
|
|
812
812
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
813
813
|
const deleteMethod = holder.delete;
|
|
814
814
|
if (deleteMethod === void 0) {
|
|
815
|
-
throw new (0,
|
|
815
|
+
throw new (0, _chunk2H7YI54Bcjs.DeleteBoundaryError)(
|
|
816
816
|
`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`,
|
|
817
817
|
{
|
|
818
818
|
operation,
|
|
@@ -841,14 +841,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
841
841
|
verify = "still-present";
|
|
842
842
|
}
|
|
843
843
|
} catch (err) {
|
|
844
|
-
if (err instanceof
|
|
844
|
+
if (err instanceof _chunk2H7YI54Bcjs.NotFoundError) verify = "not-found";
|
|
845
845
|
else {
|
|
846
846
|
verify = "error";
|
|
847
|
-
code =
|
|
847
|
+
code = _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
848
848
|
}
|
|
849
849
|
}
|
|
850
850
|
} catch (err) {
|
|
851
|
-
code =
|
|
851
|
+
code = _chunk2H7YI54Bcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
852
852
|
}
|
|
853
853
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
854
854
|
}
|
|
@@ -876,7 +876,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
876
876
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
877
877
|
const extra = resolveExtraFilter(input, operation);
|
|
878
878
|
const limit = resolveLimit(input, operation);
|
|
879
|
-
const boundaryNote =
|
|
879
|
+
const boundaryNote = _chunk2H7YI54Bcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
880
880
|
const boundary = {
|
|
881
881
|
available: boundaryNote === void 0,
|
|
882
882
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -888,7 +888,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
888
888
|
};
|
|
889
889
|
const isDelete = action === "delete";
|
|
890
890
|
if (isDelete && boundaryNote !== void 0) {
|
|
891
|
-
throw new (0,
|
|
891
|
+
throw new (0, _chunk2H7YI54Bcjs.DeleteBoundaryError)(
|
|
892
892
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
893
893
|
{
|
|
894
894
|
operation,
|
|
@@ -900,7 +900,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
900
900
|
const dryRun = _optionalChain([opts, 'optionalAccess', _13 => _13.dryRun]) !== false;
|
|
901
901
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _14 => _14.confirm]), () => ( input.confirm));
|
|
902
902
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
903
|
-
throw new (0,
|
|
903
|
+
throw new (0, _chunk2H7YI54Bcjs.ConfirmationRequiredError)(
|
|
904
904
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
905
905
|
{
|
|
906
906
|
operation: RECOVERY_CONFIRM,
|
|
@@ -916,7 +916,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
916
916
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
917
917
|
if (query.hasMore) {
|
|
918
918
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
919
|
-
throw new (0,
|
|
919
|
+
throw new (0, _chunk2H7YI54Bcjs.RecoveryTruncatedError)(
|
|
920
920
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
921
921
|
{
|
|
922
922
|
operation,
|
|
@@ -945,7 +945,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
945
945
|
return { ...base, simulated: true, dryRun: true };
|
|
946
946
|
}
|
|
947
947
|
if (unsafeId) {
|
|
948
|
-
throw new (0,
|
|
948
|
+
throw new (0, _chunk2H7YI54Bcjs.MarkerUnsafeIdError)(
|
|
949
949
|
`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)`,
|
|
950
950
|
{
|
|
951
951
|
operation,
|
|
@@ -963,7 +963,7 @@ function needsConfirmation(record) {
|
|
|
963
963
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
964
964
|
}
|
|
965
965
|
function refuse(message, operation, suggestedAction) {
|
|
966
|
-
throw new (0,
|
|
966
|
+
throw new (0, _chunk2H7YI54Bcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
967
967
|
}
|
|
968
968
|
var MODE_BY_EFFECT = {
|
|
969
969
|
read: "read",
|
|
@@ -1009,7 +1009,7 @@ function looseTypeOk(type, value) {
|
|
|
1009
1009
|
case "string[]":
|
|
1010
1010
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1011
1011
|
case "object":
|
|
1012
|
-
return
|
|
1012
|
+
return _chunk2H7YI54Bcjs.isRecord.call(void 0, value);
|
|
1013
1013
|
default:
|
|
1014
1014
|
return true;
|
|
1015
1015
|
}
|
|
@@ -1020,6 +1020,26 @@ function declaredArgList(record) {
|
|
|
1020
1020
|
if (names.length === 0) return "no positional args";
|
|
1021
1021
|
return names.map((n) => `${n}: ${schema[n].type}`).join(", ");
|
|
1022
1022
|
}
|
|
1023
|
+
function resolveDispatchArgs(record, argsIn) {
|
|
1024
|
+
const operation = record.id;
|
|
1025
|
+
const bad = (message) => {
|
|
1026
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1027
|
+
};
|
|
1028
|
+
if (argsIn === void 0 || argsIn === null) return [];
|
|
1029
|
+
if (Array.isArray(argsIn)) return argsIn;
|
|
1030
|
+
const byName = argsIn;
|
|
1031
|
+
if (!_chunk2H7YI54Bcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1032
|
+
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1033
|
+
}
|
|
1034
|
+
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
1035
|
+
const names = Object.keys(schema);
|
|
1036
|
+
const unknown = Object.keys(byName).filter((k) => !names.includes(k));
|
|
1037
|
+
if (unknown.length > 0) bad(`has no input named ${unknown.slice(0, 10).map((k) => `"${k}"`).join(", ")}${unknown.length > 10 ? ` (and ${unknown.length - 10} more)` : ""} (declared: ${declaredArgList(record)})`);
|
|
1038
|
+
const missing = names.filter((n) => schema[n].required && byName[n] === void 0);
|
|
1039
|
+
if (missing.length > 0) bad(`requires named input ${missing.map((k) => `"${k}"`).join(", ")} (declared: ${declaredArgList(record)})`);
|
|
1040
|
+
const last = names.reduce((at, n, i) => byName[n] === void 0 ? at : i, -1);
|
|
1041
|
+
return names.slice(0, last + 1).map((n) => byName[n]);
|
|
1042
|
+
}
|
|
1023
1043
|
function validateDispatchArgs(record, argsIn) {
|
|
1024
1044
|
const args = _nullishCoalesce(argsIn, () => ( []));
|
|
1025
1045
|
const operation = record.id;
|
|
@@ -1029,7 +1049,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1029
1049
|
const bagName = names.find((n) => schema[n].properties);
|
|
1030
1050
|
const surplus = args[names.length];
|
|
1031
1051
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1032
|
-
throw new (0,
|
|
1052
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1033
1053
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1034
1054
|
{
|
|
1035
1055
|
operation,
|
|
@@ -1039,7 +1059,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1039
1059
|
}
|
|
1040
1060
|
const required = names.filter((n) => schema[n].required);
|
|
1041
1061
|
if (args.length < required.length) {
|
|
1042
|
-
throw new (0,
|
|
1062
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1043
1063
|
`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)}`,
|
|
1044
1064
|
{ operation }
|
|
1045
1065
|
);
|
|
@@ -1050,13 +1070,31 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1050
1070
|
const name = names[i];
|
|
1051
1071
|
const spec = schema[name];
|
|
1052
1072
|
if (!looseTypeOk(spec.type, value)) {
|
|
1053
|
-
throw new (0,
|
|
1073
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1054
1074
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1055
1075
|
{ operation }
|
|
1056
1076
|
);
|
|
1057
1077
|
}
|
|
1058
1078
|
}
|
|
1059
1079
|
}
|
|
1080
|
+
function foldFlattenedOpts(record, toolArgs) {
|
|
1081
|
+
if (!_chunk2H7YI54Bcjs.isRecord.call(void 0, toolArgs)) {
|
|
1082
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1083
|
+
}
|
|
1084
|
+
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _15 => _15.inputSchema, 'optionalAccess', _16 => _16.opts, 'optionalAccess', _17 => _17.properties]), () => ( []))).map((p) => p.name);
|
|
1085
|
+
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
1086
|
+
const folded = { ...toolArgs };
|
|
1087
|
+
for (const k of bagKeys) delete folded[k];
|
|
1088
|
+
if (folded.opts === null) delete folded.opts;
|
|
1089
|
+
if (flat.length === 0) return folded;
|
|
1090
|
+
if (folded.opts !== void 0) {
|
|
1091
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1092
|
+
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1093
|
+
{ operation: record.id }
|
|
1094
|
+
);
|
|
1095
|
+
}
|
|
1096
|
+
return { ...folded, opts: Object.fromEntries(flat.map((k) => [k, toolArgs[k]])) };
|
|
1097
|
+
}
|
|
1060
1098
|
|
|
1061
1099
|
// src/operations/invoke/inputSets.ts
|
|
1062
1100
|
var PARAMS_BAG_KEYS = {
|
|
@@ -1111,12 +1149,12 @@ function validateParamsBag(record, args) {
|
|
|
1111
1149
|
if (record.inputSchemaStrict !== true) return;
|
|
1112
1150
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1113
1151
|
if (valid === void 0) return;
|
|
1114
|
-
const bag = _optionalChain([args, 'optionalAccess',
|
|
1115
|
-
if (bag === void 0 || bag === null || !
|
|
1152
|
+
const bag = _optionalChain([args, 'optionalAccess', _18 => _18[0]]);
|
|
1153
|
+
if (bag === void 0 || bag === null || !_chunk2H7YI54Bcjs.isRecord.call(void 0, bag)) return;
|
|
1116
1154
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1117
1155
|
if (unknown.length === 0) return;
|
|
1118
1156
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1119
|
-
throw new (0,
|
|
1157
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1120
1158
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1121
1159
|
{
|
|
1122
1160
|
operation: record.id,
|
|
@@ -1130,7 +1168,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1130
1168
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1131
1169
|
if (unknown.length === 0) return;
|
|
1132
1170
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1133
|
-
throw new (0,
|
|
1171
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1134
1172
|
`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)`,
|
|
1135
1173
|
{
|
|
1136
1174
|
operation,
|
|
@@ -1143,7 +1181,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1143
1181
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1144
1182
|
if (unknown.length === 0) return null;
|
|
1145
1183
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1146
|
-
return new (0,
|
|
1184
|
+
return new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1147
1185
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1148
1186
|
{
|
|
1149
1187
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1153,7 +1191,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1153
1191
|
}
|
|
1154
1192
|
|
|
1155
1193
|
// src/operations/invoke/registry.ts
|
|
1156
|
-
var RECORDS =
|
|
1194
|
+
var RECORDS = _chunkWBMRACCVcjs.CAPABILITIES;
|
|
1157
1195
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1158
1196
|
|
|
1159
1197
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1172,7 +1210,7 @@ function bufferResult(buf) {
|
|
|
1172
1210
|
function resolveRecord(operation) {
|
|
1173
1211
|
const record = byId.get(operation);
|
|
1174
1212
|
if (record === void 0) {
|
|
1175
|
-
throw new (0,
|
|
1213
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1176
1214
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1177
1215
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1178
1216
|
);
|
|
@@ -1183,16 +1221,16 @@ function governPreRequest(record, operation, opts) {
|
|
|
1183
1221
|
validateInvokeOptions(opts, operation);
|
|
1184
1222
|
const mode = opts.mode;
|
|
1185
1223
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1186
|
-
throw new (0,
|
|
1224
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1187
1225
|
}
|
|
1188
1226
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1189
|
-
throw new (0,
|
|
1227
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1190
1228
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1191
1229
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1192
1230
|
);
|
|
1193
1231
|
}
|
|
1194
1232
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1195
|
-
throw new (0,
|
|
1233
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1196
1234
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1197
1235
|
{ operation }
|
|
1198
1236
|
);
|
|
@@ -1209,7 +1247,7 @@ function operationsHolder(client) {
|
|
|
1209
1247
|
return {
|
|
1210
1248
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1211
1249
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1212
|
-
fetchMany: (items, opts) =>
|
|
1250
|
+
fetchMany: (items, opts) => _chunk2H7YI54Bcjs.fetchMany.call(void 0, client, items, opts),
|
|
1213
1251
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1214
1252
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1215
1253
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1219,12 +1257,12 @@ function operationsHolder(client) {
|
|
|
1219
1257
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1220
1258
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1221
1259
|
// typed outcomes reuse the fetchMany shapes).
|
|
1222
|
-
fetchByIds: (items, opts) =>
|
|
1260
|
+
fetchByIds: (items, opts) => _chunk2H7YI54Bcjs.fetchByIds.call(void 0, client, items, opts),
|
|
1223
1261
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1224
1262
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1225
1263
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1226
1264
|
// the API user cannot resolve; the name cache (default-on).
|
|
1227
|
-
expandResourceNames: (ids, opts) =>
|
|
1265
|
+
expandResourceNames: (ids, opts) => _chunk2H7YI54Bcjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
1228
1266
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1229
1267
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1230
1268
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1234,12 +1272,12 @@ function operationsHolder(client) {
|
|
|
1234
1272
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
1235
1273
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
1236
1274
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
1237
|
-
uiLink: (input) =>
|
|
1275
|
+
uiLink: (input) => _chunk2H7YI54Bcjs.uiLink.call(void 0, client, input),
|
|
1238
1276
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
1239
1277
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1240
1278
|
// pre-request; per-resource failures are recorded on the row and
|
|
1241
1279
|
// never abort the call).
|
|
1242
|
-
fieldCatalog: (opts) =>
|
|
1280
|
+
fieldCatalog: (opts) => _chunk2H7YI54Bcjs.fieldCatalog.call(void 0, client, opts),
|
|
1243
1281
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1244
1282
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1245
1283
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1249,15 +1287,15 @@ function operationsHolder(client) {
|
|
|
1249
1287
|
}
|
|
1250
1288
|
function resolveHolder(client, record, operation) {
|
|
1251
1289
|
const clientBag = client;
|
|
1252
|
-
let holder = clientBag[
|
|
1290
|
+
let holder = clientBag[_chunk2H7YI54Bcjs.camelKey.call(void 0, record.resource)];
|
|
1253
1291
|
if (typeof holder === "function") {
|
|
1254
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
1292
|
+
holder = _nullishCoalesce(clientBag[`${_chunk2H7YI54Bcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1255
1293
|
}
|
|
1256
1294
|
if (holder === void 0 && record.resource === "operations") {
|
|
1257
1295
|
holder = operationsHolder(client);
|
|
1258
1296
|
}
|
|
1259
1297
|
if (holder === void 0) {
|
|
1260
|
-
throw new (0,
|
|
1298
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1261
1299
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1262
1300
|
{ operation }
|
|
1263
1301
|
);
|
|
@@ -1302,19 +1340,19 @@ function buildCallArgs(record, args, mutationOpts, isWrite) {
|
|
|
1302
1340
|
return callArgs;
|
|
1303
1341
|
}
|
|
1304
1342
|
async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
1305
|
-
const args = _nullishCoalesce(argsIn, () => ( []));
|
|
1306
1343
|
const record = resolveRecord(operation);
|
|
1307
1344
|
governPreRequest(record, operation, opts);
|
|
1345
|
+
const args = resolveDispatchArgs(record, argsIn);
|
|
1308
1346
|
validateDispatchArgs(record, args);
|
|
1309
1347
|
validateParamsBag(record, args);
|
|
1310
1348
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1311
1349
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1312
1350
|
const holder = resolveHolder(client, record, operation);
|
|
1313
|
-
if (boundedQuery || countedQuery) await
|
|
1351
|
+
if (boundedQuery || countedQuery) await _chunk2H7YI54Bcjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
1314
1352
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1315
1353
|
const method = holder[methodName];
|
|
1316
1354
|
if (typeof method !== "function") {
|
|
1317
|
-
throw new (0,
|
|
1355
|
+
throw new (0, _chunk2H7YI54Bcjs.AutotaskConfigError)(
|
|
1318
1356
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1319
1357
|
{ operation }
|
|
1320
1358
|
);
|
|
@@ -1386,4 +1424,5 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1386
1424
|
|
|
1387
1425
|
|
|
1388
1426
|
|
|
1389
|
-
|
|
1427
|
+
|
|
1428
|
+
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.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunk2H7YI54Bcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunk2H7YI54Bcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunk2H7YI54Bcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunk2H7YI54Bcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunk2H7YI54Bcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunk2H7YI54Bcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunk2H7YI54Bcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunk2H7YI54Bcjs.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 = _chunk2H7YI54Bcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunk2H7YI54Bcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunk2H7YI54Bcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.expandResourceNames = _chunk2H7YI54Bcjs.expandResourceNames; exports.fetchByIds = _chunk2H7YI54Bcjs.fetchByIds; exports.fetchMany = _chunk2H7YI54Bcjs.fetchMany; exports.fieldCatalog = _chunk2H7YI54Bcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunk2H7YI54Bcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunk2H7YI54Bcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|