Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openfeature/core

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/core - npm Package Compare versions

Comparing version 0.0.17 to 0.0.18

30

dist/cjs/index.js
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;

@@ -9,3 +8,2 @@ var __defProps = Object.defineProperties;

var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;

@@ -38,10 +36,2 @@ var __propIsEnum = Object.prototype.propertyIsEnumerable;

};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

@@ -76,3 +66,3 @@ var __async = (__this, __arguments, generator) => {

GeneralError: () => GeneralError,
InternalEventEmitter: () => InternalEventEmitter,
GenericEventEmitter: () => GenericEventEmitter,
InvalidContextError: () => InvalidContextError,

@@ -82,3 +72,2 @@ LOG_LEVELS: () => LOG_LEVELS,

OpenFeatureError: () => OpenFeatureError,
OpenFeatureEventEmitter: () => OpenFeatureEventEmitter,
ParseError: () => ParseError,

@@ -245,5 +234,2 @@ ProviderEvents: () => ProviderEvents,

// src/events/open-feature-event-emitter.ts
var import_events2 = __toESM(require("events"));
// src/logger/default-logger.ts

@@ -302,3 +288,3 @@ var DefaultLogger = class {

// src/events/open-feature-event-emitter.ts
// src/events/generic-event-emitter.ts
var GenericEventEmitter = class {

@@ -309,7 +295,2 @@ constructor(globalLogger) {

this._handlers = /* @__PURE__ */ new WeakMap();
this.eventEmitter = new import_events2.default({ captureRejections: true });
this.eventEmitter.on("error", (err) => {
var _a;
(_a = this._logger) == null ? void 0 : _a.error("Error running event handler:", err);
});
}

@@ -352,6 +333,2 @@ emit(eventType, context) {

};
var OpenFeatureEventEmitter = class extends GenericEventEmitter {
};
var InternalEventEmitter = class extends GenericEventEmitter {
};

@@ -383,3 +360,2 @@ // src/type-guards.ts

this._logger = new DefaultLogger();
this._events = new InternalEventEmitter(() => this._logger);
this._clientEventHandlers = /* @__PURE__ */ new Map();

@@ -535,3 +511,3 @@ this._clientProviders = /* @__PURE__ */ new Map();

}
const newEmitter = new InternalEventEmitter(() => this._logger);
const newEmitter = this._createEventEmitter();
this._clientEvents.set(name, newEmitter);

@@ -538,0 +514,0 @@ const clientProvider = this.getProviderForClient(name);

@@ -187,5 +187,2 @@ var __defProp = Object.defineProperty;

// src/events/open-feature-event-emitter.ts
import EventEmitter from "events";
// src/logger/default-logger.ts

@@ -244,3 +241,3 @@ var DefaultLogger = class {

// src/events/open-feature-event-emitter.ts
// src/events/generic-event-emitter.ts
var GenericEventEmitter = class {

@@ -251,7 +248,2 @@ constructor(globalLogger) {

this._handlers = /* @__PURE__ */ new WeakMap();
this.eventEmitter = new EventEmitter({ captureRejections: true });
this.eventEmitter.on("error", (err) => {
var _a;
(_a = this._logger) == null ? void 0 : _a.error("Error running event handler:", err);
});
}

@@ -294,6 +286,2 @@ emit(eventType, context) {

};
var OpenFeatureEventEmitter = class extends GenericEventEmitter {
};
var InternalEventEmitter = class extends GenericEventEmitter {
};

@@ -325,3 +313,2 @@ // src/type-guards.ts

this._logger = new DefaultLogger();
this._events = new InternalEventEmitter(() => this._logger);
this._clientEventHandlers = /* @__PURE__ */ new Map();

@@ -477,3 +464,3 @@ this._clientProviders = /* @__PURE__ */ new Map();

}
const newEmitter = new InternalEventEmitter(() => this._logger);
const newEmitter = this._createEventEmitter();
this._clientEvents.set(name, newEmitter);

@@ -569,3 +556,3 @@ const clientProvider = this.getProviderForClient(name);

GeneralError,
InternalEventEmitter,
GenericEventEmitter,
InvalidContextError,

@@ -575,3 +562,2 @@ LOG_LEVELS,

OpenFeatureError,
OpenFeatureEventEmitter,
ParseError,

@@ -578,0 +564,0 @@ ProviderEvents,

37

dist/types.d.ts

@@ -245,6 +245,10 @@ type FlagValueType = 'boolean' | 'string' | 'number' | 'object';

/**
* The GenericEventEmitter should only be used within the SDK. It supports additional properties that can be included
* in the event details.
*/
declare abstract class GenericEventEmitter<AdditionalContext extends Record<string, unknown> = Record<string, unknown>> implements ManageLogger<GenericEventEmitter<AdditionalContext>> {
private readonly globalLogger?;
protected abstract readonly eventEmitter: NodeJS.EventEmitter;
private readonly _handlers;
private readonly eventEmitter;
private _eventLogger?;

@@ -258,20 +262,4 @@ constructor(globalLogger?: (() => Logger) | undefined);

setLogger(logger: Logger): this;
private get _logger();
protected get _logger(): Logger | undefined;
}
/**
* The OpenFeatureEventEmitter can be used by provider developers to emit
* events at various parts of the provider lifecycle.
*
* NOTE: Ready and error events are automatically emitted by the SDK based on
* the result of the initialize method.
*/
declare class OpenFeatureEventEmitter extends GenericEventEmitter {
}
/**
* The InternalEventEmitter should only be used within the SDK. It extends the
* OpenFeatureEventEmitter to include additional properties that can be included
* in the event details.
*/
declare class InternalEventEmitter extends GenericEventEmitter<CommonEventDetails> {
}

@@ -333,3 +321,3 @@ interface Metadata {

*/
events?: OpenFeatureEventEmitter;
events?: GenericEventEmitter;
/**

@@ -488,10 +476,11 @@ * A function used to shut down the provider.

declare abstract class OpenFeatureCommonAPI<P extends CommonProvider = CommonProvider> implements Eventing, EvaluationLifeCycle<OpenFeatureCommonAPI<P>>, ManageLogger<OpenFeatureCommonAPI<P>> {
protected abstract _createEventEmitter(): GenericEventEmitter;
protected abstract _defaultProvider: P;
protected abstract readonly _events: GenericEventEmitter;
protected _hooks: Hook[];
protected _context: EvaluationContext;
protected _logger: Logger;
protected abstract _defaultProvider: P;
private readonly _events;
private readonly _clientEventHandlers;
protected _clientProviders: Map<string, P>;
protected _clientEvents: Map<string | undefined, InternalEventEmitter>;
protected _clientEvents: Map<string | undefined, GenericEventEmitter>;
protected _runsOn: Paradigm;

@@ -569,3 +558,3 @@ constructor(category: Paradigm);

protected getProviderForClient(name?: string): P;
protected buildAndCacheEventEmitterForClient(name?: string): InternalEventEmitter;
protected buildAndCacheEventEmitterForClient(name?: string): GenericEventEmitter;
private getUnboundEmitters;

@@ -579,2 +568,2 @@ private getAssociatedEventEmitters;

export { BeforeHookContext, ClientMetadata, CommonEventDetails, CommonProvider, ConfigChangeEvent, DefaultLogger, ErrorCode, ErrorEvent, EvaluationContext, EvaluationContextValue, EvaluationDetails, EvaluationLifeCycle, EventContext, EventDetails, EventHandler, EventMetadata, Eventing, FlagMetadata, FlagNotFoundError, FlagValue, FlagValueType, GeneralError, Hook, HookContext, HookHints, InternalEventEmitter, InvalidContextError, JsonArray, JsonObject, JsonValue, LOG_LEVELS, Logger, ManageContext, ManageLogger, Metadata, OpenFeatureCommonAPI, OpenFeatureError, OpenFeatureEventEmitter, Paradigm, ParseError, PrimitiveValue, ProviderEvents, ProviderMetadata, ProviderStatus, ReadyEvent, ResolutionDetails, ResolutionReason, SafeLogger, StaleEvent, StandardResolutionReasons, TargetingKeyMissingError, TypeMismatchError, isObject, isString, objectOrUndefined, statusMatchesEvent, stringOrUndefined };
export { BeforeHookContext, ClientMetadata, CommonEventDetails, CommonProvider, ConfigChangeEvent, DefaultLogger, ErrorCode, ErrorEvent, EvaluationContext, EvaluationContextValue, EvaluationDetails, EvaluationLifeCycle, EventContext, EventDetails, EventHandler, EventMetadata, Eventing, FlagMetadata, FlagNotFoundError, FlagValue, FlagValueType, GeneralError, GenericEventEmitter, Hook, HookContext, HookHints, InvalidContextError, JsonArray, JsonObject, JsonValue, LOG_LEVELS, Logger, ManageContext, ManageLogger, Metadata, OpenFeatureCommonAPI, OpenFeatureError, Paradigm, ParseError, PrimitiveValue, ProviderEvents, ProviderMetadata, ProviderStatus, ReadyEvent, ResolutionDetails, ResolutionReason, SafeLogger, StaleEvent, StandardResolutionReasons, TargetingKeyMissingError, TypeMismatchError, isObject, isString, objectOrUndefined, statusMatchesEvent, stringOrUndefined };
{
"name": "@openfeature/core",
"version": "0.0.17",
"version": "0.0.18",
"description": "Shared OpenFeature JS components (server and 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