node-autotask 0.20.0 → 0.21.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 +11 -0
- package/MCP_TOOL_CATALOG.json +1393 -6
- package/MCP_TOOL_MANIFEST.md +7 -7
- package/MCP_TOOL_OVERRIDES.json +1 -1
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/capabilities.json +10689 -1699
- package/capabilities.schema.json +33 -0
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.d.cts +9 -0
- package/dist/capabilities.d.ts +9 -0
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-FLYTKJKV.cjs → chunk-CBUY3MKB.cjs} +10688 -1698
- package/dist/{chunk-2T77J2ZM.js → chunk-DM67SXCO.js} +10688 -1698
- package/dist/{chunk-XSYJB4IW.js → chunk-GBVUXAUA.js} +2 -2
- package/dist/{chunk-YH5CPRDN.cjs → chunk-HEW4WJLC.cjs} +393 -393
- package/dist/{chunk-JEJUFXHX.js → chunk-JRSU6PKP.js} +2 -2
- package/dist/{chunk-GA6UCX3Z.js → chunk-KD6LOSAK.js} +19 -14
- package/dist/{chunk-RMLGOCGA.cjs → chunk-PMPFQDVM.cjs} +135 -135
- package/dist/{chunk-L6V66V22.cjs → chunk-QWAWNQEZ.cjs} +20 -15
- package/dist/{index-AN-NjLi9.d.cts → index-ByWYfNog.d.cts} +16 -11
- package/dist/{index-CvLLsOCP.d.ts → index-DSnuyiTr.d.ts} +16 -11
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/operations/index.cjs +111 -111
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +2 -2
- package/dist/pool.cjs +8 -8
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/docs/API.md +7 -4
- package/package.json +1 -1
|
@@ -37,26 +37,26 @@
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkQWAWNQEZcjs = require('../chunk-QWAWNQEZ.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var _chunkCBUY3MKBcjs = require('../chunk-CBUY3MKB.cjs');
|
|
44
44
|
|
|
45
45
|
// src/operations/searchAcrossResources.ts
|
|
46
46
|
var DEFAULT_LIMIT = 25;
|
|
47
47
|
function resourceFor(client, key) {
|
|
48
|
-
return client[
|
|
48
|
+
return client[_chunkQWAWNQEZcjs.camelKey.call(void 0, key)];
|
|
49
49
|
}
|
|
50
50
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
51
51
|
const text = query.trim();
|
|
52
52
|
if (text === "") {
|
|
53
|
-
throw new (0,
|
|
53
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
54
54
|
}
|
|
55
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
55
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkQWAWNQEZcjs.WORKFLOW_RESOURCES));
|
|
56
56
|
if (keys.length === 0) {
|
|
57
|
-
throw new (0,
|
|
57
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
58
58
|
}
|
|
59
|
-
const limit =
|
|
59
|
+
const limit = _chunkQWAWNQEZcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
60
60
|
const results = [];
|
|
61
61
|
const skipped = [];
|
|
62
62
|
for (const key of keys) {
|
|
@@ -74,7 +74,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
74
74
|
|
|
75
75
|
// src/operations/resolveAny.ts
|
|
76
76
|
function resourceFor2(client, key) {
|
|
77
|
-
return client[
|
|
77
|
+
return client[_chunkQWAWNQEZcjs.camelKey.call(void 0, key)];
|
|
78
78
|
}
|
|
79
79
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
80
80
|
function missCost(identifier) {
|
|
@@ -83,13 +83,13 @@ function missCost(identifier) {
|
|
|
83
83
|
}
|
|
84
84
|
async function resolveAny(client, identifier, opts = {}) {
|
|
85
85
|
if (typeof identifier === "number") {
|
|
86
|
-
|
|
86
|
+
_chunkQWAWNQEZcjs.parseIdentifier.call(void 0, identifier, "identifier");
|
|
87
87
|
} else if (identifier.trim() === "") {
|
|
88
|
-
throw new (0,
|
|
88
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
89
89
|
}
|
|
90
|
-
const keys = _nullishCoalesce(opts.resources, () => (
|
|
90
|
+
const keys = _nullishCoalesce(opts.resources, () => ( _chunkQWAWNQEZcjs.WORKFLOW_RESOURCES));
|
|
91
91
|
if (keys.length === 0) {
|
|
92
|
-
throw new (0,
|
|
92
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
93
93
|
}
|
|
94
94
|
const results = [];
|
|
95
95
|
for (const key of keys) {
|
|
@@ -119,9 +119,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
119
119
|
} catch (err) {
|
|
120
120
|
let code;
|
|
121
121
|
let candidates = [];
|
|
122
|
-
if (err instanceof
|
|
122
|
+
if (err instanceof _chunkQWAWNQEZcjs.AutotaskConfigError) {
|
|
123
123
|
code = "CONFIG_ERROR";
|
|
124
|
-
} else if (
|
|
124
|
+
} else if (_chunkQWAWNQEZcjs.isAutotaskError.call(void 0, err)) {
|
|
125
125
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
126
126
|
code = err.code;
|
|
127
127
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -148,7 +148,7 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
148
148
|
// src/operations/aggregate.ts
|
|
149
149
|
var AGGREGATE_TOP_MAX = 100;
|
|
150
150
|
var AGGREGATE_DEFAULT_TOP = 25;
|
|
151
|
-
var AGGREGATE_DEFAULT_LIMIT =
|
|
151
|
+
var AGGREGATE_DEFAULT_LIMIT = _chunkQWAWNQEZcjs.BOUNDED_QUERY_MAX_LIMIT;
|
|
152
152
|
var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
|
|
153
153
|
var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
154
154
|
var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
|
|
@@ -205,7 +205,7 @@ function dateBucketLabel(value, bucket) {
|
|
|
205
205
|
}
|
|
206
206
|
var QUERY_RESOURCE_KEYS = (() => {
|
|
207
207
|
const s = /* @__PURE__ */ new Set();
|
|
208
|
-
for (const rec of
|
|
208
|
+
for (const rec of _chunkCBUY3MKBcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
|
|
209
209
|
return s;
|
|
210
210
|
})();
|
|
211
211
|
var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
|
|
@@ -240,14 +240,14 @@ function validateAggregate(operation, filter, opts) {
|
|
|
240
240
|
conditions = [];
|
|
241
241
|
} else {
|
|
242
242
|
try {
|
|
243
|
-
conditions =
|
|
243
|
+
conditions = _chunkQWAWNQEZcjs.buildFilter.call(void 0, conds).filter;
|
|
244
244
|
} catch (err) {
|
|
245
|
-
problems.push(err instanceof
|
|
245
|
+
problems.push(err instanceof _chunkQWAWNQEZcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}
|
|
249
249
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
250
|
-
throw new (0,
|
|
250
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
251
251
|
`aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
|
|
252
252
|
{ operation: "operations.aggregate" }
|
|
253
253
|
);
|
|
@@ -257,8 +257,8 @@ function validateAggregate(operation, filter, opts) {
|
|
|
257
257
|
problems.push(`unknown opts key "${key}" \u2014 the bag is closed: ${AGGREGATE_OPT_KEYS.join(", ")}`);
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
const fieldSets = resourceKey !== void 0 ?
|
|
261
|
-
const dateSets = resourceKey !== void 0 ?
|
|
260
|
+
const fieldSets = resourceKey !== void 0 ? _chunkQWAWNQEZcjs.MODEL_FIELD_SETS[resourceKey] : void 0;
|
|
261
|
+
const dateSets = resourceKey !== void 0 ? _chunkQWAWNQEZcjs.MODEL_DATE_FIELDS[resourceKey] : void 0;
|
|
262
262
|
const checkFields = (name, fields) => {
|
|
263
263
|
if (fields === void 0) return [];
|
|
264
264
|
if (!Array.isArray(fields) || fields.length === 0 || fields.some((f) => typeof f !== "string" || f.trim() === "")) {
|
|
@@ -322,11 +322,11 @@ function validateAggregate(operation, filter, opts) {
|
|
|
322
322
|
if (!Number.isInteger(opts.limit)) {
|
|
323
323
|
problems.push(`limit must be an integer (got ${String(opts.limit)})`);
|
|
324
324
|
} else {
|
|
325
|
-
limit = Math.min(Math.max(opts.limit, 1),
|
|
325
|
+
limit = Math.min(Math.max(opts.limit, 1), _chunkQWAWNQEZcjs.BOUNDED_QUERY_MAX_LIMIT);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
if (problems.length > 0) {
|
|
329
|
-
throw new (0,
|
|
329
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
330
330
|
`aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
331
331
|
- ` + problems.join("\n- "),
|
|
332
332
|
{ operation: "operations.aggregate" }
|
|
@@ -336,9 +336,9 @@ function validateAggregate(operation, filter, opts) {
|
|
|
336
336
|
}
|
|
337
337
|
async function aggregate(client, operation, filter, opts = {}) {
|
|
338
338
|
const v = validateAggregate(operation, filter, opts);
|
|
339
|
-
const holder = client[
|
|
339
|
+
const holder = client[_chunkQWAWNQEZcjs.camelKey.call(void 0, v.resourceKey)];
|
|
340
340
|
if (holder === void 0) {
|
|
341
|
-
throw new (0,
|
|
341
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
|
|
342
342
|
operation: "operations.aggregate",
|
|
343
343
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
344
344
|
});
|
|
@@ -393,20 +393,20 @@ async function aggregate(client, operation, filter, opts = {}) {
|
|
|
393
393
|
async function relationshipMap(client, resourceKey) {
|
|
394
394
|
void client;
|
|
395
395
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
396
|
-
throw new (0,
|
|
396
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
397
397
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
398
398
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
const key = resourceKey.trim();
|
|
402
|
-
const entry =
|
|
402
|
+
const entry = _chunkQWAWNQEZcjs.RELATIONSHIP_MAP[key];
|
|
403
403
|
if (entry === void 0) {
|
|
404
|
-
throw new (0,
|
|
405
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
404
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskError)(
|
|
405
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkQWAWNQEZcjs.RELATIONSHIP_MAP).length} resources`,
|
|
406
406
|
{
|
|
407
407
|
code: "RESOURCE_UNKNOWN",
|
|
408
408
|
category: "validation",
|
|
409
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
409
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkQWAWNQEZcjs.RELATIONSHIP_ZONE.label} (${_chunkQWAWNQEZcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
410
410
|
}
|
|
411
411
|
);
|
|
412
412
|
}
|
|
@@ -423,24 +423,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
423
423
|
async function blindSurfaces(client, opts) {
|
|
424
424
|
void client;
|
|
425
425
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
426
|
-
throw new (0,
|
|
426
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
427
427
|
}
|
|
428
|
-
const inv =
|
|
428
|
+
const inv = _chunkQWAWNQEZcjs.BLIND_SURFACE_INVENTORY;
|
|
429
429
|
if (inv === null) {
|
|
430
|
-
throw new (0,
|
|
430
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
431
431
|
}
|
|
432
432
|
let surfaces = inv.surfaces;
|
|
433
433
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
434
434
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
435
435
|
if (key === "") {
|
|
436
|
-
throw new (0,
|
|
436
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
437
437
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
438
438
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
439
439
|
);
|
|
440
440
|
}
|
|
441
441
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
442
|
-
throw new (0,
|
|
443
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
442
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskError)(
|
|
443
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkQWAWNQEZcjs.RELATIONSHIP_MAP).length} resources`,
|
|
444
444
|
{
|
|
445
445
|
code: "RESOURCE_UNKNOWN",
|
|
446
446
|
category: "validation",
|
|
@@ -452,7 +452,7 @@ async function blindSurfaces(client, opts) {
|
|
|
452
452
|
}
|
|
453
453
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
454
454
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
455
|
-
throw new (0,
|
|
455
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
456
456
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
457
457
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
458
458
|
);
|
|
@@ -465,51 +465,51 @@ async function blindSurfaces(client, opts) {
|
|
|
465
465
|
// src/operations/probeReachability.ts
|
|
466
466
|
async function probeReachability(client, opts) {
|
|
467
467
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
468
|
-
throw new (0,
|
|
468
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
469
469
|
}
|
|
470
|
-
const defs =
|
|
470
|
+
const defs = _chunkQWAWNQEZcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
471
471
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
472
|
-
throw new (0,
|
|
472
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
473
473
|
"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",
|
|
474
474
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
475
475
|
);
|
|
476
476
|
}
|
|
477
477
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
478
478
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
479
|
-
throw new (0,
|
|
479
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
480
480
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
481
481
|
);
|
|
482
482
|
}
|
|
483
483
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
484
484
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
485
|
-
throw new (0,
|
|
485
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
486
486
|
}
|
|
487
487
|
if (cap > defs.hardCap) {
|
|
488
|
-
throw new (0,
|
|
488
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
489
489
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
490
490
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
491
491
|
);
|
|
492
492
|
}
|
|
493
|
-
const inv =
|
|
493
|
+
const inv = _chunkQWAWNQEZcjs.BLIND_SURFACE_INVENTORY;
|
|
494
494
|
if (inv === null) {
|
|
495
|
-
throw new (0,
|
|
495
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
496
496
|
}
|
|
497
497
|
let targets;
|
|
498
498
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
499
499
|
targets = [...defs.defaultTargets];
|
|
500
500
|
} else {
|
|
501
501
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
502
|
-
throw new (0,
|
|
502
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
503
503
|
}
|
|
504
504
|
const seen = /* @__PURE__ */ new Set();
|
|
505
505
|
for (const r of opts.resources) {
|
|
506
506
|
if (typeof r !== "string" || r.trim() === "") {
|
|
507
|
-
throw new (0,
|
|
507
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
508
508
|
}
|
|
509
509
|
const key = r.trim();
|
|
510
510
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
511
511
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
512
|
-
throw new (0,
|
|
512
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskError)(
|
|
513
513
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
514
514
|
{
|
|
515
515
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -523,7 +523,7 @@ async function probeReachability(client, opts) {
|
|
|
523
523
|
targets = [...seen];
|
|
524
524
|
}
|
|
525
525
|
if (targets.length > cap) {
|
|
526
|
-
throw new (0,
|
|
526
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
527
527
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
528
528
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
529
529
|
);
|
|
@@ -533,7 +533,7 @@ async function probeReachability(client, opts) {
|
|
|
533
533
|
for (const resource of targets.sort()) {
|
|
534
534
|
const row = byResource.get(resource);
|
|
535
535
|
if (row === void 0) continue;
|
|
536
|
-
const holder = client[
|
|
536
|
+
const holder = client[_chunkQWAWNQEZcjs.camelKey.call(void 0, resource)];
|
|
537
537
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
538
538
|
if (typeof probeFn !== "function") {
|
|
539
539
|
results.push({
|
|
@@ -552,7 +552,7 @@ async function probeReachability(client, opts) {
|
|
|
552
552
|
probe: { ok: true, wire: 1, error: null }
|
|
553
553
|
});
|
|
554
554
|
} catch (err) {
|
|
555
|
-
const code =
|
|
555
|
+
const code = _chunkQWAWNQEZcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
556
556
|
const message = err instanceof Error ? err.message : String(err);
|
|
557
557
|
results.push({
|
|
558
558
|
...row,
|
|
@@ -580,24 +580,24 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
580
580
|
async function createGuidance(client, opts) {
|
|
581
581
|
void client;
|
|
582
582
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
583
|
-
throw new (0,
|
|
583
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
584
584
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
585
585
|
);
|
|
586
586
|
}
|
|
587
|
-
let rows =
|
|
587
|
+
let rows = _chunkQWAWNQEZcjs.CREATE_GUIDANCE.rows;
|
|
588
588
|
if (_optionalChain([opts, 'optionalAccess', _9 => _9.resources]) !== void 0) {
|
|
589
589
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
590
|
-
throw new (0,
|
|
590
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
591
591
|
}
|
|
592
592
|
const wanted = /* @__PURE__ */ new Set();
|
|
593
593
|
for (const r of opts.resources) {
|
|
594
594
|
if (typeof r !== "string" || r.trim() === "") {
|
|
595
|
-
throw new (0,
|
|
595
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
596
596
|
}
|
|
597
597
|
const key = r.trim();
|
|
598
|
-
if (!
|
|
599
|
-
throw new (0,
|
|
600
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
598
|
+
if (!_chunkQWAWNQEZcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
599
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskError)(
|
|
600
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkQWAWNQEZcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
601
601
|
{
|
|
602
602
|
code: "RESOURCE_UNKNOWN",
|
|
603
603
|
category: "validation",
|
|
@@ -611,18 +611,18 @@ async function createGuidance(client, opts) {
|
|
|
611
611
|
}
|
|
612
612
|
if (_optionalChain([opts, 'optionalAccess', _10 => _10.kind]) !== void 0) {
|
|
613
613
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
614
|
-
throw new (0,
|
|
614
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
615
615
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
616
616
|
);
|
|
617
617
|
}
|
|
618
618
|
rows = rows.filter((row) => _optionalChain([row, 'access', _11 => _11.blocker, 'optionalAccess', _12 => _12.kind]) === opts.kind);
|
|
619
619
|
}
|
|
620
620
|
return {
|
|
621
|
-
zone:
|
|
622
|
-
label:
|
|
623
|
-
verifiedAt:
|
|
621
|
+
zone: _chunkQWAWNQEZcjs.CREATE_GUIDANCE.zone,
|
|
622
|
+
label: _chunkQWAWNQEZcjs.CREATE_GUIDANCE.label,
|
|
623
|
+
verifiedAt: _chunkQWAWNQEZcjs.CREATE_GUIDANCE.verifiedAt,
|
|
624
624
|
rows,
|
|
625
|
-
counts:
|
|
625
|
+
counts: _chunkQWAWNQEZcjs.CREATE_GUIDANCE.counts
|
|
626
626
|
};
|
|
627
627
|
}
|
|
628
628
|
|
|
@@ -631,7 +631,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
631
631
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
632
632
|
var RECOVERY_MAX_LIMIT = 100;
|
|
633
633
|
function configError(message, operation, suggestedAction) {
|
|
634
|
-
throw new (0,
|
|
634
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
635
635
|
}
|
|
636
636
|
function parseMatchId(record) {
|
|
637
637
|
const raw = record.id;
|
|
@@ -648,7 +648,7 @@ function parseMatchId(record) {
|
|
|
648
648
|
}
|
|
649
649
|
async function recovery(client, input, opts = {}) {
|
|
650
650
|
const operation = RECOVERY_CONFIRM;
|
|
651
|
-
if (!
|
|
651
|
+
if (!_chunkQWAWNQEZcjs.isRecord.call(void 0, input)) {
|
|
652
652
|
configError(
|
|
653
653
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
654
654
|
operation,
|
|
@@ -679,10 +679,10 @@ async function recovery(client, input, opts = {}) {
|
|
|
679
679
|
"Pass action: 'delete' for the destructive path (dry-run-first; the apply requires the confirm string)."
|
|
680
680
|
);
|
|
681
681
|
}
|
|
682
|
-
const entry =
|
|
682
|
+
const entry = _chunkQWAWNQEZcjs.RELATIONSHIP_MAP[resource];
|
|
683
683
|
if (entry === void 0) {
|
|
684
|
-
throw new (0,
|
|
685
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
684
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskError)(
|
|
685
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkQWAWNQEZcjs.RELATIONSHIP_MAP).length} resources`,
|
|
686
686
|
{
|
|
687
687
|
code: "RESOURCE_UNKNOWN",
|
|
688
688
|
category: "validation",
|
|
@@ -691,7 +691,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
691
691
|
}
|
|
692
692
|
);
|
|
693
693
|
}
|
|
694
|
-
const holder = client[
|
|
694
|
+
const holder = client[_chunkQWAWNQEZcjs.camelKey.call(void 0, resource)];
|
|
695
695
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
696
696
|
configError(
|
|
697
697
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -699,7 +699,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
699
699
|
"Use a resource with a query surface, or address the record by id directly (get/fetchMany)."
|
|
700
700
|
);
|
|
701
701
|
}
|
|
702
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
702
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkQWAWNQEZcjs.MARKER_FIELDS[resource];
|
|
703
703
|
if (typeof field !== "string" || field.trim() === "") {
|
|
704
704
|
configError(
|
|
705
705
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -735,7 +735,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
735
735
|
);
|
|
736
736
|
}
|
|
737
737
|
for (const c of input.filter) {
|
|
738
|
-
if (!
|
|
738
|
+
if (!_chunkQWAWNQEZcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
739
739
|
configError(
|
|
740
740
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
741
741
|
operation,
|
|
@@ -756,7 +756,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
756
756
|
}
|
|
757
757
|
limit = input.limit;
|
|
758
758
|
}
|
|
759
|
-
const boundaryNote =
|
|
759
|
+
const boundaryNote = _chunkQWAWNQEZcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
760
760
|
const boundary = {
|
|
761
761
|
available: boundaryNote === void 0,
|
|
762
762
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -768,7 +768,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
768
768
|
};
|
|
769
769
|
const isDelete = action === "delete";
|
|
770
770
|
if (isDelete && boundaryNote !== void 0) {
|
|
771
|
-
throw new (0,
|
|
771
|
+
throw new (0, _chunkQWAWNQEZcjs.DeleteBoundaryError)(
|
|
772
772
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
773
773
|
{
|
|
774
774
|
operation,
|
|
@@ -780,7 +780,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
780
780
|
const dryRun = _optionalChain([opts, 'optionalAccess', _13 => _13.dryRun]) !== false;
|
|
781
781
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _14 => _14.confirm]), () => ( input.confirm));
|
|
782
782
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
783
|
-
throw new (0,
|
|
783
|
+
throw new (0, _chunkQWAWNQEZcjs.ConfirmationRequiredError)(
|
|
784
784
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
785
785
|
{
|
|
786
786
|
operation: RECOVERY_CONFIRM,
|
|
@@ -796,7 +796,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
796
796
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
797
797
|
if (query.hasMore) {
|
|
798
798
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
799
|
-
throw new (0,
|
|
799
|
+
throw new (0, _chunkQWAWNQEZcjs.RecoveryTruncatedError)(
|
|
800
800
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
801
801
|
{
|
|
802
802
|
operation,
|
|
@@ -835,7 +835,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
835
835
|
return { ...base, simulated: true, dryRun: true };
|
|
836
836
|
}
|
|
837
837
|
if (unsafeId) {
|
|
838
|
-
throw new (0,
|
|
838
|
+
throw new (0, _chunkQWAWNQEZcjs.MarkerUnsafeIdError)(
|
|
839
839
|
`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)`,
|
|
840
840
|
{
|
|
841
841
|
operation,
|
|
@@ -846,7 +846,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
846
846
|
}
|
|
847
847
|
const deleteMethod = holder.delete;
|
|
848
848
|
if (deleteMethod === void 0) {
|
|
849
|
-
throw new (0,
|
|
849
|
+
throw new (0, _chunkQWAWNQEZcjs.DeleteBoundaryError)(
|
|
850
850
|
`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`,
|
|
851
851
|
{
|
|
852
852
|
operation,
|
|
@@ -875,14 +875,14 @@ async function recovery(client, input, opts = {}) {
|
|
|
875
875
|
verify = "still-present";
|
|
876
876
|
}
|
|
877
877
|
} catch (err) {
|
|
878
|
-
if (err instanceof
|
|
878
|
+
if (err instanceof _chunkQWAWNQEZcjs.NotFoundError) verify = "not-found";
|
|
879
879
|
else {
|
|
880
880
|
verify = "error";
|
|
881
|
-
code =
|
|
881
|
+
code = _chunkQWAWNQEZcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
} catch (err) {
|
|
885
|
-
code =
|
|
885
|
+
code = _chunkQWAWNQEZcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
886
886
|
}
|
|
887
887
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
888
888
|
}
|
|
@@ -890,13 +890,13 @@ async function recovery(client, input, opts = {}) {
|
|
|
890
890
|
}
|
|
891
891
|
|
|
892
892
|
// src/operations/invoke.ts
|
|
893
|
-
var RECORDS =
|
|
893
|
+
var RECORDS = _chunkCBUY3MKBcjs.CAPABILITIES;
|
|
894
894
|
var byId = new Map(RECORDS.map((r) => [r.id, r]));
|
|
895
895
|
function needsConfirmation(record) {
|
|
896
896
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
897
897
|
}
|
|
898
898
|
function refuse(message, operation, suggestedAction) {
|
|
899
|
-
throw new (0,
|
|
899
|
+
throw new (0, _chunkQWAWNQEZcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
900
900
|
}
|
|
901
901
|
var MODE_BY_EFFECT = {
|
|
902
902
|
read: "read",
|
|
@@ -940,7 +940,7 @@ function looseTypeOk(type, value) {
|
|
|
940
940
|
case "string[]":
|
|
941
941
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
942
942
|
case "object":
|
|
943
|
-
return
|
|
943
|
+
return _chunkQWAWNQEZcjs.isRecord.call(void 0, value);
|
|
944
944
|
default:
|
|
945
945
|
return true;
|
|
946
946
|
}
|
|
@@ -957,7 +957,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
957
957
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
958
958
|
const names = Object.keys(schema);
|
|
959
959
|
if (args.length > names.length) {
|
|
960
|
-
throw new (0,
|
|
960
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
961
961
|
`invoke: "${operation}" declares ${names.length} positional arg(s) (${declaredArgList(record)}) but ${args.length} were passed \u2014 extra args are refused, not dropped (v0.2.0 silently dropped them)`,
|
|
962
962
|
{
|
|
963
963
|
operation,
|
|
@@ -967,7 +967,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
967
967
|
}
|
|
968
968
|
const required = names.filter((n) => schema[n].required);
|
|
969
969
|
if (args.length < required.length) {
|
|
970
|
-
throw new (0,
|
|
970
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
971
971
|
`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)}`,
|
|
972
972
|
{ operation }
|
|
973
973
|
);
|
|
@@ -978,7 +978,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
978
978
|
const name = names[i];
|
|
979
979
|
const spec = schema[name];
|
|
980
980
|
if (!looseTypeOk(spec.type, value)) {
|
|
981
|
-
throw new (0,
|
|
981
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
982
982
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
983
983
|
{ operation }
|
|
984
984
|
);
|
|
@@ -1038,11 +1038,11 @@ function validateParamsBag(record, args) {
|
|
|
1038
1038
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1039
1039
|
if (valid === void 0) return;
|
|
1040
1040
|
const bag = _optionalChain([args, 'optionalAccess', _15 => _15[0]]);
|
|
1041
|
-
if (bag === void 0 || bag === null || !
|
|
1041
|
+
if (bag === void 0 || bag === null || !_chunkQWAWNQEZcjs.isRecord.call(void 0, bag)) return;
|
|
1042
1042
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1043
1043
|
if (unknown.length === 0) return;
|
|
1044
1044
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1045
|
-
throw new (0,
|
|
1045
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1046
1046
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1047
1047
|
{
|
|
1048
1048
|
operation: record.id,
|
|
@@ -1062,7 +1062,7 @@ async function liveFieldNames(holder) {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
return names.length > 0 ? names : null;
|
|
1064
1064
|
} catch (err) {
|
|
1065
|
-
if (!
|
|
1065
|
+
if (!_chunkQWAWNQEZcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
|
|
1066
1066
|
return null;
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
@@ -1077,7 +1077,7 @@ function collectFilterFieldNames(conditions) {
|
|
|
1077
1077
|
const out = [];
|
|
1078
1078
|
const walk = (conds) => {
|
|
1079
1079
|
for (const cond of conds) {
|
|
1080
|
-
if (!
|
|
1080
|
+
if (!_chunkQWAWNQEZcjs.isRecord.call(void 0, cond)) continue;
|
|
1081
1081
|
if (cond.op === "and" || cond.op === "or") {
|
|
1082
1082
|
if (Array.isArray(cond.items)) walk(cond.items);
|
|
1083
1083
|
continue;
|
|
@@ -1091,10 +1091,10 @@ function collectFilterFieldNames(conditions) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
async function validateQueryFieldNames(record, holder, args) {
|
|
1093
1093
|
const bag = args[0];
|
|
1094
|
-
if (!
|
|
1094
|
+
if (!_chunkQWAWNQEZcjs.isRecord.call(void 0, bag)) return;
|
|
1095
1095
|
const fieldCheck = bag["fieldCheck"];
|
|
1096
1096
|
if (fieldCheck !== void 0 && typeof fieldCheck !== "boolean") {
|
|
1097
|
-
throw new (0,
|
|
1097
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1098
1098
|
`invoke: "${record.id}" params bag fieldCheck must be a boolean (got ${typeof fieldCheck}) \u2014 the request was not issued`,
|
|
1099
1099
|
{ operation: record.id, suggestedAction: "Pass fieldCheck: true (default) or fieldCheck: false (disable the field-name checks \u2014 includeFields AND filter condition names)." }
|
|
1100
1100
|
);
|
|
@@ -1114,7 +1114,7 @@ async function validateQueryFieldNames(record, holder, args) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
}
|
|
1116
1116
|
if (!shapeOk) {
|
|
1117
|
-
throw new (0,
|
|
1117
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1118
1118
|
`invoke: "${record.id}" params bag includeFields must be an array of non-empty field-name strings \u2014 the request was not issued`,
|
|
1119
1119
|
{
|
|
1120
1120
|
operation: record.id,
|
|
@@ -1126,7 +1126,7 @@ async function validateQueryFieldNames(record, holder, args) {
|
|
|
1126
1126
|
}
|
|
1127
1127
|
let filterNames;
|
|
1128
1128
|
if (bag["filter"] !== void 0) {
|
|
1129
|
-
const conditions =
|
|
1129
|
+
const conditions = _chunkQWAWNQEZcjs.normalizedConditions.call(void 0, bag["filter"]);
|
|
1130
1130
|
filterNames = collectFilterFieldNames(_nullishCoalesce(conditions, () => ( [])));
|
|
1131
1131
|
}
|
|
1132
1132
|
if (fieldCheck === false) return;
|
|
@@ -1139,7 +1139,7 @@ async function validateQueryFieldNames(record, holder, args) {
|
|
|
1139
1139
|
if (live !== null) {
|
|
1140
1140
|
known = live;
|
|
1141
1141
|
} else {
|
|
1142
|
-
const vendored =
|
|
1142
|
+
const vendored = _chunkQWAWNQEZcjs.MODEL_FIELD_SETS[record.resource];
|
|
1143
1143
|
liveOnlyExempt = Array.isArray(_optionalChain([record, 'access', _16 => _16.metadata, 'optionalAccess', _17 => _17.liveOnlyFields])) ? record.metadata.liveOnlyFields : [];
|
|
1144
1144
|
known = vendored === void 0 ? void 0 : [...vendored, ...liveOnlyExempt];
|
|
1145
1145
|
}
|
|
@@ -1152,7 +1152,7 @@ async function validateQueryFieldNames(record, holder, args) {
|
|
|
1152
1152
|
if (unknownInclude.length > 0) parts.push(`includeFields has unknown field name(s) ${formatUnknownNameList(unknownInclude)}`);
|
|
1153
1153
|
if (unknownFilter.length > 0) parts.push(`filter condition(s) carry unknown field name(s) ${formatUnknownNameList(unknownFilter)}`);
|
|
1154
1154
|
const wireClause = record.operation === "count" ? "the count request was not issued" : "the query POST was not issued";
|
|
1155
|
-
throw new (0,
|
|
1155
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1156
1156
|
`invoke: "${record.id}" ${parts.join("; ")} against ${authority} \u2014 ${wireClause}`,
|
|
1157
1157
|
{
|
|
1158
1158
|
operation: record.id,
|
|
@@ -1166,7 +1166,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1166
1166
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1167
1167
|
if (unknown.length === 0) return;
|
|
1168
1168
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1169
|
-
throw new (0,
|
|
1169
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1170
1170
|
`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)`,
|
|
1171
1171
|
{
|
|
1172
1172
|
operation,
|
|
@@ -1179,7 +1179,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1179
1179
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1180
1180
|
if (unknown.length === 0) return null;
|
|
1181
1181
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1182
|
-
return new (0,
|
|
1182
|
+
return new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1183
1183
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1184
1184
|
{
|
|
1185
1185
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1191,7 +1191,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1191
1191
|
const args = _nullishCoalesce(argsIn, () => ( []));
|
|
1192
1192
|
const record = byId.get(operation);
|
|
1193
1193
|
if (record === void 0) {
|
|
1194
|
-
throw new (0,
|
|
1194
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1195
1195
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1196
1196
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1197
1197
|
);
|
|
@@ -1199,17 +1199,17 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1199
1199
|
validateInvokeOptions(opts, operation);
|
|
1200
1200
|
const mode = opts.mode;
|
|
1201
1201
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1202
|
-
throw new (0,
|
|
1202
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1203
1203
|
}
|
|
1204
1204
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1205
|
-
throw new (0,
|
|
1205
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1206
1206
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1207
1207
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1208
1208
|
);
|
|
1209
1209
|
}
|
|
1210
1210
|
const isWrite = record.effect !== "read";
|
|
1211
1211
|
if (!isWrite && opts.dryRun === true) {
|
|
1212
|
-
throw new (0,
|
|
1212
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1213
1213
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1214
1214
|
{ operation }
|
|
1215
1215
|
);
|
|
@@ -1225,15 +1225,15 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1225
1225
|
validateParamsBag(record, args);
|
|
1226
1226
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1227
1227
|
const countedQuery = record.kind === "primitive" && record.operation === "count";
|
|
1228
|
-
let holder = client[
|
|
1228
|
+
let holder = client[_chunkQWAWNQEZcjs.camelKey.call(void 0, record.resource)];
|
|
1229
1229
|
if (typeof holder === "function") {
|
|
1230
|
-
holder = _nullishCoalesce(client[`${
|
|
1230
|
+
holder = _nullishCoalesce(client[`${_chunkQWAWNQEZcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
|
|
1231
1231
|
}
|
|
1232
1232
|
if (holder === void 0 && record.resource === "operations") {
|
|
1233
1233
|
holder = {
|
|
1234
1234
|
resolveAny: (identifier, opts2) => resolveAny(client, identifier, opts2),
|
|
1235
1235
|
searchAcrossResources: (query, opts2) => searchAcrossResources(client, query, opts2),
|
|
1236
|
-
fetchMany: (items, opts2) =>
|
|
1236
|
+
fetchMany: (items, opts2) => _chunkQWAWNQEZcjs.fetchMany.call(void 0, client, items, opts2),
|
|
1237
1237
|
// Issue #62: the generic aggregate + the cheap count — the
|
|
1238
1238
|
// groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
|
|
1239
1239
|
// sentinel rides through); the group/sum modes walk the named
|
|
@@ -1243,12 +1243,12 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1243
1243
|
// Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
|
|
1244
1244
|
// reads + the per-id `get` fallback (blind-surface-safe; per-item
|
|
1245
1245
|
// typed outcomes reuse the fetchMany shapes).
|
|
1246
|
-
fetchByIds: (items, opts2) =>
|
|
1246
|
+
fetchByIds: (items, opts2) => _chunkQWAWNQEZcjs.fetchByIds.call(void 0, client, items, opts2),
|
|
1247
1247
|
// Issue #65: opt-in resource name expansion — per-id resources.get
|
|
1248
1248
|
// reads ONLY (never an id-in query — the resources table can be blind
|
|
1249
1249
|
// to count/query while per-id reads work); blind-marked rows for ids
|
|
1250
1250
|
// the API user cannot resolve; the name cache (default-on).
|
|
1251
|
-
expandResourceNames: (ids, opts2) =>
|
|
1251
|
+
expandResourceNames: (ids, opts2) => _chunkQWAWNQEZcjs.expandResourceNames.call(void 0, client, ids, opts2),
|
|
1252
1252
|
relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
|
|
1253
1253
|
// Issue #11: the served blind-surface inventory (zero wire) + the
|
|
1254
1254
|
// bounded caller-opted reachability sweep (read-only, confirmProbe-
|
|
@@ -1261,7 +1261,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1261
1261
|
// entityInformation GETs (the op's own cap refuses over-cap fan-outs
|
|
1262
1262
|
// pre-request; per-resource failures are recorded on the row and
|
|
1263
1263
|
// never abort the call).
|
|
1264
|
-
fieldCatalog: (opts2) =>
|
|
1264
|
+
fieldCatalog: (opts2) => _chunkQWAWNQEZcjs.fieldCatalog.call(void 0, client, opts2),
|
|
1265
1265
|
// Issue #9: the one-call recovery/cleanup op — effect write in the
|
|
1266
1266
|
// registry (the governor's dry-run-first applies to it); the op's own
|
|
1267
1267
|
// confirm gate makes the destructive action deliberate (the governor
|
|
@@ -1270,7 +1270,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1270
1270
|
};
|
|
1271
1271
|
}
|
|
1272
1272
|
if (holder === void 0) {
|
|
1273
|
-
throw new (0,
|
|
1273
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1274
1274
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1275
1275
|
{ operation }
|
|
1276
1276
|
);
|
|
@@ -1279,7 +1279,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1279
1279
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1280
1280
|
const method = holder[methodName];
|
|
1281
1281
|
if (typeof method !== "function") {
|
|
1282
|
-
throw new (0,
|
|
1282
|
+
throw new (0, _chunkQWAWNQEZcjs.AutotaskConfigError)(
|
|
1283
1283
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1284
1284
|
{ operation }
|
|
1285
1285
|
);
|
|
@@ -1386,4 +1386,4 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1386
1386
|
|
|
1387
1387
|
|
|
1388
1388
|
|
|
1389
|
-
exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.EXPAND_RESOURCE_NAMES_MAX_IDS =
|
|
1389
|
+
exports.AGGREGATE_DATE_BUCKETS = AGGREGATE_DATE_BUCKETS; exports.AGGREGATE_DEFAULT_LIMIT = AGGREGATE_DEFAULT_LIMIT; exports.AGGREGATE_DEFAULT_TOP = AGGREGATE_DEFAULT_TOP; exports.AGGREGATE_TOP_MAX = AGGREGATE_TOP_MAX; exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = _chunkQWAWNQEZcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkQWAWNQEZcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkQWAWNQEZcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkQWAWNQEZcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkQWAWNQEZcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkQWAWNQEZcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkQWAWNQEZcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkQWAWNQEZcjs.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.WORKFLOW_RESOURCES = _chunkQWAWNQEZcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.expandResourceNames = _chunkQWAWNQEZcjs.expandResourceNames; exports.fetchByIds = _chunkQWAWNQEZcjs.fetchByIds; exports.fetchMany = _chunkQWAWNQEZcjs.fetchMany; exports.fieldCatalog = _chunkQWAWNQEZcjs.fieldCatalog; exports.invoke = invoke; exports.invokeDelete = invokeDelete; exports.invokeRead = invokeRead; exports.invokeWrite = invokeWrite; exports.needsConfirmation = needsConfirmation; exports.probeReachability = probeReachability; exports.recovery = recovery; exports.relationshipMap = relationshipMap; exports.resolveAny = resolveAny; exports.searchAcrossResources = searchAcrossResources; exports.unknownKeysRefusal = unknownKeysRefusal; exports.validateDispatchArgs = validateDispatchArgs; exports.validateFetchManyItems = _chunkQWAWNQEZcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|