node-autotask 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +15 -8
- package/CHANGELOG.md +574 -0
- package/MCP_TOOL_CATALOG.json +2 -2
- package/MCP_TOOL_MANIFEST.md +5 -5
- package/N8N_MCP_MANIFEST.json +2 -2
- package/N8N_MCP_MANIFEST.md +3 -3
- package/README.md +8 -4
- package/capabilities.json +1223 -1223
- package/dist/capabilities.cjs +2 -2
- package/dist/capabilities.js +1 -1
- package/dist/{chunk-W2WSZOZA.js → chunk-4YKV7ORF.js} +2 -2
- package/dist/{chunk-7I3F3AJJ.cjs → chunk-7RDR5DSI.cjs} +393 -393
- package/dist/{chunk-HXOWEYV3.js → chunk-D5RAQ4DE.js} +2 -2
- package/dist/{chunk-5O5EPYBO.cjs → chunk-JM52ZU7T.cjs} +1222 -1222
- package/dist/{chunk-VYUZZIEE.js → chunk-LB2X4X4B.js} +86 -8
- package/dist/{chunk-VV2UUW2J.js → chunk-NDK7WYWA.js} +1222 -1222
- package/dist/{chunk-WRWX6WIK.cjs → chunk-QDYSHAU6.cjs} +147 -69
- package/dist/{chunk-G564CHXM.cjs → chunk-TIM75K3G.cjs} +135 -135
- package/dist/{index-BqPY04ZG.d.ts → index-DLugNSr7.d.ts} +27 -13
- package/dist/{index-D7x3MkLK.d.cts → index-aZ3tCh1h.d.cts} +27 -13
- package/dist/index.cjs +24 -22
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -4
- package/dist/operations/index.cjs +109 -109
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +2 -2
- package/dist/pool.cjs +8 -8
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +4 -4
- package/dist/resources/index.cjs +4 -4
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +3 -3
- package/docs/API.md +48 -18
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJM52ZU7Tcjs = require('./chunk-JM52ZU7T.cjs');
|
|
4
4
|
|
|
5
5
|
// src/auth.ts
|
|
6
6
|
var AUTH_HEADERS = {
|
|
@@ -1536,6 +1536,7 @@ var DEFAULT_TIMEOUT_MS = 3e4;
|
|
|
1536
1536
|
var DEFAULT_MAX_RETRIES = 3;
|
|
1537
1537
|
var DEFAULT_MAINTENANCE_MAX_WAIT_MS = 36e5;
|
|
1538
1538
|
var DEFAULT_MAINTENANCE_POLL_MS = 3e4;
|
|
1539
|
+
var MAINTENANCE_WINDOW_MAX_MS = 4 * 36e5;
|
|
1539
1540
|
var DEFAULT_MAX_CONCURRENT = 10;
|
|
1540
1541
|
var DEFAULT_MAX_RESPONSE_BYTES = 64 * 1024 * 1024;
|
|
1541
1542
|
var DEFAULT_MAX_SCAN_RECORDS = 500;
|
|
@@ -14779,9 +14780,21 @@ function backoffDelay(attempt) {
|
|
|
14779
14780
|
const exp = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);
|
|
14780
14781
|
return Math.floor(exp / 2 + Math.random() * (exp / 2));
|
|
14781
14782
|
}
|
|
14782
|
-
|
|
14783
|
-
|
|
14784
|
-
return
|
|
14783
|
+
var MAINTENANCE_PROBE_BYTES = 256;
|
|
14784
|
+
function maintenanceProbe(text) {
|
|
14785
|
+
return Buffer.from(text, "utf8").subarray(0, MAINTENANCE_PROBE_BYTES).toString("utf8");
|
|
14786
|
+
}
|
|
14787
|
+
function looksLikeMaintenanceText(text) {
|
|
14788
|
+
return /maintenance|temporarily unavailable|service unavailable|outage|downtime|down for/i.test(
|
|
14789
|
+
maintenanceProbe(text)
|
|
14790
|
+
);
|
|
14791
|
+
}
|
|
14792
|
+
function isHtmlLike(contentType, body) {
|
|
14793
|
+
if (contentType !== null && /text\/html|application\/xhtml/i.test(contentType)) return true;
|
|
14794
|
+
return body.trimStart().startsWith("<");
|
|
14795
|
+
}
|
|
14796
|
+
function maintenanceExhaustedAction(maxWaitMs, waits) {
|
|
14797
|
+
return `The zone stayed in a maintenance window for ${Math.round(maxWaitMs / 6e4)} min \u2014 the SDK waited and retried ${waits} time(s) and gave up. Re-run after the window (the observed median is about 2 h; the ceiling is 4 h \u2014 MAINTENANCE_WINDOW_MAX_MS), or raise maintenanceMaxWaitMs.`;
|
|
14785
14798
|
}
|
|
14786
14799
|
function parseRetryAfter(value) {
|
|
14787
14800
|
if (value === null || value.length === 0) return void 0;
|
|
@@ -14799,7 +14812,7 @@ function isAbortLike(err) {
|
|
|
14799
14812
|
return typeof err === "object" && err !== null && "name" in err && err.name === "AbortError";
|
|
14800
14813
|
}
|
|
14801
14814
|
function isJsonMediaType(header) {
|
|
14802
|
-
const mediaType = _nullishCoalesce(_optionalChain([header, 'access',
|
|
14815
|
+
const mediaType = _nullishCoalesce(_optionalChain([header, 'access', _57 => _57.split, 'call', _58 => _58(";"), 'access', _59 => _59[0], 'optionalAccess', _60 => _60.trim, 'call', _61 => _61(), 'access', _62 => _62.toLowerCase, 'call', _63 => _63()]), () => ( ""));
|
|
14803
14816
|
return mediaType.startsWith("application/json") || mediaType.endsWith("+json");
|
|
14804
14817
|
}
|
|
14805
14818
|
function bodySnippet(text, redactPersonalData) {
|
|
@@ -14955,7 +14968,7 @@ var HttpClient = (_class6 = class {
|
|
|
14955
14968
|
this.maintenanceMaxWaitMs = config.maintenanceMaxWaitMs;
|
|
14956
14969
|
this.maintenancePollMs = config.maintenancePollMs;
|
|
14957
14970
|
this.maxResponseBytes = config.maxResponseBytes;
|
|
14958
|
-
this.perHour = _optionalChain([config, 'access',
|
|
14971
|
+
this.perHour = _optionalChain([config, 'access', _64 => _64.rateLimit, 'optionalAccess', _65 => _65.perHour]);
|
|
14959
14972
|
this.tenantKey = buildTenantKey(config.userName, config.baseUrl);
|
|
14960
14973
|
this.cooldownStore = config.cooldown.enabled ? _nullishCoalesce(config.cooldown.store, () => ( defaultCooldownStore())) : void 0;
|
|
14961
14974
|
this.cooldownMaxMs = config.cooldown.maxMs;
|
|
@@ -15016,7 +15029,7 @@ var HttpClient = (_class6 = class {
|
|
|
15016
15029
|
};
|
|
15017
15030
|
if (next.successes >= breaker.successesToClose) {
|
|
15018
15031
|
breaker.store.delete(key);
|
|
15019
|
-
_optionalChain([this, 'access',
|
|
15032
|
+
_optionalChain([this, 'access', _66 => _66.logger, 'access', _67 => _67.warn, 'optionalCall', _68 => _68(
|
|
15020
15033
|
`[autotask] circuit breaker CLOSED for ${key} (${next.successes} probe successes)`,
|
|
15021
15034
|
void 0
|
|
15022
15035
|
)]);
|
|
@@ -15046,7 +15059,7 @@ var HttpClient = (_class6 = class {
|
|
|
15046
15059
|
const failures = [...st.failures.filter((t) => t > now - breaker.failureWindowMs), now];
|
|
15047
15060
|
if (failures.length >= breaker.failureThreshold) {
|
|
15048
15061
|
breaker.store.set(key, { failures, openedAt: now, successes: 0, probes: 0 });
|
|
15049
|
-
_optionalChain([this, 'access',
|
|
15062
|
+
_optionalChain([this, 'access', _69 => _69.logger, 'access', _70 => _70.warn, 'optionalCall', _71 => _71(
|
|
15050
15063
|
`[autotask] circuit breaker OPEN for ${key} (${failures.length} counted failures in ${Math.round(breaker.failureWindowMs / 1e3)}s) \u2014 refusing locally for ${Math.round(breaker.openTimeoutMs / 1e3)}s`,
|
|
15051
15064
|
correlationId
|
|
15052
15065
|
)]);
|
|
@@ -15161,7 +15174,7 @@ var HttpClient = (_class6 = class {
|
|
|
15161
15174
|
return void 0;
|
|
15162
15175
|
}
|
|
15163
15176
|
if (res.status < 200 || res.status >= 300) {
|
|
15164
|
-
await _optionalChain([res, 'access',
|
|
15177
|
+
await _optionalChain([res, 'access', _72 => _72.body, 'optionalAccess', _73 => _73.cancel, 'call', _74 => _74(), 'access', _75 => _75.catch, 'call', _76 => _76(() => void 0)]);
|
|
15165
15178
|
return void 0;
|
|
15166
15179
|
}
|
|
15167
15180
|
let text;
|
|
@@ -15197,7 +15210,7 @@ var HttpClient = (_class6 = class {
|
|
|
15197
15210
|
this.liveBaseUrl = to;
|
|
15198
15211
|
this.tenantKey = buildTenantKey(this.auth.userName, to);
|
|
15199
15212
|
this.breakerKey = buildBreakerKey(to);
|
|
15200
|
-
_optionalChain([this, 'access',
|
|
15213
|
+
_optionalChain([this, 'access', _77 => _77.logger, 'access', _78 => _78.warn, 'optionalCall', _79 => _79(
|
|
15201
15214
|
`[autotask] zone re-point ${from} -> ${to} (a 401 on the stale zone base; the vendor's unauthenticated zone discovery named the tenant's current zone) \u2014 retrying the request once against the new base`,
|
|
15202
15215
|
void 0
|
|
15203
15216
|
)]);
|
|
@@ -15217,6 +15230,7 @@ var HttpClient = (_class6 = class {
|
|
|
15217
15230
|
const maintenancePollMs = _nullishCoalesce(opts.maintenancePollMs, () => ( this.maintenancePollMs));
|
|
15218
15231
|
let firstMaintenanceAt;
|
|
15219
15232
|
let maintenanceWaits = 0;
|
|
15233
|
+
let maintenanceBudgetSpent = false;
|
|
15220
15234
|
const started = Date.now();
|
|
15221
15235
|
let deadlineAt = started + timeoutMs;
|
|
15222
15236
|
const callerSignal = _nullishCoalesce(opts.signal, () => ( ambientSignal.getStore()));
|
|
@@ -15235,7 +15249,7 @@ var HttpClient = (_class6 = class {
|
|
|
15235
15249
|
const expectBody = _nullishCoalesce(opts.expectBody, () => ( method !== "DELETE"));
|
|
15236
15250
|
const ctx = { operation: opts.operation, url, correlationId };
|
|
15237
15251
|
let lastStatus;
|
|
15238
|
-
const interrupted = () => _optionalChain([callerSignal, 'optionalAccess',
|
|
15252
|
+
const interrupted = () => _optionalChain([callerSignal, 'optionalAccess', _80 => _80.aborted]) ? new AutotaskAbortError(`Request aborted: ${method} ${opts.path}`, { ...ctx, suggestedAction: "The caller aborted; re-issue the call if still needed." }) : new AutotaskTimeoutError(`Request timed out after ${timeoutMs}ms: ${method} ${opts.path}`, ctx);
|
|
15239
15253
|
const canWait = (delay) => delay <= MAX_RETRY_DELAY_MS && delay < deadlineAt - Date.now();
|
|
15240
15254
|
const pause = async (delay) => {
|
|
15241
15255
|
try {
|
|
@@ -15249,7 +15263,7 @@ var HttpClient = (_class6 = class {
|
|
|
15249
15263
|
if (deadline2 !== void 0) {
|
|
15250
15264
|
const remainingMs = deadline2 - Date.now();
|
|
15251
15265
|
if (remainingMs > 0) {
|
|
15252
|
-
if (_optionalChain([callerSignal, 'optionalAccess',
|
|
15266
|
+
if (_optionalChain([callerSignal, 'optionalAccess', _81 => _81.aborted])) throw interrupted();
|
|
15253
15267
|
const seconds = Math.ceil(remainingMs / 1e3);
|
|
15254
15268
|
const err = new RateLimitError(
|
|
15255
15269
|
`Tenant is in a rate-limit cooldown; the call was NOT sent. ${seconds}s remain \u2014 do not retry before then, and narrow the query (filter/includeFields) before retrying.`,
|
|
@@ -15280,7 +15294,7 @@ var HttpClient = (_class6 = class {
|
|
|
15280
15294
|
let breakerProbe = false;
|
|
15281
15295
|
let breakerProbeKey;
|
|
15282
15296
|
if (this.breaker !== void 0 && !opts.bypassCircuitBreaker) {
|
|
15283
|
-
if (_optionalChain([callerSignal, 'optionalAccess',
|
|
15297
|
+
if (_optionalChain([callerSignal, 'optionalAccess', _82 => _82.aborted])) throw interrupted();
|
|
15284
15298
|
const now = Date.now();
|
|
15285
15299
|
const st = this.breaker.store.get(this.breakerKey);
|
|
15286
15300
|
if (st !== void 0 && st.openedAt !== null) {
|
|
@@ -15338,7 +15352,7 @@ var HttpClient = (_class6 = class {
|
|
|
15338
15352
|
breakerProbeKey = this.breakerKey;
|
|
15339
15353
|
}
|
|
15340
15354
|
}
|
|
15341
|
-
_optionalChain([this, 'access',
|
|
15355
|
+
_optionalChain([this, 'access', _83 => _83.logger, 'access', _84 => _84.debug, 'optionalCall', _85 => _85(`[autotask] ${method} ${opts.path}`, correlationId)]);
|
|
15342
15356
|
try {
|
|
15343
15357
|
let attempt = 0;
|
|
15344
15358
|
let outcome = null;
|
|
@@ -15358,7 +15372,7 @@ var HttpClient = (_class6 = class {
|
|
|
15358
15372
|
if (signal.aborted || isAbortLike(err2)) throw interrupted();
|
|
15359
15373
|
const delay = backoffDelay(attempt);
|
|
15360
15374
|
if (attempt < maxRetries && retriable5xx && canWait(delay)) {
|
|
15361
|
-
_optionalChain([this, 'access',
|
|
15375
|
+
_optionalChain([this, 'access', _86 => _86.logger, 'access', _87 => _87.warn, 'optionalCall', _88 => _88(
|
|
15362
15376
|
`[autotask] network error on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15363
15377
|
correlationId
|
|
15364
15378
|
)]);
|
|
@@ -15376,7 +15390,7 @@ var HttpClient = (_class6 = class {
|
|
|
15376
15390
|
try {
|
|
15377
15391
|
status = res.status;
|
|
15378
15392
|
if (status >= 300 && status < 400) {
|
|
15379
|
-
await _optionalChain([res, 'access',
|
|
15393
|
+
await _optionalChain([res, 'access', _89 => _89.body, 'optionalAccess', _90 => _90.cancel, 'call', _91 => _91(), 'access', _92 => _92.catch, 'call', _93 => _93(() => void 0)]);
|
|
15380
15394
|
throw new ResponseRejectedError(
|
|
15381
15395
|
`Refused to follow a ${status} redirect for ${method} ${opts.path}`,
|
|
15382
15396
|
{ ...ctx, code: "REDIRECT_BLOCKED", httpStatus: status, suggestedAction: "Check the configured zone/baseUrl; the API does not redirect." }
|
|
@@ -15437,14 +15451,15 @@ var HttpClient = (_class6 = class {
|
|
|
15437
15451
|
httpStatus: status,
|
|
15438
15452
|
suggestedAction: "The zone returned a non-JSON 2xx body; verify baseUrl points at the REST API."
|
|
15439
15453
|
});
|
|
15440
|
-
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && maintenanceMaxWaitMs > 0 &&
|
|
15454
|
+
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && maintenanceMaxWaitMs > 0 && looksLikeMaintenanceText(text)) {
|
|
15441
15455
|
const now = Date.now();
|
|
15442
15456
|
firstMaintenanceAt ??= now;
|
|
15443
15457
|
const remaining = maintenanceMaxWaitMs - (now - firstMaintenanceAt);
|
|
15444
15458
|
if (remaining > 0) {
|
|
15445
15459
|
const wait = Math.min(maintenancePollMs, remaining);
|
|
15460
|
+
if (wait >= remaining) maintenanceBudgetSpent = true;
|
|
15446
15461
|
maintenanceWaits += 1;
|
|
15447
|
-
_optionalChain([this, 'access',
|
|
15462
|
+
_optionalChain([this, 'access', _94 => _94.logger, 'access', _95 => _95.warn, 'optionalCall', _96 => _96(
|
|
15448
15463
|
`[autotask] maintenance window on ${method} ${opts.path}; waiting ${Math.round(wait / 1e3)}s (retry ${maintenanceWaits}, up to ${Math.round(maintenanceMaxWaitMs / 6e4)} min)`,
|
|
15449
15464
|
correlationId
|
|
15450
15465
|
)]);
|
|
@@ -15453,12 +15468,13 @@ var HttpClient = (_class6 = class {
|
|
|
15453
15468
|
await pause(wait);
|
|
15454
15469
|
continue;
|
|
15455
15470
|
}
|
|
15471
|
+
maintenanceBudgetSpent = true;
|
|
15456
15472
|
}
|
|
15457
15473
|
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && retriable5xx && attempt < maxRetries) {
|
|
15458
15474
|
const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
|
|
15459
15475
|
const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
|
|
15460
15476
|
if (canWait(delay)) {
|
|
15461
|
-
_optionalChain([this, 'access',
|
|
15477
|
+
_optionalChain([this, 'access', _97 => _97.logger, 'access', _98 => _98.warn, 'optionalCall', _99 => _99(
|
|
15462
15478
|
`[autotask] non-JSON 2xx on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15463
15479
|
correlationId
|
|
15464
15480
|
)]);
|
|
@@ -15467,17 +15483,27 @@ var HttpClient = (_class6 = class {
|
|
|
15467
15483
|
continue;
|
|
15468
15484
|
}
|
|
15469
15485
|
}
|
|
15470
|
-
|
|
15486
|
+
const pageSnippet = typeof _optionalChain([err2, 'access', _100 => _100.details, 'optionalAccess', _101 => _101.bodySnippet]) === "string" ? err2.details.bodySnippet : "";
|
|
15487
|
+
if (maintenanceWaits > 0) {
|
|
15471
15488
|
err2.details = {
|
|
15472
15489
|
..._nullishCoalesce(err2.details, () => ( {})),
|
|
15473
15490
|
maintenance: {
|
|
15474
15491
|
waits: maintenanceWaits,
|
|
15475
15492
|
waitedMs: Date.now() - (_nullishCoalesce(firstMaintenanceAt, () => ( Date.now()))),
|
|
15476
15493
|
maxWaitMs: maintenanceMaxWaitMs,
|
|
15477
|
-
exhausted:
|
|
15494
|
+
exhausted: maintenanceBudgetSpent
|
|
15478
15495
|
}
|
|
15479
15496
|
};
|
|
15480
|
-
|
|
15497
|
+
if (maintenanceBudgetSpent) {
|
|
15498
|
+
err2.suggestedAction = maintenanceExhaustedAction(maintenanceMaxWaitMs, maintenanceWaits);
|
|
15499
|
+
}
|
|
15500
|
+
}
|
|
15501
|
+
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && !looksLikeMaintenanceText(text) && isHtmlLike(res.headers.get("Content-Type"), text)) {
|
|
15502
|
+
err2.details = { ..._nullishCoalesce(err2.details, () => ( {})), maintenancePatternMiss: true };
|
|
15503
|
+
_optionalChain([this, 'access', _102 => _102.logger, 'access', _103 => _103.debug, 'optionalCall', _104 => _104(
|
|
15504
|
+
`[autotask] non-JSON body did not match the maintenance vocabulary on ${method} ${opts.path}: ${pageSnippet}`,
|
|
15505
|
+
correlationId
|
|
15506
|
+
)]);
|
|
15481
15507
|
}
|
|
15482
15508
|
attachEmptyReasonDetails(err2);
|
|
15483
15509
|
throw err2;
|
|
@@ -15489,20 +15515,45 @@ var HttpClient = (_class6 = class {
|
|
|
15489
15515
|
break;
|
|
15490
15516
|
}
|
|
15491
15517
|
let body;
|
|
15518
|
+
let nonJsonBody;
|
|
15492
15519
|
if (text.length > 0) {
|
|
15493
15520
|
try {
|
|
15494
15521
|
body = JSON.parse(text);
|
|
15495
15522
|
} catch (e13) {
|
|
15496
15523
|
body = text;
|
|
15524
|
+
nonJsonBody = text;
|
|
15497
15525
|
}
|
|
15498
15526
|
}
|
|
15527
|
+
const nonJsonSnippet = nonJsonBody === void 0 ? void 0 : bodySnippet(nonJsonBody, this.redactPersonalData);
|
|
15528
|
+
const nonJsonIsMaintenance = nonJsonBody !== void 0 && looksLikeMaintenanceText(nonJsonBody);
|
|
15529
|
+
const nonJsonIsHtmlCandidate = nonJsonBody !== void 0 && isHtmlLike(res.headers.get("Content-Type"), nonJsonBody);
|
|
15530
|
+
const nonJsonMaintenanceMayWait = nonJsonIsMaintenance && retriable5xx;
|
|
15531
|
+
if (nonJsonBody !== void 0 && maintenanceMaxWaitMs > 0 && nonJsonMaintenanceMayWait) {
|
|
15532
|
+
const now = Date.now();
|
|
15533
|
+
firstMaintenanceAt ??= now;
|
|
15534
|
+
const remaining = maintenanceMaxWaitMs - (now - firstMaintenanceAt);
|
|
15535
|
+
if (remaining > 0) {
|
|
15536
|
+
const wait = Math.min(maintenancePollMs, remaining);
|
|
15537
|
+
if (wait >= remaining) maintenanceBudgetSpent = true;
|
|
15538
|
+
maintenanceWaits += 1;
|
|
15539
|
+
_optionalChain([this, 'access', _105 => _105.logger, 'access', _106 => _106.warn, 'optionalCall', _107 => _107(
|
|
15540
|
+
`[autotask] maintenance window on ${method} ${opts.path} (HTTP ${status}); waiting ${Math.round(wait / 1e3)}s (retry ${maintenanceWaits}, up to ${Math.round(maintenanceMaxWaitMs / 6e4)} min)`,
|
|
15541
|
+
correlationId
|
|
15542
|
+
)]);
|
|
15543
|
+
deadlineAt = Date.now() + wait + timeoutMs;
|
|
15544
|
+
armDeadline(deadlineAt - Date.now());
|
|
15545
|
+
await pause(wait);
|
|
15546
|
+
continue;
|
|
15547
|
+
}
|
|
15548
|
+
maintenanceBudgetSpent = true;
|
|
15549
|
+
}
|
|
15499
15550
|
const deterministic500 = status >= 500 && isDeterministicVendor500(parseVendorErrors(body));
|
|
15500
15551
|
const retryableStatus = status === 429 || status >= 500;
|
|
15501
15552
|
if (retryableStatus && !deterministic500 && attempt < maxRetries && (status === 429 ? retriable : retriable5xx)) {
|
|
15502
15553
|
const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
|
|
15503
15554
|
const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
|
|
15504
15555
|
if (canWait(delay)) {
|
|
15505
|
-
_optionalChain([this, 'access',
|
|
15556
|
+
_optionalChain([this, 'access', _108 => _108.logger, 'access', _109 => _109.warn, 'optionalCall', _110 => _110(
|
|
15506
15557
|
`[autotask] ${status} on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15507
15558
|
correlationId
|
|
15508
15559
|
)]);
|
|
@@ -15515,7 +15566,7 @@ var HttpClient = (_class6 = class {
|
|
|
15515
15566
|
const target = await this.discoverZoneBase(signal, ctx);
|
|
15516
15567
|
const targetViolation = target === void 0 || this.hostPolicy === void 0 ? null : decideHostPolicy(target, this.hostPolicy);
|
|
15517
15568
|
if (targetViolation !== null) {
|
|
15518
|
-
_optionalChain([this, 'access',
|
|
15569
|
+
_optionalChain([this, 'access', _111 => _111.logger, 'access', _112 => _112.warn, 'optionalCall', _113 => _113(
|
|
15519
15570
|
`[autotask] zone re-point refused by hostPolicy (${targetViolation.bound}): ${targetViolation.origin} \u2014 the original 401 propagates, zero wire to the refused host`,
|
|
15520
15571
|
void 0
|
|
15521
15572
|
)]);
|
|
@@ -15537,6 +15588,32 @@ var HttpClient = (_class6 = class {
|
|
|
15537
15588
|
credentialShapeExpectation(headers, this.auth)
|
|
15538
15589
|
);
|
|
15539
15590
|
err.correlationId = correlationId;
|
|
15591
|
+
if (maintenanceWaits > 0) {
|
|
15592
|
+
err.details = {
|
|
15593
|
+
..._nullishCoalesce(err.details, () => ( {})),
|
|
15594
|
+
maintenance: {
|
|
15595
|
+
waits: maintenanceWaits,
|
|
15596
|
+
waitedMs: Date.now() - (_nullishCoalesce(firstMaintenanceAt, () => ( Date.now()))),
|
|
15597
|
+
maxWaitMs: maintenanceMaxWaitMs,
|
|
15598
|
+
exhausted: maintenanceBudgetSpent
|
|
15599
|
+
}
|
|
15600
|
+
};
|
|
15601
|
+
if (maintenanceBudgetSpent) {
|
|
15602
|
+
err.suggestedAction = maintenanceExhaustedAction(maintenanceMaxWaitMs, maintenanceWaits);
|
|
15603
|
+
}
|
|
15604
|
+
}
|
|
15605
|
+
if (nonJsonBody !== void 0) {
|
|
15606
|
+
if (nonJsonIsMaintenance && !retriable5xx) {
|
|
15607
|
+
err.details = { ..._nullishCoalesce(err.details, () => ( {})), maintenanceDetected: true };
|
|
15608
|
+
err.suggestedAction = `A maintenance-shaped page answered ${method} ${opts.path} (HTTP ${status}); it was NOT waited out or re-sent \u2014 a non-2xx edge page can arrive after the request was forwarded, so verify the record before re-issuing (only a GET or an explicitly idempotent-flagged call waits this window out).`;
|
|
15609
|
+
} else if (!nonJsonIsMaintenance && nonJsonIsHtmlCandidate) {
|
|
15610
|
+
err.details = { ..._nullishCoalesce(err.details, () => ( {})), maintenancePatternMiss: true };
|
|
15611
|
+
_optionalChain([this, 'access', _114 => _114.logger, 'access', _115 => _115.debug, 'optionalCall', _116 => _116(
|
|
15612
|
+
`[autotask] non-JSON body did not match the maintenance vocabulary on ${method} ${opts.path}: ${nonJsonSnippet}`,
|
|
15613
|
+
correlationId
|
|
15614
|
+
)]);
|
|
15615
|
+
}
|
|
15616
|
+
}
|
|
15540
15617
|
if (status === 401 && zoneRetry !== void 0) {
|
|
15541
15618
|
err.details = {
|
|
15542
15619
|
..._nullishCoalesce(err.details, () => ( {})),
|
|
@@ -15553,7 +15630,7 @@ var HttpClient = (_class6 = class {
|
|
|
15553
15630
|
threadThreshold
|
|
15554
15631
|
});
|
|
15555
15632
|
this.cooldownStore.set(this.tenantKey, Date.now() + durationMs);
|
|
15556
|
-
_optionalChain([this, 'access',
|
|
15633
|
+
_optionalChain([this, 'access', _117 => _117.logger, 'access', _118 => _118.warn, 'optionalCall', _119 => _119(
|
|
15557
15634
|
`[autotask] 429 on ${method} ${opts.path} surfaces after ${attempt + 1} attempt(s); tenant cooldown armed for ${Math.round(durationMs / 1e3)}s`,
|
|
15558
15635
|
correlationId
|
|
15559
15636
|
)]);
|
|
@@ -15598,7 +15675,7 @@ var HttpClient = (_class6 = class {
|
|
|
15598
15675
|
if (this.fieldCache !== void 0 && err instanceof AutotaskError) {
|
|
15599
15676
|
const op = typeof opts.operation === "string" ? opts.operation : void 0;
|
|
15600
15677
|
const verb = op !== void 0 ? op.slice(op.lastIndexOf(".") + 1) : "";
|
|
15601
|
-
const drift = _optionalChain([err, 'access',
|
|
15678
|
+
const drift = _optionalChain([err, 'access', _120 => _120.details, 'optionalAccess', _121 => _121.deterministic]) === true || err.code === "INVALID_RESPONSE" && META_TRIO_VERBS.has(verb);
|
|
15602
15679
|
if (drift && op !== void 0) {
|
|
15603
15680
|
const dot = op.indexOf(".");
|
|
15604
15681
|
if (dot > 0) this.fieldCache.invalidate(op.slice(0, dot));
|
|
@@ -15608,7 +15685,7 @@ var HttpClient = (_class6 = class {
|
|
|
15608
15685
|
} finally {
|
|
15609
15686
|
clearTimeout(deadlineTimer);
|
|
15610
15687
|
if (!(method === "GET" || opts.idempotent === true)) {
|
|
15611
|
-
_optionalChain([this, 'access',
|
|
15688
|
+
_optionalChain([this, 'access', _122 => _122.readCache, 'optionalAccess', _123 => _123.clear, 'call', _124 => _124()]);
|
|
15612
15689
|
const nameOp = typeof opts.operation === "string" ? opts.operation : void 0;
|
|
15613
15690
|
const nameDot = nameOp !== void 0 ? nameOp.indexOf(".") : -1;
|
|
15614
15691
|
if (this.resourceNameCache !== void 0 && nameOp !== void 0 && nameDot > 0 && nameOp.slice(0, nameDot) === "resources") {
|
|
@@ -15628,7 +15705,7 @@ function attachEmptyReasonDetails(err) {
|
|
|
15628
15705
|
const resource = err.operation.slice(0, dot);
|
|
15629
15706
|
const op = err.operation.slice(dot + 1);
|
|
15630
15707
|
const surface = err.operation;
|
|
15631
|
-
const stamp = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
15708
|
+
const stamp = _optionalChain([EMPTY_REASON_STAMPS, 'access', _125 => _125[resource], 'optionalAccess', _126 => _126[op]]);
|
|
15632
15709
|
const pointer = POINTER_NOTES[surface];
|
|
15633
15710
|
const isGetMiss = err instanceof NotFoundError && op === "get";
|
|
15634
15711
|
if (stamp === void 0 && pointer === void 0 && !isGetMiss) return;
|
|
@@ -15918,7 +15995,7 @@ async function expandResourceNames(client, ids, opts = {}) {
|
|
|
15918
15995
|
continue;
|
|
15919
15996
|
}
|
|
15920
15997
|
}
|
|
15921
|
-
const epoch = _nullishCoalesce(_optionalChain([cache, 'optionalAccess',
|
|
15998
|
+
const epoch = _nullishCoalesce(_optionalChain([cache, 'optionalAccess', _127 => _127.epoch]), () => ( 0));
|
|
15922
15999
|
const work = (async () => {
|
|
15923
16000
|
try {
|
|
15924
16001
|
const record = await holder.get(id, { fresh });
|
|
@@ -16005,7 +16082,7 @@ function capabilitySets() {
|
|
|
16005
16082
|
const fieldOps = /* @__PURE__ */ new Map();
|
|
16006
16083
|
const udfOps = /* @__PURE__ */ new Map();
|
|
16007
16084
|
const resources = /* @__PURE__ */ new Set();
|
|
16008
|
-
for (const rec of
|
|
16085
|
+
for (const rec of _chunkJM52ZU7Tcjs.CAPABILITIES) {
|
|
16009
16086
|
if (rec.resource === "operations") continue;
|
|
16010
16087
|
resources.add(rec.resource);
|
|
16011
16088
|
if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
|
|
@@ -16038,7 +16115,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16038
16115
|
}
|
|
16039
16116
|
}
|
|
16040
16117
|
const { fieldOps, udfOps, resources: allResources } = capabilitySets();
|
|
16041
|
-
const includeRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
16118
|
+
const includeRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _128 => _128.include]), () => ( ["fields"]));
|
|
16042
16119
|
if (!Array.isArray(includeRaw) || includeRaw.length === 0) {
|
|
16043
16120
|
throw new AutotaskConfigError("fieldCatalog: opts.include must be a non-empty array of (info|fields|udf)");
|
|
16044
16121
|
}
|
|
@@ -16052,7 +16129,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16052
16129
|
}
|
|
16053
16130
|
if (!include.includes(kind)) include.push(kind);
|
|
16054
16131
|
}
|
|
16055
|
-
const resourcesRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
16132
|
+
const resourcesRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _129 => _129.resources]), () => ( WORKFLOW_RESOURCES));
|
|
16056
16133
|
if (!Array.isArray(resourcesRaw) || resourcesRaw.length === 0) {
|
|
16057
16134
|
throw new AutotaskConfigError("fieldCatalog: opts.resources must be a non-empty array of plan resource keys");
|
|
16058
16135
|
}
|
|
@@ -16084,7 +16161,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16084
16161
|
if (!targets.includes(key)) targets.push(key);
|
|
16085
16162
|
}
|
|
16086
16163
|
let fieldsFilter;
|
|
16087
|
-
const fieldsRaw = _optionalChain([opts, 'optionalAccess',
|
|
16164
|
+
const fieldsRaw = _optionalChain([opts, 'optionalAccess', _130 => _130.fields]);
|
|
16088
16165
|
if (fieldsRaw !== void 0) {
|
|
16089
16166
|
if (!Array.isArray(fieldsRaw) || fieldsRaw.length === 0) {
|
|
16090
16167
|
throw new AutotaskConfigError("fieldCatalog: opts.fields must be a non-empty array of vendor field name strings");
|
|
@@ -16106,7 +16183,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16106
16183
|
`fieldCatalog: opts.labels must be a boolean (got ${typeof opts.labels})`
|
|
16107
16184
|
);
|
|
16108
16185
|
}
|
|
16109
|
-
const labels = _optionalChain([opts, 'optionalAccess',
|
|
16186
|
+
const labels = _optionalChain([opts, 'optionalAccess', _131 => _131.labels]) === true;
|
|
16110
16187
|
const cost = targets.length * include.length;
|
|
16111
16188
|
if (cost > MAX_FIELD_CATALOG_WIRE) {
|
|
16112
16189
|
throw new AutotaskConfigError(
|
|
@@ -16115,7 +16192,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16115
16192
|
);
|
|
16116
16193
|
}
|
|
16117
16194
|
const cache = client.http.fieldCache;
|
|
16118
|
-
const fresh = _optionalChain([opts, 'optionalAccess',
|
|
16195
|
+
const fresh = _optionalChain([opts, 'optionalAccess', _132 => _132.fresh]) === true;
|
|
16119
16196
|
const zone = _nullishCoalesce(client.config.zone, () => ( "unknown"));
|
|
16120
16197
|
const rows = [];
|
|
16121
16198
|
let wireUsed = 0;
|
|
@@ -16139,11 +16216,11 @@ async function fieldCatalog(client, opts) {
|
|
|
16139
16216
|
error: null
|
|
16140
16217
|
};
|
|
16141
16218
|
const fetches = {
|
|
16142
|
-
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16143
|
-
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16144
|
-
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16219
|
+
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _133 => _133.getEntityInfo, 'optionalCall', _134 => _134()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getEntityInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
16220
|
+
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _135 => _135.getFieldInfo, 'optionalCall', _136 => _136()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getFieldInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
16221
|
+
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _137 => _137.getUdfInfo, 'optionalCall', _138 => _138()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))))
|
|
16145
16222
|
};
|
|
16146
|
-
if (fresh) _optionalChain([cache, 'optionalAccess',
|
|
16223
|
+
if (fresh) _optionalChain([cache, 'optionalAccess', _139 => _139.invalidate, 'call', _140 => _140(resource)]);
|
|
16147
16224
|
let allCached = true;
|
|
16148
16225
|
const ages = [];
|
|
16149
16226
|
for (const kind of include) {
|
|
@@ -16196,7 +16273,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16196
16273
|
label: zone,
|
|
16197
16274
|
cached: cache !== void 0,
|
|
16198
16275
|
labels,
|
|
16199
|
-
ttlMs: _nullishCoalesce(_optionalChain([cache, 'optionalAccess',
|
|
16276
|
+
ttlMs: _nullishCoalesce(_optionalChain([cache, 'optionalAccess', _141 => _141.ttlMs]), () => ( null)),
|
|
16200
16277
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16201
16278
|
rows,
|
|
16202
16279
|
wireUsed,
|
|
@@ -16361,7 +16438,7 @@ async function resolveCompositeNames(http, plan, opts = {}) {
|
|
|
16361
16438
|
} else {
|
|
16362
16439
|
for (const f of plan.labelFields) {
|
|
16363
16440
|
const frow = row.fields.find((x) => x.name === f);
|
|
16364
|
-
picklists[f] = _optionalChain([frow, 'optionalAccess',
|
|
16441
|
+
picklists[f] = _optionalChain([frow, 'optionalAccess', _142 => _142.picklistValues]);
|
|
16365
16442
|
}
|
|
16366
16443
|
}
|
|
16367
16444
|
} catch (err) {
|
|
@@ -16372,8 +16449,8 @@ async function resolveCompositeNames(http, plan, opts = {}) {
|
|
|
16372
16449
|
}
|
|
16373
16450
|
return {
|
|
16374
16451
|
section,
|
|
16375
|
-
resourceName: (id) => _nullishCoalesce(_optionalChain([section, 'access',
|
|
16376
|
-
recordName: (table, id) => _nullishCoalesce(_optionalChain([section, 'access',
|
|
16452
|
+
resourceName: (id) => _nullishCoalesce(_optionalChain([section, 'access', _143 => _143.rows, 'access', _144 => _144[`resource:${id}`], 'optionalAccess', _145 => _145.name]), () => ( null)),
|
|
16453
|
+
recordName: (table, id) => _nullishCoalesce(_optionalChain([section, 'access', _146 => _146.rows, 'access', _147 => _147[`${table}:${id}`], 'optionalAccess', _148 => _148.name]), () => ( null)),
|
|
16377
16454
|
labelFor: (field, value) => {
|
|
16378
16455
|
if (value === null || value === void 0) return null;
|
|
16379
16456
|
const values = picklists[field];
|
|
@@ -16644,8 +16721,8 @@ function validateFetchManyItems(items, cap, opName = "fetchMany", capRef = `FETC
|
|
|
16644
16721
|
problems.push(`${at}.fields: must be an array of exact vendor field names (discover them via operations.fieldCatalog)`);
|
|
16645
16722
|
continue;
|
|
16646
16723
|
}
|
|
16647
|
-
if (_optionalChain([validation, 'optionalAccess',
|
|
16648
|
-
const authoritative = _nullishCoalesce(_optionalChain([validation, 'optionalAccess',
|
|
16724
|
+
if (_optionalChain([validation, 'optionalAccess', _149 => _149.fieldCheck]) !== false) {
|
|
16725
|
+
const authoritative = _nullishCoalesce(_optionalChain([validation, 'optionalAccess', _150 => _150.fieldSetsByResource, 'optionalAccess', _151 => _151.get, 'call', _152 => _152(resourceKey)]), () => ( fields));
|
|
16649
16726
|
for (const f of item.fields) {
|
|
16650
16727
|
if (!authoritative.includes(f)) {
|
|
16651
16728
|
problems.push(
|
|
@@ -16749,7 +16826,7 @@ function project2(value, fields) {
|
|
|
16749
16826
|
return out;
|
|
16750
16827
|
}
|
|
16751
16828
|
function resourcePathOf(key, holder) {
|
|
16752
|
-
const path = _optionalChain([holder, 'optionalAccess',
|
|
16829
|
+
const path = _optionalChain([holder, 'optionalAccess', _153 => _153.resourcePath]);
|
|
16753
16830
|
if (typeof path !== "string" || path === "") {
|
|
16754
16831
|
throw new AutotaskConfigError(`fetchByIds: the client exposes no ${key} resource path (registry drift)`, {
|
|
16755
16832
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
@@ -16921,7 +16998,7 @@ function blindEmptyReason(stamp) {
|
|
|
16921
16998
|
};
|
|
16922
16999
|
}
|
|
16923
17000
|
function attachUpdateTargetMissReason(err, key) {
|
|
16924
|
-
const pinned = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
17001
|
+
const pinned = _optionalChain([EMPTY_REASON_STAMPS, 'access', _154 => _154[key], 'optionalAccess', _155 => _155.update]);
|
|
16925
17002
|
if (pinned === void 0) return;
|
|
16926
17003
|
err.details = { ..._nullishCoalesce(err.details, () => ( {})), emptyReason: pinned };
|
|
16927
17004
|
}
|
|
@@ -17102,7 +17179,7 @@ var BaseResource = class {
|
|
|
17102
17179
|
return (page, pageSize) => this.fetchPage(p, page, pageSize, state);
|
|
17103
17180
|
}
|
|
17104
17181
|
walkPageSize(params) {
|
|
17105
|
-
return clampPageSize(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
17182
|
+
return clampPageSize(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _156 => _156.maxRecords]), () => ( this.defaultPageSize)));
|
|
17106
17183
|
}
|
|
17107
17184
|
/** Stream items across pages (the resource `query` surface). */
|
|
17108
17185
|
queryItems(params) {
|
|
@@ -17114,7 +17191,7 @@ var BaseResource = class {
|
|
|
17114
17191
|
}
|
|
17115
17192
|
/** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded). */
|
|
17116
17193
|
async queryAllItems(params) {
|
|
17117
|
-
return collectAll(this.pageFetcher(params), { pageSize: this.walkPageSize(params), maxRecords: _optionalChain([params, 'optionalAccess',
|
|
17194
|
+
return collectAll(this.pageFetcher(params), { pageSize: this.walkPageSize(params), maxRecords: _optionalChain([params, 'optionalAccess', _157 => _157.maxTotalRecords]) });
|
|
17118
17195
|
}
|
|
17119
17196
|
/**
|
|
17120
17197
|
* `queryBounded` — server-side pagination (the MCP query surface): ONE call
|
|
@@ -17151,19 +17228,19 @@ var BaseResource = class {
|
|
|
17151
17228
|
"queryBounded: params must be an object { filter?, limit?, latest?, includeFields? } \u2014 a bare conditions array is not accepted (wrap it: { filter: [...] })"
|
|
17152
17229
|
);
|
|
17153
17230
|
}
|
|
17154
|
-
const limit = _nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
17231
|
+
const limit = _nullishCoalesce(_optionalChain([params, 'optionalAccess', _158 => _158.limit]), () => ( BOUNDED_QUERY_DEFAULT_LIMIT));
|
|
17155
17232
|
if (!Number.isInteger(limit) || limit < 1 || limit > BOUNDED_QUERY_MAX_LIMIT) {
|
|
17156
17233
|
throw new AutotaskConfigError(
|
|
17157
17234
|
`queryBounded: limit must be an integer 1..${BOUNDED_QUERY_MAX_LIMIT} (got ${String(limit)}) \u2014 it is the TOTAL record cap, not a page size`
|
|
17158
17235
|
);
|
|
17159
17236
|
}
|
|
17160
|
-
const noteChars = _optionalChain([params, 'optionalAccess',
|
|
17237
|
+
const noteChars = _optionalChain([params, 'optionalAccess', _159 => _159.noteChars]);
|
|
17161
17238
|
if (noteChars !== void 0 && (!Number.isInteger(noteChars) || noteChars < 1)) {
|
|
17162
17239
|
throw new AutotaskConfigError(
|
|
17163
17240
|
`queryBounded: noteChars must be an integer >= 1 (got ${String(noteChars)}) \u2014 it is the per-field char cap on the untrusted-class free-text fields (absent = the raw, untruncated result)`
|
|
17164
17241
|
);
|
|
17165
17242
|
}
|
|
17166
|
-
const walkParams = _optionalChain([params, 'optionalAccess',
|
|
17243
|
+
const walkParams = _optionalChain([params, 'optionalAccess', _160 => _160.fieldsPreset]) !== void 0 ? { ...params, includeFields: resolveFieldsPreset(params.fieldsPreset, this.config.key, params.includeFields) } : _nullishCoalesce(params, () => ( {}));
|
|
17167
17244
|
const latest = walkParams.latest;
|
|
17168
17245
|
if (latest !== void 0) {
|
|
17169
17246
|
if (!Number.isInteger(latest) || latest < 1 || latest > BOUNDED_QUERY_MAX_LIMIT) {
|
|
@@ -17171,7 +17248,7 @@ var BaseResource = class {
|
|
|
17171
17248
|
`queryBounded: latest must be an integer 1..${BOUNDED_QUERY_MAX_LIMIT} (got ${String(latest)}) \u2014 it is the count of the highest-id rows to return`
|
|
17172
17249
|
);
|
|
17173
17250
|
}
|
|
17174
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
17251
|
+
if (_optionalChain([params, 'optionalAccess', _161 => _161.limit]) !== void 0 && limit < latest) {
|
|
17175
17252
|
throw new AutotaskConfigError(
|
|
17176
17253
|
`queryBounded: limit (${String(limit)}) must be >= latest (${String(latest)}) \u2014 latest governs the returned count and limit is the walk window`
|
|
17177
17254
|
);
|
|
@@ -17253,8 +17330,8 @@ var BaseResource = class {
|
|
|
17253
17330
|
* speculation). */
|
|
17254
17331
|
stampEmptyQueryResult(result, params) {
|
|
17255
17332
|
if (result.items.length !== 0) return;
|
|
17256
|
-
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17257
|
-
const pinnedReason = normalizedConditions(_optionalChain([params, 'optionalAccess',
|
|
17333
|
+
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _162 => _162[this.config.key], 'optionalAccess', _163 => _163.query]), _optionalChain([params, 'optionalAccess', _164 => _164.filter]));
|
|
17334
|
+
const pinnedReason = normalizedConditions(_optionalChain([params, 'optionalAccess', _165 => _165.filter])) === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access', _166 => _166[this.config.key], 'optionalAccess', _167 => _167.query]) : void 0;
|
|
17258
17335
|
if (result.blindSurface !== void 0 || pinnedReason !== void 0) {
|
|
17259
17336
|
result.emptyReason = result.blindSurface !== void 0 ? blindEmptyReason(result.blindSurface) : pinnedReason;
|
|
17260
17337
|
}
|
|
@@ -17405,7 +17482,7 @@ var BaseResource = class {
|
|
|
17405
17482
|
if (result.items.length === 0) {
|
|
17406
17483
|
this.stampEmptyQueryResult(result, params);
|
|
17407
17484
|
} else {
|
|
17408
|
-
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17485
|
+
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _168 => _168[this.config.key], 'optionalAccess', _169 => _169.query]), params.filter);
|
|
17409
17486
|
}
|
|
17410
17487
|
return result;
|
|
17411
17488
|
}
|
|
@@ -17444,7 +17521,7 @@ var BaseResource = class {
|
|
|
17444
17521
|
* or, on a plan-pinned blind surface, the `{ count: 0, blindSurface }`
|
|
17445
17522
|
* typed sentinel (S12-C T10; see `BlindCountResult`). */
|
|
17446
17523
|
async countGlobal(params) {
|
|
17447
|
-
const conditions = normalizedConditions(_optionalChain([params, 'optionalAccess',
|
|
17524
|
+
const conditions = normalizedConditions(_optionalChain([params, 'optionalAccess', _170 => _170.filter]));
|
|
17448
17525
|
const body = {};
|
|
17449
17526
|
body.filter = conditions === void 0 ? [] : buildFilter(conditions).filter;
|
|
17450
17527
|
const res = await this.http.request({
|
|
@@ -17455,9 +17532,9 @@ var BaseResource = class {
|
|
|
17455
17532
|
idempotent: true
|
|
17456
17533
|
});
|
|
17457
17534
|
const count = unwrapQueryCount(res, `${this.config.key}.count`);
|
|
17458
|
-
const stamp = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17535
|
+
const stamp = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _171 => _171[this.config.key], 'optionalAccess', _172 => _172.count]), _optionalChain([params, 'optionalAccess', _173 => _173.filter]));
|
|
17459
17536
|
if (count === 0) {
|
|
17460
|
-
const pinnedReason = conditions === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
17537
|
+
const pinnedReason = conditions === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access', _174 => _174[this.config.key], 'optionalAccess', _175 => _175.count]) : void 0;
|
|
17461
17538
|
if (stamp !== void 0 || pinnedReason !== void 0) {
|
|
17462
17539
|
return {
|
|
17463
17540
|
count,
|
|
@@ -17488,9 +17565,9 @@ var BaseResource = class {
|
|
|
17488
17565
|
const hit = cache.get(path);
|
|
17489
17566
|
if (hit !== void 0) return hit;
|
|
17490
17567
|
}
|
|
17491
|
-
const epoch = _optionalChain([cache, 'optionalAccess',
|
|
17568
|
+
const epoch = _optionalChain([cache, 'optionalAccess', _176 => _176.epoch]);
|
|
17492
17569
|
const res = await this.http.request({ method: "GET", path, operation });
|
|
17493
|
-
_optionalChain([cache, 'optionalAccess',
|
|
17570
|
+
_optionalChain([cache, 'optionalAccess', _177 => _177.set, 'call', _178 => _178(path, res, resource, epoch)]);
|
|
17494
17571
|
return res;
|
|
17495
17572
|
}
|
|
17496
17573
|
/**
|
|
@@ -17529,7 +17606,7 @@ var BaseResource = class {
|
|
|
17529
17606
|
return value;
|
|
17530
17607
|
});
|
|
17531
17608
|
work.catch((err) => {
|
|
17532
|
-
if (err instanceof AutotaskError && (err.code === "INVALID_RESPONSE" || _optionalChain([err, 'access',
|
|
17609
|
+
if (err instanceof AutotaskError && (err.code === "INVALID_RESPONSE" || _optionalChain([err, 'access', _179 => _179.details, 'optionalAccess', _180 => _180.deterministic]) === true)) {
|
|
17533
17610
|
cache.invalidate(key);
|
|
17534
17611
|
}
|
|
17535
17612
|
});
|
|
@@ -17559,7 +17636,7 @@ var BaseResource = class {
|
|
|
17559
17636
|
path: `${this.resourcePath}/${numeric}`,
|
|
17560
17637
|
operation: `${this.config.key}.get`,
|
|
17561
17638
|
skipResponseRedaction: true,
|
|
17562
|
-
maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
17639
|
+
maxRetries: _optionalChain([readOpts, 'optionalAccess', _181 => _181.maxRetries])
|
|
17563
17640
|
});
|
|
17564
17641
|
return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
|
|
17565
17642
|
}
|
|
@@ -17578,7 +17655,7 @@ var BaseResource = class {
|
|
|
17578
17655
|
path: this.scopedItemPath(parentId, numeric),
|
|
17579
17656
|
operation: `${this.config.key}.get`,
|
|
17580
17657
|
skipResponseRedaction: true,
|
|
17581
|
-
maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
17658
|
+
maxRetries: _optionalChain([readOpts, 'optionalAccess', _182 => _182.maxRetries])
|
|
17582
17659
|
});
|
|
17583
17660
|
return unwrapItem(res, numeric, `${this.config.key}.get`, this.entityName);
|
|
17584
17661
|
}
|
|
@@ -18237,7 +18314,7 @@ var BaseResource = class {
|
|
|
18237
18314
|
current = parentId === void 0 ? await this.getGlobal(id, true) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true);
|
|
18238
18315
|
} catch (err) {
|
|
18239
18316
|
if (err instanceof NotFoundError) {
|
|
18240
|
-
const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
18317
|
+
const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access', _183 => _183[this.config.key], 'optionalAccess', _184 => _184.update]);
|
|
18241
18318
|
checks.push({
|
|
18242
18319
|
name: "current-record-exists",
|
|
18243
18320
|
ok: false,
|
|
@@ -18395,12 +18472,12 @@ var BaseResource = class {
|
|
|
18395
18472
|
return null;
|
|
18396
18473
|
}
|
|
18397
18474
|
}
|
|
18398
|
-
const epoch = _optionalChain([cache, 'optionalAccess',
|
|
18475
|
+
const epoch = _optionalChain([cache, 'optionalAccess', _185 => _185.epoch]);
|
|
18399
18476
|
try {
|
|
18400
18477
|
return await this.fetchRecordRaw(entityPath, referenceId);
|
|
18401
18478
|
} catch (err) {
|
|
18402
18479
|
if (err instanceof NotFoundError) {
|
|
18403
|
-
_optionalChain([cache, 'optionalAccess',
|
|
18480
|
+
_optionalChain([cache, 'optionalAccess', _186 => _186.set, 'call', _187 => _187(absentKey, CONTEXT_ABSENT_MARKER, RESOURCE_KEY_BY_PATH[entityPath], epoch)]);
|
|
18404
18481
|
return null;
|
|
18405
18482
|
}
|
|
18406
18483
|
throw err;
|
|
@@ -18517,7 +18594,7 @@ var BaseResource = class {
|
|
|
18517
18594
|
missDetail(operator, fields) {
|
|
18518
18595
|
const key = this.config.key;
|
|
18519
18596
|
const probe = fields.map((field) => ({ field, op: operator, value: "" }));
|
|
18520
|
-
const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
18597
|
+
const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _188 => _188[key], 'optionalAccess', _189 => _189.query]), probe);
|
|
18521
18598
|
const next = [];
|
|
18522
18599
|
if (blind !== void 0) {
|
|
18523
18600
|
next.push(`This surface is blind to records the API user does not own, so a miss is not proof of absence: ${blind.authority} returns the record when the id is known.`);
|
|
@@ -18793,4 +18870,5 @@ var BaseResource = class {
|
|
|
18793
18870
|
|
|
18794
18871
|
|
|
18795
18872
|
|
|
18796
|
-
|
|
18873
|
+
|
|
18874
|
+
exports.AUTH_HEADERS = AUTH_HEADERS; exports.buildAuthHeaders = buildAuthHeaders; exports.withAuthHeaders = withAuthHeaders; exports.NoopLogger = NoopLogger; exports.REDACTED = REDACTED; exports.CREDENTIAL_HEADER_NAMES = CREDENTIAL_HEADER_NAMES; exports.isCredentialHeaderName = isCredentialHeaderName; exports.redactRecord = redactRecord; exports.SECRET_RESPONSE_FIELDS = SECRET_RESPONSE_FIELDS; exports.PERSONAL_RESPONSE_FIELDS = PERSONAL_RESPONSE_FIELDS; exports.CONFIDENTIAL_RESPONSE_FIELDS = CONFIDENTIAL_RESPONSE_FIELDS; exports.isRedactedFieldName = isRedactedFieldName; exports.redactResponseBody = redactResponseBody; exports.AutotaskError = AutotaskError; exports.AutotaskConfigError = AutotaskConfigError; exports.AutotaskNetworkError = AutotaskNetworkError; exports.AutotaskTimeoutError = AutotaskTimeoutError; exports.AutotaskAbortError = AutotaskAbortError; exports.ResponseRejectedError = ResponseRejectedError; exports.BadRequestError = BadRequestError; exports.UnauthorizedError = UnauthorizedError; exports.ForbiddenError = ForbiddenError; exports.NotFoundError = NotFoundError; exports.ConflictError = ConflictError; exports.UnprocessableEntityError = UnprocessableEntityError; exports.RateLimitError = RateLimitError; exports.ServerError = ServerError; exports.UnexpectedContentTypeError = UnexpectedContentTypeError; exports.EmptyResponseError = EmptyResponseError; exports.CircuitBreakerError = CircuitBreakerError; exports.HostPolicyDeniedError = HostPolicyDeniedError; exports.ResolutionError = ResolutionError; exports.PaginationLimitError = PaginationLimitError; exports.QueryTooLongError = QueryTooLongError; exports.parseVendorErrors = parseVendorErrors; exports.isDeterministicVendor500 = isDeterministicVendor500; exports.formatVendorDetail = formatVendorDetail; exports.CREDENTIAL_SHAPE_POINTER = CREDENTIAL_SHAPE_POINTER; exports.mergeDetails = mergeDetails; exports.errorFromStatus = errorFromStatus; exports.StaleObjectError = StaleObjectError; exports.ConfirmationRequiredError = ConfirmationRequiredError; exports.DeleteBoundaryError = DeleteBoundaryError; exports.MarkerUnsafeIdError = MarkerUnsafeIdError; exports.RecoveryTruncatedError = RecoveryTruncatedError; exports.isAutotaskError = isAutotaskError; exports.hasSurroundingQuotes = hasSurroundingQuotes; exports.credentialShapeProblem = credentialShapeProblem; exports.CREDENTIAL_ENV_LOAD_ACTION = CREDENTIAL_ENV_LOAD_ACTION; exports.MIN_PREFIX_SUMMARY_LENGTH = MIN_PREFIX_SUMMARY_LENGTH; exports.credentialValueSummary = credentialValueSummary; exports.FIELD_CACHE_KINDS = FIELD_CACHE_KINDS; exports.DEFAULT_CIRCUIT_BREAKER_WINDOW_MS = DEFAULT_CIRCUIT_BREAKER_WINDOW_MS; exports.DEFAULT_CIRCUIT_BREAKER_FAILURE_THRESHOLD = DEFAULT_CIRCUIT_BREAKER_FAILURE_THRESHOLD; exports.DEFAULT_CIRCUIT_BREAKER_OPEN_TIMEOUT_MS = DEFAULT_CIRCUIT_BREAKER_OPEN_TIMEOUT_MS; exports.DEFAULT_CIRCUIT_BREAKER_SUCCESSES_TO_CLOSE = DEFAULT_CIRCUIT_BREAKER_SUCCESSES_TO_CLOSE; exports.DEFAULT_CIRCUIT_BREAKER_MAX_ENTRIES = DEFAULT_CIRCUIT_BREAKER_MAX_ENTRIES; exports.InMemoryCircuitBreakerStore = InMemoryCircuitBreakerStore; exports.defaultCircuitBreakerStore = defaultCircuitBreakerStore; exports.resetDefaultCircuitBreakerStore = resetDefaultCircuitBreakerStore; exports.buildBreakerKey = buildBreakerKey; exports.isBreakerFailure = isBreakerFailure; exports.DEFAULT_COOLDOWN_MAX_MS = DEFAULT_COOLDOWN_MAX_MS; exports.DEFAULT_COOLDOWN_DEFAULT_MS = DEFAULT_COOLDOWN_DEFAULT_MS; exports.DEFAULT_COOLDOWN_MAX_ENTRIES = DEFAULT_COOLDOWN_MAX_ENTRIES; exports.InMemoryCooldownStore = InMemoryCooldownStore; exports.defaultCooldownStore = defaultCooldownStore; exports.resetDefaultCooldownStore = resetDefaultCooldownStore; exports.buildTenantKey = buildTenantKey; exports.cooldownDurationMs = cooldownDurationMs; exports.ZONE_CATALOG = ZONE_CATALOG; exports.ZONES = ZONES; exports.DEFAULT_ZONE = DEFAULT_ZONE; exports.AGENT_PROFILE = AGENT_PROFILE; exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE; exports.MAX_PAGE_SIZE = MAX_PAGE_SIZE; exports.DEFAULT_TIMEOUT_MS = DEFAULT_TIMEOUT_MS; exports.DEFAULT_MAX_RETRIES = DEFAULT_MAX_RETRIES; exports.DEFAULT_MAINTENANCE_MAX_WAIT_MS = DEFAULT_MAINTENANCE_MAX_WAIT_MS; exports.DEFAULT_MAINTENANCE_POLL_MS = DEFAULT_MAINTENANCE_POLL_MS; exports.MAINTENANCE_WINDOW_MAX_MS = MAINTENANCE_WINDOW_MAX_MS; exports.DEFAULT_MAX_CONCURRENT = DEFAULT_MAX_CONCURRENT; exports.DEFAULT_MAX_RESPONSE_BYTES = DEFAULT_MAX_RESPONSE_BYTES; exports.DEFAULT_MAX_SCAN_RECORDS = DEFAULT_MAX_SCAN_RECORDS; exports.DEFAULT_MAX_SCAN_PAGES = DEFAULT_MAX_SCAN_PAGES; exports.DEFAULT_READ_CACHE_TTL_MS = DEFAULT_READ_CACHE_TTL_MS; exports.DEFAULT_FIELD_CACHE_TTL_MS = DEFAULT_FIELD_CACHE_TTL_MS; exports.DEFAULT_RESOURCE_NAME_CACHE_TTL_MS = DEFAULT_RESOURCE_NAME_CACHE_TTL_MS; exports.zoneUrl = zoneUrl; exports.resolveBaseUrl = resolveBaseUrl; exports.resolveCredentials = resolveCredentials; exports.resolveConfig = resolveConfig; exports.isRecord = isRecord2; exports.assertRecord = assertRecord; exports.deepMergeParams = deepMergeParams; exports.isIdentifierCandidate = isIdentifierCandidate; exports.parseIdentifier = parseIdentifier; exports.flattenUdfs = flattenUdfs; exports.newCorrelationId = newCorrelationId; exports.redactAuditBody = redactAuditBody; exports.camelKey = camelKey; exports.FILTER_OPERATORS = FILTER_OPERATORS; exports.GROUPING_OPERATORS = GROUPING_OPERATORS; exports.MAX_OR_CONDITIONS = MAX_OR_CONDITIONS; exports.MAX_UDF_PER_QUERY = MAX_UDF_PER_QUERY; exports.MAX_QUERY_LENGTH = MAX_QUERY_LENGTH; exports.MAX_GET_LENGTH = MAX_GET_LENGTH; exports.MAX_FIELD_LENGTH = MAX_FIELD_LENGTH; exports.isFilterOperator = isFilterOperator; exports.serializeFilter = serializeFilter; exports.validateFilter = validateFilter; exports.buildFilter = buildFilter; exports.normalizedConditions = normalizedConditions; exports.RELATIONSHIP_ZONE = RELATIONSHIP_ZONE; exports.RELATIONSHIP_MAP = RELATIONSHIP_MAP; exports.BLIND_SURFACE_STAMPS = BLIND_SURFACE_STAMPS; exports.DELETE_BOUNDARY_NOTES = DELETE_BOUNDARY_NOTES; exports.MARKER_FIELDS = MARKER_FIELDS; exports.EMPTY_REASON_STAMPS = EMPTY_REASON_STAMPS; exports.BLIND_SURFACE_INVENTORY = BLIND_SURFACE_INVENTORY; exports.REACHABILITY_PROBE_DEFAULTS = REACHABILITY_PROBE_DEFAULTS; exports.CREATE_GUIDANCE = CREATE_GUIDANCE; exports.UNTRUSTED_FIELDS_BY_RESOURCE = UNTRUSTED_FIELDS_BY_RESOURCE; exports.IDEMPOTENT_METHODS = IDEMPOTENT_METHODS; exports.buildUrl = buildUrl; exports.cursorToPath = cursorToPath; exports.buildQueryBody = buildQueryBody; exports.buildQueryRequest = buildQueryRequest; exports.runWithSignal = runWithSignal; exports.HttpClient = HttpClient; exports.unwrapItems = unwrapItems; exports.unwrapItem = unwrapItem; exports.unwrapQueryCount = unwrapQueryCount; exports.unwrapOperation = unwrapOperation; exports.passthrough = passthrough; exports.MAX_PAGES = MAX_PAGES; exports.clampPageSize = clampPageSize; exports.totalPagesFor = totalPagesFor; exports.paginate = paginate; exports.paginateItems = paginateItems; exports.collectAll = collectAll; exports.toArray = toArray; exports.FIELD_PRESETS = FIELD_PRESETS; exports.FIELD_PRESET_NAMES = FIELD_PRESET_NAMES; exports.resolveFieldsPreset = resolveFieldsPreset; exports.BOUNDED_QUERY_MAX_LIMIT = BOUNDED_QUERY_MAX_LIMIT; exports.truncateNoteChars = truncateNoteChars; exports.buildDryRunResult = buildDryRunResult; exports.mergePartialBody = mergePartialBody; exports.blindStampFor = blindStampFor; exports.decodeFileData = decodeFileData; exports.BaseResource = BaseResource; exports.EXPAND_RESOURCE_NAMES_MAX_IDS = EXPAND_RESOURCE_NAMES_MAX_IDS; exports.expandResourceNames = expandResourceNames; exports.WORKFLOW_RESOURCES = WORKFLOW_RESOURCES; exports.MAX_FIELD_CATALOG_WIRE = MAX_FIELD_CATALOG_WIRE; exports.FIELD_CATALOG_HONESTY_NOTE = FIELD_CATALOG_HONESTY_NOTE; exports.fieldCatalog = fieldCatalog; exports.PICKLIST_VALUE_NOT_SERVED_NOTE = PICKLIST_VALUE_NOT_SERVED_NOTE; exports.TICKET_LABEL_FIELDS = TICKET_LABEL_FIELDS; exports.createNamePlan = createNamePlan; exports.addNameSibling = addNameSibling; exports.addLabelSibling = addLabelSibling; exports.resolveCompositeNames = resolveCompositeNames; exports.MODEL_FIELD_SETS = MODEL_FIELD_SETS; exports.MODEL_DATE_FIELDS = MODEL_DATE_FIELDS; exports.FETCH_MANY_MAX_ITEMS = FETCH_MANY_MAX_ITEMS; exports.validateFetchManyItems = validateFetchManyItems; exports.fetchMany = fetchMany; exports.FETCH_BY_IDS_MAX_ITEMS = FETCH_BY_IDS_MAX_ITEMS; exports.FETCH_BY_IDS_CHUNK_SIZE = FETCH_BY_IDS_CHUNK_SIZE; exports.fetchByIds = fetchByIds;
|