@aeriajs/http 0.0.106 → 0.0.108
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 +8 -8
- package/dist/routing.js +2 -2
- package/dist/routing.mjs +2 -2
- package/package.json +5 -5
package/dist/routing.d.ts
CHANGED
|
@@ -12,30 +12,30 @@ type TypedContext<TContractWithRoles extends ContractWithRoles> = Omit<RouteCont
|
|
|
12
12
|
request: Omit<RouteContext['request'], 'payload' | 'query'> & {
|
|
13
13
|
payload: TContractWithRoles extends {
|
|
14
14
|
payload: infer Payload;
|
|
15
|
-
} ? PackReferences<InferProperties<Payload>> :
|
|
15
|
+
} ? PackReferences<InferProperties<Payload>> : Record<string, unknown>;
|
|
16
16
|
query: TContractWithRoles extends {
|
|
17
17
|
query: infer Query;
|
|
18
|
-
} ? InferProperties<Query> :
|
|
18
|
+
} ? InferProperties<Query> : Record<string, unknown>;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
export type ProxiedRouter<TRouter> = TRouter & Record<typeof REQUEST_METHODS[number], <const TContractWithRoles extends ContractWithRoles, TCallback extends (TContractWithRoles extends {
|
|
22
22
|
response: infer Response;
|
|
23
|
-
} ? InferProperties<Response> extends infer InferredResponse ? InferredResponse | Promise<InferredResponse> : never :
|
|
23
|
+
} ? InferProperties<Response> extends infer InferredResponse ? InferredResponse | Promise<InferredResponse> : never : unknown) extends infer Response ? (context: TypedContext<TContractWithRoles>) => Response : never>(exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => ReturnType<typeof registerRoute>>;
|
|
24
24
|
export declare const matches: <TRequest extends GenericRequest>(req: TRequest, method: RequestMethod | RequestMethod[] | null, exp: string | RegExp, options?: RouterOptions, config?: ApiConfig) => {
|
|
25
25
|
fragments: string[];
|
|
26
26
|
} | undefined;
|
|
27
|
-
export declare const registerRoute: (context: RouteContext, method: RequestMethod | RequestMethod[], exp: RouteUri, cb: (context: RouteContext) =>
|
|
27
|
+
export declare const registerRoute: (context: RouteContext, method: RequestMethod | RequestMethod[], exp: RouteUri, cb: (context: RouteContext) => unknown, contract?: ContractWithRoles, options?: RouterOptions) => Promise<{} | null | undefined>;
|
|
28
28
|
export declare const wrapRouteExecution: (response: GenericResponse, cb: () => unknown | Promise<unknown>) => Promise<{} | undefined>;
|
|
29
29
|
export declare const createRouter: (options?: Partial<RouterOptions>) => ProxiedRouter<{
|
|
30
30
|
route: <const TContractWithRoles extends ContractWithRoles, TCallback extends (TContractWithRoles extends {
|
|
31
31
|
response: infer Response;
|
|
32
|
-
} ? InferProperties<Response> :
|
|
32
|
+
} ? InferProperties<Response> : unknown) extends infer Response ? (context: TypedContext<TContractWithRoles>) => Response : never>(method: RequestMethod | RequestMethod[], exp: RouteUri, cb: TCallback, contract?: TContractWithRoles) => void;
|
|
33
33
|
routes: ((_: unknown, context: RouteContext, groupOptions?: RouteGroupOptions) => ReturnType<typeof registerRoute>)[];
|
|
34
34
|
routesMeta: RoutesMeta;
|
|
35
35
|
group: <TRouter extends {
|
|
36
|
-
install: (context: RouteContext, options?: RouterOptions) =>
|
|
36
|
+
install: (context: RouteContext, options?: RouterOptions) => unknown;
|
|
37
37
|
routesMeta: RoutesMeta;
|
|
38
|
-
}>(exp: RouteUri, router: TRouter, middleware?: (context: RouteContext) =>
|
|
39
|
-
install: (_context: RouteContext, _options?: RouterOptions) =>
|
|
38
|
+
}>(exp: RouteUri, router: TRouter, middleware?: (context: RouteContext) => unknown) => void;
|
|
39
|
+
install: (_context: RouteContext, _options?: RouterOptions) => Promise<{} | {} | null | undefined>;
|
|
40
40
|
}>;
|
|
41
41
|
export {};
|
package/dist/routing.js
CHANGED
|
@@ -69,7 +69,7 @@ const registerRoute = async (context, method, exp, cb, contract, options = {}) =
|
|
|
69
69
|
if (match) {
|
|
70
70
|
if (context.request.headers['content-type'] === 'application/json') {
|
|
71
71
|
try {
|
|
72
|
-
context.request.payload = (0, common_1.deepMerge)((0, payload_js_1.safeJson)(context.request.body), context.request.payload
|
|
72
|
+
context.request.payload = (0, common_1.deepMerge)((0, payload_js_1.safeJson)(context.request.body), context.request.payload, {
|
|
73
73
|
arrays: false,
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -209,7 +209,7 @@ const createRouter = (options = {}) => {
|
|
|
209
209
|
routes,
|
|
210
210
|
routesMeta,
|
|
211
211
|
group,
|
|
212
|
-
install: (_context, _options) => {
|
|
212
|
+
install: async (_context, _options) => {
|
|
213
213
|
return {};
|
|
214
214
|
},
|
|
215
215
|
};
|
package/dist/routing.mjs
CHANGED
|
@@ -65,7 +65,7 @@ export const registerRoute = async (context, method, exp, cb, contract, options
|
|
|
65
65
|
try {
|
|
66
66
|
context.request.payload = deepMerge(
|
|
67
67
|
safeJson(context.request.body),
|
|
68
|
-
context.request.payload
|
|
68
|
+
context.request.payload,
|
|
69
69
|
{
|
|
70
70
|
arrays: false
|
|
71
71
|
}
|
|
@@ -204,7 +204,7 @@ export const createRouter = (options = {}) => {
|
|
|
204
204
|
routes,
|
|
205
205
|
routesMeta,
|
|
206
206
|
group,
|
|
207
|
-
install: (_context, _options) => {
|
|
207
|
+
install: async (_context, _options) => {
|
|
208
208
|
return {};
|
|
209
209
|
}
|
|
210
210
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/http",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.108",
|
|
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.95",
|
|
32
|
+
"@aeriajs/entrypoint": "^0.0.97",
|
|
33
|
+
"@aeriajs/types": "^0.0.81",
|
|
34
|
+
"@aeriajs/validation": "^0.0.98"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "vitest run",
|