@midwayjs/validate 3.0.0-beta.12 → 3.0.0-beta.16
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/error.d.ts +1 -7
- package/dist/error.js +1 -15
- package/dist/service.d.ts +14 -7
- package/dist/service.js +28 -5
- package/package.json +8 -8
- package/CHANGELOG.md +0 -558
- package/dist/util.d.ts +0 -5
- package/dist/util.js +0 -63
package/dist/error.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MidwayHttpError } from '@midwayjs/core';
|
|
2
2
|
export declare class MidwayValidationError extends MidwayHttpError {
|
|
3
3
|
constructor(message: any, status: any, cause: any);
|
|
4
4
|
}
|
|
5
|
-
export declare class ValidationPropertyMissingError extends MidwayError {
|
|
6
|
-
constructor(key: any);
|
|
7
|
-
}
|
|
8
|
-
export declare class ValidationNotMethodPropertyError extends MidwayError {
|
|
9
|
-
constructor(key: any);
|
|
10
|
-
}
|
|
11
5
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/error.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MidwayValidationError = void 0;
|
|
4
4
|
const core_1 = require("@midwayjs/core");
|
|
5
5
|
const ValidateErrorCode = (0, core_1.registerErrorCode)('validate', {
|
|
6
6
|
VALIDATE_FAIL: 10000,
|
|
7
|
-
PROPERTY_MISSING: 10001,
|
|
8
|
-
NOT_METHOD_PROPERTY: 10002,
|
|
9
7
|
});
|
|
10
8
|
class MidwayValidationError extends core_1.MidwayHttpError {
|
|
11
9
|
constructor(message, status, cause) {
|
|
@@ -15,16 +13,4 @@ class MidwayValidationError extends core_1.MidwayHttpError {
|
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
exports.MidwayValidationError = MidwayValidationError;
|
|
18
|
-
class ValidationPropertyMissingError extends core_1.MidwayError {
|
|
19
|
-
constructor(key) {
|
|
20
|
-
super(`Cannot find property of "${key}"`, ValidateErrorCode.PROPERTY_MISSING);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.ValidationPropertyMissingError = ValidationPropertyMissingError;
|
|
24
|
-
class ValidationNotMethodPropertyError extends core_1.MidwayError {
|
|
25
|
-
constructor(key) {
|
|
26
|
-
super(`"${key}" is not a method property!`, ValidateErrorCode.NOT_METHOD_PROPERTY);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.ValidationNotMethodPropertyError = ValidationNotMethodPropertyError;
|
|
30
16
|
//# sourceMappingURL=error.js.map
|
package/dist/service.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import * as DefaultConfig from './config/config.default';
|
|
2
2
|
import * as Joi from 'joi';
|
|
3
3
|
import { MidwayI18nServiceSingleton } from '@midwayjs/i18n';
|
|
4
|
+
import { ObjectSchema } from 'joi';
|
|
4
5
|
export declare class ValidateService {
|
|
5
|
-
validateConfig: typeof DefaultConfig.validate;
|
|
6
|
-
i18nConfig: any;
|
|
7
|
-
i18nService: MidwayI18nServiceSingleton;
|
|
8
|
-
messages: {};
|
|
9
|
-
init(): Promise<void>;
|
|
10
|
-
validate
|
|
6
|
+
protected validateConfig: typeof DefaultConfig.validate;
|
|
7
|
+
protected i18nConfig: any;
|
|
8
|
+
protected i18nService: MidwayI18nServiceSingleton;
|
|
9
|
+
protected messages: {};
|
|
10
|
+
protected init(): Promise<void>;
|
|
11
|
+
validate<T extends new (...args: any[]) => any>(ClzType: T, value: any, options?: {
|
|
11
12
|
errorStatus?: number;
|
|
12
13
|
locale?: string;
|
|
13
14
|
validationOptions?: Joi.ValidationOptions;
|
|
14
|
-
}): Joi.ValidationResult<
|
|
15
|
+
}): Joi.ValidationResult<T>;
|
|
16
|
+
validateWithSchema<T>(schema: ObjectSchema<any>, value: any, options?: {
|
|
17
|
+
errorStatus?: number;
|
|
18
|
+
locale?: string;
|
|
19
|
+
validationOptions?: Joi.ValidationOptions;
|
|
20
|
+
}): Joi.ValidationResult<T>;
|
|
21
|
+
getSchema<T extends new (...args: any[]) => any>(ClzType: T): ObjectSchema<any>;
|
|
15
22
|
}
|
|
16
23
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.js
CHANGED
|
@@ -26,8 +26,8 @@ let ValidateService = class ValidateService {
|
|
|
26
26
|
this.messages[(0, i18n_1.formatLocale)(locale)] = Object.fromEntries(this.i18nService.getLocaleMapping(locale, 'validate'));
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
|
-
validate(ClzType, value, options) {
|
|
30
|
-
var _a, _b;
|
|
29
|
+
validate(ClzType, value, options = {}) {
|
|
30
|
+
var _a, _b, _c;
|
|
31
31
|
options.validationOptions = options.validationOptions || {};
|
|
32
32
|
options.validationOptions.errors = options.validationOptions.errors || {};
|
|
33
33
|
options.validationOptions.errors.language = (0, i18n_1.formatLocale)(this.i18nService.getAvailableLocale(options.validationOptions.errors.language ||
|
|
@@ -36,17 +36,40 @@ let ValidateService = class ValidateService {
|
|
|
36
36
|
const rules = (0, decorator_1.getClassExtendedMetadata)(constants_1.RULES_KEY, ClzType);
|
|
37
37
|
if (rules) {
|
|
38
38
|
const schema = Joi.object(rules);
|
|
39
|
-
const result = schema.validate(value, Object.assign(this.validateConfig.validationOptions, {
|
|
39
|
+
const result = schema.validate(value, Object.assign((_a = this.validateConfig.validationOptions) !== null && _a !== void 0 ? _a : {}, {
|
|
40
40
|
messages: this.messages,
|
|
41
|
-
}, (
|
|
41
|
+
}, (_b = options.validationOptions) !== null && _b !== void 0 ? _b : {}));
|
|
42
42
|
if (result.error) {
|
|
43
|
-
throw new error_1.MidwayValidationError(result.error.message, (
|
|
43
|
+
throw new error_1.MidwayValidationError(result.error.message, (_c = options === null || options === void 0 ? void 0 : options.errorStatus) !== null && _c !== void 0 ? _c : this.validateConfig.errorStatus, result.error);
|
|
44
44
|
}
|
|
45
45
|
else {
|
|
46
46
|
return result;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
+
validateWithSchema(schema, value, options = {}) {
|
|
51
|
+
var _a, _b, _c;
|
|
52
|
+
options.validationOptions = options.validationOptions || {};
|
|
53
|
+
options.validationOptions.errors = options.validationOptions.errors || {};
|
|
54
|
+
options.validationOptions.errors.language = (0, i18n_1.formatLocale)(this.i18nService.getAvailableLocale(options.validationOptions.errors.language ||
|
|
55
|
+
options.locale ||
|
|
56
|
+
this.i18nConfig.defaultLocale, 'validate'));
|
|
57
|
+
const result = schema.validate(value, Object.assign((_a = this.validateConfig.validationOptions) !== null && _a !== void 0 ? _a : {}, {
|
|
58
|
+
messages: this.messages,
|
|
59
|
+
}, (_b = options.validationOptions) !== null && _b !== void 0 ? _b : {}));
|
|
60
|
+
if (result.error) {
|
|
61
|
+
throw new error_1.MidwayValidationError(result.error.message, (_c = options === null || options === void 0 ? void 0 : options.errorStatus) !== null && _c !== void 0 ? _c : this.validateConfig.errorStatus, result.error);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
getSchema(ClzType) {
|
|
68
|
+
const rules = (0, decorator_1.getClassExtendedMetadata)(constants_1.RULES_KEY, ClzType);
|
|
69
|
+
if (rules) {
|
|
70
|
+
return Joi.object(rules);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
50
73
|
};
|
|
51
74
|
__decorate([
|
|
52
75
|
(0, decorator_1.Config)('validate'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/validate",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "Midway Component for mongoose",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@midwayjs/i18n": "^3.0.0-beta.
|
|
26
|
+
"@midwayjs/i18n": "^3.0.0-beta.16",
|
|
27
27
|
"joi": "^17.2.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@midwayjs/core": "^3.0.0-beta.
|
|
31
|
-
"@midwayjs/decorator": "^3.0.0-beta.
|
|
32
|
-
"@midwayjs/express": "^3.0.0-beta.
|
|
33
|
-
"@midwayjs/koa": "^3.0.0-beta.
|
|
34
|
-
"@midwayjs/mock": "^3.0.0-beta.
|
|
30
|
+
"@midwayjs/core": "^3.0.0-beta.16",
|
|
31
|
+
"@midwayjs/decorator": "^3.0.0-beta.16",
|
|
32
|
+
"@midwayjs/express": "^3.0.0-beta.16",
|
|
33
|
+
"@midwayjs/koa": "^3.0.0-beta.16",
|
|
34
|
+
"@midwayjs/mock": "^3.0.0-beta.16"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "43a32745ac45164dfef1494cba979f9652a6692b"
|
|
37
37
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,558 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
# [3.0.0-beta.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Features
|
|
10
|
-
|
|
11
|
-
* custom error code & add @Files/@Fields ([#1438](https://github.com/midwayjs/midway/issues/1438)) ([b0032af](https://github.com/midwayjs/midway/commit/b0032afd2fa9ea0416fe69f4bd0c1a58bea5314e))
|
|
12
|
-
* support throw err status ([#1440](https://github.com/midwayjs/midway/issues/1440)) ([7b98110](https://github.com/midwayjs/midway/commit/7b98110d65c5287a8fcb3eb5356dea2d7a32cee9))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# [3.0.0-beta.11](https://github.com/midwayjs/midway/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-12-21)
|
|
19
|
-
|
|
20
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Features
|
|
30
|
-
|
|
31
|
-
* implement i18n for validate ([#1426](https://github.com/midwayjs/midway/issues/1426)) ([4c7ed2f](https://github.com/midwayjs/midway/commit/4c7ed2ff2e7ccf10f88f62abad230f92f5e76b97))
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
|
|
38
|
-
|
|
39
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
# [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
|
|
46
|
-
|
|
47
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# [3.0.0-beta.7](https://github.com/midwayjs/midway/compare/v3.0.0-beta.6...v3.0.0-beta.7) (2021-12-03)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
### Bug Fixes
|
|
57
|
-
|
|
58
|
-
* validate typing and config ([#1388](https://github.com/midwayjs/midway/issues/1388)) ([0883569](https://github.com/midwayjs/midway/commit/08835691942183e972359cbaa076db06b6bf85ef))
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# [3.0.0-beta.6](https://github.com/midwayjs/midway/compare/v3.0.0-beta.5...v3.0.0-beta.6) (2021-11-26)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* class transformer method missing ([#1387](https://github.com/midwayjs/midway/issues/1387)) ([074e839](https://github.com/midwayjs/midway/commit/074e8393598dc95e2742f735df75a2191c5fe25d))
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
# [3.0.0-beta.5](https://github.com/midwayjs/midway/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2021-11-25)
|
|
76
|
-
|
|
77
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
# [3.0.0-beta.4](https://github.com/midwayjs/midway/compare/v3.0.0-beta.3...v3.0.0-beta.4) (2021-11-24)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Features
|
|
87
|
-
|
|
88
|
-
* add i18n ([#1375](https://github.com/midwayjs/midway/issues/1375)) ([bffefe0](https://github.com/midwayjs/midway/commit/bffefe07afe45777d49b5a76b9ab17fc2b9d9a55))
|
|
89
|
-
* auto transform args to type ([#1372](https://github.com/midwayjs/midway/issues/1372)) ([bb3f7d2](https://github.com/midwayjs/midway/commit/bb3f7d2028a034e1926d9df554849332354c3762))
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# [3.0.0-beta.3](https://github.com/midwayjs/midway/compare/v3.0.0-beta.2...v3.0.0-beta.3) (2021-11-18)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### Features
|
|
99
|
-
|
|
100
|
-
* add component and framework config definition ([#1367](https://github.com/midwayjs/midway/issues/1367)) ([b2fe615](https://github.com/midwayjs/midway/commit/b2fe6157f99659471ff1333eca0b86bb889f61a3))
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# [3.0.0-beta.2](https://github.com/midwayjs/midway/compare/v3.0.0-beta.1...v3.0.0-beta.2) (2021-11-16)
|
|
107
|
-
|
|
108
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# [3.0.0-beta.1](https://github.com/midwayjs/midway/compare/v2.12.4...v3.0.0-beta.1) (2021-11-14)
|
|
115
|
-
|
|
116
|
-
**Note:** Version bump only for package @midwayjs/validate
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## [2.13.3](https://github.com/midwayjs/midway/compare/v2.13.2...v2.13.3) (2021-09-28)
|
|
123
|
-
|
|
124
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
## [2.13.2](https://github.com/midwayjs/midway/compare/v2.13.1...v2.13.2) (2021-09-09)
|
|
131
|
-
|
|
132
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
## [2.13.1](https://github.com/midwayjs/midway/compare/v2.13.0...v2.13.1) (2021-09-08)
|
|
139
|
-
|
|
140
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
# [2.13.0](https://github.com/midwayjs/midway/compare/v2.12.9...v2.13.0) (2021-09-07)
|
|
147
|
-
|
|
148
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
## [2.12.9](https://github.com/midwayjs/midway/compare/v2.12.8...v2.12.9) (2021-09-01)
|
|
155
|
-
|
|
156
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
## [2.12.7](https://github.com/midwayjs/midway/compare/v2.12.6...v2.12.7) (2021-08-22)
|
|
163
|
-
|
|
164
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
## [2.12.5](https://github.com/midwayjs/midway/compare/v2.12.4...v2.12.5) (2021-08-18)
|
|
171
|
-
|
|
172
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
## [2.12.3](https://github.com/midwayjs/midway/compare/v2.12.2...v2.12.3) (2021-08-09)
|
|
179
|
-
|
|
180
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
## [2.12.1](https://github.com/midwayjs/midway/compare/v2.12.0...v2.12.1) (2021-08-01)
|
|
187
|
-
|
|
188
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
# [2.12.0](https://github.com/midwayjs/midway/compare/v2.11.7...v2.12.0) (2021-07-30)
|
|
195
|
-
|
|
196
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
## [2.11.6](https://github.com/midwayjs/midway/compare/v2.11.5...v2.11.6) (2021-07-16)
|
|
203
|
-
|
|
204
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
## [2.11.5](https://github.com/midwayjs/midway/compare/v2.11.4...v2.11.5) (2021-07-15)
|
|
211
|
-
|
|
212
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
## [2.11.4](https://github.com/midwayjs/midway/compare/v2.11.3...v2.11.4) (2021-07-06)
|
|
219
|
-
|
|
220
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
## [2.11.3](https://github.com/midwayjs/midway/compare/v2.11.2...v2.11.3) (2021-07-02)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
### Bug Fixes
|
|
230
|
-
|
|
231
|
-
* hide real error when user code throw error ([#1128](https://github.com/midwayjs/midway/issues/1128)) ([e728b0b](https://github.com/midwayjs/midway/commit/e728b0b80956c09cfb856ffe082f44fa29cfeb82))
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
## [2.11.2](https://github.com/midwayjs/midway/compare/v2.11.1...v2.11.2) (2021-06-28)
|
|
238
|
-
|
|
239
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
## [2.11.1](https://github.com/midwayjs/midway/compare/v2.11.0...v2.11.1) (2021-06-19)
|
|
246
|
-
|
|
247
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
# [2.11.0](https://github.com/midwayjs/midway/compare/v2.10.19...v2.11.0) (2021-06-10)
|
|
254
|
-
|
|
255
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
## [2.10.18](https://github.com/midwayjs/midway/compare/v2.10.17...v2.10.18) (2021-05-26)
|
|
262
|
-
|
|
263
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
## [2.10.14](https://github.com/midwayjs/midway/compare/v2.10.13...v2.10.14) (2021-05-11)
|
|
270
|
-
|
|
271
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
## [2.10.13](https://github.com/midwayjs/midway/compare/v2.10.12...v2.10.13) (2021-05-08)
|
|
278
|
-
|
|
279
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
## [2.10.12](https://github.com/midwayjs/midway/compare/v2.10.11...v2.10.12) (2021-05-07)
|
|
286
|
-
|
|
287
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
## [2.10.11](https://github.com/midwayjs/midway/compare/v2.10.10...v2.10.11) (2021-04-29)
|
|
294
|
-
|
|
295
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
## [2.10.10](https://github.com/midwayjs/midway/compare/v2.10.9...v2.10.10) (2021-04-24)
|
|
302
|
-
|
|
303
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
## [2.10.9](https://github.com/midwayjs/midway/compare/v2.10.8...v2.10.9) (2021-04-21)
|
|
310
|
-
|
|
311
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
## [2.10.8](https://github.com/midwayjs/midway/compare/v2.10.7...v2.10.8) (2021-04-21)
|
|
318
|
-
|
|
319
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
## [2.10.7](https://github.com/midwayjs/midway/compare/v2.10.6...v2.10.7) (2021-04-17)
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
### Bug Fixes
|
|
329
|
-
|
|
330
|
-
* add event name args ([#986](https://github.com/midwayjs/midway/issues/986)) ([bfd8232](https://github.com/midwayjs/midway/commit/bfd82320aee8600d8fa30bd2821a0e68c80fd755))
|
|
331
|
-
* format ([#997](https://github.com/midwayjs/midway/issues/997)) ([456cc14](https://github.com/midwayjs/midway/commit/456cc14513bdb000d1aa3130e9719caf7a8a803f))
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
### Features
|
|
335
|
-
|
|
336
|
-
* add midway task component ([#995](https://github.com/midwayjs/midway/issues/995)) ([befb81d](https://github.com/midwayjs/midway/commit/befb81dee90f01a20bba2c1835e8685cf85a76e7))
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
## [2.10.6](https://github.com/midwayjs/midway/compare/v2.10.5...v2.10.6) (2021-04-14)
|
|
343
|
-
|
|
344
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
## [2.10.5](https://github.com/midwayjs/midway/compare/v2.10.4...v2.10.5) (2021-04-13)
|
|
351
|
-
|
|
352
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
## [2.10.4](https://github.com/midwayjs/midway/compare/v2.10.3...v2.10.4) (2021-04-10)
|
|
359
|
-
|
|
360
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
## [2.10.3](https://github.com/midwayjs/midway/compare/v2.10.2...v2.10.3) (2021-04-07)
|
|
367
|
-
|
|
368
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
## [2.10.2](https://github.com/midwayjs/midway/compare/v2.10.1...v2.10.2) (2021-04-05)
|
|
375
|
-
|
|
376
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
# [2.10.0](https://github.com/midwayjs/midway/compare/v2.9.3...v2.10.0) (2021-04-02)
|
|
383
|
-
|
|
384
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
## [2.9.3](https://github.com/midwayjs/midway/compare/v2.9.2...v2.9.3) (2021-03-30)
|
|
391
|
-
|
|
392
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
## [2.9.2](https://github.com/midwayjs/midway/compare/v2.9.1...v2.9.2) (2021-03-27)
|
|
399
|
-
|
|
400
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
## [2.9.1](https://github.com/midwayjs/midway/compare/v2.9.0...v2.9.1) (2021-03-24)
|
|
407
|
-
|
|
408
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
# [2.9.0](https://github.com/midwayjs/midway/compare/v2.8.13...v2.9.0) (2021-03-22)
|
|
415
|
-
|
|
416
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
## [2.8.13](https://github.com/midwayjs/midway/compare/v2.8.12...v2.8.13) (2021-03-17)
|
|
423
|
-
|
|
424
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
## [2.8.11](https://github.com/midwayjs/midway/compare/v2.8.10...v2.8.11) (2021-03-12)
|
|
431
|
-
|
|
432
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
## [2.8.9](https://github.com/midwayjs/midway/compare/v2.8.8...v2.8.9) (2021-03-08)
|
|
439
|
-
|
|
440
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
## [2.8.8](https://github.com/midwayjs/midway/compare/v2.8.7...v2.8.8) (2021-03-06)
|
|
447
|
-
|
|
448
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
## [2.8.7](https://github.com/midwayjs/midway/compare/v2.8.6...v2.8.7) (2021-03-04)
|
|
455
|
-
|
|
456
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
## [2.8.6](https://github.com/midwayjs/midway/compare/v2.8.5...v2.8.6) (2021-03-03)
|
|
463
|
-
|
|
464
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
## [2.8.5](https://github.com/midwayjs/midway/compare/v2.8.4...v2.8.5) (2021-03-03)
|
|
471
|
-
|
|
472
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
## [2.8.4](https://github.com/midwayjs/midway/compare/v2.8.3...v2.8.4) (2021-03-03)
|
|
479
|
-
|
|
480
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
## [2.8.3](https://github.com/midwayjs/midway/compare/v2.8.2...v2.8.3) (2021-03-01)
|
|
487
|
-
|
|
488
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
## [2.8.2](https://github.com/midwayjs/midway/compare/v2.8.0...v2.8.2) (2021-02-27)
|
|
495
|
-
|
|
496
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
# [2.8.0](https://github.com/midwayjs/midway/compare/v2.7.7...v2.8.0) (2021-02-24)
|
|
503
|
-
|
|
504
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
## [2.7.7](https://github.com/midwayjs/midway/compare/v2.7.6...v2.7.7) (2021-02-20)
|
|
511
|
-
|
|
512
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
## [2.7.5](https://github.com/midwayjs/midway/compare/v2.7.4...v2.7.5) (2021-02-08)
|
|
519
|
-
|
|
520
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
## [2.7.3](https://github.com/midwayjs/midway/compare/v2.7.2...v2.7.3) (2021-02-02)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
### Bug Fixes
|
|
530
|
-
|
|
531
|
-
* egg socket io missing session middleware ([#835](https://github.com/midwayjs/midway/issues/835)) ([6e605a1](https://github.com/midwayjs/midway/commit/6e605a15b64bf51182b393b68d66d0867c571b94))
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
## [2.7.2](https://github.com/midwayjs/midway/compare/v2.7.1...v2.7.2) (2021-01-28)
|
|
538
|
-
|
|
539
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
## [2.7.1](https://github.com/midwayjs/midway/compare/v2.7.0...v2.7.1) (2021-01-28)
|
|
546
|
-
|
|
547
|
-
**Note:** Version bump only for package @midwayjs/typegoose
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
# [2.7.0](https://github.com/midwayjs/midway/compare/v2.6.13...v2.7.0) (2021-01-27)
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
### Features
|
|
557
|
-
|
|
558
|
-
* support entry file in bootstrap ([#819](https://github.com/midwayjs/midway/issues/819)) ([49a5ff6](https://github.com/midwayjs/midway/commit/49a5ff662134bdd42dc3a80738b44a05138f8f7c))
|
package/dist/util.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare function overrideMethodProperty(object: Record<any, any>, key: string, method: (superMethod: any) => any): void;
|
|
2
|
-
export declare function reach(target: object, path: string): any;
|
|
3
|
-
export declare function set<T extends object>(target: T, path: string, value: any): T;
|
|
4
|
-
export declare function merge(target: object, source: object): object;
|
|
5
|
-
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.merge = exports.set = exports.reach = exports.overrideMethodProperty = void 0;
|
|
4
|
-
const error_1 = require("./error");
|
|
5
|
-
function overrideMethodProperty(object, key, method) {
|
|
6
|
-
const descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
7
|
-
if (!descriptor) {
|
|
8
|
-
throw new error_1.ValidationPropertyMissingError(key);
|
|
9
|
-
}
|
|
10
|
-
const superMethod = descriptor.value;
|
|
11
|
-
if (typeof superMethod !== 'function') {
|
|
12
|
-
throw new error_1.ValidationNotMethodPropertyError(key);
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(object, key, {
|
|
15
|
-
...descriptor,
|
|
16
|
-
value: function overridedMethod() {
|
|
17
|
-
// eslint-disable-next-line prefer-rest-params
|
|
18
|
-
return method.call(this, superMethod).apply(this, arguments);
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.overrideMethodProperty = overrideMethodProperty;
|
|
23
|
-
function reach(target, path) {
|
|
24
|
-
for (const key of path.split('.')) {
|
|
25
|
-
if (target && target[key] !== undefined) {
|
|
26
|
-
target = target[key];
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return target;
|
|
33
|
-
}
|
|
34
|
-
exports.reach = reach;
|
|
35
|
-
function set(target, path, value) {
|
|
36
|
-
path.split('.').reduce((res, path, index, array) => {
|
|
37
|
-
if (index === array.length - 1) {
|
|
38
|
-
res[path] = value;
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
res[path] = typeof res[path] === 'object' ? res[path] : {};
|
|
42
|
-
}
|
|
43
|
-
return res[path];
|
|
44
|
-
}, target);
|
|
45
|
-
return target;
|
|
46
|
-
}
|
|
47
|
-
exports.set = set;
|
|
48
|
-
function merge(target, source) {
|
|
49
|
-
for (const key in source) {
|
|
50
|
-
try {
|
|
51
|
-
target[key] =
|
|
52
|
-
typeof source[key] === 'object'
|
|
53
|
-
? { ...merge(target[key], source[key]) }
|
|
54
|
-
: source[key];
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
target[key] = source[key];
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return target;
|
|
61
|
-
}
|
|
62
|
-
exports.merge = merge;
|
|
63
|
-
//# sourceMappingURL=util.js.map
|