@aeriajs/types 0.0.16 → 0.0.18
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/context.d.ts +1 -1
- package/dist/http.d.ts +1 -1
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { Collection as MongoCollection } from 'mongodb';
|
|
|
2
2
|
import type { GenericRequest, GenericResponse } from './http';
|
|
3
3
|
import type { Description, PackReferences, SchemaWithId, FunctionPath, DecodedToken, ApiConfig, CollectionDocument, CollectionFunctions } from '.';
|
|
4
4
|
export type CollectionModel<TDescription extends Description> = MongoCollection<Omit<PackReferences<SchemaWithId<TDescription>>, '_id'>>;
|
|
5
|
-
type OmitContextParameter<TFunction> = TFunction extends (payload: infer Payload, context: Context, ...args: infer Rest) => infer Return ? (payload: Payload, ...args: Rest) => Return : never;
|
|
5
|
+
type OmitContextParameter<TFunction> = TFunction extends () => any ? TFunction : TFunction extends (payload: infer Payload, context: Context, ...args: infer Rest) => infer Return ? (payload: Payload, ...args: Rest) => Return : never;
|
|
6
6
|
type RestParameters<TFunction> = TFunction extends (payload: any, context: Context, ...args: infer Rest) => any ? Rest : never;
|
|
7
7
|
type UnionFunctions<TFunctions, TSchema extends CollectionDocument<any>> = {
|
|
8
8
|
[P in keyof TFunctions]: (P extends keyof CollectionFunctions<any> ? CollectionFunctions<TSchema>[P] extends infer CollFunction ? CollFunction extends (...args: any[]) => any ? Extract<undefined, Parameters<CollFunction>[0]> extends never ? (payload: Parameters<CollFunction>[0], ...args: RestParameters<TFunctions[P]>) => ReturnType<CollFunction> : (payload?: Parameters<CollFunction>[0], ...args: RestParameters<TFunctions[P]>) => ReturnType<CollFunction> : never : never : OmitContextParameter<TFunctions[P]>) extends (...args: infer Args) => infer Return ? Return extends Promise<any> ? (...args: Args) => Return : (...args: Args) => Promise<Return> : never;
|
package/dist/http.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type RequestMethod = (typeof REQUEST_METHODS)[number];
|
|
|
6
6
|
export type GenericRequest = {
|
|
7
7
|
url: string;
|
|
8
8
|
method: RequestMethod;
|
|
9
|
-
headers: Record<string,
|
|
9
|
+
headers: Record<string, string | string[] | undefined>;
|
|
10
10
|
body?: string;
|
|
11
11
|
query: Record<string, any>;
|
|
12
12
|
payload: Record<string, any>;
|