mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
build(Needs bump): update dependencies
This commit is contained in:
@@ -30,9 +30,9 @@
|
||||
},
|
||||
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||
"dependencies": {
|
||||
"bson": "^6.10.3",
|
||||
"bson": "^6.10.4",
|
||||
"chalk": "^5.4.1",
|
||||
"tracer": "^1.3.0",
|
||||
"valibot": "^0.30.0"
|
||||
"valibot": "^1.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import {
|
||||
url,
|
||||
type AnySchema,
|
||||
type BooleanSchema,
|
||||
type NullSchema,
|
||||
type ObjectSchema,
|
||||
type Output,
|
||||
array,
|
||||
type BooleanSchema,
|
||||
boolean,
|
||||
custom,
|
||||
enum_,
|
||||
type InferOutput,
|
||||
type NullSchema,
|
||||
null_,
|
||||
type ObjectSchema,
|
||||
object,
|
||||
parse,
|
||||
special,
|
||||
pipe,
|
||||
string,
|
||||
url,
|
||||
// merge
|
||||
} from 'valibot'
|
||||
import DisconnectReason from '../constants/DisconnectReason'
|
||||
@@ -21,7 +22,7 @@ import { ClientOperation, Operation, ServerOperation } from '../constants/Operat
|
||||
/**
|
||||
* Schema to validate packets
|
||||
*/
|
||||
export const PacketSchema = special<Packet>(input => {
|
||||
export const PacketSchema = custom<Packet>(input => {
|
||||
if (
|
||||
typeof input === 'object' &&
|
||||
input &&
|
||||
@@ -51,7 +52,7 @@ export const PacketDataSchemas = {
|
||||
labels: array(
|
||||
object({
|
||||
name: string(),
|
||||
confidence: special<number>(input => typeof input === 'number' && input >= 0 && input <= 1),
|
||||
confidence: custom<number>(input => typeof input === 'number' && input >= 0 && input <= 1),
|
||||
}),
|
||||
),
|
||||
}),
|
||||
@@ -70,7 +71,7 @@ export const PacketDataSchemas = {
|
||||
text: string(),
|
||||
}),
|
||||
[ClientOperation.ParseImage]: object({
|
||||
image_url: string([url()]),
|
||||
image_url: pipe(string(), url()),
|
||||
}),
|
||||
[ClientOperation.TrainMessage]: object({
|
||||
text: string(),
|
||||
@@ -79,7 +80,7 @@ export const PacketDataSchemas = {
|
||||
} as const satisfies Record<
|
||||
Operation,
|
||||
// biome-ignore lint/suspicious/noExplicitAny: This is a schema, it's not possible to type it
|
||||
ObjectSchema<any> | AnySchema | NullSchema | BooleanSchema
|
||||
ObjectSchema<any, any> | AnySchema | NullSchema<any> | BooleanSchema<any>
|
||||
>
|
||||
|
||||
export type Packet<TOp extends Operation = Operation> = TOp extends ServerOperation
|
||||
@@ -88,6 +89,6 @@ export type Packet<TOp extends Operation = Operation> = TOp extends ServerOperat
|
||||
|
||||
type PacketWithSequenceNumber<TOp extends Operation> = {
|
||||
op: TOp
|
||||
d: Output<(typeof PacketDataSchemas)[TOp]>
|
||||
d: InferOutput<(typeof PacketDataSchemas)[TOp]>
|
||||
s: number
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Chalk, supportsColor, supportsColorStderr } from 'chalk'
|
||||
import { type Tracer, colorConsole, console as uncoloredConsole } from 'tracer'
|
||||
import { colorConsole, type Tracer, console as uncoloredConsole } from 'tracer'
|
||||
|
||||
const chalk = new Chalk()
|
||||
const DefaultConfig = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as BSON from 'bson'
|
||||
import { parse } from 'valibot'
|
||||
import type { Operation } from '../constants'
|
||||
import { type Packet, PacketSchema } from '../schemas'
|
||||
import type { Operation } from '../constants'
|
||||
|
||||
/**
|
||||
* Compresses a packet into a buffer
|
||||
|
||||
Reference in New Issue
Block a user