@tstdl/base 0.71.51 → 0.71.52
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/api/server/module.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export declare type ApiModuleOptions = {
|
|
|
5
5
|
gatewayOptions?: ApiGatewayOptions;
|
|
6
6
|
};
|
|
7
7
|
export declare const apiModuleOptions: ApiModuleOptions;
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function configureApiServer(options: Partial<ApiModuleOptions>): void;
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated Use {@link
|
|
10
|
+
* @deprecated Use {@link configureApiServer} instead
|
|
11
11
|
*/
|
|
12
12
|
export declare function registerApiControllers(...controllers: (Type | Type[])[]): void;
|
package/api/server/module.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerApiControllers = exports.
|
|
3
|
+
exports.registerApiControllers = exports.configureApiServer = exports.apiModuleOptions = void 0;
|
|
4
4
|
const container_1 = require("../../container");
|
|
5
5
|
const type_guards_1 = require("../../utils/type-guards");
|
|
6
6
|
const api_controller_1 = require("./api-controller");
|
|
@@ -8,7 +8,7 @@ const tokens_1 = require("./tokens");
|
|
|
8
8
|
exports.apiModuleOptions = {
|
|
9
9
|
controllers: []
|
|
10
10
|
};
|
|
11
|
-
function
|
|
11
|
+
function configureApiServer(options) {
|
|
12
12
|
var _a;
|
|
13
13
|
if ((0, type_guards_1.isDefined)(options.controllers)) {
|
|
14
14
|
for (const controller of options.controllers) {
|
|
@@ -19,16 +19,16 @@ function configureApiModule(options) {
|
|
|
19
19
|
exports.apiModuleOptions.gatewayOptions = (_a = options.gatewayOptions) !== null && _a !== void 0 ? _a : exports.apiModuleOptions.gatewayOptions;
|
|
20
20
|
container_1.container.register(tokens_1.API_MODULE_OPTIONS, { useValue: exports.apiModuleOptions });
|
|
21
21
|
}
|
|
22
|
-
exports.
|
|
22
|
+
exports.configureApiServer = configureApiServer;
|
|
23
23
|
/**
|
|
24
|
-
* @deprecated Use {@link
|
|
24
|
+
* @deprecated Use {@link configureApiServer} instead
|
|
25
25
|
*/
|
|
26
26
|
function registerApiControllers(...controllers) {
|
|
27
27
|
const flatControllers = controllers.flatMap((controller) => controller);
|
|
28
28
|
for (const controller of flatControllers) {
|
|
29
29
|
(0, api_controller_1.ensureApiController)(controller);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
configureApiServer({ controllers: flatControllers });
|
|
32
32
|
}
|
|
33
33
|
exports.registerApiControllers = registerApiControllers;
|
|
34
34
|
//# sourceMappingURL=module.js.map
|
|
@@ -91,7 +91,7 @@ async function clientTest() {
|
|
|
91
91
|
}
|
|
92
92
|
async function main() {
|
|
93
93
|
(0, node_1.configureNodeHttpServer)(true);
|
|
94
|
-
(0, server_1.
|
|
94
|
+
(0, server_1.configureApiServer)({ controllers: [UserApi] });
|
|
95
95
|
(0, undici_http_client_adapter_1.configureUndiciHttpClientAdapter)({ dispatcher: new undici_1.Agent({ keepAliveMaxTimeout: 1 }) });
|
|
96
96
|
container_1.container.register(http_1.HTTP_CLIENT_OPTIONS, { useValue: { baseUrl: 'http://localhost:8000' } });
|
|
97
97
|
application_1.Application.registerModule(modules_1.WebServerModule);
|