node-autotask 0.33.0 → 0.34.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 +32 -0
- package/MCP_TOOL_CATALOG.json +2 -2
- package/MCP_TOOL_MANIFEST.md +4 -4
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +4084 -2544
- package/capabilities.schema.json +32 -0
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +13 -1
- package/dist/capabilities.d.ts +13 -1
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-VKE56TTN.js → chunk-4MUBUSTL.js} +4083 -2543
- package/dist/{chunk-5DS6F6GF.js → chunk-6ADFCU3I.js} +399 -342
- package/dist/{chunk-OO67MRHN.cjs → chunk-DKJP73FX.cjs} +966 -909
- package/dist/{chunk-MFDQHFGJ.js → chunk-EZKM4HQ6.js} +1017 -577
- package/dist/{chunk-SP2SJJZX.cjs → chunk-FOOHJBPP.cjs} +4083 -2543
- package/dist/{chunk-4QN43TRP.cjs → chunk-GDQ4QM7Q.cjs} +1066 -626
- package/dist/{chunk-3LAZZT7V.cjs → chunk-P6YN2POI.cjs} +143 -143
- package/dist/{chunk-7WNE5MPG.js → chunk-RDFL5QYE.js} +2 -2
- package/dist/{index-BaeMHZPk.d.ts → index-ByMU8IC2.d.ts} +498 -198
- package/dist/{index-Cq0VsfSz.d.cts → index-Dx4-zpDo.d.cts} +498 -198
- package/dist/index.cjs +23 -23
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/operations/index.cjs +157 -116
- package/dist/operations/index.d.cts +39 -25
- package/dist/operations/index.d.ts +39 -25
- package/dist/operations/index.js +47 -6
- package/dist/pool.cjs +9 -9
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/docs/API.md +160 -35
- package/package.json +1 -1
|
@@ -44,29 +44,29 @@
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var _chunkGDQ4QM7Qcjs = require('../chunk-GDQ4QM7Q.cjs');
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
var
|
|
50
|
+
var _chunkFOOHJBPPcjs = require('../chunk-FOOHJBPP.cjs');
|
|
51
51
|
|
|
52
52
|
// src/operations/searchAcrossResources.ts
|
|
53
53
|
var DEFAULT_LIMIT = 25;
|
|
54
54
|
function resourceFor(client, key) {
|
|
55
|
-
return client[
|
|
55
|
+
return client[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, key)];
|
|
56
56
|
}
|
|
57
57
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
58
58
|
const text = query.trim();
|
|
59
59
|
if (text === "") {
|
|
60
|
-
throw new (0,
|
|
60
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
61
61
|
}
|
|
62
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
62
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkGDQ4QM7Qcjs.WORKFLOW_RESOURCES));
|
|
63
63
|
if (keys.length === 0) {
|
|
64
|
-
throw new (0,
|
|
64
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
65
65
|
}
|
|
66
|
-
const limit =
|
|
66
|
+
const limit = _chunkGDQ4QM7Qcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
67
67
|
const totalLimit = opts.totalLimit;
|
|
68
68
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
69
|
-
throw new (0,
|
|
69
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
70
70
|
}
|
|
71
71
|
const results = [];
|
|
72
72
|
const skipped = [];
|
|
@@ -97,7 +97,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
97
97
|
|
|
98
98
|
// src/operations/resolveAny.ts
|
|
99
99
|
function resourceFor2(client, key) {
|
|
100
|
-
return client[
|
|
100
|
+
return client[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, key)];
|
|
101
101
|
}
|
|
102
102
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
103
103
|
function missCost(identifier) {
|
|
@@ -106,13 +106,13 @@ function missCost(identifier) {
|
|
|
106
106
|
}
|
|
107
107
|
async function resolveAny(client, identifier, opts = {}) {
|
|
108
108
|
if (typeof identifier === "number") {
|
|
109
|
-
|
|
109
|
+
_chunkGDQ4QM7Qcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
110
110
|
} else if (identifier.trim() === "") {
|
|
111
|
-
throw new (0,
|
|
111
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
112
112
|
}
|
|
113
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
113
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkGDQ4QM7Qcjs.WORKFLOW_RESOURCES));
|
|
114
114
|
if (keys.length === 0) {
|
|
115
|
-
throw new (0,
|
|
115
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
116
116
|
}
|
|
117
117
|
const results = [];
|
|
118
118
|
for (const key of keys) {
|
|
@@ -142,9 +142,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
142
142
|
} catch (err) {
|
|
143
143
|
let code;
|
|
144
144
|
let candidates = [];
|
|
145
|
-
if (err instanceof
|
|
145
|
+
if (err instanceof _chunkGDQ4QM7Qcjs.AutotaskConfigError) {
|
|
146
146
|
code = "CONFIG_ERROR";
|
|
147
|
-
} else if (
|
|
147
|
+
} else if (_chunkGDQ4QM7Qcjs.isAutotaskError.call(void 0, err)) {
|
|
148
148
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
149
149
|
code = err.code;
|
|
150
150
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -171,7 +171,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
171
171
|
// src/operations/aggregate.ts
|
|
172
172
|
var AGGREGATE_TOP_MAX = 100;
|
|
173
173
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
174
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
174
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunkGDQ4QM7Qcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
175
175
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
176
176
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
177
177
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -228,7 +228,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
228
228
|
}
|
|
229
229
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
230
230
|
const s = /* @__PURE__ */ new Set();
|
|
231
|
-
for (const rec of
|
|
231
|
+
for (const rec of _chunkFOOHJBPPcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
232
232
|
return s;
|
|
233
233
|
})();
|
|
234
234
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -264,15 +264,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
264
264
|
return [];
|
|
265
265
|
}
|
|
266
266
|
try {
|
|
267
|
-
return
|
|
267
|
+
return _chunkGDQ4QM7Qcjs.buildFilter.call(void 0, conds).filter;
|
|
268
268
|
} catch (err) {
|
|
269
|
-
problems.push(err instanceof
|
|
269
|
+
problems.push(err instanceof _chunkGDQ4QM7Qcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
270
270
|
return [];
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
function checkOptsBag(opts, problems) {
|
|
274
274
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
275
|
-
throw new (0,
|
|
275
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
276
276
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
277
277
|
{ operation: "operations.aggregate" }
|
|
278
278
|
);
|
|
@@ -352,7 +352,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
352
352
|
if (!Number.isInteger(opts.limit)) {
|
|
353
353
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
354
354
|
} else {
|
|
355
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
355
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunkGDQ4QM7Qcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
return { top, limit };
|
|
@@ -364,14 +364,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
364
364
|
checkOptsBag(opts, problems);
|
|
365
365
|
const oracles = {
|
|
366
366
|
resourceKey,
|
|
367
|
-
fieldSets: resourceKey !== void 0 ?
|
|
368
|
-
dateSets: resourceKey !== void 0 ?
|
|
367
|
+
fieldSets: resourceKey !== void 0 ? _chunkGDQ4QM7Qcjs.MODEL_FIELD_SETS[resourceKey] : void 0,
|
|
368
|
+
dateSets: resourceKey !== void 0 ? _chunkGDQ4QM7Qcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
369
369
|
};
|
|
370
370
|
const groupBy = parseGroupBy(opts, oracles, problems);
|
|
371
371
|
const sum = checkSumFields("sum", opts.sum, oracles, problems);
|
|
372
372
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
373
373
|
if (problems.length > 0) {
|
|
374
|
-
throw new (0,
|
|
374
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
375
375
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
376
376
|
- ` + problems.join("\n- "),
|
|
377
377
|
{ operation: "operations.aggregate" }
|
|
@@ -405,9 +405,9 @@ function foldGroups(items, v) {
|
|
|
405
405
|
}
|
|
406
406
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
407
407
|
const v = validateAggregate(operation, filter, opts);
|
|
408
|
-
const holder = client[
|
|
408
|
+
const holder = client[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, v.resourceKey)];
|
|
409
409
|
if (holder === void 0) {
|
|
410
|
-
throw new (0,
|
|
410
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
411
411
|
operation: "operations.aggregate",
|
|
412
412
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
413
413
|
});
|
|
@@ -441,20 +441,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
441
441
|
async function relationshipMap(client, resourceKey) {
|
|
442
442
|
void client;
|
|
443
443
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
444
|
-
throw new (0,
|
|
444
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
445
445
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
446
446
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
447
447
|
);
|
|
448
448
|
}
|
|
449
449
|
const key = resourceKey.trim();
|
|
450
|
-
const entry =
|
|
450
|
+
const entry = _chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP[key];
|
|
451
451
|
if (entry === void 0) {
|
|
452
|
-
throw new (0,
|
|
453
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
452
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskError)(
|
|
453
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP).length} resources`,
|
|
454
454
|
{
|
|
455
455
|
code: "RESOURCE_UNKNOWN",
|
|
456
456
|
category: "validation",
|
|
457
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
457
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkGDQ4QM7Qcjs.RELATIONSHIP_ZONE.label} (${_chunkGDQ4QM7Qcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
458
458
|
}
|
|
459
459
|
);
|
|
460
460
|
}
|
|
@@ -471,24 +471,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
471
471
|
async function blindSurfaces(client, opts) {
|
|
472
472
|
void client;
|
|
473
473
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
474
|
-
throw new (0,
|
|
474
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
475
475
|
}
|
|
476
|
-
const inv =
|
|
476
|
+
const inv = _chunkGDQ4QM7Qcjs.BLIND_SURFACE_INVENTORY;
|
|
477
477
|
if (inv === null) {
|
|
478
|
-
throw new (0,
|
|
478
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
479
479
|
}
|
|
480
480
|
let surfaces = inv.surfaces;
|
|
481
481
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
482
482
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
483
483
|
if (key === "") {
|
|
484
|
-
throw new (0,
|
|
484
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
485
485
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
486
486
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
487
487
|
);
|
|
488
488
|
}
|
|
489
489
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
490
|
-
throw new (0,
|
|
491
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
490
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskError)(
|
|
491
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP).length} resources`,
|
|
492
492
|
{
|
|
493
493
|
code: "RESOURCE_UNKNOWN",
|
|
494
494
|
category: "validation",
|
|
@@ -500,7 +500,7 @@ async function blindSurfaces(client, opts) {
|
|
|
500
500
|
}
|
|
501
501
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
502
502
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
503
|
-
throw new (0,
|
|
503
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
504
504
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
505
505
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
506
506
|
);
|
|
@@ -513,51 +513,51 @@ async function blindSurfaces(client, opts) {
|
|
|
513
513
|
// src/operations/probeReachability.ts
|
|
514
514
|
async function probeReachability(client, opts) {
|
|
515
515
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
516
|
-
throw new (0,
|
|
516
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
517
517
|
}
|
|
518
|
-
const defs =
|
|
518
|
+
const defs = _chunkGDQ4QM7Qcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
519
519
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
520
|
-
throw new (0,
|
|
520
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
521
521
|
"probeReachability: confirmProbe: true is required \u2014 the op deliberately fans out read wire across the tenant (one bounded query per surface); pass confirmProbe: true to run it",
|
|
522
522
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
525
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
526
526
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
527
|
-
throw new (0,
|
|
527
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
528
528
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
529
529
|
);
|
|
530
530
|
}
|
|
531
531
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
532
532
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
533
|
-
throw new (0,
|
|
533
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
534
534
|
}
|
|
535
535
|
if (cap > defs.hardCap) {
|
|
536
|
-
throw new (0,
|
|
536
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
537
537
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
538
538
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
539
539
|
);
|
|
540
540
|
}
|
|
541
|
-
const inv =
|
|
541
|
+
const inv = _chunkGDQ4QM7Qcjs.BLIND_SURFACE_INVENTORY;
|
|
542
542
|
if (inv === null) {
|
|
543
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
544
544
|
}
|
|
545
545
|
let targets;
|
|
546
546
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
547
547
|
targets = [...defs.defaultTargets];
|
|
548
548
|
} else {
|
|
549
549
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
550
|
-
throw new (0,
|
|
550
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
551
551
|
}
|
|
552
552
|
const seen = /* @__PURE__ */ new Set();
|
|
553
553
|
for (const r of opts.resources) {
|
|
554
554
|
if (typeof r !== "string" || r.trim() === "") {
|
|
555
|
-
throw new (0,
|
|
555
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
556
556
|
}
|
|
557
557
|
const key = r.trim();
|
|
558
558
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
559
559
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
560
|
-
throw new (0,
|
|
560
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskError)(
|
|
561
561
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
562
562
|
{
|
|
563
563
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -571,7 +571,7 @@ async function probeReachability(client, opts) {
|
|
|
571
571
|
targets = [...seen];
|
|
572
572
|
}
|
|
573
573
|
if (targets.length > cap) {
|
|
574
|
-
throw new (0,
|
|
574
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
575
575
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
576
576
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
577
577
|
);
|
|
@@ -581,7 +581,7 @@ async function probeReachability(client, opts) {
|
|
|
581
581
|
for (const resource of targets.sort()) {
|
|
582
582
|
const row = byResource.get(resource);
|
|
583
583
|
if (row === void 0) continue;
|
|
584
|
-
const holder = client[
|
|
584
|
+
const holder = client[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, resource)];
|
|
585
585
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
586
586
|
if (typeof probeFn !== "function") {
|
|
587
587
|
results.push({
|
|
@@ -600,7 +600,7 @@ async function probeReachability(client, opts) {
|
|
|
600
600
|
probe: { ok: true, wire: 1, error: null }
|
|
601
601
|
});
|
|
602
602
|
} catch (err) {
|
|
603
|
-
const code =
|
|
603
|
+
const code = _chunkGDQ4QM7Qcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
604
604
|
const message = err instanceof Error ? err.message : String(err);
|
|
605
605
|
results.push({
|
|
606
606
|
...row,
|
|
@@ -628,30 +628,30 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
628
628
|
async function createGuidance(client, opts) {
|
|
629
629
|
void client;
|
|
630
630
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
631
|
-
throw new (0,
|
|
631
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
632
632
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
633
633
|
);
|
|
634
634
|
}
|
|
635
|
-
let servedRows =
|
|
635
|
+
let servedRows = _chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.rows.map((row) => ({
|
|
636
636
|
...row,
|
|
637
637
|
// Issue #219 N4: one precedence rule, stated on every row (live-proven >
|
|
638
638
|
// zone > spec). The spec set is not available here (it is a LIVE read) —
|
|
639
639
|
// the helper is handed the plan's two shapes and names the source.
|
|
640
|
-
requiredFields:
|
|
640
|
+
requiredFields: _chunkGDQ4QM7Qcjs.effectiveRequiredFields.call(void 0, void 0, _nullishCoalesce(_optionalChain([_chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP, 'access', _9 => _9[row.resource], 'optionalAccess', _10 => _10.zoneFacts]), () => ( null)))
|
|
641
641
|
}));
|
|
642
642
|
if (_optionalChain([opts, 'optionalAccess', _11 => _11.resources]) !== void 0) {
|
|
643
643
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
644
|
-
throw new (0,
|
|
644
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
645
645
|
}
|
|
646
646
|
const wanted = /* @__PURE__ */ new Set();
|
|
647
647
|
for (const r of opts.resources) {
|
|
648
648
|
if (typeof r !== "string" || r.trim() === "") {
|
|
649
|
-
throw new (0,
|
|
649
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
650
650
|
}
|
|
651
651
|
const key = r.trim();
|
|
652
|
-
if (!
|
|
653
|
-
throw new (0,
|
|
654
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
652
|
+
if (!_chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
653
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskError)(
|
|
654
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
655
655
|
{
|
|
656
656
|
code: "RESOURCE_UNKNOWN",
|
|
657
657
|
category: "validation",
|
|
@@ -665,18 +665,18 @@ async function createGuidance(client, opts) {
|
|
|
665
665
|
}
|
|
666
666
|
if (_optionalChain([opts, 'optionalAccess', _12 => _12.kind]) !== void 0) {
|
|
667
667
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
668
|
-
throw new (0,
|
|
668
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
669
669
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
670
670
|
);
|
|
671
671
|
}
|
|
672
672
|
servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _13 => _13.blocker, 'optionalAccess', _14 => _14.kind]) === opts.kind);
|
|
673
673
|
}
|
|
674
674
|
return {
|
|
675
|
-
zone:
|
|
676
|
-
label:
|
|
677
|
-
verifiedAt:
|
|
675
|
+
zone: _chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.zone,
|
|
676
|
+
label: _chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.label,
|
|
677
|
+
verifiedAt: _chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.verifiedAt,
|
|
678
678
|
rows: servedRows,
|
|
679
|
-
counts:
|
|
679
|
+
counts: _chunkGDQ4QM7Qcjs.CREATE_GUIDANCE.counts
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
682
|
|
|
@@ -685,7 +685,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
685
685
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
686
686
|
var RECOVERY_MAX_LIMIT = 100;
|
|
687
687
|
function configError(message, operation, suggestedAction) {
|
|
688
|
-
throw new (0,
|
|
688
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
689
689
|
}
|
|
690
690
|
function parseMatchId(record) {
|
|
691
691
|
const raw = record.id;
|
|
@@ -701,7 +701,7 @@ function parseMatchId(record) {
|
|
|
701
701
|
return { id: null, unsafe: true };
|
|
702
702
|
}
|
|
703
703
|
function validateRecoveryInput(input, operation) {
|
|
704
|
-
if (!
|
|
704
|
+
if (!_chunkGDQ4QM7Qcjs.isRecord.call(void 0, input)) {
|
|
705
705
|
configError(
|
|
706
706
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
707
707
|
operation,
|
|
@@ -735,10 +735,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
735
735
|
return { resource, marker, action };
|
|
736
736
|
}
|
|
737
737
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
738
|
-
const entry =
|
|
738
|
+
const entry = _chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP[resource];
|
|
739
739
|
if (entry === void 0) {
|
|
740
|
-
throw new (0,
|
|
741
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
740
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskError)(
|
|
741
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkGDQ4QM7Qcjs.RELATIONSHIP_MAP).length} resources`,
|
|
742
742
|
{
|
|
743
743
|
code: "RESOURCE_UNKNOWN",
|
|
744
744
|
category: "validation",
|
|
@@ -747,7 +747,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
747
747
|
}
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
|
-
const holder = client[
|
|
750
|
+
const holder = client[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, resource)];
|
|
751
751
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
752
752
|
configError(
|
|
753
753
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -758,7 +758,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
758
758
|
return { entry, holder };
|
|
759
759
|
}
|
|
760
760
|
function resolveMarkerField(input, resource, operation) {
|
|
761
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
761
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkGDQ4QM7Qcjs.MARKER_FIELDS[resource];
|
|
762
762
|
if (typeof field !== "string" || field.trim() === "") {
|
|
763
763
|
configError(
|
|
764
764
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -797,7 +797,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
797
797
|
);
|
|
798
798
|
}
|
|
799
799
|
for (const c of input.filter) {
|
|
800
|
-
if (!
|
|
800
|
+
if (!_chunkGDQ4QM7Qcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
801
801
|
configError(
|
|
802
802
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
803
803
|
operation,
|
|
@@ -822,7 +822,7 @@ function resolveLimit(input, operation) {
|
|
|
822
822
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
823
823
|
const deleteMethod = holder.delete;
|
|
824
824
|
if (deleteMethod === void 0) {
|
|
825
|
-
throw new (0,
|
|
825
|
+
throw new (0, _chunkGDQ4QM7Qcjs.DeleteBoundaryError)(
|
|
826
826
|
`recovery: ${resource} has no delete method on the client \u2014 the boundary is marked available in the plan but the typed delete surface is missing`,
|
|
827
827
|
{
|
|
828
828
|
operation,
|
|
@@ -851,14 +851,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
851
851
|
verify = "still-present";
|
|
852
852
|
}
|
|
853
853
|
} catch (err) {
|
|
854
|
-
if (err instanceof
|
|
854
|
+
if (err instanceof _chunkGDQ4QM7Qcjs.NotFoundError) verify = "not-found";
|
|
855
855
|
else {
|
|
856
856
|
verify = "error";
|
|
857
|
-
code =
|
|
857
|
+
code = _chunkGDQ4QM7Qcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
} catch (err) {
|
|
861
|
-
code =
|
|
861
|
+
code = _chunkGDQ4QM7Qcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
862
862
|
}
|
|
863
863
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
864
864
|
}
|
|
@@ -886,7 +886,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
886
886
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
887
887
|
const extra = resolveExtraFilter(input, operation);
|
|
888
888
|
const limit = resolveLimit(input, operation);
|
|
889
|
-
const boundaryNote =
|
|
889
|
+
const boundaryNote = _chunkGDQ4QM7Qcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
890
890
|
const boundary = {
|
|
891
891
|
available: boundaryNote === void 0,
|
|
892
892
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -898,7 +898,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
898
898
|
};
|
|
899
899
|
const isDelete = action === "delete";
|
|
900
900
|
if (isDelete && boundaryNote !== void 0) {
|
|
901
|
-
throw new (0,
|
|
901
|
+
throw new (0, _chunkGDQ4QM7Qcjs.DeleteBoundaryError)(
|
|
902
902
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
903
903
|
{
|
|
904
904
|
operation,
|
|
@@ -910,7 +910,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
910
910
|
const dryRun = _optionalChain([opts, 'optionalAccess', _15 => _15.dryRun]) !== false;
|
|
911
911
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _16 => _16.confirm]), () => ( input.confirm));
|
|
912
912
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
913
|
-
throw new (0,
|
|
913
|
+
throw new (0, _chunkGDQ4QM7Qcjs.ConfirmationRequiredError)(
|
|
914
914
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
915
915
|
{
|
|
916
916
|
operation: RECOVERY_CONFIRM,
|
|
@@ -926,7 +926,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
926
926
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
927
927
|
if (query.hasMore) {
|
|
928
928
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
929
|
-
throw new (0,
|
|
929
|
+
throw new (0, _chunkGDQ4QM7Qcjs.RecoveryTruncatedError)(
|
|
930
930
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
931
931
|
{
|
|
932
932
|
operation,
|
|
@@ -955,7 +955,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
955
955
|
return { ...base, simulated: true, dryRun: true };
|
|
956
956
|
}
|
|
957
957
|
if (unsafeId) {
|
|
958
|
-
throw new (0,
|
|
958
|
+
throw new (0, _chunkGDQ4QM7Qcjs.MarkerUnsafeIdError)(
|
|
959
959
|
`recovery: ${unsafeIds.length} of ${matches.length} match(es) on ${resource} have ids beyond Number.MAX_SAFE_INTEGER \u2014 they CANNOT be addressed through the SDK's typed delete surface (zero DELETE wire was issued)`,
|
|
960
960
|
{
|
|
961
961
|
operation,
|
|
@@ -973,7 +973,7 @@ function needsConfirmation(record) {
|
|
|
973
973
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
974
974
|
}
|
|
975
975
|
function refuse(message, operation, suggestedAction) {
|
|
976
|
-
throw new (0,
|
|
976
|
+
throw new (0, _chunkGDQ4QM7Qcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
977
977
|
}
|
|
978
978
|
var MODE_BY_EFFECT = {
|
|
979
979
|
read: "read",
|
|
@@ -1019,7 +1019,7 @@ function looseTypeOk(type, value) {
|
|
|
1019
1019
|
case "string[]":
|
|
1020
1020
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1021
1021
|
case "object":
|
|
1022
|
-
return
|
|
1022
|
+
return _chunkGDQ4QM7Qcjs.isRecord.call(void 0, value);
|
|
1023
1023
|
default:
|
|
1024
1024
|
return true;
|
|
1025
1025
|
}
|
|
@@ -1033,12 +1033,12 @@ function declaredArgList(record) {
|
|
|
1033
1033
|
function resolveDispatchArgs(record, argsIn) {
|
|
1034
1034
|
const operation = record.id;
|
|
1035
1035
|
const bad = (message) => {
|
|
1036
|
-
throw new (0,
|
|
1036
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1037
1037
|
};
|
|
1038
1038
|
if (argsIn === void 0 || argsIn === null) return [];
|
|
1039
1039
|
if (Array.isArray(argsIn)) return argsIn;
|
|
1040
1040
|
const byName = argsIn;
|
|
1041
|
-
if (!
|
|
1041
|
+
if (!_chunkGDQ4QM7Qcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1042
1042
|
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1043
1043
|
}
|
|
1044
1044
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
@@ -1059,7 +1059,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1059
1059
|
const bagName = names.find((n) => schema[n].properties);
|
|
1060
1060
|
const surplus = args[names.length];
|
|
1061
1061
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1062
|
-
throw new (0,
|
|
1062
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1063
1063
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1064
1064
|
{
|
|
1065
1065
|
operation,
|
|
@@ -1069,7 +1069,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
const required = names.filter((n) => schema[n].required);
|
|
1071
1071
|
if (args.length < required.length) {
|
|
1072
|
-
throw new (0,
|
|
1072
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1073
1073
|
`invoke: "${operation}" requires ${required.length} positional arg(s) (${required.map((n) => `${n}: ${schema[n].type}`).join(", ")}) but only ${args.length} were passed \u2014 declared args: ${declaredArgList(record)}`,
|
|
1074
1074
|
{ operation }
|
|
1075
1075
|
);
|
|
@@ -1080,7 +1080,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1080
1080
|
const name = names[i];
|
|
1081
1081
|
const spec = schema[name];
|
|
1082
1082
|
if (!looseTypeOk(spec.type, value)) {
|
|
1083
|
-
throw new (0,
|
|
1083
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1084
1084
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1085
1085
|
{ operation }
|
|
1086
1086
|
);
|
|
@@ -1088,8 +1088,8 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
1090
1090
|
function foldFlattenedOpts(record, toolArgs) {
|
|
1091
|
-
if (!
|
|
1092
|
-
throw new (0,
|
|
1091
|
+
if (!_chunkGDQ4QM7Qcjs.isRecord.call(void 0, toolArgs)) {
|
|
1092
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1093
1093
|
}
|
|
1094
1094
|
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _17 => _17.inputSchema, 'optionalAccess', _18 => _18.opts, 'optionalAccess', _19 => _19.properties]), () => ( []))).map((p) => p.name);
|
|
1095
1095
|
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
@@ -1098,7 +1098,7 @@ function foldFlattenedOpts(record, toolArgs) {
|
|
|
1098
1098
|
if (folded.opts === null) delete folded.opts;
|
|
1099
1099
|
if (flat.length === 0) return folded;
|
|
1100
1100
|
if (folded.opts !== void 0) {
|
|
1101
|
-
throw new (0,
|
|
1101
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1102
1102
|
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1103
1103
|
{ operation: record.id }
|
|
1104
1104
|
);
|
|
@@ -1160,11 +1160,11 @@ function validateParamsBag(record, args) {
|
|
|
1160
1160
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1161
1161
|
if (valid === void 0) return;
|
|
1162
1162
|
const bag = _optionalChain([args, 'optionalAccess', _20 => _20[0]]);
|
|
1163
|
-
if (bag === void 0 || bag === null || !
|
|
1163
|
+
if (bag === void 0 || bag === null || !_chunkGDQ4QM7Qcjs.isRecord.call(void 0, bag)) return;
|
|
1164
1164
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1165
1165
|
if (unknown.length === 0) return;
|
|
1166
1166
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1167
|
-
throw new (0,
|
|
1167
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1168
1168
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1169
1169
|
{
|
|
1170
1170
|
operation: record.id,
|
|
@@ -1172,17 +1172,36 @@ function validateParamsBag(record, args) {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
);
|
|
1174
1174
|
}
|
|
1175
|
-
|
|
1175
|
+
function validateGetBag(record, args) {
|
|
1176
|
+
if (record.kind !== "primitive" || record.operation !== "get") return;
|
|
1177
|
+
const at = Object.keys(_nullishCoalesce(record.inputSchema, () => ( {}))).indexOf("opts");
|
|
1178
|
+
const bag = at < 0 ? void 0 : _optionalChain([args, 'optionalAccess', _21 => _21[at]]);
|
|
1179
|
+
if (bag === void 0 || bag === null || !_chunkGDQ4QM7Qcjs.isRecord.call(void 0, bag)) return;
|
|
1180
|
+
const unknown = Object.keys(bag).filter((k) => k !== "fresh");
|
|
1181
|
+
if (unknown.length > 0) {
|
|
1182
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1183
|
+
`invoke: "${record.id}" opts bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: fresh)`,
|
|
1184
|
+
{ operation: record.id, suggestedAction: "Pass only { fresh?: boolean }." }
|
|
1185
|
+
);
|
|
1186
|
+
}
|
|
1187
|
+
if (bag.fresh !== void 0 && typeof bag.fresh !== "boolean") {
|
|
1188
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1189
|
+
`invoke: fresh must be a boolean (got ${typeof bag.fresh}) \u2014 "${record.id}" was not issued`,
|
|
1190
|
+
{ operation: record.id, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
|
|
1191
|
+
);
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
var INVOKE_OPTION_KEYS = ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh", "mode"];
|
|
1176
1195
|
function validateInvokeOptions(opts, operation) {
|
|
1177
1196
|
if (opts === void 0 || opts === null) return;
|
|
1178
1197
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1179
1198
|
if (unknown.length === 0) return;
|
|
1180
|
-
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1181
|
-
throw new (0,
|
|
1182
|
-
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries; "mode" is internal to the mode wrappers)`,
|
|
1199
|
+
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "fresh"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1200
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1201
|
+
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries, fresh; "mode" is internal to the mode wrappers)`,
|
|
1183
1202
|
{
|
|
1184
1203
|
operation,
|
|
1185
|
-
suggestedAction: suggestions.length > 0 ? `Fix the option name (${suggestions.join(", ")}).` : `Pass only dryRun / confirm / lastModifiedDate / maxRetries.`
|
|
1204
|
+
suggestedAction: suggestions.length > 0 ? `Fix the option name (${suggestions.join(", ")}).` : `Pass only dryRun / confirm / lastModifiedDate / maxRetries / fresh.`
|
|
1186
1205
|
}
|
|
1187
1206
|
);
|
|
1188
1207
|
}
|
|
@@ -1191,7 +1210,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1191
1210
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1192
1211
|
if (unknown.length === 0) return null;
|
|
1193
1212
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1194
|
-
return new (0,
|
|
1213
|
+
return new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1195
1214
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1196
1215
|
{
|
|
1197
1216
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1201,7 +1220,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1201
1220
|
}
|
|
1202
1221
|
|
|
1203
1222
|
// src/operations/invoke/registry.ts
|
|
1204
|
-
var RECORDS =
|
|
1223
|
+
var RECORDS = _chunkFOOHJBPPcjs.CAPABILITIES;
|
|
1205
1224
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1206
1225
|
|
|
1207
1226
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1220,7 +1239,7 @@ function bufferResult(buf) {
|
|
|
1220
1239
|
function resolveRecord(operation) {
|
|
1221
1240
|
const record = byId.get(operation);
|
|
1222
1241
|
if (record === void 0) {
|
|
1223
|
-
throw new (0,
|
|
1242
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1224
1243
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1225
1244
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1226
1245
|
);
|
|
@@ -1231,16 +1250,30 @@ function governPreRequest(record, operation, opts) {
|
|
|
1231
1250
|
validateInvokeOptions(opts, operation);
|
|
1232
1251
|
const mode = opts.mode;
|
|
1233
1252
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1234
|
-
throw new (0,
|
|
1253
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1235
1254
|
}
|
|
1236
1255
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1237
|
-
throw new (0,
|
|
1256
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1238
1257
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1239
1258
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1240
1259
|
);
|
|
1241
1260
|
}
|
|
1261
|
+
if (opts.fresh !== void 0) {
|
|
1262
|
+
if (typeof opts.fresh !== "boolean") {
|
|
1263
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1264
|
+
`invoke: fresh must be a boolean (got ${typeof opts.fresh}) \u2014 "${operation}" was not issued`,
|
|
1265
|
+
{ operation, suggestedAction: "Pass fresh: true (bypass the read cache) or omit it." }
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
if (record.effect !== "read" || record.kind !== "primitive" || record.operation !== "get" || !("opts" in (_nullishCoalesce(record.inputSchema, () => ( {}))))) {
|
|
1269
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1270
|
+
`invoke: fresh applies only to a single-record "<resource>.get" read \u2014 "${operation}" was not issued`,
|
|
1271
|
+
{ operation, suggestedAction: "Drop the fresh option (only <resource>.get consults the read cache per call)." }
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1242
1275
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1243
|
-
throw new (0,
|
|
1276
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1244
1277
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1245
1278
|
{ operation }
|
|
1246
1279
|
);
|
|
@@ -1257,7 +1290,7 @@ function operationsHolder(client) {
|
|
|
1257
1290
|
return {
|
|
1258
1291
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1259
1292
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1260
|
-
fetchMany: (items, opts) =>
|
|
1293
|
+
fetchMany: (items, opts) => _chunkGDQ4QM7Qcjs.fetchMany.call(void 0, client, items, opts),
|
|
1261
1294
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1262
1295
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1263
1296
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1267,12 +1300,12 @@ function operationsHolder(client) {
|
|
|
1267
1300
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1268
1301
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1269
1302
|
// typed outcomes reuse the fetchMany shapes).
|
|
1270
|
-
fetchByIds: (items, opts) =>
|
|
1303
|
+
fetchByIds: (items, opts) => _chunkGDQ4QM7Qcjs.fetchByIds.call(void 0, client, items, opts),
|
|
1271
1304
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1272
1305
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1273
1306
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1274
1307
|
// the API user cannot resolve; the name cache (default-on).
|
|
1275
|
-
expandResourceNames: (ids, opts) =>
|
|
1308
|
+
expandResourceNames: (ids, opts) => _chunkGDQ4QM7Qcjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
1276
1309
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1277
1310
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1278
1311
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1282,12 +1315,12 @@ function operationsHolder(client) {
|
|
|
1282
1315
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
1283
1316
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
1284
1317
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
1285
|
-
uiLink: (input) =>
|
|
1318
|
+
uiLink: (input) => _chunkGDQ4QM7Qcjs.uiLink.call(void 0, client, input),
|
|
1286
1319
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
1287
1320
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1288
1321
|
// pre-request; per-resource failures are recorded on the row and
|
|
1289
1322
|
// never abort the call).
|
|
1290
|
-
fieldCatalog: (opts) =>
|
|
1323
|
+
fieldCatalog: (opts) => _chunkGDQ4QM7Qcjs.fieldCatalog.call(void 0, client, opts),
|
|
1291
1324
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1292
1325
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1293
1326
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1297,15 +1330,15 @@ function operationsHolder(client) {
|
|
|
1297
1330
|
}
|
|
1298
1331
|
function resolveHolder(client, record, operation) {
|
|
1299
1332
|
const clientBag = client;
|
|
1300
|
-
let holder = clientBag[
|
|
1333
|
+
let holder = clientBag[_chunkGDQ4QM7Qcjs.camelKey.call(void 0, record.resource)];
|
|
1301
1334
|
if (typeof holder === "function") {
|
|
1302
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
1335
|
+
holder = _nullishCoalesce(clientBag[`${_chunkGDQ4QM7Qcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1303
1336
|
}
|
|
1304
1337
|
if (holder === void 0 && record.resource === "operations") {
|
|
1305
1338
|
holder = operationsHolder(client);
|
|
1306
1339
|
}
|
|
1307
1340
|
if (holder === void 0) {
|
|
1308
|
-
throw new (0,
|
|
1341
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1309
1342
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1310
1343
|
{ operation }
|
|
1311
1344
|
);
|
|
@@ -1349,20 +1382,27 @@ function buildCallArgs(record, args, mutationOpts, isWrite) {
|
|
|
1349
1382
|
}
|
|
1350
1383
|
return callArgs;
|
|
1351
1384
|
}
|
|
1385
|
+
function appendFresh(record, callArgs) {
|
|
1386
|
+
const at = Object.keys(_nullishCoalesce(record.inputSchema, () => ( {}))).indexOf("opts");
|
|
1387
|
+
while (callArgs.length < at) callArgs.push(void 0);
|
|
1388
|
+
callArgs[at] = { fresh: true };
|
|
1389
|
+
return callArgs;
|
|
1390
|
+
}
|
|
1352
1391
|
async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
1353
1392
|
const record = resolveRecord(operation);
|
|
1354
1393
|
governPreRequest(record, operation, opts);
|
|
1355
1394
|
const args = resolveDispatchArgs(record, argsIn);
|
|
1356
1395
|
validateDispatchArgs(record, args);
|
|
1357
1396
|
validateParamsBag(record, args);
|
|
1397
|
+
validateGetBag(record, args);
|
|
1358
1398
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1359
1399
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1360
1400
|
const holder = resolveHolder(client, record, operation);
|
|
1361
|
-
if (boundedQuery || countedQuery) await
|
|
1401
|
+
if (boundedQuery || countedQuery) await _chunkGDQ4QM7Qcjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
1362
1402
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1363
1403
|
const method = holder[methodName];
|
|
1364
1404
|
if (typeof method !== "function") {
|
|
1365
|
-
throw new (0,
|
|
1405
|
+
throw new (0, _chunkGDQ4QM7Qcjs.AutotaskConfigError)(
|
|
1366
1406
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1367
1407
|
{ operation }
|
|
1368
1408
|
);
|
|
@@ -1370,6 +1410,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1370
1410
|
const isWrite = record.effect !== "read";
|
|
1371
1411
|
const mutationOpts = buildMutationOpts(opts, isWrite);
|
|
1372
1412
|
const callArgs = buildCallArgs(record, args, mutationOpts, isWrite);
|
|
1413
|
+
if (opts.fresh === true) appendFresh(record, callArgs);
|
|
1373
1414
|
const result = await method.apply(holder, callArgs);
|
|
1374
1415
|
return Buffer.isBuffer(result) ? bufferResult(result) : result;
|
|
1375
1416
|
}
|
|
@@ -1439,4 +1480,4 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1439
1480
|
|
|
1440
1481
|
|
|
1441
1482
|
|
|
1442
|
-
exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.ENTITY_TYPE_TO_RESOURCE =
|
|
1483
|
+
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 = _chunkGDQ4QM7Qcjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunkGDQ4QM7Qcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkGDQ4QM7Qcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkGDQ4QM7Qcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkGDQ4QM7Qcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkGDQ4QM7Qcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkGDQ4QM7Qcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkGDQ4QM7Qcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkGDQ4QM7Qcjs.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 = _chunkGDQ4QM7Qcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunkGDQ4QM7Qcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunkGDQ4QM7Qcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = _chunkGDQ4QM7Qcjs.effectiveRequiredFields; exports.expandResourceNames = _chunkGDQ4QM7Qcjs.expandResourceNames; exports.fetchByIds = _chunkGDQ4QM7Qcjs.fetchByIds; exports.fetchMany = _chunkGDQ4QM7Qcjs.fetchMany; exports.fieldCatalog = _chunkGDQ4QM7Qcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunkGDQ4QM7Qcjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunkGDQ4QM7Qcjs.resourceForEntityType; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunkGDQ4QM7Qcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunkGDQ4QM7Qcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|