# toTsWebhookProjectionBase

FUNCTION in `@skmtc/lang-typescript 0.19.1`

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**: `destinationPath` is always this
  projection's `settings.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

```ts
import { toTsWebhookProjectionBase } from '@skmtc/lang-typescript'

toTsWebhookProjectionBase<EnrichmentType = undefined, ProjectionOptions = undefined>(
  config: WebhookProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>
): TsWebhookProjectionBaseClass<EnrichmentType, ProjectionOptions>
```

## Parameters

- `config` (WebhookProjectionBaseConfig<EnrichmentType, TsIdentifierType, ProjectionOptions>, required)
  - `id` (string, required)
  - `toIdentifierName` ((args: ToWebhookIdentifierNameArgs<EnrichmentType, ProjectionOptions>) => string, required): Pure: the cache-key name (the cache-check path runs this).
  - `toIdentifierType` ((webhook: OasWebhook, context: GenerateContextType) => TsIdentifierType, required): 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).
  - `toExportPath` ((args: ToWebhookExportPathArgs<EnrichmentType, ProjectionOptions>) => string, required)
  - `toEnrichmentDefaults` ((args: ToEnrichmentsArgs) => EnrichmentType | undefined): 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).

## Returns

`TsWebhookProjectionBaseClass<EnrichmentType, ProjectionOptions>`
