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/edge/index.mjs
CHANGED
|
@@ -913,7 +913,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
913
913
|
});
|
|
914
914
|
}
|
|
915
915
|
|
|
916
|
-
var version = "5.1.
|
|
916
|
+
var version = "5.1.1";
|
|
917
917
|
|
|
918
918
|
var PostHogPersistedProperty;
|
|
919
919
|
(function (PostHogPersistedProperty) {
|
|
@@ -3142,7 +3142,24 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
3142
3142
|
return response;
|
|
3143
3143
|
}
|
|
3144
3144
|
async getRemoteConfigPayload(flagKey) {
|
|
3145
|
-
|
|
3145
|
+
const response = await this.featureFlagsPoller?._requestRemoteConfigPayload(flagKey);
|
|
3146
|
+
if (!response) {
|
|
3147
|
+
return undefined;
|
|
3148
|
+
}
|
|
3149
|
+
const parsed = await response.json();
|
|
3150
|
+
// The payload from the endpoint is stored as a JSON encoded string. So when we return
|
|
3151
|
+
// it, it's effectively double encoded. As far as we know, we should never get single-encoded
|
|
3152
|
+
// JSON, but we'll be defensive here just in case.
|
|
3153
|
+
if (typeof parsed === 'string') {
|
|
3154
|
+
try {
|
|
3155
|
+
// If the parsed value is a string, try parsing it again to handle double-encoded JSON
|
|
3156
|
+
return JSON.parse(parsed);
|
|
3157
|
+
} catch (e) {
|
|
3158
|
+
// If second parse fails, return the string as is
|
|
3159
|
+
return parsed;
|
|
3160
|
+
}
|
|
3161
|
+
}
|
|
3162
|
+
return parsed;
|
|
3146
3163
|
}
|
|
3147
3164
|
async isFeatureEnabled(key, distinctId, options) {
|
|
3148
3165
|
const feat = await this.getFeatureFlag(key, distinctId, options);
|