import type { ParsedLNodeId, ScSorting } from "@paroicms/public-anywhere-lib"; export type LoadDescriptor = DocumentsLoadDescriptor | OneDocumentLoadDescriptor; export type DocumentsLoadDescriptor = ChildDocumentsLoadDescriptor | SearchDocumentsLoadDescriptor; export interface ListBaseDescriptor { offset?: number; limit?: number; sorting?: ScSorting; labeledWith?: LabeledWithDescriptor; fieldEquals?: FieldEqualsDescriptor; } export interface LabeledWithDescriptor { fieldName: string; termNodeId: string; } export interface FieldEqualsDescriptor { fieldName: string; value: string; } export interface ChildDocumentsLoadDescriptor extends ListBaseDescriptor { load: "list"; nodeKind: "document"; descriptorName: "children"; parentDocumentId: ParsedLNodeId; /** * If omitted, an additional query to fetch the type name will be made to the database. */ parentDocumentTypeName?: string; } export interface SearchDocumentsLoadDescriptor extends ListBaseDescriptor { load: "list"; nodeKind: "document"; descriptorName: "search"; language: string; words: string[]; /** * When provided, the search is restricted to the direct children of this document. */ parentDocumentId?: ParsedLNodeId; /** * If omitted, an additional query to fetch the type name will be made to the database. */ parentDocumentTypeName?: string; } export interface OneDocumentLoadDescriptor { load: "one"; nodeKind: "document"; descriptorName: "id"; documentId: ParsedLNodeId; }