posthog-node 5.8.3 → 5.8.5
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/dist/edge/index.cjs +14 -9
- package/dist/edge/index.cjs.map +1 -1
- package/dist/edge/index.mjs +14 -9
- package/dist/edge/index.mjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/node/index.cjs +14 -9
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +14 -9
- package/dist/node/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1111,6 +1111,7 @@ declare abstract class PostHogBackendClient extends PostHogCoreStateless impleme
|
|
|
1111
1111
|
* @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry
|
|
1112
1112
|
* @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)
|
|
1113
1113
|
* @param {SeverityLevel[] | '*'} [severityAllowList] Optional: send events matching the provided levels. Use '*' to send all events (default: ['error'])
|
|
1114
|
+
* @param {boolean} [sendExceptionsToPostHog] Optional: capture exceptions as events in PostHog (default: true)
|
|
1114
1115
|
*/
|
|
1115
1116
|
|
|
1116
1117
|
type _SentryEvent = any;
|
|
@@ -1129,14 +1130,15 @@ type SentryIntegrationOptions = {
|
|
|
1129
1130
|
projectId?: number;
|
|
1130
1131
|
prefix?: string;
|
|
1131
1132
|
severityAllowList?: SeverityLevel[] | '*';
|
|
1133
|
+
sendExceptionsToPostHog?: boolean;
|
|
1132
1134
|
};
|
|
1133
|
-
declare function createEventProcessor(_posthog: PostHogBackendClient, { organization, projectId, prefix, severityAllowList }?: SentryIntegrationOptions): (event: _SentryEvent) => _SentryEvent;
|
|
1135
|
+
declare function createEventProcessor(_posthog: PostHogBackendClient, { organization, projectId, prefix, severityAllowList, sendExceptionsToPostHog, }?: SentryIntegrationOptions): (event: _SentryEvent) => _SentryEvent;
|
|
1134
1136
|
declare function sentryIntegration(_posthog: PostHogBackendClient, options?: SentryIntegrationOptions): _SentryIntegration;
|
|
1135
1137
|
declare class PostHogSentryIntegration implements _SentryIntegrationClass {
|
|
1136
1138
|
readonly name = "posthog-node";
|
|
1137
1139
|
static readonly POSTHOG_ID_TAG = "posthog_distinct_id";
|
|
1138
1140
|
setupOnce: (addGlobalEventProcessor: (callback: _SentryEventProcessor) => void, getCurrentHub: () => _SentryHub) => void;
|
|
1139
|
-
constructor(_posthog: PostHogBackendClient, organization?: string, prefix?: string, severityAllowList?: SeverityLevel[] | '*');
|
|
1141
|
+
constructor(_posthog: PostHogBackendClient, organization?: string, prefix?: string, severityAllowList?: SeverityLevel[] | '*', sendExceptionsToPostHog?: boolean);
|
|
1140
1142
|
}
|
|
1141
1143
|
|
|
1142
1144
|
type ExpressMiddleware = (req: http.IncomingMessage, res: http.ServerResponse, next: () => void) => void;
|
package/dist/node/index.cjs
CHANGED
|
@@ -27,13 +27,15 @@ var core = require('@posthog/core');
|
|
|
27
27
|
* @param {Number} [projectId] Optional: The Sentry project id, used to send a direct link from PostHog to Sentry
|
|
28
28
|
* @param {string} [prefix] Optional: Url of a self-hosted sentry instance (default: https://sentry.io/organizations/)
|
|
29
29
|
* @param {SeverityLevel[] | '*'} [severityAllowList] Optional: send events matching the provided levels. Use '*' to send all events (default: ['error'])
|
|
30
|
+
* @param {boolean} [sendExceptionsToPostHog] Optional: capture exceptions as events in PostHog (default: true)
|
|
30
31
|
*/
|
|
31
32
|
const NAME = 'posthog-node';
|
|
32
33
|
function createEventProcessor(_posthog, {
|
|
33
34
|
organization,
|
|
34
35
|
projectId,
|
|
35
36
|
prefix,
|
|
36
|
-
severityAllowList = ['error']
|
|
37
|
+
severityAllowList = ['error'],
|
|
38
|
+
sendExceptionsToPostHog = true
|
|
37
39
|
} = {}) {
|
|
38
40
|
return event => {
|
|
39
41
|
const shouldProcessLevel = severityAllowList === '*' || severityAllowList.includes(event.level);
|
|
@@ -83,11 +85,13 @@ function createEventProcessor(_posthog, {
|
|
|
83
85
|
if (organization && projectId) {
|
|
84
86
|
properties['$sentry_url'] = (prefix || 'https://sentry.io/organizations/') + organization + '/issues/?project=' + projectId + '&query=' + event.event_id;
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
if (sendExceptionsToPostHog) {
|
|
89
|
+
_posthog.capture({
|
|
90
|
+
event: '$exception',
|
|
91
|
+
distinctId: userId,
|
|
92
|
+
properties
|
|
93
|
+
});
|
|
94
|
+
}
|
|
91
95
|
return event;
|
|
92
96
|
};
|
|
93
97
|
}
|
|
@@ -103,7 +107,7 @@ function sentryIntegration(_posthog, options) {
|
|
|
103
107
|
}
|
|
104
108
|
// V7 integration - class based
|
|
105
109
|
class PostHogSentryIntegration {
|
|
106
|
-
constructor(_posthog, organization, prefix, severityAllowList) {
|
|
110
|
+
constructor(_posthog, organization, prefix, severityAllowList, sendExceptionsToPostHog) {
|
|
107
111
|
this.name = NAME;
|
|
108
112
|
// setupOnce gets called by Sentry when it intializes the plugin
|
|
109
113
|
this.name = NAME;
|
|
@@ -113,7 +117,8 @@ class PostHogSentryIntegration {
|
|
|
113
117
|
organization,
|
|
114
118
|
projectId,
|
|
115
119
|
prefix,
|
|
116
|
-
severityAllowList
|
|
120
|
+
severityAllowList,
|
|
121
|
+
sendExceptionsToPostHog: sendExceptionsToPostHog ?? true
|
|
117
122
|
}));
|
|
118
123
|
};
|
|
119
124
|
}
|
|
@@ -1186,7 +1191,7 @@ function snipLine(line, colno) {
|
|
|
1186
1191
|
return newLine;
|
|
1187
1192
|
}
|
|
1188
1193
|
|
|
1189
|
-
var version = "5.8.
|
|
1194
|
+
var version = "5.8.5";
|
|
1190
1195
|
|
|
1191
1196
|
/**
|
|
1192
1197
|
* A lazy value that is only computed when needed. Inspired by C#'s Lazy<T> class.
|