relay: NSchema
This commit is contained in:
parent
7ee258fe87
commit
4e4b7711c9
|
@ -1,8 +1,7 @@
|
||||||
import { NostrEvent, NostrFilter } from '@nostrify/nostrify';
|
import { NostrEvent, NostrFilter, NSchema as n } from '@nostrify/nostrify';
|
||||||
import { relayInfoController } from '@/controllers/nostr/relay-info.ts';
|
import { relayInfoController } from '@/controllers/nostr/relay-info.ts';
|
||||||
import { eventsDB } from '@/storages.ts';
|
import { eventsDB } from '@/storages.ts';
|
||||||
import * as pipeline from '@/pipeline.ts';
|
import * as pipeline from '@/pipeline.ts';
|
||||||
import { jsonSchema } from '@/schema.ts';
|
|
||||||
import {
|
import {
|
||||||
type ClientCLOSE,
|
type ClientCLOSE,
|
||||||
type ClientCOUNT,
|
type ClientCOUNT,
|
||||||
|
@ -32,7 +31,7 @@ function connectStream(socket: WebSocket) {
|
||||||
const controllers = new Map<string, AbortController>();
|
const controllers = new Map<string, AbortController>();
|
||||||
|
|
||||||
socket.onmessage = (e) => {
|
socket.onmessage = (e) => {
|
||||||
const result = jsonSchema.pipe(clientMsgSchema).safeParse(e.data);
|
const result = n.json().pipe(clientMsgSchema).safeParse(e.data);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
handleMsg(result.data);
|
handleMsg(result.data);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue