@zhongmiao/meta-lc-kernel
v0.2.0
Published
English | [中文文档](./README_zh.md)
Downloads
74
Readme
@zhongmiao/meta-lc-kernel
English | 中文文档
Package Role
kernel is the structural metadata source for the platform. It owns MetaSchema, ViewDefinition, NodeDefinition, DatasourceDefinition, PermissionPolicy, schema validation, snapshot and migration DSL helpers, schema diff, SQL generation, version publishing, rollback, repository contracts, and the versioned meta definition registry.
Responsibilities
- Define table, field, relation, index, tenant, app, rule, and permission schema types.
- Validate schemas before they are published.
- Persist and retrieve versioned schemas through the repository port; concrete Postgres persistence lives in
@zhongmiao/meta-lc-kernel-adapter-postgres. - Publish, retrieve, and diff versioned view, datasource, and permission policy definitions.
- Generate schema SQL, migration SQL, API route manifests, and permission manifests.
- Guard destructive migration statements and record migration audits.
Relationship With Other Packages
- Upstream:
bff,runtime, andinfra/scripts. - Downstream: repository implementations; kernel has no workspace package dependencies.
- Migration lifecycle scripts reuse kernel migration compile and safety helpers from infra.
bffreads kernel registry definitions as a thin gateway and must not orchestrate metadata.query,permission,datasource,runtime,audit, andbffmust not become kernel dependencies.- Kernel owns structure contracts; runtime consumes view/node definitions and owns only execution contracts.
PermissionPolicy.scopeis a local structural literal; permission runtime data-scope DTOs live inpermissionand only share string semantics with kernel.
Minimal Flow
flowchart LR
Schema["MetaSchema"] --> Validate["validateSchema"]
Validate --> Publish["publishSchema"]
Publish --> Version["meta_kernel_versions"]
Definition["View / Datasource / Policy"] --> Registry["meta definition registry"]
Version --> Diff["diff / buildMigrationPlan"]
Diff --> Sql["migration SQL + safety report"]Commands
pnpm --filter @zhongmiao/meta-lc-kernel build
pnpm --filter @zhongmiao/meta-lc-kernel testBoundary Notes
- Kernel is the metadata source of truth and must stay independent from BFF orchestration.
- The package root exposes
corecontracts andapplicationAPIs only;domainremains an internal semantic layer, not SDK public API. - SDK consumers must not deep import
src/domainorsrc/applicationimplementation files; package-local tests may do so only for internal coverage. - Kernel has no workspace package dependencies and no direct Postgres access.
- Meta DB persistence is provided by repository ports and external adapters such as
@zhongmiao/meta-lc-kernel-adapter-postgres. - Do not add HTTP, NestJS controller, runtime UI, or business execution logic here.
- Do not execute runtime plans from meta registry APIs; registry only versions definitions.
- Do not keep business demo registry seeds here; examples own their own seed metadata under
examples/*.
