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

@eppo/node-server-sdk

Package Overview
Dependencies
Maintainers
4
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eppo/node-server-sdk - npm Package Compare versions

Comparing version 0.3.5 to 0.3.6

6

dist/eppo-client.d.ts

@@ -11,7 +11,7 @@ import ExperimentConfigurationRequestor from './experiment/experiment-configuration-requestor';

* @param subject an entity ID, e.g. userId
* @param flag experiment identifier
* @param experimentKey experiment identifier
* @returns a variation value if the subject is part of the experiment sample, otherwise null
* @public
*/
getAssignment(subject: string, flag: string): string;
getAssignment(subject: string, experimentKey: string): string;
/**

@@ -27,3 +27,3 @@ * Returns a Promise that resolves once the client polling process has started.

constructor(waitForInitialization: () => Promise<void>, configurationRequestor: ExperimentConfigurationRequestor);
getAssignment(subject: string, flag: string): string;
getAssignment(subject: string, experimentKey: string): string;
/**

@@ -30,0 +30,0 @@ * This checks whether the subject is included in the experiment sample.

@@ -10,11 +10,12 @@ "use strict";

}
getAssignment(subject, flag) {
getAssignment(subject, experimentKey) {
(0, validation_1.validateNotBlank)(subject, 'Invalid argument: subject cannot be blank');
(0, validation_1.validateNotBlank)(flag, 'Invalid argument: flag cannot be blank');
const experimentConfig = this.configurationRequestor.getConfiguration(flag);
if (!(experimentConfig === null || experimentConfig === void 0 ? void 0 : experimentConfig.enabled) || !this.isInExperimentSample(subject, flag, experimentConfig)) {
(0, validation_1.validateNotBlank)(experimentKey, 'Invalid argument: experimentKey cannot be blank');
const experimentConfig = this.configurationRequestor.getConfiguration(experimentKey);
if (!(experimentConfig === null || experimentConfig === void 0 ? void 0 : experimentConfig.enabled) ||
!this.isInExperimentSample(subject, experimentKey, experimentConfig)) {
return null;
}
const { variations, subjectShards } = experimentConfig;
const shard = (0, shard_1.getShard)(`assignment-${subject}-${flag}`, subjectShards);
const shard = (0, shard_1.getShard)(`assignment-${subject}-${experimentKey}`, subjectShards);
return variations.find((variation) => (0, shard_1.isShardInRange)(shard, variation.shardRange)).name;

@@ -27,5 +28,5 @@ }

*/
isInExperimentSample(subject, experiment, experimentConfig) {
isInExperimentSample(subject, experimentKey, experimentConfig) {
const { percentExposure, subjectShards } = experimentConfig;
const shard = (0, shard_1.getShard)(`exposure-${subject}-${experiment}`, subjectShards);
const shard = (0, shard_1.getShard)(`exposure-${subject}-${experimentKey}`, subjectShards);
return shard <= percentExposure * subjectShards;

@@ -32,0 +33,0 @@ }

@@ -26,7 +26,7 @@ /**

* @param subject an entity ID, e.g. userId
* @param flag experiment identifier
* @param experimentKey experiment identifier
* @returns a variation value if the subject is part of the experiment sample, otherwise null
* @public
*/
getAssignment(subject: string, flag: string): string;
getAssignment(subject: string, experimentKey: string): string;
/**

@@ -33,0 +33,0 @@ * Returns a Promise that resolves once the client polling process has started.

{
"name": "@eppo/node-server-sdk",
"version": "0.3.5",
"version": "0.3.6",
"description": "Eppo node server SDK",

@@ -5,0 +5,0 @@ "main": "dist/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