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
  import {
2
2
  CAPABILITIES
3
- } from "./chunk-OZD5FQM4.js";
3
+ } from "./chunk-JIDR3NPV.js";
4
4
 
5
5
  // src/auth.ts
6
6
  var AUTH_HEADERS = {
@@ -15188,6 +15188,7 @@ var HttpClient = class {
15188
15188
  );
15189
15189
  const auditBody = opts.body !== void 0 ? redactAuditBody(opts.body) : void 0;
15190
15190
  const retriable = opts.idempotent ?? IDEMPOTENT_METHODS.includes(method);
15191
+ const retriable5xx = opts.idempotent ?? method === "GET";
15191
15192
  const expectBody = opts.expectBody ?? method !== "DELETE";
15192
15193
  const ctx = { operation: opts.operation, url, correlationId };
15193
15194
  let lastStatus;
@@ -15313,7 +15314,7 @@ var HttpClient = 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
  this.logger.warn?.(
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 = 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 = 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 = 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)) {
@@ -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: readOpts?.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: readOpts?.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)) {