node-autotask 0.26.0 → 0.27.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 +47 -0
- package/MCP_TOOL_CATALOG.json +921 -30
- package/MCP_TOOL_MANIFEST.md +69 -16
- package/N8N_MCP_MANIFEST.json +39 -8
- package/N8N_MCP_MANIFEST.md +9 -8
- package/README.md +11 -9
- package/capabilities.json +13316 -7733
- package/capabilities.schema.json +125 -0
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-SSUECUVN.js → chunk-42ZUISDH.js} +947 -128
- package/dist/{chunk-WM6E5O55.cjs → chunk-5CC7LGNM.cjs} +13315 -7732
- package/dist/{chunk-SG4LIVMG.cjs → chunk-5GGCSRT4.cjs} +848 -439
- package/dist/{chunk-QXWIQ67O.js → chunk-F7FVOXPQ.js} +13315 -7732
- package/dist/{chunk-7DOSJS6S.js → chunk-GURC52J7.js} +23 -2
- package/dist/{chunk-5OGJTS2E.cjs → chunk-UHTZLUDE.cjs} +157 -136
- package/dist/{chunk-VVQ6NJYZ.js → chunk-ZGTFVZL5.js} +433 -24
- package/dist/{chunk-HQGE4WAV.cjs → chunk-ZJ4ONAQF.cjs} +1054 -235
- package/dist/{index-CKYr0unq.d.cts → index-BIWy9m-a.d.ts} +379 -49
- package/dist/{index-C8QH3BkP.d.ts → index-D4XYtn4s.d.cts} +379 -49
- package/dist/{index-1zBdJIEy.d.cts → index-DQ9NgraW.d.cts} +281 -1
- package/dist/{index-1zBdJIEy.d.ts → index-DQ9NgraW.d.ts} +281 -1
- package/dist/index.cjs +44 -24
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +26 -6
- package/dist/operations/index.cjs +147 -120
- package/dist/operations/index.d.cts +136 -7
- package/dist/operations/index.d.ts +136 -7
- package/dist/operations/index.js +33 -6
- package/dist/pool.cjs +42 -9
- package/dist/pool.d.cts +14 -3
- package/dist/pool.d.ts +14 -3
- package/dist/pool.js +38 -5
- package/dist/resources/index.cjs +19 -5
- package/dist/resources/index.d.cts +2 -2
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +18 -4
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/docs/API.md +207 -9
- package/examples/mcp/schemas.ts +16 -7
- package/package.json +1 -1
- /package/dist/{chunk-S643FDOR.cjs → chunk-IXF7AKOJ.cjs} +0 -0
- /package/dist/{chunk-2TWKEB2L.js → chunk-RMG55JTF.js} +0 -0
- /package/dist/{chunk-W3K5BEVY.cjs → chunk-SDYRQFGL.cjs} +0 -0
- /package/dist/{chunk-EBCHCNPK.js → chunk-WLTLB2ND.js} +0 -0
|
@@ -40,29 +40,32 @@
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var _chunkHQGE4WAVcjs = require('../chunk-HQGE4WAV.cjs');
|
|
44
43
|
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
|
|
46
|
+
var _chunkZJ4ONAQFcjs = require('../chunk-ZJ4ONAQF.cjs');
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
var _chunk5CC7LGNMcjs = require('../chunk-5CC7LGNM.cjs');
|
|
47
50
|
|
|
48
51
|
// src/operations/searchAcrossResources.ts
|
|
49
52
|
var DEFAULT_LIMIT = 25;
|
|
50
53
|
function resourceFor(client, key) {
|
|
51
|
-
return client[
|
|
54
|
+
return client[_chunkZJ4ONAQFcjs.camelKey.call(void 0, key)];
|
|
52
55
|
}
|
|
53
56
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
54
57
|
const text = query.trim();
|
|
55
58
|
if (text === "") {
|
|
56
|
-
throw new (0,
|
|
59
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
57
60
|
}
|
|
58
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
61
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkZJ4ONAQFcjs.WORKFLOW_RESOURCES));
|
|
59
62
|
if (keys.length === 0) {
|
|
60
|
-
throw new (0,
|
|
63
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
61
64
|
}
|
|
62
|
-
const limit =
|
|
65
|
+
const limit = _chunkZJ4ONAQFcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
63
66
|
const totalLimit = opts.totalLimit;
|
|
64
67
|
if (totalLimit !== void 0 && !(Number.isInteger(totalLimit) && totalLimit >= 1)) {
|
|
65
|
-
throw new (0,
|
|
68
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("searchAcrossResources: totalLimit must be a positive integer");
|
|
66
69
|
}
|
|
67
70
|
const results = [];
|
|
68
71
|
const skipped = [];
|
|
@@ -93,7 +96,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
93
96
|
|
|
94
97
|
// src/operations/resolveAny.ts
|
|
95
98
|
function resourceFor2(client, key) {
|
|
96
|
-
return client[
|
|
99
|
+
return client[_chunkZJ4ONAQFcjs.camelKey.call(void 0, key)];
|
|
97
100
|
}
|
|
98
101
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
99
102
|
function missCost(identifier) {
|
|
@@ -102,13 +105,13 @@ function missCost(identifier) {
|
|
|
102
105
|
}
|
|
103
106
|
async function resolveAny(client, identifier, opts = {}) {
|
|
104
107
|
if (typeof identifier === "number") {
|
|
105
|
-
|
|
108
|
+
_chunkZJ4ONAQFcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
106
109
|
} else if (identifier.trim() === "") {
|
|
107
|
-
throw new (0,
|
|
110
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
108
111
|
}
|
|
109
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
112
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkZJ4ONAQFcjs.WORKFLOW_RESOURCES));
|
|
110
113
|
if (keys.length === 0) {
|
|
111
|
-
throw new (0,
|
|
114
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
112
115
|
}
|
|
113
116
|
const results = [];
|
|
114
117
|
for (const key of keys) {
|
|
@@ -138,9 +141,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
138
141
|
} catch (err) {
|
|
139
142
|
let code;
|
|
140
143
|
let candidates = [];
|
|
141
|
-
if (err instanceof
|
|
144
|
+
if (err instanceof _chunkZJ4ONAQFcjs.AutotaskConfigError) {
|
|
142
145
|
code = "CONFIG_ERROR";
|
|
143
|
-
} else if (
|
|
146
|
+
} else if (_chunkZJ4ONAQFcjs.isAutotaskError.call(void 0, err)) {
|
|
144
147
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
145
148
|
code = err.code;
|
|
146
149
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -167,7 +170,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
167
170
|
// src/operations/aggregate.ts
|
|
168
171
|
var AGGREGATE_TOP_MAX = 100;
|
|
169
172
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
170
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
173
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunkZJ4ONAQFcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
171
174
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
172
175
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
173
176
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -224,7 +227,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
224
227
|
}
|
|
225
228
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
226
229
|
const s = /* @__PURE__ */ new Set();
|
|
227
|
-
for (const rec of
|
|
230
|
+
for (const rec of _chunk5CC7LGNMcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
228
231
|
return s;
|
|
229
232
|
})();
|
|
230
233
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -260,15 +263,15 @@ function parseFilterConditions(filter, problems) {
|
|
|
260
263
|
return [];
|
|
261
264
|
}
|
|
262
265
|
try {
|
|
263
|
-
return
|
|
266
|
+
return _chunkZJ4ONAQFcjs.buildFilter.call(void 0, conds).filter;
|
|
264
267
|
} catch (err) {
|
|
265
|
-
problems.push(err instanceof
|
|
268
|
+
problems.push(err instanceof _chunkZJ4ONAQFcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
266
269
|
return [];
|
|
267
270
|
}
|
|
268
271
|
}
|
|
269
272
|
function checkOptsBag(opts, problems) {
|
|
270
273
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
271
|
-
throw new (0,
|
|
274
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
272
275
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
273
276
|
{ operation: "operations.aggregate" }
|
|
274
277
|
);
|
|
@@ -348,7 +351,7 @@ function parseTopAndLimit(opts, problems) {
|
|
|
348
351
|
if (!Number.isInteger(opts.limit)) {
|
|
349
352
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
350
353
|
} else {
|
|
351
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
354
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunkZJ4ONAQFcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
352
355
|
}
|
|
353
356
|
}
|
|
354
357
|
return { top, limit };
|
|
@@ -360,14 +363,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
360
363
|
checkOptsBag(opts, problems);
|
|
361
364
|
const oracles = {
|
|
362
365
|
resourceKey,
|
|
363
|
-
fieldSets: resourceKey !== void 0 ?
|
|
364
|
-
dateSets: resourceKey !== void 0 ?
|
|
366
|
+
fieldSets: resourceKey !== void 0 ? _chunkZJ4ONAQFcjs.MODEL_FIELD_SETS[resourceKey] : void 0,
|
|
367
|
+
dateSets: resourceKey !== void 0 ? _chunkZJ4ONAQFcjs.MODEL_DATE_FIELDS[resourceKey] : void 0
|
|
365
368
|
};
|
|
366
369
|
const groupBy = parseGroupBy(opts, oracles, problems);
|
|
367
370
|
const sum = checkSumFields("sum", opts.sum, oracles, problems);
|
|
368
371
|
const { top, limit } = parseTopAndLimit(opts, problems);
|
|
369
372
|
if (problems.length > 0) {
|
|
370
|
-
throw new (0,
|
|
373
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
371
374
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
372
375
|
- ` + problems.join("\n- "),
|
|
373
376
|
{ operation: "operations.aggregate" }
|
|
@@ -401,9 +404,9 @@ function foldGroups(items, v) {
|
|
|
401
404
|
}
|
|
402
405
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
403
406
|
const v = validateAggregate(operation, filter, opts);
|
|
404
|
-
const holder = client[
|
|
407
|
+
const holder = client[_chunkZJ4ONAQFcjs.camelKey.call(void 0, v.resourceKey)];
|
|
405
408
|
if (holder === void 0) {
|
|
406
|
-
throw new (0,
|
|
409
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
407
410
|
operation: "operations.aggregate",
|
|
408
411
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
409
412
|
});
|
|
@@ -437,20 +440,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
437
440
|
async function relationshipMap(client, resourceKey) {
|
|
438
441
|
void client;
|
|
439
442
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
440
|
-
throw new (0,
|
|
443
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
441
444
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
442
445
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
443
446
|
);
|
|
444
447
|
}
|
|
445
448
|
const key = resourceKey.trim();
|
|
446
|
-
const entry =
|
|
449
|
+
const entry = _chunkZJ4ONAQFcjs.RELATIONSHIP_MAP[key];
|
|
447
450
|
if (entry === void 0) {
|
|
448
|
-
throw new (0,
|
|
449
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
451
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskError)(
|
|
452
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkZJ4ONAQFcjs.RELATIONSHIP_MAP).length} resources`,
|
|
450
453
|
{
|
|
451
454
|
code: "RESOURCE_UNKNOWN",
|
|
452
455
|
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 ${
|
|
456
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkZJ4ONAQFcjs.RELATIONSHIP_ZONE.label} (${_chunkZJ4ONAQFcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
454
457
|
}
|
|
455
458
|
);
|
|
456
459
|
}
|
|
@@ -467,24 +470,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
467
470
|
async function blindSurfaces(client, opts) {
|
|
468
471
|
void client;
|
|
469
472
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
470
|
-
throw new (0,
|
|
473
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
471
474
|
}
|
|
472
|
-
const inv =
|
|
475
|
+
const inv = _chunkZJ4ONAQFcjs.BLIND_SURFACE_INVENTORY;
|
|
473
476
|
if (inv === null) {
|
|
474
|
-
throw new (0,
|
|
477
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
475
478
|
}
|
|
476
479
|
let surfaces = inv.surfaces;
|
|
477
480
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
478
481
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
479
482
|
if (key === "") {
|
|
480
|
-
throw new (0,
|
|
483
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
481
484
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
482
485
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
483
486
|
);
|
|
484
487
|
}
|
|
485
488
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
486
|
-
throw new (0,
|
|
487
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
489
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskError)(
|
|
490
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkZJ4ONAQFcjs.RELATIONSHIP_MAP).length} resources`,
|
|
488
491
|
{
|
|
489
492
|
code: "RESOURCE_UNKNOWN",
|
|
490
493
|
category: "validation",
|
|
@@ -496,7 +499,7 @@ async function blindSurfaces(client, opts) {
|
|
|
496
499
|
}
|
|
497
500
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
498
501
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
499
|
-
throw new (0,
|
|
502
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
500
503
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
501
504
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
502
505
|
);
|
|
@@ -509,51 +512,51 @@ async function blindSurfaces(client, opts) {
|
|
|
509
512
|
// src/operations/probeReachability.ts
|
|
510
513
|
async function probeReachability(client, opts) {
|
|
511
514
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
512
|
-
throw new (0,
|
|
515
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
513
516
|
}
|
|
514
|
-
const defs =
|
|
517
|
+
const defs = _chunkZJ4ONAQFcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
515
518
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
516
|
-
throw new (0,
|
|
519
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
517
520
|
"probeReachability: confirmProbe: true is required \u2014 the op deliberately fans out read wire across the tenant (one bounded query per surface); pass confirmProbe: true to run it",
|
|
518
521
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
519
522
|
);
|
|
520
523
|
}
|
|
521
524
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
522
525
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
523
|
-
throw new (0,
|
|
526
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
524
527
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
525
528
|
);
|
|
526
529
|
}
|
|
527
530
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
528
531
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
529
|
-
throw new (0,
|
|
532
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
530
533
|
}
|
|
531
534
|
if (cap > defs.hardCap) {
|
|
532
|
-
throw new (0,
|
|
535
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
533
536
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
534
537
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
535
538
|
);
|
|
536
539
|
}
|
|
537
|
-
const inv =
|
|
540
|
+
const inv = _chunkZJ4ONAQFcjs.BLIND_SURFACE_INVENTORY;
|
|
538
541
|
if (inv === null) {
|
|
539
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
540
543
|
}
|
|
541
544
|
let targets;
|
|
542
545
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
543
546
|
targets = [...defs.defaultTargets];
|
|
544
547
|
} else {
|
|
545
548
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
546
|
-
throw new (0,
|
|
549
|
+
throw new (0, _chunkZJ4ONAQFcjs.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
550
|
}
|
|
548
551
|
const seen = /* @__PURE__ */ new Set();
|
|
549
552
|
for (const r of opts.resources) {
|
|
550
553
|
if (typeof r !== "string" || r.trim() === "") {
|
|
551
|
-
throw new (0,
|
|
554
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
552
555
|
}
|
|
553
556
|
const key = r.trim();
|
|
554
557
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
555
558
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
556
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskError)(
|
|
557
560
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
558
561
|
{
|
|
559
562
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -567,7 +570,7 @@ async function probeReachability(client, opts) {
|
|
|
567
570
|
targets = [...seen];
|
|
568
571
|
}
|
|
569
572
|
if (targets.length > cap) {
|
|
570
|
-
throw new (0,
|
|
573
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
571
574
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
572
575
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
573
576
|
);
|
|
@@ -577,7 +580,7 @@ async function probeReachability(client, opts) {
|
|
|
577
580
|
for (const resource of targets.sort()) {
|
|
578
581
|
const row = byResource.get(resource);
|
|
579
582
|
if (row === void 0) continue;
|
|
580
|
-
const holder = client[
|
|
583
|
+
const holder = client[_chunkZJ4ONAQFcjs.camelKey.call(void 0, resource)];
|
|
581
584
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
582
585
|
if (typeof probeFn !== "function") {
|
|
583
586
|
results.push({
|
|
@@ -596,7 +599,7 @@ async function probeReachability(client, opts) {
|
|
|
596
599
|
probe: { ok: true, wire: 1, error: null }
|
|
597
600
|
});
|
|
598
601
|
} catch (err) {
|
|
599
|
-
const code =
|
|
602
|
+
const code = _chunkZJ4ONAQFcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
600
603
|
const message = err instanceof Error ? err.message : String(err);
|
|
601
604
|
results.push({
|
|
602
605
|
...row,
|
|
@@ -609,6 +612,20 @@ async function probeReachability(client, opts) {
|
|
|
609
612
|
return { results, wireUsed, cap, truncated: false };
|
|
610
613
|
}
|
|
611
614
|
|
|
615
|
+
// src/operations/requiredFields.ts
|
|
616
|
+
function effectiveRequiredFields(record, zoneFacts) {
|
|
617
|
+
const prefix = _optionalChain([zoneFacts, 'optionalAccess', _9 => _9.createGuidance, 'optionalAccess', _10 => _10.liveProvenPrefix]);
|
|
618
|
+
if (Array.isArray(prefix) && prefix.length > 0) {
|
|
619
|
+
return { fields: [...prefix], from: "live-proven" };
|
|
620
|
+
}
|
|
621
|
+
const zoneSet = _optionalChain([zoneFacts, 'optionalAccess', _11 => _11.createRequiredSet]);
|
|
622
|
+
if (Array.isArray(zoneSet) && zoneSet.length > 0) {
|
|
623
|
+
return { fields: [...zoneSet], from: "zone" };
|
|
624
|
+
}
|
|
625
|
+
const spec = _optionalChain([record, 'optionalAccess', _12 => _12.requiredFields]);
|
|
626
|
+
return { fields: Array.isArray(spec) ? [...spec] : [], from: "spec" };
|
|
627
|
+
}
|
|
628
|
+
|
|
612
629
|
// src/operations/createGuidance.ts
|
|
613
630
|
var CREATE_BLOCKER_KINDS = [
|
|
614
631
|
"ok",
|
|
@@ -624,24 +641,30 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
624
641
|
async function createGuidance(client, opts) {
|
|
625
642
|
void client;
|
|
626
643
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
627
|
-
throw new (0,
|
|
644
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
628
645
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
629
646
|
);
|
|
630
647
|
}
|
|
631
|
-
let
|
|
632
|
-
|
|
648
|
+
let servedRows = _chunkZJ4ONAQFcjs.CREATE_GUIDANCE.rows.map((row) => ({
|
|
649
|
+
...row,
|
|
650
|
+
// Issue #219 N4: one precedence rule, stated on every row (live-proven >
|
|
651
|
+
// zone > spec). The spec set is not available here (it is a LIVE read) —
|
|
652
|
+
// the helper is handed the plan's two shapes and names the source.
|
|
653
|
+
requiredFields: effectiveRequiredFields(void 0, _nullishCoalesce(_optionalChain([_chunkZJ4ONAQFcjs.RELATIONSHIP_MAP, 'access', _13 => _13[row.resource], 'optionalAccess', _14 => _14.zoneFacts]), () => ( null)))
|
|
654
|
+
}));
|
|
655
|
+
if (_optionalChain([opts, 'optionalAccess', _15 => _15.resources]) !== void 0) {
|
|
633
656
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
634
|
-
throw new (0,
|
|
657
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
635
658
|
}
|
|
636
659
|
const wanted = /* @__PURE__ */ new Set();
|
|
637
660
|
for (const r of opts.resources) {
|
|
638
661
|
if (typeof r !== "string" || r.trim() === "") {
|
|
639
|
-
throw new (0,
|
|
662
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
640
663
|
}
|
|
641
664
|
const key = r.trim();
|
|
642
|
-
if (!
|
|
643
|
-
throw new (0,
|
|
644
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
665
|
+
if (!_chunkZJ4ONAQFcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
666
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskError)(
|
|
667
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkZJ4ONAQFcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
645
668
|
{
|
|
646
669
|
code: "RESOURCE_UNKNOWN",
|
|
647
670
|
category: "validation",
|
|
@@ -651,22 +674,22 @@ async function createGuidance(client, opts) {
|
|
|
651
674
|
}
|
|
652
675
|
wanted.add(key);
|
|
653
676
|
}
|
|
654
|
-
|
|
677
|
+
servedRows = servedRows.filter((row) => wanted.has(row.resource));
|
|
655
678
|
}
|
|
656
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
679
|
+
if (_optionalChain([opts, 'optionalAccess', _16 => _16.kind]) !== void 0) {
|
|
657
680
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
658
|
-
throw new (0,
|
|
681
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
659
682
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
660
683
|
);
|
|
661
684
|
}
|
|
662
|
-
|
|
685
|
+
servedRows = servedRows.filter((row) => _optionalChain([row, 'access', _17 => _17.blocker, 'optionalAccess', _18 => _18.kind]) === opts.kind);
|
|
663
686
|
}
|
|
664
687
|
return {
|
|
665
|
-
zone:
|
|
666
|
-
label:
|
|
667
|
-
verifiedAt:
|
|
668
|
-
rows,
|
|
669
|
-
counts:
|
|
688
|
+
zone: _chunkZJ4ONAQFcjs.CREATE_GUIDANCE.zone,
|
|
689
|
+
label: _chunkZJ4ONAQFcjs.CREATE_GUIDANCE.label,
|
|
690
|
+
verifiedAt: _chunkZJ4ONAQFcjs.CREATE_GUIDANCE.verifiedAt,
|
|
691
|
+
rows: servedRows,
|
|
692
|
+
counts: _chunkZJ4ONAQFcjs.CREATE_GUIDANCE.counts
|
|
670
693
|
};
|
|
671
694
|
}
|
|
672
695
|
|
|
@@ -675,7 +698,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
675
698
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
676
699
|
var RECOVERY_MAX_LIMIT = 100;
|
|
677
700
|
function configError(message, operation, suggestedAction) {
|
|
678
|
-
throw new (0,
|
|
701
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
679
702
|
}
|
|
680
703
|
function parseMatchId(record) {
|
|
681
704
|
const raw = record.id;
|
|
@@ -691,7 +714,7 @@ function parseMatchId(record) {
|
|
|
691
714
|
return { id: null, unsafe: true };
|
|
692
715
|
}
|
|
693
716
|
function validateRecoveryInput(input, operation) {
|
|
694
|
-
if (!
|
|
717
|
+
if (!_chunkZJ4ONAQFcjs.isRecord.call(void 0, input)) {
|
|
695
718
|
configError(
|
|
696
719
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
697
720
|
operation,
|
|
@@ -725,10 +748,10 @@ function validateRecoveryInput(input, operation) {
|
|
|
725
748
|
return { resource, marker, action };
|
|
726
749
|
}
|
|
727
750
|
function resolveRecoveryTarget(client, resource, operation) {
|
|
728
|
-
const entry =
|
|
751
|
+
const entry = _chunkZJ4ONAQFcjs.RELATIONSHIP_MAP[resource];
|
|
729
752
|
if (entry === void 0) {
|
|
730
|
-
throw new (0,
|
|
731
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
753
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskError)(
|
|
754
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkZJ4ONAQFcjs.RELATIONSHIP_MAP).length} resources`,
|
|
732
755
|
{
|
|
733
756
|
code: "RESOURCE_UNKNOWN",
|
|
734
757
|
category: "validation",
|
|
@@ -737,7 +760,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
737
760
|
}
|
|
738
761
|
);
|
|
739
762
|
}
|
|
740
|
-
const holder = client[
|
|
763
|
+
const holder = client[_chunkZJ4ONAQFcjs.camelKey.call(void 0, resource)];
|
|
741
764
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
742
765
|
configError(
|
|
743
766
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -748,7 +771,7 @@ function resolveRecoveryTarget(client, resource, operation) {
|
|
|
748
771
|
return { entry, holder };
|
|
749
772
|
}
|
|
750
773
|
function resolveMarkerField(input, resource, operation) {
|
|
751
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
774
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkZJ4ONAQFcjs.MARKER_FIELDS[resource];
|
|
752
775
|
if (typeof field !== "string" || field.trim() === "") {
|
|
753
776
|
configError(
|
|
754
777
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -787,7 +810,7 @@ function resolveExtraFilter(input, operation) {
|
|
|
787
810
|
);
|
|
788
811
|
}
|
|
789
812
|
for (const c of input.filter) {
|
|
790
|
-
if (!
|
|
813
|
+
if (!_chunkZJ4ONAQFcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
791
814
|
configError(
|
|
792
815
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
793
816
|
operation,
|
|
@@ -812,7 +835,7 @@ function resolveLimit(input, operation) {
|
|
|
812
835
|
async function applyRecoveryDeletes(holder, matches, parentId, resource, operation) {
|
|
813
836
|
const deleteMethod = holder.delete;
|
|
814
837
|
if (deleteMethod === void 0) {
|
|
815
|
-
throw new (0,
|
|
838
|
+
throw new (0, _chunkZJ4ONAQFcjs.DeleteBoundaryError)(
|
|
816
839
|
`recovery: ${resource} has no delete method on the client \u2014 the boundary is marked available in the plan but the typed delete surface is missing`,
|
|
817
840
|
{
|
|
818
841
|
operation,
|
|
@@ -841,14 +864,14 @@ async function applyRecoveryDeletes(holder, matches, parentId, resource, operati
|
|
|
841
864
|
verify = "still-present";
|
|
842
865
|
}
|
|
843
866
|
} catch (err) {
|
|
844
|
-
if (err instanceof
|
|
867
|
+
if (err instanceof _chunkZJ4ONAQFcjs.NotFoundError) verify = "not-found";
|
|
845
868
|
else {
|
|
846
869
|
verify = "error";
|
|
847
|
-
code =
|
|
870
|
+
code = _chunkZJ4ONAQFcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
848
871
|
}
|
|
849
872
|
}
|
|
850
873
|
} catch (err) {
|
|
851
|
-
code =
|
|
874
|
+
code = _chunkZJ4ONAQFcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
852
875
|
}
|
|
853
876
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
854
877
|
}
|
|
@@ -876,7 +899,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
876
899
|
const parentId = resolveParentId(input, entry, resource, operation);
|
|
877
900
|
const extra = resolveExtraFilter(input, operation);
|
|
878
901
|
const limit = resolveLimit(input, operation);
|
|
879
|
-
const boundaryNote =
|
|
902
|
+
const boundaryNote = _chunkZJ4ONAQFcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
880
903
|
const boundary = {
|
|
881
904
|
available: boundaryNote === void 0,
|
|
882
905
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -888,7 +911,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
888
911
|
};
|
|
889
912
|
const isDelete = action === "delete";
|
|
890
913
|
if (isDelete && boundaryNote !== void 0) {
|
|
891
|
-
throw new (0,
|
|
914
|
+
throw new (0, _chunkZJ4ONAQFcjs.DeleteBoundaryError)(
|
|
892
915
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
893
916
|
{
|
|
894
917
|
operation,
|
|
@@ -897,10 +920,10 @@ async function recovery(client, input, opts = {}) {
|
|
|
897
920
|
}
|
|
898
921
|
);
|
|
899
922
|
}
|
|
900
|
-
const dryRun = _optionalChain([opts, 'optionalAccess',
|
|
901
|
-
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
923
|
+
const dryRun = _optionalChain([opts, 'optionalAccess', _19 => _19.dryRun]) !== false;
|
|
924
|
+
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _20 => _20.confirm]), () => ( input.confirm));
|
|
902
925
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
903
|
-
throw new (0,
|
|
926
|
+
throw new (0, _chunkZJ4ONAQFcjs.ConfirmationRequiredError)(
|
|
904
927
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
905
928
|
{
|
|
906
929
|
operation: RECOVERY_CONFIRM,
|
|
@@ -916,7 +939,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
916
939
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
917
940
|
if (query.hasMore) {
|
|
918
941
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
919
|
-
throw new (0,
|
|
942
|
+
throw new (0, _chunkZJ4ONAQFcjs.RecoveryTruncatedError)(
|
|
920
943
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
921
944
|
{
|
|
922
945
|
operation,
|
|
@@ -945,7 +968,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
945
968
|
return { ...base, simulated: true, dryRun: true };
|
|
946
969
|
}
|
|
947
970
|
if (unsafeId) {
|
|
948
|
-
throw new (0,
|
|
971
|
+
throw new (0, _chunkZJ4ONAQFcjs.MarkerUnsafeIdError)(
|
|
949
972
|
`recovery: ${unsafeIds.length} of ${matches.length} match(es) on ${resource} have ids beyond Number.MAX_SAFE_INTEGER \u2014 they CANNOT be addressed through the SDK's typed delete surface (zero DELETE wire was issued)`,
|
|
950
973
|
{
|
|
951
974
|
operation,
|
|
@@ -963,7 +986,7 @@ function needsConfirmation(record) {
|
|
|
963
986
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
964
987
|
}
|
|
965
988
|
function refuse(message, operation, suggestedAction) {
|
|
966
|
-
throw new (0,
|
|
989
|
+
throw new (0, _chunkZJ4ONAQFcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
967
990
|
}
|
|
968
991
|
var MODE_BY_EFFECT = {
|
|
969
992
|
read: "read",
|
|
@@ -1009,7 +1032,7 @@ function looseTypeOk(type, value) {
|
|
|
1009
1032
|
case "string[]":
|
|
1010
1033
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1011
1034
|
case "object":
|
|
1012
|
-
return
|
|
1035
|
+
return _chunkZJ4ONAQFcjs.isRecord.call(void 0, value);
|
|
1013
1036
|
default:
|
|
1014
1037
|
return true;
|
|
1015
1038
|
}
|
|
@@ -1023,12 +1046,12 @@ function declaredArgList(record) {
|
|
|
1023
1046
|
function resolveDispatchArgs(record, argsIn) {
|
|
1024
1047
|
const operation = record.id;
|
|
1025
1048
|
const bad = (message) => {
|
|
1026
|
-
throw new (0,
|
|
1049
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(`invoke: "${operation}" ${message}`, { operation });
|
|
1027
1050
|
};
|
|
1028
1051
|
if (argsIn === void 0 || argsIn === null) return [];
|
|
1029
1052
|
if (Array.isArray(argsIn)) return argsIn;
|
|
1030
1053
|
const byName = argsIn;
|
|
1031
|
-
if (!
|
|
1054
|
+
if (!_chunkZJ4ONAQFcjs.isRecord.call(void 0, byName) || ![Object.prototype, null].includes(Object.getPrototypeOf(byName))) {
|
|
1032
1055
|
return bad(`args must be a positional array or a plain object of named inputs (declared: ${declaredArgList(record)})`);
|
|
1033
1056
|
}
|
|
1034
1057
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
@@ -1049,7 +1072,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1049
1072
|
const bagName = names.find((n) => schema[n].properties);
|
|
1050
1073
|
const surplus = args[names.length];
|
|
1051
1074
|
const bagHint = bagName && surplus !== null && typeof surplus === "object" && !Array.isArray(surplus) ? ` \u2014 options go inside the single ${bagName} object` : "";
|
|
1052
|
-
throw new (0,
|
|
1075
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1053
1076
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused${bagHint}`,
|
|
1054
1077
|
{
|
|
1055
1078
|
operation,
|
|
@@ -1059,7 +1082,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1059
1082
|
}
|
|
1060
1083
|
const required = names.filter((n) => schema[n].required);
|
|
1061
1084
|
if (args.length < required.length) {
|
|
1062
|
-
throw new (0,
|
|
1085
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1063
1086
|
`invoke: "${operation}" requires ${required.length} positional arg(s) (${required.map((n) => `${n}: ${schema[n].type}`).join(", ")}) but only ${args.length} were passed \u2014 declared args: ${declaredArgList(record)}`,
|
|
1064
1087
|
{ operation }
|
|
1065
1088
|
);
|
|
@@ -1070,7 +1093,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1070
1093
|
const name = names[i];
|
|
1071
1094
|
const spec = schema[name];
|
|
1072
1095
|
if (!looseTypeOk(spec.type, value)) {
|
|
1073
|
-
throw new (0,
|
|
1096
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1074
1097
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1075
1098
|
{ operation }
|
|
1076
1099
|
);
|
|
@@ -1078,17 +1101,17 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1078
1101
|
}
|
|
1079
1102
|
}
|
|
1080
1103
|
function foldFlattenedOpts(record, toolArgs) {
|
|
1081
|
-
if (!
|
|
1082
|
-
throw new (0,
|
|
1104
|
+
if (!_chunkZJ4ONAQFcjs.isRecord.call(void 0, toolArgs)) {
|
|
1105
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(`invoke: "${record.id}" tool args must be a plain object of named inputs`, { operation: record.id });
|
|
1083
1106
|
}
|
|
1084
|
-
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access',
|
|
1107
|
+
const bagKeys = (_nullishCoalesce(_optionalChain([record, 'access', _21 => _21.inputSchema, 'optionalAccess', _22 => _22.opts, 'optionalAccess', _23 => _23.properties]), () => ( []))).map((p) => p.name);
|
|
1085
1108
|
const flat = Object.keys(toolArgs).filter((k) => bagKeys.includes(k) && toolArgs[k] !== void 0 && toolArgs[k] !== null);
|
|
1086
1109
|
const folded = { ...toolArgs };
|
|
1087
1110
|
for (const k of bagKeys) delete folded[k];
|
|
1088
1111
|
if (folded.opts === null) delete folded.opts;
|
|
1089
1112
|
if (flat.length === 0) return folded;
|
|
1090
1113
|
if (folded.opts !== void 0) {
|
|
1091
|
-
throw new (0,
|
|
1114
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1092
1115
|
`invoke: "${record.id}" was given both opts and flattened option(s) ${flat.map((k) => `"${k}"`).join(", ")} \u2014 pass one form`,
|
|
1093
1116
|
{ operation: record.id }
|
|
1094
1117
|
);
|
|
@@ -1149,12 +1172,12 @@ function validateParamsBag(record, args) {
|
|
|
1149
1172
|
if (record.inputSchemaStrict !== true) return;
|
|
1150
1173
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1151
1174
|
if (valid === void 0) return;
|
|
1152
|
-
const bag = _optionalChain([args, 'optionalAccess',
|
|
1153
|
-
if (bag === void 0 || bag === null || !
|
|
1175
|
+
const bag = _optionalChain([args, 'optionalAccess', _24 => _24[0]]);
|
|
1176
|
+
if (bag === void 0 || bag === null || !_chunkZJ4ONAQFcjs.isRecord.call(void 0, bag)) return;
|
|
1154
1177
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1155
1178
|
if (unknown.length === 0) return;
|
|
1156
1179
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1157
|
-
throw new (0,
|
|
1180
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1158
1181
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1159
1182
|
{
|
|
1160
1183
|
operation: record.id,
|
|
@@ -1168,7 +1191,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1168
1191
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1169
1192
|
if (unknown.length === 0) return;
|
|
1170
1193
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1171
|
-
throw new (0,
|
|
1194
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1172
1195
|
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate, maxRetries; "mode" is internal to the mode wrappers)`,
|
|
1173
1196
|
{
|
|
1174
1197
|
operation,
|
|
@@ -1181,7 +1204,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1181
1204
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1182
1205
|
if (unknown.length === 0) return null;
|
|
1183
1206
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1184
|
-
return new (0,
|
|
1207
|
+
return new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1185
1208
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1186
1209
|
{
|
|
1187
1210
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1191,7 +1214,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1191
1214
|
}
|
|
1192
1215
|
|
|
1193
1216
|
// src/operations/invoke/registry.ts
|
|
1194
|
-
var RECORDS =
|
|
1217
|
+
var RECORDS = _chunk5CC7LGNMcjs.CAPABILITIES;
|
|
1195
1218
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
1196
1219
|
|
|
1197
1220
|
// src/operations/invoke/dispatch.ts
|
|
@@ -1210,7 +1233,7 @@ function bufferResult(buf) {
|
|
|
1210
1233
|
function resolveRecord(operation) {
|
|
1211
1234
|
const record = byId.get(operation);
|
|
1212
1235
|
if (record === void 0) {
|
|
1213
|
-
throw new (0,
|
|
1236
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1214
1237
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1215
1238
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1216
1239
|
);
|
|
@@ -1221,16 +1244,16 @@ function governPreRequest(record, operation, opts) {
|
|
|
1221
1244
|
validateInvokeOptions(opts, operation);
|
|
1222
1245
|
const mode = opts.mode;
|
|
1223
1246
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1224
|
-
throw new (0,
|
|
1247
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1225
1248
|
}
|
|
1226
1249
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1227
|
-
throw new (0,
|
|
1250
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1228
1251
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1229
1252
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1230
1253
|
);
|
|
1231
1254
|
}
|
|
1232
1255
|
if (record.effect === "read" && opts.dryRun === true) {
|
|
1233
|
-
throw new (0,
|
|
1256
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1234
1257
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1235
1258
|
{ operation }
|
|
1236
1259
|
);
|
|
@@ -1247,7 +1270,7 @@ function operationsHolder(client) {
|
|
|
1247
1270
|
return {
|
|
1248
1271
|
resolveAny: (identifier, opts) => resolveAny(client, identifier, opts),
|
|
1249
1272
|
searchAcrossResources: (query, opts) => searchAcrossResources(client, query, opts),
|
|
1250
|
-
fetchMany: (items, opts) =>
|
|
1273
|
+
fetchMany: (items, opts) => _chunkZJ4ONAQFcjs.fetchMany.call(void 0, client, items, opts),
|
|
1251
1274
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1252
1275
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1253
1276
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1257,12 +1280,12 @@ function operationsHolder(client) {
|
|
|
1257
1280
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1258
1281
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1259
1282
|
// typed outcomes reuse the fetchMany shapes).
|
|
1260
|
-
fetchByIds: (items, opts) =>
|
|
1283
|
+
fetchByIds: (items, opts) => _chunkZJ4ONAQFcjs.fetchByIds.call(void 0, client, items, opts),
|
|
1261
1284
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1262
1285
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1263
1286
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1264
1287
|
// the API user cannot resolve; the name cache (default-on).
|
|
1265
|
-
expandResourceNames: (ids, opts) =>
|
|
1288
|
+
expandResourceNames: (ids, opts) => _chunkZJ4ONAQFcjs.expandResourceNames.call(void 0, client, ids, opts),
|
|
1266
1289
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1267
1290
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1268
1291
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1272,12 +1295,12 @@ function operationsHolder(client) {
|
|
|
1272
1295
|
// Issue #12: the served zone-fact create-guidance catalog (zero wire).
|
|
1273
1296
|
createGuidance: (opts) => createGuidance(client, opts),
|
|
1274
1297
|
// Issue #202: ExecuteCommand deep links — pure, zero wire.
|
|
1275
|
-
uiLink: (input) =>
|
|
1298
|
+
uiLink: (input) => _chunkZJ4ONAQFcjs.uiLink.call(void 0, client, input),
|
|
1276
1299
|
// Issue #31: the opt-in live field-metadata channel — N bounded
|
|
1277
1300
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1278
1301
|
// pre-request; per-resource failures are recorded on the row and
|
|
1279
1302
|
// never abort the call).
|
|
1280
|
-
fieldCatalog: (opts) =>
|
|
1303
|
+
fieldCatalog: (opts) => _chunkZJ4ONAQFcjs.fieldCatalog.call(void 0, client, opts),
|
|
1281
1304
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1282
1305
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1283
1306
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1287,15 +1310,15 @@ function operationsHolder(client) {
|
|
|
1287
1310
|
}
|
|
1288
1311
|
function resolveHolder(client, record, operation) {
|
|
1289
1312
|
const clientBag = client;
|
|
1290
|
-
let holder = clientBag[
|
|
1313
|
+
let holder = clientBag[_chunkZJ4ONAQFcjs.camelKey.call(void 0, record.resource)];
|
|
1291
1314
|
if (typeof holder === "function") {
|
|
1292
|
-
holder = _nullishCoalesce(clientBag[`${
|
|
1315
|
+
holder = _nullishCoalesce(clientBag[`${_chunkZJ4ONAQFcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1293
1316
|
}
|
|
1294
1317
|
if (holder === void 0 && record.resource === "operations") {
|
|
1295
1318
|
holder = operationsHolder(client);
|
|
1296
1319
|
}
|
|
1297
1320
|
if (holder === void 0) {
|
|
1298
|
-
throw new (0,
|
|
1321
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1299
1322
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1300
1323
|
{ operation }
|
|
1301
1324
|
);
|
|
@@ -1348,11 +1371,11 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1348
1371
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1349
1372
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1350
1373
|
const holder = resolveHolder(client, record, operation);
|
|
1351
|
-
if (boundedQuery || countedQuery) await
|
|
1374
|
+
if (boundedQuery || countedQuery) await _chunkZJ4ONAQFcjs.validateQueryFieldNames.call(void 0, record, holder, args);
|
|
1352
1375
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1353
1376
|
const method = holder[methodName];
|
|
1354
1377
|
if (typeof method !== "function") {
|
|
1355
|
-
throw new (0,
|
|
1378
|
+
throw new (0, _chunkZJ4ONAQFcjs.AutotaskConfigError)(
|
|
1356
1379
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1357
1380
|
{ operation }
|
|
1358
1381
|
);
|
|
@@ -1425,4 +1448,8 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1425
1448
|
|
|
1426
1449
|
|
|
1427
1450
|
|
|
1428
|
-
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
|
|
1455
|
+
exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.ENTITY_TYPE_TO_RESOURCE = _chunkZJ4ONAQFcjs.ENTITY_TYPE_TO_RESOURCE; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunkZJ4ONAQFcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkZJ4ONAQFcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkZJ4ONAQFcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkZJ4ONAQFcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkZJ4ONAQFcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkZJ4ONAQFcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkZJ4ONAQFcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkZJ4ONAQFcjs.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 = _chunkZJ4ONAQFcjs.UI_LINK_ENTITIES; exports.WORKFLOW_RESOURCES = _chunkZJ4ONAQFcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.buildUiLink = _chunkZJ4ONAQFcjs.buildUiLink; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.effectiveRequiredFields = effectiveRequiredFields; exports.expandResourceNames = _chunkZJ4ONAQFcjs.expandResourceNames; exports.fetchByIds = _chunkZJ4ONAQFcjs.fetchByIds; exports.fetchMany = _chunkZJ4ONAQFcjs.fetchMany; exports.fieldCatalog = _chunkZJ4ONAQFcjs.fieldCatalog; exports.foldFlattenedOpts = foldFlattenedOpts; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.isEnumerableResource = _chunkZJ4ONAQFcjs.isEnumerableResource; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.resourceForEntityType = _chunkZJ4ONAQFcjs.resourceForEntityType; exports.searchAcrossResources = searchAcrossResources; exports.uiLink = _chunkZJ4ONAQFcjs.uiLink; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunkZJ4ONAQFcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|