@platformatic/kafka 1.5.0 → 1.6.0
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.
|
@@ -47,6 +47,8 @@ export declare const defaultOptions: ConnectionOptions;
|
|
|
47
47
|
export declare class Connection extends EventEmitter {
|
|
48
48
|
#private;
|
|
49
49
|
constructor(clientId?: string, options?: ConnectionOptions);
|
|
50
|
+
get host(): string | undefined;
|
|
51
|
+
get port(): number | undefined;
|
|
50
52
|
get instanceId(): number;
|
|
51
53
|
get status(): ConnectionStatusValue;
|
|
52
54
|
get socket(): Socket;
|
|
@@ -30,6 +30,8 @@ export const defaultOptions = {
|
|
|
30
30
|
};
|
|
31
31
|
let currentInstance = 0;
|
|
32
32
|
export class Connection extends EventEmitter {
|
|
33
|
+
#host;
|
|
34
|
+
#port;
|
|
33
35
|
#options;
|
|
34
36
|
#status;
|
|
35
37
|
#instanceId;
|
|
@@ -63,6 +65,12 @@ export class Connection extends EventEmitter {
|
|
|
63
65
|
this.#socketMustBeDrained = false;
|
|
64
66
|
notifyCreation('connection', this);
|
|
65
67
|
}
|
|
68
|
+
get host() {
|
|
69
|
+
return this.#status === ConnectionStatuses.CONNECTED ? this.#host : undefined;
|
|
70
|
+
}
|
|
71
|
+
get port() {
|
|
72
|
+
return this.#status === ConnectionStatuses.CONNECTED ? this.#port : undefined;
|
|
73
|
+
}
|
|
66
74
|
get instanceId() {
|
|
67
75
|
return this.#instanceId;
|
|
68
76
|
}
|
|
@@ -107,6 +115,8 @@ export class Connection extends EventEmitter {
|
|
|
107
115
|
};
|
|
108
116
|
this.emit('connecting');
|
|
109
117
|
/* c8 ignore next 3 - TLS connection is not tested but we rely on Node.js tests */
|
|
118
|
+
this.#host = host;
|
|
119
|
+
this.#port = port;
|
|
110
120
|
this.#socket = this.#options.tls
|
|
111
121
|
? createTLSConnection(port, host, { ...this.#options.tls, ...connectionOptions })
|
|
112
122
|
: createConnection({ ...connectionOptions, port, host });
|
|
@@ -387,7 +397,7 @@ export class Connection extends EventEmitter {
|
|
|
387
397
|
}
|
|
388
398
|
connectionsApiChannel.asyncStart.publish(request.diagnostic);
|
|
389
399
|
callback(responseError, deserialized);
|
|
390
|
-
connectionsApiChannel.
|
|
400
|
+
connectionsApiChannel.asyncEnd.publish(request.diagnostic);
|
|
391
401
|
}
|
|
392
402
|
}
|
|
393
403
|
#onDrain() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/kafka",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Modern and performant client for Apache Kafka",
|
|
5
5
|
"homepage": "https://github.com/platformatic/kafka",
|
|
6
6
|
"author": "Platformatic Inc. <oss@platformatic.dev> (https://platformatic.dev)",
|