@aeriajs/types 0.0.64 → 0.0.65
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 +4 -3
- package/dist/http.d.ts +0 -1
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -15,8 +15,9 @@ export type Pagination = {
|
|
|
15
15
|
offset: number;
|
|
16
16
|
limit: number;
|
|
17
17
|
};
|
|
18
|
+
type FilterProperty<T> = T extends ObjectId ? T | string : T;
|
|
18
19
|
type DocumentFilter<TDocument> = PackReferences<TDocument> extends infer Document ? {
|
|
19
|
-
[P in keyof Document]: null | (Document[P] extends
|
|
20
|
+
[P in keyof Document]: null | (Document[P] extends (infer E)[] ? FilterProperty<E>[] : FilterProperty<Document[P]>);
|
|
20
21
|
} : never;
|
|
21
22
|
type RemoveAny<T> = {
|
|
22
23
|
[P in keyof T as 0 extends (T[P] & 1) ? never : P]: T[P];
|
|
@@ -24,9 +25,9 @@ type RemoveAny<T> = {
|
|
|
24
25
|
export type StrictFilter<TDocument> = RemoveAny<Filter<DocumentFilter<TDocument>>>;
|
|
25
26
|
export type StrictFilterOperators<TDocument> = RemoveAny<FilterOperators<DocumentFilter<TDocument>>>;
|
|
26
27
|
export type Filters<TDocument> = StrictFilter<TDocument> & Partial<{
|
|
27
|
-
[P in keyof TDocument]:
|
|
28
|
+
[P in keyof TDocument | `${Extract<keyof TDocument, string>}.${string}`]: (P extends keyof TDocument ? TDocument[P] extends infer Field ? Field extends ObjectId ? Field | string : Field extends {
|
|
28
29
|
_id: infer Id;
|
|
29
|
-
} ? Id | string : Field : never) extends infer Field ? Field | StrictFilterOperators<Field> | null : never;
|
|
30
|
+
} ? Id | string : Field : never : any) extends infer Field ? Field | StrictFilterOperators<Field> | null : never;
|
|
30
31
|
}>;
|
|
31
32
|
export type What<TDocument> = ({
|
|
32
33
|
_id: ObjectId | string;
|
package/dist/http.d.ts
CHANGED