posthog-node 5.57.2 → 5.58.0

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.
Files changed (55) hide show
  1. package/README.md +39 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +10 -4
  4. package/dist/client.mjs +10 -4
  5. package/dist/entrypoints/otel.d.ts +18 -0
  6. package/dist/entrypoints/otel.d.ts.map +1 -0
  7. package/dist/entrypoints/otel.js +99 -0
  8. package/dist/entrypoints/otel.mjs +58 -0
  9. package/dist/exports.d.ts +1 -0
  10. package/dist/exports.d.ts.map +1 -1
  11. package/dist/exports.js +30 -20
  12. package/dist/exports.mjs +1 -0
  13. package/dist/extensions/context/context.d.ts.map +1 -1
  14. package/dist/extensions/context/context.js +12 -8
  15. package/dist/extensions/context/context.mjs +12 -8
  16. package/dist/extensions/context/event-context.d.ts +5 -0
  17. package/dist/extensions/context/event-context.d.ts.map +1 -0
  18. package/dist/extensions/context/event-context.js +57 -0
  19. package/dist/extensions/context/event-context.mjs +16 -0
  20. package/dist/extensions/context/lifetime.d.ts +8 -0
  21. package/dist/extensions/context/lifetime.d.ts.map +1 -0
  22. package/dist/extensions/context/lifetime.js +60 -0
  23. package/dist/extensions/context/lifetime.mjs +19 -0
  24. package/dist/extensions/context/listeners.d.ts +11 -0
  25. package/dist/extensions/context/listeners.d.ts.map +1 -0
  26. package/dist/extensions/context/listeners.js +65 -0
  27. package/dist/extensions/context/listeners.mjs +21 -0
  28. package/dist/extensions/context/types.d.ts +5 -0
  29. package/dist/extensions/context/types.d.ts.map +1 -1
  30. package/dist/extensions/error-tracking/index.d.ts +2 -1
  31. package/dist/extensions/error-tracking/index.d.ts.map +1 -1
  32. package/dist/extensions/error-tracking/index.js +6 -4
  33. package/dist/extensions/error-tracking/index.mjs +6 -4
  34. package/dist/extensions/express.d.ts.map +1 -1
  35. package/dist/extensions/express.js +10 -3
  36. package/dist/extensions/express.mjs +10 -3
  37. package/dist/extensions/nestjs.d.ts.map +1 -1
  38. package/dist/extensions/nestjs.js +2 -0
  39. package/dist/extensions/nestjs.mjs +2 -0
  40. package/dist/version.d.ts +1 -1
  41. package/dist/version.js +1 -1
  42. package/dist/version.mjs +1 -1
  43. package/package.json +13 -6
  44. package/src/client.ts +16 -4
  45. package/src/entrypoints/otel.ts +75 -0
  46. package/src/exports.ts +1 -0
  47. package/src/extensions/context/context.ts +16 -10
  48. package/src/extensions/context/event-context.ts +14 -0
  49. package/src/extensions/context/lifetime.ts +28 -0
  50. package/src/extensions/context/listeners.ts +36 -0
  51. package/src/extensions/context/types.ts +5 -0
  52. package/src/extensions/error-tracking/index.ts +11 -4
  53. package/src/extensions/express.ts +11 -3
  54. package/src/extensions/nestjs.ts +2 -0
  55. package/src/version.ts +1 -1
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ const capturedContext = Symbol('capturedContext');
31
+ function snapshotEventContext(context) {
32
+ const snapshot = context ? {
33
+ ...context,
34
+ properties: {
35
+ ...context.properties
36
+ }
37
+ } : null;
38
+ return (event)=>Object.assign(event, {
39
+ [capturedContext]: snapshot
40
+ });
41
+ }
42
+ function getEventContext(event, fallback) {
43
+ return capturedContext in event ? event[capturedContext] ?? void 0 : fallback;
44
+ }
45
+ __webpack_require__.d(__webpack_exports__, {
46
+ getEventContext: ()=>getEventContext,
47
+ snapshotEventContext: ()=>snapshotEventContext
48
+ });
49
+ exports.getEventContext = __webpack_exports__.getEventContext;
50
+ exports.snapshotEventContext = __webpack_exports__.snapshotEventContext;
51
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
52
+ "getEventContext",
53
+ "snapshotEventContext"
54
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
55
+ Object.defineProperty(exports, '__esModule', {
56
+ value: true
57
+ });
@@ -0,0 +1,16 @@
1
+ const capturedContext = Symbol('capturedContext');
2
+ function snapshotEventContext(context) {
3
+ const snapshot = context ? {
4
+ ...context,
5
+ properties: {
6
+ ...context.properties
7
+ }
8
+ } : null;
9
+ return (event)=>Object.assign(event, {
10
+ [capturedContext]: snapshot
11
+ });
12
+ }
13
+ function getEventContext(event, fallback) {
14
+ return capturedContext in event ? event[capturedContext] ?? void 0 : fallback;
15
+ }
16
+ export { getEventContext, snapshotEventContext };
@@ -0,0 +1,8 @@
1
+ import type { ContextData } from './types';
2
+ export interface ContextLifetime {
3
+ signal: AbortSignal;
4
+ parent?: ContextLifetime;
5
+ }
6
+ export declare function inheritContextLifetime(parent: ContextData | undefined, child: ContextData, signal?: AbortSignal): ContextData;
7
+ export declare function isContextActive(context: ContextData): boolean;
8
+ //# sourceMappingURL=lifetime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifetime.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,CAAA;IACnB,MAAM,CAAC,EAAE,eAAe,CAAA;CACzB;AAID,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,KAAK,EAAE,WAAW,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,WAAW,CAKb;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAO7D"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ const lifetimes = new WeakMap();
31
+ function inheritContextLifetime(parent, child, signal) {
32
+ const lifetime = parent && lifetimes.get(parent);
33
+ if (signal) lifetimes.set(child, {
34
+ signal,
35
+ parent: lifetime
36
+ });
37
+ else if (lifetime) lifetimes.set(child, lifetime);
38
+ return child;
39
+ }
40
+ function isContextActive(context) {
41
+ let lifetime = lifetimes.get(context);
42
+ while(lifetime){
43
+ if (lifetime.signal.aborted) return false;
44
+ lifetime = lifetime.parent;
45
+ }
46
+ return true;
47
+ }
48
+ __webpack_require__.d(__webpack_exports__, {
49
+ inheritContextLifetime: ()=>inheritContextLifetime,
50
+ isContextActive: ()=>isContextActive
51
+ });
52
+ exports.inheritContextLifetime = __webpack_exports__.inheritContextLifetime;
53
+ exports.isContextActive = __webpack_exports__.isContextActive;
54
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
55
+ "inheritContextLifetime",
56
+ "isContextActive"
57
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
58
+ Object.defineProperty(exports, '__esModule', {
59
+ value: true
60
+ });
@@ -0,0 +1,19 @@
1
+ const lifetimes = new WeakMap();
2
+ function inheritContextLifetime(parent, child, signal) {
3
+ const lifetime = parent && lifetimes.get(parent);
4
+ if (signal) lifetimes.set(child, {
5
+ signal,
6
+ parent: lifetime
7
+ });
8
+ else if (lifetime) lifetimes.set(child, lifetime);
9
+ return child;
10
+ }
11
+ function isContextActive(context) {
12
+ let lifetime = lifetimes.get(context);
13
+ while(lifetime){
14
+ if (lifetime.signal.aborted) return false;
15
+ lifetime = lifetime.parent;
16
+ }
17
+ return true;
18
+ }
19
+ export { inheritContextLifetime, isContextActive };
@@ -0,0 +1,11 @@
1
+ import type { PostHogBackendClient } from '../../client';
2
+ type ContextListener = (requestEntry: boolean) => void;
3
+ export declare function addContextListener(client: PostHogBackendClient, listener: ContextListener): () => void;
4
+ export declare function notifyContextListeners(client: PostHogBackendClient, requestEntry?: boolean): void;
5
+ /**
6
+ * Notify installed span processors after request IDs become available.
7
+ * This entry point does not load OpenTelemetry; without a processor it does nothing.
8
+ */
9
+ export declare function enrichCurrentSpan(client: PostHogBackendClient): void;
10
+ export {};
11
+ //# sourceMappingURL=listeners.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listeners.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/listeners.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAExD,KAAK,eAAe,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAA;AAStD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,GAAG,MAAM,IAAI,CAQtG;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,oBAAoB,EAAE,YAAY,UAAQ,GAAG,IAAI,CAM/F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAEpE"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, getters, values)=>{
5
+ var define = (defs, kind)=>{
6
+ for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
+ enumerable: true,
8
+ [kind]: defs[key]
9
+ });
10
+ };
11
+ define(getters, "get");
12
+ define(values, "value");
13
+ };
14
+ })();
15
+ (()=>{
16
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
+ })();
18
+ (()=>{
19
+ __webpack_require__.r = (exports1)=>{
20
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
+ value: 'Module'
22
+ });
23
+ Object.defineProperty(exports1, '__esModule', {
24
+ value: true
25
+ });
26
+ };
27
+ })();
28
+ var __webpack_exports__ = {};
29
+ __webpack_require__.r(__webpack_exports__);
30
+ const REGISTRY_KEY = Symbol.for('posthog-node.context-listeners');
31
+ const registryHolder = globalThis;
32
+ const listeners = registryHolder[REGISTRY_KEY] ??= new WeakMap();
33
+ function addContextListener(client, listener) {
34
+ const callbacks = listeners.get(client) ?? new Set();
35
+ listeners.set(client, callbacks);
36
+ callbacks.add(listener);
37
+ return ()=>{
38
+ callbacks.delete(listener);
39
+ if (!callbacks.size) listeners.delete(client);
40
+ };
41
+ }
42
+ function notifyContextListeners(client, requestEntry = false) {
43
+ for (const listener of listeners.get(client) ?? [])try {
44
+ listener(requestEntry);
45
+ } catch {}
46
+ }
47
+ function enrichCurrentSpan(client) {
48
+ notifyContextListeners(client, true);
49
+ }
50
+ __webpack_require__.d(__webpack_exports__, {
51
+ addContextListener: ()=>addContextListener,
52
+ enrichCurrentSpan: ()=>enrichCurrentSpan,
53
+ notifyContextListeners: ()=>notifyContextListeners
54
+ });
55
+ exports.addContextListener = __webpack_exports__.addContextListener;
56
+ exports.enrichCurrentSpan = __webpack_exports__.enrichCurrentSpan;
57
+ exports.notifyContextListeners = __webpack_exports__.notifyContextListeners;
58
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
59
+ "addContextListener",
60
+ "enrichCurrentSpan",
61
+ "notifyContextListeners"
62
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
63
+ Object.defineProperty(exports, '__esModule', {
64
+ value: true
65
+ });
@@ -0,0 +1,21 @@
1
+ const REGISTRY_KEY = Symbol.for('posthog-node.context-listeners');
2
+ const registryHolder = globalThis;
3
+ const listeners = registryHolder[REGISTRY_KEY] ??= new WeakMap();
4
+ function addContextListener(client, listener) {
5
+ const callbacks = listeners.get(client) ?? new Set();
6
+ listeners.set(client, callbacks);
7
+ callbacks.add(listener);
8
+ return ()=>{
9
+ callbacks.delete(listener);
10
+ if (!callbacks.size) listeners.delete(client);
11
+ };
12
+ }
13
+ function notifyContextListeners(client, requestEntry = false) {
14
+ for (const listener of listeners.get(client) ?? [])try {
15
+ listener(requestEntry);
16
+ } catch {}
17
+ }
18
+ function enrichCurrentSpan(client) {
19
+ notifyContextListeners(client, true);
20
+ }
21
+ export { addContextListener, enrichCurrentSpan, notifyContextListeners };
@@ -10,6 +10,11 @@ export interface ContextOptions {
10
10
  * @default false
11
11
  */
12
12
  fresh?: boolean;
13
+ /**
14
+ * Ends this context and its inherited scopes when aborted, without cancelling the callback.
15
+ * An already aborted signal starts no active context. A fresh context has an independent lifetime.
16
+ */
17
+ signal?: AbortSignal;
13
18
  }
14
19
  export interface IPostHogContext {
15
20
  get(): ContextData | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,IAAI,WAAW,GAAG,SAAS,CAAA;IAC9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAAA;IACtE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC5D"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/extensions/context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,IAAI,WAAW,GAAG,SAAS,CAAA;IAC9B,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,CAAC,CAAA;IACtE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC5D"}
@@ -1,4 +1,5 @@
1
1
  import { PostHogBackendClient } from '../../client';
2
+ import type { ContextData } from '../context/types';
2
3
  import { EventMessage, PostHogOptions } from '../../types';
3
4
  import type { Logger } from '@posthog/core';
4
5
  import { ErrorTracking as CoreErrorTracking } from '@posthog/core';
@@ -9,7 +10,7 @@ export default class ErrorTracking {
9
10
  private _logger;
10
11
  constructor(client: PostHogBackendClient, options: PostHogOptions, _logger: Logger);
11
12
  static isPreviouslyCapturedError(x: unknown): boolean;
12
- static buildEventMessage(builder: CoreErrorTracking.ErrorPropertiesBuilder, error: unknown, hint: CoreErrorTracking.EventHint, distinctId?: string, additionalProperties?: Record<string | number, any>): Promise<EventMessage>;
13
+ static buildEventMessage(builder: CoreErrorTracking.ErrorPropertiesBuilder, error: unknown, hint: CoreErrorTracking.EventHint, distinctId?: string, additionalProperties?: Record<string | number, any>, context?: ContextData): Promise<EventMessage>;
13
14
  private startAutocaptureIfEnabled;
14
15
  private onException;
15
16
  private onFatalError;
@@ -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;IAEvB,YAAY,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAsBjF;IAED,MAAM,CAAC,yBAAyB,CA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iBAAiB,CAAC,SAAS,EACjC,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,EACnD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC,CAuBvB;IAED,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,WAAW;YA2BL,YAAY;IAM1B,SAAS,IAAI,OAAO,CAEnB;IAED,QAAQ,IAAI,IAAI,CAEf;CACF"}
@@ -31,6 +31,7 @@ __webpack_require__.d(__webpack_exports__, {
31
31
  default: ()=>ErrorTracking
32
32
  });
33
33
  const external_autocapture_js_namespaceObject = require("./autocapture.js");
34
+ const event_context_js_namespaceObject = require("../context/event-context.js");
34
35
  const core_namespaceObject = require("@posthog/core");
35
36
  const SHUTDOWN_TIMEOUT = 2000;
36
37
  class ErrorTracking {
@@ -48,7 +49,8 @@ class ErrorTracking {
48
49
  static isPreviouslyCapturedError(x) {
49
50
  return (0, core_namespaceObject.isObject)(x) && '__posthog_previously_captured_error' in x && true === x.__posthog_previously_captured_error;
50
51
  }
51
- static async buildEventMessage(builder, error, hint, distinctId, additionalProperties) {
52
+ static async buildEventMessage(builder, error, hint, distinctId, additionalProperties, context) {
53
+ const applyContextSnapshot = (0, event_context_js_namespaceObject.snapshotEventContext)(context);
52
54
  const properties = {
53
55
  ...additionalProperties
54
56
  };
@@ -56,7 +58,7 @@ class ErrorTracking {
56
58
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
57
59
  const injectedReleaseId = core_namespaceObject.ErrorTracking.getInjectedReleaseId();
58
60
  if (injectedReleaseId) properties.$release_id = injectedReleaseId;
59
- return {
61
+ return applyContextSnapshot({
60
62
  event: '$exception',
61
63
  distinctId: distinctId,
62
64
  properties: {
@@ -64,7 +66,7 @@ class ErrorTracking {
64
66
  ...properties
65
67
  },
66
68
  _originatedFromCaptureException: true
67
- };
69
+ });
68
70
  }
69
71
  startAutocaptureIfEnabled() {
70
72
  if (this.isEnabled()) {
@@ -75,7 +77,7 @@ class ErrorTracking {
75
77
  onException(exception, hint) {
76
78
  this.client.addPendingPromise((async ()=>{
77
79
  if (!ErrorTracking.isPreviouslyCapturedError(exception)) {
78
- const eventMessage = await ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
80
+ const eventMessage = await ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint, void 0, void 0, this.client.getContext());
79
81
  const exceptionProperties = eventMessage.properties;
80
82
  const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? 'Exception';
81
83
  const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
@@ -1,4 +1,5 @@
1
1
  import { addUncaughtExceptionListener, addUnhandledRejectionListener } from "./autocapture.mjs";
2
+ import { snapshotEventContext } from "../context/event-context.mjs";
2
3
  import { BucketedRateLimiter, ErrorTracking, isObject, resolveExceptionRateLimiterConfig } from "@posthog/core";
3
4
  const SHUTDOWN_TIMEOUT = 2000;
4
5
  class error_tracking_ErrorTracking {
@@ -16,7 +17,8 @@ class error_tracking_ErrorTracking {
16
17
  static isPreviouslyCapturedError(x) {
17
18
  return isObject(x) && '__posthog_previously_captured_error' in x && true === x.__posthog_previously_captured_error;
18
19
  }
19
- static async buildEventMessage(builder, error, hint, distinctId, additionalProperties) {
20
+ static async buildEventMessage(builder, error, hint, distinctId, additionalProperties, context) {
21
+ const applyContextSnapshot = snapshotEventContext(context);
20
22
  const properties = {
21
23
  ...additionalProperties
22
24
  };
@@ -24,7 +26,7 @@ class error_tracking_ErrorTracking {
24
26
  exceptionProperties.$exception_list = await builder.modifyFrames(exceptionProperties.$exception_list);
25
27
  const injectedReleaseId = ErrorTracking.getInjectedReleaseId();
26
28
  if (injectedReleaseId) properties.$release_id = injectedReleaseId;
27
- return {
29
+ return applyContextSnapshot({
28
30
  event: '$exception',
29
31
  distinctId: distinctId,
30
32
  properties: {
@@ -32,7 +34,7 @@ class error_tracking_ErrorTracking {
32
34
  ...properties
33
35
  },
34
36
  _originatedFromCaptureException: true
35
- };
37
+ });
36
38
  }
37
39
  startAutocaptureIfEnabled() {
38
40
  if (this.isEnabled()) {
@@ -43,7 +45,7 @@ class error_tracking_ErrorTracking {
43
45
  onException(exception, hint) {
44
46
  this.client.addPendingPromise((async ()=>{
45
47
  if (!error_tracking_ErrorTracking.isPreviouslyCapturedError(exception)) {
46
- const eventMessage = await error_tracking_ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint);
48
+ const eventMessage = await error_tracking_ErrorTracking.buildEventMessage(this.client.getErrorPropertiesBuilder(), exception, hint, void 0, void 0, this.client.getContext());
47
49
  const exceptionProperties = eventMessage.properties;
48
50
  const exceptionType = exceptionProperties?.$exception_list[0]?.type ?? 'Exception';
49
51
  const isRateLimited = this._rateLimiter.consumeRateLimit(exceptionType);
@@ -1 +1 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../src/extensions/express.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAIhD,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGhD,KAAK,iBAAiB,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,CAAA;AAEhF,KAAK,sBAAsB,GAAG,CAC5B,KAAK,EAAE,eAAe,EACtB,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,KACnC,IAAI,CAAA;AAET,UAAU,eAAgB,SAAQ,KAAK;IACrC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA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,GAAG,EAAE;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,KAAK,OAAO,CAAA;CAChD,GACA,IAAI,CAEN;AAWD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,oBAAoB,EAC9B,GAAG,EAAE;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,iBAAiB,GAAG,sBAAsB,KAAK,OAAO,CAAA;CACzE,GACA,IAAI,CAEN"}
@@ -44,6 +44,7 @@ const index_js_namespaceObject = require("./error-tracking/index.js");
44
44
  var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
45
45
  const external_tracing_headers_js_namespaceObject = require("./tracing-headers.js");
46
46
  const external_url_utils_js_namespaceObject = require("./url-utils.js");
47
+ const listeners_js_namespaceObject = require("./context/listeners.js");
47
48
  function getClientIp(req) {
48
49
  const forwarded = (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(req.headers['x-forwarded-for']);
49
50
  if (forwarded) {
@@ -53,7 +54,10 @@ function getClientIp(req) {
53
54
  return req.socket?.remoteAddress;
54
55
  }
55
56
  function buildRequestContextData(posthog, req) {
56
- const { sessionId, distinctId } = (0, external_tracing_headers_js_namespaceObject.getPostHogTracingHeaderValues)(req.headers);
57
+ const headers = (0, external_tracing_headers_js_namespaceObject.getPostHogTracingHeaderValues)(req.headers);
58
+ const context = posthog.getContext();
59
+ const sessionId = context?.sessionId ?? headers.sessionId;
60
+ const distinctId = context?.distinctId ?? headers.distinctId;
57
61
  const properties = {};
58
62
  const disableCaptureUrlHashes = true === posthog.options.disable_capture_url_hashes;
59
63
  (0, external_tracing_headers_js_namespaceObject.addProperty)(properties, '$current_url', (0, external_url_utils_js_namespaceObject.normalizeRequestCurrentUrl)(req.originalUrl || req.url, disableCaptureUrlHashes));
@@ -76,7 +80,10 @@ function setupExpressRequestContext(_posthog, app) {
76
80
  }
77
81
  function posthogRequestContext(posthog) {
78
82
  return (req, _res, next)=>{
79
- posthog.withContext(buildRequestContextData(posthog, req), ()=>next());
83
+ posthog.withContext(buildRequestContextData(posthog, req), ()=>{
84
+ (0, listeners_js_namespaceObject.notifyContextListeners)(posthog, true);
85
+ next();
86
+ });
80
87
  };
81
88
  }
82
89
  function setupExpressErrorHandler(_posthog, app) {
@@ -117,7 +124,7 @@ function posthogErrorHandler(posthog) {
117
124
  ...contextData.properties || {}
118
125
  };
119
126
  posthog.addPendingPromise(Promise.all([
120
- index_js_default().buildEventMessage(posthog.getErrorPropertiesBuilder(), error, hint, contextData.distinctId, additionalProperties),
127
+ index_js_default().buildEventMessage(posthog.getErrorPropertiesBuilder(), error, hint, contextData.distinctId, additionalProperties, posthog.getContext()),
121
128
  getResponseStatusCode(res)
122
129
  ]).then(([msg, statusCode])=>{
123
130
  if (void 0 !== statusCode) msg.properties = {
@@ -1,6 +1,7 @@
1
1
  import error_tracking from "./error-tracking/index.mjs";
2
2
  import { addProperty, getFirstHeaderValue, getPostHogTracingHeaderValues } from "./tracing-headers.mjs";
3
3
  import { normalizeRequestCurrentUrl, normalizeRequestPath } from "./url-utils.mjs";
4
+ import { notifyContextListeners } from "./context/listeners.mjs";
4
5
  function getClientIp(req) {
5
6
  const forwarded = getFirstHeaderValue(req.headers['x-forwarded-for']);
6
7
  if (forwarded) {
@@ -10,7 +11,10 @@ function getClientIp(req) {
10
11
  return req.socket?.remoteAddress;
11
12
  }
12
13
  function buildRequestContextData(posthog, req) {
13
- const { sessionId, distinctId } = getPostHogTracingHeaderValues(req.headers);
14
+ const headers = getPostHogTracingHeaderValues(req.headers);
15
+ const context = posthog.getContext();
16
+ const sessionId = context?.sessionId ?? headers.sessionId;
17
+ const distinctId = context?.distinctId ?? headers.distinctId;
14
18
  const properties = {};
15
19
  const disableCaptureUrlHashes = true === posthog.options.disable_capture_url_hashes;
16
20
  addProperty(properties, '$current_url', normalizeRequestCurrentUrl(req.originalUrl || req.url, disableCaptureUrlHashes));
@@ -33,7 +37,10 @@ function setupExpressRequestContext(_posthog, app) {
33
37
  }
34
38
  function posthogRequestContext(posthog) {
35
39
  return (req, _res, next)=>{
36
- posthog.withContext(buildRequestContextData(posthog, req), ()=>next());
40
+ posthog.withContext(buildRequestContextData(posthog, req), ()=>{
41
+ notifyContextListeners(posthog, true);
42
+ next();
43
+ });
37
44
  };
38
45
  }
39
46
  function setupExpressErrorHandler(_posthog, app) {
@@ -74,7 +81,7 @@ function posthogErrorHandler(posthog) {
74
81
  ...contextData.properties || {}
75
82
  };
76
83
  posthog.addPendingPromise(Promise.all([
77
- error_tracking.buildEventMessage(posthog.getErrorPropertiesBuilder(), error, hint, contextData.distinctId, additionalProperties),
84
+ error_tracking.buildEventMessage(posthog.getErrorPropertiesBuilder(), error, hint, contextData.distinctId, additionalProperties, posthog.getContext()),
78
85
  getResponseStatusCode(res)
79
86
  ]).then(([msg, statusCode])=>{
80
87
  if (void 0 !== statusCode) msg.properties = {
@@ -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;I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BAAyB;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;IAElC,YAAY,OAAO,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,yBAAyB,EAK7E;IAED,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAAC,GAAG,CAAC,CAyDvE;CACF"}
@@ -45,6 +45,7 @@ const index_js_namespaceObject = require("./error-tracking/index.js");
45
45
  var index_js_default = /*#__PURE__*/ __webpack_require__.n(index_js_namespaceObject);
46
46
  const external_tracing_headers_js_namespaceObject = require("./tracing-headers.js");
47
47
  const external_url_utils_js_namespaceObject = require("./url-utils.js");
48
+ const listeners_js_namespaceObject = require("./context/listeners.js");
48
49
  function getClientIp(headers, request) {
49
50
  const forwarded = (0, external_tracing_headers_js_namespaceObject.getFirstHeaderValue)(headers['x-forwarded-for']);
50
51
  if (forwarded) {
@@ -89,6 +90,7 @@ class PostHogInterceptor {
89
90
  properties
90
91
  };
91
92
  return new external_rxjs_namespaceObject.Observable((subscriber)=>this.posthog.withContext(contextData, ()=>{
93
+ (0, listeners_js_namespaceObject.notifyContextListeners)(this.posthog, true);
92
94
  let source = next.handle();
93
95
  if (this.captureExceptions) source = source.pipe((0, operators_namespaceObject.catchError)((exception)=>{
94
96
  if (index_js_default().isPreviouslyCapturedError(exception)) return (0, external_rxjs_namespaceObject.throwError)(()=>exception);
@@ -3,6 +3,7 @@ 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";
5
5
  import { normalizeRequestCurrentUrl, normalizeRequestPath } from "./url-utils.mjs";
6
+ import { notifyContextListeners } from "./context/listeners.mjs";
6
7
  function getClientIp(headers, request) {
7
8
  const forwarded = getFirstHeaderValue(headers['x-forwarded-for']);
8
9
  if (forwarded) {
@@ -47,6 +48,7 @@ class PostHogInterceptor {
47
48
  properties
48
49
  };
49
50
  return new Observable((subscriber)=>this.posthog.withContext(contextData, ()=>{
51
+ notifyContextListeners(this.posthog, true);
50
52
  let source = next.handle();
51
53
  if (this.captureExceptions) source = source.pipe(catchError((exception)=>{
52
54
  if (error_tracking.isPreviouslyCapturedError(exception)) return throwError(()=>exception);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const version = "5.57.2";
1
+ export declare const version = "5.58.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -27,7 +27,7 @@ var __webpack_require__ = {};
27
27
  })();
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
- const version = "5.57.2";
30
+ const version = "5.58.0";
31
31
  __webpack_require__.d(__webpack_exports__, {}, {
32
32
  version: version
33
33
  });
package/dist/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- const version = "5.57.2";
1
+ const version = "5.58.0";
2
2
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "posthog-node",
3
- "version": "5.57.2",
3
+ "version": "5.58.0",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -29,22 +29,23 @@
29
29
  "module": "dist/entrypoints/index.node.mjs",
30
30
  "types": "dist/entrypoints/index.node.d.ts",
31
31
  "dependencies": {
32
- "@posthog/core": "^1.60.1"
32
+ "@posthog/core": "^1.61.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@edge-runtime/vm": "^5.0.0",
36
36
  "@opentelemetry/api": "^1.9.0",
37
37
  "@opentelemetry/context-async-hooks": "^2.2.0",
38
+ "@opentelemetry/sdk-trace-base": "^2.10.0",
38
39
  "@rslib/core": "0.23.2",
39
40
  "@types/express": "^5.0.6",
40
41
  "@types/node": "^20.0.0",
41
42
  "esbuild": "^0.25.0",
42
- "rxjs": "^7.8.0",
43
43
  "@vitest/coverage-v8": "^1.6.1",
44
- "vitest": "^1.6.1",
44
+ "rxjs": "^7.8.0",
45
45
  "typescript": "7.0.2",
46
- "@posthog/types": "^1.416.0",
47
- "@posthog-tooling/tsconfig-base": "1.1.1"
46
+ "vitest": "^1.6.1",
47
+ "@posthog-tooling/tsconfig-base": "1.1.1",
48
+ "@posthog/types": "^1.418.0"
48
49
  },
49
50
  "peerDependencies": {
50
51
  "@opentelemetry/api": "^1.2.0",
@@ -106,6 +107,12 @@
106
107
  "import": "./dist/experimental.mjs",
107
108
  "require": "./dist/experimental.js",
108
109
  "default": "./dist/experimental.js"
110
+ },
111
+ "./otel": {
112
+ "types": "./dist/entrypoints/otel.d.ts",
113
+ "import": "./dist/entrypoints/otel.mjs",
114
+ "require": "./dist/entrypoints/otel.js",
115
+ "default": "./dist/entrypoints/otel.js"
109
116
  }
110
117
  },
111
118
  "scripts": {