Models
toTsModelProjectionBase
Build a TypeScript model projection base class.
Thin veneer over core's toModelProjectionBase: passes TsSnippet as the base (the hierarchy is language-bound at its root) and adds the register ergonomics core deliberately doesn't define - typed with TypeScript's concise vocabulary, which core can't name (F10):
register(args)- own-file:destinationPathis always this projection'ssettings.exportPath(the foundation rule; never a fallback).registerInto(destinationPath, args)- the explicit cross-file path.
Both delegate to this package's register function - never super.register (lang-base members are type-erased on core's factory result).
The config is core's ModelProjectionBaseConfig parameterized over TsIdentifierType (so toIdentifierType's return tightens to the type bound to TsEntityType). The base is the factory's first argument, not a config field.
ProjectionOptions - the caller options the projection declares (see core's ProjectionOptions) - is forwarded to the config unchanged.
Signature
import { toTsModelProjectionBase } from '@skmtc/lang-typescript'
toTsModelProjectionBase<EnrichmentType = undefined, ProjectionOptions = undefined>(
config: ModelProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>
): TsModelProjectionBaseClass<EnrichmentType, ProjectionOptions>Parameters
Pure: the cache-key name. With no projection options, toModelContentSettings asks for it once in a run and keeps it.
Context-aware, overridable: the non-name parts of the identifier (type / typeName / exported), derived from the schema. Runs only on cache-miss. Returns IdType - the veneer's XxIdentifierType, whose type is bound to that language's EntityType vocabulary (the loose string by default). The tightening rides the type argument.
Optional: compute the DEFAULT enrichment values for a model from its schema - the seed the CMS persists and the user then edits (vs the entry's toEnrichments, which READS already-authored values). Returns the { subject, generator, stack } umbrella; a generator typically fills only subject and leaves the run-constant generator / stack scopes undefined. Omitted → the derived static returns undefined.