@mamindom/common 1.0.121 → 1.0.122
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.
|
@@ -6,6 +6,7 @@ export declare class GrpcClientFactory {
|
|
|
6
6
|
protoPath: string | string[];
|
|
7
7
|
url: string;
|
|
8
8
|
channelOptions?: Record<string, any>;
|
|
9
|
+
defaultTimeout?: string;
|
|
9
10
|
}): ClientGrpc;
|
|
10
11
|
register(token: string, client: ClientGrpc): void;
|
|
11
12
|
getClient<T extends ClientGrpc = ClientGrpc>(token: string): T;
|
|
@@ -55,14 +55,21 @@ let GrpcClientFactory = (() => {
|
|
|
55
55
|
createClient(options) {
|
|
56
56
|
const channelOptions = {
|
|
57
57
|
'grpc.service_config': JSON.stringify({
|
|
58
|
-
loadBalancingConfig: [{ round_robin: {} }]
|
|
58
|
+
loadBalancingConfig: [{ round_robin: {} }],
|
|
59
|
+
methodConfig: [
|
|
60
|
+
{
|
|
61
|
+
name: [{}],
|
|
62
|
+
timeout: options.defaultTimeout ?? '10s'
|
|
63
|
+
}
|
|
64
|
+
]
|
|
59
65
|
}),
|
|
60
66
|
...options.channelOptions
|
|
61
67
|
};
|
|
68
|
+
const { defaultTimeout: _defaultTimeout, ...grpcOptions } = options;
|
|
62
69
|
return microservices_1.ClientProxyFactory.create({
|
|
63
70
|
transport: microservices_1.Transport.GRPC,
|
|
64
71
|
options: {
|
|
65
|
-
...
|
|
72
|
+
...grpcOptions,
|
|
66
73
|
channelOptions,
|
|
67
74
|
loader: {
|
|
68
75
|
keepCase: false,
|
package/dist/grpc/grpc.module.js
CHANGED
|
@@ -69,6 +69,7 @@ let GrpcModule = (() => {
|
|
|
69
69
|
package: cfg.package,
|
|
70
70
|
protoPath: cfg.protoPath,
|
|
71
71
|
url,
|
|
72
|
+
defaultTimeout: cfg.timeout,
|
|
72
73
|
channelOptions: {
|
|
73
74
|
'grpc.max_receive_message_length': 1024 * 1024 * 50, // 50 MB
|
|
74
75
|
'grpc.max_send_message_length': 1024 * 1024 * 50 // 50 MB
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mamindom/common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.122",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"typescript": "^5.9.3"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@mamindom/contracts": "^1.0.
|
|
26
|
+
"@mamindom/contracts": "^1.0.152",
|
|
27
27
|
"@nestjs/common": "^11.1.16",
|
|
28
28
|
"@nestjs/config": "^4.0.3",
|
|
29
29
|
"@nestjs/microservices": "^11.1.16"
|