@open-norantec/utilities 1.0.1 → 2.0.0-alpha.0
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/enum-util.class.d.ts +2 -0
- package/dist/enum-util.class.js +4 -0
- package/dist/enums.d.ts +56 -0
- package/dist/enums.js +55 -0
- package/dist/eslint-util.class.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/log-util.class.d.ts +4 -4
- package/dist/schemas.d.ts +498 -0
- package/dist/schemas.js +113 -0
- package/dist/zod.d.ts +1 -0
- package/dist/zod.js +17 -0
- package/package.json +5 -5
- package/dist/schema-util.class.d.ts +0 -838
- package/dist/schema-util.class.js +0 -165
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from './zod';
|
|
1
2
|
export interface IEnum {
|
|
2
3
|
[x: string]: any;
|
|
3
4
|
}
|
|
@@ -5,4 +6,5 @@ export declare class EnumUtil {
|
|
|
5
6
|
static getEntries(inputEnum: IEnum): Array<[string, any]>;
|
|
6
7
|
static isValidValue(inputEnum: IEnum, inputValue: any): boolean;
|
|
7
8
|
static isEqual(enum1: IEnum, enum2: IEnum): boolean;
|
|
9
|
+
static createEnumSchema<const T extends Record<string, string>>(object: T, params?: Parameters<typeof z.enum>[1]): z.ZodEnum<{ [k_1 in T[keyof T]]: k_1; } extends infer T_1 ? { [k in keyof T_1]: { [k_1 in T[keyof T]]: k_1; }[k]; } : never>;
|
|
8
10
|
}
|
package/dist/enum-util.class.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EnumUtil = void 0;
|
|
4
|
+
const zod_1 = require("./zod");
|
|
4
5
|
class EnumUtil {
|
|
5
6
|
static getEntries(inputEnum) {
|
|
6
7
|
try {
|
|
@@ -34,5 +35,8 @@ class EnumUtil {
|
|
|
34
35
|
}
|
|
35
36
|
return true;
|
|
36
37
|
}
|
|
38
|
+
static createEnumSchema(object, params) {
|
|
39
|
+
return zod_1.z.enum(Object.values(object), params);
|
|
40
|
+
}
|
|
37
41
|
}
|
|
38
42
|
exports.EnumUtil = EnumUtil;
|
package/dist/enums.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare namespace Enums {
|
|
2
|
+
const OrderOrientation: {
|
|
3
|
+
readonly ASC: "ASC";
|
|
4
|
+
readonly DESC: "DESC";
|
|
5
|
+
};
|
|
6
|
+
const WhereClauseOp: {
|
|
7
|
+
readonly ADJACENT: "adjacent";
|
|
8
|
+
readonly ANY: "any";
|
|
9
|
+
readonly BETWEEN: "between";
|
|
10
|
+
readonly COL: "col";
|
|
11
|
+
readonly CONTAINED: "contained";
|
|
12
|
+
readonly CONTAINS: "contains";
|
|
13
|
+
readonly ENDS_WITH: "endsWith";
|
|
14
|
+
readonly EQ: "eq";
|
|
15
|
+
readonly GT: "gt";
|
|
16
|
+
readonly GTE: "gte";
|
|
17
|
+
readonly I_LIKE: "iLike";
|
|
18
|
+
readonly IN: "in";
|
|
19
|
+
readonly I_REGEXP: "iRegexp";
|
|
20
|
+
readonly IS: "is";
|
|
21
|
+
readonly LIKE: "like";
|
|
22
|
+
readonly LT: "lt";
|
|
23
|
+
readonly LTE: "lte";
|
|
24
|
+
readonly MATCH: "match";
|
|
25
|
+
readonly NE: "ne";
|
|
26
|
+
readonly NO_EXTEND_LEFT: "noExtendLeft";
|
|
27
|
+
readonly NO_EXTEND_RIGHT: "noExtendRight";
|
|
28
|
+
readonly NOT: "not";
|
|
29
|
+
readonly NOT_BETWEEN: "notBetween";
|
|
30
|
+
readonly NOT_I_LIKE: "notILike";
|
|
31
|
+
readonly NOT_IN: "notIn";
|
|
32
|
+
readonly NOT_I_REGEXP: "notIRegexp";
|
|
33
|
+
readonly NOT_LIKE: "notLike";
|
|
34
|
+
readonly NOT_REGEXP: "notRegexp";
|
|
35
|
+
readonly OVERLAP: "overlap";
|
|
36
|
+
readonly PLACEHOLDER: "placeholder";
|
|
37
|
+
readonly REGEXP: "regexp";
|
|
38
|
+
readonly STARTS_WITH: "startsWith";
|
|
39
|
+
readonly STRICT_LEFT: "strictLeft";
|
|
40
|
+
readonly STRICT_RIGHT: "strictRight";
|
|
41
|
+
readonly SUBSTRING: "substring";
|
|
42
|
+
readonly VALUES: "values";
|
|
43
|
+
};
|
|
44
|
+
const LogLevel: {
|
|
45
|
+
readonly ERROR: "error";
|
|
46
|
+
readonly WARN: "warn";
|
|
47
|
+
readonly INFO: "info";
|
|
48
|
+
readonly VERBOSE: "verbose";
|
|
49
|
+
readonly DEBUG: "debug";
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare namespace EnumTypes {
|
|
53
|
+
type OrderOrientation = (typeof Enums.OrderOrientation)[keyof typeof Enums.OrderOrientation];
|
|
54
|
+
type WhereClauseOp = (typeof Enums.WhereClauseOp)[keyof typeof Enums.WhereClauseOp];
|
|
55
|
+
type LogLevel = (typeof Enums.LogLevel)[keyof typeof Enums.LogLevel];
|
|
56
|
+
}
|
package/dist/enums.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Enums = void 0;
|
|
4
|
+
var Enums;
|
|
5
|
+
(function (Enums) {
|
|
6
|
+
Enums.OrderOrientation = {
|
|
7
|
+
ASC: 'ASC',
|
|
8
|
+
DESC: 'DESC',
|
|
9
|
+
};
|
|
10
|
+
Enums.WhereClauseOp = {
|
|
11
|
+
ADJACENT: 'adjacent',
|
|
12
|
+
ANY: 'any',
|
|
13
|
+
BETWEEN: 'between',
|
|
14
|
+
COL: 'col',
|
|
15
|
+
CONTAINED: 'contained',
|
|
16
|
+
CONTAINS: 'contains',
|
|
17
|
+
ENDS_WITH: 'endsWith',
|
|
18
|
+
EQ: 'eq',
|
|
19
|
+
GT: 'gt',
|
|
20
|
+
GTE: 'gte',
|
|
21
|
+
I_LIKE: 'iLike',
|
|
22
|
+
IN: 'in',
|
|
23
|
+
I_REGEXP: 'iRegexp',
|
|
24
|
+
IS: 'is',
|
|
25
|
+
LIKE: 'like',
|
|
26
|
+
LT: 'lt',
|
|
27
|
+
LTE: 'lte',
|
|
28
|
+
MATCH: 'match',
|
|
29
|
+
NE: 'ne',
|
|
30
|
+
NO_EXTEND_LEFT: 'noExtendLeft',
|
|
31
|
+
NO_EXTEND_RIGHT: 'noExtendRight',
|
|
32
|
+
NOT: 'not',
|
|
33
|
+
NOT_BETWEEN: 'notBetween',
|
|
34
|
+
NOT_I_LIKE: 'notILike',
|
|
35
|
+
NOT_IN: 'notIn',
|
|
36
|
+
NOT_I_REGEXP: 'notIRegexp',
|
|
37
|
+
NOT_LIKE: 'notLike',
|
|
38
|
+
NOT_REGEXP: 'notRegexp',
|
|
39
|
+
OVERLAP: 'overlap',
|
|
40
|
+
PLACEHOLDER: 'placeholder',
|
|
41
|
+
REGEXP: 'regexp',
|
|
42
|
+
STARTS_WITH: 'startsWith',
|
|
43
|
+
STRICT_LEFT: 'strictLeft',
|
|
44
|
+
STRICT_RIGHT: 'strictRight',
|
|
45
|
+
SUBSTRING: 'substring',
|
|
46
|
+
VALUES: 'values',
|
|
47
|
+
};
|
|
48
|
+
Enums.LogLevel = {
|
|
49
|
+
ERROR: 'error',
|
|
50
|
+
WARN: 'warn',
|
|
51
|
+
INFO: 'info',
|
|
52
|
+
VERBOSE: 'verbose',
|
|
53
|
+
DEBUG: 'debug',
|
|
54
|
+
};
|
|
55
|
+
})(Enums || (exports.Enums = Enums = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ export * from './json-util.class';
|
|
|
5
5
|
export * from './string-util.class';
|
|
6
6
|
export * from './user-agent-util.class';
|
|
7
7
|
export * from './enum-util.class';
|
|
8
|
-
export * from './schema-util.class';
|
|
9
8
|
export * from './log-util.class';
|
|
10
9
|
export * from './crypto-util.class';
|
|
11
10
|
export * from './date-util.class';
|
|
12
11
|
export * from './url-util.class';
|
|
13
12
|
export * from './error-util.class';
|
|
13
|
+
export * from './zod';
|
|
14
|
+
export * from './schemas';
|
|
15
|
+
export * from './enums';
|
package/dist/index.js
CHANGED
|
@@ -21,9 +21,11 @@ __exportStar(require("./json-util.class"), exports);
|
|
|
21
21
|
__exportStar(require("./string-util.class"), exports);
|
|
22
22
|
__exportStar(require("./user-agent-util.class"), exports);
|
|
23
23
|
__exportStar(require("./enum-util.class"), exports);
|
|
24
|
-
__exportStar(require("./schema-util.class"), exports);
|
|
25
24
|
__exportStar(require("./log-util.class"), exports);
|
|
26
25
|
__exportStar(require("./crypto-util.class"), exports);
|
|
27
26
|
__exportStar(require("./date-util.class"), exports);
|
|
28
27
|
__exportStar(require("./url-util.class"), exports);
|
|
29
28
|
__exportStar(require("./error-util.class"), exports);
|
|
29
|
+
__exportStar(require("./zod"), exports);
|
|
30
|
+
__exportStar(require("./schemas"), exports);
|
|
31
|
+
__exportStar(require("./enums"), exports);
|
package/dist/log-util.class.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumTypes } from './enums';
|
|
2
2
|
export declare class LogUtil {
|
|
3
3
|
private readonly defaultLogLevel;
|
|
4
|
-
constructor(defaultLogLevel?:
|
|
5
|
-
match(bottomLogLevel:
|
|
6
|
-
log(level:
|
|
4
|
+
constructor(defaultLogLevel?: EnumTypes.LogLevel);
|
|
5
|
+
match(bottomLogLevel: EnumTypes.LogLevel | boolean, logLevel: EnumTypes.LogLevel): boolean;
|
|
6
|
+
log(level: EnumTypes.LogLevel, message: string | Error): void;
|
|
7
7
|
}
|