@fixback/node 0.6.3 → 0.6.5
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 +6 -4
- package/dist/client.d.ts +1 -1
- package/dist/client.js +51 -11
- package/dist/client.js.map +1 -1
- package/dist/transport.d.ts +21 -2
- package/dist/transport.js +71 -4
- 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 +10 -0
- package/dist/wire.js +18 -0
- package/dist/wire.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -45,9 +45,10 @@ environment and deploy that environment's key.
|
|
|
45
45
|
|
|
46
46
|
That single call wires:
|
|
47
47
|
|
|
48
|
-
- a **batched** secret-key transport that backs off on `429` (honouring `Retry-After`)
|
|
49
|
-
|
|
50
|
-
later still records when every error
|
|
48
|
+
- a **batched** secret-key transport that backs off on `429` (honouring `Retry-After`) and
|
|
49
|
+
sends a flush too large for one request in several — each error carries the instant it
|
|
50
|
+
was captured (`occurredAt`), so a batch flushed later still records when every error
|
|
51
|
+
happened;
|
|
51
52
|
- process-level `uncaughtException` / `unhandledRejection` capture that **never changes
|
|
52
53
|
your process's exit behaviour** — `autoCapture: false` turns both off (or
|
|
53
54
|
`captureUncaughtException` / `captureUnhandledRejection` individually);
|
|
@@ -128,7 +129,8 @@ with values), method, status, a correlation id, and the app-supplied user ref on
|
|
|
128
129
|
query-string values. Request/response bodies are an explicit opt-in, **off by default**:
|
|
129
130
|
with `captureBodies: true` the failing request's bodies ride on its server context —
|
|
130
131
|
serialized, PII-redacted at the scrub choke point, and dropped (never truncated) when
|
|
131
|
-
larger than `maxBodyBytes` (16384 by default, at most 65536)
|
|
132
|
+
larger than `maxBodyBytes` (16384 by default, at most 65536) or when they would make their
|
|
133
|
+
error too large to send in one request. A `beforeSend(event)` hook
|
|
132
134
|
lets you redact further or drop an event entirely (return `null`).
|
|
133
135
|
|
|
134
136
|
## Fails quiet
|
package/dist/client.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { type InitOptions, type ResolvedConfig } from "./config";
|
|
14
14
|
import { type ProcessLike } from "./process";
|
|
15
15
|
import { type CaptureTransport } from "./transport";
|
|
16
|
-
import type
|
|
16
|
+
import { type ServerContext, type Severity } from "./wire";
|
|
17
17
|
export type { BeforeSend, FixbackErrorEvent, ServerContext, Severity } from "./wire";
|
|
18
18
|
export type { InitOptions } from "./config";
|
|
19
19
|
export type { CaptureTransport } from "./transport";
|
package/dist/client.js
CHANGED
|
@@ -25,6 +25,7 @@ const context_1 = require("./context");
|
|
|
25
25
|
const process_1 = require("./process");
|
|
26
26
|
const stack_1 = require("./stack");
|
|
27
27
|
const transport_1 = require("./transport");
|
|
28
|
+
const wire_1 = require("./wire");
|
|
28
29
|
/** Merge two server contexts, the override winning; `undefined` when both are empty. */
|
|
29
30
|
function mergeServerContext(base, override) {
|
|
30
31
|
if (!base && !override)
|
|
@@ -124,10 +125,13 @@ class FixbackClient {
|
|
|
124
125
|
};
|
|
125
126
|
if (this.config.scrub)
|
|
126
127
|
applyDefaultScrub(event);
|
|
128
|
+
// The name and message as the default scrub left them, before the hook can change
|
|
129
|
+
// them: only that text is safe to cut short on the wire ({@link capErrorText}).
|
|
130
|
+
const scrubbed = this.config.scrub ? { type: event.type, value: event.value } : undefined;
|
|
127
131
|
const finalised = this.runBeforeSend(event);
|
|
128
132
|
if (!finalised)
|
|
129
133
|
return; // dropped at the choke point — no transport
|
|
130
|
-
this.transport.enqueue(toPayload(finalised));
|
|
134
|
+
this.transport.enqueue(toPayload(finalised, scrubbed));
|
|
131
135
|
}
|
|
132
136
|
catch {
|
|
133
137
|
// Capture must never throw into the host (story 34).
|
|
@@ -182,16 +186,21 @@ function applyDefaultScrub(event) {
|
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
/**
|
|
185
|
-
* Project the event onto the wire payload
|
|
186
|
-
* renamed `errorName` / `errorMessage` (ADR 2026-09-17)
|
|
187
|
-
* {@link applyDefaultScrub};
|
|
189
|
+
* Project the event onto the wire payload, bounded as ingest bounds it. The error class
|
|
190
|
+
* + message ride as the renamed `errorName` / `errorMessage` (ADR 2026-09-17), scrubbed
|
|
191
|
+
* by {@link applyDefaultScrub}; when that scrub produced them (`scrubbed`), they are cut
|
|
192
|
+
* to the lengths ingest keeps ({@link capErrorText}). A blank one is dropped, and a frame
|
|
193
|
+
* ingest would discard is not sent. So no bytes go on what the server throws away, and a
|
|
194
|
+
* long message cannot crowd a batch out of the API's body limit. `level` stays event-only.
|
|
188
195
|
*/
|
|
189
|
-
function toPayload(event) {
|
|
196
|
+
function toPayload(event, scrubbed) {
|
|
190
197
|
const payload = { errorSignature: event.errorSignature };
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
198
|
+
const errorName = capErrorText(event.type, wire_1.ERROR_NAME_MAX_LENGTH, event.type === scrubbed?.type);
|
|
199
|
+
if (errorName !== undefined)
|
|
200
|
+
payload.errorName = errorName;
|
|
201
|
+
const errorMessage = capErrorText(event.value, wire_1.ERROR_MESSAGE_MAX_LENGTH, event.value === scrubbed?.value);
|
|
202
|
+
if (errorMessage !== undefined)
|
|
203
|
+
payload.errorMessage = errorMessage;
|
|
195
204
|
if (event.handled !== undefined)
|
|
196
205
|
payload.handled = event.handled;
|
|
197
206
|
if (event.release !== undefined)
|
|
@@ -201,12 +210,43 @@ function toPayload(event) {
|
|
|
201
210
|
if (typeof event.occurredAt === "number" && Number.isFinite(event.occurredAt)) {
|
|
202
211
|
payload.occurredAt = event.occurredAt;
|
|
203
212
|
}
|
|
204
|
-
|
|
205
|
-
|
|
213
|
+
const frames = Array.isArray(event.errorFrames)
|
|
214
|
+
? event.errorFrames.filter(keptByIngest).slice(0, wire_1.MAX_CAPTURED_FRAMES)
|
|
215
|
+
: [];
|
|
216
|
+
if (frames.length > 0)
|
|
217
|
+
payload.errorFrames = frames;
|
|
206
218
|
if (event.server)
|
|
207
219
|
payload.server = event.server;
|
|
208
220
|
return payload;
|
|
209
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* A captured name or message bounded as ingest bounds it: `undefined` when absent or
|
|
224
|
+
* blank, and cut to `max` UTF-16 code units when it is the default scrub's output.
|
|
225
|
+
* Ingest scrubs and then cuts, and cutting raw text first could split an email or a
|
|
226
|
+
* digit run into a fragment its re-scrub no longer matches. So raw text (`scrub: false`,
|
|
227
|
+
* or rewritten by `beforeSend`) goes whole, for ingest to cut once it has scrubbed it.
|
|
228
|
+
*/
|
|
229
|
+
function capErrorText(value, max, scrubbed) {
|
|
230
|
+
if (typeof value !== "string" || value.trim().length === 0)
|
|
231
|
+
return undefined;
|
|
232
|
+
return scrubbed && value.length > max ? value.slice(0, max) : value;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Whether ingest keeps a frame (its frame schema, `apps/api/src/errors/frames.ts`): a
|
|
236
|
+
* file and a function within their lengths, a positive line, and a column that is a
|
|
237
|
+
* count. It discards any other, so the SDK does not send it.
|
|
238
|
+
*/
|
|
239
|
+
function keptByIngest(frame) {
|
|
240
|
+
const { file, line, column, function: fn } = frame;
|
|
241
|
+
return (typeof file === "string" &&
|
|
242
|
+
file.length > 0 &&
|
|
243
|
+
file.length <= wire_1.FRAME_FILE_MAX_LENGTH &&
|
|
244
|
+
Number.isInteger(line) &&
|
|
245
|
+
line > 0 &&
|
|
246
|
+
(column == null || (Number.isInteger(column) && column >= 0)) &&
|
|
247
|
+
(fn == null ||
|
|
248
|
+
(typeof fn === "string" && fn.length > 0 && fn.length <= wire_1.FRAME_FUNCTION_MAX_LENGTH)));
|
|
249
|
+
}
|
|
210
250
|
// --- Module-level singleton API ----------------------------------------------
|
|
211
251
|
let activeClient = null;
|
|
212
252
|
let activeUninstall = null;
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AA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** a server emits many errors, so they buffer and flush together
|
|
7
|
-
* (on the batch cap, on an interval, on demand, and on `close`).
|
|
7
|
+
* (on the batch cap, on an interval, on demand, and on `close`). Each request is filled
|
|
8
|
+
* to a byte budget a little under the API's body limit ({@link MAX_BATCH_BYTES}); the
|
|
9
|
+
* rest goes in the next one.
|
|
8
10
|
* - **Coalesced:** repeats of one fingerprint in a flush window fold into a single
|
|
9
11
|
* item with a summed occurrence count — the client half of the crash-loop defence
|
|
10
12
|
* (the server folds across flushes, ADR-0062).
|
|
@@ -32,6 +34,8 @@ export interface TransportConfig {
|
|
|
32
34
|
readonly maxQueueSize: number;
|
|
33
35
|
readonly flushIntervalMs: number;
|
|
34
36
|
readonly timeoutMs: number;
|
|
37
|
+
/** The most bytes one request's body may take. Defaults to {@link MAX_BATCH_BYTES}. */
|
|
38
|
+
readonly maxBatchBytes?: number;
|
|
35
39
|
}
|
|
36
40
|
/** Injectable collaborators, defaulted to the real implementations. */
|
|
37
41
|
export interface TransportDeps {
|
|
@@ -40,6 +44,7 @@ export interface TransportDeps {
|
|
|
40
44
|
}
|
|
41
45
|
export declare class Transport implements CaptureTransport {
|
|
42
46
|
private readonly config;
|
|
47
|
+
private readonly maxBatchBytes;
|
|
43
48
|
private readonly fetchImpl;
|
|
44
49
|
private readonly backoff;
|
|
45
50
|
/** Insertion-ordered buffer keyed by fingerprint, so a coalesce is O(1). */
|
|
@@ -61,8 +66,22 @@ export declare class Transport implements CaptureTransport {
|
|
|
61
66
|
close(): Promise<void>;
|
|
62
67
|
/** Send batches until the buffer drains, the window opens, or a send fails. */
|
|
63
68
|
private drain;
|
|
64
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Remove and return the oldest buffered errors as one request's batch: at most
|
|
71
|
+
* `maxBatchSize` of them, and only as many as fit the body budget. An error that would
|
|
72
|
+
* overflow the request waits, whole, for the next one. An error that alone exceeds the
|
|
73
|
+
* budget leads its own request, shedding evidence to fit ({@link shedEvidence}).
|
|
74
|
+
*/
|
|
65
75
|
private takeBatch;
|
|
76
|
+
/**
|
|
77
|
+
* Fit an error that alone exceeds the body budget by shedding the evidence it can
|
|
78
|
+
* lose: its captured request/response bodies first, then its stack frames. `undefined`
|
|
79
|
+
* when even that is not enough, which takes an outsized value the SDK sends whole: a raw
|
|
80
|
+
* message it does not cut (`capErrorText` in `client.ts`), a user ref, a release.
|
|
81
|
+
*/
|
|
82
|
+
private shedEvidence;
|
|
83
|
+
/** Whether an error fits the body budget in a request of its own. */
|
|
84
|
+
private fitsAlone;
|
|
66
85
|
/**
|
|
67
86
|
* POST one batch. Returns `true` on acceptance; on a `429` it opens the backoff
|
|
68
87
|
* window from `Retry-After` and returns `false`; any other failure (unreachable,
|
package/dist/transport.js
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
* Project secret key as an `Authorization: Bearer` token.
|
|
6
6
|
*
|
|
7
7
|
* - **Batched:** a server emits many errors, so they buffer and flush together
|
|
8
|
-
* (on the batch cap, on an interval, on demand, and on `close`).
|
|
8
|
+
* (on the batch cap, on an interval, on demand, and on `close`). Each request is filled
|
|
9
|
+
* to a byte budget a little under the API's body limit ({@link MAX_BATCH_BYTES}); the
|
|
10
|
+
* rest goes in the next one.
|
|
9
11
|
* - **Coalesced:** repeats of one fingerprint in a flush window fold into a single
|
|
10
12
|
* item with a summed occurrence count — the client half of the crash-loop defence
|
|
11
13
|
* (the server folds across flushes, ADR-0062).
|
|
@@ -17,8 +19,21 @@
|
|
|
17
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
20
|
exports.Transport = void 0;
|
|
19
21
|
const sdk_core_1 = require("@fixback/sdk-core");
|
|
22
|
+
/**
|
|
23
|
+
* The most bytes one request's JSON body may take. The API parses JSON bodies up to
|
|
24
|
+
* Express's default 100 KB and refuses a larger one whole with a `413`, losing every
|
|
25
|
+
* error in it, so each request fills to a little under that.
|
|
26
|
+
*/
|
|
27
|
+
const MAX_BATCH_BYTES = 96 * 1024;
|
|
28
|
+
/** The size of a value's JSON, in UTF-8 bytes — what it weighs in a request body. */
|
|
29
|
+
function jsonBytes(value) {
|
|
30
|
+
return Buffer.byteLength(JSON.stringify(value), "utf8");
|
|
31
|
+
}
|
|
32
|
+
/** The bytes the batch envelope adds around its errors: `{"errors":[` and `]}`. */
|
|
33
|
+
const ENVELOPE_BYTES = jsonBytes({ errors: [] });
|
|
20
34
|
class Transport {
|
|
21
35
|
config;
|
|
36
|
+
maxBatchBytes;
|
|
22
37
|
fetchImpl;
|
|
23
38
|
backoff;
|
|
24
39
|
/** Insertion-ordered buffer keyed by fingerprint, so a coalesce is O(1). */
|
|
@@ -28,6 +43,7 @@ class Transport {
|
|
|
28
43
|
closed = false;
|
|
29
44
|
constructor(config, deps = {}) {
|
|
30
45
|
this.config = config;
|
|
46
|
+
this.maxBatchBytes = config.maxBatchBytes ?? MAX_BATCH_BYTES;
|
|
31
47
|
this.fetchImpl = deps.fetchImpl ?? (0, sdk_core_1.resolveFetch)();
|
|
32
48
|
this.backoff = deps.backoff ?? new sdk_core_1.AutoReportBackoff();
|
|
33
49
|
if (config.flushIntervalMs > 0) {
|
|
@@ -93,17 +109,68 @@ class Transport {
|
|
|
93
109
|
return; // 429 (held) or unreachable/refused — stop; the rest waits or is dropped
|
|
94
110
|
}
|
|
95
111
|
}
|
|
96
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Remove and return the oldest buffered errors as one request's batch: at most
|
|
114
|
+
* `maxBatchSize` of them, and only as many as fit the body budget. An error that would
|
|
115
|
+
* overflow the request waits, whole, for the next one. An error that alone exceeds the
|
|
116
|
+
* budget leads its own request, shedding evidence to fit ({@link shedEvidence}).
|
|
117
|
+
*/
|
|
97
118
|
takeBatch() {
|
|
98
119
|
const batch = [];
|
|
120
|
+
let bytes = ENVELOPE_BYTES;
|
|
99
121
|
for (const [signature, entry] of this.buffer) {
|
|
100
|
-
batch.push(entry);
|
|
101
|
-
this.buffer.delete(signature);
|
|
102
122
|
if (batch.length >= this.config.maxBatchSize)
|
|
103
123
|
break;
|
|
124
|
+
let item = entry;
|
|
125
|
+
let size;
|
|
126
|
+
try {
|
|
127
|
+
size = jsonBytes(item);
|
|
128
|
+
}
|
|
129
|
+
catch {
|
|
130
|
+
// A value JSON cannot carry (a BigInt or a cycle a hook left in) can never be
|
|
131
|
+
// sent: drop it, rather than let it stall every flush behind it.
|
|
132
|
+
this.buffer.delete(signature);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const comma = batch.length > 0 ? 1 : 0;
|
|
136
|
+
if (bytes + comma + size > this.maxBatchBytes) {
|
|
137
|
+
if (batch.length > 0)
|
|
138
|
+
break; // full: the rest goes in the next request
|
|
139
|
+
const shed = this.shedEvidence(item);
|
|
140
|
+
if (shed === undefined) {
|
|
141
|
+
// Over the budget even bare, so it cannot go: drop it rather than send a request
|
|
142
|
+
// the API may refuse, which would also stop the drain behind it.
|
|
143
|
+
this.buffer.delete(signature);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
item = shed;
|
|
147
|
+
size = jsonBytes(item);
|
|
148
|
+
}
|
|
149
|
+
batch.push(item);
|
|
150
|
+
bytes += comma + size;
|
|
151
|
+
this.buffer.delete(signature);
|
|
104
152
|
}
|
|
105
153
|
return batch;
|
|
106
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Fit an error that alone exceeds the body budget by shedding the evidence it can
|
|
157
|
+
* lose: its captured request/response bodies first, then its stack frames. `undefined`
|
|
158
|
+
* when even that is not enough, which takes an outsized value the SDK sends whole: a raw
|
|
159
|
+
* message it does not cut (`capErrorText` in `client.ts`), a user ref, a release.
|
|
160
|
+
*/
|
|
161
|
+
shedEvidence(item) {
|
|
162
|
+
const bodiless = item.server
|
|
163
|
+
? { ...item, server: { ...item.server, requestBody: undefined, responseBody: undefined } }
|
|
164
|
+
: item;
|
|
165
|
+
if (this.fitsAlone(bodiless))
|
|
166
|
+
return bodiless;
|
|
167
|
+
const frameless = { ...bodiless, errorFrames: undefined };
|
|
168
|
+
return this.fitsAlone(frameless) ? frameless : undefined;
|
|
169
|
+
}
|
|
170
|
+
/** Whether an error fits the body budget in a request of its own. */
|
|
171
|
+
fitsAlone(item) {
|
|
172
|
+
return ENVELOPE_BYTES + jsonBytes(item) <= this.maxBatchBytes;
|
|
173
|
+
}
|
|
107
174
|
/**
|
|
108
175
|
* POST one batch. Returns `true` on acceptance; on a `429` it opens the backoff
|
|
109
176
|
* window from `Retry-After` and returns `false`; any other failure (unreachable,
|
package/dist/transport.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,gDAO2B;AAI3B;;;;GAIG;AACH,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC;AAElC,qFAAqF;AACrF,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED,mFAAmF;AACnF,MAAM,cAAc,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,EAA6B,CAAC,CAAC;AA0C5E,MAAa,SAAS;IACH,MAAM,CAAkB;IACxB,aAAa,CAAS;IACtB,SAAS,CAAwB;IACjC,OAAO,CAAoB;IAC5C,4EAA4E;IAC3D,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,KAAK,CAA6C;IAClD,QAAQ,GAAyB,IAAI,CAAC;IACtC,MAAM,GAAG,KAAK,CAAC;IAEvB,YAAY,MAAuB,EAAE,OAAsB,EAAE;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,eAAe,CAAC;Q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;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC,CAAC,wCAAwC;QACxD,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;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;AA1LD,8BA0LC"}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
package/dist/wire.d.ts
CHANGED
|
@@ -144,3 +144,13 @@ export interface ServerErrorPayload {
|
|
|
144
144
|
export interface ServerErrorBatch {
|
|
145
145
|
readonly errors: readonly ServerErrorPayload[];
|
|
146
146
|
}
|
|
147
|
+
/** The longest error name ingest keeps. */
|
|
148
|
+
export declare const ERROR_NAME_MAX_LENGTH = 256;
|
|
149
|
+
/** The longest error message ingest keeps. */
|
|
150
|
+
export declare const ERROR_MESSAGE_MAX_LENGTH = 2048;
|
|
151
|
+
/** The longest frame file ingest accepts; it discards a frame with a longer one. */
|
|
152
|
+
export declare const FRAME_FILE_MAX_LENGTH = 1024;
|
|
153
|
+
/** The longest frame function ingest accepts; it discards a frame with a longer one. */
|
|
154
|
+
export declare const FRAME_FUNCTION_MAX_LENGTH = 256;
|
|
155
|
+
/** The most frames ingest keeps, top of stack first. */
|
|
156
|
+
export declare const MAX_CAPTURED_FRAMES = 30;
|
package/dist/wire.js
CHANGED
|
@@ -12,4 +12,22 @@
|
|
|
12
12
|
* shared core, so the browser and node SDKs describe a frame identically.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.MAX_CAPTURED_FRAMES = exports.FRAME_FUNCTION_MAX_LENGTH = exports.FRAME_FILE_MAX_LENGTH = exports.ERROR_MESSAGE_MAX_LENGTH = exports.ERROR_NAME_MAX_LENGTH = void 0;
|
|
16
|
+
/*
|
|
17
|
+
* The bounds the endpoint keeps, mirrored by value from `@fixback/shared` (which is
|
|
18
|
+
* workspace-private) under the same names. Ingest slices the name and message to
|
|
19
|
+
* these lengths and discards a frame outside them, so the SDK applies them before
|
|
20
|
+
* transport: no bytes are spent on what the server throws away, and a long message
|
|
21
|
+
* cannot crowd a batch out of the API's body limit.
|
|
22
|
+
*/
|
|
23
|
+
/** The longest error name ingest keeps. */
|
|
24
|
+
exports.ERROR_NAME_MAX_LENGTH = 256;
|
|
25
|
+
/** The longest error message ingest keeps. */
|
|
26
|
+
exports.ERROR_MESSAGE_MAX_LENGTH = 2048;
|
|
27
|
+
/** The longest frame file ingest accepts; it discards a frame with a longer one. */
|
|
28
|
+
exports.FRAME_FILE_MAX_LENGTH = 1024;
|
|
29
|
+
/** The longest frame function ingest accepts; it discards a frame with a longer one. */
|
|
30
|
+
exports.FRAME_FUNCTION_MAX_LENGTH = 256;
|
|
31
|
+
/** The most frames ingest keeps, top of stack first. */
|
|
32
|
+
exports.MAX_CAPTURED_FRAMES = 30;
|
|
15
33
|
//# sourceMappingURL=wire.js.map
|
package/dist/wire.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../src/wire.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAmJH;;;;;;GAMG;AAEH,2CAA2C;AAC9B,QAAA,qBAAqB,GAAG,GAAG,CAAC;AAEzC,8CAA8C;AACjC,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAE7C,oFAAoF;AACvE,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C,wFAAwF;AAC3E,QAAA,yBAAyB,GAAG,GAAG,CAAC;AAE7C,wDAAwD;AAC3C,QAAA,mBAAmB,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fixback/node",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
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.12.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@nestjs/common": ">=10.0.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@nestjs/common": "^11.
|
|
77
|
-
"@nestjs/core": "^11.
|
|
76
|
+
"@nestjs/common": "^11.2.7",
|
|
77
|
+
"@nestjs/core": "^11.2.7",
|
|
78
78
|
"@types/node": "^22.20.1",
|
|
79
79
|
"reflect-metadata": "^0.2.2",
|
|
80
80
|
"rxjs": "^7.8.2",
|