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
5
Versions
75
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 1.1.0 to 1.2.0

dist/assignment-hooks.d.ts

2

dist/client/eppo-client.d.ts

@@ -0,1 +1,2 @@

import { IAssignmentHooks } from '../assignment-hooks';
import { IAssignmentLogger } from '../assignment-logger';

@@ -26,2 +27,3 @@ import { IConfigurationStore } from '../configuration-store';

getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: {}): string;
getAssignmentWithHooks(subjectKey: string, experimentKey: string, subjectAttributes: {}, assignmentHooks: IAssignmentHooks): Promise<string>;
setLogger(logger: IAssignmentLogger): void;

@@ -28,0 +30,0 @@ private flushQueuedEvents;

@@ -41,2 +41,10 @@ "use strict";

}
async getAssignmentWithHooks(subjectKey, experimentKey, subjectAttributes = {}, assignmentHooks) {
let assignment = await (assignmentHooks === null || assignmentHooks === void 0 ? void 0 : assignmentHooks.onPreAssignment(subjectKey));
if (assignment == null) {
assignment = this.getAssignment(subjectKey, experimentKey, subjectAttributes);
}
assignmentHooks === null || assignmentHooks === void 0 ? void 0 : assignmentHooks.onPostAssignment(assignment);
return assignment;
}
setLogger(logger) {

@@ -43,0 +51,0 @@ this.assignmentLogger = logger;

@@ -28,2 +28,3 @@ import { AxiosInstance } from 'axios';

getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: {}): string;
getAssignmentWithHooks(subjectKey: string, experimentKey: string, subjectAttributes: {}, assignmentHooks: IAssignmentHooks): Promise<string>;
setLogger(logger: IAssignmentLogger): void;

@@ -86,2 +87,25 @@ private flushQueuedEvents;

/**
* Implement this interface to override an assignment or receive a callback post assignment
* @public
*/
declare interface IAssignmentHooks {
/**
* Invoked before a subject is assigned to an experiment variation.
*
* @param subject id of subject being assigned
* @returns variation to override for the given subject. If null is returned,
* then the subject will be assigned with the default assignment logic.
* @public
*/
onPreAssignment(subject: string): Promise<string | null>;
/**
* Invoked after a subject is assigned. Useful for any post assignment logic needed which is specific
* to an experiment/flag. Do not use this for logging assignments - use IAssignmentLogger instead.
* @param variation the assigned variation
* @public
*/
onPostAssignment(variation: string): Promise<void>;
}
/**
* Implement this interface log variation assignments to your data warehouse.

@@ -88,0 +112,0 @@ * @public

2

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

@@ -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

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

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