@reproapp/node-sdk 0.0.4 → 0.0.6
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/index.d.ts +16 -10
- package/dist/index.js +462 -439
- package/package.json +2 -2
- package/src/index.ts +539 -488
- package/test/circular-capture.test.js +1 -1
- package/test/disable-subtree.test.js +1 -1
- package/test/kafka-runtime-privacy-policy.test.js +451 -18
- package/test/runtime-privacy-materialization.test.js +76 -0
package/dist/index.d.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import type { Request, Response, NextFunction } from 'express';
|
|
27
27
|
import type { Schema } from 'mongoose';
|
|
28
28
|
import { type IngestClientConfig } from './ingest/client';
|
|
29
|
-
import { type NormalizedRuntimePrivacyPolicy, type RuntimePrivacyConfig } from './privacy';
|
|
29
|
+
import { type NormalizedRuntimePrivacyPolicy, type RuntimePrivacyConfig, type RuntimePrivacyDbContext, type RuntimePrivacySurface } from './privacy';
|
|
30
30
|
type SpanContext = {
|
|
31
31
|
traceId: string | null;
|
|
32
32
|
spanId: string | number | null;
|
|
@@ -71,9 +71,6 @@ type TraceEventRecord = {
|
|
|
71
71
|
threw?: boolean;
|
|
72
72
|
error?: any;
|
|
73
73
|
unawaited?: boolean;
|
|
74
|
-
argsValueCapture?: TraceValueCaptureRef;
|
|
75
|
-
returnValueCapture?: TraceValueCaptureRef;
|
|
76
|
-
errorValueCapture?: TraceValueCaptureRef;
|
|
77
74
|
};
|
|
78
75
|
type PendingTraceEventRecord = TraceEventRecord & {
|
|
79
76
|
__reproPending?: {
|
|
@@ -85,14 +82,9 @@ type PendingTraceEventRecord = TraceEventRecord & {
|
|
|
85
82
|
__reproSourceFile?: string | null;
|
|
86
83
|
__reproTraceValueEntries?: TraceValueBatchEntry[];
|
|
87
84
|
};
|
|
88
|
-
type TraceValueCaptureRef = {
|
|
89
|
-
status: 'stored' | 'truncated-for-storage' | 'skipped-non-meaningful';
|
|
90
|
-
valueId?: string;
|
|
91
|
-
projectedKind?: string;
|
|
92
|
-
};
|
|
93
85
|
type TraceValueBatchEntry = {
|
|
94
86
|
id: string;
|
|
95
|
-
target: 'db.pk' | 'db.before' | 'db.after' | 'db.query' | 'db.resultMeta' | 'db.error' | 'request.headers' | 'request.body' | 'request.params' | 'request.query' | 'response.body'
|
|
87
|
+
target: 'db.pk' | 'db.before' | 'db.after' | 'db.query' | 'db.resultMeta' | 'db.error' | 'request.headers' | 'request.body' | 'request.params' | 'request.query' | 'response.body';
|
|
96
88
|
value: any;
|
|
97
89
|
truncatedForStorage?: boolean;
|
|
98
90
|
projectedKind?: string;
|
|
@@ -280,6 +272,17 @@ type MaskRequestContext = {
|
|
|
280
272
|
key: string;
|
|
281
273
|
};
|
|
282
274
|
declare function shareRuntimePrivacyState(source: ReproMiddlewareConfig, target: ReproMiddlewareConfig): void;
|
|
275
|
+
type InlinePrivacyMaterializationResult = {
|
|
276
|
+
value: any;
|
|
277
|
+
skipped?: {
|
|
278
|
+
status: 'skipped';
|
|
279
|
+
reason: string;
|
|
280
|
+
target: RuntimePrivacySurface;
|
|
281
|
+
serializedLength?: number;
|
|
282
|
+
limit?: number;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
declare function materializeInlinePrivacyValueAsync(target: RuntimePrivacySurface, value: any, cfg: ReproMiddlewareConfig, req: MaskRequestContext, trace: TraceEventForFilter | null, masking: NormalizedMaskingConfig | null, privacy: NormalizedRuntimePrivacyPolicy | null, db?: RuntimePrivacyDbContext | null): Promise<InlinePrivacyMaterializationResult>;
|
|
283
286
|
export type ReproMiddlewareConfig = IngestClientConfig & {
|
|
284
287
|
/** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
|
|
285
288
|
captureHeaders?: boolean | HeaderCaptureOptions;
|
|
@@ -313,6 +316,7 @@ export type KafkaJsPatchConfig = ReproMiddlewareConfig & {
|
|
|
313
316
|
resolveContext?: KafkaContextResolver;
|
|
314
317
|
};
|
|
315
318
|
declare function recordKafkaTraceEventAsync(raw: any, sink: TraceEventRecord[], cfg: KafkaJsPatchConfig, maskReq: MaskRequestContext): Promise<void>;
|
|
319
|
+
declare function patchKafkaProducerInstance(producer: any, cfg: KafkaJsPatchConfig): void;
|
|
316
320
|
declare function wrapKafkaEachMessageHandler(eachMessage: any, cfg: KafkaJsPatchConfig, consumer: any): (this: any, payload: any) => Promise<any>;
|
|
317
321
|
export declare function patchKafkaJs(cfg: KafkaJsPatchConfig): void;
|
|
318
322
|
export type RedisPatchConfig = ReproMiddlewareConfig & {
|
|
@@ -341,6 +345,8 @@ export declare const __reproTestHooks: {
|
|
|
341
345
|
getRuntimePrivacyPolicyForTest(cfg: ReproMiddlewareConfig): NormalizedRuntimePrivacyPolicy | null;
|
|
342
346
|
setRuntimePrivacyPolicyForTest(cfg: ReproMiddlewareConfig, policy: NormalizedRuntimePrivacyPolicy | null): void;
|
|
343
347
|
recordKafkaTraceEventAsyncForTest: typeof recordKafkaTraceEventAsync;
|
|
348
|
+
materializeInlinePrivacyValueAsyncForTest: typeof materializeInlinePrivacyValueAsync;
|
|
349
|
+
patchKafkaProducerInstanceForTest: typeof patchKafkaProducerInstance;
|
|
344
350
|
wrapKafkaEachMessageHandlerForTest: typeof wrapKafkaEachMessageHandler;
|
|
345
351
|
};
|
|
346
352
|
export {};
|