mormati-common 0.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/dist/const/const.provider.d.ts +1 -0
- package/dist/const/const.provider.js +5 -0
- package/dist/const/const.provider.js.map +1 -0
- package/dist/const/index.d.ts +1 -0
- package/dist/const/index.js +6 -0
- package/dist/const/index.js.map +1 -0
- package/dist/helper/decorator/decorator.controller.d.ts +24 -0
- package/dist/helper/decorator/decorator.controller.js +60 -0
- package/dist/helper/decorator/decorator.controller.js.map +1 -0
- package/dist/helper/decorator/decorator.types.d.ts +3 -0
- package/dist/helper/decorator/decorator.types.js +3 -0
- package/dist/helper/decorator/decorator.types.js.map +1 -0
- package/dist/helper/decorator/decorator.usecase.d.ts +7 -0
- package/dist/helper/decorator/decorator.usecase.js +12 -0
- package/dist/helper/decorator/decorator.usecase.js.map +1 -0
- package/dist/helper/decorator/index.d.ts +3 -0
- package/dist/helper/decorator/index.js +19 -0
- package/dist/helper/decorator/index.js.map +1 -0
- package/dist/helper/filter/filter.error.d.ts +20 -0
- package/dist/helper/filter/filter.error.js +100 -0
- package/dist/helper/filter/filter.error.js.map +1 -0
- package/dist/helper/filter/index.d.ts +1 -0
- package/dist/helper/filter/index.js +6 -0
- package/dist/helper/filter/index.js.map +1 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/index.js +22 -0
- package/dist/helper/index.js.map +1 -0
- package/dist/helper/interceptor/index.d.ts +3 -0
- package/dist/helper/interceptor/index.js +10 -0
- package/dist/helper/interceptor/index.js.map +1 -0
- package/dist/helper/interceptor/interceptor-pre.validation.d.ts +9 -0
- package/dist/helper/interceptor/interceptor-pre.validation.js +31 -0
- package/dist/helper/interceptor/interceptor-pre.validation.js.map +1 -0
- package/dist/helper/interceptor/interceptor.response.d.ts +8 -0
- package/dist/helper/interceptor/interceptor.response.js +43 -0
- package/dist/helper/interceptor/interceptor.response.js.map +1 -0
- package/dist/helper/interceptor/interceptor.storage.d.ts +8 -0
- package/dist/helper/interceptor/interceptor.storage.js +30 -0
- package/dist/helper/interceptor/interceptor.storage.js.map +1 -0
- package/dist/helper/method/index.d.ts +1 -0
- package/dist/helper/method/index.js +6 -0
- package/dist/helper/method/index.js.map +1 -0
- package/dist/helper/method/method.env.d.ts +1 -0
- package/dist/helper/method/method.env.js +18 -0
- package/dist/helper/method/method.env.js.map +1 -0
- package/dist/helper/pipe/index.d.ts +1 -0
- package/dist/helper/pipe/index.js +6 -0
- package/dist/helper/pipe/index.js.map +1 -0
- package/dist/helper/pipe/validation.pipe.d.ts +6 -0
- package/dist/helper/pipe/validation.pipe.js +22 -0
- package/dist/helper/pipe/validation.pipe.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/init/index.d.ts +3 -0
- package/dist/init/index.js +10 -0
- package/dist/init/index.js.map +1 -0
- package/dist/init/init.error.d.ts +2 -0
- package/dist/init/init.error.js +9 -0
- package/dist/init/init.error.js.map +1 -0
- package/dist/init/init.server.d.ts +2 -0
- package/dist/init/init.server.js +19 -0
- package/dist/init/init.server.js.map +1 -0
- package/dist/init/init.validation.d.ts +2 -0
- package/dist/init/init.validation.js +14 -0
- package/dist/init/init.validation.js.map +1 -0
- package/dist/modules/i18n/i18n.module.d.ts +5 -0
- package/dist/modules/i18n/i18n.module.js +41 -0
- package/dist/modules/i18n/i18n.module.js.map +1 -0
- package/dist/modules/i18n/i18n.service.d.ts +9 -0
- package/dist/modules/i18n/i18n.service.js +44 -0
- package/dist/modules/i18n/i18n.service.js.map +1 -0
- package/dist/modules/i18n/i18n.type.d.ts +3 -0
- package/dist/modules/i18n/i18n.type.js +3 -0
- package/dist/modules/i18n/i18n.type.js.map +1 -0
- package/dist/modules/storage/storage.middleware.d.ts +10 -0
- package/dist/modules/storage/storage.middleware.js +50 -0
- package/dist/modules/storage/storage.middleware.js.map +1 -0
- package/dist/modules/storage/storage.module.d.ts +6 -0
- package/dist/modules/storage/storage.module.js +45 -0
- package/dist/modules/storage/storage.module.js.map +1 -0
- package/dist/modules/storage/storage.service.d.ts +7 -0
- package/dist/modules/storage/storage.service.js +40 -0
- package/dist/modules/storage/storage.service.js.map +1 -0
- package/dist/modules/storage/storage.type.d.ts +10 -0
- package/dist/modules/storage/storage.type.js +4 -0
- package/dist/modules/storage/storage.type.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/package.json +17 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COMMON_CONFIGURATION = "COMMON_CONFIGURATION";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.provider.js","sourceRoot":"","sources":["../../../../libs/common/src/const/const.provider.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { COMMON_CONFIGURATION } from './const.provider';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMMON_CONFIGURATION = void 0;
|
|
4
|
+
var const_provider_1 = require("./const.provider");
|
|
5
|
+
Object.defineProperty(exports, "COMMON_CONFIGURATION", { enumerable: true, get: function () { return const_provider_1.COMMON_CONFIGURATION; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/common/src/const/index.ts"],"names":[],"mappings":";;;AAAA,mDAE0B;AADtB,sHAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IUsecaseDecorator } from "./decorator.usecase";
|
|
2
|
+
import { TPath, TPipes } from "./decorator.types";
|
|
3
|
+
export declare const Controller: (path?: TPath) => ClassDecorator;
|
|
4
|
+
export declare const Header: (name: string, value: string) => MethodDecorator;
|
|
5
|
+
export interface IPostOptions extends IUsecaseDecorator {
|
|
6
|
+
}
|
|
7
|
+
export declare const Post: (path?: TPath, options?: IPostOptions) => MethodDecorator;
|
|
8
|
+
export interface IGetOptions extends IUsecaseDecorator {
|
|
9
|
+
}
|
|
10
|
+
export declare const Get: (path?: TPath, options?: IGetOptions) => MethodDecorator;
|
|
11
|
+
export interface IPutOptions extends IUsecaseDecorator {
|
|
12
|
+
}
|
|
13
|
+
export declare const Put: (path?: TPath, options?: IPutOptions) => MethodDecorator;
|
|
14
|
+
export interface IDeleteOptions extends IUsecaseDecorator {
|
|
15
|
+
}
|
|
16
|
+
export declare const Delete: (path?: TPath, options?: IDeleteOptions) => MethodDecorator;
|
|
17
|
+
export interface IPatchOptions extends IUsecaseDecorator {
|
|
18
|
+
}
|
|
19
|
+
export declare const Patch: (path?: TPath, options?: IPatchOptions) => MethodDecorator;
|
|
20
|
+
export declare const Request: () => ParameterDecorator;
|
|
21
|
+
export declare const Headers: (property: string) => ParameterDecorator;
|
|
22
|
+
export declare const Body: (property?: string, ...pipes: TPipes[]) => ParameterDecorator;
|
|
23
|
+
export declare const Param: (property?: string, ...pipes: TPipes[]) => ParameterDecorator;
|
|
24
|
+
export declare const Query: (property?: string, ...pipes: TPipes[]) => ParameterDecorator;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Query = exports.Param = exports.Body = exports.Headers = exports.Request = exports.Patch = exports.Delete = exports.Put = exports.Get = exports.Post = exports.Header = exports.Controller = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const decorator_usecase_1 = require("./decorator.usecase");
|
|
6
|
+
const Controller = (path) => (0, common_1.Controller)(path);
|
|
7
|
+
exports.Controller = Controller;
|
|
8
|
+
const Header = (name, value) => (0, common_1.Header)(name, value);
|
|
9
|
+
exports.Header = Header;
|
|
10
|
+
const Post = (path, options = {}) => (0, decorator_usecase_1.UsecaseDecorator)({
|
|
11
|
+
...options,
|
|
12
|
+
decorators: [
|
|
13
|
+
...(options.decorators ?? []),
|
|
14
|
+
(0, common_1.Post)(path)
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
exports.Post = Post;
|
|
18
|
+
const Get = (path, options = {}) => (0, decorator_usecase_1.UsecaseDecorator)({
|
|
19
|
+
...options,
|
|
20
|
+
decorators: [
|
|
21
|
+
...(options.decorators ?? []),
|
|
22
|
+
(0, common_1.Get)(path)
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
exports.Get = Get;
|
|
26
|
+
const Put = (path, options = {}) => (0, decorator_usecase_1.UsecaseDecorator)({
|
|
27
|
+
...options,
|
|
28
|
+
decorators: [
|
|
29
|
+
...(options.decorators ?? []),
|
|
30
|
+
(0, common_1.Put)(path)
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
exports.Put = Put;
|
|
34
|
+
const Delete = (path, options = {}) => (0, decorator_usecase_1.UsecaseDecorator)({
|
|
35
|
+
...options,
|
|
36
|
+
decorators: [
|
|
37
|
+
...(options.decorators ?? []),
|
|
38
|
+
(0, common_1.Delete)(path)
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
exports.Delete = Delete;
|
|
42
|
+
const Patch = (path, options = {}) => (0, decorator_usecase_1.UsecaseDecorator)({
|
|
43
|
+
...options,
|
|
44
|
+
decorators: [
|
|
45
|
+
...(options.decorators ?? []),
|
|
46
|
+
(0, common_1.Patch)(path)
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
exports.Patch = Patch;
|
|
50
|
+
const Request = () => (0, common_1.Request)();
|
|
51
|
+
exports.Request = Request;
|
|
52
|
+
const Headers = (property) => (0, common_1.Headers)(property);
|
|
53
|
+
exports.Headers = Headers;
|
|
54
|
+
const Body = (property, ...pipes) => (0, common_1.Body)(property, ...pipes);
|
|
55
|
+
exports.Body = Body;
|
|
56
|
+
const Param = (property, ...pipes) => (0, common_1.Param)(property, ...pipes);
|
|
57
|
+
exports.Param = Param;
|
|
58
|
+
const Query = (property, ...pipes) => (0, common_1.Query)(property, ...pipes);
|
|
59
|
+
exports.Query = Query;
|
|
60
|
+
//# sourceMappingURL=decorator.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.controller.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/decorator/decorator.controller.ts"],"names":[],"mappings":";;;AAAA,2CAgBuB;AACvB,2DAAyE;AAQlE,MAAM,UAAU,GAAG,CAAC,IAAY,EAAkB,EAAE,CACvD,IAAA,mBAAgB,EAAC,IAAI,CAAC,CAAA;AADb,QAAA,UAAU,cACG;AAOnB,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,KAAa,EAAmB,EAAE,CACnE,IAAA,eAAY,EAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AADhB,QAAA,MAAM,UACU;AAOtB,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,UAAwB,EAAE,EAAmB,EAAE,CAC9E,IAAA,oCAAgB,EAAC;IACb,GAAG,OAAO;IACV,UAAU,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAA,aAAU,EAAC,IAAI,CAAC;KACnB;CACJ,CAAC,CAAA;AAPO,QAAA,IAAI,QAOX;AAOC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,UAAuB,EAAE,EAAmB,EAAE,CAC5E,IAAA,oCAAgB,EAAC;IACb,GAAG,OAAO;IACV,UAAU,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAA,YAAS,EAAC,IAAI,CAAC;KAClB;CACJ,CAAC,CAAA;AAPO,QAAA,GAAG,OAOV;AAOC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,UAAuB,EAAE,EAAmB,EAAE,CAC5E,IAAA,oCAAgB,EAAC;IACb,GAAG,OAAO;IACV,UAAU,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAA,YAAS,EAAC,IAAI,CAAC;KAClB;CACJ,CAAC,CAAA;AAPO,QAAA,GAAG,OAOV;AAOC,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,UAA0B,EAAE,EAAmB,EAAE,CAClF,IAAA,oCAAgB,EAAC;IACb,GAAG,OAAO;IACV,UAAU,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAA,eAAY,EAAC,IAAI,CAAC;KACrB;CACJ,CAAC,CAAA;AAPO,QAAA,MAAM,UAOb;AAOC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,UAAyB,EAAE,EAAmB,EAAE,CAChF,IAAA,oCAAgB,EAAC;IACb,GAAG,OAAO;IACV,UAAU,EAAE;QACR,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;QAC7B,IAAA,cAAW,EAAC,IAAI,CAAC;KACpB;CACJ,CAAC,CAAA;AAPO,QAAA,KAAK,SAOZ;AAOC,MAAM,OAAO,GAAG,GAAuB,EAAE,CAC5C,IAAA,gBAAa,GAAE,CAAA;AADN,QAAA,OAAO,WACD;AAMZ,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAsB,EAAE,CAC5D,IAAA,gBAAa,EAAC,QAAQ,CAAC,CAAA;AADd,QAAA,OAAO,WACO;AAMpB,MAAM,IAAI,GAAG,CAAC,QAAiB,EAAE,GAAG,KAAe,EAAsB,EAAE,CAC9E,IAAA,aAAU,EAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;AADrB,QAAA,IAAI,QACiB;AAM3B,MAAM,KAAK,GAAG,CAAC,QAAiB,EAAE,GAAG,KAAe,EAAsB,EAAE,CAC/E,IAAA,cAAW,EAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;AADtB,QAAA,KAAK,SACiB;AAM5B,MAAM,KAAK,GAAG,CAAC,QAAiB,EAAE,GAAG,KAAe,EAAsB,EAAE,CAC/E,IAAA,cAAW,EAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAA;AADtB,QAAA,KAAK,SACiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.types.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/decorator/decorator.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UsecaseDecorator = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const interceptor_1 = require("../interceptor");
|
|
6
|
+
const interceptor_2 = require("../interceptor");
|
|
7
|
+
const UsecaseDecorator = (options) => {
|
|
8
|
+
const { version = '1', groups = [], transform = true, decorators = [] } = options;
|
|
9
|
+
return (0, common_1.applyDecorators)(...(version ? [(0, common_1.Version)(version)] : []), ...(groups.length > 0 ? [(0, common_1.UseInterceptors)(new interceptor_1.ValidationPreInterceptor({ groups }))] : []), ...(transform ? [(0, common_1.UseInterceptors)(interceptor_1.ResponseInterceptor)] : []), (0, common_1.UseInterceptors)(interceptor_2.StorageInterceptor), ...decorators);
|
|
10
|
+
};
|
|
11
|
+
exports.UsecaseDecorator = UsecaseDecorator;
|
|
12
|
+
//# sourceMappingURL=decorator.usecase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorator.usecase.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/decorator/decorator.usecase.ts"],"names":[],"mappings":";;;AAAA,2CAA2E;AAC3E,gDAA+E;AAC/E,gDAAoD;AAa7C,MAAM,gBAAgB,GAAG,CAAC,OAA2B,EAAmB,EAAE;IAC7E,MAAM,EACF,OAAO,GAAG,GAAG,EACb,MAAM,GAAG,EAAE,EACX,SAAS,GAAG,IAAI,EAChB,UAAU,GAAG,EAAE,EAClB,GAAG,OAAO,CAAA;IAEX,OAAO,IAAA,wBAAe,EAClB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,gBAAO,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACtC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAe,EAAC,IAAI,sCAAwB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACzF,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,IAAA,wBAAe,EAAC,iCAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAC5D,IAAA,wBAAe,EAAC,gCAAkB,CAAC,EACnC,GAAG,UAAU,CAChB,CAAA;AACL,CAAC,CAAA;AAfY,QAAA,gBAAgB,oBAe5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Query = exports.Param = exports.Body = exports.Headers = exports.Request = exports.Patch = exports.Delete = exports.Put = exports.Get = exports.Post = exports.Header = exports.Controller = exports.UsecaseDecorator = void 0;
|
|
4
|
+
var decorator_usecase_1 = require("./decorator.usecase");
|
|
5
|
+
Object.defineProperty(exports, "UsecaseDecorator", { enumerable: true, get: function () { return decorator_usecase_1.UsecaseDecorator; } });
|
|
6
|
+
var decorator_controller_1 = require("./decorator.controller");
|
|
7
|
+
Object.defineProperty(exports, "Controller", { enumerable: true, get: function () { return decorator_controller_1.Controller; } });
|
|
8
|
+
Object.defineProperty(exports, "Header", { enumerable: true, get: function () { return decorator_controller_1.Header; } });
|
|
9
|
+
Object.defineProperty(exports, "Post", { enumerable: true, get: function () { return decorator_controller_1.Post; } });
|
|
10
|
+
Object.defineProperty(exports, "Get", { enumerable: true, get: function () { return decorator_controller_1.Get; } });
|
|
11
|
+
Object.defineProperty(exports, "Put", { enumerable: true, get: function () { return decorator_controller_1.Put; } });
|
|
12
|
+
Object.defineProperty(exports, "Delete", { enumerable: true, get: function () { return decorator_controller_1.Delete; } });
|
|
13
|
+
Object.defineProperty(exports, "Patch", { enumerable: true, get: function () { return decorator_controller_1.Patch; } });
|
|
14
|
+
Object.defineProperty(exports, "Request", { enumerable: true, get: function () { return decorator_controller_1.Request; } });
|
|
15
|
+
Object.defineProperty(exports, "Headers", { enumerable: true, get: function () { return decorator_controller_1.Headers; } });
|
|
16
|
+
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return decorator_controller_1.Body; } });
|
|
17
|
+
Object.defineProperty(exports, "Param", { enumerable: true, get: function () { return decorator_controller_1.Param; } });
|
|
18
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return decorator_controller_1.Query; } });
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/decorator/index.ts"],"names":[],"mappings":";;;AACA,yDAE6B;AADzB,qHAAA,gBAAgB,OAAA;AAIpB,+DAagC;AAZ5B,kHAAA,UAAU,OAAA;AACV,8GAAA,MAAM,OAAA;AACN,4GAAA,IAAI,OAAA;AACJ,2GAAA,GAAG,OAAA;AACH,2GAAA,GAAG,OAAA;AACH,8GAAA,MAAM,OAAA;AACN,6GAAA,KAAK,OAAA;AACL,+GAAA,OAAO,OAAA;AACP,+GAAA,OAAO,OAAA;AACP,4GAAA,IAAI,OAAA;AACJ,6GAAA,KAAK,OAAA;AACL,6GAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExceptionFilter, ArgumentsHost, HttpException } from '@nestjs/common';
|
|
2
|
+
type TFlaw = string | Error | HttpException | any;
|
|
3
|
+
export declare class ErrorFilter implements ExceptionFilter {
|
|
4
|
+
catch(flaw: TFlaw, host: ArgumentsHost): void;
|
|
5
|
+
identifier(flaw: TFlaw): any;
|
|
6
|
+
exceptionThrow(flaw: string): {
|
|
7
|
+
status: number;
|
|
8
|
+
source: string;
|
|
9
|
+
message: string;
|
|
10
|
+
error: any;
|
|
11
|
+
};
|
|
12
|
+
exceptionError(flaw: Error): {
|
|
13
|
+
status: number;
|
|
14
|
+
source: string;
|
|
15
|
+
message: string;
|
|
16
|
+
error: any;
|
|
17
|
+
};
|
|
18
|
+
exceptionHttp(flaw: HttpException): any;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
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.ErrorFilter = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const moment = require("moment");
|
|
12
|
+
let ErrorFilter = class ErrorFilter {
|
|
13
|
+
catch(flaw, host) {
|
|
14
|
+
const ctx = host.switchToHttp();
|
|
15
|
+
const ctxResponse = ctx.getResponse();
|
|
16
|
+
const { status, source, message, error } = this.identifier(flaw);
|
|
17
|
+
const response = {
|
|
18
|
+
success: false,
|
|
19
|
+
timestamp: moment().toISOString(),
|
|
20
|
+
status,
|
|
21
|
+
source,
|
|
22
|
+
message,
|
|
23
|
+
error
|
|
24
|
+
};
|
|
25
|
+
ctxResponse.status(status).json(response);
|
|
26
|
+
}
|
|
27
|
+
identifier(flaw) {
|
|
28
|
+
switch (true) {
|
|
29
|
+
case flaw instanceof common_1.HttpException:
|
|
30
|
+
console.log("[SERVER ERR] # From ErrorTransform[HttpException]");
|
|
31
|
+
return this.exceptionHttp(flaw);
|
|
32
|
+
case flaw instanceof Error:
|
|
33
|
+
console.log("[SERVER ERR] # From ErrorTransform[ErrorException]");
|
|
34
|
+
return this.exceptionError(flaw);
|
|
35
|
+
default:
|
|
36
|
+
console.log("[SERVER ERR] # From ErrorTransform[ThrowException]");
|
|
37
|
+
return this.exceptionThrow(flaw);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exceptionThrow(flaw) {
|
|
41
|
+
const [status, message] = flaw.split(' -> ');
|
|
42
|
+
return {
|
|
43
|
+
status: message ? parseInt(status) : 500,
|
|
44
|
+
source: "Throw Exception",
|
|
45
|
+
message: message ?? status,
|
|
46
|
+
error: null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
exceptionError(flaw) {
|
|
50
|
+
return {
|
|
51
|
+
status: 500,
|
|
52
|
+
source: "Error Exception",
|
|
53
|
+
message: flaw.message,
|
|
54
|
+
error: null
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
exceptionHttp(flaw) {
|
|
58
|
+
const exception = flaw.getResponse();
|
|
59
|
+
const status = flaw.getStatus();
|
|
60
|
+
const source = exception?.statusCode === 400 && Array.isArray(exception?.message) ?
|
|
61
|
+
"Http Exception[DTO]"
|
|
62
|
+
: typeof exception == "string" ?
|
|
63
|
+
"Http Exception[Default]"
|
|
64
|
+
: "Http Exception[Unknown]";
|
|
65
|
+
switch (source) {
|
|
66
|
+
case "Http Exception[DTO]": {
|
|
67
|
+
const { error, message } = exception;
|
|
68
|
+
return {
|
|
69
|
+
status: status,
|
|
70
|
+
source: source,
|
|
71
|
+
message: message?.join(', '),
|
|
72
|
+
error: error,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case "Http Exception[Default]": {
|
|
76
|
+
return {
|
|
77
|
+
status: status,
|
|
78
|
+
source: source,
|
|
79
|
+
message: exception,
|
|
80
|
+
error: null
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
default: {
|
|
84
|
+
const { message, ...restException } = exception;
|
|
85
|
+
return {
|
|
86
|
+
status: status,
|
|
87
|
+
source: source,
|
|
88
|
+
message: message ?? "Unknown Error",
|
|
89
|
+
error: null,
|
|
90
|
+
...restException
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
exports.ErrorFilter = ErrorFilter;
|
|
97
|
+
exports.ErrorFilter = ErrorFilter = __decorate([
|
|
98
|
+
(0, common_1.Catch)()
|
|
99
|
+
], ErrorFilter);
|
|
100
|
+
//# sourceMappingURL=filter.error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter.error.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/filter/filter.error.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ErrorFilter } from './filter.error';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorFilter = void 0;
|
|
4
|
+
var filter_error_1 = require("./filter.error");
|
|
5
|
+
Object.defineProperty(exports, "ErrorFilter", { enumerable: true, get: function () { return filter_error_1.ErrorFilter; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/filter/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAApC,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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("./decorator"), exports);
|
|
18
|
+
__exportStar(require("./filter"), exports);
|
|
19
|
+
__exportStar(require("./interceptor"), exports);
|
|
20
|
+
__exportStar(require("./pipe"), exports);
|
|
21
|
+
__exportStar(require("./method"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/common/src/helper/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,2CAAyB;AACzB,gDAA8B;AAC9B,yCAAuB;AACvB,2CAAyB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StorageInterceptor = exports.ResponseInterceptor = exports.ValidationPreInterceptor = void 0;
|
|
4
|
+
var interceptor_pre_validation_1 = require("./interceptor-pre.validation");
|
|
5
|
+
Object.defineProperty(exports, "ValidationPreInterceptor", { enumerable: true, get: function () { return interceptor_pre_validation_1.ValidationPreInterceptor; } });
|
|
6
|
+
var interceptor_response_1 = require("./interceptor.response");
|
|
7
|
+
Object.defineProperty(exports, "ResponseInterceptor", { enumerable: true, get: function () { return interceptor_response_1.ResponseInterceptor; } });
|
|
8
|
+
var interceptor_storage_1 = require("./interceptor.storage");
|
|
9
|
+
Object.defineProperty(exports, "StorageInterceptor", { enumerable: true, get: function () { return interceptor_storage_1.StorageInterceptor; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/interceptor/index.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AAA/D,sIAAA,wBAAwB,OAAA;AACjC,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
export declare class ValidationPreInterceptor implements NestInterceptor {
|
|
4
|
+
private readonly body;
|
|
5
|
+
private readonly params;
|
|
6
|
+
private readonly query;
|
|
7
|
+
constructor(body?: {}, params?: {}, query?: {});
|
|
8
|
+
intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.ValidationPreInterceptor = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
let ValidationPreInterceptor = class ValidationPreInterceptor {
|
|
15
|
+
constructor(body = {}, params = {}, query = {}) {
|
|
16
|
+
this.body = body;
|
|
17
|
+
this.params = params;
|
|
18
|
+
this.query = query;
|
|
19
|
+
}
|
|
20
|
+
async intercept(context, next) {
|
|
21
|
+
const request = context.switchToHttp().getRequest();
|
|
22
|
+
Object.assign(request, { body: { ...request.body, ...this.body } });
|
|
23
|
+
return next.handle();
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.ValidationPreInterceptor = ValidationPreInterceptor;
|
|
27
|
+
exports.ValidationPreInterceptor = ValidationPreInterceptor = __decorate([
|
|
28
|
+
(0, common_1.Injectable)(),
|
|
29
|
+
__metadata("design:paramtypes", [Object, Object, Object])
|
|
30
|
+
], ValidationPreInterceptor);
|
|
31
|
+
//# sourceMappingURL=interceptor-pre.validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor-pre.validation.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/interceptor/interceptor-pre.validation.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4F;AAuBrF,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACjC,YACqB,OAAO,EAAE,EACT,SAAS,EAAE,EACX,QAAQ,EAAE;QAFV,SAAI,GAAJ,IAAI,CAAK;QACT,WAAM,GAAN,MAAM,CAAK;QACX,UAAK,GAAL,KAAK,CAAK;IAC3B,CAAC;IAEL,KAAK,CAAC,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QAEpD,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QACnE,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;IACxB,CAAC;CACJ,CAAA;AAbY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;;GACA,wBAAwB,CAapC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
4
|
+
export declare class ResponseInterceptor implements NestInterceptor {
|
|
5
|
+
private readonly configService;
|
|
6
|
+
constructor(configService: ConfigService);
|
|
7
|
+
intercept(context: ExecutionContext, next: CallHandler): Observable<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
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.ResponseInterceptor = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const operators_1 = require("rxjs/operators");
|
|
15
|
+
const moment = require("moment");
|
|
16
|
+
const config_1 = require("@nestjs/config");
|
|
17
|
+
let ResponseInterceptor = class ResponseInterceptor {
|
|
18
|
+
constructor(configService) {
|
|
19
|
+
this.configService = configService;
|
|
20
|
+
}
|
|
21
|
+
intercept(context, next) {
|
|
22
|
+
return next.handle().pipe((0, operators_1.map)((response) => {
|
|
23
|
+
const status = context.switchToHttp().getResponse().statusCode;
|
|
24
|
+
const { message, data } = response ?? {};
|
|
25
|
+
if (!message)
|
|
26
|
+
return response;
|
|
27
|
+
return {
|
|
28
|
+
success: true,
|
|
29
|
+
timestamp: moment().toISOString(),
|
|
30
|
+
source: this.configService.get('SERVER_NAME'),
|
|
31
|
+
status: status,
|
|
32
|
+
message: message ?? '',
|
|
33
|
+
data: data ?? undefined
|
|
34
|
+
};
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.ResponseInterceptor = ResponseInterceptor;
|
|
39
|
+
exports.ResponseInterceptor = ResponseInterceptor = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
__metadata("design:paramtypes", [config_1.ConfigService])
|
|
42
|
+
], ResponseInterceptor);
|
|
43
|
+
//# sourceMappingURL=interceptor.response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.response.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/interceptor/interceptor.response.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAKwB;AAExB,8CAAqC;AACrC,iCAAiC;AACjC,2CAA+C;AAmBxC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YACmB,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;IAC3C,CAAC;IAEL,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CACvB,IAAA,eAAG,EAAC,CAAC,QAAQ,EAAE,EAAE;YACf,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE,CAAC,UAAU,CAAA;YAC9D,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAA;YAExC,IAAI,CAAC,OAAO;gBAAE,OAAO,QAAQ,CAAA;YAE7B,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,SAAS,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE;gBACjC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,aAAa,CAAC;gBAC7C,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,OAAO,IAAI,EAAE;gBACtB,IAAI,EAAE,IAAI,IAAI,SAAS;aACxB,CAAA;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CAEF,CAAA;AAzBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAGuB,sBAAa;GAFpC,mBAAmB,CAyB/B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { StorageService } from '../../modules/storage/storage.service';
|
|
4
|
+
export declare class StorageInterceptor implements NestInterceptor {
|
|
5
|
+
private readonly storageService;
|
|
6
|
+
constructor(storageService: StorageService);
|
|
7
|
+
intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<any>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.StorageInterceptor = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const storage_service_1 = require("../../modules/storage/storage.service");
|
|
15
|
+
let StorageInterceptor = class StorageInterceptor {
|
|
16
|
+
constructor(storageService) {
|
|
17
|
+
this.storageService = storageService;
|
|
18
|
+
}
|
|
19
|
+
async intercept(context, next) {
|
|
20
|
+
const request = context.switchToHttp().getRequest();
|
|
21
|
+
this.storageService.setState({ account: request.account });
|
|
22
|
+
return next.handle();
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
exports.StorageInterceptor = StorageInterceptor;
|
|
26
|
+
exports.StorageInterceptor = StorageInterceptor = __decorate([
|
|
27
|
+
(0, common_1.Injectable)(),
|
|
28
|
+
__metadata("design:paramtypes", [storage_service_1.StorageService])
|
|
29
|
+
], StorageInterceptor);
|
|
30
|
+
//# sourceMappingURL=interceptor.storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interceptor.storage.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/interceptor/interceptor.storage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4F;AAE5F,2EAAuE;AAGhE,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC3B,YACqB,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAC/C,CAAC;IAEL,KAAK,CAAC,SAAS,CAAC,OAAyB,EAAE,IAAiB;QACxD,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;QACpD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;QAC1D,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;IACxB,CAAC;CACJ,CAAA;AAVY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;qCAG4B,gCAAc;GAF1C,kBAAkB,CAU9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getEnvPath } from './method.env';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnvPath = void 0;
|
|
4
|
+
var method_env_1 = require("./method.env");
|
|
5
|
+
Object.defineProperty(exports, "getEnvPath", { enumerable: true, get: function () { return method_env_1.getEnvPath; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/method/index.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAAjC,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getEnvPath(BASE_PATH?: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnvPath = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function getEnvPath(BASE_PATH = 'src/helpers/env') {
|
|
7
|
+
console.log(`[SERVER Env] # Configuring '${process.env.NODE_ENV}' env..`);
|
|
8
|
+
let env = process.env.NODE_ENV;
|
|
9
|
+
let path = (0, path_1.resolve)(`${BASE_PATH}/.${process.env.NODE_ENV}.env`);
|
|
10
|
+
if (!(0, fs_1.existsSync)(path)) {
|
|
11
|
+
env = "dev";
|
|
12
|
+
path = (0, path_1.resolve)(`${BASE_PATH}/.dev.env`);
|
|
13
|
+
}
|
|
14
|
+
console.log(`[SERVER Env] # Env Configured [${env}]`);
|
|
15
|
+
return path;
|
|
16
|
+
}
|
|
17
|
+
exports.getEnvPath = getEnvPath;
|
|
18
|
+
//# sourceMappingURL=method.env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.env.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/method/method.env.ts"],"names":[],"mappings":";;;AAAA,2BAAgC;AAChC,+BAA+B;AAW/B,SAAgB,UAAU,CAAC,YAAoB,iBAAiB;IAC5D,OAAO,CAAC,GAAG,CAAC,+BAA+B,OAAO,CAAC,GAAG,CAAC,QAAQ,SAAS,CAAC,CAAC;IAC1E,IAAI,GAAG,GAAW,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA;IACtC,IAAI,IAAI,GAAW,IAAA,cAAO,EAAC,GAAG,SAAS,KAAK,OAAO,CAAC,GAAG,CAAC,QAAQ,MAAM,CAAC,CAAC;IACxE,IAAI,CAAC,IAAA,eAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACpB,GAAG,GAAG,KAAK,CAAA;QACX,IAAI,GAAG,IAAA,cAAO,EAAC,GAAG,SAAS,WAAW,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,kCAAkC,GAAG,GAAG,CAAC,CAAC;IACtD,OAAO,IAAI,CAAA;AACf,CAAC;AAVD,gCAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ValidationPipe } from "./validation.pipe";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidationPipe = void 0;
|
|
4
|
+
var validation_pipe_1 = require("./validation.pipe");
|
|
5
|
+
Object.defineProperty(exports, "ValidationPipe", { enumerable: true, get: function () { return validation_pipe_1.ValidationPipe; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/common/src/helper/pipe/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PipeTransform, ArgumentMetadata, ValidationPipeOptions } from '@nestjs/common';
|
|
2
|
+
export declare class ValidationPipe implements PipeTransform {
|
|
3
|
+
private readonly options?;
|
|
4
|
+
constructor(options?: ValidationPipeOptions);
|
|
5
|
+
transform(value: any, metadata: ArgumentMetadata): Promise<any>;
|
|
6
|
+
}
|