@nathapp/nestjs-common 1.0.1-rc.6 → 1.0.1-rc.7
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/exception/app-exception-code.enum.d.ts +2 -1
- package/dist/exception/app-exception-code.enum.js +2 -1
- package/dist/exception/index.d.ts +1 -2
- package/dist/exception/index.js +1 -3
- package/package.json +1 -1
- package/dist/config/db.config.d.ts +0 -14
- package/dist/config/db.config.js +0 -17
- package/dist/config/mongodb.config.d.ts +0 -10
- package/dist/config/mongodb.config.js +0 -14
- package/dist/config/rabbitmq.config.d.ts +0 -10
- package/dist/config/rabbitmq.config.js +0 -14
- package/dist/config/redis.config.d.ts +0 -10
- package/dist/config/redis.config.js +0 -14
- package/dist/exception/app-exception-filter.provider.d.ts +0 -2
- package/dist/exception/app-exception-filter.provider.js +0 -9
- package/dist/exception/translator.d.ts +0 -12
- package/dist/exception/translator.js +0 -9
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export declare enum CommonExceptionCode {
|
|
2
2
|
UNKNOWN_ERROR = -1,
|
|
3
|
+
REQUEST_PARAMETER_ERROR = -2,
|
|
3
4
|
NOT_FOUND = 404,
|
|
4
5
|
INTERNAL_ERROR = 501,
|
|
5
|
-
USER_NOT_FOUND =
|
|
6
|
+
USER_NOT_FOUND = 20000,
|
|
6
7
|
UNAUTHORIZED = 40000,
|
|
7
8
|
FORBIDDEN_IP_NOT_MATCH = 40001,
|
|
8
9
|
FORBIDDEN_BLACKLISTED = 40002,
|
|
@@ -4,9 +4,10 @@ exports.CommonExceptionCode = void 0;
|
|
|
4
4
|
var CommonExceptionCode;
|
|
5
5
|
(function (CommonExceptionCode) {
|
|
6
6
|
CommonExceptionCode[CommonExceptionCode["UNKNOWN_ERROR"] = -1] = "UNKNOWN_ERROR";
|
|
7
|
+
CommonExceptionCode[CommonExceptionCode["REQUEST_PARAMETER_ERROR"] = -2] = "REQUEST_PARAMETER_ERROR";
|
|
7
8
|
CommonExceptionCode[CommonExceptionCode["NOT_FOUND"] = 404] = "NOT_FOUND";
|
|
8
9
|
CommonExceptionCode[CommonExceptionCode["INTERNAL_ERROR"] = 501] = "INTERNAL_ERROR";
|
|
9
|
-
CommonExceptionCode[CommonExceptionCode["USER_NOT_FOUND"] =
|
|
10
|
+
CommonExceptionCode[CommonExceptionCode["USER_NOT_FOUND"] = 20000] = "USER_NOT_FOUND";
|
|
10
11
|
CommonExceptionCode[CommonExceptionCode["UNAUTHORIZED"] = 40000] = "UNAUTHORIZED";
|
|
11
12
|
CommonExceptionCode[CommonExceptionCode["FORBIDDEN_IP_NOT_MATCH"] = 40001] = "FORBIDDEN_IP_NOT_MATCH";
|
|
12
13
|
CommonExceptionCode[CommonExceptionCode["FORBIDDEN_BLACKLISTED"] = 40002] = "FORBIDDEN_BLACKLISTED";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CommonExceptionCode } from "./app-exception-code.enum";
|
|
2
|
-
import { createAppExceptionFilterProvider } from "./app-exception-filter.provider";
|
|
3
2
|
import { AppExceptionFilter } from "./app-exception.filter";
|
|
4
3
|
import { AppException } from "./app.exception";
|
|
5
4
|
import { GlobalExceptionsFilter } from "./global-exception.filter";
|
|
6
5
|
import { UsernameNotFoundException } from "./user-not-found.exception";
|
|
7
|
-
export { AppException, AppExceptionFilter,
|
|
6
|
+
export { AppException, AppExceptionFilter, GlobalExceptionsFilter, UsernameNotFoundException, CommonExceptionCode };
|
package/dist/exception/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommonExceptionCode = exports.UsernameNotFoundException = exports.GlobalExceptionsFilter = exports.
|
|
3
|
+
exports.CommonExceptionCode = exports.UsernameNotFoundException = exports.GlobalExceptionsFilter = exports.AppExceptionFilter = exports.AppException = void 0;
|
|
4
4
|
const app_exception_code_enum_1 = require("./app-exception-code.enum");
|
|
5
5
|
Object.defineProperty(exports, "CommonExceptionCode", { enumerable: true, get: function () { return app_exception_code_enum_1.CommonExceptionCode; } });
|
|
6
|
-
const app_exception_filter_provider_1 = require("./app-exception-filter.provider");
|
|
7
|
-
Object.defineProperty(exports, "createAppExceptionFilterProvider", { enumerable: true, get: function () { return app_exception_filter_provider_1.createAppExceptionFilterProvider; } });
|
|
8
6
|
const app_exception_filter_1 = require("./app-exception.filter");
|
|
9
7
|
Object.defineProperty(exports, "AppExceptionFilter", { enumerable: true, get: function () { return app_exception_filter_1.AppExceptionFilter; } });
|
|
10
8
|
const app_exception_1 = require("./app.exception");
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
declare const _default: (() => {
|
|
2
|
-
isPresent: boolean;
|
|
3
|
-
name: string;
|
|
4
|
-
url: string;
|
|
5
|
-
type: "mysql" | "mariadb" | "postgres" | "mssql" | "oracle" | "sqlite";
|
|
6
|
-
entityPath: string;
|
|
7
|
-
}) & import("@nestjs/config").ConfigFactoryKeyHost<{
|
|
8
|
-
isPresent: boolean;
|
|
9
|
-
name: string;
|
|
10
|
-
url: string;
|
|
11
|
-
type: "mysql" | "mariadb" | "postgres" | "mssql" | "oracle" | "sqlite";
|
|
12
|
-
entityPath: string;
|
|
13
|
-
}>;
|
|
14
|
-
export default _default;
|
package/dist/config/db.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@nathapp/common");
|
|
4
|
-
const config_1 = require("@nestjs/config");
|
|
5
|
-
exports.default = (0, config_1.registerAs)("db", () => {
|
|
6
|
-
const isPresent = !(0, common_1.isUndefinedOrNullOrEmpty)(process.env.DB_URL);
|
|
7
|
-
const name = process.env.DB_NAME || "default";
|
|
8
|
-
const url = process.env.DB_URL;
|
|
9
|
-
const type = (isPresent ? url.split(":").shift() : null);
|
|
10
|
-
return {
|
|
11
|
-
isPresent,
|
|
12
|
-
name,
|
|
13
|
-
url,
|
|
14
|
-
type,
|
|
15
|
-
entityPath: process.env.DB_ENTITY_PATH || "/**/*.entity.ts",
|
|
16
|
-
};
|
|
17
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@nathapp/common");
|
|
4
|
-
const config_1 = require("@nestjs/config");
|
|
5
|
-
exports.default = (0, config_1.registerAs)("mongodb", () => {
|
|
6
|
-
const isPresent = !(0, common_1.isUndefinedOrNullOrEmpty)(process.env.MONGO_URL);
|
|
7
|
-
const name = process.env.MONGO_NAME || "default";
|
|
8
|
-
const url = process.env.MONGO_URL;
|
|
9
|
-
return {
|
|
10
|
-
isPresent,
|
|
11
|
-
name,
|
|
12
|
-
url,
|
|
13
|
-
};
|
|
14
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@nathapp/common");
|
|
4
|
-
const config_1 = require("@nestjs/config");
|
|
5
|
-
exports.default = (0, config_1.registerAs)("rabbitmq", () => {
|
|
6
|
-
const isPresent = !(0, common_1.isUndefinedOrNullOrEmpty)(process.env.RABBITMQ_URL);
|
|
7
|
-
const name = process.env.RABBITMQ_NAME || "default";
|
|
8
|
-
const url = process.env.RABBITMQ_URL;
|
|
9
|
-
return {
|
|
10
|
-
isPresent,
|
|
11
|
-
name,
|
|
12
|
-
url,
|
|
13
|
-
};
|
|
14
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const common_1 = require("@nathapp/common");
|
|
4
|
-
const config_1 = require("@nestjs/config");
|
|
5
|
-
exports.default = (0, config_1.registerAs)("redis", () => {
|
|
6
|
-
const isPresent = !(0, common_1.isUndefinedOrNullOrEmpty)(process.env.REDIS_URL);
|
|
7
|
-
const name = process.env.REDIS_NAME || "default";
|
|
8
|
-
const url = process.env.REDIS_URL;
|
|
9
|
-
return {
|
|
10
|
-
isPresent,
|
|
11
|
-
name,
|
|
12
|
-
url,
|
|
13
|
-
};
|
|
14
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAppExceptionFilterProvider = void 0;
|
|
4
|
-
const core_1 = require("@nestjs/core");
|
|
5
|
-
const app_exception_filter_1 = require("./app-exception.filter");
|
|
6
|
-
exports.createAppExceptionFilterProvider = {
|
|
7
|
-
provide: core_1.APP_FILTER,
|
|
8
|
-
useClass: app_exception_filter_1.AppExceptionFilter,
|
|
9
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface Translator {
|
|
2
|
-
translate(key: string, params: {
|
|
3
|
-
lang: string;
|
|
4
|
-
args?: any;
|
|
5
|
-
}): string | Promise<string>;
|
|
6
|
-
}
|
|
7
|
-
export declare class NullTranslator implements Translator {
|
|
8
|
-
translate(key: string, params: {
|
|
9
|
-
lang: string;
|
|
10
|
-
args?: any;
|
|
11
|
-
}): string | Promise<string>;
|
|
12
|
-
}
|