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

@hackler/sdk-core

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hackler/sdk-core - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

12

lib/internal/workspace/Workspace.d.ts

@@ -23,11 +23,7 @@ import { Bucket, BucketId, EventKey, EventType, Experiment, ExperimentKey } from "../model/model";

private static parseOrNull;
private static mapNotUndefined;
private static associateTo;
private static associate;
private static associateBy;
}
declare global {
interface Array<T> {
mapNotUndefined<R>(this: T[], transform: (value: T) => R | undefined): Array<R>;
associateTo<K, V>(this: T[], destination: Map<K, V>, transform: (value: T) => [K, V]): Map<K, V>;
associate<K, V>(this: T[], transform: (value: T) => [K, V]): Map<K, V>;
associateBy<K>(this: T[], keySelector: (value: T) => K): Map<K, T>;
}
}
//# sourceMappingURL=Workspace.d.ts.map

@@ -33,10 +33,6 @@ "use strict";

var _this = this;
var buckets = dto.buckets.associate(function (it) { return [it.id, _this.toBucket(it)]; });
var experiments = dto.experiments
.mapNotUndefined(function (it) { return _this.toExperimentOrNull("AB_TEST", it); })
.associateBy(function (it) { return it.key; });
var featureFlags = dto.featureFlags
.mapNotUndefined(function (it) { return _this.toExperimentOrNull("FEATURE_FLAG", it); })
.associateBy(function (it) { return it.key; });
var eventTypes = dto.events.associate(function (it) { return [it.key, new model_1.EventType(it.id, it.key)]; });
var buckets = Workspace.associate(dto.buckets, function (it) { return [it.id, _this.toBucket(it)]; });
var experiments = Workspace.associateBy(Workspace.mapNotUndefined(dto.experiments, function (it) { return _this.toExperimentOrNull("AB_TEST", it); }), function (it) { return it.key; });
var featureFlags = Workspace.associateBy(Workspace.mapNotUndefined(dto.featureFlags, function (it) { return _this.toExperimentOrNull("FEATURE_FLAG", it); }), function (it) { return it.key; });
var eventTypes = Workspace.associate(dto.events, function (it) { return [it.key, new model_1.EventType(it.id, it.key)]; });
return new Workspace(experiments, featureFlags, buckets, eventTypes);

@@ -53,3 +49,3 @@ };

var variations = dto.variations.map(function (it) { return new model_1.Variation(it.id, it.key, it.status === "DROPPED"); });
var overrides = dto.execution.userOverrides.associate(function (it) { return [it.userId, it.variationId]; });
var overrides = Workspace.associate(dto.execution.userOverrides, function (it) { return [it.userId, it.variationId]; });
switch (dto.execution.status) {

@@ -59,4 +55,4 @@ case "READY":

case "RUNNING":
var targetAudiences = dto.execution.targetAudiences.mapNotUndefined(function (it) { return _this.toTargetOrNull(it); });
var targetRules = dto.execution.targetRules.mapNotUndefined(function (it) { return _this.toTargetRuleOrNull(it); });
var targetAudiences = Workspace.mapNotUndefined(dto.execution.targetAudiences, function (it) { return _this.toTargetOrNull(it); });
var targetRules = Workspace.mapNotUndefined(dto.execution.targetRules, function (it) { return _this.toTargetRuleOrNull(it); });
var defaultRule = this.toTargetActionOrNull(dto.execution.defaultRule);

@@ -84,4 +80,3 @@ return defaultRule &&

var _this = this;
var conditions = dto.conditions
.mapNotUndefined(function (it) { return _this.toConditionOrNull(it); });
var conditions = Workspace.mapNotUndefined(dto.conditions, function (it) { return _this.toConditionOrNull(it); });
return new model_1.Target(conditions);

@@ -107,31 +102,31 @@ };

if (!t) {
log.debug("Unsupported type [" + t + "]. Please use the latest version of sdk.");
log.debug("Unsupported type [" + type + "]. Please use the latest version of sdk.");
}
return t;
};
Workspace.mapNotUndefined = function (receiver, transform) {
return receiver.reduce(function (results, t) {
var result = transform(t);
if (result) {
results.push(result);
}
return results;
}, Array());
};
Workspace.associateTo = function (receiver, destination, transform) {
return receiver.reduce(function (map, value) {
var kv = transform(value);
map.set(kv[0], kv[1]);
return map;
}, destination);
};
Workspace.associate = function (receiver, transform) {
return Workspace.associateTo(receiver, new Map(), transform);
};
Workspace.associateBy = function (receiver, keySelector) {
return this.associateTo(receiver, new Map(), function (it) { return [keySelector(it), it]; });
};
return Workspace;
}());
exports.default = Workspace;
Array.prototype.mapNotUndefined = function (transform) {
return this.reduce(function (results, t) {
var result = transform(t);
if (result) {
results.push(result);
}
return results;
}, Array());
};
Array.prototype.associateTo = function (destination, transform) {
return this.reduce(function (map, value) {
var kv = transform(value);
map.set(kv[0], kv[1]);
return map;
}, destination);
};
Array.prototype.associate = function (transform) {
return this.associateTo(new Map(), transform);
};
Array.prototype.associateBy = function (keySelector) {
return this.associateTo(new Map(), function (it) { return [keySelector(it), it]; });
};
//# sourceMappingURL=Workspace.js.map
{
"name": "@hackler/sdk-core",
"version": "2.1.0",
"version": "2.1.1",
"description": "JavaScript SDK-core",

@@ -5,0 +5,0 @@ "author": {

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