@grupo-argenta/schema-kit-nest 0.0.20 → 0.0.21
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/config/naming-strategy.d.ts +6 -0
- package/config/naming-strategy.js +17 -0
- package/config/redis.constants.d.ts +1 -0
- package/config/redis.constants.js +4 -0
- package/context-logger.service.d.ts +4 -0
- package/context-logger.service.js +23 -0
- package/decorators/date-range.d.ts +4 -0
- package/decorators/date-range.js +17 -0
- package/decorators/encrypted.d.ts +10 -0
- package/decorators/encrypted.js +15 -0
- package/decorators/file-column.d.ts +17 -0
- package/decorators/file-column.js +20 -0
- package/decorators/get-user.decorator.d.ts +6 -0
- package/decorators/get-user.decorator.js +12 -0
- package/decorators/luxon.d.ts +6 -0
- package/decorators/luxon.js +20 -0
- package/decorators/multipart.decorator.d.ts +4 -0
- package/decorators/multipart.decorator.js +51 -0
- package/decorators/post-get.decorator.d.ts +10 -0
- package/decorators/post-get.decorator.js +25 -0
- package/decorators/query-or-body.decorator.d.ts +8 -0
- package/decorators/query-or-body.decorator.js +15 -0
- package/decorators/when.decorator.d.ts +8 -0
- package/decorators/when.decorator.js +16 -0
- package/html/components/badge.d.ts +13 -0
- package/html/components/badge.js +29 -0
- package/html/components/colors.d.ts +11 -0
- package/html/components/colors.js +15 -0
- package/html/components/component.d.ts +11 -0
- package/html/components/component.js +35 -0
- package/html/components/default/default-footer.d.ts +6 -0
- package/html/components/default/default-footer.js +18 -0
- package/html/components/default/default-header.d.ts +13 -0
- package/html/components/default/default-header.js +30 -0
- package/html/components/env-badge.d.ts +7 -0
- package/html/components/env-badge.js +29 -0
- package/html/components/grid.d.ts +17 -0
- package/html/components/grid.js +44 -0
- package/html/components/shell.d.ts +18 -0
- package/html/components/shell.js +423 -0
- package/html/components/table.d.ts +16 -0
- package/html/components/table.js +55 -0
- package/html/components/unordered-list.d.ts +6 -0
- package/html/components/unordered-list.js +21 -0
- package/index.d.ts +49 -0
- package/index.js +65 -0
- package/interfaces/paginated-result.d.ts +21 -0
- package/interfaces/paginated-result.js +12 -0
- package/modules/auth/access-token.d.ts +27 -0
- package/modules/auth/access-token.js +14 -0
- package/modules/auth/known-module.d.ts +45 -0
- package/modules/auth/known-module.js +46 -0
- package/modules/auth/refresh-token.d.ts +18 -0
- package/modules/auth/refresh-token.js +2 -0
- package/modules/auth/token-type.d.ts +4 -0
- package/modules/auth/token-type.js +8 -0
- package/modules/encrypted-column/encrypted-column.module.d.ts +16 -0
- package/modules/encrypted-column/encrypted-column.module.js +35 -0
- package/modules/pubsub/pubsub-dynamic-topic.service.d.ts +77 -0
- package/modules/pubsub/pubsub-dynamic-topic.service.js +324 -0
- package/modules/pubsub/pubsub-redeliver-subscriber.service.d.ts +14 -0
- package/modules/pubsub/pubsub-redeliver-subscriber.service.js +77 -0
- package/modules/pubsub/pubsub-redeliver.service.d.ts +22 -0
- package/modules/pubsub/pubsub-redeliver.service.js +48 -0
- package/modules/pubsub/pubsub.constants.d.ts +2 -0
- package/modules/pubsub/pubsub.constants.js +5 -0
- package/modules/pubsub/pubsub.methods.d.ts +18 -0
- package/modules/pubsub/pubsub.methods.js +18 -0
- package/modules/pubsub/pubsub.methods.redelivery.d.ts +3 -0
- package/modules/pubsub/pubsub.methods.redelivery.js +2 -0
- package/modules/redis/redis.module.d.ts +10 -0
- package/modules/redis/redis.module.js +59 -0
- package/modules/redis/redis.options.d.ts +7 -0
- package/modules/redis/redis.options.js +4 -0
- package/modules/storage/storage.service.d.ts +16 -0
- package/modules/storage/storage.service.js +61 -0
- package/monitoramento/http-request-log/http-request-log.controller.d.ts +184 -0
- package/monitoramento/http-request-log/http-request-log.controller.js +32 -0
- package/monitoramento/http-request-log/http-request-log.dto.d.ts +220 -0
- package/monitoramento/http-request-log/http-request-log.dto.js +42 -0
- package/monitoramento/http-request-log/http-request-log.entity.d.ts +17 -0
- package/monitoramento/http-request-log/http-request-log.entity.js +87 -0
- package/monitoramento/http-request-log/http-request-log.module.d.ts +2 -0
- package/monitoramento/http-request-log/http-request-log.module.js +26 -0
- package/monitoramento/http-request-log/http-request-log.service.d.ts +8 -0
- package/monitoramento/http-request-log/http-request-log.service.js +35 -0
- package/monitoramento/index.d.ts +17 -0
- package/monitoramento/index.js +33 -0
- package/monitoramento/migrations/1792689106394-create_http_request_logs_table.d.ts +5 -0
- package/monitoramento/migrations/1792689106394-create_http_request_logs_table.js +96 -0
- package/monitoramento/migrations/1792689106395-create_pubsub_message_logs_table.d.ts +5 -0
- package/monitoramento/migrations/1792689106395-create_pubsub_message_logs_table.js +157 -0
- package/monitoramento/monitoramento.constants.d.ts +2 -0
- package/monitoramento/monitoramento.constants.js +5 -0
- package/monitoramento/monitoramento.entities.d.ts +1 -0
- package/monitoramento/monitoramento.entities.js +7 -0
- package/monitoramento/monitoramento.module.d.ts +6 -0
- package/monitoramento/monitoramento.module.js +61 -0
- package/monitoramento/monitoramento.options.d.ts +15 -0
- package/monitoramento/monitoramento.options.js +2 -0
- package/monitoramento/outbound-request.interceptor.d.ts +14 -0
- package/monitoramento/outbound-request.interceptor.js +113 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.controller.d.ts +257 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.controller.js +34 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.dto.d.ts +320 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.dto.js +57 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.entity.d.ts +44 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.entity.js +152 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.module.d.ts +2 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.module.js +26 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.service.d.ts +20 -0
- package/monitoramento/pubsub-message-log/pubsub-message-log.service.js +99 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.controller.d.ts +9 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.controller.js +45 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.module.d.ts +11 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.module.js +41 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.options.d.ts +10 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.options.js +4 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.service.d.ts +68 -0
- package/monitoramento/pubsub-self-check/pubsub-self-check.service.js +213 -0
- package/package.json +1 -1
- package/schema/abstract.entity.d.ts +28 -0
- package/schema/abstract.entity.js +68 -0
- package/schema/schema-builder.d.ts +131 -0
- package/schema/schema-builder.js +162 -0
- package/schema/schema.controller.d.ts +51 -0
- package/schema/schema.controller.js +121 -0
- package/schema/schema.service.d.ts +81 -0
- package/schema/schema.service.js +305 -0
- package/schema/typeorm-extensions.d.ts +6 -0
- package/schema/typeorm-extensions.js +6 -0
- package/schema/zod-extensions/cnpj.validator.d.ts +28 -0
- package/schema/zod-extensions/cnpj.validator.js +133 -0
- package/schema/zod-extensions/cpf-cnpj.validator.d.ts +2 -0
- package/schema/zod-extensions/cpf-cnpj.validator.js +8 -0
- package/schema/zod-extensions/cpf.validator.d.ts +18 -0
- package/schema/zod-extensions/cpf.validator.js +166 -0
- package/schema/zod-extensions.d.ts +50 -0
- package/schema/zod-extensions.js +144 -0
- package/schema-kit.module.d.ts +2 -0
- package/schema-kit.module.js +23 -0
- package/transformers/date-range.transformer.d.ts +6 -0
- package/transformers/date-range.transformer.js +44 -0
- package/transformers/encrypted.transformer.d.ts +11 -0
- package/transformers/encrypted.transformer.js +35 -0
- package/transformers/luxon.transformer.d.ts +3 -0
- package/transformers/luxon.transformer.js +12 -0
- package/utils/utils.d.ts +49 -0
- package/utils/utils.js +79 -0
- package/validators/ip-validator.d.ts +3 -0
- package/validators/ip-validator.js +8 -0
- package/validators/pubsub-delete.validator.d.ts +6 -0
- package/validators/pubsub-delete.validator.js +11 -0
- package/validators/url-validator.d.ts +3 -0
- package/validators/url-validator.js +8 -0
- package/validators/uuid-validator.d.ts +3 -0
- package/validators/uuid-validator.js +8 -0
package/utils/utils.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
declare function SHA256(message: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* const iv = crypto.randomBytes(12).toString('hex');
|
|
5
|
+
* const encrypted = Utils.AES256GCM.encrypt({
|
|
6
|
+
* data: 'TESTING',
|
|
7
|
+
* iv,
|
|
8
|
+
* key: this.environmentService.get('ENCRYPTION_AES_KEY_KEYSETS'),
|
|
9
|
+
* })
|
|
10
|
+
* @param option
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
declare function encryptAES256GCM(option: {
|
|
14
|
+
data: string;
|
|
15
|
+
iv: string;
|
|
16
|
+
key: string;
|
|
17
|
+
}): string;
|
|
18
|
+
/**
|
|
19
|
+
* @example
|
|
20
|
+
* const decrypted = Utils.AES256GCM.decrypt({
|
|
21
|
+
* data: encrypted,
|
|
22
|
+
* iv,
|
|
23
|
+
* key: this.environmentService.get('ENCRYPTION_AES_KEY_KEYSETS'),
|
|
24
|
+
* })
|
|
25
|
+
* @param options
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
declare function decryptAES256GCM(options: {
|
|
29
|
+
data: string;
|
|
30
|
+
iv: string;
|
|
31
|
+
key: string;
|
|
32
|
+
}): string;
|
|
33
|
+
declare function generateRSAKeyPair(): {
|
|
34
|
+
publicKey: string;
|
|
35
|
+
privateKey: string;
|
|
36
|
+
};
|
|
37
|
+
declare function randomBytes(size: number): string;
|
|
38
|
+
export declare const Utils: {
|
|
39
|
+
SHA256: typeof SHA256;
|
|
40
|
+
AES256GCM: {
|
|
41
|
+
encrypt: typeof encryptAES256GCM;
|
|
42
|
+
decrypt: typeof decryptAES256GCM;
|
|
43
|
+
};
|
|
44
|
+
RSA: {
|
|
45
|
+
generateKeyPair: typeof generateRSAKeyPair;
|
|
46
|
+
};
|
|
47
|
+
randomBytes: typeof randomBytes;
|
|
48
|
+
};
|
|
49
|
+
export {};
|
package/utils/utils.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Utils = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
8
|
+
const buffer_1 = require("buffer");
|
|
9
|
+
function SHA256(message) {
|
|
10
|
+
return crypto_1.default.createHash('sha256').update(message).digest('hex');
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @example
|
|
14
|
+
* const iv = crypto.randomBytes(12).toString('hex');
|
|
15
|
+
* const encrypted = Utils.AES256GCM.encrypt({
|
|
16
|
+
* data: 'TESTING',
|
|
17
|
+
* iv,
|
|
18
|
+
* key: this.environmentService.get('ENCRYPTION_AES_KEY_KEYSETS'),
|
|
19
|
+
* })
|
|
20
|
+
* @param option
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
function encryptAES256GCM(option) {
|
|
24
|
+
const encoding = 'hex';
|
|
25
|
+
const cypher = crypto_1.default.createCipheriv('aes-256-gcm', buffer_1.Buffer.from(option.key, encoding), buffer_1.Buffer.from(option.iv, encoding));
|
|
26
|
+
const encrypted = buffer_1.Buffer.concat([cypher.update(option.data, 'utf8'), cypher.final()]);
|
|
27
|
+
const tag = cypher.getAuthTag();
|
|
28
|
+
return buffer_1.Buffer.concat([encrypted, tag]).toString(encoding);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @example
|
|
32
|
+
* const decrypted = Utils.AES256GCM.decrypt({
|
|
33
|
+
* data: encrypted,
|
|
34
|
+
* iv,
|
|
35
|
+
* key: this.environmentService.get('ENCRYPTION_AES_KEY_KEYSETS'),
|
|
36
|
+
* })
|
|
37
|
+
* @param options
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
function decryptAES256GCM(options) {
|
|
41
|
+
const encoding = 'hex';
|
|
42
|
+
const dataBuffer = buffer_1.Buffer.from(options.data, encoding);
|
|
43
|
+
const key = buffer_1.Buffer.from(options.key, encoding);
|
|
44
|
+
const iv = buffer_1.Buffer.from(options.iv, encoding);
|
|
45
|
+
const authTag = dataBuffer.subarray(dataBuffer.length - 16);
|
|
46
|
+
const encrypted = dataBuffer.subarray(0, dataBuffer.length - 16);
|
|
47
|
+
const decipher = crypto_1.default.createDecipheriv('aes-256-gcm', key, iv);
|
|
48
|
+
decipher.setAuthTag(authTag);
|
|
49
|
+
const decrypted = buffer_1.Buffer.concat([decipher.update(encrypted), decipher.final()]);
|
|
50
|
+
return decrypted.toString('utf8');
|
|
51
|
+
}
|
|
52
|
+
function generateRSAKeyPair() {
|
|
53
|
+
const { publicKey, privateKey } = crypto_1.default.generateKeyPairSync('rsa', {
|
|
54
|
+
modulusLength: 2048,
|
|
55
|
+
publicKeyEncoding: {
|
|
56
|
+
type: 'spki',
|
|
57
|
+
format: 'pem',
|
|
58
|
+
},
|
|
59
|
+
privateKeyEncoding: {
|
|
60
|
+
type: 'pkcs8',
|
|
61
|
+
format: 'pem',
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
return { publicKey, privateKey };
|
|
65
|
+
}
|
|
66
|
+
function randomBytes(size) {
|
|
67
|
+
return crypto_1.default.randomBytes(size).toString('hex');
|
|
68
|
+
}
|
|
69
|
+
exports.Utils = {
|
|
70
|
+
SHA256,
|
|
71
|
+
AES256GCM: {
|
|
72
|
+
encrypt: encryptAES256GCM,
|
|
73
|
+
decrypt: decryptAES256GCM,
|
|
74
|
+
},
|
|
75
|
+
RSA: {
|
|
76
|
+
generateKeyPair: generateRSAKeyPair,
|
|
77
|
+
},
|
|
78
|
+
randomBytes,
|
|
79
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ipSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.ipSchema = zod_1.default.ipv4().or(zod_1.default.ipv6());
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PubSubDeleteSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.PubSubDeleteSchema = zod_1.default.object({
|
|
9
|
+
uuid: zod_1.default.uuidv7({ message: 'Invalid UUID format' }),
|
|
10
|
+
soft: zod_1.default.boolean(),
|
|
11
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.urlSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.urlSchema = zod_1.default.url();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.UuidSchema = void 0;
|
|
7
|
+
const zod_1 = __importDefault(require("zod"));
|
|
8
|
+
exports.UuidSchema = zod_1.default.uuid({ message: 'Invalid UUID format' });
|