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.

59 lines (58 loc) 2.07 kB
import { type ApiMode } from "./utils/versionDetection.js"; /** * Terminology configuration for API mode-specific naming */ interface TerminologyConfig { container: "table" | "collection"; containerName: "Table" | "Collection"; fields: "columns" | "attributes"; fieldName: "Column" | "Attribute"; security: "rowSecurity" | "documentSecurity"; schemaRef: "table.schema.json" | "collection.schema.json"; items: "rows" | "documents"; } /** * Detection result with source information */ interface ApiModeDetectionResult { apiMode: ApiMode; useTables: boolean; detectionSource: "appwrite.json" | "server-version" | "default"; serverVersion?: string; } /** * Get terminology configuration based on API mode */ export declare function getTerminologyConfig(useTables: boolean): TerminologyConfig; /** * Detect API mode using multiple detection sources * Priority: appwrite.json > server version > default (collections) */ export declare function detectApiMode(basePath: string): Promise<ApiModeDetectionResult>; /** * Create directory structure for Appwrite project */ export declare function createProjectDirectories(basePath: string, useTables: boolean): { appwriteFolder: string; containerFolder: string; schemaFolder: string; yamlSchemaFolder: string; dataFolder: string; }; /** * Create example YAML schema file with correct terminology */ export declare function createExampleSchema(containerFolder: string, terminology: TerminologyConfig): string; /** * Create JSON schema for YAML validation */ export declare function createYamlValidationSchema(yamlSchemaFolder: string, useTables: boolean): string; /** * Initialize a new Appwrite project with correct directory structure and terminology */ export declare function initProject(basePath?: string, forceApiMode?: 'legacy' | 'tablesdb'): Promise<void>; /** * Create a new collection or table schema file */ export declare function createSchema(name: string, basePath?: string, forceApiMode?: 'legacy' | 'tablesdb'): Promise<void>; export {};