работаем бля работаем
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import type { ChadClient, SomeSocket } from '../types/webrtc.ts'
|
||||
|
||||
export function socketToClient(socket: SomeSocket): ChadClient {
|
||||
return {
|
||||
socketId: socket.id,
|
||||
userId: socket.data.userId,
|
||||
username: socket.data.username,
|
||||
displayName: socket.data.displayName,
|
||||
inputMuted: socket.data.inputMuted,
|
||||
outputMuted: socket.data.outputMuted,
|
||||
}
|
||||
}
|
||||
12
server/utils/typebox-ref.ts
Normal file
12
server/utils/typebox-ref.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Static, TSchema, TSchemaOptions, TUnsafe } from 'typebox'
|
||||
import { Unsafe } from 'typebox'
|
||||
|
||||
export function TypeboxRef<T extends TSchema>(t: T, options: TSchemaOptions = {}): TUnsafe<Static<T>> {
|
||||
const id = (t as unknown as Record<string, string | undefined>).$id
|
||||
|
||||
if (!id) {
|
||||
throw new Error('missing ID on schema')
|
||||
}
|
||||
|
||||
return Unsafe<Static<T>>({ ...t, $ref: id, $id: undefined, ...options })
|
||||
}
|
||||
Reference in New Issue
Block a user