import { Model } from "./Model"; import { Schema } from "./Schema"; import { DynamoDB, AWSError } from "aws-sdk"; import { CallbackType, ObjectType } from "./General"; import { SerializerOptions } from "./Serializer"; import { PopulateSettings } from "./Populate"; export interface DocumentSaveSettings { overwrite?: boolean; return?: "request" | "document"; } export interface DocumentSettings { type?: "fromDynamo" | "toDynamo"; } export declare class Document { constructor(model: Model, object?: DynamoDB.AttributeMap | ObjectType, settings?: DocumentSettings); model?: Model; static objectToDynamo(object: ObjectType): DynamoDB.AttributeMap; static objectToDynamo(object: any, settings: { type: "value"; }): DynamoDB.AttributeValue; static objectToDynamo(object: ObjectType, settings: { type: "object"; }): DynamoDB.AttributeMap; static fromDynamo(object: DynamoDB.AttributeMap): ObjectType; static isDynamoObject(object: ObjectType, recurrsive?: boolean): boolean | null; static attributesWithSchema: (document: Document, model: Model) => Promise; static objectFromSchema: (object: any, model: Model, settings?: DocumentObjectFromSchemaSettings) => Promise; static prepareForObjectFromSchema: (object: any, model: Model, settings: DocumentObjectFromSchemaSettings) => any; conformToSchema: (this: Document, settings?: DocumentObjectFromSchemaSettings) => Promise; toDynamo: (this: Document, settings?: Partial) => Promise; prepareForResponse(): Promise; original(): ObjectType | null; toJSON(): ObjectType; serialize(nameOrOptions?: SerializerOptions | string): ObjectType; delete(this: Document): Promise; delete(this: Document, callback: CallbackType): void; save(this: Document): Promise; save(this: Document, callback: CallbackType): void; save(this: Document, settings: DocumentSaveSettings & { return: "request"; }): Promise; save(this: Document, settings: DocumentSaveSettings & { return: "request"; }, callback: CallbackType): void; save(this: Document, settings: DocumentSaveSettings & { return: "document"; }): Promise; save(this: Document, settings: DocumentSaveSettings & { return: "document"; }, callback: CallbackType): void; populate(): Promise; populate(callback: CallbackType): void; populate(settings: PopulateSettings): Promise; populate(settings: PopulateSettings, callback: CallbackType): void; } export interface DocumentObjectFromSchemaSettings { type: "toDynamo" | "fromDynamo"; schema?: Schema; checkExpiredItem?: boolean; saveUnknown?: boolean; defaults?: boolean; forceDefault?: boolean; customTypesDynamo?: boolean; validate?: boolean; required?: boolean | "nested"; enum?: boolean; populate?: boolean; combine?: boolean; modifiers?: ("set" | "get")[]; updateTimestamps?: boolean | { updatedAt?: boolean; createdAt?: boolean; }; }