UNPKG

appwrite-utils-cli

Version:

Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.

94 lines (93 loc) 3.74 kB
import type { CollectionCreate, ImportDef } from "appwrite-utils"; /** * Integration service that bridges YAML import configurations with the existing import system. * Provides seamless integration between new YAML configs and legacy TypeScript collection definitions. */ export declare class YamlImportIntegration { private configLoader; private appwriteFolderPath; constructor(appwriteFolderPath: string); /** * Initializes the YAML import system. * Creates necessary directories, schemas, and example files. */ initialize(): Promise<void>; /** * Merges YAML import configurations with existing collection definitions. * Allows collections to have both TypeScript and YAML import definitions. * * @param collections - Existing collection configurations * @returns Collections with merged import definitions */ mergeWithCollections(collections: CollectionCreate[]): Promise<CollectionCreate[]>; /** * Validates YAML import configurations against existing collection schemas. * Ensures that all target fields exist in the collection definitions. * * @param collections - Collection definitions to validate against * @returns Validation results with errors and warnings */ validateConfigurations(collections: CollectionCreate[]): Promise<{ isValid: boolean; errors: string[]; warnings: string[]; }>; /** * Validates that source files exist for import configurations. */ private validateSourceFiles; /** * Validates that converter functions are available. */ private validateConverters; /** * Generates a YAML import configuration from an existing ImportDef. * Useful for migrating TypeScript configurations to YAML. * Supports both collection and table terminology. * * @param importDef - Existing ImportDef to convert * @param collectionName - Name of the collection * @param useTableTerminology - Whether to use table terminology * @returns YAML configuration string */ convertImportDefToYaml(importDef: ImportDef, collectionName: string, useTableTerminology?: boolean): string; /** * Exports existing TypeScript import configurations to YAML files. * Helps migrate from TypeScript to YAML-based configurations. * Supports both collection and table terminology. * * @param collections - Collections with existing import definitions * @param useTableTerminology - Whether to use table terminology */ exportToYaml(collections: CollectionCreate[], useTableTerminology?: boolean): Promise<void>; /** * Gets statistics about YAML import configurations. */ getStatistics(): Promise<{ hasYamlConfigs: boolean; totalConfigurations: number; collectionsWithConfigs: number; configurationsByType: { [type: string]: number; }; totalAttributeMappings: number; totalRelationshipMappings: number; }>; /** * Creates a new YAML import configuration from a template. * Supports both collection and table terminology. * * @param collectionName - Name of the collection * @param sourceFile - Source data file name * @param useTableTerminology - Whether to use table terminology * @param outputPath - Output file path (optional) */ createFromTemplate(collectionName: string, sourceFile: string, useTableTerminology?: boolean, outputPath?: string): Promise<string>; /** * Checks if YAML import system is properly set up. */ isSetupComplete(): Promise<{ isComplete: boolean; missingComponents: string[]; }>; }