import type { Kysely } from 'kysely'; import type { Database, RedirectRow } from '../db/schema.js'; /** * Author-created redirects. * * The automatic half — a redirect written for every path change — has existed since Phase 1 and * lives in `items.ts`, where it rides the same atomic batch as the move. This is the other half * SCOPE asks for: a redirect somebody types in, for a URL that was never a Taproot page at all. * Migrating a site is the case that needs it, and it is most of why anyone wants the feature. * * `source` has carried a `manual` variant since the table was created, documented as "author-created * and never GC'd", and nothing has ever written one. */ export declare class RedirectError extends Error { readonly code: 'invalid' | 'conflict' | 'not_found'; constructor(message: string, code: 'invalid' | 'conflict' | 'not_found'); } export interface RedirectInput { fromPath: string; toPath: string; statusCode?: number; } export declare function listRedirects(db: Kysely, options?: { search?: string; limit?: number; offset?: number; }): Promise<{ redirects: RedirectRow[]; total: number; }>; export declare function getRedirectById(db: Kysely, id: string): Promise; export declare function createRedirect(db: Kysely, input: RedirectInput): Promise; export declare function updateRedirect(db: Kysely, id: string, input: Partial): Promise; export declare function deleteRedirect(db: Kysely, id: string): Promise; /** * Whether a live item already occupies this path. * * Not an error — the catch-all resolves an item before it looks at the redirect table, so the row * is simply inert until the item moves away. Surfaced so the admin can say so rather than leaving * someone to wonder why a redirect they just added does nothing. */ export declare function redirectIsShadowed(db: Kysely, fromPath: string): Promise;