Exports entities and their data to JSON files.
Each entity is exported as a single file containing:
- The entity definition (schema)
- All data records for that entity (when data mirroring is enabled)
File Format
{
"export_version": "1.0",
"exported_at": "2025-12-11T10:30:00Z",
"definition": {
"name": "brand",
"display_name": "Brand",
...
},
"data": [
{"title": "Acme Corp", "slug": "acme-corp", ...},
{"title": "Globex", "slug": "globex", ...}
]
}
Summary
Functions
Exports all entities with their data (full export).
Exports all data for all entities.
Exports all entities (definitions only, no data).
Exports a single entity with its definition and optionally data.
Exports a single entity data record.
Serializes an entity struct to a map suitable for JSON export.
Serializes an entity data record to a map suitable for JSON export.
Functions
@spec export_all() :: {:ok, %{definitions: non_neg_integer(), data: non_neg_integer()}}
Exports all entities with their data (full export).
Returns definition count and data record count.
Exports all data for all entities.
Re-exports each entity file with its data included.
Exports all entities (definitions only, no data).
@spec export_entity(struct() | String.t()) :: {:ok, String.t(), :with_data | :definition_only} | {:error, term()}
Exports a single entity with its definition and optionally data.
Parameters
entity- Entity struct or entity name string
Returns
{:ok, file_path}on success{:error, reason}on failure
Exports a single entity data record.
This re-exports the entire entity file with updated data.
Serializes an entity struct to a map suitable for JSON export.
Serializes an entity data record to a map suitable for JSON export.