node-autotask 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/ARCHITECTURE.md +43 -7
  2. package/MCP_TOOL_CATALOG.json +1 -1
  3. package/MCP_TOOL_MANIFEST.md +2 -2
  4. package/N8N_MCP_MANIFEST.json +2 -2
  5. package/N8N_MCP_MANIFEST.md +3 -3
  6. package/README.md +9 -8
  7. package/capabilities.json +2132 -2740
  8. package/dist/capabilities.cjs +2 -2
  9. package/dist/capabilities.d.cts +9 -4
  10. package/dist/capabilities.d.ts +9 -4
  11. package/dist/capabilities.js +1 -1
  12. package/dist/{chunk-Y6O5VVQ4.js → chunk-AXVYQPTB.js} +136 -126
  13. package/dist/{chunk-IKJLIDK3.js → chunk-CSA6QSV6.js} +37 -25
  14. package/dist/{chunk-CXXNONRP.cjs → chunk-EWMG3HHU.cjs} +2131 -2739
  15. package/dist/{chunk-OZD5FQM4.js → chunk-JIDR3NPV.js} +2131 -2739
  16. package/dist/{chunk-DDZXN6LN.js → chunk-LH5BXQ7A.js} +2 -2
  17. package/dist/{chunk-CJA6L6NR.cjs → chunk-V7QPZA7L.cjs} +135 -135
  18. package/dist/{chunk-MTDCLVQQ.cjs → chunk-VLIUHEPE.cjs} +558 -548
  19. package/dist/{chunk-KB2ANVVR.cjs → chunk-Z7YT72SS.cjs} +42 -30
  20. package/dist/{index-DbMKWnEX.d.cts → index-BXIwhAN4.d.cts} +67 -13
  21. package/dist/{index-TuqNq3Ro.d.ts → index-M0qJIiRt.d.ts} +67 -13
  22. package/dist/index.cjs +61 -19
  23. package/dist/index.d.cts +83 -3
  24. package/dist/index.d.ts +83 -3
  25. package/dist/index.js +46 -4
  26. package/dist/operations/index.cjs +110 -107
  27. package/dist/operations/index.d.cts +9 -2
  28. package/dist/operations/index.d.ts +9 -2
  29. package/dist/operations/index.js +9 -6
  30. package/dist/pool.cjs +8 -8
  31. package/dist/pool.d.cts +1 -1
  32. package/dist/pool.d.ts +1 -1
  33. package/dist/pool.js +4 -4
  34. package/dist/resources/index.cjs +4 -4
  35. package/dist/resources/index.d.cts +1 -1
  36. package/dist/resources/index.d.ts +1 -1
  37. package/dist/resources/index.js +3 -3
  38. package/dist/untrusted.cjs +3 -1
  39. package/dist/untrusted.d.cts +9 -4
  40. package/dist/untrusted.d.ts +9 -4
  41. package/dist/untrusted.js +3 -1
  42. package/docs/API.md +112 -22
  43. package/docs/LIVE-TESTING.md +1 -1
  44. package/package.json +2 -2
@@ -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 _chunkCXXNONRPcjs = require('./chunk-CXXNONRP.cjs');
3
+ var _chunkEWMG3HHUcjs = require('./chunk-EWMG3HHU.cjs');
4
4
 
5
5
  // src/auth.ts
6
6
  var AUTH_HEADERS = {
@@ -15188,6 +15188,7 @@ var HttpClient = (_class6 = class {
15188
15188
  );
15189
15189
  const auditBody = opts.body !== void 0 ? redactAuditBody(opts.body) : void 0;
15190
15190
  const retriable = _nullishCoalesce(opts.idempotent, () => ( IDEMPOTENT_METHODS.includes(method)));
15191
+ const retriable5xx = _nullishCoalesce(opts.idempotent, () => ( method === "GET"));
15191
15192
  const expectBody = _nullishCoalesce(opts.expectBody, () => ( method !== "DELETE"));
15192
15193
  const ctx = { operation: opts.operation, url, correlationId };
15193
15194
  let lastStatus;
@@ -15313,7 +15314,7 @@ var HttpClient = (_class6 = class {
15313
15314
  this.release();
15314
15315
  if (signal.aborted || isAbortLike(err2)) throw interrupted();
15315
15316
  const delay = backoffDelay(attempt);
15316
- if (attempt < maxRetries && retriable && canWait(delay)) {
15317
+ if (attempt < maxRetries && retriable5xx && canWait(delay)) {
15317
15318
  _optionalChain([this, 'access', _86 => _86.logger, 'access', _87 => _87.warn, 'optionalCall', _88 => _88(
15318
15319
  `[autotask] network error on ${method} ${opts.path}; retrying in ${delay}ms (attempt ${attempt + 1}/${maxRetries})`,
15319
15320
  correlationId
@@ -15384,7 +15385,7 @@ var HttpClient = (_class6 = class {
15384
15385
  // The content-type is host-sourced (a host-supplied
15385
15386
  // baseUrl can serve arbitrary HTML) — capped, never prose;
15386
15387
  // the raw snippet rides details only.
15387
- suggestedAction: retriable ? `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).`
15388
+ 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).`
15388
15389
  }
15389
15390
  ) : new AutotaskError(`Invalid JSON response body for ${method} ${opts.path}`, {
15390
15391
  ...ctx,
@@ -15393,7 +15394,7 @@ var HttpClient = (_class6 = class {
15393
15394
  httpStatus: status,
15394
15395
  suggestedAction: "The zone returned a non-JSON 2xx body; verify baseUrl points at the REST API."
15395
15396
  });
15396
- if (err2.code === "UNEXPECTED_CONTENT_TYPE" && retriable && attempt < maxRetries) {
15397
+ if (err2.code === "UNEXPECTED_CONTENT_TYPE" && retriable5xx && attempt < maxRetries) {
15397
15398
  const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
15398
15399
  const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
15399
15400
  if (canWait(delay)) {
@@ -15425,7 +15426,7 @@ var HttpClient = (_class6 = class {
15425
15426
  }
15426
15427
  const deterministic500 = status >= 500 && isDeterministicVendor500(parseVendorErrors(body));
15427
15428
  const retryableStatus = status === 429 || status >= 500;
15428
- if (retryableStatus && !deterministic500 && attempt < maxRetries && retriable) {
15429
+ if (retryableStatus && !deterministic500 && attempt < maxRetries && (status === 429 ? retriable : retriable5xx)) {
15429
15430
  const retryAfter = parseRetryAfter(res.headers.get("Retry-After"));
15430
15431
  const delay = retryAfter !== void 0 ? retryAfter * 1e3 : backoffDelay(attempt);
15431
15432
  if (canWait(delay)) {
@@ -15929,7 +15930,7 @@ function capabilitySets() {
15929
15930
  const fieldOps = /* @__PURE__ */ new Map();
15930
15931
  const udfOps = /* @__PURE__ */ new Map();
15931
15932
  const resources = /* @__PURE__ */ new Set();
15932
- for (const rec of _chunkCXXNONRPcjs.CAPABILITIES) {
15933
+ for (const rec of _chunkEWMG3HHUcjs.CAPABILITIES) {
15933
15934
  if (rec.resource === "operations") continue;
15934
15935
  resources.add(rec.resource);
15935
15936
  if (rec.operation === "getFieldInfo") fieldOps.set(rec.resource, rec);
@@ -17458,13 +17459,14 @@ var BaseResource = class {
17458
17459
  * see the live record, and an unredacted body must not enter the
17459
17460
  * (redacted-view) read cache.
17460
17461
  */
17461
- async getGlobalUnredacted(id) {
17462
+ async getGlobalUnredacted(id, readOpts) {
17462
17463
  const numeric = parseIdentifier(id, "id");
17463
17464
  const res = await this.http.request({
17464
17465
  method: "GET",
17465
17466
  path: `${this.resourcePath}/${numeric}`,
17466
17467
  operation: `${this.config.key}.get`,
17467
- skipResponseRedaction: true
17468
+ skipResponseRedaction: true,
17469
+ maxRetries: _optionalChain([readOpts, 'optionalAccess', _167 => _167.maxRetries])
17468
17470
  });
17469
17471
  return unwrapItem(res, numeric, `${this.config.key}.get`);
17470
17472
  }
@@ -17476,13 +17478,14 @@ var BaseResource = class {
17476
17478
  * record's own current values: a redacted read would write literal
17477
17479
  * '[REDACTED]' markers into the fallback PUT (corruption on live records).
17478
17480
  */
17479
- async getScopedUnredacted(parentId, id) {
17481
+ async getScopedUnredacted(parentId, id, readOpts) {
17480
17482
  const numeric = parseIdentifier(id, "id");
17481
17483
  const res = await this.http.request({
17482
17484
  method: "GET",
17483
17485
  path: this.scopedItemPath(parentId, numeric),
17484
17486
  operation: `${this.config.key}.get`,
17485
- skipResponseRedaction: true
17487
+ skipResponseRedaction: true,
17488
+ maxRetries: _optionalChain([readOpts, 'optionalAccess', _168 => _168.maxRetries])
17486
17489
  });
17487
17490
  return unwrapItem(res, numeric, `${this.config.key}.get`);
17488
17491
  }
@@ -17544,7 +17547,8 @@ var BaseResource = class {
17544
17547
  method: "POST",
17545
17548
  path: this.resourcePath,
17546
17549
  body,
17547
- operation: `${this.config.key}.create`
17550
+ operation: `${this.config.key}.create`,
17551
+ maxRetries: opts.maxRetries
17548
17552
  });
17549
17553
  return this.unwrapCreateOperation(res, body, opts);
17550
17554
  }
@@ -17707,7 +17711,7 @@ var BaseResource = class {
17707
17711
  if (opts.raw !== true) {
17708
17712
  let current;
17709
17713
  try {
17710
- current = await this.getGlobalUnredacted(numeric);
17714
+ current = await this.getGlobalUnredacted(numeric, { maxRetries: opts.maxRetries });
17711
17715
  } catch (err) {
17712
17716
  if (err instanceof NotFoundError) attachUpdateTargetMissReason(err, this.config.key);
17713
17717
  throw err;
@@ -17726,7 +17730,8 @@ var BaseResource = class {
17726
17730
  method: "PUT",
17727
17731
  path: collectionUpdate ? this.resourcePath : `${this.resourcePath}/${numeric}`,
17728
17732
  body,
17729
- operation
17733
+ operation,
17734
+ maxRetries: opts.maxRetries
17730
17735
  });
17731
17736
  } catch (err) {
17732
17737
  if (!this.putFallbackEligible(err)) throw err;
@@ -17734,7 +17739,7 @@ var BaseResource = class {
17734
17739
  throw this.putFallbackDeclined(err, route, false);
17735
17740
  }
17736
17741
  const merged = await this.putFallbackMergedBody(
17737
- () => this.getGlobalUnredacted(numeric),
17742
+ () => this.getGlobalUnredacted(numeric, { maxRetries: opts.maxRetries }),
17738
17743
  body,
17739
17744
  numeric
17740
17745
  );
@@ -17744,7 +17749,8 @@ var BaseResource = class {
17744
17749
  method: "PUT",
17745
17750
  path: `${this.resourcePath}/${numeric}`,
17746
17751
  body: merged,
17747
- operation
17752
+ operation,
17753
+ maxRetries: opts.maxRetries
17748
17754
  });
17749
17755
  } catch (rerr) {
17750
17756
  if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, route, true);
@@ -17758,12 +17764,13 @@ var BaseResource = class {
17758
17764
  * (204 / empty body) is a valid vendor delete answer — synthesize the
17759
17765
  * result from the path id (issue #25: the transport returns undefined
17760
17766
  * for it; a non-blank wrong shape still throws via unwrapOperation). */
17761
- async deleteGlobal(id) {
17767
+ async deleteGlobal(id, opts = {}) {
17762
17768
  const numeric = parseIdentifier(id, "id");
17763
17769
  const res = await this.http.request({
17764
17770
  method: "DELETE",
17765
17771
  path: `${this.resourcePath}/${numeric}`,
17766
- operation: `${this.config.key}.delete`
17772
+ operation: `${this.config.key}.delete`,
17773
+ maxRetries: opts.maxRetries
17767
17774
  });
17768
17775
  return res === void 0 ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);
17769
17776
  }
@@ -17784,7 +17791,8 @@ var BaseResource = class {
17784
17791
  method: "POST",
17785
17792
  path: this.scopedCollectionPath(parentId),
17786
17793
  body,
17787
- operation: `${this.config.key}.create`
17794
+ operation: `${this.config.key}.create`,
17795
+ maxRetries: opts.maxRetries
17788
17796
  });
17789
17797
  return this.unwrapCreateOperation(res, body, opts);
17790
17798
  }
@@ -17792,7 +17800,7 @@ var BaseResource = class {
17792
17800
  * Swagger documents put+patch on the scoped collection and has NO put/patch on
17793
17801
  * the item path anywhere in the spec; the node strips the id from the path and
17794
17802
  * PATCHes the collection, and the vendor keys the record by the id in the body. */
17795
- async updateScopedRaw(parentId, id, data) {
17803
+ async updateScopedRaw(parentId, id, data, opts = {}) {
17796
17804
  const numeric = parseIdentifier(id, "id");
17797
17805
  const body = this.normalizeMutationBody(data);
17798
17806
  body.id = numeric;
@@ -17804,12 +17812,13 @@ var BaseResource = class {
17804
17812
  method: "PATCH",
17805
17813
  path,
17806
17814
  body,
17807
- operation
17815
+ operation,
17816
+ maxRetries: opts.maxRetries
17808
17817
  });
17809
17818
  } catch (err) {
17810
17819
  if (!this.putFallbackEligible(err)) throw err;
17811
17820
  const merged = await this.putFallbackMergedBody(
17812
- () => this.getScopedUnredacted(parentId, numeric),
17821
+ () => this.getScopedUnredacted(parentId, numeric, { maxRetries: opts.maxRetries }),
17813
17822
  body,
17814
17823
  numeric
17815
17824
  );
@@ -17819,7 +17828,8 @@ var BaseResource = class {
17819
17828
  method: "PUT",
17820
17829
  path: `${path}/${numeric}`,
17821
17830
  body: merged,
17822
- operation
17831
+ operation,
17832
+ maxRetries: opts.maxRetries
17823
17833
  });
17824
17834
  } catch (rerr) {
17825
17835
  if (this.putFallbackEligible(rerr)) throw this.putFallbackDeclined(rerr, `PUT ${path}/${numeric}`, true);
@@ -17831,12 +17841,13 @@ var BaseResource = class {
17831
17841
  }
17832
17842
  /** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
17833
17843
  * (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
17834
- async deleteScopedRaw(parentId, id) {
17844
+ async deleteScopedRaw(parentId, id, opts = {}) {
17835
17845
  const numeric = parseIdentifier(id, "id");
17836
17846
  const res = await this.http.request({
17837
17847
  method: "DELETE",
17838
17848
  path: this.scopedItemPath(parentId, id),
17839
- operation: `${this.config.key}.delete`
17849
+ operation: `${this.config.key}.delete`,
17850
+ maxRetries: opts.maxRetries
17840
17851
  });
17841
17852
  return res === void 0 ? { id: numeric } : unwrapOperation(res, `${this.config.key}.delete`);
17842
17853
  }
@@ -17844,12 +17855,13 @@ var BaseResource = class {
17844
17855
  * Attachment delete: the vendor returns the deleted attachment MODEL, not
17845
17856
  * OperationResultModel (G1 envelope.md) — pass it through typed.
17846
17857
  */
17847
- async deleteScopedModel(parentId, id) {
17858
+ async deleteScopedModel(parentId, id, opts = {}) {
17848
17859
  const numeric = parseIdentifier(id, "id");
17849
17860
  const res = await this.http.request({
17850
17861
  method: "DELETE",
17851
17862
  path: this.scopedItemPath(parentId, id),
17852
- operation: `${this.config.key}.delete`
17863
+ operation: `${this.config.key}.delete`,
17864
+ maxRetries: opts.maxRetries
17853
17865
  });
17854
17866
  if (res === void 0) return {};
17855
17867
  if (!isRecord2(res)) {
@@ -18132,7 +18144,7 @@ var BaseResource = class {
18132
18144
  current = parentId === void 0 ? await this.getGlobal(id, true) : this.config.attachmentGet ? await this.getScopedModel(parentId, id, true) : await this.getScopedRaw(parentId, id, true);
18133
18145
  } catch (err) {
18134
18146
  if (err instanceof NotFoundError) {
18135
- const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access', _167 => _167[this.config.key], 'optionalAccess', _168 => _168.update]);
18147
+ const updateReason = _optionalChain([EMPTY_REASON_STAMPS, 'access', _169 => _169[this.config.key], 'optionalAccess', _170 => _170.update]);
18136
18148
  checks.push({
18137
18149
  name: "current-record-exists",
18138
18150
  ok: false,
@@ -18290,12 +18302,12 @@ var BaseResource = class {
18290
18302
  return null;
18291
18303
  }
18292
18304
  }
18293
- const epoch = _optionalChain([cache, 'optionalAccess', _169 => _169.epoch]);
18305
+ const epoch = _optionalChain([cache, 'optionalAccess', _171 => _171.epoch]);
18294
18306
  try {
18295
18307
  return await this.fetchRecordRaw(entityPath, referenceId);
18296
18308
  } catch (err) {
18297
18309
  if (err instanceof NotFoundError) {
18298
- _optionalChain([cache, 'optionalAccess', _170 => _170.set, 'call', _171 => _171(absentKey, CONTEXT_ABSENT_MARKER, RESOURCE_KEY_BY_PATH[entityPath], epoch)]);
18310
+ _optionalChain([cache, 'optionalAccess', _172 => _172.set, 'call', _173 => _173(absentKey, CONTEXT_ABSENT_MARKER, RESOURCE_KEY_BY_PATH[entityPath], epoch)]);
18299
18311
  return null;
18300
18312
  }
18301
18313
  throw err;
@@ -18411,7 +18423,7 @@ var BaseResource = class {
18411
18423
  missDetail(operator, fields) {
18412
18424
  const key = this.config.key;
18413
18425
  const probe = fields.map((field) => ({ field, op: operator, value: "" }));
18414
- const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _172 => _172[key], 'optionalAccess', _173 => _173.query]), probe);
18426
+ const blind = blindStampFor(_optionalChain([BLIND_SURFACE_STAMPS, 'access', _174 => _174[key], 'optionalAccess', _175 => _175.query]), probe);
18415
18427
  const next = [];
18416
18428
  if (blind !== void 0) {
18417
18429
  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.`);
@@ -823,7 +823,9 @@ interface AutotaskConfig {
823
823
  pageSize?: number;
824
824
  /** HTTP timeout in ms (whole-call budget). Default 30_000. */
825
825
  timeoutMs?: number;
826
- /** Retry budget for idempotent requests on 429/5xx. Default 3 (0 disables). */
826
+ /**
827
+ * The client's retry budget (default 3; 0 disables auto-retry). Three legs, two rules (issues #105/#109): the 429 leg retries on the pre-#105 retriable set (GET/PUT/DELETE + idempotent-flagged calls); the 5xx/network leg and the non-JSON-2xx (#24) leg retry GET + idempotent-flagged calls only. A per-call override rides `InvokeOptions.maxRetries` / `MutationOpts.maxRetries`.
828
+ */
827
829
  maxRetries?: number;
828
830
  /** Optional request log sink. Default: no-op. */
829
831
  logger?: Logger;
@@ -1194,10 +1196,13 @@ interface RequestOptions {
1194
1196
  /** Per-request timeout override (default: config.timeoutMs). */
1195
1197
  timeoutMs?: number;
1196
1198
  /**
1197
- * INTERNAL (SDK-only, never a caller surface): per-request retry-budget
1198
- * override (default: config.maxRetries). Used by the doctor preflight
1199
- * (src/doctor.ts) to report failures fast — retries off, shortened
1200
- * timeout. Does not change the transport chain order.
1199
+ * INTERNAL (SDK-only, never set by a caller on the transport directly):
1200
+ * per-request retry-budget override (default: config.maxRetries). Carries
1201
+ * the doctor preflight's fail-fast override (src/doctor.ts — retries off,
1202
+ * shortened timeout) and the caller surfaces' per-call budget
1203
+ * (InvokeOptions.maxRetries / MutationOpts.maxRetries, issue #105 — the
1204
+ * resource layer threads it here; `0` = exactly one send). Does not change
1205
+ * the transport chain order.
1201
1206
  */
1202
1207
  maxRetries?: number;
1203
1208
  /**
@@ -1212,7 +1217,15 @@ interface RequestOptions {
1212
1217
  expectBody?: boolean;
1213
1218
  /** Caller abort signal, combined with the deadline; aborting throws `AutotaskAbortError` (never retried). */
1214
1219
  signal?: AbortSignal;
1215
- /** Safe to retry on 429/5xx even though it is not GET/PUT/DELETE (e.g. the `/query` POST reads). Default: by method. */
1220
+ /**
1221
+ * Safe to retry even though the method is not GET (e.g. the `/query` POST
1222
+ * reads; or a mutation whose payload is idempotent by construction — the
1223
+ * issue #105 opt-back into the pre-#105 auto-retry). Default: by method —
1224
+ * the 429 leg retries GET/PUT/DELETE (the pre-#105 rule, unchanged); the
1225
+ * 5xx/network leg retries GET only (issue #105 — an unflagged mutation
1226
+ * makes exactly one send there; a 429 on an unflagged POST/PATCH still
1227
+ * surfaces at once, as before #105).
1228
+ */
1216
1229
  idempotent?: boolean;
1217
1230
  /**
1218
1231
  * INTERNAL (SDK-only, never a caller surface): skip the INV-A1 response
@@ -1242,7 +1255,15 @@ interface RequestOptions {
1242
1255
  */
1243
1256
  bypassCircuitBreaker?: boolean;
1244
1257
  }
1245
- /** Idempotent methods the transport may retry (POST/PATCH are never retried). */
1258
+ /**
1259
+ * The legacy retriable method set (kept exported for the public-surface
1260
+ * baseline): pre-#105 the transport auto-retried exactly these on 429/5xx,
1261
+ * and #105 keeps this set as the 429 leg's rule (a 429 is a pre-processing
1262
+ * refusal — the vendor never executed the call). Since issue #105 the
1263
+ * 5xx/network leg is narrower — GET + explicitly idempotent-flagged calls;
1264
+ * a mutation opts back into the pre-#105 auto-retry on both legs with
1265
+ * `idempotent: true`.
1266
+ */
1246
1267
  declare const IDEMPOTENT_METHODS: readonly string[];
1247
1268
  /**
1248
1269
  * Build the absolute request URL (base + path + query). Issue #54: the path
@@ -1884,6 +1905,21 @@ interface MutationOpts {
1884
1905
  * switch off).
1885
1906
  */
1886
1907
  raw?: boolean;
1908
+ /**
1909
+ * Issue #105: the per-call retry budget — it overrides the client's
1910
+ * `maxRetries` for every request this mutation issues (its send and its
1911
+ * auxiliary reads, e.g. the partial-update merge read). `0` = exactly one
1912
+ * send per request, no auto-retry; omitted = the client's configured
1913
+ * `maxRetries`. (Since #105 a mutation never auto-retries a 5xx or network
1914
+ * error by default — the write-outcome is unknown once the body was
1915
+ * written; a 429 is still retried per `Retry-After` on the pre-#105
1916
+ * retriable set, GET/PUT/DELETE + flagged calls. The optional stale-object
1917
+ * guard's verification read keeps the client budget. Compound ops
1918
+ * (`time_entries.createForResource`, `companies.upsertByName`) apply the
1919
+ * override to the op's mutation send only — their pre-wire resolution
1920
+ * reads keep the client budget.)
1921
+ */
1922
+ maxRetries?: number;
1887
1923
  }
1888
1924
  /**
1889
1925
  * Issue #13: the create-path response-shape-drift recovery options
@@ -2168,7 +2204,9 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2168
2204
  * see the live record, and an unredacted body must not enter the
2169
2205
  * (redacted-view) read cache.
2170
2206
  */
2171
- protected getGlobalUnredacted(id: Identifier): Promise<T>;
2207
+ protected getGlobalUnredacted(id: Identifier, readOpts?: {
2208
+ maxRetries?: number;
2209
+ }): Promise<T>;
2172
2210
  /**
2173
2211
  * Issue #34 fallback merge read: a FRESH parent-scoped single-record GET
2174
2212
  * that skips response redaction and is never cached (the same invariants
@@ -2177,7 +2215,9 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2177
2215
  * record's own current values: a redacted read would write literal
2178
2216
  * '[REDACTED]' markers into the fallback PUT (corruption on live records).
2179
2217
  */
2180
- protected getScopedUnredacted(parentId: Identifier, id: Identifier): Promise<T>;
2218
+ protected getScopedUnredacted(parentId: Identifier, id: Identifier, readOpts?: {
2219
+ maxRetries?: number;
2220
+ }): Promise<T>;
2181
2221
  /** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */
2182
2222
  protected getScopedRaw(parentId: Identifier, id: Identifier, fresh?: boolean): Promise<T>;
2183
2223
  /**
@@ -2271,7 +2311,7 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2271
2311
  * (204 / empty body) is a valid vendor delete answer — synthesize the
2272
2312
  * result from the path id (issue #25: the transport returns undefined
2273
2313
  * for it; a non-blank wrong shape still throws via unwrapOperation). */
2274
- protected deleteGlobal(id: Identifier): Promise<OperationResult>;
2314
+ protected deleteGlobal(id: Identifier, opts?: MutationOpts): Promise<OperationResult>;
2275
2315
  protected scopedCollectionPath(parentId: Identifier): string;
2276
2316
  protected scopedItemPath(parentId: Identifier, id: Identifier): string;
2277
2317
  /** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
@@ -2280,15 +2320,15 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2280
2320
  * Swagger documents put+patch on the scoped collection and has NO put/patch on
2281
2321
  * the item path anywhere in the spec; the node strips the id from the path and
2282
2322
  * PATCHes the collection, and the vendor keys the record by the id in the body. */
2283
- protected updateScopedRaw(parentId: Identifier, id: Identifier, data: TUpdate): Promise<OperationResult>;
2323
+ protected updateScopedRaw(parentId: Identifier, id: Identifier, data: TUpdate, opts?: MutationOpts): Promise<OperationResult>;
2284
2324
  /** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
2285
2325
  * (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
2286
- protected deleteScopedRaw(parentId: Identifier, id: Identifier): Promise<OperationResult>;
2326
+ protected deleteScopedRaw(parentId: Identifier, id: Identifier, opts?: MutationOpts): Promise<OperationResult>;
2287
2327
  /**
2288
2328
  * Attachment delete: the vendor returns the deleted attachment MODEL, not
2289
2329
  * OperationResultModel (G1 envelope.md) — pass it through typed.
2290
2330
  */
2291
- protected deleteScopedModel(parentId: Identifier, id: Identifier): Promise<T>;
2331
+ protected deleteScopedModel(parentId: Identifier, id: Identifier, opts?: MutationOpts): Promise<T>;
2292
2332
  /** `GET /V1.0/<E>/entityInformation` → `{ info }` unwrapped.
2293
2333
  * Goes through the field cache when it is present (issue #80:
2294
2334
  * default-on; `fieldCache: false` = the bit-for-bit uncached wire
@@ -3658,6 +3698,14 @@ interface MoveConfigurationItemOptions {
3658
3698
  /** The caller's snapshot of the source's lastModifiedDate; a mismatch
3659
3699
  * throws STALE_OBJECT before the mutation. */
3660
3700
  lastModifiedDate?: string;
3701
+ /**
3702
+ * Issue #105: the per-call retry budget — overrides the client's
3703
+ * `maxRetries` for every request the operation issues (the two
3704
+ * pre-reads, the copy POST, the deactivate PUT). `0` = exactly one send
3705
+ * per request, no auto-retry; omitted = the client's configured
3706
+ * `maxRetries`.
3707
+ */
3708
+ maxRetries?: number;
3661
3709
  }
3662
3710
  interface MoveConfigurationItemResult {
3663
3711
  sourceId: Identifier;
@@ -6763,6 +6811,12 @@ declare class ResourceSkillsResource extends BaseResource<ResourceSkill, Resourc
6763
6811
  interface TransferOwnershipOptions {
6764
6812
  /** Default `true`: list the changes, issue no update. */
6765
6813
  dryRun?: boolean;
6814
+ /**
6815
+ * Issue #105: the per-call retry budget for the per-company PUTs. `0` =
6816
+ * exactly one send per company, no auto-retry; omitted = the client's
6817
+ * configured `maxRetries`.
6818
+ */
6819
+ maxRetries?: number;
6766
6820
  }
6767
6821
  interface OwnershipChange {
6768
6822
  /** The company id being re-owned. */
@@ -823,7 +823,9 @@ interface AutotaskConfig {
823
823
  pageSize?: number;
824
824
  /** HTTP timeout in ms (whole-call budget). Default 30_000. */
825
825
  timeoutMs?: number;
826
- /** Retry budget for idempotent requests on 429/5xx. Default 3 (0 disables). */
826
+ /**
827
+ * The client's retry budget (default 3; 0 disables auto-retry). Three legs, two rules (issues #105/#109): the 429 leg retries on the pre-#105 retriable set (GET/PUT/DELETE + idempotent-flagged calls); the 5xx/network leg and the non-JSON-2xx (#24) leg retry GET + idempotent-flagged calls only. A per-call override rides `InvokeOptions.maxRetries` / `MutationOpts.maxRetries`.
828
+ */
827
829
  maxRetries?: number;
828
830
  /** Optional request log sink. Default: no-op. */
829
831
  logger?: Logger;
@@ -1194,10 +1196,13 @@ interface RequestOptions {
1194
1196
  /** Per-request timeout override (default: config.timeoutMs). */
1195
1197
  timeoutMs?: number;
1196
1198
  /**
1197
- * INTERNAL (SDK-only, never a caller surface): per-request retry-budget
1198
- * override (default: config.maxRetries). Used by the doctor preflight
1199
- * (src/doctor.ts) to report failures fast — retries off, shortened
1200
- * timeout. Does not change the transport chain order.
1199
+ * INTERNAL (SDK-only, never set by a caller on the transport directly):
1200
+ * per-request retry-budget override (default: config.maxRetries). Carries
1201
+ * the doctor preflight's fail-fast override (src/doctor.ts — retries off,
1202
+ * shortened timeout) and the caller surfaces' per-call budget
1203
+ * (InvokeOptions.maxRetries / MutationOpts.maxRetries, issue #105 — the
1204
+ * resource layer threads it here; `0` = exactly one send). Does not change
1205
+ * the transport chain order.
1201
1206
  */
1202
1207
  maxRetries?: number;
1203
1208
  /**
@@ -1212,7 +1217,15 @@ interface RequestOptions {
1212
1217
  expectBody?: boolean;
1213
1218
  /** Caller abort signal, combined with the deadline; aborting throws `AutotaskAbortError` (never retried). */
1214
1219
  signal?: AbortSignal;
1215
- /** Safe to retry on 429/5xx even though it is not GET/PUT/DELETE (e.g. the `/query` POST reads). Default: by method. */
1220
+ /**
1221
+ * Safe to retry even though the method is not GET (e.g. the `/query` POST
1222
+ * reads; or a mutation whose payload is idempotent by construction — the
1223
+ * issue #105 opt-back into the pre-#105 auto-retry). Default: by method —
1224
+ * the 429 leg retries GET/PUT/DELETE (the pre-#105 rule, unchanged); the
1225
+ * 5xx/network leg retries GET only (issue #105 — an unflagged mutation
1226
+ * makes exactly one send there; a 429 on an unflagged POST/PATCH still
1227
+ * surfaces at once, as before #105).
1228
+ */
1216
1229
  idempotent?: boolean;
1217
1230
  /**
1218
1231
  * INTERNAL (SDK-only, never a caller surface): skip the INV-A1 response
@@ -1242,7 +1255,15 @@ interface RequestOptions {
1242
1255
  */
1243
1256
  bypassCircuitBreaker?: boolean;
1244
1257
  }
1245
- /** Idempotent methods the transport may retry (POST/PATCH are never retried). */
1258
+ /**
1259
+ * The legacy retriable method set (kept exported for the public-surface
1260
+ * baseline): pre-#105 the transport auto-retried exactly these on 429/5xx,
1261
+ * and #105 keeps this set as the 429 leg's rule (a 429 is a pre-processing
1262
+ * refusal — the vendor never executed the call). Since issue #105 the
1263
+ * 5xx/network leg is narrower — GET + explicitly idempotent-flagged calls;
1264
+ * a mutation opts back into the pre-#105 auto-retry on both legs with
1265
+ * `idempotent: true`.
1266
+ */
1246
1267
  declare const IDEMPOTENT_METHODS: readonly string[];
1247
1268
  /**
1248
1269
  * Build the absolute request URL (base + path + query). Issue #54: the path
@@ -1884,6 +1905,21 @@ interface MutationOpts {
1884
1905
  * switch off).
1885
1906
  */
1886
1907
  raw?: boolean;
1908
+ /**
1909
+ * Issue #105: the per-call retry budget — it overrides the client's
1910
+ * `maxRetries` for every request this mutation issues (its send and its
1911
+ * auxiliary reads, e.g. the partial-update merge read). `0` = exactly one
1912
+ * send per request, no auto-retry; omitted = the client's configured
1913
+ * `maxRetries`. (Since #105 a mutation never auto-retries a 5xx or network
1914
+ * error by default — the write-outcome is unknown once the body was
1915
+ * written; a 429 is still retried per `Retry-After` on the pre-#105
1916
+ * retriable set, GET/PUT/DELETE + flagged calls. The optional stale-object
1917
+ * guard's verification read keeps the client budget. Compound ops
1918
+ * (`time_entries.createForResource`, `companies.upsertByName`) apply the
1919
+ * override to the op's mutation send only — their pre-wire resolution
1920
+ * reads keep the client budget.)
1921
+ */
1922
+ maxRetries?: number;
1887
1923
  }
1888
1924
  /**
1889
1925
  * Issue #13: the create-path response-shape-drift recovery options
@@ -2168,7 +2204,9 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2168
2204
  * see the live record, and an unredacted body must not enter the
2169
2205
  * (redacted-view) read cache.
2170
2206
  */
2171
- protected getGlobalUnredacted(id: Identifier): Promise<T>;
2207
+ protected getGlobalUnredacted(id: Identifier, readOpts?: {
2208
+ maxRetries?: number;
2209
+ }): Promise<T>;
2172
2210
  /**
2173
2211
  * Issue #34 fallback merge read: a FRESH parent-scoped single-record GET
2174
2212
  * that skips response redaction and is never cached (the same invariants
@@ -2177,7 +2215,9 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2177
2215
  * record's own current values: a redacted read would write literal
2178
2216
  * '[REDACTED]' markers into the fallback PUT (corruption on live records).
2179
2217
  */
2180
- protected getScopedUnredacted(parentId: Identifier, id: Identifier): Promise<T>;
2218
+ protected getScopedUnredacted(parentId: Identifier, id: Identifier, readOpts?: {
2219
+ maxRetries?: number;
2220
+ }): Promise<T>;
2181
2221
  /** Parent-scoped `GET .../{parentId}/<Child>/{id}` → `{ item }` unwrapped. */
2182
2222
  protected getScopedRaw(parentId: Identifier, id: Identifier, fresh?: boolean): Promise<T>;
2183
2223
  /**
@@ -2271,7 +2311,7 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2271
2311
  * (204 / empty body) is a valid vendor delete answer — synthesize the
2272
2312
  * result from the path id (issue #25: the transport returns undefined
2273
2313
  * for it; a non-blank wrong shape still throws via unwrapOperation). */
2274
- protected deleteGlobal(id: Identifier): Promise<OperationResult>;
2314
+ protected deleteGlobal(id: Identifier, opts?: MutationOpts): Promise<OperationResult>;
2275
2315
  protected scopedCollectionPath(parentId: Identifier): string;
2276
2316
  protected scopedItemPath(parentId: Identifier, id: Identifier): string;
2277
2317
  /** Parent-scoped create: `POST .../{parentId}/<Child>` (issue #13: a drifted 2xx runs the bounded marker recovery where the plan pins a marker field). */
@@ -2280,15 +2320,15 @@ declare abstract class BaseResource<T = Record<string, unknown>, TCreate = Recor
2280
2320
  * Swagger documents put+patch on the scoped collection and has NO put/patch on
2281
2321
  * the item path anywhere in the spec; the node strips the id from the path and
2282
2322
  * PATCHes the collection, and the vendor keys the record by the id in the body. */
2283
- protected updateScopedRaw(parentId: Identifier, id: Identifier, data: TUpdate): Promise<OperationResult>;
2323
+ protected updateScopedRaw(parentId: Identifier, id: Identifier, data: TUpdate, opts?: MutationOpts): Promise<OperationResult>;
2284
2324
  /** Parent-scoped delete: `DELETE .../{parentId}/<Child>/{id}` → `{ id }`
2285
2325
  * (a blank 2xx synthesizes `{ id }` from the path id — issue #25). */
2286
- protected deleteScopedRaw(parentId: Identifier, id: Identifier): Promise<OperationResult>;
2326
+ protected deleteScopedRaw(parentId: Identifier, id: Identifier, opts?: MutationOpts): Promise<OperationResult>;
2287
2327
  /**
2288
2328
  * Attachment delete: the vendor returns the deleted attachment MODEL, not
2289
2329
  * OperationResultModel (G1 envelope.md) — pass it through typed.
2290
2330
  */
2291
- protected deleteScopedModel(parentId: Identifier, id: Identifier): Promise<T>;
2331
+ protected deleteScopedModel(parentId: Identifier, id: Identifier, opts?: MutationOpts): Promise<T>;
2292
2332
  /** `GET /V1.0/<E>/entityInformation` → `{ info }` unwrapped.
2293
2333
  * Goes through the field cache when it is present (issue #80:
2294
2334
  * default-on; `fieldCache: false` = the bit-for-bit uncached wire
@@ -3658,6 +3698,14 @@ interface MoveConfigurationItemOptions {
3658
3698
  /** The caller's snapshot of the source's lastModifiedDate; a mismatch
3659
3699
  * throws STALE_OBJECT before the mutation. */
3660
3700
  lastModifiedDate?: string;
3701
+ /**
3702
+ * Issue #105: the per-call retry budget — overrides the client's
3703
+ * `maxRetries` for every request the operation issues (the two
3704
+ * pre-reads, the copy POST, the deactivate PUT). `0` = exactly one send
3705
+ * per request, no auto-retry; omitted = the client's configured
3706
+ * `maxRetries`.
3707
+ */
3708
+ maxRetries?: number;
3661
3709
  }
3662
3710
  interface MoveConfigurationItemResult {
3663
3711
  sourceId: Identifier;
@@ -6763,6 +6811,12 @@ declare class ResourceSkillsResource extends BaseResource<ResourceSkill, Resourc
6763
6811
  interface TransferOwnershipOptions {
6764
6812
  /** Default `true`: list the changes, issue no update. */
6765
6813
  dryRun?: boolean;
6814
+ /**
6815
+ * Issue #105: the per-call retry budget for the per-company PUTs. `0` =
6816
+ * exactly one send per company, no auto-retry; omitted = the client's
6817
+ * configured `maxRetries`.
6818
+ */
6819
+ maxRetries?: number;
6766
6820
  }
6767
6821
  interface OwnershipChange {
6768
6822
  /** The company id being re-owned. */