node-autotask 0.16.0 → 0.18.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.
Files changed (40) hide show
  1. package/ARCHITECTURE.md +10 -4
  2. package/MCP_TOOL_CATALOG.json +2 -2
  3. package/MCP_TOOL_MANIFEST.md +4 -4
  4. package/N8N_MCP_MANIFEST.json +2 -2
  5. package/N8N_MCP_MANIFEST.md +3 -3
  6. package/README.md +36 -0
  7. package/capabilities.json +1571 -1571
  8. package/dist/capabilities.cjs +2 -2
  9. package/dist/capabilities.js +1 -1
  10. package/dist/{chunk-EWMG3HHU.cjs → chunk-5O5EPYBO.cjs} +1570 -1570
  11. package/dist/{chunk-L3TK4CN5.cjs → chunk-7I3F3AJJ.cjs} +429 -419
  12. package/dist/{chunk-VCGC6YCI.cjs → chunk-G564CHXM.cjs} +135 -135
  13. package/dist/{chunk-NB254T3F.js → chunk-HXOWEYV3.js} +49 -39
  14. package/dist/{chunk-JIDR3NPV.js → chunk-VV2UUW2J.js} +1570 -1570
  15. package/dist/{chunk-U6JUHHMB.js → chunk-VYUZZIEE.js} +66 -32
  16. package/dist/{chunk-GWALLMAM.js → chunk-W2WSZOZA.js} +2 -2
  17. package/dist/{chunk-MAYYTYV5.cjs → chunk-WRWX6WIK.cjs} +68 -34
  18. package/dist/{index-CUsvZndu.d.ts → index-BqPY04ZG.d.ts} +89 -16
  19. package/dist/{index-leMyBJze.d.cts → index-D7x3MkLK.d.cts} +89 -16
  20. package/dist/index.cjs +24 -22
  21. package/dist/index.d.cts +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +6 -4
  24. package/dist/operations/index.cjs +178 -105
  25. package/dist/operations/index.d.cts +22 -7
  26. package/dist/operations/index.d.ts +22 -7
  27. package/dist/operations/index.js +77 -4
  28. package/dist/pool.cjs +8 -8
  29. package/dist/pool.d.cts +1 -1
  30. package/dist/pool.d.ts +1 -1
  31. package/dist/pool.js +4 -4
  32. package/dist/resources/index.cjs +4 -4
  33. package/dist/resources/index.d.cts +1 -1
  34. package/dist/resources/index.d.ts +1 -1
  35. package/dist/resources/index.js +3 -3
  36. package/docs/API.md +78 -15
  37. package/examples/basic.ts +2 -2
  38. package/examples/mcp-server-http.ts +5 -4
  39. package/examples/mcp-server.ts +3 -3
  40. package/package.json +3 -2
@@ -36,26 +36,26 @@
36
36
 
37
37
 
38
38
 
39
- var _chunkMAYYTYV5cjs = require('../chunk-MAYYTYV5.cjs');
39
+ var _chunkWRWX6WIKcjs = require('../chunk-WRWX6WIK.cjs');
40
40
 
41
41
 
42
- var _chunkEWMG3HHUcjs = require('../chunk-EWMG3HHU.cjs');
42
+ var _chunk5O5EPYBOcjs = require('../chunk-5O5EPYBO.cjs');
43
43
 
44
44
  // src/operations/searchAcrossResources.ts
45
45
  var DEFAULT_LIMIT = 25;
46
46
  function resourceFor(client, key) {
47
- return client[_chunkMAYYTYV5cjs.camelKey.call(void 0, key)];
47
+ return client[_chunkWRWX6WIKcjs.camelKey.call(void 0, key)];
48
48
  }
49
49
  async function searchAcrossResources(client, query, opts = {}) {
50
50
  const text = query.trim();
51
51
  if (text === "") {
52
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
52
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
53
53
  }
54
- const keys = _nullishCoalesce(opts.resources, () => ( _chunkMAYYTYV5cjs.WORKFLOW_RESOURCES));
54
+ const keys = _nullishCoalesce(opts.resources, () => ( _chunkWRWX6WIKcjs.WORKFLOW_RESOURCES));
55
55
  if (keys.length === 0) {
56
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
56
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
57
57
  }
58
- const limit = _chunkMAYYTYV5cjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
58
+ const limit = _chunkWRWX6WIKcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
59
59
  const results = [];
60
60
  const skipped = [];
61
61
  for (const key of keys) {
@@ -73,7 +73,7 @@ async function searchAcrossResources(client, query, opts = {}) {
73
73
 
74
74
  // src/operations/resolveAny.ts
75
75
  function resourceFor2(client, key) {
76
- return client[_chunkMAYYTYV5cjs.camelKey.call(void 0, key)];
76
+ return client[_chunkWRWX6WIKcjs.camelKey.call(void 0, key)];
77
77
  }
78
78
  var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
79
79
  function missCost(identifier) {
@@ -82,13 +82,13 @@ function missCost(identifier) {
82
82
  }
83
83
  async function resolveAny(client, identifier, opts = {}) {
84
84
  if (typeof identifier === "number") {
85
- _chunkMAYYTYV5cjs.parseIdentifier.call(void 0, identifier, "identifier");
85
+ _chunkWRWX6WIKcjs.parseIdentifier.call(void 0, identifier, "identifier");
86
86
  } else if (identifier.trim() === "") {
87
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
87
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
88
88
  }
89
- const keys = _nullishCoalesce(opts.resources, () => ( _chunkMAYYTYV5cjs.WORKFLOW_RESOURCES));
89
+ const keys = _nullishCoalesce(opts.resources, () => ( _chunkWRWX6WIKcjs.WORKFLOW_RESOURCES));
90
90
  if (keys.length === 0) {
91
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("resolveAny: no resources requested");
91
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("resolveAny: no resources requested");
92
92
  }
93
93
  const results = [];
94
94
  for (const key of keys) {
@@ -118,9 +118,9 @@ async function resolveAny(client, identifier, opts = {}) {
118
118
  } catch (err) {
119
119
  let code;
120
120
  let candidates = [];
121
- if (err instanceof _chunkMAYYTYV5cjs.AutotaskConfigError) {
121
+ if (err instanceof _chunkWRWX6WIKcjs.AutotaskConfigError) {
122
122
  code = "CONFIG_ERROR";
123
- } else if (_chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err)) {
123
+ } else if (_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err)) {
124
124
  if (FAULT_CATEGORIES.has(err.category)) throw err;
125
125
  code = err.code;
126
126
  if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
@@ -147,7 +147,7 @@ async function resolveAny(client, identifier, opts = {}) {
147
147
  // src/operations/aggregate.ts
148
148
  var AGGREGATE_TOP_MAX = 100;
149
149
  var AGGREGATE_DEFAULT_TOP = 25;
150
- var AGGREGATE_DEFAULT_LIMIT = _chunkMAYYTYV5cjs.BOUNDED_QUERY_MAX_LIMIT;
150
+ var AGGREGATE_DEFAULT_LIMIT = _chunkWRWX6WIKcjs.BOUNDED_QUERY_MAX_LIMIT;
151
151
  var AGGREGATE_DATE_BUCKETS = ["month", "week", "year"];
152
152
  var DATE_ONLY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
153
153
  var DATETIME_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d{1,9})?(Z|[+-]\d{2}:?\d{2})?$/;
@@ -204,7 +204,7 @@ function dateBucketLabel(value, bucket) {
204
204
  }
205
205
  var QUERY_RESOURCE_KEYS = (() => {
206
206
  const s = /* @__PURE__ */ new Set();
207
- for (const rec of _chunkEWMG3HHUcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
207
+ for (const rec of _chunk5O5EPYBOcjs.CAPABILITIES) if (rec.operation === "query") s.add(rec.resource);
208
208
  return s;
209
209
  })();
210
210
  var AGGREGATE_OPT_KEYS = ["groupBy", "sum", "top", "limit"];
@@ -239,14 +239,14 @@ function validateAggregate(operation, filter, opts) {
239
239
  conditions = [];
240
240
  } else {
241
241
  try {
242
- conditions = _chunkMAYYTYV5cjs.buildFilter.call(void 0, conds).filter;
242
+ conditions = _chunkWRWX6WIKcjs.buildFilter.call(void 0, conds).filter;
243
243
  } catch (err) {
244
- problems.push(err instanceof _chunkMAYYTYV5cjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
244
+ problems.push(err instanceof _chunkWRWX6WIKcjs.AutotaskConfigError ? err.message : `filter must be the query-bag filter (13 operators; caps 500 OR-conditions / 1 UDF / 8000 chars); ${String(err)}`);
245
245
  }
246
246
  }
247
247
  }
248
248
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
249
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
249
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
250
250
  `aggregate: opts must be the options object (got ${Array.isArray(opts) ? "an array" : typeof opts})`,
251
251
  { operation: "operations.aggregate" }
252
252
  );
@@ -256,8 +256,8 @@ function validateAggregate(operation, filter, opts) {
256
256
  problems.push(`unknown opts key "${key}" \u2014 the bag is closed: ${AGGREGATE_OPT_KEYS.join(", ")}`);
257
257
  }
258
258
  }
259
- const fieldSets = resourceKey !== void 0 ? _chunkMAYYTYV5cjs.MODEL_FIELD_SETS[resourceKey] : void 0;
260
- const dateSets = resourceKey !== void 0 ? _chunkMAYYTYV5cjs.MODEL_DATE_FIELDS[resourceKey] : void 0;
259
+ const fieldSets = resourceKey !== void 0 ? _chunkWRWX6WIKcjs.MODEL_FIELD_SETS[resourceKey] : void 0;
260
+ const dateSets = resourceKey !== void 0 ? _chunkWRWX6WIKcjs.MODEL_DATE_FIELDS[resourceKey] : void 0;
261
261
  const checkFields = (name, fields) => {
262
262
  if (fields === void 0) return [];
263
263
  if (!Array.isArray(fields) || fields.length === 0 || fields.some((f) => typeof f !== "string" || f.trim() === "")) {
@@ -321,11 +321,11 @@ function validateAggregate(operation, filter, opts) {
321
321
  if (!Number.isInteger(opts.limit)) {
322
322
  problems.push(`limit must be an integer (got ${String(opts.limit)})`);
323
323
  } else {
324
- limit = Math.min(Math.max(opts.limit, 1), _chunkMAYYTYV5cjs.BOUNDED_QUERY_MAX_LIMIT);
324
+ limit = Math.min(Math.max(opts.limit, 1), _chunkWRWX6WIKcjs.BOUNDED_QUERY_MAX_LIMIT);
325
325
  }
326
326
  }
327
327
  if (problems.length > 0) {
328
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
328
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
329
329
  `aggregate: ${problems.length} problem(s) found pre-request (zero wire was issued)
330
330
  - ` + problems.join("\n- "),
331
331
  { operation: "operations.aggregate" }
@@ -335,9 +335,9 @@ function validateAggregate(operation, filter, opts) {
335
335
  }
336
336
  async function aggregate(client, operation, filter, opts = {}) {
337
337
  const v = validateAggregate(operation, filter, opts);
338
- const holder = client[_chunkMAYYTYV5cjs.camelKey.call(void 0, v.resourceKey)];
338
+ const holder = client[_chunkWRWX6WIKcjs.camelKey.call(void 0, v.resourceKey)];
339
339
  if (holder === void 0) {
340
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
340
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`aggregate: the client exposes no accessor for resource "${v.resourceKey}"`, {
341
341
  operation: "operations.aggregate",
342
342
  suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
343
343
  });
@@ -392,20 +392,20 @@ async function aggregate(client, operation, filter, opts = {}) {
392
392
  async function relationshipMap(client, resourceKey) {
393
393
  void client;
394
394
  if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
395
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
395
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
396
396
  `relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
397
397
  { suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
398
398
  );
399
399
  }
400
400
  const key = resourceKey.trim();
401
- const entry = _chunkMAYYTYV5cjs.RELATIONSHIP_MAP[key];
401
+ const entry = _chunkWRWX6WIKcjs.RELATIONSHIP_MAP[key];
402
402
  if (entry === void 0) {
403
- throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
404
- `relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkMAYYTYV5cjs.RELATIONSHIP_MAP).length} resources`,
403
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
404
+ `relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkWRWX6WIKcjs.RELATIONSHIP_MAP).length} resources`,
405
405
  {
406
406
  code: "RESOURCE_UNKNOWN",
407
407
  category: "validation",
408
- suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkMAYYTYV5cjs.RELATIONSHIP_ZONE.label} (${_chunkMAYYTYV5cjs.RELATIONSHIP_ZONE.zone})-verified.`
408
+ suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkWRWX6WIKcjs.RELATIONSHIP_ZONE.label} (${_chunkWRWX6WIKcjs.RELATIONSHIP_ZONE.zone})-verified.`
409
409
  }
410
410
  );
411
411
  }
@@ -422,24 +422,24 @@ var BLIND_SURFACE_KINDS = [
422
422
  async function blindSurfaces(client, opts) {
423
423
  void client;
424
424
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
425
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
425
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
426
426
  }
427
- const inv = _chunkMAYYTYV5cjs.BLIND_SURFACE_INVENTORY;
427
+ const inv = _chunkWRWX6WIKcjs.BLIND_SURFACE_INVENTORY;
428
428
  if (inv === null) {
429
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
429
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
430
430
  }
431
431
  let surfaces = inv.surfaces;
432
432
  if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
433
433
  const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
434
434
  if (key === "") {
435
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
435
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
436
436
  "blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
437
437
  { suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
438
438
  );
439
439
  }
440
440
  if (!inv.surfaces.some((row) => row.resource === key)) {
441
- throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
442
- `blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkMAYYTYV5cjs.RELATIONSHIP_MAP).length} resources`,
441
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
442
+ `blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkWRWX6WIKcjs.RELATIONSHIP_MAP).length} resources`,
443
443
  {
444
444
  code: "RESOURCE_UNKNOWN",
445
445
  category: "validation",
@@ -451,7 +451,7 @@ async function blindSurfaces(client, opts) {
451
451
  }
452
452
  if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
453
453
  if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
454
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
454
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
455
455
  `blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
456
456
  { suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
457
457
  );
@@ -464,51 +464,51 @@ async function blindSurfaces(client, opts) {
464
464
  // src/operations/probeReachability.ts
465
465
  async function probeReachability(client, opts) {
466
466
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
467
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
467
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
468
468
  }
469
- const defs = _chunkMAYYTYV5cjs.REACHABILITY_PROBE_DEFAULTS;
469
+ const defs = _chunkWRWX6WIKcjs.REACHABILITY_PROBE_DEFAULTS;
470
470
  if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
471
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
471
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
472
472
  "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",
473
473
  { suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
474
474
  );
475
475
  }
476
476
  const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
477
477
  if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
478
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
478
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
479
479
  `probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
480
480
  );
481
481
  }
482
482
  const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
483
483
  if (!Number.isInteger(cap) || cap < 1) {
484
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
484
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
485
485
  }
486
486
  if (cap > defs.hardCap) {
487
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
487
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
488
488
  `probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
489
489
  { suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
490
490
  );
491
491
  }
492
- const inv = _chunkMAYYTYV5cjs.BLIND_SURFACE_INVENTORY;
492
+ const inv = _chunkWRWX6WIKcjs.BLIND_SURFACE_INVENTORY;
493
493
  if (inv === null) {
494
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
494
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
495
495
  }
496
496
  let targets;
497
497
  if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
498
498
  targets = [...defs.defaultTargets];
499
499
  } else {
500
500
  if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
501
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
501
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
502
502
  }
503
503
  const seen = /* @__PURE__ */ new Set();
504
504
  for (const r of opts.resources) {
505
505
  if (typeof r !== "string" || r.trim() === "") {
506
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
506
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
507
507
  }
508
508
  const key = r.trim();
509
509
  if (!inv.surfaces.some((row) => row.resource === key)) {
510
510
  const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
511
- throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
511
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
512
512
  `probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
513
513
  {
514
514
  code: "RESOURCE_UNKNOWN",
@@ -522,7 +522,7 @@ async function probeReachability(client, opts) {
522
522
  targets = [...seen];
523
523
  }
524
524
  if (targets.length > cap) {
525
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
525
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
526
526
  `probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
527
527
  { suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
528
528
  );
@@ -532,7 +532,7 @@ async function probeReachability(client, opts) {
532
532
  for (const resource of targets.sort()) {
533
533
  const row = byResource.get(resource);
534
534
  if (row === void 0) continue;
535
- const holder = client[_chunkMAYYTYV5cjs.camelKey.call(void 0, resource)];
535
+ const holder = client[_chunkWRWX6WIKcjs.camelKey.call(void 0, resource)];
536
536
  const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
537
537
  if (typeof probeFn !== "function") {
538
538
  results.push({
@@ -551,7 +551,7 @@ async function probeReachability(client, opts) {
551
551
  probe: { ok: true, wire: 1, error: null }
552
552
  });
553
553
  } catch (err) {
554
- const code = _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
554
+ const code = _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
555
555
  const message = err instanceof Error ? err.message : String(err);
556
556
  results.push({
557
557
  ...row,
@@ -579,24 +579,24 @@ var CREATE_BLOCKER_KINDS = [
579
579
  async function createGuidance(client, opts) {
580
580
  void client;
581
581
  if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
582
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
582
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
583
583
  "createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
584
584
  );
585
585
  }
586
- let rows = _chunkMAYYTYV5cjs.CREATE_GUIDANCE.rows;
586
+ let rows = _chunkWRWX6WIKcjs.CREATE_GUIDANCE.rows;
587
587
  if (_optionalChain([opts, 'optionalAccess', _9 => _9.resources]) !== void 0) {
588
588
  if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
589
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
589
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
590
590
  }
591
591
  const wanted = /* @__PURE__ */ new Set();
592
592
  for (const r of opts.resources) {
593
593
  if (typeof r !== "string" || r.trim() === "") {
594
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
594
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
595
595
  }
596
596
  const key = r.trim();
597
- if (!_chunkMAYYTYV5cjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
598
- throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
599
- `createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkMAYYTYV5cjs.CREATE_GUIDANCE.rows.length} create entities`,
597
+ if (!_chunkWRWX6WIKcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
598
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
599
+ `createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkWRWX6WIKcjs.CREATE_GUIDANCE.rows.length} create entities`,
600
600
  {
601
601
  code: "RESOURCE_UNKNOWN",
602
602
  category: "validation",
@@ -610,18 +610,18 @@ async function createGuidance(client, opts) {
610
610
  }
611
611
  if (_optionalChain([opts, 'optionalAccess', _10 => _10.kind]) !== void 0) {
612
612
  if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
613
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
613
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
614
614
  `createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
615
615
  );
616
616
  }
617
617
  rows = rows.filter((row) => _optionalChain([row, 'access', _11 => _11.blocker, 'optionalAccess', _12 => _12.kind]) === opts.kind);
618
618
  }
619
619
  return {
620
- zone: _chunkMAYYTYV5cjs.CREATE_GUIDANCE.zone,
621
- label: _chunkMAYYTYV5cjs.CREATE_GUIDANCE.label,
622
- verifiedAt: _chunkMAYYTYV5cjs.CREATE_GUIDANCE.verifiedAt,
620
+ zone: _chunkWRWX6WIKcjs.CREATE_GUIDANCE.zone,
621
+ label: _chunkWRWX6WIKcjs.CREATE_GUIDANCE.label,
622
+ verifiedAt: _chunkWRWX6WIKcjs.CREATE_GUIDANCE.verifiedAt,
623
623
  rows,
624
- counts: _chunkMAYYTYV5cjs.CREATE_GUIDANCE.counts
624
+ counts: _chunkWRWX6WIKcjs.CREATE_GUIDANCE.counts
625
625
  };
626
626
  }
627
627
 
@@ -630,7 +630,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
630
630
  var RECOVERY_DEFAULT_LIMIT = 25;
631
631
  var RECOVERY_MAX_LIMIT = 100;
632
632
  function configError(message, operation, suggestedAction) {
633
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(message, { operation, suggestedAction });
633
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(message, { operation, suggestedAction });
634
634
  }
635
635
  function parseMatchId(record) {
636
636
  const raw = record.id;
@@ -647,7 +647,7 @@ function parseMatchId(record) {
647
647
  }
648
648
  async function recovery(client, input, opts = {}) {
649
649
  const operation = RECOVERY_CONFIRM;
650
- if (!_chunkMAYYTYV5cjs.isRecord.call(void 0, input)) {
650
+ if (!_chunkWRWX6WIKcjs.isRecord.call(void 0, input)) {
651
651
  configError(
652
652
  `recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
653
653
  operation,
@@ -678,10 +678,10 @@ async function recovery(client, input, opts = {}) {
678
678
  "Pass action: 'delete' for the destructive path (dry-run-first; the apply requires the confirm string)."
679
679
  );
680
680
  }
681
- const entry = _chunkMAYYTYV5cjs.RELATIONSHIP_MAP[resource];
681
+ const entry = _chunkWRWX6WIKcjs.RELATIONSHIP_MAP[resource];
682
682
  if (entry === void 0) {
683
- throw new (0, _chunkMAYYTYV5cjs.AutotaskError)(
684
- `recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkMAYYTYV5cjs.RELATIONSHIP_MAP).length} resources`,
683
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskError)(
684
+ `recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkWRWX6WIKcjs.RELATIONSHIP_MAP).length} resources`,
685
685
  {
686
686
  code: "RESOURCE_UNKNOWN",
687
687
  category: "validation",
@@ -690,7 +690,7 @@ async function recovery(client, input, opts = {}) {
690
690
  }
691
691
  );
692
692
  }
693
- const holder = client[_chunkMAYYTYV5cjs.camelKey.call(void 0, resource)];
693
+ const holder = client[_chunkWRWX6WIKcjs.camelKey.call(void 0, resource)];
694
694
  if (!holder || typeof holder.queryBounded !== "function") {
695
695
  configError(
696
696
  `recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
@@ -698,7 +698,7 @@ async function recovery(client, input, opts = {}) {
698
698
  "Use a resource with a query surface, or address the record by id directly (get/fetchMany)."
699
699
  );
700
700
  }
701
- const field = input.field !== void 0 ? String(input.field) : _chunkMAYYTYV5cjs.MARKER_FIELDS[resource];
701
+ const field = input.field !== void 0 ? String(input.field) : _chunkWRWX6WIKcjs.MARKER_FIELDS[resource];
702
702
  if (typeof field !== "string" || field.trim() === "") {
703
703
  configError(
704
704
  `recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
@@ -734,7 +734,7 @@ async function recovery(client, input, opts = {}) {
734
734
  );
735
735
  }
736
736
  for (const c of input.filter) {
737
- if (!_chunkMAYYTYV5cjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
737
+ if (!_chunkWRWX6WIKcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
738
738
  configError(
739
739
  "recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
740
740
  operation,
@@ -755,7 +755,7 @@ async function recovery(client, input, opts = {}) {
755
755
  }
756
756
  limit = input.limit;
757
757
  }
758
- const boundaryNote = _chunkMAYYTYV5cjs.DELETE_BOUNDARY_NOTES[resource];
758
+ const boundaryNote = _chunkWRWX6WIKcjs.DELETE_BOUNDARY_NOTES[resource];
759
759
  const boundary = {
760
760
  available: boundaryNote === void 0,
761
761
  reason: _nullishCoalesce(boundaryNote, () => ( null)),
@@ -767,7 +767,7 @@ async function recovery(client, input, opts = {}) {
767
767
  };
768
768
  const isDelete = action === "delete";
769
769
  if (isDelete && boundaryNote !== void 0) {
770
- throw new (0, _chunkMAYYTYV5cjs.DeleteBoundaryError)(
770
+ throw new (0, _chunkWRWX6WIKcjs.DeleteBoundaryError)(
771
771
  `recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
772
772
  {
773
773
  operation,
@@ -779,7 +779,7 @@ async function recovery(client, input, opts = {}) {
779
779
  const dryRun = _optionalChain([opts, 'optionalAccess', _13 => _13.dryRun]) !== false;
780
780
  const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _14 => _14.confirm]), () => ( input.confirm));
781
781
  if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
782
- throw new (0, _chunkMAYYTYV5cjs.ConfirmationRequiredError)(
782
+ throw new (0, _chunkWRWX6WIKcjs.ConfirmationRequiredError)(
783
783
  `recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
784
784
  {
785
785
  operation: RECOVERY_CONFIRM,
@@ -795,7 +795,7 @@ async function recovery(client, input, opts = {}) {
795
795
  const query = await holder.queryBounded({ filter: conditions, limit });
796
796
  if (query.hasMore) {
797
797
  const wire = isDelete ? "DELETE wire" : "mutating wire";
798
- throw new (0, _chunkMAYYTYV5cjs.RecoveryTruncatedError)(
798
+ throw new (0, _chunkWRWX6WIKcjs.RecoveryTruncatedError)(
799
799
  `recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
800
800
  {
801
801
  operation,
@@ -834,7 +834,7 @@ async function recovery(client, input, opts = {}) {
834
834
  return { ...base, simulated: true, dryRun: true };
835
835
  }
836
836
  if (unsafeId) {
837
- throw new (0, _chunkMAYYTYV5cjs.MarkerUnsafeIdError)(
837
+ throw new (0, _chunkWRWX6WIKcjs.MarkerUnsafeIdError)(
838
838
  `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)`,
839
839
  {
840
840
  operation,
@@ -845,7 +845,7 @@ async function recovery(client, input, opts = {}) {
845
845
  }
846
846
  const deleteMethod = holder.delete;
847
847
  if (deleteMethod === void 0) {
848
- throw new (0, _chunkMAYYTYV5cjs.DeleteBoundaryError)(
848
+ throw new (0, _chunkWRWX6WIKcjs.DeleteBoundaryError)(
849
849
  `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`,
850
850
  {
851
851
  operation,
@@ -874,14 +874,14 @@ async function recovery(client, input, opts = {}) {
874
874
  verify = "still-present";
875
875
  }
876
876
  } catch (err) {
877
- if (err instanceof _chunkMAYYTYV5cjs.NotFoundError) verify = "not-found";
877
+ if (err instanceof _chunkWRWX6WIKcjs.NotFoundError) verify = "not-found";
878
878
  else {
879
879
  verify = "error";
880
- code = _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
880
+ code = _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
881
881
  }
882
882
  }
883
883
  } catch (err) {
884
- code = _chunkMAYYTYV5cjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
884
+ code = _chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
885
885
  }
886
886
  deleted.push({ id, verified: verify === "not-found", code });
887
887
  }
@@ -889,13 +889,13 @@ async function recovery(client, input, opts = {}) {
889
889
  }
890
890
 
891
891
  // src/operations/invoke.ts
892
- var RECORDS = _chunkEWMG3HHUcjs.CAPABILITIES;
892
+ var RECORDS = _chunk5O5EPYBOcjs.CAPABILITIES;
893
893
  var byId = new Map(RECORDS.map((r) => [r.id, r]));
894
894
  function needsConfirmation(record) {
895
895
  return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
896
896
  }
897
897
  function refuse(message, operation, suggestedAction) {
898
- throw new (0, _chunkMAYYTYV5cjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
898
+ throw new (0, _chunkWRWX6WIKcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
899
899
  }
900
900
  var MODE_BY_EFFECT = {
901
901
  read: "read",
@@ -939,7 +939,7 @@ function looseTypeOk(type, value) {
939
939
  case "string[]":
940
940
  return Array.isArray(value) && value.every((v) => typeof v === "string");
941
941
  case "object":
942
- return _chunkMAYYTYV5cjs.isRecord.call(void 0, value);
942
+ return _chunkWRWX6WIKcjs.isRecord.call(void 0, value);
943
943
  default:
944
944
  return true;
945
945
  }
@@ -956,7 +956,7 @@ function validateDispatchArgs(record, argsIn) {
956
956
  const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
957
957
  const names = Object.keys(schema);
958
958
  if (args.length > names.length) {
959
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
959
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
960
960
  `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)`,
961
961
  {
962
962
  operation,
@@ -966,7 +966,7 @@ function validateDispatchArgs(record, argsIn) {
966
966
  }
967
967
  const required = names.filter((n) => schema[n].required);
968
968
  if (args.length < required.length) {
969
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
969
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
970
970
  `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)}`,
971
971
  { operation }
972
972
  );
@@ -977,7 +977,7 @@ function validateDispatchArgs(record, argsIn) {
977
977
  const name = names[i];
978
978
  const spec = schema[name];
979
979
  if (!looseTypeOk(spec.type, value)) {
980
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
980
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
981
981
  `invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
982
982
  { operation }
983
983
  );
@@ -985,7 +985,12 @@ function validateDispatchArgs(record, argsIn) {
985
985
  }
986
986
  }
987
987
  var PARAMS_BAG_KEYS = {
988
- query: ["filter", "limit", "includeFields", "via", "latest", "noteChars", "fieldsPreset"],
988
+ query: ["filter", "limit", "includeFields", "via", "latest", "noteChars", "fieldsPreset", "fieldCheck"],
989
+ // No registry row DECLARES `queryAll` today (a plan decision: the raw walk is
990
+ // called directly), so this entry never fires. It is KEPT so that a future
991
+ // `queryAll` row — which `invoke` WOULD dispatch via holder[operation] —
992
+ // cannot silently open the bag (the keys are the vendor `QueryParams` set
993
+ // the raw method accepts).
989
994
  queryAll: ["filter", "maxRecords", "includeFields", "maxTotalRecords", "via"],
990
995
  count: ["filter"]
991
996
  };
@@ -1029,11 +1034,11 @@ function validateParamsBag(record, args) {
1029
1034
  const valid = PARAMS_BAG_KEYS[record.operation];
1030
1035
  if (valid === void 0) return;
1031
1036
  const bag = _optionalChain([args, 'optionalAccess', _15 => _15[0]]);
1032
- if (bag === void 0 || bag === null || !_chunkMAYYTYV5cjs.isRecord.call(void 0, bag)) return;
1037
+ if (bag === void 0 || bag === null || !_chunkWRWX6WIKcjs.isRecord.call(void 0, bag)) return;
1033
1038
  const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
1034
1039
  if (unknown.length === 0) return;
1035
1040
  const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1036
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1041
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1037
1042
  `invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
1038
1043
  {
1039
1044
  operation: record.id,
@@ -1041,13 +1046,80 @@ function validateParamsBag(record, args) {
1041
1046
  }
1042
1047
  );
1043
1048
  }
1049
+ async function liveFieldNames(holder) {
1050
+ const reader = holder.getFieldInfo;
1051
+ if (typeof reader !== "function") return null;
1052
+ try {
1053
+ const rows = await reader.call(holder);
1054
+ const names = [];
1055
+ for (const row of rows) {
1056
+ if (typeof row.name === "string") names.push(row.name);
1057
+ }
1058
+ return names.length > 0 ? names : null;
1059
+ } catch (err) {
1060
+ if (!_chunkWRWX6WIKcjs.isAutotaskError.call(void 0, err) || err.code === "ABORTED") throw err;
1061
+ return null;
1062
+ }
1063
+ }
1064
+ var UNKNOWN_NAME_LIST_CAP = 20;
1065
+ var UNKNOWN_NAME_DISPLAY_CHARS = 80;
1066
+ async function validateQueryIncludeFields(record, holder, args) {
1067
+ const bag = args[0];
1068
+ if (!_chunkWRWX6WIKcjs.isRecord.call(void 0, bag)) return;
1069
+ const fieldCheck = bag["fieldCheck"];
1070
+ if (fieldCheck !== void 0 && typeof fieldCheck !== "boolean") {
1071
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1072
+ `invoke: "${record.id}" params bag fieldCheck must be a boolean (got ${typeof fieldCheck}) \u2014 the request was not issued`,
1073
+ { operation: record.id, suggestedAction: "Pass fieldCheck: true (default) or fieldCheck: false (disable the includeFields name check)." }
1074
+ );
1075
+ }
1076
+ const includeFields = bag["includeFields"];
1077
+ if (includeFields === void 0) return;
1078
+ let shapeOk = Array.isArray(includeFields);
1079
+ const names = [];
1080
+ if (shapeOk) {
1081
+ for (const entry of includeFields) {
1082
+ if (typeof entry !== "string" || entry.length === 0) {
1083
+ shapeOk = false;
1084
+ break;
1085
+ }
1086
+ names.push(entry);
1087
+ }
1088
+ }
1089
+ if (!shapeOk) {
1090
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1091
+ `invoke: "${record.id}" params bag includeFields must be an array of non-empty field-name strings \u2014 the request was not issued`,
1092
+ {
1093
+ operation: record.id,
1094
+ suggestedAction: 'Pass includeFields as an array of exact vendor field names, e.g. ["id", "title"]; the live set is in operations.fieldCatalog.'
1095
+ }
1096
+ );
1097
+ }
1098
+ if (names.length === 0) return;
1099
+ if (fieldCheck === false) return;
1100
+ const live = await liveFieldNames(holder);
1101
+ const known = _nullishCoalesce(live, () => ( _chunkWRWX6WIKcjs.MODEL_FIELD_SETS[record.resource]));
1102
+ if (known === void 0) return;
1103
+ const unknown = names.filter((name) => !known.includes(name));
1104
+ if (unknown.length === 0) return;
1105
+ const authority = live !== null ? "the tenant's live entity field metadata" : "the vendored spec (src/field-sets.ts)";
1106
+ const listed = unknown.slice(0, UNKNOWN_NAME_LIST_CAP).map((n) => `"${n.length > UNKNOWN_NAME_DISPLAY_CHARS ? `${n.slice(0, UNKNOWN_NAME_DISPLAY_CHARS)}\u2026` : n}"`).join(", ");
1107
+ const more = unknown.length > UNKNOWN_NAME_LIST_CAP ? ` (and ${unknown.length - UNKNOWN_NAME_LIST_CAP} more)` : "";
1108
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1109
+ `invoke: "${record.id}" includeFields has unknown field name(s) ${listed}${more} against ${authority} \u2014 the query POST was not issued`,
1110
+ {
1111
+ operation: record.id,
1112
+ suggestedAction: `Use exact vendor field names (operations.fieldCatalog lists the live set for the entity); pass fieldCheck: false to disable this name check. The authority here was ${authority}.`
1113
+ }
1114
+ );
1115
+ }
1044
1116
  var INVOKE_OPTION_KEYS = ["dryRun", "confirm", "lastModifiedDate", "maxRetries", "mode"];
1045
1117
  function validateInvokeOptions(opts, operation) {
1046
1118
  if (opts === void 0 || opts === null) return;
1047
1119
  const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
1048
1120
  if (unknown.length === 0) return;
1049
1121
  const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate", "maxRetries"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1050
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1122
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1051
1123
  `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)`,
1052
1124
  {
1053
1125
  operation,
@@ -1060,11 +1132,11 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
1060
1132
  const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
1061
1133
  if (unknown.length === 0) return null;
1062
1134
  const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
1063
- return new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1135
+ return new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1064
1136
  `unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
1065
1137
  {
1066
1138
  ...operation !== void 0 ? { operation } : {},
1067
- suggestedAction: suggestions.length > 0 ? `Fix the ${subject} name (${suggestions.join(", ")}); the full contract is in the tool's inputSchema (autotask_describe).` : `Pass only the valid keys (${validKeys.join(", ")}).`
1139
+ suggestedAction: suggestions.length > 0 ? operation === void 0 ? `Fix the ${subject} name (${suggestions.join(", ")}); the tool's full contract is in the tool's inputSchema, served by the MCP client's list_tools.` : `Fix the ${subject} name (${suggestions.join(", ")}); the full contract is in the tool's inputSchema (autotask_describe).` : `Pass only the valid keys (${validKeys.join(", ")}).`
1068
1140
  }
1069
1141
  );
1070
1142
  }
@@ -1072,7 +1144,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1072
1144
  const args = _nullishCoalesce(argsIn, () => ( []));
1073
1145
  const record = byId.get(operation);
1074
1146
  if (record === void 0) {
1075
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1147
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1076
1148
  `invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
1077
1149
  { operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
1078
1150
  );
@@ -1080,17 +1152,17 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1080
1152
  validateInvokeOptions(opts, operation);
1081
1153
  const mode = opts.mode;
1082
1154
  if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
1083
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
1155
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
1084
1156
  }
1085
1157
  if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
1086
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1158
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1087
1159
  `invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
1088
1160
  { operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
1089
1161
  );
1090
1162
  }
1091
1163
  const isWrite = record.effect !== "read";
1092
1164
  if (!isWrite && opts.dryRun === true) {
1093
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1165
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1094
1166
  `invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
1095
1167
  { operation }
1096
1168
  );
@@ -1105,15 +1177,15 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1105
1177
  validateDispatchArgs(record, args);
1106
1178
  validateParamsBag(record, args);
1107
1179
  const boundedQuery = record.kind === "primitive" && record.operation === "query";
1108
- let holder = client[_chunkMAYYTYV5cjs.camelKey.call(void 0, record.resource)];
1180
+ let holder = client[_chunkWRWX6WIKcjs.camelKey.call(void 0, record.resource)];
1109
1181
  if (typeof holder === "function") {
1110
- holder = _nullishCoalesce(client[`${_chunkMAYYTYV5cjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
1182
+ holder = _nullishCoalesce(client[`${_chunkWRWX6WIKcjs.camelKey.call(void 0, record.resource)}Resource`], () => ( holder));
1111
1183
  }
1112
1184
  if (holder === void 0 && record.resource === "operations") {
1113
1185
  holder = {
1114
1186
  resolveAny: (identifier, opts2) => resolveAny(client, identifier, opts2),
1115
1187
  searchAcrossResources: (query, opts2) => searchAcrossResources(client, query, opts2),
1116
- fetchMany: (items, opts2) => _chunkMAYYTYV5cjs.fetchMany.call(void 0, client, items, opts2),
1188
+ fetchMany: (items, opts2) => _chunkWRWX6WIKcjs.fetchMany.call(void 0, client, items, opts2),
1117
1189
  // Issue #62: the generic aggregate + the cheap count — the
1118
1190
  // groupBy/sum-absent mode is ONE vendor /query/count (the S12-C blind
1119
1191
  // sentinel rides through); the group/sum modes walk the named
@@ -1123,12 +1195,12 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1123
1195
  // Issue #59 PR-B: the bulk fetch by ids — query-first chunked `id in`
1124
1196
  // reads + the per-id `get` fallback (blind-surface-safe; per-item
1125
1197
  // typed outcomes reuse the fetchMany shapes).
1126
- fetchByIds: (items, opts2) => _chunkMAYYTYV5cjs.fetchByIds.call(void 0, client, items, opts2),
1198
+ fetchByIds: (items, opts2) => _chunkWRWX6WIKcjs.fetchByIds.call(void 0, client, items, opts2),
1127
1199
  // Issue #65: opt-in resource name expansion — per-id resources.get
1128
1200
  // reads ONLY (never an id-in query — the resources table can be blind
1129
1201
  // to count/query while per-id reads work); blind-marked rows for ids
1130
1202
  // the API user cannot resolve; the name cache (default-on).
1131
- expandResourceNames: (ids, opts2) => _chunkMAYYTYV5cjs.expandResourceNames.call(void 0, client, ids, opts2),
1203
+ expandResourceNames: (ids, opts2) => _chunkWRWX6WIKcjs.expandResourceNames.call(void 0, client, ids, opts2),
1132
1204
  relationshipMap: (resourceKey) => relationshipMap(client, resourceKey),
1133
1205
  // Issue #11: the served blind-surface inventory (zero wire) + the
1134
1206
  // bounded caller-opted reachability sweep (read-only, confirmProbe-
@@ -1141,7 +1213,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1141
1213
  // entityInformation GETs (the op's own cap refuses over-cap fan-outs
1142
1214
  // pre-request; per-resource failures are recorded on the row and
1143
1215
  // never abort the call).
1144
- fieldCatalog: (opts2) => _chunkMAYYTYV5cjs.fieldCatalog.call(void 0, client, opts2),
1216
+ fieldCatalog: (opts2) => _chunkWRWX6WIKcjs.fieldCatalog.call(void 0, client, opts2),
1145
1217
  // Issue #9: the one-call recovery/cleanup op — effect write in the
1146
1218
  // registry (the governor's dry-run-first applies to it); the op's own
1147
1219
  // confirm gate makes the destructive action deliberate (the governor
@@ -1150,15 +1222,16 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
1150
1222
  };
1151
1223
  }
1152
1224
  if (holder === void 0) {
1153
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1225
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1154
1226
  `invoke: the client exposes no accessor for resource "${record.resource}"`,
1155
1227
  { operation }
1156
1228
  );
1157
1229
  }
1230
+ if (boundedQuery) await validateQueryIncludeFields(record, holder, args);
1158
1231
  const methodName = boundedQuery ? "queryBounded" : record.operation;
1159
1232
  const method = holder[methodName];
1160
1233
  if (typeof method !== "function") {
1161
- throw new (0, _chunkMAYYTYV5cjs.AutotaskConfigError)(
1234
+ throw new (0, _chunkWRWX6WIKcjs.AutotaskConfigError)(
1162
1235
  `invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
1163
1236
  { operation }
1164
1237
  );
@@ -1265,4 +1338,4 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
1265
1338
 
1266
1339
 
1267
1340
 
1268
- 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 = _chunkMAYYTYV5cjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkMAYYTYV5cjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkMAYYTYV5cjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkMAYYTYV5cjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkMAYYTYV5cjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkMAYYTYV5cjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkMAYYTYV5cjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkMAYYTYV5cjs.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 = _chunkMAYYTYV5cjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.expandResourceNames = _chunkMAYYTYV5cjs.expandResourceNames; exports.fetchByIds = _chunkMAYYTYV5cjs.fetchByIds; exports.fetchMany = _chunkMAYYTYV5cjs.fetchMany; exports.fieldCatalog = _chunkMAYYTYV5cjs.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 = _chunkMAYYTYV5cjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
1341
+ 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 = _chunkWRWX6WIKcjs.EXPAND_RESOURCE_NAMES_MAX_IDS; exports.FETCH_BY_IDS_CHUNK_SIZE = _chunkWRWX6WIKcjs.FETCH_BY_IDS_CHUNK_SIZE; exports.FETCH_BY_IDS_MAX_ITEMS = _chunkWRWX6WIKcjs.FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_MANY_MAX_ITEMS = _chunkWRWX6WIKcjs.FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkWRWX6WIKcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = _chunkWRWX6WIKcjs.FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = _chunkWRWX6WIKcjs.MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = _chunkWRWX6WIKcjs.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 = _chunkWRWX6WIKcjs.WORKFLOW_RESOURCES; exports.aggregate = aggregate; exports.blindSurfaces = blindSurfaces; exports.createGuidance = createGuidance; exports.dateBucketLabel = dateBucketLabel; exports.expandResourceNames = _chunkWRWX6WIKcjs.expandResourceNames; exports.fetchByIds = _chunkWRWX6WIKcjs.fetchByIds; exports.fetchMany = _chunkWRWX6WIKcjs.fetchMany; exports.fieldCatalog = _chunkWRWX6WIKcjs.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 = _chunkWRWX6WIKcjs.validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;