UNPKG

@paroicms/server

Version:
25 lines (24 loc) 1.29 kB
import { Drop } from "liquidjs"; import type { RenderingContext } from "./liquidjs-rendering/rendering-context.js"; export declare const valuesFnSymbol: unique symbol; export declare const promiseSymbol: unique symbol; export type DropValues<T> = { [name in keyof T]: DropOrLiquidValue; }; export type DropOrLiquidValue = DropInst<any> | LiquidValue | (() => Promise<DropOrLiquidValue> | DropOrLiquidValue); export type LiquidValue = PrimitiveLiquidValue | object | DropOrLiquidValue[]; export type PrimitiveLiquidValue = string | number | boolean | undefined; export type DropInst<T> = Drop & { [valuesFnSymbol]: () => Promise<DropValues<T>>; }; export interface LiquidDropOptions<T> { renderingCacheKey: string; values: DropValues<T>; } export declare function createLiquidDrop<T>(renderingContext: RenderingContext, optionsOrFn: LiquidDropOptions<T> | (() => Promise<LiquidDropOptions<T>>)): DropInst<T>; export declare function loadOrFromRenderingCache<T>(renderingContext: RenderingContext, renderingCacheKey: string, load: () => Promise<T>): Promise<T>; export declare function createLiquidDropFromPromise<T>({ renderingContext, renderingCacheKey, value, }: { renderingContext: RenderingContext; renderingCacheKey: string; value: Promise<T>; }): DropInst<T>;