@patchstack/connect 0.3.18 → 0.3.20

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/dist/protect.d.ts CHANGED
@@ -23,6 +23,8 @@ export interface Protection {
23
23
  node(options?: { maxBodyBytes?: number; screenResponses?: boolean }): (req: unknown, res: unknown, next: () => void) => void;
24
24
  /** Present when `egress: true` — restores the original global fetch. */
25
25
  uninstallEgress?: () => void;
26
+ /** Present when `refreshMs > 0` — stops the live rule-refresh interval. */
27
+ stopRefresh?: () => void;
26
28
  }
27
29
 
28
30
  export interface CreateProtectionOptions {
@@ -37,6 +39,22 @@ export interface CreateProtectionOptions {
37
39
  siteUuid?: string;
38
40
  /** Override the Pulse rules API base URL. */
39
41
  pulseRulesUrl?: string;
42
+ /**
43
+ * Re-fetch and hot-swap the live rules every N ms. For long-lived runtimes that aren't restarted
44
+ * on change (an AI builder's sandbox/preview) so a rule that becomes relevant after boot still
45
+ * applies. Default 0 (off) — a real deploy restarts the process, which re-fetches anyway. Only
46
+ * meaningful with a live source (`siteUuid`/`token`).
47
+ */
48
+ refreshMs?: number;
49
+ /**
50
+ * During a refresh, also re-post the dependency manifest (the runtime counterpart to `scan`) so a
51
+ * dependency added after boot — e.g. via `npm install <pkg>`, which fires no npm lifecycle hook —
52
+ * is reported and enforced without a restart. Defaults on when a `siteUuid` is set; set false to
53
+ * refresh rules only. Only meaningful with `refreshMs > 0` and a Pulse `siteUuid`.
54
+ */
55
+ reportManifest?: boolean;
56
+ /** Directory the manifest re-scan reads the lockfile from during a refresh. Default process.cwd(). */
57
+ cwd?: string;
40
58
  /** Directory for the last-known-good rule cache (disk — the default cache backend). */
41
59
  cacheDir?: string;
42
60
  /**
@@ -55,6 +73,12 @@ export interface CreateProtectionOptions {
55
73
  egress?: boolean;
56
74
  /** Hosts exempt from egress screening. */
57
75
  allowHosts?: string[];
76
+ /**
77
+ * Screen the Node http/https path against DNS rebinding: resolve outbound hostnames and block +
78
+ * pin to the vetted address when they map to a disallowed (internal/metadata) IP. Default true;
79
+ * only active when `egress` is on and node:dns is available (a no-op on edge runtimes).
80
+ */
81
+ screenDns?: boolean;
58
82
  /** Redaction mask (string or per-category function). Default "[REDACTED]". */
59
83
  maskWith?: string | ((category?: string) => string);
60
84
  onError?: (err: unknown) => void;