🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@nxtedition/trace

Package Overview
Dependencies
Maintainers
12
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nxtedition/trace - npm Package Compare versions

Comparing version
1.1.4
to
2.0.0
+19
lib/core.d.ts
/**
* Lightweight trace-writer primitives shared by hot-path consumers.
*
* Keep this module free of RxJS and transport dependencies: scheduler, HTTP,
* cache and SMB all import it even when no trace is ever constructed.
*/
export interface TraceWriter {
write: ((obj: object, op: string) => void) | null;
}
export declare function installTrace(trace: TraceWriter | undefined): void;
export declare function getTrace(): TraceWriter | undefined;
export declare function getTraceCount(): number;
export declare function traceWrite(trace: TraceWriter | null | undefined): TraceWriter['write'];
export declare function validateTrace(trace: unknown): TraceWriter | null | undefined;
export declare function traceSafe(write: (obj: object, op: string) => void, obj: object, op: string): void;
/** Return a bounded, exception-safe, low-cardinality error tag. */
export declare function traceErr(err: unknown): string;
export declare function genTracerId(): number;
//# sourceMappingURL=core.d.ts.map
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;CAClD;AAoBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAMjE;AAED,wBAAgB,QAAQ,IAAI,WAAW,GAAG,SAAS,CAElD;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAStF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,CAkB5E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAMjG;AA4ED,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAE7C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAWpC"}
/**
* Lightweight trace-writer primitives shared by hot-path consumers.
*
* Keep this module free of RxJS and transport dependencies: scheduler, HTTP,
* cache and SMB all import it even when no trace is ever constructed.
*/
const TraceSymbol = Symbol.for('@nxtedition/app/trace');
const TraceCounterSymbol = Symbol.for('@nxtedition/app/traceCounter');
const TracerIdSymbol = Symbol.for('@nxtedition/app/tracerId');
const traceGlobals = globalThis;
// A module-local mirror keeps the per-operation default lookup to one variable
// read. The interval only synchronizes installs performed by another physical
// copy of this package in the same thread.
let globalTrace = traceGlobals[TraceSymbol];
setInterval(() => {
globalTrace = traceGlobals[TraceSymbol];
}, 1e3).unref();
export function installTrace(trace) {
if (trace !== undefined) {
validateTrace(trace);
}
traceGlobals[TraceSymbol] = trace;
globalTrace = trace;
}
export function getTrace() {
return traceGlobals[TraceSymbol];
}
export function getTraceCount() {
return traceGlobals[TraceCounterSymbol] ?? 0;
}
export function traceWrite(trace) {
try {
const writer = (trace === undefined ? globalTrace : trace)?.write;
return typeof writer === 'function' ? writer : null;
}
catch {
// A caller-mutable writer (or Proxy) must not turn tracing into a failure
// path before traceSafe gets a chance to contain the actual invocation.
return null;
}
}
export function validateTrace(trace) {
if (trace === undefined || trace === null) {
return trace;
}
try {
if ((typeof trace !== 'object' && typeof trace !== 'function') || !('write' in trace)) {
throw new Error('Invalid trace');
}
const write = trace.write;
if (write !== null && typeof write !== 'function') {
throw new Error('Invalid trace');
}
}
catch {
throw new Error('Invalid trace');
}
return trace;
}
export function traceSafe(write, obj, op) {
try {
write(obj, op);
}
catch (err) {
process.emitWarning(err instanceof Error ? err : new Error(traceErr(err)));
}
}
const TRACE_ERR_LIMIT = 64;
function joinTraceErrors(errors, limit, active) {
if (active.has(errors)) {
return 'unknown'.slice(0, limit);
}
active.add(errors);
try {
let result = '';
for (let i = 0; i < errors.length && result.length < limit; i++) {
if (i > 0) {
result += ',';
if (result.length >= limit) {
break;
}
}
result += traceErrPart(errors[i], limit - result.length, active);
}
return result.slice(0, limit);
}
catch {
return resultOrUnknown('', limit);
}
finally {
active.delete(errors);
}
}
function resultOrUnknown(result, limit) {
return (result || 'unknown').slice(0, limit);
}
function traceErrPart(err, limit, active) {
if (limit <= 0) {
return '';
}
try {
if (Array.isArray(err)) {
return resultOrUnknown(joinTraceErrors(err, limit, active ?? new WeakSet()), limit);
}
const value = err;
const code = value?.code;
if (typeof code === 'string' && code !== '') {
return code.slice(0, limit);
}
const errors = value?.errors;
if (Array.isArray(errors) && errors.length > 0) {
active ??= new WeakSet();
if (typeof err === 'object' && err !== null) {
if (active.has(err)) {
return 'unknown'.slice(0, limit);
}
active.add(err);
try {
return resultOrUnknown(joinTraceErrors(errors, limit, active), limit);
}
finally {
active.delete(err);
}
}
return resultOrUnknown(joinTraceErrors(errors, limit, active), limit);
}
const message = value?.message;
if (typeof message === 'string' && message !== '') {
return message.slice(0, limit);
}
return String(err).slice(0, limit);
}
catch {
return 'unknown'.slice(0, limit);
}
}
/** Return a bounded, exception-safe, low-cardinality error tag. */
export function traceErr(err) {
return resultOrUnknown(traceErrPart(err, TRACE_ERR_LIMIT), TRACE_ERR_LIMIT);
}
export function genTracerId() {
const current = traceGlobals[TracerIdSymbol];
const next = typeof current === 'number' &&
Number.isSafeInteger(current) &&
current >= 0 &&
current < Number.MAX_SAFE_INTEGER
? current + 1
: 1;
traceGlobals[TracerIdSymbol] = next;
return next;
}
//# sourceMappingURL=core.js.map
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA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,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,OAAO,eAAe,CAAC,YAAY,CAAC,GAAG,EAAE,eAAe,CAAC,EAAE,eAAe,CAAC,CAAA;AAC7E,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,MAAM,OAAO,GAAG,YAAY,CAAC,cAAc,CAAC,CAAA;IAC5C,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ;QAC3B,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC;QAC7B,OAAO,IAAI,CAAC;QACZ,OAAO,GAAG,MAAM,CAAC,gBAAgB;QAC/B,CAAC,CAAC,OAAO,GAAG,CAAC;QACb,CAAC,CAAC,CAAC,CAAA;IACP,YAAY,CAAC,cAAc,CAAC,GAAG,IAAI,CAAA;IACnC,OAAO,IAAI,CAAA;AACb,CAAC"}
+5
-56
import * as rxjs from 'rxjs';
import { type TraceWriter } from './core.ts';
export { genTracerId, getTrace, getTraceCount, installTrace, traceErr, traceSafe, traceWrite, validateTrace, type TraceWriter, } from './core.ts';
/**
* The makeTrace writer contract consumed across the lib packages (smb, cache,
* scheduler, http): `write` is the trace function while tracing is enabled and
* null while disabled, so call sites gate on it at zero cost when off.
*
* Contract: `write` must not call back into the instance being traced —
* emission happens inside dispatch/park control flow, and reentrancy there is
* unsupported (makeTrace's writer is a plain string append and satisfies this).
*/
export interface TraceWriter {
write: ((obj: object, op: string) => void) | null;
}
/**
* Install (or clear, with undefined) the per-thread default writer. Writes
* the shared slots — the cross-copy source of truth — AND this copy's mirror
* synchronously, so the installing thread traces immediately instead of
* waiting out the mirror interval. Used by `@nxtedition/app`'s
* traceMiddleware; tests toggling the default writer must use this too.
*/
export declare function installTrace(trace: TraceWriter | undefined): void;
/**
* The currently installed per-thread default writer, if any — the same
* resolution the mirror refreshes from. For deciding whether to install/warn
* (traceMiddleware) or for diagnostics; per-operation code should use
* traceWrite, which reads the mirror.
*/
export declare function getTrace(): TraceWriter | undefined;
/**
* Number of currently *enabled* traces in this thread: each makeTrace bumps
* this while its enabled$ stream says on and drops it when disabled or disposed
* — the monitor middleware surfaces this as the per-thread trace status.
*/
export declare function getTraceCount(): number;
/**
* Resolve the effective trace write fn for an operation: an explicit option
* wins (null = tracing disabled for this instance); when the option is absent,
* fall back to the per-thread writer `@nxtedition/app`'s traceMiddleware
* installs (installTrace). Resolved lazily per operation —
* the global may be installed after an instance is constructed, and `write`
* flips between fn and null at runtime.
*/
export declare function traceWrite(trace: TraceWriter | null | undefined): TraceWriter['write'];
export declare function validateTrace(trace: unknown): TraceWriter | null | undefined;
/**
* Emit a trace doc from inside dispatch/park/slot-accounting or request
* control flow. Tracing is auxiliary — a throwing writer must never strand
* slots, abort a drain loop, fail a request, or crash a timer callback.
* Surface the failure as a process warning instead of rethrowing.
*/
export declare function traceSafe(w: (obj: object, op: string) => void, obj: object, op: string): void;
export declare function traceErr(err: unknown): string;
export declare function genTracerId(): number;
/**
* Force-enable tracing for `serviceName` in every thread of this process

@@ -101,3 +51,3 @@ * until `until` (epoch ms). Re-posting with a later `until` slides the

export interface MakeTraceOptions {
url: string | string[];
url: string;
stringify?: (obj: unknown) => string;

@@ -107,4 +57,2 @@ index: string;

limit?: number;
/** @deprecated Compat: push the disposer here instead of using Symbol.asyncDispose. */
destroyers?: Array<() => Promise<void>> | null;
logger: TraceLogger;

@@ -121,5 +69,6 @@ serviceName: string;

flush: () => Promise<void>;
readonly enabled$: rxjs.Observable<boolean | null>;
[Symbol.asyncDispose]: () => Promise<void>;
}
export declare function makeTrace({ url, stringify, index, batch, limit, destroyers, logger, serviceName, enabled$: userEnabled$, ds, }: MakeTraceOptions): Trace;
export declare function makeTrace({ url, stringify, index, batch, limit, logger, serviceName, enabled$: userEnabled$, ds, }: MakeTraceOptions): Trace;
//# sourceMappingURL=index.d.ts.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAmB5B;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;CAClD;AA8BD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,IAAI,CAGjE;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,IAAI,WAAW,GAAG,SAAS,CAElD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAOtF;AAMD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,CAgB5E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAQ7F;AAQD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA2B7C;AAMD,wBAAgB,WAAW,IAAI,MAAM,CAIpC;AA4BD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAanE;AAeD,eAAO,MAAM,aAAa,QAAO,CAAA;AACjC,eA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,GAAG,IAAI,CAAA;IACxC,SAAS,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,MAAM,CAAA;IACnC,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;IAC1D,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;IAC1D,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,CAAA;IAClD,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C;AAiBD,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,SAA0B,EAC1B,KAAK,EACL,KAAa,EACb,KAAY,EACZ,MAAM,EACN,WAAW,EACX,QAAQ,EAAE,YAAmB,EAC7B,EAAS,GACV,EAAE,gBAAgB,GAAG,KAAK,CAsgB1B"}
+490
-404
import { threadId } from 'node:worker_threads';
import fp from 'lodash/fp.js';
import * as rxjs from 'rxjs';
import assert from 'node:assert/strict';
import { getTrace, installTrace } from './core.js';
export { genTracerId, getTrace, getTraceCount, installTrace, traceErr, traceSafe, traceWrite, validateTrace, } from './core.js';
// nxt-undici is loaded lazily at first flush, NOT statically: it depends on

@@ -16,157 +16,18 @@ // @nxtedition/scheduler, which depends on this package — a static import here

if (undici === null) {
undici = await (undiciImport ??= import('@nxtedition/nxt-undici'));
undiciImport ??= import('@nxtedition/nxt-undici').catch((err) => {
// A transient loader failure must not poison every later flush with the
// same permanently-rejected promise.
undiciImport = null;
throw err;
});
undici = await undiciImport;
}
return undici;
}
// Symbol.for-keyed slots (the http package's cross-realm registry convention):
// same key in every copy/realm of this package, collision-proof against other
// globals. `declare global` cannot express computed-name vars, so access goes
// through the typed cast below. These slots are the ONLY registry — consumers
// resolve through getTrace()/traceWrite() (or read the Symbol.for slot
// directly where depending on this package is impossible).
const TraceSymbol = Symbol.for('@nxtedition/app/trace');
const TraceCounterSymbol = Symbol.for('@nxtedition/app/traceCounter');
const TracerIdSymbol = Symbol.for('@nxtedition/app/tracerId');
const traceGlobals = globalThis;
// Module-local mirror of the global slot so the per-operation resolution in
// traceWrite is a plain variable read instead of a globalThis property access
// on hot paths. The mirror caches the writer OBJECT — runtime enable/disable
// (the `write` null-flip) stays instantaneous; only install/clear of the slot
// itself propagates lazily. installTrace() updates this copy synchronously;
// the 1s interval only catches writers installed by a DIFFERENT copy of this
// package writing the Symbol.for slot.
let globalTrace = traceGlobals[TraceSymbol];
setInterval(() => {
globalTrace = traceGlobals[TraceSymbol];
}, 1e3).unref();
/**
* Install (or clear, with undefined) the per-thread default writer. Writes
* the shared slots — the cross-copy source of truth — AND this copy's mirror
* synchronously, so the installing thread traces immediately instead of
* waiting out the mirror interval. Used by `@nxtedition/app`'s
* traceMiddleware; tests toggling the default writer must use this too.
*/
export function installTrace(trace) {
traceGlobals[TraceSymbol] = trace;
globalTrace = trace;
}
/**
* The currently installed per-thread default writer, if any — the same
* resolution the mirror refreshes from. For deciding whether to install/warn
* (traceMiddleware) or for diagnostics; per-operation code should use
* traceWrite, which reads the mirror.
*/
export function getTrace() {
return traceGlobals[TraceSymbol];
}
/**
* Number of currently *enabled* traces in this thread: each makeTrace bumps
* this while its enabled$ stream says on and drops it when disabled or disposed
* — the monitor middleware surfaces this as the per-thread trace status.
*/
export function getTraceCount() {
return traceGlobals[TraceCounterSymbol] ?? 0;
}
/**
* Resolve the effective trace write fn for an operation: an explicit option
* wins (null = tracing disabled for this instance); when the option is absent,
* fall back to the per-thread writer `@nxtedition/app`'s traceMiddleware
* installs (installTrace). Resolved lazily per operation —
* the global may be installed after an instance is constructed, and `write`
* flips between fn and null at runtime.
*/
export function traceWrite(trace) {
const t = trace === undefined ? globalTrace : trace;
const w = t?.write;
// typeof guard rather than a bare nullish check: `write` is caller-mutable
// at runtime, and a truthy non-function must resolve to "disabled" instead
// of a deferred TypeError at the emission site.
return typeof w === 'function' ? w : null;
}
// Functions are accepted alongside objects: makeTrace's canonical writer is a
// callable with `write` assigned onto itself. `write` itself must be a
// function or null AT VALIDATION TIME (it flips between the two at runtime) —
// a `{ write: 42 }` writer must fail fast here, not silently never trace.
export function validateTrace(trace) {
if (trace !== undefined && trace !== null) {
if ((typeof trace !== 'object' && typeof trace !== 'function') || !('write' in trace)) {
throw new Error('Invalid trace');
}
let write;
try {
write = trace.write;
}
catch {
throw new Error('Invalid trace');
}
if (write !== null && typeof write !== 'function') {
throw new Error('Invalid trace');
}
}
return trace;
}
/**
* Emit a trace doc from inside dispatch/park/slot-accounting or request
* control flow. Tracing is auxiliary — a throwing writer must never strand
* slots, abort a drain loop, fail a request, or crash a timer callback.
* Surface the failure as a process warning instead of rethrowing.
*/
export function traceSafe(w, obj, op) {
try {
w(obj, op);
}
catch (err) {
// traceErr (never throws) rather than String(err): a writer throwing a
// non-stringifiable value must not escape the containment either.
process.emitWarning(err instanceof Error ? err : new Error(traceErr(err)));
}
}
// Short, bounded error tag for trace docs — prefer the error code so the field
// maps to one low-cardinality keyword in the trace index. AggregateError and
// Error arrays tag each member (comma-joined, still bounded). Must never
// throw: it is evaluated while building docs inside slot-accounting control
// flow, so a poisoned error value (throwing getter, unstringifiable object,
// cyclic aggregate) must yield a fallback tag, not a new throw path.
export function traceErr(err) {
try {
if (Array.isArray(err)) {
return err
.map((e) => traceErr(e))
.join(',')
.slice(0, 64);
}
const e = err;
if (typeof e?.code === 'string' && e.code !== '') {
return e.code.slice(0, 64);
}
// AggregateError (and anything else carrying an `errors` array): the
// members are more specific than the generic top-level message.
if (Array.isArray(e?.errors) && e.errors.length > 0) {
return e.errors
.map((x) => traceErr(x))
.join(',')
.slice(0, 64);
}
if (typeof e?.message === 'string' && e.message !== '') {
return e.message.slice(0, 64);
}
return String(err).slice(0, 64);
}
catch {
return 'unknown';
}
}
// Per-thread monotonically increasing id for stamping trace docs from multiple
// instances of a traced component (scheduler/limiter/smb client, …) so their
// docs stay distinguishable within one pid/tid. Shared across components — the
// op prefix already namespaces them.
export function genTracerId() {
const next = (traceGlobals[TracerIdSymbol] ?? 0) + 1;
traceGlobals[TracerIdSymbol] = next;
return next;
}
const maxInt = 2147483647;
let nextTraceId = Math.floor(Math.random() * maxInt);
const MAX_INT_32 = 2147483647;
let nextTraceId = Math.floor(Math.random() * MAX_INT_32);
function genTraceId() {
nextTraceId = (nextTraceId + 1) & maxInt;
nextTraceId = (nextTraceId + 1) & MAX_INT_32;
return nextTraceId;

@@ -190,2 +51,68 @@ }

let forceChannel = null;
const forceWindows = new Map();
const forceListeners = new Set();
function applyForceWindow(serviceName, until) {
if (until > Date.now()) {
forceWindows.set(serviceName, until);
}
else {
forceWindows.delete(serviceName);
}
for (const listener of forceListeners) {
listener(serviceName, until);
}
}
function ensureForceChannel() {
if (forceChannel === null) {
forceChannel = new BroadcastChannel(TRACE_FORCE_CHANNEL);
forceChannel.unref();
forceChannel.onmessage = (event) => {
const data = event?.data;
if (data != null &&
typeof data.serviceName === 'string' &&
data.serviceName !== '' &&
typeof data.until === 'number' &&
Number.isFinite(data.until)) {
applyForceWindow(data.serviceName, data.until);
}
};
}
return forceChannel;
}
function unrefTimer(delay) {
return new rxjs.Observable((subscriber) => {
const timer = setTimeout(() => {
subscriber.next();
subscriber.complete();
}, Math.min(Math.max(delay, 0), MAX_INT_32)).unref();
return () => clearTimeout(timer);
});
}
function forceWindow(until) {
return new rxjs.Observable((subscriber) => {
let timer = null;
const check = () => {
const remaining = until - Date.now();
if (remaining <= 0) {
subscriber.next(false);
subscriber.complete();
return;
}
timer = setTimeout(check, Math.min(remaining, MAX_INT_32)).unref();
};
if (until > Date.now()) {
subscriber.next(true);
check();
}
else {
subscriber.next(false);
subscriber.complete();
}
return () => {
if (timer !== null) {
clearTimeout(timer);
}
};
});
}
/**

@@ -203,13 +130,12 @@ * Force-enable tracing for `serviceName` in every thread of this process

}
if (forceChannel == null) {
forceChannel = new BroadcastChannel(TRACE_FORCE_CHANNEL);
// The poster must never keep an otherwise-finished process alive.
forceChannel.unref();
}
forceChannel.postMessage({ serviceName, until });
// Apply locally before broadcasting so the detector's activation sample can
// be captured in the same tick. BroadcastChannel delivery covers workers
// and other physical copies of this package.
applyForceWindow(serviceName, until);
ensureForceChannel().postMessage({ serviceName, until });
}
// Auto-trace window/throttle state machine (pure, so it is unit-testable —
// callers wire it to their live pressure signal + clock and forceTrace()).
// Ported verbatim from nxt render/src/lib/auto-trace.js so every service
// shares the same episode/window/day-cap semantics.
// Shared with nxt render's auto-trace driver so every service uses the same
// episode/window/day-cap semantics.
//

@@ -244,2 +170,16 @@ // Model: while a pressure `reason` is present, (re)arm a sliding AUTO_TRACE_MS

export function stepAutoTrace(state, reason, manual, now) {
// Keep the advertised rolling-day count accurate even on quiet/manual ticks.
let expired = 0;
while (expired < state.starts.length && now - state.starts[expired] > DAY_MS) {
expired++;
}
if (expired > 0) {
state.starts.splice(0, expired);
}
// A capped chronic-pressure episode must observe an OFF tick before it can
// consume another daily slot; otherwise it reactivates immediately at the
// exact cap and tracing never actually turns off.
if (!reason && now >= state.until) {
state.episodeStart = 0;
}
let activated = false;

@@ -252,8 +192,8 @@ if (reason && !manual) {

if (now - state.episodeStart < AUTO_TRACE_MAX_EPISODE_MS) {
state.until = now + AUTO_TRACE_MS;
state.until = Math.min(now + AUTO_TRACE_MS, state.episodeStart + AUTO_TRACE_MAX_EPISODE_MS);
}
}
else {
else if (state.episodeStart === 0 ||
state.until < state.episodeStart + AUTO_TRACE_MAX_EPISODE_MS) {
// New episode (OFF→ON). Enforce the rolling daily cap.
state.starts = state.starts.filter((t) => now - t <= DAY_MS);
if (state.starts.length < AUTO_TRACE_MAX_PER_DAY) {

@@ -269,12 +209,17 @@ state.starts.push(now);

}
// A `debug`-array entry enables tracing for a service, optionally scoped to a
// single logged-in user via `{user}@{serviceName}`. A bare `{serviceName}`
// entry (no `{user}@` prefix) matches regardless of who is connected. The user
// segment forbids `@` so the split is unambiguous; the service segment takes
// the remainder.
const DEBUG_ENTRY_RE = /^(?:(?<user>[^@]+)@)?(?<serviceName>.+)$/;
export function makeTrace({ url, stringify = JSON.stringify, index, batch = 256e3, limit = 32e6, destroyers = null, logger, serviceName, enabled$: userEnabled$ = null, ds = null, }) {
const HEADERS = { 'content-type': 'application/x-ndjson' };
let pending = 0;
let enabled = null;
const BULK_HEADERS = { 'content-type': 'application/x-ndjson' };
const DROP_REPORT_INTERVAL = 10e3;
function normalizeToggle(value) {
if (typeof value === 'boolean') {
return value;
}
try {
const enabled = value?.enabled;
return typeof enabled === 'boolean' ? enabled : null;
}
catch {
return null;
}
}
export function makeTrace({ url, stringify = JSON.stringify, index, batch = 256e3, limit = 32e6, logger, serviceName, enabled$: userEnabled$ = null, ds = null, }) {
if (typeof stringify !== 'function') {

@@ -289,20 +234,86 @@ throw new TypeError('trace.stringify must be a function');

}
// Validate before creating the interval/Agent below so an invalid enabled$
// can't throw and leak those resources.
if (typeof batch !== 'number' || !Number.isFinite(batch) || batch <= 0) {
throw new TypeError('trace.batch must be a positive finite number');
}
if (typeof limit !== 'number' || !Number.isFinite(limit) || limit < 0) {
throw new TypeError('trace.limit must be a non-negative finite number');
}
if (typeof url !== 'string' || url === '') {
throw new TypeError('trace.url must be a non-empty string');
}
let bulkUrl;
try {
bulkUrl = new URL('/_bulk?filter_path=errors,items.*.error', url);
if (bulkUrl.protocol !== 'http:' && bulkUrl.protocol !== 'https:') {
throw new TypeError('unsupported protocol');
}
}
catch (err) {
throw new TypeError('trace.url must be an absolute HTTP(S) URL', { cause: err });
}
for (const method of ['debug', 'info', 'warn', 'error']) {
if (typeof logger?.[method] !== 'function') {
throw new TypeError(`trace.logger.${method} must be a function`);
}
}
if (userEnabled$ != null && !rxjs.isObservable(userEnabled$)) {
throw new TypeError('trace.enabled$ must be an Observable');
}
// A trace is off by default and only a stream (a ds record or enabled$) can
// turn it on, so require one here rather than silently constructing a trace
// that could never trace. Checked before the interval/Agent below so a throw
// can't leak them.
if (ds == null && userEnabled$ == null) {
throw new TypeError('trace must have either ds or enabled$');
const safeLog = (method, first, message) => {
try {
if (message === undefined) {
logger[method](first);
}
else {
logger[method](first, message);
}
}
catch (err) {
process.emitWarning(err instanceof Error ? err : new Error('trace logger failed', { cause: err }));
}
};
let recordEnabled$ = null;
if (ds !== null) {
if (typeof ds.record?.observe !== 'function') {
throw new TypeError('trace.ds.record.observe must be a function');
}
let service$;
let debug$;
try {
service$ = ds.record.observe(serviceName, 'trace');
debug$ = ds.record.observe('debug', 'trace');
}
catch (err) {
throw new TypeError('trace.ds.record.observe failed', { cause: err });
}
if (!rxjs.isObservable(service$) || !rxjs.isObservable(debug$)) {
throw new TypeError('trace.ds.record.observe must return an Observable');
}
const toggles = rxjs.combineLatest([service$, debug$]).pipe(rxjs.map(([service, debug]) => {
const serviceToggle = normalizeToggle(service);
if (serviceToggle !== null) {
return serviceToggle;
}
let debugValue = debug;
if (Array.isArray(debug)) {
const userEntry = ds.user == null ? null : `${ds.user}@${serviceName}`;
// Arrays are enable-lists: absence is "unset", not an explicit false.
return debug.some((entry) => entry === serviceName || (userEntry !== null && entry === userEntry))
? true
: null;
}
if (typeof debug === 'object' && debug !== null) {
try {
debugValue = debug[serviceName];
}
catch {
debugValue = null;
}
}
return normalizeToggle(debugValue);
}));
// Force/user streams must be able to control tracing while DS is still
// waiting for their first record values.
recordEnabled$ = rxjs.concat(rxjs.of(null), toggles);
}
// unref: @nxtedition/app relies on the event loop draining so beforeExit can
// fire and trigger disposal — a ref'd interval would keep an otherwise-
// finished process alive forever. Symbol.asyncDispose does a final flush on
// shutdown.
const flushInterval = setInterval(() => void flushTraces(), 10e3).unref();
const traceUrl = Array.isArray(url) ? url[0] : url;
// Created lazily on first flush together with the nxt-undici import (see

@@ -312,14 +323,71 @@ // loadUndici) — construction must not close the module cycle.

let client = null;
logger.info({ url: traceUrl }, 'trace initialized');
let traceData = '';
async function flushTraces() {
if (!traceData) {
safeLog('info', { url }, 'trace initialized');
if (recordEnabled$ !== null) {
safeLog('info', { serviceName }, 'trace enabled$ created from ds.record.observe');
}
const header = `${JSON.stringify({ create: { _index: `trace-${index}` } })}\n`;
const headerBytes = Buffer.byteLength(header);
const postfix = `,"serviceName":${JSON.stringify(serviceName)},"pid":${process.pid},"tid":${threadId}}\n`;
let enabled = null;
let disposed = false;
let pendingBytes = 0;
let bufferedBytes = 0;
let bufferedDocuments = 0;
let bufferedLosses = 0;
const buffer = [];
const lossWeights = [];
const inFlight = new Set();
const appendDocument = (document, representedLosses = 1) => {
buffer.push(header, document);
lossWeights.push(representedLosses);
bufferedBytes += headerBytes + Buffer.byteLength(document);
bufferedDocuments++;
bufferedLosses += representedLosses;
};
const appendDropMarker = (count, reason) => {
if (count <= 0) {
return;
}
const data = traceData;
traceData = '';
pending += data.length;
appendDocument(`${JSON.stringify({
count,
reason,
traceId: genTraceId(),
'@timestamp': Date.now(),
op: 'trace:dropped',
serviceName,
pid: process.pid,
tid: threadId,
})}\n`, count);
};
const takeBatch = () => {
if (bufferedDocuments === 0) {
return null;
}
const result = {
data: buffer.join(''),
bytes: bufferedBytes,
documents: bufferedDocuments,
losses: bufferedLosses,
lossWeights: lossWeights.splice(0),
};
buffer.length = 0;
bufferedBytes = 0;
bufferedDocuments = 0;
bufferedLosses = 0;
return result;
};
const itemError = (item) => {
if (typeof item !== 'object' || item === null) {
return null;
}
for (const action in item) {
const error = item[action]?.error;
if (typeof error === 'object' && error !== null) {
return error;
}
}
return null;
};
const sendBatch = async (current) => {
try {
// Cached after the first flush — see loadUndici; the common steady-state
// path costs one null check, no promise hop.
const { request, Agent } = undici ?? (await loadUndici());

@@ -331,23 +399,17 @@ client ??= new Agent({

});
// filter_path trims the bulk response to the errors flag + per-item
// errors, so inspecting rejections costs nothing on the happy path
// (a clean response is just {"errors":false}). ES answers HTTP 200
// with errors:true for per-item rejections (mapping conflicts, field
// caps) — the body used to be dumped unchecked, which made every such
// rejection an invisible gap in the trace window: outside both the
// NXT_TRACE_DROPPED accounting and the 'trace failed' log.
const { statusCode, body } = await request(new URL('/_bulk?filter_path=errors,items.*.error', traceUrl), {
const { statusCode, body } = await request(bulkUrl, {
method: 'POST',
idempotent: true,
headers: HEADERS,
headers: BULK_HEADERS,
headersTimeout: 60e3,
bodyTimeout: 60e3,
body: data,
body: current.data,
dispatcher: client,
retry: 4,
// The trace sink must never feed its own undici request docs back into
// itself, otherwise every flush permanently schedules the next flush.
trace: null,
});
const text = await body.text();
if (statusCode >= 400) {
// undici's retry already handled retryable failures — a status that
// still arrives here means the whole batch was not indexed.
if (statusCode < 200 || statusCode >= 300) {
throw Object.assign(new Error(`bulk request failed: ${statusCode}`), {

@@ -358,101 +420,226 @@ statusCode,

}
let res = null;
let response;
try {
res = JSON.parse(text);
response = JSON.parse(text);
}
catch {
// A non-JSON 2xx body has nothing actionable.
catch (err) {
throw new Error('bulk request returned invalid JSON', { cause: err });
}
if (res?.errors) {
// filter_path keeps only the items that carry an error, so the array
// length IS the rejection count.
const items = Array.isArray(res.items) ? res.items : [];
const sample = items
.map((item) => item != null && typeof item === 'object'
? Object.values(item)[0]?.error
: undefined)
.find(Boolean);
if (items.length > 0) {
logger.warn({
code: 'NXT_TRACE_REJECTED',
count: items.length,
index,
type: sample?.type,
reason: typeof sample?.reason === 'string' ? sample.reason.slice(0, 256) : undefined,
}, 'trace rejected');
// Same in-index convention as the backpressure marker below: a gap
// in a trace window must be distinguishable from quiescence.
// `reason` labels the loss class.
traceData += header;
traceData += `{"count":${items.length},"reason":"rejected","traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"trace:dropped${postfix}`;
if (response === null || typeof response.errors !== 'boolean') {
throw new Error('bulk request returned an invalid response');
}
if (!response.errors) {
return;
}
const items = Array.isArray(response.items) ? response.items : [];
let rejectedDocuments = 0;
let rejectedLosses = 0;
let sample = null;
for (let i = 0; i < items.length; i++) {
const item = items[i];
const error = itemError(item);
if (error !== null) {
rejectedDocuments++;
rejectedLosses += current.lossWeights[i] ?? 1;
sample ??= error;
}
}
if (rejectedDocuments === 0) {
throw new Error('bulk request reported errors without item details');
}
safeLog('warn', {
code: 'NXT_TRACE_REJECTED',
count: rejectedLosses,
documents: rejectedDocuments,
index,
type: sample?.type,
reason: typeof sample?.reason === 'string' ? sample.reason.slice(0, 256) : undefined,
}, 'trace rejected');
appendDropMarker(rejectedLosses, 'rejected');
}
catch (err) {
// Bounded head only — during an ES outage every failed flush would
// otherwise attach up to `batch` bytes of payload to the error log.
const count = data.split(header).length - 1;
logger.error({ err, bytes: data.length, count, data: data.slice(0, 4096) }, 'trace failed');
// The whole batch is lost — leave the loss marker for the window; it is
// indexed by the next successful flush. Persistent outages compound the
// counts (a marker for lost markers), which is self-describing.
traceData += header;
traceData += `{"count":${count},"reason":"failed","traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"trace:dropped${postfix}`;
safeLog('error', {
err,
bytes: current.bytes,
documents: current.documents,
count: current.losses,
data: current.data.slice(0, 4096),
}, 'trace failed');
appendDropMarker(current.losses, 'failed');
}
finally {
pending -= data.length;
};
const startFlush = () => {
const current = takeBatch();
if (current === null) {
return null;
}
}
const header = `{"create":{"_index":"trace-${index}"}}\n`;
const postfix = `","serviceName":"${serviceName}","pid":${process.pid},"tid":${threadId}}\n`;
let dropCount = 0;
const markDrop = fp.throttle(10e3, () => {
if (!dropCount) {
pendingBytes += current.bytes;
const operation = sendBatch(current);
const tracked = operation.finally(() => {
pendingBytes -= current.bytes;
inFlight.delete(tracked);
});
inFlight.add(tracked);
return tracked;
};
const awaitInFlight = async () => {
while (inFlight.size > 0) {
await Promise.all(inFlight);
}
};
let lastDropReport = 0;
let dropTimer = null;
const dropCounts = new Map();
const emitDrops = () => {
if (dropTimer !== null) {
clearTimeout(dropTimer);
dropTimer = null;
}
if (dropCounts.size === 0) {
return;
}
logger.warn({ code: 'NXT_TRACE_DROPPED', count: dropCount, index }, 'trace dropped');
// Also record the loss in-index — otherwise a gap in a trace window is
// indistinguishable from quiescence. The marker bypasses the pending limit
// (it must land precisely when everything else is being dropped) but is
// bounded by the throttle to one small doc per window.
traceData += header;
traceData += `{"count":${dropCount},"traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"trace:dropped${postfix}`;
dropCount = 0;
});
lastDropReport = Date.now();
for (const [reason, count] of dropCounts) {
safeLog('warn', { code: 'NXT_TRACE_DROPPED', count, index, reason }, 'trace dropped');
appendDropMarker(count, reason);
}
dropCounts.clear();
};
const markDrop = (reason) => {
dropCounts.set(reason, (dropCounts.get(reason) ?? 0) + 1);
const remaining = DROP_REPORT_INTERVAL - (Date.now() - lastDropReport);
if (lastDropReport === 0 || remaining <= 0) {
emitDrops();
}
else if (dropTimer === null) {
dropTimer = setTimeout(emitDrops, remaining).unref();
}
};
const flushAll = async () => {
emitDrops();
void startFlush();
await awaitInFlight();
// A failed/rejected in-flight batch creates one loss marker. Give that
// marker one best-effort send without recursively retrying forever.
if (bufferedDocuments > 0) {
void startFlush();
await awaitInFlight();
}
};
const trace = ((obj, op) => {
if (!enabled) {
if (!enabled || disposed) {
return;
}
if (pending > limit) {
dropCount++;
markDrop();
if (pendingBytes !== 0 && pendingBytes >= limit) {
markDrop('backpressure');
return;
}
else {
const doc = (typeof obj === 'string' ? obj : stringify(obj)).slice(0, -1);
traceData += header;
traceData += `${doc},"traceId":${genTraceId()},"@timestamp":${Date.now()},"op":"${op}${postfix}`;
if (traceData.length > batch) {
void flushTraces();
let doc;
try {
const serialized = typeof obj === 'string' ? obj : stringify(obj);
if (typeof serialized !== 'string' ||
serialized.charCodeAt(0) !== 123 ||
serialized.charCodeAt(serialized.length - 1) !== 125 ||
typeof op !== 'string') {
throw new TypeError('trace document must serialize to a JSON object');
}
let hasProperties = serialized.length > 2;
// Raw strings and custom serializers are trust boundaries. Validate
// their syntax once so one malformed payload cannot corrupt the rest of
// the NDJSON batch. The default JSON.stringify object path needs only
// the O(1) top-level-object check above.
if (typeof obj === 'string' || stringify !== JSON.stringify) {
const parsed = JSON.parse(serialized);
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
throw new TypeError('trace document must serialize to a JSON object');
}
hasProperties = Object.keys(parsed).length > 0;
}
const separator = hasProperties ? ',' : '';
doc = `${serialized.slice(0, -1)}${separator}"traceId":${genTraceId()},"@timestamp":${Date.now()},"op":${JSON.stringify(op)}${postfix}`;
}
catch {
markDrop('serialize');
return;
}
appendDocument(doc);
if (bufferedBytes >= batch) {
void startFlush();
}
});
trace.stringify = stringify;
trace.trace = trace;
trace.write = trace;
trace.flush = flushTraces;
let enabledSubscription = null;
let disposed = false;
trace[Symbol.asyncDispose] = async () => {
// Idempotent: mixing manual cleanup with AsyncDisposableStack/`using`
// makes double-dispose easy, and a second pass would corrupt the live
// refcount and re-close the transport.
if (disposed) {
trace.trace = null;
trace.write = null;
trace.flush = () => (disposed && disposePromise !== null ? disposePromise : flushAll());
const enabledStatus = new rxjs.BehaviorSubject(null);
Object.defineProperty(trace, 'enabled$', {
enumerable: true,
value: enabledStatus.asObservable(),
});
const force$ = new rxjs.Observable((subscriber) => {
ensureForceChannel();
const listener = (name, until) => {
if (name === serviceName) {
subscriber.next(until);
}
};
forceListeners.add(listener);
subscriber.next(forceWindows.get(serviceName) ?? 0);
return () => forceListeners.delete(listener);
}).pipe(rxjs.switchMap((until) => forceWindow(until).pipe(rxjs.tap((forced) => {
if (!forced && forceWindows.get(serviceName) === until) {
forceWindows.delete(serviceName);
}
}))));
const userState$ = userEnabled$
? rxjs.concat(rxjs.of(null), userEnabled$.pipe(rxjs.map(normalizeToggle)))
: rxjs.of(null);
const changeCount = (delta) => {
traceGlobals[TraceCounterSymbol] = Math.max(0, (traceGlobals[TraceCounterSymbol] ?? 0) + delta);
};
const setEnabled = (value) => {
if (disposed || value === enabled) {
return;
}
const wasEnabled = enabled === true;
enabled = value;
if (value) {
trace.write = trace;
trace.trace = trace;
if (!wasEnabled) {
changeCount(1);
}
safeLog('debug', 'trace enabled');
}
else {
trace.write = null;
trace.trace = null;
if (wasEnabled) {
changeCount(-1);
}
safeLog('debug', 'trace disabled');
emitDrops();
void flushAll();
}
// Publish only after writer and refcount state are coherent.
enabledStatus.next(value);
};
let enabledSubscription = null;
enabledSubscription = rxjs
.combineLatest([recordEnabled$ ?? rxjs.of(null), force$, userState$])
.pipe(rxjs.map(([record, force, user]) => record ?? (force || user === true)), rxjs.retry({
resetOnSuccess: true,
delay: (err, retryCount) => {
safeLog('error', { err, retryCount }, 'trace enabled$ error, retrying');
return unrefTimer(10e3);
},
}), rxjs.distinctUntilChanged())
.subscribe({
next: setEnabled,
error: (err) => safeLog('error', { err }, 'trace enabled$ error'),
});
let disposePromise = null;
const dispose = async () => {
disposed = true;
// Clear the default-writer slots when they point at this trace: a later
// install in the same thread must not be blocked by a disposed (inert)
// registration. The write/trace nulling below keeps captured references
// and other copies' mirrors harmless regardless.
if (traceGlobals[TraceSymbol] === trace) {
if (getTrace() === trace) {
installTrace(undefined);

@@ -462,7 +649,4 @@ }

enabledSubscription?.unsubscribe();
// Release this trace's enabled-count slot if it was still on at dispose,
// mirroring the true -> false decrement in the enabled$ handler. The
// `disposed` guard above keeps a double dispose from decrementing twice.
if (enabled === true) {
traceGlobals[TraceCounterSymbol] = (traceGlobals[TraceCounterSymbol] ?? 1) - 1;
changeCount(-1);
}

@@ -472,121 +656,23 @@ enabled = false;

trace.trace = null;
await flushTraces();
if (enabledStatus.getValue() !== false) {
enabledStatus.next(false);
}
enabledStatus.complete();
emitDrops();
await flushAll();
await client?.close();
};
let recordEnabled$ = null;
if (ds) {
recordEnabled$ = rxjs
.combineLatest([
serviceName ? ds.record.observe(serviceName, 'trace') : rxjs.of(undefined),
ds.record.observe('debug', 'trace'),
])
.pipe(rxjs.map(([service, debug]) => service ??
(Array.isArray(debug)
? debug.some((entry) => {
if (typeof entry !== 'string') {
return false;
}
const groups = entry.match(DEBUG_ENTRY_RE)?.groups;
return (groups?.serviceName === serviceName &&
(groups?.user == null || groups.user === ds.user));
})
: typeof debug === 'object' && debug !== null
? debug[serviceName]
: debug)), rxjs.map((value) => (typeof value === 'boolean' ? value : null) ??
value?.enabled ??
value), rxjs.map((enabled) => (typeof enabled === 'boolean' ? enabled : null)));
logger.info({ serviceName }, 'trace enabled$ created from ds.record.observe');
}
// Controlled by enabled$: start disabled and let the stream turn tracing on, so a
// service never traces during the startup window before the first emission (matches
// the off-by-default behavior consumers previously wired up themselves). The internal
// `enabled` flag gates the callable itself, so a captured `trace`/`trace.trace`
// reference can't bypass the toggle; nulling `trace.write`/`trace.trace` additionally
// keeps the property-based contract consumers rely on.
assert.strictEqual(enabled, null, 'trace enabled must start null');
trace.write = null;
trace.trace = null;
// Force-enable stream: follows forceTrace() broadcasts addressed to this
// serviceName. Each message (re)opens a window that closes at `until`;
// switchMap so a newer message supersedes the pending expiry timer. The
// channel is created on subscribe and closed on unsubscribe (the
// enabledSubscription teardown in the disposer), and unref'd so it never
// keeps an otherwise-finished process alive.
const force$ = new rxjs.Observable((subscriber) => {
const bc = new BroadcastChannel(TRACE_FORCE_CHANNEL);
bc.unref();
bc.onmessage = (event) => {
const data = event?.data;
if (data != null &&
data.serviceName === serviceName &&
typeof data.until === 'number' &&
Number.isFinite(data.until)) {
subscriber.next(data.until);
}
};
return () => bc.close();
}).pipe(rxjs.switchMap((until) => {
const remainingMs = until - Date.now();
return remainingMs > 0
? rxjs.concat(rxjs.of(true), rxjs.timer(remainingMs).pipe(rxjs.map(() => false)))
: rxjs.of(false);
}), rxjs.startWith(false));
// Precedence: an explicit boolean on the service/debug record wins (in both
// directions — a manual `false` suppresses a force window), then a live
// forceTrace() window, then the caller-supplied enabled$, default off.
// Absent streams contribute a constant null so the positional destructure
// below stays stable.
enabledSubscription = rxjs
.combineLatest([
recordEnabled$ ?? rxjs.of(null),
force$,
userEnabled$ ?? rxjs.of(null),
])
.pipe(rxjs.map(([record, force, user]) => record ?? (force || (user ?? false))), rxjs.retry({
resetOnSuccess: true,
// delay must return an ObservableInput; a bare number throws "where a stream
// was expected" and the retry never happens.
delay: (err, retryCount) => {
logger.error({ err, retryCount }, 'trace enabled$ error, retrying');
return rxjs.timer(10e3);
},
}), rxjs.distinctUntilChanged())
.subscribe({
next: (value) => {
if (value === enabled) {
return;
}
// Only genuine boolean transitions move the enabled-count: (null|false)
// -> true bumps it, true -> false drops it. The initial null -> false (a
// trace that starts disabled and was never counted) must NOT decrement,
// or getTraceCount() drifts negative. Disposal-while-enabled is handled
// in the disposer, so a merely completing stream never disables.
const wasEnabled = enabled === true;
enabled = value;
if (value) {
logger.debug('trace enabled');
trace.write = trace;
trace.trace = trace;
traceGlobals[TraceCounterSymbol] = (traceGlobals[TraceCounterSymbol] ?? 0) + 1;
}
else {
logger.debug('trace disabled');
trace.write = null;
trace.trace = null;
if (wasEnabled) {
traceGlobals[TraceCounterSymbol] = (traceGlobals[TraceCounterSymbol] ?? 1) - 1;
}
void flushTraces();
}
},
error: (err) => {
logger.error({ err }, 'trace enabled$ error');
},
});
// Compat
if (Array.isArray(destroyers)) {
destroyers.push(trace[Symbol.asyncDispose]);
}
trace[Symbol.asyncDispose] = () => {
if (disposePromise === null) {
const { promise, resolve, reject } = Promise.withResolvers();
disposePromise = promise;
void dispose().then(resolve, reject);
}
return disposePromise;
};
// Periodic fire-and-forget batches are tracked by startFlush, so public
// flush/dispose remain real barriers for them.
const flushInterval = setInterval(() => void startFlush(), 10e3).unref();
return trace;
}
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,4EAA4E;AAC5E,8EAA8E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,3 +8,10 @@ "main": "lib/index.js",

"exports": {
".": "./lib/index.js"
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./core": {
"types": "./lib/core.d.ts",
"default": "./lib/core.js"
}
},

@@ -22,18 +29,17 @@ "files": [

"build": "rimraf lib && tsc -p tsconfig.build.json",
"typecheck": "tsc --noEmit",
"typecheck": "tsc -p tsconfig.json",
"test": "yarn build && node --test",
"test:ci": "yarn build && node --test"
"test:ci": "node --test"
},
"dependencies": {
"@nxtedition/nxt-undici": "^7.3.27",
"lodash": "^4.18.1",
"rxjs": "^7.0.0"
"@nxtedition/nxt-undici": "^8.0.4",
"rxjs": "^7.8.2"
},
"devDependencies": {
"@types/node": "^25.9.4",
"oxlint-tsgolint": "^0.23.0",
"@types/node": "^26.1.1",
"es-module-lexer": "^2.3.1",
"rimraf": "^6.1.3",
"typescript": "^5.9.3"
"typescript": "^7.0.2"
},
"gitHead": "53fdc3a961a0df3cad75c7d25dce565bd5f8e5ef"
"gitHead": "756528b231bf3618493c73d7aeaf05ed31ac9f05"
}