@fonoster/common 0.8.18 → 0.8.20
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.
|
@@ -77,24 +77,27 @@ function handleError(error, callback) {
|
|
|
77
77
|
switch (code) {
|
|
78
78
|
case PrismaErrorEnum_1.PrismaErrorEnum.RECORD_ALREADY_EXISTS:
|
|
79
79
|
case grpc.status.ALREADY_EXISTS:
|
|
80
|
-
logAndCallback(grpc_js_1.status.ALREADY_EXISTS,
|
|
80
|
+
logAndCallback(grpc_js_1.status.ALREADY_EXISTS, "The resource already exists", "duplicated entity error");
|
|
81
81
|
break;
|
|
82
82
|
case PrismaErrorEnum_1.PrismaErrorEnum.RECORD_NOT_FOUND:
|
|
83
83
|
case grpc.status.NOT_FOUND:
|
|
84
|
-
logAndCallback(grpc_js_1.status.NOT_FOUND,
|
|
84
|
+
logAndCallback(grpc_js_1.status.NOT_FOUND, "The requested resource was not found", "not found error");
|
|
85
85
|
break;
|
|
86
86
|
case PrismaErrorEnum_1.PrismaErrorEnum.FAILED_PRECONDITION:
|
|
87
87
|
case grpc.status.FAILED_PRECONDITION:
|
|
88
|
-
logAndCallback(grpc_js_1.status.FAILED_PRECONDITION,
|
|
88
|
+
logAndCallback(grpc_js_1.status.FAILED_PRECONDITION, "Failed precondition error (e.g., missing dependency)", "failed precondition error");
|
|
89
89
|
break;
|
|
90
90
|
case grpc.status.PERMISSION_DENIED:
|
|
91
|
-
logAndCallback(grpc_js_1.status.PERMISSION_DENIED,
|
|
91
|
+
logAndCallback(grpc_js_1.status.PERMISSION_DENIED, "You don't have permission to perform this action", "permission denied error");
|
|
92
92
|
break;
|
|
93
93
|
case grpc.status.UNAUTHENTICATED:
|
|
94
|
-
logAndCallback(grpc_js_1.status.UNAUTHENTICATED,
|
|
94
|
+
logAndCallback(grpc_js_1.status.UNAUTHENTICATED, "You need to be authenticated to perform this action", "unauthenticated error");
|
|
95
|
+
break;
|
|
96
|
+
case grpc.status.INVALID_ARGUMENT:
|
|
97
|
+
logAndCallback(grpc_js_1.status.INVALID_ARGUMENT, message !== null && message !== void 0 ? message : "Your request has invalid arguments", "invalid argument error");
|
|
95
98
|
break;
|
|
96
99
|
default:
|
|
97
100
|
logger.error("unknown error:", error);
|
|
98
|
-
callback({ code: grpc_js_1.status.UNKNOWN, message:
|
|
101
|
+
callback({ code: grpc_js_1.status.UNKNOWN, message: "Unknown error" });
|
|
99
102
|
}
|
|
100
103
|
}
|
|
@@ -8,7 +8,7 @@ declare const createTrunkRequestSchema: z.ZodObject<{
|
|
|
8
8
|
host: z.ZodEffects<z.ZodString, string, string>;
|
|
9
9
|
port: z.ZodNumber;
|
|
10
10
|
transport: z.ZodNativeEnum<typeof Transport>;
|
|
11
|
-
user: z.ZodString
|
|
11
|
+
user: z.ZodOptional<z.ZodString>;
|
|
12
12
|
weight: z.ZodNumber;
|
|
13
13
|
priority: z.ZodNumber;
|
|
14
14
|
enabled: z.ZodBoolean;
|
|
@@ -69,7 +69,7 @@ const createTrunkRequestSchema = zod_1.z.object({
|
|
|
69
69
|
host: hostOrIPSchema,
|
|
70
70
|
port: zod_1.z.number(),
|
|
71
71
|
transport: zod_1.z.nativeEnum(types_1.Transport, { message: "Invalid transport" }),
|
|
72
|
-
user: zod_1.z.string(),
|
|
72
|
+
user: zod_1.z.string().optional(),
|
|
73
73
|
weight: zod_1.z.number(),
|
|
74
74
|
priority: zod_1.z.number(),
|
|
75
75
|
enabled: zod_1.z.boolean()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/common",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.20",
|
|
4
4
|
"description": "Common library for Fonoster projects",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fonoster/logger": "^0.8.
|
|
21
|
+
"@fonoster/logger": "^0.8.20",
|
|
22
22
|
"@grpc/grpc-js": "~1.10.6",
|
|
23
23
|
"@grpc/proto-loader": "^0.7.12",
|
|
24
24
|
"dotenv": "^16.4.7",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/nodemailer": "^6.4.14"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4e605a379fec5ac31bf0a3d2f57cbd54da6c732b"
|
|
49
49
|
}
|