node-autotask 0.8.0 → 0.8.1
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/ARCHITECTURE.md +54 -12
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/README.md +9 -3
- package/dist/{chunk-C7U3ZRRK.js → chunk-2QLOK7PX.js} +27 -31
- package/dist/{chunk-C7U3ZRRK.js.map → chunk-2QLOK7PX.js.map} +1 -1
- package/dist/{chunk-LDKIIVFV.cjs → chunk-CQIZDSBE.cjs} +272 -276
- package/dist/chunk-CQIZDSBE.cjs.map +1 -0
- package/dist/{chunk-QUFEIJEB.cjs → chunk-DA73ALND.cjs} +136 -138
- package/dist/chunk-DA73ALND.cjs.map +1 -0
- package/dist/{chunk-GNS47RBV.js → chunk-IUJJPWUX.js} +612 -18
- package/dist/chunk-IUJJPWUX.js.map +1 -0
- package/dist/{chunk-RFXGG37L.cjs → chunk-IV2Z3JLR.cjs} +680 -86
- package/dist/chunk-IV2Z3JLR.cjs.map +1 -0
- package/dist/{chunk-ONPT4PIV.js → chunk-PAQXQFGG.js} +4 -6
- package/dist/{chunk-ONPT4PIV.js.map → chunk-PAQXQFGG.js.map} +1 -1
- package/dist/index.cjs +120 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -3
- package/dist/index.d.ts +129 -3
- package/dist/index.js +156 -63
- package/dist/index.js.map +1 -1
- package/dist/operations/index.cjs +113 -116
- package/dist/operations/index.cjs.map +1 -1
- package/dist/operations/index.js +9 -12
- package/dist/operations/index.js.map +1 -1
- package/dist/pool.cjs +8 -11
- package/dist/pool.cjs.map +1 -1
- package/dist/pool.js +4 -7
- package/dist/pool.js.map +1 -1
- package/dist/resources/index.cjs +3 -5
- package/dist/resources/index.cjs.map +1 -1
- package/dist/resources/index.js +2 -4
- package/package.json +9 -3
- package/dist/chunk-5QVXRT3A.cjs +0 -580
- package/dist/chunk-5QVXRT3A.cjs.map +0 -1
- package/dist/chunk-FE225M76.js +0 -580
- package/dist/chunk-FE225M76.js.map +0 -1
- package/dist/chunk-GNS47RBV.js.map +0 -1
- package/dist/chunk-IFXFOYDU.cjs +0 -32
- package/dist/chunk-IFXFOYDU.cjs.map +0 -1
- package/dist/chunk-LDKIIVFV.cjs.map +0 -1
- package/dist/chunk-OOEVTGP4.js +0 -121
- package/dist/chunk-OOEVTGP4.js.map +0 -1
- package/dist/chunk-PBBFMRI5.cjs +0 -121
- package/dist/chunk-PBBFMRI5.cjs.map +0 -1
- package/dist/chunk-QF4K3XTK.js +0 -32
- package/dist/chunk-QF4K3XTK.js.map +0 -1
- package/dist/chunk-QUFEIJEB.cjs.map +0 -1
- package/dist/chunk-RFXGG37L.cjs.map +0 -1
- package/dist/credential-shape.cjs +0 -15
- package/dist/credential-shape.cjs.map +0 -1
- package/dist/credential-shape.d.cts +0 -52
- package/dist/credential-shape.d.ts +0 -52
- package/dist/credential-shape.js +0 -15
- package/dist/credential-shape.js.map +0 -1
- package/dist/credentials.cjs +0 -17
- package/dist/credentials.cjs.map +0 -1
- package/dist/credentials.d.cts +0 -78
- package/dist/credentials.d.ts +0 -78
- package/dist/credentials.js +0 -17
- package/dist/credentials.js.map +0 -1
|
@@ -10,21 +10,18 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var _chunkRFXGG37Lcjs = require('../chunk-RFXGG37L.cjs');
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
var _chunkU2PEBFPUcjs = require('../chunk-U2PEBFPU.cjs');
|
|
17
|
-
|
|
18
15
|
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
|
|
22
19
|
|
|
23
20
|
|
|
21
|
+
var _chunkIV2Z3JLRcjs = require('../chunk-IV2Z3JLR.cjs');
|
|
24
22
|
|
|
25
23
|
|
|
26
|
-
var
|
|
27
|
-
require('../chunk-IFXFOYDU.cjs');
|
|
24
|
+
var _chunkU2PEBFPUcjs = require('../chunk-U2PEBFPU.cjs');
|
|
28
25
|
|
|
29
26
|
// src/operations/types.ts
|
|
30
27
|
var WORKFLOW_RESOURCES = [
|
|
@@ -38,18 +35,18 @@ var WORKFLOW_RESOURCES = [
|
|
|
38
35
|
// src/operations/searchAcrossResources.ts
|
|
39
36
|
var DEFAULT_LIMIT = 25;
|
|
40
37
|
function resourceFor(client, key) {
|
|
41
|
-
return client[
|
|
38
|
+
return client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, key)];
|
|
42
39
|
}
|
|
43
40
|
async function searchAcrossResources(client, query, opts = {}) {
|
|
44
41
|
const text = query.trim();
|
|
45
42
|
if (text === "") {
|
|
46
|
-
throw new (0,
|
|
43
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("searchAcrossResources: query must be a non-empty string");
|
|
47
44
|
}
|
|
48
45
|
const keys = _nullishCoalesce(opts.resources, () => ( WORKFLOW_RESOURCES));
|
|
49
46
|
if (keys.length === 0) {
|
|
50
|
-
throw new (0,
|
|
47
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("searchAcrossResources: no resources requested");
|
|
51
48
|
}
|
|
52
|
-
const limit =
|
|
49
|
+
const limit = _chunkIV2Z3JLRcjs.clampPageSize.call(void 0, _nullishCoalesce(opts.limit, () => ( DEFAULT_LIMIT)));
|
|
53
50
|
const results = [];
|
|
54
51
|
const skipped = [];
|
|
55
52
|
for (const key of keys) {
|
|
@@ -67,7 +64,7 @@ async function searchAcrossResources(client, query, opts = {}) {
|
|
|
67
64
|
|
|
68
65
|
// src/operations/resolveAny.ts
|
|
69
66
|
function resourceFor2(client, key) {
|
|
70
|
-
return client[
|
|
67
|
+
return client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, key)];
|
|
71
68
|
}
|
|
72
69
|
var FAULT_CATEGORIES = /* @__PURE__ */ new Set(["auth", "rate_limit", "server", "network", "timeout", "policy"]);
|
|
73
70
|
function missCost(identifier) {
|
|
@@ -77,14 +74,14 @@ function missCost(identifier) {
|
|
|
77
74
|
async function resolveAny(client, identifier, opts = {}) {
|
|
78
75
|
if (typeof identifier === "number") {
|
|
79
76
|
if (!Number.isInteger(identifier) || identifier < 0) {
|
|
80
|
-
throw new (0,
|
|
77
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("resolveAny: numeric identifier must be a non-negative integer");
|
|
81
78
|
}
|
|
82
79
|
} else if (identifier.trim() === "") {
|
|
83
|
-
throw new (0,
|
|
80
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("resolveAny: identifier must be non-empty");
|
|
84
81
|
}
|
|
85
82
|
const keys = _nullishCoalesce(opts.resources, () => ( WORKFLOW_RESOURCES));
|
|
86
83
|
if (keys.length === 0) {
|
|
87
|
-
throw new (0,
|
|
84
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("resolveAny: no resources requested");
|
|
88
85
|
}
|
|
89
86
|
const results = [];
|
|
90
87
|
for (const key of keys) {
|
|
@@ -114,9 +111,9 @@ async function resolveAny(client, identifier, opts = {}) {
|
|
|
114
111
|
} catch (err) {
|
|
115
112
|
let code;
|
|
116
113
|
let candidates = [];
|
|
117
|
-
if (err instanceof
|
|
114
|
+
if (err instanceof _chunkIV2Z3JLRcjs.AutotaskConfigError) {
|
|
118
115
|
code = "CONFIG_ERROR";
|
|
119
|
-
} else if (
|
|
116
|
+
} else if (_chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err)) {
|
|
120
117
|
if (FAULT_CATEGORIES.has(err.category)) throw err;
|
|
121
118
|
code = err.code;
|
|
122
119
|
if (code === "RESOLUTION_AMBIGUOUS" && err.resourceIds !== void 0) {
|
|
@@ -265,7 +262,7 @@ var MODEL_FIELD_SETS = {
|
|
|
265
262
|
var FETCH_MANY_MAX_ITEMS = 20;
|
|
266
263
|
function validateFetchManyItems(items, cap) {
|
|
267
264
|
if (!Array.isArray(items)) {
|
|
268
|
-
throw new (0,
|
|
265
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
269
266
|
`fetchMany: items must be the items ARRAY \u2014 one positional arg, [{ resource: string, id: number, fields?: string[] }] (got ${Array.isArray(items) ? "an array" : typeof items})`,
|
|
270
267
|
{
|
|
271
268
|
suggestedAction: 'Pass args = [[{ resource: "tickets", id: 123 }, { resource: "projects", id: 456 }]] \u2014 the items array is the single positional argument.'
|
|
@@ -273,12 +270,12 @@ function validateFetchManyItems(items, cap) {
|
|
|
273
270
|
);
|
|
274
271
|
}
|
|
275
272
|
if (items.length === 0) {
|
|
276
|
-
throw new (0,
|
|
273
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("fetchMany: items must not be empty (a zero-item batch is a shape error, not a no-op)", {
|
|
277
274
|
suggestedAction: "Pass at least one { resource, id } item \u2014 or use the resource's query op for a filtered read."
|
|
278
275
|
});
|
|
279
276
|
}
|
|
280
277
|
if (items.length > cap) {
|
|
281
|
-
throw new (0,
|
|
278
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
282
279
|
`fetchMany: ${items.length} items over the ${cap}-item cap (FETCH_MANY_MAX_ITEMS = ${FETCH_MANY_MAX_ITEMS}) \u2014 zero items were fetched (pre-request)`,
|
|
283
280
|
{
|
|
284
281
|
suggestedAction: `Split the batch into groups of <= ${cap} items \u2014 or, for more than ${cap} records / a filtered set, use the resource's bounded query op (<resource>.query).`
|
|
@@ -306,10 +303,10 @@ function validateFetchManyItems(items, cap) {
|
|
|
306
303
|
);
|
|
307
304
|
continue;
|
|
308
305
|
}
|
|
309
|
-
const rel =
|
|
306
|
+
const rel = _chunkIV2Z3JLRcjs.RELATIONSHIP_MAP[resourceKey];
|
|
310
307
|
if (rel !== void 0 && rel.parentScoped) {
|
|
311
308
|
problems.push(
|
|
312
|
-
`${at}.resource: "${resourceKey}" is a parent-scoped child \u2014 its get needs (parentId, id); fetchMany takes single numeric ids of TOP-LEVEL records (scoped reads: client.${
|
|
309
|
+
`${at}.resource: "${resourceKey}" is a parent-scoped child \u2014 its get needs (parentId, id); fetchMany takes single numeric ids of TOP-LEVEL records (scoped reads: client.${_chunkIV2Z3JLRcjs.camelKey.call(void 0, resourceKey)}.get(parentId, id))`
|
|
313
310
|
);
|
|
314
311
|
continue;
|
|
315
312
|
}
|
|
@@ -334,7 +331,7 @@ function validateFetchManyItems(items, cap) {
|
|
|
334
331
|
}
|
|
335
332
|
}
|
|
336
333
|
if (problems.length > 0) {
|
|
337
|
-
throw new (0,
|
|
334
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
338
335
|
`fetchMany: ${problems.length} problem(s) found pre-request (zero wire was issued)
|
|
339
336
|
- ` + problems.join("\n- "),
|
|
340
337
|
{ suggestedAction: "Fix every item above and call again \u2014 validation covers the whole batch up-front (one round, zero wire)." }
|
|
@@ -351,7 +348,7 @@ function project(value, fields) {
|
|
|
351
348
|
async function fetchMany(client, items, opts = {}) {
|
|
352
349
|
if (opts.maxItems !== void 0) {
|
|
353
350
|
if (!Number.isInteger(opts.maxItems) || opts.maxItems < 1) {
|
|
354
|
-
throw new (0,
|
|
351
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(`fetchMany: maxItems must be an integer >= 1 (got ${String(opts.maxItems)})`);
|
|
355
352
|
}
|
|
356
353
|
}
|
|
357
354
|
const cap = Math.min(FETCH_MANY_MAX_ITEMS, _nullishCoalesce(opts.maxItems, () => ( FETCH_MANY_MAX_ITEMS)));
|
|
@@ -359,9 +356,9 @@ async function fetchMany(client, items, opts = {}) {
|
|
|
359
356
|
const results = [];
|
|
360
357
|
for (const item of items) {
|
|
361
358
|
const key = item.resource;
|
|
362
|
-
const holder = client[
|
|
359
|
+
const holder = client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, key)];
|
|
363
360
|
if (holder === void 0) {
|
|
364
|
-
throw new (0,
|
|
361
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(`fetchMany: the client exposes no accessor for resource "${key}"`, {
|
|
365
362
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
366
363
|
});
|
|
367
364
|
}
|
|
@@ -369,9 +366,9 @@ async function fetchMany(client, items, opts = {}) {
|
|
|
369
366
|
const value = await holder.get(item.id);
|
|
370
367
|
results.push({ resource: key, id: item.id, found: true, value: item.fields !== void 0 ? project(value, item.fields) : value });
|
|
371
368
|
} catch (err) {
|
|
372
|
-
if (err instanceof
|
|
369
|
+
if (err instanceof _chunkIV2Z3JLRcjs.NotFoundError) {
|
|
373
370
|
results.push({ resource: key, id: item.id, found: false, value: null, error: { code: "NOT_FOUND", message: err.message } });
|
|
374
|
-
} else if (
|
|
371
|
+
} else if (_chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err) && err.code !== "ABORTED") {
|
|
375
372
|
const e = { code: err.code, message: err.message };
|
|
376
373
|
if (err.httpStatus !== void 0) e.httpStatus = err.httpStatus;
|
|
377
374
|
results.push({ resource: key, id: item.id, found: false, value: null, error: e });
|
|
@@ -388,20 +385,20 @@ async function fetchMany(client, items, opts = {}) {
|
|
|
388
385
|
async function relationshipMap(client, resourceKey) {
|
|
389
386
|
void client;
|
|
390
387
|
if (typeof resourceKey !== "string" || resourceKey.trim() === "") {
|
|
391
|
-
throw new (0,
|
|
388
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
392
389
|
`relationshipMap: resourceKey must be a non-empty plan resource key string (e.g. 'tickets'; got ${typeof resourceKey === "string" ? "a blank string" : typeof resourceKey})`,
|
|
393
390
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items, ticket_notes." }
|
|
394
391
|
);
|
|
395
392
|
}
|
|
396
393
|
const key = resourceKey.trim();
|
|
397
|
-
const entry =
|
|
394
|
+
const entry = _chunkIV2Z3JLRcjs.RELATIONSHIP_MAP[key];
|
|
398
395
|
if (entry === void 0) {
|
|
399
|
-
throw new (0,
|
|
400
|
-
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
396
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
397
|
+
`relationshipMap: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkIV2Z3JLRcjs.RELATIONSHIP_MAP).length} resources`,
|
|
401
398
|
{
|
|
402
399
|
code: "RESOURCE_UNKNOWN",
|
|
403
400
|
category: "validation",
|
|
404
|
-
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${
|
|
401
|
+
suggestedAction: `Pass the exact plan resource key (snake_case) from autotask_catalog (e.g. tickets, companies, configuration_items). Zone facts served are ${_chunkIV2Z3JLRcjs.RELATIONSHIP_ZONE.label} (${_chunkIV2Z3JLRcjs.RELATIONSHIP_ZONE.zone})-verified.`
|
|
405
402
|
}
|
|
406
403
|
);
|
|
407
404
|
}
|
|
@@ -418,24 +415,24 @@ var BLIND_SURFACE_KINDS = [
|
|
|
418
415
|
async function blindSurfaces(client, opts) {
|
|
419
416
|
void client;
|
|
420
417
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
421
|
-
throw new (0,
|
|
418
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("blindSurfaces: opts must be an object { resource?: string, kind?: BlindSurfaceKind }");
|
|
422
419
|
}
|
|
423
|
-
const inv =
|
|
420
|
+
const inv = _chunkIV2Z3JLRcjs.BLIND_SURFACE_INVENTORY;
|
|
424
421
|
if (inv === null) {
|
|
425
|
-
throw new (0,
|
|
422
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("blindSurfaces: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
426
423
|
}
|
|
427
424
|
let surfaces = inv.surfaces;
|
|
428
425
|
if (_optionalChain([opts, 'optionalAccess', _ => _.resource]) !== void 0) {
|
|
429
426
|
const key = typeof opts.resource === "string" ? opts.resource.trim() : "";
|
|
430
427
|
if (key === "") {
|
|
431
|
-
throw new (0,
|
|
428
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
432
429
|
"blindSurfaces: opts.resource must be a non-empty plan resource key string (e.g. 'tickets')",
|
|
433
430
|
{ suggestedAction: "Pass the exact plan resource key (snake_case) from autotask_catalog \u2014 e.g. tickets, companies, configuration_items." }
|
|
434
431
|
);
|
|
435
432
|
}
|
|
436
433
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
437
|
-
throw new (0,
|
|
438
|
-
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(
|
|
434
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
435
|
+
`blindSurfaces: unknown resource "${key}" \u2014 the plan has ${Object.keys(_chunkIV2Z3JLRcjs.RELATIONSHIP_MAP).length} resources`,
|
|
439
436
|
{
|
|
440
437
|
code: "RESOURCE_UNKNOWN",
|
|
441
438
|
category: "validation",
|
|
@@ -447,7 +444,7 @@ async function blindSurfaces(client, opts) {
|
|
|
447
444
|
}
|
|
448
445
|
if (_optionalChain([opts, 'optionalAccess', _2 => _2.kind]) !== void 0) {
|
|
449
446
|
if (!BLIND_SURFACE_KINDS.includes(opts.kind)) {
|
|
450
|
-
throw new (0,
|
|
447
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
451
448
|
`blindSurfaces: unknown kind "${String(opts.kind)}" \u2014 the valid classes are: ${BLIND_SURFACE_KINDS.join(", ")}`,
|
|
452
449
|
{ suggestedAction: `Filter with one of: ${BLIND_SURFACE_KINDS.join(", ")} (or omit kind for the full 116-surface inventory).` }
|
|
453
450
|
);
|
|
@@ -460,51 +457,51 @@ async function blindSurfaces(client, opts) {
|
|
|
460
457
|
// src/operations/probeReachability.ts
|
|
461
458
|
async function probeReachability(client, opts) {
|
|
462
459
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
463
|
-
throw new (0,
|
|
460
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("probeReachability: opts must be an object { resources?: string[], limit?: 1|2, maxWireCalls?: number, confirmProbe?: true }");
|
|
464
461
|
}
|
|
465
|
-
const defs =
|
|
462
|
+
const defs = _chunkIV2Z3JLRcjs.REACHABILITY_PROBE_DEFAULTS;
|
|
466
463
|
if (_optionalChain([opts, 'optionalAccess', _3 => _3.confirmProbe]) !== true) {
|
|
467
|
-
throw new (0,
|
|
464
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
468
465
|
"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",
|
|
469
466
|
{ suggestedAction: `Re-call with { confirmProbe: true } (plus resources/limit/maxWireCalls as needed). For the ZERO-wire pinned inventory use operations.blindSurfaces.` }
|
|
470
467
|
);
|
|
471
468
|
}
|
|
472
469
|
const limit = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _4 => _4.limit]), () => ( defs.limitDefault));
|
|
473
470
|
if (!Number.isInteger(limit) || limit < 1 || limit > defs.limitMax) {
|
|
474
|
-
throw new (0,
|
|
471
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
475
472
|
`probeReachability: limit must be an integer 1..${defs.limitMax} (got ${String(limit)}) \u2014 the rows-per-surface bound for the discovery read`
|
|
476
473
|
);
|
|
477
474
|
}
|
|
478
475
|
const cap = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _5 => _5.maxWireCalls]), () => ( defs.defaultCap));
|
|
479
476
|
if (!Number.isInteger(cap) || cap < 1) {
|
|
480
|
-
throw new (0,
|
|
477
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(`probeReachability: maxWireCalls must be a positive integer (got ${String(cap)})`);
|
|
481
478
|
}
|
|
482
479
|
if (cap > defs.hardCap) {
|
|
483
|
-
throw new (0,
|
|
480
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
484
481
|
`probeReachability: maxWireCalls ${cap} exceeds the hard wire cap of ${defs.hardCap} \u2014 the sweep is refused above it (never capped silently)`,
|
|
485
482
|
{ suggestedAction: `Pass maxWireCalls \u2264 ${defs.hardCap} and a resources set no larger than the cap (the refused set is never truncated).` }
|
|
486
483
|
);
|
|
487
484
|
}
|
|
488
|
-
const inv =
|
|
485
|
+
const inv = _chunkIV2Z3JLRcjs.BLIND_SURFACE_INVENTORY;
|
|
489
486
|
if (inv === null) {
|
|
490
|
-
throw new (0,
|
|
487
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("probeReachability: the reachability inventory is absent from the generated artifact \u2014 re-run the build");
|
|
491
488
|
}
|
|
492
489
|
let targets;
|
|
493
490
|
if (_optionalChain([opts, 'optionalAccess', _6 => _6.resources]) === void 0) {
|
|
494
491
|
targets = [...defs.defaultTargets];
|
|
495
492
|
} else {
|
|
496
493
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
497
|
-
throw new (0,
|
|
494
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("probeReachability: opts.resources must be a non-empty string[] of plan resource keys (or omit it for the default non-data-full set)");
|
|
498
495
|
}
|
|
499
496
|
const seen = /* @__PURE__ */ new Set();
|
|
500
497
|
for (const r of opts.resources) {
|
|
501
498
|
if (typeof r !== "string" || r.trim() === "") {
|
|
502
|
-
throw new (0,
|
|
499
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(`probeReachability: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`);
|
|
503
500
|
}
|
|
504
501
|
const key = r.trim();
|
|
505
502
|
if (!inv.surfaces.some((row) => row.resource === key)) {
|
|
506
503
|
const surfaceCount = new Set(inv.surfaces.map((s) => s.resource)).size;
|
|
507
|
-
throw new (0,
|
|
504
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
508
505
|
`probeReachability: unknown resource "${key}" \u2014 the inventory has ${surfaceCount} surfaces`,
|
|
509
506
|
{
|
|
510
507
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -518,7 +515,7 @@ async function probeReachability(client, opts) {
|
|
|
518
515
|
targets = [...seen];
|
|
519
516
|
}
|
|
520
517
|
if (targets.length > cap) {
|
|
521
|
-
throw new (0,
|
|
518
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
522
519
|
`probeReachability: ${targets.length} requested surface(s) exceed the wire cap of ${cap} \u2014 the sweep is refused above its cap (never truncated)`,
|
|
523
520
|
{ suggestedAction: `Raise maxWireCalls (\u2264 ${defs.hardCap}) to cover the set, or pass a smaller resources list.` }
|
|
524
521
|
);
|
|
@@ -528,7 +525,7 @@ async function probeReachability(client, opts) {
|
|
|
528
525
|
for (const resource of targets.sort()) {
|
|
529
526
|
const row = byResource.get(resource);
|
|
530
527
|
if (row === void 0) continue;
|
|
531
|
-
const holder = client[
|
|
528
|
+
const holder = client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, resource)];
|
|
532
529
|
const probeFn = _optionalChain([holder, 'optionalAccess', _7 => _7.queryBounded]);
|
|
533
530
|
if (typeof probeFn !== "function") {
|
|
534
531
|
results.push({
|
|
@@ -547,7 +544,7 @@ async function probeReachability(client, opts) {
|
|
|
547
544
|
probe: { ok: true, wire: 1, error: null }
|
|
548
545
|
});
|
|
549
546
|
} catch (err) {
|
|
550
|
-
const code =
|
|
547
|
+
const code = _chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
551
548
|
const message = err instanceof Error ? err.message : String(err);
|
|
552
549
|
results.push({
|
|
553
550
|
...row,
|
|
@@ -575,24 +572,24 @@ var CREATE_BLOCKER_KINDS = [
|
|
|
575
572
|
async function createGuidance(client, opts) {
|
|
576
573
|
void client;
|
|
577
574
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
578
|
-
throw new (0,
|
|
575
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
579
576
|
"createGuidance: opts must be an object { resources?: string[], kind?: CreateBlockerKind }"
|
|
580
577
|
);
|
|
581
578
|
}
|
|
582
|
-
let rows =
|
|
579
|
+
let rows = _chunkIV2Z3JLRcjs.CREATE_GUIDANCE.rows;
|
|
583
580
|
if (_optionalChain([opts, 'optionalAccess', _9 => _9.resources]) !== void 0) {
|
|
584
581
|
if (!Array.isArray(opts.resources) || opts.resources.length === 0) {
|
|
585
|
-
throw new (0,
|
|
582
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("createGuidance: opts.resources must be a non-empty string[] of plan resource keys");
|
|
586
583
|
}
|
|
587
584
|
const wanted = /* @__PURE__ */ new Set();
|
|
588
585
|
for (const r of opts.resources) {
|
|
589
586
|
if (typeof r !== "string" || r.trim() === "") {
|
|
590
|
-
throw new (0,
|
|
587
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("createGuidance: opts.resources must contain non-empty plan resource key strings");
|
|
591
588
|
}
|
|
592
589
|
const key = r.trim();
|
|
593
|
-
if (!
|
|
594
|
-
throw new (0,
|
|
595
|
-
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${
|
|
590
|
+
if (!_chunkIV2Z3JLRcjs.CREATE_GUIDANCE.rows.some((row) => row.resource === key)) {
|
|
591
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
592
|
+
`createGuidance: unknown resource "${key}" \u2014 the catalog has ${_chunkIV2Z3JLRcjs.CREATE_GUIDANCE.rows.length} create entities`,
|
|
596
593
|
{
|
|
597
594
|
code: "RESOURCE_UNKNOWN",
|
|
598
595
|
category: "validation",
|
|
@@ -606,18 +603,18 @@ async function createGuidance(client, opts) {
|
|
|
606
603
|
}
|
|
607
604
|
if (_optionalChain([opts, 'optionalAccess', _10 => _10.kind]) !== void 0) {
|
|
608
605
|
if (!CREATE_BLOCKER_KINDS.includes(opts.kind)) {
|
|
609
|
-
throw new (0,
|
|
606
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
610
607
|
`createGuidance: unknown kind "${String(opts.kind)}" \u2014 the valid kinds are: ${CREATE_BLOCKER_KINDS.join(", ")}`
|
|
611
608
|
);
|
|
612
609
|
}
|
|
613
610
|
rows = rows.filter((row) => _optionalChain([row, 'access', _11 => _11.blocker, 'optionalAccess', _12 => _12.kind]) === opts.kind);
|
|
614
611
|
}
|
|
615
612
|
return {
|
|
616
|
-
zone:
|
|
617
|
-
label:
|
|
618
|
-
verifiedAt:
|
|
613
|
+
zone: _chunkIV2Z3JLRcjs.CREATE_GUIDANCE.zone,
|
|
614
|
+
label: _chunkIV2Z3JLRcjs.CREATE_GUIDANCE.label,
|
|
615
|
+
verifiedAt: _chunkIV2Z3JLRcjs.CREATE_GUIDANCE.verifiedAt,
|
|
619
616
|
rows,
|
|
620
|
-
counts:
|
|
617
|
+
counts: _chunkIV2Z3JLRcjs.CREATE_GUIDANCE.counts
|
|
621
618
|
};
|
|
622
619
|
}
|
|
623
620
|
|
|
@@ -660,7 +657,7 @@ function capabilitySets() {
|
|
|
660
657
|
function apiEntityFor(rec) {
|
|
661
658
|
const m = /^GET \/V1\.0\/([^/]+)\/entityInformation\/fields$/.exec(_nullishCoalesce(rec.endpoint, () => ( "")));
|
|
662
659
|
if (m === null) {
|
|
663
|
-
throw new (0,
|
|
660
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
664
661
|
`fieldCatalog: the plan's getFieldInfo endpoint for "${rec.resource}" has no /V1.0/<Entity>/entityInformation/fields shape (${rec.endpoint}) \u2014 plan defect`,
|
|
665
662
|
{ operation: "operations.fieldCatalog" }
|
|
666
663
|
);
|
|
@@ -669,13 +666,13 @@ function apiEntityFor(rec) {
|
|
|
669
666
|
}
|
|
670
667
|
async function fieldCatalog(client, opts) {
|
|
671
668
|
if (opts !== void 0 && (typeof opts !== "object" || opts === null || Array.isArray(opts))) {
|
|
672
|
-
throw new (0,
|
|
669
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
673
670
|
"fieldCatalog: opts must be an object { resources?: string[], include?: (info|fields|udf)[], fresh?: boolean }"
|
|
674
671
|
);
|
|
675
672
|
}
|
|
676
673
|
for (const key of Object.keys(_nullishCoalesce(opts, () => ( {})))) {
|
|
677
674
|
if (!FIELD_CATALOG_OPT_KEYS.includes(key)) {
|
|
678
|
-
throw new (0,
|
|
675
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
679
676
|
`fieldCatalog: unknown opts key "${key}" \u2014 the bag is closed: ${FIELD_CATALOG_OPT_KEYS.join(", ")}`,
|
|
680
677
|
{ suggestedAction: "Drop the unknown key (autotask_describe(operations.fieldCatalog) shows the exact bag)." }
|
|
681
678
|
);
|
|
@@ -684,26 +681,26 @@ async function fieldCatalog(client, opts) {
|
|
|
684
681
|
const { fieldOps, udfOps, resources: allResources } = capabilitySets();
|
|
685
682
|
const includeRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _13 => _13.include]), () => ( ["fields"]));
|
|
686
683
|
if (!Array.isArray(includeRaw) || includeRaw.length === 0) {
|
|
687
|
-
throw new (0,
|
|
684
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("fieldCatalog: opts.include must be a non-empty array of (info|fields|udf)");
|
|
688
685
|
}
|
|
689
686
|
const include = [];
|
|
690
687
|
for (const kind of includeRaw) {
|
|
691
|
-
if (typeof kind !== "string" || !
|
|
692
|
-
throw new (0,
|
|
693
|
-
`fieldCatalog: unknown include kind "${String(kind)}" \u2014 the valid kinds are: ${
|
|
694
|
-
{ suggestedAction: `Filter with one or more of: ${
|
|
688
|
+
if (typeof kind !== "string" || !_chunkIV2Z3JLRcjs.FIELD_CACHE_KINDS.includes(kind)) {
|
|
689
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
690
|
+
`fieldCatalog: unknown include kind "${String(kind)}" \u2014 the valid kinds are: ${_chunkIV2Z3JLRcjs.FIELD_CACHE_KINDS.join(", ")}`,
|
|
691
|
+
{ suggestedAction: `Filter with one or more of: ${_chunkIV2Z3JLRcjs.FIELD_CACHE_KINDS.join(", ")} (default ['fields']).` }
|
|
695
692
|
);
|
|
696
693
|
}
|
|
697
694
|
if (!include.includes(kind)) include.push(kind);
|
|
698
695
|
}
|
|
699
696
|
const resourcesRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _14 => _14.resources]), () => ( WORKFLOW_RESOURCES));
|
|
700
697
|
if (!Array.isArray(resourcesRaw) || resourcesRaw.length === 0) {
|
|
701
|
-
throw new (0,
|
|
698
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)("fieldCatalog: opts.resources must be a non-empty array of plan resource keys");
|
|
702
699
|
}
|
|
703
700
|
const targets = [];
|
|
704
701
|
for (const r of resourcesRaw) {
|
|
705
702
|
if (typeof r !== "string" || r.trim() === "") {
|
|
706
|
-
throw new (0,
|
|
703
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
707
704
|
`fieldCatalog: opts.resources must contain non-empty plan resource key strings (got ${typeof r === "string" && r.trim() === "" ? "a blank string" : typeof r})`
|
|
708
705
|
);
|
|
709
706
|
}
|
|
@@ -711,12 +708,12 @@ async function fieldCatalog(client, opts) {
|
|
|
711
708
|
const fieldOp = fieldOps.get(key);
|
|
712
709
|
if (fieldOp === void 0) {
|
|
713
710
|
if (allResources.has(key)) {
|
|
714
|
-
throw new (0,
|
|
711
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
715
712
|
`fieldCatalog: resource "${key}" has no field catalog \u2014 the vendor defines the entityInformation trio for the ${fieldOps.size} plan entity resources only`,
|
|
716
713
|
{ suggestedAction: `Pass one of the ${fieldOps.size} field-capable plan keys (list them with autotask_catalog).` }
|
|
717
714
|
);
|
|
718
715
|
}
|
|
719
|
-
throw new (0,
|
|
716
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
720
717
|
`fieldCatalog: unknown resource "${key}" \u2014 the plan has ${fieldOps.size} field-capable resources`,
|
|
721
718
|
{
|
|
722
719
|
code: "RESOURCE_UNKNOWN",
|
|
@@ -729,7 +726,7 @@ async function fieldCatalog(client, opts) {
|
|
|
729
726
|
}
|
|
730
727
|
const cost = targets.length * include.length;
|
|
731
728
|
if (cost > MAX_FIELD_CATALOG_WIRE) {
|
|
732
|
-
throw new (0,
|
|
729
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
733
730
|
`fieldCatalog: ${targets.length} resource(s) \xD7 ${include.length} kind(s) = ${cost} metadata reads exceed the wire cap of ${MAX_FIELD_CATALOG_WIRE} \u2014 the call is refused above its cap (never truncated)`,
|
|
734
731
|
{ suggestedAction: `Pass a smaller resources list or a narrower include set so the product stays \u2264 ${MAX_FIELD_CATALOG_WIRE}.` }
|
|
735
732
|
);
|
|
@@ -744,7 +741,7 @@ async function fieldCatalog(client, opts) {
|
|
|
744
741
|
const fieldOp = fieldOps.get(resource);
|
|
745
742
|
if (fieldOp === void 0) continue;
|
|
746
743
|
const apiEntity = apiEntityFor(fieldOp);
|
|
747
|
-
const holder = client[
|
|
744
|
+
const holder = client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, resource)];
|
|
748
745
|
const row = {
|
|
749
746
|
resource,
|
|
750
747
|
apiEntity,
|
|
@@ -758,9 +755,9 @@ async function fieldCatalog(client, opts) {
|
|
|
758
755
|
error: null
|
|
759
756
|
};
|
|
760
757
|
const fetches = {
|
|
761
|
-
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _16 => _16.getEntityInfo, 'optionalCall', _17 => _17()]), () => ( Promise.reject(new (0,
|
|
762
|
-
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _18 => _18.getFieldInfo, 'optionalCall', _19 => _19()]), () => ( Promise.reject(new (0,
|
|
763
|
-
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _20 => _20.getUdfInfo, 'optionalCall', _21 => _21()]), () => ( Promise.reject(new (0,
|
|
758
|
+
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _16 => _16.getEntityInfo, 'optionalCall', _17 => _17()]), () => ( Promise.reject(new (0, _chunkIV2Z3JLRcjs.AutotaskError)(`fieldCatalog: the client exposes no getEntityInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
759
|
+
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _18 => _18.getFieldInfo, 'optionalCall', _19 => _19()]), () => ( Promise.reject(new (0, _chunkIV2Z3JLRcjs.AutotaskError)(`fieldCatalog: the client exposes no getFieldInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
760
|
+
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _20 => _20.getUdfInfo, 'optionalCall', _21 => _21()]), () => ( Promise.reject(new (0, _chunkIV2Z3JLRcjs.AutotaskError)(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))))
|
|
764
761
|
};
|
|
765
762
|
if (fresh) _optionalChain([cache, 'optionalAccess', _22 => _22.invalidate, 'call', _23 => _23(resource)]);
|
|
766
763
|
let allCached = true;
|
|
@@ -794,7 +791,7 @@ async function fieldCatalog(client, opts) {
|
|
|
794
791
|
wireUsed += 1;
|
|
795
792
|
row.wire += 1;
|
|
796
793
|
if (row.error === null) {
|
|
797
|
-
const code =
|
|
794
|
+
const code = _chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err) ? err.code : "NETWORK_ERROR";
|
|
798
795
|
const message = err instanceof Error ? err.message : String(err);
|
|
799
796
|
row.error = { code, message };
|
|
800
797
|
}
|
|
@@ -849,7 +846,7 @@ var RECOVERY_CONFIRM = "operations.recovery";
|
|
|
849
846
|
var RECOVERY_DEFAULT_LIMIT = 25;
|
|
850
847
|
var RECOVERY_MAX_LIMIT = 100;
|
|
851
848
|
function configError(message, operation, suggestedAction) {
|
|
852
|
-
throw new (0,
|
|
849
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(message, { operation, suggestedAction });
|
|
853
850
|
}
|
|
854
851
|
function parseMatchId(record) {
|
|
855
852
|
const raw = record.id;
|
|
@@ -866,7 +863,7 @@ function parseMatchId(record) {
|
|
|
866
863
|
}
|
|
867
864
|
async function recovery(client, input, opts = {}) {
|
|
868
865
|
const operation = RECOVERY_CONFIRM;
|
|
869
|
-
if (!
|
|
866
|
+
if (!_chunkIV2Z3JLRcjs.isRecord.call(void 0, input)) {
|
|
870
867
|
configError(
|
|
871
868
|
`recovery: input must be an object { resource, marker, ... } (got ${typeof input})`,
|
|
872
869
|
operation,
|
|
@@ -897,10 +894,10 @@ async function recovery(client, input, opts = {}) {
|
|
|
897
894
|
"Pass action: 'delete' for the destructive path (dry-run-first; the apply requires the confirm string)."
|
|
898
895
|
);
|
|
899
896
|
}
|
|
900
|
-
const entry =
|
|
897
|
+
const entry = _chunkIV2Z3JLRcjs.RELATIONSHIP_MAP[resource];
|
|
901
898
|
if (entry === void 0) {
|
|
902
|
-
throw new (0,
|
|
903
|
-
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(
|
|
899
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskError)(
|
|
900
|
+
`recovery: unknown resource "${resource}" \u2014 the plan has ${Object.keys(_chunkIV2Z3JLRcjs.RELATIONSHIP_MAP).length} resources`,
|
|
904
901
|
{
|
|
905
902
|
code: "RESOURCE_UNKNOWN",
|
|
906
903
|
category: "validation",
|
|
@@ -909,7 +906,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
909
906
|
}
|
|
910
907
|
);
|
|
911
908
|
}
|
|
912
|
-
const holder = client[
|
|
909
|
+
const holder = client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, resource)];
|
|
913
910
|
if (!holder || typeof holder.queryBounded !== "function") {
|
|
914
911
|
configError(
|
|
915
912
|
`recovery: ${resource} exposes no bounded query surface \u2014 the marker search cannot run`,
|
|
@@ -917,7 +914,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
917
914
|
"Use a resource with a query surface, or address the record by id directly (get/fetchMany)."
|
|
918
915
|
);
|
|
919
916
|
}
|
|
920
|
-
const field = input.field !== void 0 ? String(input.field) :
|
|
917
|
+
const field = input.field !== void 0 ? String(input.field) : _chunkIV2Z3JLRcjs.MARKER_FIELDS[resource];
|
|
921
918
|
if (typeof field !== "string" || field.trim() === "") {
|
|
922
919
|
configError(
|
|
923
920
|
`recovery: ${resource} has no plan markerField and no input.field was passed \u2014 the marker search needs a name-like field to filter on`,
|
|
@@ -953,7 +950,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
953
950
|
);
|
|
954
951
|
}
|
|
955
952
|
for (const c of input.filter) {
|
|
956
|
-
if (!
|
|
953
|
+
if (!_chunkIV2Z3JLRcjs.isRecord.call(void 0, c) || typeof c.op !== "string" || c.op === "and" || c.op === "or") {
|
|
957
954
|
configError(
|
|
958
955
|
"recovery: input.filter accepts only plain leaf conditions ({ field, op, value }) \u2014 no grouping",
|
|
959
956
|
operation,
|
|
@@ -974,7 +971,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
974
971
|
}
|
|
975
972
|
limit = input.limit;
|
|
976
973
|
}
|
|
977
|
-
const boundaryNote =
|
|
974
|
+
const boundaryNote = _chunkIV2Z3JLRcjs.DELETE_BOUNDARY_NOTES[resource];
|
|
978
975
|
const boundary = {
|
|
979
976
|
available: boundaryNote === void 0,
|
|
980
977
|
reason: _nullishCoalesce(boundaryNote, () => ( null)),
|
|
@@ -986,7 +983,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
986
983
|
};
|
|
987
984
|
const isDelete = action === "delete";
|
|
988
985
|
if (isDelete && boundaryNote !== void 0) {
|
|
989
|
-
throw new (0,
|
|
986
|
+
throw new (0, _chunkIV2Z3JLRcjs.DeleteBoundaryError)(
|
|
990
987
|
`recovery: the vendor defines no DELETE for ${resource} \u2014 the delete cannot be issued through the API (zero wire was issued)`,
|
|
991
988
|
{
|
|
992
989
|
operation,
|
|
@@ -998,7 +995,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
998
995
|
const dryRun = _optionalChain([opts, 'optionalAccess', _25 => _25.dryRun]) !== false;
|
|
999
996
|
const confirm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _26 => _26.confirm]), () => ( input.confirm));
|
|
1000
997
|
if (isDelete && !dryRun && confirm !== RECOVERY_CONFIRM) {
|
|
1001
|
-
throw new (0,
|
|
998
|
+
throw new (0, _chunkIV2Z3JLRcjs.ConfirmationRequiredError)(
|
|
1002
999
|
`recovery: action 'delete' apply is destructive and requires its confirmation flag: pass confirm: "${RECOVERY_CONFIRM}"`,
|
|
1003
1000
|
{
|
|
1004
1001
|
operation: RECOVERY_CONFIRM,
|
|
@@ -1014,7 +1011,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1014
1011
|
const query = await holder.queryBounded({ filter: conditions, limit });
|
|
1015
1012
|
if (query.hasMore) {
|
|
1016
1013
|
const wire = isDelete ? "DELETE wire" : "mutating wire";
|
|
1017
|
-
throw new (0,
|
|
1014
|
+
throw new (0, _chunkIV2Z3JLRcjs.RecoveryTruncatedError)(
|
|
1018
1015
|
`recovery: the marker search on ${resource} TRIPPED its match cap (${limit}) \u2014 more matches exist than were returned (zero ${wire} was issued)`,
|
|
1019
1016
|
{
|
|
1020
1017
|
operation,
|
|
@@ -1053,7 +1050,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1053
1050
|
return { ...base, simulated: true, dryRun: true };
|
|
1054
1051
|
}
|
|
1055
1052
|
if (unsafeId) {
|
|
1056
|
-
throw new (0,
|
|
1053
|
+
throw new (0, _chunkIV2Z3JLRcjs.MarkerUnsafeIdError)(
|
|
1057
1054
|
`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)`,
|
|
1058
1055
|
{
|
|
1059
1056
|
operation,
|
|
@@ -1064,7 +1061,7 @@ async function recovery(client, input, opts = {}) {
|
|
|
1064
1061
|
}
|
|
1065
1062
|
const deleteMethod = holder.delete;
|
|
1066
1063
|
if (deleteMethod === void 0) {
|
|
1067
|
-
throw new (0,
|
|
1064
|
+
throw new (0, _chunkIV2Z3JLRcjs.DeleteBoundaryError)(
|
|
1068
1065
|
`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`,
|
|
1069
1066
|
{
|
|
1070
1067
|
operation,
|
|
@@ -1093,14 +1090,14 @@ async function recovery(client, input, opts = {}) {
|
|
|
1093
1090
|
verify = "still-present";
|
|
1094
1091
|
}
|
|
1095
1092
|
} catch (err) {
|
|
1096
|
-
if (err instanceof
|
|
1093
|
+
if (err instanceof _chunkIV2Z3JLRcjs.NotFoundError) verify = "not-found";
|
|
1097
1094
|
else {
|
|
1098
1095
|
verify = "error";
|
|
1099
|
-
code =
|
|
1096
|
+
code = _chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
1100
1097
|
}
|
|
1101
1098
|
}
|
|
1102
1099
|
} catch (err) {
|
|
1103
|
-
code =
|
|
1100
|
+
code = _chunkIV2Z3JLRcjs.isAutotaskError.call(void 0, err) ? err.code : "SERVER_ERROR";
|
|
1104
1101
|
}
|
|
1105
1102
|
deleted.push({ id, verified: verify === "not-found", code });
|
|
1106
1103
|
}
|
|
@@ -1114,7 +1111,7 @@ function needsConfirmation(record) {
|
|
|
1114
1111
|
return record.effect === "destructive" || (_nullishCoalesce(record.flags, () => ( []))).includes("requiresApproval");
|
|
1115
1112
|
}
|
|
1116
1113
|
function refuse(message, operation, suggestedAction) {
|
|
1117
|
-
throw new (0,
|
|
1114
|
+
throw new (0, _chunkIV2Z3JLRcjs.ConfirmationRequiredError)(message, { operation, suggestedAction });
|
|
1118
1115
|
}
|
|
1119
1116
|
var MODE_BY_EFFECT = {
|
|
1120
1117
|
read: "read",
|
|
@@ -1155,7 +1152,7 @@ function looseTypeOk(type, value) {
|
|
|
1155
1152
|
case "string[]":
|
|
1156
1153
|
return Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
1157
1154
|
case "object":
|
|
1158
|
-
return
|
|
1155
|
+
return _chunkIV2Z3JLRcjs.isRecord.call(void 0, value);
|
|
1159
1156
|
default:
|
|
1160
1157
|
return true;
|
|
1161
1158
|
}
|
|
@@ -1172,7 +1169,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1172
1169
|
const schema = _nullishCoalesce(record.inputSchema, () => ( {}));
|
|
1173
1170
|
const names = Object.keys(schema);
|
|
1174
1171
|
if (args.length > names.length) {
|
|
1175
|
-
throw new (0,
|
|
1172
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1176
1173
|
`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)`,
|
|
1177
1174
|
{
|
|
1178
1175
|
operation,
|
|
@@ -1182,7 +1179,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1182
1179
|
}
|
|
1183
1180
|
const required = names.filter((n) => schema[n].required);
|
|
1184
1181
|
if (args.length < required.length) {
|
|
1185
|
-
throw new (0,
|
|
1182
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1186
1183
|
`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)}`,
|
|
1187
1184
|
{ operation }
|
|
1188
1185
|
);
|
|
@@ -1193,7 +1190,7 @@ function validateDispatchArgs(record, argsIn) {
|
|
|
1193
1190
|
const name = names[i];
|
|
1194
1191
|
const spec = schema[name];
|
|
1195
1192
|
if (!looseTypeOk(spec.type, value)) {
|
|
1196
|
-
throw new (0,
|
|
1193
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1197
1194
|
`invoke: "${operation}" arg ${i + 1} is declared ${name}: ${spec.type} \u2014 the value has the wrong type (pass a ${spec.type} value)`,
|
|
1198
1195
|
{ operation }
|
|
1199
1196
|
);
|
|
@@ -1243,11 +1240,11 @@ function validateParamsBag(record, args) {
|
|
|
1243
1240
|
const valid = PARAMS_BAG_KEYS[record.operation];
|
|
1244
1241
|
if (valid === void 0) return;
|
|
1245
1242
|
const bag = _optionalChain([args, 'optionalAccess', _27 => _27[0]]);
|
|
1246
|
-
if (bag === void 0 || bag === null || !
|
|
1243
|
+
if (bag === void 0 || bag === null || !_chunkIV2Z3JLRcjs.isRecord.call(void 0, bag)) return;
|
|
1247
1244
|
const unknown = Object.keys(bag).filter((k) => !valid.includes(k));
|
|
1248
1245
|
if (unknown.length === 0) return;
|
|
1249
1246
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, valid)]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1250
|
-
throw new (0,
|
|
1247
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1251
1248
|
`invoke: "${record.id}" params bag has unknown key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the bag is closed (valid keys: ${valid.join(", ")})`,
|
|
1252
1249
|
{
|
|
1253
1250
|
operation: record.id,
|
|
@@ -1261,7 +1258,7 @@ function validateInvokeOptions(opts, operation) {
|
|
|
1261
1258
|
const unknown = Object.keys(opts).filter((k) => !INVOKE_OPTION_KEYS.includes(k));
|
|
1262
1259
|
if (unknown.length === 0) return;
|
|
1263
1260
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, ["dryRun", "confirm", "lastModifiedDate"])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1264
|
-
throw new (0,
|
|
1261
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1265
1262
|
`invoke: "${operation}" has unknown option key(s) ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the options set is closed (valid: dryRun, confirm, lastModifiedDate)`,
|
|
1266
1263
|
{
|
|
1267
1264
|
operation,
|
|
@@ -1274,7 +1271,7 @@ function unknownKeysRefusal(raw, validKeys, subject, operation) {
|
|
|
1274
1271
|
const unknown = Object.keys(raw).filter((k) => !validKeys.includes(k));
|
|
1275
1272
|
if (unknown.length === 0) return null;
|
|
1276
1273
|
const suggestions = unknown.map((k) => [k, suggestForKey(k, [...validKeys])]).filter((pair) => pair[1] !== null).map(([k, s]) => `"${k}" \u2192 "${s}"`);
|
|
1277
|
-
return new (0,
|
|
1274
|
+
return new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1278
1275
|
`unknown ${subject} ${unknown.map((k) => `"${k}"`).join(", ")} \u2014 the ${subject} set is closed (valid keys: ${validKeys.join(", ")})`,
|
|
1279
1276
|
{
|
|
1280
1277
|
...operation !== void 0 ? { operation } : {},
|
|
@@ -1286,7 +1283,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1286
1283
|
const args = _nullishCoalesce(argsIn, () => ( []));
|
|
1287
1284
|
const record = byId.get(operation);
|
|
1288
1285
|
if (record === void 0) {
|
|
1289
|
-
throw new (0,
|
|
1286
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1290
1287
|
`invoke: unknown operation "${operation}" \u2014 it is not in the capability registry`,
|
|
1291
1288
|
{ operation, suggestedAction: "List the registry (the ./capabilities subpath) for the exact operation key." }
|
|
1292
1289
|
);
|
|
@@ -1294,17 +1291,17 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1294
1291
|
validateInvokeOptions(opts, operation);
|
|
1295
1292
|
const mode = opts.mode;
|
|
1296
1293
|
if (mode !== void 0 && MODE_BY_EFFECT[record.effect] !== mode) {
|
|
1297
|
-
throw new (0,
|
|
1294
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(crossModeRefusal(operation, record.effect, mode), { operation });
|
|
1298
1295
|
}
|
|
1299
1296
|
if (opts.dryRun !== void 0 && typeof opts.dryRun !== "boolean") {
|
|
1300
|
-
throw new (0,
|
|
1297
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1301
1298
|
`invoke: dryRun must be a boolean (got ${typeof opts.dryRun}) \u2014 "${operation}" was not issued`,
|
|
1302
1299
|
{ operation, suggestedAction: "Pass dryRun: true (simulate) or dryRun: false (apply) as a real boolean." }
|
|
1303
1300
|
);
|
|
1304
1301
|
}
|
|
1305
1302
|
const isWrite = record.effect !== "read";
|
|
1306
1303
|
if (!isWrite && opts.dryRun === true) {
|
|
1307
|
-
throw new (0,
|
|
1304
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1308
1305
|
`invoke: "${operation}" is a read \u2014 dryRun is not applicable (reads issue their request as-is)`,
|
|
1309
1306
|
{ operation }
|
|
1310
1307
|
);
|
|
@@ -1319,7 +1316,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1319
1316
|
validateDispatchArgs(record, args);
|
|
1320
1317
|
validateParamsBag(record, args);
|
|
1321
1318
|
const boundedQuery = record.kind === "primitive" && record.operation === "query";
|
|
1322
|
-
let holder = client[
|
|
1319
|
+
let holder = client[_chunkIV2Z3JLRcjs.camelKey.call(void 0, record.resource)];
|
|
1323
1320
|
if (holder === void 0 && record.resource === "operations") {
|
|
1324
1321
|
holder = {
|
|
1325
1322
|
resolveAny: (identifier, opts2) => resolveAny(client, identifier, opts2),
|
|
@@ -1346,7 +1343,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1346
1343
|
};
|
|
1347
1344
|
}
|
|
1348
1345
|
if (holder === void 0) {
|
|
1349
|
-
throw new (0,
|
|
1346
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1350
1347
|
`invoke: the client exposes no accessor for resource "${record.resource}"`,
|
|
1351
1348
|
{ operation }
|
|
1352
1349
|
);
|
|
@@ -1354,7 +1351,7 @@ async function invokeMode(client, operation, argsIn = [], opts = {}) {
|
|
|
1354
1351
|
const methodName = boundedQuery ? "queryBounded" : record.operation;
|
|
1355
1352
|
const method = holder[methodName];
|
|
1356
1353
|
if (typeof method !== "function") {
|
|
1357
|
-
throw new (0,
|
|
1354
|
+
throw new (0, _chunkIV2Z3JLRcjs.AutotaskConfigError)(
|
|
1358
1355
|
`invoke: "${record.resource}.${methodName}" is not a callable method on the client`,
|
|
1359
1356
|
{ operation }
|
|
1360
1357
|
);
|
|
@@ -1446,5 +1443,5 @@ async function invokeDelete(client, operation, args = [], opts = {}) {
|
|
|
1446
1443
|
|
|
1447
1444
|
|
|
1448
1445
|
|
|
1449
|
-
exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.FETCH_MANY_MAX_ITEMS = FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS =
|
|
1446
|
+
exports.BLIND_SURFACE_KINDS = BLIND_SURFACE_KINDS; exports.CREATE_BLOCKER_KINDS = CREATE_BLOCKER_KINDS; exports.FETCH_MANY_MAX_ITEMS = FETCH_MANY_MAX_ITEMS; exports.FIELD_CACHE_KINDS = _chunkIV2Z3JLRcjs.FIELD_CACHE_KINDS; exports.FIELD_CATALOG_HONESTY_NOTE = FIELD_CATALOG_HONESTY_NOTE; exports.INVOKE_OPTION_KEYS = INVOKE_OPTION_KEYS; exports.MAX_FIELD_CATALOG_WIRE = MAX_FIELD_CATALOG_WIRE; exports.PARAMS_BAG_KEYS = PARAMS_BAG_KEYS; exports.RECOVERY_CONFIRM = RECOVERY_CONFIRM; exports.RECOVERY_DEFAULT_LIMIT = RECOVERY_DEFAULT_LIMIT; exports.RECOVERY_MAX_LIMIT = RECOVERY_MAX_LIMIT; exports.WORKFLOW_RESOURCES = WORKFLOW_RESOURCES; exports.blindSurfaces = blindSurfaces; exports.createGuidance = createGuidance; exports.fetchMany = fetchMany; exports.fieldCatalog = 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 = validateFetchManyItems; exports.validateInvokeOptions = validateInvokeOptions; exports.validateParamsBag = validateParamsBag;
|
|
1450
1447
|
//# sourceMappingURL=index.cjs.map
|