Template
1
0

feat: biome check

This commit is contained in:
2025-09-25 14:29:15 +02:00
parent f2ba21a7e3
commit 0819534901
68 changed files with 211 additions and 802 deletions

View File

@@ -2,12 +2,12 @@ import { encrypt } from "@platform/vault";
import {
assertServerErrorResponse,
RelayAdapter,
RelayInput,
RelayResponse,
ServerErrorResponse,
type RelayAdapter,
type RelayInput,
type RelayResponse,
type ServerErrorResponse,
} from "../libraries/adapter.ts";
import { ServerError, ServerErrorType } from "../libraries/errors.ts";
import { ServerError, type ServerErrorType } from "../libraries/errors.ts";
/**
* HttpAdapter provides a unified transport layer for Relay.

View File

@@ -1,4 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface ServerContext {}
export type ServerContext = {};
export const context: ServerContext = {} as any;

View File

@@ -1,4 +1,4 @@
import { ZodError } from "zod";
import type { ZodError } from "zod";
export abstract class ServerError<TData = unknown> extends Error {
abstract readonly code: string;

View File

@@ -1,8 +1,9 @@
import z, { ZodType } from "zod";
import type z from "zod";
import type { ZodType } from "zod";
import { ServerContext } from "./context.ts";
import { ServerError, ServerErrorClass } from "./errors.ts";
import { RouteAccess } from "./route.ts";
import type { ServerContext } from "./context.ts";
import type { ServerError, ServerErrorClass } from "./errors.ts";
import type { RouteAccess } from "./route.ts";
export class Procedure<const TState extends State = State> {
readonly type = "procedure" as const;
@@ -234,7 +235,8 @@ type HandleFn<TArgs extends Array<any> = any[], TResponse = any> = (
? Promise<z.infer<TResponse> | Response | ServerError>
: Promise<Response | ServerError | void>;
type ServerArgs<TState extends State> =
HasInputArgs<TState> extends true ? [z.output<TState["params"]>, ServerContext] : [ServerContext];
type ServerArgs<TState extends State> = HasInputArgs<TState> extends true
? [z.output<TState["params"]>, ServerContext]
: [ServerContext];
type HasInputArgs<TState extends State> = TState["params"] extends ZodType ? true : false;

View File

@@ -1,9 +1,9 @@
import { match, type MatchFunction } from "path-to-regexp";
import z, { ZodObject, ZodRawShape, ZodType } from "zod";
import { type MatchFunction, match } from "path-to-regexp";
import z, { type ZodObject, type ZodRawShape, type ZodType } from "zod";
import { ServerContext } from "./context.ts";
import { ServerError, ServerErrorClass } from "./errors.ts";
import { Hooks } from "./hooks.ts";
import type { ServerContext } from "./context.ts";
import { ServerError, type ServerErrorClass } from "./errors.ts";
import type { Hooks } from "./hooks.ts";
export class Route<const TState extends RouteState = RouteState> {
readonly type = "route" as const;
@@ -480,15 +480,14 @@ type HandleFn<TArgs extends Array<any> = any[], TResponse = any> = (
? Promise<z.infer<TResponse> | Response | ServerError>
: Promise<Response | ServerError | void>;
type ServerArgs<TState extends RouteState> =
HasInputArgs<TState> extends true
? [
(TState["params"] extends ZodObject ? { params: z.output<TState["params"]> } : unknown) &
(TState["query"] extends ZodObject ? { query: z.output<TState["query"]> } : unknown) &
(TState["body"] extends ZodType ? { body: z.output<TState["body"]> } : unknown),
ServerContext,
]
: [ServerContext];
type ServerArgs<TState extends RouteState> = HasInputArgs<TState> extends true
? [
(TState["params"] extends ZodObject ? { params: z.output<TState["params"]> } : unknown) &
(TState["query"] extends ZodObject ? { query: z.output<TState["query"]> } : unknown) &
(TState["body"] extends ZodType ? { body: z.output<TState["body"]> } : unknown),
ServerContext,
]
: [ServerContext];
type HasInputArgs<TState extends RouteState> = TState["params"] extends ZodObject
? true

View File

@@ -15,4 +15,4 @@
"path-to-regexp": "8",
"zod": "4.1.11"
}
}
}