@echelon-framework/core
v0.7.1
Published
Echelon core — kontrakty, tokeny DI, typy i JSON Schema. Zero zależności runtime.
Downloads
176
Maintainers
Readme
@echelon-framework/core
Core types, interfaces, and contracts for the Echelon framework — Angular-based, config-driven dashboard & low-code platform.
Installation
npm install @echelon-framework/coreWhat's inside
DataBus — reactive data layer
import type { DataBus, DataSource, DataSnapshot } from '@echelon-framework/core';
// DataSource — reactive stream per datasource ID
interface DataSource<T> {
readonly id: DatasourceId;
readonly value$: Observable<DataSnapshot<T>>;
refresh(): void;
snapshot(): DataSnapshot<T>;
}
// DataBus — singleton registry of all datasources
interface DataBus {
source<T>(id: DatasourceId): DataSource<T>;
invalidate(id?: DatasourceId): void;
}EventBus — pub/sub event layer
import type { EventBus, EchelonEvent } from '@echelon-framework/core';
interface EventBus {
readonly stream$: Observable<EchelonEvent>;
on<T>(typePattern: string): Observable<EchelonEvent<T>>;
emit<T>(type: string, payload: T): void;
}PageConfig — declarative page configuration
import type {
PageConfig,
WidgetConfig,
DatasourceConfig,
EventHandlerConfig,
} from '@echelon-framework/core';
// PageConfig = { $schemaVersion, page: { id, title, datasources, widgets, layout, eventHandlers, lifecycle } }EventAction — declarative handler actions
type EventAction =
| { call: string; with?: string } // call computed function
| { emit: string; payload?: string } // emit event
| { setDatasource: string; from: string } // overwrite DS value
| { mergeDatasource: string; from: string } // shallow merge DS value (wizard steps)
| { clearDatasource: string } // clear DS
| { navigate: string | unknown[] } // router navigate
| { fetch: string; into: string; with?: unknown }; // HTTP fetch → DSDatasourceConfig
interface DatasourceConfig {
kind?: 'transport' | 'local' | 'computed' | 'stream';
transport?: string; // 'http' | 'websocket' | 'mock'
endpoint?: string; // URL path
initial?: unknown; // for kind:'local'
fn?: string; // for kind:'computed'
inputs?: string[]; // computed dependencies
cache?: CacheConfig;
persistence?: PersistenceConfig;
}License
BUSL-1.1
