posthog-node 4.8.1 → 4.9.0
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 +11 -8
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.esm.js +11 -8
- package/lib/index.esm.js.map +1 -1
- package/lib/posthog-core/src/index.d.ts +4 -4
- package/package.json +1 -1
- package/test/feature-flags.spec.ts +3 -1
- package/test/posthog-node.spec.ts +4 -0
package/CHANGELOG.md
CHANGED
package/lib/index.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@ var node_fs = require('node:fs');
|
|
|
7
7
|
var node_readline = require('node:readline');
|
|
8
8
|
var node_path = require('node:path');
|
|
9
9
|
|
|
10
|
-
var version = "4.
|
|
10
|
+
var version = "4.9.0";
|
|
11
11
|
|
|
12
12
|
var PostHogPersistedProperty;
|
|
13
13
|
(function (PostHogPersistedProperty) {
|
|
@@ -1155,7 +1155,7 @@ class PostHogCoreStateless {
|
|
|
1155
1155
|
}
|
|
1156
1156
|
async getFeatureFlagStateless(key, distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
|
|
1157
1157
|
await this._initPromise;
|
|
1158
|
-
const featureFlags = await this.getFeatureFlagsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip);
|
|
1158
|
+
const featureFlags = await this.getFeatureFlagsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [key]);
|
|
1159
1159
|
if (!featureFlags) {
|
|
1160
1160
|
// If we haven't loaded flags yet, or errored out, we respond with undefined
|
|
1161
1161
|
return undefined;
|
|
@@ -1171,7 +1171,7 @@ class PostHogCoreStateless {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
async getFeatureFlagPayloadStateless(key, distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
|
|
1173
1173
|
await this._initPromise;
|
|
1174
|
-
const payloads = await this.getFeatureFlagPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip);
|
|
1174
|
+
const payloads = await this.getFeatureFlagPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, [key]);
|
|
1175
1175
|
if (!payloads) {
|
|
1176
1176
|
return undefined;
|
|
1177
1177
|
}
|
|
@@ -1182,9 +1182,9 @@ class PostHogCoreStateless {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
return response;
|
|
1184
1184
|
}
|
|
1185
|
-
async getFeatureFlagPayloadsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
|
|
1185
|
+
async getFeatureFlagPayloadsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip, flagKeysToEvaluate) {
|
|
1186
1186
|
await this._initPromise;
|
|
1187
|
-
const payloads = (await this.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip)).payloads;
|
|
1187
|
+
const payloads = (await this.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeysToEvaluate)).payloads;
|
|
1188
1188
|
return payloads;
|
|
1189
1189
|
}
|
|
1190
1190
|
_parsePayload(response) {
|
|
@@ -1195,16 +1195,19 @@ class PostHogCoreStateless {
|
|
|
1195
1195
|
return response;
|
|
1196
1196
|
}
|
|
1197
1197
|
}
|
|
1198
|
-
async getFeatureFlagsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
|
|
1198
|
+
async getFeatureFlagsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip, flagKeysToEvaluate) {
|
|
1199
1199
|
await this._initPromise;
|
|
1200
|
-
return (await this.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip)).flags;
|
|
1200
|
+
return (await this.getFeatureFlagsAndPayloadsStateless(distinctId, groups, personProperties, groupProperties, disableGeoip, flagKeysToEvaluate)).flags;
|
|
1201
1201
|
}
|
|
1202
|
-
async getFeatureFlagsAndPayloadsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip) {
|
|
1202
|
+
async getFeatureFlagsAndPayloadsStateless(distinctId, groups = {}, personProperties = {}, groupProperties = {}, disableGeoip, flagKeysToEvaluate) {
|
|
1203
1203
|
await this._initPromise;
|
|
1204
1204
|
const extraPayload = {};
|
|
1205
1205
|
if (disableGeoip ?? this.disableGeoip) {
|
|
1206
1206
|
extraPayload['geoip_disable'] = true;
|
|
1207
1207
|
}
|
|
1208
|
+
if (flagKeysToEvaluate) {
|
|
1209
|
+
extraPayload['flag_keys_to_evaluate'] = flagKeysToEvaluate;
|
|
1210
|
+
}
|
|
1208
1211
|
const decideResponse = await this.getDecide(distinctId, groups, personProperties, groupProperties, extraPayload);
|
|
1209
1212
|
// Add check for quota limitation on feature flags
|
|
1210
1213
|
if (decideResponse?.quotaLimited?.includes(QuotaLimitedFeature.FeatureFlags)) {
|