UNPKG

@webiny/api-headless-cms-ddb

Version:

DynamoDB storage operations plugin for Headless CMS API.

44 lines (43 loc) 1.83 kB
import { Plugin } from "@webiny/plugins"; import { ValueFilterPlugin } from "@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin"; import { Field } from "../operations/entry/filtering/types"; import { CmsFieldFilterValueTransformPlugin } from "../types"; /** * This plugin is used to create the filter. * Internally we have default one + the one for the reference field - because it is actually an object when filtering. */ interface CmsEntryFieldFilterPluginParams<T = any> { fieldType: string; create: (params: CmsEntryFieldFilterPluginCreateParams<T>) => null | CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[]; } interface CmsEntryFieldFilterPluginCreateParams<T = any> { key: string; value: T; field: Field; fields: Record<string, Field>; operation: string; valueFilterPlugins: Record<string, ValueFilterPlugin>; transformValuePlugins: Record<string, CmsFieldFilterValueTransformPlugin>; getFilterCreatePlugin: (type: string) => CmsEntryFieldFilterPlugin; negate: boolean; compareValue: any; transformValue: <I = any, O = any>(value: I) => O; } export interface CmsEntryFieldFilterPluginCreateResponse { field: Field; path: string; fieldPathId: string; plugin: ValueFilterPlugin; negate: boolean; compareValue: any; transformValue: <I = any, O = any>(value: I) => O; } export declare class CmsEntryFieldFilterPlugin<T = any> extends Plugin { static readonly type: string; static readonly ALL: string; private readonly config; readonly fieldType: string; constructor(config: CmsEntryFieldFilterPluginParams<T>); create(params: CmsEntryFieldFilterPluginCreateParams<T>): CmsEntryFieldFilterPluginCreateResponse | CmsEntryFieldFilterPluginCreateResponse[] | null; } export {};