@nest-omni/core 1.0.2 → 1.0.3
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/package.json +1 -1
- package/dist/boilerplate.polyfill.d.ts +0 -39
- package/dist/boilerplate.polyfill.js +0 -66
- package/dist/boilerplate.polyfill.js.map +0 -1
- package/dist/common/abstract-client.service.d.ts +0 -16
- package/dist/common/abstract-client.service.js +0 -26
- package/dist/common/abstract-client.service.js.map +0 -1
- package/dist/common/abstract.entity.d.ts +0 -17
- package/dist/common/abstract.entity.js +0 -71
- package/dist/common/abstract.entity.js.map +0 -1
- package/dist/common/dto/abstract.dto.d.ts +0 -13
- package/dist/common/dto/abstract.dto.js +0 -63
- package/dist/common/dto/abstract.dto.js.map +0 -1
- package/dist/common/dto/bulk-id.dto.d.ts +0 -3
- package/dist/common/dto/bulk-id.dto.js +0 -29
- package/dist/common/dto/bulk-id.dto.js.map +0 -1
- package/dist/common/dto/create-translation.dto.d.ts +0 -5
- package/dist/common/dto/create-translation.dto.js +0 -28
- package/dist/common/dto/create-translation.dto.js.map +0 -1
- package/dist/common/dto/page-meta.dto.d.ts +0 -15
- package/dist/common/dto/page-meta.dto.js +0 -55
- package/dist/common/dto/page-meta.dto.js.map +0 -1
- package/dist/common/dto/page-options.dto.d.ts +0 -8
- package/dist/common/dto/page-options.dto.js +0 -52
- package/dist/common/dto/page-options.dto.js.map +0 -1
- package/dist/common/dto/page.dto.d.ts +0 -11
- package/dist/common/dto/page.dto.js +0 -61
- package/dist/common/dto/page.dto.js.map +0 -1
- package/dist/common/utils.d.ts +0 -3
- package/dist/common/utils.js +0 -26
- package/dist/common/utils.js.map +0 -1
- package/dist/constants/index.d.ts +0 -4
- package/dist/constants/index.js +0 -21
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/language-code.d.ts +0 -5
- package/dist/constants/language-code.js +0 -10
- package/dist/constants/language-code.js.map +0 -1
- package/dist/constants/order.d.ts +0 -4
- package/dist/constants/order.js +0 -9
- package/dist/constants/order.js.map +0 -1
- package/dist/constants/role-type.d.ts +0 -4
- package/dist/constants/role-type.js +0 -9
- package/dist/constants/role-type.js.map +0 -1
- package/dist/constants/token-type.d.ts +0 -4
- package/dist/constants/token-type.js +0 -9
- package/dist/constants/token-type.js.map +0 -1
- package/dist/decorators/api-page-ok-response.decorator.d.ts +0 -5
- package/dist/decorators/api-page-ok-response.decorator.js +0 -26
- package/dist/decorators/api-page-ok-response.decorator.js.map +0 -1
- package/dist/decorators/auth-user.decorator.d.ts +0 -1
- package/dist/decorators/auth-user.decorator.js +0 -16
- package/dist/decorators/auth-user.decorator.js.map +0 -1
- package/dist/decorators/controller.decorator.d.ts +0 -1
- package/dist/decorators/controller.decorator.js +0 -12
- package/dist/decorators/controller.decorator.js.map +0 -1
- package/dist/decorators/field.decorators.d.ts +0 -71
- package/dist/decorators/field.decorators.js +0 -457
- package/dist/decorators/field.decorators.js.map +0 -1
- package/dist/decorators/http.decorators.d.ts +0 -3
- package/dist/decorators/http.decorators.js +0 -9
- package/dist/decorators/http.decorators.js.map +0 -1
- package/dist/decorators/index.d.ts +0 -12
- package/dist/decorators/index.js +0 -29
- package/dist/decorators/index.js.map +0 -1
- package/dist/decorators/omni-auth.decorator.d.ts +0 -8
- package/dist/decorators/omni-auth.decorator.js +0 -36
- package/dist/decorators/omni-auth.decorator.js.map +0 -1
- package/dist/decorators/operation.decorator.d.ts +0 -1
- package/dist/decorators/operation.decorator.js +0 -7
- package/dist/decorators/operation.decorator.js.map +0 -1
- package/dist/decorators/property.decorators.d.ts +0 -15
- package/dist/decorators/property.decorators.js +0 -43
- package/dist/decorators/property.decorators.js.map +0 -1
- package/dist/decorators/public-route.decorator.d.ts +0 -3
- package/dist/decorators/public-route.decorator.js +0 -8
- package/dist/decorators/public-route.decorator.js.map +0 -1
- package/dist/decorators/swagger.schema.d.ts +0 -5
- package/dist/decorators/swagger.schema.js +0 -80
- package/dist/decorators/swagger.schema.js.map +0 -1
- package/dist/decorators/timestamp-column.decorator.d.ts +0 -1
- package/dist/decorators/timestamp-column.decorator.js +0 -29
- package/dist/decorators/timestamp-column.decorator.js.map +0 -1
- package/dist/decorators/transform.decorators.d.ts +0 -8
- package/dist/decorators/transform.decorators.js +0 -96
- package/dist/decorators/transform.decorators.js.map +0 -1
- package/dist/decorators/translate.decorator.d.ts +0 -5
- package/dist/decorators/translate.decorator.js +0 -18
- package/dist/decorators/translate.decorator.js.map +0 -1
- package/dist/decorators/use-dto.decorator.d.ts +0 -4
- package/dist/decorators/use-dto.decorator.js +0 -10
- package/dist/decorators/use-dto.decorator.js.map +0 -1
- package/dist/decorators/user-check.decorator.d.ts +0 -6
- package/dist/decorators/user-check.decorator.js +0 -22
- package/dist/decorators/user-check.decorator.js.map +0 -1
- package/dist/decorators/user.decorator.d.ts +0 -8
- package/dist/decorators/user.decorator.js +0 -39
- package/dist/decorators/user.decorator.js.map +0 -1
- package/dist/decorators/user_auth.decorator.d.ts +0 -1
- package/dist/decorators/user_auth.decorator.js +0 -17
- package/dist/decorators/user_auth.decorator.js.map +0 -1
- package/dist/decorators/validator.decorators.d.ts +0 -10
- package/dist/decorators/validator.decorators.js +0 -63
- package/dist/decorators/validator.decorators.js.map +0 -1
- package/dist/exceptions/file-not-image.exception.d.ts +0 -4
- package/dist/exceptions/file-not-image.exception.js +0 -11
- package/dist/exceptions/file-not-image.exception.js.map +0 -1
- package/dist/exceptions/index.d.ts +0 -2
- package/dist/exceptions/index.js +0 -19
- package/dist/exceptions/index.js.map +0 -1
- package/dist/exceptions/page-type.exception.d.ts +0 -4
- package/dist/exceptions/page-type.exception.js +0 -11
- package/dist/exceptions/page-type.exception.js.map +0 -1
- package/dist/exceptions/user-not-found.exception.d.ts +0 -4
- package/dist/exceptions/user-not-found.exception.js +0 -11
- package/dist/exceptions/user-not-found.exception.js.map +0 -1
- package/dist/filters/bad-request.filter.d.ts +0 -5
- package/dist/filters/bad-request.filter.js +0 -65
- package/dist/filters/bad-request.filter.js.map +0 -1
- package/dist/filters/constraint-errors.d.ts +0 -1
- package/dist/filters/constraint-errors.js +0 -7
- package/dist/filters/constraint-errors.js.map +0 -1
- package/dist/filters/index.d.ts +0 -3
- package/dist/filters/index.js +0 -20
- package/dist/filters/index.js.map +0 -1
- package/dist/filters/query-failed.filter.d.ts +0 -10
- package/dist/filters/query-failed.filter.js +0 -43
- package/dist/filters/query-failed.filter.js.map +0 -1
- package/dist/health-checker/health-checker.controller.d.ts +0 -15
- package/dist/health-checker/health-checker.controller.js +0 -68
- package/dist/health-checker/health-checker.controller.js.map +0 -1
- package/dist/health-checker/health-checker.module.d.ts +0 -2
- package/dist/health-checker/health-checker.module.js +0 -26
- package/dist/health-checker/health-checker.module.js.map +0 -1
- package/dist/health-checker/health-indicators/service.indicator.d.ts +0 -8
- package/dist/health-checker/health-indicators/service.indicator.js +0 -57
- package/dist/health-checker/health-indicators/service.indicator.js.map +0 -1
- package/dist/helpers/common.helper.d.ts +0 -3
- package/dist/helpers/common.helper.js +0 -37
- package/dist/helpers/common.helper.js.map +0 -1
- package/dist/helpers/date.helper.d.ts +0 -10
- package/dist/helpers/date.helper.js +0 -59
- package/dist/helpers/date.helper.js.map +0 -1
- package/dist/helpers/index.d.ts +0 -3
- package/dist/helpers/index.js +0 -20
- package/dist/helpers/index.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.js +0 -28
- package/dist/index.js.map +0 -1
- package/dist/interceptors/auth-user.interceptor.d.ts +0 -4
- package/dist/interceptors/auth-user.interceptor.js +0 -25
- package/dist/interceptors/auth-user.interceptor.js.map +0 -1
- package/dist/interceptors/index.d.ts +0 -2
- package/dist/interceptors/index.js +0 -19
- package/dist/interceptors/index.js.map +0 -1
- package/dist/interceptors/language-interceptor.service.d.ts +0 -6
- package/dist/interceptors/language-interceptor.service.js +0 -31
- package/dist/interceptors/language-interceptor.service.js.map +0 -1
- package/dist/interceptors/translation-interceptor.service.d.ts +0 -5
- package/dist/interceptors/translation-interceptor.service.js +0 -35
- package/dist/interceptors/translation-interceptor.service.js.map +0 -1
- package/dist/interfaces/IApiFile.d.ts +0 -4
- package/dist/interfaces/IApiFile.js +0 -3
- package/dist/interfaces/IApiFile.js.map +0 -1
- package/dist/interfaces/IFile.d.ts +0 -9
- package/dist/interfaces/IFile.js +0 -3
- package/dist/interfaces/IFile.js.map +0 -1
- package/dist/interfaces/ITranslationDecoratorInterface.d.ts +0 -3
- package/dist/interfaces/ITranslationDecoratorInterface.js +0 -3
- package/dist/interfaces/ITranslationDecoratorInterface.js.map +0 -1
- package/dist/interfaces/index.d.ts +0 -3
- package/dist/interfaces/index.js +0 -20
- package/dist/interfaces/index.js.map +0 -1
- package/dist/interfaces/response.d.ts +0 -25
- package/dist/interfaces/response.js +0 -3
- package/dist/interfaces/response.js.map +0 -1
- package/dist/middlewares/index.d.ts +0 -3
- package/dist/middlewares/index.js +0 -20
- package/dist/middlewares/index.js.map +0 -1
- package/dist/middlewares/omni-auth.middleware.d.ts +0 -1
- package/dist/middlewares/omni-auth.middleware.js +0 -14
- package/dist/middlewares/omni-auth.middleware.js.map +0 -1
- package/dist/middlewares/powerby.middleware.d.ts +0 -1
- package/dist/middlewares/powerby.middleware.js +0 -11
- package/dist/middlewares/powerby.middleware.js.map +0 -1
- package/dist/middlewares/request-id.middleware.d.ts +0 -7
- package/dist/middlewares/request-id.middleware.js +0 -23
- package/dist/middlewares/request-id.middleware.js.map +0 -1
- package/dist/providers/context.provider.d.ts +0 -32
- package/dist/providers/context.provider.js +0 -71
- package/dist/providers/context.provider.js.map +0 -1
- package/dist/providers/generator.provider.d.ts +0 -9
- package/dist/providers/generator.provider.js +0 -51
- package/dist/providers/generator.provider.js.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.js +0 -19
- package/dist/providers/index.js.map +0 -1
- package/dist/setup/bootstrap.setup.d.ts +0 -5
- package/dist/setup/bootstrap.setup.js +0 -102
- package/dist/setup/bootstrap.setup.js.map +0 -1
- package/dist/setup/index.d.ts +0 -1
- package/dist/setup/index.js +0 -18
- package/dist/setup/index.js.map +0 -1
- package/dist/setup-swagger.d.ts +0 -2
- package/dist/setup-swagger.js +0 -63
- package/dist/setup-swagger.js.map +0 -1
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/index.js +0 -19
- package/dist/shared/index.js.map +0 -1
- package/dist/shared/serviceRegistryModule.d.ts +0 -2
- package/dist/shared/serviceRegistryModule.js +0 -102
- package/dist/shared/serviceRegistryModule.js.map +0 -1
- package/dist/shared/services/api-config.service.d.ts +0 -70
- package/dist/shared/services/api-config.service.js +0 -286
- package/dist/shared/services/api-config.service.js.map +0 -1
- package/dist/shared/services/aws-s3.service.d.ts +0 -10
- package/dist/shared/services/aws-s3.service.js +0 -49
- package/dist/shared/services/aws-s3.service.js.map +0 -1
- package/dist/shared/services/generator.service.d.ts +0 -4
- package/dist/shared/services/generator.service.js +0 -24
- package/dist/shared/services/generator.service.js.map +0 -1
- package/dist/shared/services/index.d.ts +0 -5
- package/dist/shared/services/index.js +0 -22
- package/dist/shared/services/index.js.map +0 -1
- package/dist/shared/services/translation.service.d.ts +0 -9
- package/dist/shared/services/translation.service.js +0 -61
- package/dist/shared/services/translation.service.js.map +0 -1
- package/dist/shared/services/validator.service.d.ts +0 -3
- package/dist/shared/services/validator.service.js +0 -21
- package/dist/shared/services/validator.service.js.map +0 -1
- package/dist/snake-naming.strategy.d.ts +0 -11
- package/dist/snake-naming.strategy.js +0 -38
- package/dist/snake-naming.strategy.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -9
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/validators/file-mimetype.validator.d.ts +0 -13
- package/dist/validators/file-mimetype.validator.js +0 -24
- package/dist/validators/file-mimetype.validator.js.map +0 -1
- package/dist/validators/index.d.ts +0 -3
- package/dist/validators/index.js +0 -20
- package/dist/validators/index.js.map +0 -1
- package/dist/validators/is-exists.validator.d.ts +0 -18
- package/dist/validators/is-exists.validator.js +0 -52
- package/dist/validators/is-exists.validator.js.map +0 -1
- package/dist/validators/is-unique.validator.d.ts +0 -17
- package/dist/validators/is-unique.validator.js +0 -83
- package/dist/validators/is-unique.validator.js.map +0 -1
- package/dist/validators/phone-country-code.validator.d.ts +0 -2
- package/dist/validators/phone-country-code.validator.js +0 -31
- package/dist/validators/phone-country-code.validator.js.map +0 -1
- package/dist/validators/same-as.validator.d.ts +0 -2
- package/dist/validators/same-as.validator.js +0 -26
- package/dist/validators/same-as.validator.js.map +0 -1
- package/dist/validators/skip-empty.validator.d.ts +0 -1
- package/dist/validators/skip-empty.validator.js +0 -19
- package/dist/validators/skip-empty.validator.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"page-type.exception.js","sourceRoot":"","sources":["../../src/exceptions/page-type.exception.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AAErD,MAAa,iBAAkB,SAAQ,4BAAmB;IACxD;QACE,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1B,CAAC;CACF;AAJD,8CAIC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserNotFoundException = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
class UserNotFoundException extends common_1.NotFoundException {
|
|
6
|
-
constructor(error) {
|
|
7
|
-
super('error.userNotFound', error);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.UserNotFoundException = UserNotFoundException;
|
|
11
|
-
//# sourceMappingURL=user-not-found.exception.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-not-found.exception.js","sourceRoot":"","sources":["../../src/exceptions/user-not-found.exception.ts"],"names":[],"mappings":";;;AAAA,2CAAmD;AAEnD,MAAa,qBAAsB,SAAQ,0BAAiB;IAC1D,YAAY,KAAc;QACxB,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.HttpExceptionFilter = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const typeorm_1 = require("typeorm");
|
|
12
|
-
const nestjs_i18n_1 = require("nestjs-i18n");
|
|
13
|
-
let HttpExceptionFilter = class HttpExceptionFilter {
|
|
14
|
-
catch(exception, host) {
|
|
15
|
-
const i18n = nestjs_i18n_1.I18nContext.current(host);
|
|
16
|
-
const ctx = host.switchToHttp();
|
|
17
|
-
const response = ctx.getResponse();
|
|
18
|
-
const request = ctx.getRequest();
|
|
19
|
-
let statusCode = exception instanceof common_1.HttpException ? exception.getStatus() : 500;
|
|
20
|
-
let error = exception instanceof common_1.HttpException
|
|
21
|
-
? exception.message
|
|
22
|
-
: 'Internal server error';
|
|
23
|
-
if (exception instanceof typeorm_1.EntityNotFoundError) {
|
|
24
|
-
statusCode = 404;
|
|
25
|
-
error = 'Entity not found';
|
|
26
|
-
}
|
|
27
|
-
if (statusCode === 500) {
|
|
28
|
-
console.error(exception);
|
|
29
|
-
}
|
|
30
|
-
const getFirstError = (error, property = '') => {
|
|
31
|
-
if (error?.children?.length > 0) {
|
|
32
|
-
const firstError = error.children[0];
|
|
33
|
-
firstError['property'] = `${property}.${firstError['property']}`;
|
|
34
|
-
return getFirstError(firstError, firstError.property);
|
|
35
|
-
}
|
|
36
|
-
return error;
|
|
37
|
-
};
|
|
38
|
-
if (exception instanceof nestjs_i18n_1.I18nValidationException) {
|
|
39
|
-
const firstErros = getFirstError(exception.errors[0], exception.errors[0].property);
|
|
40
|
-
const constraint = Object.values(firstErros.constraints)[0];
|
|
41
|
-
const [translationKey, argsString] = constraint.split('|');
|
|
42
|
-
const args = !!argsString ? JSON.parse(argsString) : {};
|
|
43
|
-
error = i18n.translate(translationKey, {
|
|
44
|
-
args: {
|
|
45
|
-
property: firstErros.property,
|
|
46
|
-
value: firstErros.value,
|
|
47
|
-
constraints: firstErros.constraints,
|
|
48
|
-
...args,
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const parseJson = {
|
|
53
|
-
code: statusCode,
|
|
54
|
-
msg: error,
|
|
55
|
-
requestId: request.id,
|
|
56
|
-
timestamp: new Date().toISOString(),
|
|
57
|
-
};
|
|
58
|
-
return response.status(200).json(parseJson);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
exports.HttpExceptionFilter = HttpExceptionFilter;
|
|
62
|
-
exports.HttpExceptionFilter = HttpExceptionFilter = __decorate([
|
|
63
|
-
(0, common_1.Catch)()
|
|
64
|
-
], HttpExceptionFilter);
|
|
65
|
-
//# sourceMappingURL=bad-request.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bad-request.filter.js","sourceRoot":"","sources":["../../src/filters/bad-request.filter.ts"],"names":[],"mappings":";;;;;;;;;AACA,2CAAsD;AAEtD,qCAA8C;AAC9C,6CAAmE;AAG5D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,KAAK,CAAC,SAAS,EAAE,IAAmB;QAClC,MAAM,IAAI,GAAG,yBAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,M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AU,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAW,CAAC;YACtE,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3D,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACxD,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE;gBACrC,IAAI,EAAE;oBACJ,QAAQ,EAAE,UAAU,CAAC,QAAQ;oBAC7B,KAAK,EAAE,UAAU,CAAC,KAAK;oBACvB,WAAW,EAAE,UAAU,CAAC,WAAW;oBACnC,GAAG,IAAI;iBACR;aACF,CAAC,CAAC;QACL,CAAC;QAED,MAAM,SAAS,GAAG;YAChB,IAAI,EAAE,UAAU;YAChB,GAAG,EAAE,KAAK;YACV,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACpC,CAAC;QAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;CACF,CAAA;AA3DY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,cAAK,GAAE;GACK,mBAAmB,CA2D/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const constraintErrors: Record<string, string>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constraint-errors.js","sourceRoot":"","sources":["../../src/filters/constraint-errors.ts"],"names":[],"mappings":";;;AAEa,QAAA,gBAAgB,GAA2B;IACtD,8BAA8B,EAAE,oBAAoB;CACrD,CAAC"}
|
package/dist/filters/index.d.ts
DELETED
package/dist/filters/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./bad-request.filter"), exports);
|
|
18
|
-
__exportStar(require("./constraint-errors"), exports);
|
|
19
|
-
__exportStar(require("./query-failed.filter"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,sDAAoC;AACpC,wDAAsC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common';
|
|
2
|
-
import { Reflector } from '@nestjs/core';
|
|
3
|
-
import { QueryFailedError } from 'typeorm';
|
|
4
|
-
export declare class QueryFailedFilter implements ExceptionFilter<QueryFailedError> {
|
|
5
|
-
reflector: Reflector;
|
|
6
|
-
constructor(reflector: Reflector);
|
|
7
|
-
catch(exception: QueryFailedError & {
|
|
8
|
-
constraint?: string;
|
|
9
|
-
}, host: ArgumentsHost): void;
|
|
10
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.QueryFailedFilter = void 0;
|
|
13
|
-
const common_1 = require("@nestjs/common");
|
|
14
|
-
const core_1 = require("@nestjs/core");
|
|
15
|
-
const http_1 = require("http");
|
|
16
|
-
const typeorm_1 = require("typeorm");
|
|
17
|
-
const constraint_errors_1 = require("./constraint-errors");
|
|
18
|
-
let QueryFailedFilter = class QueryFailedFilter {
|
|
19
|
-
reflector;
|
|
20
|
-
constructor(reflector) {
|
|
21
|
-
this.reflector = reflector;
|
|
22
|
-
}
|
|
23
|
-
catch(exception, host) {
|
|
24
|
-
const ctx = host.switchToHttp();
|
|
25
|
-
const response = ctx.getResponse();
|
|
26
|
-
const status = exception.constraint?.startsWith('UQ')
|
|
27
|
-
? common_1.HttpStatus.CONFLICT
|
|
28
|
-
: common_1.HttpStatus.INTERNAL_SERVER_ERROR;
|
|
29
|
-
response.status(status).json({
|
|
30
|
-
code: status,
|
|
31
|
-
error: http_1.STATUS_CODES[status],
|
|
32
|
-
msg: exception.constraint
|
|
33
|
-
? constraint_errors_1.constraintErrors[exception.constraint]
|
|
34
|
-
: undefined,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.QueryFailedFilter = QueryFailedFilter;
|
|
39
|
-
exports.QueryFailedFilter = QueryFailedFilter = __decorate([
|
|
40
|
-
(0, common_1.Catch)(typeorm_1.QueryFailedError),
|
|
41
|
-
__metadata("design:paramtypes", [core_1.Reflector])
|
|
42
|
-
], QueryFailedFilter);
|
|
43
|
-
//# sourceMappingURL=query-failed.filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"query-failed.filter.js","sourceRoot":"","sources":["../../src/filters/query-failed.filter.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,2CAAmD;AACnD,uCAAyC;AACzC,+BAAoC;AACpC,qCAA2C;AAE3C,2DAAuD;AAGhD,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACT;IAAnB,YAAmB,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE3C,KAAK,CACH,SAAqD,EACrD,IAAmB;QAEnB,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAEnC,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC;YACnD,CAAC,CAAC,mBAAU,CAAC,QAAQ;YACrB,CAAC,CAAC,mBAAU,CAAC,qBAAqB,CAAC;QAErC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC3B,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,mBAAY,CAAC,MAAM,CAAC;YAC3B,GAAG,EAAE,SAAS,CAAC,UAAU;gBACvB,CAAC,CAAC,oCAAgB,CAAC,SAAS,CAAC,UAAU,CAAC;gBACxC,CAAC,CAAC,SAAS;SACd,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AAtBY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,cAAK,EAAC,0BAAgB,CAAC;qCAEQ,gBAAS;GAD5B,iBAAiB,CAsB7B"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HealthCheckResult } from '@nestjs/terminus';
|
|
2
|
-
import { HealthCheckService, TypeOrmHealthIndicator } from '@nestjs/terminus';
|
|
3
|
-
import { ServiceHealthIndicator } from './health-indicators/service.indicator';
|
|
4
|
-
import { RedisHealthIndicator } from '@liaoliaots/nestjs-redis-health';
|
|
5
|
-
import { ApiConfigService } from '../shared/services';
|
|
6
|
-
export declare class HealthCheckerController {
|
|
7
|
-
private configService;
|
|
8
|
-
private healthCheckService;
|
|
9
|
-
private ormIndicator;
|
|
10
|
-
private serviceIndicator;
|
|
11
|
-
private redisIndicator;
|
|
12
|
-
private readonly redis;
|
|
13
|
-
constructor(configService: ApiConfigService, healthCheckService: HealthCheckService, ormIndicator: TypeOrmHealthIndicator, serviceIndicator: ServiceHealthIndicator, redisIndicator: RedisHealthIndicator);
|
|
14
|
-
check(): Promise<HealthCheckResult>;
|
|
15
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.HealthCheckerController = void 0;
|
|
13
|
-
const ioredis_1 = require("ioredis");
|
|
14
|
-
const common_1 = require("@nestjs/common");
|
|
15
|
-
const terminus_1 = require("@nestjs/terminus");
|
|
16
|
-
const service_indicator_1 = require("./health-indicators/service.indicator");
|
|
17
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
18
|
-
const nestjs_redis_health_1 = require("@liaoliaots/nestjs-redis-health");
|
|
19
|
-
const services_1 = require("../shared/services");
|
|
20
|
-
let HealthCheckerController = class HealthCheckerController {
|
|
21
|
-
configService;
|
|
22
|
-
healthCheckService;
|
|
23
|
-
ormIndicator;
|
|
24
|
-
serviceIndicator;
|
|
25
|
-
redisIndicator;
|
|
26
|
-
redis;
|
|
27
|
-
constructor(configService, healthCheckService, ormIndicator, serviceIndicator, redisIndicator) {
|
|
28
|
-
this.configService = configService;
|
|
29
|
-
this.healthCheckService = healthCheckService;
|
|
30
|
-
this.ormIndicator = ormIndicator;
|
|
31
|
-
this.serviceIndicator = serviceIndicator;
|
|
32
|
-
this.redisIndicator = redisIndicator;
|
|
33
|
-
if (this.configService.isRedisEnabled) {
|
|
34
|
-
this.redis = new ioredis_1.default(this.configService.ioRedisConfig);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
async check() {
|
|
38
|
-
const indicator = [
|
|
39
|
-
() => this.ormIndicator.pingCheck('database', { timeout: 1500 }),
|
|
40
|
-
];
|
|
41
|
-
if (this.configService.isRedisEnabled) {
|
|
42
|
-
indicator.push(() => this.redisIndicator.checkHealth('redis', {
|
|
43
|
-
type: 'redis',
|
|
44
|
-
client: this.redis,
|
|
45
|
-
timeout: 1500,
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
return this.healthCheckService.check(indicator);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
exports.HealthCheckerController = HealthCheckerController;
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, common_1.Get)(),
|
|
54
|
-
(0, terminus_1.HealthCheck)(),
|
|
55
|
-
(0, swagger_1.ApiOperation)({ summary: 'Service health check' }),
|
|
56
|
-
__metadata("design:type", Function),
|
|
57
|
-
__metadata("design:paramtypes", []),
|
|
58
|
-
__metadata("design:returntype", Promise)
|
|
59
|
-
], HealthCheckerController.prototype, "check", null);
|
|
60
|
-
exports.HealthCheckerController = HealthCheckerController = __decorate([
|
|
61
|
-
(0, common_1.Controller)('health'),
|
|
62
|
-
__metadata("design:paramtypes", [services_1.ApiConfigService,
|
|
63
|
-
terminus_1.HealthCheckService,
|
|
64
|
-
terminus_1.TypeOrmHealthIndicator,
|
|
65
|
-
service_indicator_1.ServiceHealthIndicator,
|
|
66
|
-
nestjs_redis_health_1.RedisHealthIndicator])
|
|
67
|
-
], HealthCheckerController);
|
|
68
|
-
//# sourceMappingURL=health-checker.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health-checker.controller.js","sourceRoot":"","sources":["../../src/health-checker/health-checker.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA4B;AAC5B,2CAAiD;AAEjD,+CAI0B;AAE1B,6EAA+E;AAC/E,6CAA+C;AAC/C,yEAAuE;AACvE,iDAAsD;AAG/C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAIxB;IACA;IACA;IACA;IACA;IAPO,KAAK,CAAQ;IAE9B,YACU,aAA+B,EAC/B,kBAAsC,EACtC,YAAoC,EACpC,gBAAwC,EACxC,cAAoC;QAJpC,kBAAa,GAAb,aAAa,CAAkB;QAC/B,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,iBAAY,GAAZ,YAAY,CAAwB;QACpC,qBAAgB,GAAhB,gBAAgB,CAAwB;QACxC,mBAAc,GAAd,cAAc,CAAsB;QAE5C,IAAI,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;YACtC,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAC3D,CAAC;IACH,CAAC;IAKK,AAAN,KAAK,CAAC,KAAK;QACT,MAAM,SAAS,GAAG;YAChB,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;SACjE,CAAC;QAEF,IAAI,IAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;YACtC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,CAClB,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,OAAO,EAAE;gBACvC,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE,IAAI,CAAC,KAAK;gBAClB,OAAO,EAAE,IAAI;aACd,CAAC,CACH,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,CAAC;CACF,CAAA;AAnCY,0DAAuB;AAkB5B;IAHL,IAAA,YAAG,GAAE;IACL,IAAA,sBAAW,GAAE;IACb,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;;;;oDAiBjD;kCAlCU,uBAAuB;IADnC,IAAA,mBAAU,EAAC,QAAQ,CAAC;qCAKM,2BAAgB;QACX,6BAAkB;QACxB,iCAAsB;QAClB,0CAAsB;QACxB,0CAAoB;GARnC,uBAAuB,CAmCnC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.HealthCheckerModule = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
const terminus_1 = require("@nestjs/terminus");
|
|
12
|
-
const nestjs_redis_health_1 = require("@liaoliaots/nestjs-redis-health");
|
|
13
|
-
const health_checker_controller_1 = require("./health-checker.controller");
|
|
14
|
-
const service_indicator_1 = require("./health-indicators/service.indicator");
|
|
15
|
-
const services_1 = require("../shared/services");
|
|
16
|
-
let HealthCheckerModule = class HealthCheckerModule {
|
|
17
|
-
};
|
|
18
|
-
exports.HealthCheckerModule = HealthCheckerModule;
|
|
19
|
-
exports.HealthCheckerModule = HealthCheckerModule = __decorate([
|
|
20
|
-
(0, common_1.Module)({
|
|
21
|
-
imports: [terminus_1.TerminusModule, nestjs_redis_health_1.RedisHealthModule],
|
|
22
|
-
controllers: [health_checker_controller_1.HealthCheckerController],
|
|
23
|
-
providers: [services_1.ApiConfigService, service_indicator_1.ServiceHealthIndicator],
|
|
24
|
-
})
|
|
25
|
-
], HealthCheckerModule);
|
|
26
|
-
//# sourceMappingURL=health-checker.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health-checker.module.js","sourceRoot":"","sources":["../../src/health-checker/health-checker.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,+CAAkD;AAClD,yEAAoE;AACpE,2EAAsE;AACtE,6EAA+E;AAC/E,iDAAsD;AAO/C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,kDAAmB;8BAAnB,mBAAmB;IAL/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,yBAAc,EAAE,uCAAiB,CAAC;QAC5C,WAAW,EAAE,CAAC,mDAAuB,CAAC;QACtC,SAAS,EAAE,CAAC,2BAAgB,EAAE,0CAAsB,CAAC;KACtD,CAAC;GACW,mBAAmB,CAAG"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ClientProxy } from '@nestjs/microservices';
|
|
2
|
-
import type { HealthIndicatorResult } from '@nestjs/terminus';
|
|
3
|
-
import { HealthIndicator } from '@nestjs/terminus';
|
|
4
|
-
export declare class ServiceHealthIndicator extends HealthIndicator {
|
|
5
|
-
private readonly clientProxy?;
|
|
6
|
-
constructor(clientProxy?: ClientProxy);
|
|
7
|
-
isHealthy(eventName: string): Promise<HealthIndicatorResult>;
|
|
8
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.ServiceHealthIndicator = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const microservices_1 = require("@nestjs/microservices");
|
|
18
|
-
const terminus_1 = require("@nestjs/terminus");
|
|
19
|
-
const rxjs_1 = require("rxjs");
|
|
20
|
-
const operators_1 = require("rxjs/operators");
|
|
21
|
-
let ServiceHealthIndicator = class ServiceHealthIndicator extends terminus_1.HealthIndicator {
|
|
22
|
-
clientProxy;
|
|
23
|
-
constructor(clientProxy) {
|
|
24
|
-
super();
|
|
25
|
-
this.clientProxy = clientProxy;
|
|
26
|
-
}
|
|
27
|
-
async isHealthy(eventName) {
|
|
28
|
-
try {
|
|
29
|
-
if (!this.clientProxy) {
|
|
30
|
-
return {
|
|
31
|
-
[eventName]: {
|
|
32
|
-
status: 'down',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const result = await (0, rxjs_1.firstValueFrom)(this.clientProxy.send(eventName, { check: true }).pipe((0, operators_1.timeout)(10000)), {
|
|
37
|
-
defaultValue: undefined,
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
[eventName]: result,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
throw new terminus_1.HealthCheckError(`${eventName} failed`, {
|
|
45
|
-
[eventName]: error,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
exports.ServiceHealthIndicator = ServiceHealthIndicator;
|
|
51
|
-
exports.ServiceHealthIndicator = ServiceHealthIndicator = __decorate([
|
|
52
|
-
(0, common_1.Injectable)(),
|
|
53
|
-
__param(0, (0, common_1.Optional)()),
|
|
54
|
-
__param(0, (0, common_1.Inject)('NATS_SERVICE')),
|
|
55
|
-
__metadata("design:paramtypes", [microservices_1.ClientProxy])
|
|
56
|
-
], ServiceHealthIndicator);
|
|
57
|
-
//# sourceMappingURL=service.indicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"service.indicator.js","sourceRoot":"","sources":["../../../src/health-checker/health-indicators/service.indicator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA8D;AAC9D,yDAAoD;AAEpD,+CAAqE;AACrE,+BAAsC;AACtC,8CAAyC;AAGlC,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,0BAAe;IAItC;IAHnB,YAGmB,WAAyB;QAE1C,KAAK,EAAE,CAAC;QAFS,gBAAW,GAAX,WAAW,CAAc;IAG5C,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,IAAI,CAAC;YACH,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO;oBACL,CAAC,SAAS,CAAC,EAAE;wBACX,MAAM,EAAE,MAAM;qBACf;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAc,EACjC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAA,mBAAO,EAAC,KAAK,CAAC,CAAC,EACtE;gBACE,YAAY,EAAE,SAAS;aACxB,CACF,CAAC;YAEF,OAAO;gBACL,CAAC,SAAS,CAAC,EAAE,MAAM;aACpB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,2BAAgB,CAAC,GAAG,SAAS,SAAS,EAAE;gBAChD,CAAC,SAAS,CAAC,EAAE,KAAK;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF,CAAA;AAnCY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IACV,WAAA,IAAA,eAAM,EAAC,cAAc,CAAC,CAAA;qCACQ,2BAAW;GAJjC,sBAAsB,CAmClC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIPAdress = exports.randomString = exports.enumToArray = void 0;
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
function enumToArray(Enum) {
|
|
6
|
-
return Object.keys(Enum)
|
|
7
|
-
.filter((key) => typeof Enum[key] === 'number')
|
|
8
|
-
.map((key) => Enum[key]);
|
|
9
|
-
}
|
|
10
|
-
exports.enumToArray = enumToArray;
|
|
11
|
-
const randomString = (length = 8, charSet) => {
|
|
12
|
-
charSet =
|
|
13
|
-
charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
14
|
-
let randomString = '';
|
|
15
|
-
for (let i = 0; i < length; i++) {
|
|
16
|
-
const randomPoz = Math.floor(Math.random() * charSet.length);
|
|
17
|
-
randomString += charSet.substring(randomPoz, randomPoz + 1);
|
|
18
|
-
}
|
|
19
|
-
return randomString;
|
|
20
|
-
};
|
|
21
|
-
exports.randomString = randomString;
|
|
22
|
-
function getIPAdress() {
|
|
23
|
-
const interfaces = (0, os_1.networkInterfaces)();
|
|
24
|
-
for (const devName in interfaces) {
|
|
25
|
-
const iface = interfaces[devName];
|
|
26
|
-
for (let i = 0; i < iface.length; i++) {
|
|
27
|
-
const alias = iface[i];
|
|
28
|
-
if (alias.family === 'IPv4' &&
|
|
29
|
-
alias.address !== '127.0.0.1' &&
|
|
30
|
-
!alias.internal) {
|
|
31
|
-
return alias.address;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.getIPAdress = getIPAdress;
|
|
37
|
-
//# sourceMappingURL=common.helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.helper.js","sourceRoot":"","sources":["../../src/helpers/common.helper.ts"],"names":[],"mappings":";;;AAAA,2BAAuC;AAMvC,SAAgB,WAAW,CAAI,IAAS;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SACrB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,IAAI,CAAC,GAAU,CAAC,KAAK,QAAQ,CAAC;SACrD,GAAG,CAAC,CAAC,GAAG,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-
export declare function timestamp(value?: number): number;
|
|
3
|
-
export declare function strToTimeStamp(str: string | Date): number;
|
|
4
|
-
export declare function getTodayTimeStamp(): {
|
|
5
|
-
startTime: number;
|
|
6
|
-
endTime: number;
|
|
7
|
-
};
|
|
8
|
-
export declare function unixtimestampToDate(value: number): Date;
|
|
9
|
-
export declare function formatDateTime(value: number | string, format?: string, holder?: string | null): string;
|
|
10
|
-
export declare function timestampColumn(name: string): ColumnOptions;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.timestampColumn = exports.formatDateTime = exports.unixtimestampToDate = exports.getTodayTimeStamp = exports.strToTimeStamp = exports.timestamp = void 0;
|
|
4
|
-
const moment = require("moment");
|
|
5
|
-
const _ = require("lodash");
|
|
6
|
-
function timestamp(value) {
|
|
7
|
-
if (!value) {
|
|
8
|
-
value = moment.now();
|
|
9
|
-
}
|
|
10
|
-
return Math.round(value / 1000);
|
|
11
|
-
}
|
|
12
|
-
exports.timestamp = timestamp;
|
|
13
|
-
function strToTimeStamp(str) {
|
|
14
|
-
if (_.isEmpty(str)) {
|
|
15
|
-
return 0;
|
|
16
|
-
}
|
|
17
|
-
return moment(str).unix();
|
|
18
|
-
}
|
|
19
|
-
exports.strToTimeStamp = strToTimeStamp;
|
|
20
|
-
function getTodayTimeStamp() {
|
|
21
|
-
const startTime = strToTimeStamp(moment().format('YYYY-MM-DD 00:00:00'));
|
|
22
|
-
const endTime = strToTimeStamp(moment().format('YYYY-MM-DD 23:59:59'));
|
|
23
|
-
return {
|
|
24
|
-
startTime,
|
|
25
|
-
endTime,
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
exports.getTodayTimeStamp = getTodayTimeStamp;
|
|
29
|
-
function unixtimestampToDate(value) {
|
|
30
|
-
return moment(value * 1000).toDate();
|
|
31
|
-
}
|
|
32
|
-
exports.unixtimestampToDate = unixtimestampToDate;
|
|
33
|
-
function formatDateTime(value, format = 'YYYY-MM-DD HH:mm:ss', holder = '') {
|
|
34
|
-
if (value === 'now') {
|
|
35
|
-
return moment().format(format);
|
|
36
|
-
}
|
|
37
|
-
if (typeof value === 'string') {
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
if (value > 0) {
|
|
41
|
-
return moment(value * 1000).format(format);
|
|
42
|
-
}
|
|
43
|
-
return holder;
|
|
44
|
-
}
|
|
45
|
-
exports.formatDateTime = formatDateTime;
|
|
46
|
-
function timestampColumn(name) {
|
|
47
|
-
return {
|
|
48
|
-
type: 'int',
|
|
49
|
-
name,
|
|
50
|
-
nullable: false,
|
|
51
|
-
default: 0,
|
|
52
|
-
transformer: {
|
|
53
|
-
to: (value) => value === 0 || /\d{10}/.test(value) ? value : strToTimeStamp(value),
|
|
54
|
-
from: (value) => (!value ? value : formatDateTime),
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
exports.timestampColumn = timestampColumn;
|
|
59
|
-
//# sourceMappingURL=date.helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"date.helper.js","sourceRoot":"","sources":["../../src/helpers/date.helper.ts"],"names":[],"mappings":";;;AACA,iCAAiC;AACjC,4BAA4B;AAE5B,SAAgB,SAAS,CAAC,KAAc;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,KAAK,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IACvB,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;AAClC,CAAC;AALD,8BAKC;AAED,SAAgB,cAAc,CAAC,GAAkB;IAC/C,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACnB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5B,CAAC;AALD,wCAKC;AAED,SAAgB,iBAA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K,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC;SAC5D;KACF,CAAC;AACJ,CAAC;AAZD,0CAYC"}
|
package/dist/helpers/index.d.ts
DELETED
package/dist/helpers/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./date.helper"), exports);
|
|
18
|
-
__exportStar(require("./excel.helper"), exports);
|
|
19
|
-
__exportStar(require("./common.helper"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,iDAA+B;AAC/B,kDAAgC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export * from './decorators';
|
|
3
|
-
export * from './exceptions';
|
|
4
|
-
export * from './filters';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './interceptors';
|
|
7
|
-
export * from './shared';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * from './snake-naming.strategy';
|
|
10
|
-
export * from './boilerplate.polyfill';
|
|
11
|
-
export * from './middlewares';
|
package/dist/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./constants"), exports);
|
|
18
|
-
__exportStar(require("./decorators"), exports);
|
|
19
|
-
__exportStar(require("./exceptions"), exports);
|
|
20
|
-
__exportStar(require("./filters"), exports);
|
|
21
|
-
__exportStar(require("./interfaces"), exports);
|
|
22
|
-
__exportStar(require("./interceptors"), exports);
|
|
23
|
-
__exportStar(require("./shared"), exports);
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
25
|
-
__exportStar(require("./snake-naming.strategy"), exports);
|
|
26
|
-
__exportStar(require("./boilerplate.polyfill"), exports);
|
|
27
|
-
__exportStar(require("./middlewares"), exports);
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,+CAA6B;AAC7B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B;AAE/B,2CAAyB;AACzB,0CAAwB;AACxB,0DAAwC;AACxC,yDAAuC;AACvC,gDAA8B"}
|