/** * EventRecord is the type for the event data that is passed to the handler function. */ export interface EventRecord { /** API version */ api_version: string; /** Event content containing the actual data */ content: Record; /** Type of the event (e.g., 'customer_created', 'subscription_created') */ event_type: string; /** Unique identifier for the event */ id: string; /** Object type */ object: string; /** Timestamp when the event occurred */ occurred_at: number; /** Source of the event */ source: string; /** Webhook status */ webhook_status: string; /** Array of webhook configurations */ webhooks: Array<{ id: string; object: string; webhook_status: string; }>; } export interface AllowedModule { name: string; version?: string; description?: string; type: 'internal' | 'public'; } export interface Manifest { events: Record; dependencies?: Record; } /** * Create options for create command */ export interface CreateOptions { template: string; } /** * Run options for run command */ export interface RunOptions { port: string; } /** * Package options for package command */ export interface PackageOptions { name: string; } /** * Map of iparam `type` identifiers to placeholder values. * Keys match valid `type` values in `iparams.json`; each value’s TypeScript type is the allowed * JSON shape for that type in definition defaults and `iparams.local.json`. */ export const IPARAM_TYPE_VALUE_MAP = { NUMBER: 0 as number, TEXT: '' as string, DROPDOWN: '' as string, MULTISELECT_DROPDOWN: [] as string[], DATE: '' as string, URL: '' as string, BOOLEAN: false as boolean, SECRET: '' as string }; /** Parameter type (keys of {@link IPARAM_TYPE_VALUE_MAP}) */ export type IparamType = keyof typeof IPARAM_TYPE_VALUE_MAP; /** Per-type value type; derived from {@link IPARAM_TYPE_VALUE_MAP} */ export type IparamValueByType = { [K in IparamType]: (typeof IPARAM_TYPE_VALUE_MAP)[K]; }; /** Valid `type` strings for runtime checks. */ export const VALID_IPARAM_TYPES = Object.keys( IPARAM_TYPE_VALUE_MAP ) as IparamType[]; /** Union of every value an iparam can hold. */ export type IparamValue = IparamValueByType[IparamType]; /** Single parameter entry inside a section in `iparams.json`. */ export interface IparamDefn { name: string; display_name: string; description: string; type: IparamType; required?: boolean; default?: IparamValue; options?: string[]; } /** Group of related parameters in `iparams.json`. */ export interface IparamSection { name: string; display_name: string; description: string; parameters: IparamDefn[]; } /** Parameter values for a single section in `iparams.local.json`. */ export interface SectionObject { [key: string]: IparamValue; } /** * Root schema for `iparams.json`. * An empty object means no installation parameters are defined. * Parameter names are unique within a section and may repeat across sections. */ export interface IparamDefns { installation_parameters?: { sections: IparamSection[]; }; } /** * Root values for `iparams.local.json`, keyed by section name. * Access in handlers: `payload.iparams..`. */ export interface IparamInputs { [sectionName: string]: SectionObject; } /** SNS payload version */ export type PayloadVersion = 'v1' | 'v2'; /** * Single argument passed to event handlers. * Handlers receive payload with event data and installation parameters. */ export interface HandlerPayload { /** The webhook event record */ event: EventRecord; /** * Installation parameter values. * Present for templates/apps that define iparams; omitted for templates without iparams. */ iparams?: IparamInputs; }