@echelon-framework/model
v0.7.1
Published
Echelon model — domain model decorators (@Model/@Field/@Id/@Required/...) z field-level metadata czytaną w runtime.
Readme
@echelon-framework/model
Domain model decorators for Echelon framework — @Model, @Aggregate with field-level metadata.
Part of the Echelon Framework — Angular-based, config-driven dashboard & low-code platform.
Installation
npm install @echelon-framework/model@Model decorator
import { Model, Field, PrimaryKey, Required, Relation } from '@echelon-framework/model';
@Model({ id: 'Client', title: 'Klient' })
export class Client {
@PrimaryKey()
@Required()
code!: string;
@Required()
name!: string;
@Field({ type: 'string', enumValues: ['corporate', 'individual'] })
type!: string;
@Relation({ target: 'Account', kind: '1:N' })
accounts!: Account[];
}@Aggregate decorator
import { Aggregate } from '@echelon-framework/model';
@Aggregate({
root: 'Client',
sources: ['clientBasic', 'clientMargins', 'clientAccounts'],
})
export class ClientFullView {
// Aggregate expansion generates datasources + event handlers
// for chained loading of related data
}Usage with PageBuilder
import { expandAggregate } from '@echelon-framework/model';
const agg = expandAggregate(ClientFullView);
// → { datasources, eventHandlers, rootSources, targetDsId }
PageBuilder.create('client-profile')
.aggregate(agg) // registers all DS + handlers
.widget('data', widget.any('data-table', { bind: { rows: agg.targetDsId } }))
.build();License
BUSL-1.1
