superposition-provider 0.99.1 → 0.99.2

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/index.js CHANGED
@@ -3183,7 +3183,7 @@ var runtimeConfig = {};
3183
3183
 
3184
3184
  var name = "superposition-sdk";
3185
3185
  var description = "superposition-sdk client";
3186
- var version = "0.99.1";
3186
+ var version = "0.99.2";
3187
3187
  var repository = {
3188
3188
  type: "git",
3189
3189
  url: "git+https://github.com/juspay/superposition.git"
@@ -16807,6 +16807,14 @@ class ExperimentationClient {
16807
16807
  }
16808
16808
  }
16809
16809
  }
16810
+ // If cache is empty, fetch on-demand regardless of strategy
16811
+ if (!this.cachedExperiments) {
16812
+ const experiments = await this.fetchExperiments();
16813
+ if (experiments) {
16814
+ this.cachedExperiments = experiments;
16815
+ this.lastUpdated = new Date();
16816
+ }
16817
+ }
16810
16818
  return this.cachedExperiments || [];
16811
16819
  }
16812
16820
  async getExperimentGroups() {
@@ -16836,6 +16844,14 @@ class ExperimentationClient {
16836
16844
  }
16837
16845
  }
16838
16846
  }
16847
+ // If cache is empty, fetch on-demand regardless of strategy
16848
+ if (!this.cachedExperimentGroups) {
16849
+ const experimentGroups = await this.fetchExperimentGroups();
16850
+ if (experimentGroups) {
16851
+ this.cachedExperimentGroups = experimentGroups;
16852
+ this.lastUpdated = new Date();
16853
+ }
16854
+ }
16839
16855
  return this.cachedExperimentGroups || [];
16840
16856
  }
16841
16857
  generateCacheKey(queryData) {
@@ -16907,7 +16923,7 @@ class ConfigurationClient {
16907
16923
  }
16908
16924
  async eval(queryData, filterPrefixes, targetingKey) {
16909
16925
  try {
16910
- const configData = await this.fetchConfigData();
16926
+ const configData = this.currentConfigData || await this.fetchConfigData();
16911
16927
  let experimentationArgs;
16912
16928
  if (this.experimentationClient && targetingKey) {
16913
16929
  const experiments = await this.experimentationClient.getExperiments();
@@ -16959,7 +16975,7 @@ class ConfigurationClient {
16959
16975
  // TODO: Remove this function all together and use eval for getAllConfigValue as well
16960
16976
  async getAllConfigValue(defaultValue, context, targetingKey) {
16961
16977
  try {
16962
- const configData = await this.fetchConfigData();
16978
+ const configData = this.currentConfigData || await this.fetchConfigData();
16963
16979
  // Prepare query data with experiment variants if applicable
16964
16980
  let queryData = { ...context };
16965
16981
  if (this.experimentationClient && targetingKey) {