@echelon-framework/designer-core
v0.7.1
Published
Graph model + exporters for the Echelon visual process designer (read-only MVP).
Downloads
1,479
Maintainers
Readme
@echelon-framework/designer-core
Core stores, schema types, validation, and utilities for Echelon visual designers.
Installation
npm install @echelon-framework/designer-coreDraft Stores (5)
All stores: Angular Injectable, signal-based, localStorage persistence.
import {
DraftModelStoreService, // Models (fields, relations, serverManaged)
DraftFormStoreService, // Forms (fields, inputContracts, emits, outputModel)
DraftDatasourceStoreService, // DataSources (kind, contract, mockConfig)
DraftPageStoreService, // Pages (config, route, layout)
DraftTranslationStoreService, // Translations (keys, languages)
} from '@echelon-framework/designer-core';Model Store
const store = inject(DraftModelStoreService);
store.upsert({
id: 'Client',
title: 'Klient',
fields: [
{ id: 'name', type: 'string', required: true },
{ id: 'accounts', type: 'array', ref: { modelId: 'Account', kind: '1:N' } },
{ id: 'createdAt', type: 'date', serverManaged: true },
],
});
store.toSchema('Client'); // → { name: { type: 'string', required: true }, ... }Form Store
const store = inject(DraftFormStoreService);
store.upsert({
id: 'new-client', title: 'New Client',
intent: 'create', // create | edit | view | filter | patch
outputModel: 'Client', // produces Client
registerAsDatasource: true, // visible in DS Designer as kind:'form'
inputContracts: [...], // typed requires with schema
emits: [{ event: 'client.created' }],
fields: [{ id: 'name', type: 'text', required: true, width: 6 }],
});Schema Types
import {
type Schema,
type SchemaProperty,
type PropertyType,
type DatasourceContract,
type DataContextBinding,
type DatasourceParamBinding,
type PaginatedEnvelope,
validateSchemaCompatibility,
validateSnapshotAgainstSchema,
} from '@echelon-framework/designer-core';
// Validate DS output covers Form input
const errors = validateSchemaCompatibility(formSchema, dsOutputSchema);FormIntent + resolveFieldBehavior
import { resolveFieldBehavior } from '@echelon-framework/designer-core';
const behavior = resolveFieldBehavior(
{ required: true, primaryKey: true, serverManaged: true }, // model field
'create', // intent
);
// → { include: false, required: false, readOnly: false }
// PK + serverManaged excluded on create intent11 Utility Wrappers
| Lib | Import | Key functions |
| ---------------- | ---------------- | ---------------------------------------- |
| zod | validation.ts | validateModel(), ModelFieldSchema |
| immer | state.ts | updateState(state, draft => ...) |
| nanoid | id.ts | generateModelId(), generateFormId() |
| date-fns | dates.ts | formatDate(), formatRelative() |
| idb-keyval | storage.ts | idb.get/set/remove() (IndexedDB) |
| hotkeys-js | keyboard.ts | registerShortcuts() |
| pako | compression.ts | compressGzip() |
| lz-string | compression.ts | compressForStorage() |
| papaparse | csv.ts | parseCsv(), toCsv(), downloadCsv() |
| diff-match-patch | diff.ts | computeJsonDiff(), applyTextPatch() |
License
BUSL-1.1
