node-autotask 0.14.0 → 0.16.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 +17 -2
- package/README.md +5 -3
- package/dist/capabilities.d.cts +6 -5
- package/dist/capabilities.d.ts +6 -5
- package/dist/{chunk-2ZZOTJ2C.js → chunk-GWALLMAM.js} +2 -2
- package/dist/{chunk-5QMXECLN.cjs → chunk-L3TK4CN5.cjs} +390 -390
- package/dist/{chunk-XSIY3WRR.cjs → chunk-MAYYTYV5.cjs} +129 -66
- package/dist/{chunk-IYN2BHVW.js → chunk-NB254T3F.js} +1 -1
- package/dist/{chunk-KA6UU26H.js → chunk-U6JUHHMB.js} +70 -7
- package/dist/{chunk-FCJUM42E.cjs → chunk-VCGC6YCI.cjs} +135 -135
- package/dist/{index-zt1KXThi.d.ts → index-CUsvZndu.d.ts} +34 -2
- package/dist/{index-oiwPuJOG.d.cts → index-leMyBJze.d.cts} +34 -2
- package/dist/index.cjs +25 -21
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +7 -3
- package/dist/operations/index.cjs +100 -100
- package/dist/operations/index.d.cts +2 -2
- package/dist/operations/index.d.ts +2 -2
- package/dist/operations/index.js +1 -1
- package/dist/pool.cjs +7 -7
- package/dist/pool.d.cts +1 -1
- package/dist/pool.d.ts +1 -1
- package/dist/pool.js +3 -3
- package/dist/resources/index.cjs +3 -3
- package/dist/resources/index.d.cts +1 -1
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +2 -2
- package/docs/API.md +34 -13
- package/package.json +1 -1
|
@@ -1532,6 +1532,8 @@ var DEFAULT_PAGE_SIZE = 10;
|
|
|
1532
1532
|
var MAX_PAGE_SIZE = 500;
|
|
1533
1533
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
1534
1534
|
var DEFAULT_MAX_RETRIES = 3;
|
|
1535
|
+
var DEFAULT_MAINTENANCE_MAX_WAIT_MS = 36e5;
|
|
1536
|
+
var DEFAULT_MAINTENANCE_POLL_MS = 3e4;
|
|
1535
1537
|
var DEFAULT_MAX_CONCURRENT = 10;
|
|
1536
1538
|
var DEFAULT_MAX_RESPONSE_BYTES = 64 * 1024 * 1024;
|
|
1537
1539
|
var DEFAULT_MAX_SCAN_RECORDS = 500;
|
|
@@ -1689,6 +1691,14 @@ function resolveConfig(config) {
|
|
|
1689
1691
|
if (!Number.isInteger(maxRetries) || maxRetries < 0) {
|
|
1690
1692
|
throw new AutotaskConfigError("maxRetries must be a non-negative integer");
|
|
1691
1693
|
}
|
|
1694
|
+
const maintenanceMaxWaitMs = _nullishCoalesce(config.maintenanceMaxWaitMs, () => ( DEFAULT_MAINTENANCE_MAX_WAIT_MS));
|
|
1695
|
+
if (!Number.isInteger(maintenanceMaxWaitMs) || maintenanceMaxWaitMs < 0) {
|
|
1696
|
+
throw new AutotaskConfigError("maintenanceMaxWaitMs must be a non-negative integer");
|
|
1697
|
+
}
|
|
1698
|
+
const maintenancePollMs = _nullishCoalesce(config.maintenancePollMs, () => ( DEFAULT_MAINTENANCE_POLL_MS));
|
|
1699
|
+
if (!Number.isInteger(maintenancePollMs) || maintenancePollMs <= 0) {
|
|
1700
|
+
throw new AutotaskConfigError("maintenancePollMs must be a positive integer");
|
|
1701
|
+
}
|
|
1692
1702
|
const maxConcurrent = _nullishCoalesce(config.maxConcurrent, () => ( (agent ? AGENT_PROFILE.maxConcurrent : DEFAULT_MAX_CONCURRENT)));
|
|
1693
1703
|
if (!Number.isInteger(maxConcurrent) || maxConcurrent <= 0) {
|
|
1694
1704
|
throw new AutotaskConfigError("maxConcurrent must be a positive integer");
|
|
@@ -1822,6 +1832,8 @@ function resolveConfig(config) {
|
|
|
1822
1832
|
pageSize: pageSizeCapped,
|
|
1823
1833
|
timeoutMs,
|
|
1824
1834
|
maxRetries,
|
|
1835
|
+
maintenanceMaxWaitMs,
|
|
1836
|
+
maintenancePollMs,
|
|
1825
1837
|
maxConcurrent,
|
|
1826
1838
|
maxResponseBytes,
|
|
1827
1839
|
logger,
|
|
@@ -14755,6 +14767,10 @@ function backoffDelay(attempt) {
|
|
|
14755
14767
|
const exp = Math.min(BACKOFF_CAP_MS, BACKOFF_BASE_MS * 2 ** attempt);
|
|
14756
14768
|
return Math.floor(exp / 2 + Math.random() * (exp / 2));
|
|
14757
14769
|
}
|
|
14770
|
+
function isMaintenancePage(err) {
|
|
14771
|
+
const snippet = typeof _optionalChain([err, 'access', _57 => _57.details, 'optionalAccess', _58 => _58.bodySnippet]) === "string" ? err.details.bodySnippet : "";
|
|
14772
|
+
return /maintenance|temporarily unavailable|service unavailable|outage|downtime|down for/i.test(snippet);
|
|
14773
|
+
}
|
|
14758
14774
|
function parseRetryAfter(value) {
|
|
14759
14775
|
if (value === null || value.length === 0) return void 0;
|
|
14760
14776
|
const trimmed = value.trim();
|
|
@@ -14771,7 +14787,7 @@ function isAbortLike(err) {
|
|
|
14771
14787
|
return typeof err === "object" && err !== null && "name" in err && err.name === "AbortError";
|
|
14772
14788
|
}
|
|
14773
14789
|
function isJsonMediaType(header) {
|
|
14774
|
-
const mediaType = _nullishCoalesce(_optionalChain([header, 'access',
|
|
14790
|
+
const mediaType = _nullishCoalesce(_optionalChain([header, 'access', _59 => _59.split, 'call', _60 => _60(";"), 'access', _61 => _61[0], 'optionalAccess', _62 => _62.trim, 'call', _63 => _63(), 'access', _64 => _64.toLowerCase, 'call', _65 => _65()]), () => ( ""));
|
|
14775
14791
|
return mediaType.startsWith("application/json") || mediaType.endsWith("+json");
|
|
14776
14792
|
}
|
|
14777
14793
|
function bodySnippet(text, redactPersonalData) {
|
|
@@ -14851,6 +14867,9 @@ var HttpClient = (_class6 = class {
|
|
|
14851
14867
|
|
|
14852
14868
|
|
|
14853
14869
|
|
|
14870
|
+
/** Maintenance-window auto-retry budget + poll (issue #112 follow-up; see config). */
|
|
14871
|
+
|
|
14872
|
+
|
|
14854
14873
|
|
|
14855
14874
|
|
|
14856
14875
|
/** The resolved profile (issue #4) — the agent profile changes the
|
|
@@ -14921,8 +14940,10 @@ var HttpClient = (_class6 = class {
|
|
|
14921
14940
|
impersonationResourceId: config.impersonationResourceId
|
|
14922
14941
|
};
|
|
14923
14942
|
this.maxRetries = config.maxRetries;
|
|
14943
|
+
this.maintenanceMaxWaitMs = config.maintenanceMaxWaitMs;
|
|
14944
|
+
this.maintenancePollMs = config.maintenancePollMs;
|
|
14924
14945
|
this.maxResponseBytes = config.maxResponseBytes;
|
|
14925
|
-
this.perHour = _optionalChain([config, 'access',
|
|
14946
|
+
this.perHour = _optionalChain([config, 'access', _66 => _66.rateLimit, 'optionalAccess', _67 => _67.perHour]);
|
|
14926
14947
|
this.tenantKey = buildTenantKey(config.userName, config.baseUrl);
|
|
14927
14948
|
this.cooldownStore = config.cooldown.enabled ? _nullishCoalesce(config.cooldown.store, () => ( defaultCooldownStore())) : void 0;
|
|
14928
14949
|
this.cooldownMaxMs = config.cooldown.maxMs;
|
|
@@ -14983,7 +15004,7 @@ var HttpClient = (_class6 = class {
|
|
|
14983
15004
|
};
|
|
14984
15005
|
if (next.successes >= breaker.successesToClose) {
|
|
14985
15006
|
breaker.store.delete(key);
|
|
14986
|
-
_optionalChain([this, 'access',
|
|
15007
|
+
_optionalChain([this, 'access', _68 => _68.logger, 'access', _69 => _69.warn, 'optionalCall', _70 => _70(
|
|
14987
15008
|
`[autotask] circuit breaker CLOSED for ${key} (${next.successes} probe successes)`,
|
|
14988
15009
|
void 0
|
|
14989
15010
|
)]);
|
|
@@ -15013,7 +15034,7 @@ var HttpClient = (_class6 = class {
|
|
|
15013
15034
|
const failures = [...st.failures.filter((t) => t > now - breaker.failureWindowMs), now];
|
|
15014
15035
|
if (failures.length >= breaker.failureThreshold) {
|
|
15015
15036
|
breaker.store.set(key, { failures, openedAt: now, successes: 0, probes: 0 });
|
|
15016
|
-
_optionalChain([this, 'access',
|
|
15037
|
+
_optionalChain([this, 'access', _71 => _71.logger, 'access', _72 => _72.warn, 'optionalCall', _73 => _73(
|
|
15017
15038
|
`[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`,
|
|
15018
15039
|
correlationId
|
|
15019
15040
|
)]);
|
|
@@ -15128,7 +15149,7 @@ var HttpClient = (_class6 = class {
|
|
|
15128
15149
|
return void 0;
|
|
15129
15150
|
}
|
|
15130
15151
|
if (res.status < 200 || res.status >= 300) {
|
|
15131
|
-
await _optionalChain([res, 'access',
|
|
15152
|
+
await _optionalChain([res, 'access', _74 => _74.body, 'optionalAccess', _75 => _75.cancel, 'call', _76 => _76(), 'access', _77 => _77.catch, 'call', _78 => _78(() => void 0)]);
|
|
15132
15153
|
return void 0;
|
|
15133
15154
|
}
|
|
15134
15155
|
let text;
|
|
@@ -15164,7 +15185,7 @@ var HttpClient = (_class6 = class {
|
|
|
15164
15185
|
this.liveBaseUrl = to;
|
|
15165
15186
|
this.tenantKey = buildTenantKey(this.auth.userName, to);
|
|
15166
15187
|
this.breakerKey = buildBreakerKey(to);
|
|
15167
|
-
_optionalChain([this, 'access',
|
|
15188
|
+
_optionalChain([this, 'access', _79 => _79.logger, 'access', _80 => _80.warn, 'optionalCall', _81 => _81(
|
|
15168
15189
|
`[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`,
|
|
15169
15190
|
void 0
|
|
15170
15191
|
)]);
|
|
@@ -15180,11 +15201,21 @@ var HttpClient = (_class6 = class {
|
|
|
15180
15201
|
const correlationId = newCorrelationId();
|
|
15181
15202
|
const timeoutMs = _nullishCoalesce(opts.timeoutMs, () => ( this.timeoutMs));
|
|
15182
15203
|
const maxRetries = _nullishCoalesce(opts.maxRetries, () => ( this.maxRetries));
|
|
15204
|
+
const maintenanceMaxWaitMs = _nullishCoalesce(opts.maintenanceMaxWaitMs, () => ( this.maintenanceMaxWaitMs));
|
|
15205
|
+
const maintenancePollMs = _nullishCoalesce(opts.maintenancePollMs, () => ( this.maintenancePollMs));
|
|
15206
|
+
let firstMaintenanceAt;
|
|
15207
|
+
let maintenanceWaits = 0;
|
|
15183
15208
|
const started = Date.now();
|
|
15184
|
-
|
|
15209
|
+
let deadlineAt = started + timeoutMs;
|
|
15185
15210
|
const callerSignal = _nullishCoalesce(opts.signal, () => ( ambientSignal.getStore()));
|
|
15211
|
+
const deadline = new AbortController();
|
|
15212
|
+
let deadlineTimer = setTimeout(() => deadline.abort(), timeoutMs);
|
|
15213
|
+
const armDeadline = (ms) => {
|
|
15214
|
+
clearTimeout(deadlineTimer);
|
|
15215
|
+
deadlineTimer = setTimeout(() => deadline.abort(), Math.max(0, ms));
|
|
15216
|
+
};
|
|
15186
15217
|
const signal = AbortSignal.any(
|
|
15187
|
-
callerSignal === void 0 ? [
|
|
15218
|
+
callerSignal === void 0 ? [deadline.signal] : [deadline.signal, callerSignal]
|
|
15188
15219
|
);
|
|
15189
15220
|
const auditBody = opts.body !== void 0 ? redactAuditBody(opts.body) : void 0;
|
|
15190
15221
|
const retriable = _nullishCoalesce(opts.idempotent, () => ( IDEMPOTENT_METHODS.includes(method)));
|
|
@@ -15192,7 +15223,7 @@ var HttpClient = (_class6 = class {
|
|
|
15192
15223
|
const expectBody = _nullishCoalesce(opts.expectBody, () => ( method !== "DELETE"));
|
|
15193
15224
|
const ctx = { operation: opts.operation, url, correlationId };
|
|
15194
15225
|
let lastStatus;
|
|
15195
|
-
const interrupted = () => _optionalChain([callerSignal, 'optionalAccess',
|
|
15226
|
+
const interrupted = () => _optionalChain([callerSignal, 'optionalAccess', _82 => _82.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);
|
|
15196
15227
|
const canWait = (delay) => delay <= MAX_RETRY_DELAY_MS && delay < deadlineAt - Date.now();
|
|
15197
15228
|
const pause = async (delay) => {
|
|
15198
15229
|
try {
|
|
@@ -15202,11 +15233,11 @@ var HttpClient = (_class6 = class {
|
|
|
15202
15233
|
}
|
|
15203
15234
|
};
|
|
15204
15235
|
if (this.cooldownStore !== void 0 && !opts.bypassCooldown) {
|
|
15205
|
-
const
|
|
15206
|
-
if (
|
|
15207
|
-
const remainingMs =
|
|
15236
|
+
const deadline2 = this.cooldownStore.get(this.tenantKey);
|
|
15237
|
+
if (deadline2 !== void 0) {
|
|
15238
|
+
const remainingMs = deadline2 - Date.now();
|
|
15208
15239
|
if (remainingMs > 0) {
|
|
15209
|
-
if (_optionalChain([callerSignal, 'optionalAccess',
|
|
15240
|
+
if (_optionalChain([callerSignal, 'optionalAccess', _83 => _83.aborted])) throw interrupted();
|
|
15210
15241
|
const seconds = Math.ceil(remainingMs / 1e3);
|
|
15211
15242
|
const err = new RateLimitError(
|
|
15212
15243
|
`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.`,
|
|
@@ -15237,7 +15268,7 @@ var HttpClient = (_class6 = class {
|
|
|
15237
15268
|
let breakerProbe = false;
|
|
15238
15269
|
let breakerProbeKey;
|
|
15239
15270
|
if (this.breaker !== void 0 && !opts.bypassCircuitBreaker) {
|
|
15240
|
-
if (_optionalChain([callerSignal, 'optionalAccess',
|
|
15271
|
+
if (_optionalChain([callerSignal, 'optionalAccess', _84 => _84.aborted])) throw interrupted();
|
|
15241
15272
|
const now = Date.now();
|
|
15242
15273
|
const st = this.breaker.store.get(this.breakerKey);
|
|
15243
15274
|
if (st !== void 0 && st.openedAt !== null) {
|
|
@@ -15295,7 +15326,7 @@ var HttpClient = (_class6 = class {
|
|
|
15295
15326
|
breakerProbeKey = this.breakerKey;
|
|
15296
15327
|
}
|
|
15297
15328
|
}
|
|
15298
|
-
_optionalChain([this, 'access',
|
|
15329
|
+
_optionalChain([this, 'access', _85 => _85.logger, 'access', _86 => _86.debug, 'optionalCall', _87 => _87(`[autotask] ${method} ${opts.path}`, correlationId)]);
|
|
15299
15330
|
try {
|
|
15300
15331
|
let attempt = 0;
|
|
15301
15332
|
let outcome = null;
|
|
@@ -15315,7 +15346,7 @@ var HttpClient = (_class6 = class {
|
|
|
15315
15346
|
if (signal.aborted || isAbortLike(err2)) throw interrupted();
|
|
15316
15347
|
const delay = backoffDelay(attempt);
|
|
15317
15348
|
if (attempt < maxRetries && retriable5xx && canWait(delay)) {
|
|
15318
|
-
_optionalChain([this, 'access',
|
|
15349
|
+
_optionalChain([this, 'access', _88 => _88.logger, 'access', _89 => _89.warn, 'optionalCall', _90 => _90(
|
|
15319
15350
|
`[autotask] network error on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15320
15351
|
correlationId
|
|
15321
15352
|
)]);
|
|
@@ -15333,7 +15364,7 @@ var HttpClient = (_class6 = class {
|
|
|
15333
15364
|
try {
|
|
15334
15365
|
status = res.status;
|
|
15335
15366
|
if (status >= 300 && status < 400) {
|
|
15336
|
-
await _optionalChain([res, 'access',
|
|
15367
|
+
await _optionalChain([res, 'access', _91 => _91.body, 'optionalAccess', _92 => _92.cancel, 'call', _93 => _93(), 'access', _94 => _94.catch, 'call', _95 => _95(() => void 0)]);
|
|
15337
15368
|
throw new ResponseRejectedError(
|
|
15338
15369
|
`Refused to follow a ${status} redirect for ${method} ${opts.path}`,
|
|
15339
15370
|
{ ...ctx, code: "REDIRECT_BLOCKED", httpStatus: status, suggestedAction: "Check the configured zone/baseUrl; the API does not redirect." }
|
|
@@ -15385,7 +15416,7 @@ var HttpClient = (_class6 = class {
|
|
|
15385
15416
|
// The content-type is host-sourced (a host-supplied
|
|
15386
15417
|
// baseUrl can serve arbitrary HTML) — capped, never prose;
|
|
15387
15418
|
// the raw snippet rides details only.
|
|
15388
|
-
suggestedAction:
|
|
15419
|
+
suggestedAction: retriable5xx ? `The zone answered with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the zone is likely in a maintenance window \u2014 retry after the window, or verify baseUrl points at the REST API.` : `The zone answered a write with a non-JSON body (content-type: ${contentType.slice(0, 100)}); the request may have taken effect \u2014 verify the record before re-issuing (writes are never auto-retried).`
|
|
15389
15420
|
}
|
|
15390
15421
|
) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
|
|
15391
15422
|
...ctx,
|
|
@@ -15394,11 +15425,28 @@ var HttpClient = (_class6 = class {
|
|
|
15394
15425
|
httpStatus: status,
|
|
15395
15426
|
suggestedAction: "The zone returned a non-JSON 2xx body; verify baseUrl points at the REST API."
|
|
15396
15427
|
});
|
|
15397
|
-
if (err2.code === "UNEXPECTED_CONTENT_TYPE" &&
|
|
15428
|
+
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && maintenanceMaxWaitMs > 0 && isMaintenancePage(err2)) {
|
|
15429
|
+
const now = Date.now();
|
|
15430
|
+
firstMaintenanceAt ??= now;
|
|
15431
|
+
const remaining = maintenanceMaxWaitMs - (now - firstMaintenanceAt);
|
|
15432
|
+
if (remaining > 0) {
|
|
15433
|
+
const wait = Math.min(maintenancePollMs, remaining);
|
|
15434
|
+
maintenanceWaits += 1;
|
|
15435
|
+
_optionalChain([this, 'access', _96 => _96.logger, 'access', _97 => _97.warn, 'optionalCall', _98 => _98(
|
|
15436
|
+
`[autotask] maintenance window on ${method} ${opts.path}; waiting ${Math.round(wait / 1e3)}s (retry ${maintenanceWaits}, up to ${Math.round(maintenanceMaxWaitMs / 6e4)} min)`,
|
|
15437
|
+
correlationId
|
|
15438
|
+
)]);
|
|
15439
|
+
deadlineAt = Date.now() + wait + timeoutMs;
|
|
15440
|
+
armDeadline(deadlineAt - Date.now());
|
|
15441
|
+
await pause(wait);
|
|
15442
|
+
continue;
|
|
15443
|
+
}
|
|
15444
|
+
}
|
|
15445
|
+
if (err2.code === "UNEXPECTED_CONTENT_TYPE" && retriable5xx && attempt < maxRetries) {
|
|
15398
15446
|
const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
|
|
15399
15447
|
const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
|
|
15400
15448
|
if (canWait(delay)) {
|
|
15401
|
-
_optionalChain([this, 'access',
|
|
15449
|
+
_optionalChain([this, 'access', _99 => _99.logger, 'access', _100 => _100.warn, 'optionalCall', _101 => _101(
|
|
15402
15450
|
`[autotask] non-JSON 2xx on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15403
15451
|
correlationId
|
|
15404
15452
|
)]);
|
|
@@ -15407,6 +15455,18 @@ var HttpClient = (_class6 = class {
|
|
|
15407
15455
|
continue;
|
|
15408
15456
|
}
|
|
15409
15457
|
}
|
|
15458
|
+
if (maintenanceWaits > 0 && err2.code === "UNEXPECTED_CONTENT_TYPE") {
|
|
15459
|
+
err2.details = {
|
|
15460
|
+
..._nullishCoalesce(err2.details, () => ( {})),
|
|
15461
|
+
maintenance: {
|
|
15462
|
+
waits: maintenanceWaits,
|
|
15463
|
+
waitedMs: Date.now() - (_nullishCoalesce(firstMaintenanceAt, () => ( Date.now()))),
|
|
15464
|
+
maxWaitMs: maintenanceMaxWaitMs,
|
|
15465
|
+
exhausted: true
|
|
15466
|
+
}
|
|
15467
|
+
};
|
|
15468
|
+
err2.suggestedAction = `The zone stayed in a maintenance window for ${Math.round(maintenanceMaxWaitMs / 6e4)} min \u2014 the SDK waited and retried ${maintenanceWaits} time(s) and gave up. Re-run after the window (typically under 30 min), or raise maintenanceMaxWaitMs.`;
|
|
15469
|
+
}
|
|
15410
15470
|
attachEmptyReasonDetails(err2);
|
|
15411
15471
|
throw err2;
|
|
15412
15472
|
}
|
|
@@ -15430,7 +15490,7 @@ var HttpClient = (_class6 = class {
|
|
|
15430
15490
|
const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
|
|
15431
15491
|
const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
|
|
15432
15492
|
if (canWait(delay)) {
|
|
15433
|
-
_optionalChain([this, 'access',
|
|
15493
|
+
_optionalChain([this, 'access', _102 => _102.logger, 'access', _103 => _103.warn, 'optionalCall', _104 => _104(
|
|
15434
15494
|
`[autotask] ${status} on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
|
|
15435
15495
|
correlationId
|
|
15436
15496
|
)]);
|
|
@@ -15443,7 +15503,7 @@ var HttpClient = (_class6 = class {
|
|
|
15443
15503
|
const target = await this.discoverZoneBase(signal, ctx);
|
|
15444
15504
|
const targetViolation = target === void 0 || this.hostPolicy === void 0 ? null : decideHostPolicy(target, this.hostPolicy);
|
|
15445
15505
|
if (targetViolation !== null) {
|
|
15446
|
-
_optionalChain([this, 'access',
|
|
15506
|
+
_optionalChain([this, 'access', _105 => _105.logger, 'access', _106 => _106.warn, 'optionalCall', _107 => _107(
|
|
15447
15507
|
`[autotask] zone re-point refused by hostPolicy (${targetViolation.bound}): ${targetViolation.origin} \u2014 the original 401 propagates, zero wire to the refused host`,
|
|
15448
15508
|
void 0
|
|
15449
15509
|
)]);
|
|
@@ -15481,7 +15541,7 @@ var HttpClient = (_class6 = class {
|
|
|
15481
15541
|
threadThreshold
|
|
15482
15542
|
});
|
|
15483
15543
|
this.cooldownStore.set(this.tenantKey, Date.now() + durationMs);
|
|
15484
|
-
_optionalChain([this, 'access',
|
|
15544
|
+
_optionalChain([this, 'access', _108 => _108.logger, 'access', _109 => _109.warn, 'optionalCall', _110 => _110(
|
|
15485
15545
|
`[autotask] 429 on ${method} ${opts.path} surfaces after ${attempt + 1} attempt(s); tenant cooldown armed for ${Math.round(durationMs / 1e3)}s`,
|
|
15486
15546
|
correlationId
|
|
15487
15547
|
)]);
|
|
@@ -15526,7 +15586,7 @@ var HttpClient = (_class6 = class {
|
|
|
15526
15586
|
if (this.fieldCache !== void 0 && err instanceof AutotaskError) {
|
|
15527
15587
|
const op = typeof opts.operation === "string" ? opts.operation : void 0;
|
|
15528
15588
|
const verb = op !== void 0 ? op.slice(op.lastIndexOf(".") + 1) : "";
|
|
15529
|
-
const drift = _optionalChain([err, 'access',
|
|
15589
|
+
const drift = _optionalChain([err, 'access', _111 => _111.details, 'optionalAccess', _112 => _112.deterministic]) === true || err.code === "INVALID_RESPONSE" && META_TRIO_VERBS.has(verb);
|
|
15530
15590
|
if (drift && op !== void 0) {
|
|
15531
15591
|
const dot = op.indexOf(".");
|
|
15532
15592
|
if (dot > 0) this.fieldCache.invalidate(op.slice(0, dot));
|
|
@@ -15534,8 +15594,9 @@ var HttpClient = (_class6 = class {
|
|
|
15534
15594
|
}
|
|
15535
15595
|
throw err;
|
|
15536
15596
|
} finally {
|
|
15597
|
+
clearTimeout(deadlineTimer);
|
|
15537
15598
|
if (!(method === "GET" || opts.idempotent === true)) {
|
|
15538
|
-
_optionalChain([this, 'access',
|
|
15599
|
+
_optionalChain([this, 'access', _113 => _113.readCache, 'optionalAccess', _114 => _114.clear, 'call', _115 => _115()]);
|
|
15539
15600
|
const nameOp = typeof opts.operation === "string" ? opts.operation : void 0;
|
|
15540
15601
|
const nameDot = nameOp !== void 0 ? nameOp.indexOf(".") : -1;
|
|
15541
15602
|
if (this.resourceNameCache !== void 0 && nameOp !== void 0 && nameDot > 0 && nameOp.slice(0, nameDot) === "resources") {
|
|
@@ -15555,7 +15616,7 @@ function attachEmptyReasonDetails(err) {
|
|
|
15555
15616
|
const resource = err.operation.slice(0, dot);
|
|
15556
15617
|
const op = err.operation.slice(dot + 1);
|
|
15557
15618
|
const surface = err.operation;
|
|
15558
|
-
const stamp = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
15619
|
+
const stamp = _optionalChain([EMPTY_REASON_STAMPS, 'access', _116 => _116[resource], 'optionalAccess', _117 => _117[op]]);
|
|
15559
15620
|
const pointer = POINTER_NOTES[surface];
|
|
15560
15621
|
const isGetMiss = err instanceof NotFoundError && op === "get";
|
|
15561
15622
|
if (stamp === void 0 && pointer === void 0 && !isGetMiss) return;
|
|
@@ -15844,7 +15905,7 @@ async function expandResourceNames(client, ids, opts = {}) {
|
|
|
15844
15905
|
continue;
|
|
15845
15906
|
}
|
|
15846
15907
|
}
|
|
15847
|
-
const epoch = _nullishCoalesce(_optionalChain([cache, 'optionalAccess',
|
|
15908
|
+
const epoch = _nullishCoalesce(_optionalChain([cache, 'optionalAccess', _118 => _118.epoch]), () => ( 0));
|
|
15848
15909
|
const work = (async () => {
|
|
15849
15910
|
try {
|
|
15850
15911
|
const record = await holder.get(id, { fresh });
|
|
@@ -15963,7 +16024,7 @@ async function fieldCatalog(client, opts) {
|
|
|
15963
16024
|
}
|
|
15964
16025
|
}
|
|
15965
16026
|
const { fieldOps, udfOps, resources: allResources } = capabilitySets();
|
|
15966
|
-
const includeRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
16027
|
+
const includeRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _119 => _119.include]), () => ( ["fields"]));
|
|
15967
16028
|
if (!Array.isArray(includeRaw) || includeRaw.length === 0) {
|
|
15968
16029
|
throw new AutotaskConfigError("fieldCatalog: opts.include must be a non-empty array of (info|fields|udf)");
|
|
15969
16030
|
}
|
|
@@ -15977,7 +16038,7 @@ async function fieldCatalog(client, opts) {
|
|
|
15977
16038
|
}
|
|
15978
16039
|
if (!include.includes(kind)) include.push(kind);
|
|
15979
16040
|
}
|
|
15980
|
-
const resourcesRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
16041
|
+
const resourcesRaw = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _120 => _120.resources]), () => ( WORKFLOW_RESOURCES));
|
|
15981
16042
|
if (!Array.isArray(resourcesRaw) || resourcesRaw.length === 0) {
|
|
15982
16043
|
throw new AutotaskConfigError("fieldCatalog: opts.resources must be a non-empty array of plan resource keys");
|
|
15983
16044
|
}
|
|
@@ -16009,7 +16070,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16009
16070
|
if (!targets.includes(key)) targets.push(key);
|
|
16010
16071
|
}
|
|
16011
16072
|
let fieldsFilter;
|
|
16012
|
-
const fieldsRaw = _optionalChain([opts, 'optionalAccess',
|
|
16073
|
+
const fieldsRaw = _optionalChain([opts, 'optionalAccess', _121 => _121.fields]);
|
|
16013
16074
|
if (fieldsRaw !== void 0) {
|
|
16014
16075
|
if (!Array.isArray(fieldsRaw) || fieldsRaw.length === 0) {
|
|
16015
16076
|
throw new AutotaskConfigError("fieldCatalog: opts.fields must be a non-empty array of vendor field name strings");
|
|
@@ -16031,7 +16092,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16031
16092
|
`fieldCatalog: opts.labels must be a boolean (got ${typeof opts.labels})`
|
|
16032
16093
|
);
|
|
16033
16094
|
}
|
|
16034
|
-
const labels = _optionalChain([opts, 'optionalAccess',
|
|
16095
|
+
const labels = _optionalChain([opts, 'optionalAccess', _122 => _122.labels]) === true;
|
|
16035
16096
|
const cost = targets.length * include.length;
|
|
16036
16097
|
if (cost > MAX_FIELD_CATALOG_WIRE) {
|
|
16037
16098
|
throw new AutotaskConfigError(
|
|
@@ -16040,7 +16101,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16040
16101
|
);
|
|
16041
16102
|
}
|
|
16042
16103
|
const cache = client.http.fieldCache;
|
|
16043
|
-
const fresh = _optionalChain([opts, 'optionalAccess',
|
|
16104
|
+
const fresh = _optionalChain([opts, 'optionalAccess', _123 => _123.fresh]) === true;
|
|
16044
16105
|
const zone = _nullishCoalesce(client.config.zone, () => ( "unknown"));
|
|
16045
16106
|
const rows = [];
|
|
16046
16107
|
let wireUsed = 0;
|
|
@@ -16064,11 +16125,11 @@ async function fieldCatalog(client, opts) {
|
|
|
16064
16125
|
error: null
|
|
16065
16126
|
};
|
|
16066
16127
|
const fetches = {
|
|
16067
|
-
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16068
|
-
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16069
|
-
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess',
|
|
16128
|
+
info: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _124 => _124.getEntityInfo, 'optionalCall', _125 => _125()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getEntityInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
16129
|
+
fields: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _126 => _126.getFieldInfo, 'optionalCall', _127 => _127()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getFieldInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" })))),
|
|
16130
|
+
udf: () => _nullishCoalesce(_optionalChain([holder, 'optionalAccess', _128 => _128.getUdfInfo, 'optionalCall', _129 => _129()]), () => ( Promise.reject(new AutotaskError(`fieldCatalog: the client exposes no getUdfInfo read for "${resource}"`, { code: "INVALID_RESPONSE", category: "server" }))))
|
|
16070
16131
|
};
|
|
16071
|
-
if (fresh) _optionalChain([cache, 'optionalAccess',
|
|
16132
|
+
if (fresh) _optionalChain([cache, 'optionalAccess', _130 => _130.invalidate, 'call', _131 => _131(resource)]);
|
|
16072
16133
|
let allCached = true;
|
|
16073
16134
|
const ages = [];
|
|
16074
16135
|
for (const kind of include) {
|
|
@@ -16121,7 +16182,7 @@ async function fieldCatalog(client, opts) {
|
|
|
16121
16182
|
label: zone,
|
|
16122
16183
|
cached: cache !== void 0,
|
|
16123
16184
|
labels,
|
|
16124
|
-
ttlMs: _nullishCoalesce(_optionalChain([cache, 'optionalAccess',
|
|
16185
|
+
ttlMs: _nullishCoalesce(_optionalChain([cache, 'optionalAccess', _132 => _132.ttlMs]), () => ( null)),
|
|
16125
16186
|
fetchedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16126
16187
|
rows,
|
|
16127
16188
|
wireUsed,
|
|
@@ -16286,7 +16347,7 @@ async function resolveCompositeNames(http, plan, opts = {}) {
|
|
|
16286
16347
|
} else {
|
|
16287
16348
|
for (const f of plan.labelFields) {
|
|
16288
16349
|
const frow = row.fields.find((x) => x.name === f);
|
|
16289
|
-
picklists[f] = _optionalChain([frow, 'optionalAccess',
|
|
16350
|
+
picklists[f] = _optionalChain([frow, 'optionalAccess', _133 => _133.picklistValues]);
|
|
16290
16351
|
}
|
|
16291
16352
|
}
|
|
16292
16353
|
} catch (err) {
|
|
@@ -16297,8 +16358,8 @@ async function resolveCompositeNames(http, plan, opts = {}) {
|
|
|
16297
16358
|
}
|
|
16298
16359
|
return {
|
|
16299
16360
|
section,
|
|
16300
|
-
resourceName: (id) => _nullishCoalesce(_optionalChain([section, 'access',
|
|
16301
|
-
recordName: (table, id) => _nullishCoalesce(_optionalChain([section, 'access',
|
|
16361
|
+
resourceName: (id) => _nullishCoalesce(_optionalChain([section, 'access', _134 => _134.rows, 'access', _135 => _135[`resource:${id}`], 'optionalAccess', _136 => _136.name]), () => ( null)),
|
|
16362
|
+
recordName: (table, id) => _nullishCoalesce(_optionalChain([section, 'access', _137 => _137.rows, 'access', _138 => _138[`${table}:${id}`], 'optionalAccess', _139 => _139.name]), () => ( null)),
|
|
16302
16363
|
labelFor: (field, value) => {
|
|
16303
16364
|
if (value === null || value === void 0) return null;
|
|
16304
16365
|
const values = picklists[field];
|
|
@@ -16569,8 +16630,8 @@ function validateFetchManyItems(items, cap, opName = "fetchMany", capRef = `FETC
|
|
|
16569
16630
|
problems.push(`${at}.fields: must be an array of exact vendor field names (discover them via operations.fieldCatalog)`);
|
|
16570
16631
|
continue;
|
|
16571
16632
|
}
|
|
16572
|
-
if (_optionalChain([validation, 'optionalAccess',
|
|
16573
|
-
const authoritative = _nullishCoalesce(_optionalChain([validation, 'optionalAccess',
|
|
16633
|
+
if (_optionalChain([validation, 'optionalAccess', _140 => _140.fieldCheck]) !== false) {
|
|
16634
|
+
const authoritative = _nullishCoalesce(_optionalChain([validation, 'optionalAccess', _141 => _141.fieldSetsByResource, 'optionalAccess', _142 => _142.get, 'call', _143 => _143(resourceKey)]), () => ( fields));
|
|
16574
16635
|
for (const f of item.fields) {
|
|
16575
16636
|
if (!authoritative.includes(f)) {
|
|
16576
16637
|
problems.push(
|
|
@@ -16674,7 +16735,7 @@ function project2(value, fields) {
|
|
|
16674
16735
|
return out;
|
|
16675
16736
|
}
|
|
16676
16737
|
function resourcePathOf(key, holder) {
|
|
16677
|
-
const path = _optionalChain([holder, 'optionalAccess',
|
|
16738
|
+
const path = _optionalChain([holder, 'optionalAccess', _144 => _144.resourcePath]);
|
|
16678
16739
|
if (typeof path !== "string" || path === "") {
|
|
16679
16740
|
throw new AutotaskConfigError(`fetchByIds: the client exposes no ${key} resource path (registry drift)`, {
|
|
16680
16741
|
suggestedAction: "Rebuild the client from the SDK build that ships this registry (the resource set is pinned by the plan)."
|
|
@@ -16846,7 +16907,7 @@ function blindEmptyReason(stamp) {
|
|
|
16846
16907
|
};
|
|
16847
16908
|
}
|
|
16848
16909
|
function attachUpdateTargetMissReason(err, key) {
|
|
16849
|
-
const pinned = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
16910
|
+
const pinned = _optionalChain([EMPTY_REASON_STAMPS, 'access', _145 => _145[key], 'optionalAccess', _146 => _146.update]);
|
|
16850
16911
|
if (pinned === void 0) return;
|
|
16851
16912
|
err.details = { ..._nullishCoalesce(err.details, () => ( {})), emptyReason: pinned };
|
|
16852
16913
|
}
|
|
@@ -17011,7 +17072,7 @@ var BaseResource = class {
|
|
|
17011
17072
|
return (page, pageSize) => this.fetchPage(p, page, pageSize, state);
|
|
17012
17073
|
}
|
|
17013
17074
|
walkPageSize(params) {
|
|
17014
|
-
return clampPageSize(_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
17075
|
+
return clampPageSize(_nullishCoalesce(_optionalChain([params, 'optionalAccess', _147 => _147.maxRecords]), () => ( this.defaultPageSize)));
|
|
17015
17076
|
}
|
|
17016
17077
|
/** Stream items across pages (the resource `query` surface). */
|
|
17017
17078
|
queryItems(params) {
|
|
@@ -17023,7 +17084,7 @@ var BaseResource = class {
|
|
|
17023
17084
|
}
|
|
17024
17085
|
/** Collect every item across all pages (the resource `queryAll` surface; 1000-page guarded). */
|
|
17025
17086
|
async queryAllItems(params) {
|
|
17026
|
-
return collectAll(this.pageFetcher(params), { pageSize: this.walkPageSize(params), maxRecords: _optionalChain([params, 'optionalAccess',
|
|
17087
|
+
return collectAll(this.pageFetcher(params), { pageSize: this.walkPageSize(params), maxRecords: _optionalChain([params, 'optionalAccess', _148 => _148.maxTotalRecords]) });
|
|
17027
17088
|
}
|
|
17028
17089
|
/**
|
|
17029
17090
|
* `queryBounded` — server-side pagination (the MCP query surface): ONE call
|
|
@@ -17058,19 +17119,19 @@ var BaseResource = class {
|
|
|
17058
17119
|
"queryBounded: params must be an object { filter?, limit?, latest?, includeFields? } \u2014 a bare conditions array is not accepted (wrap it: { filter: [...] })"
|
|
17059
17120
|
);
|
|
17060
17121
|
}
|
|
17061
|
-
const limit = _nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
17122
|
+
const limit = _nullishCoalesce(_optionalChain([params, 'optionalAccess', _149 => _149.limit]), () => ( BOUNDED_QUERY_DEFAULT_LIMIT));
|
|
17062
17123
|
if (!Number.isInteger(limit) || limit < 1 || limit > BOUNDED_QUERY_MAX_LIMIT) {
|
|
17063
17124
|
throw new AutotaskConfigError(
|
|
17064
17125
|
`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`
|
|
17065
17126
|
);
|
|
17066
17127
|
}
|
|
17067
|
-
const noteChars = _optionalChain([params, 'optionalAccess',
|
|
17128
|
+
const noteChars = _optionalChain([params, 'optionalAccess', _150 => _150.noteChars]);
|
|
17068
17129
|
if (noteChars !== void 0 && (!Number.isInteger(noteChars) || noteChars < 1)) {
|
|
17069
17130
|
throw new AutotaskConfigError(
|
|
17070
17131
|
`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)`
|
|
17071
17132
|
);
|
|
17072
17133
|
}
|
|
17073
|
-
const walkParams = _optionalChain([params, 'optionalAccess',
|
|
17134
|
+
const walkParams = _optionalChain([params, 'optionalAccess', _151 => _151.fieldsPreset]) !== void 0 ? { ...params, includeFields: resolveFieldsPreset(params.fieldsPreset, this.config.key, params.includeFields) } : _nullishCoalesce(params, () => ( {}));
|
|
17074
17135
|
const latest = walkParams.latest;
|
|
17075
17136
|
if (latest !== void 0) {
|
|
17076
17137
|
if (!Number.isInteger(latest) || latest < 1 || latest > BOUNDED_QUERY_MAX_LIMIT) {
|
|
@@ -17078,7 +17139,7 @@ var BaseResource = class {
|
|
|
17078
17139
|
`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`
|
|
17079
17140
|
);
|
|
17080
17141
|
}
|
|
17081
|
-
if (_optionalChain([params, 'optionalAccess',
|
|
17142
|
+
if (_optionalChain([params, 'optionalAccess', _152 => _152.limit]) !== void 0 && limit < latest) {
|
|
17082
17143
|
throw new AutotaskConfigError(
|
|
17083
17144
|
`queryBounded: limit (${String(limit)}) must be >= latest (${String(latest)}) \u2014 latest governs the returned count and limit is the walk window`
|
|
17084
17145
|
);
|
|
@@ -17160,8 +17221,8 @@ var BaseResource = class {
|
|
|
17160
17221
|
* speculation). */
|
|
17161
17222
|
stampEmptyQueryResult(result, params) {
|
|
17162
17223
|
if (result.items.length !== 0) return;
|
|
17163
|
-
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17164
|
-
const pinnedReason = normalizedConditions(_optionalChain([params, 'optionalAccess',
|
|
17224
|
+
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _153 => _153[this.config.key], 'optionalAccess', _154 => _154.query]), _optionalChain([params, 'optionalAccess', _155 => _155.filter]));
|
|
17225
|
+
const pinnedReason = normalizedConditions(_optionalChain([params, 'optionalAccess', _156 => _156.filter])) === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access', _157 => _157[this.config.key], 'optionalAccess', _158 => _158.query]) : void 0;
|
|
17165
17226
|
if (result.blindSurface !== void 0 || pinnedReason !== void 0) {
|
|
17166
17227
|
result.emptyReason = result.blindSurface !== void 0 ? blindEmptyReason(result.blindSurface) : pinnedReason;
|
|
17167
17228
|
}
|
|
@@ -17312,7 +17373,7 @@ var BaseResource = class {
|
|
|
17312
17373
|
if (result.items.length === 0) {
|
|
17313
17374
|
this.stampEmptyQueryResult(result, params);
|
|
17314
17375
|
} else {
|
|
17315
|
-
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17376
|
+
result.blindSurface = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _159 => _159[this.config.key], 'optionalAccess', _160 => _160.query]), params.filter);
|
|
17316
17377
|
}
|
|
17317
17378
|
return result;
|
|
17318
17379
|
}
|
|
@@ -17351,7 +17412,7 @@ var BaseResource = class {
|
|
|
17351
17412
|
* or, on a plan-pinned blind surface, the `{ count: 0, blindSurface }`
|
|
17352
17413
|
* typed sentinel (S12-C T10; see `BlindCountResult`). */
|
|
17353
17414
|
async countGlobal(params) {
|
|
17354
|
-
const conditions = normalizedConditions(_optionalChain([params, 'optionalAccess',
|
|
17415
|
+
const conditions = normalizedConditions(_optionalChain([params, 'optionalAccess', _161 => _161.filter]));
|
|
17355
17416
|
const body = {};
|
|
17356
17417
|
body.filter = conditions === void 0 ? [] : buildFilter(conditions).filter;
|
|
17357
17418
|
const res = await this.http.request({
|
|
@@ -17362,9 +17423,9 @@ var BaseResource = class {
|
|
|
17362
17423
|
idempotent: true
|
|
17363
17424
|
});
|
|
17364
17425
|
const count = unwrapQueryCount(res, `${this.config.key}.count`);
|
|
17365
|
-
const stamp = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
17426
|
+
const stamp = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _162 => _162[this.config.key], 'optionalAccess', _163 => _163.count]), _optionalChain([params, 'optionalAccess', _164 => _164.filter]));
|
|
17366
17427
|
if (count === 0) {
|
|
17367
|
-
const pinnedReason = conditions === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
17428
|
+
const pinnedReason = conditions === void 0 ? _optionalChain([EMPTY_REASON_STAMPS, 'access', _165 => _165[this.config.key], 'optionalAccess', _166 => _166.count]) : void 0;
|
|
17368
17429
|
if (stamp !== void 0 || pinnedReason !== void 0) {
|
|
17369
17430
|
return {
|
|
17370
17431
|
count,
|
|
@@ -17395,9 +17456,9 @@ var BaseResource = class {
|
|
|
17395
17456
|
const hit = cache.get(path);
|
|
17396
17457
|
if (hit !== void 0) return hit;
|
|
17397
17458
|
}
|
|
17398
|
-
const epoch = _optionalChain([cache, 'optionalAccess',
|
|
17459
|
+
const epoch = _optionalChain([cache, 'optionalAccess', _167 => _167.epoch]);
|
|
17399
17460
|
const res = await this.http.request({ method: "GET", path, operation });
|
|
17400
|
-
_optionalChain([cache, 'optionalAccess',
|
|
17461
|
+
_optionalChain([cache, 'optionalAccess', _168 => _168.set, 'call', _169 => _169(path, res, resource, epoch)]);
|
|
17401
17462
|
return res;
|
|
17402
17463
|
}
|
|
17403
17464
|
/**
|
|
@@ -17436,7 +17497,7 @@ var BaseResource = class {
|
|
|
17436
17497
|
return value;
|
|
17437
17498
|
});
|
|
17438
17499
|
work.catch((err) => {
|
|
17439
|
-
if (err instanceof AutotaskError && (err.code === "INVALID_RESPONSE" || _optionalChain([err, 'access',
|
|
17500
|
+
if (err instanceof AutotaskError && (err.code === "INVALID_RESPONSE" || _optionalChain([err, 'access', _170 => _170.details, 'optionalAccess', _171 => _171.deterministic]) === true)) {
|
|
17440
17501
|
cache.invalidate(key);
|
|
17441
17502
|
}
|
|
17442
17503
|
});
|
|
@@ -17466,7 +17527,7 @@ var BaseResource = class {
|
|
|
17466
17527
|
path: `${this.resourcePath}/${numeric}`,
|
|
17467
17528
|
operation: `${this.config.key}.get`,
|
|
17468
17529
|
skipResponseRedaction: true,
|
|
17469
|
-
maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
17530
|
+
maxRetries: _optionalChain([readOpts, 'optionalAccess', _172 => _172.maxRetries])
|
|
17470
17531
|
});
|
|
17471
17532
|
return unwrapItem(res, numeric, `${this.config.key}.get`);
|
|
17472
17533
|
}
|
|
@@ -17485,7 +17546,7 @@ var BaseResource = class {
|
|
|
17485
17546
|
path: this.scopedItemPath(parentId, numeric),
|
|
17486
17547
|
operation: `${this.config.key}.get`,
|
|
17487
17548
|
skipResponseRedaction: true,
|
|
17488
|
-
maxRetries: _optionalChain([readOpts, 'optionalAccess',
|
|
17549
|
+
maxRetries: _optionalChain([readOpts, 'optionalAccess', _173 => _173.maxRetries])
|
|
17489
17550
|
});
|
|
17490
17551
|
return unwrapItem(res, numeric, `${this.config.key}.get`);
|
|
17491
17552
|
}
|
|
@@ -18144,7 +18205,7 @@ var BaseResource = class {
|
|
|
18144
18205
|
current = parentId === void 0 ? await this.getGlobal(id, true) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true);
|
|
18145
18206
|
} catch (err) {
|
|
18146
18207
|
if (err instanceof NotFoundError) {
|
|
18147
|
-
const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access',
|
|
18208
|
+
const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access', _174 => _174[this.config.key], 'optionalAccess', _175 => _175.update]);
|
|
18148
18209
|
checks.push({
|
|
18149
18210
|
name: "current-record-exists",
|
|
18150
18211
|
ok: false,
|
|
@@ -18302,12 +18363,12 @@ var BaseResource = class {
|
|
|
18302
18363
|
return null;
|
|
18303
18364
|
}
|
|
18304
18365
|
}
|
|
18305
|
-
const epoch = _optionalChain([cache, 'optionalAccess',
|
|
18366
|
+
const epoch = _optionalChain([cache, 'optionalAccess', _176 => _176.epoch]);
|
|
18306
18367
|
try {
|
|
18307
18368
|
return await this.fetchRecordRaw(entityPath, referenceId);
|
|
18308
18369
|
} catch (err) {
|
|
18309
18370
|
if (err instanceof NotFoundError) {
|
|
18310
|
-
_optionalChain([cache, 'optionalAccess',
|
|
18371
|
+
_optionalChain([cache, 'optionalAccess', _177 => _177.set, 'call', _178 => _178(absentKey, CONTEXT_ABSENT_MARKER, RESOURCE_KEY_BY_PATH[entityPath], epoch)]);
|
|
18311
18372
|
return null;
|
|
18312
18373
|
}
|
|
18313
18374
|
throw err;
|
|
@@ -18423,7 +18484,7 @@ var BaseResource = class {
|
|
|
18423
18484
|
missDetail(operator, fields) {
|
|
18424
18485
|
const key = this.config.key;
|
|
18425
18486
|
const probe = fields.map((field) => ({ field, op: operator, value: "" }));
|
|
18426
|
-
const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access',
|
|
18487
|
+
const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _179 => _179[key], 'optionalAccess', _180 => _180.query]), probe);
|
|
18427
18488
|
const next = [];
|
|
18428
18489
|
if (blind !== void 0) {
|
|
18429
18490
|
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.`);
|
|
@@ -18696,4 +18757,6 @@ var BaseResource = class {
|
|
|
18696
18757
|
|
|
18697
18758
|
|
|
18698
18759
|
|
|
18699
|
-
|
|
18760
|
+
|
|
18761
|
+
|
|
18762
|
+
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.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.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;
|