import { type Encodable } from "@automate.ax/codec"; import { Client } from "@notionhq/client"; import type { DistributedOmit, ExclusifyUnion, KeysOfUnion } from "type-fest"; import * as z from "zod"; import type { DefinedAction } from "../../automation/actions.js"; import type { ActionAccountConnectionRequirements, IntegrationScopeRequirement, ResolvedIntegrationAccount } from "../../automation/integrations.js"; /** Notion API version implemented by this integration. */ export declare const NOTION_API_VERSION = "2026-03-11"; type InputObject = Record; type NotionMethod = (...args: never[]) => Promise; type NotionMethodParameters = NonNullable[0]>; /** Provider request union after removing integration-owned fields. */ type NotionInputVariants, "auth">>> = DistributedOmit, "auth" | TExcluded>; /** Codec-safe public output for an official Notion SDK response. */ export type NotionValue = T extends readonly (infer TItem)[] ? NotionValue[] : T extends { type: "transcription"; } ? never : T extends { archived: unknown; in_trash: unknown; } ? { [TKey in Exclude]: NotionValue; } : T extends object ? { [TKey in keyof T]: NotionValue; } : T extends Encodable ? T : never; /** * Input accepted by a Notion SDK method, without its per-request auth escape * hatch. */ export type NotionInput, "auth">> = never> = Extract>, InputObject>; /** Output returned by a Notion SDK method. */ export type NotionOutput = Awaited>; /** Portable public type for a Notion-backed action definition. */ export type NotionDefinedAction, "auth">> = never, TOutput extends object = NotionOutput> = DefinedAction, NotionInput>, z.ZodType>, "notion">; /** Runtime contract for one current official Notion response family. */ export interface NotionOutputContract { item?: NotionListItemContract; listType?: string | readonly string[]; object?: string | readonly string[]; requiredKeys: readonly string[]; variants?: readonly NotionOutputVariant[]; } /** Runtime contract for one result in a Notion list response. */ export interface NotionListItemContract { object?: string | readonly string[]; requiredKeys: readonly string[]; } /** Required response fields for one object discriminator. */ export interface NotionOutputVariant { object: string; requiredKeys: readonly string[]; } /** Response contracts shared by Notion actions. */ export declare const notionOutput: { readonly entity: (object: string | readonly string[], requiredKeys?: readonly string[]) => NotionOutputContract; readonly fields: (...requiredKeys: string[]) => NotionOutputContract; readonly list: (listType?: string | readonly string[], item?: NotionListItemContract) => NotionOutputContract; readonly oneOf: (...variants: readonly NotionOutputVariant[]) => NotionOutputContract; }; /** Account requirements shared by Notion actions. */ export declare const notionAccount: { readonly agents: ActionAccountConnectionRequirements; readonly createView: ActionAccountConnectionRequirements; readonly createMeetingNote: ActionAccountConnectionRequirements; readonly authenticated: { readonly connections: readonly [{ connectionMethodId: "oauth"; requiredScope?: IntegrationScopeRequirement; }, { readonly connectionMethodId: "personal-access-token"; readonly requiredScope: "notion_api"; }]; }; readonly insertComments: ActionAccountConnectionRequirements; readonly insertContent: ActionAccountConnectionRequirements; readonly readComments: ActionAccountConnectionRequirements; readonly readContent: ActionAccountConnectionRequirements; readonly updateContent: ActionAccountConnectionRequirements; readonly userInfo: ActionAccountConnectionRequirements; readonly usersList: { readonly connections: readonly [{ connectionMethodId: "oauth"; requiredScope?: IntegrationScopeRequirement; }]; }; }; /** * Creates the official authenticated Notion client at the supported API * version. * * @param account - Resolved Notion integration account. * @throws {Error} When the connection method or credential shape is invalid. */ export declare function getNotionApi(account: ResolvedIntegrationAccount<"notion">): Client; /** * Runtime schema for a JSON response returned by the official Notion client. * * @param contract - Required fields and discriminators for the endpoint. */ export declare function notionOutputSchema(contract: NotionOutputContract): z.ZodType>; /** * Runtime schema for an official Notion request. * * The SDK supplies the exact compile-time union while this schema enforces the * provider's cross-endpoint limits and rejects fields outside the current API. * * @param allowedKeys - Current top-level request fields accepted by the * endpoint. * @param requiredKeys - Top-level fields required before calling the provider. * @param refine - Optional endpoint-specific invariant validation. * @param inputSchema - Optional endpoint-specific request schema. */ export declare function notionInputSchema(allowedKeys: readonly (KeysOfUnion & string)[], requiredKeys?: readonly (KeysOfUnion & string)[], refine?: (input: T) => boolean, inputSchema?: z.ZodType): z.ZodType; /** * Defines one fully typed Notion action backed by an official client method. * * @param options - Action metadata, authorization, request fields, and handler. * @param options.account - Supported connection methods and required * capabilities. * @param options.allowedKeys - Current top-level provider request fields. * @param options.call - Official SDK method invocation. * @param options.description - Public action description. * @param options.inputSchema - Endpoint-specific runtime request validation. * @param options.name - Public action name. * @param options.output - Current provider response contract. * @param options.replaySafety - Whether an interrupted provider call can be * replayed without duplicating a side effect. * @param options.refine - Optional endpoint-specific runtime validation. * @param options.requiredKeys - Required top-level provider request fields. */ export declare function notionAction, "auth">> = never, TOutput extends object = NotionOutput>(options: { account: ActionAccountConnectionRequirements; allowedKeys: readonly (KeysOfUnion> & string)[]; call: (client: Client, input: NotionInput) => Promise; description: string; inputSchema?: z.ZodType; name: string; output: NotionOutputContract; replaySafety: "safe" | "unsafe"; refine?: (input: NotionInput) => boolean; requiredKeys?: readonly (KeysOfUnion> & string)[]; }): NotionDefinedAction; export {}; //# sourceMappingURL=lib.d.ts.map