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

@statsig/client-core

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@statsig/client-core - npm Package Compare versions

Comparing version 0.0.1-beta.6 to 0.0.1-beta.7

2

package.json
{
"name": "@statsig/client-core",
"version": "0.0.1-beta.6",
"version": "0.0.1-beta.7",
"dependencies": {},

@@ -5,0 +5,0 @@ "type": "commonjs",

@@ -7,3 +7,4 @@ import { EvaluationOptions } from './StatsigClientBase';

export interface StatsigClientCommonInterface extends StatsigClientEventEmitterInterface {
initialize(): void;
initializeSync(): void;
initializeAsync(): Promise<void>;
shutdown(): Promise<void>;

@@ -21,3 +22,4 @@ }

getCurrentUser(): StatsigUser;
updateUser(user: StatsigUser): void;
updateUserSync(user: StatsigUser): void;
updateUserAsync(user: StatsigUser): Promise<void>;
checkGate(name: string, options: EvaluationOptions): boolean;

@@ -24,0 +26,0 @@ getFeatureGate(name: string, options: EvaluationOptions): FeatureGate;

@@ -66,4 +66,3 @@ "use strict";

StatsigClientBase.prototype._runPostUpdate = function (current, user) {
var _a, _b;
(_b = (_a = this._adapter).handlePostUpdate) === null || _b === void 0 ? void 0 : _b.call(_a, current, user).catch(function (err) {
this._adapter.getDataAsync(current, user).catch(function (err) {
Log_1.Log.error('An error occurred after update.', err);

@@ -70,0 +69,0 @@ });

import { StatsigOptionsCommon } from './StatsigOptionsCommon';
import { StatsigUser } from './StatsigUser';
export type DataSource = 'Uninitialized' | 'Loading' | 'NoValues' | 'Cache' | 'Network' | 'NetworkNotModified' | 'Bootstrap' | 'Prefetch';
export type DataSource = 'Uninitialized' | 'Loading' | 'NoValues' | 'Cache' | 'Network' | 'NetworkNotModified' | 'Bootstrap';
export type StatsigDataAdapterResult = {

@@ -8,2 +8,14 @@ readonly source: DataSource;

};
/**
* Describes a type that is used during intialize/update operations of a Statsig client.
*
* See below to find the default adapters, but know that it is possible to create your
* own StatsigDataAdapter and provide it via {@link StatsigOptions.dataAdapter}.
*
* Defaults:
*
* - {@link PrecomputedEvaluationsClient} uses {@link EvaluationsDataAdapter}
*
* - {@link OnDeviceEvaluationsClient} uses {@link SpecsDataAdapter}
*/
export type StatsigDataAdapter = {

@@ -17,13 +29,14 @@ /**

/**
* Synchronously get data for the given user (if any). Called during initialization and updates.
* Synchronously get data for the given user (if any). Called during initializeSync and/or updateUserSync.
* It is also called during async update operations before StatsigDataAdapter.getDataAsync is called.
* @param {StatsigUser | undefined} user The StatsigUser to get data for.
* @returns {StatsigDataAdapterResult | null} The data that was found for the given StatsigUser.
*/
readonly getData: (user?: StatsigUser) => StatsigDataAdapterResult | null;
readonly getDataSync: (user?: StatsigUser) => StatsigDataAdapterResult | null;
/**
*
* @param {StatsigDataAdapterResult | null} result The values that were found and applied during initialization or update.
* @param {StatsigUser | undefined} user The StatsigUser object that was used.
* Asynchronously get data for the given user (if any). Called during initializeAsync and/or updateUserAsync.
* @param {StatsigUser | undefined} user The StatsigUser to get data for.
* @returns {StatsigDataAdapterResult | null} The data that was found for the given StatsigUser.
*/
readonly handlePostUpdate: (result: StatsigDataAdapterResult | null, user?: StatsigUser) => Promise<void>;
readonly getDataAsync: (current: StatsigDataAdapterResult | null, user?: StatsigUser) => Promise<StatsigDataAdapterResult | null>;
};

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

exports.StatsigMetadataProvider = void 0;
var SDK_VERSION = '0.0.1-beta.6';
var SDK_VERSION = '0.0.1-beta.7';
var metadata = {

@@ -18,0 +18,0 @@ sdkVersion: SDK_VERSION,

@@ -25,3 +25,3 @@ import { LogLevel } from './Log';

/**
* StatsigDataAdapter implementor used to customize the initialization flow.
* StatsigDataAdapter implementor used to customize the initialization/update flow.
* Default: EvaluationsDataAdapter (Precomputed) or SpecsDataAdapter (OnDevice)

@@ -28,0 +28,0 @@ */

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