declare var __dirname; namespace _sindri { /** */ export type type_input = { domains : Array< { name : string; description : (null | string); key_field : ( null | { name : string; description ?: (null | string); } ); data_fields : Array< { name : string; description : (null | string); type : ("boolean" | "integer" | "float" | "string_short" | "string_medium" | "string_long"); nullable : boolean; default : (null | boolean | int | float | string); } >; constraints ?: Array< { kind : ("unique" | "foreign_key"); parameters : Record; } >; } >; }; /** */ export type type_output = { render : ((input_data : type_input) => Promise); }; /** */ export enum enum_realm { database = "database", backend = "backend", frontend = "frontend", other = "other", } /** */ var _outputs : Record> = { [enum_realm.database]: {}, [enum_realm.backend]: {}, [enum_realm.frontend]: {}, [enum_realm.other]: {}, }; /** */ export function add_output( realm : enum_realm, implementation : string, output : _sindri.type_output ) : void { _outputs[realm][implementation] = output; } /** */ export function get_output( realm : enum_realm, implementation : string ) : _sindri.type_output { return _outputs[realm][implementation]; } /** */ export function list_outputs( ) : Array<{realm : enum_realm; implementation : string;}> { return ( Object.entries(_outputs) .map( ([realm, group]) => ( Object.keys(group) .map( implementation => ({"realm": (realm as enum_realm), "implementation": implementation}) ) ) ) .reduce( (x, y) => x.concat(y), [] ) ); } /** */ export function get_template( realm : enum_realm, implementation : string, name : string ) : Promise { return lib_plankton.file.read( [__dirname, "templates", realm, implementation, name].join("/") ); } }