@nest-omni/core 1.0.56-4 → 1.0.57
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/.hygen/new/crud/controller.ejs.t +36 -24
- package/common/utils.js +3 -4
- package/decorators/api-page-ok-response.decorator.js +1 -2
- package/decorators/auth-user.decorator.js +1 -2
- package/decorators/controller.decorator.js +1 -2
- package/decorators/field.decorators.js +37 -38
- package/decorators/http.decorators.js +1 -2
- package/decorators/property.decorators.js +6 -7
- package/decorators/swagger.schema.js +1 -2
- package/decorators/timestamp-column.decorator.js +1 -2
- package/decorators/transform.decorators.js +8 -9
- package/decorators/translate.decorator.js +3 -3
- package/decorators/use-dto.decorator.js +1 -2
- package/decorators/user-check.decorator.js +2 -2
- package/decorators/user.decorator.js +2 -2
- package/decorators/user_auth.decorator.js +1 -2
- package/decorators/validator.decorators.js +7 -8
- package/helpers/common.helper.js +3 -3
- package/helpers/date.helper.js +6 -7
- package/interceptors/language-interceptor.service.js +2 -2
- package/interfaces/IFile.d.ts +0 -1
- package/package.json +2 -4
- package/providers/context.provider.d.ts +3 -3
- package/setup/bootstrap.setup.d.ts +0 -3
- package/setup/bootstrap.setup.js +2 -6
- package/shared/serviceRegistryModule.js +0 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/validator-json/decorators.js +2 -3
- package/validator-json/default.js +3 -3
- package/validators/is-exists.validator.js +2 -2
- package/validators/is-unique.validator.js +2 -2
- package/validators/phone-country-code.validator.js +1 -2
- package/validators/same-as.validator.js +1 -2
- package/validators/skip-empty.validator.js +1 -2
|
@@ -34,37 +34,49 @@ skip_if: <%= !blocks.includes('Controller') %>
|
|
|
34
34
|
GetDtoName = 'Get' + DtoName;
|
|
35
35
|
getDtoFileName = 'get-' + dtoFileName;
|
|
36
36
|
|
|
37
|
-
%>import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import { Update<%= classify(name) %>Dto } from './dto/update-<%= name %>.dto';
|
|
37
|
+
%>import { Body, Controller, Delete, Put, Post } from '@nestjs/common';
|
|
38
|
+
import { ApiBody, ApiOperation, ApiTags } from '@nestjs/swagger';
|
|
39
|
+
import { Crud } from '@dataui/crud';
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
constructor(private readonly <%= camelize(name) %>Service: <%= classify(name) %>Service) {}
|
|
41
|
+
import { <%= EntityName %> } from './<%= entityFileName %>';
|
|
42
|
+
import { <%= ServiceName %> } from './<%= serviceFileName %>';
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
import { dto } from './requests';
|
|
45
|
+
import { serialize } from './responses';
|
|
46
|
+
import { targetConstructorToSchema } from '@nest-omni/core/validator-json';
|
|
47
|
+
import { I18nService } from 'nestjs-i18n';
|
|
48
|
+
import { BulkIdDto } from '@nest-omni/core/common/dto/bulk-id.dto';
|
|
50
49
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
@Crud({
|
|
51
|
+
model: { type: <%= EntityName %> },
|
|
52
|
+
dto,
|
|
53
|
+
serialize,
|
|
54
|
+
query: {
|
|
55
|
+
alwaysPaginate: true,
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
@Controller('<%= h.inflection.pluralize(fileName).toLowerCase() %>')
|
|
59
|
+
@ApiTags('<%= h.inflection.pluralize(fileName).toLowerCase() %>')
|
|
60
|
+
export class <%= ControllerName %> {
|
|
61
|
+
constructor(
|
|
62
|
+
public service: <%= ServiceName %>,
|
|
63
|
+
public i18n: I18nService,
|
|
64
|
+
) {}
|
|
55
65
|
|
|
56
|
-
@
|
|
57
|
-
|
|
58
|
-
return
|
|
66
|
+
@Post('validator')
|
|
67
|
+
async getCreateRules(): Promise<any> {
|
|
68
|
+
return targetConstructorToSchema(dto.create, this.i18n);
|
|
59
69
|
}
|
|
60
70
|
|
|
61
|
-
@
|
|
62
|
-
|
|
63
|
-
return
|
|
71
|
+
@Put('validator')
|
|
72
|
+
async getUpdateRules(): Promise<any> {
|
|
73
|
+
return targetConstructorToSchema(dto.update, this.i18n);
|
|
64
74
|
}
|
|
65
75
|
|
|
66
|
-
@Delete('
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
@Delete('/bulk')
|
|
77
|
+
@ApiBody({ type: BulkIdDto })
|
|
78
|
+
@ApiOperation({ summary: 'bulk deletion of records' })
|
|
79
|
+
async deleteBulk(@Body() bulkId: BulkIdDto) {
|
|
80
|
+
return await this.service.deleteBulk(bulkId);
|
|
69
81
|
}
|
|
70
82
|
}
|
package/common/utils.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generateHash = generateHash;
|
|
4
|
+
exports.validateHash = validateHash;
|
|
5
|
+
exports.getVariableName = getVariableName;
|
|
4
6
|
const bcrypt_1 = require("bcrypt");
|
|
5
7
|
function generateHash(password) {
|
|
6
8
|
return bcrypt_1.default.hashSync(password, 10);
|
|
7
9
|
}
|
|
8
|
-
exports.generateHash = generateHash;
|
|
9
10
|
function validateHash(password, hash) {
|
|
10
11
|
if (!password || !hash) {
|
|
11
12
|
return Promise.resolve(false);
|
|
12
13
|
}
|
|
13
14
|
return bcrypt_1.default.compare(password, hash);
|
|
14
15
|
}
|
|
15
|
-
exports.validateHash = validateHash;
|
|
16
16
|
function getVariableName(getVar) {
|
|
17
17
|
const m = /\(\)=>(.*)/.exec(getVar.toString().replace(/(\r\n|\n|\r|\s)/gm, ''));
|
|
18
18
|
if (!m) {
|
|
@@ -22,4 +22,3 @@ function getVariableName(getVar) {
|
|
|
22
22
|
const memberParts = fullMemberName.split('.');
|
|
23
23
|
return memberParts[memberParts.length - 1];
|
|
24
24
|
}
|
|
25
|
-
exports.getVariableName = getVariableName;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiPageResponse =
|
|
3
|
+
exports.ApiPageResponse = ApiPageResponse;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
6
|
const page_dto_1 = require("../common/dto/page.dto");
|
|
@@ -22,4 +22,3 @@ function ApiPageResponse(options) {
|
|
|
22
22
|
},
|
|
23
23
|
}));
|
|
24
24
|
}
|
|
25
|
-
exports.ApiPageResponse = ApiPageResponse;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuthUser =
|
|
3
|
+
exports.AuthUser = AuthUser;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
function AuthUser() {
|
|
6
6
|
return (0, common_1.createParamDecorator)((_data, context) => {
|
|
@@ -12,4 +12,3 @@ function AuthUser() {
|
|
|
12
12
|
return user;
|
|
13
13
|
})();
|
|
14
14
|
}
|
|
15
|
-
exports.AuthUser = AuthUser;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Controller =
|
|
3
|
+
exports.Controller = Controller;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const crud_1 = require("@dataui/crud");
|
|
6
6
|
const _ = require("lodash");
|
|
@@ -8,4 +8,3 @@ function Controller(field) {
|
|
|
8
8
|
const featureName = _.upperFirst(field);
|
|
9
9
|
return (0, common_1.applyDecorators)((0, common_1.Controller)(field), (0, crud_1.Feature)(featureName));
|
|
10
10
|
}
|
|
11
|
-
exports.Controller = Controller;
|
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.NumberField = NumberField;
|
|
4
|
+
exports.NumberFieldOptional = NumberFieldOptional;
|
|
5
|
+
exports.StringField = StringField;
|
|
6
|
+
exports.StringFieldOptional = StringFieldOptional;
|
|
7
|
+
exports.PasswordField = PasswordField;
|
|
8
|
+
exports.PasswordFieldOptional = PasswordFieldOptional;
|
|
9
|
+
exports.BooleanField = BooleanField;
|
|
10
|
+
exports.BooleanFieldOptional = BooleanFieldOptional;
|
|
11
|
+
exports.TranslationsField = TranslationsField;
|
|
12
|
+
exports.TranslationsFieldOptional = TranslationsFieldOptional;
|
|
13
|
+
exports.TmpKeyField = TmpKeyField;
|
|
14
|
+
exports.TmpKeyFieldOptional = TmpKeyFieldOptional;
|
|
15
|
+
exports.getEnumDescription = getEnumDescription;
|
|
16
|
+
exports.EnumField = EnumField;
|
|
17
|
+
exports.ClassField = ClassField;
|
|
18
|
+
exports.EnumFieldOptional = EnumFieldOptional;
|
|
19
|
+
exports.ClassFieldOptional = ClassFieldOptional;
|
|
20
|
+
exports.EmailField = EmailField;
|
|
21
|
+
exports.EmailFieldOptional = EmailFieldOptional;
|
|
22
|
+
exports.PhoneField = PhoneField;
|
|
23
|
+
exports.PhoneFieldOptional = PhoneFieldOptional;
|
|
24
|
+
exports.UUIDField = UUIDField;
|
|
25
|
+
exports.UUIDFieldOptional = UUIDFieldOptional;
|
|
26
|
+
exports.URLField = URLField;
|
|
27
|
+
exports.URLFieldOptional = URLFieldOptional;
|
|
28
|
+
exports.FQDNField = FQDNField;
|
|
29
|
+
exports.FQDNFieldOptional = FQDNFieldOptional;
|
|
30
|
+
exports.DateField = DateField;
|
|
31
|
+
exports.DateFieldOptional = DateFieldOptional;
|
|
32
|
+
exports.IpFieldOptional = IpFieldOptional;
|
|
33
|
+
exports.IpField = IpField;
|
|
34
|
+
exports.ObjectField = ObjectField;
|
|
35
|
+
exports.ObjectFieldOptional = ObjectFieldOptional;
|
|
36
|
+
exports.TimeZoneField = TimeZoneField;
|
|
37
|
+
exports.TimeZoneFieldOptional = TimeZoneFieldOptional;
|
|
38
|
+
exports.LocaleField = LocaleField;
|
|
39
|
+
exports.LocaleFieldOptional = LocaleFieldOptional;
|
|
4
40
|
const common_1 = require("@nestjs/common");
|
|
5
41
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
42
|
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
@@ -61,11 +97,9 @@ function NumberField(options = {}) {
|
|
|
61
97
|
}
|
|
62
98
|
return (0, common_1.applyDecorators)(...decorators);
|
|
63
99
|
}
|
|
64
|
-
exports.NumberField = NumberField;
|
|
65
100
|
function NumberFieldOptional(options = {}) {
|
|
66
101
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), NumberField(Object.assign({ required: false }, options)));
|
|
67
102
|
}
|
|
68
|
-
exports.NumberFieldOptional = NumberFieldOptional;
|
|
69
103
|
function StringField(options = {}) {
|
|
70
104
|
var _a;
|
|
71
105
|
const decorators = [
|
|
@@ -106,11 +140,9 @@ function StringField(options = {}) {
|
|
|
106
140
|
}
|
|
107
141
|
return (0, common_1.applyDecorators)(...decorators);
|
|
108
142
|
}
|
|
109
|
-
exports.StringField = StringField;
|
|
110
143
|
function StringFieldOptional(options = {}) {
|
|
111
144
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), StringField(Object.assign({ required: false }, options)));
|
|
112
145
|
}
|
|
113
|
-
exports.StringFieldOptional = StringFieldOptional;
|
|
114
146
|
function PasswordField(options = {}) {
|
|
115
147
|
const decorators = [
|
|
116
148
|
StringField(Object.assign(Object.assign({}, options), { minLength: 6 })),
|
|
@@ -123,11 +155,9 @@ function PasswordField(options = {}) {
|
|
|
123
155
|
}
|
|
124
156
|
return (0, common_1.applyDecorators)(...decorators);
|
|
125
157
|
}
|
|
126
|
-
exports.PasswordField = PasswordField;
|
|
127
158
|
function PasswordFieldOptional(options = {}) {
|
|
128
159
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PasswordField(Object.assign({ required: false }, options)));
|
|
129
160
|
}
|
|
130
|
-
exports.PasswordFieldOptional = PasswordFieldOptional;
|
|
131
161
|
function BooleanField(options = {}) {
|
|
132
162
|
const decorators = [
|
|
133
163
|
(0, transform_decorators_1.ToBoolean)(),
|
|
@@ -144,11 +174,9 @@ function BooleanField(options = {}) {
|
|
|
144
174
|
}
|
|
145
175
|
return (0, common_1.applyDecorators)(...decorators);
|
|
146
176
|
}
|
|
147
|
-
exports.BooleanField = BooleanField;
|
|
148
177
|
function BooleanFieldOptional(options = {}) {
|
|
149
178
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), BooleanField(Object.assign({ required: false }, options)));
|
|
150
179
|
}
|
|
151
|
-
exports.BooleanFieldOptional = BooleanFieldOptional;
|
|
152
180
|
function TranslationsField(options) {
|
|
153
181
|
const decorators = [
|
|
154
182
|
(0, class_validator_1.ArrayMinSize)(constants_1.supportedLanguageCount),
|
|
@@ -169,11 +197,9 @@ function TranslationsField(options) {
|
|
|
169
197
|
}
|
|
170
198
|
return (0, common_1.applyDecorators)(...decorators);
|
|
171
199
|
}
|
|
172
|
-
exports.TranslationsField = TranslationsField;
|
|
173
200
|
function TranslationsFieldOptional(options) {
|
|
174
201
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TranslationsField(Object.assign({ required: false }, options)));
|
|
175
202
|
}
|
|
176
|
-
exports.TranslationsFieldOptional = TranslationsFieldOptional;
|
|
177
203
|
function TmpKeyField(options = {}) {
|
|
178
204
|
const decorators = [
|
|
179
205
|
StringField(options),
|
|
@@ -190,16 +216,13 @@ function TmpKeyField(options = {}) {
|
|
|
190
216
|
}
|
|
191
217
|
return (0, common_1.applyDecorators)(...decorators);
|
|
192
218
|
}
|
|
193
|
-
exports.TmpKeyField = TmpKeyField;
|
|
194
219
|
function TmpKeyFieldOptional(options = {}) {
|
|
195
220
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TmpKeyField(Object.assign({ required: false }, options)));
|
|
196
221
|
}
|
|
197
|
-
exports.TmpKeyFieldOptional = TmpKeyFieldOptional;
|
|
198
222
|
function getEnumDescription(enumType) {
|
|
199
223
|
const keys = Object.keys(enumType).filter((k) => typeof enumType[k] === 'number');
|
|
200
224
|
return keys.map((k) => `${enumType[k]}: ${k}`).join(', ');
|
|
201
225
|
}
|
|
202
|
-
exports.getEnumDescription = getEnumDescription;
|
|
203
226
|
function EnumField(getEnum, options = {}) {
|
|
204
227
|
const enumValue = getEnum();
|
|
205
228
|
const decorators = [
|
|
@@ -222,7 +245,6 @@ function EnumField(getEnum, options = {}) {
|
|
|
222
245
|
}
|
|
223
246
|
return (0, common_1.applyDecorators)(...decorators);
|
|
224
247
|
}
|
|
225
|
-
exports.EnumField = EnumField;
|
|
226
248
|
function ClassField(getClass, options = {}) {
|
|
227
249
|
const classValue = getClass();
|
|
228
250
|
if (!classValue) {
|
|
@@ -249,15 +271,12 @@ function ClassField(getClass, options = {}) {
|
|
|
249
271
|
}
|
|
250
272
|
return (0, common_1.applyDecorators)(...decorators);
|
|
251
273
|
}
|
|
252
|
-
exports.ClassField = ClassField;
|
|
253
274
|
function EnumFieldOptional(getEnum, options = {}) {
|
|
254
275
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EnumField(getEnum, Object.assign({ required: false }, options)));
|
|
255
276
|
}
|
|
256
|
-
exports.EnumFieldOptional = EnumFieldOptional;
|
|
257
277
|
function ClassFieldOptional(getClass, options = {}) {
|
|
258
278
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ClassField(getClass, Object.assign({ required: false }, options)));
|
|
259
279
|
}
|
|
260
|
-
exports.ClassFieldOptional = ClassFieldOptional;
|
|
261
280
|
function EmailField(options = {}) {
|
|
262
281
|
var _a;
|
|
263
282
|
const decorators = [
|
|
@@ -275,11 +294,9 @@ function EmailField(options = {}) {
|
|
|
275
294
|
}
|
|
276
295
|
return (0, common_1.applyDecorators)(...decorators);
|
|
277
296
|
}
|
|
278
|
-
exports.EmailField = EmailField;
|
|
279
297
|
function EmailFieldOptional(options = {}) {
|
|
280
298
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), EmailField(Object.assign({ required: false }, options)));
|
|
281
299
|
}
|
|
282
|
-
exports.EmailFieldOptional = EmailFieldOptional;
|
|
283
300
|
function PhoneField(options = {}) {
|
|
284
301
|
const decorators = [(0, validator_decorators_1.IsPhoneNumber)(), (0, transform_decorators_1.PhoneNumberSerializer)()];
|
|
285
302
|
if (options.nullable) {
|
|
@@ -293,11 +310,9 @@ function PhoneField(options = {}) {
|
|
|
293
310
|
}
|
|
294
311
|
return (0, common_1.applyDecorators)(...decorators);
|
|
295
312
|
}
|
|
296
|
-
exports.PhoneField = PhoneField;
|
|
297
313
|
function PhoneFieldOptional(options = {}) {
|
|
298
314
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), PhoneField(Object.assign({ required: false }, options)));
|
|
299
315
|
}
|
|
300
|
-
exports.PhoneFieldOptional = PhoneFieldOptional;
|
|
301
316
|
function UUIDField(options = {}) {
|
|
302
317
|
const decorators = [
|
|
303
318
|
(0, class_transformer_1.Type)(() => String),
|
|
@@ -320,11 +335,9 @@ function UUIDField(options = {}) {
|
|
|
320
335
|
}
|
|
321
336
|
return (0, common_1.applyDecorators)(...decorators);
|
|
322
337
|
}
|
|
323
|
-
exports.UUIDField = UUIDField;
|
|
324
338
|
function UUIDFieldOptional(options = {}) {
|
|
325
339
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), UUIDField(Object.assign({ required: false }, options)));
|
|
326
340
|
}
|
|
327
|
-
exports.UUIDFieldOptional = UUIDFieldOptional;
|
|
328
341
|
function URLField(options = {}) {
|
|
329
342
|
const decorators = [StringField(Object.assign({}, options))];
|
|
330
343
|
if (options.simpleUrl) {
|
|
@@ -347,11 +360,9 @@ function URLField(options = {}) {
|
|
|
347
360
|
}
|
|
348
361
|
return (0, common_1.applyDecorators)(...decorators);
|
|
349
362
|
}
|
|
350
|
-
exports.URLField = URLField;
|
|
351
363
|
function URLFieldOptional(options = {}) {
|
|
352
364
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), URLField(Object.assign({ required: false }, options)));
|
|
353
365
|
}
|
|
354
|
-
exports.URLFieldOptional = URLFieldOptional;
|
|
355
366
|
function FQDNField(options = {}) {
|
|
356
367
|
const decorators = [
|
|
357
368
|
(0, class_validator_1.IsFQDN)(options, {
|
|
@@ -368,11 +379,9 @@ function FQDNField(options = {}) {
|
|
|
368
379
|
}
|
|
369
380
|
return (0, common_1.applyDecorators)(...decorators);
|
|
370
381
|
}
|
|
371
|
-
exports.FQDNField = FQDNField;
|
|
372
382
|
function FQDNFieldOptional(options = {}) {
|
|
373
383
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), FQDNField(Object.assign({ required: false }, options)));
|
|
374
384
|
}
|
|
375
|
-
exports.FQDNFieldOptional = FQDNFieldOptional;
|
|
376
385
|
function DateField(options = {}) {
|
|
377
386
|
const decorators = [
|
|
378
387
|
(0, class_transformer_1.Type)(() => Date),
|
|
@@ -401,15 +410,12 @@ function DateField(options = {}) {
|
|
|
401
410
|
}
|
|
402
411
|
return (0, common_1.applyDecorators)(...decorators);
|
|
403
412
|
}
|
|
404
|
-
exports.DateField = DateField;
|
|
405
413
|
function DateFieldOptional(options = {}) {
|
|
406
414
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), DateField(Object.assign(Object.assign({}, options), { required: false })));
|
|
407
415
|
}
|
|
408
|
-
exports.DateFieldOptional = DateFieldOptional;
|
|
409
416
|
function IpFieldOptional(options = {}) {
|
|
410
417
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), IpField(Object.assign({ required: false }, options)));
|
|
411
418
|
}
|
|
412
|
-
exports.IpFieldOptional = IpFieldOptional;
|
|
413
419
|
function IpField(options) {
|
|
414
420
|
const decorators = [
|
|
415
421
|
(0, class_validator_1.IsIP)(options.version || 4, {
|
|
@@ -426,7 +432,6 @@ function IpField(options) {
|
|
|
426
432
|
}
|
|
427
433
|
return (0, common_1.applyDecorators)(...decorators);
|
|
428
434
|
}
|
|
429
|
-
exports.IpField = IpField;
|
|
430
435
|
function ObjectField(options = {}) {
|
|
431
436
|
const decorators = [
|
|
432
437
|
(0, class_transformer_1.Type)(() => Object),
|
|
@@ -446,11 +451,9 @@ function ObjectField(options = {}) {
|
|
|
446
451
|
}
|
|
447
452
|
return (0, common_1.applyDecorators)(...decorators);
|
|
448
453
|
}
|
|
449
|
-
exports.ObjectField = ObjectField;
|
|
450
454
|
function ObjectFieldOptional(options = {}) {
|
|
451
455
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), ObjectField(Object.assign({ required: false }, options)));
|
|
452
456
|
}
|
|
453
|
-
exports.ObjectFieldOptional = ObjectFieldOptional;
|
|
454
457
|
function TimeZoneField(options = {}) {
|
|
455
458
|
const decorators = [
|
|
456
459
|
StringField(Object.assign({}, options)),
|
|
@@ -467,11 +470,9 @@ function TimeZoneField(options = {}) {
|
|
|
467
470
|
}
|
|
468
471
|
return (0, common_1.applyDecorators)(...decorators);
|
|
469
472
|
}
|
|
470
|
-
exports.TimeZoneField = TimeZoneField;
|
|
471
473
|
function TimeZoneFieldOptional(options = {}) {
|
|
472
474
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), TimeZoneField(Object.assign({ required: false }, options)));
|
|
473
475
|
}
|
|
474
|
-
exports.TimeZoneFieldOptional = TimeZoneFieldOptional;
|
|
475
476
|
function LocaleField(options = {}) {
|
|
476
477
|
const decorators = [
|
|
477
478
|
StringField(Object.assign({}, options)),
|
|
@@ -491,8 +492,6 @@ function LocaleField(options = {}) {
|
|
|
491
492
|
}
|
|
492
493
|
return (0, common_1.applyDecorators)(...decorators);
|
|
493
494
|
}
|
|
494
|
-
exports.LocaleField = LocaleField;
|
|
495
495
|
function LocaleFieldOptional(options = {}) {
|
|
496
496
|
return (0, common_1.applyDecorators)((0, validator_decorators_1.IsEmptyable)(), LocaleField(Object.assign({ required: false }, options)));
|
|
497
497
|
}
|
|
498
|
-
exports.LocaleFieldOptional = LocaleFieldOptional;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UUIDParam =
|
|
3
|
+
exports.UUIDParam = UUIDParam;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
function UUIDParam(property, ...pipes) {
|
|
6
6
|
return (0, common_1.Param)(property, new common_1.ParseUUIDPipe({ version: '4' }), ...pipes);
|
|
7
7
|
}
|
|
8
|
-
exports.UUIDParam = UUIDParam;
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApiBooleanProperty = ApiBooleanProperty;
|
|
4
|
+
exports.ApiBooleanPropertyOptional = ApiBooleanPropertyOptional;
|
|
5
|
+
exports.ApiUUIDProperty = ApiUUIDProperty;
|
|
6
|
+
exports.ApiUUIDPropertyOptional = ApiUUIDPropertyOptional;
|
|
7
|
+
exports.ApiEnumProperty = ApiEnumProperty;
|
|
8
|
+
exports.ApiEnumPropertyOptional = ApiEnumPropertyOptional;
|
|
4
9
|
const swagger_1 = require("@nestjs/swagger");
|
|
5
10
|
const utils_1 = require("../common/utils");
|
|
6
11
|
const field_decorators_1 = require("../decorators/field.decorators");
|
|
7
12
|
function ApiBooleanProperty(options = {}) {
|
|
8
13
|
return (0, swagger_1.ApiProperty)(Object.assign({ type: Boolean }, options));
|
|
9
14
|
}
|
|
10
|
-
exports.ApiBooleanProperty = ApiBooleanProperty;
|
|
11
15
|
function ApiBooleanPropertyOptional(options = {}) {
|
|
12
16
|
return ApiBooleanProperty(Object.assign({ required: false }, options));
|
|
13
17
|
}
|
|
14
|
-
exports.ApiBooleanPropertyOptional = ApiBooleanPropertyOptional;
|
|
15
18
|
function ApiUUIDProperty(options = {}) {
|
|
16
19
|
return (0, swagger_1.ApiProperty)(Object.assign({ type: options.each ? [String] : String, format: 'uuid', isArray: options.each }, options));
|
|
17
20
|
}
|
|
18
|
-
exports.ApiUUIDProperty = ApiUUIDProperty;
|
|
19
21
|
function ApiUUIDPropertyOptional(options = {}) {
|
|
20
22
|
return ApiUUIDProperty(Object.assign({ required: false }, options));
|
|
21
23
|
}
|
|
22
|
-
exports.ApiUUIDPropertyOptional = ApiUUIDPropertyOptional;
|
|
23
24
|
function ApiEnumProperty(getEnum, options = {}) {
|
|
24
25
|
const enumValue = getEnum();
|
|
25
26
|
options.description = (0, field_decorators_1.getEnumDescription)(enumValue);
|
|
26
27
|
return (0, swagger_1.ApiProperty)(Object.assign({ type: 'enum', enum: enumValue, enumName: (0, utils_1.getVariableName)(getEnum) }, options));
|
|
27
28
|
}
|
|
28
|
-
exports.ApiEnumProperty = ApiEnumProperty;
|
|
29
29
|
function ApiEnumPropertyOptional(getEnum, options = {}) {
|
|
30
30
|
return ApiEnumProperty(getEnum, Object.assign({ required: false }, options));
|
|
31
31
|
}
|
|
32
|
-
exports.ApiEnumPropertyOptional = ApiEnumPropertyOptional;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiFile =
|
|
3
|
+
exports.ApiFile = ApiFile;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const constants_1 = require("@nestjs/common/constants");
|
|
6
6
|
const route_paramtypes_enum_1 = require("@nestjs/common/enums/route-paramtypes.enum");
|
|
@@ -76,4 +76,3 @@ function ApiFile(files, options = {}) {
|
|
|
76
76
|
: (0, common_1.UseInterceptors)((0, platform_express_1.FileInterceptor)(file.name)));
|
|
77
77
|
return (0, common_1.applyDecorators)(RegisterModels(), (0, swagger_1.ApiConsumes)('multipart/form-data'), ApiFileDecorator(filesArray, options), ...apiFileInterceptors);
|
|
78
78
|
}
|
|
79
|
-
exports.ApiFile = ApiFile;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimestampColumn =
|
|
3
|
+
exports.TimestampColumn = TimestampColumn;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const swagger_1 = require("@nestjs/swagger");
|
|
6
6
|
const typeorm_1 = require("typeorm");
|
|
@@ -25,4 +25,3 @@ function TimestampColumn(name, description) {
|
|
|
25
25
|
},
|
|
26
26
|
}));
|
|
27
27
|
}
|
|
28
|
-
exports.TimestampColumn = TimestampColumn;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Trim = Trim;
|
|
4
|
+
exports.ToBoolean = ToBoolean;
|
|
5
|
+
exports.ToInt = ToInt;
|
|
6
|
+
exports.ToArray = ToArray;
|
|
7
|
+
exports.ToLowerCase = ToLowerCase;
|
|
8
|
+
exports.ToUpperCase = ToUpperCase;
|
|
9
|
+
exports.S3UrlParser = S3UrlParser;
|
|
10
|
+
exports.PhoneNumberSerializer = PhoneNumberSerializer;
|
|
4
11
|
const class_transformer_1 = require("class-transformer");
|
|
5
12
|
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
6
13
|
const lodash_1 = require("lodash");
|
|
@@ -14,7 +21,6 @@ function Trim() {
|
|
|
14
21
|
return (0, lodash_1.trim)(value).replaceAll(/\s\s+/g, ' ');
|
|
15
22
|
});
|
|
16
23
|
}
|
|
17
|
-
exports.Trim = Trim;
|
|
18
24
|
function ToBoolean() {
|
|
19
25
|
return (0, class_transformer_1.Transform)((params) => {
|
|
20
26
|
switch (params.value) {
|
|
@@ -30,14 +36,12 @@ function ToBoolean() {
|
|
|
30
36
|
}
|
|
31
37
|
}, { toClassOnly: true });
|
|
32
38
|
}
|
|
33
|
-
exports.ToBoolean = ToBoolean;
|
|
34
39
|
function ToInt() {
|
|
35
40
|
return (0, class_transformer_1.Transform)((params) => {
|
|
36
41
|
const value = params.value;
|
|
37
42
|
return Number.parseInt(value, 10);
|
|
38
43
|
}, { toClassOnly: true });
|
|
39
44
|
}
|
|
40
|
-
exports.ToInt = ToInt;
|
|
41
45
|
function ToArray() {
|
|
42
46
|
return (0, class_transformer_1.Transform)((params) => {
|
|
43
47
|
const value = params.value;
|
|
@@ -47,7 +51,6 @@ function ToArray() {
|
|
|
47
51
|
return (0, lodash_1.castArray)(value);
|
|
48
52
|
}, { toClassOnly: true });
|
|
49
53
|
}
|
|
50
|
-
exports.ToArray = ToArray;
|
|
51
54
|
function ToLowerCase() {
|
|
52
55
|
return (0, class_transformer_1.Transform)((params) => {
|
|
53
56
|
const value = params.value;
|
|
@@ -62,7 +65,6 @@ function ToLowerCase() {
|
|
|
62
65
|
toClassOnly: true,
|
|
63
66
|
});
|
|
64
67
|
}
|
|
65
|
-
exports.ToLowerCase = ToLowerCase;
|
|
66
68
|
function ToUpperCase() {
|
|
67
69
|
return (0, class_transformer_1.Transform)((params) => {
|
|
68
70
|
const value = params.value;
|
|
@@ -77,7 +79,6 @@ function ToUpperCase() {
|
|
|
77
79
|
toClassOnly: true,
|
|
78
80
|
});
|
|
79
81
|
}
|
|
80
|
-
exports.ToUpperCase = ToUpperCase;
|
|
81
82
|
function S3UrlParser() {
|
|
82
83
|
return (0, class_transformer_1.Transform)((params) => {
|
|
83
84
|
const key = params.value;
|
|
@@ -94,8 +95,6 @@ function S3UrlParser() {
|
|
|
94
95
|
}
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
|
-
exports.S3UrlParser = S3UrlParser;
|
|
98
98
|
function PhoneNumberSerializer() {
|
|
99
99
|
return (0, class_transformer_1.Transform)((params) => (0, libphonenumber_js_1.parsePhoneNumber)(params.value).number);
|
|
100
100
|
}
|
|
101
|
-
exports.PhoneNumberSerializer = PhoneNumberSerializer;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DYNAMIC_TRANSLATION_DECORATOR_KEY = exports.STATIC_TRANSLATION_DECORATOR_KEY = void 0;
|
|
4
|
+
exports.StaticTranslate = StaticTranslate;
|
|
5
|
+
exports.DynamicTranslate = DynamicTranslate;
|
|
4
6
|
exports.STATIC_TRANSLATION_DECORATOR_KEY = 'custom:static-translate';
|
|
5
7
|
exports.DYNAMIC_TRANSLATION_DECORATOR_KEY = 'custom:dynamic-translate';
|
|
6
8
|
function StaticTranslate(data = {}) {
|
|
@@ -8,10 +10,8 @@ function StaticTranslate(data = {}) {
|
|
|
8
10
|
Reflect.defineMetadata(exports.STATIC_TRANSLATION_DECORATOR_KEY, data, target, key);
|
|
9
11
|
};
|
|
10
12
|
}
|
|
11
|
-
exports.StaticTranslate = StaticTranslate;
|
|
12
13
|
function DynamicTranslate() {
|
|
13
14
|
return (target, key) => {
|
|
14
15
|
Reflect.defineMetadata(exports.DYNAMIC_TRANSLATION_DECORATOR_KEY, {}, target, key);
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
exports.DynamicTranslate = DynamicTranslate;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.User = void 0;
|
|
4
|
+
exports.getUserData = getUserData;
|
|
4
5
|
const common_1 = require("@nestjs/common");
|
|
5
6
|
const lodash = require("lodash");
|
|
6
7
|
exports.User = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
@@ -18,4 +19,3 @@ function getUserData(req, data) {
|
|
|
18
19
|
};
|
|
19
20
|
return data ? user[data] : user;
|
|
20
21
|
}
|
|
21
|
-
exports.getUserData = getUserData;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.User = void 0;
|
|
4
|
+
exports.getOmniAuthData = getOmniAuthData;
|
|
4
5
|
const common_1 = require("@nestjs/common");
|
|
5
6
|
const lodash_1 = require("lodash");
|
|
6
7
|
const config_1 = require("@nestjs/config");
|
|
@@ -41,4 +42,3 @@ function getOmniAuthData(request, key) {
|
|
|
41
42
|
}
|
|
42
43
|
return key ? user[key] : user;
|
|
43
44
|
}
|
|
44
|
-
exports.getOmniAuthData = getOmniAuthData;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserFilter =
|
|
3
|
+
exports.UserFilter = UserFilter;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const crud_1 = require("@dataui/crud");
|
|
6
6
|
const user_decorator_1 = require("./user.decorator");
|
|
@@ -13,4 +13,3 @@ function UserFilter(field) {
|
|
|
13
13
|
},
|
|
14
14
|
}));
|
|
15
15
|
}
|
|
16
|
-
exports.UserFilter = UserFilter;
|