mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
chore(deps): upgrade all dependencies, toolchains and images (#2825)
This commit is contained in:
@@ -11,7 +11,9 @@ import {isJsonRecord, parseJsonRecord, parseJsonWithGuard} from '@app/api/utils/
|
||||
import type {MessageResponse} from '@fluxer/schema/src/domains/message/MessageResponseSchemas';
|
||||
import type {INatsConnectionManager} from '@pkgs/nats/src/INatsConnectionManager';
|
||||
import {NatsConnectionManager} from '@pkgs/nats/src/NatsConnectionManager';
|
||||
import {StringCodec} from 'nats';
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
|
||||
const MESSAGE_RESPONSE_SERVICE_SUBJECT = 'svc.messages';
|
||||
const MESSAGE_RESPONSE_SERVICE_TIMEOUT_MS = 6000;
|
||||
@@ -79,8 +81,6 @@ function isMessageServiceResponse(value: unknown): value is MessageServiceRespon
|
||||
}
|
||||
|
||||
export class MessageResponseDataService {
|
||||
private readonly codec = StringCodec();
|
||||
|
||||
constructor(private readonly connectionManager: INatsConnectionManager) {}
|
||||
|
||||
async listMessages(params: {
|
||||
@@ -307,10 +307,10 @@ export class MessageResponseDataService {
|
||||
const connection = this.connectionManager.getConnection();
|
||||
const response = await connection.request(
|
||||
MESSAGE_RESPONSE_SERVICE_SUBJECT,
|
||||
this.codec.encode(JSON.stringify(payload)),
|
||||
textEncoder.encode(JSON.stringify(payload)),
|
||||
{timeout: MESSAGE_RESPONSE_SERVICE_TIMEOUT_MS},
|
||||
);
|
||||
const decoded = this.codec.decode(response.data);
|
||||
const decoded = textDecoder.decode(response.data);
|
||||
const parsed = parseJsonWithGuard(decoded, isMessageServiceResponse);
|
||||
if (!parsed) {
|
||||
throwForSvcErrorReply('message-response-service', parseJsonRecord(decoded));
|
||||
|
||||
Reference in New Issue
Block a user