@arkstack/driver-express 0.12.5 → 0.12.7
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/dist/index.d.ts +43 -0
- package/dist/middlewares/index.d.ts +15 -0
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -20,15 +20,58 @@ interface ExpressDriverOptions {
|
|
|
20
20
|
mountPublicAssets?: (app: Express, publicPath: string) => PromiseOrValue<void>;
|
|
21
21
|
errorHandler?: ErrorRequestHandler | Handler;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The ExpressDriver class implements the ArkstackKitDriver
|
|
25
|
+
* contract for the Express framework.
|
|
26
|
+
*/
|
|
23
27
|
declare class ExpressDriver extends ArkstackKitDriver<Express, Handler> {
|
|
24
28
|
readonly name = "express";
|
|
25
29
|
private readonly options;
|
|
30
|
+
/**
|
|
31
|
+
* Creates an instance of ExpressDriver.
|
|
32
|
+
*
|
|
33
|
+
* @param options
|
|
34
|
+
*/
|
|
26
35
|
constructor(options: ExpressDriverOptions);
|
|
36
|
+
/**
|
|
37
|
+
* Creates an Express application instance.
|
|
38
|
+
*
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
27
41
|
createApp(): Express;
|
|
42
|
+
/**
|
|
43
|
+
* Mounts static assets from the specified public path to the Express application.
|
|
44
|
+
*
|
|
45
|
+
* @param app
|
|
46
|
+
* @param publicPath
|
|
47
|
+
*/
|
|
28
48
|
mountPublicAssets(app: Express, publicPath: string): PromiseOrValue<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Binds the router to the Express application using the provided bindRouter function.
|
|
51
|
+
*
|
|
52
|
+
* @param app
|
|
53
|
+
*/
|
|
29
54
|
bindRouter(app: Express): PromiseOrValue<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Applies middleware to the Express application.
|
|
57
|
+
*
|
|
58
|
+
* @param app
|
|
59
|
+
* @param middleware
|
|
60
|
+
*/
|
|
30
61
|
applyMiddleware(app: Express, middleware: Handler | ArkstackMiddlewareConfig<Handler>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Registers an error handler middleware to the Express
|
|
64
|
+
* application if provided in the options.
|
|
65
|
+
*
|
|
66
|
+
* @param app
|
|
67
|
+
*/
|
|
31
68
|
registerErrorHandler(app: Express): void;
|
|
69
|
+
/**
|
|
70
|
+
* Starts the Express server on the specified port.
|
|
71
|
+
*
|
|
72
|
+
* @param app
|
|
73
|
+
* @param port
|
|
74
|
+
*/
|
|
32
75
|
start(app: Express, port: number): void;
|
|
33
76
|
}
|
|
34
77
|
//#endregion
|
|
@@ -10,9 +10,24 @@ declare const auth: Handler;
|
|
|
10
10
|
declare const formdata: multer.Multer;
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/middlewares/limiter.d.ts
|
|
13
|
+
/**
|
|
14
|
+
* create a rate limiter middleware
|
|
15
|
+
*
|
|
16
|
+
* @param requests number of requests allowed per windowMs
|
|
17
|
+
* @param perMin number of minutes for the window
|
|
18
|
+
* @param message custom message to be returned when rate limit is exceeded
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
13
21
|
declare const limiter: (requests?: number | ValueDeterminingMiddleware<number>, perSec?: number, message?: string | ValueDeterminingMiddleware<string>) => _$express_rate_limit0.RateLimitRequestHandler;
|
|
14
22
|
//#endregion
|
|
15
23
|
//#region src/middlewares/request-logger.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* Middleware to log incoming requests and their response times.
|
|
26
|
+
*
|
|
27
|
+
* @param config Configuration options for the request logger middleware.
|
|
28
|
+
* @param config.allowInProduction If true, the logger will also log requests in production environment. Default is false.
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
16
31
|
declare const requestLogger: ({
|
|
17
32
|
allowInProduction
|
|
18
33
|
}?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/driver-express",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Express driver for Arkstack, providing Express-based runtime integration for the framework.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"express-rate-limit": "^8.4.1",
|
|
43
43
|
"@resora/plugin-clear-router": "^1.0.34",
|
|
44
44
|
"resora": "^1.3.6",
|
|
45
|
-
"@arkstack/contract": "^0.12.
|
|
45
|
+
"@arkstack/contract": "^0.12.7"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"express": "^5.2.1",
|
|
49
|
-
"@arkstack/auth": "^0.12.
|
|
50
|
-
"@arkstack/
|
|
51
|
-
"@arkstack/
|
|
49
|
+
"@arkstack/auth": "^0.12.7",
|
|
50
|
+
"@arkstack/foundry": "^0.12.7",
|
|
51
|
+
"@arkstack/common": "^0.12.7"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
54
54
|
"@arkstack/auth": {
|