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/CHANGELOG.md
CHANGED
package/lib/index.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
6
|
|
|
7
|
-
var version = "4.4.
|
|
7
|
+
var version = "4.4.1";
|
|
8
8
|
|
|
9
9
|
var PostHogPersistedProperty;
|
|
10
10
|
(function (PostHogPersistedProperty) {
|
|
@@ -69,6 +69,9 @@ function safeSetTimeout(fn, timeout) {
|
|
|
69
69
|
// We unref if available to prevent Node.js hanging on exit
|
|
70
70
|
t?.unref && t?.unref();
|
|
71
71
|
return t;
|
|
72
|
+
}
|
|
73
|
+
function getFetch() {
|
|
74
|
+
return typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
// Copyright (c) 2013 Pieroxy <pieroxy@pieroxy.net>
|
|
@@ -1431,10 +1434,7 @@ class PostHogMemoryStorage {
|
|
|
1431
1434
|
* This is currently solved by using the global fetch if available instead.
|
|
1432
1435
|
* See https://github.com/PostHog/posthog-js-lite/issues/127 for more info
|
|
1433
1436
|
*/
|
|
1434
|
-
let _fetch =
|
|
1435
|
-
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
1436
|
-
// @ts-ignore
|
|
1437
|
-
typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
|
|
1437
|
+
let _fetch = getFetch();
|
|
1438
1438
|
if (!_fetch) {
|
|
1439
1439
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1440
1440
|
const axios = require('axios');
|