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.
49 lines (48 loc) • 1.37 kB
TypeScript
import type { Collection, CollectionCreate } from "appwrite-utils";
export interface YamlCollectionData {
name: string;
id?: string;
documentSecurity?: boolean;
enabled?: boolean;
permissions?: Array<{
permission: string;
target: string;
}>;
attributes?: Array<{
key: string;
type: string;
size?: number;
required?: boolean;
array?: boolean;
default?: any;
description?: string;
min?: number;
max?: number;
elements?: string[];
relatedCollection?: string;
relationType?: string;
twoWay?: boolean;
twoWayKey?: string;
onDelete?: string;
side?: string;
}>;
indexes?: Array<{
key: string;
type: string;
attributes: string[];
orders?: string[];
}>;
importDefs?: any[];
}
/**
* Converts a Collection object to YAML format with proper schema reference
*/
export declare function collectionToYaml(collection: Collection | CollectionCreate, schemaPath?: string): string;
/**
* Sanitizes a collection name for use as a filename
*/
export declare function sanitizeFilename(name: string): string;
/**
* Generates the filename for a collection YAML file
*/
export declare function getCollectionYamlFilename(collection: Collection | CollectionCreate): string;