dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
37 lines (36 loc) • 4.51 kB
TypeScript
import type { BatchWriteCommandOutput } from '@aws-sdk/lib-dynamodb';
import type { Entity } from '../../../entity/index.js';
import type { Schema, TransformedValue } from '../../../schema/index.js';
import { AccessPattern } from '../../../table/actions/accessPattern/index.js';
import type { RequestEntities as BatchGetRequestEntities } from '../../../table/actions/batchGet/batchGetCommand.js';
import type { BatchGetCommandOptions, ExecuteBatchGetInput, ExecuteBatchGetResponses, IBatchGetRequest } from '../../../table/actions/batchGet/index.js';
import { BatchGetCommand } from '../../../table/actions/batchGet/index.js';
import type { BatchWriteCommandOptions, RequestEntities as BatchWriteRequestEntities, ExecuteBatchWriteInput, IBatchWriteRequest } from '../../../table/actions/batchWrite/index.js';
import { BatchWriteCommand } from '../../../table/actions/batchWrite/index.js';
import type { DeletePartitionOptions, DeletePartitionResponse } from '../../../table/actions/deletePartition/index.js';
import type { PrimaryKey } from '../../../table/actions/parsePrimaryKey/index.js';
import type { Query, QueryOptions, QueryResponse } from '../../../table/actions/query/index.js';
import type { ScanOptions, ScanResponse } from '../../../table/actions/scan/index.js';
import type { Table } from '../../../table/index.js';
import { TableAction } from '../../../table/index.js';
import type { Cast, _Omit } from '../../../types/index.js';
export declare class TableRepository<TABLE extends Table = Table, ENTITIES extends Entity[] = Entity[]> extends TableAction<TABLE, ENTITIES> {
static actionName: "repository";
constructor(table: TABLE, entities?: ENTITIES);
entities<NEXT_ENTITIES extends Entity[]>(...nextEntities: NEXT_ENTITIES): TableRepository<TABLE, NEXT_ENTITIES>;
parsePrimaryKey(keyInput: {
[KEY: string]: unknown;
}): PrimaryKey<TABLE>;
scan<OPTIONS extends ScanOptions<TABLE, ENTITIES> = ScanOptions<TABLE, ENTITIES>>(options?: OPTIONS): Promise<ScanResponse<TABLE, ENTITIES, OPTIONS>>;
query<QUERY extends Query<TABLE> = Query<TABLE>, OPTIONS extends QueryOptions<TABLE, ENTITIES> = QueryOptions<TABLE, ENTITIES>>(query: QUERY, options?: OPTIONS): Promise<QueryResponse<TABLE, QUERY, ENTITIES, OPTIONS>>;
deletePartition<QUERY extends Query<TABLE> = Query<TABLE>>(query: QUERY, options?: DeletePartitionOptions<TABLE, ENTITIES, QUERY>): Promise<DeletePartitionResponse>;
static executeBatchGet<COMMANDS extends ExecuteBatchGetInput>(...commands: COMMANDS): Promise<ExecuteBatchGetResponses<COMMANDS>>;
batchGet<REQUESTS_OR_OPTIONS extends IBatchGetRequest[] | [BatchGetCommandOptions, ...IBatchGetRequest[]], REQUESTS extends IBatchGetRequest[] = REQUESTS_OR_OPTIONS extends IBatchGetRequest[] ? REQUESTS_OR_OPTIONS : REQUESTS_OR_OPTIONS extends [BatchGetCommandOptions, ...infer TAIL_REQUESTS] ? TAIL_REQUESTS extends IBatchGetRequest[] ? TAIL_REQUESTS : never : never, REQUEST_ENTITIES extends Entity[] = BatchGetRequestEntities<REQUESTS>, OPTIONS extends BatchGetCommandOptions<REQUEST_ENTITIES> = REQUESTS_OR_OPTIONS extends [
BatchGetCommandOptions<REQUEST_ENTITIES>
] ? REQUESTS_OR_OPTIONS[0] : BatchGetCommandOptions<REQUEST_ENTITIES>>(..._requests: REQUESTS_OR_OPTIONS): BatchGetCommand<TABLE, REQUEST_ENTITIES, REQUESTS, OPTIONS>;
static executeBatchWrite(...commands: ExecuteBatchWriteInput): Promise<BatchWriteCommandOutput>;
batchWrite<REQUESTS_OR_OPTIONS extends IBatchWriteRequest[] | [BatchWriteCommandOptions, ...IBatchWriteRequest[]], REQUESTS extends IBatchWriteRequest[] = REQUESTS_OR_OPTIONS extends IBatchWriteRequest[] ? REQUESTS_OR_OPTIONS : REQUESTS_OR_OPTIONS extends [BatchWriteCommandOptions, ...infer TAIL_REQUESTS] ? TAIL_REQUESTS extends IBatchWriteRequest[] ? TAIL_REQUESTS : never : never, REQUEST_ENTITIES extends Entity[] = BatchWriteRequestEntities<REQUESTS>>(..._requests: REQUESTS_OR_OPTIONS): BatchWriteCommand<TABLE, REQUEST_ENTITIES, REQUESTS>;
accessPattern<SCHEMA extends Schema, QUERY extends Query<TABLE>, DEFAULT_OPTIONS extends QueryOptions<TABLE, ENTITIES, QUERY> = QueryOptions<TABLE, ENTITIES, QUERY>, CONTEXT_OPTIONS extends QueryOptions<TABLE, ENTITIES, QUERY> = QueryOptions<TABLE, ENTITIES, QUERY>>(schema: SCHEMA, pattern: (input: TransformedValue<SCHEMA>) => QUERY & {
options?: CONTEXT_OPTIONS;
}, options?: DEFAULT_OPTIONS): AccessPattern<TABLE, ENTITIES, SCHEMA, Cast<_Omit<QUERY, 'options'>, Query<TABLE>>, DEFAULT_OPTIONS, CONTEXT_OPTIONS>;
}