@antelopejs/interface-dms-builder
The AntelopeJS interface that edits the pages, blocks, resources and queries of a DMS project from code.
What it does
- Creates and edits pages, categories and their block trees with operations such as
CreatePage,AddBlock,ConfigureBlock,MoveBlockandSetPageBlocks. - Generates resources, each a
Table, aDataControllerand a model, and edits their fields. - Compiles query templates into a model method and a page route, so a card gets a number without hand-written code.
- Reports every block type and DataType the builder can write, with a schema for its options (
GetCatalog). - Returns every mutation as an
OpResult. It holds the files changed on success, and a typed error otherwise.
Every operation is an InterfaceFunction routed to @antelopejs/dms-builder. That module parses the project, applies the edit as an AST rewrite, and writes only if the project still typechecks.
Install
Add the interface to the module that calls the builder.
pnpm add @antelopejs/interface-dms-builder
Quick start
The following code creates a page and puts a KPI card on it.
import { AddBlock, CreatePage } from "@antelopejs/interface-dms-builder";
const page = await CreatePage({
name: "revenue",
displayName: "Revenue",
category: "pages",
icon: "i-ph-chart-line",
});
if (!page.ok) {
throw new Error(`could not create the page: ${page.error.code}`);
}
const block = await AddBlock({
page: page.data.ref,
name: "total",
type: "KpiCard",
config: { title: "Total revenue", icon: "i-ph-currency-eur" },
});
if (!block.ok) {
throw new Error(`could not add the block: ${block.error.code}`);
}
Compatibility
The interface declares this peer dependency:
| Package | Supported | Tested with |
|---|---|---|
@antelopejs/interface-core | >=0.2.4 <1.0.0 | 0.4.0 |
The @antelopejs/dms-builder module implements this interface. The @antelopejs/interface-dms-builder row in the compatibility block of the module README gives the interface range each module release implements. The implementation is not a peer dependency of the interface package. It runs in development only, unless its api.enabled option turns it on.
Documentation
- Extending the builder covers the interface and the HTTP API.
- Interface reference is the canonical contract. It ships with this package and is published at /docs/modules/builder/reference.
- A chart without code follows one chart from the choice of a measure to the reopened page.
Contributing
This package lives in the AntelopeJS/dms-builder pnpm workspace, next to the module that implements it. Read CONTRIBUTING.md and the repository README for the development commands. Release this package before the module that implements it.