posthog-node 5.46.1 → 5.47.1

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":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/error-tracking/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,4BAA4B,CAAS;IAC7C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;IAwBlF,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO;WAIxC,iBAAiB,CAC5B,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,EACjD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,iBAAiB,CAAC,SAAS,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAClD,OAAO,CAAC,YAAY,CAAC;IAmBxB,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,WAAW;YAwBL,YAAY;IAM1B,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,IAAI;CAGjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/extensions/error-tracking/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIlE,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,4BAA4B,CAAS;IAC7C,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,OAAO,CAAQ;gBAEX,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;IAwBlF,MAAM,CAAC,yBAAyB,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO;WAIxC,iBAAiB,CAC5B,OAAO,EAAE,iBAAiB,CAAC,sBAAsB,EACjD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,iBAAiB,CAAC,SAAS,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,GAClD,OAAO,CAAC,YAAY,CAAC;IAwBxB,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,WAAW;YAwBL,YAAY;IAM1B,SAAS,IAAI,OAAO;IAIpB,QAAQ,IAAI,IAAI;CAGjB"}
@@ -50,6 +50,8 @@ class ErrorTracking {
50
50
  };
51
51
  const exceptionProperties = builder.buildFromUnknown(error, hint);
52
52
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
53
+ const injectedReleaseId = core_namespaceObject.ErrorTracking.getInjectedReleaseId();
54
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
53
55
  return {
54
56
  event: '$exception',
55
57
  distinctId: distinctId,
@@ -1,7 +1,7 @@
1
1
  import { addUncaughtExceptionListener, addUnhandledRejectionListener } from "./autocapture.mjs";
2
- import { BucketedRateLimiter, isObject, resolveExceptionRateLimiterConfig } from "@posthog/core";
2
+ import { BucketedRateLimiter, ErrorTracking, isObject, resolveExceptionRateLimiterConfig } from "@posthog/core";
3
3
  const SHUTDOWN_TIMEOUT = 2000;
4
- class ErrorTracking {
4
+ class error_tracking_ErrorTracking {
5
5
  constructor(client, options, _logger){
6
6
  this.client = client;
7
7
  this._exceptionAutocaptureEnabled = options.enableExceptionAutocapture || false;
@@ -22,6 +22,8 @@ class ErrorTracking {
22
22
  };
23
23
  const exceptionProperties = builder.buildFromUnknown(error, hint);
24
24
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
25
+ const injectedReleaseId = ErrorTracking.getInjectedReleaseId();
26
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
25
27
  return {
26
28
  event: '$exception',
27
29
  distinctId: distinctId,
@@ -40,8 +42,8 @@ class ErrorTracking {
40
42
  }
41
43
  onException(exception, hint) {
42
44
  this.client.addPendingPromise((async ()=>{
43
- if (!ErrorTracking.isPreviouslyCapturedError(exception)) {
44
- const eventMessage = await ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
45
+ if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(exception)) {
46
+ const eventMessage = await error_tracking_ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
45
47
  const exceptionProperties = eventMessage.properties;
46
48
  const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? 'Exception';
47
49
  const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
@@ -64,4 +66,4 @@ class ErrorTracking {
64
66
  this._rateLimiter.stop();
65
67
  }
66
68
  }
67
- export { ErrorTracking as default };
69
+ export { error_tracking_ErrorTracking as default };
@@ -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,OAA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,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 };
@@ -1 +1 @@
1
- {"version":3,"file":"sentry-integration.d.ts","sourceRoot":"","sources":["../../src/extensions/sentry-integration.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAiBrD,KAAK,YAAY,GAAG,GAAG,CAAA;AACvB,KAAK,qBAAqB,GAAG,GAAG,CAAA;AAEhC,KAAK,UAAU,GAAG,GAAG,CAAA;AAGrB,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,CAAA;CAChD;AAED,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,uBAAuB,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,E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B,uBAAuB,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,EAClE,aAAa,EAAE,MAAM,UAAU,KAC5B,IAAI,CAAA;gBAGP,QAAQ,EAAE,oBAAoB,EAC9B,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,MAAM,EACf,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,EAC3D,uBAAuB,CAAC,EAAE,OAAO;CAoBpC"}
@@ -24,10 +24,11 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
+ sentryIntegration: ()=>sentryIntegration,
27
28
  PostHogSentryIntegration: ()=>PostHogSentryIntegration,
28
- createEventProcessor: ()=>createEventProcessor,
29
- sentryIntegration: ()=>sentryIntegration
29
+ createEventProcessor: ()=>createEventProcessor
30
30
  });
31
+ const core_namespaceObject = require("@posthog/core");
31
32
  const NAME = 'posthog-node';
32
33
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
33
34
  'error'
@@ -64,6 +65,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
64
65
  $sentry_exception_type: exceptions[0]?.type,
65
66
  $sentry_tags: event.tags
66
67
  };
68
+ const injectedReleaseId = core_namespaceObject.ErrorTracking.getInjectedReleaseId();
69
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
67
70
  if (organization && projectId) properties['$sentry_url'] = (prefix || 'https://sentry.io/organizations/') + organization + '/issues/?project=' + projectId + '&query=' + event.event_id;
68
71
  if (sendExceptionsToPostHog) _posthog.capture({
69
72
  event: '$exception',
@@ -1,3 +1,4 @@
1
+ import { ErrorTracking } from "@posthog/core";
1
2
  const NAME = 'posthog-node';
2
3
  function createEventProcessor(_posthog, { organization, projectId, prefix, severityAllowList = [
3
4
  'error'
@@ -34,6 +35,8 @@ function createEventProcessor(_posthog, { organization, projectId, prefix, sever
34
35
  $sentry_exception_type: exceptions[0]?.type,
35
36
  $sentry_tags: event.tags
36
37
  };
38
+ const injectedReleaseId = ErrorTracking.getInjectedReleaseId();
39
+ if (injectedReleaseId) properties.$release_id = injectedReleaseId;
37
40
  if (organization && projectId) properties['$sentry_url'] = (prefix || 'https://sentry.io/organizations/') + organization + '/issues/?project=' + projectId + '&query=' + event.event_id;
38
41
  if (sendExceptionsToPostHog) _posthog.capture({
39
42
  event: '$exception',
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.46.1";
1
+ export declare const version = "5.47.1";
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.46.1';
29
+ const version = '5.47.1';
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.46.1';
1
+ const version = '5.47.1';
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.46.1",
3
+ "version": "5.47.1",
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.45.1"
31
+ "@posthog/core": "^1.46.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@edge-runtime/jest-environment": "^4.0.0",
@@ -54,6 +54,11 @@ export default class ErrorTracking {
54
54
  const exceptionProperties = builder.buildFromUnknown(error, hint)
55
55
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list)
56
56
 
57
+ const injectedReleaseId = CoreErrorTracking.getInjectedReleaseId()
58
+ if (injectedReleaseId) {
59
+ properties.$release_id = injectedReleaseId
60
+ }
61
+
57
62
  return {
58
63
  event: '$exception',
59
64
  // Leave distinctId resolution to prepareEventMessage which checks request context
@@ -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
  }
@@ -138,6 +138,7 @@ export function createEventProcessor(
138
138
  $exception_type: any
139
139
  $exception_list: any
140
140
  $exception_level: CoreErrorTracking.SeverityLevel
141
+ $release_id?: string
141
142
  } = {
142
143
  // PostHog Exception Properties,
143
144
  $exception_message: exceptions[0]?.value || event.message,
@@ -152,6 +153,11 @@ export function createEventProcessor(
152
153
  $sentry_tags: event.tags,
153
154
  }
154
155
 
156
+ const injectedReleaseId = CoreErrorTracking.getInjectedReleaseId()
157
+ if (injectedReleaseId) {
158
+ properties.$release_id = injectedReleaseId
159
+ }
160
+
155
161
  if (organization && projectId) {
156
162
  properties['$sentry_url'] =
157
163
  (prefix || 'https://sentry.io/organizations/') +
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '5.46.1'
1
+ export const version = '5.47.1'