@tramvai/module-common 2.22.0 → 2.24.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/index.browser.js +7 -1
- package/lib/index.es.js +10 -4
- package/lib/index.js +9 -3
- package/lib/requestManager/requestManager.d.ts +3 -0
- package/package.json +16 -16
package/lib/index.browser.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponen
|
|
|
13
13
|
import pathOr from '@tinkoff/utils/object/pathOr';
|
|
14
14
|
import flatten from '@tinkoff/utils/array/flatten';
|
|
15
15
|
import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
|
|
16
|
-
import { format } from '@tinkoff/url';
|
|
16
|
+
import { format, parse } from '@tinkoff/url';
|
|
17
17
|
import isEmpty from '@tinkoff/utils/is/empty';
|
|
18
18
|
import values from '@tinkoff/utils/object/values';
|
|
19
19
|
import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
|
|
@@ -158,6 +158,12 @@ class RequestManager {
|
|
|
158
158
|
getUrl() {
|
|
159
159
|
return this.url;
|
|
160
160
|
}
|
|
161
|
+
getParsedUrl() {
|
|
162
|
+
if (!this.parsedUrl) {
|
|
163
|
+
this.parsedUrl = parse(this.url);
|
|
164
|
+
}
|
|
165
|
+
return this.parsedUrl;
|
|
166
|
+
}
|
|
161
167
|
getMethod() {
|
|
162
168
|
return this.request.method;
|
|
163
169
|
}
|
package/lib/index.es.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileSystemPagesEnabled, getAllFileSystemPages, isFileSystemPageComponen
|
|
|
13
13
|
import pathOr from '@tinkoff/utils/object/pathOr';
|
|
14
14
|
import flatten from '@tinkoff/utils/array/flatten';
|
|
15
15
|
import { createEvent, createReducer, convertAction, createDispatcher, devTools, Provider } from '@tramvai/state';
|
|
16
|
-
import { format } from '@tinkoff/url';
|
|
16
|
+
import { format, parse } from '@tinkoff/url';
|
|
17
17
|
import isEmpty from '@tinkoff/utils/is/empty';
|
|
18
18
|
import values from '@tinkoff/utils/object/values';
|
|
19
19
|
import { METRICS_MODULE_TOKEN } from '@tramvai/tokens-metrics';
|
|
@@ -160,6 +160,12 @@ class RequestManager {
|
|
|
160
160
|
getUrl() {
|
|
161
161
|
return this.url;
|
|
162
162
|
}
|
|
163
|
+
getParsedUrl() {
|
|
164
|
+
if (!this.parsedUrl) {
|
|
165
|
+
this.parsedUrl = parse(this.url);
|
|
166
|
+
}
|
|
167
|
+
return this.parsedUrl;
|
|
168
|
+
}
|
|
163
169
|
getMethod() {
|
|
164
170
|
return this.request.method;
|
|
165
171
|
}
|
|
@@ -1010,11 +1016,11 @@ const papiClearCache = ({ clearCache, logger, }) => {
|
|
|
1010
1016
|
return createPapiMethod({
|
|
1011
1017
|
method: 'post',
|
|
1012
1018
|
path: '/clear-cache',
|
|
1013
|
-
async handler({
|
|
1019
|
+
async handler({ responseManager }) {
|
|
1014
1020
|
await clearCache();
|
|
1015
1021
|
// DEVOPS-1661
|
|
1016
|
-
|
|
1017
|
-
|
|
1022
|
+
responseManager.setStatus(404);
|
|
1023
|
+
responseManager.setHeader('X-Status', 'done');
|
|
1018
1024
|
log.info('SERVER:CLEAR:CACHE:INTERNAL');
|
|
1019
1025
|
},
|
|
1020
1026
|
});
|
package/lib/index.js
CHANGED
|
@@ -177,6 +177,12 @@ class RequestManager {
|
|
|
177
177
|
getUrl() {
|
|
178
178
|
return this.url;
|
|
179
179
|
}
|
|
180
|
+
getParsedUrl() {
|
|
181
|
+
if (!this.parsedUrl) {
|
|
182
|
+
this.parsedUrl = url.parse(this.url);
|
|
183
|
+
}
|
|
184
|
+
return this.parsedUrl;
|
|
185
|
+
}
|
|
180
186
|
getMethod() {
|
|
181
187
|
return this.request.method;
|
|
182
188
|
}
|
|
@@ -1027,11 +1033,11 @@ const papiClearCache = ({ clearCache, logger, }) => {
|
|
|
1027
1033
|
return papi.createPapiMethod({
|
|
1028
1034
|
method: 'post',
|
|
1029
1035
|
path: '/clear-cache',
|
|
1030
|
-
async handler({
|
|
1036
|
+
async handler({ responseManager }) {
|
|
1031
1037
|
await clearCache();
|
|
1032
1038
|
// DEVOPS-1661
|
|
1033
|
-
|
|
1034
|
-
|
|
1039
|
+
responseManager.setStatus(404);
|
|
1040
|
+
responseManager.setHeader('X-Status', 'done');
|
|
1035
1041
|
log.info('SERVER:CLEAR:CACHE:INTERNAL');
|
|
1036
1042
|
},
|
|
1037
1043
|
});
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import type { Url } from '@tinkoff/url';
|
|
2
3
|
import type { REQUEST, REQUEST_MANAGER_TOKEN } from '@tramvai/tokens-common';
|
|
3
4
|
declare type Interface = typeof REQUEST_MANAGER_TOKEN;
|
|
4
5
|
export declare class RequestManager implements Interface {
|
|
5
6
|
private request;
|
|
6
7
|
private url;
|
|
8
|
+
private parsedUrl;
|
|
7
9
|
constructor({ request }: {
|
|
8
10
|
request: typeof REQUEST;
|
|
9
11
|
});
|
|
10
12
|
getBody(): any;
|
|
11
13
|
getUrl(): string;
|
|
14
|
+
getParsedUrl(): Url;
|
|
12
15
|
getMethod(): string;
|
|
13
16
|
getHeader(key: string): string | string[];
|
|
14
17
|
getHeaders(): import("http").IncomingHttpHeaders;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -28,31 +28,31 @@
|
|
|
28
28
|
"build-for-publish": "true"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tinkoff/errors": "0.3.
|
|
31
|
+
"@tinkoff/errors": "0.3.3",
|
|
32
32
|
"@tinkoff/hook-runner": "0.4.2",
|
|
33
33
|
"@tinkoff/lru-cache-nano": "^7.8.1",
|
|
34
34
|
"@tinkoff/pubsub": "0.5.3",
|
|
35
35
|
"@tinkoff/url": "0.8.2",
|
|
36
|
-
"@tramvai/experiments": "2.
|
|
37
|
-
"@tramvai/module-cookie": "2.
|
|
38
|
-
"@tramvai/module-environment": "2.
|
|
39
|
-
"@tramvai/module-log": "2.
|
|
40
|
-
"@tramvai/tokens-child-app": "2.
|
|
41
|
-
"@tramvai/tokens-common": "2.
|
|
42
|
-
"@tramvai/tokens-render": "2.
|
|
36
|
+
"@tramvai/experiments": "2.24.0",
|
|
37
|
+
"@tramvai/module-cookie": "2.24.0",
|
|
38
|
+
"@tramvai/module-environment": "2.24.0",
|
|
39
|
+
"@tramvai/module-log": "2.24.0",
|
|
40
|
+
"@tramvai/tokens-child-app": "2.24.0",
|
|
41
|
+
"@tramvai/tokens-common": "2.24.0",
|
|
42
|
+
"@tramvai/tokens-render": "2.24.0",
|
|
43
43
|
"hoist-non-react-statics": "^3.3.1",
|
|
44
44
|
"node-abort-controller": "^3.0.1"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@tinkoff/dippy": "0.8.2",
|
|
48
48
|
"@tinkoff/utils": "^2.1.2",
|
|
49
|
-
"@tramvai/cli": "2.
|
|
50
|
-
"@tramvai/core": "2.
|
|
51
|
-
"@tramvai/papi": "2.
|
|
52
|
-
"@tramvai/react": "2.
|
|
53
|
-
"@tramvai/state": "2.
|
|
54
|
-
"@tramvai/tokens-metrics": "2.
|
|
55
|
-
"@tramvai/tokens-server": "2.
|
|
49
|
+
"@tramvai/cli": "2.24.0",
|
|
50
|
+
"@tramvai/core": "2.24.0",
|
|
51
|
+
"@tramvai/papi": "2.24.0",
|
|
52
|
+
"@tramvai/react": "2.24.0",
|
|
53
|
+
"@tramvai/state": "2.24.0",
|
|
54
|
+
"@tramvai/tokens-metrics": "2.24.0",
|
|
55
|
+
"@tramvai/tokens-server": "2.24.0",
|
|
56
56
|
"react": ">=16.14.0",
|
|
57
57
|
"tslib": "^2.0.3"
|
|
58
58
|
},
|