@tramvai/tokens-server-private 1.85.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 ADDED
@@ -0,0 +1,47 @@
1
+ /// <reference types="node" />
2
+ import type { FastifyError, FastifyInstance, FastifyReply, FastifyRequest } from 'fastify';
3
+ /**
4
+ * @description
5
+ * Instance of the current fastify app that handles requests.
6
+ * Can be used to setup custom request handler and add custom routes
7
+ */
8
+ export declare const WEB_FASTIFY_APP_TOKEN: FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").FastifyLoggerInstance>;
9
+ /**
10
+ * @description
11
+ * Subscription to before web-app initialization. It is called before any standard handlers.
12
+ */
13
+ export declare const WEB_FASTIFY_APP_BEFORE_INIT_TOKEN: FASTIFY_APP_INIT_HANDLER;
14
+ /**
15
+ * @description
16
+ * Subscription to web-app initialization.
17
+ * It is called after global request handlers but before handlers for page rendering
18
+ */
19
+ export declare const WEB_FASTIFY_APP_INIT_TOKEN: FASTIFY_APP_INIT_HANDLER;
20
+ /**
21
+ * @description
22
+ * You can limit requests of application.
23
+ */
24
+ export declare const WEB_FASTIFY_APP_LIMITER_TOKEN: FASTIFY_APP_INIT_HANDLER;
25
+ /**
26
+ * @description
27
+ * Subscription to after web-app initialization.
28
+ * It is called after any other handlers
29
+ */
30
+ export declare const WEB_FASTIFY_APP_AFTER_INIT_TOKEN: FASTIFY_APP_INIT_HANDLER;
31
+ /**
32
+ * @description
33
+ * Subscription to error handler before any default handlers.
34
+ */
35
+ export declare const WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN: FASTIFY_APP_ERROR_HANDLER;
36
+ /**
37
+ * @description
38
+ * Subscription to error handler.
39
+ */
40
+ export declare const WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN: FASTIFY_APP_ERROR_HANDLER;
41
+ /**
42
+ * @description
43
+ * Subscription to error handler after default handlers.
44
+ */
45
+ export declare const WEB_FASTIFY_APP_AFTER_ERROR_TOKEN: FASTIFY_APP_ERROR_HANDLER;
46
+ export declare type FASTIFY_APP_INIT_HANDLER = Array<(app: FastifyInstance) => Promise<void> | void>;
47
+ export declare type FASTIFY_APP_ERROR_HANDLER = Array<(error: FastifyError, request: FastifyRequest, reply: FastifyReply) => Promise<string | undefined> | string | undefined>;
@@ -0,0 +1,47 @@
1
+ import { createToken } from '@tinkoff/dippy';
2
+
3
+ /**
4
+ * @description
5
+ * Instance of the current fastify app that handles requests.
6
+ * Can be used to setup custom request handler and add custom routes
7
+ */
8
+ const WEB_FASTIFY_APP_TOKEN = createToken('webApp fastify');
9
+ /**
10
+ * @description
11
+ * Subscription to before web-app initialization. It is called before any standard handlers.
12
+ */
13
+ const WEB_FASTIFY_APP_BEFORE_INIT_TOKEN = createToken('webApp fastify beforeInit', { multi: true });
14
+ /**
15
+ * @description
16
+ * Subscription to web-app initialization.
17
+ * It is called after global request handlers but before handlers for page rendering
18
+ */
19
+ const WEB_FASTIFY_APP_INIT_TOKEN = createToken('webApp fastify init', { multi: true });
20
+ /**
21
+ * @description
22
+ * You can limit requests of application.
23
+ */
24
+ const WEB_FASTIFY_APP_LIMITER_TOKEN = createToken('webApp fastify limiter', { multi: true });
25
+ /**
26
+ * @description
27
+ * Subscription to after web-app initialization.
28
+ * It is called after any other handlers
29
+ */
30
+ const WEB_FASTIFY_APP_AFTER_INIT_TOKEN = createToken('webApp fastify afterInit', { multi: true });
31
+ /**
32
+ * @description
33
+ * Subscription to error handler before any default handlers.
34
+ */
35
+ const WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN = createToken('webApp fastify beforeError', { multi: true });
36
+ /**
37
+ * @description
38
+ * Subscription to error handler.
39
+ */
40
+ const WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN = createToken('webApp fastify error', { multi: true });
41
+ /**
42
+ * @description
43
+ * Subscription to error handler after default handlers.
44
+ */
45
+ const WEB_FASTIFY_APP_AFTER_ERROR_TOKEN = createToken('webApp fastify afterError', { multi: true });
46
+
47
+ export { 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_INIT_TOKEN, WEB_FASTIFY_APP_LIMITER_TOKEN, WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN, WEB_FASTIFY_APP_TOKEN };
package/lib/index.js ADDED
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dippy = require('@tinkoff/dippy');
6
+
7
+ /**
8
+ * @description
9
+ * Instance of the current fastify app that handles requests.
10
+ * Can be used to setup custom request handler and add custom routes
11
+ */
12
+ const WEB_FASTIFY_APP_TOKEN = dippy.createToken('webApp fastify');
13
+ /**
14
+ * @description
15
+ * Subscription to before web-app initialization. It is called before any standard handlers.
16
+ */
17
+ const WEB_FASTIFY_APP_BEFORE_INIT_TOKEN = dippy.createToken('webApp fastify beforeInit', { multi: true });
18
+ /**
19
+ * @description
20
+ * Subscription to web-app initialization.
21
+ * It is called after global request handlers but before handlers for page rendering
22
+ */
23
+ const WEB_FASTIFY_APP_INIT_TOKEN = dippy.createToken('webApp fastify init', { multi: true });
24
+ /**
25
+ * @description
26
+ * You can limit requests of application.
27
+ */
28
+ const WEB_FASTIFY_APP_LIMITER_TOKEN = dippy.createToken('webApp fastify limiter', { multi: true });
29
+ /**
30
+ * @description
31
+ * Subscription to after web-app initialization.
32
+ * It is called after any other handlers
33
+ */
34
+ const WEB_FASTIFY_APP_AFTER_INIT_TOKEN = dippy.createToken('webApp fastify afterInit', { multi: true });
35
+ /**
36
+ * @description
37
+ * Subscription to error handler before any default handlers.
38
+ */
39
+ const WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN = dippy.createToken('webApp fastify beforeError', { multi: true });
40
+ /**
41
+ * @description
42
+ * Subscription to error handler.
43
+ */
44
+ const WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN = dippy.createToken('webApp fastify error', { multi: true });
45
+ /**
46
+ * @description
47
+ * Subscription to error handler after default handlers.
48
+ */
49
+ const WEB_FASTIFY_APP_AFTER_ERROR_TOKEN = dippy.createToken('webApp fastify afterError', { multi: true });
50
+
51
+ exports.WEB_FASTIFY_APP_AFTER_ERROR_TOKEN = WEB_FASTIFY_APP_AFTER_ERROR_TOKEN;
52
+ exports.WEB_FASTIFY_APP_AFTER_INIT_TOKEN = WEB_FASTIFY_APP_AFTER_INIT_TOKEN;
53
+ exports.WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN = WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN;
54
+ exports.WEB_FASTIFY_APP_BEFORE_INIT_TOKEN = WEB_FASTIFY_APP_BEFORE_INIT_TOKEN;
55
+ exports.WEB_FASTIFY_APP_INIT_TOKEN = WEB_FASTIFY_APP_INIT_TOKEN;
56
+ exports.WEB_FASTIFY_APP_LIMITER_TOKEN = WEB_FASTIFY_APP_LIMITER_TOKEN;
57
+ exports.WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN = WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN;
58
+ exports.WEB_FASTIFY_APP_TOKEN = WEB_FASTIFY_APP_TOKEN;
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@tramvai/tokens-server-private",
3
+ "version": "1.85.0",
4
+ "description": "Tramvai private tokens for @tramvai/module-server",
5
+ "main": "lib/index.js",
6
+ "module": "lib/index.es.js",
7
+ "typings": "lib/index.d.ts",
8
+ "files": [
9
+ "lib"
10
+ ],
11
+ "sideEffects": false,
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git@github.com:Tinkoff/tramvai.git"
15
+ },
16
+ "scripts": {
17
+ "build": "tramvai-build --for-publish",
18
+ "watch": "tsc -w",
19
+ "build-for-publish": "true"
20
+ },
21
+ "dependencies": {},
22
+ "peerDependencies": {
23
+ "@tinkoff/dippy": "0.7.39",
24
+ "fastify": "^3.27.4",
25
+ "tslib": "^2.0.3"
26
+ },
27
+ "devDependencies": {},
28
+ "license": "Apache-2.0"
29
+ }