Docs@skmtc/core

Models

TYPE

ModelProjectionBaseConfig

@skmtc/core 0.63.4

Configuration for toModelProjectionBase.

Generic over the identifier-type shape IdType: a language veneer parameterizes this config with its own XxIdentifierType (ModelProjectionBaseConfig<E, KtIdentifierType>) so toIdentifierType's return tightens to that language's type vocabulary - no recast. The default keeps the loose type: string boundary.

Generic over ProjectionOptions: the caller options this projection accepts, received by the identity statics and stored as this.options.

Signature

import type { ModelProjectionBaseConfig } from '@skmtc/core'

type ModelProjectionBaseConfig<EnrichmentType = undefined, IdType extends IdentifierType = IdentifierType, ProjectionOptions = undefined> = { ... }

Properties

id, string required
toIdentifierName, (args: ToModelIdentifierNameArgs<EnrichmentType, ProjectionOptions>) => string required

Pure: the cache-key name. With no projection options, toModelContentSettings asks for it once in a run and keeps it.

toIdentifierType, (ref: RefParts, context: GenerateContextType) => IdType required

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.

toExportPath, (args: ToModelExportPathArgs<EnrichmentType, ProjectionOptions>) => string required
toEnrichmentDefaults, (args: ToEnrichmentsArgs) => EnrichmentType | undefined

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.