@koalarx/nest 1.11.12 → 1.12.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/core/backgroud-services/cron-service/cron-job.handler.base.js +2 -2
- package/core/controllers/controller.decorator.js +1 -2
- package/core/controllers/schemas/boolean.schema.js +1 -2
- package/core/controllers/schemas/document-number.schema.js +6 -7
- package/core/controllers/schemas/email.schema.js +1 -2
- package/core/controllers/schemas/native-enum.schema.js +1 -2
- package/core/database/entity.base.js +11 -0
- package/core/database/entity.decorator.js +1 -2
- package/core/database/prisma.service.js +2 -1
- package/core/database/repository.base.js +5 -5
- package/core/errors/error.base.d.ts +2 -2
- package/core/health-check/health-check.controller.js +2 -1
- package/core/health-check/health-check.module.js +2 -1
- package/core/koala-nest-database.module.js +2 -1
- package/core/koala-nest-http.module.js +2 -1
- package/core/koala-nest.module.js +2 -1
- package/core/mapping/auto-mapping-class-context.d.ts +2 -2
- package/core/mapping/auto-mapping-list.d.ts +2 -2
- package/core/mapping/auto-mapping.decorator.js +1 -2
- package/core/mapping/auto-mapping.module.js +2 -1
- package/core/mapping/auto-mapping.service.js +2 -1
- package/core/mapping/create-map.js +1 -2
- package/core/mapping/for-member.js +1 -2
- package/core/utils/assing-object.js +1 -2
- package/core/utils/instanciate-class-with-dependencies-injection.js +1 -2
- package/core/utils/set-mask-document-number.js +4 -5
- package/decorators/api-property-enum.decorator.js +1 -2
- package/decorators/upload.decorator.js +1 -2
- package/env/env.module.js +2 -1
- package/env/env.service.js +2 -1
- package/filters/domain-errors.filter.d.ts +0 -1
- package/filters/domain-errors.filter.js +2 -1
- package/filters/global-exception.filter.d.ts +0 -1
- package/filters/global-exception.filter.js +2 -1
- package/filters/prisma-validation-exception.filter.d.ts +0 -1
- package/filters/prisma-validation-exception.filter.js +2 -1
- package/filters/zod-errors.filter.d.ts +0 -1
- package/filters/zod-errors.filter.js +2 -1
- package/package.json +2 -2
- package/services/logging/logging.service.js +2 -1
- package/services/redis/redis.service.js +2 -1
- package/services/redlock/red-lock.service.js +2 -1
- package/test/repositories/in-memory-base.repository.js +5 -6
- package/test/utils/create-e2e-database.js +1 -2
- package/test/utils/drop-e2e-database.js +1 -2
- package/test/utils/wait-for.js +1 -2
- package/tsconfig.lib.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CronJobHandlerBase = void 0;
|
|
4
|
-
const
|
|
4
|
+
const KlDelay_1 = require("@koalarx/utils/KlDelay");
|
|
5
5
|
const koala_global_vars_1 = require("../../koala-global-vars");
|
|
6
6
|
class CronJobHandlerBase {
|
|
7
7
|
redlockService;
|
|
@@ -41,7 +41,7 @@ class CronJobHandlerBase {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
await (0,
|
|
44
|
+
await (0, KlDelay_1.delay)(this._timeout);
|
|
45
45
|
await this.redlockService.releaseLock(name);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -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 swagger_1 = require("@nestjs/swagger");
|
|
6
6
|
function Controller(config) {
|
|
@@ -9,4 +9,3 @@ function Controller(config) {
|
|
|
9
9
|
(0, swagger_1.ApiTags)(config.tag)(target);
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
|
-
exports.Controller = Controller;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.booleanSchema =
|
|
3
|
+
exports.booleanSchema = booleanSchema;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
function booleanSchema() {
|
|
6
6
|
return zod_1.z.coerce.string().transform((value) => {
|
|
@@ -10,4 +10,3 @@ function booleanSchema() {
|
|
|
10
10
|
return undefined;
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
exports.booleanSchema = booleanSchema;
|
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.documentNumberSchema =
|
|
4
|
-
const
|
|
3
|
+
exports.documentNumberSchema = documentNumberSchema;
|
|
4
|
+
const KlString_1 = require("@koalarx/utils/KlString");
|
|
5
5
|
function documentNumberSchema(value) {
|
|
6
6
|
if (value !== '' && value !== 'undefined' && value !== 'null') {
|
|
7
7
|
if (value.includes('.')) {
|
|
8
8
|
if (value.length === 14) {
|
|
9
|
-
return (0,
|
|
9
|
+
return (0, KlString_1.validateCpf)(value);
|
|
10
10
|
}
|
|
11
11
|
else if (value.length === 18) {
|
|
12
|
-
return (0,
|
|
12
|
+
return (0, KlString_1.validateCnpj)(value);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
if (value.length === 11) {
|
|
17
|
-
return (0,
|
|
17
|
+
return (0, KlString_1.validateCpf)(value);
|
|
18
18
|
}
|
|
19
19
|
else if (value.length === 14) {
|
|
20
|
-
return (0,
|
|
20
|
+
return (0, KlString_1.validateCnpj)(value);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
return false;
|
|
24
24
|
}
|
|
25
25
|
return true;
|
|
26
26
|
}
|
|
27
|
-
exports.documentNumberSchema = documentNumberSchema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emailSchema =
|
|
3
|
+
exports.emailSchema = emailSchema;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
function emailSchema(email, isRequired = false) {
|
|
6
6
|
if (isRequired && !email) {
|
|
@@ -11,4 +11,3 @@ function emailSchema(email, isRequired = false) {
|
|
|
11
11
|
}
|
|
12
12
|
return zod_1.z.coerce.string().max(50).email().parse(email);
|
|
13
13
|
}
|
|
14
|
-
exports.emailSchema = emailSchema;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nativeEnumSchema =
|
|
3
|
+
exports.nativeEnumSchema = nativeEnumSchema;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
function nativeEnumSchema(nativeEnum) {
|
|
6
6
|
return {
|
|
@@ -26,4 +26,3 @@ function nativeEnumSchema(nativeEnum) {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
exports.nativeEnumSchema = nativeEnumSchema;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntityBase = exports.EntityActionType = void 0;
|
|
4
|
+
const utils_1 = require("@koalarx/utils");
|
|
4
5
|
const auto_mapping_list_1 = require("../mapping/auto-mapping-list");
|
|
5
6
|
const list_1 = require("../utils/list");
|
|
6
7
|
var EntityActionType;
|
|
@@ -36,6 +37,16 @@ class EntityBase {
|
|
|
36
37
|
}
|
|
37
38
|
this[key].setList(value);
|
|
38
39
|
}
|
|
40
|
+
else if (propDefinitions?.type === 'KlArray' &&
|
|
41
|
+
(props[key] instanceof Array || Array.isArray(props[key]))) {
|
|
42
|
+
this[key] = new utils_1.KlArray(props[key]);
|
|
43
|
+
}
|
|
44
|
+
else if (propDefinitions?.type === 'KlDate' && props[key] instanceof Date) {
|
|
45
|
+
this[key] = new utils_1.KlDate(props[key]);
|
|
46
|
+
}
|
|
47
|
+
else if (propDefinitions?.type === 'KlTime' && props[key] instanceof Date) {
|
|
48
|
+
this[key] = new utils_1.KlTime(props[key].getHours(), props[key].getMinutes(), props[key].getSeconds(), props[key].getMilliseconds());
|
|
49
|
+
}
|
|
39
50
|
else if (EntityOnPropKey) {
|
|
40
51
|
if (props[key]) {
|
|
41
52
|
const entity = new EntityOnPropKey();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Entity =
|
|
3
|
+
exports.Entity = Entity;
|
|
4
4
|
function Entity(id) {
|
|
5
5
|
return function (target) {
|
|
6
6
|
const originalConstructor = target;
|
|
@@ -29,4 +29,3 @@ function Entity(id) {
|
|
|
29
29
|
return NewConstructor;
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
exports.Entity = Entity;
|
|
@@ -13,7 +13,7 @@ exports.PrismaService = void 0;
|
|
|
13
13
|
const env_service_1 = require("../../env/env.service");
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const client_1 = require("@prisma/client");
|
|
16
|
-
let PrismaService =
|
|
16
|
+
let PrismaService = class PrismaService extends client_1.PrismaClient {
|
|
17
17
|
env;
|
|
18
18
|
constructor(env) {
|
|
19
19
|
super({
|
|
@@ -44,6 +44,7 @@ let PrismaService = exports.PrismaService = class PrismaService extends client_1
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
+
exports.PrismaService = PrismaService;
|
|
47
48
|
exports.PrismaService = PrismaService = __decorate([
|
|
48
49
|
(0, common_1.Injectable)(),
|
|
49
50
|
__metadata("design:paramtypes", [env_service_1.EnvService])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RepositoryBase = void 0;
|
|
4
|
-
const
|
|
4
|
+
const KlString_1 = require("@koalarx/utils/KlString");
|
|
5
5
|
const pagination_dto_1 = require("../dtos/pagination.dto");
|
|
6
6
|
const koala_global_vars_1 = require("../koala-global-vars");
|
|
7
7
|
const list_1 = require("../utils/list");
|
|
@@ -122,13 +122,13 @@ class RepositoryBase {
|
|
|
122
122
|
if (modelName) {
|
|
123
123
|
list.toArray('removed').forEach((item) => {
|
|
124
124
|
relationDeletes.push({
|
|
125
|
-
modelName: (0,
|
|
125
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
126
126
|
schema: { where: { id: item._id } },
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
129
|
list.toArray('updated').forEach((item) => {
|
|
130
130
|
relationUpdates.push({
|
|
131
|
-
modelName: (0,
|
|
131
|
+
modelName: (0, KlString_1.toCamelCase)(modelName),
|
|
132
132
|
schema: {
|
|
133
133
|
where: { id: item._id },
|
|
134
134
|
data: this.entityToPrisma(item),
|
|
@@ -174,7 +174,7 @@ class RepositoryBase {
|
|
|
174
174
|
if (!modelName)
|
|
175
175
|
throw new Error('modelName não informado no contrutor do repositorio');
|
|
176
176
|
if (transactionalClient) {
|
|
177
|
-
return transactionalClient[(0,
|
|
177
|
+
return transactionalClient[(0, KlString_1.toCamelCase)(modelName)];
|
|
178
178
|
}
|
|
179
179
|
return this._context[modelName];
|
|
180
180
|
}
|
|
@@ -198,7 +198,7 @@ class RepositoryBase {
|
|
|
198
198
|
Object.keys(entity)
|
|
199
199
|
.filter((key) => key === 'id' || key.includes('Id'))
|
|
200
200
|
.forEach((key) => (where[key] = entity[key]));
|
|
201
|
-
return client[(0,
|
|
201
|
+
return client[(0, KlString_1.toCamelCase)(entity.constructor.name)].delete({ where });
|
|
202
202
|
}
|
|
203
203
|
getIdPropName() {
|
|
204
204
|
return Reflect.getMetadata('entity:id', this._modelName.prototype) ?? 'id';
|
|
@@ -13,11 +13,12 @@ exports.HealthCheckController = void 0;
|
|
|
13
13
|
const is_public_decorator_1 = require("../../decorators/is-public.decorator");
|
|
14
14
|
const common_1 = require("@nestjs/common");
|
|
15
15
|
const swagger_1 = require("@nestjs/swagger");
|
|
16
|
-
let HealthCheckController =
|
|
16
|
+
let HealthCheckController = class HealthCheckController {
|
|
17
17
|
healthCheck() {
|
|
18
18
|
return { status: 'ok' };
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
|
+
exports.HealthCheckController = HealthCheckController;
|
|
21
22
|
__decorate([
|
|
22
23
|
(0, common_1.Get)(),
|
|
23
24
|
(0, is_public_decorator_1.IsPublic)(),
|
|
@@ -9,8 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.HealthCheckModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const health_check_controller_1 = require("./health-check.controller");
|
|
12
|
-
let HealthCheckModule =
|
|
12
|
+
let HealthCheckModule = class HealthCheckModule {
|
|
13
13
|
};
|
|
14
|
+
exports.HealthCheckModule = HealthCheckModule;
|
|
14
15
|
exports.HealthCheckModule = HealthCheckModule = __decorate([
|
|
15
16
|
(0, common_1.Module)({
|
|
16
17
|
controllers: [health_check_controller_1.HealthCheckController],
|
|
@@ -12,7 +12,7 @@ const common_1 = require("@nestjs/common");
|
|
|
12
12
|
const env_service_1 = require("../env/env.service");
|
|
13
13
|
const prisma_service_1 = require("./database/prisma.service");
|
|
14
14
|
exports.PRISMA_TOKEN = 'PRISMA_SERVICE_TOKEN';
|
|
15
|
-
let KoalaNestDatabaseModule =
|
|
15
|
+
let KoalaNestDatabaseModule = KoalaNestDatabaseModule_1 = class KoalaNestDatabaseModule {
|
|
16
16
|
static register(config) {
|
|
17
17
|
const imports = config.imports ?? [];
|
|
18
18
|
const repositoriesToExport = config.repositories?.map((repository) => repository.interface) ?? [];
|
|
@@ -46,6 +46,7 @@ let KoalaNestDatabaseModule = exports.KoalaNestDatabaseModule = KoalaNestDatabas
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
exports.KoalaNestDatabaseModule = KoalaNestDatabaseModule;
|
|
49
50
|
exports.KoalaNestDatabaseModule = KoalaNestDatabaseModule = KoalaNestDatabaseModule_1 = __decorate([
|
|
50
51
|
(0, common_1.Module)({})
|
|
51
52
|
], KoalaNestDatabaseModule);
|
|
@@ -11,7 +11,7 @@ exports.KoalaNestHttpModule = void 0;
|
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const env_service_1 = require("../env/env.service");
|
|
13
13
|
const auto_mapping_module_1 = require("./mapping/auto-mapping.module");
|
|
14
|
-
let KoalaNestHttpModule =
|
|
14
|
+
let KoalaNestHttpModule = class KoalaNestHttpModule {
|
|
15
15
|
static { KoalaNestHttpModule_1 = this; }
|
|
16
16
|
static _config;
|
|
17
17
|
static register(config) {
|
|
@@ -31,6 +31,7 @@ let KoalaNestHttpModule = exports.KoalaNestHttpModule = class KoalaNestHttpModul
|
|
|
31
31
|
KoalaNestHttpModule_1._config.middlewares?.forEach((middleware) => consumer.apply(middleware).forRoutes('*'));
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
+
exports.KoalaNestHttpModule = KoalaNestHttpModule;
|
|
34
35
|
exports.KoalaNestHttpModule = KoalaNestHttpModule = KoalaNestHttpModule_1 = __decorate([
|
|
35
36
|
(0, common_1.Module)({})
|
|
36
37
|
], KoalaNestHttpModule);
|
|
@@ -20,7 +20,7 @@ const redis_service_1 = require("../services/redis/redis.service");
|
|
|
20
20
|
const ired_lock_service_1 = require("../services/redlock/ired-lock.service");
|
|
21
21
|
const red_lock_service_1 = require("../services/redlock/red-lock.service");
|
|
22
22
|
const health_check_module_1 = require("./health-check/health-check.module");
|
|
23
|
-
let KoalaNestModule =
|
|
23
|
+
let KoalaNestModule = KoalaNestModule_1 = class KoalaNestModule {
|
|
24
24
|
static register(config) {
|
|
25
25
|
const controllers = config?.controllers ?? [];
|
|
26
26
|
const healthCheck = config?.healthCheck ?? health_check_module_1.HealthCheckModule;
|
|
@@ -60,6 +60,7 @@ let KoalaNestModule = exports.KoalaNestModule = KoalaNestModule_1 = class KoalaN
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
+
exports.KoalaNestModule = KoalaNestModule;
|
|
63
64
|
exports.KoalaNestModule = KoalaNestModule = KoalaNestModule_1 = __decorate([
|
|
64
65
|
(0, common_1.Module)({})
|
|
65
66
|
], KoalaNestModule);
|
|
@@ -7,8 +7,8 @@ export declare class AutoMappingClassContext implements IComparable<AutoMappingC
|
|
|
7
7
|
props: List<{
|
|
8
8
|
name: string;
|
|
9
9
|
type: any;
|
|
10
|
-
compositionType?: Type<any
|
|
11
|
-
compositionAction?: "onlySet" | "addTo"
|
|
10
|
+
compositionType?: Type<any>;
|
|
11
|
+
compositionAction?: "onlySet" | "addTo";
|
|
12
12
|
}>;
|
|
13
13
|
constructor(source: Type<any>);
|
|
14
14
|
equals(obj: AutoMappingClassContext): boolean;
|
|
@@ -16,8 +16,8 @@ export declare class AutoMappingList {
|
|
|
16
16
|
static getPropDefinitions(source: Type<any>, propName: string): {
|
|
17
17
|
name: string;
|
|
18
18
|
type: any;
|
|
19
|
-
compositionType?: Type<any
|
|
20
|
-
compositionAction?: "onlySet" | "addTo"
|
|
19
|
+
compositionType?: Type<any>;
|
|
20
|
+
compositionAction?: "onlySet" | "addTo";
|
|
21
21
|
} | null | undefined;
|
|
22
22
|
static getTargets(source: Type<any>): Type<any>[];
|
|
23
23
|
static addMappedProp(source: Type<any>, propName: string): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutoMap =
|
|
3
|
+
exports.AutoMap = AutoMap;
|
|
4
4
|
const auto_mapping_list_1 = require("./auto-mapping-list");
|
|
5
5
|
function AutoMap(config) {
|
|
6
6
|
return function (target, propertyKey) {
|
|
@@ -25,4 +25,3 @@ function AutoMap(config) {
|
|
|
25
25
|
auto_mapping_list_1.AutoMappingList.addMappedProp(target.constructor, propertyKey);
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
exports.AutoMap = AutoMap;
|
|
@@ -11,7 +11,7 @@ exports.AutoMappingModule = void 0;
|
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const auto_mapping_profile_1 = require("./auto-mapping-profile");
|
|
13
13
|
const auto_mapping_service_1 = require("./auto-mapping.service");
|
|
14
|
-
let AutoMappingModule =
|
|
14
|
+
let AutoMappingModule = AutoMappingModule_1 = class AutoMappingModule {
|
|
15
15
|
static register(profile) {
|
|
16
16
|
return {
|
|
17
17
|
module: AutoMappingModule_1,
|
|
@@ -23,6 +23,7 @@ let AutoMappingModule = exports.AutoMappingModule = AutoMappingModule_1 = class
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
+
exports.AutoMappingModule = AutoMappingModule;
|
|
26
27
|
exports.AutoMappingModule = AutoMappingModule = AutoMappingModule_1 = __decorate([
|
|
27
28
|
(0, common_1.Module)({})
|
|
28
29
|
], AutoMappingModule);
|
|
@@ -14,7 +14,7 @@ const common_1 = require("@nestjs/common");
|
|
|
14
14
|
const list_1 = require("../utils/list");
|
|
15
15
|
const auto_mapping_list_1 = require("./auto-mapping-list");
|
|
16
16
|
const auto_mapping_profile_1 = require("./auto-mapping-profile");
|
|
17
|
-
let AutoMappingService =
|
|
17
|
+
let AutoMappingService = class AutoMappingService {
|
|
18
18
|
_contextList = auto_mapping_list_1.AutoMappingList;
|
|
19
19
|
constructor(automappingProfile) {
|
|
20
20
|
automappingProfile.profile();
|
|
@@ -101,6 +101,7 @@ let AutoMappingService = exports.AutoMappingService = class AutoMappingService {
|
|
|
101
101
|
return value.map((item) => this.mapNestedProp(item, compositionType.prototype.constructor) ?? {});
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
+
exports.AutoMappingService = AutoMappingService;
|
|
104
105
|
exports.AutoMappingService = AutoMappingService = __decorate([
|
|
105
106
|
(0, common_1.Injectable)(),
|
|
106
107
|
__metadata("design:paramtypes", [auto_mapping_profile_1.AutoMappingProfile])
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMap =
|
|
3
|
+
exports.createMap = createMap;
|
|
4
4
|
const auto_mapping_list_1 = require("./auto-mapping-list");
|
|
5
5
|
function createMap(source, target, ...formMember) {
|
|
6
6
|
auto_mapping_list_1.AutoMappingList.add(source, target, ...formMember);
|
|
7
7
|
}
|
|
8
|
-
exports.createMap = createMap;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assignObject =
|
|
3
|
+
exports.assignObject = assignObject;
|
|
4
4
|
function assignObject(Target, source) {
|
|
5
5
|
return Object.assign(new Target(), source);
|
|
6
6
|
}
|
|
7
|
-
exports.assignObject = assignObject;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.instanciateClassWithDependenciesInjection =
|
|
3
|
+
exports.instanciateClassWithDependenciesInjection = instanciateClassWithDependenciesInjection;
|
|
4
4
|
function instanciateClassWithDependenciesInjection(app, Target) {
|
|
5
5
|
const dependencies = Reflect.getMetadata('design:paramtypes', Target) ?? [];
|
|
6
6
|
const injections = dependencies.map((dependency) => {
|
|
@@ -8,4 +8,3 @@ function instanciateClassWithDependenciesInjection(app, Target) {
|
|
|
8
8
|
});
|
|
9
9
|
return new Target(...injections);
|
|
10
10
|
}
|
|
11
|
-
exports.instanciateClassWithDependenciesInjection = instanciateClassWithDependenciesInjection;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setMaskDocumentNumber =
|
|
4
|
-
const
|
|
3
|
+
exports.setMaskDocumentNumber = setMaskDocumentNumber;
|
|
4
|
+
const KlString_1 = require("@koalarx/utils/KlString");
|
|
5
5
|
function setMaskDocumentNumber(document) {
|
|
6
6
|
if (!document) {
|
|
7
7
|
return '';
|
|
8
8
|
}
|
|
9
9
|
const documentWithoutMask = document.replace(/[^0-9]/g, '');
|
|
10
10
|
return documentWithoutMask.length === 11
|
|
11
|
-
? (0,
|
|
12
|
-
: (0,
|
|
11
|
+
? (0, KlString_1.maskCpf)(documentWithoutMask)
|
|
12
|
+
: (0, KlString_1.maskCnpj)(documentWithoutMask);
|
|
13
13
|
}
|
|
14
|
-
exports.setMaskDocumentNumber = setMaskDocumentNumber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiPropertyEnum =
|
|
3
|
+
exports.ApiPropertyEnum = ApiPropertyEnum;
|
|
4
4
|
const swagger_1 = require("@nestjs/swagger");
|
|
5
5
|
function ApiPropertyEnum(options) {
|
|
6
6
|
return function (target, propertyKey) {
|
|
@@ -19,4 +19,3 @@ function ApiPropertyEnum(options) {
|
|
|
19
19
|
})(target, propertyKey);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
exports.ApiPropertyEnum = ApiPropertyEnum;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UploadDecorator =
|
|
3
|
+
exports.UploadDecorator = UploadDecorator;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const file_validator_1 = require("../core/validators/file-validator");
|
|
6
6
|
function UploadDecorator(maxSizeInKb, filetype) {
|
|
@@ -16,4 +16,3 @@ function UploadDecorator(maxSizeInKb, filetype) {
|
|
|
16
16
|
fileIsRequired: false,
|
|
17
17
|
}));
|
|
18
18
|
}
|
|
19
|
-
exports.UploadDecorator = UploadDecorator;
|
package/env/env.module.js
CHANGED
|
@@ -9,8 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.EnvModule = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const env_service_1 = require("./env.service");
|
|
12
|
-
let EnvModule =
|
|
12
|
+
let EnvModule = class EnvModule {
|
|
13
13
|
};
|
|
14
|
+
exports.EnvModule = EnvModule;
|
|
14
15
|
exports.EnvModule = EnvModule = __decorate([
|
|
15
16
|
(0, common_1.Module)({
|
|
16
17
|
providers: [env_service_1.EnvService],
|
package/env/env.service.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.EnvService = void 0;
|
|
13
13
|
const common_1 = require("@nestjs/common");
|
|
14
14
|
const config_1 = require("@nestjs/config");
|
|
15
|
-
let EnvService =
|
|
15
|
+
let EnvService = class EnvService {
|
|
16
16
|
configService;
|
|
17
17
|
constructor(configService) {
|
|
18
18
|
this.configService = configService;
|
|
@@ -21,6 +21,7 @@ let EnvService = exports.EnvService = class EnvService {
|
|
|
21
21
|
return this.configService.get(key, { infer: true });
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
+
exports.EnvService = EnvService;
|
|
24
25
|
exports.EnvService = EnvService = __decorate([
|
|
25
26
|
(0, common_1.Injectable)(),
|
|
26
27
|
__metadata("design:paramtypes", [config_1.ConfigService])
|
|
@@ -23,7 +23,7 @@ const koala_global_vars_1 = require("../core/koala-global-vars");
|
|
|
23
23
|
const env_config_1 = require("../core/utils/env.config");
|
|
24
24
|
const filter_request_params_1 = require("../core/utils/filter-request-params");
|
|
25
25
|
const ilogging_service_1 = require("../services/logging/ilogging.service");
|
|
26
|
-
let DomainErrorsFilter =
|
|
26
|
+
let DomainErrorsFilter = class DomainErrorsFilter extends core_1.BaseExceptionFilter {
|
|
27
27
|
loggingService;
|
|
28
28
|
constructor(loggingService) {
|
|
29
29
|
super();
|
|
@@ -85,6 +85,7 @@ let DomainErrorsFilter = exports.DomainErrorsFilter = class DomainErrorsFilter e
|
|
|
85
85
|
return mappedException;
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
+
exports.DomainErrorsFilter = DomainErrorsFilter;
|
|
88
89
|
exports.DomainErrorsFilter = DomainErrorsFilter = __decorate([
|
|
89
90
|
(0, common_1.Catch)(not_allowed_error_1.NotAllowedError, resource_not_found_error_1.ResourceNotFoundError, user_already_exist_error_1.UserAlreadyExist, wrong_credentials_error_1.WrongCredentialsError, conflict_error_1.ConflictError, bad_request_error_1.BadRequestError, no_content_error_1.NoContentError),
|
|
90
91
|
__metadata("design:paramtypes", [ilogging_service_1.ILoggingService])
|
|
@@ -17,7 +17,7 @@ const koala_global_vars_1 = require("../core/koala-global-vars");
|
|
|
17
17
|
const env_config_1 = require("../core/utils/env.config");
|
|
18
18
|
const filter_request_params_1 = require("../core/utils/filter-request-params");
|
|
19
19
|
const ilogging_service_1 = require("../services/logging/ilogging.service");
|
|
20
|
-
let GlobalExceptionsFilter =
|
|
20
|
+
let GlobalExceptionsFilter = class GlobalExceptionsFilter extends core_1.BaseExceptionFilter {
|
|
21
21
|
loggingService;
|
|
22
22
|
constructor(loggingService) {
|
|
23
23
|
super();
|
|
@@ -61,6 +61,7 @@ let GlobalExceptionsFilter = exports.GlobalExceptionsFilter = class GlobalExcept
|
|
|
61
61
|
return filterRequestParams.response.status(statusCode).json(responseBody);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
exports.GlobalExceptionsFilter = GlobalExceptionsFilter;
|
|
64
65
|
exports.GlobalExceptionsFilter = GlobalExceptionsFilter = __decorate([
|
|
65
66
|
(0, common_1.Catch)(),
|
|
66
67
|
__metadata("design:paramtypes", [ilogging_service_1.ILoggingService])
|
|
@@ -17,7 +17,7 @@ const koala_global_vars_1 = require("../core/koala-global-vars");
|
|
|
17
17
|
const env_config_1 = require("../core/utils/env.config");
|
|
18
18
|
const filter_request_params_1 = require("../core/utils/filter-request-params");
|
|
19
19
|
const ilogging_service_1 = require("../services/logging/ilogging.service");
|
|
20
|
-
let PrismaValidationExceptionFilter =
|
|
20
|
+
let PrismaValidationExceptionFilter = class PrismaValidationExceptionFilter extends core_1.BaseExceptionFilter {
|
|
21
21
|
loggingService;
|
|
22
22
|
constructor(loggingService) {
|
|
23
23
|
super();
|
|
@@ -75,6 +75,7 @@ let PrismaValidationExceptionFilter = exports.PrismaValidationExceptionFilter =
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
+
exports.PrismaValidationExceptionFilter = PrismaValidationExceptionFilter;
|
|
78
79
|
exports.PrismaValidationExceptionFilter = PrismaValidationExceptionFilter = __decorate([
|
|
79
80
|
(0, common_1.Catch)(client_1.Prisma.PrismaClientKnownRequestError),
|
|
80
81
|
__metadata("design:paramtypes", [ilogging_service_1.ILoggingService])
|
|
@@ -18,7 +18,7 @@ const koala_global_vars_1 = require("../core/koala-global-vars");
|
|
|
18
18
|
const env_config_1 = require("../core/utils/env.config");
|
|
19
19
|
const filter_request_params_1 = require("../core/utils/filter-request-params");
|
|
20
20
|
const ilogging_service_1 = require("../services/logging/ilogging.service");
|
|
21
|
-
let ZodErrorsFilter =
|
|
21
|
+
let ZodErrorsFilter = class ZodErrorsFilter extends core_1.BaseExceptionFilter {
|
|
22
22
|
loggingService;
|
|
23
23
|
constructor(loggingService) {
|
|
24
24
|
super();
|
|
@@ -53,6 +53,7 @@ let ZodErrorsFilter = exports.ZodErrorsFilter = class ZodErrorsFilter extends co
|
|
|
53
53
|
.send(zodResponse);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
exports.ZodErrorsFilter = ZodErrorsFilter;
|
|
56
57
|
exports.ZodErrorsFilter = ZodErrorsFilter = __decorate([
|
|
57
58
|
(0, common_1.Catch)(zod_1.ZodError),
|
|
58
59
|
__metadata("design:paramtypes", [ilogging_service_1.ILoggingService])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koalarx/nest",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"homepage": "https://github.com/igordrangel/koala-nest#readme",
|
|
15
15
|
"types": "./koala-nest.d.ts",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@koalarx/utils": "^
|
|
17
|
+
"@koalarx/utils": "^4.1.1",
|
|
18
18
|
"@nestjs/common": "^11.0.12",
|
|
19
19
|
"@nestjs/config": "^4.0.1",
|
|
20
20
|
"@nestjs/core": "^11.0.12",
|
|
@@ -9,11 +9,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.LoggingService = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const consola_1 = require("consola");
|
|
12
|
-
let LoggingService =
|
|
12
|
+
let LoggingService = class LoggingService {
|
|
13
13
|
async report(data) {
|
|
14
14
|
consola_1.default.error(data.error);
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
+
exports.LoggingService = LoggingService;
|
|
17
18
|
exports.LoggingService = LoggingService = __decorate([
|
|
18
19
|
(0, common_1.Injectable)()
|
|
19
20
|
], LoggingService);
|