@expressots/core 2.9.1 → 2.11.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/CHANGELOG.md +145 -89
- package/lib/cjs/application/{app-container.js → application-container.js} +95 -94
- package/lib/cjs/application/application-factory.js +39 -74
- package/lib/cjs/application/index.js +7 -7
- package/lib/cjs/common/{color-service.provider.js → color-codes.js} +46 -47
- package/lib/cjs/common/index.js +2 -2
- package/lib/cjs/common/{package-resolver.provider.js → package-resolver.js} +35 -35
- package/lib/cjs/common/{project-config.provider.js → project-config.js} +2 -2
- package/lib/cjs/console/console.js +60 -61
- package/lib/cjs/console/index.js +5 -5
- package/lib/cjs/container-module/container-module.js +111 -111
- package/lib/cjs/container-module/index.js +6 -6
- package/lib/cjs/controller/base-controller.js +74 -75
- package/lib/cjs/controller/index.js +5 -5
- package/lib/cjs/decorator/index.js +17 -17
- package/lib/cjs/decorator/scope-binding.js +44 -44
- package/lib/cjs/error/app-error.js +26 -26
- package/lib/cjs/error/error-handler-middleware.js +28 -28
- package/lib/cjs/error/index.js +9 -9
- package/lib/cjs/error/report.js +53 -54
- package/lib/cjs/error/status-code.js +89 -89
- package/lib/cjs/index.js +26 -26
- package/lib/cjs/middleware/index.js +32 -32
- package/lib/cjs/middleware/interfaces/body-parser.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/compression.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-parser.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-session/cookie-session.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cookie-session/keygrip.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/cors.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/express-rate-limit.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/express-session.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/helmet.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/morgan.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/multer.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/serve-favicon.interface.js +2 -2
- package/lib/cjs/middleware/interfaces/serve-static.interface.js +2 -2
- package/lib/cjs/middleware/middleware-resolver.js +72 -72
- package/lib/cjs/middleware/middleware-service.js +480 -481
- package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +82 -82
- package/lib/cjs/provider/dto-validator/dto-validator.provider.js +53 -53
- package/lib/cjs/provider/environment/env-validator.provider.js +98 -98
- package/lib/cjs/provider/index.js +13 -13
- package/lib/cjs/provider/logger/logger.provider.js +117 -117
- package/lib/cjs/provider/provider-manager.js +49 -50
- package/lib/cjs/render/handlebars.interface.js +2 -2
- package/lib/cjs/render/index.js +2 -2
- package/lib/cjs/render/render.type.js +2 -2
- package/lib/cjs/types/application/{app-container.d.ts → application-container.d.ts} +64 -62
- package/lib/cjs/types/application/application-factory.d.ts +19 -34
- package/lib/cjs/types/application/index.d.ts +2 -2
- package/lib/cjs/types/common/{color-service.provider.d.ts → color-codes.d.ts} +29 -29
- package/lib/cjs/types/common/index.d.ts +1 -1
- package/lib/cjs/types/common/{package-resolver.provider.d.ts → package-resolver.d.ts} +8 -8
- package/lib/cjs/types/common/{project-config.provider.d.ts → project-config.d.ts} +56 -56
- package/lib/cjs/types/console/console.d.ts +27 -27
- package/lib/cjs/types/console/index.d.ts +1 -1
- package/lib/cjs/types/container-module/container-module.d.ts +28 -28
- package/lib/cjs/types/container-module/index.d.ts +1 -1
- package/lib/cjs/types/controller/base-controller.d.ts +48 -48
- package/lib/cjs/types/controller/index.d.ts +1 -1
- package/lib/cjs/types/decorator/index.d.ts +1 -1
- package/lib/cjs/types/decorator/scope-binding.d.ts +33 -33
- package/lib/cjs/types/error/app-error.d.ts +29 -29
- package/lib/cjs/types/error/error-handler-middleware.d.ts +11 -11
- package/lib/cjs/types/error/index.d.ts +3 -3
- package/lib/cjs/types/error/report.d.ts +25 -25
- package/lib/cjs/types/error/status-code.d.ts +136 -136
- package/lib/cjs/types/index.d.ts +10 -10
- package/lib/cjs/types/middleware/index.d.ts +13 -13
- package/lib/cjs/types/middleware/interfaces/body-parser.interface.d.ts +33 -33
- package/lib/cjs/types/middleware/interfaces/compression.interface.d.ts +98 -98
- package/lib/cjs/types/middleware/interfaces/cookie-parser.interface.d.ts +9 -9
- package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +57 -57
- package/lib/cjs/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +27 -27
- package/lib/cjs/types/middleware/interfaces/cors.interface.d.ts +57 -57
- package/lib/cjs/types/middleware/interfaces/express-rate-limit.interface.d.ts +292 -292
- package/lib/cjs/types/middleware/interfaces/express-session.interface.d.ts +207 -207
- package/lib/cjs/types/middleware/interfaces/helmet.interface.d.ts +210 -210
- package/lib/cjs/types/middleware/interfaces/morgan.interface.d.ts +40 -40
- package/lib/cjs/types/middleware/interfaces/multer.interface.d.ts +255 -255
- package/lib/cjs/types/middleware/interfaces/serve-favicon.interface.d.ts +11 -11
- package/lib/cjs/types/middleware/interfaces/serve-static.interface.d.ts +70 -70
- package/lib/cjs/types/middleware/middleware-resolver.d.ts +11 -11
- package/lib/cjs/types/middleware/middleware-service.d.ts +368 -368
- package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +43 -43
- package/lib/cjs/types/provider/dto-validator/dto-validator.provider.d.ts +11 -11
- package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +35 -35
- package/lib/cjs/types/provider/index.d.ts +5 -5
- package/lib/cjs/types/provider/logger/logger.provider.d.ts +54 -54
- package/lib/cjs/types/provider/provider-manager.d.ts +16 -16
- package/lib/cjs/types/render/handlebars.interface.d.ts +46 -46
- package/lib/cjs/types/render/index.d.ts +2 -2
- package/lib/cjs/types/render/render.type.d.ts +12 -12
- package/lib/package.json +16 -17
- package/package.json +16 -17
|
@@ -1,210 +1,210 @@
|
|
|
1
|
-
import { Request, Response } from "express";
|
|
2
|
-
/**
|
|
3
|
-
* @typedef {string} cspDirectiveValue
|
|
4
|
-
* Possible values for Content Security Policy directives.
|
|
5
|
-
* Can be 'self', 'none', or a string.
|
|
6
|
-
*/
|
|
7
|
-
type cspDirectiveValue = "self" | "none" | string;
|
|
8
|
-
/**
|
|
9
|
-
* @interface directiveOptions
|
|
10
|
-
* Options for defining Content Security Policy directives.
|
|
11
|
-
*/
|
|
12
|
-
interface directiveOptions {
|
|
13
|
-
"default-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
14
|
-
"base-uri"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
15
|
-
"font-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
16
|
-
"form-action"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
17
|
-
"frame-ancestors"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
18
|
-
"img-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
19
|
-
"object-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
20
|
-
"script-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
21
|
-
"script-src-attr"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
22
|
-
"style-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
23
|
-
"upgrade-insecure-requests"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @interface ContentSecurityPolicy
|
|
27
|
-
* Defines a Content Security Policy configuration.
|
|
28
|
-
*/
|
|
29
|
-
interface ContentSecurityPolicy {
|
|
30
|
-
/**
|
|
31
|
-
* A function that sets Content Security Policy.
|
|
32
|
-
*
|
|
33
|
-
* @param {directiveOptions} options - Optional configuration options for Content Security Policy.
|
|
34
|
-
* @returns {Function} A middleware function.
|
|
35
|
-
*/
|
|
36
|
-
useDefaults?: false;
|
|
37
|
-
directives?: directiveOptions;
|
|
38
|
-
reportOnly?: boolean;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @typedef {Object} CrossOriginEmbedderPolicyOptions
|
|
42
|
-
* An optional policy for Cross-Origin Embedder Policy.
|
|
43
|
-
*/
|
|
44
|
-
interface CrossOriginEmbedderPolicyOptions {
|
|
45
|
-
/**
|
|
46
|
-
* An optional policy for Cross-Origin Embedder Policy.
|
|
47
|
-
*/
|
|
48
|
-
policy?: "require-corp" | "credentialless";
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @typedef {Object} CrossOriginOpenerPolicyOptions
|
|
52
|
-
* An optional policy for Cross-Origin Opener Policy.
|
|
53
|
-
*/
|
|
54
|
-
interface CrossOriginOpenerPolicyOptions {
|
|
55
|
-
/**
|
|
56
|
-
* An optional policy for Cross-Origin Opener Policy.
|
|
57
|
-
*/
|
|
58
|
-
policy?: "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @typedef {Object} CrossOriginResourcePolicyOptions
|
|
62
|
-
* An optional policy for Cross-Origin Resource Policy.
|
|
63
|
-
*/
|
|
64
|
-
interface CrossOriginResourcePolicyOptions {
|
|
65
|
-
/**
|
|
66
|
-
* An optional policy for Cross-Origin Resource Policy.
|
|
67
|
-
*/
|
|
68
|
-
policy?: "same-origin" | "same-site" | "cross-origin";
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* @typedef {string} ReferrerPolicyToken
|
|
72
|
-
* A type alias for Referrer Policy tokens.
|
|
73
|
-
*/
|
|
74
|
-
type ReferrerPolicyToken = "no-referrer" | "no-referrer-when-downgrade" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | "";
|
|
75
|
-
/**
|
|
76
|
-
* @typedef {Object} ReferrerPolicyOptions
|
|
77
|
-
* An optional policy for Referrer Policy.
|
|
78
|
-
*/
|
|
79
|
-
interface ReferrerPolicyOptions {
|
|
80
|
-
/**
|
|
81
|
-
* An optional policy for Referrer Policy.
|
|
82
|
-
*/
|
|
83
|
-
policy?: ReferrerPolicyToken | Array<ReferrerPolicyToken> | false;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @typedef {Object} StrictTransportSecurityOptions
|
|
87
|
-
* Options for Strict Transport Security.
|
|
88
|
-
*/
|
|
89
|
-
interface StrictTransportSecurityOptions {
|
|
90
|
-
/**
|
|
91
|
-
* An optional max age for Strict Transport Security.
|
|
92
|
-
*/
|
|
93
|
-
maxAge?: number;
|
|
94
|
-
/**
|
|
95
|
-
* An optional flag to include subdomains.
|
|
96
|
-
*/
|
|
97
|
-
includeSubDomains?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* An optional flag for preload.
|
|
100
|
-
*/
|
|
101
|
-
preload?: boolean;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* @typedef {boolean|string} xContentTypeOptions
|
|
105
|
-
* Options for X-Content-Type-Options.
|
|
106
|
-
*/
|
|
107
|
-
type xContentTypeOptions = false | "nosniff";
|
|
108
|
-
/**
|
|
109
|
-
* @typedef {Object} XDnsPrefetchControlOptions
|
|
110
|
-
* Options for X-DNS-Prefetch-Control.
|
|
111
|
-
*/
|
|
112
|
-
interface XDnsPrefetchControlOptions {
|
|
113
|
-
/**
|
|
114
|
-
* An optional flag to allow DNS prefetching.
|
|
115
|
-
*/
|
|
116
|
-
allow?: boolean;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @typedef {Object} XFrameOptionsOptions
|
|
120
|
-
* Options for X-Frame-Options.
|
|
121
|
-
*/
|
|
122
|
-
interface XFrameOptionsOptions {
|
|
123
|
-
/**
|
|
124
|
-
* An optional action for X-Frame-Options.
|
|
125
|
-
*/
|
|
126
|
-
action?: "deny" | "sameorigin" | false;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @typedef {Object} XPermittedCrossDomainPoliciesOptions
|
|
130
|
-
* Options for X-Permitted-Cross-Domain-Policies.
|
|
131
|
-
*/
|
|
132
|
-
interface XPermittedCrossDomainPoliciesOptions {
|
|
133
|
-
/**
|
|
134
|
-
* An optional policy for X-Permitted-Cross-Domain-Policies.
|
|
135
|
-
*/
|
|
136
|
-
permittedPolicies?: "none" | "master-only" | "by-content-type" | "all";
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* @typedef {boolean} xPoweredByOptions
|
|
140
|
-
* Options for X-Powered-By.
|
|
141
|
-
*/
|
|
142
|
-
type xPoweredByOptions = false;
|
|
143
|
-
/**
|
|
144
|
-
* @typedef {boolean} xXssProtectionOptions
|
|
145
|
-
* Options for X-XSS-Protection.
|
|
146
|
-
*/
|
|
147
|
-
type xXssProtectionOptions = false;
|
|
148
|
-
/**
|
|
149
|
-
* @interface OptionsHelmet
|
|
150
|
-
* Options for Helmet middleware.
|
|
151
|
-
*/
|
|
152
|
-
export interface OptionsHelmet {
|
|
153
|
-
/**
|
|
154
|
-
* An optional Content Security Policy.
|
|
155
|
-
*/
|
|
156
|
-
contentSecurityPolicy?: ContentSecurityPolicy | false;
|
|
157
|
-
/**
|
|
158
|
-
* An optional Cross-Origin Embedder Policy.
|
|
159
|
-
*/
|
|
160
|
-
crossOriginEmbedderPolicy?: CrossOriginEmbedderPolicyOptions | boolean;
|
|
161
|
-
/**
|
|
162
|
-
* An optional Cross-Origin Opener Policy.
|
|
163
|
-
*/
|
|
164
|
-
crossOriginOpenerPolicy?: boolean | CrossOriginOpenerPolicyOptions;
|
|
165
|
-
/**
|
|
166
|
-
* An optional Cross-Origin Resource Policy.
|
|
167
|
-
*/
|
|
168
|
-
crossOriginResourcePolicy?: boolean | CrossOriginResourcePolicyOptions;
|
|
169
|
-
/**
|
|
170
|
-
* An optional flag for originAgentCluster.
|
|
171
|
-
*/
|
|
172
|
-
originAgentCluster?: false;
|
|
173
|
-
/**
|
|
174
|
-
* An optional Referrer Policy.
|
|
175
|
-
*/
|
|
176
|
-
referrerPolicy?: ReferrerPolicyOptions;
|
|
177
|
-
/**
|
|
178
|
-
* An optional Strict Transport Security.
|
|
179
|
-
*/
|
|
180
|
-
strictTransportSecurity?: StrictTransportSecurityOptions;
|
|
181
|
-
/**
|
|
182
|
-
* An optional X-Content-Type-Options.
|
|
183
|
-
*/
|
|
184
|
-
xContentTypeOptions?: xContentTypeOptions;
|
|
185
|
-
/**
|
|
186
|
-
* An optional X-DNS-Prefetch-Control.
|
|
187
|
-
*/
|
|
188
|
-
xDnsPrefetchControl?: XDnsPrefetchControlOptions;
|
|
189
|
-
/**
|
|
190
|
-
* An optional X-Download-Options.
|
|
191
|
-
*/
|
|
192
|
-
xDownloadOptions?: boolean | "noopen";
|
|
193
|
-
/**
|
|
194
|
-
* An optional X-Frame-Options.
|
|
195
|
-
*/
|
|
196
|
-
xFrameOptions?: XFrameOptionsOptions;
|
|
197
|
-
/**
|
|
198
|
-
* An optional X-Permitted-Cross-Domain-Policies.
|
|
199
|
-
*/
|
|
200
|
-
xPermittedCrossDomainPolicies?: XPermittedCrossDomainPoliciesOptions;
|
|
201
|
-
/**
|
|
202
|
-
* An optional X-Powered-By.
|
|
203
|
-
*/
|
|
204
|
-
xPoweredBy?: xPoweredByOptions;
|
|
205
|
-
/**
|
|
206
|
-
* An optional X-XSS-Protection.
|
|
207
|
-
*/
|
|
208
|
-
xXssProtection?: xXssProtectionOptions;
|
|
209
|
-
}
|
|
210
|
-
export {};
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {string} cspDirectiveValue
|
|
4
|
+
* Possible values for Content Security Policy directives.
|
|
5
|
+
* Can be 'self', 'none', or a string.
|
|
6
|
+
*/
|
|
7
|
+
type cspDirectiveValue = "self" | "none" | string;
|
|
8
|
+
/**
|
|
9
|
+
* @interface directiveOptions
|
|
10
|
+
* Options for defining Content Security Policy directives.
|
|
11
|
+
*/
|
|
12
|
+
interface directiveOptions {
|
|
13
|
+
"default-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
14
|
+
"base-uri"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
15
|
+
"font-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
16
|
+
"form-action"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
17
|
+
"frame-ancestors"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
18
|
+
"img-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
19
|
+
"object-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
20
|
+
"script-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
21
|
+
"script-src-attr"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
22
|
+
"style-src"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
23
|
+
"upgrade-insecure-requests"?: Array<cspDirectiveValue> | null | Array<(req: Request, res: Response) => string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @interface ContentSecurityPolicy
|
|
27
|
+
* Defines a Content Security Policy configuration.
|
|
28
|
+
*/
|
|
29
|
+
interface ContentSecurityPolicy {
|
|
30
|
+
/**
|
|
31
|
+
* A function that sets Content Security Policy.
|
|
32
|
+
*
|
|
33
|
+
* @param {directiveOptions} options - Optional configuration options for Content Security Policy.
|
|
34
|
+
* @returns {Function} A middleware function.
|
|
35
|
+
*/
|
|
36
|
+
useDefaults?: false;
|
|
37
|
+
directives?: directiveOptions;
|
|
38
|
+
reportOnly?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {Object} CrossOriginEmbedderPolicyOptions
|
|
42
|
+
* An optional policy for Cross-Origin Embedder Policy.
|
|
43
|
+
*/
|
|
44
|
+
interface CrossOriginEmbedderPolicyOptions {
|
|
45
|
+
/**
|
|
46
|
+
* An optional policy for Cross-Origin Embedder Policy.
|
|
47
|
+
*/
|
|
48
|
+
policy?: "require-corp" | "credentialless";
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} CrossOriginOpenerPolicyOptions
|
|
52
|
+
* An optional policy for Cross-Origin Opener Policy.
|
|
53
|
+
*/
|
|
54
|
+
interface CrossOriginOpenerPolicyOptions {
|
|
55
|
+
/**
|
|
56
|
+
* An optional policy for Cross-Origin Opener Policy.
|
|
57
|
+
*/
|
|
58
|
+
policy?: "same-origin" | "same-origin-allow-popups" | "unsafe-none";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @typedef {Object} CrossOriginResourcePolicyOptions
|
|
62
|
+
* An optional policy for Cross-Origin Resource Policy.
|
|
63
|
+
*/
|
|
64
|
+
interface CrossOriginResourcePolicyOptions {
|
|
65
|
+
/**
|
|
66
|
+
* An optional policy for Cross-Origin Resource Policy.
|
|
67
|
+
*/
|
|
68
|
+
policy?: "same-origin" | "same-site" | "cross-origin";
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @typedef {string} ReferrerPolicyToken
|
|
72
|
+
* A type alias for Referrer Policy tokens.
|
|
73
|
+
*/
|
|
74
|
+
type ReferrerPolicyToken = "no-referrer" | "no-referrer-when-downgrade" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url" | "";
|
|
75
|
+
/**
|
|
76
|
+
* @typedef {Object} ReferrerPolicyOptions
|
|
77
|
+
* An optional policy for Referrer Policy.
|
|
78
|
+
*/
|
|
79
|
+
interface ReferrerPolicyOptions {
|
|
80
|
+
/**
|
|
81
|
+
* An optional policy for Referrer Policy.
|
|
82
|
+
*/
|
|
83
|
+
policy?: ReferrerPolicyToken | Array<ReferrerPolicyToken> | false;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} StrictTransportSecurityOptions
|
|
87
|
+
* Options for Strict Transport Security.
|
|
88
|
+
*/
|
|
89
|
+
interface StrictTransportSecurityOptions {
|
|
90
|
+
/**
|
|
91
|
+
* An optional max age for Strict Transport Security.
|
|
92
|
+
*/
|
|
93
|
+
maxAge?: number;
|
|
94
|
+
/**
|
|
95
|
+
* An optional flag to include subdomains.
|
|
96
|
+
*/
|
|
97
|
+
includeSubDomains?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* An optional flag for preload.
|
|
100
|
+
*/
|
|
101
|
+
preload?: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @typedef {boolean|string} xContentTypeOptions
|
|
105
|
+
* Options for X-Content-Type-Options.
|
|
106
|
+
*/
|
|
107
|
+
type xContentTypeOptions = false | "nosniff";
|
|
108
|
+
/**
|
|
109
|
+
* @typedef {Object} XDnsPrefetchControlOptions
|
|
110
|
+
* Options for X-DNS-Prefetch-Control.
|
|
111
|
+
*/
|
|
112
|
+
interface XDnsPrefetchControlOptions {
|
|
113
|
+
/**
|
|
114
|
+
* An optional flag to allow DNS prefetching.
|
|
115
|
+
*/
|
|
116
|
+
allow?: boolean;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @typedef {Object} XFrameOptionsOptions
|
|
120
|
+
* Options for X-Frame-Options.
|
|
121
|
+
*/
|
|
122
|
+
interface XFrameOptionsOptions {
|
|
123
|
+
/**
|
|
124
|
+
* An optional action for X-Frame-Options.
|
|
125
|
+
*/
|
|
126
|
+
action?: "deny" | "sameorigin" | false;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* @typedef {Object} XPermittedCrossDomainPoliciesOptions
|
|
130
|
+
* Options for X-Permitted-Cross-Domain-Policies.
|
|
131
|
+
*/
|
|
132
|
+
interface XPermittedCrossDomainPoliciesOptions {
|
|
133
|
+
/**
|
|
134
|
+
* An optional policy for X-Permitted-Cross-Domain-Policies.
|
|
135
|
+
*/
|
|
136
|
+
permittedPolicies?: "none" | "master-only" | "by-content-type" | "all";
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @typedef {boolean} xPoweredByOptions
|
|
140
|
+
* Options for X-Powered-By.
|
|
141
|
+
*/
|
|
142
|
+
type xPoweredByOptions = false;
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {boolean} xXssProtectionOptions
|
|
145
|
+
* Options for X-XSS-Protection.
|
|
146
|
+
*/
|
|
147
|
+
type xXssProtectionOptions = false;
|
|
148
|
+
/**
|
|
149
|
+
* @interface OptionsHelmet
|
|
150
|
+
* Options for Helmet middleware.
|
|
151
|
+
*/
|
|
152
|
+
export interface OptionsHelmet {
|
|
153
|
+
/**
|
|
154
|
+
* An optional Content Security Policy.
|
|
155
|
+
*/
|
|
156
|
+
contentSecurityPolicy?: ContentSecurityPolicy | false;
|
|
157
|
+
/**
|
|
158
|
+
* An optional Cross-Origin Embedder Policy.
|
|
159
|
+
*/
|
|
160
|
+
crossOriginEmbedderPolicy?: CrossOriginEmbedderPolicyOptions | boolean;
|
|
161
|
+
/**
|
|
162
|
+
* An optional Cross-Origin Opener Policy.
|
|
163
|
+
*/
|
|
164
|
+
crossOriginOpenerPolicy?: boolean | CrossOriginOpenerPolicyOptions;
|
|
165
|
+
/**
|
|
166
|
+
* An optional Cross-Origin Resource Policy.
|
|
167
|
+
*/
|
|
168
|
+
crossOriginResourcePolicy?: boolean | CrossOriginResourcePolicyOptions;
|
|
169
|
+
/**
|
|
170
|
+
* An optional flag for originAgentCluster.
|
|
171
|
+
*/
|
|
172
|
+
originAgentCluster?: false;
|
|
173
|
+
/**
|
|
174
|
+
* An optional Referrer Policy.
|
|
175
|
+
*/
|
|
176
|
+
referrerPolicy?: ReferrerPolicyOptions;
|
|
177
|
+
/**
|
|
178
|
+
* An optional Strict Transport Security.
|
|
179
|
+
*/
|
|
180
|
+
strictTransportSecurity?: StrictTransportSecurityOptions;
|
|
181
|
+
/**
|
|
182
|
+
* An optional X-Content-Type-Options.
|
|
183
|
+
*/
|
|
184
|
+
xContentTypeOptions?: xContentTypeOptions;
|
|
185
|
+
/**
|
|
186
|
+
* An optional X-DNS-Prefetch-Control.
|
|
187
|
+
*/
|
|
188
|
+
xDnsPrefetchControl?: XDnsPrefetchControlOptions;
|
|
189
|
+
/**
|
|
190
|
+
* An optional X-Download-Options.
|
|
191
|
+
*/
|
|
192
|
+
xDownloadOptions?: boolean | "noopen";
|
|
193
|
+
/**
|
|
194
|
+
* An optional X-Frame-Options.
|
|
195
|
+
*/
|
|
196
|
+
xFrameOptions?: XFrameOptionsOptions;
|
|
197
|
+
/**
|
|
198
|
+
* An optional X-Permitted-Cross-Domain-Policies.
|
|
199
|
+
*/
|
|
200
|
+
xPermittedCrossDomainPolicies?: XPermittedCrossDomainPoliciesOptions;
|
|
201
|
+
/**
|
|
202
|
+
* An optional X-Powered-By.
|
|
203
|
+
*/
|
|
204
|
+
xPoweredBy?: xPoweredByOptions;
|
|
205
|
+
/**
|
|
206
|
+
* An optional X-XSS-Protection.
|
|
207
|
+
*/
|
|
208
|
+
xXssProtection?: xXssProtectionOptions;
|
|
209
|
+
}
|
|
210
|
+
export {};
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import http from "http";
|
|
3
|
-
export interface StreamOptions {
|
|
4
|
-
/**
|
|
5
|
-
* Output stream for writing log lines.
|
|
6
|
-
*/
|
|
7
|
-
write(str: string): void;
|
|
8
|
-
}
|
|
9
|
-
/***
|
|
10
|
-
* Morgan accepts these properties in the options object.
|
|
11
|
-
*/
|
|
12
|
-
export interface OptionsMorgan {
|
|
13
|
-
/***
|
|
14
|
-
* Buffer duration before writing logs to the stream, defaults to false.
|
|
15
|
-
* When set to true, defaults to 1000 ms.
|
|
16
|
-
* @deprecated
|
|
17
|
-
*/
|
|
18
|
-
buffer?: boolean | undefined;
|
|
19
|
-
/***
|
|
20
|
-
* Write log line on request instead of response. This means that a
|
|
21
|
-
* requests will be logged even if the server crashes, but data from the
|
|
22
|
-
* response cannot be logged (like the response code).
|
|
23
|
-
*/
|
|
24
|
-
immediate?: boolean | undefined;
|
|
25
|
-
/***
|
|
26
|
-
* Function to determine if logging is skipped, defaults to false. This
|
|
27
|
-
* function will be called as skip(req, res).
|
|
28
|
-
*/
|
|
29
|
-
skip?(req: http.IncomingMessage, res: http.ServerResponse): boolean;
|
|
30
|
-
/***
|
|
31
|
-
* Output stream for writing log lines, defaults to process.stdout.
|
|
32
|
-
* @param str
|
|
33
|
-
*/
|
|
34
|
-
stream?: StreamOptions | undefined;
|
|
35
|
-
}
|
|
36
|
-
export type FormatFn = (tokens: TokenIndexer, req: http.IncomingMessage, res: http.ServerResponse) => string;
|
|
37
|
-
export type TokenCallbackFn = (req: http.IncomingMessage, res: http.ServerResponse, arg?: string | number) => string | number;
|
|
38
|
-
export interface TokenIndexer {
|
|
39
|
-
[tokenName: string]: TokenCallbackFn;
|
|
40
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import http from "http";
|
|
3
|
+
export interface StreamOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Output stream for writing log lines.
|
|
6
|
+
*/
|
|
7
|
+
write(str: string): void;
|
|
8
|
+
}
|
|
9
|
+
/***
|
|
10
|
+
* Morgan accepts these properties in the options object.
|
|
11
|
+
*/
|
|
12
|
+
export interface OptionsMorgan {
|
|
13
|
+
/***
|
|
14
|
+
* Buffer duration before writing logs to the stream, defaults to false.
|
|
15
|
+
* When set to true, defaults to 1000 ms.
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
18
|
+
buffer?: boolean | undefined;
|
|
19
|
+
/***
|
|
20
|
+
* Write log line on request instead of response. This means that a
|
|
21
|
+
* requests will be logged even if the server crashes, but data from the
|
|
22
|
+
* response cannot be logged (like the response code).
|
|
23
|
+
*/
|
|
24
|
+
immediate?: boolean | undefined;
|
|
25
|
+
/***
|
|
26
|
+
* Function to determine if logging is skipped, defaults to false. This
|
|
27
|
+
* function will be called as skip(req, res).
|
|
28
|
+
*/
|
|
29
|
+
skip?(req: http.IncomingMessage, res: http.ServerResponse): boolean;
|
|
30
|
+
/***
|
|
31
|
+
* Output stream for writing log lines, defaults to process.stdout.
|
|
32
|
+
* @param str
|
|
33
|
+
*/
|
|
34
|
+
stream?: StreamOptions | undefined;
|
|
35
|
+
}
|
|
36
|
+
export type FormatFn = (tokens: TokenIndexer, req: http.IncomingMessage, res: http.ServerResponse) => string;
|
|
37
|
+
export type TokenCallbackFn = (req: http.IncomingMessage, res: http.ServerResponse, arg?: string | number) => string | number;
|
|
38
|
+
export interface TokenIndexer {
|
|
39
|
+
[tokenName: string]: TokenCallbackFn;
|
|
40
|
+
}
|