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.

71 lines (70 loc) 2.37 kB
import { type YamlCollectionData, type YamlTerminologyConfig } from "./yamlConverter.js"; import { type CollectionCreate } from "appwrite-utils"; /** * Enhanced YAML loader with dual terminology support */ export declare class YamlLoader { private baseDirectory; constructor(baseDirectory: string); /** * Loads a YAML file with automatic terminology detection and normalization */ loadCollectionYaml(filePath: string): Promise<{ data: YamlCollectionData; originalTerminology: 'collection' | 'table'; normalized: YamlCollectionData; }>; /** * Loads multiple YAML files from a directory with terminology support */ loadDirectoryYamls(directoryPath: string, targetTerminology?: 'collection' | 'table'): Promise<{ collections: Array<{ filePath: string; data: YamlCollectionData; originalTerminology: 'collection' | 'table'; converted?: YamlCollectionData; }>; summary: { total: number; collectionFormat: number; tableFormat: number; converted: number; }; }>; /** * Converts YAML data to CollectionCreate format for internal use */ yamlToCollectionCreate(yamlData: YamlCollectionData): CollectionCreate; /** * Saves YAML data with specified terminology */ saveCollectionYaml(filePath: string, data: YamlCollectionData, config: YamlTerminologyConfig): Promise<void>; /** * Migrates YAML files from one terminology to another */ migrateTerminology(sourceDirectory: string, targetDirectory: string, toTableTerminology: boolean): Promise<{ migrated: number; skipped: number; errors: string[]; }>; /** * Validates YAML files for terminology consistency */ validateTerminologyConsistency(directoryPath: string): Promise<{ isConsistent: boolean; issues: Array<{ file: string; issue: string; severity: 'warning' | 'error'; }>; summary: { collectionFiles: number; tableFiles: number; mixedFiles: number; }; }>; } /** * Creates a YAML loader instance for the given base directory */ export declare function createYamlLoader(baseDirectory: string): YamlLoader;