dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
39 lines (38 loc) • 1.35 kB
TypeScript
import type { $sentArgs } from '../../../entity/constants.js';
import type { Entity, EntitySendableAction } from '../../../entity/entity.js';
import { $actionName, $spy } from './constants.js';
import type { EntitySpy } 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 EntityActionStub<ENTITY extends Entity, ACTION extends EntitySendableAction<ENTITY>> {
[$spy]: EntitySpy<ENTITY>;
[$actionName]: string;
constructor(spy: EntitySpy<ENTITY>, Action: new (entity: ENTITY) => ACTION);
resolve(response: Awaited<ReturnType<ACTION['send']>>): EntitySpy<ENTITY>;
reject(error?: string | Error | AwsError): EntitySpy<ENTITY>;
mock(mock: (...args: ReturnType<ACTION[$sentArgs]>) => ReturnType<ACTION['send']> | Awaited<ReturnType<ACTION['send']>> | undefined): EntitySpy<ENTITY>;
}
export {};