@aeriajs/types 0.0.65 → 0.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions.d.ts +6 -5
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export type What<TDocument> = ({
|
|
|
36
36
|
} & Omit<PackReferences<TDocument>, '_id'>) extends infer Document ? {
|
|
37
37
|
[P in keyof Document]: Document[P] | null;
|
|
38
38
|
} : never;
|
|
39
|
-
export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? DocumentProp extends string ? DocumentProp[] : string[] : never;
|
|
39
|
+
export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? [DocumentProp] extends [string] ? DocumentProp[] : string[] : never;
|
|
40
40
|
export type QuerySort<TDocument> = Partial<Record<keyof WithId<TDocument>, 1 | -1>>;
|
|
41
41
|
export type CollectionDocument<TDocument> = TDocument;
|
|
42
42
|
export type CountPayload<TDocument extends CollectionDocument<OptionalId<any>>> = {
|
|
@@ -75,6 +75,10 @@ export type GetReturnType<TDocument> = Result.Either<StrictEndpointError<ACError
|
|
|
75
75
|
export type CountReturnType = Result.Either<EndpointError, number>;
|
|
76
76
|
export type GetAllReturnType<TDocument> = Result.Either<EndpointError, TDocument[]>;
|
|
77
77
|
export type RemoveReturnType<TDocument> = Result.Either<EndpointError, TDocument>;
|
|
78
|
+
export type PaginatedGetAllReturnType<TDocument> = Result.Either<EndpointError, {
|
|
79
|
+
data: TDocument[];
|
|
80
|
+
pagination: Pagination;
|
|
81
|
+
}>;
|
|
78
82
|
export type CollectionFunctions<TDocument extends CollectionDocument<OptionalId<any>>> = {
|
|
79
83
|
count: (payload: CountPayload<TDocument>) => Promise<CountReturnType>;
|
|
80
84
|
get: (payload: GetPayload<TDocument>) => Promise<GetReturnType<TDocument>>;
|
|
@@ -87,10 +91,7 @@ export type CollectionFunctions<TDocument extends CollectionDocument<OptionalId<
|
|
|
87
91
|
export type CollectionFunctionsSDK<TDocument extends CollectionDocument<OptionalId<any>>> = {
|
|
88
92
|
count: (payload: CountPayload<TDocument>) => Promise<WithACErrors<CountReturnType>>;
|
|
89
93
|
get: (payload: GetPayload<TDocument>) => Promise<WithACErrors<GetReturnType<TDocument>>>;
|
|
90
|
-
getAll: (payload?: GetAllPayload<TDocument>) => Promise<WithACErrors<
|
|
91
|
-
data: TDocument[];
|
|
92
|
-
pagination: Pagination;
|
|
93
|
-
}>>>;
|
|
94
|
+
getAll: (payload?: GetAllPayload<TDocument>) => Promise<WithACErrors<PaginatedGetAllReturnType<TDocument>>>;
|
|
94
95
|
insert: (payload: InsertPayload<TDocument>) => Promise<WithACErrors<InsertReturnType<TDocument>>>;
|
|
95
96
|
remove: (payload: RemovePayload<TDocument>) => Promise<WithACErrors<RemoveReturnType<TDocument>>>;
|
|
96
97
|
removeAll: (payload: RemoveAllPayload) => Promise<any>;
|