@aeriajs/types 0.0.103 → 0.0.105
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/functionSchemas.d.ts +4 -4
- package/dist/functions.d.ts +5 -6
- package/dist/property.d.ts +1 -3
- package/dist/resultSchemas.d.ts +2 -2
- package/dist/resultSchemas.js +2 -2
- package/dist/resultSchemas.mjs +2 -2
- package/dist/schema.d.ts +8 -5
- package/dist/security.d.ts +1 -1
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ export declare const insertError: () => {
|
|
|
25
25
|
};
|
|
26
26
|
readonly details: {
|
|
27
27
|
readonly type: "object";
|
|
28
|
-
readonly
|
|
28
|
+
readonly additionalProperties: true;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
};
|
|
@@ -55,7 +55,7 @@ export declare const getError: () => {
|
|
|
55
55
|
};
|
|
56
56
|
readonly details: {
|
|
57
57
|
readonly type: "object";
|
|
58
|
-
readonly
|
|
58
|
+
readonly additionalProperties: true;
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
};
|
|
@@ -85,7 +85,7 @@ export declare const getAllError: () => {
|
|
|
85
85
|
};
|
|
86
86
|
readonly details: {
|
|
87
87
|
readonly type: "object";
|
|
88
|
-
readonly
|
|
88
|
+
readonly additionalProperties: true;
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
};
|
|
@@ -115,7 +115,7 @@ export declare const countError: () => {
|
|
|
115
115
|
};
|
|
116
116
|
readonly details: {
|
|
117
117
|
readonly type: "object";
|
|
118
|
-
readonly
|
|
118
|
+
readonly additionalProperties: true;
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
};
|
package/dist/functions.d.ts
CHANGED
|
@@ -24,8 +24,9 @@ type RemoveAny<T> = {
|
|
|
24
24
|
};
|
|
25
25
|
export type StrictFilter<TDocument> = RemoveAny<Filter<DocumentFilter<TDocument>>>;
|
|
26
26
|
export type StrictFilterOperators<TDocument> = RemoveAny<FilterOperators<DocumentFilter<TDocument>>>;
|
|
27
|
+
type FlattenObjectKeys<T> = T extends T & 0 ? never : T extends Record<infer K, unknown> ? K extends string ? T[K] extends Record<string, unknown> ? `${K}.${FlattenObjectKeys<T[K]>}` : K : never : never;
|
|
27
28
|
export type Filters<TDocument> = StrictFilter<TDocument> & Partial<{
|
|
28
|
-
[P in keyof TDocument |
|
|
29
|
+
[P in keyof TDocument | FlattenObjectKeys<TDocument>]: (P extends keyof TDocument ? TDocument[P] extends infer Field ? Field extends ObjectId ? Field | string : Field extends {
|
|
29
30
|
_id: infer Id;
|
|
30
31
|
} ? Id | string : Field : never : unknown) extends infer Field ? Field | StrictFilterOperators<Field> | null : never;
|
|
31
32
|
}>;
|
|
@@ -61,9 +62,7 @@ export type InsertPayload<TDocument extends WithId<unknown>> = {
|
|
|
61
62
|
export type RemovePayload<TDocument extends WithId<unknown>> = {
|
|
62
63
|
filters: Filters<TDocument>;
|
|
63
64
|
};
|
|
64
|
-
export type RemoveAllPayload =
|
|
65
|
-
filters: (ObjectId | string)[];
|
|
66
|
-
};
|
|
65
|
+
export type RemoveAllPayload<TDocument extends WithId<unknown>> = GetPayload<TDocument>;
|
|
67
66
|
export type RemoveFilePayload = UploadAuxProps & {
|
|
68
67
|
filters: {
|
|
69
68
|
_id: ObjectId | string;
|
|
@@ -86,7 +85,7 @@ export type CollectionFunctions<TSchema extends JsonSchema = JsonSchema> = Schem
|
|
|
86
85
|
keepTempIds: true;
|
|
87
86
|
}>>) => Promise<InsertReturnType<InferredDocument>>;
|
|
88
87
|
remove: (payload: RemovePayload<InferredDocument>) => Promise<RemoveReturnType<InferredDocument>>;
|
|
89
|
-
removeAll: (payload: RemoveAllPayload) => Promise<unknown>;
|
|
88
|
+
removeAll: (payload: RemoveAllPayload<InferredDocument>) => Promise<unknown>;
|
|
90
89
|
removeFile: (payload: RemoveFilePayload) => Promise<unknown>;
|
|
91
90
|
} : never : never;
|
|
92
91
|
export type CollectionFunctionsSDK<TSchema extends JsonSchema = JsonSchema> = SchemaWithId<TSchema> extends infer InferredDocument ? InferredDocument extends WithId<unknown> ? {
|
|
@@ -97,7 +96,7 @@ export type CollectionFunctionsSDK<TSchema extends JsonSchema = JsonSchema> = Sc
|
|
|
97
96
|
keepTempIds: true;
|
|
98
97
|
}>>) => Promise<WithACErrors<InsertReturnType<InferredDocument>>>;
|
|
99
98
|
remove: (payload: RemovePayload<InferredDocument>) => Promise<WithACErrors<RemoveReturnType<InferredDocument>>>;
|
|
100
|
-
removeAll: (payload: RemoveAllPayload) => Promise<unknown>;
|
|
99
|
+
removeAll: (payload: RemoveAllPayload<InferredDocument>) => Promise<unknown>;
|
|
101
100
|
removeFile: (payload: RemoveFilePayload) => Promise<unknown>;
|
|
102
101
|
} : never : never;
|
|
103
102
|
export {};
|
package/dist/property.d.ts
CHANGED
|
@@ -57,9 +57,7 @@ export type FixedObjectProperty = {
|
|
|
57
57
|
writable?: readonly string[];
|
|
58
58
|
};
|
|
59
59
|
export type VariableObjectProperty = {
|
|
60
|
-
|
|
61
|
-
} | {
|
|
62
|
-
additionalProperties: boolean | Property;
|
|
60
|
+
additionalProperties: true | Property;
|
|
63
61
|
};
|
|
64
62
|
export type ObjectProperty = (FixedObjectProperty | VariableObjectProperty) & {
|
|
65
63
|
type: 'object';
|
package/dist/resultSchemas.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare const endpointErrorSchema: <const THTTPStatus extends HTTPStatus[
|
|
|
51
51
|
};
|
|
52
52
|
readonly details: {
|
|
53
53
|
readonly type: "object";
|
|
54
|
-
readonly
|
|
54
|
+
readonly additionalProperties: true;
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
};
|
|
@@ -81,7 +81,7 @@ export declare const genericEndpointErrorSchema: () => {
|
|
|
81
81
|
};
|
|
82
82
|
readonly details: {
|
|
83
83
|
readonly type: "object";
|
|
84
|
-
readonly
|
|
84
|
+
readonly additionalProperties: true;
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
};
|
package/dist/resultSchemas.js
CHANGED
|
@@ -59,7 +59,7 @@ const endpointErrorSchema = (error) => {
|
|
|
59
59
|
},
|
|
60
60
|
details: {
|
|
61
61
|
type: 'object',
|
|
62
|
-
|
|
62
|
+
additionalProperties: true,
|
|
63
63
|
},
|
|
64
64
|
},
|
|
65
65
|
},
|
|
@@ -95,7 +95,7 @@ const genericEndpointErrorSchema = () => {
|
|
|
95
95
|
},
|
|
96
96
|
details: {
|
|
97
97
|
type: 'object',
|
|
98
|
-
|
|
98
|
+
additionalProperties: true,
|
|
99
99
|
},
|
|
100
100
|
},
|
|
101
101
|
},
|
package/dist/resultSchemas.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export const endpointErrorSchema = (error) => {
|
|
|
55
55
|
},
|
|
56
56
|
details: {
|
|
57
57
|
type: "object",
|
|
58
|
-
|
|
58
|
+
additionalProperties: true
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -90,7 +90,7 @@ export const genericEndpointErrorSchema = () => {
|
|
|
90
90
|
},
|
|
91
91
|
details: {
|
|
92
92
|
type: "object",
|
|
93
|
-
|
|
93
|
+
additionalProperties: true
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { ObjectId } from 'mongodb';
|
|
2
|
+
type Prettify<T> = {
|
|
3
|
+
[K in keyof T]: T[K];
|
|
4
|
+
} & {};
|
|
2
5
|
type Owned = {
|
|
3
6
|
owner?: Collections['user']['item'];
|
|
4
7
|
};
|
|
@@ -28,12 +31,12 @@ export type InferProperty<T> = T extends TestType<{
|
|
|
28
31
|
}> ? Schema<T & {
|
|
29
32
|
timestamps: false;
|
|
30
33
|
}> : T extends TestType<{
|
|
34
|
+
additionalProperties: true;
|
|
35
|
+
}> ? any : T extends TestType<{
|
|
31
36
|
additionalProperties: infer K;
|
|
32
37
|
}> ? {
|
|
33
38
|
[P: string]: InferProperty<K> | undefined;
|
|
34
39
|
} : T extends TestType<{
|
|
35
|
-
type: 'object';
|
|
36
|
-
}> ? any : T extends TestType<{
|
|
37
40
|
items: infer K;
|
|
38
41
|
}> ? InferProperty<K>[] : T extends TestType<{
|
|
39
42
|
getter: (doc: unknown) => infer K;
|
|
@@ -51,10 +54,10 @@ export type InferSchema<TSchema, TSchemaOptions extends SchemaOptions = {}> = Me
|
|
|
51
54
|
} ? Partial<MappedTypes> : TSchema extends {
|
|
52
55
|
required: infer InferredRequired;
|
|
53
56
|
} ? ExtractRequiredPropNames<InferredRequired> extends infer RequiredPropName ? Pick<MappedTypes, Extract<keyof MappedTypes, RequiredPropName>> extends infer RequiredProps ? RequiredProps & Partial<Exclude<MappedTypes, keyof RequiredProps>> : never : Partial<MappedTypes> : MappedTypes : never;
|
|
54
|
-
export type Schema<TSchema, TSchemaOptions extends SchemaOptions = {}> = CaseTimestamped<TSchema, CaseOwned<TSchema, InferSchema<TSchema, TSchemaOptions
|
|
55
|
-
export type SchemaWithId<TSchema, TSchemaOptions extends SchemaOptions = {}> = Schema<TSchema, TSchemaOptions> & {
|
|
57
|
+
export type Schema<TSchema, TSchemaOptions extends SchemaOptions = {}> = Prettify<CaseTimestamped<TSchema, CaseOwned<TSchema, InferSchema<TSchema, TSchemaOptions>>>>;
|
|
58
|
+
export type SchemaWithId<TSchema, TSchemaOptions extends SchemaOptions = {}> = Prettify<Schema<TSchema, TSchemaOptions> & {
|
|
56
59
|
_id: ObjectId;
|
|
57
|
-
}
|
|
60
|
+
}>;
|
|
58
61
|
export type InferProperties<TSchema> = TSchema extends readonly unknown[] ? TSchema extends readonly (infer SchemaOption)[] ? SchemaOption extends unknown ? SchemaOption extends {
|
|
59
62
|
$ref: infer K;
|
|
60
63
|
} | {
|
package/dist/security.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type CollectionProps<TPayload> = {
|
|
|
40
40
|
payload: TPayload;
|
|
41
41
|
};
|
|
42
42
|
export type CollectionReadPayload = {
|
|
43
|
-
filters: Record<string, unknown
|
|
43
|
+
filters: Record<string, unknown>;
|
|
44
44
|
sort?: QuerySort<unknown>;
|
|
45
45
|
limit?: number;
|
|
46
46
|
offset?: number;
|