diff --git a/packages/client/src/events/events.ts b/packages/client/src/events/events.ts index c9c4520d35..71c2d62474 100644 --- a/packages/client/src/events/events.ts +++ b/packages/client/src/events/events.ts @@ -1,4 +1,8 @@ import { ClientProviderEvents } from '@openfeature/core'; export { ClientProviderEvents as ProviderEvents}; + +/** + * A subset of events that can be directly emitted by providers. + */ export type ProviderEmittableEvents = Exclude; \ No newline at end of file diff --git a/packages/client/src/open-feature.ts b/packages/client/src/open-feature.ts index f2d9fd35c2..1aa5024396 100644 --- a/packages/client/src/open-feature.ts +++ b/packages/client/src/open-feature.ts @@ -197,7 +197,7 @@ export class OpenFeatureAPI extends OpenFeatureCommonAPI impleme newContext: EvaluationContext, ): Promise { const providerName = provider.metadata.name; - return await provider.onContextChange?.(oldContext, newContext).then(() => { + return provider.onContextChange?.(oldContext, newContext).then(() => { this.getAssociatedEventEmitters(clientName).forEach((emitter) => { emitter?.emit(ProviderEvents.ContextChanged, { clientName, providerName }); }); @@ -209,7 +209,6 @@ export class OpenFeatureAPI extends OpenFeatureCommonAPI impleme }); this._events?.emit(ProviderEvents.Error, { clientName, providerName, message: err?.message, }); }); - } } diff --git a/packages/shared/src/events/event-utils.ts b/packages/shared/src/events/event-utils.ts index cb584d8c58..d538c85d0f 100644 --- a/packages/shared/src/events/event-utils.ts +++ b/packages/shared/src/events/event-utils.ts @@ -11,7 +11,7 @@ const eventStatusMap = { /** * Returns true if the provider's status corresponds to the event. * If the provider's status is not defined, it matches READY. - * @param {ProviderEvents} event event to match + * @param {AnyProviderEvent} event event to match * @param {ProviderStatus} status status of provider * @returns {boolean} boolean indicating if the provider status corresponds to the event. */ diff --git a/packages/shared/src/events/eventing.ts b/packages/shared/src/events/eventing.ts index a684c3e16e..8b72cae842 100644 --- a/packages/shared/src/events/eventing.ts +++ b/packages/shared/src/events/eventing.ts @@ -37,21 +37,21 @@ export interface Eventing { /** * Adds a handler for the given provider event type. * The handlers are called in the order they have been added. - * @param {ProviderEvents} eventType The provider event type to listen to + * @param {AnyProviderEvent} eventType The provider event type to listen to * @param {EventHandler} handler The handler to run on occurrence of the event type */ addHandler(eventType: AnyProviderEvent, handler: EventHandler): void; /** * Removes a handler for the given provider event type. - * @param {ProviderEvents} eventType The provider event type to remove the listener for + * @param {AnyProviderEvent} eventType The provider event type to remove the listener for * @param {EventHandler} handler The handler to remove for the provider event type */ removeHandler(eventType: AnyProviderEvent, handler: EventHandler): void; /** * Gets the current handlers for the given provider event type. - * @param {ProviderEvents} eventType The provider event type to get the current handlers for + * @param {AnyProviderEvent} eventType The provider event type to get the current handlers for * @returns {EventHandler[]} The handlers currently attached to the given provider event type */ getHandlers(eventType: AnyProviderEvent): EventHandler[]; diff --git a/packages/shared/src/open-feature.ts b/packages/shared/src/open-feature.ts index 06b3787cfa..4571543405 100644 --- a/packages/shared/src/open-feature.ts +++ b/packages/shared/src/open-feature.ts @@ -77,7 +77,7 @@ export abstract class OpenFeatureCommonAPI

(eventType: T, handler: EventHandler): void { @@ -101,7 +101,7 @@ export abstract class OpenFeatureCommonAPI

(eventType: T, handler: EventHandler): void { @@ -110,7 +110,7 @@ export abstract class OpenFeatureCommonAPI

(eventType: T): EventHandler[] {