import { StateDefinition as BotStateDefinition, EventDefinition as BotEventDefinition, ConfigurationDefinition as BotConfigurationDefinition, UserDefinition, ConversationDefinition, MessageDefinition, ActionDefinition as BotActionDefinition, TableDefinition as BotTableDefinition, WorkflowDefinition } from '../bot/definition'; import { SchemaTransformOptions } from '../common/types'; import { IntegrationPackage, InterfacePackage } from '../package'; import * as typeUtils from '../utils/type-utils'; import { z } from '../zui'; export { UserDefinition, ConversationDefinition, MessageDefinition, WorkflowDefinition } from '../bot/definition'; type BaseConfig = z.ZuiObjectOrRefSchema; type BaseStates = Record; type BaseEvents = Record; type BaseActions = Record; type BaseInterfaces = Record; type BaseIntegrations = Record; type BaseTables = Record; type BaseWorkflows = Record; export type TableDefinition = typeUtils.Merge; export type ConfigurationDefinition = typeUtils.Merge; export type StateDefinition = typeUtils.Merge; export type EventDefinition = typeUtils.Merge; export type ActionDefinition = typeUtils.Merge; export type RecurringEventDefinition = { [K in keyof TEvents]: { type: K; payload: z.infer; schedule: { cron: string; }; }; }[keyof TEvents]; export type ZuiSchemaWithEntityReferences = ((props: { entities: { [TInterfaceAlias in keyof TInterfaces]: { [TEntityName in keyof TInterfaces[TInterfaceAlias]['definition']['entities']]: z.ZodRef; }; }; }) => TReturnType) | TReturnType; type GenericDefinition = typeUtils.Merge; }>; type GenericNestedDefinition = Omit & { [TKey in TKeys]: Omit & { schema: ZuiSchemaWithEntityReferences; }; }; export type PluginDefinitionProps = { name: TName; version: TVersion; title?: string; description?: string; icon?: string; readme?: string; attributes?: Record; integrations?: TIntegrations; interfaces?: TInterfaces; user?: UserDefinition; conversation?: ConversationDefinition; message?: MessageDefinition; states?: { [K in keyof TStates]: GenericDefinition>; }; configuration?: GenericDefinition>; events?: { [K in keyof TEvents]: GenericDefinition>; }; recurringEvents?: Record>; actions?: { [K in keyof TActions]: GenericNestedDefinition, 'input' | 'output'>; }; tables?: { [K in keyof TTables]: GenericDefinition>; }; /** * # EXPERIMENTAL * This API is experimental and may change in the future. */ workflows?: { [K in keyof TWorkflows]: WorkflowDefinition; }; __advanced?: SchemaTransformOptions; }; export declare class PluginDefinition { readonly props: PluginDefinitionProps; readonly name: this['props']['name']; readonly version: this['props']['version']; readonly title: this['props']['title']; readonly description: this['props']['description']; readonly icon: this['props']['icon']; readonly readme: this['props']['readme']; readonly attributes: this['props']['attributes']; readonly integrations: this['props']['integrations']; readonly interfaces: this['props']['interfaces']; readonly user: this['props']['user']; readonly conversation: this['props']['conversation']; readonly message: this['props']['message']; readonly states: { [K in keyof TStates]: StateDefinition; }; readonly configuration?: ConfigurationDefinition; readonly events: { [K in keyof TEvents]: EventDefinition; }; readonly recurringEvents: this['props']['recurringEvents']; readonly actions: { [K in keyof TActions]: ActionDefinition; }; readonly tables: { [K in keyof TTables]: TableDefinition; }; readonly workflows: this['props']['workflows']; readonly __advanced: this['props']['__advanced']; constructor(props: PluginDefinitionProps); get metadata(): { readonly sdkVersion: string; }; /** * Returns a copy of the plugin definition where all entity references are * resolved to the base entity schema defined by the interface. This does not * include any additional properties that may be added to the entity by the * backing integration. * * If `intersectWithUnknownRecord` is `true` (default), the entity schemas * will be intersected with `z.record(z.string(), z.unknown())` to make it * explicit that the backing integration may have added additional properties. */ dereferenceEntities({ intersectWithUnknownRecord }?: { intersectWithUnknownRecord?: boolean; }): this; private _buildZuiReferenceMap; private _dereferenceZuiSchema; private _dereferenceDefinitionSchemas; private _dereferenceActionDefinitionSchemas; }