@oridune/epic-odm
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "@oridune/epic-odm", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Install 1 ODM and code once with any database driver.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -96,4 +96,4 @@ "use strict"; | ||
Target !== null && | ||
!(Target instanceof require("mongodb").ObjectId) && | ||
!(Target instanceof Array) && | ||
!(Target instanceof require("mongodb").ObjectId) && | ||
!(Target instanceof operators_1.Operator) && | ||
@@ -186,2 +186,5 @@ !(Target instanceof RegExp)) | ||
break; | ||
case "Toggle": | ||
Results[Key] = { $not: `$${Key}` }; | ||
break; | ||
case "ReplaceWith": | ||
@@ -188,0 +191,0 @@ Results["$replaceWith"] = Object.assign(Object.assign({}, Results["$replaceWith"]), { [Key]: Target.Value }); |
@@ -54,10 +54,12 @@ "use strict"; | ||
throw new Error(`The value '${value}' provided for field '${name}' does not match the pattern '${options.match}'!`); | ||
// Minimum Length Validation | ||
if (typeof options.minLength === "number" && options.minLength >= 0) | ||
if (((_b = (((_a = value.toString) === null || _a === void 0 ? void 0 : _a.call(value)) || value)) === null || _b === void 0 ? void 0 : _b.length) < options.minLength) | ||
throw new Error(`Value length (${(_d = (((_c = value.toString) === null || _c === void 0 ? void 0 : _c.call(value)) || value)) === null || _d === void 0 ? void 0 : _d.length}) for field '${name}' is smaller than expected length which is ${options.minLength}!`); | ||
// Maximum Length Validation | ||
if (typeof options.length === "number" && options.length >= 0) | ||
if (((_f = (((_e = value.toString) === null || _e === void 0 ? void 0 : _e.call(value)) || value)) === null || _f === void 0 ? void 0 : _f.length) > options.length) | ||
throw new Error(`Value length (${(_h = (((_g = value.toString) === null || _g === void 0 ? void 0 : _g.call(value)) || value)) === null || _h === void 0 ? void 0 : _h.length}) for field '${name}' is greater than expected length which is ${options.length}!`); | ||
if (typeof value === "string") { | ||
if (typeof options.minLength === "number" && options.minLength >= 0) | ||
if (((_b = (((_a = value.toString) === null || _a === void 0 ? void 0 : _a.call(value)) || value)) === null || _b === void 0 ? void 0 : _b.length) < options.minLength) | ||
// Minimum Length Validation | ||
throw new Error(`Value length (${(_d = (((_c = value.toString) === null || _c === void 0 ? void 0 : _c.call(value)) || value)) === null || _d === void 0 ? void 0 : _d.length}) for field '${name}' is smaller than expected length which is ${options.minLength}!`); | ||
// Maximum Length Validation | ||
if (typeof options.length === "number" && options.length >= 0) | ||
if (((_f = (((_e = value.toString) === null || _e === void 0 ? void 0 : _e.call(value)) || value)) === null || _f === void 0 ? void 0 : _f.length) > options.length) | ||
throw new Error(`Value length (${(_h = (((_g = value.toString) === null || _g === void 0 ? void 0 : _g.call(value)) || value)) === null || _h === void 0 ? void 0 : _h.length}) for field '${name}' is greater than expected length which is ${options.length}!`); | ||
} | ||
} | ||
@@ -64,0 +66,0 @@ return value; |
export declare type TComparisonOperators = "EQ" | "NE" | "GT" | "ST" | "GE" | "SE" | "NG" | "NS" | "RG" | "QF" | "ALL"; | ||
export declare type TRangeOperators = "BT" | "NB" | "IN" | "NI"; | ||
export declare type TMutationOperators = "ObjectID" | "SetTo" | "Push" | "PushToSet" | "ReplaceWith" | "Increment" | "Decrement"; | ||
export declare type TMutationOperators = "ObjectID" | "SetTo" | "Push" | "PushToSet" | "ReplaceWith" | "Increment" | "Decrement" | "Toggle"; | ||
export declare type TCheckOperators = "IsArrayEmpty" | "NotArrayEmpty"; | ||
@@ -100,2 +100,6 @@ export declare type TOtherOperators = "Raw"; | ||
/** | ||
* Toggle the current boolean value | ||
*/ | ||
export declare const Toggle: () => Operator<"Toggle", boolean>; | ||
/** | ||
* Check if an Array is empty | ||
@@ -102,0 +106,0 @@ */ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Raw = exports.ObjectID = exports.ReplaceWith = exports.NotArrayEmpty = exports.IsArrayEmpty = exports.Decrement = exports.Increment = exports.PushToSet = exports.Push = exports.SetTo = exports.NotBetween = exports.Between = exports.NotIn = exports.In = exports.All = exports.Matches = exports.SmallerEqual = exports.GreaterEqual = exports.NotSmaller = exports.Smaller = exports.NotGreater = exports.Greater = exports.NotNull = exports.NotEqual = exports.IsNull = exports.IsEqual = exports.Operator = void 0; | ||
exports.Raw = exports.ObjectID = exports.ReplaceWith = exports.NotArrayEmpty = exports.IsArrayEmpty = exports.Toggle = exports.Decrement = exports.Increment = exports.PushToSet = exports.Push = exports.SetTo = exports.NotBetween = exports.Between = exports.NotIn = exports.In = exports.All = exports.Matches = exports.SmallerEqual = exports.GreaterEqual = exports.NotSmaller = exports.Smaller = exports.NotGreater = exports.Greater = exports.NotNull = exports.NotEqual = exports.IsNull = exports.IsEqual = exports.Operator = void 0; | ||
class Operator { | ||
@@ -119,2 +119,7 @@ constructor(Type, Value) { | ||
/** | ||
* Toggle the current boolean value | ||
*/ | ||
const Toggle = () => new Operator("Toggle", false); | ||
exports.Toggle = Toggle; | ||
/** | ||
* Check if an Array is empty | ||
@@ -121,0 +126,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
123056
2541