@posthog/core 1.25.1 → 1.25.3
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/gzip.d.ts +11 -1
- package/dist/gzip.d.ts.map +1 -1
- package/dist/gzip.js +12 -3
- package/dist/gzip.mjs +8 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -12
- package/dist/index.mjs +2 -2
- package/dist/posthog-core-stateless.d.ts.map +1 -1
- package/dist/posthog-core-stateless.js +6 -3
- package/dist/posthog-core-stateless.mjs +6 -3
- package/package.json +1 -1
- package/src/gzip.ts +25 -1
- package/src/index.ts +1 -1
- package/src/posthog-core-stateless.ts +12 -3
package/dist/gzip.d.ts
CHANGED
|
@@ -3,8 +3,18 @@
|
|
|
3
3
|
* This API (as of 2025-05-07) is not available on React Native.
|
|
4
4
|
*/
|
|
5
5
|
export declare function isGzipSupported(): boolean;
|
|
6
|
+
export declare const isNativeAsyncGzipReadError: (error: unknown) => boolean;
|
|
7
|
+
export type GzipCompressOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* By default this helper swallows compression errors and returns null.
|
|
10
|
+
* Some browsers, notably Safari 16, can throw NotReadableError from the
|
|
11
|
+
* native CompressionStream path. Callers can opt into rethrowing so they
|
|
12
|
+
* can detect that case and change future compression behavior if needed.
|
|
13
|
+
*/
|
|
14
|
+
rethrow?: boolean;
|
|
15
|
+
};
|
|
6
16
|
/**
|
|
7
17
|
* Gzip a string using Compression Streams API if it's available
|
|
8
18
|
*/
|
|
9
|
-
export declare function gzipCompress(input: string, isDebug?: boolean): Promise<Blob | null>;
|
|
19
|
+
export declare function gzipCompress(input: string, isDebug?: boolean, options?: GzipCompressOptions): Promise<Blob | null>;
|
|
10
20
|
//# sourceMappingURL=gzip.d.ts.map
|
package/dist/gzip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../src/gzip.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../src/gzip.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,eAAO,MAAM,0BAA0B,GAAI,OAAO,OAAO,KAAG,OAQ3D,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAqBrH"}
|
package/dist/gzip.js
CHANGED
|
@@ -25,12 +25,18 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
gzipCompress: ()=>gzipCompress,
|
|
28
|
-
isGzipSupported: ()=>isGzipSupported
|
|
28
|
+
isGzipSupported: ()=>isGzipSupported,
|
|
29
|
+
isNativeAsyncGzipReadError: ()=>isNativeAsyncGzipReadError
|
|
29
30
|
});
|
|
30
31
|
function isGzipSupported() {
|
|
31
32
|
return 'CompressionStream' in globalThis;
|
|
32
33
|
}
|
|
33
|
-
|
|
34
|
+
const isNativeAsyncGzipReadError = (error)=>{
|
|
35
|
+
if (!error || 'object' != typeof error) return false;
|
|
36
|
+
const name = 'name' in error ? String(error.name) : '';
|
|
37
|
+
return 'NotReadableError' === name;
|
|
38
|
+
};
|
|
39
|
+
async function gzipCompress(input, isDebug = true, options) {
|
|
34
40
|
try {
|
|
35
41
|
const dataStream = new Blob([
|
|
36
42
|
input
|
|
@@ -40,15 +46,18 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
40
46
|
const compressedStream = dataStream.pipeThrough(new CompressionStream('gzip'));
|
|
41
47
|
return await new Response(compressedStream).blob();
|
|
42
48
|
} catch (error) {
|
|
49
|
+
if (options?.rethrow) throw error;
|
|
43
50
|
if (isDebug) console.error('Failed to gzip compress data', error);
|
|
44
51
|
return null;
|
|
45
52
|
}
|
|
46
53
|
}
|
|
47
54
|
exports.gzipCompress = __webpack_exports__.gzipCompress;
|
|
48
55
|
exports.isGzipSupported = __webpack_exports__.isGzipSupported;
|
|
56
|
+
exports.isNativeAsyncGzipReadError = __webpack_exports__.isNativeAsyncGzipReadError;
|
|
49
57
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
50
58
|
"gzipCompress",
|
|
51
|
-
"isGzipSupported"
|
|
59
|
+
"isGzipSupported",
|
|
60
|
+
"isNativeAsyncGzipReadError"
|
|
52
61
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
53
62
|
Object.defineProperty(exports, '__esModule', {
|
|
54
63
|
value: true
|
package/dist/gzip.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
function isGzipSupported() {
|
|
2
2
|
return 'CompressionStream' in globalThis;
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
const isNativeAsyncGzipReadError = (error)=>{
|
|
5
|
+
if (!error || 'object' != typeof error) return false;
|
|
6
|
+
const name = 'name' in error ? String(error.name) : '';
|
|
7
|
+
return 'NotReadableError' === name;
|
|
8
|
+
};
|
|
9
|
+
async function gzipCompress(input, isDebug = true, options) {
|
|
5
10
|
try {
|
|
6
11
|
const dataStream = new Blob([
|
|
7
12
|
input
|
|
@@ -11,8 +16,9 @@ async function gzipCompress(input, isDebug = true) {
|
|
|
11
16
|
const compressedStream = dataStream.pipeThrough(new CompressionStream('gzip'));
|
|
12
17
|
return await new Response(compressedStream).blob();
|
|
13
18
|
} catch (error) {
|
|
19
|
+
if (options?.rethrow) throw error;
|
|
14
20
|
if (isDebug) console.error('Failed to gzip compress data', error);
|
|
15
21
|
return null;
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
|
-
export { gzipCompress, isGzipSupported };
|
|
24
|
+
export { gzipCompress, isGzipSupported, isNativeAsyncGzipReadError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getFeatureFlagValue } from './featureFlagUtils';
|
|
2
|
-
export { gzipCompress } from './gzip';
|
|
2
|
+
export { gzipCompress, isNativeAsyncGzipReadError } from './gzip';
|
|
3
3
|
export * from './utils';
|
|
4
4
|
export * as ErrorTracking from './error-tracking';
|
|
5
5
|
export { uuidv7 } from './vendor/uuidv7';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAA;AACjE,cAAc,SAAS,CAAA;AACvB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -78,6 +78,7 @@ var __webpack_exports__ = {};
|
|
|
78
78
|
getRequirementsHint: ()=>_surveys_validation__WEBPACK_IMPORTED_MODULE_8__.getRequirementsHint,
|
|
79
79
|
getValidationError: ()=>_surveys_validation__WEBPACK_IMPORTED_MODULE_8__.getValidationError,
|
|
80
80
|
gzipCompress: ()=>_gzip__WEBPACK_IMPORTED_MODULE_1__.gzipCompress,
|
|
81
|
+
isNativeAsyncGzipReadError: ()=>_gzip__WEBPACK_IMPORTED_MODULE_1__.isNativeAsyncGzipReadError,
|
|
81
82
|
uuidv7: ()=>_vendor_uuidv7__WEBPACK_IMPORTED_MODULE_4__.uuidv7
|
|
82
83
|
});
|
|
83
84
|
var _featureFlagUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./featureFlagUtils");
|
|
@@ -86,13 +87,14 @@ var __webpack_exports__ = {};
|
|
|
86
87
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
87
88
|
for(var __WEBPACK_IMPORT_KEY__ in _utils__WEBPACK_IMPORTED_MODULE_2__)if ([
|
|
88
89
|
"ErrorTracking",
|
|
89
|
-
"
|
|
90
|
+
"gzipCompress",
|
|
90
91
|
"default",
|
|
91
92
|
"getRequirementsHint",
|
|
93
|
+
"isNativeAsyncGzipReadError",
|
|
92
94
|
"getLengthFromRules",
|
|
93
95
|
"getFeatureFlagValue",
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
+
"uuidv7",
|
|
97
|
+
"getValidationError"
|
|
96
98
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
97
99
|
return _utils__WEBPACK_IMPORTED_MODULE_2__[key];
|
|
98
100
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
@@ -103,13 +105,14 @@ var __webpack_exports__ = {};
|
|
|
103
105
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
104
106
|
for(var __WEBPACK_IMPORT_KEY__ in _posthog_core__WEBPACK_IMPORTED_MODULE_5__)if ([
|
|
105
107
|
"ErrorTracking",
|
|
106
|
-
"
|
|
108
|
+
"gzipCompress",
|
|
107
109
|
"default",
|
|
108
110
|
"getRequirementsHint",
|
|
111
|
+
"isNativeAsyncGzipReadError",
|
|
109
112
|
"getLengthFromRules",
|
|
110
113
|
"getFeatureFlagValue",
|
|
111
|
-
"
|
|
112
|
-
"
|
|
114
|
+
"uuidv7",
|
|
115
|
+
"getValidationError"
|
|
113
116
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
114
117
|
return _posthog_core__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
115
118
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
@@ -118,13 +121,14 @@ var __webpack_exports__ = {};
|
|
|
118
121
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
119
122
|
for(var __WEBPACK_IMPORT_KEY__ in _posthog_core_stateless__WEBPACK_IMPORTED_MODULE_6__)if ([
|
|
120
123
|
"ErrorTracking",
|
|
121
|
-
"
|
|
124
|
+
"gzipCompress",
|
|
122
125
|
"default",
|
|
123
126
|
"getRequirementsHint",
|
|
127
|
+
"isNativeAsyncGzipReadError",
|
|
124
128
|
"getLengthFromRules",
|
|
125
129
|
"getFeatureFlagValue",
|
|
126
|
-
"
|
|
127
|
-
"
|
|
130
|
+
"uuidv7",
|
|
131
|
+
"getValidationError"
|
|
128
132
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
129
133
|
return _posthog_core_stateless__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
130
134
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
@@ -133,13 +137,14 @@ var __webpack_exports__ = {};
|
|
|
133
137
|
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
134
138
|
for(var __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_7__)if ([
|
|
135
139
|
"ErrorTracking",
|
|
136
|
-
"
|
|
140
|
+
"gzipCompress",
|
|
137
141
|
"default",
|
|
138
142
|
"getRequirementsHint",
|
|
143
|
+
"isNativeAsyncGzipReadError",
|
|
139
144
|
"getLengthFromRules",
|
|
140
145
|
"getFeatureFlagValue",
|
|
141
|
-
"
|
|
142
|
-
"
|
|
146
|
+
"uuidv7",
|
|
147
|
+
"getValidationError"
|
|
143
148
|
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
144
149
|
return _types__WEBPACK_IMPORTED_MODULE_7__[key];
|
|
145
150
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
@@ -152,6 +157,7 @@ exports.getLengthFromRules = __webpack_exports__.getLengthFromRules;
|
|
|
152
157
|
exports.getRequirementsHint = __webpack_exports__.getRequirementsHint;
|
|
153
158
|
exports.getValidationError = __webpack_exports__.getValidationError;
|
|
154
159
|
exports.gzipCompress = __webpack_exports__.gzipCompress;
|
|
160
|
+
exports.isNativeAsyncGzipReadError = __webpack_exports__.isNativeAsyncGzipReadError;
|
|
155
161
|
exports.uuidv7 = __webpack_exports__.uuidv7;
|
|
156
162
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
157
163
|
"ErrorTracking",
|
|
@@ -160,6 +166,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
160
166
|
"getRequirementsHint",
|
|
161
167
|
"getValidationError",
|
|
162
168
|
"gzipCompress",
|
|
169
|
+
"isNativeAsyncGzipReadError",
|
|
163
170
|
"uuidv7"
|
|
164
171
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
165
172
|
Object.defineProperty(exports, '__esModule', {
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getFeatureFlagValue } from "./featureFlagUtils.mjs";
|
|
2
|
-
import { gzipCompress } from "./gzip.mjs";
|
|
2
|
+
import { gzipCompress, isNativeAsyncGzipReadError } from "./gzip.mjs";
|
|
3
3
|
import { uuidv7 } from "./vendor/uuidv7.mjs";
|
|
4
4
|
import { getLengthFromRules, getRequirementsHint, getValidationError } from "./surveys/validation.mjs";
|
|
5
5
|
export * from "./utils/index.mjs";
|
|
@@ -7,4 +7,4 @@ export * from "./posthog-core.mjs";
|
|
|
7
7
|
export * from "./posthog-core-stateless.mjs";
|
|
8
8
|
export * from "./types.mjs";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__error_tracking_index_mjs_b3406d6f__ from "./error-tracking/index.mjs";
|
|
10
|
-
export { __WEBPACK_EXTERNAL_MODULE__error_tracking_index_mjs_b3406d6f__ as ErrorTracking, getFeatureFlagValue, getLengthFromRules, getRequirementsHint, getValidationError, gzipCompress, uuidv7 };
|
|
10
|
+
export { __WEBPACK_EXTERNAL_MODULE__error_tracking_index_mjs_b3406d6f__ as ErrorTracking, getFeatureFlagValue, getLengthFromRules, getRequirementsHint, getValidationError, gzipCompress, isNativeAsyncGzipReadError, uuidv7 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posthog-core-stateless.d.ts","sourceRoot":"","sources":["../src/posthog-core-stateless.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGnD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,mBAAmB,EACnB,gBAAgB,EAGhB,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EAExB,MAAM,EACN,cAAc,EAEf,MAAM,SAAS,CAAA;AAChB,OAAO,EAOL,g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ueue = new index_js_namespaceObject.PromiseQueue();
|
|
88
88
|
this._events = new external_eventemitter_js_namespaceObject.SimpleEventEmitter();
|
|
89
89
|
this._isInitialized = false;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
const normalizedApiKey = 'string' == typeof apiKey ? apiKey.trim() : '';
|
|
91
|
+
const normalizedHost = 'string' == typeof options.host ? options.host.trim() : '';
|
|
92
|
+
(0, index_js_namespaceObject.assert)(normalizedApiKey, "You must pass your PostHog project's api key.");
|
|
93
|
+
this.apiKey = normalizedApiKey;
|
|
94
|
+
this.host = (0, index_js_namespaceObject.removeTrailingSlash)(normalizedHost || 'https://us.i.posthog.com');
|
|
93
95
|
this.flushAt = options.flushAt ? Math.max(options.flushAt, 1) : 20;
|
|
94
96
|
this.maxBatchSize = Math.max(this.flushAt, options.maxBatchSize ?? 100);
|
|
95
97
|
this.maxQueueSize = Math.max(this.flushAt, options.maxQueueSize ?? 1000);
|
|
@@ -287,6 +289,7 @@ class PostHogCoreStateless {
|
|
|
287
289
|
group_properties: groupProperties,
|
|
288
290
|
...extraPayload
|
|
289
291
|
};
|
|
292
|
+
if (personProperties.$device_id) requestData.$device_id = personProperties.$device_id;
|
|
290
293
|
if (this.evaluationContexts && this.evaluationContexts.length > 0) requestData.evaluation_contexts = this.evaluationContexts;
|
|
291
294
|
const fetchOptions = {
|
|
292
295
|
method: 'POST',
|
|
@@ -56,9 +56,11 @@ class PostHogCoreStateless {
|
|
|
56
56
|
this.promiseQueue = new PromiseQueue();
|
|
57
57
|
this._events = new SimpleEventEmitter();
|
|
58
58
|
this._isInitialized = false;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const normalizedApiKey = 'string' == typeof apiKey ? apiKey.trim() : '';
|
|
60
|
+
const normalizedHost = 'string' == typeof options.host ? options.host.trim() : '';
|
|
61
|
+
assert(normalizedApiKey, "You must pass your PostHog project's api key.");
|
|
62
|
+
this.apiKey = normalizedApiKey;
|
|
63
|
+
this.host = removeTrailingSlash(normalizedHost || 'https://us.i.posthog.com');
|
|
62
64
|
this.flushAt = options.flushAt ? Math.max(options.flushAt, 1) : 20;
|
|
63
65
|
this.maxBatchSize = Math.max(this.flushAt, options.maxBatchSize ?? 100);
|
|
64
66
|
this.maxQueueSize = Math.max(this.flushAt, options.maxQueueSize ?? 1000);
|
|
@@ -256,6 +258,7 @@ class PostHogCoreStateless {
|
|
|
256
258
|
group_properties: groupProperties,
|
|
257
259
|
...extraPayload
|
|
258
260
|
};
|
|
261
|
+
if (personProperties.$device_id) requestData.$device_id = personProperties.$device_id;
|
|
259
262
|
if (this.evaluationContexts && this.evaluationContexts.length > 0) requestData.evaluation_contexts = this.evaluationContexts;
|
|
260
263
|
const fetchOptions = {
|
|
261
264
|
method: 'POST',
|
package/package.json
CHANGED
package/src/gzip.ts
CHANGED
|
@@ -6,10 +6,30 @@ export function isGzipSupported(): boolean {
|
|
|
6
6
|
return 'CompressionStream' in globalThis
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
export const isNativeAsyncGzipReadError = (error: unknown): boolean => {
|
|
10
|
+
if (!error || typeof error !== 'object') {
|
|
11
|
+
return false
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const name = 'name' in error ? String(error.name) : ''
|
|
15
|
+
|
|
16
|
+
return name === 'NotReadableError'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type GzipCompressOptions = {
|
|
20
|
+
/**
|
|
21
|
+
* By default this helper swallows compression errors and returns null.
|
|
22
|
+
* Some browsers, notably Safari 16, can throw NotReadableError from the
|
|
23
|
+
* native CompressionStream path. Callers can opt into rethrowing so they
|
|
24
|
+
* can detect that case and change future compression behavior if needed.
|
|
25
|
+
*/
|
|
26
|
+
rethrow?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
9
29
|
/**
|
|
10
30
|
* Gzip a string using Compression Streams API if it's available
|
|
11
31
|
*/
|
|
12
|
-
export async function gzipCompress(input: string, isDebug = true): Promise<Blob | null> {
|
|
32
|
+
export async function gzipCompress(input: string, isDebug = true, options?: GzipCompressOptions): Promise<Blob | null> {
|
|
13
33
|
try {
|
|
14
34
|
// Turn the string into a stream using a Blob, and then compress it
|
|
15
35
|
const dataStream = new Blob([input], {
|
|
@@ -21,6 +41,10 @@ export async function gzipCompress(input: string, isDebug = true): Promise<Blob
|
|
|
21
41
|
// Using a Response to easily extract the readablestream value. Decoding into a string for fetch
|
|
22
42
|
return await new Response(compressedStream).blob()
|
|
23
43
|
} catch (error) {
|
|
44
|
+
if (options?.rethrow) {
|
|
45
|
+
throw error
|
|
46
|
+
}
|
|
47
|
+
|
|
24
48
|
if (isDebug) {
|
|
25
49
|
console.error('Failed to gzip compress data', error)
|
|
26
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { getFeatureFlagValue } from './featureFlagUtils'
|
|
2
|
-
export { gzipCompress } from './gzip'
|
|
2
|
+
export { gzipCompress, isNativeAsyncGzipReadError } from './gzip'
|
|
3
3
|
export * from './utils'
|
|
4
4
|
export * as ErrorTracking from './error-tracking'
|
|
5
5
|
export { uuidv7 } from './vendor/uuidv7'
|
|
@@ -145,10 +145,13 @@ export abstract class PostHogCoreStateless {
|
|
|
145
145
|
abstract setPersistedProperty<T>(key: PostHogPersistedProperty, value: T | null): void
|
|
146
146
|
|
|
147
147
|
constructor(apiKey: string, options: PostHogCoreOptions = {}) {
|
|
148
|
-
|
|
148
|
+
const normalizedApiKey = typeof apiKey === 'string' ? apiKey.trim() : ''
|
|
149
|
+
const normalizedHost = typeof options.host === 'string' ? options.host.trim() : ''
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
assert(normalizedApiKey, "You must pass your PostHog project's api key.")
|
|
152
|
+
|
|
153
|
+
this.apiKey = normalizedApiKey
|
|
154
|
+
this.host = removeTrailingSlash(normalizedHost || 'https://us.i.posthog.com')
|
|
152
155
|
this.flushAt = options.flushAt ? Math.max(options.flushAt, 1) : 20
|
|
153
156
|
this.maxBatchSize = Math.max(this.flushAt, options.maxBatchSize ?? 100)
|
|
154
157
|
this.maxQueueSize = Math.max(this.flushAt, options.maxQueueSize ?? 1000)
|
|
@@ -477,6 +480,12 @@ export abstract class PostHogCoreStateless {
|
|
|
477
480
|
...extraPayload,
|
|
478
481
|
}
|
|
479
482
|
|
|
483
|
+
// Extract $device_id from personProperties and send it as a top-level field so the
|
|
484
|
+
// feature flags service can use it for device-based bucketing during remote evaluation.
|
|
485
|
+
if (personProperties.$device_id) {
|
|
486
|
+
requestData.$device_id = personProperties.$device_id
|
|
487
|
+
}
|
|
488
|
+
|
|
480
489
|
// Add evaluation contexts if configured
|
|
481
490
|
if (this.evaluationContexts && this.evaluationContexts.length > 0) {
|
|
482
491
|
requestData.evaluation_contexts = this.evaluationContexts
|