/** * Type definitions for Extend's JSON Schema format. */ import { z } from "zod"; /** * Marker symbol to identify Extend schema wrappers. */ export declare const EXTEND_SCHEMA_MARKER: unique symbol; /** * Wrapper that holds both the Zod schema (for TypeScript inference) * and the converted Extend JSON Schema (for the API). */ export interface ExtendSchemaWrapper { [EXTEND_SCHEMA_MARKER]: true; /** The original Zod schema for type inference */ _zodSchema: z.ZodObject; /** The converted JSON Schema for the Extend API */ jsonSchema: ExtendRootJSONSchema; /** Inferred TypeScript type (phantom type for inference) */ _output: z.infer>; } /** * Extract the output type from an ExtendSchemaWrapper. */ export type InferExtendSchema = T extends ExtendSchemaWrapper ? z.infer> : never; export type ExtendRootJSONSchema = { type: "object"; properties: Record; required: string[]; additionalProperties?: boolean; }; type BaseJSONSchema = { "extend:name"?: string; description?: string; }; export type ExtendEnumJSONSchema = BaseJSONSchema & { enum: (string | null)[]; "extend:descriptions"?: string[]; }; export type ExtendStringJSONSchema = BaseJSONSchema & { type: ["string", "null"]; "extend:type"?: "date"; }; export type ExtendNumberJSONSchema = BaseJSONSchema & { type: ["number", "null"]; }; export type ExtendIntegerJSONSchema = BaseJSONSchema & { type: ["integer", "null"]; }; export type ExtendBooleanJSONSchema = BaseJSONSchema & { type: ["boolean", "null"]; }; export type ExtendArrayJSONSchema = BaseJSONSchema & { type: "array"; items: ExtendObjectJSONSchema | { type: "string"; "extend:type"?: "date"; } | { type: "number"; } | { type: "integer"; } | { type: "boolean"; }; }; export type ExtendObjectJSONSchema = BaseJSONSchema & { type: "object"; "extend:type"?: "currency" | "signature"; properties: Record; required: string[]; additionalProperties?: boolean; }; export type ExtendJSONSchema = ExtendEnumJSONSchema | ExtendStringJSONSchema | ExtendNumberJSONSchema | ExtendIntegerJSONSchema | ExtendBooleanJSONSchema | ExtendArrayJSONSchema | ExtendObjectJSONSchema; /** * Marker for date fields that will use extend:type: "date" */ export declare const DATE_TYPE_MARKER: unique symbol; /** * Marker for currency fields that will use extend:type: "currency" */ export declare const CURRENCY_TYPE_MARKER: unique symbol; /** * Marker for signature fields that will use extend:type: "signature" */ export declare const SIGNATURE_TYPE_MARKER: unique symbol; /** * Currency output type */ export type CurrencyValue = { amount: number | null; iso_4217_currency_code: string | null; }; /** * Signature output type */ export type SignatureValue = { printed_name: string | null; signature_date: string | null; is_signed: boolean | null; title_or_role: string | null; }; export {};