repro-nest 0.0.220 → 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
@@ -195,8 +195,8 @@ export declare function initReproTracing(opts?: ReproTracingInitOptions): Tracer
195
195
  export declare function isReproTracingEnabled(): boolean;
196
196
  export type ReproMiddlewareConfig = {
197
197
  appId: string;
198
- tenantId: string;
199
198
  appSecret: string;
199
+ appName?: string;
200
200
  /** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
201
201
  captureHeaders?: boolean | HeaderCaptureOptions;
202
202
  /** Optional masking rules for request/response payloads and function traces. */
@@ -205,13 +205,13 @@ export type ReproMiddlewareConfig = {
205
205
  export declare function reproMiddleware(cfg: ReproMiddlewareConfig): (req: Request, res: Response, next: NextFunction) => void;
206
206
  export declare function reproMongoosePlugin(cfg: {
207
207
  appId: string;
208
- tenantId: string;
209
208
  appSecret: string;
209
+ appName?: string;
210
210
  }): (schema: Schema) => void;
211
211
  export type SendgridPatchConfig = {
212
212
  appId: string;
213
- tenantId: string;
214
213
  appSecret: string;
214
+ appName?: string;
215
215
  resolveContext?: () => {
216
216
  sid?: string;
217
217
  aid?: string;
package/dist/index.js CHANGED
@@ -856,7 +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
- 'X-Tenant-Id': cfg.tenantId,
859
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
860
860
  },
861
861
  body: JSON.stringify(body),
862
862
  });
@@ -5,8 +5,8 @@ type Ctx = {
5
5
  export declare const getCtx: () => Ctx;
6
6
  export type SendgridPatchConfig = {
7
7
  appId: string;
8
- tenantId: string;
9
8
  appSecret: string;
9
+ appName?: string;
10
10
  resolveContext?: () => {
11
11
  sid?: string;
12
12
  aid?: string;
@@ -18,7 +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
- 'X-Tenant-Id': cfg.tenantId,
21
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
22
22
  },
23
23
  body: JSON.stringify(body),
24
24
  });
package/docs/tracing.md CHANGED
@@ -105,7 +105,7 @@ import { reproMiddleware } from 'repro-nest';
105
105
 
106
106
  app.use(reproMiddleware({
107
107
  appId,
108
- tenantId,
108
+ appName,
109
109
  appSecret,
110
110
  masking: {
111
111
  rules: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repro-nest",
3
- "version": "0.0.220",
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: { tenantId: string; 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,7 +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
- 'X-Tenant-Id': cfg.tenantId,
1140
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
1141
1141
  },
1142
1142
  body: JSON.stringify(body),
1143
1143
  });
@@ -1784,8 +1784,8 @@ function applyMasking(
1784
1784
  // ===================================================================
1785
1785
  export type ReproMiddlewareConfig = {
1786
1786
  appId: string;
1787
- tenantId: string;
1788
1787
  appSecret: string;
1788
+ appName?: string;
1789
1789
  /** Configure header capture/masking. Defaults to capturing with sensitive headers masked. */
1790
1790
  captureHeaders?: boolean | HeaderCaptureOptions;
1791
1791
  /** Optional masking rules for request/response payloads and function traces. */
@@ -2228,7 +2228,7 @@ export function reproMiddleware(cfg: ReproMiddlewareConfig) {
2228
2228
  // - ONLY schema middleware (pre/post) for specific ops
2229
2229
  // - keeps your existing doc-diff hooks
2230
2230
  // ===================================================================
2231
- export function reproMongoosePlugin(cfg: { appId: string; tenantId: string; appSecret: string }) {
2231
+ export function reproMongoosePlugin(cfg: { appId: string; appSecret: string; appName?: string }) {
2232
2232
  return function (schema: Schema) {
2233
2233
  // -------- pre/post save (unchanged) --------
2234
2234
  schema.pre('save', { document: true }, async function (next) {
@@ -2723,8 +2723,8 @@ function buildMinimalUpdate(before: any, after: any) {
2723
2723
  // ===================================================================
2724
2724
  export type SendgridPatchConfig = {
2725
2725
  appId: string;
2726
- tenantId: string;
2727
2726
  appSecret: string;
2727
+ appName?: string;
2728
2728
  resolveContext?: () => { sid?: string; aid?: string } | undefined;
2729
2729
  };
2730
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: { tenantId: string; 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,7 +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
- 'X-Tenant-Id': cfg.tenantId,
25
+ ...(cfg.appName ? { 'X-App-Name': cfg.appName } : {}),
26
26
  },
27
27
  body: JSON.stringify(body),
28
28
  });
@@ -31,8 +31,8 @@ async function post(
31
31
 
32
32
  export type SendgridPatchConfig = {
33
33
  appId: string;
34
- tenantId: string;
35
34
  appSecret: string;
35
+ appName?: string;
36
36
  // Optional: provide a function to resolve sid/aid if AsyncLocalStorage is not set
37
37
  resolveContext?: () => { sid?: string; aid?: string } | undefined;
38
38
  };