@tramvai/tokens-server 2.31.0 → 2.32.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.d.ts +0 -96
- package/lib/index.es.js +1 -101
- package/lib/index.js +0 -105
- package/package.json +2 -6
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Server } from 'http';
|
|
3
|
-
import type { Application } from 'express';
|
|
4
3
|
import type { Papi } from '@tramvai/papi';
|
|
5
4
|
declare module '@tramvai/papi' {
|
|
6
5
|
interface Options {
|
|
@@ -60,100 +59,6 @@ export declare const SERVER_MODULE_STATICS_OPTIONS: import("@tinkoff/dippy").Bas
|
|
|
60
59
|
```
|
|
61
60
|
*/
|
|
62
61
|
export declare const SERVER_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>>;
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
65
|
-
* @description
|
|
66
|
-
* Instance of the current server app. By default it is an `express` app.
|
|
67
|
-
* Can be used to setup custom request handler and add custom routes
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
```tsx
|
|
71
|
-
{
|
|
72
|
-
provide: SERVER_TOKEN,
|
|
73
|
-
useFactory: ({ webApp }) => {
|
|
74
|
-
const server = https.createServer();
|
|
75
|
-
server.on('request', webApp);
|
|
76
|
-
|
|
77
|
-
return server;
|
|
78
|
-
},
|
|
79
|
-
deps: {
|
|
80
|
-
WEB_APP_TOKEN,
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
*/
|
|
85
|
-
export declare const WEB_APP_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<Application>;
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
88
|
-
* @description
|
|
89
|
-
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
```tsx
|
|
93
|
-
{
|
|
94
|
-
provide: WEB_APP_BEFORE_INIT_TOKEN,
|
|
95
|
-
multi: true,
|
|
96
|
-
useValue: (app) => {
|
|
97
|
-
app.use(cookieParser())
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
```
|
|
101
|
-
*/
|
|
102
|
-
export declare const WEB_APP_BEFORE_INIT_TOKEN: import("@tinkoff/dippy").MultiTokenInterface<APP_INIT_HANDLER>;
|
|
103
|
-
/**
|
|
104
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
105
|
-
* @description
|
|
106
|
-
* Subscription to web-app initialization.
|
|
107
|
-
* It is called after global request handlers but before handlers for page rendering
|
|
108
|
-
*
|
|
109
|
-
* @example
|
|
110
|
-
```tsx
|
|
111
|
-
{
|
|
112
|
-
provide: WEB_APP_INIT_TOKEN,
|
|
113
|
-
multi: true,
|
|
114
|
-
useValue: (app) => {
|
|
115
|
-
app.use('mm.css', proxyCss());
|
|
116
|
-
app.use('mm.js', proxyClientJs());
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
```
|
|
120
|
-
*/
|
|
121
|
-
export declare const WEB_APP_INIT_TOKEN: import("@tinkoff/dippy").MultiTokenInterface<APP_INIT_HANDLER>;
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
124
|
-
* @description
|
|
125
|
-
* You can limit requests of application.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
```tsx
|
|
129
|
-
{
|
|
130
|
-
provide: WEB_APP_LIMITER_TOKEN,
|
|
131
|
-
multi: true,
|
|
132
|
-
useValue: (app) => {
|
|
133
|
-
app.use(logMiddleware())
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
```
|
|
137
|
-
*/
|
|
138
|
-
export declare const WEB_APP_LIMITER_TOKEN: import("@tinkoff/dippy").MultiTokenInterface<APP_INIT_HANDLER>;
|
|
139
|
-
/**
|
|
140
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
141
|
-
* @description
|
|
142
|
-
* Subscription to after web-app initialization.
|
|
143
|
-
* It is called after any other handlers
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
```tsx
|
|
147
|
-
{
|
|
148
|
-
provide: WEB_APP_AFTER_INIT_TOKEN,
|
|
149
|
-
multi: true,
|
|
150
|
-
useValue: (app) => {
|
|
151
|
-
app.use(logMiddleware())
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
*/
|
|
156
|
-
export declare const WEB_APP_AFTER_INIT_TOKEN: import("@tinkoff/dippy").MultiTokenInterface<APP_INIT_HANDLER>;
|
|
157
62
|
/**
|
|
158
63
|
* @description
|
|
159
64
|
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
@@ -190,7 +95,6 @@ export declare const LIVENESS_PROBE_TOKEN: import("@tinkoff/dippy").BaseTokenInt
|
|
|
190
95
|
export interface ServerModuleStaticsOptions {
|
|
191
96
|
path: string;
|
|
192
97
|
}
|
|
193
|
-
export declare type APP_INIT_HANDLER = (app?: Application) => Promise<void> | void;
|
|
194
98
|
export declare type ProxyConfig = {
|
|
195
99
|
[key: string]: string | {
|
|
196
100
|
target: string;
|
package/lib/index.es.js
CHANGED
|
@@ -51,106 +51,6 @@ const SERVER_MODULE_STATICS_OPTIONS = createToken('serverModuleStaticsOptions');
|
|
|
51
51
|
```
|
|
52
52
|
*/
|
|
53
53
|
const SERVER_TOKEN = createToken('server');
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
56
|
-
* @description
|
|
57
|
-
* Instance of the current server app. By default it is an `express` app.
|
|
58
|
-
* Can be used to setup custom request handler and add custom routes
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
```tsx
|
|
62
|
-
{
|
|
63
|
-
provide: SERVER_TOKEN,
|
|
64
|
-
useFactory: ({ webApp }) => {
|
|
65
|
-
const server = https.createServer();
|
|
66
|
-
server.on('request', webApp);
|
|
67
|
-
|
|
68
|
-
return server;
|
|
69
|
-
},
|
|
70
|
-
deps: {
|
|
71
|
-
WEB_APP_TOKEN,
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
*/
|
|
76
|
-
const WEB_APP_TOKEN = createToken('webApp');
|
|
77
|
-
/**
|
|
78
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
79
|
-
* @description
|
|
80
|
-
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
81
|
-
*
|
|
82
|
-
* @example
|
|
83
|
-
```tsx
|
|
84
|
-
{
|
|
85
|
-
provide: WEB_APP_BEFORE_INIT_TOKEN,
|
|
86
|
-
multi: true,
|
|
87
|
-
useValue: (app) => {
|
|
88
|
-
app.use(cookieParser())
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
*/
|
|
93
|
-
const WEB_APP_BEFORE_INIT_TOKEN = createToken('webAppBeforeInit', {
|
|
94
|
-
multi: true,
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
98
|
-
* @description
|
|
99
|
-
* Subscription to web-app initialization.
|
|
100
|
-
* It is called after global request handlers but before handlers for page rendering
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
```tsx
|
|
104
|
-
{
|
|
105
|
-
provide: WEB_APP_INIT_TOKEN,
|
|
106
|
-
multi: true,
|
|
107
|
-
useValue: (app) => {
|
|
108
|
-
app.use('mm.css', proxyCss());
|
|
109
|
-
app.use('mm.js', proxyClientJs());
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
*/
|
|
114
|
-
const WEB_APP_INIT_TOKEN = createToken('webAppInit', { multi: true });
|
|
115
|
-
/**
|
|
116
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
117
|
-
* @description
|
|
118
|
-
* You can limit requests of application.
|
|
119
|
-
*
|
|
120
|
-
* @example
|
|
121
|
-
```tsx
|
|
122
|
-
{
|
|
123
|
-
provide: WEB_APP_LIMITER_TOKEN,
|
|
124
|
-
multi: true,
|
|
125
|
-
useValue: (app) => {
|
|
126
|
-
app.use(logMiddleware())
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
*/
|
|
131
|
-
const WEB_APP_LIMITER_TOKEN = createToken('webAppLimitter', {
|
|
132
|
-
multi: true,
|
|
133
|
-
});
|
|
134
|
-
/**
|
|
135
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
136
|
-
* @description
|
|
137
|
-
* Subscription to after web-app initialization.
|
|
138
|
-
* It is called after any other handlers
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
```tsx
|
|
142
|
-
{
|
|
143
|
-
provide: WEB_APP_AFTER_INIT_TOKEN,
|
|
144
|
-
multi: true,
|
|
145
|
-
useValue: (app) => {
|
|
146
|
-
app.use(logMiddleware())
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
*/
|
|
151
|
-
const WEB_APP_AFTER_INIT_TOKEN = createToken('webAppAfterInit', {
|
|
152
|
-
multi: true,
|
|
153
|
-
});
|
|
154
54
|
/**
|
|
155
55
|
* @description
|
|
156
56
|
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
@@ -187,4 +87,4 @@ const READINESS_PROBE_TOKEN = createToken('readiness-probe-fn');
|
|
|
187
87
|
*/
|
|
188
88
|
const LIVENESS_PROBE_TOKEN = createToken('liveness-probe-fn');
|
|
189
89
|
|
|
190
|
-
export { DEPENDENCIES_VERSION_FILTER_TOKEN, LIVENESS_PROBE_TOKEN, PROXY_CONFIG_TOKEN, READINESS_PROBE_TOKEN, SERVER_MODULE_PAPI_PRIVATE_ROUTE, SERVER_MODULE_PAPI_PRIVATE_URL, SERVER_MODULE_PAPI_PUBLIC_ROUTE, SERVER_MODULE_PAPI_PUBLIC_URL, SERVER_MODULE_STATICS_OPTIONS, SERVER_TOKEN, UTILITY_SERVER_PATHS, UTILITY_SERVER_PORT_TOKEN
|
|
90
|
+
export { DEPENDENCIES_VERSION_FILTER_TOKEN, LIVENESS_PROBE_TOKEN, PROXY_CONFIG_TOKEN, READINESS_PROBE_TOKEN, SERVER_MODULE_PAPI_PRIVATE_ROUTE, SERVER_MODULE_PAPI_PRIVATE_URL, SERVER_MODULE_PAPI_PUBLIC_ROUTE, SERVER_MODULE_PAPI_PUBLIC_URL, SERVER_MODULE_STATICS_OPTIONS, SERVER_TOKEN, UTILITY_SERVER_PATHS, UTILITY_SERVER_PORT_TOKEN };
|
package/lib/index.js
CHANGED
|
@@ -55,106 +55,6 @@ const SERVER_MODULE_STATICS_OPTIONS = dippy.createToken('serverModuleStaticsOpti
|
|
|
55
55
|
```
|
|
56
56
|
*/
|
|
57
57
|
const SERVER_TOKEN = dippy.createToken('server');
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
60
|
-
* @description
|
|
61
|
-
* Instance of the current server app. By default it is an `express` app.
|
|
62
|
-
* Can be used to setup custom request handler and add custom routes
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
```tsx
|
|
66
|
-
{
|
|
67
|
-
provide: SERVER_TOKEN,
|
|
68
|
-
useFactory: ({ webApp }) => {
|
|
69
|
-
const server = https.createServer();
|
|
70
|
-
server.on('request', webApp);
|
|
71
|
-
|
|
72
|
-
return server;
|
|
73
|
-
},
|
|
74
|
-
deps: {
|
|
75
|
-
WEB_APP_TOKEN,
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
```
|
|
79
|
-
*/
|
|
80
|
-
const WEB_APP_TOKEN = dippy.createToken('webApp');
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
83
|
-
* @description
|
|
84
|
-
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
```tsx
|
|
88
|
-
{
|
|
89
|
-
provide: WEB_APP_BEFORE_INIT_TOKEN,
|
|
90
|
-
multi: true,
|
|
91
|
-
useValue: (app) => {
|
|
92
|
-
app.use(cookieParser())
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
*/
|
|
97
|
-
const WEB_APP_BEFORE_INIT_TOKEN = dippy.createToken('webAppBeforeInit', {
|
|
98
|
-
multi: true,
|
|
99
|
-
});
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
102
|
-
* @description
|
|
103
|
-
* Subscription to web-app initialization.
|
|
104
|
-
* It is called after global request handlers but before handlers for page rendering
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
```tsx
|
|
108
|
-
{
|
|
109
|
-
provide: WEB_APP_INIT_TOKEN,
|
|
110
|
-
multi: true,
|
|
111
|
-
useValue: (app) => {
|
|
112
|
-
app.use('mm.css', proxyCss());
|
|
113
|
-
app.use('mm.js', proxyClientJs());
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
```
|
|
117
|
-
*/
|
|
118
|
-
const WEB_APP_INIT_TOKEN = dippy.createToken('webAppInit', { multi: true });
|
|
119
|
-
/**
|
|
120
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
121
|
-
* @description
|
|
122
|
-
* You can limit requests of application.
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
```tsx
|
|
126
|
-
{
|
|
127
|
-
provide: WEB_APP_LIMITER_TOKEN,
|
|
128
|
-
multi: true,
|
|
129
|
-
useValue: (app) => {
|
|
130
|
-
app.use(logMiddleware())
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
```
|
|
134
|
-
*/
|
|
135
|
-
const WEB_APP_LIMITER_TOKEN = dippy.createToken('webAppLimitter', {
|
|
136
|
-
multi: true,
|
|
137
|
-
});
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Prefer not to use such low-level entity as it may change in the future or will be dropped.
|
|
140
|
-
* @description
|
|
141
|
-
* Subscription to after web-app initialization.
|
|
142
|
-
* It is called after any other handlers
|
|
143
|
-
*
|
|
144
|
-
* @example
|
|
145
|
-
```tsx
|
|
146
|
-
{
|
|
147
|
-
provide: WEB_APP_AFTER_INIT_TOKEN,
|
|
148
|
-
multi: true,
|
|
149
|
-
useValue: (app) => {
|
|
150
|
-
app.use(logMiddleware())
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
*/
|
|
155
|
-
const WEB_APP_AFTER_INIT_TOKEN = dippy.createToken('webAppAfterInit', {
|
|
156
|
-
multi: true,
|
|
157
|
-
});
|
|
158
58
|
/**
|
|
159
59
|
* @description
|
|
160
60
|
* Add resources for request proxying to the app through `http-proxy-middleware`
|
|
@@ -203,8 +103,3 @@ exports.SERVER_MODULE_STATICS_OPTIONS = SERVER_MODULE_STATICS_OPTIONS;
|
|
|
203
103
|
exports.SERVER_TOKEN = SERVER_TOKEN;
|
|
204
104
|
exports.UTILITY_SERVER_PATHS = UTILITY_SERVER_PATHS;
|
|
205
105
|
exports.UTILITY_SERVER_PORT_TOKEN = UTILITY_SERVER_PORT_TOKEN;
|
|
206
|
-
exports.WEB_APP_AFTER_INIT_TOKEN = WEB_APP_AFTER_INIT_TOKEN;
|
|
207
|
-
exports.WEB_APP_BEFORE_INIT_TOKEN = WEB_APP_BEFORE_INIT_TOKEN;
|
|
208
|
-
exports.WEB_APP_INIT_TOKEN = WEB_APP_INIT_TOKEN;
|
|
209
|
-
exports.WEB_APP_LIMITER_TOKEN = WEB_APP_LIMITER_TOKEN;
|
|
210
|
-
exports.WEB_APP_TOKEN = WEB_APP_TOKEN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -19,15 +19,11 @@
|
|
|
19
19
|
"build-for-publish": "true"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tramvai/papi": "2.
|
|
22
|
+
"@tramvai/papi": "2.32.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@tinkoff/dippy": "0.8.6",
|
|
26
|
-
"express": "^4.17.1",
|
|
27
26
|
"tslib": "^2.4.0"
|
|
28
27
|
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"@types/express": "^4.17.9"
|
|
31
|
-
},
|
|
32
28
|
"license": "Apache-2.0"
|
|
33
29
|
}
|