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.2.0

3

lib/internal/evaluation/match/OperatorMatcher.d.ts

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

import { MatchOperator } from "../../model/model";
import { MatchOperator, Version } from "../../model/model";
export default interface OperatorMatcher {

@@ -6,2 +6,3 @@ stringMatches(userValue: string, matchValue: string): boolean;

booleanMatches(userValue: boolean, matchValue: boolean): boolean;
versionMatches(userValue: Version, matchValue: Version): boolean;
}

@@ -8,0 +9,0 @@ export declare class OperatorMatcherFactory {

@@ -16,2 +16,5 @@ "use strict";

};
InMatcher.prototype.versionMatches = function (userValue, matchValue) {
return userValue.isEqualTo(matchValue);
};
return InMatcher;

@@ -31,2 +34,5 @@ }());

};
ContainsMatcher.prototype.versionMatches = function (userValue, matchValue) {
return false;
};
return ContainsMatcher;

@@ -46,2 +52,5 @@ }());

};
StartsWithMatcher.prototype.versionMatches = function (userValue, matchValue) {
return false;
};
return StartsWithMatcher;

@@ -61,2 +70,5 @@ }());

};
EndsWithMatcher.prototype.versionMatches = function (userValue, matchValue) {
return false;
};
return EndsWithMatcher;

@@ -76,2 +88,5 @@ }());

};
GreaterThanMatcher.prototype.versionMatches = function (userValue, matchValue) {
return userValue.isGreaterThan(matchValue);
};
return GreaterThanMatcher;

@@ -91,2 +106,5 @@ }());

};
GreaterThanOrEqualToMatcher.prototype.versionMatches = function (userValue, matchValue) {
return userValue.isGreaterThanOrEqualTo(matchValue);
};
return GreaterThanOrEqualToMatcher;

@@ -106,2 +124,5 @@ }());

};
LessThanMatcher.prototype.versionMatches = function (userValue, matchValue) {
return userValue.isLessThan(matchValue);
};
return LessThanMatcher;

@@ -121,2 +142,5 @@ }());

};
LessThanOrEqualToMatcher.prototype.versionMatches = function (userValue, matchValue) {
return userValue.isLessThanOrEqualTo(matchValue);
};
return LessThanOrEqualToMatcher;

@@ -123,0 +147,0 @@ }());

@@ -10,4 +10,5 @@ import OperatorMatcher from "./OperatorMatcher";

private static BOOLEAN_MATCHER;
private static VERSION_MATCHER;
getMatcher(valueType: MatchValueType): ValueMatcher;
}
//# sourceMappingURL=ValueMatcher.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValueMatcherFactory = void 0;
var model_1 = require("../../model/model");
var StringMatcher = /** @class */ (function () {

@@ -43,2 +44,17 @@ function StringMatcher() {

}());
var VersionMatcher = /** @class */ (function () {
function VersionMatcher() {
}
VersionMatcher.prototype.matches = function (operatorMatcher, userValue, matchValue) {
var userVersion = model_1.Version.tryParse(userValue);
var matchVersion = model_1.Version.tryParse(matchValue);
if (userVersion && matchVersion) {
return operatorMatcher.versionMatches(userVersion, matchVersion);
}
else {
return false;
}
};
return VersionMatcher;
}());
var ValueMatcherFactory = /** @class */ (function () {

@@ -55,2 +71,4 @@ function ValueMatcherFactory() {

return ValueMatcherFactory.BOOLEAN_MATCHER;
case "VERSION":
return ValueMatcherFactory.VERSION_MATCHER;
}

@@ -61,2 +79,3 @@ };

ValueMatcherFactory.BOOLEAN_MATCHER = new BooleanMatcher();
ValueMatcherFactory.VERSION_MATCHER = new VersionMatcher();
return ValueMatcherFactory;

@@ -63,0 +82,0 @@ }());

"use strict";
// import {VariationKey} from "../VariationKey"
Object.defineProperty(exports, "__esModule", { value: true });
exports.TARGET_KEY_TYPES = exports.TARGET_ACTION_TYPES = exports.MATCH_OPERATORS = exports.MATCH_VALUE_TYPES = exports.MATCH_TYPES = exports.TargetRule = exports.TargetAction = exports.TargetMatch = exports.TargetKey = exports.TargetCondition = exports.Target = exports.EventType = exports.Slot = exports.Bucket = exports.Variation = exports.Experiment = exports.DecisionReason = exports.FeatureFlagDecision = exports.Decision = void 0;
exports.TARGET_KEY_TYPES = exports.TARGET_ACTION_TYPES = exports.MATCH_OPERATORS = exports.MATCH_VALUE_TYPES = exports.MATCH_TYPES = exports.MetaVersion = exports.CoreVersion = exports.Version = exports.TargetRule = exports.TargetAction = exports.TargetMatch = exports.TargetKey = exports.TargetCondition = exports.Target = exports.EventType = exports.Slot = exports.Bucket = exports.Variation = exports.Experiment = exports.DecisionReason = exports.FeatureFlagDecision = exports.Decision = void 0;
var tslib_1 = require("tslib");

@@ -266,4 +266,112 @@ /**

exports.TargetRule = TargetRule;
function compareValues(a, b) {
return a - b;
}
var Version = /** @class */ (function () {
function Version(coreVersion, prerelease, build) {
this.coreVersion = coreVersion;
this.prerelease = prerelease;
this.build = build;
}
Version.tryParse = function (value) {
var match = Version.regExp.exec(value);
if (!match)
return undefined;
var _a = tslib_1.__read(match, 6), _ = _a[0], major = _a[1], _b = _a[2], minor = _b === void 0 ? "0" : _b, _c = _a[3], patch = _c === void 0 ? "0" : _c, prerelease = _a[4], build = _a[5];
var coreVersion = new CoreVersion(parseInt(major, 10), parseInt(minor, 10), parseInt(patch, 10));
return new Version(coreVersion, MetaVersion.parse(prerelease), MetaVersion.parse(build));
};
Version.prototype.compareTo = function (other) {
return this.coreVersion.compareTo(other.coreVersion)
|| this.prerelease.compareTo(other.prerelease);
};
Version.prototype.isEqualTo = function (other) {
return this.compareTo(other) === 0;
};
Version.prototype.isGreaterThan = function (other) {
return this.compareTo(other) > 0;
};
Version.prototype.isGreaterThanOrEqualTo = function (other) {
return this.compareTo(other) >= 0;
};
Version.prototype.isLessThan = function (other) {
return this.compareTo(other) < 0;
};
Version.prototype.isLessThanOrEqualTo = function (other) {
return this.compareTo(other) <= 0;
};
Version.regExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?(?:\.(0|[1-9]\d*))?(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
return Version;
}());
exports.Version = Version;
var CoreVersion = /** @class */ (function () {
function CoreVersion(major, minor, patch) {
this.major = major;
this.minor = minor;
this.patch = patch;
}
CoreVersion.prototype.compareTo = function (other) {
return compareValues(this.major, other.major)
|| compareValues(this.minor, other.minor)
|| compareValues(this.patch, other.patch);
};
return CoreVersion;
}());
exports.CoreVersion = CoreVersion;
var MetaVersion = /** @class */ (function () {
function MetaVersion(identifiers) {
this.identifiers = identifiers;
}
MetaVersion.parse = function (text) {
if (!text) {
return MetaVersion.EMPTY;
}
else {
return new MetaVersion(text.split("."));
}
};
MetaVersion.prototype.isEmpty = function () {
return this.identifiers.length === 0;
};
MetaVersion.prototype.isNotEmpty = function () {
return !this.isEmpty();
};
MetaVersion.prototype.compareTo = function (other) {
if (this.isEmpty() && other.isEmpty()) {
return 0;
}
if (this.isEmpty() && other.isNotEmpty()) {
return 1;
}
if (this.isNotEmpty() && other.isEmpty()) {
return -1;
}
return this.compareIdentifiers(other);
};
MetaVersion.prototype.compareIdentifiers = function (other) {
var length = Math.min(this.identifiers.length, other.identifiers.length);
for (var i = 0; i < length; i++) {
var result = MetaVersion.compareIdentifiers(this.identifiers[i], other.identifiers[i]);
if (result !== 0) {
return result;
}
}
return compareValues(this.identifiers.length, other.identifiers.length);
};
MetaVersion.compareIdentifiers = function (identifier1, identifier2) {
if (MetaVersion.numericIdentifierRegExp.test(identifier1) && MetaVersion.numericIdentifierRegExp.test(identifier2)) {
return compareValues(+identifier1, +identifier2);
}
if (identifier1 === identifier2) {
return 0;
}
return identifier1 < identifier2 ? -1 : 1;
};
MetaVersion.EMPTY = new MetaVersion([]);
MetaVersion.numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
return MetaVersion;
}());
exports.MetaVersion = MetaVersion;
exports.MATCH_TYPES = ["MATCH", "NOT_MATCH"];
exports.MATCH_VALUE_TYPES = ["STRING", "NUMBER", "BOOLEAN"];
exports.MATCH_VALUE_TYPES = ["STRING", "NUMBER", "BOOLEAN", "VERSION"];
exports.MATCH_OPERATORS = ["IN", "CONTAINS", "STARTS_WITH", "ENDS_WITH", "GT", "GTE", "LT", "LTE"];

@@ -270,0 +378,0 @@ exports.TARGET_ACTION_TYPES = ["VARIATION", "BUCKET"];

{
"name": "@hackler/sdk-core",
"version": "2.1.0",
"version": "2.2.0",
"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

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

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