relay: NSchema

This commit is contained in:
Alex Gleason 2024-04-25 18:48:02 -05:00
parent 7ee258fe87
commit 4e4b7711c9
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 2 additions and 3 deletions

View File

@ -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 {