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

@eppo/js-client-sdk-common

Package Overview
Dependencies
Maintainers
8
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eppo/js-client-sdk-common - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

dist/cache/abstract-assignment-cache.d.ts

13

dist/cache/lru-cache.d.ts
/**
* LRUCache is a cache that stores a maximum number of items.
* LRUCache is a simple implementation of a Least Recently Used (LRU) cache.
*
* Items are removed from the cache when the cache is full.
* Old items are evicted when the cache reaches its capacity.
*
* The cache is implemented as a Map, which is a built-in JavaScript object.
* The Map object holds key-value pairs and remembers the order of key-value pairs as they were inserted.
* The cache is implemented as a Map, which maintains insertion order:
* ```
* Iteration happens in insertion order, which corresponds to the order in which each key-value pair
* was first inserted into the map by the set() method (that is, there wasn't a key with the same
* value already in the map when set() was called).
* ```
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
*/

@@ -9,0 +14,0 @@ export declare class LRUCache implements Map<string, string> {

@@ -5,8 +5,13 @@ "use strict";

/**
* LRUCache is a cache that stores a maximum number of items.
* LRUCache is a simple implementation of a Least Recently Used (LRU) cache.
*
* Items are removed from the cache when the cache is full.
* Old items are evicted when the cache reaches its capacity.
*
* The cache is implemented as a Map, which is a built-in JavaScript object.
* The Map object holds key-value pairs and remembers the order of key-value pairs as they were inserted.
* The cache is implemented as a Map, which maintains insertion order:
* ```
* Iteration happens in insertion order, which corresponds to the order in which each key-value pair
* was first inserted into the map by the set() method (that is, there wasn't a key with the same
* value already in the map when set() was called).
* ```
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
*/

@@ -13,0 +18,0 @@ class LRUCache {

import { IAssignmentLogger } from '../assignment-logger';
import { AssignmentCache } from '../cache/assignment-cache';
import { AssignmentCache } from '../cache/abstract-assignment-cache';
import { IConfigurationStore } from '../configuration-store/configuration-store';

@@ -4,0 +4,0 @@ import { FlagEvaluation } from '../evaluator';

@@ -6,3 +6,3 @@ "use strict";

const application_logger_1 = require("../application-logger");
const assignment_cache_1 = require("../cache/assignment-cache");
const abstract_assignment_cache_1 = require("../cache/abstract-assignment-cache");
const constants_1 = require("../constants");

@@ -189,6 +189,6 @@ const decoding_1 = require("../decoding");

useNonExpiringInMemoryAssignmentCache() {
this.assignmentCache = new assignment_cache_1.NonExpiringInMemoryAssignmentCache();
this.assignmentCache = new abstract_assignment_cache_1.NonExpiringInMemoryAssignmentCache();
}
useLRUInMemoryAssignmentCache(maxSize) {
this.assignmentCache = new assignment_cache_1.LRUInMemoryAssignmentCache(maxSize);
this.assignmentCache = new abstract_assignment_cache_1.LRUInMemoryAssignmentCache(maxSize);
}

@@ -215,3 +215,3 @@ useCustomAssignmentCache(cache) {

logAssignment(result) {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e;
const { flagKey, subjectKey, allocationKey, subjectAttributes, variation } = result;

@@ -235,3 +235,3 @@ const event = Object.assign(Object.assign({}, ((_a = result.extraLogging) !== null && _a !== void 0 ? _a : {})), { allocation: allocationKey !== null && allocationKey !== void 0 ? allocationKey : null, experiment: allocationKey ? `${flagKey}-${allocationKey}` : null, featureFlag: flagKey, variation: (_b = variation === null || variation === void 0 ? void 0 : variation.key) !== null && _b !== void 0 ? _b : null, subject: subjectKey, timestamp: new Date().toISOString(), subjectAttributes, metaData: {

// assignment logger may be null while waiting for initialization
if (this.assignmentLogger == null) {
if (!this.assignmentLogger) {
this.queuedEvents.length < constants_1.MAX_EVENT_QUEUE_SIZE && this.queuedEvents.push(event);

@@ -243,6 +243,6 @@ return;

(_d = this.assignmentCache) === null || _d === void 0 ? void 0 : _d.set({
flagKey: flagKey,
subjectKey: result.subjectKey,
allocationKey: (_e = result.allocationKey) !== null && _e !== void 0 ? _e : '__eppo_no_allocation',
variationKey: (_g = (_f = result.variation) === null || _f === void 0 ? void 0 : _f.key) !== null && _g !== void 0 ? _g : '__eppo_no_variation',
flagKey,
subjectKey,
allocationKey: allocationKey !== null && allocationKey !== void 0 ? allocationKey : '__eppo_no_allocation',
variationKey: (_e = variation === null || variation === void 0 ? void 0 : variation.key) !== null && _e !== void 0 ? _e : '__eppo_no_variation',
});

@@ -249,0 +249,0 @@ }

import { IAsyncStore, IConfigurationStore, ISyncStore } from './configuration-store';
export declare class HybridConfigurationStore<T> implements IConfigurationStore<T> {
private readonly servingStore;
private readonly persistentStore;
protected readonly servingStore: ISyncStore<T>;
protected readonly persistentStore: IAsyncStore<T> | null;
constructor(servingStore: ISyncStore<T>, persistentStore: IAsyncStore<T> | null);

@@ -6,0 +6,0 @@ /**

import { logger } from './application-logger';
import { IAssignmentHooks } from './assignment-hooks';
import { IAssignmentLogger, IAssignmentEvent } from './assignment-logger';
import { AbstractAssignmentCache, AssignmentCache, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, AsyncMap } from './cache/assignment-cache';
import { AbstractAssignmentCache, AssignmentCache, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, AsyncMap, AssignmentCacheKey, AssignmentCacheValue, AssignmentCacheEntry, assignmentCacheKeyToString, assignmentCacheValueToString } from './cache/abstract-assignment-cache';
import EppoClient, { FlagConfigurationRequestParameters, IEppoClient } from './client/eppo-client';

@@ -15,3 +15,3 @@ import { IConfigurationStore, IAsyncStore, ISyncStore } from './configuration-store/configuration-store';

import * as validation from './validation';
export { logger as applicationLogger, AbstractAssignmentCache, IAssignmentHooks, IAssignmentLogger, IAssignmentEvent, EppoClient, IEppoClient, constants, FlagConfigRequestor, HttpClient, validation, IConfigurationStore, IAsyncStore, ISyncStore, MemoryStore, HybridConfigurationStore, MemoryOnlyConfigurationStore, AssignmentCache, AsyncMap, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, FlagConfigurationRequestParameters, Flag, VariationType, AttributeType, SubjectAttributes, };
export { logger as applicationLogger, AbstractAssignmentCache, IAssignmentHooks, IAssignmentLogger, IAssignmentEvent, EppoClient, IEppoClient, constants, FlagConfigRequestor, HttpClient, validation, IConfigurationStore, IAsyncStore, ISyncStore, MemoryStore, HybridConfigurationStore, MemoryOnlyConfigurationStore, AssignmentCacheKey, AssignmentCacheValue, AssignmentCacheEntry, AssignmentCache, AsyncMap, NonExpiringInMemoryAssignmentCache, LRUInMemoryAssignmentCache, assignmentCacheKeyToString, assignmentCacheValueToString, FlagConfigurationRequestParameters, Flag, VariationType, AttributeType, SubjectAttributes, };
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariationType = exports.LRUInMemoryAssignmentCache = exports.NonExpiringInMemoryAssignmentCache = exports.MemoryOnlyConfigurationStore = exports.HybridConfigurationStore = exports.MemoryStore = exports.validation = exports.HttpClient = exports.FlagConfigRequestor = exports.constants = exports.EppoClient = exports.AbstractAssignmentCache = exports.applicationLogger = void 0;
exports.VariationType = exports.assignmentCacheValueToString = exports.assignmentCacheKeyToString = exports.LRUInMemoryAssignmentCache = exports.NonExpiringInMemoryAssignmentCache = exports.MemoryOnlyConfigurationStore = exports.HybridConfigurationStore = exports.MemoryStore = exports.validation = exports.HttpClient = exports.FlagConfigRequestor = exports.constants = exports.EppoClient = exports.AbstractAssignmentCache = exports.applicationLogger = void 0;
const application_logger_1 = require("./application-logger");
Object.defineProperty(exports, "applicationLogger", { enumerable: true, get: function () { return application_logger_1.logger; } });
const assignment_cache_1 = require("./cache/assignment-cache");
Object.defineProperty(exports, "AbstractAssignmentCache", { enumerable: true, get: function () { return assignment_cache_1.AbstractAssignmentCache; } });
Object.defineProperty(exports, "NonExpiringInMemoryAssignmentCache", { enumerable: true, get: function () { return assignment_cache_1.NonExpiringInMemoryAssignmentCache; } });
Object.defineProperty(exports, "LRUInMemoryAssignmentCache", { enumerable: true, get: function () { return assignment_cache_1.LRUInMemoryAssignmentCache; } });
const abstract_assignment_cache_1 = require("./cache/abstract-assignment-cache");
Object.defineProperty(exports, "AbstractAssignmentCache", { enumerable: true, get: function () { return abstract_assignment_cache_1.AbstractAssignmentCache; } });
Object.defineProperty(exports, "NonExpiringInMemoryAssignmentCache", { enumerable: true, get: function () { return abstract_assignment_cache_1.NonExpiringInMemoryAssignmentCache; } });
Object.defineProperty(exports, "LRUInMemoryAssignmentCache", { enumerable: true, get: function () { return abstract_assignment_cache_1.LRUInMemoryAssignmentCache; } });
Object.defineProperty(exports, "assignmentCacheKeyToString", { enumerable: true, get: function () { return abstract_assignment_cache_1.assignmentCacheKeyToString; } });
Object.defineProperty(exports, "assignmentCacheValueToString", { enumerable: true, get: function () { return abstract_assignment_cache_1.assignmentCacheValueToString; } });
const eppo_client_1 = require("./client/eppo-client");

@@ -11,0 +13,0 @@ exports.EppoClient = eppo_client_1.default;

{
"name": "@eppo/js-client-sdk-common",
"version": "3.3.0",
"version": "3.3.1",
"description": "Eppo SDK for client-side JavaScript applications (base for both web and react native)",

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

/**
* LRUCache is a cache that stores a maximum number of items.
* LRUCache is a simple implementation of a Least Recently Used (LRU) cache.
*
* Items are removed from the cache when the cache is full.
* Old items are evicted when the cache reaches its capacity.
*
* The cache is implemented as a Map, which is a built-in JavaScript object.
* The Map object holds key-value pairs and remembers the order of key-value pairs as they were inserted.
* The cache is implemented as a Map, which maintains insertion order:
* ```
* Iteration happens in insertion order, which corresponds to the order in which each key-value pair
* was first inserted into the map by the set() method (that is, there wasn't a key with the same
* value already in the map when set() was called).
* ```
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
*/

@@ -9,0 +14,0 @@ export class LRUCache implements Map<string, string> {

@@ -8,3 +8,3 @@ import ApiEndpoints from '../api-endpoints';

NonExpiringInMemoryAssignmentCache,
} from '../cache/assignment-cache';
} from '../cache/abstract-assignment-cache';
import { IConfigurationStore } from '../configuration-store/configuration-store';

@@ -544,3 +544,3 @@ import {

// assignment logger may be null while waiting for initialization
if (this.assignmentLogger == null) {
if (!this.assignmentLogger) {
this.queuedEvents.length < MAX_EVENT_QUEUE_SIZE && this.queuedEvents.push(event);

@@ -552,6 +552,6 @@ return;

this.assignmentCache?.set({
flagKey: flagKey,
subjectKey: result.subjectKey,
allocationKey: result.allocationKey ?? '__eppo_no_allocation',
variationKey: result.variation?.key ?? '__eppo_no_variation',
flagKey,
subjectKey,
allocationKey: allocationKey ?? '__eppo_no_allocation',
variationKey: variation?.key ?? '__eppo_no_variation',
});

@@ -558,0 +558,0 @@ } catch (error) {

@@ -7,4 +7,4 @@ import { logger, loggerPrefix } from '../application-logger';

constructor(
private readonly servingStore: ISyncStore<T>,
private readonly persistentStore: IAsyncStore<T> | null,
protected readonly servingStore: ISyncStore<T>,
protected readonly persistentStore: IAsyncStore<T> | null,
) {}

@@ -11,0 +11,0 @@

@@ -10,3 +10,8 @@ import { logger } from './application-logger';

AsyncMap,
} from './cache/assignment-cache';
AssignmentCacheKey,
AssignmentCacheValue,
AssignmentCacheEntry,
assignmentCacheKeyToString,
assignmentCacheValueToString,
} from './cache/abstract-assignment-cache';
import EppoClient, { FlagConfigurationRequestParameters, IEppoClient } from './client/eppo-client';

@@ -49,2 +54,5 @@ import {

// Assignment cache
AssignmentCacheKey,
AssignmentCacheValue,
AssignmentCacheEntry,
AssignmentCache,

@@ -54,2 +62,4 @@ AsyncMap,

LRUInMemoryAssignmentCache,
assignmentCacheKeyToString,
assignmentCacheValueToString,

@@ -56,0 +66,0 @@ // Interfaces

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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