Webhooks
toTsWebhookProjectionBase
Build a TypeScript webhook projection base class.
Sibling of toTsOasOperationProjectionBase for the OpenAPI 3.1 webhook subject. Thin veneer over core's toWebhookProjectionBase: 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:
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 WebhookProjectionBaseConfig 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 { toTsWebhookProjectionBase } from '@skmtc/lang-typescript'
toTsWebhookProjectionBase<EnrichmentType = undefined, ProjectionOptions = undefined>(
config: WebhookProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>
): TsWebhookProjectionBaseClass<EnrichmentType, ProjectionOptions>Parameters
Pure: the cache-key name (the cache-check path runs this).
Context-aware, overridable: the non-name parts of the identifier, derived from the webhook. Runs only on cache-miss. Returns this language's XxIdentifierType (IdType; the loose type: string by default).
Optional: compute the DEFAULT enrichment values for a webhook from its schema - the seed the CMS persists and the user then edits (vs the entry's toEnrichments, which READS already-authored values).