@zharp/node 0.1.0 → 0.2.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/dist/index.d.mts CHANGED
@@ -26,6 +26,26 @@ interface ZharpUser {
26
26
  /** Sent as `enduser.name`. */
27
27
  name?: string;
28
28
  }
29
+ /** `captureBodies`: which request and response bodies go on HTTP spans. */
30
+ interface CaptureBodiesOptions {
31
+ /** `errors` (default): failed requests only (status 400 and above). `all`: every request. */
32
+ mode?: 'errors' | 'all';
33
+ /** Characters kept per body. Default 32768 (32 KB), at most 131072 (128 KB). */
34
+ maxSize?: number;
35
+ /**
36
+ * More keys whose values are replaced with `[Filtered]`, on top of the built-in ones. A string
37
+ * matches a key ignoring case, `-` and `_`; a RegExp is tested against the key as it is.
38
+ */
39
+ redactKeys?: Array<string | RegExp>;
40
+ /**
41
+ * Which requests (incoming and outgoing) have their bodies captured: a bare host matches that
42
+ * host, a string with a scheme matches URLs starting with it, a RegExp is tested against the
43
+ * full URL. Default: all of them.
44
+ */
45
+ urls?: Array<string | RegExp>;
46
+ }
47
+ /** `true` is `'errors'`. */
48
+ type CaptureBodies = boolean | 'errors' | 'all' | CaptureBodiesOptions;
29
49
  interface NodeOptions {
30
50
  /**
31
51
  * The app's key from the Zharp dashboard (`zpk_…`), or a workspace API key with the ingest
@@ -60,6 +80,20 @@ interface NodeOptions {
60
80
  * whatever this says.
61
81
  */
62
82
  captureConsole?: boolean;
83
+ /**
84
+ * Request and response bodies on HTTP spans — incoming requests and outgoing http/https
85
+ * calls. Default **off**. `'errors'` (or `true`) keeps them for failed requests only (status
86
+ * 400 and above); `'all'` for every request. Falls back to `ZHARP_CAPTURE_BODIES`
87
+ * (`errors` or `all`). Text is capped at 32 KB; files in uploads, inline images and binary
88
+ * bodies are described (name, type, size), never sent. Field names are always kept; values
89
+ * under secret-looking keys (`password`, `token`, `authorization`, `card`, …) are replaced
90
+ * with `[Filtered]` before anything is sent. Other personal data in a body is sent as it is:
91
+ * add its keys to `redactKeys`.
92
+ *
93
+ * captureBodies: 'errors'
94
+ * captureBodies: { mode: 'all', redactKeys: ['dateOfBirth'], urls: [/\/api\//] }
95
+ */
96
+ captureBodies?: CaptureBodies;
63
97
  /**
64
98
  * Capture uncaught exceptions and unhandled rejections. Default true. The process still
65
99
  * exits as Node would have, once they have been sent.
@@ -150,8 +184,8 @@ declare class ZharpNode {
150
184
  }
151
185
 
152
186
  /** Sent as `telemetry.sdk.version`. Bumped with package.json. */
153
- declare const VERSION = "0.1.0";
187
+ declare const VERSION = "0.2.0";
154
188
 
155
189
  declare const Zharp: ZharpNode;
156
190
 
157
- export { type AttributeValue, type Attributes, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };
191
+ export { type AttributeValue, type Attributes, type CaptureBodies, type CaptureBodiesOptions, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };
package/dist/index.d.ts CHANGED
@@ -26,6 +26,26 @@ interface ZharpUser {
26
26
  /** Sent as `enduser.name`. */
27
27
  name?: string;
28
28
  }
29
+ /** `captureBodies`: which request and response bodies go on HTTP spans. */
30
+ interface CaptureBodiesOptions {
31
+ /** `errors` (default): failed requests only (status 400 and above). `all`: every request. */
32
+ mode?: 'errors' | 'all';
33
+ /** Characters kept per body. Default 32768 (32 KB), at most 131072 (128 KB). */
34
+ maxSize?: number;
35
+ /**
36
+ * More keys whose values are replaced with `[Filtered]`, on top of the built-in ones. A string
37
+ * matches a key ignoring case, `-` and `_`; a RegExp is tested against the key as it is.
38
+ */
39
+ redactKeys?: Array<string | RegExp>;
40
+ /**
41
+ * Which requests (incoming and outgoing) have their bodies captured: a bare host matches that
42
+ * host, a string with a scheme matches URLs starting with it, a RegExp is tested against the
43
+ * full URL. Default: all of them.
44
+ */
45
+ urls?: Array<string | RegExp>;
46
+ }
47
+ /** `true` is `'errors'`. */
48
+ type CaptureBodies = boolean | 'errors' | 'all' | CaptureBodiesOptions;
29
49
  interface NodeOptions {
30
50
  /**
31
51
  * The app's key from the Zharp dashboard (`zpk_…`), or a workspace API key with the ingest
@@ -60,6 +80,20 @@ interface NodeOptions {
60
80
  * whatever this says.
61
81
  */
62
82
  captureConsole?: boolean;
83
+ /**
84
+ * Request and response bodies on HTTP spans — incoming requests and outgoing http/https
85
+ * calls. Default **off**. `'errors'` (or `true`) keeps them for failed requests only (status
86
+ * 400 and above); `'all'` for every request. Falls back to `ZHARP_CAPTURE_BODIES`
87
+ * (`errors` or `all`). Text is capped at 32 KB; files in uploads, inline images and binary
88
+ * bodies are described (name, type, size), never sent. Field names are always kept; values
89
+ * under secret-looking keys (`password`, `token`, `authorization`, `card`, …) are replaced
90
+ * with `[Filtered]` before anything is sent. Other personal data in a body is sent as it is:
91
+ * add its keys to `redactKeys`.
92
+ *
93
+ * captureBodies: 'errors'
94
+ * captureBodies: { mode: 'all', redactKeys: ['dateOfBirth'], urls: [/\/api\//] }
95
+ */
96
+ captureBodies?: CaptureBodies;
63
97
  /**
64
98
  * Capture uncaught exceptions and unhandled rejections. Default true. The process still
65
99
  * exits as Node would have, once they have been sent.
@@ -150,8 +184,8 @@ declare class ZharpNode {
150
184
  }
151
185
 
152
186
  /** Sent as `telemetry.sdk.version`. Bumped with package.json. */
153
- declare const VERSION = "0.1.0";
187
+ declare const VERSION = "0.2.0";
154
188
 
155
189
  declare const Zharp: ZharpNode;
156
190
 
157
- export { type AttributeValue, type Attributes, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };
191
+ export { type AttributeValue, type Attributes, type CaptureBodies, type CaptureBodiesOptions, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };