superposition-provider 0.85.0 → 0.86.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/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Superposition Provider
2
+
3
+ Superposition provider is an openfeature provider that works with [Superposition](https://juspay.io/open-source/superposition) to fetch feature flags, configurations, and experiment variants from a Superposition server, store it in-memory and do configuration resolutions based on dynamic contexts. Read the [docs](https://juspay.io/open-source/superposition/docs) for more details.
4
+
5
+ ## Getting started
6
+
7
+ Install the provider
8
+ ```
9
+ npm install superposition-provider
10
+ ```
11
+
12
+ > **Note:** You will need to boot up Superposition before running the client code. Check the docs on how to get started with Superposition.
13
+
14
+ ## Initialization
15
+
16
+ To initialize the Superposition provider, you need to create a configuration. Create the provider object and then, you can set the provider using OpenFeature's API.
17
+
18
+ ```javascript
19
+ import { OpenFeature } from '@openfeature/server-sdk';
20
+ import { SuperpositionProvider } from 'superposition-provider';
21
+
22
+ // create a simple configuration object, for all options check the provider documentation
23
+ const config = {
24
+ endpoint: "http://localhost:8080",
25
+ token: "your-token-here",
26
+ org_id: "localorg",
27
+ workspace_id: "test",
28
+ };
29
+ const provider = new SuperpositionProvider(config);
30
+ console.log("Provider created successfully");
31
+
32
+ // Initialize the provider
33
+ await OpenFeature.setProviderAndWait(provider);
34
+ console.log("Provider initialized successfully");
35
+ ```
36
+
37
+ ## Usage
38
+
39
+ Once the provider is initialized, you can evaluate feature flags and configurations using the OpenFeature client.
40
+
41
+ ```javascript
42
+ const client = OpenFeature.getClient();
43
+ const context = {
44
+ d1: "d1",
45
+ };
46
+
47
+ console.log("Testing feature flags...");
48
+
49
+ const boolValue = await client.getBooleanValue("bool", false, context);
50
+ console.log("Boolean flag 'bool':", boolValue);
51
+
52
+ const stringValue = await client.getStringValue(
53
+ "string",
54
+ "default",
55
+ context,
56
+ );
57
+ console.log("String flag 'string':", stringValue);
58
+
59
+ const numberValue = await client.getNumberValue("number_key", 0, context);
60
+ console.log("Number flag 'number_key':", numberValue);
61
+
62
+ // Test resolving all config
63
+ const allConfig = await provider.resolveAllConfigDetails({}, context);
64
+ console.log("All config:", allConfig);
65
+ ```
66
+
package/dist/index.esm.js CHANGED
@@ -9632,6 +9632,7 @@ function requireAws_restJson1 () {
9632
9632
  let body;
9633
9633
  body = JSON.stringify((0, smithy_client_1.take)(input, {
9634
9634
  'allow_experiment_self_approval': [],
9635
+ 'auto_populate_control': [],
9635
9636
  'metrics': _ => se_Document(_),
9636
9637
  'strict_mode': [],
9637
9638
  'workspace_admin_email': [],
@@ -10563,6 +10564,7 @@ function requireAws_restJson1 () {
10563
10564
  let body;
10564
10565
  body = JSON.stringify((0, smithy_client_1.take)(input, {
10565
10566
  'allow_experiment_self_approval': [],
10567
+ 'auto_populate_control': [],
10566
10568
  'config_version': [],
10567
10569
  'mandatory_dimensions': _ => (0, smithy_client_1._json)(_),
10568
10570
  'metrics': _ => se_Document(_),
@@ -10935,6 +10937,7 @@ function requireAws_restJson1 () {
10935
10937
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
10936
10938
  const doc = (0, smithy_client_1.take)(data, {
10937
10939
  'allow_experiment_self_approval': smithy_client_1.expectBoolean,
10940
+ 'auto_populate_control': smithy_client_1.expectBoolean,
10938
10941
  'config_version': smithy_client_1.expectString,
10939
10942
  'created_at': _ => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
10940
10943
  'created_by': smithy_client_1.expectString,
@@ -12018,6 +12021,7 @@ function requireAws_restJson1 () {
12018
12021
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
12019
12022
  const doc = (0, smithy_client_1.take)(data, {
12020
12023
  'allow_experiment_self_approval': smithy_client_1.expectBoolean,
12024
+ 'auto_populate_control': smithy_client_1.expectBoolean,
12021
12025
  'config_version': smithy_client_1.expectString,
12022
12026
  'created_at': _ => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
12023
12027
  'created_by': smithy_client_1.expectString,
@@ -12676,6 +12680,7 @@ function requireAws_restJson1 () {
12676
12680
  const de_WorkspaceResponse = (output, context) => {
12677
12681
  return (0, smithy_client_1.take)(output, {
12678
12682
  'allow_experiment_self_approval': smithy_client_1.expectBoolean,
12683
+ 'auto_populate_control': smithy_client_1.expectBoolean,
12679
12684
  'config_version': smithy_client_1.expectString,
12680
12685
  'created_at': (_) => (0, smithy_client_1.expectNonNull)((0, smithy_client_1.parseRfc3339DateTimeWithOffset)(_)),
12681
12686
  'created_by': smithy_client_1.expectString,