Skip to content

build

build<TMap, TCollection>(config): Effect<void, LoadingError | TransformationError | ValidationError | ContentStoreError, ContentStore | { [K in string | number | symbol]: CollectionParts<TCollection[K]>[“loaderDeps”] | CollectionParts<TCollection[K]>[“transformerDeps”] | CollectionParts<TCollection[K]>[“validatorDeps”] }[keyof TCollection]>

Defined in: packages/core/src/cms.ts:487

Builds and initializes all collections in the CMS. This function loads, transforms, validates, and stores all collection data.

TMap extends Record<string, CollectionAny>

Record mapping collection names to their Collection definitions

TCollection extends Record<string, CollectionAny> = TMap

The collection map type

Configuration object containing the collections to build

TCollection

Effect<void, LoadingError | TransformationError | ValidationError | ContentStoreError, ContentStore | { [K in string | number | symbol]: CollectionParts<TCollection[K]>[“loaderDeps”] | CollectionParts<TCollection[K]>[“transformerDeps”] | CollectionParts<TCollection[K]>[“validatorDeps”] }[keyof TCollection]>

Effect that completes when all collections have been built

const buildEffect = build({
collections: {
posts: postsCollection,
users: usersCollection
}
});
yield* buildEffect;