@aeriajs/http 0.0.59 → 0.0.60
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/routing.d.ts +4 -21
- package/package.json +5 -5
package/dist/routing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RouteContext, GenericRequest, GenericResponse, RequestMethod, RouteUri, InferProperty, InferResponse, PackReferences, ContractWithRoles, ApiConfig,
|
|
1
|
+
import type { RouteContext, GenericRequest, GenericResponse, RequestMethod, RouteUri, InferProperty, InferResponse, PackReferences, ContractWithRoles, ApiConfig, RoleFromAccessCondition } from '@aeriajs/types';
|
|
2
2
|
export type RouterOptions = {
|
|
3
3
|
exhaust?: boolean;
|
|
4
4
|
base?: RouteUri;
|
|
@@ -8,7 +8,7 @@ export type Middleware = (context: RouteContext) => any;
|
|
|
8
8
|
export type RouteGroupOptions = {
|
|
9
9
|
base?: RouteUri;
|
|
10
10
|
};
|
|
11
|
-
type TypedContext<TContractWithRoles extends ContractWithRoles> = RouteContext<TContractWithRoles['roles']
|
|
11
|
+
type TypedContext<TContractWithRoles extends ContractWithRoles> = RouteContext<RoleFromAccessCondition<TContractWithRoles['roles']>> & {
|
|
12
12
|
request: Omit<RouteContext['request'], 'payload' | 'query'> & {
|
|
13
13
|
payload: TContractWithRoles extends {
|
|
14
14
|
payload: infer Payload;
|
|
@@ -20,11 +20,7 @@ type TypedContext<TContractWithRoles extends ContractWithRoles> = RouteContext<T
|
|
|
20
20
|
};
|
|
21
21
|
export type ProxiedRouter<TRouter> = TRouter & Record<RequestMethod, <const TContractWithRoles extends ContractWithRoles, TCallback extends (TContractWithRoles extends {
|
|
22
22
|
response: infer Response;
|
|
23
|
-
} ? InferResponse<Response> : any) extends infer Response ? TContractWithRoles
|
|
24
|
-
token: {
|
|
25
|
-
authenticated: true;
|
|
26
|
-
};
|
|
27
|
-
}) => Response : (context: TypedContext<TContractWithRoles>) => Response : never : never>(exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => ReturnType<typeof registerRoute>>;
|
|
23
|
+
} ? InferResponse<Response> : any) extends infer Response ? (context: TypedContext<TContractWithRoles>) => Response : never>(exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => ReturnType<typeof registerRoute>>;
|
|
28
24
|
export declare const matches: <TRequest extends GenericRequest>(req: TRequest, method: RequestMethod | RequestMethod[] | null, exp: string | RegExp, options: RouterOptions, config?: ApiConfig) => {
|
|
29
25
|
fragments: string[];
|
|
30
26
|
} | undefined;
|
|
@@ -33,20 +29,7 @@ export declare const wrapRouteExecution: (response: GenericResponse, cb: () => a
|
|
|
33
29
|
export declare const createRouter: (options?: Partial<RouterOptions>) => ProxiedRouter<{
|
|
34
30
|
route: <const TContractWithRoles extends ContractWithRoles, TCallback extends (TContractWithRoles extends {
|
|
35
31
|
response: infer Response;
|
|
36
|
-
} ? InferResponse<Response> : any) extends infer Response_1 ?
|
|
37
|
-
request: Omit<GenericRequest, "payload" | "query"> & {
|
|
38
|
-
payload: TContractWithRoles extends {
|
|
39
|
-
payload: infer Payload;
|
|
40
|
-
} ? PackReferences<InferProperty<Payload>> : any;
|
|
41
|
-
query: TContractWithRoles extends {
|
|
42
|
-
query: infer Query;
|
|
43
|
-
} ? InferProperty<Query> : any;
|
|
44
|
-
};
|
|
45
|
-
} & {
|
|
46
|
-
token: {
|
|
47
|
-
authenticated: true;
|
|
48
|
-
};
|
|
49
|
-
}) => Response_1 : (context: TypedContext<TContractWithRoles>) => Response_1 : never : never>(method: RequestMethod | RequestMethod[], exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => void;
|
|
32
|
+
} ? InferResponse<Response> : any) extends infer Response_1 ? (context: TypedContext<TContractWithRoles>) => Response_1 : never>(method: RequestMethod | RequestMethod[], exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => void;
|
|
50
33
|
routes: ((_: unknown, context: RouteContext, groupOptions?: RouteGroupOptions) => ReturnType<typeof registerRoute>)[];
|
|
51
34
|
routesMeta: RoutesMeta;
|
|
52
35
|
group: <TRouter extends {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.60",
|
|
4
4
|
"description": "## Installation",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@aeriajs/validation": "link:../validation"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@aeriajs/common": "^0.0.
|
|
32
|
-
"@aeriajs/entrypoint": "^0.0.
|
|
33
|
-
"@aeriajs/types": "^0.0.
|
|
34
|
-
"@aeriajs/validation": "^0.0.
|
|
31
|
+
"@aeriajs/common": "^0.0.52",
|
|
32
|
+
"@aeriajs/entrypoint": "^0.0.52",
|
|
33
|
+
"@aeriajs/types": "^0.0.49",
|
|
34
|
+
"@aeriajs/validation": "^0.0.55"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "echo skipping",
|