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/CHANGELOG.md
CHANGED
package/lib/edge/index.cjs
CHANGED
|
@@ -935,7 +935,7 @@ function setupExpressErrorHandler(_posthog, app) {
|
|
|
935
935
|
});
|
|
936
936
|
}
|
|
937
937
|
|
|
938
|
-
var version = "5.1.
|
|
938
|
+
var version = "5.1.1";
|
|
939
939
|
|
|
940
940
|
var PostHogPersistedProperty;
|
|
941
941
|
(function (PostHogPersistedProperty) {
|
|
@@ -3164,7 +3164,24 @@ class PostHogBackendClient extends PostHogCoreStateless {
|
|
|
3164
3164
|
return response;
|
|
3165
3165
|
}
|
|
3166
3166
|
async getRemoteConfigPayload(flagKey) {
|
|
3167
|
-
|
|
3167
|
+
const response = await this.featureFlagsPoller?._requestRemoteConfigPayload(flagKey);
|
|
3168
|
+
if (!response) {
|
|
3169
|
+
return undefined;
|
|
3170
|
+
}
|
|
3171
|
+
const parsed = await response.json();
|
|
3172
|
+
// The payload from the endpoint is stored as a JSON encoded string. So when we return
|
|
3173
|
+
// it, it's effectively double encoded. As far as we know, we should never get single-encoded
|
|
3174
|
+
// JSON, but we'll be defensive here just in case.
|
|
3175
|
+
if (typeof parsed === 'string') {
|
|
3176
|
+
try {
|
|
3177
|
+
// If the parsed value is a string, try parsing it again to handle double-encoded JSON
|
|
3178
|
+
return JSON.parse(parsed);
|
|
3179
|
+
} catch (e) {
|
|
3180
|
+
// If second parse fails, return the string as is
|
|
3181
|
+
return parsed;
|
|
3182
|
+
}
|
|
3183
|
+
}
|
|
3184
|
+
return parsed;
|
|
3168
3185
|
}
|
|
3169
3186
|
async isFeatureEnabled(key, distinctId, options) {
|
|
3170
3187
|
const feat = await this.getFeatureFlag(key, distinctId, options);
|