posthog-node 5.47.0 → 5.47.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;AAM7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,UAAU,iBAAiB;IACzB,UAAU,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IACxB,WAAW,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;CAC1B;AAED,UAAU,gBAAgB;IACxB,YAAY,IAAI,iBAAiB,CAAA;CAClC;AAED,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG;IAC3B,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;CACxB;AAED,UAAU,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACxC,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;CAC1E;AAED,MAAM,WAAW,uBAAuB;IACtC,+GAA+G;IAC/G,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAA;CACtD;AAwBD,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,kBAAkB,CAAQ;gBAEtB,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAO9E,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;CAoDzE"}
1
+ {"version":3,"file":"nestjs.d.ts","sourceRoot":"","sources":["../../src/extensions/nestjs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAc,MAAM,MAAM,CAAA;AAM7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAGhD,UAAU,iBAAiB;IACzB,UAAU,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;IACxB,WAAW,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAA;CAC1B;AAED,UAAU,gBAAgB;IACxB,YAAY,IAAI,iBAAiB,CAAA;CAClC;AAED,UAAU,WAAW,CAAC,CAAC,GAAG,GAAG;IAC3B,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,CAAA;CACxB;AAED,UAAU,eAAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACxC,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;CAC1E;AAED,MAAM,WAAW,uBAAuB;IACtC,+GAA+G;IAC/G,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,yBAAyB;IACxC,mGAAmG;IACnG,iBAAiB,CAAC,EAAE,OAAO,GAAG,uBAAuB,CAAA;CACtD;AAwBD,qBAAa,kBAAmB,YAAW,eAAe;IACxD,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,kBAAkB,CAAQ;gBAEtB,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,yBAAyB;IAO9E,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC;CAyDzE"}
@@ -84,20 +84,23 @@ class PostHogInterceptor {
84
84
  } : {},
85
85
  properties
86
86
  };
87
- this.posthog.enterContext(contextData);
88
- let source = next.handle();
89
- if (this.captureExceptions) source = source.pipe((0, operators_namespaceObject.catchError)((exception)=>{
90
- if (index_js_default().isPreviouslyCapturedError(exception)) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
91
- const status = getExceptionStatus(exception);
92
- if (void 0 !== status && status < this.minStatusToCapture) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
93
- const responseStatus = status ?? response?.statusCode;
94
- const additionalProperties = void 0 !== responseStatus ? {
95
- $response_status_code: responseStatus
96
- } : void 0;
97
- this.posthog.captureException(exception, distinctId, additionalProperties);
98
- return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
99
- }));
100
- return source;
87
+ return new external_rxjs_namespaceObject.Observable((subscriber)=>this.posthog.withContext(contextData, ()=>{
88
+ let source = next.handle();
89
+ if (this.captureExceptions) source = source.pipe((0, operators_namespaceObject.catchError)((exception)=>{
90
+ if (index_js_default().isPreviouslyCapturedError(exception)) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
91
+ const status = getExceptionStatus(exception);
92
+ if (void 0 !== status && status < this.minStatusToCapture) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
93
+ const responseStatus = status ?? response?.statusCode;
94
+ const additionalProperties = void 0 !== responseStatus ? {
95
+ $response_status_code: responseStatus
96
+ } : void 0;
97
+ this.posthog.captureException(exception, distinctId, additionalProperties);
98
+ return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
99
+ }));
100
+ return source.subscribe(subscriber);
101
+ }, {
102
+ fresh: true
103
+ }));
101
104
  }
102
105
  }
103
106
  exports.PostHogInterceptor = __webpack_exports__.PostHogInterceptor;
@@ -1,4 +1,4 @@
1
- import { throwError } from "rxjs";
1
+ import { Observable, throwError } from "rxjs";
2
2
  import { catchError } from "rxjs/operators";
3
3
  import error_tracking from "./error-tracking/index.mjs";
4
4
  import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from "./tracing-headers.mjs";
@@ -46,20 +46,23 @@ class PostHogInterceptor {
46
46
  } : {},
47
47
  properties
48
48
  };
49
- this.posthog.enterContext(contextData);
50
- let source = next.handle();
51
- if (this.captureExceptions) source = source.pipe(catchError((exception)=>{
52
- if (error_tracking.isPreviouslyCapturedError(exception)) return throwError(()=>exception);
53
- const status = getExceptionStatus(exception);
54
- if (void 0 !== status && status < this.minStatusToCapture) return throwError(()=>exception);
55
- const responseStatus = status ?? response?.statusCode;
56
- const additionalProperties = void 0 !== responseStatus ? {
57
- $response_status_code: responseStatus
58
- } : void 0;
59
- this.posthog.captureException(exception, distinctId, additionalProperties);
60
- return throwError(()=>exception);
61
- }));
62
- return source;
49
+ return new Observable((subscriber)=>this.posthog.withContext(contextData, ()=>{
50
+ let source = next.handle();
51
+ if (this.captureExceptions) source = source.pipe(catchError((exception)=>{
52
+ if (error_tracking.isPreviouslyCapturedError(exception)) return throwError(()=>exception);
53
+ const status = getExceptionStatus(exception);
54
+ if (void 0 !== status && status < this.minStatusToCapture) return throwError(()=>exception);
55
+ const responseStatus = status ?? response?.statusCode;
56
+ const additionalProperties = void 0 !== responseStatus ? {
57
+ $response_status_code: responseStatus
58
+ } : void 0;
59
+ this.posthog.captureException(exception, distinctId, additionalProperties);
60
+ return throwError(()=>exception);
61
+ }));
62
+ return source.subscribe(subscriber);
63
+ }, {
64
+ fresh: true
65
+ }));
63
66
  }
64
67
  }
65
68
  export { PostHogInterceptor };
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.47.0";
1
+ export declare const version = "5.47.2";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -26,7 +26,7 @@ __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  version: ()=>version
28
28
  });
29
- const version = '5.47.0';
29
+ const version = '5.47.2';
30
30
  exports.version = __webpack_exports__.version;
31
31
  for(var __webpack_i__ in __webpack_exports__)if (-1 === [
32
32
  "version"
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = '5.47.0';
1
+ const version = '5.47.2';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.47.0",
3
+ "version": "5.47.2",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -28,7 +28,7 @@
28
28
  "module": "dist/entrypoints/index.node.mjs",
29
29
  "types": "dist/entrypoints/index.node.d.ts",
30
30
  "dependencies": {
31
- "@posthog/core": "^1.46.0"
31
+ "@posthog/core": "^1.46.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@edge-runtime/jest-environment": "^4.0.0",
@@ -95,30 +95,35 @@ export class PostHogInterceptor implements NestInterceptor {
95
95
  properties,
96
96
  }
97
97
 
98
- // Use enterContext so the context propagates through RxJS Observable
99
- // subscription and catchError handlers, not just the synchronous callback.
100
- this.posthog.enterContext(contextData)
101
-
102
- let source = next.handle()
103
-
104
- if (this.captureExceptions) {
105
- source = source.pipe(
106
- catchError((exception: unknown) => {
107
- if (ErrorTracking.isPreviouslyCapturedError(exception)) {
108
- return throwError(() => exception)
109
- }
110
- const status = getExceptionStatus(exception)
111
- if (status !== undefined && status < this.minStatusToCapture) {
112
- return throwError(() => exception)
98
+ return new Observable((subscriber) =>
99
+ this.posthog.withContext(
100
+ contextData,
101
+ () => {
102
+ let source = next.handle()
103
+
104
+ if (this.captureExceptions) {
105
+ source = source.pipe(
106
+ catchError((exception: unknown) => {
107
+ if (ErrorTracking.isPreviouslyCapturedError(exception)) {
108
+ return throwError(() => exception)
109
+ }
110
+ const status = getExceptionStatus(exception)
111
+ if (status !== undefined && status < this.minStatusToCapture) {
112
+ return throwError(() => exception)
113
+ }
114
+ const responseStatus = status ?? response?.statusCode
115
+ const additionalProperties: Record<string, any> | undefined =
116
+ responseStatus !== undefined ? { $response_status_code: responseStatus } : undefined
117
+ this.posthog.captureException(exception, distinctId, additionalProperties)
118
+ return throwError(() => exception)
119
+ })
120
+ )
113
121
  }
114
- const responseStatus = status ?? response?.statusCode
115
- const additionalProperties: Record<string, any> | undefined =
116
- responseStatus !== undefined ? { $response_status_code: responseStatus } : undefined
117
- this.posthog.captureException(exception, distinctId, additionalProperties)
118
- return throwError(() => exception)
119
- })
122
+
123
+ return source.subscribe(subscriber)
124
+ },
125
+ { fresh: true }
120
126
  )
121
- }
122
- return source
127
+ )
123
128
  }
124
129
  }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.47.0'
1
+ export const version = '5.47.2'