1 | import { Condition, ConditionInitalizer, BasicOperators } from "./Condition";
|
2 | import { Model } from "./Model";
|
3 | import { Document } from "./Document";
|
4 | import { CallbackType, ObjectType, DocumentArray, SortOrder } from "./General";
|
5 | import { AWSError } from "aws-sdk";
|
6 | declare enum DocumentRetrieverTypes {
|
7 | scan = "scan",
|
8 | query = "query"
|
9 | }
|
10 | interface DocumentRetrieverTypeInformation {
|
11 | type: DocumentRetrieverTypes;
|
12 | pastTense: string;
|
13 | }
|
14 | interface DocumentRetriever extends BasicOperators {
|
15 | }
|
16 | declare abstract class DocumentRetriever {
|
17 | internalSettings?: {
|
18 | model: Model<Document>;
|
19 | typeInformation: DocumentRetrieverTypeInformation;
|
20 | };
|
21 | settings: {
|
22 | condition: Condition;
|
23 | limit?: number;
|
24 | all?: {
|
25 | delay: number;
|
26 | max: number;
|
27 | };
|
28 | startAt?: any;
|
29 | attributes?: string[];
|
30 | index?: string;
|
31 | consistent?: boolean;
|
32 | count?: boolean;
|
33 | parallel?: number;
|
34 | sort?: SortOrder;
|
35 | };
|
36 | getRequest: (this: DocumentRetriever) => Promise<any>;
|
37 | all: (this: DocumentRetriever, delay?: number, max?: number) => DocumentRetriever;
|
38 | limit: (this: DocumentRetriever, value: number) => DocumentRetriever;
|
39 | startAt: (this: DocumentRetriever, value: ObjectType) => DocumentRetriever;
|
40 | attributes: (this: DocumentRetriever, value: string[]) => DocumentRetriever;
|
41 | count: (this: DocumentRetriever) => DocumentRetriever;
|
42 | consistent: (this: DocumentRetriever) => DocumentRetriever;
|
43 | using: (this: DocumentRetriever, value: string) => DocumentRetriever;
|
44 | exec(this: DocumentRetriever, callback?: any): any;
|
45 | constructor(model: Model<Document>, typeInformation: DocumentRetrieverTypeInformation, object?: ConditionInitalizer);
|
46 | }
|
47 | interface DocumentRetrieverResponse<T> extends DocumentArray<T> {
|
48 | lastKey?: ObjectType;
|
49 | count: number;
|
50 | }
|
51 | interface ScanResponse<T> extends DocumentRetrieverResponse<T> {
|
52 | scannedCount: number;
|
53 | timesScanned: number;
|
54 | }
|
55 | interface QueryResponse<T> extends DocumentRetrieverResponse<T> {
|
56 | queriedCount: number;
|
57 | timesQueried: number;
|
58 | }
|
59 | export declare class Scan extends DocumentRetriever {
|
60 | exec(): Promise<ScanResponse<Document[]>>;
|
61 | exec(callback: CallbackType<ScanResponse<Document[]>, AWSError>): void;
|
62 | parallel(value: number): Scan;
|
63 | constructor(model: Model<Document>, object?: ConditionInitalizer);
|
64 | }
|
65 | export declare class Query extends DocumentRetriever {
|
66 | exec(): Promise<QueryResponse<Document[]>>;
|
67 | exec(callback: CallbackType<QueryResponse<Document[]>, AWSError>): void;
|
68 | sort(order: SortOrder): Query;
|
69 | constructor(model: Model<Document>, object?: ConditionInitalizer);
|
70 | }
|
71 | export {};
|