@duplojs/http 0.6.2 → 0.7.1
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/client/getBody.cjs +1 -1
- package/dist/client/getBody.mjs +1 -1
- package/dist/client/hooks.d.ts +1 -25
- package/dist/client/httpClient.d.ts +29 -25
- package/dist/client/promiseRequest.cjs +3 -0
- package/dist/client/promiseRequest.d.ts +31 -39
- package/dist/client/promiseRequest.mjs +4 -1
- package/dist/client/queryToString.cjs +2 -2
- package/dist/client/queryToString.mjs +2 -2
- package/dist/client/types/clientRequestParams.d.ts +9 -3
- package/dist/client/types/clientResponse.d.ts +6 -6
- package/dist/client/types/hooks.d.ts +25 -0
- package/dist/client/types/index.cjs +2 -0
- package/dist/client/types/index.d.ts +2 -0
- package/dist/client/types/index.mjs +2 -0
- package/dist/client/types/promiseRequestParams.cjs +2 -0
- package/dist/client/types/promiseRequestParams.d.ts +9 -0
- package/dist/client/types/promiseRequestParams.mjs +1 -0
- package/dist/client/types/serverRoute.d.ts +28 -4
- package/dist/client/unexpectedResponseError.d.ts +1 -2
- package/dist/core/builders/preflight/route.cjs +1 -0
- package/dist/core/builders/preflight/route.d.ts +4 -2
- package/dist/core/builders/preflight/route.mjs +1 -0
- package/dist/core/builders/route/builder.cjs +1 -0
- package/dist/core/builders/route/builder.d.ts +4 -2
- package/dist/core/builders/route/builder.mjs +1 -0
- package/dist/core/clean/newType.d.ts +1 -1
- package/dist/core/clean/primitive.d.ts +1 -1
- package/dist/core/defaultHooks/index.cjs +50 -0
- package/dist/core/defaultHooks/index.d.ts +5 -0
- package/dist/core/defaultHooks/index.mjs +48 -0
- package/dist/{interfaces/node/error → core/errors}/bodyParseWrongChunkReceived.cjs +6 -4
- package/dist/core/errors/bodyParseWrongChunkReceived.d.ts +9 -0
- package/dist/core/errors/bodyParseWrongChunkReceived.mjs +14 -0
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.cjs +2 -2
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.d.ts +2 -2
- package/dist/{interfaces/node/error → core/errors}/bodySizeExceedsLimitError.mjs +2 -2
- package/dist/{interfaces/node/error → core/errors}/index.cjs +6 -4
- package/dist/{interfaces/node/error → core/errors}/index.d.ts +3 -2
- package/dist/{interfaces/node/error → core/errors}/index.mjs +3 -2
- package/dist/core/errors/parseJsonError.cjs +16 -0
- package/dist/core/errors/parseJsonError.d.ts +9 -0
- package/dist/core/errors/parseJsonError.mjs +14 -0
- package/dist/core/errors/wrongContentTypeError.cjs +16 -0
- package/dist/core/errors/wrongContentTypeError.d.ts +9 -0
- package/dist/core/errors/wrongContentTypeError.mjs +14 -0
- package/dist/core/functionsBuilders/route/create.d.ts +2 -2
- package/dist/core/functionsBuilders/route/default.cjs +0 -11
- package/dist/core/functionsBuilders/route/default.mjs +0 -11
- package/dist/core/functionsBuilders/route/hook.d.ts +2 -2
- package/dist/core/functionsBuilders/steps/create.d.ts +2 -2
- package/dist/core/functionsBuilders/steps/defaults/cutStep.cjs +15 -18
- package/dist/core/functionsBuilders/steps/defaults/cutStep.mjs +15 -18
- package/dist/core/functionsBuilders/steps/defaults/extractStep.cjs +43 -19
- package/dist/core/functionsBuilders/steps/defaults/extractStep.d.ts +2 -1
- package/dist/core/functionsBuilders/steps/defaults/extractStep.mjs +44 -20
- package/dist/core/functionsBuilders/steps/defaults/handlerStep.cjs +14 -8
- package/dist/core/functionsBuilders/steps/defaults/handlerStep.mjs +14 -8
- package/dist/core/hub/defaultBodyController.cjs +8 -0
- package/dist/core/hub/defaultBodyController.d.ts +1 -0
- package/dist/core/hub/defaultBodyController.mjs +6 -0
- package/dist/core/hub/hooks.cjs +3 -1
- package/dist/core/hub/hooks.d.ts +2 -3
- package/dist/core/hub/hooks.mjs +3 -1
- package/dist/core/hub/index.cjs +101 -127
- package/dist/core/hub/index.d.ts +33 -34
- package/dist/core/hub/index.mjs +100 -128
- package/dist/core/implementHttpServer.cjs +5 -5
- package/dist/core/implementHttpServer.d.ts +2 -1
- package/dist/core/implementHttpServer.mjs +5 -5
- package/dist/core/index.cjs +34 -10
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.mjs +13 -2
- package/dist/core/request/bodyController/base.cjs +36 -0
- package/dist/core/request/bodyController/base.d.ts +28 -0
- package/dist/core/request/bodyController/base.mjs +34 -0
- package/dist/core/request/bodyController/formData.cjs +28 -0
- package/dist/core/request/bodyController/formData.d.ts +22 -0
- package/dist/core/request/bodyController/formData.mjs +25 -0
- package/dist/core/request/bodyController/index.cjs +13 -0
- package/dist/core/request/bodyController/index.d.ts +3 -0
- package/dist/core/request/bodyController/index.mjs +3 -0
- package/dist/core/request/bodyController/text.cjs +14 -0
- package/dist/core/request/bodyController/text.d.ts +10 -0
- package/dist/core/request/bodyController/text.mjs +11 -0
- package/dist/core/{request.cjs → request/index.cjs} +21 -3
- package/dist/core/{request.d.ts → request/index.d.ts} +10 -3
- package/dist/core/request/index.mjs +50 -0
- package/dist/core/response/contract.d.ts +1 -1
- package/dist/core/route/hooks.d.ts +0 -2
- package/dist/core/route/index.d.ts +2 -1
- package/dist/core/router/index.cjs +27 -8
- package/dist/core/router/index.d.ts +2 -1
- package/dist/core/router/index.mjs +28 -10
- package/dist/core/router/notFoundBodyReaderImplementationError.cjs +16 -0
- package/dist/core/router/notFoundBodyReaderImplementationError.d.ts +11 -0
- package/dist/core/router/notFoundBodyReaderImplementationError.mjs +14 -0
- package/dist/core/router/types/buildedRouter.d.ts +3 -3
- package/dist/core/steps/extract.d.ts +3 -1
- package/dist/core/steps/types/steps.d.ts +1 -3
- package/dist/core/types/hosts.cjs +2 -0
- package/dist/core/types/hosts.d.ts +4 -0
- package/dist/core/types/hosts.mjs +1 -0
- package/dist/core/types/httpServerParams.cjs +2 -0
- package/dist/core/types/httpServerParams.d.ts +11 -0
- package/dist/core/types/httpServerParams.mjs +1 -0
- package/dist/core/types/index.cjs +2 -0
- package/dist/core/types/index.d.ts +2 -0
- package/dist/core/types/index.mjs +2 -0
- package/dist/interfaces/bun/types/request.cjs +1 -1
- package/dist/interfaces/bun/types/request.mjs +1 -1
- package/dist/interfaces/node/bodyReaders/formData/error.cjs +14 -0
- package/dist/interfaces/node/bodyReaders/formData/error.d.ts +8 -0
- package/dist/interfaces/node/bodyReaders/formData/error.mjs +12 -0
- package/dist/interfaces/node/bodyReaders/formData/index.cjs +94 -0
- package/dist/interfaces/node/bodyReaders/formData/index.d.ts +4 -0
- package/dist/interfaces/node/bodyReaders/formData/index.mjs +90 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.cjs +175 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.d.ts +21 -0
- package/dist/interfaces/node/bodyReaders/formData/readRequestFormData.mjs +173 -0
- package/dist/interfaces/node/bodyReaders/index.cjs +9 -0
- package/dist/interfaces/node/bodyReaders/index.d.ts +2 -0
- package/dist/interfaces/node/bodyReaders/index.mjs +2 -0
- package/dist/interfaces/node/bodyReaders/text/index.cjs +41 -0
- package/dist/interfaces/node/bodyReaders/text/index.d.ts +3 -0
- package/dist/interfaces/node/bodyReaders/text/index.mjs +38 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.cjs +37 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.d.ts +6 -0
- package/dist/interfaces/node/bodyReaders/text/readRequestText.mjs +35 -0
- package/dist/interfaces/node/createHttpServer.cjs +13 -5
- package/dist/interfaces/node/createHttpServer.d.ts +13 -12
- package/dist/interfaces/node/createHttpServer.mjs +13 -5
- package/dist/interfaces/node/hooks/index.cjs +47 -0
- package/dist/interfaces/node/hooks/index.d.ts +5 -0
- package/dist/interfaces/node/hooks/index.mjs +45 -0
- package/dist/interfaces/node/index.cjs +13 -9
- package/dist/interfaces/node/index.d.ts +1 -1
- package/dist/interfaces/node/index.mjs +7 -5
- package/dist/interfaces/node/types/index.cjs +0 -1
- package/dist/interfaces/node/types/index.d.ts +0 -1
- package/dist/interfaces/node/types/index.mjs +0 -1
- package/dist/interfaces/node/types/request.cjs +1 -1
- package/dist/interfaces/node/types/request.mjs +1 -1
- package/dist/plugins/codeGenerator/index.cjs +2 -0
- package/dist/plugins/codeGenerator/index.mjs +1 -1
- package/dist/plugins/codeGenerator/plugin.cjs +11 -4
- package/dist/plugins/codeGenerator/plugin.mjs +12 -5
- package/dist/plugins/codeGenerator/routeToDataParser.cjs +24 -1
- package/dist/plugins/codeGenerator/routeToDataParser.d.ts +34 -0
- package/dist/plugins/codeGenerator/routeToDataParser.mjs +24 -3
- package/dist/plugins/codeGenerator/typescriptTransfomer.cjs +28 -0
- package/dist/plugins/codeGenerator/typescriptTransfomer.d.ts +4 -0
- package/dist/plugins/codeGenerator/typescriptTransfomer.mjs +24 -0
- package/dist/plugins/openApiGenerator/makeOpenApiRoute.d.ts +3 -0
- package/dist/plugins/openApiGenerator/plugin.cjs +3 -3
- package/dist/plugins/openApiGenerator/plugin.mjs +4 -4
- package/dist/plugins/openApiGenerator/routeToOpenApi.cjs +16 -6
- package/dist/plugins/openApiGenerator/routeToOpenApi.d.ts +10 -1
- package/dist/plugins/openApiGenerator/routeToOpenApi.mjs +16 -6
- package/dist/plugins/openApiGenerator/types/entrypoint.d.ts +6 -1
- package/dist/plugins/openApiGenerator/types/openApiMethod.d.ts +1 -1
- package/package.json +5 -6
- package/dist/core/request.mjs +0 -32
- package/dist/interfaces/node/error/bodyParseUnknownError.cjs +0 -16
- package/dist/interfaces/node/error/bodyParseUnknownError.d.ts +0 -9
- package/dist/interfaces/node/error/bodyParseUnknownError.mjs +0 -14
- package/dist/interfaces/node/error/bodyParseWrongChunkReceived.d.ts +0 -8
- package/dist/interfaces/node/error/bodyParseWrongChunkReceived.mjs +0 -12
- package/dist/interfaces/node/hooks.cjs +0 -126
- package/dist/interfaces/node/hooks.d.ts +0 -8
- package/dist/interfaces/node/hooks.mjs +0 -124
- package/dist/interfaces/node/types/host.d.ts +0 -4
- /package/dist/{interfaces/node/types/host.cjs → client/types/hooks.cjs} +0 -0
- /package/dist/{interfaces/node/types/host.mjs → client/types/hooks.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../../steps/index.mjs';
|
|
2
|
-
import { unwrap, E, A, O,
|
|
2
|
+
import { unwrap, E, forward, A, O, pipe, P, DP, isType, justReturn, innerPipe } from '@duplojs/utils';
|
|
3
3
|
import '../../../response/index.mjs';
|
|
4
4
|
import { createStepFunctionBuilder } from '../create.mjs';
|
|
5
5
|
import { extractStepKind } from '../../../steps/extract.mjs';
|
|
@@ -8,32 +8,56 @@ import { PredictedResponse } from '../../../response/predicted.mjs';
|
|
|
8
8
|
const defaultExtractStepFunctionBuilder = createStepFunctionBuilder(extractStepKind.has, (step, { success, environment, defaultExtractContract }) => {
|
|
9
9
|
const { shape, responseContract: stepResponseContract, } = step.definition;
|
|
10
10
|
const responseContract = stepResponseContract ?? defaultExtractContract;
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
?
|
|
14
|
-
: undefined);
|
|
15
|
-
|
|
16
|
-
? response.setHeader("extract-key", `request.${key}`)
|
|
17
|
-
: response.setHeader("extract-key", `request.${key}.${subKey}`);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
function createExtractor(parser, key, subKey) {
|
|
12
|
+
const createResponse = environment === "DEV"
|
|
13
|
+
? (result) => new PredictedResponse(responseContract.code, responseContract.information, result)
|
|
14
|
+
: () => new PredictedResponse(responseContract.code, responseContract.information, undefined);
|
|
15
|
+
const setHeader = subKey === undefined || key === "body"
|
|
16
|
+
? (response) => response.setHeader("extract-key", `request.${key}`)
|
|
17
|
+
: (response) => response.setHeader("extract-key", `request.${key}.${subKey}`);
|
|
18
|
+
const getResponse = (result) => setHeader(createResponse(result));
|
|
19
|
+
const treatResult = (result, floor) => E.isLeft(result)
|
|
20
|
+
? getResponse(unwrap(result))
|
|
21
|
+
: {
|
|
22
|
+
...floor,
|
|
23
|
+
[subKey ?? key]: unwrap(result),
|
|
24
|
+
};
|
|
25
|
+
const getValue = typeof subKey === "string"
|
|
26
|
+
? (value) => value?.[subKey]
|
|
27
|
+
: forward;
|
|
28
|
+
if (key === "body") {
|
|
29
|
+
const parseFunction = parser.isAsynchronous()
|
|
30
|
+
? parser.asyncParse
|
|
31
|
+
: parser.parse;
|
|
32
|
+
return async (request, floor) => {
|
|
33
|
+
const bodyResult = await request.getBody();
|
|
34
|
+
if (E.isLeft(bodyResult)) {
|
|
35
|
+
return treatResult(bodyResult, floor);
|
|
36
|
+
}
|
|
37
|
+
const result = await parseFunction(getValue(unwrap(bodyResult)));
|
|
38
|
+
return treatResult(result, floor);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (parser.isAsynchronous()) {
|
|
42
|
+
const parseFunction = parser.asyncParse;
|
|
43
|
+
return async (request, floor) => {
|
|
44
|
+
const result = await parseFunction(getValue(request[key]));
|
|
45
|
+
return treatResult(result, floor);
|
|
46
|
+
};
|
|
22
47
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
48
|
+
const parseFunction = parser.parse;
|
|
49
|
+
return (request, floor) => {
|
|
50
|
+
const result = parseFunction(getValue(request[key]));
|
|
51
|
+
return treatResult(result, floor);
|
|
26
52
|
};
|
|
27
53
|
}
|
|
28
|
-
const extractors = A.reduce(O.entries(shape), A.reduceFrom([]), ({ lastValue, element: [key, value], next }) =>
|
|
29
|
-
? A.push(lastValue, (request, floor) => treatResult(value.parse(request[key]), floor, key))
|
|
30
|
-
: pipe(value, P.when(isType("undefined"), justReturn(lastValue)), P.otherwise(innerPipe(O.entries, A.map(([subKey, subValue]) => ((request, floor) => treatResult(subValue.parse(request[key]?.[subKey]), floor, key, subKey))), (subExtractor) => A.concat(lastValue, subExtractor))))));
|
|
54
|
+
const extractors = A.reduce(O.entries(shape), A.reduceFrom([]), ({ lastValue, element: [key, value], next, }) => pipe(value, P.when(DP.dataParserKind.has, (value) => A.push(lastValue, createExtractor(value, key, undefined))), P.otherwise((value) => pipe(value, P.when(isType("undefined"), justReturn(lastValue)), P.otherwise(innerPipe(O.entries, A.map(([subKey, subValue]) => createExtractor(subValue, key, subKey)), (subExtractor) => A.concat(lastValue, subExtractor))))), next));
|
|
31
55
|
return success({
|
|
32
|
-
buildedFunction: (request, floor) => {
|
|
56
|
+
buildedFunction: async (request, floor) => {
|
|
33
57
|
let newFloor = floor;
|
|
34
58
|
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
35
59
|
for (let index = 0; index < extractors.length; index++) {
|
|
36
|
-
const result = extractors[index](request, newFloor);
|
|
60
|
+
const result = await extractors[index](request, newFloor);
|
|
37
61
|
if (result instanceof PredictedResponse) {
|
|
38
62
|
return result;
|
|
39
63
|
}
|
|
@@ -18,17 +18,23 @@ const defaultHandlerStepFunctionBuilder = create.createStepFunctionBuilder(handl
|
|
|
18
18
|
if (!currentContract) {
|
|
19
19
|
throw new contract.ResponseContract.Error(information);
|
|
20
20
|
}
|
|
21
|
-
const result = currentContract.body.parse(body);
|
|
22
|
-
if (utils.E.isLeft(result)) {
|
|
23
|
-
throw new contract.ResponseContract.Error(information, utils.unwrap(result));
|
|
24
|
-
}
|
|
25
21
|
return new predicted.PredictedResponse(currentContract.code, currentContract.information, body);
|
|
26
22
|
};
|
|
27
23
|
return success({
|
|
28
|
-
buildedFunction: (request, floor) =>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
buildedFunction: async (request, floor) => {
|
|
25
|
+
const predictedResponse = await handlerFunction(floor, {
|
|
26
|
+
request,
|
|
27
|
+
response,
|
|
28
|
+
});
|
|
29
|
+
const currentContract = preparedContractResponse[predictedResponse.information];
|
|
30
|
+
const result = currentContract.body.isAsynchronous()
|
|
31
|
+
? await currentContract.body.asyncParse(predictedResponse.body)
|
|
32
|
+
: currentContract.body.parse(predictedResponse.body);
|
|
33
|
+
if (utils.E.isLeft(result)) {
|
|
34
|
+
throw new contract.ResponseContract.Error(predictedResponse.information, utils.unwrap(result));
|
|
35
|
+
}
|
|
36
|
+
return predictedResponse;
|
|
37
|
+
},
|
|
32
38
|
hooksRouteLifeCycle: [],
|
|
33
39
|
});
|
|
34
40
|
});
|
|
@@ -16,17 +16,23 @@ const defaultHandlerStepFunctionBuilder = createStepFunctionBuilder(handlerStepK
|
|
|
16
16
|
if (!currentContract) {
|
|
17
17
|
throw new ResponseContract.Error(information);
|
|
18
18
|
}
|
|
19
|
-
const result = currentContract.body.parse(body);
|
|
20
|
-
if (E.isLeft(result)) {
|
|
21
|
-
throw new ResponseContract.Error(information, unwrap(result));
|
|
22
|
-
}
|
|
23
19
|
return new PredictedResponse(currentContract.code, currentContract.information, body);
|
|
24
20
|
};
|
|
25
21
|
return success({
|
|
26
|
-
buildedFunction: (request, floor) =>
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
buildedFunction: async (request, floor) => {
|
|
23
|
+
const predictedResponse = await handlerFunction(floor, {
|
|
24
|
+
request,
|
|
25
|
+
response,
|
|
26
|
+
});
|
|
27
|
+
const currentContract = preparedContractResponse[predictedResponse.information];
|
|
28
|
+
const result = currentContract.body.isAsynchronous()
|
|
29
|
+
? await currentContract.body.asyncParse(predictedResponse.body)
|
|
30
|
+
: currentContract.body.parse(predictedResponse.body);
|
|
31
|
+
if (E.isLeft(result)) {
|
|
32
|
+
throw new ResponseContract.Error(predictedResponse.information, unwrap(result));
|
|
33
|
+
}
|
|
34
|
+
return predictedResponse;
|
|
35
|
+
},
|
|
30
36
|
hooksRouteLifeCycle: [],
|
|
31
37
|
});
|
|
32
38
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultBodyController: import("../request").BodyController<"text", import("../request").TextBodyReaderParams>;
|
package/dist/core/hub/hooks.cjs
CHANGED
|
@@ -9,7 +9,9 @@ async function launchHookBeforeBuildRoute(hooks, route) {
|
|
|
9
9
|
return utils.G.asyncReduce(hooks, utils.G.reduceFrom(route), async ({ element: hook, lastValue, next, }) => next(await hook(lastValue)));
|
|
10
10
|
}
|
|
11
11
|
async function launchHookServer(hooks, hub, httpServerParams) {
|
|
12
|
-
|
|
12
|
+
for (const hook of hooks) {
|
|
13
|
+
await hook(hub, httpServerParams);
|
|
14
|
+
}
|
|
13
15
|
}
|
|
14
16
|
const hookExit = hookServerExitKind.setTo({});
|
|
15
17
|
const hookNext = hookServerNextKind.setTo({});
|
package/dist/core/hub/hooks.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type Route } from "../route";
|
|
|
2
2
|
import { type EscapeVoid, type Kind, type MaybePromise } from "@duplojs/utils";
|
|
3
3
|
import { type Hub } from ".";
|
|
4
4
|
import { type RouterInitializationData } from "../router";
|
|
5
|
+
import { type HttpServerParams } from "../types";
|
|
5
6
|
export declare const hookServerExitKind: import("@duplojs/utils").KindHandler<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/server-hook-exit", unknown>>;
|
|
6
7
|
export interface ServerHookExit extends Kind<typeof hookServerExitKind.definition> {
|
|
7
8
|
}
|
|
@@ -10,12 +11,10 @@ export interface ServerHookNext extends Kind<typeof hookServerNextKind.definitio
|
|
|
10
11
|
}
|
|
11
12
|
export type HookBeforeBuildRoute = (route: Route) => MaybePromise<Route>;
|
|
12
13
|
export declare function launchHookBeforeBuildRoute(hooks: Iterable<HookBeforeBuildRoute>, route: Route): Promise<Route<import("../route").RouteDefinition>>;
|
|
13
|
-
export interface HttpServerParams {
|
|
14
|
-
}
|
|
15
14
|
export type HookBeforeServerBuildRoutes = (hub: Hub, httpServerParams: HttpServerParams) => MaybePromise<Hub | EscapeVoid>;
|
|
16
15
|
export type HookBeforeStartServer = (hub: Hub, httpServerParams: HttpServerParams) => MaybePromise<Hub | EscapeVoid>;
|
|
17
16
|
export type HookAfterStartServer = (hub: Hub, httpServerParams: HttpServerParams) => MaybePromise<Hub | EscapeVoid>;
|
|
18
|
-
export declare function launchHookServer(hooks: Iterable<HookBeforeStartServer | HookAfterStartServer | HookBeforeServerBuildRoutes>, hub: Hub, httpServerParams: HttpServerParams): Promise<
|
|
17
|
+
export declare function launchHookServer(hooks: Iterable<HookBeforeStartServer | HookAfterStartServer | HookBeforeServerBuildRoutes>, hub: Hub, httpServerParams: HttpServerParams): Promise<void>;
|
|
19
18
|
export interface HttpServerErrorParams {
|
|
20
19
|
readonly error: unknown;
|
|
21
20
|
next(): ServerHookNext;
|
package/dist/core/hub/hooks.mjs
CHANGED
|
@@ -7,7 +7,9 @@ async function launchHookBeforeBuildRoute(hooks, route) {
|
|
|
7
7
|
return G.asyncReduce(hooks, G.reduceFrom(route), async ({ element: hook, lastValue, next, }) => next(await hook(lastValue)));
|
|
8
8
|
}
|
|
9
9
|
async function launchHookServer(hooks, hub, httpServerParams) {
|
|
10
|
-
|
|
10
|
+
for (const hook of hooks) {
|
|
11
|
+
await hook(hub, httpServerParams);
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
const hookExit = hookServerExitKind.setTo({});
|
|
13
15
|
const hookNext = hookServerNextKind.setTo({});
|
package/dist/core/hub/index.cjs
CHANGED
|
@@ -1,146 +1,119 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var kind = require('../kind.cjs');
|
|
4
|
-
var index = require('../route/index.cjs');
|
|
4
|
+
var index$1 = require('../route/index.cjs');
|
|
5
5
|
var utils = require('@duplojs/utils');
|
|
6
6
|
require('../steps/index.cjs');
|
|
7
|
-
var
|
|
7
|
+
var index = require('../request/index.cjs');
|
|
8
8
|
var defaultNotfoundHandler = require('./defaultNotfoundHandler.cjs');
|
|
9
9
|
var defaultExtractContract = require('./defaultExtractContract.cjs');
|
|
10
|
+
var defaultBodyController = require('./defaultBodyController.cjs');
|
|
10
11
|
var hooks = require('./hooks.cjs');
|
|
11
12
|
var handler = require('../steps/handler.cjs');
|
|
12
13
|
|
|
13
14
|
const hubKind = kind.createCoreLibKind("hub");
|
|
15
|
+
class Hub extends utils.kindHeritage("hub", kind.createCoreLibKind("hub")) {
|
|
16
|
+
config;
|
|
17
|
+
plugins = [];
|
|
18
|
+
hooksRouteLifeCycle = [];
|
|
19
|
+
hooksHubLifeCycle = [];
|
|
20
|
+
routes = new Set();
|
|
21
|
+
routeFunctionBuilders = [];
|
|
22
|
+
stepFunctionBuilders = [];
|
|
23
|
+
bodyReaderImplementations = [];
|
|
24
|
+
classRequest = index.Request;
|
|
25
|
+
notfoundHandler = defaultNotfoundHandler.defaultNotfoundHandler;
|
|
26
|
+
defaultExtractContract = defaultExtractContract.defaultExtractContract;
|
|
27
|
+
defaultBodyController = defaultBodyController.defaultBodyController;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
super({});
|
|
30
|
+
this.config = config;
|
|
31
|
+
}
|
|
32
|
+
register(routes) {
|
|
33
|
+
utils.pipe(routes, utils.P.when(index$1.routeKind.has, utils.A.coalescing), utils.P.when(utils.isType("iterable"), utils.A.from), utils.P.otherwise(utils.O.values), utils.A.map((route) => this.routes.add(route)));
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
addRouteFunctionBuilder(functionBuilder) {
|
|
37
|
+
this.routeFunctionBuilders.push(...utils.A.coalescing(functionBuilder));
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
addStepFunctionBuilder(functionBuilder) {
|
|
41
|
+
this.stepFunctionBuilders.push(...utils.A.coalescing(functionBuilder));
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
addRouteHooks(hook) {
|
|
45
|
+
this.hooksRouteLifeCycle.push(...utils.A.coalescing(hook));
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
addHubHooks(hook) {
|
|
49
|
+
this.hooksHubLifeCycle.push(...utils.A.coalescing(hook));
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
addBodyReaderImplementation(bodyReaderImplementation) {
|
|
53
|
+
this.bodyReaderImplementations.push(...utils.A.coalescing(bodyReaderImplementation));
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
plug(plugin) {
|
|
57
|
+
const pluginResult = typeof plugin === "function"
|
|
58
|
+
? plugin(this)
|
|
59
|
+
: plugin;
|
|
60
|
+
if (pluginResult.bodyReaderImplementations) {
|
|
61
|
+
this.addBodyReaderImplementation(pluginResult.bodyReaderImplementations);
|
|
62
|
+
}
|
|
63
|
+
if (pluginResult.hooksHubLifeCycle) {
|
|
64
|
+
this.addHubHooks(pluginResult.hooksHubLifeCycle);
|
|
65
|
+
}
|
|
66
|
+
if (pluginResult.hooksRouteLifeCycle) {
|
|
67
|
+
this.addRouteHooks(pluginResult.hooksRouteLifeCycle);
|
|
68
|
+
}
|
|
69
|
+
if (pluginResult.routeFunctionBuilders) {
|
|
70
|
+
this.addRouteFunctionBuilder(pluginResult.routeFunctionBuilders);
|
|
71
|
+
}
|
|
72
|
+
if (pluginResult.routes) {
|
|
73
|
+
this.register(pluginResult.routes);
|
|
74
|
+
}
|
|
75
|
+
if (pluginResult.stepFunctionBuilders) {
|
|
76
|
+
this.addStepFunctionBuilder(pluginResult.stepFunctionBuilders);
|
|
77
|
+
}
|
|
78
|
+
this.plugins.push(pluginResult);
|
|
79
|
+
return this;
|
|
80
|
+
}
|
|
81
|
+
setNotfoundHandler(responseContract, theFunction) {
|
|
82
|
+
this.notfoundHandler = handler.createHandlerStep({
|
|
83
|
+
responseContract,
|
|
84
|
+
theFunction: (floor, params) => theFunction(params),
|
|
85
|
+
metadata: [],
|
|
86
|
+
});
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
setDefaultExtractContract(responseContract) {
|
|
90
|
+
this.defaultExtractContract = responseContract;
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
aggregatesHooksHubLifeCycle(hookName) {
|
|
94
|
+
return utils.A.flatMap(this.hooksHubLifeCycle, (hooks) => hooks[hookName] ?? []);
|
|
95
|
+
}
|
|
96
|
+
setDefaultBodyController(bodyController) {
|
|
97
|
+
this.defaultBodyController = bodyController;
|
|
98
|
+
return this;
|
|
99
|
+
}
|
|
100
|
+
aggregatesHooksRouteLifeCycle(hookName) {
|
|
101
|
+
return utils.A.flatMap(this.hooksRouteLifeCycle, (hooks) => hooks[hookName] ?? []);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
static "new"(config) {
|
|
107
|
+
return new Hub(config);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
14
110
|
function createHub(config) {
|
|
15
|
-
return
|
|
16
|
-
...hubKind.addTo({}),
|
|
17
|
-
config,
|
|
18
|
-
plugins: [],
|
|
19
|
-
hooksHubLifeCycle: [],
|
|
20
|
-
hooksRouteLifeCycle: [],
|
|
21
|
-
routeFunctionBuilders: [],
|
|
22
|
-
routes: [],
|
|
23
|
-
stepFunctionBuilders: [],
|
|
24
|
-
notfoundHandler: defaultNotfoundHandler.defaultNotfoundHandler,
|
|
25
|
-
defaultExtractContract: defaultExtractContract.defaultExtractContract,
|
|
26
|
-
classRequest: request.Request,
|
|
27
|
-
addHubHooks(hook) {
|
|
28
|
-
return {
|
|
29
|
-
...this,
|
|
30
|
-
hooksHubLifeCycle: utils.A.concat(this.hooksHubLifeCycle, utils.A.coalescing(hook)),
|
|
31
|
-
};
|
|
32
|
-
},
|
|
33
|
-
addRouteFunctionBuilder(functionBuilder) {
|
|
34
|
-
return {
|
|
35
|
-
...this,
|
|
36
|
-
routeFunctionBuilders: utils.A.concat(this.routeFunctionBuilders, utils.A.coalescing(functionBuilder)),
|
|
37
|
-
};
|
|
38
|
-
},
|
|
39
|
-
addRouteHooks(hook) {
|
|
40
|
-
return {
|
|
41
|
-
...this,
|
|
42
|
-
hooksRouteLifeCycle: utils.A.concat(this.hooksRouteLifeCycle, utils.A.coalescing(hook)),
|
|
43
|
-
};
|
|
44
|
-
},
|
|
45
|
-
addStepFunctionBuilder(hook) {
|
|
46
|
-
return {
|
|
47
|
-
...this,
|
|
48
|
-
stepFunctionBuilders: utils.A.concat(this.stepFunctionBuilders, utils.A.coalescing(hook)),
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
plug(plugin) {
|
|
52
|
-
return {
|
|
53
|
-
...this,
|
|
54
|
-
plugins: utils.A.push(this.plugins, typeof plugin === "function"
|
|
55
|
-
? plugin(this)
|
|
56
|
-
: plugin),
|
|
57
|
-
};
|
|
58
|
-
},
|
|
59
|
-
register(route) {
|
|
60
|
-
return {
|
|
61
|
-
...this,
|
|
62
|
-
routes: utils.A.concat(this.routes, utils.pipe(route, utils.P.when(index.routeKind.has, utils.A.coalescing), utils.P.when(utils.isType("iterable"), utils.A.from), utils.P.otherwise(utils.O.values), utils.A.filter((route) => !utils.A.includes(this.routes, route)))),
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
setDefaultExtractContract(defaultExtractContract) {
|
|
66
|
-
return {
|
|
67
|
-
...this,
|
|
68
|
-
defaultExtractContract,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
setNotfoundHandler(responseContract, theFunction) {
|
|
72
|
-
return {
|
|
73
|
-
...this,
|
|
74
|
-
notfoundHandler: handler.createHandlerStep({
|
|
75
|
-
responseContract,
|
|
76
|
-
theFunction: (floor, params) => theFunction(params),
|
|
77
|
-
metadata: [],
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
aggregates() {
|
|
82
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom({
|
|
83
|
-
hooksRouteLifeCycle: this.hooksRouteLifeCycle,
|
|
84
|
-
routeFunctionBuilders: this.routeFunctionBuilders,
|
|
85
|
-
stepFunctionBuilders: this.stepFunctionBuilders,
|
|
86
|
-
routes: this.routes,
|
|
87
|
-
hooksHubLifeCycle: this.hooksHubLifeCycle,
|
|
88
|
-
}), ({ lastValue, element: plugin, next, }) => next({
|
|
89
|
-
hooksRouteLifeCycle: plugin.hooksRouteLifeCycle
|
|
90
|
-
? utils.A.concat(lastValue.hooksRouteLifeCycle, plugin.hooksRouteLifeCycle)
|
|
91
|
-
: lastValue.hooksRouteLifeCycle,
|
|
92
|
-
routeFunctionBuilders: plugin.routeFunctionBuilders
|
|
93
|
-
? utils.A.concat(lastValue.routeFunctionBuilders, plugin.routeFunctionBuilders)
|
|
94
|
-
: lastValue.routeFunctionBuilders,
|
|
95
|
-
stepFunctionBuilders: plugin.stepFunctionBuilders
|
|
96
|
-
? utils.A.concat(lastValue.stepFunctionBuilders, plugin.stepFunctionBuilders)
|
|
97
|
-
: lastValue.stepFunctionBuilders,
|
|
98
|
-
routes: plugin.routes
|
|
99
|
-
? utils.A.concat(lastValue.routes, plugin.routes)
|
|
100
|
-
: lastValue.routes,
|
|
101
|
-
hooksHubLifeCycle: plugin.hooksHubLifeCycle
|
|
102
|
-
? utils.A.concat(lastValue.hooksHubLifeCycle, plugin.hooksHubLifeCycle)
|
|
103
|
-
: lastValue.hooksHubLifeCycle,
|
|
104
|
-
}));
|
|
105
|
-
},
|
|
106
|
-
aggregatesRoutes() {
|
|
107
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom(this.routes), ({ lastValue, element: { routes }, next, }) => routes
|
|
108
|
-
? next(utils.A.concat(lastValue, routes))
|
|
109
|
-
: next(lastValue));
|
|
110
|
-
},
|
|
111
|
-
aggregatesRouteFunctionBuilders() {
|
|
112
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom(this.routeFunctionBuilders), ({ lastValue, element: { routeFunctionBuilders }, next, }) => routeFunctionBuilders
|
|
113
|
-
? next(utils.A.concat(lastValue, routeFunctionBuilders))
|
|
114
|
-
: next(lastValue));
|
|
115
|
-
},
|
|
116
|
-
aggregatesStepFunctionBuilders() {
|
|
117
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom(this.stepFunctionBuilders), ({ lastValue, element: { stepFunctionBuilders }, next, }) => stepFunctionBuilders
|
|
118
|
-
? next(utils.A.concat(lastValue, stepFunctionBuilders))
|
|
119
|
-
: next(lastValue));
|
|
120
|
-
},
|
|
121
|
-
aggregatesHooksHubLifeCycle(hookName) {
|
|
122
|
-
const hooks = utils.A.flatMap(this.hooksHubLifeCycle, (hooks) => hooks[hookName] ?? []);
|
|
123
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom(hooks), ({ lastValue, element: { hooksHubLifeCycle }, next, }) => {
|
|
124
|
-
if (!hooksHubLifeCycle) {
|
|
125
|
-
return next(lastValue);
|
|
126
|
-
}
|
|
127
|
-
return next(utils.A.concat(lastValue, utils.A.flatMap(hooksHubLifeCycle, (hooks) => hooks[hookName] ?? [])));
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
aggregatesHooksRouteLifeCycle(hookName) {
|
|
131
|
-
const hooks = utils.A.flatMap(this.hooksRouteLifeCycle, (hooks) => hooks[hookName] ?? []);
|
|
132
|
-
return utils.A.reduce(this.plugins, utils.A.reduceFrom(hooks), ({ lastValue, element: { hooksRouteLifeCycle }, next, }) => {
|
|
133
|
-
if (!hooksRouteLifeCycle) {
|
|
134
|
-
return next(lastValue);
|
|
135
|
-
}
|
|
136
|
-
return next(utils.A.concat(lastValue, utils.A.flatMap(hooksRouteLifeCycle, (hooks) => hooks[hookName] ?? [])));
|
|
137
|
-
});
|
|
138
|
-
},
|
|
139
|
-
};
|
|
111
|
+
return Hub.new(config);
|
|
140
112
|
}
|
|
141
113
|
|
|
142
114
|
exports.defaultNotfoundHandler = defaultNotfoundHandler.defaultNotfoundHandler;
|
|
143
115
|
exports.defaultExtractContract = defaultExtractContract.defaultExtractContract;
|
|
116
|
+
exports.defaultBodyController = defaultBodyController.defaultBodyController;
|
|
144
117
|
exports.createHookHubLifeCycle = hooks.createHookHubLifeCycle;
|
|
145
118
|
exports.hookServerExitKind = hooks.hookServerExitKind;
|
|
146
119
|
exports.hookServerNextKind = hooks.hookServerNextKind;
|
|
@@ -149,5 +122,6 @@ exports.launchHookServer = hooks.launchHookServer;
|
|
|
149
122
|
exports.launchHookServerError = hooks.launchHookServerError;
|
|
150
123
|
exports.serverErrorExitHookFunction = hooks.serverErrorExitHookFunction;
|
|
151
124
|
exports.serverErrorNextHookFunction = hooks.serverErrorNextHookFunction;
|
|
125
|
+
exports.Hub = Hub;
|
|
152
126
|
exports.createHub = createHub;
|
|
153
127
|
exports.hubKind = hubKind;
|
package/dist/core/hub/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Route, type HookRouteLifeCycle } from "../route";
|
|
2
|
-
import { type
|
|
2
|
+
import { type MaybeArray, type MaybePromise, type DP } from "@duplojs/utils";
|
|
3
3
|
import { type HookHubLifeCycle } from "./hooks";
|
|
4
4
|
import { type HandlerStepFunctionParams, type HandlerStep } from "../steps";
|
|
5
|
-
import { Request } from "../request";
|
|
5
|
+
import { type BodyController, type BodyReaderImplementation, Request } from "../request";
|
|
6
6
|
import { type ClientErrorResponseCode, type ResponseContract } from "../response";
|
|
7
7
|
import { type Environment } from "../types";
|
|
8
8
|
import { type createStepFunctionBuilder } from "../functionsBuilders/steps";
|
|
@@ -10,6 +10,7 @@ import { type createRouteFunctionBuilder } from "../functionsBuilders/route";
|
|
|
10
10
|
export * from "./hooks";
|
|
11
11
|
export * from "./defaultNotfoundHandler";
|
|
12
12
|
export * from "./defaultExtractContract";
|
|
13
|
+
export * from "./defaultBodyController";
|
|
13
14
|
export declare const hubKind: import("@duplojs/utils").KindHandler<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/hub", unknown>>;
|
|
14
15
|
export interface HubConfig {
|
|
15
16
|
readonly environment: Environment;
|
|
@@ -21,38 +22,36 @@ export interface HubPlugin {
|
|
|
21
22
|
readonly routes?: readonly Route[];
|
|
22
23
|
readonly routeFunctionBuilders?: readonly ReturnType<typeof createRouteFunctionBuilder>[];
|
|
23
24
|
readonly stepFunctionBuilders?: readonly ReturnType<typeof createStepFunctionBuilder>[];
|
|
25
|
+
readonly bodyReaderImplementations?: readonly BodyReaderImplementation[];
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
plug(plugin: HubPlugin | ((self: this) => HubPlugin)):
|
|
49
|
-
setNotfoundHandler<GenericResponseContract extends ResponseContract.Contract, GenericResponse extends ResponseContract.Convert<GenericResponseContract>>(responseContract: GenericResponseContract, theFunction: (param: HandlerStepFunctionParams<Request, GenericResponse>) => MaybePromise<GenericResponse>):
|
|
50
|
-
setDefaultExtractContract(responseContract: this["defaultExtractContract"]):
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
aggregatesStepFunctionBuilders(): readonly ReturnType<typeof createStepFunctionBuilder>[];
|
|
55
|
-
aggregatesHooksHubLifeCycle<GenericHookName extends keyof HookHubLifeCycle>(hookName: GenericHookName): readonly Exclude<HookHubLifeCycle[GenericHookName], undefined>[];
|
|
56
|
-
aggregatesHooksRouteLifeCycle<GenericHookName extends keyof HookRouteLifeCycle>(hookName: GenericHookName): readonly Exclude<HookRouteLifeCycle[GenericHookName], undefined>[];
|
|
27
|
+
declare const Hub_base: new (params?: {
|
|
28
|
+
"@DuplojsHttpCore/hub"?: unknown;
|
|
29
|
+
} | undefined) => import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"@DuplojsHttpCore/hub", unknown>, unknown> & import("@duplojs/utils").Kind<import("@duplojs/utils").KindDefinition<"hub", unknown>, unknown>;
|
|
30
|
+
export declare class Hub<GenericConfig extends HubConfig = HubConfig> extends Hub_base {
|
|
31
|
+
config: GenericConfig;
|
|
32
|
+
plugins: HubPlugin[];
|
|
33
|
+
hooksRouteLifeCycle: HookRouteLifeCycle[];
|
|
34
|
+
hooksHubLifeCycle: HookHubLifeCycle[];
|
|
35
|
+
routes: Set<Route<import("../route").RouteDefinition>>;
|
|
36
|
+
routeFunctionBuilders: ReturnType<typeof createRouteFunctionBuilder>[];
|
|
37
|
+
stepFunctionBuilders: ReturnType<typeof createStepFunctionBuilder>[];
|
|
38
|
+
bodyReaderImplementations: BodyReaderImplementation[];
|
|
39
|
+
classRequest: typeof Request;
|
|
40
|
+
notfoundHandler: HandlerStep;
|
|
41
|
+
defaultExtractContract: ResponseContract.Contract<ClientErrorResponseCode, string, DP.DataParserEmpty>;
|
|
42
|
+
defaultBodyController: BodyController;
|
|
43
|
+
private constructor();
|
|
44
|
+
register(routes: Route | Iterable<Route> | Record<string, Route>): this;
|
|
45
|
+
addRouteFunctionBuilder(functionBuilder: MaybeArray<ReturnType<typeof createRouteFunctionBuilder>>): this;
|
|
46
|
+
addStepFunctionBuilder(functionBuilder: MaybeArray<ReturnType<typeof createStepFunctionBuilder>>): this;
|
|
47
|
+
addRouteHooks(hook: MaybeArray<HookRouteLifeCycle>): this;
|
|
48
|
+
addHubHooks(hook: MaybeArray<HookHubLifeCycle>): this;
|
|
49
|
+
addBodyReaderImplementation(bodyReaderImplementation: MaybeArray<BodyReaderImplementation>): this;
|
|
50
|
+
plug(plugin: HubPlugin | ((self: this) => HubPlugin)): this;
|
|
51
|
+
setNotfoundHandler<GenericResponseContract extends ResponseContract.Contract, GenericResponse extends ResponseContract.Convert<GenericResponseContract>>(responseContract: GenericResponseContract, theFunction: (param: HandlerStepFunctionParams<Request, GenericResponse>) => MaybePromise<GenericResponse>): this;
|
|
52
|
+
setDefaultExtractContract(responseContract: this["defaultExtractContract"]): this;
|
|
53
|
+
aggregatesHooksHubLifeCycle<GenericHookName extends keyof HookHubLifeCycle>(hookName: GenericHookName): (NonNullable<HookHubLifeCycle[GenericHookName]> extends infer T ? T extends NonNullable<HookHubLifeCycle[GenericHookName]> ? T extends readonly (infer InnerArr)[] ? InnerArr extends readonly (infer InnerArr)[] ? InnerArr : InnerArr : T : never : never)[];
|
|
54
|
+
setDefaultBodyController(bodyController: BodyController): this;
|
|
55
|
+
aggregatesHooksRouteLifeCycle<GenericHookName extends keyof HookRouteLifeCycle>(hookName: GenericHookName): (NonNullable<HookRouteLifeCycle<Request>[GenericHookName]> extends infer T ? T extends NonNullable<HookRouteLifeCycle<Request>[GenericHookName]> ? T extends readonly (infer InnerArr)[] ? InnerArr extends readonly (infer InnerArr)[] ? InnerArr : InnerArr : T : never : never)[];
|
|
57
56
|
}
|
|
58
57
|
export declare function createHub<const GenericConfig extends HubConfig>(config: GenericConfig): Hub<GenericConfig>;
|