factory
factory<
TMap,TCollection>():Tag<Cms<TMap,TCollection,CmsError|ContentStoreError>,Cms<TMap,TCollection,CmsError|ContentStoreError>>
Defined in: packages/core/src/cms.ts:554
Factory function that creates a Context.Tag for a CMS instance. This tag is used to identify and inject CMS instances in the Effect context.
Type Parameters
Section titled “Type Parameters”TMap extends Record<string, CollectionAny>
Record mapping collection names to their Collection definitions
TCollection
Section titled “TCollection”TCollection extends Record<string, CollectionAny> = TMap
The collection map type
Returns
Section titled “Returns”Tag<Cms<TMap, TCollection, CmsError | ContentStoreError>, Cms<TMap, TCollection, CmsError | ContentStoreError>>
A Context.Tag for the CMS type
Example
Section titled “Example”const CmsTag = factory<{ posts: PostCollection }>();
// Use in an Effectconst getCms = Effect.gen(function* () { const cms = yield* CmsTag; return cms;});