superposition-provider 0.92.0 → 0.93.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/dist/experimentation-client.d.ts +4 -3
- package/dist/index.esm.js +93 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +93 -68
- package/dist/index.js.map +1 -1
- package/dist/native-lib/libsuperposition_core-aarch64-apple-darwin.dylib +0 -0
- package/dist/native-lib/libsuperposition_core-x86_64-apple-darwin.dylib +0 -0
- package/dist/native-lib/libsuperposition_core-x86_64-pc-windows-msvc.dll +0 -0
- package/dist/native-lib/libsuperposition_core-x86_64-unknown-linux-gnu.so +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9103,7 +9103,7 @@ function requireModels_0 () {
|
|
|
9103
9103
|
if (hasRequiredModels_0) return models_0;
|
|
9104
9104
|
hasRequiredModels_0 = 1;
|
|
9105
9105
|
Object.defineProperty(models_0, "__esModule", { value: true });
|
|
9106
|
-
models_0.Stage = models_0.FunctionExecutionRequest = models_0.ExperimentSortOn = models_0.ExperimentGroupSortOn = models_0.WorkspaceStatus = models_0.Version = models_0.HttpMethod = models_0.OrgStatus = models_0.FunctionTypes = models_0.ContextFilterSortOn = models_0.DimensionMatchStrategy = models_0.MergeStrategy = models_0.DimensionType = models_0.ExperimentStatusType = models_0.ExperimentType = models_0.ContextActionOut = models_0.ContextAction = models_0.ContextIdentifier = models_0.SortBy = models_0.VariantType = models_0.ResourceNotFound = models_0.InternalServerError = models_0.GroupType = void 0;
|
|
9106
|
+
models_0.Stage = models_0.FunctionExecutionRequest = models_0.ExperimentSortOn = models_0.ExperimentGroupSortOn = models_0.WorkspaceStatus = models_0.Version = models_0.HttpMethod = models_0.OrgStatus = models_0.FunctionTypes = models_0.ContextFilterSortOn = models_0.DimensionMatchStrategy = models_0.MergeStrategy = models_0.DimensionType = models_0.ExperimentStatusType = models_0.ExperimentType = models_0.ContextActionOut = models_0.ContextAction = models_0.ContextIdentifier = models_0.SortBy = models_0.AuditAction = models_0.VariantType = models_0.ResourceNotFound = models_0.InternalServerError = models_0.GroupType = void 0;
|
|
9107
9107
|
const SuperpositionServiceException_1 = requireSuperpositionServiceException();
|
|
9108
9108
|
models_0.GroupType = {
|
|
9109
9109
|
SYSTEM_GENERATED: "SYSTEM_GENERATED",
|
|
@@ -9139,9 +9139,14 @@ function requireModels_0 () {
|
|
|
9139
9139
|
CONTROL: "CONTROL",
|
|
9140
9140
|
EXPERIMENTAL: "EXPERIMENTAL",
|
|
9141
9141
|
};
|
|
9142
|
+
models_0.AuditAction = {
|
|
9143
|
+
DELETE: "DELETE",
|
|
9144
|
+
INSERT: "INSERT",
|
|
9145
|
+
UPDATE: "UPDATE",
|
|
9146
|
+
};
|
|
9142
9147
|
models_0.SortBy = {
|
|
9143
|
-
|
|
9144
|
-
|
|
9148
|
+
ASC: "asc",
|
|
9149
|
+
DESC: "desc",
|
|
9145
9150
|
};
|
|
9146
9151
|
var ContextIdentifier;
|
|
9147
9152
|
(function (ContextIdentifier) {
|
|
@@ -9209,22 +9214,22 @@ function requireModels_0 () {
|
|
|
9209
9214
|
REPLACE: "REPLACE",
|
|
9210
9215
|
};
|
|
9211
9216
|
models_0.DimensionMatchStrategy = {
|
|
9212
|
-
|
|
9213
|
-
|
|
9217
|
+
EXACT: "exact",
|
|
9218
|
+
SUBSET: "subset",
|
|
9214
9219
|
};
|
|
9215
9220
|
models_0.ContextFilterSortOn = {
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9221
|
+
CREATED_AT: "created_at",
|
|
9222
|
+
LAST_MODIFIED_AT: "last_modified_at",
|
|
9223
|
+
WEIGHT: "weight",
|
|
9219
9224
|
};
|
|
9220
9225
|
models_0.FunctionTypes = {
|
|
9221
|
-
|
|
9222
|
-
|
|
9226
|
+
AUTOCOMPLETE: "AUTOCOMPLETE",
|
|
9227
|
+
VALIDATION: "VALIDATION",
|
|
9223
9228
|
};
|
|
9224
9229
|
models_0.OrgStatus = {
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9230
|
+
ACTIVE: "Active",
|
|
9231
|
+
INACTIVE: "Inactive",
|
|
9232
|
+
PENDING_KYB: "PendingKyb",
|
|
9228
9233
|
};
|
|
9229
9234
|
models_0.HttpMethod = {
|
|
9230
9235
|
DELETE: "DELETE",
|
|
@@ -9242,13 +9247,13 @@ function requireModels_0 () {
|
|
|
9242
9247
|
ENABLED: "ENABLED",
|
|
9243
9248
|
};
|
|
9244
9249
|
models_0.ExperimentGroupSortOn = {
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9250
|
+
CREATED_AT: "created_at",
|
|
9251
|
+
LAST_MODIFIED_AT: "last_modified_at",
|
|
9252
|
+
NAME: "name",
|
|
9248
9253
|
};
|
|
9249
9254
|
models_0.ExperimentSortOn = {
|
|
9250
|
-
|
|
9251
|
-
|
|
9255
|
+
CREATED_AT: "created_at",
|
|
9256
|
+
LAST_MODIFIED_AT: "last_modified_at",
|
|
9252
9257
|
};
|
|
9253
9258
|
var FunctionExecutionRequest;
|
|
9254
9259
|
(function (FunctionExecutionRequest) {
|
|
@@ -9733,7 +9738,7 @@ function requireAws_restJson1 () {
|
|
|
9733
9738
|
});
|
|
9734
9739
|
b.bp("/config");
|
|
9735
9740
|
const query = (0, smithy_client_1.map)({
|
|
9736
|
-
[_p]: [, input[_p]],
|
|
9741
|
+
[_p]: [() => input.prefix !== void 0, () => ((input[_p] || []))],
|
|
9737
9742
|
[_v]: [, input[_v]],
|
|
9738
9743
|
});
|
|
9739
9744
|
let body;
|
|
@@ -9897,7 +9902,7 @@ function requireAws_restJson1 () {
|
|
|
9897
9902
|
});
|
|
9898
9903
|
b.bp("/config/resolve");
|
|
9899
9904
|
const query = (0, smithy_client_1.map)({
|
|
9900
|
-
[_p]: [, input[_p]],
|
|
9905
|
+
[_p]: [() => input.prefix !== void 0, () => ((input[_p] || []))],
|
|
9901
9906
|
[_v]: [, input[_v]],
|
|
9902
9907
|
[_sr]: [() => input.show_reasoning !== void 0, () => (input[_sr].toString())],
|
|
9903
9908
|
[_ci]: [, input[_ci]],
|
|
@@ -10020,8 +10025,8 @@ function requireAws_restJson1 () {
|
|
|
10020
10025
|
[_a]: [() => input.all !== void 0, () => (input[_a].toString())],
|
|
10021
10026
|
[_fd]: [() => input.from_date !== void 0, () => ((0, smithy_client_1.serializeDateTime)(input[_fd]).toString())],
|
|
10022
10027
|
[_td]: [() => input.to_date !== void 0, () => ((0, smithy_client_1.serializeDateTime)(input[_td]).toString())],
|
|
10023
|
-
[_ta]: [, input[_t]],
|
|
10024
|
-
[_ac]: [, input[_ac]],
|
|
10028
|
+
[_ta]: [() => input.tables !== void 0, () => ((input[_t] || []))],
|
|
10029
|
+
[_ac]: [() => input.action !== void 0, () => ((input[_ac] || []))],
|
|
10025
10030
|
[_u]: [, input[_u]],
|
|
10026
10031
|
[_sb]: [, input[_sb]],
|
|
10027
10032
|
});
|
|
@@ -10044,11 +10049,11 @@ function requireAws_restJson1 () {
|
|
|
10044
10049
|
[_c]: [() => input.count !== void 0, () => (input[_c].toString())],
|
|
10045
10050
|
[_pa]: [() => input.page !== void 0, () => (input[_pa].toString())],
|
|
10046
10051
|
[_a]: [() => input.all !== void 0, () => (input[_a].toString())],
|
|
10047
|
-
[_p]: [, input[_p]],
|
|
10052
|
+
[_p]: [() => input.prefix !== void 0, () => ((input[_p] || []))],
|
|
10048
10053
|
[_so]: [, input[_so]],
|
|
10049
10054
|
[_sb]: [, input[_sb]],
|
|
10050
|
-
[_cb]: [, input[_cb]],
|
|
10051
|
-
[_lmb]: [, input[_lmb]],
|
|
10055
|
+
[_cb]: [() => input.created_by !== void 0, () => ((input[_cb] || []))],
|
|
10056
|
+
[_lmb]: [() => input.last_modified_by !== void 0, () => ((input[_lmb] || []))],
|
|
10052
10057
|
[_pl]: [, input[_pl]],
|
|
10053
10058
|
[_dms]: [, input[_dms]],
|
|
10054
10059
|
});
|
|
@@ -10112,13 +10117,13 @@ function requireAws_restJson1 () {
|
|
|
10112
10117
|
[_c]: [() => input.count !== void 0, () => (input[_c].toString())],
|
|
10113
10118
|
[_pa]: [() => input.page !== void 0, () => (input[_pa].toString())],
|
|
10114
10119
|
[_a]: [() => input.all !== void 0, () => (input[_a].toString())],
|
|
10115
|
-
[_s]: [, input[_s]],
|
|
10120
|
+
[_s]: [() => input.status !== void 0, () => ((input[_s] || []))],
|
|
10116
10121
|
[_fd]: [() => input.from_date !== void 0, () => ((0, smithy_client_1.serializeDateTime)(input[_fd]).toString())],
|
|
10117
10122
|
[_td]: [() => input.to_date !== void 0, () => ((0, smithy_client_1.serializeDateTime)(input[_td]).toString())],
|
|
10118
10123
|
[_en]: [, input[_en]],
|
|
10119
|
-
[_ei]: [, input[_ei]],
|
|
10120
|
-
[_egi]: [, input[_egi]],
|
|
10121
|
-
[_cb]: [, input[_cb]],
|
|
10124
|
+
[_ei]: [() => input.experiment_ids !== void 0, () => ((input[_ei] || []))],
|
|
10125
|
+
[_egi]: [() => input.experiment_group_ids !== void 0, () => ((input[_egi] || []))],
|
|
10126
|
+
[_cb]: [() => input.created_by !== void 0, () => ((input[_cb] || []))],
|
|
10122
10127
|
[_so]: [, input[_so]],
|
|
10123
10128
|
[_sb]: [, input[_sb]],
|
|
10124
10129
|
[_geo]: [() => input.global_experiments_only !== void 0, () => (input[_geo].toString())],
|
|
@@ -10148,7 +10153,7 @@ function requireAws_restJson1 () {
|
|
|
10148
10153
|
[_lmb]: [, input[_lmb]],
|
|
10149
10154
|
[_so]: [, input[_so]],
|
|
10150
10155
|
[_sb]: [, input[_sb]],
|
|
10151
|
-
[_gt]: [, input[_gt]],
|
|
10156
|
+
[_gt]: [() => input.group_type !== void 0, () => ((input[_gt] || []))],
|
|
10152
10157
|
});
|
|
10153
10158
|
let body;
|
|
10154
10159
|
b.m("GET")
|
|
@@ -10169,6 +10174,7 @@ function requireAws_restJson1 () {
|
|
|
10169
10174
|
[_c]: [() => input.count !== void 0, () => (input[_c].toString())],
|
|
10170
10175
|
[_pa]: [() => input.page !== void 0, () => (input[_pa].toString())],
|
|
10171
10176
|
[_a]: [() => input.all !== void 0, () => (input[_a].toString())],
|
|
10177
|
+
[_ft]: [() => input.function_type !== void 0, () => ((input[_ft] || []))],
|
|
10172
10178
|
});
|
|
10173
10179
|
let body;
|
|
10174
10180
|
b.m("GET")
|
|
@@ -12920,6 +12926,7 @@ function requireAws_restJson1 () {
|
|
|
12920
12926
|
const _ei = "experiment_ids";
|
|
12921
12927
|
const _en = "experiment_name";
|
|
12922
12928
|
const _fd = "from_date";
|
|
12929
|
+
const _ft = "function_type";
|
|
12923
12930
|
const _geo = "global_experiments_only";
|
|
12924
12931
|
const _gt = "group_type";
|
|
12925
12932
|
const _lm = "last-modified";
|
|
@@ -15480,10 +15487,11 @@ class ExperimentationClient {
|
|
|
15480
15487
|
this.cachedExperiments = experiments;
|
|
15481
15488
|
this.cachedExperimentGroups = experimentgroups;
|
|
15482
15489
|
this.lastUpdated = new Date();
|
|
15483
|
-
console.log(
|
|
15490
|
+
console.log("Experiments and Experiment Groups fetched successfully.");
|
|
15484
15491
|
}
|
|
15485
15492
|
// Set up refresh strategy
|
|
15486
|
-
if (this.options.refreshStrategy &&
|
|
15493
|
+
if (this.options.refreshStrategy &&
|
|
15494
|
+
"interval" in this.options.refreshStrategy) {
|
|
15487
15495
|
const strategy = this.options.refreshStrategy;
|
|
15488
15496
|
this.startPolling(strategy.interval);
|
|
15489
15497
|
}
|
|
@@ -15497,11 +15505,11 @@ class ExperimentationClient {
|
|
|
15497
15505
|
this.cachedExperiments = experiments;
|
|
15498
15506
|
this.cachedExperimentGroups = experimentGroups;
|
|
15499
15507
|
this.lastUpdated = new Date();
|
|
15500
|
-
console.log(
|
|
15508
|
+
console.log("Experiments and Experiment Groups refreshed successfully.");
|
|
15501
15509
|
}
|
|
15502
15510
|
}
|
|
15503
15511
|
catch (error) {
|
|
15504
|
-
console.error(
|
|
15512
|
+
console.error("Polling error:", error);
|
|
15505
15513
|
}
|
|
15506
15514
|
}, interval);
|
|
15507
15515
|
}
|
|
@@ -15510,7 +15518,11 @@ class ExperimentationClient {
|
|
|
15510
15518
|
const commandInput = {
|
|
15511
15519
|
workspace_id: this.superpositionOptions.workspace_id,
|
|
15512
15520
|
org_id: this.superpositionOptions.org_id,
|
|
15513
|
-
all: true
|
|
15521
|
+
all: true,
|
|
15522
|
+
status: [
|
|
15523
|
+
superpositionSdk.ExperimentStatusType.CREATED,
|
|
15524
|
+
superpositionSdk.ExperimentStatusType.INPROGRESS,
|
|
15525
|
+
],
|
|
15514
15526
|
};
|
|
15515
15527
|
const command = new superpositionSdk.ListExperimentCommand(commandInput);
|
|
15516
15528
|
const response = await this.smithyClient.send(command);
|
|
@@ -15522,7 +15534,7 @@ class ExperimentationClient {
|
|
|
15522
15534
|
for (const exp of response.data) {
|
|
15523
15535
|
// Skip experiments without required fields
|
|
15524
15536
|
if (!exp.id) {
|
|
15525
|
-
console.warn(
|
|
15537
|
+
console.warn("Skipping experiment without ID");
|
|
15526
15538
|
continue;
|
|
15527
15539
|
}
|
|
15528
15540
|
const variants = [];
|
|
@@ -15534,7 +15546,8 @@ class ExperimentationClient {
|
|
|
15534
15546
|
continue;
|
|
15535
15547
|
}
|
|
15536
15548
|
const variantType = variant.variant_type;
|
|
15537
|
-
if (variantType !==
|
|
15549
|
+
if (variantType !== superpositionSdk.VariantType.CONTROL &&
|
|
15550
|
+
variantType !== superpositionSdk.VariantType.EXPERIMENTAL) {
|
|
15538
15551
|
console.warn(`Invalid variant type: ${variant.variant_type}`);
|
|
15539
15552
|
continue;
|
|
15540
15553
|
}
|
|
@@ -15543,7 +15556,7 @@ class ExperimentationClient {
|
|
|
15543
15556
|
variant_type: variantType,
|
|
15544
15557
|
context_id: variant.context_id,
|
|
15545
15558
|
override_id: variant.override_id,
|
|
15546
|
-
overrides: this.normalizeToStringRecord(variant.overrides)
|
|
15559
|
+
overrides: this.normalizeToStringRecord(variant.overrides),
|
|
15547
15560
|
});
|
|
15548
15561
|
}
|
|
15549
15562
|
}
|
|
@@ -15551,13 +15564,13 @@ class ExperimentationClient {
|
|
|
15551
15564
|
id: exp.id,
|
|
15552
15565
|
context: this.normalizeToStringRecord(exp.context),
|
|
15553
15566
|
variants: variants,
|
|
15554
|
-
traffic_percentage: exp.traffic_percentage || 100
|
|
15567
|
+
traffic_percentage: exp.traffic_percentage || 100,
|
|
15555
15568
|
});
|
|
15556
15569
|
}
|
|
15557
15570
|
return experiments;
|
|
15558
15571
|
}
|
|
15559
15572
|
catch (error) {
|
|
15560
|
-
console.error(
|
|
15573
|
+
console.error("Error fetching experiments from Superposition:", error);
|
|
15561
15574
|
return null;
|
|
15562
15575
|
}
|
|
15563
15576
|
}
|
|
@@ -15566,7 +15579,7 @@ class ExperimentationClient {
|
|
|
15566
15579
|
const commandInput = {
|
|
15567
15580
|
workspace_id: this.superpositionOptions.workspace_id,
|
|
15568
15581
|
org_id: this.superpositionOptions.org_id,
|
|
15569
|
-
all: true
|
|
15582
|
+
all: true,
|
|
15570
15583
|
};
|
|
15571
15584
|
const command = new superpositionSdk.ListExperimentGroupsCommand(commandInput);
|
|
15572
15585
|
const response = await this.smithyClient.send(command);
|
|
@@ -15578,7 +15591,7 @@ class ExperimentationClient {
|
|
|
15578
15591
|
for (const exp_group of response.data) {
|
|
15579
15592
|
// Skip experiment groups without required fields
|
|
15580
15593
|
if (!exp_group.id) {
|
|
15581
|
-
console.warn(
|
|
15594
|
+
console.warn("Skipping experiment group without ID");
|
|
15582
15595
|
continue;
|
|
15583
15596
|
}
|
|
15584
15597
|
experimentGroups.push({
|
|
@@ -15586,13 +15599,15 @@ class ExperimentationClient {
|
|
|
15586
15599
|
context: this.normalizeToStringRecord(exp_group.context),
|
|
15587
15600
|
traffic_percentage: exp_group.traffic_percentage || 100,
|
|
15588
15601
|
member_experiment_ids: exp_group.member_experiment_ids || [],
|
|
15589
|
-
group_type: exp_group.group_type ||
|
|
15602
|
+
group_type: exp_group.group_type ||
|
|
15603
|
+
superpositionSdk.GroupType.USER_CREATED,
|
|
15604
|
+
buckets: exp_group.buckets || [],
|
|
15590
15605
|
});
|
|
15591
15606
|
}
|
|
15592
15607
|
return experimentGroups;
|
|
15593
15608
|
}
|
|
15594
15609
|
catch (error) {
|
|
15595
|
-
console.error(
|
|
15610
|
+
console.error("Error fetching experiment groups from Superposition:", error);
|
|
15596
15611
|
return null;
|
|
15597
15612
|
}
|
|
15598
15613
|
}
|
|
@@ -15607,9 +15622,9 @@ class ExperimentationClient {
|
|
|
15607
15622
|
return result;
|
|
15608
15623
|
}
|
|
15609
15624
|
// If it's already a record/object
|
|
15610
|
-
if (typeof value ===
|
|
15625
|
+
if (typeof value === "object" && !Array.isArray(value)) {
|
|
15611
15626
|
for (const [key, val] of Object.entries(value)) {
|
|
15612
|
-
if (typeof val ===
|
|
15627
|
+
if (typeof val === "string") {
|
|
15613
15628
|
result[key] = val;
|
|
15614
15629
|
}
|
|
15615
15630
|
else if (val != null) {
|
|
@@ -15624,14 +15639,16 @@ class ExperimentationClient {
|
|
|
15624
15639
|
return result;
|
|
15625
15640
|
}
|
|
15626
15641
|
async getExperiments() {
|
|
15627
|
-
if (this.options.refreshStrategy &&
|
|
15642
|
+
if (this.options.refreshStrategy &&
|
|
15643
|
+
"ttl" in this.options.refreshStrategy) {
|
|
15628
15644
|
const strategy = this.options.refreshStrategy;
|
|
15629
15645
|
const now = new Date();
|
|
15630
15646
|
const shouldRefresh = !this.lastUpdated ||
|
|
15631
|
-
|
|
15647
|
+
now.getTime() - this.lastUpdated.getTime() >
|
|
15648
|
+
strategy.ttl * 1000;
|
|
15632
15649
|
if (shouldRefresh) {
|
|
15633
15650
|
try {
|
|
15634
|
-
console.log(
|
|
15651
|
+
console.log("TTL expired. Fetching experiments on-demand.");
|
|
15635
15652
|
const experiments = await this.fetchExperiments();
|
|
15636
15653
|
if (experiments) {
|
|
15637
15654
|
this.cachedExperiments = experiments;
|
|
@@ -15639,25 +15656,28 @@ class ExperimentationClient {
|
|
|
15639
15656
|
}
|
|
15640
15657
|
}
|
|
15641
15658
|
catch (error) {
|
|
15642
|
-
console.warn(
|
|
15643
|
-
if (!strategy.use_stale_on_error ||
|
|
15659
|
+
console.warn("On-demand fetch failed:", error);
|
|
15660
|
+
if (!strategy.use_stale_on_error ||
|
|
15661
|
+
!this.cachedExperiments) {
|
|
15644
15662
|
throw error;
|
|
15645
15663
|
}
|
|
15646
|
-
console.log(
|
|
15664
|
+
console.log("Using stale experiments due to error.");
|
|
15647
15665
|
}
|
|
15648
15666
|
}
|
|
15649
15667
|
}
|
|
15650
15668
|
return this.cachedExperiments || [];
|
|
15651
15669
|
}
|
|
15652
15670
|
async getExperimentGroups() {
|
|
15653
|
-
if (this.options.refreshStrategy &&
|
|
15671
|
+
if (this.options.refreshStrategy &&
|
|
15672
|
+
"ttl" in this.options.refreshStrategy) {
|
|
15654
15673
|
const strategy = this.options.refreshStrategy;
|
|
15655
15674
|
const now = new Date();
|
|
15656
15675
|
const shouldRefresh = !this.lastUpdated ||
|
|
15657
|
-
|
|
15676
|
+
now.getTime() - this.lastUpdated.getTime() >
|
|
15677
|
+
strategy.ttl * 1000;
|
|
15658
15678
|
if (shouldRefresh) {
|
|
15659
15679
|
try {
|
|
15660
|
-
console.log(
|
|
15680
|
+
console.log("TTL expired. Fetching experiment groups on-demand.");
|
|
15661
15681
|
const experimentGroups = await this.fetchExperimentGroups();
|
|
15662
15682
|
if (experimentGroups) {
|
|
15663
15683
|
this.cachedExperimentGroups = experimentGroups;
|
|
@@ -15665,11 +15685,12 @@ class ExperimentationClient {
|
|
|
15665
15685
|
}
|
|
15666
15686
|
}
|
|
15667
15687
|
catch (error) {
|
|
15668
|
-
console.warn(
|
|
15669
|
-
if (!strategy.use_stale_on_error ||
|
|
15688
|
+
console.warn("On-demand fetch failed:", error);
|
|
15689
|
+
if (!strategy.use_stale_on_error ||
|
|
15690
|
+
!this.cachedExperimentGroups) {
|
|
15670
15691
|
throw error;
|
|
15671
15692
|
}
|
|
15672
|
-
console.log(
|
|
15693
|
+
console.log("Using stale experiment groups due to error.");
|
|
15673
15694
|
}
|
|
15674
15695
|
}
|
|
15675
15696
|
}
|
|
@@ -15691,15 +15712,15 @@ class ExperimentationClient {
|
|
|
15691
15712
|
try {
|
|
15692
15713
|
if (this.pollingInterval) {
|
|
15693
15714
|
clearInterval(this.pollingInterval);
|
|
15694
|
-
console.log(
|
|
15715
|
+
console.log("Polling stopped successfully");
|
|
15695
15716
|
}
|
|
15696
15717
|
this.clearEvalCache();
|
|
15697
15718
|
this.cachedExperiments = null;
|
|
15698
15719
|
this.lastUpdated = null;
|
|
15699
|
-
console.log(
|
|
15720
|
+
console.log("ExperimentationClient closed successfully");
|
|
15700
15721
|
}
|
|
15701
15722
|
catch (error) {
|
|
15702
|
-
console.error(
|
|
15723
|
+
console.error("Error during ExperimentationClient cleanup:", error);
|
|
15703
15724
|
throw error;
|
|
15704
15725
|
}
|
|
15705
15726
|
}
|
|
@@ -15789,6 +15810,7 @@ class ConfigurationClient {
|
|
|
15789
15810
|
throw new Error(`Failed to fetch configuration: ${errorMessage}`);
|
|
15790
15811
|
}
|
|
15791
15812
|
}
|
|
15813
|
+
// TODO: defaultValue is taken but not used. Should it be used as a fallback?
|
|
15792
15814
|
async getAllConfigValue(defaultValue, context, targetingKey) {
|
|
15793
15815
|
try {
|
|
15794
15816
|
const configData = await this.fetchConfigData();
|
|
@@ -15796,9 +15818,10 @@ class ConfigurationClient {
|
|
|
15796
15818
|
let queryData = { ...context };
|
|
15797
15819
|
if (this.experimentationClient && targetingKey) {
|
|
15798
15820
|
const experiments = await this.experimentationClient.getExperiments();
|
|
15821
|
+
const experiment_groups = await this.experimentationClient.getExperimentGroups();
|
|
15799
15822
|
const identifier = this.experimentationOptions?.defaultIdentifier ||
|
|
15800
15823
|
(targetingKey ? targetingKey : "default");
|
|
15801
|
-
const variantIds = await this.getApplicableVariants(experiments, queryData, identifier);
|
|
15824
|
+
const variantIds = await this.getApplicableVariants(experiments, experiment_groups, this.currentConfigData?.dimensions || {}, queryData, identifier);
|
|
15802
15825
|
if (variantIds.length > 0) {
|
|
15803
15826
|
queryData.variantIds = variantIds;
|
|
15804
15827
|
}
|
|
@@ -15814,9 +15837,9 @@ class ConfigurationClient {
|
|
|
15814
15837
|
}
|
|
15815
15838
|
}
|
|
15816
15839
|
// Add method to get applicable variants
|
|
15817
|
-
async getApplicableVariants(experiments, queryData, identifier, filterPrefixes) {
|
|
15840
|
+
async getApplicableVariants(experiments, experiment_groups, dimensions, queryData, identifier, filterPrefixes) {
|
|
15818
15841
|
// This would use the native resolver's getApplicableVariants method
|
|
15819
|
-
return this.resolver.getApplicableVariants(experiments, queryData, identifier, filterPrefixes || []);
|
|
15842
|
+
return this.resolver.getApplicableVariants(experiments, experiment_groups, dimensions, queryData, identifier, filterPrefixes || []);
|
|
15820
15843
|
}
|
|
15821
15844
|
// Add method to close and cleanup
|
|
15822
15845
|
async close() {
|
|
@@ -16010,7 +16033,7 @@ class NativeResolver {
|
|
|
16010
16033
|
throw new Error(`Failed to parse reasoning evaluation result: ${parseError}`);
|
|
16011
16034
|
}
|
|
16012
16035
|
}
|
|
16013
|
-
getApplicableVariants(experiments, dimensions, userContext, identifier, filterPrefixes = []) {
|
|
16036
|
+
getApplicableVariants(experiments, experiment_groups, dimensions, userContext, identifier, filterPrefixes = []) {
|
|
16014
16037
|
if (!this.isAvailable) {
|
|
16015
16038
|
throw new Error("Native resolver is not available. Please ensure the native library is built and accessible.");
|
|
16016
16039
|
}
|
|
@@ -16021,15 +16044,17 @@ class NativeResolver {
|
|
|
16021
16044
|
throw new Error("userContext parameter is required");
|
|
16022
16045
|
}
|
|
16023
16046
|
const experimentsJson = JSON.stringify(experiments);
|
|
16047
|
+
const experimentGroupsJson = JSON.stringify(experiment_groups);
|
|
16024
16048
|
const userContextJson = JSON.stringify(userContext);
|
|
16025
16049
|
const dimensionsJson = JSON.stringify(dimensions);
|
|
16026
16050
|
const filterPrefixesJson = filterPrefixes.length > 0 ? JSON.stringify(filterPrefixes) : null;
|
|
16027
|
-
console.log("
|
|
16028
|
-
console.log(" experiments:", experiments);
|
|
16051
|
+
console.log("Calling FFI getApplicableVariants with parameters:");
|
|
16052
|
+
console.log(" experiments:", experiments.length);
|
|
16053
|
+
console.log(" experimentGroups:", experiment_groups.length);
|
|
16029
16054
|
console.log(" userContext:", userContext);
|
|
16030
16055
|
console.log(" identifier:", identifier);
|
|
16031
16056
|
console.log(" filterPrefixes:", filterPrefixes);
|
|
16032
|
-
const result = this.lib.core_get_applicable_variants(experimentsJson, dimensionsJson, userContextJson, identifier, filterPrefixesJson);
|
|
16057
|
+
const result = this.lib.core_get_applicable_variants(experimentsJson, experimentGroupsJson, dimensionsJson, userContextJson, identifier, filterPrefixesJson);
|
|
16033
16058
|
console.log("FFI getApplicableVariants call completed, result:", result);
|
|
16034
16059
|
if (!result) {
|
|
16035
16060
|
this.throwLastError("Failed to get applicable variants");
|