@fixback/node 0.5.1 → 0.6.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/README.md +33 -8
- package/dist/client.js +6 -3
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +27 -13
- package/dist/config.js +10 -2
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +15 -6
- package/dist/context.js +28 -5
- package/dist/context.js.map +1 -1
- package/dist/express.d.ts +4 -1
- package/dist/express.js.map +1 -1
- package/dist/host-identity.d.ts +9 -6
- package/dist/host-identity.js +6 -5
- package/dist/host-identity.js.map +1 -1
- package/dist/http.d.ts +3 -3
- package/dist/http.js +1 -1
- package/dist/transport.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wire.d.ts +18 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,9 +4,10 @@ The Fixback **backend error SDK** for Node servers. Capture unhandled crashes an
|
|
|
4
4
|
manually-reported errors and file them into the same Fixback pipeline your frontend
|
|
5
5
|
uses — one queue for your whole product (ADR-0061/0062/0028, spec #224).
|
|
6
6
|
|
|
7
|
-
Backend errors authenticate with
|
|
8
|
-
|
|
9
|
-
single Issue with a rising occurrence count
|
|
7
|
+
Backend errors authenticate with a **secret key**, so they arrive **Internal** tier,
|
|
8
|
+
tagged `platform: node`, and filed under the environment that key belongs to.
|
|
9
|
+
Fleet-wide crash-loops collapse into a single Issue with a rising occurrence count
|
|
10
|
+
instead of flooding your queue.
|
|
10
11
|
|
|
11
12
|
> 📖 **Full documentation: [fixback-docs.dev.wemuda.com/sdk/node](https://fixback-docs.dev.wemuda.com/sdk/node)** — guides, concepts, and the complete API reference.
|
|
12
13
|
|
|
@@ -29,15 +30,24 @@ import { init } from "@fixback/node";
|
|
|
29
30
|
|
|
30
31
|
init({
|
|
31
32
|
secretKey: process.env.FIXBACK_SECRET_KEY!, // sk_… (never your publishable key)
|
|
32
|
-
environment: process.env.NODE_ENV, // "production" | "staging" | …
|
|
33
33
|
release: process.env.GIT_SHA, // symbolicated against your uploaded sourcemaps
|
|
34
34
|
enabled: process.env.NODE_ENV === "production", // gate auto-capture off in local dev
|
|
35
35
|
});
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
The secret key selects the environment. Each environment in the Fixback dashboard —
|
|
39
|
+
*Production*, *Staging*, … — has its own keys (and its own Gate), and every error is
|
|
40
|
+
filed under the environment of the secret key that sent it. So each deploy sets
|
|
41
|
+
`FIXBACK_SECRET_KEY` to its own environment's secret key, and there is no
|
|
42
|
+
`environment` option to keep in step with it — one passed to `init` is ignored, with
|
|
43
|
+
a one-time warning. A new deploy target starts in the dashboard: create its
|
|
44
|
+
environment and deploy that environment's key.
|
|
45
|
+
|
|
38
46
|
That single call wires:
|
|
39
47
|
|
|
40
|
-
- a **batched** secret-key transport that backs off on `429` (honouring `Retry-After`)
|
|
48
|
+
- a **batched** secret-key transport that backs off on `429` (honouring `Retry-After`) —
|
|
49
|
+
each error carries the instant it was captured (`occurredAt`), so a batch flushed
|
|
50
|
+
later still records when every error happened;
|
|
41
51
|
- process-level `uncaughtException` / `unhandledRejection` capture that **never changes
|
|
42
52
|
your process's exit behaviour** — `autoCapture: false` turns both off (or
|
|
43
53
|
`captureUncaughtException` / `captureUnhandledRejection` individually);
|
|
@@ -100,13 +110,28 @@ import { setUser } from "@fixback/node";
|
|
|
100
110
|
setUser(currentUser.id); // an opaque ref you choose — not a name/email unless you send one
|
|
101
111
|
```
|
|
102
112
|
|
|
113
|
+
### The Correlation id
|
|
114
|
+
|
|
115
|
+
The request-context middleware gives every request one id, from the first source that
|
|
116
|
+
has it: the trace id of an inbound W3C **`traceparent`** header, then `x-request-id` (or
|
|
117
|
+
your `requestIdHeader`), else a freshly minted one. A malformed `traceparent` is ignored,
|
|
118
|
+
never partly used. Errors captured during the request carry the id, so when the page runs
|
|
119
|
+
the Fixback browser SDK — which sends `traceparent` on its same-origin requests and to the
|
|
120
|
+
origins you list in its `propagateTo` — the browser Issue for a failed request and this
|
|
121
|
+
server's Issue show the same id. The browser SDK sends the sampled flag (`01`), so a
|
|
122
|
+
parent-based OpenTelemetry sampler on this server records those requests rather than
|
|
123
|
+
dropping them.
|
|
124
|
+
|
|
103
125
|
## Privacy
|
|
104
126
|
|
|
105
127
|
Private-by-default. The SDK captures the route **pattern** (never the concrete path
|
|
106
128
|
with values), method, status, a correlation id, and the app-supplied user ref only. It
|
|
107
|
-
**never** sends
|
|
108
|
-
|
|
109
|
-
|
|
129
|
+
**never** sends `Authorization`/`Cookie` headers, environment variables, or
|
|
130
|
+
query-string values. Request/response bodies are an explicit opt-in, **off by default**:
|
|
131
|
+
with `captureBodies: true` the failing request's bodies ride on its server context —
|
|
132
|
+
serialized, PII-redacted at the scrub choke point, and dropped (never truncated) when
|
|
133
|
+
larger than `maxBodyBytes` (16384 by default, at most 65536). A `beforeSend(event)` hook
|
|
134
|
+
lets you redact further or drop an event entirely (return `null`).
|
|
110
135
|
|
|
111
136
|
## Fails quiet
|
|
112
137
|
|
package/dist/client.js
CHANGED
|
@@ -115,8 +115,10 @@ class FixbackClient {
|
|
|
115
115
|
value: partial.value,
|
|
116
116
|
handled: partial.handled,
|
|
117
117
|
level: partial.level,
|
|
118
|
-
environment: this.config.environment,
|
|
119
118
|
release: this.config.release,
|
|
119
|
+
// The capture instant (#539): taken here, synchronously with the capture, so a
|
|
120
|
+
// batch flushed seconds later still says when the error really happened.
|
|
121
|
+
occurredAt: Date.now(),
|
|
120
122
|
errorFrames: partial.errorFrames,
|
|
121
123
|
server: mergeServerContext((0, context_1.currentServerContext)(), context.server),
|
|
122
124
|
};
|
|
@@ -192,12 +194,13 @@ function toPayload(event) {
|
|
|
192
194
|
payload.errorMessage = event.value;
|
|
193
195
|
if (event.handled !== undefined)
|
|
194
196
|
payload.handled = event.handled;
|
|
195
|
-
if (event.environment !== undefined)
|
|
196
|
-
payload.environment = event.environment;
|
|
197
197
|
if (event.release !== undefined)
|
|
198
198
|
payload.release = event.release;
|
|
199
199
|
if (event.occurrences !== undefined)
|
|
200
200
|
payload.occurrences = event.occurrences;
|
|
201
|
+
if (typeof event.occurredAt === "number" && Number.isFinite(event.occurredAt)) {
|
|
202
|
+
payload.occurredAt = event.occurredAt;
|
|
203
|
+
}
|
|
201
204
|
if (event.errorFrames && event.errorFrames.length > 0)
|
|
202
205
|
payload.errorFrames = event.errorFrames;
|
|
203
206
|
if (event.server)
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAsPH,oBAqBC;AAGD,8BAEC;AAGD,4CAEC;AAGD,wCAEC;AAGD,sBAEC;AAGD,sBAOC;AAvSD,gDAAqG;AAErG,qCAAgF;AAChF,uCAAiD;AACjD,uCAAqE;AACrE,mCAAuC;AACvC,2CAA+D;AA+B/D,wFAAwF;AACxF,SAAS,kBAAkB,CACzB,IAA+B,EAC/B,QAAmC;IAEnC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IACzC,MAAM,MAAM,GAA4B,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,EAAE,CAAC;IACjF,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAE,MAAwB,CAAC,CAAC,CAAC,SAA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AwB,IAAI,MAAM,CAAC,yBAAyB,CAAC;YACrF,CAAC,CAAC,IAAA,gCAAsB,EACpB,MAAM,EACN;gBACE,wBAAwB,EAAE,MAAM,CAAC,wBAAwB;gBACzD,yBAAyB,EAAE,MAAM,CAAC,yBAAyB;aAC5D,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,CAC7D;YACH,CAAC,CAAC,IAAI,CAAC;IACX,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gFAAgF;AAChF,SAAgB,SAAS;IACvB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,oFAAoF;AACpF,SAAgB,gBAAgB,CAAC,KAAc,EAAE,OAAwB;IACvE,YAAY,EAAE,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED,wEAAwE;AACxE,SAAgB,cAAc,CAAC,OAAe,EAAE,KAAgB,EAAE,OAAwB;IACxF,YAAY,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC;AAED,8DAA8D;AAC9D,SAAgB,KAAK;IACnB,OAAO,YAAY,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC;AAED,8FAA8F;AAC9F,SAAgB,KAAK;IACnB,MAAM,OAAO,GAAG,YAAY,CAAC;IAC7B,MAAM,SAAS,GAAG,eAAe,CAAC;IAClC,YAAY,GAAG,IAAI,CAAC;IACpB,eAAe,GAAG,IAAI,CAAC;IACvB,IAAI,SAAS;QAAE,SAAS,EAAE,CAAC;IAC3B,OAAO,OAAO,EAAE,KAAK,EAAE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
* secret key or an explicit `enabled: false` leaves the SDK inert (`enabled: false`)
|
|
6
6
|
* rather than raising — a Fixback misconfiguration must never break the host server.
|
|
7
7
|
* Numeric knobs are clamped to safe bounds (the batch to the server's 500-item cap)
|
|
8
|
-
* instead of rejected.
|
|
8
|
+
* instead of rejected. The one option that no longer exists — `environment` — is
|
|
9
|
+
* ignored with a single warning rather than silently.
|
|
9
10
|
*/
|
|
10
11
|
import { type CommonInitOptions, DEFAULT_API_URL } from "@fixback/sdk-core";
|
|
11
12
|
import type { BeforeSend, FixbackErrorEvent } from "./wire";
|
|
@@ -13,19 +14,24 @@ export { DEFAULT_API_URL };
|
|
|
13
14
|
/**
|
|
14
15
|
* Options for {@link init} — the one call that wires backend capture.
|
|
15
16
|
*
|
|
16
|
-
* The shared half (`apiUrl`, `release`, `
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
17
|
+
* The shared half (`apiUrl`, `release`, `enabled`, `scrub`, `beforeSend`) comes from
|
|
18
|
+
* `CommonInitOptions` so it means the same here as in the browser and Expo SDKs
|
|
19
|
+
* (ADR-0028); `beforeSend` is bound to this SDK's {@link FixbackErrorEvent}. The two
|
|
20
|
+
* capture-SDK trace options are omitted rather than inherited: a backend has no
|
|
21
|
+
* breadcrumb buffer and no console/network streams, so `beforeBreadcrumb` and
|
|
22
|
+
* `capture` would be dead names here. {@link autoCapture} is the backend's
|
|
23
|
+
* equivalent umbrella.
|
|
24
|
+
*
|
|
25
|
+
* There is no `environment`: the {@link secretKey} belongs to one Environment, and
|
|
26
|
+
* every error it sends lands in that Environment (ADR 2026-09-24) — so a deploy sets
|
|
27
|
+
* one variable, its own Environment's secret key.
|
|
23
28
|
*/
|
|
24
29
|
export interface InitOptions extends Omit<CommonInitOptions<FixbackErrorEvent>, "beforeBreadcrumb" | "capture"> {
|
|
25
30
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
28
|
-
* the
|
|
31
|
+
* The **secret key** (`sk_…`) the backend authenticates with — one of the keys of
|
|
32
|
+
* the Environment this deploy files into, and the same kind of key
|
|
33
|
+
* `npx fixback sourcemaps upload` uses (never the publishable key). Without it the
|
|
34
|
+
* SDK stays inert.
|
|
29
35
|
*/
|
|
30
36
|
readonly secretKey: string;
|
|
31
37
|
/**
|
|
@@ -48,7 +54,11 @@ export interface InitOptions extends Omit<CommonInitOptions<FixbackErrorEvent>,
|
|
|
48
54
|
readonly maxQueueSize?: number;
|
|
49
55
|
/** Overall per-request transport timeout in ms; `0` disables. Defaults to `30000`. */
|
|
50
56
|
readonly timeoutMs?: number;
|
|
51
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* The header a correlation id is read from when a request carries no well-formed W3C
|
|
59
|
+
* `traceparent` (which always wins — its trace id is the Correlation id a Fixback
|
|
60
|
+
* capture SDK stamped on the page's network entry). Defaults to `x-request-id`.
|
|
61
|
+
*/
|
|
52
62
|
readonly requestIdHeader?: string;
|
|
53
63
|
/**
|
|
54
64
|
* Capture the failing request's **request and response bodies** onto the error's
|
|
@@ -73,7 +83,6 @@ export interface ResolvedConfig {
|
|
|
73
83
|
readonly secretKey: string;
|
|
74
84
|
readonly apiUrl: string;
|
|
75
85
|
readonly errorsEndpoint: string;
|
|
76
|
-
readonly environment?: string;
|
|
77
86
|
readonly release?: string;
|
|
78
87
|
readonly beforeSend?: BeforeSend;
|
|
79
88
|
readonly scrub: boolean;
|
|
@@ -91,5 +100,10 @@ export interface ResolvedConfig {
|
|
|
91
100
|
* Resolve raw {@link InitOptions} into a validated {@link ResolvedConfig}. Never
|
|
92
101
|
* throws: without a usable secret key (or with `enabled: false`) the result is
|
|
93
102
|
* inert (`enabled: false`), so an inert client can no-op every capture.
|
|
103
|
+
*
|
|
104
|
+
* A caller still passing the removed `environment` (a plain-JS caller gets no type
|
|
105
|
+
* error) is told once, here — whether or not the SDK is enabled, since local dev is
|
|
106
|
+
* where it is read — and the value goes nowhere: the secret key's Environment is the
|
|
107
|
+
* only one an error can land in.
|
|
94
108
|
*/
|
|
95
109
|
export declare function resolveConfig(options: InitOptions): ResolvedConfig;
|
package/dist/config.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* secret key or an explicit `enabled: false` leaves the SDK inert (`enabled: false`)
|
|
7
7
|
* rather than raising — a Fixback misconfiguration must never break the host server.
|
|
8
8
|
* Numeric knobs are clamped to safe bounds (the batch to the server's 500-item cap)
|
|
9
|
-
* instead of rejected.
|
|
9
|
+
* instead of rejected. The one option that no longer exists — `environment` — is
|
|
10
|
+
* ignored with a single warning rather than silently.
|
|
10
11
|
*/
|
|
11
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
13
|
exports.DEFAULT_API_URL = void 0;
|
|
@@ -50,8 +51,16 @@ function clampInt(value, fallback, min, max) {
|
|
|
50
51
|
* Resolve raw {@link InitOptions} into a validated {@link ResolvedConfig}. Never
|
|
51
52
|
* throws: without a usable secret key (or with `enabled: false`) the result is
|
|
52
53
|
* inert (`enabled: false`), so an inert client can no-op every capture.
|
|
54
|
+
*
|
|
55
|
+
* A caller still passing the removed `environment` (a plain-JS caller gets no type
|
|
56
|
+
* error) is told once, here — whether or not the SDK is enabled, since local dev is
|
|
57
|
+
* where it is read — and the value goes nowhere: the secret key's Environment is the
|
|
58
|
+
* only one an error can land in.
|
|
53
59
|
*/
|
|
54
60
|
function resolveConfig(options) {
|
|
61
|
+
const removedOption = (0, sdk_core_1.removedEnvironmentOptionWarning)(options);
|
|
62
|
+
if (removedOption)
|
|
63
|
+
console.warn(`[fixback] ${removedOption}`);
|
|
55
64
|
const secretKey = trimmed(options.secretKey) ?? "";
|
|
56
65
|
const apiUrl = normalizeApiUrl(options.apiUrl);
|
|
57
66
|
const enabled = options.enabled !== false && secretKey.length > 0;
|
|
@@ -61,7 +70,6 @@ function resolveConfig(options) {
|
|
|
61
70
|
secretKey,
|
|
62
71
|
apiUrl,
|
|
63
72
|
errorsEndpoint: `${apiUrl}/api/errors`,
|
|
64
|
-
environment: trimmed(options.environment),
|
|
65
73
|
release: trimmed(options.release),
|
|
66
74
|
beforeSend: typeof options.beforeSend === "function" ? options.beforeSend : undefined,
|
|
67
75
|
scrub: options.scrub !== false,
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAyJH,sCAkCC;AAzLD,gDAI2B;AAMlB,gGARP,0BAAe,OAQO;AAExB,sFAAsF;AACtF,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,MAAM,sBAAsB,GAAG,GAAG,CAAC;AACnC,MAAM,yBAAyB,GAAG,KAAK,CAAC;AACxC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,yBAAyB,GAAG,cAAc,CAAC;AAEjD,mGAAmG;AACnG,MAAM,sBAAsB,GAAG,MAAM,CAAC;AACtC,4FAA4F;AAC5F,MAAM,sBAAsB,GAAG,MAAM,CAAC;AA6FtC,mFAAmF;AACnF,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC;AAED,kEAAkE;AAClE,SAAS,eAAe,CAAC,KAAyB;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,0BAAe,CAAC;IAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,0BAAe,CAAC;AACrD,CAAC;AAED,8EAA8E;AAC9E,SAAS,aAAa,CAAC,IAAyB,EA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C,KAAK,KAAK,KAAK;QAC9B,wBAAwB,EAAE,aAAa,CAAC,OAAO,CAAC,wBAAwB,EAAE,WAAW,CAAC;QACtF,yBAAyB,EAAE,aAAa,CAAC,OAAO,CAAC,yBAAyB,EAAE,WAAW,CAAC;QACxF,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,sBAAsB,EAAE,CAAC,EAAE,gBAAgB,CAAC;QACzF,eAAe,EAAE,QAAQ,CACvB,OAAO,CAAC,eAAe,EACvB,yBAAyB,EACzB,CAAC,EACD,MAAM,CAAC,gBAAgB,CACxB;QACD,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,sBAAsB,EAAE,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;QAChG,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,EAAE,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC;QACtF,eAAe,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,IAAI,yBAAyB,CAAC,CAAC,WAAW,EAAE;QAC9F,8EAA8E;QAC9E,0EAA0E;QAC1E,aAAa,EAAE,OAAO,CAAC,aAAa,KAAK,IAAI;QAC7C,YAAY,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,sBAAsB,EAAE,CAAC,EAAE,sBAAsB,CAAC;KAChG,CAAC;AACJ,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -15,7 +15,11 @@ import type { ServerContext } from "./wire";
|
|
|
15
15
|
export interface RequestStore {
|
|
16
16
|
readonly req: HttpRequestLike;
|
|
17
17
|
readonly res?: HttpResponseLike;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* The request's **Correlation id** — the page's `traceparent` trace id when the
|
|
20
|
+
* request carried a well-formed one, else the configured request-id header, else
|
|
21
|
+
* generated ({@link resolveRequestId}).
|
|
22
|
+
*/
|
|
19
23
|
readonly requestId?: string;
|
|
20
24
|
/** The app-supplied user ref, written by {@link setRequestUser}. Never scraped. */
|
|
21
25
|
user?: string;
|
|
@@ -66,7 +70,10 @@ export declare function deriveServerContext(store: RequestStore | undefined): Se
|
|
|
66
70
|
export declare function currentServerContext(): ServerContext | undefined;
|
|
67
71
|
/** Options for {@link createRequestContextMiddleware}. */
|
|
68
72
|
export interface RequestContextOptions {
|
|
69
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* The header a correlation id is read from when the request carries no well-formed
|
|
75
|
+
* `traceparent` (which always wins). Defaults to `x-request-id`.
|
|
76
|
+
*/
|
|
70
77
|
readonly requestIdHeader?: string;
|
|
71
78
|
/**
|
|
72
79
|
* Record the request/response bodies onto the store (the `captureBodies` opt-in,
|
|
@@ -80,9 +87,11 @@ export interface RequestContextOptions {
|
|
|
80
87
|
}
|
|
81
88
|
/**
|
|
82
89
|
* Build the Express-style request-context middleware: it opens an ALS store for the
|
|
83
|
-
* request (adopting an inbound correlation id
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
90
|
+
* request (adopting an inbound correlation id — `traceparent` first, then the
|
|
91
|
+
* configured request-id header — or minting one, {@link resolveRequestId}) and runs
|
|
92
|
+
* the rest of the request within it. Shared by the Express adapter and the NestJS
|
|
93
|
+
* module so both frameworks get per-request correlation the same way. Under
|
|
94
|
+
* `captureBodies` it also wraps the response writers so the response body can be
|
|
95
|
+
* recorded (ADR-2026-09-16).
|
|
87
96
|
*/
|
|
88
97
|
export declare function createRequestContextMiddleware(options?: RequestContextOptions): (req: HttpRequestLike, res: HttpResponseLike, next: NextFunction) => void;
|
package/dist/context.js
CHANGED
|
@@ -20,6 +20,7 @@ exports.currentServerContext = currentServerContext;
|
|
|
20
20
|
exports.createRequestContextMiddleware = createRequestContextMiddleware;
|
|
21
21
|
const node_async_hooks_1 = require("node:async_hooks");
|
|
22
22
|
const node_crypto_1 = require("node:crypto");
|
|
23
|
+
const sdk_core_1 = require("@fixback/sdk-core");
|
|
23
24
|
const http_1 = require("./http");
|
|
24
25
|
/** The fallback body cap used when a store opts into body capture without naming one. */
|
|
25
26
|
const FALLBACK_MAX_BODY_BYTES = 16_384;
|
|
@@ -158,12 +159,34 @@ function readRequestId(req, header) {
|
|
|
158
159
|
const trimmed = value.trim();
|
|
159
160
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
160
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* The request's **Correlation id** (grill 2026-09-24 D2), from the first source that
|
|
164
|
+
* yields one:
|
|
165
|
+
*
|
|
166
|
+
* 1. the W3C **`traceparent`** a Fixback capture SDK (or any tracer) sent — its trace
|
|
167
|
+
* id is the Correlation id the page stamped on its network entry, which is what lets
|
|
168
|
+
* this server error and that request join. A malformed or repeated value is ignored
|
|
169
|
+
* whole, never partially used (`parseTraceparent`, the shared core's one definition);
|
|
170
|
+
* 2. the configured request-id header (`x-request-id` by default) — what a builder's
|
|
171
|
+
* router or logs already carry, so an app without a capture SDK keeps its ids;
|
|
172
|
+
* 3. a fresh id minted here.
|
|
173
|
+
*
|
|
174
|
+
* The only header values this reads are those two correlation carriers — never a body,
|
|
175
|
+
* an auth/cookie header, or a query value.
|
|
176
|
+
*/
|
|
177
|
+
function resolveRequestId(req, requestIdHeader) {
|
|
178
|
+
return ((0, sdk_core_1.parseTraceparent)(req.headers?.[sdk_core_1.TRACEPARENT_HEADER]) ??
|
|
179
|
+
readRequestId(req, requestIdHeader) ??
|
|
180
|
+
(0, node_crypto_1.randomUUID)());
|
|
181
|
+
}
|
|
161
182
|
/**
|
|
162
183
|
* Build the Express-style request-context middleware: it opens an ALS store for the
|
|
163
|
-
* request (adopting an inbound correlation id
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
184
|
+
* request (adopting an inbound correlation id — `traceparent` first, then the
|
|
185
|
+
* configured request-id header — or minting one, {@link resolveRequestId}) and runs
|
|
186
|
+
* the rest of the request within it. Shared by the Express adapter and the NestJS
|
|
187
|
+
* module so both frameworks get per-request correlation the same way. Under
|
|
188
|
+
* `captureBodies` it also wraps the response writers so the response body can be
|
|
189
|
+
* recorded (ADR-2026-09-16).
|
|
167
190
|
*/
|
|
168
191
|
function createRequestContextMiddleware(options = {}) {
|
|
169
192
|
const header = (options.requestIdHeader ?? "x-request-id").toLowerCase();
|
|
@@ -173,7 +196,7 @@ function createRequestContextMiddleware(options = {}) {
|
|
|
173
196
|
const store = {
|
|
174
197
|
req,
|
|
175
198
|
res,
|
|
176
|
-
requestId:
|
|
199
|
+
requestId: resolveRequestId(req, header),
|
|
177
200
|
};
|
|
178
201
|
if (captureBodies) {
|
|
179
202
|
store.captureBodies = true;
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAkDH,0CAEC;AAGD,kDAEC;AAOD,wCAGC;AAUD,sCAmBC;AAsCD,kDAiCC;AAGD,oDAEC;AA6DD,wEAuBC;AA9PD,uDAAqD;AACrD,6CAAyC;AAEzC,gDAAyE;AAEzE,iCAMgB;AAGhB,yFAAyF;AACzF,MAAM,uBAAuB,GAAG,MAAM,CAAC;AA8BvC,MAAM,OAAO,GAAG,IAAI,oCAAiB,EAAgB,CAAC;AAEtD,wEAAwE;AACxE,SAAgB,eAAe;IAC7B,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,oFAAoF;AACpF,SAAgB,mBAAmB,CAAI,KAAmB,EAAE,EAAW;IACrE,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IACjC,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AAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAS,gBAAgB,CAAC,GAAoB,EAAE,eAAuB;IACrE,OAAO,CACL,IAAA,2BAAgB,EAAC,GAAG,CAAC,OAAO,EAAE,CAAC,6BAAkB,CAAC,CAAC;QACnD,aAAa,CAAC,GAAG,EAAE,eAAe,CAAC;QACnC,IAAA,wBAAU,GAAE,CACb,CAAC;AACJ,CAAC;AAoBD;;;;;;;;GAQG;AACH,SAAgB,8BAA8B,CAC5C,UAAiC,EAAE;IAEnC,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,eAAe,IAAI,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;IACzE,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,KAAK,IAAI,CAAC;IACrD,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAC1C,OAAO,SAAS,qBAAqB,CACnC,GAAoB,EACpB,GAAqB,EACrB,IAAkB;QAElB,MAAM,KAAK,GAAiB;YAC1B,GAAG;YACH,GAAG;YACH,SAAS,EAAE,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC;SACzC,CAAC;QACF,IAAI,aAAa,EAAE,CAAC;YAClB,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;YAC3B,IAAI,OAAO,YAAY,KAAK,QAAQ;gBAAE,KAAK,CAAC,YAAY,GAAG,YAAY,CAAC;YACxE,0BAA0B,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,CAAC;QACD,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/express.d.ts
CHANGED
|
@@ -21,7 +21,10 @@ export type ExpressMiddleware = (req: HttpRequestLike, res: HttpResponseLike, ne
|
|
|
21
21
|
export type ExpressErrorMiddleware = (error: unknown, req: HttpRequestLike, res: HttpResponseLike, next: NextFunction) => void;
|
|
22
22
|
/** Options for {@link fixbackRequestContext}. */
|
|
23
23
|
export interface RequestContextOptions {
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* The header a correlation id is read from when the request carries no well-formed
|
|
26
|
+
* `traceparent` (which always wins). Defaults to the client's config, then `x-request-id`.
|
|
27
|
+
*/
|
|
25
28
|
readonly requestIdHeader?: string;
|
|
26
29
|
}
|
|
27
30
|
/** Options for {@link fixbackErrorHandler}. */
|
package/dist/express.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express.js","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;
|
|
1
|
+
{"version":3,"file":"express.js","sourceRoot":"","sources":["../src/express.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAkDH,sDASC;AAOD,kDAyBC;AAzFD,qCAIkB;AAClB,uCAA2D;AAC3D,iCAMgB;AAgChB;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,UAAiC,EAAE;IACvE,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,eAAe,IAAI,MAAM,EAAE,eAAe,CAAC;IAClE,OAAO,IAAA,wCAA8B,EAAC;QACpC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,+EAA+E;QAC/E,wFAAwF;QACxF,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7F,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,UAA+B,EAAE;IACnE,MAAM,MAAM,GAAkB,OAAO,CAAC,MAAM,IAAI;QAC9C,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,IAAA,yBAAsB,EAAC,KAAK,EAAE,OAAO,CAAC;KAC7E,CAAC;IACF,OAAO,SAAS,6BAA6B,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI;QACjE,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,EAAE,GAAG,IAAA,+BAAwB,EAAC,GAAG,CAAC,EAAE,UAAU,EAAE,IAAA,kBAAW,EAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAAC;gBACzF,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5D,CAAC;YAAC,MAAM,CAAC;gBACP,4EAA4E;YAC9E,CAAC;QACH,CAAC,CAAC;QACF,8EAA8E;QAC9E,+EAA+E;QAC/E,6EAA6E;QAC7E,4EAA4E;QAC5E,IAAI,IAAA,kBAAS,GAAE,EAAE,aAAa,EAAE,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,CAAC;YACZ,OAAO,EAAE,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,OAAO,EAAE,CAAC;YACV,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/host-identity.d.ts
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
* **Host identity** minting (ADR-0066; ticket #251) — the escape hatch for a backend
|
|
3
3
|
* that already knows who its users are.
|
|
4
4
|
*
|
|
5
|
-
* A Host identity is a compact `HS256` JWT the customer's own server mints with
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* the
|
|
9
|
-
*
|
|
5
|
+
* A Host identity is a compact `HS256` JWT the customer's own server mints with a
|
|
6
|
+
* **secret key** and hands to a capture SDK; ingest verifies it against the secret
|
|
7
|
+
* keys of the Environment the SDK's publishable key belongs to (ADR 2026-09-24) and
|
|
8
|
+
* tiers the Reporter (Member ⇒ Internal, else Invited) with no Connect round trip.
|
|
9
|
+
* This helper is the executable statement of the signing recipe, so a customer never
|
|
10
|
+
* has to hand-roll JWT signing:
|
|
10
11
|
*
|
|
11
12
|
* key = sha256(secretKey) // hex — the value the server stores and verifies against
|
|
12
13
|
* token = base64url(header).base64url(payload).base64url(HMAC-SHA256(key, signingInput))
|
|
@@ -23,7 +24,9 @@
|
|
|
23
24
|
/** What {@link mintHostIdentity} needs to mint a token. */
|
|
24
25
|
export interface MintHostIdentityOptions {
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
+
* A **secret key** (`sk_…`) of the same Environment as the publishable key the
|
|
28
|
+
* capture SDK presents — a staging secret cannot mint an identity production
|
|
29
|
+
* admits (ADR 2026-09-24). The same kind of credential {@link init} and
|
|
27
30
|
* `npx fixback sourcemaps upload` use. It signs the token; keep it server-side.
|
|
28
31
|
*/
|
|
29
32
|
readonly secretKey: string;
|
package/dist/host-identity.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* **Host identity** minting (ADR-0066; ticket #251) — the escape hatch for a backend
|
|
4
4
|
* that already knows who its users are.
|
|
5
5
|
*
|
|
6
|
-
* A Host identity is a compact `HS256` JWT the customer's own server mints with
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the
|
|
10
|
-
*
|
|
6
|
+
* A Host identity is a compact `HS256` JWT the customer's own server mints with a
|
|
7
|
+
* **secret key** and hands to a capture SDK; ingest verifies it against the secret
|
|
8
|
+
* keys of the Environment the SDK's publishable key belongs to (ADR 2026-09-24) and
|
|
9
|
+
* tiers the Reporter (Member ⇒ Internal, else Invited) with no Connect round trip.
|
|
10
|
+
* This helper is the executable statement of the signing recipe, so a customer never
|
|
11
|
+
* has to hand-roll JWT signing:
|
|
11
12
|
*
|
|
12
13
|
* key = sha256(secretKey) // hex — the value the server stores and verifies against
|
|
13
14
|
* token = base64url(header).base64url(payload).base64url(HMAC-SHA256(key, signingInput))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-identity.js","sourceRoot":"","sources":["../src/host-identity.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"host-identity.js","sourceRoot":"","sources":["../src/host-identity.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAoDH,4CAmCC;AArFD,6CAAqD;AAErD,sEAAsE;AACtE,MAAM,0BAA0B,GAAG,EAAE,GAAG,EAAE,CAAC;AAgC3C,4DAA4D;AAC5D,SAAS,SAAS,CAAC,KAAsB;IACvC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,gBAAgB,CAAC,OAAgC;IAC/D,MAAM,SAAS,GACb,OAAO,OAAO,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACxE,MAAM,OAAO,GACX,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpE,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,GAAG,GACP,OAAO,OAAO,CAAC,gBAAgB,KAAK,QAAQ;QAC5C,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACzC,OAAO,CAAC,gBAAgB,GAAG,CAAC;QAC1B,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACtC,CAAC,CAAC,0BAA0B,CAAC;IACjC,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAEjD,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC;IAC5C,MAAM,OAAO,GAA4B;QACvC,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,UAAU;QACf,GAAG,EAAE,UAAU,GAAG,GAAG;KACtB,CAAC;IACF,MAAM,KAAK,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5E,IAAI,KAAK;QAAE,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAEjC,MAAM,YAAY,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,SAAS,CACpE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CACxB,EAAE,CAAC;IACJ,MAAM,GAAG,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1E,OAAO,GAAG,YAAY,IAAI,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;AACnD,CAAC"}
|
package/dist/http.d.ts
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* the SDK needs no `@types/express` dependency: Express and NestJS (on Express) both pass
|
|
7
7
|
* requests/responses that satisfy these shapes, and tests pass plain objects. Only
|
|
8
8
|
* the private-by-default fields are read here — never bodies, headers beyond the
|
|
9
|
-
* correlation id, query values, or env.
|
|
9
|
+
* correlation-id carriers (`traceparent`, then the request-id header), query values, or env.
|
|
10
10
|
*/
|
|
11
11
|
/** A framework response writer (`res.json` / `res.send`) — wrapped under `captureBodies`. */
|
|
12
12
|
export type ResponseWriter = (this: unknown, ...args: unknown[]) => unknown;
|
|
13
13
|
/**
|
|
14
|
-
* The request slice the adapters read — headers (bar the correlation
|
|
15
|
-
* never read. The parsed **body** is read only under the `captureBodies` opt-in
|
|
14
|
+
* The request slice the adapters read — headers (bar the correlation-id carriers,
|
|
15
|
+
* `traceparent` and the request-id header) and query are never read. The parsed **body** is read only under the `captureBodies` opt-in
|
|
16
16
|
* (default off, ADR-2026-09-16); it is whatever the app's body parser already put on
|
|
17
17
|
* `req.body`, so Fixback parses nothing itself.
|
|
18
18
|
*/
|
package/dist/http.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the SDK needs no `@types/express` dependency: Express and NestJS (on Express) both pass
|
|
8
8
|
* requests/responses that satisfy these shapes, and tests pass plain objects. Only
|
|
9
9
|
* the private-by-default fields are read here — never bodies, headers beyond the
|
|
10
|
-
* correlation id, query values, or env.
|
|
10
|
+
* correlation-id carriers (`traceparent`, then the request-id header), query values, or env.
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.routePatternOf = routePatternOf;
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,gDAO2B;
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,gDAO2B;AA0C3B,MAAa,SAAS;IACH,MAAM,CAAkB;IACxB,SAAS,C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C;YACjB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC5B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,qBAAU,EAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;gBACvD,OAAO,KAAK,CAAC;YACf,CAAC;YACD,OAAO,KAAK,CAAC,CAAC,uBAAuB;QACvC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uEAAuE;IAC/D,WAAW,CAAC,OAAmC;QACrD,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;QACjC,IAAI,EAAE,IAAI,CAAC;YAAE,OAAO,OAAO,CAAC;QAC5B,IAAI,KAAgD,CAAC;QACrD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE;YAC/C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;YACnD,IAAI,KAAK,KAAK,SAAS;gBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtID,8BAsIC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/wire.d.ts
CHANGED
|
@@ -34,7 +34,11 @@ export interface ServerContext {
|
|
|
34
34
|
readonly route?: string;
|
|
35
35
|
/** The resolved HTTP status of the failed request. */
|
|
36
36
|
readonly statusCode?: number;
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The request's **Correlation id**: the trace id of the page's `traceparent` when the
|
|
39
|
+
* request carried a well-formed one, else the configured request-id header
|
|
40
|
+
* (`x-request-id`), else generated — so a browser network entry and this error share it.
|
|
41
|
+
*/
|
|
38
42
|
readonly requestId?: string;
|
|
39
43
|
/** An **app-supplied** user reference (via `setUser`) — never scraped from the request. */
|
|
40
44
|
readonly user?: string;
|
|
@@ -72,12 +76,17 @@ export interface FixbackErrorEvent {
|
|
|
72
76
|
handled?: boolean;
|
|
73
77
|
/** The severity of a `captureMessage` (event-only; unset for a `captureException`). */
|
|
74
78
|
level?: Severity;
|
|
75
|
-
/** The deploy environment (`production` / `staging` / …). */
|
|
76
|
-
environment?: string;
|
|
77
79
|
/** The host app's Release — the build the stack symbolicates against. */
|
|
78
80
|
release?: string;
|
|
79
81
|
/** The running occurrence count coalesced for this fingerprint in the flush window. */
|
|
80
82
|
occurrences?: number;
|
|
83
|
+
/**
|
|
84
|
+
* The **capture instant**, in epoch milliseconds on this process's clock — when the
|
|
85
|
+
* error was captured, not when a batch was sent. The server records it as when this
|
|
86
|
+
* occurrence happened, believing it within a bounded clock skew (a day) and falling
|
|
87
|
+
* back to its own ingest time otherwise (the Occurrence ledger, #539).
|
|
88
|
+
*/
|
|
89
|
+
occurredAt?: number;
|
|
81
90
|
/** The parsed stack frames, top of stack first, scrubbed and capped. */
|
|
82
91
|
errorFrames?: CapturedFrame[];
|
|
83
92
|
/** The in-flight request's server context, when captured inside a request. */
|
|
@@ -111,9 +120,14 @@ export interface ServerErrorPayload {
|
|
|
111
120
|
readonly errorName?: string;
|
|
112
121
|
readonly errorMessage?: string;
|
|
113
122
|
readonly handled?: boolean;
|
|
114
|
-
readonly environment?: string;
|
|
115
123
|
readonly release?: string;
|
|
116
124
|
readonly occurrences?: number;
|
|
125
|
+
/**
|
|
126
|
+
* The capture instant in epoch ms (#539) — for an item that coalesced several
|
|
127
|
+
* occurrences, the first one's, like the rest of its evidence. Recorded on the
|
|
128
|
+
* error's Occurrence as when it happened, within the server's clock-skew bound.
|
|
129
|
+
*/
|
|
130
|
+
readonly occurredAt?: number;
|
|
117
131
|
readonly errorFrames?: readonly CapturedFrame[];
|
|
118
132
|
readonly server?: ServerContext;
|
|
119
133
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fixback/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The Fixback backend error SDK for Node servers — one-call init, batched secret-key capture, process handlers, and Express + NestJS adapters.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@fixback/sdk-core": "0.
|
|
53
|
+
"@fixback/sdk-core": "0.10.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@nestjs/common": ">=10.0.0",
|