@aeriajs/types 0.0.19 → 0.0.20
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 +9 -6
- package/dist/property.d.ts +5 -2
- package/dist/schema.d.ts +3 -1
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -23,11 +23,14 @@ export type Filters<TDocument> = StrictFilter<any> & Partial<{
|
|
|
23
23
|
_id: infer Id;
|
|
24
24
|
} ? Id | string : Field : never) extends infer Field ? Field | StrictFilterOperators<Field> | null : never;
|
|
25
25
|
}>;
|
|
26
|
-
|
|
26
|
+
type DocumentUpdateFilter<Document> = {
|
|
27
27
|
[P in keyof Document]: Document[P] extends null ? null : Document[P] | StrictUpdateFilter<Document[P]>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
};
|
|
29
|
+
export type What<TDocument> = {
|
|
30
|
+
_id: ObjectId | string;
|
|
31
|
+
} & Partial<DocumentUpdateFilter<DocumentFilter<TDocument>>> | {
|
|
32
|
+
_id?: null;
|
|
33
|
+
} & Omit<PackReferences<TDocument>, '_id'>;
|
|
31
34
|
export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? TDocument extends string ? DocumentProp[] : string[] : never;
|
|
32
35
|
export type QuerySort<TDocument> = Partial<Record<keyof WithId<TDocument>, 1 | -1>>;
|
|
33
36
|
export type CollectionDocument<TDocument> = TDocument;
|
|
@@ -47,8 +50,8 @@ export type GetAllPayload<TDocument extends CollectionDocument<OptionalId<any>>>
|
|
|
47
50
|
sort?: QuerySort<TDocument>;
|
|
48
51
|
populate?: (keyof TDocument | string)[];
|
|
49
52
|
};
|
|
50
|
-
export type InsertPayload<TDocument extends CollectionDocument<any
|
|
51
|
-
what:
|
|
53
|
+
export type InsertPayload<TDocument extends CollectionDocument<any>> = {
|
|
54
|
+
what: What<TDocument>;
|
|
52
55
|
project?: Projection<TDocument>;
|
|
53
56
|
};
|
|
54
57
|
export type RemovePayload<TDocument extends CollectionDocument<OptionalId<any>>> = {
|
package/dist/property.d.ts
CHANGED
|
@@ -90,8 +90,11 @@ export type ArrayOfRefs = Omit<ArrayProperty, 'items'> & {
|
|
|
90
90
|
export type GetterProperty = {
|
|
91
91
|
getter: (document: any) => any;
|
|
92
92
|
};
|
|
93
|
-
export type
|
|
94
|
-
|
|
93
|
+
export type ConstProperty = {
|
|
94
|
+
const: string | number | boolean;
|
|
95
|
+
};
|
|
96
|
+
export type MixedProperty = RefProperty | FileProperty | EnumProperty | ArrayProperty | ObjectProperty | StringProperty | NumberProperty | BooleanProperty | GetterProperty | ConstProperty;
|
|
97
|
+
export type NonCircularMixedProperty = NonCircularRefProperty | FileProperty | EnumProperty | ArrayProperty | ObjectProperty | StringProperty | NumberProperty | BooleanProperty | GetterProperty | ConstProperty;
|
|
95
98
|
export type PropertyBase = {
|
|
96
99
|
description?: string;
|
|
97
100
|
readOnly?: boolean;
|
package/dist/schema.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export type InferProperty<T> = T extends TestType<{
|
|
|
33
33
|
items: infer K;
|
|
34
34
|
}> ? InferProperty<K>[] : T extends TestType<{
|
|
35
35
|
getter: (doc: any) => infer K;
|
|
36
|
+
}> ? K : T extends TestType<{
|
|
37
|
+
const: infer K;
|
|
36
38
|
}> ? K : never;
|
|
37
39
|
export type InferSchema<TSchema> = MergeReferences<TSchema> extends infer MappedTypes ? TSchema extends {
|
|
38
40
|
required: readonly [];
|
|
@@ -87,7 +89,7 @@ type MapReferences<TSchema> = TSchema extends {
|
|
|
87
89
|
}>;
|
|
88
90
|
}> ? K extends keyof Collections ? Collections[K]['item'][] : never : never : never;
|
|
89
91
|
} : never;
|
|
90
|
-
type PackReferencesAux<T> = T extends (...args: any[]) => any ? T : T extends {
|
|
92
|
+
type PackReferencesAux<T> = T extends (...args: any[]) => any ? T : T extends ObjectId ? T : T extends {
|
|
91
93
|
_id: infer Id;
|
|
92
94
|
} ? Id : T extends Record<string, any> ? PackReferences<T> : T extends any[] | readonly any[] ? PackReferencesAux<T[number]>[] : T;
|
|
93
95
|
type CombineProperties<TSchema> = TSchema extends {
|