← @mortar-kit/core

ContentSourceinterface

import { ContentSource } from '@mortar-kit/core'

interface ContentSource

Reading documents by collection name: what bricks, layouts and routes need.

Properties

list: (collection: string, options?: ListOptions) => Promise<DocSummary[]>

Documents of a collection, without their bodies.

get: (collection: string, ref: DocRef) => Promise<Doc<Record<string, unknown>> | null>

One document, or null if there is none.

track?: () => void

Called before each brick load, where reads are tracked: read a signal here to make every load run again when it changes (the admin preview does, after each save).