import { type HookedBlockPositionId } from './hooked-blocks.js'; import { type AddBlockTemplateId, type EditorPluginSlotId, type IntegrationEnvServiceId, type ManualRestContractAuthId, type ManualRestContractHttpMethodId, type RestResourceMethodId } from './cli-add-types.js'; /** * Namespace format accepted by plugin-level REST resources. */ export declare const REST_RESOURCE_NAMESPACE_PATTERN: RegExp; /** * Validate a normalized workspace-generated slug. * * @param label Human-readable field label used in error messages. * @param slug Normalized slug value to validate. * @param usage CLI usage hint shown when the slug is empty. * @returns The validated slug. * @throws {Error} When the slug is empty or contains unsupported characters. */ export declare function assertValidGeneratedSlug(label: string, slug: string, usage: string): string; /** * Validate a source type name used by generated schema artifact workflows. * * @param label Human-readable field label used in error messages. * @param value TypeScript identifier candidate from CLI input or defaults. * @param usage CLI usage hint shown when the identifier is empty. * @returns The trimmed, validated TypeScript identifier. * @throws {Error} When the value is empty or not a TypeScript identifier. */ export declare function assertValidTypeScriptIdentifier(label: string, value: string, usage: string): string; /** * Validate a REST resource namespace. * * @param namespace Namespace candidate such as `vendor/v1`. * @returns The trimmed namespace. * @throws {Error} When the namespace is empty or not lowercase slash-separated. */ export declare function assertValidRestResourceNamespace(namespace: string): string; /** * Resolve the effective REST resource namespace for a workspace. * * @param workspaceNamespace Default workspace namespace prefix. * @param namespace Optional explicit namespace from CLI input. * @returns A validated namespace, defaulting to `/v1`. * @throws {Error} When the resolved namespace is invalid. */ export declare function resolveRestResourceNamespace(workspaceNamespace: string, namespace?: string): string; /** * Validate a WordPress post type key used as post-meta scope. * * @param postType Raw post type key from CLI input. * @returns The trimmed post type key. * @throws {Error} When the key is empty or contains unsupported characters. */ export declare function assertValidPostMetaPostType(postType: string): string; /** * Resolve a post-meta key from explicit input or the workspace slug default. * * @param options Optional explicit meta key plus workspace prefix and slug. * @returns A validated post-meta key. * @throws {Error} When the key is empty or contains whitespace/control characters. */ export declare function resolvePostMetaKey({ metaKey, phpPrefix, slug }: { metaKey?: string; phpPrefix: string; slug: string; }): string; /** * Parse and validate REST resource method ids from a comma-separated list. * * @param methods Optional comma-separated method list. Defaults to list, read, and create. * @returns Deduplicated canonical REST resource method ids. * @throws {Error} When any method is unsupported or the list is empty. */ export declare function assertValidRestResourceMethods(methods?: string): RestResourceMethodId[]; /** * Validate a PHP callable reference supplied to generated REST route metadata. * * @param label Human-readable field label for errors. * @param callback Optional PHP function or `ClassName::method` callback string. * @returns The trimmed callback when present. * @throws {Error} When the callback cannot be emitted as a safe PHP callable string. */ export declare function resolveOptionalPhpCallbackReference(label: string, callback?: string | null): string | undefined; /** * Validate a PHP class reference used by generated REST controller wrappers. * * @param label Human-readable field label for errors. * @param classReference Optional PHP class name. * @returns The trimmed class reference when present. * @throws {Error} When the class reference cannot be emitted safely. */ export declare function resolveOptionalPhpClassReference(label: string, classReference?: string | null): string | undefined; /** * Normalize and validate the HTTP method used by a manual REST contract. * * @param method Optional method input. Defaults to GET. * @returns A canonical uppercase HTTP method. * @throws {Error} When the method is unsupported. */ export declare function assertValidManualRestContractHttpMethod(method?: string): ManualRestContractHttpMethodId; /** * Normalize and validate the auth intent used by a manual REST contract. * * @param auth Optional auth intent input. Defaults to public. * @returns A canonical auth intent. * @throws {Error} When the auth intent is unsupported. */ export declare function assertValidManualRestContractAuth(auth?: string): ManualRestContractAuthId; /** * Check whether a generated REST item route keeps the generated `id` contract aligned. * * @param routePattern Route pattern relative to the namespace. * @returns True when the pattern has no regex groups or uses only `(?P...)`. */ export declare function isGeneratedRestResourceRoutePatternCompatible(routePattern: string): boolean; /** * Collect unique WordPress named capture parameters from a REST route pattern. * * @param routePattern Route pattern relative to the namespace. * @returns Capture names in first-seen order. */ export declare function collectRestRouteNamedCaptureNames(routePattern: string): string[]; export declare function resolveManualRestContractPathPattern(slug: string, pathPattern?: string): string; /** * Normalize and validate a generated REST resource item route pattern. * * @param slug Generated resource slug used for the default item route path. * @param routePattern Optional route path pattern, relative to the namespace. * @returns A route pattern with a leading slash. * @throws {Error} When the route pattern is empty or clearly not a route path. */ export declare function resolveGeneratedRestResourceRoutePattern(slug: string, routePattern?: string): string; /** * Validate a hooked block insertion position. * * @param position Position candidate from CLI input. * @returns The canonical hooked block position id. * @throws {Error} When the position is not supported. */ export declare function assertValidHookedBlockPosition(position: string): HookedBlockPositionId; /** * Build a PHP-safe workspace identifier prefix for a generated artifact. * * @param workspacePhpPrefix Workspace PHP prefix from project metadata. * @param slug Generated artifact slug to append. * @returns Snake-case PHP prefix for generated identifiers. */ export declare function buildWorkspacePhpPrefix(workspacePhpPrefix: string, slug: string): string; /** * Check whether a value is a supported built-in add block template id. * * @param value Candidate template id from CLI input. * @returns True when the value is an `AddBlockTemplateId`. */ export declare function isAddBlockTemplateId(value: string): value is AddBlockTemplateId; /** * Quote a value for safe insertion into generated TypeScript source. * * @param value Raw string value. * @returns A single-quoted TypeScript string literal. */ export declare function quoteTsString(value: string): string; /** * Validate a full block name used as a hooked block anchor. * * @param anchorBlockName Anchor block name from CLI input. * @returns The trimmed full block name. * @throws {Error} When the anchor is empty or not `namespace/slug`. */ export declare function assertValidHookAnchor(anchorBlockName: string): string; /** * Validate and normalize the editor plugin shell slot. * * @param slot Optional shell slot. Defaults to `sidebar`. * @returns The canonical editor plugin slot id. * @throws {Error} When the slot is not supported by the workspace scaffold. */ export declare function assertValidEditorPluginSlot(slot?: string): EditorPluginSlotId; /** * Validate and normalize the optional integration environment service starter. * * @param service Optional service starter id. Defaults to `none`. * @returns The canonical integration environment service id. * @throws {Error} When the service starter is unsupported. */ export declare function assertValidIntegrationEnvService(service?: string): IntegrationEnvServiceId;