@autofleet/super-express 3.0.0 → 4.1.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/package.json +2 -3
- package/src/index.d.ts +65 -67
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@autofleet/super-express",
|
3
|
-
"version": "
|
3
|
+
"version": "4.1.0",
|
4
4
|
"description": "AF Express with built in boilerplate",
|
5
5
|
"main": "src/index.js",
|
6
6
|
"author": "Autofleet",
|
@@ -12,8 +12,7 @@
|
|
12
12
|
"morgan": "^1.10.0"
|
13
13
|
},
|
14
14
|
"scripts": {
|
15
|
-
"test": "node --test test/index.test.js"
|
16
|
-
"publish": "npm publish"
|
15
|
+
"test": "node --test test/index.test.js"
|
17
16
|
},
|
18
17
|
"repository": {
|
19
18
|
"type": "git",
|
package/src/index.d.ts
CHANGED
@@ -1,82 +1,80 @@
|
|
1
1
|
import * as express from 'express';
|
2
2
|
|
3
|
-
|
3
|
+
/**
|
4
|
+
* Options to customize the behavior of the SuperExpress application.
|
5
|
+
*/
|
6
|
+
export interface DefaultOptions {
|
4
7
|
/**
|
5
|
-
*
|
8
|
+
* Enables or disables body parser middleware.
|
6
9
|
*/
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Enables or disables HTTP request logging middleware.
|
18
|
-
*/
|
19
|
-
morgan?: boolean;
|
20
|
-
/**
|
21
|
-
* Enables or disables the alive endpoint middleware.
|
22
|
-
*/
|
23
|
-
nitur?: boolean;
|
24
|
-
/**
|
25
|
-
* Enables or disables the stats endpoint middleware.
|
26
|
-
*/
|
27
|
-
stats?: boolean;
|
28
|
-
/**
|
29
|
-
* Path to the package.json file for the stats endpoint.
|
30
|
-
*/
|
31
|
-
packageJsonPath?: string;
|
32
|
-
/**
|
33
|
-
* Enables or disables request tracing middleware.
|
34
|
-
*/
|
35
|
-
tracing?: boolean;
|
36
|
-
/**
|
37
|
-
* Enables or disables eager loading of user permissions for tracing middleware.
|
38
|
-
*/
|
39
|
-
eagerLoadUserPermissions?: boolean;
|
40
|
-
/**
|
41
|
-
* Options to customize the alive endpoint middleware.
|
42
|
-
*/
|
43
|
-
aliveEndpointOptions?: Record<string, unknown>;
|
44
|
-
// Add other options from config/default-options.json as needed
|
45
|
-
}
|
46
|
-
|
10
|
+
bodyParser?: boolean;
|
11
|
+
/**
|
12
|
+
* Enables or disables security headers middleware.
|
13
|
+
*/
|
14
|
+
helmet?: boolean;
|
15
|
+
/**
|
16
|
+
* Enables or disables HTTP request logging middleware.
|
17
|
+
*/
|
18
|
+
morgan?: boolean;
|
47
19
|
/**
|
48
|
-
*
|
20
|
+
* Enables or disables the alive endpoint middleware.
|
49
21
|
*/
|
50
|
-
|
22
|
+
nitur?: boolean;
|
23
|
+
/**
|
24
|
+
* Enables or disables the stats endpoint middleware.
|
25
|
+
*/
|
26
|
+
stats?: boolean;
|
27
|
+
/**
|
28
|
+
* Path to the package.json file for the stats endpoint.
|
29
|
+
*/
|
30
|
+
packageJsonPath?: string;
|
31
|
+
/**
|
32
|
+
* Enables or disables request tracing middleware.
|
33
|
+
*/
|
34
|
+
tracing?: boolean;
|
35
|
+
/**
|
36
|
+
* Enables or disables eager loading of user permissions for tracing middleware.
|
37
|
+
*/
|
38
|
+
eagerLoadUserPermissions?: boolean;
|
39
|
+
/**
|
40
|
+
* Options to customize the alive endpoint middleware.
|
41
|
+
*/
|
42
|
+
aliveEndpointOptions?: Record<string, unknown>;
|
43
|
+
// Add other options from config/default-options.json as needed
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Type for the callback function used in the listen method.
|
48
|
+
*/
|
49
|
+
export type ListenCallback = () => void;
|
51
50
|
|
52
|
-
|
53
|
-
|
51
|
+
type Listen = express.Application['listen'];
|
52
|
+
type Server = Listen extends (port: any, cb: any) => infer R ? R : never;
|
54
53
|
|
54
|
+
/**
|
55
|
+
* Extends the express.Application interface to include nativeListen and the overridden listen method.
|
56
|
+
*/
|
57
|
+
export interface SuperExpressApp extends express.Application {
|
55
58
|
/**
|
56
|
-
*
|
59
|
+
* Original express listen method.
|
57
60
|
*/
|
58
|
-
|
59
|
-
/**
|
60
|
-
* Original express listen method.
|
61
|
-
*/
|
62
|
-
nativeListen: Listen;
|
63
|
-
|
64
|
-
/**
|
65
|
-
* Overridden listen method to add custom behavior.
|
66
|
-
* @param port - The port number to listen on.
|
67
|
-
* @param cb - Optional callback function to execute after the server starts listening.
|
68
|
-
*/
|
69
|
-
listen(port: number, cb?: ListenCallback): Server;
|
70
|
-
}
|
61
|
+
nativeListen: Listen;
|
71
62
|
|
72
63
|
/**
|
73
|
-
*
|
74
|
-
* @param
|
75
|
-
* @
|
64
|
+
* Overridden listen method to add custom behavior.
|
65
|
+
* @param port - The port number to listen on.
|
66
|
+
* @param cb - Optional callback function to execute after the server starts listening.
|
76
67
|
*/
|
77
|
-
|
78
|
-
options?: Partial<DefaultOptions & express.ApplicationOptions>
|
79
|
-
): SuperExpressApp;
|
68
|
+
listen(port: number, cb?: ListenCallback): Server;
|
80
69
|
}
|
81
70
|
|
82
|
-
|
71
|
+
/**
|
72
|
+
* Creates a new SuperExpress application with the given options.
|
73
|
+
* @param options - Optional settings to customize the application.
|
74
|
+
* @returns A SuperExpress application instance.
|
75
|
+
*/
|
76
|
+
declare function createSuperExpressApp(
|
77
|
+
options?: Partial<DefaultOptions & express.ApplicationOptions>
|
78
|
+
): SuperExpressApp;
|
79
|
+
|
80
|
+
export = createSuperExpressApp;
|