posthog-node 4.4.0 → 4.4.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 +4 -0
- package/lib/index.cjs.js +5 -5
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/types.d.ts +1 -0
- package/lib/posthog-core/src/utils.d.ts +2 -0
- package/lib/posthog-node/src/fetch.d.ts +1 -2
- package/lib/posthog-node/src/posthog-node.d.ts +1 -0
- package/package.json +1 -1
- package/src/fetch.ts +3 -7
- package/src/posthog-node.ts +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -375,6 +375,7 @@ type PostHogNodeV1 = {
|
|
|
375
375
|
type PostHogOptions = PostHogCoreOptions & {
|
|
376
376
|
persistence?: 'memory';
|
|
377
377
|
personalApiKey?: string;
|
|
378
|
+
privacyMode?: boolean;
|
|
378
379
|
featureFlagsPollingInterval?: number;
|
|
379
380
|
maxCacheSize?: number;
|
|
380
381
|
fetch?: (url: string, options: PostHogFetchOptions) => Promise<PostHogFetchResponse>;
|
package/lib/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
|
|
3
|
-
var version = "4.4.
|
|
3
|
+
var version = "4.4.1";
|
|
4
4
|
|
|
5
5
|
var PostHogPersistedProperty;
|
|
6
6
|
(function (PostHogPersistedProperty) {
|
|
@@ -65,6 +65,9 @@ function safeSetTimeout(fn, timeout) {
|
|
|
65
65
|
// We unref if available to prevent Node.js hanging on exit
|
|
66
66
|
t?.unref && t?.unref();
|
|
67
67
|
return t;
|
|
68
|
+
}
|
|
69
|
+
function getFetch() {
|
|
70
|
+
return typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
// Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
|
|
@@ -1427,10 +1430,7 @@ class PostHogMemoryStorage {
|
|
|
1427
1430
|
* This is currently solved by using the global fetch if available instead.
|
|
1428
1431
|
* See https://github.com/PostHog/posthog-js-lite/issues/127 for more info
|
|
1429
1432
|
*/
|
|
1430
|
-
let _fetch =
|
|
1431
|
-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
1432
|
-
// @ts-ignore
|
|
1433
|
-
typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
|
|
1433
|
+
let _fetch = getFetch();
|
|
1434
1434
|
if (!_fetch) {
|
|
1435
1435
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1436
1436
|
const axios = require('axios');
|