UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

17 lines (16 loc) 1.27 kB
import { EntityAction } from '../../../entity/index.js'; import type { Entity } from '../../../entity/index.js'; import { PathParser } from '../../../schema/actions/parsePaths/index.js'; import type { ParsePathsOptions, ProjectionExpression, TransformPathsOptions } from '../../../schema/actions/parsePaths/index.js'; import type { Paths } from '../../../schema/index.js'; import { $pathParser } from './constants.js'; export declare class EntityPathParser<ENTITY extends Entity = Entity> extends EntityAction<ENTITY> { static actionName: 'parsePaths'; static express(paths: string[]): ProjectionExpression; [$pathParser]: PathParser<ENTITY['schema']>; constructor(entity: ENTITY); transform(paths: string[], options?: TransformPathsOptions): string[]; parse(attributes: string[], options?: ParsePathsOptions): ProjectionExpression; } export type EntityPaths<ENTITY extends Entity = Entity> = Paths<ENTITY['schema']>; export type EntityPathsUnion<ENTITIES extends Entity[] = Entity[], RESULTS extends string = never> = ENTITIES extends [infer ENTITIES_HEAD, ...infer ENTITIES_TAIL] ? ENTITIES_HEAD extends Entity ? ENTITIES_TAIL extends Entity[] ? EntityPathsUnion<ENTITIES_TAIL, RESULTS | EntityPaths<ENTITIES_HEAD>> : never : never : RESULTS;