Skip to content

Compilation

Compilation takes a validated manifest and produces a normalized, runtime-ready object. It derives form fields, builds path registries, and ensures all optional arrays exist.

Package

text
@ikary/engine   (contracts/node/engine/)
text
# Compilation: coming soon

Install

bash
pnpm add @ikary/engine
PythonPython support for this section is coming soon.

compileCellApp(manifest)

The main entry point. Takes a validated CellManifestV1, runs schema validation and business rules, normalizes the manifest, and returns a compiled manifest.

typescript
import { compileCellApp, isValidationResult } from '@ikary/engine';
import type { CellManifestV1 } from '@ikary/contract';

const result = compileCellApp(manifest);

if (isValidationResult(result)) {
  console.error('Errors:', result.errors);
} else {
  // result is a normalized CellManifestV1
  console.log(result.spec.entities);
}
PythonPython support for this section is coming soon.

normalizeManifest(manifest)

Ensures all optional arrays exist (entities, pages, navigation items). Prevents undefined access in downstream code.

typescript
import { normalizeManifest } from '@ikary/engine';

const normalized = normalizeManifest(manifest);
PythonPython support for this section is coming soon.

Field derivation

typescript
import { deriveCreateFields, deriveEditFields } from '@ikary/engine';

// Derive fields for a create form (filtered, sorted, with effective properties)
const createFields = deriveCreateFields(entity.fields);

// Derive fields for an edit form
const editFields = deriveEditFields(entity.fields);
PythonPython support for this section is coming soon.

Path builders

typescript
import {
  buildEntityListPath,
  buildEntityDetailPath,
  buildEntityCreatePath,
  buildEntityEditPath,
} from '@ikary/engine';

buildEntityListPath(manifest, 'customer');           // "/crm/customers"
buildEntityDetailPath(manifest, 'customer', '123'); // "/crm/customers/123"
PythonPython support for this section is coming soon.

Design

Engine is stateless and pure: no I/O, no YAML dependency, no React. It accepts a manifest object and returns a transformed manifest object. Consumers compose loader and engine as needed.