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/lib/index.d.ts
CHANGED
|
@@ -389,7 +389,7 @@ interface Mechanism {
|
|
|
389
389
|
declare class ErrorTracking {
|
|
390
390
|
private client;
|
|
391
391
|
private _exceptionAutocaptureEnabled;
|
|
392
|
-
static captureException(client: PostHog, error: unknown,
|
|
392
|
+
static captureException(client: PostHog, error: unknown, hint: EventHint, distinctId?: string, additionalProperties?: Record<string | number, any>): Promise<void>;
|
|
393
393
|
constructor(client: PostHog, options: PostHogOptions);
|
|
394
394
|
private startAutocaptureIfEnabled;
|
|
395
395
|
private onException;
|
|
@@ -472,7 +472,7 @@ declare class PostHog extends PostHogCoreStateless implements PostHogNodeV1 {
|
|
|
472
472
|
reloadFeatureFlags(): Promise<void>;
|
|
473
473
|
shutdown(shutdownTimeoutMs?: number): Promise<void>;
|
|
474
474
|
private addLocalPersonAndGroupProperties;
|
|
475
|
-
captureException(error: unknown, distinctId
|
|
475
|
+
captureException(error: unknown, distinctId?: string, additionalProperties?: Record<string | number, any>): void;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
/**
|
package/lib/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createReadStream } from 'node:fs';
|
|
|
3
3
|
import { createInterface } from 'node:readline';
|
|
4
4
|
import { posix, dirname, sep } from 'node:path';
|
|
5
5
|
|
|
6
|
-
var version = "4.5.
|
|
6
|
+
var version = "4.5.1";
|
|
7
7
|
|
|
8
8
|
var PostHogPersistedProperty;
|
|
9
9
|
(function (PostHogPersistedProperty) {
|
|
@@ -2874,10 +2874,12 @@ function getLastStackFrame(arr) {
|
|
|
2874
2874
|
|
|
2875
2875
|
const SHUTDOWN_TIMEOUT = 2000;
|
|
2876
2876
|
class ErrorTracking {
|
|
2877
|
-
static async captureException(client, error,
|
|
2877
|
+
static async captureException(client, error, hint, distinctId, additionalProperties) {
|
|
2878
2878
|
const properties = {
|
|
2879
2879
|
...additionalProperties
|
|
2880
2880
|
};
|
|
2881
|
+
// Given stateless nature of Node SDK we capture exceptions using personless processing when no
|
|
2882
|
+
// user can be determined because a distinct_id is not provided e.g. exception autocapture
|
|
2881
2883
|
if (!distinctId) {
|
|
2882
2884
|
properties.$process_person_profile = false;
|
|
2883
2885
|
}
|
|
@@ -2903,11 +2905,7 @@ class ErrorTracking {
|
|
|
2903
2905
|
}
|
|
2904
2906
|
}
|
|
2905
2907
|
onException(exception, hint) {
|
|
2906
|
-
|
|
2907
|
-
// when no user can be determined e.g. in the case of exception autocapture
|
|
2908
|
-
ErrorTracking.captureException(this.client, exception, uuidv7(), hint, {
|
|
2909
|
-
$process_person_profile: false
|
|
2910
|
-
});
|
|
2908
|
+
ErrorTracking.captureException(this.client, exception, hint);
|
|
2911
2909
|
}
|
|
2912
2910
|
async onFatalError() {
|
|
2913
2911
|
await this.client.shutdown(SHUTDOWN_TIMEOUT);
|
|
@@ -3245,9 +3243,9 @@ class PostHog extends PostHogCoreStateless {
|
|
|
3245
3243
|
}
|
|
3246
3244
|
captureException(error, distinctId, additionalProperties) {
|
|
3247
3245
|
const syntheticException = new Error('PostHog syntheticException');
|
|
3248
|
-
ErrorTracking.captureException(this, error,
|
|
3246
|
+
ErrorTracking.captureException(this, error, {
|
|
3249
3247
|
syntheticException
|
|
3250
|
-
}, additionalProperties);
|
|
3248
|
+
}, distinctId, additionalProperties);
|
|
3251
3249
|
}
|
|
3252
3250
|
}
|
|
3253
3251
|
|
|
@@ -3368,7 +3366,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
3368
3366
|
};
|
|
3369
3367
|
// Given stateless nature of Node SDK we capture exceptions using personless processing
|
|
3370
3368
|
// when no user can be determined e.g. in the case of exception autocapture
|
|
3371
|
-
ErrorTracking.captureException(_posthog, error, uuidv7(),
|
|
3369
|
+
ErrorTracking.captureException(_posthog, error, hint, uuidv7(), {
|
|
3372
3370
|
$process_person_profile: false
|
|
3373
3371
|
});
|
|
3374
3372
|
next(error);
|