@expressots/core 1.9.0 → 2.0.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 (93) hide show
  1. package/lib/CHANGELOG.md +54 -26
  2. package/lib/cjs/application/application-factory.js +83 -0
  3. package/lib/cjs/application/index.js +3 -5
  4. package/lib/cjs/controller/base-controller.js +1 -12
  5. package/lib/cjs/decorator/scope-binding.js +30 -0
  6. package/lib/cjs/index.js +1 -0
  7. package/lib/cjs/middleware/index.js +5 -0
  8. package/lib/cjs/middleware/interfaces/body-parser.interface.js +2 -0
  9. package/lib/cjs/middleware/interfaces/compression.interface.js +2 -0
  10. package/lib/cjs/middleware/interfaces/cors.interface.js +2 -0
  11. package/lib/cjs/middleware/interfaces/serve-static.interface.js +2 -0
  12. package/lib/cjs/middleware/middleware-resolver.js +64 -0
  13. package/lib/cjs/middleware/middleware-service.js +145 -0
  14. package/lib/cjs/provider/index.js +2 -2
  15. package/lib/cjs/types/application/application-factory.d.ts +34 -0
  16. package/lib/cjs/types/application/application-factory.d.ts.map +1 -0
  17. package/lib/cjs/types/application/index.d.ts +1 -1
  18. package/lib/cjs/types/application/index.d.ts.map +1 -1
  19. package/lib/cjs/types/controller/base-controller.d.ts +4 -10
  20. package/lib/cjs/types/controller/base-controller.d.ts.map +1 -1
  21. package/lib/cjs/types/decorator/scope-binding.d.ts +30 -0
  22. package/lib/cjs/types/decorator/scope-binding.d.ts.map +1 -1
  23. package/lib/cjs/types/index.d.ts +1 -0
  24. package/lib/cjs/types/index.d.ts.map +1 -1
  25. package/lib/cjs/types/middleware/index.d.ts +5 -0
  26. package/lib/cjs/types/middleware/index.d.ts.map +1 -0
  27. package/lib/cjs/types/middleware/interfaces/body-parser.interface.d.ts +34 -0
  28. package/lib/cjs/types/middleware/interfaces/body-parser.interface.d.ts.map +1 -0
  29. package/lib/cjs/types/middleware/interfaces/compression.interface.d.ts +99 -0
  30. package/lib/cjs/types/middleware/interfaces/compression.interface.d.ts.map +1 -0
  31. package/lib/cjs/types/middleware/interfaces/cors.interface.d.ts +58 -0
  32. package/lib/cjs/types/middleware/interfaces/cors.interface.d.ts.map +1 -0
  33. package/lib/cjs/types/middleware/interfaces/serve-static.interface.d.ts +71 -0
  34. package/lib/cjs/types/middleware/interfaces/serve-static.interface.d.ts.map +1 -0
  35. package/lib/cjs/types/middleware/middleware-resolver.d.ts +12 -0
  36. package/lib/cjs/types/middleware/middleware-resolver.d.ts.map +1 -0
  37. package/lib/cjs/types/middleware/middleware-service.d.ts +137 -0
  38. package/lib/cjs/types/middleware/middleware-service.d.ts.map +1 -0
  39. package/lib/cjs/types/provider/index.d.ts +1 -1
  40. package/lib/cjs/types/provider/index.d.ts.map +1 -1
  41. package/lib/esm/application/application-factory.js +72 -0
  42. package/lib/esm/application/index.js +3 -5
  43. package/lib/esm/controller/base-controller.js +1 -13
  44. package/lib/esm/decorator/scope-binding.js +30 -0
  45. package/lib/esm/index.mjs +1 -0
  46. package/lib/esm/middleware/index.js +5 -0
  47. package/lib/esm/middleware/interfaces/body-parser.interface.js +2 -0
  48. package/lib/esm/middleware/interfaces/compression.interface.js +2 -0
  49. package/lib/esm/middleware/interfaces/cors.interface.js +2 -0
  50. package/lib/esm/middleware/interfaces/serve-static.interface.js +2 -0
  51. package/lib/esm/middleware/middleware-resolver.js +65 -0
  52. package/lib/esm/middleware/middleware-service.js +144 -0
  53. package/lib/esm/provider/index.js +2 -2
  54. package/lib/esm/types/application/application-factory.d.ts +34 -0
  55. package/lib/esm/types/application/application-factory.d.ts.map +1 -0
  56. package/lib/esm/types/application/index.d.ts +1 -1
  57. package/lib/esm/types/application/index.d.ts.map +1 -1
  58. package/lib/esm/types/controller/base-controller.d.ts +4 -10
  59. package/lib/esm/types/controller/base-controller.d.ts.map +1 -1
  60. package/lib/esm/types/decorator/scope-binding.d.ts +30 -0
  61. package/lib/esm/types/decorator/scope-binding.d.ts.map +1 -1
  62. package/lib/esm/types/index.d.ts +1 -0
  63. package/lib/esm/types/index.d.ts.map +1 -1
  64. package/lib/esm/types/middleware/index.d.ts +5 -0
  65. package/lib/esm/types/middleware/index.d.ts.map +1 -0
  66. package/lib/esm/types/middleware/interfaces/body-parser.interface.d.ts +34 -0
  67. package/lib/esm/types/middleware/interfaces/body-parser.interface.d.ts.map +1 -0
  68. package/lib/esm/types/middleware/interfaces/compression.interface.d.ts +99 -0
  69. package/lib/esm/types/middleware/interfaces/compression.interface.d.ts.map +1 -0
  70. package/lib/esm/types/middleware/interfaces/cors.interface.d.ts +58 -0
  71. package/lib/esm/types/middleware/interfaces/cors.interface.d.ts.map +1 -0
  72. package/lib/esm/types/middleware/interfaces/serve-static.interface.d.ts +71 -0
  73. package/lib/esm/types/middleware/interfaces/serve-static.interface.d.ts.map +1 -0
  74. package/lib/esm/types/middleware/middleware-resolver.d.ts +12 -0
  75. package/lib/esm/types/middleware/middleware-resolver.d.ts.map +1 -0
  76. package/lib/esm/types/middleware/middleware-service.d.ts +137 -0
  77. package/lib/esm/types/middleware/middleware-service.d.ts.map +1 -0
  78. package/lib/esm/types/provider/index.d.ts +1 -1
  79. package/lib/esm/types/provider/index.d.ts.map +1 -1
  80. package/lib/package.json +7 -8
  81. package/package.json +7 -8
  82. package/lib/cjs/application/application.js +0 -141
  83. package/lib/cjs/provider/logger/winston-logger.js +0 -131
  84. package/lib/cjs/types/application/application.d.ts +0 -70
  85. package/lib/cjs/types/application/application.d.ts.map +0 -1
  86. package/lib/cjs/types/provider/logger/winston-logger.d.ts +0 -46
  87. package/lib/cjs/types/provider/logger/winston-logger.d.ts.map +0 -1
  88. package/lib/esm/application/application.js +0 -144
  89. package/lib/esm/provider/logger/winston-logger.js +0 -132
  90. package/lib/esm/types/application/application.d.ts +0 -70
  91. package/lib/esm/types/application/application.d.ts.map +0 -1
  92. package/lib/esm/types/provider/logger/winston-logger.d.ts +0 -46
  93. package/lib/esm/types/provider/logger/winston-logger.d.ts.map +0 -1
@@ -1,4 +1,34 @@
1
+ /**
2
+ * Provides a singleton binding for the given identifier.
3
+ *
4
+ * @remarks
5
+ * Singleton binding ensures that the same instance of a dependency is reused within the entire container.
6
+ *
7
+ * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
8
+ * @returns A fluent interface for further configuring the binding.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * @provideSingleton(ServiceIdentifier)
13
+ * class MyService {}
14
+ * ```
15
+ */
1
16
  declare const provideSingleton: (identifier: any) => (target: any) => any;
17
+ /**
18
+ * Provides a transient binding for the given identifier.
19
+ *
20
+ * @remarks
21
+ * Transient binding ensures that a new instance of a dependency is created every time it is resolved.
22
+ *
23
+ * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
24
+ * @returns A fluent interface for further configuring the binding.
25
+ *
26
+ * @example
27
+ * ```typescript
28
+ * @provideTransient(ServiceIdentifier)
29
+ * class MyService {}
30
+ * ```
31
+ */
2
32
  declare const provideTransient: (identifier: any) => (target: any) => any;
3
33
  export { provideSingleton, provideTransient };
4
34
  //# sourceMappingURL=scope-binding.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope-binding.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/decorator/scope-binding.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,gBAAgB,eAAgB,GAAG,yBAExC,CAAC;AAEF,QAAA,MAAM,gBAAgB,eAAgB,GAAG,yBAExC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"scope-binding.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/decorator/scope-binding.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,gBAAgB,eAAgB,GAAG,yBAExC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,gBAAgB,eAAgB,GAAG,yBAExC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
@@ -5,6 +5,7 @@ export * from "./container-module";
5
5
  export * from "./controller";
6
6
  export * from "./decorator";
7
7
  export * from "./error";
8
+ export * from "./middleware";
8
9
  export * from "./provider";
9
10
  export * from "./render";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/core/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { IMiddleware, Middleware } from "./middleware-service";
2
+ export { OptionsJson } from "./interfaces/body-parser.interface";
3
+ export { CorsOptions } from "./interfaces/cors.interface";
4
+ export { CompressionOptions } from "./interfaces/compression.interface";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import * as http from "http";
4
+ interface OptionsJson {
5
+ /** When set to true, then deflated (compressed) bodies will be inflated; when false, deflated bodies are rejected. Defaults to true. */
6
+ inflate?: boolean | undefined;
7
+ /**
8
+ * Controls the maximum request body size. If this is a number,
9
+ * then the value specifies the number of bytes; if it is a string,
10
+ * the value is passed to the bytes library for parsing. Defaults to '100kb'.
11
+ */
12
+ limit?: number | string | undefined;
13
+ /**
14
+ * The type option is used to determine what media type the middleware will parse
15
+ */
16
+ type?: string | Array<string> | ((req: http.IncomingMessage) => any) | undefined;
17
+ /**
18
+ * The verify option, if supplied, is called as verify(req, res, buf, encoding),
19
+ * where buf is a Buffer of the raw request body and encoding is the encoding of the request.
20
+ */
21
+ verify?(req: http.IncomingMessage, res: http.ServerResponse, buf: Buffer, encoding: string): void;
22
+ /**
23
+ *
24
+ * The reviver option is passed directly to JSON.parse as the second argument.
25
+ */
26
+ reviver?(key: string, value: any): any;
27
+ /**
28
+ * When set to `true`, will only accept arrays and objects;
29
+ * when `false` will accept anything JSON.parse accepts. Defaults to `true`.
30
+ */
31
+ strict?: boolean | undefined;
32
+ }
33
+ export { OptionsJson };
34
+ //# sourceMappingURL=body-parser.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"body-parser.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/body-parser.interface.ts"],"names":[],"mappings":";;AACA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,UAAU,WAAW;IACnB,wIAAwI;IACxI,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IACpC;;OAEG;IACH,IAAI,CAAC,EACD,MAAM,GACN,KAAK,CAAC,MAAM,CAAC,GACb,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,KAAK,GAAG,CAAC,GACpC,SAAS,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,CACL,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,EACxB,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,GACf,IAAI,CAAC;IACR;;;OAGG;IACH,OAAO,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC9B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,99 @@
1
+ import express from "express";
2
+ interface CompressionFilter {
3
+ (req: express.Request, res: express.Response): boolean;
4
+ }
5
+ interface CompressionOptions {
6
+ /**
7
+ * @default zlib.constants.Z_DEFAULT_CHUNK or 16384
8
+ * @see {@link https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning| Node.js documentation}
9
+ * @see {@link https://github.com/expressjs/compression#chunksize|chunkSize documentation}
10
+ */
11
+ chunkSize?: number | undefined;
12
+ /**
13
+ * A function to decide if the response should be considered for compression. This function is called as
14
+ * `filter(req, res)` and is expected to return `true` to consider the response for compression, or `false` to
15
+ * not compress the response.
16
+ *
17
+ * The default filter function uses the `compressible` module to determine if `res.getHeader('Content-Type')`
18
+ * is compressible.
19
+ *
20
+ * @see {@link https://github.com/expressjs/compression#filter|`filter` documentation}
21
+ * @see {@link https://www.npmjs.com/package/compressible|compressible module}
22
+ */
23
+ filter?: CompressionFilter | undefined;
24
+ /**
25
+ * The level of zlib compression to apply to responses. A higher level will result in better compression, but
26
+ * will take longer to complete. A lower level will result in less compression, but will be much faster.
27
+ *
28
+ * This is an integer in the range of `0` (no compression) to `9` (maximum compression). The special value `-1`
29
+ * can be used to mean the "default compression level", which is a default compromise between speed and
30
+ * compression (currently equivalent to level 6).
31
+ *
32
+ * - `-1` Default compression level (also `zlib.constants.Z_DEFAULT_COMPRESSION`).
33
+ * - `0` No compression (also `zlib.constants.Z_NO_COMPRESSION`).
34
+ * - `1` Fastest compression (also `zlib.constants.Z_BEST_SPEED`).
35
+ * - `2`
36
+ * - `3`
37
+ * - `4`
38
+ * - `5`
39
+ * - `6` (currently what `zlib.constants.Z_DEFAULT_COMPRESSION` points to).
40
+ * - `7`
41
+ * - `8`
42
+ * - `9` Best compression (also `zlib.constants.Z_BEST_COMPRESSION`).
43
+ *
44
+ * **Note** in the list above, `zlib` is from `zlib = require('zlib')`.
45
+ *
46
+ * @default zlib.constants.DEFAULT_COMPRESSION or -1
47
+ * @see {@link https://github.com/expressjs/compression#level|`level` documentation}
48
+ */
49
+ level?: number | undefined;
50
+ /**
51
+ * This specifies how much memory should be allocated for the internal compression state and is an integer in
52
+ * the range of `1` (minimum level) and `9` (maximum level).
53
+ *
54
+ * @default zlib.constants.DEFAULT_MEMLEVEL or 8
55
+ * @see {@link https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}
56
+ * @see {@link https://github.com/expressjs/compression#memlevel|`memLevel` documentation}
57
+ */
58
+ memLevel?: number | undefined;
59
+ /**
60
+ * This is used to tune the compression algorithm. This value only affects the compression ratio, not the
61
+ * correctness of the compressed output, even if it is not set appropriately.
62
+ *
63
+ * - `zlib.constants.Z_DEFAULT_STRATEGY` Use for normal data.
64
+ * - `zlib.constants.Z_FILTERED` Use for data produced by a filter (or predictor). Filtered data consists mostly of small
65
+ * values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress
66
+ * them better. The effect is to force more Huffman coding and less string matching; it is somewhat intermediate
67
+ * between `zlib.constants.Z_DEFAULT_STRATEGY` and `zlib.constants.Z_HUFFMAN_ONLY`.
68
+ * - `zlib.constants.Z_FIXED` Use to prevent the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
69
+ * - `zlib.constants.Z_HUFFMAN_ONLY` Use to force Huffman encoding only (no string match).
70
+ * - `zlib.constants.Z_RLE` Use to limit match distances to one (run-length encoding). This is designed to be almost as
71
+ * fast as `zlib.constants.Z_HUFFMAN_ONLY`, but give better compression for PNG image data.
72
+ *
73
+ * **Note** in the list above, `zlib` is from `zlib = require('zlib')`.
74
+ */
75
+ strategy?: number | undefined;
76
+ /**
77
+ * The byte threshold for the response body size before compression is considered for the response, defaults to
78
+ * 1kb. This is a number of bytes or any string accepted by the bytes module.
79
+ *
80
+ * **Note** this is only an advisory setting; if the response size cannot be determined at the time the response
81
+ * headers are written, then it is assumed the response is *over* the threshold. To guarantee the response size
82
+ * can be determined, be sure set a `Content-Length` response header.
83
+ *
84
+ * @see {@link https://www.npmjs.com/package/bytes|`bytes` module}
85
+ * @see {@link https://github.com/expressjs/compression#threshold|`threshold` documentation}
86
+ */
87
+ threshold?: number | string | undefined;
88
+ /**
89
+ * @default zlib.constants.Z_DEFAULT_WINDOWBITS or 15.
90
+ * @see {@link https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}
91
+ */
92
+ windowBits?: number | undefined;
93
+ /**
94
+ * In addition , `zlib` options may be passed in to the options object.
95
+ */
96
+ [property: string]: any;
97
+ }
98
+ export { CompressionOptions };
99
+ //# sourceMappingURL=compression.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compression.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/compression.interface.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,UAAU,iBAAiB;IACzB,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC;CACxD;AAED,UAAU,kBAAkB;IAC1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAEvC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAExC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,58 @@
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 };
58
+ //# sourceMappingURL=cors.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cors.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/cors.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,KAAK,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAE9E;;;;;GAKG;AACH,KAAK,YAAY,GAAG,CAClB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,YAAY,KAAK,IAAI,KACzD,IAAI,CAAC;AAEV;;GAEG;AACH,UAAU,WAAW;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC;IACjD;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAE7C;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAEpD;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAEpD;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAExC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,71 @@
1
+ /// <reference types="node" />
2
+ import http from "http";
3
+ interface ServeStaticOptions<R extends http.ServerResponse = http.ServerResponse> {
4
+ /**
5
+ * Enable or disable accepting ranged requests, defaults to true.
6
+ * Disabling this will not send Accept-Ranges and ignore the contents of the Range request header.
7
+ */
8
+ acceptRanges?: boolean | undefined;
9
+ /**
10
+ * Enable or disable setting Cache-Control response header, defaults to true.
11
+ * Disabling this will ignore the immutable and maxAge options.
12
+ */
13
+ cacheControl?: boolean | undefined;
14
+ /**
15
+ * Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot (".").
16
+ * Note this check is done on the path itself without checking if the path actually exists on the disk.
17
+ * If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
18
+ * The default value is 'ignore'.
19
+ * 'allow' No special treatment for dotfiles
20
+ * 'deny' Send a 403 for any request for a dotfile
21
+ * 'ignore' Pretend like the dotfile does not exist and call next()
22
+ */
23
+ dotfiles?: string | undefined;
24
+ /**
25
+ * Enable or disable etag generation, defaults to true.
26
+ */
27
+ etag?: boolean | undefined;
28
+ /**
29
+ * Set file extension fallbacks. When set, if a file is not found, the given extensions will be added to the file name and search for.
30
+ * The first that exists will be served. Example: ['html', 'htm'].
31
+ * The default value is false.
32
+ */
33
+ extensions?: Array<string> | false | undefined;
34
+ /**
35
+ * Let client errors fall-through as unhandled requests, otherwise forward a client error.
36
+ * The default value is true.
37
+ */
38
+ fallthrough?: boolean | undefined;
39
+ /**
40
+ * Enable or disable the immutable directive in the Cache-Control response header.
41
+ * If enabled, the maxAge option should also be specified to enable caching. The immutable directive will prevent supported clients from making conditional requests during the life of the maxAge option to check if the file has changed.
42
+ */
43
+ immutable?: boolean | undefined;
44
+ /**
45
+ * By default this module will send "index.html" files in response to a request on a directory.
46
+ * To disable this set false or to supply a new index pass a string or an array in preferred order.
47
+ */
48
+ index?: boolean | string | Array<string> | undefined;
49
+ /**
50
+ * Enable or disable Last-Modified header, defaults to true. Uses the file system's last modified value.
51
+ */
52
+ lastModified?: boolean | undefined;
53
+ /**
54
+ * Provide a max-age in milliseconds for http caching, defaults to 0. This can also be a string accepted by the ms module.
55
+ */
56
+ maxAge?: number | string | undefined;
57
+ /**
58
+ * Redirect to trailing "/" when the pathname is a dir. Defaults to true.
59
+ */
60
+ redirect?: boolean | undefined;
61
+ /**
62
+ * Function to set custom headers on response. Alterations to the headers need to occur synchronously.
63
+ * The function is called as fn(res, path, stat), where the arguments are:
64
+ * res the response object
65
+ * path the file path that is being sent
66
+ * stat the stat object of the file that is being sent
67
+ */
68
+ setHeaders?: ((res: R, path: string, stat: any) => any) | undefined;
69
+ }
70
+ export { ServeStaticOptions };
71
+ //# sourceMappingURL=serve-static.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve-static.interface.d.ts","sourceRoot":"","sources":["../../../../../packages/core/src/middleware/interfaces/serve-static.interface.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,UAAU,kBAAkB,CAC1B,CAAC,SAAS,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,cAAc;IAEnD;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEnC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE9B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,CAAC;IAE/C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAElC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEhC;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAErD;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B;;;;;;OAMG;IAEH,UAAU,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,SAAS,CAAC;CACrE;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,12 @@
1
+ import express from "express";
2
+ /**
3
+ * A utility function that wraps the creation and retrieval of middleware.
4
+ * It creates a new instance of MiddlewareResolver and calls the getMiddleware method.
5
+ *
6
+ * @param {string} middleware - The name of the middleware to be retrieved.
7
+ * @param {...any} options - Optional arguments to configure the middleware.
8
+ * @returns {express.RequestHandler | null} - Returns the configured middleware or null if not found or not installed.
9
+ */
10
+ declare function middlewareResolver(middleware: string, ...options: any): express.RequestHandler | null;
11
+ export { middlewareResolver };
12
+ //# sourceMappingURL=middleware-resolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-resolver.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-resolver.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,SAAS,CAAC;AAgE9B;;;;;;;GAOG;AACH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,GAAG,OAAO,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,GAAG,IAAI,CAG/B;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,137 @@
1
+ import express from "express";
2
+ import { OptionsJson } from "./interfaces/body-parser.interface";
3
+ import { CompressionOptions } from "./interfaces/compression.interface";
4
+ import { CorsOptions } from "./interfaces/cors.interface";
5
+ import { ServeStaticOptions } from "./interfaces/serve-static.interface";
6
+ type ExpressHandler = express.ErrorRequestHandler | express.RequestParamHandler | express.RequestHandler | undefined;
7
+ /**
8
+ * Interface for configuring and managing middlewares in the application.
9
+ * Provides methods to be added automatically in the application without the need to import packages.
10
+ */
11
+ interface IMiddleware {
12
+ /**
13
+ * Adds a Body Parser middleware to the middleware collection.
14
+ * The body parser is responsible for parsing the incoming request bodies in a middleware.
15
+ *
16
+ * @param options - Optional configuration options for the JSON body parser.
17
+ */
18
+ addBodyParser(options?: OptionsJson): void;
19
+ /**
20
+ * Adds Cross-Origin Resource Sharing (CORS) middleware to enable or control cross-origin requests.
21
+ *
22
+ * @param options - Optional configuration options for CORS. Defines the behavior of CORS requests like allowed origins, methods, headers, etc.
23
+ */
24
+ addCors(options?: CorsOptions): void;
25
+ /**
26
+ * Adds Compression middleware to reduce the size of the response body and improve the speed of the client-server communication.
27
+ *
28
+ * @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
29
+ */
30
+ addCompression(options?: CompressionOptions): void;
31
+ /**
32
+ * Configures the error handling middleware for the application.
33
+ *
34
+ * @param errorHandling - The Express error handler function that takes care of processing errors and formulating the response.
35
+ */
36
+ setErrorHandler(errorHandling?: ExpressHandler): void;
37
+ /**
38
+ * Adds a middleware to serve static files from the specified root directory.
39
+ * Allows the application to serve files like images, CSS, JavaScript, etc.
40
+ *
41
+ * @param root - The root directory from which the static assets are to be served.
42
+ * @param options - Optional configuration options for serving static files. Defines behavior like cache control, custom headers, etc.
43
+ */
44
+ serveStatic(root: string, options?: ServeStaticOptions): void;
45
+ /**
46
+ * Adds a middleware to the middleware collection.
47
+ *
48
+ * @param middleware - The Express request handler function to be added to the middleware collection.
49
+ *
50
+ */
51
+ addMiddleware(middleware: express.RequestHandler): void;
52
+ /**
53
+ * Retrieves all the middlewares that have been added.
54
+ *
55
+ * @returns An array of Express request handlers representing the middlewares.
56
+ */
57
+ getMiddlewares(): Array<express.RequestHandler>;
58
+ /**
59
+ * Gets the configured error handler middleware.
60
+ *
61
+ * @returns The error handler middleware.
62
+ */
63
+ getErrorHandler(): ExpressHandler;
64
+ }
65
+ /**
66
+ * Singleton class that implements the IConfigure interface.
67
+ * Manages the middleware configuration for the application,
68
+ * including adding Body Parser and retrieving all configured middlewares.
69
+ *
70
+ * @see IConfigure
71
+ */
72
+ declare class Middleware implements IMiddleware {
73
+ private middlewares;
74
+ private errorHandler;
75
+ private logger;
76
+ /**
77
+ * Checks if a middleware with the given name exists in the middleware collection.
78
+ *
79
+ * @param middlewareName - The name of the middleware to be checked.
80
+ *
81
+ * @returns A boolean value indicating whether the middleware exists or not.
82
+ */
83
+ private middlewareExists;
84
+ /**
85
+ * Adds a Body Parser middleware to the middleware collection using the given options.
86
+ *
87
+ * @param options - Optional configuration options for the JSON body parser.
88
+ */
89
+ addBodyParser(options?: OptionsJson): void;
90
+ /**
91
+ * Adds Cross-Origin Resource Sharing (CORS) middleware to enable or control cross-origin requests.
92
+ *
93
+ * @param options - Optional configuration options for CORS. Defines the behavior of CORS requests like allowed origins, methods, headers, etc.
94
+ */
95
+ addCors(options?: CorsOptions): void;
96
+ /**
97
+ * Adds Compression middleware to reduce the size of the response body and improve the speed of the client-server communication.
98
+ *
99
+ * @param options - Optional configuration options for Compression. Allows fine-tuning the compression behavior, such as setting the compression level, threshold, and filter functions to determine which requests should be compressed.
100
+ */
101
+ addCompression(options?: CompressionOptions): void;
102
+ /**
103
+ * Configures the error handling middleware for the application.
104
+ *
105
+ * @param errorHandling - The Express error handler function that takes care of processing errors and formulating the response.
106
+ */
107
+ setErrorHandler(errorHandling?: ExpressHandler): void;
108
+ /**
109
+ * Adds a middleware to serve static files from the specified root directory.
110
+ * Allows the application to serve files like images, CSS, JavaScript, etc.
111
+ *
112
+ * @param root - The root directory from which the static assets are to be served.
113
+ * @param options - Optional configuration options for serving static files. Defines behavior like cache control, custom headers, etc.
114
+ */
115
+ serveStatic(root: string, options?: ServeStaticOptions): void;
116
+ /**
117
+ * Adds a middleware to the middleware collection.
118
+ *
119
+ * @param middleware - The Express request handler function to be added to the middleware collection.
120
+ *
121
+ */
122
+ addMiddleware(middleware: express.RequestHandler): void;
123
+ /**
124
+ * Retrieves all the middlewares that have been added to the collection.
125
+ *
126
+ * @returns An array of Express request handlers representing the middlewares.
127
+ */
128
+ getMiddlewares(): Array<express.RequestHandler>;
129
+ /**
130
+ * Gets the configured error handler middleware.
131
+ *
132
+ * @returns The error handler middleware.
133
+ */
134
+ getErrorHandler(): ExpressHandler;
135
+ }
136
+ export { Middleware, IMiddleware };
137
+ //# sourceMappingURL=middleware-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware-service.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/middleware/middleware-service.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAI9B,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAGzE,KAAK,cAAc,GACf,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,cAAc,GACtB,SAAS,CAAC;AAEd;;;GAGG;AACH,UAAU,WAAW;IACnB;;;;;OAKG;IACH,aAAa,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAE3C;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAErC;;;;OAIG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEnD;;;;OAIG;IACH,eAAe,CAAC,aAAa,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAEtD;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAE9D;;;;;OAKG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAExD;;;;OAIG;IACH,cAAc,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAEhD;;;;OAIG;IACH,eAAe,IAAI,cAAc,CAAC;CACnC;AAED;;;;;;GAMG;AACH,cACM,UAAW,YAAW,WAAW;IACrC,OAAO,CAAC,WAAW,CAAqC;IACxD,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,MAAM,CAAwB;IAEtC;;;;;;OAMG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;OAIG;IACI,aAAa,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IAajD;;;;OAIG;IACH,OAAO,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI;IASpC;;;;OAIG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAUlD;;;;OAIG;IACH,eAAe,CAAC,aAAa,CAAC,EAAE,cAAc,GAAG,IAAI;IAQrD;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,IAAI;IAa7D;;;;;OAKG;IACH,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,cAAc,GAAG,IAAI;IAavD;;;;OAIG;IACI,cAAc,IAAI,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC;IAItD;;;;OAIG;IACI,eAAe,IAAI,cAAc;CAGzC;AAED,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { Provider, IProvider } from "./provider-service";
2
2
  export { Logger } from "./logger/logger-service";
3
- export { EnvValidatorProvider } from "./environment/env-validator.provider";
3
+ export { EnvValidatorProvider as Env } from "./environment/env-validator.provider";
4
4
  export { ValidateDTO } from "./dto-validator/dto-validator.provider";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/core/src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,oBAAoB,IAAI,GAAG,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppFactory = void 0;
4
+ const logger_service_1 = require("../provider/logger/logger-service");
5
+ const adapter_express_1 = require("@expressots/adapter-express");
6
+ //import { AppFastify } from "./fastify/application-fastify";
7
+ //import { IApplicationFastify } from "./fastify/application-fastify.interface";
8
+ //import { Handler } from "@fastify/middie";
9
+ /**
10
+ * AppFactory Class
11
+ *
12
+ * Responsible for creating an instance of the Application,
13
+ * either using a custom application type or with provided middlewares.
14
+ */
15
+ class AppFactory {
16
+ static logger = new logger_service_1.Logger();
17
+ /* public static async create(
18
+ container: Container,
19
+ middlewares: Array<express.RequestHandler>,
20
+ httpServerFactory?: new () => AppFastify,
21
+ ): Promise<AppFastify>; */
22
+ /**
23
+ * Implementation of the create method, handling both overloads.
24
+ * @param container - InversifyJS container to resolve dependencies.
25
+ * @param appTypeOrMiddlewares - Custom application class or array of middlewares.
26
+ * @returns Instance of the application.
27
+ */
28
+ static async create(container, appTypeOrMiddlewares, httpServerFactory /*| AppFastify*/) {
29
+ let app /*| AppFastify*/ = {}; /*| AppFastify*/
30
+ if (this.isOpinionated(appTypeOrMiddlewares)) {
31
+ switch (httpServerFactory) {
32
+ case adapter_express_1.AppExpress:
33
+ app = container.resolve(appTypeOrMiddlewares);
34
+ app.create(container);
35
+ return app;
36
+ /* case AppFastify:
37
+ app = container.resolve(appTypeOrMiddlewares as new () => AppFastify);
38
+ await app.create(container);
39
+ return app as IApplicationFastify; */
40
+ default:
41
+ app = container.resolve(appTypeOrMiddlewares);
42
+ app.create(container);
43
+ return app;
44
+ }
45
+ }
46
+ else {
47
+ switch (httpServerFactory) {
48
+ case adapter_express_1.AppExpress:
49
+ app = container.get(adapter_express_1.AppExpress);
50
+ app.create(container, appTypeOrMiddlewares);
51
+ return app;
52
+ /* case AppFastify:
53
+ app = container.get<AppFastify>(AppFastify);
54
+ await app.create(container, appTypeOrMiddlewares as Array<Handler>);
55
+ return app as AppFastify; */
56
+ default:
57
+ app = container.get(adapter_express_1.AppExpress);
58
+ app.create(container, appTypeOrMiddlewares);
59
+ return app;
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ * Checks if the provided parameter is a custom application type.
65
+ * @param appTypeOrMiddlewares - Custom application class or array of middlewares.
66
+ * @returns True if the provided parameter is a custom application type.
67
+ */
68
+ static isOpinionated(appTypeOrMiddlewares) {
69
+ return typeof appTypeOrMiddlewares === "function";
70
+ }
71
+ }
72
+ exports.AppFactory = AppFactory;
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppContainer = exports.ServerEnvironment = exports.Application = exports.AppInstance = void 0;
4
- var application_1 = require("./application");
5
- Object.defineProperty(exports, "AppInstance", { enumerable: true, get: function () { return application_1.AppInstance; } });
6
- Object.defineProperty(exports, "Application", { enumerable: true, get: function () { return application_1.Application; } });
7
- Object.defineProperty(exports, "ServerEnvironment", { enumerable: true, get: function () { return application_1.ServerEnvironment; } });
3
+ exports.AppFactory = exports.AppContainer = void 0;
8
4
  var app_container_1 = require("./app-container");
9
5
  Object.defineProperty(exports, "AppContainer", { enumerable: true, get: function () { return app_container_1.AppContainer; } });
6
+ var application_factory_1 = require("./application-factory");
7
+ Object.defineProperty(exports, "AppFactory", { enumerable: true, get: function () { return application_factory_1.AppFactory; } });
@@ -5,9 +5,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
11
8
  var BaseController_1;
12
9
  Object.defineProperty(exports, "__esModule", { value: true });
13
10
  exports.BaseController = void 0;
@@ -18,14 +15,6 @@ const inversify_binding_decorators_1 = require("inversify-binding-decorators");
18
15
  * @provide BaseController
19
16
  */
20
17
  let BaseController = BaseController_1 = class BaseController {
21
- serviceName;
22
- /**
23
- * Constructs a new BaseController instance with a specified service name.
24
- * @param serviceName - The name of the service associated with the controller.
25
- */
26
- constructor(serviceName = "") {
27
- this.serviceName = serviceName;
28
- }
29
18
  /**
30
19
  * Calls an asynchronous use case and sends an appropriate response based on the result.
31
20
  * @param useCase - A promise representing the asynchronous use case to call.
@@ -82,6 +71,5 @@ let BaseController = BaseController_1 = class BaseController {
82
71
  };
83
72
  exports.BaseController = BaseController;
84
73
  exports.BaseController = BaseController = BaseController_1 = __decorate([
85
- (0, inversify_binding_decorators_1.provide)(BaseController_1),
86
- __metadata("design:paramtypes", [String])
74
+ (0, inversify_binding_decorators_1.provide)(BaseController_1)
87
75
  ], BaseController);