@tramvai/tokens-server 1.41.0 → 1.45.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 +2 -2
- package/lib/index.d.ts +18 -17
- package/lib/index.es.js +18 -17
- package/lib/index.js +18 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Server tokens
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Tramvai tokens for integration and extending [server module](references/modules/server.md).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Tokens
|
|
6
6
|
|
|
7
7
|
@inline src/index.ts
|
package/lib/index.d.ts
CHANGED
|
@@ -4,33 +4,33 @@ import type { Application } from 'express';
|
|
|
4
4
|
import type { Papi } from '@tramvai/papi';
|
|
5
5
|
/**
|
|
6
6
|
* @description
|
|
7
|
-
*
|
|
7
|
+
* Specifies base url for public papi handlers. By default equals to `/[appName]/papi`
|
|
8
8
|
*/
|
|
9
9
|
export declare const SERVER_MODULE_PAPI_PUBLIC_URL: string;
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
12
|
-
*
|
|
12
|
+
* Specifies base url for private papi handlers. By default equals `/[appName]/private/papi`
|
|
13
13
|
*/
|
|
14
14
|
export declare const SERVER_MODULE_PAPI_PRIVATE_URL: string;
|
|
15
15
|
/**
|
|
16
16
|
* @description
|
|
17
|
-
*
|
|
17
|
+
* Add private papi route
|
|
18
18
|
*/
|
|
19
19
|
export declare const SERVER_MODULE_PAPI_PRIVATE_ROUTE: Papi<any, any>;
|
|
20
20
|
/**
|
|
21
21
|
* @description
|
|
22
|
-
*
|
|
22
|
+
* Add public papi route
|
|
23
23
|
*/
|
|
24
24
|
export declare const SERVER_MODULE_PAPI_PUBLIC_ROUTE: Papi<any, any>;
|
|
25
25
|
/**
|
|
26
26
|
* @description
|
|
27
|
-
*
|
|
27
|
+
* Settings for the static server
|
|
28
28
|
*/
|
|
29
29
|
export declare const SERVER_MODULE_STATICS_OPTIONS: ServerModuleStaticsOptions;
|
|
30
30
|
/**
|
|
31
31
|
* @description
|
|
32
|
-
*
|
|
33
|
-
*
|
|
32
|
+
* Instance of nodejs `http.Server`.
|
|
33
|
+
* Can be used for adding custom logic on server, like error handling, connection settings
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
36
|
```tsx
|
|
@@ -51,8 +51,8 @@ export declare const SERVER_MODULE_STATICS_OPTIONS: ServerModuleStaticsOptions;
|
|
|
51
51
|
export declare const SERVER_TOKEN: Server;
|
|
52
52
|
/**
|
|
53
53
|
* @description
|
|
54
|
-
*
|
|
55
|
-
*
|
|
54
|
+
* Instance of the current server app. By default it is an `express` app.
|
|
55
|
+
* Can be used to setup custom request handler and add custom routes
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
```tsx
|
|
@@ -73,7 +73,7 @@ export declare const SERVER_TOKEN: Server;
|
|
|
73
73
|
export declare const WEB_APP_TOKEN: Application;
|
|
74
74
|
/**
|
|
75
75
|
* @description
|
|
76
|
-
*
|
|
76
|
+
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
77
77
|
*
|
|
78
78
|
* @example
|
|
79
79
|
```tsx
|
|
@@ -89,8 +89,8 @@ export declare const WEB_APP_TOKEN: Application;
|
|
|
89
89
|
export declare const WEB_APP_BEFORE_INIT_TOKEN: APP_INIT_HANDLER;
|
|
90
90
|
/**
|
|
91
91
|
* @description
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* Subscription to web-app initialization.
|
|
93
|
+
* It is called after global request handlers but before handlers for page rendering
|
|
94
94
|
*
|
|
95
95
|
* @example
|
|
96
96
|
```tsx
|
|
@@ -107,7 +107,8 @@ export declare const WEB_APP_BEFORE_INIT_TOKEN: APP_INIT_HANDLER;
|
|
|
107
107
|
export declare const WEB_APP_INIT_TOKEN: APP_INIT_HANDLER;
|
|
108
108
|
/**
|
|
109
109
|
* @description
|
|
110
|
-
*
|
|
110
|
+
* Subscription to after web-app initialization.
|
|
111
|
+
* It is called after any other handlers
|
|
111
112
|
*
|
|
112
113
|
* @example
|
|
113
114
|
```tsx
|
|
@@ -123,18 +124,18 @@ export declare const WEB_APP_INIT_TOKEN: APP_INIT_HANDLER;
|
|
|
123
124
|
export declare const WEB_APP_AFTER_INIT_TOKEN: APP_INIT_HANDLER;
|
|
124
125
|
/**
|
|
125
126
|
* @description
|
|
126
|
-
*
|
|
127
|
+
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
127
128
|
*/
|
|
128
129
|
export declare const PROXY_CONFIG_TOKEN: ProxyConfig[];
|
|
129
130
|
/**
|
|
130
131
|
* @description
|
|
131
|
-
*
|
|
132
|
+
* Override filter function when accessing papi route `/dependenciesVersion`
|
|
132
133
|
*/
|
|
133
134
|
export declare const DEPENDENCIES_VERSION_FILTER_TOKEN: DepsFilter;
|
|
134
135
|
/**
|
|
135
136
|
* @description
|
|
136
|
-
*
|
|
137
|
-
*
|
|
137
|
+
* List of the special URLs on server (e.g. healthz and readyz)
|
|
138
|
+
* Url matching is happens with a library `path-to-regexp`.
|
|
138
139
|
*/
|
|
139
140
|
export declare const SPECIAL_SERVER_PATHS: string;
|
|
140
141
|
export interface ServerModuleStaticsOptions {
|
package/lib/index.es.js
CHANGED
|
@@ -2,37 +2,37 @@ import { createToken } from '@tinkoff/dippy';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
5
|
-
*
|
|
5
|
+
* Specifies base url for public papi handlers. By default equals to `/[appName]/papi`
|
|
6
6
|
*/
|
|
7
7
|
const SERVER_MODULE_PAPI_PUBLIC_URL = createToken('serverModulePapiPublicUrl');
|
|
8
8
|
/**
|
|
9
9
|
* @description
|
|
10
|
-
*
|
|
10
|
+
* Specifies base url for private papi handlers. By default equals `/[appName]/private/papi`
|
|
11
11
|
*/
|
|
12
12
|
const SERVER_MODULE_PAPI_PRIVATE_URL = createToken('serverModulePapiPrivateUrl');
|
|
13
13
|
/**
|
|
14
14
|
* @description
|
|
15
|
-
*
|
|
15
|
+
* Add private papi route
|
|
16
16
|
*/
|
|
17
17
|
const SERVER_MODULE_PAPI_PRIVATE_ROUTE = createToken('serverModulePapiPrivateRoute', {
|
|
18
18
|
multi: true,
|
|
19
19
|
});
|
|
20
20
|
/**
|
|
21
21
|
* @description
|
|
22
|
-
*
|
|
22
|
+
* Add public papi route
|
|
23
23
|
*/
|
|
24
24
|
const SERVER_MODULE_PAPI_PUBLIC_ROUTE = createToken('serverModulePapiPublicRoute', {
|
|
25
25
|
multi: true,
|
|
26
26
|
});
|
|
27
27
|
/**
|
|
28
28
|
* @description
|
|
29
|
-
*
|
|
29
|
+
* Settings for the static server
|
|
30
30
|
*/
|
|
31
31
|
const SERVER_MODULE_STATICS_OPTIONS = createToken('serverModuleStaticsOptions');
|
|
32
32
|
/**
|
|
33
33
|
* @description
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Instance of nodejs `http.Server`.
|
|
35
|
+
* Can be used for adding custom logic on server, like error handling, connection settings
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
```tsx
|
|
@@ -53,8 +53,8 @@ const SERVER_MODULE_STATICS_OPTIONS = createToken('serverModuleStaticsOptions');
|
|
|
53
53
|
const SERVER_TOKEN = createToken('server');
|
|
54
54
|
/**
|
|
55
55
|
* @description
|
|
56
|
-
*
|
|
57
|
-
*
|
|
56
|
+
* Instance of the current server app. By default it is an `express` app.
|
|
57
|
+
* Can be used to setup custom request handler and add custom routes
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
```tsx
|
|
@@ -75,7 +75,7 @@ const SERVER_TOKEN = createToken('server');
|
|
|
75
75
|
const WEB_APP_TOKEN = createToken('webApp');
|
|
76
76
|
/**
|
|
77
77
|
* @description
|
|
78
|
-
*
|
|
78
|
+
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
79
79
|
*
|
|
80
80
|
* @example
|
|
81
81
|
```tsx
|
|
@@ -93,8 +93,8 @@ const WEB_APP_BEFORE_INIT_TOKEN = createToken('webAppBeforeInit', {
|
|
|
93
93
|
});
|
|
94
94
|
/**
|
|
95
95
|
* @description
|
|
96
|
-
*
|
|
97
|
-
*
|
|
96
|
+
* Subscription to web-app initialization.
|
|
97
|
+
* It is called after global request handlers but before handlers for page rendering
|
|
98
98
|
*
|
|
99
99
|
* @example
|
|
100
100
|
```tsx
|
|
@@ -111,7 +111,8 @@ const WEB_APP_BEFORE_INIT_TOKEN = createToken('webAppBeforeInit', {
|
|
|
111
111
|
const WEB_APP_INIT_TOKEN = createToken('webAppInit', { multi: true });
|
|
112
112
|
/**
|
|
113
113
|
* @description
|
|
114
|
-
*
|
|
114
|
+
* Subscription to after web-app initialization.
|
|
115
|
+
* It is called after any other handlers
|
|
115
116
|
*
|
|
116
117
|
* @example
|
|
117
118
|
```tsx
|
|
@@ -129,20 +130,20 @@ const WEB_APP_AFTER_INIT_TOKEN = createToken('webAppAfterInit', {
|
|
|
129
130
|
});
|
|
130
131
|
/**
|
|
131
132
|
* @description
|
|
132
|
-
*
|
|
133
|
+
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
133
134
|
*/
|
|
134
135
|
const PROXY_CONFIG_TOKEN = createToken('proxyConfigToken', {
|
|
135
136
|
multi: true,
|
|
136
137
|
});
|
|
137
138
|
/**
|
|
138
139
|
* @description
|
|
139
|
-
*
|
|
140
|
+
* Override filter function when accessing papi route `/dependenciesVersion`
|
|
140
141
|
*/
|
|
141
142
|
const DEPENDENCIES_VERSION_FILTER_TOKEN = createToken('dependenciesVersionFilter');
|
|
142
143
|
/**
|
|
143
144
|
* @description
|
|
144
|
-
*
|
|
145
|
-
*
|
|
145
|
+
* List of the special URLs on server (e.g. healthz and readyz)
|
|
146
|
+
* Url matching is happens with a library `path-to-regexp`.
|
|
146
147
|
*/
|
|
147
148
|
const SPECIAL_SERVER_PATHS = createToken('specialServerPaths', { multi: true });
|
|
148
149
|
|
package/lib/index.js
CHANGED
|
@@ -6,37 +6,37 @@ var dippy = require('@tinkoff/dippy');
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @description
|
|
9
|
-
*
|
|
9
|
+
* Specifies base url for public papi handlers. By default equals to `/[appName]/papi`
|
|
10
10
|
*/
|
|
11
11
|
const SERVER_MODULE_PAPI_PUBLIC_URL = dippy.createToken('serverModulePapiPublicUrl');
|
|
12
12
|
/**
|
|
13
13
|
* @description
|
|
14
|
-
*
|
|
14
|
+
* Specifies base url for private papi handlers. By default equals `/[appName]/private/papi`
|
|
15
15
|
*/
|
|
16
16
|
const SERVER_MODULE_PAPI_PRIVATE_URL = dippy.createToken('serverModulePapiPrivateUrl');
|
|
17
17
|
/**
|
|
18
18
|
* @description
|
|
19
|
-
*
|
|
19
|
+
* Add private papi route
|
|
20
20
|
*/
|
|
21
21
|
const SERVER_MODULE_PAPI_PRIVATE_ROUTE = dippy.createToken('serverModulePapiPrivateRoute', {
|
|
22
22
|
multi: true,
|
|
23
23
|
});
|
|
24
24
|
/**
|
|
25
25
|
* @description
|
|
26
|
-
*
|
|
26
|
+
* Add public papi route
|
|
27
27
|
*/
|
|
28
28
|
const SERVER_MODULE_PAPI_PUBLIC_ROUTE = dippy.createToken('serverModulePapiPublicRoute', {
|
|
29
29
|
multi: true,
|
|
30
30
|
});
|
|
31
31
|
/**
|
|
32
32
|
* @description
|
|
33
|
-
*
|
|
33
|
+
* Settings for the static server
|
|
34
34
|
*/
|
|
35
35
|
const SERVER_MODULE_STATICS_OPTIONS = dippy.createToken('serverModuleStaticsOptions');
|
|
36
36
|
/**
|
|
37
37
|
* @description
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Instance of nodejs `http.Server`.
|
|
39
|
+
* Can be used for adding custom logic on server, like error handling, connection settings
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
```tsx
|
|
@@ -57,8 +57,8 @@ const SERVER_MODULE_STATICS_OPTIONS = dippy.createToken('serverModuleStaticsOpti
|
|
|
57
57
|
const SERVER_TOKEN = dippy.createToken('server');
|
|
58
58
|
/**
|
|
59
59
|
* @description
|
|
60
|
-
*
|
|
61
|
-
*
|
|
60
|
+
* Instance of the current server app. By default it is an `express` app.
|
|
61
|
+
* Can be used to setup custom request handler and add custom routes
|
|
62
62
|
*
|
|
63
63
|
* @example
|
|
64
64
|
```tsx
|
|
@@ -79,7 +79,7 @@ const SERVER_TOKEN = dippy.createToken('server');
|
|
|
79
79
|
const WEB_APP_TOKEN = dippy.createToken('webApp');
|
|
80
80
|
/**
|
|
81
81
|
* @description
|
|
82
|
-
*
|
|
82
|
+
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
83
83
|
*
|
|
84
84
|
* @example
|
|
85
85
|
```tsx
|
|
@@ -97,8 +97,8 @@ const WEB_APP_BEFORE_INIT_TOKEN = dippy.createToken('webAppBeforeInit', {
|
|
|
97
97
|
});
|
|
98
98
|
/**
|
|
99
99
|
* @description
|
|
100
|
-
*
|
|
101
|
-
*
|
|
100
|
+
* Subscription to web-app initialization.
|
|
101
|
+
* It is called after global request handlers but before handlers for page rendering
|
|
102
102
|
*
|
|
103
103
|
* @example
|
|
104
104
|
```tsx
|
|
@@ -115,7 +115,8 @@ const WEB_APP_BEFORE_INIT_TOKEN = dippy.createToken('webAppBeforeInit', {
|
|
|
115
115
|
const WEB_APP_INIT_TOKEN = dippy.createToken('webAppInit', { multi: true });
|
|
116
116
|
/**
|
|
117
117
|
* @description
|
|
118
|
-
*
|
|
118
|
+
* Subscription to after web-app initialization.
|
|
119
|
+
* It is called after any other handlers
|
|
119
120
|
*
|
|
120
121
|
* @example
|
|
121
122
|
```tsx
|
|
@@ -133,20 +134,20 @@ const WEB_APP_AFTER_INIT_TOKEN = dippy.createToken('webAppAfterInit', {
|
|
|
133
134
|
});
|
|
134
135
|
/**
|
|
135
136
|
* @description
|
|
136
|
-
*
|
|
137
|
+
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
137
138
|
*/
|
|
138
139
|
const PROXY_CONFIG_TOKEN = dippy.createToken('proxyConfigToken', {
|
|
139
140
|
multi: true,
|
|
140
141
|
});
|
|
141
142
|
/**
|
|
142
143
|
* @description
|
|
143
|
-
*
|
|
144
|
+
* Override filter function when accessing papi route `/dependenciesVersion`
|
|
144
145
|
*/
|
|
145
146
|
const DEPENDENCIES_VERSION_FILTER_TOKEN = dippy.createToken('dependenciesVersionFilter');
|
|
146
147
|
/**
|
|
147
148
|
* @description
|
|
148
|
-
*
|
|
149
|
-
*
|
|
149
|
+
* List of the special URLs on server (e.g. healthz and readyz)
|
|
150
|
+
* Url matching is happens with a library `path-to-regexp`.
|
|
150
151
|
*/
|
|
151
152
|
const SPECIAL_SERVER_PATHS = dippy.createToken('specialServerPaths', { multi: true });
|
|
152
153
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"build-for-publish": "true"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tramvai/papi": "1.
|
|
22
|
+
"@tramvai/papi": "1.45.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@tinkoff/dippy": "0.7.35",
|