UNPKG

@fibery/ai-utils

Version:

Utilities for Fibery AI

103 lines (102 loc) 2.54 kB
import { Schema, TypeObject } from '@fibery/schema'; export type FormulaField = { expression?: any; params?: Record<string, any>; [key: string]: any; }; export type ProcessedField = { type: string; formulaText?: string; values?: string[]; defaultValue?: string | null; }; export type ProcessedType = { color: string; fields: Record<string, ProcessedField>; description: string; }; export type ProcessedTypes = { [typeName: string]: ProcessedType; }; export type EnumValues = { values: string[]; defaultValue: unknown | null; }; export type Enums = Record<string, EnumValues>; export type EnumFetcher = (enumsTypeObjects: TypeObject[]) => Promise<Record<string, { id: string; name: string; rank: string; color: string; isFinal?: boolean; type?: string; }[]>>; export type TemplateField = { name: string; type: string | ProcessedField; isManyToMany?: boolean; values?: string[] | null; formulaText?: string; defaultValue?: string | null; }; export type TemplateType = { name: string; description: string; fields: TemplateField[]; }; export type TemplateData = { schema: ProcessedTypes; types: TemplateType[]; compact?: boolean; nonExistentTypes?: string[]; }; export type ProcessSchemaParams = { typeObjects: TypeObject[]; compact?: boolean; fetchEnums?: EnumFetcher; }; export type GetSchemaStringParams = { typeObjects: TypeObject[]; schema: Schema; nonExistentTypes?: string[]; compact?: boolean; fetchEnums?: EnumFetcher; }; export type EnumCommand = { command: string; args: unknown; }; export type ExecuteCommandsFn = (commands: EnumCommand[]) => Promise<Array<{ success: boolean; result: Array<{ id: string; name: string; rank: string; color: string; icon: string; isFinal?: boolean; type?: string; }>; }>>; export type EnumValuesMap = Record<string, Array<{ id: string; name: string; rank: string; color: string; icon: string; isFinal?: boolean; type?: string; }>>; export type ProcessedFieldJson = { 'fibery/type': string; 'fibery/meta'?: Record<string, any>; }; export type ProcessedTypeJson = { 'fibery/description': string; 'fibery/fields': Record<string, ProcessedFieldJson>; 'fibery/values'?: Array<{ 'fibery/id': string; 'enum/name': string; }>; }; export type ProcessedSchemaJson = Record<string, ProcessedTypeJson>;