agnostic-query
Version:
Type-safe fluent builder for portable query schemas. Runtime-agnostic, database-agnostic — the same QuerySchema drives Drizzle, Kysely, db0, or raw SQL.
26 lines (25 loc) • 1.48 kB
TypeScript
import z from 'zod';
import type { FieldPathByShape, SchemaShape } from './core/schema.js';
import { type QueryWhere } from './core/where.js';
export declare const createFieldPathSchema: <TShape extends SchemaShape>() => z.ZodType<FieldPathByShape<TShape>>;
export declare const createWhereSchema: <TShape extends SchemaShape>() => z.ZodType<QueryWhere<TShape, any>, QueryWhere<TShape, any>, z.core.$ZodTypeInternals<QueryWhere<TShape, any>, QueryWhere<TShape, any>>>;
export declare const createOrderBySchema: <TShape extends SchemaShape>() => z.ZodArray<z.ZodObject<{
field: z.ZodType<FieldPathByShape<TShape>, unknown, z.core.$ZodTypeInternals<FieldPathByShape<TShape>, unknown>>;
direction: z.ZodEnum<{
asc: "asc";
desc: "desc";
}>;
}, z.core.$strip>>;
export declare const createQuerySchema: <TShape extends SchemaShape>() => z.ZodObject<{
where: z.ZodOptional<z.ZodNullable<z.ZodType<QueryWhere<TShape, any>, QueryWhere<TShape, any>, z.core.$ZodTypeInternals<QueryWhere<TShape, any>, QueryWhere<TShape, any>>>>>;
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
field: z.ZodType<FieldPathByShape<TShape>, unknown, z.core.$ZodTypeInternals<FieldPathByShape<TShape>, unknown>>;
direction: z.ZodEnum<{
asc: "asc";
desc: "desc";
}>;
}, z.core.$strip>>>;
limit: z.ZodOptional<z.ZodNumber>;
offset: z.ZodOptional<z.ZodNumber>;
table: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;