import type { Context } from "../context.ts"; import { type CloudflareApi, type CloudflareApiOptions } from "./api.ts"; /** * Properties for creating or updating an AI Search Namespace */ export interface AiSearchNamespaceProps extends CloudflareApiOptions { /** * Name of the namespace. * Must match pattern: `^[a-z0-9]([a-z0-9-]{0,26}[a-z0-9])?$` * * @default `${app}-${stage}-${id}` */ name?: string; /** * Optional description for the namespace (max 256 characters). * * Pass `null` to explicitly clear a previously-set description on update. * Leaving this field undefined (absent from props) will NOT touch the * existing description on update. */ description?: string | null; /** * Whether to adopt an existing namespace with the same name if it exists * * @default false */ adopt?: boolean; /** * Whether to delete the namespace when removed from Alchemy. * Namespace must be empty (no instances) to be deleted. * * @default true */ delete?: boolean; } /** * Type guard for AiSearchNamespace */ export declare function isAiSearchNamespace(resource: unknown): resource is AiSearchNamespace; /** * Output returned after AI Search Namespace creation/update */ export type AiSearchNamespace = Omit & { /** * Resource type identifier for binding resolution */ type: "ai_search_namespace"; /** * The stable identifier of the namespace (equal to `namespace`). * Present because Alchemy's resource model expects every output to carry an `id`. */ id: string; /** * The name of the namespace. */ namespace: string; /** * Optional description of the namespace */ description: string | null; /** * Time at which the namespace was created */ createdAt: string; }; /** * API response for AI Search namespace * @internal */ interface AiSearchNamespaceApiResponse { name: string; description: string | null; created_at: string; } /** * An AI Search Namespace groups AI Search instances together, * providing logical isolation and scoped access control. * * Namespaces are a first-class concept in the AI Search binding model. * Instance names are unique within their namespace: `UNIQUE(account_id, namespace, name)`. * * @see https://developers.cloudflare.com/ai-search/ * * @example * ## Create a namespace * * ```ts * const ns = await AiSearchNamespace("production", { * name: "production", * }); * ``` * * @example * ## Use as a Worker binding * * ```ts * const ns = await AiSearchNamespace("docs", { * name: "docs", * }); * * const worker = await Worker("my-worker", { * bindings: { * DOCS: ns, * }, * // ... * }); * ``` * * @example * ## Adopt an existing namespace * * ```ts * const ns = await AiSearchNamespace("existing", { * name: "production", * adopt: true, * }); * ``` */ export declare const AiSearchNamespace: (((this: any, id: string, props?: {}) => never) & (new (_: never) => never)) | ((this: Context, id: string, props?: AiSearchNamespaceProps) => Promise); /** * Create an AI Search namespace */ export declare function createAiSearchNamespace(api: CloudflareApi, payload: { name: string; description?: string | null; }): Promise; /** * Get an AI Search namespace by name */ export declare function getAiSearchNamespace(api: CloudflareApi, name: string): Promise; /** * Update an AI Search namespace. * * `description: null` clears a previously-set description. `description` * absent from the payload leaves the current value untouched. */ export declare function updateAiSearchNamespace(api: CloudflareApi, name: string, payload: { description?: string | null; }): Promise; /** * Delete an AI Search namespace. Namespace must be empty (no instances). * The reserved `default` namespace cannot be deleted and is skipped. */ export declare function deleteAiSearchNamespace(api: CloudflareApi, name: string): Promise; /** * List all AI Search namespaces in an account */ export declare function listAiSearchNamespaces(api: CloudflareApi): Promise; export {}; //# sourceMappingURL=ai-search-namespace.d.ts.map