@koalarx/nest 0.1.0 → 1.0.1
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.d.ts +14 -0
- package/{common → core}/backgroud-services/cron-service/cron-job.js +18 -16
- package/core/backgroud-services/cron-service/cron-job.spec.d.ts +8 -0
- package/core/backgroud-services/cron-service/cron-job.spec.js +33 -0
- package/core/backgroud-services/event-service/event-class.d.ts +5 -0
- package/{common → core}/backgroud-services/event-service/event-class.js +3 -3
- package/core/backgroud-services/event-service/event-handler.d.ts +5 -0
- package/core/backgroud-services/event-service/event-job.d.ts +13 -0
- package/{common → core}/backgroud-services/event-service/event-job.js +4 -2
- package/{common → core}/backgroud-services/event-service/event-queue.js +7 -4
- package/core/backgroud-services/event-service/event-queue.spec.d.ts +1 -0
- package/core/backgroud-services/event-service/event-queue.spec.js +34 -0
- package/core/controllers/created-registre-response.base.d.ts +4 -0
- package/core/controllers/schemas/boolean.schema.d.ts +2 -0
- package/core/controllers/schemas/boolean.schema.js +15 -0
- package/core/database/entity.base.d.ts +9 -0
- package/core/database/entity.base.js +39 -0
- package/core/database/repository.base.d.ts +6 -11
- package/core/database/repository.base.js +24 -21
- package/core/koala-app.d.ts +10 -8
- package/core/koala-app.js +41 -8
- package/core/koala-global-vars.d.ts +7 -0
- package/core/koala-global-vars.js +9 -0
- package/core/koala-nest-database.module.js +2 -2
- package/core/koala-nest-http.module.d.ts +3 -3
- package/core/koala-nest-http.module.js +5 -9
- package/core/koala-nest.module.js +4 -3
- package/core/mapping/auto-mapping-class-context.d.ts +15 -0
- package/core/mapping/auto-mapping-class-context.js +18 -0
- package/core/mapping/auto-mapping-context.d.ts +11 -0
- package/core/mapping/auto-mapping-context.js +24 -0
- package/core/mapping/auto-mapping-list.d.ts +18 -0
- package/core/mapping/auto-mapping-list.js +46 -0
- package/core/mapping/auto-mapping-profile.d.ts +3 -0
- package/core/mapping/auto-mapping-profile.js +6 -0
- package/core/mapping/auto-mapping.decorator.d.ts +9 -0
- package/core/mapping/auto-mapping.decorator.js +27 -0
- package/core/mapping/auto-mapping.module.d.ts +5 -0
- package/core/mapping/auto-mapping.module.js +28 -0
- package/core/mapping/auto-mapping.service.d.ts +10 -0
- package/core/mapping/auto-mapping.service.js +93 -0
- package/core/mapping/create-map.d.ts +3 -0
- package/core/mapping/create-map.js +8 -0
- package/core/mapping/for-member.d.ts +5 -0
- package/core/mapping/for-member.js +9 -0
- package/{common → core}/models/pagination-params.d.ts +3 -0
- package/{common/mediator → core/request-overflow}/request-handler.base.d.ts +1 -1
- package/core/request-overflow/request-result.spec.d.ts +1 -0
- package/core/request-overflow/request-result.spec.js +21 -0
- package/{common/mediator → core/request-overflow}/request-validator.base.d.ts +1 -1
- package/core/utils/assing-object.d.ts +2 -0
- package/core/utils/assing-object.js +7 -0
- package/core/utils/list.d.ts +10 -7
- package/core/utils/list.js +31 -9
- package/core/utils/list.spec.d.ts +1 -0
- package/core/utils/list.spec.js +42 -0
- package/{services/env → env}/env.d.ts +6 -6
- package/{services/env → env}/env.js +2 -2
- package/{services/env → env}/env.service.d.ts +2 -2
- package/filters/domain-errors.filter.d.ts +7 -7
- package/filters/domain-errors.filter.js +7 -7
- package/package.json +10 -27
- package/services/redis/redis.service.d.ts +1 -1
- package/services/redis/redis.service.js +1 -1
- package/test/koala-app-test-dependencies.d.ts +10 -0
- package/test/koala-app-test-dependencies.js +13 -0
- package/test/koala-app-test.d.ts +20 -0
- package/test/koala-app-test.js +66 -0
- package/test/repositories/in-memory-base.repository.d.ts +16 -0
- package/test/repositories/in-memory-base.repository.js +55 -0
- package/test/services/fake-logging.service.d.ts +4 -0
- package/test/services/fake-logging.service.js +9 -0
- package/test/services/fake-red-lock.service.d.ts +5 -0
- package/test/services/fake-red-lock.service.js +11 -0
- package/test/utils/create-e2e-database.d.ts +2 -0
- package/test/utils/create-e2e-database.js +27 -0
- package/test/utils/drop-e2e-database.d.ts +1 -0
- package/test/utils/drop-e2e-database.js +8 -0
- package/test/utils/wait-for.d.ts +1 -0
- package/test/utils/wait-for.js +22 -0
- package/tsconfig.lib.tsbuildinfo +1 -1
- package/common/backgroud-services/cron-service/cron-job.d.ts +0 -15
- package/common/backgroud-services/event-service/event-class.d.ts +0 -5
- package/common/backgroud-services/event-service/event-handler.d.ts +0 -5
- package/common/backgroud-services/event-service/event-job.d.ts +0 -10
- package/common/controllers/created-registre-response.base.d.ts +0 -4
- package/core/database/entity.d.ts +0 -8
- package/core/database/entity.js +0 -28
- package/decorators/is-cnpj.decorator.d.ts +0 -2
- package/decorators/is-cnpj.decorator.js +0 -71
- /package/{common → core}/backgroud-services/event-service/event-handler.js +0 -0
- /package/{common → core}/backgroud-services/event-service/event-is-trigger.d.ts +0 -0
- /package/{common → core}/backgroud-services/event-service/event-is-trigger.js +0 -0
- /package/{common → core}/backgroud-services/event-service/event-queue.d.ts +0 -0
- /package/{common → core}/controllers/base.controller.d.ts +0 -0
- /package/{common → core}/controllers/base.controller.js +0 -0
- /package/{common → core}/controllers/created-registre-response.base.js +0 -0
- /package/{common → core}/controllers/list-response.base.d.ts +0 -0
- /package/{common → core}/controllers/list-response.base.js +0 -0
- /package/{common → core}/controllers/router-config.base.d.ts +0 -0
- /package/{common → core}/controllers/router-config.base.js +0 -0
- /package/{common → core}/controllers/schemas/document-number.schema.d.ts +0 -0
- /package/{common → core}/controllers/schemas/document-number.schema.js +0 -0
- /package/{common → core}/controllers/schemas/email.schema.d.ts +0 -0
- /package/{common → core}/controllers/schemas/email.schema.js +0 -0
- /package/{common → core}/controllers/schemas/list-query.schema.d.ts +0 -0
- /package/{common → core}/controllers/schemas/list-query.schema.js +0 -0
- /package/{common → core}/controllers/schemas/native-enum.schema.d.ts +0 -0
- /package/{common → core}/controllers/schemas/native-enum.schema.js +0 -0
- /package/{services/prisma → core/database}/prisma-client-with-custom-transaction.interface.d.ts +0 -0
- /package/{services/prisma → core/database}/prisma-client-with-custom-transaction.interface.js +0 -0
- /package/{services/prisma → core/database}/prisma-transactional-client.d.ts +0 -0
- /package/{services/prisma → core/database}/prisma-transactional-client.js +0 -0
- /package/{services/prisma → core/database}/prisma.service.d.ts +0 -0
- /package/{services/prisma → core/database}/prisma.service.js +0 -0
- /package/{common → core}/errors/bad-request.error.d.ts +0 -0
- /package/{common → core}/errors/bad-request.error.js +0 -0
- /package/{common → core}/errors/conflict.error.d.ts +0 -0
- /package/{common → core}/errors/conflict.error.js +0 -0
- /package/{common → core}/errors/no-content.error.d.ts +0 -0
- /package/{common → core}/errors/no-content.error.js +0 -0
- /package/{common → core}/errors/not-allowed.error.d.ts +0 -0
- /package/{common → core}/errors/not-allowed.error.js +0 -0
- /package/{common → core}/errors/resource-not-found.error.d.ts +0 -0
- /package/{common → core}/errors/resource-not-found.error.js +0 -0
- /package/{common → core}/errors/use-case-error.d.ts +0 -0
- /package/{common → core}/errors/use-case-error.js +0 -0
- /package/{common → core}/errors/user-already-exist.error.d.ts +0 -0
- /package/{common → core}/errors/user-already-exist.error.js +0 -0
- /package/{common → core}/errors/wrong-credentials.error.d.ts +0 -0
- /package/{common → core}/errors/wrong-credentials.error.js +0 -0
- /package/{common → core}/models/pagination-params.js +0 -0
- /package/{common/mediator → core/request-overflow}/request-handler.base.js +0 -0
- /package/{common/mediator → core/request-overflow}/request-result.d.ts +0 -0
- /package/{common/mediator → core/request-overflow}/request-result.js +0 -0
- /package/{common/mediator → core/request-overflow}/request-validator.base.js +0 -0
- /package/{services/env → env}/env.module.d.ts +0 -0
- /package/{services/env → env}/env.module.js +0 -0
- /package/{services/env → env}/env.service.js +0 -0
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ILoggingService } from '../../../services/logging/ilogging.service';
|
|
2
|
-
import { IRedLockService } from '../../../services/redlock/ired-lock.service';
|
|
3
|
-
import { RequestResult } from '../../mediator/request-result';
|
|
4
|
-
export type CronJobResponse = RequestResult<Error, null>;
|
|
5
|
-
export declare abstract class CronJob {
|
|
6
|
-
private readonly redlockService;
|
|
7
|
-
private readonly loggingService;
|
|
8
|
-
private readonly loggedUsername;
|
|
9
|
-
private readonly appName;
|
|
10
|
-
readonly timeout: number;
|
|
11
|
-
protected constructor(redlockService: IRedLockService, loggingService: ILoggingService, loggedUsername: string, appName: string, timeInMinutes: number);
|
|
12
|
-
abstract run(): Promise<void>;
|
|
13
|
-
protected abstract isActive(): Promise<boolean>;
|
|
14
|
-
protected start(job: () => Promise<CronJobResponse>): Promise<void>;
|
|
15
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Entity } from '../../../core/database/entity';
|
|
2
|
-
import { IComparable } from '../../../core/utils/interfaces/icomparable';
|
|
3
|
-
import { EventClass } from './event-class';
|
|
4
|
-
import { EventQueue } from './event-queue';
|
|
5
|
-
export declare class EventJob<TEntity extends IComparable> extends Entity<TEntity> {
|
|
6
|
-
private _eventQueue;
|
|
7
|
-
get eventQueue(): EventQueue[];
|
|
8
|
-
clearQueue(): void;
|
|
9
|
-
addEvent(event: EventClass<EventJob<TEntity>>): void;
|
|
10
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Optional } from '../@types';
|
|
2
|
-
import { IComparable, IComparableId } from '../utils/interfaces/icomparable';
|
|
3
|
-
export type EntityProps<T extends IComparable<T>> = Omit<Optional<T, '_id'>, 'equals'>;
|
|
4
|
-
export declare abstract class Entity<T extends IComparable<T>> implements IComparable<T> {
|
|
5
|
-
_id: IComparableId;
|
|
6
|
-
protected automap(props: EntityProps<T>): void;
|
|
7
|
-
equals(obj: Entity<T>): boolean;
|
|
8
|
-
}
|
package/core/database/entity.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Entity = void 0;
|
|
4
|
-
const list_1 = require("../utils/list");
|
|
5
|
-
class Entity {
|
|
6
|
-
_id;
|
|
7
|
-
automap(props) {
|
|
8
|
-
Object.keys(props ?? {}).forEach((key) => {
|
|
9
|
-
if (Array.isArray(props[key]) && this[key] instanceof list_1.List) {
|
|
10
|
-
let value = props[key];
|
|
11
|
-
if (this[key].entityType) {
|
|
12
|
-
value = value.map((item) => new this[key].entityType(item));
|
|
13
|
-
}
|
|
14
|
-
this[key].setList(value);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
if (key === 'id') {
|
|
18
|
-
this._id = props[key];
|
|
19
|
-
}
|
|
20
|
-
this[key] = props[key];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
equals(obj) {
|
|
25
|
-
return obj._id === this._id;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.Entity = Entity;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IsCNPJ = void 0;
|
|
4
|
-
const class_validator_1 = require("class-validator");
|
|
5
|
-
function IsCNPJ(validationOptions) {
|
|
6
|
-
return function (object, propertyName) {
|
|
7
|
-
(0, class_validator_1.registerDecorator)({
|
|
8
|
-
name: 'IsCNPJ',
|
|
9
|
-
target: object.constructor,
|
|
10
|
-
propertyName,
|
|
11
|
-
options: validationOptions,
|
|
12
|
-
validator: {
|
|
13
|
-
validate(value) {
|
|
14
|
-
return isValidCNPJ(value);
|
|
15
|
-
},
|
|
16
|
-
defaultMessage(args) {
|
|
17
|
-
return `${args.property} inválido`;
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
exports.IsCNPJ = IsCNPJ;
|
|
24
|
-
function isValidCNPJ(value) {
|
|
25
|
-
value = value.replace(/[^\d]+/g, '');
|
|
26
|
-
if (value === '') {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
if (value.length !== 14) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (value === '00000000000000' ||
|
|
33
|
-
value === '11111111111111' ||
|
|
34
|
-
value === '22222222222222' ||
|
|
35
|
-
value === '33333333333333' ||
|
|
36
|
-
value === '44444444444444' ||
|
|
37
|
-
value === '55555555555555' ||
|
|
38
|
-
value === '66666666666666' ||
|
|
39
|
-
value === '77777777777777' ||
|
|
40
|
-
value === '88888888888888' ||
|
|
41
|
-
value === '99999999999999') {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
let tamanho = value.length - 2;
|
|
45
|
-
let numeros = value.substring(0, tamanho);
|
|
46
|
-
const digitos = value.substring(tamanho);
|
|
47
|
-
let soma = 0;
|
|
48
|
-
let pos = tamanho - 7;
|
|
49
|
-
for (let i = tamanho; i >= 1; i--) {
|
|
50
|
-
soma += parseInt(numeros.charAt(tamanho - i), 10) * pos--;
|
|
51
|
-
if (pos < 2) {
|
|
52
|
-
pos = 9;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
let resultado = soma % 11 < 2 ? 0 : 11 - (soma % 11);
|
|
56
|
-
if (resultado !== parseInt(digitos.charAt(0), 10)) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
tamanho = tamanho + 1;
|
|
60
|
-
numeros = value.substring(0, tamanho);
|
|
61
|
-
soma = 0;
|
|
62
|
-
pos = tamanho - 7;
|
|
63
|
-
for (let i = tamanho; i >= 1; i--) {
|
|
64
|
-
soma += parseInt(numeros.charAt(tamanho - i), 10) * pos--;
|
|
65
|
-
if (pos < 2) {
|
|
66
|
-
pos = 9;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
resultado = soma % 11 < 2 ? 0 : 11 - (soma % 11);
|
|
70
|
-
return !(resultado !== parseInt(digitos.charAt(1), 10));
|
|
71
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{services/prisma → core/database}/prisma-client-with-custom-transaction.interface.d.ts
RENAMED
|
File without changes
|
/package/{services/prisma → core/database}/prisma-client-with-custom-transaction.interface.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|