← @mortar-kit/core

ContentServerinterface

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

interface ContentServer

The content functions an app's "use server" module exports, by these names, for contentClient.

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.

save: (collection: string, doc: Doc) => Promise<SaveResult>

Validates and stores a document (signed-in only).

remove: (collection: string, id: string) => Promise<RemoveResult>

Deletes a document, unless others reference it (signed-in only).

move: (collection: string, id: string, index: number) => Promise<void>

Moves a document of an orderable collection (signed-in only).

listAssets: () => Promise<Asset[]>

Every uploaded file, newest first ([] without a blob store).

uploadAsset: (form: FormData) => Promise<UploadResult>

Stores a file sent as form data: file, plus optional folder, title and alt (signed-in only).

removeAsset: (key: string) => Promise<RemoveResult>

Deletes a file, unless documents use it (signed-in only).

updateAsset: (key: string, details: AssetDetails) => Promise<UpdateAssetResult>

Sets a file's default title, alt text or folder (signed-in only).

listAssetFolders: () => Promise<AssetFolder[]>

Every asset folder.

saveAssetFolder: (folder: { id?: string; name: string }) => Promise<FolderResult>

Creates or renames an asset folder (signed-in only).

removeAssetFolder: (id: string) => Promise<void>

Deletes an asset folder; its files stay (signed-in only).