import type { BatchWriteItem, BatchWriteResult, IDeleteBatchItem, IPutBatchItem } from "../../utils/batch/types.js"; import type { BaseScanParams, ScanResponse } from "../scan.js"; import type { Entity } from "../../toolbox.js"; import type { GenericRecord } from "@webiny/api/types.js"; import { Table } from "../../toolbox.js"; export type ITableScanParams = BaseScanParams; export type ITableScanResponse = ScanResponse; export interface ITable { table: Table; createWriter(): ITableWriteBatch; createReader(): ITableReadBatch; scan(params: ITableScanParams): Promise>; } export interface ITableWriteBatch { readonly total: number; readonly items: BatchWriteItem[]; put(entity: Entity, item: IPutBatchItem): void; delete(entity: Entity, item: IDeleteBatchItem): void; execute(): Promise; combine(items: BatchWriteItem[]): ITableWriteBatch; } export interface ITableReadBatchKey { PK: string; SK: string; } export interface ITableReadBatchBuilderGetResponse { Table: Table; Key: ITableReadBatchKey; } export interface ITableReadBatchKey { PK: string; SK: string; } export interface ITableReadBatch { readonly total: number; readonly items: ITableReadBatchBuilderGetResponse[]; get(entity: Entity, input: ITableReadBatchKey | ITableReadBatchKey[]): void; execute(): Promise; }