import { ListItem, DcuplItemsOptions, Projection, SortingProjection, ScriptController } from '@dcupl/common'; import { DcuplModel, ModelParser } from '../../model-parser/index.js'; export declare class ItemService { modelParser: ModelParser; private scriptController; private log; constructor(modelParser: ModelParser, scriptController: ScriptController); getItem(itemId: string, dataAsMap: Map, model: DcuplModel, options?: DcuplItemsOptions): ListType | null; getManyItems(itemKeys: string[], dataAsMap: Map, model: DcuplModel, options?: DcuplItemsOptions): ListType[]; getItems(dataAsMap: Map, model: DcuplModel, options?: DcuplItemsOptions): ListType[]; getItemsAsMap(dataAsMap: Map, model?: DcuplModel, options?: DcuplItemsOptions): Map; protected getSortedItemsBasedOnScript(data: Map, options?: DcuplItemsOptions): Map; protected getSortedItems(data: Map, options?: DcuplItemsOptions, model?: DcuplModel): Map; private getUndefinedValueForSorting; isValidProjection(projection?: Projection): boolean; getPagedData(data: Map, start: number, count: number, projection?: Projection, model?: DcuplModel): Map; /** * Whether `sort.script` names a registered script. Runs once per call, never per item. An * unregistered key logs one warning naming the key and is ignored, so the result keeps its * order (#473), the same contract as a malformed attribute sort (#465): no throw. A sort * without a `script` does not warn. */ checkSortScript(sort: SortingProjection | undefined): boolean; private hasRegisteredScript; /** * Whether `sort` can be applied as an attribute sort. Runs once per call, never per item. * A present but malformed sort (wrong shape, lowercase order, attributes and order of * different length) logs one warning naming the expected shape and is ignored, so the * result keeps its unsorted order (#465). When the sort also carries a `script`, the * warning says only the attribute sort is ignored: the script sort still runs. * A missing sort, an empty one (`{}` or `{ attributes: [], order: [] }`) and a * script-only sort (`{ script }`) do not warn. */ checkSortProjection(sort: SortingProjection | undefined): boolean; /** * The part of `sort` that can run, validated once: the sort itself when its attribute sort is * valid and its script (if any) is registered, only the valid part when the other is malformed * or unregistered (one warning each), else undefined. For callers that apply the same sort many * times (groupBy sections), so a malformed sort warns once per query instead of once per call * (#465, #473). */ sanitizeSort(sort: SortingProjection | undefined): SortingProjection | undefined; private isEmptyOrScriptOnlySort; private describeSort; protected isValidSortProjection(sort: SortingProjection | undefined): boolean; getProjectedData(projection: Projection, model: DcuplModel, dataEntry: ListType): ListType; /** * The models a projection reads through: for every nested projection key * that is a reference of `model`, the referenced model, recursively (the * same walk {@link getProjectedData} takes). A list that projects * `{ memberships: { user: { daysInactive: true } } }` on `project` reads * `membership` and `user`, so a change on either can change its result * (#284). Keys that are no reference (properties, `$`/`$$`, array indices) * contribute nothing; the root model itself is not included. */ getProjectionModels(projection: Projection, model: DcuplModel, collected?: Set): Set; }