posthog-node 4.5.0 → 4.5.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.
- package/CHANGELOG.md +6 -0
- package/lib/index.cjs.js +8 -10
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.esm.js +8 -10
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-node/src/error-tracking.d.ts +1 -1
- package/lib/posthog-node/src/posthog-node.d.ts +1 -1
- package/lib/posthog-node/src/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/error-tracking.ts +5 -4
- package/src/extensions/express.ts +1 -1
- package/src/posthog-node.ts +2 -2
- package/src/types.ts +1 -0
- package/test/feature-flags.spec.ts +2 -40
- package/test/posthog-node.spec.ts +0 -3
package/CHANGELOG.md
CHANGED
package/lib/index.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var node_fs = require('node:fs');
|
|
|
7
7
|
var node_readline = require('node:readline');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
|
|
10
|
-
var version = "4.5.
|
|
10
|
+
var version = "4.5.1";
|
|
11
11
|
|
|
12
12
|
var PostHogPersistedProperty;
|
|
13
13
|
(function (PostHogPersistedProperty) {
|
|
@@ -2878,10 +2878,12 @@ function getLastStackFrame(arr) {
|
|
|
2878
2878
|
|
|
2879
2879
|
const SHUTDOWN_TIMEOUT = 2000;
|
|
2880
2880
|
class ErrorTracking {
|
|
2881
|
-
static async captureException(client, error,
|
|
2881
|
+
static async captureException(client, error, hint, distinctId, additionalProperties) {
|
|
2882
2882
|
const properties = {
|
|
2883
2883
|
...additionalProperties
|
|
2884
2884
|
};
|
|
2885
|
+
// Given stateless nature of Node SDK we capture exceptions using personless processing when no
|
|
2886
|
+
// user can be determined because a distinct_id is not provided e.g. exception autocapture
|
|
2885
2887
|
if (!distinctId) {
|
|
2886
2888
|
properties.$process_person_profile = false;
|
|
2887
2889
|
}
|
|
@@ -2907,11 +2909,7 @@ class ErrorTracking {
|
|
|
2907
2909
|
}
|
|
2908
2910
|
}
|
|
2909
2911
|
onException(exception, hint) {
|
|
2910
|
-
|
|
2911
|
-
// when no user can be determined e.g. in the case of exception autocapture
|
|
2912
|
-
ErrorTracking.captureException(this.client, exception, uuidv7(), hint, {
|
|
2913
|
-
$process_person_profile: false
|
|
2914
|
-
});
|
|
2912
|
+
ErrorTracking.captureException(this.client, exception, hint);
|
|
2915
2913
|
}
|
|
2916
2914
|
async onFatalError() {
|
|
2917
2915
|
await this.client.shutdown(SHUTDOWN_TIMEOUT);
|
|
@@ -3249,9 +3247,9 @@ class PostHog extends PostHogCoreStateless {
|
|
|
3249
3247
|
}
|
|
3250
3248
|
captureException(error, distinctId, additionalProperties) {
|
|
3251
3249
|
const syntheticException = new Error('PostHog syntheticException');
|
|
3252
|
-
ErrorTracking.captureException(this, error,
|
|
3250
|
+
ErrorTracking.captureException(this, error, {
|
|
3253
3251
|
syntheticException
|
|
3254
|
-
}, additionalProperties);
|
|
3252
|
+
}, distinctId, additionalProperties);
|
|
3255
3253
|
}
|
|
3256
3254
|
}
|
|
3257
3255
|
|
|
@@ -3372,7 +3370,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
3372
3370
|
};
|
|
3373
3371
|
// Given stateless nature of Node SDK we capture exceptions using personless processing
|
|
3374
3372
|
// when no user can be determined e.g. in the case of exception autocapture
|
|
3375
|
-
ErrorTracking.captureException(_posthog, error, uuidv7(),
|
|
3373
|
+
ErrorTracking.captureException(_posthog, error, hint, uuidv7(), {
|
|
3376
3374
|
$process_person_profile: false
|
|
3377
3375
|
});
|
|
3378
3376
|
next(error);
|