UNPKG

dynamodb-toolbox

Version:

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

39 lines (38 loc) 1.33 kB
import type { $sentArgs } from '../../../table/constants.js'; import type { Table, TableSendableAction } from '../../../table/table.js'; import { $actionName, $spy } from './constants.js'; import type { TableSpy } from './spy.js'; export interface Error { name: string; message: string; stack?: string; } interface MetadataBearer { $metadata: { httpStatusCode?: number; requestId?: string; extendedRequestId?: string; cfId?: string; attempts?: number; totalRetryDelay?: number; }; } export interface AwsError extends Partial<{ name: string; message: string; stack?: string; }>, Partial<MetadataBearer> { Type?: string; Code?: string; $fault?: 'client' | 'server'; $service?: string; } export declare class TableActionStub<TABLE extends Table, ACTION extends TableSendableAction<TABLE>> { [$spy]: TableSpy<TABLE>; [$actionName]: string; constructor(spy: TableSpy<TABLE>, Action: new (entity: TABLE) => ACTION); resolve(response: Awaited<ReturnType<ACTION['send']>>): TableSpy<TABLE>; reject(error?: string | Error | AwsError): TableSpy<TABLE>; mock(mock: (...args: ReturnType<ACTION[$sentArgs]>) => ReturnType<ACTION['send']> | Awaited<ReturnType<ACTION['send']>> | undefined): TableSpy<TABLE>; } export {};