UNPKG

@stackbit/types

Version:

Types for Stackbit config and Content Source Interface

83 lines 2.44 kB
import { Logger } from './logger'; export type AssetSource = AssetSourceCloudinary | AssetSourceBynder | AssetSourceAprimo | AssetSourceIframe; export type AssetSourceFunctionOptions = { assetData: any; getLogger: () => Logger; }; export interface AssetSourceCloudinary { type: 'cloudinary'; /** * if not specified defaults to 'cloudinary' */ name?: string; /** * Cloudinary asset preview function * If not specified will default to: * ({ value }) => { * title: value?.public_id, * image: value?.derived?.[0]?.secure_url ?? value?.secure_url * } */ preview?: AssetPreview; /** * asset transform function, if not specified will use the asset "as is" */ transform?: (options: AssetSourceFunctionOptions) => any; } export interface AssetSourceBynder { type: 'bynder'; /** * if not specified defaults to 'bynder' */ name?: string; /** * Bynder asset preview function * If not specified will default to: * ({ value }) => { * title: value?.public_id, * image: value?.derived?.[0]?.secure_url ?? value?.secure_url * } */ preview?: AssetPreview; /** * asset transform function, if not specified will use the asset "as is" */ transform?: (options: AssetSourceFunctionOptions) => any; } export interface AssetSourceAprimo { type: 'aprimo'; /** * if not specified defaults to 'aprimo' */ name?: string; /** * Aprimo asset preview function * If not specified will default to: * ({ value }) => { * title: value?.title, * image: value?.rendition?.publicuri * } */ preview?: AssetPreview; /** * asset transform function, if not specified will use the asset "as is" */ transform?: (options: AssetSourceFunctionOptions) => any; } export interface AssetSourceIframe { type: 'iframe'; name: string; url: string; preview: AssetPreview; /** * asset transform function, if not specified will use the asset "as is" */ transform?: (options: AssetSourceFunctionOptions) => any; } export type AssetPreview = AssetPreviewFunction | AssetPreviewFields; export type AssetPreviewFunction = (options: AssetSourceFunctionOptions) => AssetPreviewFields; export interface AssetPreviewFields { title?: string; image: string; } //# sourceMappingURL=asset-source.d.ts.map