@configdirector/openfeature-server-provider 0.9.5 → 1.0.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/configdirector-openfeature-server-provider.cjs +1 -1
- package/dist/configdirector-openfeature-server-provider.d.cts +106 -9
- package/dist/configdirector-openfeature-server-provider.d.cts.map +1 -1
- package/dist/configdirector-openfeature-server-provider.d.mts +106 -9
- package/dist/configdirector-openfeature-server-provider.d.mts.map +1 -1
- package/dist/configdirector-openfeature-server-provider.mjs +1 -1
- package/dist/configdirector-openfeature-server-provider.mjs.map +1 -1
- package/package.json +5 -3
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
import { ConfigDirectorClient, ConfigDirectorClientOptions, ConfigDirectorContext, ConfigDirectorLogMessageDecorator, ConfigDirectorLogger, ConfigDirectorLoggingLevel, ConfigValueType } from "@js-client-core/index";
|
|
2
1
|
import { EvaluationContext, JsonValue, OpenFeatureEventEmitter, Paradigm, Provider, ProviderMetadata, ResolutionDetails } from "@openfeature/server-sdk";
|
|
3
2
|
|
|
4
3
|
//#region ../shared/src/types.d.ts
|
|
4
|
+
declare const ConfigTypeList: readonly ["custom", "boolean", "string", "integer", "float", "enum", "url", "json"];
|
|
5
|
+
type ConfigType = (typeof ConfigTypeList)[number];
|
|
5
6
|
type ConfigEnumLikeType = {
|
|
6
7
|
[key: string]: string | number;
|
|
7
8
|
};
|
|
8
|
-
type ConfigValueType
|
|
9
|
-
|
|
9
|
+
type ConfigValueType = string | number | boolean | object | ConfigEnumLikeType;
|
|
10
|
+
type ConfigState = {
|
|
11
|
+
id: string;
|
|
12
|
+
key: string;
|
|
13
|
+
type: ConfigType;
|
|
14
|
+
value: string | undefined | null;
|
|
15
|
+
valueId?: string | undefined | null;
|
|
16
|
+
};
|
|
17
|
+
type ConfigDirectorLoggingLevel = "debug" | "info" | "warn" | "error" | "off";
|
|
18
|
+
interface ConfigDirectorLogger {
|
|
10
19
|
debug(message: string, ...args: any): void;
|
|
11
20
|
info(message: string, ...args: any): void;
|
|
12
21
|
warn(message: string, ...args: any): void;
|
|
13
22
|
error(message: string, ...args: any): void;
|
|
14
23
|
}
|
|
24
|
+
interface ConfigDirectorLogMessageDecorator {
|
|
25
|
+
decorateMessage(message: string): string;
|
|
26
|
+
}
|
|
15
27
|
type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean";
|
|
16
28
|
type ConfigEvaluation = {
|
|
17
29
|
key: string;
|
|
18
|
-
value: ConfigValueType
|
|
30
|
+
value: ConfigValueType;
|
|
19
31
|
valueId?: string;
|
|
20
32
|
isDefaultValue: boolean;
|
|
21
33
|
reason: EvaluationReason;
|
|
22
|
-
context?: ConfigDirectorContext
|
|
34
|
+
context?: ConfigDirectorContext;
|
|
23
35
|
};
|
|
24
36
|
/**
|
|
25
37
|
* The user's context to be sent to ConfigDirector. This context will be used for targeting
|
|
26
38
|
* rules evaluation.
|
|
27
39
|
*/
|
|
28
|
-
type ConfigDirectorContext
|
|
40
|
+
type ConfigDirectorContext = {
|
|
29
41
|
/**
|
|
30
42
|
* The user's identifier. This should be a value that uniquely identifies an application
|
|
31
43
|
* user.
|
|
@@ -70,7 +82,7 @@ type ConnectionMode = "streaming" | "polling" | "one-time";
|
|
|
70
82
|
/**
|
|
71
83
|
* Configuration options for the {@link ConfigDirectorClient}
|
|
72
84
|
*/
|
|
73
|
-
type ConfigDirectorClientOptions
|
|
85
|
+
type ConfigDirectorClientOptions = {
|
|
74
86
|
/**
|
|
75
87
|
* Application metadata that remains constant through the lifetime of the connection
|
|
76
88
|
*/
|
|
@@ -127,7 +139,7 @@ type ConfigDirectorClientOptions$1 = {
|
|
|
127
139
|
* { logger: createConsoleLogger("debug") },
|
|
128
140
|
* );
|
|
129
141
|
*/
|
|
130
|
-
logger?: ConfigDirectorLogger
|
|
142
|
+
logger?: ConfigDirectorLogger;
|
|
131
143
|
/**
|
|
132
144
|
* Telemetry tunning. It is unlikely these settings need to be adjusted. However, in cases where
|
|
133
145
|
* your application has a large number of evaluations per second, you can adjust these settings
|
|
@@ -188,6 +200,91 @@ type ClientHooks = {
|
|
|
188
200
|
configEvaluated?: HookHandler<"configEvaluated"> | HookHandler<"configEvaluated">[];
|
|
189
201
|
};
|
|
190
202
|
type HookHandler<TEvent extends keyof ClientEvents> = (payload: ClientEvents[TEvent]) => void;
|
|
203
|
+
type WatchHandler<T extends ConfigValueType> = (message: T) => void;
|
|
204
|
+
/**
|
|
205
|
+
* The ConfigDirector SDK client object.
|
|
206
|
+
*
|
|
207
|
+
* Applications should create a single instance of `ConfigDirectorClient`, and call
|
|
208
|
+
* {@link initialize} during application initialization.
|
|
209
|
+
*/
|
|
210
|
+
interface ConfigDirectorClient {
|
|
211
|
+
/**
|
|
212
|
+
* Initializes the connection to ConfigDirector to retrieve config definitions. Until
|
|
213
|
+
* initialization is successful, all flags will return their default value provided to
|
|
214
|
+
* {@link watch} or {@link getValue}.
|
|
215
|
+
*
|
|
216
|
+
* If the connection fails or is interrupted with a transient error (network error,
|
|
217
|
+
* internal server error, etc) the client will continue to attempt to connect. However,
|
|
218
|
+
* if the connection fails with a persistent error, like an invalid SDK key, the client will
|
|
219
|
+
* not attempt to re-connect and an error will be logged to the console or the provided
|
|
220
|
+
* logger.
|
|
221
|
+
*/
|
|
222
|
+
initialize(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Returns whether or not the client is ready after calling {@link initialize}
|
|
225
|
+
*
|
|
226
|
+
* The definition of ready is that the connection to the server was successful, and config definitions
|
|
227
|
+
* were received.
|
|
228
|
+
*/
|
|
229
|
+
get isReady(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Evaluates a config and returns its value based on the current context and targeting rules
|
|
232
|
+
*
|
|
233
|
+
* @returns The evaluated config value, or the `defaultValue` if the config state was unavailable
|
|
234
|
+
* @param configKey The config key to evaluate
|
|
235
|
+
* @param defaultValue The default value to be returned if the config state is unavailable. For
|
|
236
|
+
* example, if the client cannot connect to the server due to network conditions, or if getValue
|
|
237
|
+
* is called before initialization is done.
|
|
238
|
+
* @param context The user's context to be used for targeting rules evaluation (optional)
|
|
239
|
+
*/
|
|
240
|
+
getValue<T extends ConfigValueType>(configKey: string, defaultValue: T, context?: ConfigDirectorContext): T;
|
|
241
|
+
/**
|
|
242
|
+
* Watches for changes to a a config evaluation value. Whenever the config value changes, the
|
|
243
|
+
* provided callback function will be called with the new value. Changes can happen due to updates
|
|
244
|
+
* to the config in the ConfigDirector dashboard, or if the context is updated via {@link updateContext}.
|
|
245
|
+
*
|
|
246
|
+
* @returns An 'unwatch' function that can be called to remove the subscriber
|
|
247
|
+
*
|
|
248
|
+
* @param configKey The config key to watch
|
|
249
|
+
* @param defaultValue The default value to be referenced if the config state is unavailable
|
|
250
|
+
* @param callback The callback function to be called whenever the config value is updated
|
|
251
|
+
* @param context The user's context to be used for targeting rules evaluation (optional)
|
|
252
|
+
*/
|
|
253
|
+
watch<T extends ConfigValueType>(configKey: string, defaultValue: T, callback: WatchHandler<T>, context?: ConfigDirectorContext): () => void;
|
|
254
|
+
/**
|
|
255
|
+
* Removes a particular subscriber to the given `configKey`, or all subscribers if no callback
|
|
256
|
+
* is provided.
|
|
257
|
+
*
|
|
258
|
+
* @param configKey The config key to remove subscribers from
|
|
259
|
+
* @param callback The subscriber to be removed. If not provided, all subscribers are removed for
|
|
260
|
+
* the given `configKey`.
|
|
261
|
+
*/
|
|
262
|
+
unwatch<T extends ConfigValueType>(configKey: string, callback?: WatchHandler<T>): void;
|
|
263
|
+
/**
|
|
264
|
+
* Removes all subscribers from all config keys
|
|
265
|
+
*/
|
|
266
|
+
unwatchAll(): void;
|
|
267
|
+
/**
|
|
268
|
+
* Returns the evaluated {@link ConfigState} for every known config key, or only the keys
|
|
269
|
+
* listed in `configKeys` when provided.
|
|
270
|
+
*
|
|
271
|
+
* Intended for SSR hydration — does NOT record telemetry events. Returns an empty object
|
|
272
|
+
* when the client is not yet ready.
|
|
273
|
+
*/
|
|
274
|
+
getAllConfigs(options?: {
|
|
275
|
+
context?: ConfigDirectorContext;
|
|
276
|
+
configKeys?: string[];
|
|
277
|
+
}): Record<string, ConfigState>;
|
|
278
|
+
on<T extends keyof ClientEvents>(eventName: T, handler: (args: ClientEvents[T]) => void): void;
|
|
279
|
+
off<T extends keyof ClientEvents>(eventName: T, handler?: (args: ClientEvents[T]) => void): void;
|
|
280
|
+
/**
|
|
281
|
+
* Disposes of the client. All connections are closed, and all event and config key subscribers
|
|
282
|
+
* are removed.
|
|
283
|
+
*
|
|
284
|
+
* Intended to be called when your application shuts down
|
|
285
|
+
*/
|
|
286
|
+
dispose(): void;
|
|
287
|
+
}
|
|
191
288
|
//#endregion
|
|
192
289
|
//#region src/ConfigDirectorProvider.d.ts
|
|
193
290
|
declare class ConfigDirectorProvider implements Provider {
|
|
@@ -196,7 +293,7 @@ declare class ConfigDirectorProvider implements Provider {
|
|
|
196
293
|
readonly metadata: ProviderMetadata;
|
|
197
294
|
readonly runsOn: Paradigm;
|
|
198
295
|
readonly events: OpenFeatureEventEmitter;
|
|
199
|
-
constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions
|
|
296
|
+
constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions);
|
|
200
297
|
initialize(): Promise<void>;
|
|
201
298
|
resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: EvaluationContext): Promise<ResolutionDetails<boolean>>;
|
|
202
299
|
resolveStringEvaluation(flagKey: string, defaultValue: string, context: EvaluationContext): Promise<ResolutionDetails<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configdirector-openfeature-server-provider.d.cts","names":[],"sources":["../../shared/src/types.ts","../../js-server-sdk/src/types.ts","../src/ConfigDirectorProvider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"configdirector-openfeature-server-provider.d.cts","names":[],"sources":["../../shared/src/types.ts","../../js-server-sdk/src/types.ts","../src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AoB,YAAA,EAAc,SAAA,EAAW,CAAA,EAAG,OAAA,IAAW,IAAA,EAAM,YAAA,CAAa,CAAA;EAlDT;;;;;;EA0DrE,OAAA;AAAA;;;cCzOW,sBAAA,YAAkC,QAAA;EAAA,iBAC5B,MAAA;EAAA,iBACA,YAAA;EAAA,SAER,QAAA,EAAU,gBAAA;EAAA,SAGV,MAAA,EAAQ,QAAA;EAAA,SACR,MAAA,EAAM,uBAAA;cAEI,YAAA,UAAsB,aAAA,GAAgB,2BAAA;EAiBnD,UAAA,CAAA,GAAU,OAAA;EAMhB,wBAAA,CACE,OAAA,UACA,YAAA,WACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,CACE,OAAA,UACA,YAAA,UACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,CACE,OAAA,UACA,YAAA,UACA,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA;EAIX,uBAAA,WAAkC,SAAA,CAAA,CAChC,OAAA,UACA,YAAA,EAAc,CAAA,EACd,OAAA,EAAS,iBAAA,GACR,OAAA,CAAQ,iBAAA,CAAkB,CAAA;EAM7B,OAAA,CAAA,CAAA,GAAY,OAAA;EAAA,QAKJ,QAAA;EAAA,QAWA,UAAA;AAAA"}
|
|
@@ -1,31 +1,43 @@
|
|
|
1
1
|
import { EvaluationContext, JsonValue, OpenFeatureEventEmitter, Paradigm, Provider, ProviderMetadata, ResolutionDetails } from "@openfeature/server-sdk";
|
|
2
|
-
import { ConfigDirectorClient, ConfigDirectorClientOptions, ConfigDirectorContext, ConfigDirectorLogMessageDecorator, ConfigDirectorLogger, ConfigDirectorLoggingLevel, ConfigValueType } from "@js-client-core/index";
|
|
3
2
|
|
|
4
3
|
//#region ../shared/src/types.d.ts
|
|
4
|
+
declare const ConfigTypeList: readonly ["custom", "boolean", "string", "integer", "float", "enum", "url", "json"];
|
|
5
|
+
type ConfigType = (typeof ConfigTypeList)[number];
|
|
5
6
|
type ConfigEnumLikeType = {
|
|
6
7
|
[key: string]: string | number;
|
|
7
8
|
};
|
|
8
|
-
type ConfigValueType
|
|
9
|
-
|
|
9
|
+
type ConfigValueType = string | number | boolean | object | ConfigEnumLikeType;
|
|
10
|
+
type ConfigState = {
|
|
11
|
+
id: string;
|
|
12
|
+
key: string;
|
|
13
|
+
type: ConfigType;
|
|
14
|
+
value: string | undefined | null;
|
|
15
|
+
valueId?: string | undefined | null;
|
|
16
|
+
};
|
|
17
|
+
type ConfigDirectorLoggingLevel = "debug" | "info" | "warn" | "error" | "off";
|
|
18
|
+
interface ConfigDirectorLogger {
|
|
10
19
|
debug(message: string, ...args: any): void;
|
|
11
20
|
info(message: string, ...args: any): void;
|
|
12
21
|
warn(message: string, ...args: any): void;
|
|
13
22
|
error(message: string, ...args: any): void;
|
|
14
23
|
}
|
|
24
|
+
interface ConfigDirectorLogMessageDecorator {
|
|
25
|
+
decorateMessage(message: string): string;
|
|
26
|
+
}
|
|
15
27
|
type EvaluationReason = "found-match" | "config-state-missing" | "client-not-ready" | "type-mismatch" | "value-missing" | "invalid-number" | "invalid-json" | "invalid-boolean";
|
|
16
28
|
type ConfigEvaluation = {
|
|
17
29
|
key: string;
|
|
18
|
-
value: ConfigValueType
|
|
30
|
+
value: ConfigValueType;
|
|
19
31
|
valueId?: string;
|
|
20
32
|
isDefaultValue: boolean;
|
|
21
33
|
reason: EvaluationReason;
|
|
22
|
-
context?: ConfigDirectorContext
|
|
34
|
+
context?: ConfigDirectorContext;
|
|
23
35
|
};
|
|
24
36
|
/**
|
|
25
37
|
* The user's context to be sent to ConfigDirector. This context will be used for targeting
|
|
26
38
|
* rules evaluation.
|
|
27
39
|
*/
|
|
28
|
-
type ConfigDirectorContext
|
|
40
|
+
type ConfigDirectorContext = {
|
|
29
41
|
/**
|
|
30
42
|
* The user's identifier. This should be a value that uniquely identifies an application
|
|
31
43
|
* user.
|
|
@@ -70,7 +82,7 @@ type ConnectionMode = "streaming" | "polling" | "one-time";
|
|
|
70
82
|
/**
|
|
71
83
|
* Configuration options for the {@link ConfigDirectorClient}
|
|
72
84
|
*/
|
|
73
|
-
type ConfigDirectorClientOptions
|
|
85
|
+
type ConfigDirectorClientOptions = {
|
|
74
86
|
/**
|
|
75
87
|
* Application metadata that remains constant through the lifetime of the connection
|
|
76
88
|
*/
|
|
@@ -127,7 +139,7 @@ type ConfigDirectorClientOptions$1 = {
|
|
|
127
139
|
* { logger: createConsoleLogger("debug") },
|
|
128
140
|
* );
|
|
129
141
|
*/
|
|
130
|
-
logger?: ConfigDirectorLogger
|
|
142
|
+
logger?: ConfigDirectorLogger;
|
|
131
143
|
/**
|
|
132
144
|
* Telemetry tunning. It is unlikely these settings need to be adjusted. However, in cases where
|
|
133
145
|
* your application has a large number of evaluations per second, you can adjust these settings
|
|
@@ -188,6 +200,91 @@ type ClientHooks = {
|
|
|
188
200
|
configEvaluated?: HookHandler<"configEvaluated"> | HookHandler<"configEvaluated">[];
|
|
189
201
|
};
|
|
190
202
|
type HookHandler<TEvent extends keyof ClientEvents> = (payload: ClientEvents[TEvent]) => void;
|
|
203
|
+
type WatchHandler<T extends ConfigValueType> = (message: T) => void;
|
|
204
|
+
/**
|
|
205
|
+
* The ConfigDirector SDK client object.
|
|
206
|
+
*
|
|
207
|
+
* Applications should create a single instance of `ConfigDirectorClient`, and call
|
|
208
|
+
* {@link initialize} during application initialization.
|
|
209
|
+
*/
|
|
210
|
+
interface ConfigDirectorClient {
|
|
211
|
+
/**
|
|
212
|
+
* Initializes the connection to ConfigDirector to retrieve config definitions. Until
|
|
213
|
+
* initialization is successful, all flags will return their default value provided to
|
|
214
|
+
* {@link watch} or {@link getValue}.
|
|
215
|
+
*
|
|
216
|
+
* If the connection fails or is interrupted with a transient error (network error,
|
|
217
|
+
* internal server error, etc) the client will continue to attempt to connect. However,
|
|
218
|
+
* if the connection fails with a persistent error, like an invalid SDK key, the client will
|
|
219
|
+
* not attempt to re-connect and an error will be logged to the console or the provided
|
|
220
|
+
* logger.
|
|
221
|
+
*/
|
|
222
|
+
initialize(): Promise<void>;
|
|
223
|
+
/**
|
|
224
|
+
* Returns whether or not the client is ready after calling {@link initialize}
|
|
225
|
+
*
|
|
226
|
+
* The definition of ready is that the connection to the server was successful, and config definitions
|
|
227
|
+
* were received.
|
|
228
|
+
*/
|
|
229
|
+
get isReady(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Evaluates a config and returns its value based on the current context and targeting rules
|
|
232
|
+
*
|
|
233
|
+
* @returns The evaluated config value, or the `defaultValue` if the config state was unavailable
|
|
234
|
+
* @param configKey The config key to evaluate
|
|
235
|
+
* @param defaultValue The default value to be returned if the config state is unavailable. For
|
|
236
|
+
* example, if the client cannot connect to the server due to network conditions, or if getValue
|
|
237
|
+
* is called before initialization is done.
|
|
238
|
+
* @param context The user's context to be used for targeting rules evaluation (optional)
|
|
239
|
+
*/
|
|
240
|
+
getValue<T extends ConfigValueType>(configKey: string, defaultValue: T, context?: ConfigDirectorContext): T;
|
|
241
|
+
/**
|
|
242
|
+
* Watches for changes to a a config evaluation value. Whenever the config value changes, the
|
|
243
|
+
* provided callback function will be called with the new value. Changes can happen due to updates
|
|
244
|
+
* to the config in the ConfigDirector dashboard, or if the context is updated via {@link updateContext}.
|
|
245
|
+
*
|
|
246
|
+
* @returns An 'unwatch' function that can be called to remove the subscriber
|
|
247
|
+
*
|
|
248
|
+
* @param configKey The config key to watch
|
|
249
|
+
* @param defaultValue The default value to be referenced if the config state is unavailable
|
|
250
|
+
* @param callback The callback function to be called whenever the config value is updated
|
|
251
|
+
* @param context The user's context to be used for targeting rules evaluation (optional)
|
|
252
|
+
*/
|
|
253
|
+
watch<T extends ConfigValueType>(configKey: string, defaultValue: T, callback: WatchHandler<T>, context?: ConfigDirectorContext): () => void;
|
|
254
|
+
/**
|
|
255
|
+
* Removes a particular subscriber to the given `configKey`, or all subscribers if no callback
|
|
256
|
+
* is provided.
|
|
257
|
+
*
|
|
258
|
+
* @param configKey The config key to remove subscribers from
|
|
259
|
+
* @param callback The subscriber to be removed. If not provided, all subscribers are removed for
|
|
260
|
+
* the given `configKey`.
|
|
261
|
+
*/
|
|
262
|
+
unwatch<T extends ConfigValueType>(configKey: string, callback?: WatchHandler<T>): void;
|
|
263
|
+
/**
|
|
264
|
+
* Removes all subscribers from all config keys
|
|
265
|
+
*/
|
|
266
|
+
unwatchAll(): void;
|
|
267
|
+
/**
|
|
268
|
+
* Returns the evaluated {@link ConfigState} for every known config key, or only the keys
|
|
269
|
+
* listed in `configKeys` when provided.
|
|
270
|
+
*
|
|
271
|
+
* Intended for SSR hydration — does NOT record telemetry events. Returns an empty object
|
|
272
|
+
* when the client is not yet ready.
|
|
273
|
+
*/
|
|
274
|
+
getAllConfigs(options?: {
|
|
275
|
+
context?: ConfigDirectorContext;
|
|
276
|
+
configKeys?: string[];
|
|
277
|
+
}): Record<string, ConfigState>;
|
|
278
|
+
on<T extends keyof ClientEvents>(eventName: T, handler: (args: ClientEvents[T]) => void): void;
|
|
279
|
+
off<T extends keyof ClientEvents>(eventName: T, handler?: (args: ClientEvents[T]) => void): void;
|
|
280
|
+
/**
|
|
281
|
+
* Disposes of the client. All connections are closed, and all event and config key subscribers
|
|
282
|
+
* are removed.
|
|
283
|
+
*
|
|
284
|
+
* Intended to be called when your application shuts down
|
|
285
|
+
*/
|
|
286
|
+
dispose(): void;
|
|
287
|
+
}
|
|
191
288
|
//#endregion
|
|
192
289
|
//#region src/ConfigDirectorProvider.d.ts
|
|
193
290
|
declare class ConfigDirectorProvider implements Provider {
|
|
@@ -196,7 +293,7 @@ declare class ConfigDirectorProvider implements Provider {
|
|
|
196
293
|
readonly metadata: ProviderMetadata;
|
|
197
294
|
readonly runsOn: Paradigm;
|
|
198
295
|
readonly events: OpenFeatureEventEmitter;
|
|
199
|
-
constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions
|
|
296
|
+
constructor(clientSdkKey: string, clientOptions?: ConfigDirectorClientOptions);
|
|
200
297
|
initialize(): Promise<void>;
|
|
201
298
|
resolveBooleanEvaluation(flagKey: string, defaultValue: boolean, context: EvaluationContext): Promise<ResolutionDetails<boolean>>;
|
|
202
299
|
resolveStringEvaluation(flagKey: string, defaultValue: string, context: EvaluationContext): Promise<ResolutionDetails<string>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configdirector-openfeature-server-provider.d.mts","names":[],"sources":["../../shared/src/types.ts","../../js-server-sdk/src/types.ts","../src/ConfigDirectorProvider.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"configdirector-openfeature-server-provider.d.mts","names":[],"sources":["../../shared/src/types.ts","../../js-server-sdk/src/types.ts","../src/ConfigDirectorProvider.ts"],"mappings":";;;cAAa,cAAA;AAAA,KAUD,UAAA,WAAqB,cAAA;AAAA,KAErB,kBAAA;EAAA,CAAwB,GAAA;AAAA;AAAA,KAExB,eAAA,wCAAuD,kBAAA;AAAA,KAEvD,WAAA;EACV,EAAA;EACA,GAAA;EACA,IAAA,EAAM,UAAA;EACN,KAAA;EACA,OAAA;AAAA;AAAA,KAQU,0BAAA;AAAA,UAEK,oBAAA;EACf,KAAA,CAAM,OAAA,aAAoB,IAAA;EAE1B,IAAA,CAAK,OAAA,aAAoB,IAAA;EAEzB,IAAA,CAAK,OAAA,aAAoB,IAAA;EAEzB,KAAA,CAAM,OAAA,aAAoB,IAAA;AAAA;AAAA,UAGX,iCAAA;EACf,eAAA,CAAgB,OAAA;AAAA;AAAA,KAGN,gBAAA;AAAA,KAUA,gBAAA;EACV,GAAA;EACA,KAAA,EAAO,eAAA;EACP,OAAA;EACA,cAAA;EACA,MAAA,EAAQ,gBAAA;EACR,OAAA,GAAU,qBAAA;AAAA;;;;;KAMA,qBAAA;EApCyB;;;;;;;;EA6CnC,EAAA;EAxCA;;;;EA8CA,IAAA;EA5C0B;;;AAG5B;EA+CE,MAAA;IAAA,CAAY,GAAA;EAAA;EA9CmB;AAGjC;;;;;AAUA;EA0CE,SAAA;AAAA;;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