import { type Encodable } from "@automate.ax/codec"; import { SquareClient } from "square"; import * as z from "zod"; import { type DefinedAction } from "../../automation/actions.js"; import type { ResolvedIntegrationAccount } from "../../automation/integrations.js"; import type { Readable } from "node:stream"; type InputObject = Record; /** Codec-safe form of an official Square SDK type. */ export type SquareValue = unknown extends T ? Encodable : T extends readonly (infer TItem)[] ? SquareValue[] : T extends object ? { [TKey in keyof T]: SquareValue; } & { readonly [key: string]: Encodable; } : T extends Encodable ? T : never; /** Official Square request type accepted by an action. */ export type SquareInputValue = T extends unknown ? T extends Readable ? never : T extends Blob | File ? T : T extends readonly (infer TItem)[] ? SquareInputValue[] : T extends object ? { [TKey in keyof T]: SquareInputValue; } : T : never; /** Durable top-level request object for an official Square SDK input. */ export type SquareInputObject = { [TKey in keyof T]: SquareInputValue; } & InputObject; /** Portable public type for one Square-backed action definition. */ export type SquareDefinedAction = DefinedAction, z.ZodType>, "square">; /** * Preserves declaration emit on public Square SDK names. * * @param action - Fully built action with matching runtime schemas. */ export declare function squareAction(action: SquareDefinedAction): SquareDefinedAction; /** Normal or paginated result shape returned by official Square SDK methods. */ type SquareOperationResult = T | { hasNextPage(): boolean; response: T; }; /** * Defines one generated Square operation without repeating builder types. * * @param options - Validated operation metadata and SDK invocation. * @param options.allowedKeys - Accepted top-level request fields. * @param options.description - Public action description. * @param options.execute - Official SDK method binding. * @param options.name - Public action name. * @param options.replaySafety - Retry classification for ambiguous failures. * @param options.requiredKeys - Required top-level request fields. * @param options.scopes - Seller OAuth permissions required by the operation. */ export declare function defineSquareOperation(options: { allowedKeys: readonly string[]; description: string; execute: (api: SquareClient, input: SquareInputObject) => PromiseLike>; name: string; replaySafety: "safe" | "unsafe"; requiredKeys: readonly string[]; scopes: readonly string[]; }): SquareDefinedAction, TOutput>; /** * Creates an official Square client for one resolved seller account. * * @param account - Resolved account carrying an encrypted-at-rest access token. */ export declare function getSquareApi(account: ResolvedIntegrationAccount<"square">): SquareClient; /** * Runtime schema for one official Square SDK request object. * * @param options - Generated top-level request contract. * @param options.allowedKeys - Accepted request field names. * @param options.requiredKeys - Required request field names. */ export declare function squareInputSchema(options: { allowedKeys: readonly string[]; requiredKeys: readonly string[]; }): z.ZodType>; /** Runtime schema for an official Square response object. */ export declare function squareObjectSchema(): z.ZodType>; /** * Returns the provider response from a normal or paginated SDK result. * * @param value - Official SDK response or paginated response wrapper. */ export declare function fromSquare(value: T | { hasNextPage(): boolean; response: T; }): SquareValue; export {}; //# sourceMappingURL=lib.d.ts.map