import { ZodRawShape, z, ZodString } from 'zod'; type AppletDefinition = { fetch: (request: Request) => Response | Promise; }; type BunServeLike = { stop: (closeActiveConnections?: boolean) => void; }; declare function defineApplet(definition: AppletDefinition): BunServeLike; type CurrentUser = { id: string; tenantId: string; permissions: string[]; requestId?: string; }; declare const auth: { currentUser(): Promise; }; type EngineCallOptions = { timeoutMs?: number; }; declare const engine: { call(method: string, params: unknown, options?: EngineCallOptions): Promise; }; declare const kv: { get(key: string): Promise; set(key: string, value: unknown, ttlSeconds?: number): Promise; del(key: string): Promise; mget(keys: string[]): Promise>; }; type DBConstraint = { field: string; op: 'eq'; value: unknown; }; type DBIndexConstraint = DBConstraint & { name: string; }; type DBQueryOptions = { index?: DBIndexConstraint; filters?: DBConstraint[]; order?: 'asc' | 'desc'; take?: number; }; type DBQueryIndex = { eq(field: string, value: unknown): DBQueryIndex; }; type DBQueryFilter = { eq(field: string, value: unknown): DBQueryFilter; }; type DBQueryBuilder = { withIndex(name: string, build: (q: DBQueryIndex) => DBQueryIndex | void): DBQueryBuilder; filter(build: (q: DBQueryFilter) => DBQueryFilter | void): DBQueryBuilder; order(direction: 'asc' | 'desc'): DBQueryBuilder; take(limit: number): DBQueryBuilder; collect(): Promise; first(): Promise; }; type DBClient = { get(id: string): Promise; query(table: string): DBQueryBuilder; queryRaw(table: string, query?: DBQueryOptions): Promise; insert(table: string, value: unknown): Promise; patch(id: string, value: unknown): Promise; replace(id: string, value: unknown): Promise; delete(id: string): Promise; }; declare const db: DBClient; type ScheduledJob = { id: string; type: string; cron: string; method: string; params: unknown; status: string; nextRunAt?: string; lastRunAt?: string; lastStatus?: string; lastError?: string; createdAt?: string; updatedAt?: string; }; declare const jobs: { enqueue(method: string, params?: unknown): Promise; schedule(cron: string, method: string, params?: unknown): Promise; list(): Promise; cancel(id: string): Promise<{ ok: boolean; }>; }; declare const secrets: { get(name: string): Promise; }; type StoredFile = { id: string; name: string; contentType?: string; size: number; path: string; createdAt: string; }; declare const files: { store(input: { name: string; contentType?: string; data: Blob | ArrayBuffer | Uint8Array; }): Promise; get(id: string): Promise; delete(id: string): Promise; }; type ConnectionHandler = (connectionId: string) => void | Promise; type MessageHandler = (connectionId: string, data: Uint8Array) => void | Promise; type CloseHandler = (connectionId: string) => void | Promise; declare const ws: { send(connectionId: string, data: unknown): Promise<{ ok: boolean; }>; onConnection(handler: ConnectionHandler): () => void; onMessage(handler: MessageHandler): () => void; onClose(handler: CloseHandler): () => void; }; type TableIndex = { name: string; fields: string[]; }; type TableDefinition = { schema: z.ZodObject; indexes: TableIndex[]; index(name: string, fields: string[]): TableDefinition; }; type SchemaDefinition>> = { tables: Tables; }; declare function defineTable(shape: T): TableDefinition; declare function defineSchema>>(tables: Tables): SchemaDefinition; declare function id(_tableName: string): ZodString; type EngineHandler = (params: unknown) => unknown | Promise; type TestContextOptions = { appletId?: string; user?: Partial; secrets?: Record; engineHandlers?: Record; }; declare function createTestContext(options?: TestContextOptions): { auth: { currentUser(): Promise; }; engine: { call(method: string, params: unknown): Promise; }; kv: { get(key: string): Promise; set(key: string, value: unknown, ttlSeconds?: number): Promise; del(key: string): Promise; mget(keys: string[]): Promise>; }; db: DBClient; jobs: { enqueue(method: string, params?: unknown): Promise; schedule(cron: string, method: string, params?: unknown): Promise; list(): Promise; cancel(id: string): Promise<{ ok: boolean; }>; }; secrets: { get(name: string): Promise; }; files: { store(input: { name: string; contentType?: string; data: Blob | ArrayBuffer | Uint8Array; }): Promise; get(id: string): Promise; delete(id: string): Promise; }; setCurrentUser(nextUser: Partial): void; }; export { type AppletDefinition, type CurrentUser, type DBClient, type DBConstraint, type DBIndexConstraint, type DBQueryBuilder, type DBQueryFilter, type DBQueryIndex, type DBQueryOptions, type ScheduledJob, type SchemaDefinition, type StoredFile, type TableDefinition, type TableIndex, type TestContextOptions, auth, createTestContext, db, defineApplet, defineSchema, defineTable, engine, files, id, jobs, kv, secrets, ws };