namirasoft-node 1.4.95 → 1.4.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Validator.d.ts +3 -0
- package/dist/Validator.js +16 -0
- package/dist/Validator.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Validator.ts +16 -0
- package/src/index.ts +3 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Validator = void 0;
|
|
4
|
+
const namirasoft_core_1 = require("namirasoft-core");
|
|
5
|
+
class Validator {
|
|
6
|
+
checkDuplicated(name, values) {
|
|
7
|
+
const seen = new Set();
|
|
8
|
+
for (const value of values) {
|
|
9
|
+
if (seen.has(value))
|
|
10
|
+
namirasoft_core_1.ErrorOperation.throwHTTP(400, `Duplicated value '${value}' was found in ${name}`);
|
|
11
|
+
seen.add(value);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Validator = Validator;
|
|
16
|
+
//# sourceMappingURL=Validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Validator.js","sourceRoot":"","sources":["../src/Validator.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEjD,MAAa,SAAS;IAElB,eAAe,CAAI,IAAY,EAAE,MAAW;QAExC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAK,CAAC;QAE1B,KAAK,MAAM,KAAK,IAAI,MAAM,EAC1B,CAAC;YACG,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBACf,gCAAc,CAAC,SAAS,CAAC,GAAG,EAAE,qBAAqB,KAAK,kBAAkB,IAAI,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACL,CAAC;CACJ;AAbD,8BAaC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -34,4 +34,6 @@ __exportStar(require("./OTPOperation"), exports);
|
|
|
34
34
|
__exportStar(require("./RequestHeaderService"), exports);
|
|
35
35
|
__exportStar(require("./ServerToServerOperation"), exports);
|
|
36
36
|
__exportStar(require("./SMTPService"), exports);
|
|
37
|
+
__exportStar(require("./Timer"), exports);
|
|
38
|
+
__exportStar(require("./Validator"), exports);
|
|
37
39
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC;AACjC,6CAA2B;AAC3B,iDAA+B;AAC/B,qDAAmC;AACnC,0DAAwC;AACxC,kEAAgD;AAChD,gEAA8C;AAC9C,8CAA4B;AAC5B,2DAAyC;AACzC,qDAAmC;AACnC,iDAA+B;AAC/B,gDAA8B;AAC9B,yCAAuB;AACvB,iDAA+B;AAC/B,yDAAuC;AACvC,4DAA0C;AAC1C,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,oDAAkC;AAClC,wDAAsC;AACtC,mDAAiC;AACjC,6CAA2B;AAC3B,iDAA+B;AAC/B,qDAAmC;AACnC,0DAAwC;AACxC,kEAAgD;AAChD,gEAA8C;AAC9C,8CAA4B;AAC5B,2DAAyC;AACzC,qDAAmC;AACnC,iDAA+B;AAC/B,gDAA8B;AAC9B,yCAAuB;AACvB,iDAA+B;AAC/B,yDAAuC;AACvC,4DAA0C;AAC1C,gDAA8B;AAC9B,0CAAwB;AACxB,8CAA4B"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.4.
|
|
11
|
+
"version": "1.4.96",
|
|
12
12
|
"author": "Amir Abolhasani",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"express": "^5.1.0",
|
|
32
32
|
"joi": "^17.13.3",
|
|
33
33
|
"namirasoft-core": "^1.4.71",
|
|
34
|
-
"namirasoft-log": "^1.4.
|
|
34
|
+
"namirasoft-log": "^1.4.28",
|
|
35
35
|
"namirasoft-schema": "^1.4.25",
|
|
36
36
|
"node-cron": "^3.0.3",
|
|
37
37
|
"nodemailer": "^6.10.1",
|
package/src/Validator.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ErrorOperation } from "namirasoft-core";
|
|
2
|
+
|
|
3
|
+
export class Validator
|
|
4
|
+
{
|
|
5
|
+
checkDuplicated<T>(name: string, values: T[]): void
|
|
6
|
+
{
|
|
7
|
+
const seen = new Set<T>();
|
|
8
|
+
|
|
9
|
+
for (const value of values)
|
|
10
|
+
{
|
|
11
|
+
if (seen.has(value))
|
|
12
|
+
ErrorOperation.throwHTTP(400, `Duplicated value '${value}' was found in ${name}`);
|
|
13
|
+
seen.add(value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -17,4 +17,6 @@ export * from "./Meta";
|
|
|
17
17
|
export * from "./OTPOperation";
|
|
18
18
|
export * from "./RequestHeaderService";
|
|
19
19
|
export * from "./ServerToServerOperation";
|
|
20
|
-
export * from "./SMTPService";
|
|
20
|
+
export * from "./SMTPService";
|
|
21
|
+
export * from "./Timer";
|
|
22
|
+
export * from "./Validator";
|