Docs@skmtc/core

Models

TYPE

ModelEntry

@skmtc/core 0.63.4

The entry of a model generator, which toModelEntry makes. It represents the generator to core, and a generator has one.

When isSupported or toPreviewModule uses the result of toEnrichments on its own entry, declare the type of the entry: const entry: ModelEntry<EnrichmentSchema> = toModelEntry(...). Without it, TypeScript reports TS7022.

Signature

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

type ModelEntry<EnrichmentType = undefined> = { ... }
EnrichmentType

The enrichments that toEnrichmentSchema parses

Properties

id, string required
type, 'model' required
projections, readonly DeclaredProjection[]

The projection classes the entry declared; absent when it declared none. See DeclaredProjection.

transform, (args: TransformModelArgs) => void required
isSupported, (args: IsSupportedModelArgs) => boolean required
supportsVariant, () => boolean required
toPreviewModule, (args: ToModelPreviewModuleArgs) => PreviewModule
toEnrichmentSchema, () => v.GenericSchema<EnrichmentType> required
toEnrichments, (args: ToModelEnrichmentsArgs) => EnrichmentType required

The generator's enrichments for one model and variant, parsed with toEnrichmentSchema. The factory makes it: it is not a config key.

toEnrichmentRequest, <RequestedEnrichment extends EnrichmentType>(ref: RefParts) => EnrichmentRequest<RequestedEnrichment> | undefined
toEnrichmentDefaults, (args: ToModelEnrichmentsArgs) => EnrichmentType | undefined