@reproapp/node-sdk 0.0.38 → 0.0.41
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 +228 -310
- package/dist/index.d.ts +55 -0
- package/dist/index.js +1038 -21
- package/dist/ingest/client.js +2 -1
- package/dist/ingest/mapper.js +2 -0
- package/dist/ingest/types.d.ts +1 -0
- package/package.json +10 -4
- package/src/index.ts +1320 -20
- package/src/ingest/client.ts +1 -0
- package/src/ingest/mapper.ts +1 -0
- package/src/ingest/types.ts +1 -0
- package/test/backend-live-mode.test.js +421 -0
- package/test/postgresql-integration.test.js +302 -0
- package/test/postgresql-integrations.testcontainers.test.js +261 -0
- package/test/request-manifest-priority.test.js +6 -0
package/dist/index.d.ts
CHANGED
|
@@ -287,6 +287,11 @@ type RequestCaptureScopeState = {
|
|
|
287
287
|
dbChangeCount: number;
|
|
288
288
|
emailEventCount: number;
|
|
289
289
|
};
|
|
290
|
+
type BackendLiveTimingConfig = {
|
|
291
|
+
sessionMaxDurationMs: number;
|
|
292
|
+
segmentMaxDurationMs: number;
|
|
293
|
+
segmentIdleMs: number;
|
|
294
|
+
};
|
|
290
295
|
declare function sanitizeTraceValueForPrivacy(value: any): any;
|
|
291
296
|
declare function sanitizeMaterializedTraceValue(value: any): any;
|
|
292
297
|
export declare function __materializePendingTraceEventsForWorker(payload: TraceMaterializationWorkerPayload): Promise<PendingTraceEventRecord[]>;
|
|
@@ -322,12 +327,48 @@ declare function getEventTraceValueEntries(event: TraceEventRecord | PendingTrac
|
|
|
322
327
|
declare function estimateTraceBatchSerializedBytes(batch: TraceEventRecord[], requestRid: string, actionId: string | null | undefined, batchIndex: number): number;
|
|
323
328
|
declare function chunkTraceEventsForTransport(events: TraceEventRecord[], requestRid: string, actionId: string | null | undefined): TraceEventRecord[][];
|
|
324
329
|
export type ReproMiddlewareConfig = IngestClientConfig & {
|
|
330
|
+
/** API base used for backend-owned live session documents. Defaults to REPRO_API_BASE_URL/REPRO_API_BASE/privacy.apiBase. */
|
|
331
|
+
apiBase?: string;
|
|
325
332
|
/** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
|
|
326
333
|
captureHeaders?: boolean | HeaderCaptureOptions;
|
|
327
334
|
/** Optional masking rules for request/response payloads and function traces. */
|
|
328
335
|
masking?: ReproMaskingConfig;
|
|
329
336
|
/** Optional privacy policy config for deterministic runtime transformations. */
|
|
330
337
|
privacy?: RuntimePrivacyConfig;
|
|
338
|
+
/** Opt-in production/live capture mode. Staging/manual tagged capture is unchanged when disabled. */
|
|
339
|
+
liveMode?: ReproLiveModeConfig | boolean;
|
|
340
|
+
};
|
|
341
|
+
export type ReproLiveActorArgs = {
|
|
342
|
+
req: Request;
|
|
343
|
+
headers: Request['headers'];
|
|
344
|
+
method: string;
|
|
345
|
+
url: string;
|
|
346
|
+
path: string;
|
|
347
|
+
ip?: string | null;
|
|
348
|
+
appId: string;
|
|
349
|
+
appName?: string;
|
|
350
|
+
serviceName?: string;
|
|
351
|
+
};
|
|
352
|
+
export type ReproLiveActorDecision = ReproLiveActorArgs & {
|
|
353
|
+
actorId: string;
|
|
354
|
+
actorType?: string;
|
|
355
|
+
actorLabels?: Record<string, string>;
|
|
356
|
+
};
|
|
357
|
+
export type ReproLiveModeConfig = {
|
|
358
|
+
enabled?: boolean;
|
|
359
|
+
backendOnly?: boolean;
|
|
360
|
+
/**
|
|
361
|
+
* Stable actor/correlation key for live capture. Return null/undefined/empty
|
|
362
|
+
* to skip capture for that request.
|
|
363
|
+
*/
|
|
364
|
+
defineActorId?: (args: ReproLiveActorArgs) => string | number | null | undefined | Promise<string | number | null | undefined>;
|
|
365
|
+
/**
|
|
366
|
+
* Optional filter for segmenting which actors/requests are captured.
|
|
367
|
+
*/
|
|
368
|
+
shouldCapture?: (args: ReproLiveActorDecision) => boolean | Promise<boolean>;
|
|
369
|
+
actorType?: string;
|
|
370
|
+
actorLabels?: Record<string, string | number | boolean | null | undefined> | ((args: ReproLiveActorDecision) => Record<string, string | number | boolean | null | undefined> | null | undefined | Promise<Record<string, string | number | boolean | null | undefined> | null | undefined>);
|
|
371
|
+
apiBase?: string;
|
|
331
372
|
};
|
|
332
373
|
export type ReproInitConfig = ReproMiddlewareConfig & {
|
|
333
374
|
/**
|
|
@@ -376,6 +417,16 @@ export type RedisPatchConfig = ReproMiddlewareConfig & {
|
|
|
376
417
|
} | undefined;
|
|
377
418
|
};
|
|
378
419
|
export declare function patchRedis(cfg: RedisPatchConfig): void;
|
|
420
|
+
export type PostgreSqlPatchConfig = ReproMiddlewareConfig & {
|
|
421
|
+
resolveContext?: () => {
|
|
422
|
+
sid?: string;
|
|
423
|
+
aid?: string;
|
|
424
|
+
} | undefined;
|
|
425
|
+
};
|
|
426
|
+
declare function patchPgFromModuleExports(pgModule: any): void;
|
|
427
|
+
declare function patchPostgresJsFromModuleExports(postgresModule: any): void;
|
|
428
|
+
declare function patchTypeOrmFromModuleExports(typeOrmModule: any): void;
|
|
429
|
+
export declare function patchPostgreSql(cfg: PostgreSqlPatchConfig): void;
|
|
379
430
|
export type MongoDbPatchConfig = ReproMiddlewareConfig & {
|
|
380
431
|
resolveContext?: () => {
|
|
381
432
|
sid?: string;
|
|
@@ -407,6 +458,7 @@ export declare const __reproTestHooks: {
|
|
|
407
458
|
}): void;
|
|
408
459
|
drainSdkBackgroundQueueForTest(): Promise<void>;
|
|
409
460
|
resetSdkBackgroundQueuesForTest(): void;
|
|
461
|
+
setBackendLiveTimingForTest(override: Partial<BackendLiveTimingConfig> | null): void;
|
|
410
462
|
runWithRequestContextForTest<T>(ctx: Partial<Ctx>, fn: () => T): T;
|
|
411
463
|
getNativeMongoSuppressionCountForTest(): number;
|
|
412
464
|
getRuntimePrivacyPolicyForTest(cfg: ReproMiddlewareConfig): NormalizedRuntimePrivacyPolicy | null;
|
|
@@ -419,6 +471,9 @@ export declare const __reproTestHooks: {
|
|
|
419
471
|
patchAmqplibConnectionForTest: typeof patchAmqplibConnection;
|
|
420
472
|
patchAmqplibChannelForTest: typeof patchAmqplibChannel;
|
|
421
473
|
wrapAmqplibConsumeHandlerForTest: typeof wrapAmqplibConsumeHandler;
|
|
474
|
+
patchPgModuleForTest: typeof patchPgFromModuleExports;
|
|
475
|
+
patchPostgresJsModuleForTest: typeof patchPostgresJsFromModuleExports;
|
|
476
|
+
patchTypeOrmModuleForTest: typeof patchTypeOrmFromModuleExports;
|
|
422
477
|
patchMongoDbModuleForTest: typeof patchMongoDbFromModuleExports;
|
|
423
478
|
patchMongoCollectionPrototypeForTest: typeof patchMongoCollectionPrototype;
|
|
424
479
|
chunkTraceEventsForTransportForTest: typeof chunkTraceEventsForTransport;
|