@autter/runtime-node 1.8.0 → 1.9.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 +69 -1
- package/dist/{chunk-7H3FCV4P.cjs → chunk-AN45KLWD.cjs} +11 -11
- package/dist/{chunk-MOZOUEMA.cjs → chunk-BHYHORUD.cjs} +44 -3
- package/dist/{chunk-QKY2OQSO.js → chunk-HHKQ3UCH.js} +533 -31
- package/dist/{chunk-UC3QH4PC.js → chunk-JSGGUWRD.js} +1 -1
- package/dist/{chunk-37W7YYXO.cjs → chunk-YWTIKZSI.cjs} +596 -94
- package/dist/{chunk-B5ZMOCEM.js → chunk-ZKM76SDP.js} +44 -3
- package/dist/cli.cjs +8 -8
- package/dist/cli.js +2 -2
- package/dist/index.cjs +424 -209
- package/dist/index.d.cts +75 -3
- package/dist/index.d.ts +75 -3
- package/dist/index.js +231 -16
- package/dist/{sinks-CIdlmYwy.d.cts → sinks-CLtQFPnn.d.cts} +39 -3
- package/dist/{sinks-CIdlmYwy.d.ts → sinks-CLtQFPnn.d.ts} +39 -3
- package/dist/testing.cjs +8 -8
- package/dist/testing.d.cts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +2 -2
- package/package.json +7 -3
|
@@ -166,10 +166,19 @@ declare function isRuntimeErrorLike(err: unknown): err is RuntimeErrorLike;
|
|
|
166
166
|
interface ErrorAttributeOptions {
|
|
167
167
|
/** Also emit `exception.cause.N.*` for the cause chain (default true). */
|
|
168
168
|
causes?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* With `causes`, also emit what only an occurrence record needs (default
|
|
171
|
+
* true): each cause's stack (`exception.cause.N.stacktrace`, RF-06: a
|
|
172
|
+
* wrapped error groups with its root cause) and the debug ids of the
|
|
173
|
+
* bundles in the stacks (`autter.debug_ids`, RF-05: server source maps).
|
|
174
|
+
* Request and operation summaries pass false.
|
|
175
|
+
*/
|
|
176
|
+
stacks?: boolean;
|
|
169
177
|
}
|
|
170
178
|
/**
|
|
171
|
-
* Wire attributes for an error: `autter.error.code|why|fix|link|status|expected
|
|
172
|
-
*
|
|
179
|
+
* Wire attributes for an error: `autter.error.code|why|fix|link|status|expected`,
|
|
180
|
+
* `exception.cause.N.type|message|code|stacktrace` (N = 1..5) and
|
|
181
|
+
* `autter.debug_ids` (see ErrorAttributeOptions.stacks). Never includes
|
|
173
182
|
* `internal` — see `errorInternal`.
|
|
174
183
|
*/
|
|
175
184
|
declare function errorAttributes(err: unknown, options?: ErrorAttributeOptions): Record<string, string | number | boolean>;
|
|
@@ -250,6 +259,33 @@ interface BreadcrumbInput {
|
|
|
250
259
|
at?: string | number | Date;
|
|
251
260
|
}
|
|
252
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Handled errors (RF-01, RF-02): the building blocks every server SDK shares
|
|
264
|
+
* for errors the app caught instead of letting them crash.
|
|
265
|
+
*
|
|
266
|
+
* - Caught errors: an `Error` the app passes to `console.error`, a logger
|
|
267
|
+
* (pino, winston, bunyan) or `runtimeLogger.error` is reported as an
|
|
268
|
+
* occurrence at `error` severity, marked `autter.handled = true`,
|
|
269
|
+
* `autter.handling = "caught"`, with the log line as context
|
|
270
|
+
* (`autter.log.source`, `autter.log.message`).
|
|
271
|
+
* - Deliberate fallbacks: `runtimeContext.degraded(err, reason)` reports the
|
|
272
|
+
* error at `warning` severity (never an incident), marked
|
|
273
|
+
* `autter.handling = "deliberate"` with `autter.degraded.reason`.
|
|
274
|
+
*
|
|
275
|
+
* A burst limit keeps a looping error from flooding: per kind (error type
|
|
276
|
+
* and throw site) ten at once, then one every ten seconds. What it leaves
|
|
277
|
+
* out is counted, and the count rides on the next record of that kind as
|
|
278
|
+
* `autter.caught.dropped`, which the ingester adds to `runtime_ingest_drops`
|
|
279
|
+
* (reason `caught_limited`).
|
|
280
|
+
*/
|
|
281
|
+
type LoggedErrorSource = "console" | "pino" | "winston" | "bunyan" | "runtimeLogger";
|
|
282
|
+
/**
|
|
283
|
+
* `captureLoggedErrors`: `true` (default) reports errors logged through
|
|
284
|
+
* every source the SDK supports, `false` none; an object turns single
|
|
285
|
+
* sources off, e.g. `{ console: false }`.
|
|
286
|
+
*/
|
|
287
|
+
type CaptureLoggedErrorsOption = boolean | Partial<Record<LoggedErrorSource, boolean>>;
|
|
288
|
+
|
|
253
289
|
/**
|
|
254
290
|
* Client-side volume control shared by the server SDKs (runtime-node,
|
|
255
291
|
* runtime-edge; 1.8.0 / 1.2.0, EI-38): `ignoreErrors` and `sampleRate`.
|
|
@@ -358,4 +394,4 @@ interface MemorySink extends RuntimeSink {
|
|
|
358
394
|
/** Keeps every record in memory — for tests (`@autter/runtime-node/testing`). */
|
|
359
395
|
declare function memorySink(): MemorySink;
|
|
360
396
|
|
|
361
|
-
export {
|
|
397
|
+
export { defineRuntimeErrors as A, type BreadcrumbInput as B, type CapturedException as C, errorAttributes as D, fileSink as E, type FileSinkOptions as F, isRuntimeErrorLike as G, otlpSink as H, type IgnoreErrorPattern as I, redactAttributes as J, redactText as K, type LoggedErrorSource as L, type MemorySink as M, toClientError as N, type OtlpSinkOptions as O, type RuntimeEvent as R, type RuntimeOutcome as a, type RedactOptions as b, type Redactor$1 as c, type RuntimeLogLevel as d, type RuntimeOperationKind as e, type RuntimeSink as f, type RuntimeLogContext as g, type RuntimeCarrier as h, type CaptureLoggedErrorsOption as i, type Breadcrumb as j, type BreadcrumbLevel as k, type BreadcrumbType as l, memorySink as m, CODE_PATTERN as n, type ClientErrorBody as o, type ConsoleSinkOptions as p, RuntimeError as q, type RuntimeErrorCatalog as r, type RuntimeErrorDefinition as s, type RuntimeErrorExtras as t, type RuntimeErrorFactory as u, type RuntimeErrorLike as v, type RuntimeErrorOptions as w, type RuntimeLogContextValue as x, type RuntimeSinkContext as y, consoleSink as z };
|
|
@@ -166,10 +166,19 @@ declare function isRuntimeErrorLike(err: unknown): err is RuntimeErrorLike;
|
|
|
166
166
|
interface ErrorAttributeOptions {
|
|
167
167
|
/** Also emit `exception.cause.N.*` for the cause chain (default true). */
|
|
168
168
|
causes?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* With `causes`, also emit what only an occurrence record needs (default
|
|
171
|
+
* true): each cause's stack (`exception.cause.N.stacktrace`, RF-06: a
|
|
172
|
+
* wrapped error groups with its root cause) and the debug ids of the
|
|
173
|
+
* bundles in the stacks (`autter.debug_ids`, RF-05: server source maps).
|
|
174
|
+
* Request and operation summaries pass false.
|
|
175
|
+
*/
|
|
176
|
+
stacks?: boolean;
|
|
169
177
|
}
|
|
170
178
|
/**
|
|
171
|
-
* Wire attributes for an error: `autter.error.code|why|fix|link|status|expected
|
|
172
|
-
*
|
|
179
|
+
* Wire attributes for an error: `autter.error.code|why|fix|link|status|expected`,
|
|
180
|
+
* `exception.cause.N.type|message|code|stacktrace` (N = 1..5) and
|
|
181
|
+
* `autter.debug_ids` (see ErrorAttributeOptions.stacks). Never includes
|
|
173
182
|
* `internal` — see `errorInternal`.
|
|
174
183
|
*/
|
|
175
184
|
declare function errorAttributes(err: unknown, options?: ErrorAttributeOptions): Record<string, string | number | boolean>;
|
|
@@ -250,6 +259,33 @@ interface BreadcrumbInput {
|
|
|
250
259
|
at?: string | number | Date;
|
|
251
260
|
}
|
|
252
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Handled errors (RF-01, RF-02): the building blocks every server SDK shares
|
|
264
|
+
* for errors the app caught instead of letting them crash.
|
|
265
|
+
*
|
|
266
|
+
* - Caught errors: an `Error` the app passes to `console.error`, a logger
|
|
267
|
+
* (pino, winston, bunyan) or `runtimeLogger.error` is reported as an
|
|
268
|
+
* occurrence at `error` severity, marked `autter.handled = true`,
|
|
269
|
+
* `autter.handling = "caught"`, with the log line as context
|
|
270
|
+
* (`autter.log.source`, `autter.log.message`).
|
|
271
|
+
* - Deliberate fallbacks: `runtimeContext.degraded(err, reason)` reports the
|
|
272
|
+
* error at `warning` severity (never an incident), marked
|
|
273
|
+
* `autter.handling = "deliberate"` with `autter.degraded.reason`.
|
|
274
|
+
*
|
|
275
|
+
* A burst limit keeps a looping error from flooding: per kind (error type
|
|
276
|
+
* and throw site) ten at once, then one every ten seconds. What it leaves
|
|
277
|
+
* out is counted, and the count rides on the next record of that kind as
|
|
278
|
+
* `autter.caught.dropped`, which the ingester adds to `runtime_ingest_drops`
|
|
279
|
+
* (reason `caught_limited`).
|
|
280
|
+
*/
|
|
281
|
+
type LoggedErrorSource = "console" | "pino" | "winston" | "bunyan" | "runtimeLogger";
|
|
282
|
+
/**
|
|
283
|
+
* `captureLoggedErrors`: `true` (default) reports errors logged through
|
|
284
|
+
* every source the SDK supports, `false` none; an object turns single
|
|
285
|
+
* sources off, e.g. `{ console: false }`.
|
|
286
|
+
*/
|
|
287
|
+
type CaptureLoggedErrorsOption = boolean | Partial<Record<LoggedErrorSource, boolean>>;
|
|
288
|
+
|
|
253
289
|
/**
|
|
254
290
|
* Client-side volume control shared by the server SDKs (runtime-node,
|
|
255
291
|
* runtime-edge; 1.8.0 / 1.2.0, EI-38): `ignoreErrors` and `sampleRate`.
|
|
@@ -358,4 +394,4 @@ interface MemorySink extends RuntimeSink {
|
|
|
358
394
|
/** Keeps every record in memory — for tests (`@autter/runtime-node/testing`). */
|
|
359
395
|
declare function memorySink(): MemorySink;
|
|
360
396
|
|
|
361
|
-
export {
|
|
397
|
+
export { defineRuntimeErrors as A, type BreadcrumbInput as B, type CapturedException as C, errorAttributes as D, fileSink as E, type FileSinkOptions as F, isRuntimeErrorLike as G, otlpSink as H, type IgnoreErrorPattern as I, redactAttributes as J, redactText as K, type LoggedErrorSource as L, type MemorySink as M, toClientError as N, type OtlpSinkOptions as O, type RuntimeEvent as R, type RuntimeOutcome as a, type RedactOptions as b, type Redactor$1 as c, type RuntimeLogLevel as d, type RuntimeOperationKind as e, type RuntimeSink as f, type RuntimeLogContext as g, type RuntimeCarrier as h, type CaptureLoggedErrorsOption as i, type Breadcrumb as j, type BreadcrumbLevel as k, type BreadcrumbType as l, memorySink as m, CODE_PATTERN as n, type ClientErrorBody as o, type ConsoleSinkOptions as p, RuntimeError as q, type RuntimeErrorCatalog as r, type RuntimeErrorDefinition as s, type RuntimeErrorExtras as t, type RuntimeErrorFactory as u, type RuntimeErrorLike as v, type RuntimeErrorOptions as w, type RuntimeLogContextValue as x, type RuntimeSinkContext as y, consoleSink as z };
|
package/dist/testing.cjs
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
5
|
+
var _chunkYWTIKZSIcjs = require('./chunk-YWTIKZSI.cjs');
|
|
6
|
+
require('./chunk-BHYHORUD.cjs');
|
|
7
7
|
|
|
8
8
|
// src/testing.ts
|
|
9
9
|
function captureRuntime() {
|
|
10
|
-
const sink =
|
|
11
|
-
const remove =
|
|
10
|
+
const sink = _chunkYWTIKZSIcjs.memorySink.call(void 0, );
|
|
11
|
+
const remove = _chunkYWTIKZSIcjs.addRuntimeSink.call(void 0, sink);
|
|
12
12
|
return {
|
|
13
13
|
get events() {
|
|
14
14
|
return [...sink.events];
|
|
15
15
|
},
|
|
16
16
|
get operations() {
|
|
17
|
-
return sink.events.filter(
|
|
17
|
+
return sink.events.filter(_chunkYWTIKZSIcjs.isSummary);
|
|
18
18
|
},
|
|
19
19
|
get logs() {
|
|
20
|
-
return sink.events.filter((event) => !
|
|
20
|
+
return sink.events.filter((event) => !_chunkYWTIKZSIcjs.isSummary.call(void 0, event));
|
|
21
21
|
},
|
|
22
22
|
get exceptions() {
|
|
23
23
|
return [...sink.exceptions];
|
|
@@ -98,7 +98,7 @@ var OperationExpectation = class {
|
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
100
|
function expectOperation(source, name) {
|
|
101
|
-
const events = Array.isArray(source) ? source.filter(
|
|
101
|
+
const events = Array.isArray(source) ? source.filter(_chunkYWTIKZSIcjs.isSummary) : source.operations;
|
|
102
102
|
const matches = events.filter((event2) => {
|
|
103
103
|
const actual = String(_nullishCoalesce(event2.attributes["autter.operation.name"], () => ( "")));
|
|
104
104
|
return typeof name === "string" ? actual === name : name.test(actual);
|
|
@@ -118,4 +118,4 @@ function expectOperation(source, name) {
|
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
|
|
121
|
-
exports.captureRuntime = captureRuntime; exports.expectOperation = expectOperation; exports.memorySink =
|
|
121
|
+
exports.captureRuntime = captureRuntime; exports.expectOperation = expectOperation; exports.memorySink = _chunkYWTIKZSIcjs.memorySink;
|
package/dist/testing.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-
|
|
2
|
-
export { M as MemorySink, m as memorySink } from './sinks-
|
|
1
|
+
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-CLtQFPnn.cjs';
|
|
2
|
+
export { M as MemorySink, m as memorySink } from './sinks-CLtQFPnn.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test helpers — `@autter/runtime-node/testing`. No ingester, no network:
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-
|
|
2
|
-
export { M as MemorySink, m as memorySink } from './sinks-
|
|
1
|
+
import { R as RuntimeEvent, a as RuntimeOutcome, C as CapturedException } from './sinks-CLtQFPnn.js';
|
|
2
|
+
export { M as MemorySink, m as memorySink } from './sinks-CLtQFPnn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Test helpers — `@autter/runtime-node/testing`. No ingester, no network:
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autter/runtime-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Autter Runtime for Node.js: request wide events, coded errors, operation logging, same-origin browser relay and a curated OpenTelemetry server tracker",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,16 +45,20 @@
|
|
|
45
45
|
"@opentelemetry/sdk-metrics": "^1.30.1",
|
|
46
46
|
"@opentelemetry/sdk-node": "^0.57.1",
|
|
47
47
|
"@opentelemetry/sdk-trace-base": "^1.30.1",
|
|
48
|
-
"@opentelemetry/semantic-conventions": "^1.28.0"
|
|
48
|
+
"@opentelemetry/semantic-conventions": "^1.28.0",
|
|
49
|
+
"require-in-the-middle": "^7.5.2"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@autter/runtime-core": "0.0.0",
|
|
52
53
|
"@types/node": "^22.10.0",
|
|
54
|
+
"bunyan": "^1.8.15",
|
|
53
55
|
"express": "^4.21.2",
|
|
54
56
|
"fastify": "^5.12.5",
|
|
55
57
|
"koa": "^3.2.1",
|
|
58
|
+
"pino": "^10.4.0",
|
|
56
59
|
"tsup": "^8.3.5",
|
|
57
|
-
"typescript": "^5.7.0"
|
|
60
|
+
"typescript": "^5.7.0",
|
|
61
|
+
"winston": "^3.19.0"
|
|
58
62
|
},
|
|
59
63
|
"engines": {
|
|
60
64
|
"node": ">=20"
|