@tramvai/tokens-server-private 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 +17 -3
- package/lib/index.es.js +11 -1
- package/lib/index.js +12 -0
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Server } from 'http';
|
|
3
|
-
import type { FastifyError, FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
|
|
3
|
+
import type { FastifyError, FastifyInstance, FastifyReply, FastifyRequest as OriginalFastifyRequest } from 'fastify';
|
|
4
4
|
import type { Papi } from '@tramvai/papi';
|
|
5
|
+
declare type FastifyRequest = OriginalFastifyRequest & {
|
|
6
|
+
cookies: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* Direct reference to request object
|
|
11
|
+
*/
|
|
12
|
+
export declare const FASTIFY_REQUEST: import("@tinkoff/dippy").BaseTokenInterface<FastifyRequest>;
|
|
13
|
+
/**
|
|
14
|
+
* @description
|
|
15
|
+
* Direct reference to response object
|
|
16
|
+
*/
|
|
17
|
+
export declare const FASTIFY_RESPONSE: import("@tinkoff/dippy").BaseTokenInterface<FastifyReply<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>>;
|
|
5
18
|
/**
|
|
6
19
|
* @description
|
|
7
20
|
* Creates new server instance
|
|
@@ -19,7 +32,7 @@ export declare const WEB_FASTIFY_APP_FACTORY_TOKEN: import("@tinkoff/dippy").Bas
|
|
|
19
32
|
* Instance of the current fastify app that handles requests.
|
|
20
33
|
* Can be used to setup custom request handler and add custom routes
|
|
21
34
|
*/
|
|
22
|
-
export declare const WEB_FASTIFY_APP_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").
|
|
35
|
+
export declare const WEB_FASTIFY_APP_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
|
|
23
36
|
/**
|
|
24
37
|
* @description
|
|
25
38
|
* Subscription to before web-app initialization. It is called before any standard handlers.
|
|
@@ -71,8 +84,9 @@ export declare const UTILITY_SERVER_TOKEN: import("@tinkoff/dippy").BaseTokenInt
|
|
|
71
84
|
* @description
|
|
72
85
|
* Web app for utility routes
|
|
73
86
|
*/
|
|
74
|
-
export declare const UTILITY_WEB_FASTIFY_APP_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").
|
|
87
|
+
export declare const UTILITY_WEB_FASTIFY_APP_TOKEN: import("@tinkoff/dippy").BaseTokenInterface<FastifyInstance<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify").FastifyBaseLogger, import("fastify").FastifyTypeProviderDefault>>;
|
|
75
88
|
export declare type FASTIFY_APP_INIT_HANDLER = (app: FastifyInstance) => Promise<void> | void;
|
|
76
89
|
export declare type FASTIFY_APP_ERROR_HANDLER = (error: FastifyError, request: FastifyRequest, reply: FastifyReply) => Promise<string | undefined | void> | string | undefined | void;
|
|
77
90
|
export declare type PapiExecutor = <Result>(papi: Papi<Result>) => Result;
|
|
78
91
|
export declare const PAPI_EXECUTOR: import("@tinkoff/dippy").BaseTokenInterface<PapiExecutor>;
|
|
92
|
+
export {};
|
package/lib/index.es.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { createToken } from '@tinkoff/dippy';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* Direct reference to request object
|
|
6
|
+
*/
|
|
7
|
+
const FASTIFY_REQUEST = createToken('fastify request');
|
|
8
|
+
/**
|
|
9
|
+
* @description
|
|
10
|
+
* Direct reference to response object
|
|
11
|
+
*/
|
|
12
|
+
const FASTIFY_RESPONSE = createToken('fastify response');
|
|
3
13
|
/**
|
|
4
14
|
* @description
|
|
5
15
|
* Creates new server instance
|
|
@@ -70,4 +80,4 @@ const UTILITY_SERVER_TOKEN = createToken('server utilityServer');
|
|
|
70
80
|
const UTILITY_WEB_FASTIFY_APP_TOKEN = createToken('webApp utilityServer');
|
|
71
81
|
const PAPI_EXECUTOR = createToken('papi executor');
|
|
72
82
|
|
|
73
|
-
export { PAPI_EXECUTOR, SERVER_FACTORY_TOKEN, UTILITY_SERVER_TOKEN, UTILITY_WEB_FASTIFY_APP_TOKEN, WEB_FASTIFY_APP_AFTER_ERROR_TOKEN, WEB_FASTIFY_APP_AFTER_INIT_TOKEN, WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN, WEB_FASTIFY_APP_BEFORE_INIT_TOKEN, WEB_FASTIFY_APP_FACTORY_TOKEN, WEB_FASTIFY_APP_INIT_TOKEN, WEB_FASTIFY_APP_LIMITER_TOKEN, WEB_FASTIFY_APP_METRICS_TOKEN, WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN, WEB_FASTIFY_APP_TOKEN };
|
|
83
|
+
export { FASTIFY_REQUEST, FASTIFY_RESPONSE, PAPI_EXECUTOR, SERVER_FACTORY_TOKEN, UTILITY_SERVER_TOKEN, UTILITY_WEB_FASTIFY_APP_TOKEN, WEB_FASTIFY_APP_AFTER_ERROR_TOKEN, WEB_FASTIFY_APP_AFTER_INIT_TOKEN, WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN, WEB_FASTIFY_APP_BEFORE_INIT_TOKEN, WEB_FASTIFY_APP_FACTORY_TOKEN, WEB_FASTIFY_APP_INIT_TOKEN, WEB_FASTIFY_APP_LIMITER_TOKEN, WEB_FASTIFY_APP_METRICS_TOKEN, WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN, WEB_FASTIFY_APP_TOKEN };
|
package/lib/index.js
CHANGED
|
@@ -4,6 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var dippy = require('@tinkoff/dippy');
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @description
|
|
9
|
+
* Direct reference to request object
|
|
10
|
+
*/
|
|
11
|
+
const FASTIFY_REQUEST = dippy.createToken('fastify request');
|
|
12
|
+
/**
|
|
13
|
+
* @description
|
|
14
|
+
* Direct reference to response object
|
|
15
|
+
*/
|
|
16
|
+
const FASTIFY_RESPONSE = dippy.createToken('fastify response');
|
|
7
17
|
/**
|
|
8
18
|
* @description
|
|
9
19
|
* Creates new server instance
|
|
@@ -74,6 +84,8 @@ const UTILITY_SERVER_TOKEN = dippy.createToken('server utilityServer');
|
|
|
74
84
|
const UTILITY_WEB_FASTIFY_APP_TOKEN = dippy.createToken('webApp utilityServer');
|
|
75
85
|
const PAPI_EXECUTOR = dippy.createToken('papi executor');
|
|
76
86
|
|
|
87
|
+
exports.FASTIFY_REQUEST = FASTIFY_REQUEST;
|
|
88
|
+
exports.FASTIFY_RESPONSE = FASTIFY_RESPONSE;
|
|
77
89
|
exports.PAPI_EXECUTOR = PAPI_EXECUTOR;
|
|
78
90
|
exports.SERVER_FACTORY_TOKEN = SERVER_FACTORY_TOKEN;
|
|
79
91
|
exports.UTILITY_SERVER_TOKEN = UTILITY_SERVER_TOKEN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-server-private",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.32.0",
|
|
4
4
|
"description": "Tramvai private tokens for @tramvai/module-server",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -19,11 +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
|
-
"fastify": "^
|
|
26
|
+
"fastify": "^4.6.0",
|
|
27
27
|
"tslib": "^2.4.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {},
|