codegen library

Typed records from a schema snapshot, behind dart run vaultbase:types. Not part of package:vaultbase/vaultbase.dart, so apps don't ship it.

Functions

codegenHeader(String command) → String
The do-not-edit banner, naming the command that regenerates the file.
generateDart(List<Map<String, dynamic>> collections, {String header = '// AUTO-GENERATED by `dart run vaultbase:types`. ' 'Do not edit.\n'}) → String
Dart source for the collections of a schema snapshot: per collection a XRecord extends RecordModel with a getter per field, an XCreate (base and auth collections) with toJson(), and vb.collections.<name>.
snapshotCollections(Object? json) → List<Map<String, dynamic>>
The collections of a schema snapshot (GET /api/v1/admin/migrations/snapshot): a [...] list, {collections: [...]}, or either inside the {data: ...} envelope.