superposition-provider 0.84.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.
@@ -0,0 +1,22 @@
1
+ import { SuperpositionOptions, ConfigOptions, ConfigData } from './types';
2
+ import { NativeResolver } from 'superposition-bindings';
3
+ import { ExperimentationOptions } from './types';
4
+ export declare class ConfigurationClient {
5
+ private config;
6
+ private resolver;
7
+ private options;
8
+ private currentConfigData;
9
+ private experimentationClient?;
10
+ private experimentationOptions?;
11
+ private defaults;
12
+ private smithyClient;
13
+ constructor(config: SuperpositionOptions, resolver: NativeResolver, options?: ConfigOptions, experimentationOptions?: ExperimentationOptions);
14
+ initialize(): Promise<void>;
15
+ eval(queryData: Record<string, any>, filterPrefixes?: string[], targetingKey?: string): Promise<any>;
16
+ eval<T>(queryData: Record<string, any>, filterPrefixes?: string[], targetingKey?: string): Promise<T>;
17
+ setDefault(defaults: ConfigData): void;
18
+ private fetchConfigData;
19
+ getAllConfigValue(defaultValue: Record<string, any>, context: Record<string, any>, targetingKey?: string): Promise<Record<string, any>>;
20
+ private getApplicableVariants;
21
+ close(): Promise<void>;
22
+ }
@@ -0,0 +1,49 @@
1
+ import { GroupType } from 'superposition-sdk';
2
+ import { SuperpositionOptions, ExperimentationOptions } from './types';
3
+ export interface Variant {
4
+ id: string;
5
+ variant_type: 'CONTROL' | 'EXPERIMENTAL';
6
+ context_id?: string;
7
+ override_id?: string;
8
+ overrides: Record<string, string>;
9
+ }
10
+ export interface Experiment {
11
+ id: string;
12
+ context: Record<string, string>;
13
+ variants: Variant[];
14
+ traffic_percentage: number;
15
+ }
16
+ export interface ExperimentGroup {
17
+ id: string;
18
+ context: Record<string, string>;
19
+ member_experiment_ids: string[];
20
+ traffic_percentage: number;
21
+ group_type: GroupType;
22
+ }
23
+ export declare class ExperimentationClient {
24
+ private superpositionOptions;
25
+ private smithyClient;
26
+ private options;
27
+ private cachedExperiments;
28
+ private cachedExperimentGroups;
29
+ private lastUpdated;
30
+ private evaluationCache;
31
+ private pollingInterval?;
32
+ constructor(superpositionOptions: SuperpositionOptions, experimentOptions: ExperimentationOptions);
33
+ initialize(): Promise<void>;
34
+ private startPolling;
35
+ private fetchExperiments;
36
+ private fetchExperimentGroups;
37
+ /**
38
+ * Normalize any value to a Record<string, string> format
39
+ * This ensures compatibility with the expected interface
40
+ */
41
+ private normalizeToStringRecord;
42
+ getExperiments(): Promise<Experiment[]>;
43
+ getExperimentGroups(): Promise<ExperimentGroup[]>;
44
+ generateCacheKey(queryData: Record<string, any>): string;
45
+ getFromEvalCache(key: string): any | undefined;
46
+ setEvalCache(key: string, value: any): void;
47
+ clearEvalCache(): void;
48
+ close(): Promise<void>;
49
+ }
@@ -0,0 +1,5 @@
1
+ export { SuperpositionProvider, SuperpositionProviderOptions } from './superposition-provider';
2
+ export { ConfigurationClient } from './configuration-client';
3
+ export { ExperimentationClient, Experiment, Variant } from './experimentation-client';
4
+ export * from './types';
5
+ export * from './utils';