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.

52 lines (51 loc) 1.49 kB
import type { AppwriteConfig } from "appwrite-utils"; export interface JsonSchemaProperty { type: string | string[]; description?: string; format?: string; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; pattern?: string; enum?: any[]; items?: JsonSchemaProperty; $ref?: string; properties?: Record<string, JsonSchemaProperty>; additionalProperties?: boolean; required?: string[]; default?: any; oneOf?: JsonSchemaProperty[]; } export interface JsonSchema { $schema: string; $id: string; title: string; description?: string; type: "object"; properties: Record<string, JsonSchemaProperty>; required: string[]; additionalProperties: boolean; definitions?: Record<string, JsonSchemaProperty>; } export declare class JsonSchemaGenerator { private config; private appwriteFolderPath; private relationshipMap; constructor(config: AppwriteConfig, appwriteFolderPath: string); private extractRelationships; private attributeToJsonSchemaProperty; private getBaseTypeSchema; private createJsonSchema; generateJsonSchemas(options?: { outputFormat?: "json" | "typescript" | "both"; outputDirectory?: string; verbose?: boolean; }): void; private generateTypeScriptSchema; private generateIndexFile; validateSchema(schema: JsonSchema): { valid: boolean; errors: string[]; }; }