@tramvai/module-server 1.84.2 → 1.90.1
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/server/error.d.ts +6 -3
- package/lib/server/express-compatibility.d.ts +25 -0
- package/lib/server/server.d.ts +2 -4
- package/lib/server/webApp.d.ts +25 -9
- package/lib/server/xHeaders.d.ts +2 -2
- package/lib/server.es.js +265 -96
- package/lib/server.js +276 -102
- package/package.json +18 -14
package/lib/server/error.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
2
|
import type { LOGGER_TOKEN } from '@tramvai/module-common';
|
|
3
|
-
|
|
4
|
-
export declare const errorHandler: (app:
|
|
3
|
+
import type { WEB_FASTIFY_APP_AFTER_ERROR_TOKEN, WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN, WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN } from '@tramvai/tokens-server-private';
|
|
4
|
+
export declare const errorHandler: (app: FastifyInstance, { log, beforeError, processError, afterError, }: {
|
|
5
5
|
log: ReturnType<typeof LOGGER_TOKEN>;
|
|
6
|
+
beforeError: typeof WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN;
|
|
7
|
+
processError: typeof WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN;
|
|
8
|
+
afterError: typeof WEB_FASTIFY_APP_AFTER_ERROR_TOKEN;
|
|
6
9
|
}) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fork of https://github.com/fastify/fastify-express
|
|
3
|
+
*/
|
|
4
|
+
/// <reference types="node" />
|
|
5
|
+
import express from 'express';
|
|
6
|
+
import type { FastifyPluginCallback } from 'fastify';
|
|
7
|
+
declare module 'fastify' {
|
|
8
|
+
interface FastifyInstance {
|
|
9
|
+
/**
|
|
10
|
+
* Express middleware function
|
|
11
|
+
*/
|
|
12
|
+
use: express.Application['use'];
|
|
13
|
+
/**
|
|
14
|
+
* Express application instance
|
|
15
|
+
*/
|
|
16
|
+
express: express.Application;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
interface Options {
|
|
20
|
+
express: {
|
|
21
|
+
instance: express.Application;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export declare const fastifyExpressCompatibility: FastifyPluginCallback<Options, import("http").Server>;
|
|
25
|
+
export {};
|
package/lib/server/server.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import http from 'http';
|
|
3
|
-
import type { SERVER_TOKEN
|
|
3
|
+
import type { SERVER_TOKEN } from '@tramvai/tokens-server';
|
|
4
4
|
import type { LOGGER_TOKEN } from '@tramvai/tokens-common';
|
|
5
5
|
import type { ENV_MANAGER_TOKEN } from '@tramvai/module-environment';
|
|
6
|
-
export declare const serverFactory: (
|
|
7
|
-
webApp: typeof WEB_APP_TOKEN;
|
|
8
|
-
}) => http.Server;
|
|
6
|
+
export declare const serverFactory: () => http.Server;
|
|
9
7
|
export declare const serverListenCommand: ({ server, logger, envManager, }: {
|
|
10
8
|
server: typeof SERVER_TOKEN;
|
|
11
9
|
logger: typeof LOGGER_TOKEN;
|
package/lib/server/webApp.d.ts
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { LOGGER_TOKEN } from '@tramvai/tokens-common';
|
|
2
3
|
import type { COMMAND_LINE_RUNNER_TOKEN } from '@tramvai/core';
|
|
3
|
-
import type { WEB_APP_TOKEN, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_INIT_TOKEN, WEB_APP_AFTER_INIT_TOKEN, WEB_APP_LIMITER_TOKEN } from '@tramvai/tokens-server';
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
6
|
-
|
|
4
|
+
import type { WEB_APP_TOKEN, WEB_APP_BEFORE_INIT_TOKEN, WEB_APP_INIT_TOKEN, WEB_APP_AFTER_INIT_TOKEN, WEB_APP_LIMITER_TOKEN, SERVER_TOKEN } from '@tramvai/tokens-server';
|
|
5
|
+
import type { WEB_FASTIFY_APP_TOKEN, WEB_FASTIFY_APP_AFTER_INIT_TOKEN, WEB_FASTIFY_APP_BEFORE_INIT_TOKEN, WEB_FASTIFY_APP_INIT_TOKEN, WEB_FASTIFY_APP_LIMITER_TOKEN, WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN, WEB_FASTIFY_APP_AFTER_ERROR_TOKEN, WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN } from '@tramvai/tokens-server-private';
|
|
6
|
+
export declare const webAppFactory: ({ server, expressApp, }: {
|
|
7
|
+
server: typeof SERVER_TOKEN;
|
|
8
|
+
expressApp: typeof WEB_APP_TOKEN;
|
|
9
|
+
}) => import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").FastifyLoggerInstance> & PromiseLike<import("fastify").FastifyInstance<import("http").Server, import("http").IncomingMessage, import("http").ServerResponse, import("fastify").FastifyLoggerInstance>>;
|
|
10
|
+
export declare const webAppExpressFactory: ({ webApp }: {
|
|
11
|
+
webApp: typeof WEB_FASTIFY_APP_TOKEN;
|
|
12
|
+
}) => import("express-serve-static-core").Express;
|
|
13
|
+
export declare const webAppInitCommand: ({ app, expressApp, logger, commandLineRunner, beforeInit, init, afterInit, limiterRequest, expressBeforeInit, expressInit, expressAfterInit, expressLimiterRequest, beforeError, processError, afterError, }: {
|
|
14
|
+
app: typeof WEB_FASTIFY_APP_TOKEN;
|
|
15
|
+
expressApp: typeof WEB_APP_TOKEN;
|
|
7
16
|
logger: typeof LOGGER_TOKEN;
|
|
8
17
|
commandLineRunner: typeof COMMAND_LINE_RUNNER_TOKEN;
|
|
9
|
-
beforeInit: typeof
|
|
10
|
-
init: typeof
|
|
11
|
-
afterInit: typeof
|
|
12
|
-
limiterRequest: typeof
|
|
18
|
+
beforeInit: typeof WEB_FASTIFY_APP_BEFORE_INIT_TOKEN;
|
|
19
|
+
init: typeof WEB_FASTIFY_APP_INIT_TOKEN;
|
|
20
|
+
afterInit: typeof WEB_FASTIFY_APP_AFTER_INIT_TOKEN;
|
|
21
|
+
limiterRequest: typeof WEB_FASTIFY_APP_LIMITER_TOKEN;
|
|
22
|
+
expressBeforeInit: typeof WEB_APP_BEFORE_INIT_TOKEN;
|
|
23
|
+
expressInit: typeof WEB_APP_INIT_TOKEN;
|
|
24
|
+
expressAfterInit: typeof WEB_APP_AFTER_INIT_TOKEN;
|
|
25
|
+
expressLimiterRequest: typeof WEB_APP_LIMITER_TOKEN;
|
|
26
|
+
beforeError: typeof WEB_FASTIFY_APP_BEFORE_ERROR_TOKEN;
|
|
27
|
+
processError: typeof WEB_FASTIFY_APP_PROCESS_ERROR_TOKEN;
|
|
28
|
+
afterError: typeof WEB_FASTIFY_APP_AFTER_ERROR_TOKEN;
|
|
13
29
|
}) => () => Promise<void>;
|
package/lib/server/xHeaders.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { APP_INFO_TOKEN } from '@tramvai/core';
|
|
2
|
-
import type { WEB_APP_TOKEN } from '@tramvai/tokens-server';
|
|
3
2
|
import type { ENV_MANAGER_TOKEN } from '@tramvai/module-common';
|
|
3
|
+
import type { WEB_FASTIFY_APP_TOKEN } from '@tramvai/tokens-server-private';
|
|
4
4
|
export declare const xHeadersFactory: ({ app, envManager, appInfo, }: {
|
|
5
|
-
app: typeof
|
|
5
|
+
app: typeof WEB_FASTIFY_APP_TOKEN;
|
|
6
6
|
envManager: typeof ENV_MANAGER_TOKEN;
|
|
7
7
|
appInfo: typeof APP_INFO_TOKEN;
|
|
8
8
|
}) => () => Promise<void>;
|