@tramvai/module-server 5.49.1 → 6.59.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/README.md +3 -3
- package/lib/modules/debugRequests.es.js +2 -4
- package/lib/modules/debugRequests.js +2 -4
- package/lib/modules/earlyHints/service.es.js +4 -1
- package/lib/modules/earlyHints/service.js +4 -1
- package/lib/server/taskManager.es.js +3 -5
- package/lib/server/taskManager.js +3 -5
- package/lib/server/webApp.es.js +3 -2
- package/lib/server/webApp.js +3 -2
- package/package.json +24 -24
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ createApp({
|
|
|
26
26
|
|
|
27
27
|
### Processing the users requests
|
|
28
28
|
|
|
29
|
-
`ServerModule` creates [
|
|
29
|
+
`ServerModule` creates [fastify.js](https://fastify.dev/) application, handles user requests, runs [commandLineRunner](concepts/command-line-runner.md), and sends responses to users with data, headers and status from `RESPONSE_MANAGER_TOKEN` token.
|
|
30
30
|
|
|
31
31
|
### Request proxying
|
|
32
32
|
|
|
@@ -42,7 +42,7 @@ To enable proxying, create a file `proxy.conf.js` or `proxy.conf.json` in the ro
|
|
|
42
42
|
const testStand = 'https://example.org';
|
|
43
43
|
|
|
44
44
|
module.exports = {
|
|
45
|
-
// The key is the path pattern for the `
|
|
45
|
+
// The key is the path pattern for the `fastify` to be passed to `app.use`
|
|
46
46
|
// value can be a string, in order to proxy all urls starting with `/login/`
|
|
47
47
|
'/login/': testStand,
|
|
48
48
|
// or can be a config object for [http-proxy](https://github.com/chimurai/http-proxy-middleware#http-proxy-options)
|
|
@@ -115,7 +115,7 @@ Module will not serve the newly added file on the filesystem, works only for all
|
|
|
115
115
|
|
|
116
116
|
### PAPI
|
|
117
117
|
|
|
118
|
-
Papi - API routes for the `tramvai` application. More information is available in [Papi](03-features/
|
|
118
|
+
Papi - API routes for the `tramvai` application. More information is available in [Papi](03-features/017-papi.md)
|
|
119
119
|
|
|
120
120
|
### Emulation of network/backends problems in the application
|
|
121
121
|
|
|
@@ -10,10 +10,8 @@ import http from 'http';
|
|
|
10
10
|
import https from 'https';
|
|
11
11
|
|
|
12
12
|
class Interceptor {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this.delay = 0;
|
|
16
|
-
}
|
|
13
|
+
intercepted = false;
|
|
14
|
+
delay = 0;
|
|
17
15
|
setIntercept(intercept) {
|
|
18
16
|
this.intercepted = intercept;
|
|
19
17
|
}
|
|
@@ -20,10 +20,8 @@ var http__default = /*#__PURE__*/_interopDefaultLegacy(http);
|
|
|
20
20
|
var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
21
21
|
|
|
22
22
|
class Interceptor {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
this.delay = 0;
|
|
26
|
-
}
|
|
23
|
+
intercepted = false;
|
|
24
|
+
delay = 0;
|
|
27
25
|
setIntercept(intercept) {
|
|
28
26
|
this.intercepted = intercept;
|
|
29
27
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
class EarlyHintsManager {
|
|
2
|
+
sentHints = new Set();
|
|
3
|
+
response;
|
|
4
|
+
resourcesRegistry;
|
|
5
|
+
earlyHintsEnabled;
|
|
2
6
|
constructor(payload) {
|
|
3
|
-
this.sentHints = new Set();
|
|
4
7
|
this.response = payload.response;
|
|
5
8
|
this.resourcesRegistry = payload.resourcesRegistry;
|
|
6
9
|
this.earlyHintsEnabled = payload.earlyHintsEnabled;
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
class EarlyHintsManager {
|
|
6
|
+
sentHints = new Set();
|
|
7
|
+
response;
|
|
8
|
+
resourcesRegistry;
|
|
9
|
+
earlyHintsEnabled;
|
|
6
10
|
constructor(payload) {
|
|
7
|
-
this.sentHints = new Set();
|
|
8
11
|
this.response = payload.response;
|
|
9
12
|
this.resourcesRegistry = payload.resourcesRegistry;
|
|
10
13
|
this.earlyHintsEnabled = payload.earlyHintsEnabled;
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
class ServerResponseTaskManager {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
this.status = 'idle';
|
|
10
|
-
}
|
|
6
|
+
tasks = [];
|
|
7
|
+
processedTasks = [];
|
|
8
|
+
status = 'idle';
|
|
11
9
|
push(task) {
|
|
12
10
|
if (this.status === 'closed') {
|
|
13
11
|
return;
|
package/lib/server/webApp.es.js
CHANGED
|
@@ -122,8 +122,9 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, executionContextMan
|
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
124
|
catch (err) {
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
const storage = asyncLocalStorage.getStore();
|
|
126
|
+
if (storage && storage.tramvaiRequestDi) {
|
|
127
|
+
const responseManager = storage.tramvaiRequestDi.get(RESPONSE_MANAGER_TOKEN);
|
|
127
128
|
if (responseManager && !reply.sent) {
|
|
128
129
|
reply.headers(responseManager.getHeaders());
|
|
129
130
|
}
|
package/lib/server/webApp.js
CHANGED
|
@@ -131,8 +131,9 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, executionContextMan
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
catch (err) {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const storage = asyncLocalStorage.getStore();
|
|
135
|
+
if (storage && storage.tramvaiRequestDi) {
|
|
136
|
+
const responseManager = storage.tramvaiRequestDi.get(tokensCommon.RESPONSE_MANAGER_TOKEN);
|
|
136
137
|
if (responseManager && !reply.sent) {
|
|
137
138
|
reply.headers(responseManager.getHeaders());
|
|
138
139
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.59.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -21,37 +21,37 @@
|
|
|
21
21
|
"watch": "tsc -w"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"afterframe": "^1.0.2",
|
|
25
|
-
"@tinkoff/errors": "0.6.2",
|
|
26
|
-
"@tinkoff/monkeypatch": "5.0.2",
|
|
27
|
-
"@tinkoff/terminus": "0.4.2",
|
|
28
|
-
"@tinkoff/url": "0.11.2",
|
|
29
|
-
"@tramvai/module-cache-warmup": "5.49.1",
|
|
30
|
-
"@tramvai/module-metrics": "5.49.1",
|
|
31
|
-
"@tramvai/papi": "5.49.1",
|
|
32
|
-
"@tramvai/tokens-server": "5.49.1",
|
|
33
|
-
"@tramvai/tokens-router": "5.49.1",
|
|
34
|
-
"@tramvai/tokens-server-private": "5.49.1",
|
|
35
|
-
"@tramvai/safe-strings": "0.8.4",
|
|
36
|
-
"fastify": "^4.14.1",
|
|
37
|
-
"@fastify/cookie": "^8.3.0",
|
|
38
24
|
"@fastify/compress": "^6.2.0",
|
|
25
|
+
"@fastify/cookie": "^8.3.0",
|
|
39
26
|
"@fastify/formbody": "^7.4.0",
|
|
40
27
|
"@fastify/static": "^6.9.0",
|
|
41
28
|
"@loadable/server": "^5.15.0",
|
|
29
|
+
"@tinkoff/errors": "0.7.1",
|
|
30
|
+
"@tinkoff/monkeypatch": "6.0.0",
|
|
31
|
+
"@tinkoff/terminus": "0.5.1",
|
|
32
|
+
"@tinkoff/url": "0.12.1",
|
|
33
|
+
"@tramvai/module-cache-warmup": "6.59.0",
|
|
34
|
+
"@tramvai/module-metrics": "6.59.0",
|
|
35
|
+
"@tramvai/papi": "6.59.0",
|
|
36
|
+
"@tramvai/safe-strings": "0.9.0",
|
|
37
|
+
"@tramvai/tokens-router": "6.59.0",
|
|
38
|
+
"@tramvai/tokens-server": "6.59.0",
|
|
39
|
+
"@tramvai/tokens-server-private": "6.59.0",
|
|
40
|
+
"afterframe": "^1.0.2",
|
|
41
|
+
"fastify": "^4.14.1",
|
|
42
42
|
"http-proxy-middleware": "^2.0.2"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@tinkoff/dippy": "0.
|
|
45
|
+
"@tinkoff/dippy": "0.12.3",
|
|
46
46
|
"@tinkoff/utils": "^2.1.2",
|
|
47
|
-
"@tramvai/cli": "
|
|
48
|
-
"@tramvai/core": "
|
|
49
|
-
"@tramvai/
|
|
50
|
-
"@tramvai/module-
|
|
51
|
-
"@tramvai/
|
|
52
|
-
"@tramvai/tokens-common": "
|
|
53
|
-
"@tramvai/tokens-core-private": "
|
|
54
|
-
"@tramvai/tokens-render": "
|
|
47
|
+
"@tramvai/cli": "6.59.0",
|
|
48
|
+
"@tramvai/core": "6.59.0",
|
|
49
|
+
"@tramvai/module-common": "6.59.0",
|
|
50
|
+
"@tramvai/module-environment": "6.59.0",
|
|
51
|
+
"@tramvai/react": "6.59.0",
|
|
52
|
+
"@tramvai/tokens-common": "6.59.0",
|
|
53
|
+
"@tramvai/tokens-core-private": "6.59.0",
|
|
54
|
+
"@tramvai/tokens-render": "6.59.0",
|
|
55
55
|
"react": ">=16.14.0",
|
|
56
56
|
"react-dom": ">=16.14.0",
|
|
57
57
|
"tslib": "^2.4.0"
|