repro-nest 0.0.221 → 0.0.222

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 CHANGED
@@ -38,6 +38,7 @@ import {
38
38
 
39
39
  const reproConfig = {
40
40
  appId: process.env.REPRO_APP_ID as string,
41
+ appName: process.env.REPRO_APP_NAME as string,
41
42
  tenantId: process.env.REPRO_TENANT_ID as string,
42
43
  appSecret: process.env.REPRO_APP_SECRET as string,
43
44
  };
@@ -66,6 +67,7 @@ bootstrap();
66
67
 
67
68
  Configuration notes:
68
69
  - `REPRO_API_BASE` (optional) overrides the backend base URL used to send data.
70
+ - `REPRO_APP_NAME` (optional) sets `appName`, which is sent as `X-App-Name`.
69
71
 
70
72
  ### initReproTracing
71
73
 
@@ -152,6 +154,7 @@ include `x-bug-session-id` and `x-bug-action-id` headers to be captured.
152
154
 
153
155
  Options (type -> purpose):
154
156
  - `appId` (string): Repro app id.
157
+ - `appName` (string, optional): Repro app name (sent as `X-App-Name`).
155
158
  - `tenantId` (string): Repro tenant id.
156
159
  - `appSecret` (string): Repro app secret.
157
160
  - `captureHeaders` (boolean | HeaderCaptureOptions): enable/disable header capture
@@ -193,6 +196,7 @@ import { reproMiddleware } from 'repro-nest';
193
196
 
194
197
  app.use(reproMiddleware({
195
198
  appId: process.env.REPRO_APP_ID as string,
199
+ appName: process.env.REPRO_APP_NAME as string,
196
200
  tenantId: process.env.REPRO_TENANT_ID as string,
197
201
  appSecret: process.env.REPRO_APP_SECRET as string,
198
202
  captureHeaders: {
@@ -254,6 +258,7 @@ document diffs. It emits data only when a Repro session is active (i.e., when
254
258
 
255
259
  Arguments:
256
260
  - `appId` (string): Repro app id
261
+ - `appName` (string, optional): Repro app name (sent as `X-App-Name`)
257
262
  - `tenantId` (string): Repro tenant id
258
263
  - `appSecret` (string): Repro app secret
259
264
 
@@ -265,6 +270,7 @@ import { reproMongoosePlugin } from 'repro-nest';
265
270
 
266
271
  mongoose.plugin(reproMongoosePlugin({
267
272
  appId: process.env.REPRO_APP_ID as string,
273
+ appName: process.env.REPRO_APP_NAME as string,
268
274
  tenantId: process.env.REPRO_TENANT_ID as string,
269
275
  appSecret: process.env.REPRO_APP_SECRET as string,
270
276
  }));
@@ -280,6 +286,7 @@ MongooseModule.forRoot(process.env.MONGO_URL as string, {
280
286
  connectionFactory: (connection) => {
281
287
  connection.plugin(reproMongoosePlugin({
282
288
  appId: process.env.REPRO_APP_ID as string,
289
+ appName: process.env.REPRO_APP_NAME as string,
283
290
  tenantId: process.env.REPRO_TENANT_ID as string,
284
291
  appSecret: process.env.REPRO_APP_SECRET as string,
285
292
  }));
@@ -297,6 +304,7 @@ import { reproMongoosePlugin } from 'repro-nest';
297
304
  const userSchema = new Schema({ email: String });
298
305
  userSchema.plugin(reproMongoosePlugin({
299
306
  appId: process.env.REPRO_APP_ID as string,
307
+ appName: process.env.REPRO_APP_NAME as string,
300
308
  tenantId: process.env.REPRO_TENANT_ID as string,
301
309
  appSecret: process.env.REPRO_APP_SECRET as string,
302
310
  }));
package/dist/index.d.ts CHANGED
@@ -196,6 +196,7 @@ export declare function isReproTracingEnabled(): boolean;
196
196
  export type ReproMiddlewareConfig = {
197
197
  appId: string;
198
198
  appSecret: string;
199
+ appName?: string;
199
200
  /** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
200
201
  captureHeaders?: boolean | HeaderCaptureOptions;
201
202
  /** Optional masking rules for request/response payloads and function traces. */
@@ -205,10 +206,12 @@ export declare function reproMiddleware(cfg: ReproMiddlewareConfig): (req: Reque
205
206
  export declare function reproMongoosePlugin(cfg: {
206
207
  appId: string;
207
208
  appSecret: string;
209
+ appName?: string;
208
210
  }): (schema: Schema) => void;
209
211
  export type SendgridPatchConfig = {
210
212
  appId: string;
211
213
  appSecret: string;
214
+ appName?: string;
212
215
  resolveContext?: () => {
213
216
  sid?: string;
214
217
  aid?: string;
package/dist/index.js CHANGED
@@ -856,6 +856,7 @@ async function post(cfg, sessionId, body) {
856
856
  'Content-Type': 'application/json',
857
857
  'X-App-Id': cfg.appId,
858
858
  'X-App-Secret': cfg.appSecret,
859
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
859
860
  },
860
861
  body: JSON.stringify(body),
861
862
  });
@@ -6,6 +6,7 @@ export declare const getCtx: () => Ctx;
6
6
  export type SendgridPatchConfig = {
7
7
  appId: string;
8
8
  appSecret: string;
9
+ appName?: string;
9
10
  resolveContext?: () => {
10
11
  sid?: string;
11
12
  aid?: string;
@@ -18,6 +18,7 @@ async function post(cfg, sessionId, body) {
18
18
  'Content-Type': 'application/json',
19
19
  'X-App-Id': cfg.appId,
20
20
  'X-App-Secret': cfg.appSecret,
21
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
21
22
  },
22
23
  body: JSON.stringify(body),
23
24
  });
package/docs/tracing.md CHANGED
@@ -105,6 +105,7 @@ import { reproMiddleware } from 'repro-nest';
105
105
 
106
106
  app.use(reproMiddleware({
107
107
  appId,
108
+ appName,
108
109
  appSecret,
109
110
  masking: {
110
111
  rules: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repro-nest",
3
- "version": "0.0.221",
3
+ "version": "0.0.222",
4
4
  "description": "Repro Nest SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1123,7 +1123,7 @@ function resolveCollectionOrWarn(source: any, type: 'doc' | 'query'): string {
1123
1123
  }
1124
1124
 
1125
1125
  async function post(
1126
- cfg: { appId: string; appSecret: string; apiBase?: string },
1126
+ cfg: { appId: string; appSecret: string; appName?: string; apiBase?: string },
1127
1127
  sessionId: string,
1128
1128
  body: any,
1129
1129
  ) {
@@ -1137,6 +1137,7 @@ async function post(
1137
1137
  'Content-Type': 'application/json',
1138
1138
  'X-App-Id': cfg.appId,
1139
1139
  'X-App-Secret': cfg.appSecret,
1140
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
1140
1141
  },
1141
1142
  body: JSON.stringify(body),
1142
1143
  });
@@ -1784,6 +1785,7 @@ function applyMasking(
1784
1785
  export type ReproMiddlewareConfig = {
1785
1786
  appId: string;
1786
1787
  appSecret: string;
1788
+ appName?: string;
1787
1789
  /** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
1788
1790
  captureHeaders?: boolean | HeaderCaptureOptions;
1789
1791
  /** Optional masking rules for request/response payloads and function traces. */
@@ -2226,7 +2228,7 @@ export function reproMiddleware(cfg: ReproMiddlewareConfig) {
2226
2228
  // - ONLY schema middleware (pre/post) for specific ops
2227
2229
  // - keeps your existing doc-diff hooks
2228
2230
  // ===================================================================
2229
- export function reproMongoosePlugin(cfg: { appId: string; appSecret: string }) {
2231
+ export function reproMongoosePlugin(cfg: { appId: string; appSecret: string; appName?: string }) {
2230
2232
  return function (schema: Schema) {
2231
2233
  // -------- pre/post save (unchanged) --------
2232
2234
  schema.pre('save', { document: true }, async function (next) {
@@ -2722,6 +2724,7 @@ function buildMinimalUpdate(before: any, after: any) {
2722
2724
  export type SendgridPatchConfig = {
2723
2725
  appId: string;
2724
2726
  appSecret: string;
2727
+ appName?: string;
2725
2728
  resolveContext?: () => { sid?: string; aid?: string } | undefined;
2726
2729
  };
2727
2730
 
@@ -8,7 +8,7 @@ export const getCtx = () => als.getStore() || {};
8
8
  // If you already export als/getCtx from repro-node, reuse that instead of re-declaring.
9
9
 
10
10
  async function post(
11
- cfg: { appId: string; appSecret: string; apiBase?: string },
11
+ cfg: { appId: string; appSecret: string; appName?: string; apiBase?: string },
12
12
  sessionId: string,
13
13
  body: any,
14
14
  ) {
@@ -22,6 +22,7 @@ async function post(
22
22
  'Content-Type': 'application/json',
23
23
  'X-App-Id': cfg.appId,
24
24
  'X-App-Secret': cfg.appSecret,
25
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
25
26
  },
26
27
  body: JSON.stringify(body),
27
28
  });
@@ -31,6 +32,7 @@ async function post(
31
32
  export type SendgridPatchConfig = {
32
33
  appId: string;
33
34
  appSecret: string;
35
+ appName?: string;
34
36
  // Optional: provide a function to resolve sid/aid if AsyncLocalStorage is not set
35
37
  resolveContext?: () => { sid?: string; aid?: string } | undefined;
36
38
  };