@expressots/core 2.9.0 → 2.10.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.
Files changed (95) hide show
  1. package/lib/CHANGELOG.md +133 -85
  2. package/lib/cjs/application/app-container.js +93 -94
  3. package/lib/cjs/application/application-factory.js +74 -74
  4. package/lib/cjs/application/index.js +7 -7
  5. package/lib/cjs/common/color-service.provider.js +46 -47
  6. package/lib/cjs/common/index.js +2 -2
  7. package/lib/cjs/common/package-resolver.provider.js +35 -35
  8. package/lib/cjs/common/project-config.provider.js +2 -2
  9. package/lib/cjs/console/console.js +60 -61
  10. package/lib/cjs/console/index.js +5 -5
  11. package/lib/cjs/container-module/container-module.js +111 -111
  12. package/lib/cjs/container-module/index.js +6 -6
  13. package/lib/cjs/controller/base-controller.js +74 -75
  14. package/lib/cjs/controller/index.js +5 -5
  15. package/lib/cjs/decorator/index.js +17 -17
  16. package/lib/cjs/decorator/scope-binding.js +44 -44
  17. package/lib/cjs/error/app-error.js +26 -26
  18. package/lib/cjs/error/error-handler-middleware.js +28 -28
  19. package/lib/cjs/error/index.js +9 -9
  20. package/lib/cjs/error/report.js +53 -54
  21. package/lib/cjs/error/status-code.js +89 -89
  22. package/lib/cjs/index.js +26 -26
  23. package/lib/cjs/middleware/index.js +32 -32
  24. package/lib/cjs/middleware/interfaces/body-parser.interface.js +2 -2
  25. package/lib/cjs/middleware/interfaces/compression.interface.js +2 -2
  26. package/lib/cjs/middleware/interfaces/cookie-parser.interface.js +2 -2
  27. package/lib/cjs/middleware/interfaces/cookie-session/cookie-session.interface.js +2 -2
  28. package/lib/cjs/middleware/interfaces/cookie-session/keygrip.interface.js +2 -2
  29. package/lib/cjs/middleware/interfaces/cors.interface.js +2 -2
  30. package/lib/cjs/middleware/interfaces/express-rate-limit.interface.js +2 -2
  31. package/lib/cjs/middleware/interfaces/express-session.interface.js +2 -2
  32. package/lib/cjs/middleware/interfaces/helmet.interface.js +2 -2
  33. package/lib/cjs/middleware/interfaces/morgan.interface.js +2 -2
  34. package/lib/cjs/middleware/interfaces/multer.interface.js +2 -2
  35. package/lib/cjs/middleware/interfaces/serve-favicon.interface.js +2 -2
  36. package/lib/cjs/middleware/interfaces/serve-static.interface.js +2 -2
  37. package/lib/cjs/middleware/middleware-resolver.js +72 -72
  38. package/lib/cjs/middleware/middleware-service.js +480 -481
  39. package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +82 -82
  40. package/lib/cjs/provider/dto-validator/dto-validator.provider.js +53 -53
  41. package/lib/cjs/provider/environment/env-validator.provider.js +98 -98
  42. package/lib/cjs/provider/index.js +13 -13
  43. package/lib/cjs/provider/logger/logger.provider.js +117 -117
  44. package/lib/cjs/provider/provider-manager.js +49 -50
  45. package/lib/cjs/render/handlebars.interface.js +2 -2
  46. package/lib/cjs/render/index.js +2 -2
  47. package/lib/cjs/render/render.type.js +2 -2
  48. package/lib/cjs/types/application/app-container.d.ts +62 -62
  49. package/lib/cjs/types/application/application-factory.d.ts +34 -34
  50. package/lib/cjs/types/application/index.d.ts +2 -2
  51. package/lib/cjs/types/common/color-service.provider.d.ts +29 -29
  52. package/lib/cjs/types/common/index.d.ts +1 -1
  53. package/lib/cjs/types/common/package-resolver.provider.d.ts +8 -8
  54. package/lib/cjs/types/common/project-config.provider.d.ts +56 -47
  55. package/lib/cjs/types/console/console.d.ts +27 -27
  56. package/lib/cjs/types/console/index.d.ts +1 -1
  57. package/lib/cjs/types/container-module/container-module.d.ts +28 -28
  58. package/lib/cjs/types/container-module/index.d.ts +1 -1
  59. package/lib/cjs/types/controller/base-controller.d.ts +48 -48
  60. package/lib/cjs/types/controller/index.d.ts +1 -1
  61. package/lib/cjs/types/decorator/index.d.ts +1 -1
  62. package/lib/cjs/types/decorator/scope-binding.d.ts +33 -33
  63. package/lib/cjs/types/error/app-error.d.ts +29 -29
  64. package/lib/cjs/types/error/error-handler-middleware.d.ts +11 -11
  65. package/lib/cjs/types/error/index.d.ts +3 -3
  66. package/lib/cjs/types/error/report.d.ts +25 -25
  67. package/lib/cjs/types/error/status-code.d.ts +136 -136
  68. package/lib/cjs/types/index.d.ts +10 -10
  69. package/lib/cjs/types/middleware/index.d.ts +13 -13
  70. package/lib/cjs/types/middleware/interfaces/body-parser.interface.d.ts +33 -33
  71. package/lib/cjs/types/middleware/interfaces/compression.interface.d.ts +98 -98
  72. package/lib/cjs/types/middleware/interfaces/cookie-parser.interface.d.ts +9 -9
  73. package/lib/cjs/types/middleware/interfaces/cookie-session/cookie-session.interface.d.ts +57 -57
  74. package/lib/cjs/types/middleware/interfaces/cookie-session/keygrip.interface.d.ts +27 -27
  75. package/lib/cjs/types/middleware/interfaces/cors.interface.d.ts +57 -57
  76. package/lib/cjs/types/middleware/interfaces/express-rate-limit.interface.d.ts +292 -292
  77. package/lib/cjs/types/middleware/interfaces/express-session.interface.d.ts +207 -207
  78. package/lib/cjs/types/middleware/interfaces/helmet.interface.d.ts +210 -210
  79. package/lib/cjs/types/middleware/interfaces/morgan.interface.d.ts +40 -40
  80. package/lib/cjs/types/middleware/interfaces/multer.interface.d.ts +255 -255
  81. package/lib/cjs/types/middleware/interfaces/serve-favicon.interface.d.ts +11 -11
  82. package/lib/cjs/types/middleware/interfaces/serve-static.interface.d.ts +70 -70
  83. package/lib/cjs/types/middleware/middleware-resolver.d.ts +11 -11
  84. package/lib/cjs/types/middleware/middleware-service.d.ts +368 -368
  85. package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +43 -43
  86. package/lib/cjs/types/provider/dto-validator/dto-validator.provider.d.ts +11 -11
  87. package/lib/cjs/types/provider/environment/env-validator.provider.d.ts +35 -35
  88. package/lib/cjs/types/provider/index.d.ts +5 -5
  89. package/lib/cjs/types/provider/logger/logger.provider.d.ts +54 -54
  90. package/lib/cjs/types/provider/provider-manager.d.ts +16 -16
  91. package/lib/cjs/types/render/handlebars.interface.d.ts +46 -46
  92. package/lib/cjs/types/render/index.d.ts +2 -2
  93. package/lib/cjs/types/render/render.type.d.ts +12 -12
  94. package/lib/package.json +16 -17
  95. package/package.json +16 -17
@@ -1,57 +1,57 @@
1
- import { Keygrip } from "./keygrip.interface";
2
- interface CookieSessionOptions {
3
- /**
4
- * The name of the cookie to set, defaults to session.
5
- */
6
- name?: string | undefined;
7
- /**
8
- * The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.
9
- */
10
- keys: Array<string> | Keygrip;
11
- /**
12
- * A string which will be used as single key if keys is not provided.
13
- */
14
- secret?: string | undefined;
15
- /**
16
- * a number representing the milliseconds from Date.now() for expiry.
17
- */
18
- maxAge?: number | undefined;
19
- /**
20
- * a Date object indicating the cookie's expiration date (expires at the end of session by default).
21
- */
22
- expires?: Date | undefined;
23
- /**
24
- * a string indicating the path of the cookie (/ by default).
25
- */
26
- path?: string | undefined;
27
- /**
28
- * a string indicating the domain of the cookie (no default).
29
- */
30
- domain?: string | undefined;
31
- /**
32
- * a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', 'none', or true (which maps to 'strict').
33
- */
34
- sameSite?: "strict" | "lax" | "none" | boolean | undefined;
35
- /**
36
- * a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).
37
- */
38
- secure?: boolean | undefined;
39
- /**
40
- * a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).
41
- */
42
- secureProxy?: boolean | undefined;
43
- /**
44
- * a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default).
45
- */
46
- httpOnly?: boolean | undefined;
47
- /**
48
- * a boolean indicating whether the cookie is to be signed (true by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the
49
- * first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.
50
- */
51
- signed?: boolean | undefined;
52
- /**
53
- * a boolean indicating whether to overwrite previously set cookies of the same name (true by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
54
- */
55
- overwrite?: boolean | undefined;
56
- }
57
- export { CookieSessionOptions };
1
+ import { Keygrip } from "./keygrip.interface";
2
+ interface CookieSessionOptions {
3
+ /**
4
+ * The name of the cookie to set, defaults to session.
5
+ */
6
+ name?: string | undefined;
7
+ /**
8
+ * The list of keys to use to sign & verify cookie values. Set cookies are always signed with keys[0], while the other keys are valid for verification, allowing for key rotation.
9
+ */
10
+ keys: Array<string> | Keygrip;
11
+ /**
12
+ * A string which will be used as single key if keys is not provided.
13
+ */
14
+ secret?: string | undefined;
15
+ /**
16
+ * a number representing the milliseconds from Date.now() for expiry.
17
+ */
18
+ maxAge?: number | undefined;
19
+ /**
20
+ * a Date object indicating the cookie's expiration date (expires at the end of session by default).
21
+ */
22
+ expires?: Date | undefined;
23
+ /**
24
+ * a string indicating the path of the cookie (/ by default).
25
+ */
26
+ path?: string | undefined;
27
+ /**
28
+ * a string indicating the domain of the cookie (no default).
29
+ */
30
+ domain?: string | undefined;
31
+ /**
32
+ * a boolean or string indicating whether the cookie is a "same site" cookie (false by default). This can be set to 'strict', 'lax', 'none', or true (which maps to 'strict').
33
+ */
34
+ sameSite?: "strict" | "lax" | "none" | boolean | undefined;
35
+ /**
36
+ * a boolean indicating whether the cookie is only to be sent over HTTPS (false by default for HTTP, true by default for HTTPS).
37
+ */
38
+ secure?: boolean | undefined;
39
+ /**
40
+ * a boolean indicating whether the cookie is only to be sent over HTTPS (use this if you handle SSL not in your node process).
41
+ */
42
+ secureProxy?: boolean | undefined;
43
+ /**
44
+ * a boolean indicating whether the cookie is only to be sent over HTTP(S), and not made available to client JavaScript (true by default).
45
+ */
46
+ httpOnly?: boolean | undefined;
47
+ /**
48
+ * a boolean indicating whether the cookie is to be signed (true by default). If this is true, another cookie of the same name with the .sig suffix appended will also be sent, with a 27-byte url-safe base64 SHA1 value representing the hash of cookie-name=cookie-value against the
49
+ * first Keygrip key. This signature key is used to detect tampering the next time a cookie is received.
50
+ */
51
+ signed?: boolean | undefined;
52
+ /**
53
+ * a boolean indicating whether to overwrite previously set cookies of the same name (true by default). If this is true, all cookies set during the same request with the same name (regardless of path or domain) are filtered out of the Set-Cookie header when setting this cookie.
54
+ */
55
+ overwrite?: boolean | undefined;
56
+ }
57
+ export { CookieSessionOptions };
@@ -1,27 +1,27 @@
1
- interface Keygrip {
2
- /**
3
- * Signs the provided data and returns the signature as a string.
4
- * @param data Data to be signed.
5
- * @returns Signature string.
6
- */
7
- sign(data: any): string;
8
- /**
9
- * Verifies the provided data against a given digest (signature).
10
- * @param data Data to be verified.
11
- * @param digest Signature to verify against.
12
- * @returns True if the verification is successful, otherwise false.
13
- */
14
- verify(data: any, digest: string): boolean;
15
- /**
16
- * Retrieves the index of the provided data in relation to a given digest (signature).
17
- * @param data Data to find the index for.
18
- * @param digest Signature to search for.
19
- * @returns Index of the data, or -1 if not found.
20
- */
21
- index(data: any, digest: string): number;
22
- }
23
- interface KeygripFunction {
24
- new (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
25
- (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
26
- }
27
- export { KeygripFunction as Keygrip };
1
+ interface Keygrip {
2
+ /**
3
+ * Signs the provided data and returns the signature as a string.
4
+ * @param data Data to be signed.
5
+ * @returns Signature string.
6
+ */
7
+ sign(data: any): string;
8
+ /**
9
+ * Verifies the provided data against a given digest (signature).
10
+ * @param data Data to be verified.
11
+ * @param digest Signature to verify against.
12
+ * @returns True if the verification is successful, otherwise false.
13
+ */
14
+ verify(data: any, digest: string): boolean;
15
+ /**
16
+ * Retrieves the index of the provided data in relation to a given digest (signature).
17
+ * @param data Data to find the index for.
18
+ * @param digest Signature to search for.
19
+ * @returns Index of the data, or -1 if not found.
20
+ */
21
+ index(data: any, digest: string): number;
22
+ }
23
+ interface KeygripFunction {
24
+ new (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
25
+ (keys: ReadonlyArray<string>, algorithm?: string, encoding?: string): Keygrip;
26
+ }
27
+ export { KeygripFunction as Keygrip };
@@ -1,57 +1,57 @@
1
- /**
2
- * Represents the possible values for the `origin` property in the `CorsOptions` interface.
3
- */
4
- type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
5
- /**
6
- * A function type to define a custom origin configuration in the `CorsOptions` interface.
7
- *
8
- * @param requestOrigin - The origin of the incoming request, or undefined if not available.
9
- * @param callback - A callback function to indicate whether the request origin is allowed or not.
10
- */
11
- type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
12
- /**
13
- * Interface to define Cross-Origin Resource Sharing (CORS) options.
14
- */
15
- interface CorsOptions {
16
- /**
17
- * Configures the Access-Control-Allow-Origin CORS header.
18
- *
19
- * @default '*' (allows requests from any origin)
20
- */
21
- origin?: StaticOrigin | CustomOrigin | undefined;
22
- /**
23
- * Configures the Access-Control-Allow-Methods CORS header.
24
- *
25
- * @default 'GET,HEAD,PUT,PATCH,POST,DELETE' (allows these HTTP methods)
26
- */
27
- methods?: string | Array<string> | undefined;
28
- /**
29
- * Configures the Access-Control-Allow-Headers CORS header.
30
- */
31
- allowedHeaders?: string | Array<string> | undefined;
32
- /**
33
- * Configures the Access-Control-Expose-Headers CORS header.
34
- */
35
- exposedHeaders?: string | Array<string> | undefined;
36
- /**
37
- * Configures the Access-Control-Allow-Credentials CORS header.
38
- */
39
- credentials?: boolean | undefined;
40
- /**
41
- * Configures the Access-Control-Max-Age CORS header.
42
- */
43
- maxAge?: number | undefined;
44
- /**
45
- * If true, allows preflight requests to pass to the next handler.
46
- *
47
- * @default false
48
- */
49
- preflightContinue?: boolean | undefined;
50
- /**
51
- * Defines the status code to be sent to the client on a successful OPTIONS request, as a part of the preflight request.
52
- *
53
- * @default 204
54
- */
55
- optionsSuccessStatus?: number | undefined;
56
- }
57
- export { CorsOptions };
1
+ /**
2
+ * Represents the possible values for the `origin` property in the `CorsOptions` interface.
3
+ */
4
+ type StaticOrigin = boolean | string | RegExp | (boolean | string | RegExp)[];
5
+ /**
6
+ * A function type to define a custom origin configuration in the `CorsOptions` interface.
7
+ *
8
+ * @param requestOrigin - The origin of the incoming request, or undefined if not available.
9
+ * @param callback - A callback function to indicate whether the request origin is allowed or not.
10
+ */
11
+ type CustomOrigin = (requestOrigin: string | undefined, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
12
+ /**
13
+ * Interface to define Cross-Origin Resource Sharing (CORS) options.
14
+ */
15
+ interface CorsOptions {
16
+ /**
17
+ * Configures the Access-Control-Allow-Origin CORS header.
18
+ *
19
+ * @default '*' (allows requests from any origin)
20
+ */
21
+ origin?: StaticOrigin | CustomOrigin | undefined;
22
+ /**
23
+ * Configures the Access-Control-Allow-Methods CORS header.
24
+ *
25
+ * @default 'GET,HEAD,PUT,PATCH,POST,DELETE' (allows these HTTP methods)
26
+ */
27
+ methods?: string | Array<string> | undefined;
28
+ /**
29
+ * Configures the Access-Control-Allow-Headers CORS header.
30
+ */
31
+ allowedHeaders?: string | Array<string> | undefined;
32
+ /**
33
+ * Configures the Access-Control-Expose-Headers CORS header.
34
+ */
35
+ exposedHeaders?: string | Array<string> | undefined;
36
+ /**
37
+ * Configures the Access-Control-Allow-Credentials CORS header.
38
+ */
39
+ credentials?: boolean | undefined;
40
+ /**
41
+ * Configures the Access-Control-Max-Age CORS header.
42
+ */
43
+ maxAge?: number | undefined;
44
+ /**
45
+ * If true, allows preflight requests to pass to the next handler.
46
+ *
47
+ * @default false
48
+ */
49
+ preflightContinue?: boolean | undefined;
50
+ /**
51
+ * Defines the status code to be sent to the client on a successful OPTIONS request, as a part of the preflight request.
52
+ *
53
+ * @default 204
54
+ */
55
+ optionsSuccessStatus?: number | undefined;
56
+ }
57
+ export { CorsOptions };