import type { Temporal } from "@js-temporal/polyfill"; import type { WatchCallback as VueWatchCallback, WatchOptions as VueWatchOptions, WatchSource as VueWatchSource, WatchStopHandle as VueWatchStopHandle } from "vue"; import type { z } from "zod"; import { AccessCapabilitySchema, AccessRoleDefinitionSchema, AccessRoleSchema, AccessSubjectSchema } from "../schemas/access.schema.js"; import { AiFunctionCallSchema, AiMessageSchema, AiProviderConfigSchema, AiRoleSchema, AiToolCallSchema } from "../schemas/ai.schema.js"; import { ApiErrorSchema, HttpMethodSchema, LocaleSchema, LogLevelSchema, SerializedErrorSchema, StorageTargetSchema, ThemeModeSchema } from "../schemas/common.schema.js"; import { AgentDataSchema, AgentStepSchema, AiErrorSchema, AppDateFormatOptionsSchema, AssistantReplySchema, AstroServiceErrorSchema, CurrencyFormatOptionsSchema, CurrencySchema, FieldErrorsSchema, GeometryFormatOptionsSchema, GeoPositionSchema, LazyLoaderEntrySchema, NumberFormatOptionsSchema, ProductTypeSchema, ScrollPositionSchema, ValidationIssueSchema, ViewportSizeSchema } from "../schemas/core.schema.js"; import { FakeVehicleSchema } from "../schemas/faker.schema.js"; import { FileEncodingSchema, FileHashAlgorithmSchema, FileStatsSchema, FilesystemErrorSchema, ReadDirEntrySchema, ReadDirOptionsSchema, WriteFileOptionsSchema } from "../schemas/filesystem.schema.js"; import { IfConfigSchema, IfInsertRowsSchema, IfInvokeOptionsSchema, IfListOptionsSchema, IfOrderSchema, IfRpcCallSchema, IfStorageRefSchema, IfTableQuerySchema, IfUpdatePatchSchema, IfWriteQuerySchema } from "../schemas/insforge.schema.js"; import { MediaProviderSchema, MediaSourceSchema, SmartVideoOptionsSchema, YoutubeEmbedOptionsSchema, YoutubeThumbnailQualitySchema } from "../schemas/media.schema.js"; import { NotionBlockListSchema, NotionBlockSchema, NotionConfigSchema, NotionCoverSchema, NotionDatabaseQuerySchema, NotionDatabaseSchema, NotionIconSchema, NotionPageListSchema, NotionPageSchema, NotionParentSchema, NotionPropertySchemaSchema, NotionPropertyValueSchema, NotionRichTextSchema, NotionSearchQuerySchema, NotionSearchResultSchema, NotionSortSchema, NotionUserListSchema, NotionUserSchema } from "../schemas/notion.schema.js"; import { RssConfigSchema, RssItemSchema } from "../schemas/rss.schema.js"; import { WordPressAuthSchema, WordPressConfigSchema, WpAcfFieldsSchema, WpBaseEntitySchema, WpBatchOperationSchema, WpBatchResultSchema, WpCategoryCreateSchema, WpCategorySchema, WpCategoryUpdateSchema, WpCommentCreateSchema, WpCommentSchema, WpCommentUpdateSchema, WpEmbeddedSchema, WpMediaMetaSchema, WpMediaSchema, WpMediaUpdateSchema, WpPageCreateSchema, WpPageSchema, WpPageUpdateSchema, WpPostCreateSchema, WpPostSchema, WpPostUpdateSchema, WpQueryParamsSchema, WpTagCreateSchema, WpTagSchema, WpTagUpdateSchema, WpUserCreateSchema, WpUserSchema, WpUserUpdateSchema } from "../schemas/wordpress.schema.js"; import { YoutubeApiConfigSchema, YoutubeChannelsResponseSchema, YoutubeListParamsSchema, YoutubePlaylistItemsResponseSchema, YoutubeVideoNormalizedSchema, YoutubeVideoPageSchema, YoutubeVideosResponseSchema, YoutubeVideoThumbnailsSchema } from "../schemas/youtube.schema.js"; /** Native console methods used as log levels. */ export type LogLevel = z.infer; /** Target can be either an HTMLElement reference or a CSS selector string. */ export type ObserverTarget = HTMLElement | string; /** Callback invoked when an observed element enters the viewport. */ export type ObserverCallback = (entry: IntersectionObserverEntry) => void; /** Configuration for a registered IntersectionObserver. */ export interface ObserverConfig { callback: ObserverCallback; options: IntersectionObserverInit; autoUnobserve: boolean; } /** Internal registry entry storing an observer instance and its tracked targets. */ export interface ObserverEntry { config: ObserverConfig; observer: IntersectionObserver | null; targets: Set; } /** Internal registry entry for lazy loading configurations. */ export type LazyLoaderEntry = z.infer; /** Contract of the DOM facade. */ export interface IDomService { useIsBrowser(): boolean; useGetRoot(): HTMLElement | null; useGetBody(): HTMLBodyElement | null; useGetElementById(id: string): T | null; useGetElementByClass(className: string): T | null; useQuerySelector(selector: K): HTMLElementTagNameMap[K] | null; useQuerySelector(selector: string): E | null; useQuerySelectorAll(selector: K): HTMLElementTagNameMap[K][]; useQuerySelectorAll(selector: string): E[]; useAddClass(target: Element | string, className: string): void; useRemoveClass(target: Element | string, className: string | string[]): void; useToggleClass(target: Element | string, className: string, force?: boolean): boolean | undefined; useHasClass(target: Element | string, className: string): boolean; useGetAttribute(target: Element | string, attr: string): string | null; useSetAttribute(target: Element | string, attr: string, value: string): void; useRemoveAttribute(target: Element | string, attr: string): void; useGetDataAttribute(target: HTMLElement | string, key: string): string | undefined; useSetDataAttribute(target: HTMLElement | string, key: string, value: string): void; useOn(target: EventTarget | string, event: K, callback: (event: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): (() => void) | null; useCreateElement(tagName: T, options?: ElementCreationOptions): HTMLElementTagNameMap[T]; useSetHtml(target: Element | string, html: string): void; useSetText(target: Element | string, text: string): void; useAppend(target: Element | string, child: Element | string): void; useRemove(target: Element | string): void; } /** Represents a geographic position with latitude, longitude and accuracy. */ export type GeoPosition = z.infer; /** Type for the experimental Battery API. */ export interface BatteryManager extends EventTarget { charging: boolean; chargingTime: number; dischargingTime: number; level: number; } export type WorkerFunc = (data: TInput) => TOutput | Promise; export interface WorkerPoolEntry { worker: Worker; workerUrl: string; func: WorkerFunc; pending: Map void; cleanup: () => void; }>; } export type StorageTarget = z.infer; /** Strategy contract: homogeneous storage without `any`. */ export interface StorageStrategy { useGetItem(key: string): T | null; useSetItem(key: string, value: unknown): void; useRemoveItem(key: string): void; useClear(): void; } /** Text encodings accepted by the filesystem helpers. */ export type FileEncoding = z.infer; /** Hash algorithms supported by `useHashFile` / `useVerifyFileHash`. */ export type FileHashAlgorithm = z.infer; /** Safe error from a filesystem operation (`NodeJS.ErrnoException`-shaped). */ export type FilesystemError = z.infer; /** Safe Result for filesystem operations: `{ data, error, ok }`, never throws. */ export type FilesystemResult = SafeResult; /** Portable stats subset returned by `useGetFileStats`. */ export type FileStats = z.infer; /** A single directory entry returned by `useReadDir`. */ export type ReadDirEntry = z.infer; /** Options for `useReadDir`. */ export type ReadDirOptions = z.infer; /** Options for `useWriteFile` / `useAppendFile`. */ export type WriteFileOptions = z.infer; export type Locale = z.infer; export type Currency = z.infer; export type CurrencyFormatOptions = z.infer; export type NumberFormatOptions = z.infer; export type TemporalInput = string | number | Date | Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime | Temporal.Instant; export type AppDateFormatOptions = z.infer; /** Backwards-compatible alias for {@link AppDateFormatOptions}. */ export type DateFormatOptions = AppDateFormatOptions; /** Contract of the dates facade. */ export interface DatesServiceTypes { useDiff(start: string | Temporal.PlainDate, end: string | Temporal.PlainDate): string; useFormat(dateInput: TemporalInput, locale?: Locale, options?: Intl.DateTimeFormatOptions): string; useNow(): string; useNowDateTime(): string; useAddDays(date: string | Temporal.PlainDate, days: number): string; useSubtractDays(date: string | Temporal.PlainDate, days: number): string; useIsEqual(date1: string | Temporal.PlainDate, date2: string | Temporal.PlainDate): boolean; useIsBefore(date1: string | Temporal.PlainDate, date2: string | Temporal.PlainDate): boolean; useIsAfter(date1: string | Temporal.PlainDate, date2: string | Temporal.PlainDate): boolean; useFirstDayOfMonth(date?: string | Temporal.PlainDate): string; useLastDayOfMonth(date?: string | Temporal.PlainDate): string; } export type HttpMethod = z.infer; export type QueryParams = Record; export type PathParams = Record; export interface UrlOptions { params?: PathParams; query?: QueryParams; ignoreDefaultQuery?: boolean; } export interface ApiEntry { baseUri: string | URL; endpoints: Record; defaultQueryParams?: Record; } export type ApisConfig = Record; /** * Options passed when executing a fetch request. * * URL building lives **at the top level** — the same shape as `useGet`, * `useRequest` and Nuxt's `useFetch` — so nothing has to be nested: * * ```ts * useFetch("api", "byId", { method: "GET", params: { id: 25 }, query: { limit: 2 } }); * ``` * * @typeParam T - The type {@link FetchOptions.transform} resolves to. Defaults * to `any` on purpose: with `unknown` a bare `FetchOptions` (or one stored in * a variable / passed through a wrapper) would no longer be assignable to * `FetchOptions`, which is a type-level break for existing callers. */ export interface FetchOptions extends RequestInit { /** Path params substituted into `:name` placeholders of the endpoint. */ params?: PathParams; /** Query-string params appended to the URL. */ query?: QueryParams; /** Skip the endpoint's `defaultQueryParams` instead of merging them. */ ignoreDefaultQuery?: boolean; /** * Nested form of {@link FetchOptions.params}, {@link FetchOptions.query} and * {@link FetchOptions.ignoreDefaultQuery}. * * @deprecated Pass them at the top level instead. Kept for backwards * compatibility and scheduled for removal in the next major. */ urlOptions?: UrlOptions; /** Maps the parsed response body to `T` before it is returned. */ transform?: (input: unknown) => T | Promise; } /** Structure of the safe error returned on non-2xx or network failures. */ export type ApiError = z.infer; /** * Generic Safe Result discriminated union (Astro Actions style): the `ok` flag * narrows between the success and error branches and nothing is thrown. * * Domain results below are aliases of this shape with a specific error type. */ export type SafeResult = { data: T; error: null; ok: true; } | { data: null; error: E; ok: false; }; /** * Safe result, discriminated union (Astro Actions style) without throwing. * The `ok` flag narrows the union between the success and error branches. */ export type FetchResult = { data: T; error: null; url: string; status: number; ok: true; } | { data: null; error: ApiError; url: string; status: number; ok: false; }; /** Contract of the fetch facade. */ export interface IFetchApiManager { /** @deprecated Use `defineApiConfig`. */ useInit(apis: ApisConfig): void; /** @deprecated Use `defineApiConfig`. */ useInitApis(apis: ApisConfig): void; useGetApis(): ApisConfig; useGetApisConfig(): ApisConfig; useBuildUrl(apiName: string, endpointName: string, options?: UrlOptions): string; /** @deprecated Use `useBuildUrl`. */ useBuildApiUrl(apiName: string, endpointName: string, options?: UrlOptions): string; useFetch(apiName: string, endpointName: string, options?: FetchOptions): Promise>; useFetchApi(apiName: string, endpointName: string, options?: FetchOptions): Promise>; useGet(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise>; useGetApi(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise>; usePost(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; usePut(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; usePatch(apiName: string, endpointName: string, body?: unknown, urlOptions?: UrlOptions): Promise>; useDelete(apiName: string, endpointName: string, urlOptions?: UrlOptions): Promise>; } /** Serialized error shape. */ export type ISerializedError = z.infer; /** Contract of the formatter facade. */ export interface IFormatterService { useCapitalize(text: string, locale?: Locale): string; useFormatCurrency(options: CurrencyFormatOptions): string; useFormatNumber(value: number, locale?: Locale, digits?: number): string; useJsonParse(json: string): T; useJsonStringify(data: unknown): string; useLowerCase(text: string, locale?: Locale): string; useUpperCase(text: string, locale?: Locale): string; } /** Contract of the unit converter facade. */ export interface IConverterService { useToCelsius(fahrenheit: number, locale?: Locale, digits?: number): string; useToFahrenheit(celsius: number, locale?: Locale, digits?: number): string; useToKilometers(miles: number, locale?: Locale, digits?: number): string; useToMiles(km: number, locale?: Locale, digits?: number): string; useToInches(cm: number, locale?: Locale, digits?: number): string; useToCm(inches: number, locale?: Locale, digits?: number): string; useToKilos(pounds: number, locale?: Locale, digits?: number): string; useToPounds(kilos: number, locale?: Locale, digits?: number): string; } /** Contract for a crypto strategy. */ export interface ICryptoStrategy { useHash(plainText: string, salt?: string): Promise; /** @deprecated Use {@link useHash}. */ useEncrypt(plainText: string, salt?: string): Promise; } /** Contract for a UUID strategy. */ export interface IUuidStrategy { useGenerate(): string; } /** Generic fake vehicle returned by `useFakeVehicle`. */ export type FakeVehicle = z.infer; /** Options for number formatting in geometry calculations. */ export type GeometryFormatOptions = z.infer; export type SignalListener = (newValue: T, oldValue: T) => void; export interface Subscribable { useSubscribe: (listener: SignalListener) => () => void; } export interface SignalGetter extends Subscribable { (): T; } export type SignalSetter = (newValue: T | ((prev: T) => T)) => void; export interface ToggleSignalSetter { useSet: (value: boolean) => void; useToggle: () => void; } /** Contract of the reactive facade. */ export interface IReactiveService { useCreateSignal(initialValue: T): [SignalGetter, SignalSetter]; useCreateEffect(callback: () => void | (() => void), signals: Subscribable[]): () => void; useCreateMemo(computation: () => T, signals: Subscribable[]): SignalGetter; useCreateToggle(initialValue?: boolean): [SignalGetter, ToggleSignalSetter]; useCreateStorageSignal(key: string, fallbackValue: T, target?: StorageTarget): [SignalGetter, SignalSetter]; useCreateDebouncedSignal(initialValue: T, delayMs?: number): [SignalGetter, SignalSetter & { useCancel: () => void; }]; useCreateBatch(): (callback: () => void) => void; } /** Control object returned by timeout operations. */ export interface TimeoutControl { promise: Promise; cancel: () => void; } /** Control object returned by interval operations. */ export interface IntervalControl { pause: () => void; resume: () => void; stop: () => void; isRunning: () => boolean; } /** Contract of the data utilities. */ export interface IDataUtils { useUnique(array: T[]): T[]; useChunk(array: T[], size: number): T[][]; useGroupBy(array: T[], key: keyof T | ((item: T) => string)): Record; useIsObject(item: unknown): item is Record; useDeepClone(value: T): T; useDeepMerge>(target: T, source: Record): T; usePick(obj: T, keys: K[]): Pick; useOmit(obj: T, keys: K[]): Omit; } /** Contract of the system utilities. */ export interface ISystemUtils { useSleep(ms: number): Promise; useRetry(fn: () => Promise, retries?: number, delayMs?: number): Promise; useCopyToClipboard(text: string): Promise; useGetUrlParams(urlString: string): Record; useRound(value: string | number, decimals?: number): number; useAverage(numbers: number[]): number; } /** Contract of the app utilities facade. */ export interface IAppUtils { readonly data: IDataUtils; readonly system: ISystemUtils; } /** Represents viewport dimensions. */ export type ViewportSize = z.infer; /** Represents scroll position. */ export type ScrollPosition = z.infer; /** Options for scrolling operations. */ export interface ScrollOptions { behavior?: ScrollBehavior; block?: ScrollLogicalPosition; inline?: ScrollLogicalPosition; } export type ThemeMode = z.infer; export interface ThemeOptions { defaultMode?: ThemeMode; storageKey?: string; attribute?: string; target?: HTMLElement; onChange?: (mode: ThemeMode, resolved: "light" | "dark") => void; } /** Contract of the theme facade. */ export interface IThemeService { useInitTheme(options?: ThemeOptions): void; useSetThemeMode(mode: ThemeMode): void; useGetThemeMode(): ThemeMode; useGetResolved(): "light" | "dark"; usePrefersColorScheme(): boolean; useToggleTheme(): void; useResetTheme(): void; useDestroyTheme(): void; } /** Minimal shape of an Astro content collection entry. */ export interface CollectionEntryLike { id: string; slug?: string; data?: TData; [key: string]: unknown; } export interface PathsOptions { param?: TParam; valueFrom?: (item: T) => string | number; propsFrom?: (item: T) => TProps; paramsFrom?: (item: T) => Record; } export interface AstroPath { params: Record; props: TProps; } export interface PaginationProps { items: T[]; currentPage: number; totalPages: number; } export type AstroServiceError = z.infer; /** Safe Result (discriminated union without throwing). */ export type AstroServiceResult = SafeResult; /** Contract of the Astro facade. */ export interface IAstroService { usePathsFrom(items: T[], options?: PathsOptions): AstroPath[]; useGetStaticPaths>(getCollectionFn: (collection: string) => Promise[]>, collectionName: string, options?: PathsOptions, TParam, TProps>): Promise[]>>; useFindEntry(items: T[], value: string, keyFrom?: (item: T) => string | number): T | null; useGeneratePagination(items: T[], pageSize?: number, param?: TParam): AstroPath>[]; usePathsFromValues(values: (string | number)[], param?: TParam): AstroPath[]; useExtractUniqueValues(items: T[], keyFrom: (item: T) => V | V[]): V[]; } /** A single item in an RSS feed. */ export type RssItem = z.infer; /** Configuration for generating an RSS feed. */ export type RssConfig = z.infer; /** Result of an RSS generation attempt. */ export type RssResult = SafeResult; /** Contract of the RSS facade. */ export interface IRssService { /** Generates the RSS XML string from a config. */ useGenerateRss(config: RssConfig): RssResult; /** Generates an HTML `` tag for the RSS feed. */ useRssLinkTag(config: Pick): string; /** Generates an Astro GET endpoint handler for the RSS feed. */ useCreateRssEndpoint(config: Omit & { items: RssItem[] | (() => RssItem[] | Promise); }): (context: { site?: URL | string; }) => Promise; /** Convenience: creates an RSS endpoint from a SiteConfig. */ useCreateRssEndpointFromConfig(siteConfig: import("../config/site.config.js").SiteConfig, items: RssItem[] | (() => RssItem[] | Promise)): (context: { site?: URL | string; }) => Promise; } /** Role of a chat message in the OpenAI-compatible protocol. */ export type AiRole = z.infer; /** Function invocation requested by the model when using tools. */ export type AiFunctionCall = z.infer; /** A single tool call emitted by the model (OpenAI-compatible wire shape). */ export type AiToolCall = z.infer; /** * A chat message. `tool_calls` and `tool_call_id` use snake_case on purpose: * they mirror the OpenAI-compatible protocol so messages pass through unchanged. */ export type AiMessage = z.infer; /** Provider configuration for an OpenAI-compatible chat/agent endpoint. */ export type AiProviderConfig = z.infer; /** Options for a single chat completion. */ export interface AiChatOptions { temperature?: number; maxTokens?: number; topP?: number; signal?: AbortSignal; /** Overrides the provider `systemPrompt` for this request. */ systemPrompt?: string; } /** Safe error returned on non-2xx or network failures. */ export type AiError = z.infer; /** Safe result (discriminated union) without throwing. */ export type AiResult = SafeResult; /** * A tool the agent can invoke. `parameters` is a JSON Schema object * describing the expected input. */ export interface AiTool { name: string; description: string; parameters: Record; execute(input: unknown): unknown | Promise; } /** One round of tool execution inside the agent loop. */ export type AgentStep = z.infer; /** Payload returned by a successful {@link useRunAgent} call. */ export type AgentData = z.infer; /** Safe result of an agent run. */ export type AgentResult = AiResult; /** Options for running the tool-calling agent loop. */ export interface AgentRunOptions extends AiChatOptions { tools?: AiTool[]; maxSteps?: number; /** Prior conversation (system messages are ignored; a system prompt is prepended). */ history?: AiMessage[]; } /** Contract of the AI/agent facade. */ export interface IAiService { useInitAgent(config: Partial): void; useChat(messages: AiMessage[], options?: AiChatOptions): Promise>; useRunAgent(goal: string, options?: AgentRunOptions): Promise; } /** Persistence contract for assistant conversations. */ export interface ConversationStore { useCreate(channel?: string): Promise; useExists(sessionId: string): Promise; useAppend(sessionId: string, message: AiMessage): Promise; useGetHistory(sessionId: string): Promise; useReset(sessionId: string): Promise; } /** Configuration for the assistant facade. */ export interface AssistantInitConfig extends Partial { store?: ConversationStore; tools?: AiTool[]; maxSteps?: number; } /** Options for a single assistant reply. */ export interface AssistantReplyOptions extends AiChatOptions { tools?: AiTool[]; maxSteps?: number; } /** Payload returned by a successful assistant reply. */ export type AssistantReply = z.infer; /** Safe result of an assistant reply. */ export type AssistantResult = AiResult; /** Contract of the assistant facade. */ export interface IAssistantService { useInitAssistant(config?: AssistantInitConfig): void; useReply(sessionId: string | undefined, text: string, options?: AssistantReplyOptions): Promise; useCreateSession(channel?: string): Promise; useSessionExists(sessionId: string): Promise; useGetHistory(sessionId: string): Promise; useResetSession(sessionId: string): Promise; } /** * Built-in roles, ordered from most to least privileged. * * - `owner` — the site owner; the only role that can manage roles and perform * system-level operations. There should be exactly one owner. * - `admin` — day-to-day administration: manage members and moderate anything. * - `editor` — publish and manage any content. * - `author` — create and manage only their own content. * - `member` — registered account; can use the assistant and read content. * - `guest` — anonymous default; read-only, never persisted. */ export type AccessRole = z.infer; /** * Namespaced capabilities derived from the project domain. * Format: `:[:]`. */ export type AccessCapability = z.infer; /** A role definition: slug, human label and the capabilities it grants. */ export type AccessRoleDefinition = z.infer; /** * Structural subject for access checks. Decoupled from the persistence layer: * any object with an id and a role list can be checked (e.g. a Prisma * `Account` row, a JWT payload, or a test fixture). */ export type AccessSubject = z.infer; /** Contract of the access-control facade. Pure, no I/O. */ export interface IAccessService { useCan(subject: AccessSubject, capability: AccessCapability): boolean; useHasRole(subject: AccessSubject, role: AccessRole): boolean; useCapabilitiesFor(role: AccessRole): AccessCapability[]; useRegisterRole(definition: AccessRoleDefinition): void; useRoles(): AccessRoleDefinition[]; } /** * Watch source taken from the native Vue `watch` (`ref`, reactive object, * getter function or array of those). */ export type WatchSource = VueWatchSource; /** * Watch callback taken from the native Vue `watch`. Any internal function * is accepted: sync or async, with `(newValue, oldValue)` args or with no * args at all (e.g. `() => checkValidations()`). */ export type WatchCallback = VueWatchCallback; /** * Watch options taken from the native Vue `watch`. `deep` defaults to * `true` in `useKatanaWatch`. */ export type WatchOptions = VueWatchOptions; /** Stop function taken from the native Vue `watch`. */ export type WatchStopHandle = VueWatchStopHandle; /** A single field-level validation message keyed by field name. */ export type FieldErrors = z.infer; /** Minimal issue shape (`error.issues` entries). */ export type ValidationIssue = z.infer; /** Minimal Zod-like success/failure result (`schema.safeParse`). */ export type ValidationParseResult = { success: true; data: T; } | { success: false; error: { issues: ValidationIssue[]; }; }; /** * Schema-agnostic contract. Accepts Zod (`safeParse`), Valibot * (`safeParse`), Standard Schema (`~standard.validate`), Yup * (`validateSync`) or any object exposing one of those members. */ export interface ValidationSchema { safeParse?: (data: unknown) => ValidationParseResult; "~standard"?: { validate: (data: unknown) => { issues?: ValidationIssue[]; } | Promise<{ issues?: ValidationIssue[]; }>; }; validateSync?: (data: unknown) => unknown; validate?: (data: unknown) => unknown | Promise; } export type ProductType = z.infer; /** Configuration for the Notion API integration. */ export type NotionConfig = z.infer; /** Rich text object used in Notion blocks and properties. */ export type NotionRichText = z.infer; /** A Notion page object. */ export type NotionPage = z.infer; /** Parent reference for pages and databases. */ export type NotionParent = z.infer; /** Property value on a Notion page. */ export type NotionProperty = z.infer; /** Icon on a page or database (emoji or file). */ export type NotionIcon = z.infer; /** Cover image on a page. */ export type NotionCover = z.infer; /** A Notion block object. */ export type NotionBlock = z.infer; /** Result of listing block children (paginated). */ export type NotionBlockList = z.infer; /** A Notion database object. */ export type NotionDatabase = z.infer; /** Schema definition for a database property. */ export type NotionPropertySchema = z.infer; /** Filter for querying a Notion database. */ export interface NotionFilter { and?: NotionFilter[]; or?: NotionFilter[]; property?: string; [key: string]: unknown; } /** Sort option for querying a Notion database. */ export type NotionSort = z.infer; /** Query options for a Notion database. */ export type NotionDatabaseQuery = z.infer; /** Result of querying a Notion database (paginated). */ export type NotionPageList = z.infer; /** A Notion user object. */ export type NotionUser = z.infer; /** Paginated list of Notion users. */ export type NotionUserList = z.infer; /** Search query options for the Notion API. */ export type NotionSearchQuery = z.infer; /** Result of a Notion search (paginated). */ export type NotionSearchResult = z.infer; /** Contract of the Notion adapter facade. */ export interface INotionService { /** @deprecated Use `defineNotionConfig`. */ useInitNotion(config: NotionConfig): void; useNotionGetPage(pageId: string): Promise>; useNotionCreatePage(parent: NotionParent, properties: Record, children?: unknown[]): Promise>; useNotionUpdatePage(pageId: string, properties: Record): Promise>; useNotionArchivePage(pageId: string): Promise>; useNotionGetBlock(blockId: string): Promise>; useNotionGetBlockChildren(blockId: string, options?: { start_cursor?: string; page_size?: number; }): Promise>; useNotionAppendBlocks(blockId: string, children: unknown[]): Promise>; useNotionUpdateBlock(blockId: string, content: Record): Promise>; useNotionDeleteBlock(blockId: string): Promise>; useNotionGetDatabase(databaseId: string): Promise>; useNotionQueryDatabase(databaseId: string, query?: NotionDatabaseQuery): Promise>; useNotionCreateDatabase(parent: NotionParent, title: NotionRichText[], properties: Record): Promise>; useNotionUpdateDatabase(databaseId: string, title: NotionRichText[], properties?: Record): Promise>; useNotionGetUser(userId: string): Promise>; useNotionListUsers(options?: { start_cursor?: string; page_size?: number; }): Promise>; useNotionSearchContent(query: NotionSearchQuery): Promise>; useNotionListAllBlockChildren(blockId: string): Promise>; useNotionListAllDatabasePages(databaseId: string, filter?: NotionFilter, sorts?: NotionSort[]): Promise>; } /** Configuration for the WordPress REST API integration. */ export type WordPressConfig = z.infer; /** Authentication methods for WordPress. */ export type WordPressAuth = z.infer; /** Base fields shared by all WordPress entities. */ export type WpBaseEntity = z.infer; /** A WordPress post. */ export type WpPost = z.infer; /** Payload for creating a WordPress post. */ export type WpPostCreate = z.infer; /** Payload for updating a WordPress post. */ export type WpPostUpdate = z.infer; /** A WordPress page. */ export type WpPage = z.infer; /** Payload for creating a WordPress page. */ export type WpPageCreate = z.infer; /** Payload for updating a WordPress page. */ export type WpPageUpdate = z.infer; /** A WordPress media item (attachment). */ export type WpMedia = z.infer; /** Metadata for a media upload. */ export type WpMediaMeta = z.infer; /** Payload for updating a WordPress media item. */ export type WpMediaUpdate = z.infer; /** A WordPress category. */ export type WpCategory = z.infer; /** Payload for creating a WordPress category. */ export type WpCategoryCreate = z.infer; /** Payload for updating a WordPress category. */ export type WpCategoryUpdate = z.infer; /** A WordPress tag. */ export type WpTag = z.infer; /** Payload for creating a WordPress tag. */ export type WpTagCreate = z.infer; /** Payload for updating a WordPress tag. */ export type WpTagUpdate = z.infer; /** A WordPress comment. */ export type WpComment = z.infer; /** Payload for creating a WordPress comment. */ export type WpCommentCreate = z.infer; /** Payload for updating a WordPress comment. */ export type WpCommentUpdate = z.infer; /** A WordPress user. */ export type WpUser = z.infer; /** Payload for creating a WordPress user. */ export type WpUserCreate = z.infer; /** Payload for updating a WordPress user. */ export type WpUserUpdate = z.infer; /** * Common query parameters for WordPress REST API list endpoints. * * Includes field limiting (`_fields: "id,title,link"`) and resource * embedding (`_embed: true | "author,wp:featuredmedia"`). */ export type WpQueryParams = z.infer; /** * Container for ACF (Advanced Custom Fields) fields on a WordPress entity. * * ACF fields appear on posts, pages, media, taxonomies, users, and options. * Field names and types are defined by the site's ACF configuration. * * @example * ```ts * const post = await useWpGetPost(42, { _fields: "id,title,acf" }); * if (post.ok && post.data.acf) { * console.log(post.data.acf.hero_image); // image field * console.log(post.data.acf.subtitle); // text field * console.log(post.data.acf.gallery); // gallery field (array) * } * ``` */ export type WpAcfFields = z.infer; /** * Embedded resources returned by WordPress when `_embed` is used. * * Contains related entities: author, featured media, terms, replies. * Access with `post._embedded?.["wp:featuredmedia"]?.[0]`. * * @example * ```ts * const result = await useWpGetPosts({ _embed: "author,wp:featuredmedia" }); * if (result.ok) { * for (const post of result.data) { * const author = post._embedded?.author?.[0]?.name; * const image = post._embedded?.["wp:featuredmedia"]?.[0]?.source_url; * } * } * ``` */ export type WpEmbedded = z.infer; /** A batch operation for the WordPress REST API. */ export type WpBatchOperation = z.infer; /** Result of a WordPress batch operation. */ export type WpBatchResult = z.infer; /** Contract of the WordPress adapter facade. */ export interface IWordPressService { /** @deprecated Use `defineWordPressConfig`. */ useInitWordPress(config: WordPressConfig): void; useWpGetPosts(options?: WpQueryParams): Promise>; useWpGetPost(id: number, options?: WpQueryParams): Promise>; useWpCreatePost(data: WpPostCreate): Promise>; useWpUpdatePost(id: number, data: WpPostUpdate): Promise>; useWpDeletePost(id: number, force?: boolean): Promise>; useWpGetPages(options?: WpQueryParams): Promise>; useWpGetPage(id: number, options?: WpQueryParams): Promise>; useWpCreatePage(data: WpPageCreate): Promise>; useWpUpdatePage(id: number, data: WpPageUpdate): Promise>; useWpDeletePage(id: number, force?: boolean): Promise>; useWpGetMedia(options?: WpQueryParams): Promise>; useWpGetMediaItem(id: number): Promise>; useWpUploadMedia(file: File | Blob | Buffer, meta?: WpMediaMeta): Promise>; useWpUpdateMedia(id: number, data: WpMediaUpdate): Promise>; useWpDeleteMedia(id: number, force?: boolean): Promise>; useWpGetCategories(options?: WpQueryParams): Promise>; useWpGetCategory(id: number): Promise>; useWpCreateCategory(data: WpCategoryCreate): Promise>; useWpUpdateCategory(id: number, data: WpCategoryUpdate): Promise>; useWpDeleteCategory(id: number, force?: boolean): Promise>; useWpGetTags(options?: WpQueryParams): Promise>; useWpGetTag(id: number): Promise>; useWpCreateTag(data: WpTagCreate): Promise>; useWpUpdateTag(id: number, data: WpTagUpdate): Promise>; useWpDeleteTag(id: number, force?: boolean): Promise>; useWpGetComments(options?: WpQueryParams): Promise>; useWpGetComment(id: number): Promise>; useWpCreateComment(data: WpCommentCreate): Promise>; useWpUpdateComment(id: number, data: WpCommentUpdate): Promise>; useWpDeleteComment(id: number, force?: boolean): Promise>; useWpGetUsers(options?: WpQueryParams): Promise>; useWpGetUser(id: number): Promise>; useWpGetCurrentUser(): Promise>; useWpCreateUser(data: WpUserCreate): Promise>; useWpUpdateUser(id: number, data: WpUserUpdate): Promise>; useWpDeleteUser(id: number, reassign?: number): Promise>; useWpGetCustomPosts(postType: string, options?: WpQueryParams): Promise>; useWpGetCustomPost(postType: string, id: number, options?: WpQueryParams): Promise>; useWpCreateCustomPost(postType: string, data: Record): Promise>; useWpUpdateCustomPost(postType: string, id: number, data: Record): Promise>; useWpDeleteCustomPost(postType: string, id: number, force?: boolean): Promise>; useWpBatch(operations: WpBatchOperation[]): Promise>; useWpListAllPosts(options?: WpQueryParams): Promise>; useWpSearchAllPosts(query: string, options?: WpQueryParams): Promise>; useWpFindPostBySlug(slug: string): Promise>; } /** * Config for the InsForge adapter. InsForge is the database fallback * (primary data layer is Cloudflare); storage and edge functions * are also available through the same client. */ export type IfConfig = z.infer; /** Sort clause for table queries. */ export type IfOrder = z.infer; /** Options for a table read. Filters map to equality clauses. */ export type IfTableQuery = z.infer; /** Rows for insert (one or many). */ export type IfInsertRows = z.infer; /** Patch for update (must be paired with filters — mass updates are refused). */ export type IfUpdatePatch = z.infer; /** Options for an update or delete. Filters are REQUIRED (no mass writes). */ export type IfWriteQuery = z.infer; /** Postgres function (RPC) call. */ export type IfRpcCall = z.infer; /** Bucket + object key reference for storage operations. */ export type IfStorageRef = z.infer; /** Options for listing bucket objects. */ export type IfListOptions = z.infer; /** Edge function invocation. */ export type IfInvokeOptions = z.infer; /** Where a media source comes from. `file` = direct mp4/webm (native `