New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openfeature/web-sdk

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/web-sdk - npm Package Compare versions

Comparing version 0.3.5-experimental to 0.3.6-experimental

33

dist/cjs/index.js

@@ -723,2 +723,7 @@ "use strict";

// ../shared/src/filter.ts
function isDefined(input) {
return typeof input !== "undefined" && input !== null;
}
// ../shared/src/open-feature.ts

@@ -786,15 +791,21 @@ var OpenFeatureCommonAPI = class {

}
const clientEmitter = this.getAndCacheEventEmitterForClient(clientName);
const emitters = clientName ? [this.getAndCacheEventEmitterForClient(clientName)] : this.getUnboundEmitters();
if (typeof provider.initialize === "function") {
(_d = (_c = (_b = provider.initialize) == null ? void 0 : _b.call(provider, this._context)) == null ? void 0 : _c.then(() => {
var _a2;
clientEmitter.emit("PROVIDER_READY" /* Ready */, { clientName });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_READY" /* Ready */, { clientName });
});
(_a2 = this._events) == null ? void 0 : _a2.emit("PROVIDER_READY" /* Ready */, { clientName });
})) == null ? void 0 : _d.catch((error) => {
var _a2;
clientEmitter.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
});
(_a2 = this._events) == null ? void 0 : _a2.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
});
} else {
clientEmitter.emit("PROVIDER_READY" /* Ready */, { clientName });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_READY" /* Ready */, { clientName });
});
(_e = this._events) == null ? void 0 : _e.emit("PROVIDER_READY" /* Ready */, { clientName });

@@ -807,3 +818,3 @@ }

}
this.transferListeners(oldProvider, provider, clientName, clientEmitter);
this.transferListeners(oldProvider, provider, clientName, emitters);
if (![...this._clientProviders.values(), this._defaultProvider].includes(oldProvider)) {

@@ -839,3 +850,9 @@ (_f = oldProvider == null ? void 0 : oldProvider.onClose) == null ? void 0 : _f.call(oldProvider);

}
transferListeners(oldProvider, newProvider, clientName, clientEmitter) {
getUnboundEmitters() {
const namedProviders = [...this._clientProviders.keys()];
const eventEmitterNames = [...this._clientEvents.keys()].filter(isDefined);
const unboundEmitterNames = eventEmitterNames.filter((name) => !namedProviders.includes(name));
return unboundEmitterNames.map((name) => this._clientEvents.get(name)).filter(isDefined);
}
transferListeners(oldProvider, newProvider, clientName, emitters) {
var _a;

@@ -849,3 +866,5 @@ (_a = this._clientEventHandlers.get(clientName)) == null ? void 0 : _a.forEach((eventHandler) => {

const handler = (details) => __async(this, null, function* () {
clientEmitter.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));
});
this._events.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));

@@ -852,0 +871,0 @@ });

@@ -691,2 +691,7 @@ var __create = Object.create;

// ../shared/src/filter.ts
function isDefined(input) {
return typeof input !== "undefined" && input !== null;
}
// ../shared/src/open-feature.ts

@@ -754,15 +759,21 @@ var OpenFeatureCommonAPI = class {

}
const clientEmitter = this.getAndCacheEventEmitterForClient(clientName);
const emitters = clientName ? [this.getAndCacheEventEmitterForClient(clientName)] : this.getUnboundEmitters();
if (typeof provider.initialize === "function") {
(_d = (_c = (_b = provider.initialize) == null ? void 0 : _b.call(provider, this._context)) == null ? void 0 : _c.then(() => {
var _a2;
clientEmitter.emit("PROVIDER_READY" /* Ready */, { clientName });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_READY" /* Ready */, { clientName });
});
(_a2 = this._events) == null ? void 0 : _a2.emit("PROVIDER_READY" /* Ready */, { clientName });
})) == null ? void 0 : _d.catch((error) => {
var _a2;
clientEmitter.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
});
(_a2 = this._events) == null ? void 0 : _a2.emit("PROVIDER_ERROR" /* Error */, { clientName, message: error.message });
});
} else {
clientEmitter.emit("PROVIDER_READY" /* Ready */, { clientName });
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit("PROVIDER_READY" /* Ready */, { clientName });
});
(_e = this._events) == null ? void 0 : _e.emit("PROVIDER_READY" /* Ready */, { clientName });

@@ -775,3 +786,3 @@ }

}
this.transferListeners(oldProvider, provider, clientName, clientEmitter);
this.transferListeners(oldProvider, provider, clientName, emitters);
if (![...this._clientProviders.values(), this._defaultProvider].includes(oldProvider)) {

@@ -807,3 +818,9 @@ (_f = oldProvider == null ? void 0 : oldProvider.onClose) == null ? void 0 : _f.call(oldProvider);

}
transferListeners(oldProvider, newProvider, clientName, clientEmitter) {
getUnboundEmitters() {
const namedProviders = [...this._clientProviders.keys()];
const eventEmitterNames = [...this._clientEvents.keys()].filter(isDefined);
const unboundEmitterNames = eventEmitterNames.filter((name) => !namedProviders.includes(name));
return unboundEmitterNames.map((name) => this._clientEvents.get(name)).filter(isDefined);
}
transferListeners(oldProvider, newProvider, clientName, emitters) {
var _a;

@@ -817,3 +834,5 @@ (_a = this._clientEventHandlers.get(clientName)) == null ? void 0 : _a.forEach((eventHandler) => {

const handler = (details) => __async(this, null, function* () {
clientEmitter.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));
emitters.forEach((emitter) => {
emitter == null ? void 0 : emitter.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));
});
this._events.emit(eventType, __spreadProps(__spreadValues({}, details), { clientName }));

@@ -820,0 +839,0 @@ });

@@ -419,2 +419,3 @@ type EventMetadata = {

protected getAndCacheEventEmitterForClient(name?: string): OpenFeatureEventEmitter;
private getUnboundEmitters;
private transferListeners;

@@ -421,0 +422,0 @@ close(): Promise<void>;

{
"name": "@openfeature/web-sdk",
"version": "0.3.5-experimental",
"version": "0.3.6-experimental",
"description": "OpenFeature SDK for Web",

@@ -5,0 +5,0 @@ "main": "./dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc