@openfeature/web-sdk 0.4.2 → 0.4.3

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/types.d.ts CHANGED
@@ -1,575 +1,5 @@
1
- type FlagValueType = 'boolean' | 'string' | 'number' | 'object';
2
- type PrimitiveValue = null | boolean | string | number;
3
- type JsonObject = {
4
- [key: string]: JsonValue;
5
- };
6
- type JsonArray = JsonValue[];
7
- /**
8
- * Represents a JSON node value.
9
- */
10
- type JsonValue = PrimitiveValue | JsonObject | JsonArray;
11
- /**
12
- * Represents a JSON node value, or Date.
13
- */
14
- type FlagValue = boolean | string | number | JsonValue;
15
- type ResolutionReason = keyof typeof StandardResolutionReasons | (string & Record<never, never>);
16
- /**
17
- * A structure which supports definition of arbitrary properties, with keys of type string, and values of type boolean, string, or number.
18
- *
19
- * This structure is populated by a provider for use by an Application Author (via the Evaluation API) or an Application Integrator (via hooks).
20
- */
21
- type FlagMetadata = Record<string, string | number | boolean>;
22
- type ResolutionDetails<U> = {
23
- value: U;
24
- variant?: string;
25
- flagMetadata?: FlagMetadata;
26
- reason?: ResolutionReason;
27
- errorCode?: ErrorCode;
28
- errorMessage?: string;
29
- };
30
- type EvaluationDetails<T extends FlagValue> = {
31
- flagKey: string;
32
- flagMetadata: Readonly<FlagMetadata>;
33
- } & ResolutionDetails<T>;
34
- declare const StandardResolutionReasons: {
35
- /**
36
- * The resolved value was the result of a dynamic evaluation, such as a rule or specific user-targeting.
37
- */
38
- readonly TARGETING_MATCH: "TARGETING_MATCH";
39
- /**
40
- * The resolved value was the result of pseudorandom assignment.
41
- */
42
- readonly SPLIT: "SPLIT";
43
- /**
44
- * The resolved value was the result of the flag being disabled in the management system.
45
- */
46
- readonly DISABLED: "DISABLED";
47
- /**
48
- * The resolved value was configured statically, or otherwise fell back to a pre-configured value.
49
- */
50
- readonly DEFAULT: "DEFAULT";
51
- /**
52
- * The reason for the resolved value could not be determined.
53
- */
54
- readonly UNKNOWN: "UNKNOWN";
55
- /**
56
- * The resolved value is static (no dynamic evaluation).
57
- */
58
- readonly STATIC: "STATIC";
59
- /**
60
- * The resolved value was retrieved from cache.
61
- */
62
- readonly CACHED: "CACHED";
63
- /**
64
- * The resolved value was the result of an error.
65
- *
66
- * Note: The `errorCode` and `errorMessage` fields may contain additional details of this error.
67
- */
68
- readonly ERROR: "ERROR";
69
- };
70
- declare enum ErrorCode {
71
- /**
72
- * The value was resolved before the provider was ready.
73
- */
74
- PROVIDER_NOT_READY = "PROVIDER_NOT_READY",
75
- /**
76
- * The flag could not be found.
77
- */
78
- FLAG_NOT_FOUND = "FLAG_NOT_FOUND",
79
- /**
80
- * An error was encountered parsing data, such as a flag configuration.
81
- */
82
- PARSE_ERROR = "PARSE_ERROR",
83
- /**
84
- * The type of the flag value does not match the expected type.
85
- */
86
- TYPE_MISMATCH = "TYPE_MISMATCH",
87
- /**
88
- * The provider requires a targeting key and one was not provided in the evaluation context.
89
- */
90
- TARGETING_KEY_MISSING = "TARGETING_KEY_MISSING",
91
- /**
92
- * The evaluation context does not meet provider requirements.
93
- */
94
- INVALID_CONTEXT = "INVALID_CONTEXT",
95
- /**
96
- * An error with an unspecified code.
97
- */
98
- GENERAL = "GENERAL"
99
- }
100
-
101
- type EvaluationContextValue = PrimitiveValue | Date | {
102
- [key: string]: EvaluationContextValue;
103
- } | EvaluationContextValue[];
104
- /**
105
- * A container for arbitrary contextual data that can be used as a basis for dynamic evaluation
106
- */
107
- type EvaluationContext = {
108
- /**
109
- * A string uniquely identifying the subject (end-user, or client service) of a flag evaluation.
110
- * Providers may require this field for fractional flag evaluation, rules, or overrides targeting specific users.
111
- * Such providers may behave unpredictably if a targeting key is not specified at flag resolution.
112
- */
113
- targetingKey?: string;
114
- } & Record<string, EvaluationContextValue>;
115
- interface ManageContext<T> {
116
- /**
117
- * Access the evaluation context set on the receiver.
118
- * @returns {EvaluationContext} Evaluation context
119
- */
120
- getContext(): EvaluationContext;
121
- /**
122
- * Sets evaluation context that will be used during flag evaluations
123
- * on this receiver.
124
- * @template T The type of the receiver
125
- * @param {EvaluationContext} context Evaluation context
126
- * @returns {T} The receiver (this object)
127
- */
128
- setContext(context: EvaluationContext): T;
129
- }
130
-
131
- declare enum ProviderEvents {
132
- /**
133
- * The provider is ready to evaluate flags.
134
- */
135
- Ready = "PROVIDER_READY",
136
- /**
137
- * The provider is in an error state.
138
- */
139
- Error = "PROVIDER_ERROR",
140
- /**
141
- * The flag configuration in the source-of-truth has changed.
142
- */
143
- ConfigurationChanged = "PROVIDER_CONFIGURATION_CHANGED",
144
- /**
145
- * The provider's cached state is no longer valid and may not be up-to-date with the source of truth.
146
- */
147
- Stale = "PROVIDER_STALE"
148
- }
149
-
150
- /**
151
- * Returns true if the provider's status corresponds to the event.
152
- * If the provider's status is not defined, it matches READY.
153
- * @param {ProviderEvents} event event to match
154
- * @param {ProviderStatus} status status of provider
155
- * @returns {boolean} boolean indicating if the provider status corresponds to the event.
156
- */
157
- declare const statusMatchesEvent: (event: ProviderEvents, status?: ProviderStatus) => boolean;
158
-
159
- type EventMetadata = {
160
- [key: string]: string | boolean | number;
161
- };
162
- type CommonEventDetails = {
163
- providerName: string;
164
- clientName?: string;
165
- };
166
- type CommonEventProps = {
167
- message?: string;
168
- metadata?: EventMetadata;
169
- };
170
- type ReadyEvent = CommonEventProps;
171
- type ErrorEvent = CommonEventProps;
172
- type StaleEvent = CommonEventProps;
173
- type ConfigChangeEvent = CommonEventProps & {
174
- flagsChanged?: string[];
175
- };
176
- type EventMap = {
177
- [ProviderEvents.Ready]: ReadyEvent;
178
- [ProviderEvents.Error]: ErrorEvent;
179
- [ProviderEvents.Stale]: StaleEvent;
180
- [ProviderEvents.ConfigurationChanged]: ConfigChangeEvent;
181
- };
182
- type EventContext<T extends ProviderEvents, U extends Record<string, unknown> = Record<string, unknown>> = EventMap[T] & U;
183
- type EventDetails<T extends ProviderEvents> = EventContext<T> & CommonEventDetails;
184
- type EventHandler<T extends ProviderEvents> = (eventDetails?: EventDetails<T>) => Promise<unknown> | unknown;
185
- interface Eventing {
186
- /**
187
- * Adds a handler for the given provider event type.
188
- * The handlers are called in the order they have been added.
189
- * @param {ProviderEvents} eventType The provider event type to listen to
190
- * @param {EventHandler} handler The handler to run on occurrence of the event type
191
- */
192
- addHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
193
- /**
194
- * Removes a handler for the given provider event type.
195
- * @param {ProviderEvents} eventType The provider event type to remove the listener for
196
- * @param {EventHandler} handler The handler to remove for the provider event type
197
- */
198
- removeHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
199
- /**
200
- * Gets the current handlers for the given provider event type.
201
- * @param {ProviderEvents} eventType The provider event type to get the current handlers for
202
- * @returns {EventHandler[]} The handlers currently attached to the given provider event type
203
- */
204
- getHandlers<T extends ProviderEvents>(eventType: T): EventHandler<T>[];
205
- }
206
-
207
- interface Logger {
208
- error(...args: unknown[]): void;
209
- warn(...args: unknown[]): void;
210
- info(...args: unknown[]): void;
211
- debug(...args: unknown[]): void;
212
- }
213
- interface ManageLogger<T> {
214
- /**
215
- * Sets a logger on this receiver. This logger supersedes to the global logger
216
- * and is passed to various components in the SDK.
217
- * The logger configured on the global API object will be used for all evaluations,
218
- * unless overridden in a particular client.
219
- * @template T The type of the receiver
220
- * @param {Logger} logger The logger to be used
221
- * @returns {T} The receiver (this object)
222
- */
223
- setLogger(logger: Logger): T;
224
- }
225
-
226
- declare class DefaultLogger implements Logger {
227
- error(...args: unknown[]): void;
228
- warn(...args: unknown[]): void;
229
- info(): void;
230
- debug(): void;
231
- }
232
-
233
- declare const LOG_LEVELS: Array<keyof Logger>;
234
- declare class SafeLogger implements Logger {
235
- private readonly logger;
236
- private readonly fallbackLogger;
237
- constructor(logger: Logger);
238
- error(...args: unknown[]): void;
239
- warn(...args: unknown[]): void;
240
- info(...args: unknown[]): void;
241
- debug(...args: unknown[]): void;
242
- private log;
243
- }
244
-
245
- declare abstract class GenericEventEmitter<AdditionalContext extends Record<string, unknown> = Record<string, unknown>> implements ManageLogger<GenericEventEmitter<AdditionalContext>> {
246
- private readonly globalLogger?;
247
- private readonly _handlers;
248
- private readonly eventEmitter;
249
- private _eventLogger?;
250
- constructor(globalLogger?: (() => Logger) | undefined);
251
- emit<T extends ProviderEvents>(eventType: T, context?: EventContext<T, AdditionalContext>): void;
252
- addHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
253
- removeHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
254
- removeAllHandlers(eventType?: ProviderEvents): void;
255
- getHandlers<T extends ProviderEvents>(eventType: T): EventHandler<T>[];
256
- setLogger(logger: Logger): this;
257
- private get _logger();
258
- }
259
- /**
260
- * The OpenFeatureEventEmitter can be used by provider developers to emit
261
- * events at various parts of the provider lifecycle.
262
- *
263
- * NOTE: Ready and error events are automatically emitted by the SDK based on
264
- * the result of the initialize method.
265
- */
266
- declare class OpenFeatureEventEmitter extends GenericEventEmitter {
267
- }
268
- /**
269
- * The InternalEventEmitter should only be used within the SDK. It extends the
270
- * OpenFeatureEventEmitter to include additional properties that can be included
271
- * in the event details.
272
- */
273
- declare class InternalEventEmitter extends GenericEventEmitter<CommonEventDetails> {
274
- }
275
-
276
- interface Metadata {
277
- }
278
-
279
- /**
280
- * Defines where the library is intended to be run.
281
- */
282
- type Paradigm = 'server' | 'client';
283
-
284
- /**
285
- * The state of the provider.
286
- */
287
- declare enum ProviderStatus {
288
- /**
289
- * The provider has not been initialized and cannot yet evaluate flags.
290
- */
291
- NOT_READY = "NOT_READY",
292
- /**
293
- * The provider is ready to resolve flags.
294
- */
295
- READY = "READY",
296
- /**
297
- * The provider is in an error state and unable to evaluate flags.
298
- */
299
- ERROR = "ERROR",
300
- /**
301
- * The provider's cached state is no longer valid and may not be up-to-date with the source of truth.
302
- */
303
- STALE = "STALE"
304
- }
305
- /**
306
- * Static data about the provider.
307
- */
308
- interface ProviderMetadata extends Metadata {
309
- readonly name: string;
310
- }
311
- interface CommonProvider {
312
- readonly metadata: ProviderMetadata;
313
- /**
314
- * Represents where the provider is intended to be run. If defined,
315
- * the SDK will enforce that the defined paradigm at runtime.
316
- */
317
- readonly runsOn?: Paradigm;
318
- /**
319
- * Returns a representation of the current readiness of the provider.
320
- * If the provider needs to be initialized, it should return {@link ProviderStatus.READY}.
321
- * If the provider is in an error state, it should return {@link ProviderStatus.ERROR}.
322
- * If the provider is functioning normally, it should return {@link ProviderStatus.NOT_READY}.
323
- *
324
- * _Providers which do not implement this method are assumed to be ready immediately._
325
- */
326
- readonly status?: ProviderStatus;
327
- /**
328
- * An event emitter for ProviderEvents.
329
- * @see ProviderEvents
330
- */
331
- events?: OpenFeatureEventEmitter;
332
- /**
333
- * A function used to shut down the provider.
334
- * Called when this provider is replaced with a new one, or when the OpenFeature is shut down.
335
- */
336
- onClose?(): Promise<void>;
337
- /**
338
- * A function used to setup the provider.
339
- * Called by the SDK after the provider is set if the provider's status is {@link ProviderStatus.NOT_READY}.
340
- * When the returned promise resolves, the SDK fires the ProviderEvents.Ready event.
341
- * If the returned promise rejects, the SDK fires the ProviderEvents.Error event.
342
- * Use this function to perform any context-dependent setup within the provider.
343
- * @param context
344
- */
345
- initialize?(context?: EvaluationContext): Promise<void>;
346
- }
347
-
348
- interface ClientMetadata extends Metadata {
349
- readonly version?: string;
350
- readonly name?: string;
351
- readonly providerMetadata: ProviderMetadata;
352
- }
353
-
354
- type HookHints = Readonly<Record<string, unknown>>;
355
- interface HookContext<T extends FlagValue = FlagValue> {
356
- readonly flagKey: string;
357
- readonly defaultValue: T;
358
- readonly flagValueType: FlagValueType;
359
- readonly context: Readonly<EvaluationContext>;
360
- readonly clientMetadata: ClientMetadata;
361
- readonly providerMetadata: ProviderMetadata;
362
- readonly logger: Logger;
363
- }
364
- interface BeforeHookContext extends HookContext {
365
- context: EvaluationContext;
366
- }
367
-
368
- interface Hook<T extends FlagValue = FlagValue> {
369
- /**
370
- * Runs before flag values are resolved from the provider.
371
- * If an EvaluationContext is returned, it will be merged with the pre-existing EvaluationContext.
372
- * @param hookContext
373
- * @param hookHints
374
- */
375
- before?(hookContext: BeforeHookContext, hookHints?: HookHints): Promise<EvaluationContext | void> | EvaluationContext | void;
376
- /**
377
- * Runs after flag values are successfully resolved from the provider.
378
- * @param hookContext
379
- * @param evaluationDetails
380
- * @param hookHints
381
- */
382
- after?(hookContext: Readonly<HookContext<T>>, evaluationDetails: EvaluationDetails<T>, hookHints?: HookHints): Promise<void> | void;
383
- /**
384
- * Runs in the event of an unhandled error or promise rejection during flag resolution, or any attached hooks.
385
- * @param hookContext
386
- * @param error
387
- * @param hookHints
388
- */
389
- error?(hookContext: Readonly<HookContext<T>>, error: unknown, hookHints?: HookHints): Promise<void> | void;
390
- /**
391
- * Runs after all other hook stages, regardless of success or error.
392
- * Errors thrown here are unhandled by the client and will surface in application code.
393
- * @param hookContext
394
- * @param hookHints
395
- */
396
- finally?(hookContext: Readonly<HookContext<T>>, hookHints?: HookHints): Promise<void> | void;
397
- }
398
-
399
- interface EvaluationLifeCycle<T> {
400
- /**
401
- * Adds hooks that will run during flag evaluations on this receiver.
402
- * Hooks are executed in the order they were registered. Adding additional hooks
403
- * will not remove existing hooks.
404
- * Hooks registered on the global API object run with all evaluations.
405
- * Hooks registered on the client run with all evaluations on that client.
406
- * @template T The type of the receiver
407
- * @param {Hook<FlagValue>[]} hooks A list of hooks that should always run
408
- * @returns {T} The receiver (this object)
409
- */
410
- addHooks(...hooks: Hook<FlagValue>[]): T;
411
- /**
412
- * Access all the hooks that are registered on this receiver.
413
- * @returns {Hook<FlagValue>[]} A list of the client hooks
414
- */
415
- getHooks(): Hook<FlagValue>[];
416
- /**
417
- * Clears all the hooks that are registered on this receiver.
418
- * @template T The type of the receiver
419
- * @returns {T} The receiver (this object)
420
- */
421
- clearHooks(): T;
422
- }
423
-
424
- declare abstract class OpenFeatureError extends Error {
425
- abstract code: ErrorCode;
426
- constructor(message?: string);
427
- }
428
-
429
- declare class GeneralError extends OpenFeatureError {
430
- code: ErrorCode;
431
- constructor(message?: string);
432
- }
433
-
434
- declare class FlagNotFoundError extends OpenFeatureError {
435
- code: ErrorCode;
436
- constructor(message?: string);
437
- }
438
-
439
- declare class ParseError extends OpenFeatureError {
440
- code: ErrorCode;
441
- constructor(message?: string);
442
- }
443
-
444
- declare class TypeMismatchError extends OpenFeatureError {
445
- code: ErrorCode;
446
- constructor(message?: string);
447
- }
448
-
449
- declare class TargetingKeyMissingError extends OpenFeatureError {
450
- code: ErrorCode;
451
- constructor(message?: string);
452
- }
453
-
454
- declare class InvalidContextError extends OpenFeatureError {
455
- code: ErrorCode;
456
- constructor(message?: string);
457
- }
458
-
459
- /**
460
- * Checks whether the parameter is a string.
461
- * @param {unknown} value The value to check
462
- * @returns {value is string} True if the value is a string
463
- */
464
- declare function isString(value: unknown): value is string;
465
- /**
466
- * Returns the parameter if it is a string, otherwise returns undefined.
467
- * @param {unknown} value The value to check
468
- * @returns {string|undefined} The parameter if it is a string, otherwise undefined
469
- */
470
- declare function stringOrUndefined(value: unknown): string | undefined;
471
- /**
472
- * Checks whether the parameter is an object.
473
- * @param {unknown} value The value to check
474
- * @returns {value is string} True if the value is an object
475
- */
476
- declare function isObject<T extends object>(value: unknown): value is T;
477
- /**
478
- * Returns the parameter if it is an object, otherwise returns undefined.
479
- * @param {unknown} value The value to check
480
- * @returns {object|undefined} The parameter if it is an object, otherwise undefined
481
- */
482
- declare function objectOrUndefined<T extends object>(value: unknown): T | undefined;
483
-
484
- declare abstract class OpenFeatureCommonAPI<P extends CommonProvider = CommonProvider> implements Eventing, EvaluationLifeCycle<OpenFeatureCommonAPI<P>>, ManageLogger<OpenFeatureCommonAPI<P>> {
485
- protected _hooks: Hook[];
486
- protected _context: EvaluationContext;
487
- protected _logger: Logger;
488
- protected abstract _defaultProvider: P;
489
- private readonly _events;
490
- private readonly _clientEventHandlers;
491
- protected _clientProviders: Map<string, P>;
492
- protected _clientEvents: Map<string | undefined, InternalEventEmitter>;
493
- protected _runsOn: Paradigm;
494
- constructor(category: Paradigm);
495
- addHooks(...hooks: Hook<FlagValue>[]): this;
496
- getHooks(): Hook<FlagValue>[];
497
- clearHooks(): this;
498
- setLogger(logger: Logger): this;
499
- /**
500
- * Get metadata about registered provider.
501
- * @returns {ProviderMetadata} Provider Metadata
502
- */
503
- get providerMetadata(): ProviderMetadata;
504
- /**
505
- * Adds a handler for the given provider event type.
506
- * The handlers are called in the order they have been added.
507
- * API (global) events run for all providers.
508
- * @param {ProviderEvents} eventType The provider event type to listen to
509
- * @param {EventHandler} handler The handler to run on occurrence of the event type
510
- */
511
- addHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
512
- /**
513
- * Removes a handler for the given provider event type.
514
- * @param {ProviderEvents} eventType The provider event type to remove the listener for
515
- * @param {EventHandler} handler The handler to remove for the provider event type
516
- */
517
- removeHandler<T extends ProviderEvents>(eventType: T, handler: EventHandler<T>): void;
518
- /**
519
- * Gets the current handlers for the given provider event type.
520
- * @param {ProviderEvents} eventType The provider event type to get the current handlers for
521
- * @returns {EventHandler[]} The handlers currently attached to the given provider event type
522
- */
523
- getHandlers<T extends ProviderEvents>(eventType: T): EventHandler<T>[];
524
- /**
525
- * Sets the default provider for flag evaluations and returns a promise that resolves when the provider is ready.
526
- * This provider will be used by unnamed clients and named clients to which no provider is bound.
527
- * Setting a provider supersedes the current provider used in new and existing clients without a name.
528
- * @template P
529
- * @param {P} provider The provider responsible for flag evaluations.
530
- * @returns {Promise<void>}
531
- * @throws Uncaught exceptions thrown by the provider during initialization.
532
- */
533
- setProviderAndWait(provider: P): Promise<void>;
534
- /**
535
- * Sets the provider that OpenFeature will use for flag evaluations of providers with the given name.
536
- * A promise is returned that resolves when the provider is ready.
537
- * Setting a provider supersedes the current provider used in new and existing clients with that name.
538
- * @template P
539
- * @param {string} clientName The name to identify the client
540
- * @param {P} provider The provider responsible for flag evaluations.
541
- * @returns {Promise<void>}
542
- * @throws Uncaught exceptions thrown by the provider during initialization.
543
- */
544
- setProviderAndWait(clientName: string, provider: P): Promise<void>;
545
- /**
546
- * Sets the default provider for flag evaluations.
547
- * This provider will be used by unnamed clients and named clients to which no provider is bound.
548
- * Setting a provider supersedes the current provider used in new and existing clients without a name.
549
- * @template P
550
- * @param {P} provider The provider responsible for flag evaluations.
551
- * @returns {this} OpenFeature API
552
- */
553
- setProvider(provider: P): this;
554
- /**
555
- * Sets the provider that OpenFeature will use for flag evaluations of providers with the given name.
556
- * Setting a provider supersedes the current provider used in new and existing clients with that name.
557
- * @template P
558
- * @param {string} clientName The name to identify the client
559
- * @param {P} provider The provider responsible for flag evaluations.
560
- * @returns {this} OpenFeature API
561
- */
562
- setProvider(clientName: string, provider: P): this;
563
- private setAwaitableProvider;
564
- protected getProviderForClient(name?: string): P;
565
- protected buildAndCacheEventEmitterForClient(name?: string): InternalEventEmitter;
566
- private getUnboundEmitters;
567
- private getAssociatedEventEmitters;
568
- private transferListeners;
569
- close(): Promise<void>;
570
- protected clearProvidersAndSetDefault(defaultProvider: P): Promise<void>;
571
- private handleShutdownError;
572
- }
1
+ import { Hook, HookHints, EvaluationDetails, JsonValue, EvaluationLifeCycle, ManageLogger, Eventing, ClientMetadata, CommonProvider, EvaluationContext, Logger, ResolutionDetails, ProviderStatus, OpenFeatureEventEmitter, ProviderEvents, EventHandler, FlagValue, OpenFeatureCommonAPI, ManageContext } from '@openfeature/core';
2
+ export * from '@openfeature/core';
573
3
 
574
4
  interface FlagEvaluationOptions {
575
5
  hooks?: Hook[];
@@ -785,4 +215,4 @@ declare class OpenFeatureAPI extends OpenFeatureCommonAPI<Provider> implements M
785
215
  */
786
216
  declare const OpenFeature: OpenFeatureAPI;
787
217
 
788
- export { BeforeHookContext, Client, ClientMetadata, CommonEventDetails, CommonProvider, ConfigChangeEvent, DefaultLogger, ErrorCode, ErrorEvent, EvaluationContext, EvaluationContextValue, EvaluationDetails, EvaluationLifeCycle, EventContext, EventDetails, EventHandler, EventMetadata, Eventing, Features, FlagEvaluationOptions, FlagMetadata, FlagNotFoundError, FlagValue, FlagValueType, GeneralError, Hook, HookContext, HookHints, InternalEventEmitter, InvalidContextError, JsonArray, JsonObject, JsonValue, LOG_LEVELS, Logger, ManageContext, ManageLogger, Metadata, NOOP_PROVIDER, OpenFeature, OpenFeatureAPI, OpenFeatureClient, OpenFeatureCommonAPI, OpenFeatureError, OpenFeatureEventEmitter, Paradigm, ParseError, PrimitiveValue, Provider, ProviderEvents, ProviderMetadata, ProviderStatus, ReadyEvent, ResolutionDetails, ResolutionReason, SafeLogger, StaleEvent, StandardResolutionReasons, TargetingKeyMissingError, TypeMismatchError, isObject, isString, objectOrUndefined, statusMatchesEvent, stringOrUndefined };
218
+ export { Client, Features, FlagEvaluationOptions, NOOP_PROVIDER, OpenFeature, OpenFeatureAPI, OpenFeatureClient, Provider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeature/web-sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "OpenFeature SDK for Web",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "files": [
@@ -17,15 +17,15 @@
17
17
  "test": "jest --verbose",
18
18
  "lint": "eslint ./",
19
19
  "clean": "shx rm -rf ./dist",
20
- "build:web-esm": "esbuild src/index.ts --bundle --sourcemap --target=es2016 --platform=browser --format=esm --outfile=./dist/esm/index.js --analyze",
21
- "build:web-cjs": "esbuild src/index.ts --bundle --sourcemap --target=es2016 --platform=browser --format=cjs --outfile=./dist/cjs/index.js --analyze",
20
+ "build:web-esm": "esbuild src/index.ts --bundle --external:@openfeature/core --sourcemap --target=es2016 --platform=browser --format=esm --outfile=./dist/esm/index.js --analyze",
21
+ "build:web-cjs": "esbuild src/index.ts --bundle --external:@openfeature/core --sourcemap --target=es2016 --platform=browser --format=cjs --outfile=./dist/cjs/index.js --analyze",
22
22
  "build:rollup-types": "rollup -c ../../rollup.config.mjs",
23
23
  "build": "npm run clean && npm run build:web-esm && npm run build:web-cjs && npm run build:rollup-types",
24
24
  "postbuild": "shx cp ./../../package.esm.json ./dist/esm/package.json",
25
25
  "current-version": "echo $npm_package_version",
26
26
  "prepack": "shx cp ./../../LICENSE ./LICENSE",
27
27
  "publish-if-not-exists": "cp $NPM_CONFIG_USERCONFIG .npmrc && if [ \"$(npm show $npm_package_name@$npm_package_version version)\" = \"$(npm run current-version -s)\" ]; then echo 'already published, skipping'; else npm publish --access public; fi",
28
- "docs": "typedoc"
28
+ "update-core-peer": "npm install --save-peer --save-exact @openfeature/core@$OPENFEATURE_CORE_VERSION"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -45,11 +45,10 @@
45
45
  "url": "https://github.com/open-feature/js-sdk/issues"
46
46
  },
47
47
  "homepage": "https://github.com/open-feature/js-sdk#readme",
48
- "devDependencies": {
49
- "@openfeature/shared": "*"
48
+ "peerDependencies": {
49
+ "@openfeature/core": "0.0.16"
50
50
  },
51
- "typedoc": {
52
- "displayName": "OpenFeature Web SDK",
53
- "entryPoint": "./src/index.ts"
51
+ "devDependencies": {
52
+ "@openfeature/core": "0.0.16"
54
53
  }
55
54
  }