@piwitests/instrumentation-nitro 0.42.0 → 0.44.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/faults.d.ts +1 -1
- package/dist/faults.js +1 -1
- package/dist/index.js +8 -10
- package/dist/probe.d.ts +5 -6
- package/package.json +1 -1
package/dist/faults.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-probe fault classes
|
|
2
|
+
* Server-probe fault classes — the pure decisions the
|
|
3
3
|
* plugin applies to one signed request. Kept side-effect-free so each class is
|
|
4
4
|
* unit-tested without a running server; the plugin owns the throwing, delaying
|
|
5
5
|
* and outbound-call interception these describe.
|
package/dist/faults.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-probe fault classes
|
|
2
|
+
* Server-probe fault classes — the pure decisions the
|
|
3
3
|
* plugin applies to one signed request. Kept side-effect-free so each class is
|
|
4
4
|
* unit-tested without a running server; the plugin owns the throwing, delaying
|
|
5
5
|
* and outbound-call interception these describe.
|
package/dist/index.js
CHANGED
|
@@ -59,9 +59,8 @@ function markProbeApplied(store) {
|
|
|
59
59
|
/** Signed probe nonces already honored this process, so a header is single-use. */
|
|
60
60
|
const probeNonces = new ProbeNonceCache();
|
|
61
61
|
// Links consola calls and recorded spans to the request being handled. The store
|
|
62
|
-
// is scoped with als.run() around the whole downstream handler chain
|
|
63
|
-
// enterWith() from a request hook
|
|
64
|
-
// the hook's own async scope, so only the first request after boot would capture).
|
|
62
|
+
// is scoped with als.run() around the whole downstream handler chain: a binding
|
|
63
|
+
// made with enterWith() from a request hook dies with the hook's own async scope.
|
|
65
64
|
const als = new AsyncLocalStorage();
|
|
66
65
|
/**
|
|
67
66
|
* Record a server-side span for the in-flight request. Shows up in the Piwi
|
|
@@ -76,9 +75,9 @@ export function recordServerSpan(span) {
|
|
|
76
75
|
}
|
|
77
76
|
// The consola reporter is process-global — register it only once.
|
|
78
77
|
let reporterAdded = false;
|
|
79
|
-
// Capture and probe verification run only outside production
|
|
80
|
-
//
|
|
81
|
-
// `development`/`test` is treated as non-production. Any other value
|
|
78
|
+
// Capture and probe verification run only outside production (the ASP.NET
|
|
79
|
+
// package's default allow-list is Development and Test): only an unset/empty
|
|
80
|
+
// NODE_ENV or `development`/`test` is treated as non-production. Any other value
|
|
82
81
|
// (`production`, `staging`, `prod`, …) disables capture unless
|
|
83
82
|
// PIWI_TEST_LOGS_DISABLED is explicitly `false`, so a signed probe header is
|
|
84
83
|
// never honored on a production-like deployment that skipped `NODE_ENV=production`.
|
|
@@ -96,10 +95,9 @@ const MANIFEST_PATH = '/__piwi/manifest';
|
|
|
96
95
|
*/
|
|
97
96
|
const observedRoutes = new Map();
|
|
98
97
|
/**
|
|
99
|
-
* Server probes stay off unless
|
|
100
|
-
*
|
|
101
|
-
* is applied
|
|
102
|
-
* on.
|
|
98
|
+
* Server probes stay off unless `PIWI_SERVER_PROBES=true`. When off (the
|
|
99
|
+
* default), a signed probe header is still verified and recorded, but no fault
|
|
100
|
+
* is applied.
|
|
103
101
|
*/
|
|
104
102
|
const SERVER_PROBES_ENABLED = process.env.PIWI_SERVER_PROBES === 'true';
|
|
105
103
|
/**
|
package/dist/probe.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Server-probe support
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* default (see the README).
|
|
2
|
+
* Server-probe support. A probe run signs a fault spec into the `X-Piwi-Probe`
|
|
3
|
+
* request header; the instrumentation verifies the signature here and, when
|
|
4
|
+
* server probes are enabled (`PIWI_SERVER_PROBES=true`, off by default — see the
|
|
5
|
+
* README), applies the fault inside the request scope. With server probes off,
|
|
6
|
+
* the header is only parsed and verified.
|
|
8
7
|
*/
|
|
9
8
|
/** A fault the probe run asks the server to apply to one request. */
|
|
10
9
|
export interface PiwiProbeSpec {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piwitests/instrumentation-nitro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"description": "Nitro/Nuxt server plugin for sending backend logs to Piwi Dashboard via the X-Piwi-Logs response header",
|
|
5
5
|
"homepage": "https://piwitests.dev",
|
|
6
6
|
"repository": {
|