@tramvai/module-server 1.74.0 → 1.76.0
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/lib/server/webApp.d.ts +3 -2
- package/lib/server.es.js +5 -3
- package/lib/server.js +4 -2
- package/package.json +10 -10
package/lib/server/webApp.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { LOGGER_TOKEN } from '@tramvai/module-common';
|
|
2
2
|
import type { COMMAND_LINE_RUNNER_TOKEN } from '@tramvai/core';
|
|
3
|
-
import type { WEB_APP_TOKEN, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_INIT_TOKEN, WEB_APP_AFTER_INIT_TOKEN } from '@tramvai/tokens-server';
|
|
3
|
+
import type { WEB_APP_TOKEN, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_INIT_TOKEN, WEB_APP_AFTER_INIT_TOKEN, WEB_APP_LIMITER_TOKEN } from '@tramvai/tokens-server';
|
|
4
4
|
export declare const webAppFactory: () => import("express-serve-static-core").Express;
|
|
5
|
-
export declare const webAppInitCommand: ({ app, logger, commandLineRunner, beforeInit, init, afterInit, }: {
|
|
5
|
+
export declare const webAppInitCommand: ({ app, logger, commandLineRunner, beforeInit, init, afterInit, limiterRequest, }: {
|
|
6
6
|
app: typeof WEB_APP_TOKEN;
|
|
7
7
|
logger: typeof LOGGER_TOKEN;
|
|
8
8
|
commandLineRunner: typeof COMMAND_LINE_RUNNER_TOKEN;
|
|
9
9
|
beforeInit: typeof WEB_APP_BEFORE_INIT_TOKEN;
|
|
10
10
|
init: typeof WEB_APP_INIT_TOKEN;
|
|
11
11
|
afterInit: typeof WEB_APP_AFTER_INIT_TOKEN;
|
|
12
|
+
limiterRequest: typeof WEB_APP_LIMITER_TOKEN;
|
|
12
13
|
}) => () => Promise<void>;
|
package/lib/server.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from 'tslib';
|
|
2
2
|
import { Scope, APP_INFO_TOKEN, Module, provide, DI_TOKEN, COMMAND_LINE_RUNNER_TOKEN, commandLineListTokens } from '@tramvai/core';
|
|
3
|
-
import { SERVER_MODULE_PAPI_PUBLIC_ROUTE, SERVER_MODULE_PAPI_PUBLIC_URL, SERVER_MODULE_PAPI_PRIVATE_URL, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_TOKEN, SERVER_MODULE_PAPI_PRIVATE_ROUTE, SERVER_MODULE_STATICS_OPTIONS,
|
|
3
|
+
import { SERVER_MODULE_PAPI_PUBLIC_ROUTE, SERVER_MODULE_PAPI_PUBLIC_URL, SERVER_MODULE_PAPI_PRIVATE_URL, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_TOKEN, SERVER_MODULE_PAPI_PRIVATE_ROUTE, SERVER_MODULE_STATICS_OPTIONS, SERVER_TOKEN, READINESS_PROBE_TOKEN, LIVENESS_PROBE_TOKEN, SPECIAL_SERVER_PATHS, PROXY_CONFIG_TOKEN, DEPENDENCIES_VERSION_FILTER_TOKEN, WEB_APP_INIT_TOKEN, WEB_APP_AFTER_INIT_TOKEN, WEB_APP_LIMITER_TOKEN } from '@tramvai/tokens-server';
|
|
4
4
|
export * from '@tramvai/tokens-server';
|
|
5
5
|
import { REQUEST, RESPONSE, RESPONSE_MANAGER_TOKEN, LOGGER_TOKEN as LOGGER_TOKEN$1, ENV_MANAGER_TOKEN as ENV_MANAGER_TOKEN$1, ENV_USED_TOKEN } from '@tramvai/module-common';
|
|
6
6
|
import { MetricsModule } from '@tramvai/module-metrics';
|
|
@@ -83,7 +83,7 @@ const webAppFactory = () => {
|
|
|
83
83
|
app.disable('x-powered-by');
|
|
84
84
|
return app;
|
|
85
85
|
};
|
|
86
|
-
const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, afterInit, }) => {
|
|
86
|
+
const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, afterInit, limiterRequest, }) => {
|
|
87
87
|
const log = logger('server:webapp');
|
|
88
88
|
const runHandlers = (handlers) => {
|
|
89
89
|
if (handlers) {
|
|
@@ -92,6 +92,7 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, a
|
|
|
92
92
|
};
|
|
93
93
|
return async function webAppInit() {
|
|
94
94
|
await runHandlers(beforeInit);
|
|
95
|
+
await runHandlers(limiterRequest);
|
|
95
96
|
app.use(bodyParser.urlencoded({
|
|
96
97
|
limit: '2mb',
|
|
97
98
|
extended: false,
|
|
@@ -415,7 +416,7 @@ ServerGracefulShutdownModule = __decorate([
|
|
|
415
416
|
Module({
|
|
416
417
|
providers: [
|
|
417
418
|
{
|
|
418
|
-
provide:
|
|
419
|
+
provide: WEB_APP_BEFORE_INIT_TOKEN,
|
|
419
420
|
multi: true,
|
|
420
421
|
useFactory: ({ server, app, logger, commandLineRunner, livenessProbe, readinessProbe, }) => {
|
|
421
422
|
const log = logger('server');
|
|
@@ -743,6 +744,7 @@ ServerModule = __decorate([
|
|
|
743
744
|
beforeInit: { token: WEB_APP_BEFORE_INIT_TOKEN, optional: true },
|
|
744
745
|
init: { token: WEB_APP_INIT_TOKEN, optional: true },
|
|
745
746
|
afterInit: { token: WEB_APP_AFTER_INIT_TOKEN, optional: true },
|
|
747
|
+
limiterRequest: { token: WEB_APP_LIMITER_TOKEN, optional: true },
|
|
746
748
|
},
|
|
747
749
|
},
|
|
748
750
|
{
|
package/lib/server.js
CHANGED
|
@@ -105,7 +105,7 @@ const webAppFactory = () => {
|
|
|
105
105
|
app.disable('x-powered-by');
|
|
106
106
|
return app;
|
|
107
107
|
};
|
|
108
|
-
const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, afterInit, }) => {
|
|
108
|
+
const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, afterInit, limiterRequest, }) => {
|
|
109
109
|
const log = logger('server:webapp');
|
|
110
110
|
const runHandlers = (handlers) => {
|
|
111
111
|
if (handlers) {
|
|
@@ -114,6 +114,7 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, a
|
|
|
114
114
|
};
|
|
115
115
|
return async function webAppInit() {
|
|
116
116
|
await runHandlers(beforeInit);
|
|
117
|
+
await runHandlers(limiterRequest);
|
|
117
118
|
app.use(bodyParser__default["default"].urlencoded({
|
|
118
119
|
limit: '2mb',
|
|
119
120
|
extended: false,
|
|
@@ -437,7 +438,7 @@ ServerGracefulShutdownModule = tslib.__decorate([
|
|
|
437
438
|
core.Module({
|
|
438
439
|
providers: [
|
|
439
440
|
{
|
|
440
|
-
provide: tokensServer.
|
|
441
|
+
provide: tokensServer.WEB_APP_BEFORE_INIT_TOKEN,
|
|
441
442
|
multi: true,
|
|
442
443
|
useFactory: ({ server, app, logger, commandLineRunner, livenessProbe, readinessProbe, }) => {
|
|
443
444
|
const log = logger('server');
|
|
@@ -765,6 +766,7 @@ exports.ServerModule = tslib.__decorate([
|
|
|
765
766
|
beforeInit: { token: tokensServer.WEB_APP_BEFORE_INIT_TOKEN, optional: true },
|
|
766
767
|
init: { token: tokensServer.WEB_APP_INIT_TOKEN, optional: true },
|
|
767
768
|
afterInit: { token: tokensServer.WEB_APP_AFTER_INIT_TOKEN, optional: true },
|
|
769
|
+
limiterRequest: { token: tokensServer.WEB_APP_LIMITER_TOKEN, optional: true },
|
|
768
770
|
},
|
|
769
771
|
},
|
|
770
772
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.76.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"@tinkoff/express-terminus": "0.1.13",
|
|
24
24
|
"@tinkoff/monkeypatch": "1.3.3",
|
|
25
25
|
"@tinkoff/url": "0.7.37",
|
|
26
|
-
"@tramvai/module-cache-warmup": "1.
|
|
27
|
-
"@tramvai/module-metrics": "1.
|
|
28
|
-
"@tramvai/papi": "1.
|
|
29
|
-
"@tramvai/tokens-server": "1.
|
|
26
|
+
"@tramvai/module-cache-warmup": "1.76.0",
|
|
27
|
+
"@tramvai/module-metrics": "1.76.0",
|
|
28
|
+
"@tramvai/papi": "1.76.0",
|
|
29
|
+
"@tramvai/tokens-server": "1.76.0",
|
|
30
30
|
"body-parser": "^1.19.0",
|
|
31
31
|
"compression": "^1.7.4",
|
|
32
32
|
"cookie-parser": "^1.4.3",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tinkoff/utils": "^2.1.2",
|
|
39
|
-
"@tramvai/cli": "1.
|
|
40
|
-
"@tramvai/core": "1.
|
|
41
|
-
"@tramvai/module-common": "1.
|
|
42
|
-
"@tramvai/module-environment": "1.
|
|
43
|
-
"@tramvai/tokens-common": "1.
|
|
39
|
+
"@tramvai/cli": "1.76.0",
|
|
40
|
+
"@tramvai/core": "1.76.0",
|
|
41
|
+
"@tramvai/module-common": "1.76.0",
|
|
42
|
+
"@tramvai/module-environment": "1.76.0",
|
|
43
|
+
"@tramvai/tokens-common": "1.76.0",
|
|
44
44
|
"@tinkoff/dippy": "0.7.38",
|
|
45
45
|
"tslib": "^2.0.3"
|
|
46
46
|
},
|