mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
chore(deps): upgrade all dependencies, toolchains and images (#2825)
This commit is contained in:
1 parent
56e04e7b53
commit
3b552e00ef
510 files changed
+23614
-37473
No files matched your search
@@ -5,8 +5,8 @@ import {
|
||||
GatewayRolloutConfigPublisher,
|
||||
} from '@app/api/instance/GatewayRolloutConfigPublisher';
|
||||
import type {GatewayRolloutConfig} from '@fluxer/schema/src/domains/admin/GatewayRolloutSchemas';
|
||||
import type {NatsConnection} from '@nats-io/transport-node';
|
||||
import type {INatsConnectionManager} from '@pkgs/nats/src/INatsConnectionManager';
|
||||
import {type NatsConnection, StringCodec} from 'nats';
|
||||
import {describe, expect, it} from 'vitest';
|
||||
|
||||
interface FakePublish {
|
||||
@@ -15,7 +15,6 @@ interface FakePublish {
|
||||
}
|
||||
|
||||
class FakeNatsConnectionManager implements INatsConnectionManager {
|
||||
private readonly codec = StringCodec();
|
||||
private closed = true;
|
||||
readonly publishes: Array<FakePublish> = [];
|
||||
connectCalls = 0;
|
||||
@@ -34,7 +33,7 @@ class FakeNatsConnectionManager implements INatsConnectionManager {
|
||||
publish: (subject: string, data: Uint8Array) => {
|
||||
this.publishes.push({
|
||||
subject,
|
||||
body: JSON.parse(this.codec.decode(data)) as Record<string, unknown>,
|
||||
body: JSON.parse(new TextDecoder().decode(data)) as Record<string, unknown>,
|
||||
});
|
||||
},
|
||||
flush: async () => {
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import type {GatewayRolloutConfig} from '@fluxer/schema/src/domains/admin/GatewayRolloutSchemas';
|
||||
import type {INatsConnectionManager} from '@pkgs/nats/src/INatsConnectionManager';
|
||||
import {StringCodec} from 'nats';
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
|
||||
export const GATEWAY_ROLLOUT_CONFIG_NATS_SUBJECT = 'config.gateway.rollout';
|
||||
|
||||
@@ -12,8 +13,6 @@ interface GatewayRolloutConfigNatsMessage {
|
||||
}
|
||||
|
||||
export class GatewayRolloutConfigPublisher {
|
||||
private readonly codec = StringCodec();
|
||||
|
||||
constructor(private readonly connectionManager: INatsConnectionManager) {}
|
||||
|
||||
async publish(config: GatewayRolloutConfig): Promise<void> {
|
||||
@@ -25,7 +24,7 @@ export class GatewayRolloutConfigPublisher {
|
||||
type: 'gateway_rollout_config',
|
||||
config,
|
||||
};
|
||||
connection.publish(GATEWAY_ROLLOUT_CONFIG_NATS_SUBJECT, this.codec.encode(JSON.stringify(message)));
|
||||
connection.publish(GATEWAY_ROLLOUT_CONFIG_NATS_SUBJECT, textEncoder.encode(JSON.stringify(message)));
|
||||
await connection.flush();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user