equipped 5.0.0-beta.9 → 5.0.0-rc.2
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/CHANGELOG.md +156 -0
- package/lib/bull/index.js +33 -44
- package/lib/cache/cache.d.ts +1 -0
- package/lib/cache/types/redis-cache.d.ts +1 -0
- package/lib/cache/types/redis-cache.js +8 -0
- package/lib/db/_instance.d.ts +2 -2
- package/lib/db/_instance.js +9 -25
- package/lib/db/mongoose/changes.d.ts +1 -26
- package/lib/db/mongoose/changes.js +7 -20
- package/lib/db/mongoose/index.d.ts +2 -27
- package/lib/db/mongoose/index.js +8 -24
- package/lib/db/mongoose/query.d.ts +0 -25
- package/lib/errors/customError.js +2 -0
- package/lib/errors/types/accessTokenExpired.js +1 -1
- package/lib/errors/types/badRequestError.js +1 -1
- package/lib/errors/types/notAuthenticatedError.js +1 -1
- package/lib/errors/types/notAuthorizedError.js +1 -1
- package/lib/errors/types/notFoundError.js +1 -1
- package/lib/errors/types/refreshTokenMisusedError.js +1 -1
- package/lib/errors/types/validationError.js +1 -1
- package/lib/events/index.js +1 -3
- package/lib/events/kafka.d.ts +1 -1
- package/lib/events/kafka.js +19 -25
- package/lib/events/rabbit.d.ts +1 -1
- package/lib/events/rabbit.js +9 -22
- package/lib/instance/index.d.ts +2 -1
- package/lib/instance/index.js +28 -41
- package/lib/instance/settings.d.ts +2 -2
- package/lib/instance/settings.js +4 -4
- package/lib/listeners/emitter.d.ts +6 -3
- package/lib/listeners/emitter.js +97 -109
- package/lib/scripts/json-schema.d.ts +2 -1
- package/lib/scripts/json-schema.js +29 -22
- package/lib/server/impls/base.d.ts +18 -7
- package/lib/server/impls/base.js +177 -80
- package/lib/server/impls/express.d.ts +0 -1
- package/lib/server/impls/express.js +16 -34
- package/lib/server/impls/fastify.d.ts +2 -4
- package/lib/server/impls/fastify.js +21 -39
- package/lib/server/middlewares/errorHandler.d.ts +2 -2
- package/lib/server/middlewares/notFoundHandler.d.ts +2 -2
- package/lib/server/middlewares/parseAuthUser.d.ts +2 -2
- package/lib/server/middlewares/requireAuthUser.d.ts +2 -2
- package/lib/server/middlewares/requireAuthUser.js +2 -2
- package/lib/server/middlewares/requireRefreshUser.d.ts +2 -2
- package/lib/server/middlewares/requireRefreshUser.js +2 -2
- package/lib/server/requests.d.ts +10 -7
- package/lib/server/requests.js +27 -21
- package/lib/server/routes.d.ts +4 -2
- package/lib/server/routes.js +33 -33
- package/lib/server/types.d.ts +19 -9
- package/lib/server/types.js +3 -0
- package/lib/storage/index.d.ts +0 -1
- package/lib/structure/baseEntity.js +7 -9
- package/lib/types/index.d.ts +2 -2
- package/lib/utils/auth.d.ts +5 -5
- package/lib/utils/authUser.d.ts +3 -2
- package/lib/utils/media.d.ts +0 -1
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js +9 -0
- package/lib/validations/index.d.ts +79 -85
- package/lib/validations/index.js +4 -4
- package/package.json +24 -25
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import * as Validate from 'valleyed';
|
|
2
|
+
import { ExtractI } from 'valleyed/lib/api/base';
|
|
3
|
+
import { VCore } from 'valleyed/lib/api/core';
|
|
4
|
+
import { VObject } from 'valleyed/lib/api/objects';
|
|
2
5
|
import { StorageFile } from '../storage';
|
|
3
6
|
type Phone = {
|
|
4
7
|
code: string;
|
|
5
8
|
number: string;
|
|
6
9
|
};
|
|
7
10
|
export declare const Schema: {
|
|
8
|
-
is: <T>(value: T) => Validate.VCore<T>;
|
|
9
|
-
in: <
|
|
10
|
-
or: <
|
|
11
|
+
is: <T>(value: T, comparer?: (val: any, comp: T) => boolean, err?: string) => Validate.VCore<T>;
|
|
12
|
+
in: <T>(values: Readonly<T[]>, comparer?: (val: any, arrayItem: T) => boolean, err?: string) => Validate.VCore<T>;
|
|
13
|
+
or: <T extends Validate.VCore<any>[]>(options: T, err?: string | undefined) => import("valleyed/lib/api/junctions").VOr<T>;
|
|
11
14
|
and: <I>(options: Validate.VCore<I>[], err?: string | undefined) => import("valleyed/lib/api/junctions").VAnd<I>;
|
|
12
15
|
string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
|
|
13
16
|
discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: import("valleyed/lib/api/base").ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
|
|
14
17
|
number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
|
|
15
18
|
boolean: (err?: string | undefined) => import("valleyed/lib/api/booleans").VBoolean;
|
|
16
|
-
time: <
|
|
19
|
+
time: <T extends import("valleyed/lib/api/times").Timeable = import("valleyed/lib/api/times").Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T>;
|
|
17
20
|
file: (err?: string | undefined) => import("valleyed/lib/api/files").VFile;
|
|
18
|
-
array: <
|
|
19
|
-
tuple: <
|
|
20
|
-
object: <
|
|
21
|
+
array: <I>(comparer: Validate.VCore<I>, err?: string | undefined) => import("valleyed/lib/api/arrays").VArray<I>;
|
|
22
|
+
tuple: <T extends ReadonlyArray<Validate.VCore<any>>>(schema: readonly [...T], err?: string | undefined) => import("valleyed/lib/api/tuples").VTuple<T>;
|
|
23
|
+
object: <T extends Record<string, Validate.VCore<any>>>(schema: T, trim?: boolean | undefined, err?: string | undefined) => VObject<T>;
|
|
21
24
|
record: <VI>(vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VRecord<VI>;
|
|
22
|
-
map: <KI,
|
|
23
|
-
null: (err?: string
|
|
24
|
-
undefined: (err?: string
|
|
25
|
-
instanceof: <
|
|
26
|
-
any: <
|
|
25
|
+
map: <KI, VI>(kCom: Validate.VCore<KI>, vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VMap<KI, VI>;
|
|
26
|
+
null: (err?: string) => Validate.VCore<null>;
|
|
27
|
+
undefined: (err?: string) => Validate.VCore<undefined>;
|
|
28
|
+
instanceof: <T>(classDef: new () => T, err?: string) => Validate.VCore<T>;
|
|
29
|
+
any: <T = any>() => Validate.VCore<T>;
|
|
27
30
|
force: {
|
|
28
31
|
string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
|
|
29
32
|
number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
|
|
@@ -37,25 +40,25 @@ export declare const Validation: {
|
|
|
37
40
|
Validator: typeof Validate.Validator;
|
|
38
41
|
VCore: typeof Validate.VCore;
|
|
39
42
|
v: {
|
|
40
|
-
is: <T>(value: T) => Validate.VCore<T>;
|
|
41
|
-
in: <
|
|
42
|
-
or: <
|
|
43
|
+
is: <T>(value: T, comparer?: (val: any, comp: T) => boolean, err?: string) => Validate.VCore<T>;
|
|
44
|
+
in: <T>(values: Readonly<T[]>, comparer?: (val: any, arrayItem: T) => boolean, err?: string) => Validate.VCore<T>;
|
|
45
|
+
or: <T extends Validate.VCore<any>[]>(options: T, err?: string | undefined) => import("valleyed/lib/api/junctions").VOr<T>;
|
|
43
46
|
and: <I>(options: Validate.VCore<I>[], err?: string | undefined) => import("valleyed/lib/api/junctions").VAnd<I>;
|
|
44
47
|
string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
|
|
45
48
|
discriminate: <D extends Record<string, Validate.VCore<any>>>(discriminator: (val: import("valleyed/lib/api/base").ExtractI<D[keyof D]>) => string, schemas: D, err?: string | undefined) => import("valleyed/lib/api/junctions").VDiscriminator<D>;
|
|
46
49
|
number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
|
|
47
50
|
boolean: (err?: string | undefined) => import("valleyed/lib/api/booleans").VBoolean;
|
|
48
|
-
time: <
|
|
51
|
+
time: <T extends import("valleyed/lib/api/times").Timeable = import("valleyed/lib/api/times").Timeable>(err?: string | undefined) => import("valleyed/lib/api/times").VTime<T>;
|
|
49
52
|
file: (err?: string | undefined) => import("valleyed/lib/api/files").VFile;
|
|
50
|
-
array: <
|
|
51
|
-
tuple: <
|
|
52
|
-
object: <
|
|
53
|
+
array: <I>(comparer: Validate.VCore<I>, err?: string | undefined) => import("valleyed/lib/api/arrays").VArray<I>;
|
|
54
|
+
tuple: <T extends ReadonlyArray<Validate.VCore<any>>>(schema: readonly [...T], err?: string | undefined) => import("valleyed/lib/api/tuples").VTuple<T>;
|
|
55
|
+
object: <T extends Record<string, Validate.VCore<any>>>(schema: T, trim?: boolean | undefined, err?: string | undefined) => VObject<T>;
|
|
53
56
|
record: <VI>(vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VRecord<VI>;
|
|
54
|
-
map: <KI,
|
|
55
|
-
null: (err?: string
|
|
56
|
-
undefined: (err?: string
|
|
57
|
-
instanceof: <
|
|
58
|
-
any: <
|
|
57
|
+
map: <KI, VI>(kCom: Validate.VCore<KI>, vCom: Validate.VCore<VI>, err?: string | undefined) => import("valleyed/lib/api/records").VMap<KI, VI>;
|
|
58
|
+
null: (err?: string) => Validate.VCore<null>;
|
|
59
|
+
undefined: (err?: string) => Validate.VCore<undefined>;
|
|
60
|
+
instanceof: <T>(classDef: new () => T, err?: string) => Validate.VCore<T>;
|
|
61
|
+
any: <T = any>() => Validate.VCore<T>;
|
|
59
62
|
force: {
|
|
60
63
|
string: (err?: string | undefined) => import("valleyed/lib/api/strings").VString;
|
|
61
64
|
number: (err?: string | undefined) => import("valleyed/lib/api/numbers").VNumber;
|
|
@@ -63,48 +66,47 @@ export declare const Validation: {
|
|
|
63
66
|
time: (err?: string | undefined) => import("valleyed/lib/api/times").VTime<Date>;
|
|
64
67
|
};
|
|
65
68
|
};
|
|
66
|
-
isEqualTo: <Type>(compare: Type, comparer?: (
|
|
67
|
-
isNotEqualTo: <Compare,
|
|
68
|
-
arrayContains: <
|
|
69
|
-
arrayNotContains: <
|
|
70
|
-
isString: (error?: string
|
|
71
|
-
isLengthOf: (length: number, stripHTMLTags?: boolean
|
|
72
|
-
isMinOf: (length: number, stripHTMLTags?: boolean
|
|
73
|
-
isMaxOf: (length: number, stripHTMLTags?: boolean
|
|
74
|
-
isEmail: (error?: string
|
|
75
|
-
isUrl: (error?: string
|
|
76
|
-
isNumber: (error?: string
|
|
77
|
-
isInt: (error?: string
|
|
78
|
-
isMoreThan: (compare: number, error?: string
|
|
79
|
-
isMoreThanOrEqualTo: (compare: number, error?: string
|
|
80
|
-
isLessThan: (compare: number, error?: string
|
|
81
|
-
isLessThanOrEqualTo: (compare: number, error?: string
|
|
82
|
-
isArray: (error?: string
|
|
83
|
-
hasLengthOf: <
|
|
84
|
-
hasMinOf: <
|
|
85
|
-
hasMaxOf: <
|
|
86
|
-
isArrayOf: <
|
|
87
|
-
isUndefined: (error?: string
|
|
88
|
-
isNull: (error?: string
|
|
89
|
-
isBoolean: (error?: string
|
|
90
|
-
isInstanceOf: <T>(classDef: new () => T, error?: string
|
|
69
|
+
isEqualTo: <Type>(compare: Type, comparer?: (val: any, compare: Type) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
|
|
70
|
+
isNotEqualTo: <Compare, Type>(compare: Compare, comparer?: (val: Type, compare: Compare) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
|
|
71
|
+
arrayContains: <Type>(array: Readonly<Type[]>, comparer?: (val: any, arrayItem: Type) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
|
|
72
|
+
arrayNotContains: <Compare, Type>(array: Readonly<Compare[]>, comparer?: (val: Type, arrayItem: Compare) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type>;
|
|
73
|
+
isString: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
|
|
74
|
+
isLengthOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
|
|
75
|
+
isMinOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
|
|
76
|
+
isMaxOf: (length: number, stripHTMLTags?: boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
|
|
77
|
+
isEmail: (error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
|
|
78
|
+
isUrl: (error?: string) => import("valleyed/lib/utils/rules").Rule<string>;
|
|
79
|
+
isNumber: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
|
|
80
|
+
isInt: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
|
|
81
|
+
isMoreThan: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
|
|
82
|
+
isMoreThanOrEqualTo: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
|
|
83
|
+
isLessThan: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
|
|
84
|
+
isLessThanOrEqualTo: (compare: number, error?: string) => import("valleyed/lib/utils/rules").Rule<number>;
|
|
85
|
+
isArray: (error?: string) => import("valleyed/lib/utils/rules").Rule<any>;
|
|
86
|
+
hasLengthOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
|
|
87
|
+
hasMinOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
|
|
88
|
+
hasMaxOf: <Type>(length: number, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
|
|
89
|
+
isArrayOf: <Type>(comparer: (cur: Type, idx: number) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Type[]>;
|
|
90
|
+
isUndefined: (error?: string) => import("valleyed/lib/utils/rules").Rule<undefined>;
|
|
91
|
+
isNull: (error?: string) => import("valleyed/lib/utils/rules").Rule<null>;
|
|
92
|
+
isBoolean: (error?: string) => import("valleyed/lib/utils/rules").Rule<boolean>;
|
|
93
|
+
isInstanceOf: <T>(classDef: new () => T, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
|
|
91
94
|
fileMimeTypes: string[];
|
|
92
95
|
videoMimeTypes: string[];
|
|
93
96
|
audioMimeTypes: string[];
|
|
94
97
|
imageMimeTypes: string[];
|
|
95
|
-
isImage: (error?: string
|
|
96
|
-
isAudio: (error?: string
|
|
97
|
-
isVideo: (error?: string
|
|
98
|
-
isFile: (error?: string
|
|
99
|
-
isTuple: <
|
|
100
|
-
isRecord: <
|
|
101
|
-
isMap: <
|
|
102
|
-
isCustom: <
|
|
103
|
-
isTime: <
|
|
104
|
-
isLaterThan: <
|
|
105
|
-
isEarlierThan: <
|
|
98
|
+
isImage: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
|
|
99
|
+
isAudio: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
|
|
100
|
+
isVideo: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
|
|
101
|
+
isFile: (error?: string) => import("valleyed/lib/utils/rules").Rule<import("valleyed/lib/types").File>;
|
|
102
|
+
isTuple: <T extends ReadonlyArray<(v: any, idx: number) => boolean>>(comparer: Validate.GetMap<T>, error?: string) => import("valleyed/lib/utils/rules").Rule<{ [K in keyof T]: T[K] extends (v: infer V, idx: number) => boolean ? V : never; }>;
|
|
103
|
+
isRecord: <V>(com: (cur: V) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Record<string, V>>;
|
|
104
|
+
isMap: <K, V>(kCom: (cur: K) => boolean, vCom: (cur: V) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<Map<K, V>>;
|
|
105
|
+
isCustom: <T>(validity: (v: T) => boolean, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
|
|
106
|
+
isTime: <T extends Validate.Timeable>(error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
|
|
107
|
+
isLaterThan: <T extends Validate.Timeable>(compare: Validate.Timeable, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
|
|
108
|
+
isEarlierThan: <T extends Validate.Timeable>(compare: Validate.Timeable, error?: string) => import("valleyed/lib/utils/rules").Rule<T>;
|
|
106
109
|
ClassPropertiesWrapper: typeof Validate.ClassPropertiesWrapper;
|
|
107
|
-
A: typeof Validate.A;
|
|
108
110
|
Differ: typeof Validate.Differ;
|
|
109
111
|
capitalize: (text: string) => string;
|
|
110
112
|
stripHTML: (html: string) => string;
|
|
@@ -113,48 +115,40 @@ export declare const Validation: {
|
|
|
113
115
|
original: string;
|
|
114
116
|
normalized: string;
|
|
115
117
|
}[];
|
|
116
|
-
formatNumber: (num: number, dp?: number
|
|
118
|
+
formatNumber: (num: number, dp?: number) => string;
|
|
117
119
|
pluralize: (count: number, singular: string, plural: string) => string;
|
|
118
120
|
getRandomValue: () => string;
|
|
119
|
-
groupBy: <
|
|
121
|
+
groupBy: <Type, Unique extends string | number>(array: Array<Type>, func: (item: Type) => Unique) => {
|
|
120
122
|
key: Unique;
|
|
121
|
-
values:
|
|
123
|
+
values: Type[];
|
|
122
124
|
}[];
|
|
123
125
|
getAlphabet: (num: number) => string;
|
|
124
|
-
addToArray: <
|
|
126
|
+
addToArray: <T>(array: T[], item: T, getKey: (a: T) => any, getComparer: (a: T) => number | string, asc?: boolean) => T[];
|
|
125
127
|
divideByZero: (num: number, den: number) => number;
|
|
126
128
|
getPercentage: (num: number, den: number) => number;
|
|
127
|
-
getRandomSample: <
|
|
128
|
-
shuffleArray: <
|
|
129
|
-
chunkArray: <
|
|
129
|
+
getRandomSample: <Type>(population: Array<Type>, n: number) => Type[];
|
|
130
|
+
shuffleArray: <Type>(array: Array<Type>) => Type[];
|
|
131
|
+
chunkArray: <T>(arr: T[], size: number) => T[][];
|
|
132
|
+
wrapInTryCatch: <T>(fn: () => T, defaultValue?: T) => T | undefined;
|
|
130
133
|
Geohash: typeof Validate.Geohash;
|
|
131
|
-
isValid: <
|
|
134
|
+
isValid: <T>(value: T, ignored?: boolean) => {
|
|
132
135
|
valid: true;
|
|
133
136
|
errors: string[];
|
|
134
|
-
value:
|
|
137
|
+
value: T;
|
|
135
138
|
ignored: boolean;
|
|
136
139
|
};
|
|
137
|
-
isInvalid: <
|
|
140
|
+
isInvalid: <T>(errors: string[], value: T) => {
|
|
138
141
|
valid: false;
|
|
139
142
|
errors: string[];
|
|
140
143
|
value: unknown;
|
|
141
144
|
ignored: boolean;
|
|
142
145
|
};
|
|
143
|
-
makeRule: <
|
|
144
|
-
makeSanitizer: <
|
|
145
|
-
check: <
|
|
146
|
-
valid: false;
|
|
147
|
-
errors: string[];
|
|
148
|
-
value: unknown;
|
|
149
|
-
ignored: boolean;
|
|
150
|
-
} | {
|
|
151
|
-
valid: true;
|
|
152
|
-
errors: string[];
|
|
153
|
-
value: T_18;
|
|
154
|
-
ignored: boolean;
|
|
155
|
-
};
|
|
146
|
+
makeRule: <T>(func: Validate.Rule<T>) => Validate.Rule<T>;
|
|
147
|
+
makeSanitizer: <T>(func: Validate.Sanitizer<T>) => (val: T) => T;
|
|
148
|
+
check: <T>(value: T, rules: Validate.Rule<T>[], options?: Partial<Validate.Options>) => ReturnType<Validate.Rule<T>>;
|
|
156
149
|
};
|
|
157
|
-
export declare
|
|
150
|
+
export declare function validate<T extends Record<string, VCore<any>>>(schema: T, value: unknown): ExtractI<VObject<T>>;
|
|
151
|
+
export declare function validate<T extends VCore<any>>(schema: T, value: unknown): ExtractI<T>;
|
|
158
152
|
export declare const Hash: {
|
|
159
153
|
hash: (password: string) => Promise<string>;
|
|
160
154
|
compare: (plainPassword: string, hashed: string) => Promise<boolean>;
|
package/lib/validations/index.js
CHANGED
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Hash = exports.
|
|
26
|
+
exports.Hash = exports.Validation = exports.Schema = void 0;
|
|
27
|
+
exports.validate = validate;
|
|
27
28
|
const bcrypt = __importStar(require("bcryptjs"));
|
|
28
29
|
const Validate = __importStar(require("valleyed"));
|
|
29
30
|
const errors_1 = require("../errors");
|
|
@@ -47,7 +48,7 @@ const file = Validate.v.file;
|
|
|
47
48
|
Validate.v.file = (...args) => file(...args).addRule(isNotTruncated());
|
|
48
49
|
exports.Schema = Validate.v;
|
|
49
50
|
exports.Validation = { ...Validate, isNotTruncated, isValidPhone };
|
|
50
|
-
|
|
51
|
+
function validate(schema, value) {
|
|
51
52
|
const validator = schema instanceof Validate.VCore ? schema : Validate.v.object(schema);
|
|
52
53
|
const validity = validator.parse(value);
|
|
53
54
|
if (validity.valid)
|
|
@@ -66,8 +67,7 @@ const validate = (schema, value) => {
|
|
|
66
67
|
}), {});
|
|
67
68
|
throw new errors_1.ValidationError(Object.entries(errorsObject)
|
|
68
69
|
.map(([key, value]) => ({ field: key, messages: value })));
|
|
69
|
-
}
|
|
70
|
-
exports.validate = validate;
|
|
70
|
+
}
|
|
71
71
|
const hash = async (password) => {
|
|
72
72
|
password = password.trim();
|
|
73
73
|
if (!password)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "equipped",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@commitlint/cli": "^19.3.0",
|
|
20
20
|
"@commitlint/config-conventional": "^19.2.2",
|
|
21
|
-
"@stylistic/eslint-plugin": "^2.
|
|
21
|
+
"@stylistic/eslint-plugin": "^2.4.0",
|
|
22
22
|
"@types/amqplib": "^0.10.5",
|
|
23
23
|
"@types/bcryptjs": "^2.4.6",
|
|
24
24
|
"@types/bull": "^3.15.9",
|
|
@@ -26,63 +26,62 @@
|
|
|
26
26
|
"@types/express": "^4.17.21",
|
|
27
27
|
"@types/express-fileupload": "^1.5.0",
|
|
28
28
|
"@types/jsonwebtoken": "^9.0.6",
|
|
29
|
-
"@types/node": "^
|
|
29
|
+
"@types/node": "^22.0.0",
|
|
30
30
|
"@types/pug": "^2.0.10",
|
|
31
31
|
"@types/supertest": "^6.0.2",
|
|
32
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
33
|
-
"@typescript-eslint/parser": "^7.
|
|
34
|
-
"eslint": "^9.
|
|
35
|
-
"eslint-plugin-promise": "^
|
|
36
|
-
"husky": "^9.
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
33
|
+
"@typescript-eslint/parser": "^7.18.0",
|
|
34
|
+
"eslint": "^9.8.0",
|
|
35
|
+
"eslint-plugin-promise": "^7.0.0",
|
|
36
|
+
"husky": "^9.1.4",
|
|
37
37
|
"standard-version": "^9.5.0",
|
|
38
|
-
"typescript": "^5.4
|
|
38
|
+
"typescript": "^5.5.4"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@fastify/cookie": "^9.3.1",
|
|
42
42
|
"@fastify/cors": "^9.0.1",
|
|
43
43
|
"@fastify/formbody": "^7.4.0",
|
|
44
44
|
"@fastify/helmet": "^11.1.1",
|
|
45
|
-
"@fastify/multipart": "^8.
|
|
45
|
+
"@fastify/multipart": "^8.3.0",
|
|
46
46
|
"@fastify/rate-limit": "^9.1.0",
|
|
47
47
|
"@fastify/static": "^7.0.4",
|
|
48
|
-
"@fastify/swagger": "^8.
|
|
49
|
-
"@
|
|
50
|
-
"@wesleytodd/openapi": "^1.0.0",
|
|
48
|
+
"@fastify/swagger": "^8.15.0",
|
|
49
|
+
"@wesleytodd/openapi": "^1.1.0",
|
|
51
50
|
"amqp-connection-manager": "^4.1.14",
|
|
52
51
|
"amqplib": "^0.10.4",
|
|
53
52
|
"axios": "^1.7.2",
|
|
54
53
|
"bcryptjs": "^2.4.3",
|
|
55
|
-
"bull": "^4.
|
|
54
|
+
"bull": "^4.16.0",
|
|
56
55
|
"cookie-parser": "^1.4.6",
|
|
57
56
|
"cors": "^2.8.5",
|
|
58
57
|
"dotenv": "^16.4.5",
|
|
59
58
|
"express": "^4.19.2",
|
|
60
|
-
"express-fileupload": "^1.5.
|
|
61
|
-
"express-rate-limit": "^7.
|
|
59
|
+
"express-fileupload": "^1.5.1",
|
|
60
|
+
"express-rate-limit": "^7.4.0",
|
|
62
61
|
"express-slow-down": "^2.0.3",
|
|
63
|
-
"fastify": "^4.
|
|
62
|
+
"fastify": "^4.28.1",
|
|
64
63
|
"fastify-slow-down": "^1.2.2",
|
|
65
64
|
"helmet": "^7.1.0",
|
|
66
65
|
"json-schema-resolver": "^2.0.0",
|
|
67
66
|
"jsonwebtoken": "^9.0.2",
|
|
68
67
|
"jwks-rsa": "^3.1.0",
|
|
69
68
|
"kafkajs": "^2.2.4",
|
|
70
|
-
"mongoose": "^8.
|
|
69
|
+
"mongoose": "^8.5.2",
|
|
71
70
|
"mongoose-lean-defaults": "^2.2.1",
|
|
72
71
|
"mongoose-lean-getters": "^2.1.0",
|
|
73
72
|
"mongoose-lean-virtuals": "^0.9.1",
|
|
74
73
|
"music-metadata": "^7.14.0",
|
|
75
74
|
"openapi-types": "^12.1.3",
|
|
76
|
-
"path-to-regexp": "^
|
|
77
|
-
"pino": "^9.
|
|
78
|
-
"pino-http": "^10.
|
|
75
|
+
"path-to-regexp": "^7.1.0",
|
|
76
|
+
"pino": "^9.3.2",
|
|
77
|
+
"pino-http": "^10.2.0",
|
|
79
78
|
"pug": "^3.0.3",
|
|
80
|
-
"qs": "^6.12.
|
|
81
|
-
"redis": "^4.
|
|
79
|
+
"qs": "^6.12.3",
|
|
80
|
+
"redis": "^4.7.0",
|
|
82
81
|
"socket.io": "4.7.5",
|
|
83
82
|
"supertest": "^7.0.0",
|
|
84
|
-
"ts-oas": "^0.4.
|
|
85
|
-
"valleyed": "4.
|
|
83
|
+
"ts-oas": "^0.4.4",
|
|
84
|
+
"valleyed": "4.3.1"
|
|
86
85
|
},
|
|
87
86
|
"repository": {
|
|
88
87
|
"url": "git://github.com/kevinand11/equipped.git"
|