posthog-node 5.1.0 → 5.1.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/edge/index.cjs +19 -2
- package/lib/edge/index.cjs.map +1 -1
- package/lib/edge/index.mjs +19 -2
- package/lib/edge/index.mjs.map +1 -1
- package/lib/node/index.cjs +19 -2
- package/lib/node/index.cjs.map +1 -1
- package/lib/node/index.mjs +19 -2
- package/lib/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/node/index.mjs
CHANGED
|
@@ -1318,7 +1318,7 @@ function snipLine(line, colno) {
|
|
|
1318
1318
|
return newLine;
|
|
1319
1319
|
}
|
|
1320
1320
|
|
|
1321
|
-
var version = "5.1.
|
|
1321
|
+
var version = "5.1.1";
|
|
1322
1322
|
|
|
1323
1323
|
var PostHogPersistedProperty;
|
|
1324
1324
|
(function (PostHogPersistedProperty) {
|
|
@@ -3547,7 +3547,24 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
3547
3547
|
return response;
|
|
3548
3548
|
}
|
|
3549
3549
|
async getRemoteConfigPayload(flagKey) {
|
|
3550
|
-
|
|
3550
|
+
const response = await this.featureFlagsPoller?._requestRemoteConfigPayload(flagKey);
|
|
3551
|
+
if (!response) {
|
|
3552
|
+
return undefined;
|
|
3553
|
+
}
|
|
3554
|
+
const parsed = await response.json();
|
|
3555
|
+
// The payload from the endpoint is stored as a JSON encoded string. So when we return
|
|
3556
|
+
// it, it's effectively double encoded. As far as we know, we should never get single-encoded
|
|
3557
|
+
// JSON, but we'll be defensive here just in case.
|
|
3558
|
+
if (typeof parsed === 'string') {
|
|
3559
|
+
try {
|
|
3560
|
+
// If the parsed value is a string, try parsing it again to handle double-encoded JSON
|
|
3561
|
+
return JSON.parse(parsed);
|
|
3562
|
+
} catch (e) {
|
|
3563
|
+
// If second parse fails, return the string as is
|
|
3564
|
+
return parsed;
|
|
3565
|
+
}
|
|
3566
|
+
}
|
|
3567
|
+
return parsed;
|
|
3551
3568
|
}
|
|
3552
3569
|
async isFeatureEnabled(key, distinctId, options) {
|
|
3553
3570
|
const feat = await this.getFeatureFlag(key, distinctId, options);
|