@lucaapp/service-utils 1.7.0 → 1.8.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { KafkaClient } from '../kafka';
|
|
2
2
|
declare const generateSubscriptionId: () => string;
|
|
3
|
-
declare const emitWebsocketEvent: (kafkaClient: KafkaClient, subId: string, data: any) => Promise<void>;
|
|
3
|
+
declare const emitWebsocketEvent: (kafkaClient: KafkaClient, subId: string, type: string, data: any) => Promise<void>;
|
|
4
4
|
export { generateSubscriptionId, emitWebsocketEvent };
|
|
@@ -7,7 +7,7 @@ const generateSubscriptionId = () => {
|
|
|
7
7
|
return (0, crypto_1.randomBytes)(32).toString('base64');
|
|
8
8
|
};
|
|
9
9
|
exports.generateSubscriptionId = generateSubscriptionId;
|
|
10
|
-
const emitWebsocketEvent = async (kafkaClient, subId, data) => {
|
|
10
|
+
const emitWebsocketEvent = async (kafkaClient, subId, type, data) => {
|
|
11
11
|
const issuer = kafkaClient.serviceIdentity.identityName;
|
|
12
12
|
// using WS_EVENT_backend since all WS_EVENTs use same schema
|
|
13
13
|
const topic = `wsevent_${issuer}`;
|
|
@@ -16,6 +16,7 @@ const emitWebsocketEvent = async (kafkaClient, subId, data) => {
|
|
|
16
16
|
type: 'create',
|
|
17
17
|
entity: {
|
|
18
18
|
subId,
|
|
19
|
+
type,
|
|
19
20
|
data,
|
|
20
21
|
},
|
|
21
22
|
};
|