@expressots/core 2.7.0 → 2.9.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 (97) hide show
  1. package/lib/CHANGELOG.md +77 -0
  2. package/lib/cjs/application/app-container.js +94 -82
  3. package/lib/cjs/application/application-factory.js +74 -72
  4. package/lib/cjs/application/index.js +7 -7
  5. package/lib/cjs/common/color-service.provider.js +47 -46
  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 +61 -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 +75 -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 -37
  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 +54 -57
  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 -29
  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 -0
  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 +481 -300
  39. package/lib/cjs/provider/db-in-memory/db-in-memory.provider.js +82 -75
  40. package/lib/cjs/provider/dto-validator/dto-validator.provider.js +53 -53
  41. package/lib/cjs/provider/environment/env-validator.provider.js +98 -96
  42. package/lib/cjs/provider/index.js +13 -13
  43. package/lib/cjs/provider/logger/{logger-service.js → logger.provider.js} +117 -115
  44. package/lib/cjs/provider/provider-manager.js +50 -0
  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 -125
  49. package/lib/cjs/types/application/application-factory.d.ts +34 -33
  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 +47 -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 -12
  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 -208
  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 -0
  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 -275
  85. package/lib/cjs/types/provider/db-in-memory/db-in-memory.provider.d.ts +43 -38
  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 -30
  88. package/lib/cjs/types/provider/index.d.ts +5 -5
  89. package/lib/cjs/types/provider/logger/{logger-service.d.ts → logger.provider.d.ts} +54 -49
  90. package/lib/cjs/types/provider/provider-manager.d.ts +16 -0
  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 +21 -20
  95. package/package.json +21 -20
  96. package/lib/cjs/provider/provider-service.js +0 -38
  97. package/lib/cjs/types/provider/provider-service.d.ts +0 -30
@@ -1,44 +1,44 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.provideTransient = exports.provideSingleton = void 0;
4
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
5
- /* eslint-disable @typescript-eslint/no-explicit-any */
6
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
7
- /**
8
- * Provides a singleton binding for the given identifier.
9
- *
10
- * @remarks
11
- * Singleton binding ensures that the same instance of a dependency is reused within the entire container.
12
- *
13
- * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
14
- * @returns A fluent interface for further configuring the binding.
15
- *
16
- * @example
17
- * ```typescript
18
- * @provideSingleton(ServiceIdentifier)
19
- * class MyService {}
20
- * ```
21
- */
22
- const provideSingleton = (identifier) => {
23
- return (0, inversify_binding_decorators_1.fluentProvide)(identifier).inSingletonScope().done();
24
- };
25
- exports.provideSingleton = provideSingleton;
26
- /**
27
- * Provides a transient binding for the given identifier.
28
- *
29
- * @remarks
30
- * Transient binding ensures that a new instance of a dependency is created every time it is resolved.
31
- *
32
- * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
33
- * @returns A fluent interface for further configuring the binding.
34
- *
35
- * @example
36
- * ```typescript
37
- * @provideTransient(ServiceIdentifier)
38
- * class MyService {}
39
- * ```
40
- */
41
- const provideTransient = (identifier) => {
42
- return (0, inversify_binding_decorators_1.fluentProvide)(identifier).inTransientScope().done();
43
- };
44
- exports.provideTransient = provideTransient;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.provideTransient = exports.provideSingleton = void 0;
4
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
5
+ /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ const inversify_binding_decorators_1 = require("inversify-binding-decorators");
7
+ /**
8
+ * Provides a singleton binding for the given identifier.
9
+ *
10
+ * @remarks
11
+ * Singleton binding ensures that the same instance of a dependency is reused within the entire container.
12
+ *
13
+ * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
14
+ * @returns A fluent interface for further configuring the binding.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * @provideSingleton(ServiceIdentifier)
19
+ * class MyService {}
20
+ * ```
21
+ */
22
+ const provideSingleton = (identifier) => {
23
+ return (0, inversify_binding_decorators_1.fluentProvide)(identifier).inSingletonScope().done();
24
+ };
25
+ exports.provideSingleton = provideSingleton;
26
+ /**
27
+ * Provides a transient binding for the given identifier.
28
+ *
29
+ * @remarks
30
+ * Transient binding ensures that a new instance of a dependency is created every time it is resolved.
31
+ *
32
+ * @param identifier - The identifier (e.g., symbol, string, class) for the dependency being registered.
33
+ * @returns A fluent interface for further configuring the binding.
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * @provideTransient(ServiceIdentifier)
38
+ * class MyService {}
39
+ * ```
40
+ */
41
+ const provideTransient = (identifier) => {
42
+ return (0, inversify_binding_decorators_1.fluentProvide)(identifier).inTransientScope().done();
43
+ };
44
+ exports.provideTransient = provideTransient;
@@ -1,37 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppError = void 0;
4
- /**
5
- * The AppError class extends the built-in Error class in JavaScript,
6
- * providing additional properties to manage custom application errors.
7
- * It captures detailed information about the error, including a status code
8
- * and an optional service identifier, which can be useful for error handling
9
- * and logging within the application.
10
- *
11
- * @extends {Error}
12
- */
13
- class AppError extends Error {
14
- /**
15
- * The HTTP status code associated with the error.
16
- * Commonly used to define the HTTP response status code.
17
- */
18
- statusCode;
19
- /**
20
- * The service identifier associated with the error.
21
- * This property can be used to trace the origin of the error in the application.
22
- * It is optional and can be left undefined.
23
- */
24
- service;
25
- /**
26
- * @param {string} message - The error message to be displayed.
27
- * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
28
- * @param {string} [service] - The service identifier associated with the error.
29
- */
30
- constructor(message, statusCode = 500, service) {
31
- super(message);
32
- this.statusCode = statusCode;
33
- this.service = service;
34
- Error.captureStackTrace(this, this.constructor);
35
- }
36
- }
37
- exports.AppError = AppError;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = void 0;
4
+ /**
5
+ * The AppError class extends the built-in Error class in JavaScript,
6
+ * providing additional properties to manage custom application errors.
7
+ * It captures detailed information about the error, including a status code
8
+ * and an optional service identifier, which can be useful for error handling
9
+ * and logging within the application.
10
+ *
11
+ * @extends {Error}
12
+ */
13
+ class AppError extends Error {
14
+ /**
15
+ * @param {string} message - The error message to be displayed.
16
+ * @param {number} [statusCode=500] - The HTTP status code associated with the error (default: 500).
17
+ * @param {string} [service] - The service identifier associated with the error.
18
+ */
19
+ constructor(message, statusCode = 500, service) {
20
+ super(message);
21
+ this.statusCode = statusCode;
22
+ this.service = service;
23
+ Error.captureStackTrace(this, this.constructor);
24
+ }
25
+ }
26
+ exports.AppError = AppError;
@@ -1,28 +1,28 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_error_1 = require("./app-error");
4
- const status_code_1 = require("./status-code");
5
- /**
6
- * errorHandler is a custom Express error-handling middleware function.
7
- * It logs the error, sets the status code, and sends a JSON response containing the status code and error message.
8
- * @param error - An instance of IAppError containing error details.
9
- * @param req - The Express request object.
10
- * @param res - The Express response object.
11
- * @param next - The Express next function for passing control to the next middleware function.
12
- */
13
- function defaultErrorHandler(error, req, res,
14
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
- next) {
16
- if (error instanceof app_error_1.AppError) {
17
- res
18
- .status(error.statusCode)
19
- .json({ statusCode: error.statusCode, error: error.message });
20
- }
21
- else {
22
- res.status(status_code_1.StatusCode.InternalServerError).json({
23
- statusCode: status_code_1.StatusCode.InternalServerError,
24
- error: "An unexpected error occurred.",
25
- });
26
- }
27
- }
28
- exports.default = defaultErrorHandler;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const app_error_1 = require("./app-error");
4
+ const status_code_1 = require("./status-code");
5
+ /**
6
+ * errorHandler is a custom Express error-handling middleware function.
7
+ * It logs the error, sets the status code, and sends a JSON response containing the status code and error message.
8
+ * @param error - An instance of IAppError containing error details.
9
+ * @param req - The Express request object.
10
+ * @param res - The Express response object.
11
+ * @param next - The Express next function for passing control to the next middleware function.
12
+ */
13
+ function defaultErrorHandler(error, req, res,
14
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
+ next) {
16
+ if (error instanceof app_error_1.AppError) {
17
+ res
18
+ .status(error.statusCode)
19
+ .json({ statusCode: error.statusCode, error: error.message });
20
+ }
21
+ else {
22
+ res.status(status_code_1.StatusCode.InternalServerError).json({
23
+ statusCode: status_code_1.StatusCode.InternalServerError,
24
+ error: "An unexpected error occurred.",
25
+ });
26
+ }
27
+ }
28
+ exports.default = defaultErrorHandler;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppError = exports.Report = exports.StatusCode = void 0;
4
- var status_code_1 = require("./status-code");
5
- Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return status_code_1.StatusCode; } });
6
- var report_1 = require("./report");
7
- Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
8
- var app_error_1 = require("./app-error");
9
- Object.defineProperty(exports, "AppError", { enumerable: true, get: function () { return app_error_1.AppError; } });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppError = exports.Report = exports.StatusCode = void 0;
4
+ var status_code_1 = require("./status-code");
5
+ Object.defineProperty(exports, "StatusCode", { enumerable: true, get: function () { return status_code_1.StatusCode; } });
6
+ var report_1 = require("./report");
7
+ Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
8
+ var app_error_1 = require("./app-error");
9
+ Object.defineProperty(exports, "AppError", { enumerable: true, get: function () { return app_error_1.AppError; } });
@@ -1,57 +1,54 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
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
- var Report_1;
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.Report = void 0;
14
- const inversify_binding_decorators_1 = require("inversify-binding-decorators");
15
- const logger_service_1 = require("../provider/logger/logger-service");
16
- const app_error_1 = require("./app-error");
17
- /**
18
- * Report class is a utility class to manage and log errors within the application.
19
- * It is responsible for creating a standardized error object, logging it,
20
- * and then throwing the error for further handling.
21
- */
22
- let Report = class Report {
23
- static { Report_1 = this; }
24
- static stack;
25
- logger;
26
- constructor() {
27
- this.logger = new logger_service_1.Logger();
28
- }
29
- /**
30
- * The Error method is responsible for generating a standardized error object,
31
- * logging the error, and then throwing it for further handling.
32
- * The error thrown is of the custom type AppError, which extends the built-in Error class.
33
- *
34
- * @param error - An instance of Error or a string that describes the error.
35
- * @param statusCode - The HTTP status code associated with the error (default is 500).
36
- * @param service - The service name associated with the error. If not specified,
37
- * it defaults to the name of the calling function.
38
- *
39
- * @throws An object of the custom type AppError, which includes details about the error.
40
- */
41
- error(error, statusCode, service) {
42
- let appError = {};
43
- if (error instanceof Error) {
44
- appError = new app_error_1.AppError(error.message, statusCode, service);
45
- }
46
- else {
47
- appError = new app_error_1.AppError(error, statusCode, service);
48
- }
49
- this.logger.error(appError.message, appError.service || "service-undefined");
50
- return appError;
51
- }
52
- };
53
- exports.Report = Report;
54
- exports.Report = Report = Report_1 = __decorate([
55
- (0, inversify_binding_decorators_1.provide)(Report_1),
56
- __metadata("design:paramtypes", [])
57
- ], Report);
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
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
+ var Report_1;
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.Report = void 0;
14
+ const inversify_binding_decorators_1 = require("inversify-binding-decorators");
15
+ const logger_provider_1 = require("../provider/logger/logger.provider");
16
+ const app_error_1 = require("./app-error");
17
+ /**
18
+ * Report class is a utility class to manage and log errors within the application.
19
+ * It is responsible for creating a standardized error object, logging it,
20
+ * and then throwing the error for further handling.
21
+ */
22
+ let Report = Report_1 = class Report {
23
+ constructor() {
24
+ this.logger = new logger_provider_1.Logger();
25
+ }
26
+ /**
27
+ * The Error method is responsible for generating a standardized error object,
28
+ * logging the error, and then throwing it for further handling.
29
+ * The error thrown is of the custom type AppError, which extends the built-in Error class.
30
+ *
31
+ * @param error - An instance of Error or a string that describes the error.
32
+ * @param statusCode - The HTTP status code associated with the error (default is 500).
33
+ * @param service - The service name associated with the error. If not specified,
34
+ * it defaults to the name of the calling function.
35
+ *
36
+ * @throws An object of the custom type AppError, which includes details about the error.
37
+ */
38
+ error(error, statusCode, service) {
39
+ let appError = {};
40
+ if (error instanceof Error) {
41
+ appError = new app_error_1.AppError(error.message, statusCode, service);
42
+ }
43
+ else {
44
+ appError = new app_error_1.AppError(error, statusCode, service);
45
+ }
46
+ this.logger.error(appError.message, appError.service || "service-undefined");
47
+ return appError;
48
+ }
49
+ };
50
+ Report = Report_1 = __decorate([
51
+ (0, inversify_binding_decorators_1.provide)(Report_1),
52
+ __metadata("design:paramtypes", [])
53
+ ], Report);
54
+ exports.Report = Report;
@@ -1,89 +1,89 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusCode = void 0;
4
- /* Http Error Code Response */
5
- var InformationResponse;
6
- (function (InformationResponse) {
7
- InformationResponse[InformationResponse["Continue"] = 100] = "Continue";
8
- InformationResponse[InformationResponse["SwitchingProtocols"] = 101] = "SwitchingProtocols";
9
- InformationResponse[InformationResponse["Processing"] = 102] = "Processing";
10
- InformationResponse[InformationResponse["eEarlyHints"] = 103] = "eEarlyHints";
11
- })(InformationResponse || (InformationResponse = {}));
12
- var SuccessfulResponse;
13
- (function (SuccessfulResponse) {
14
- SuccessfulResponse[SuccessfulResponse["OK"] = 200] = "OK";
15
- SuccessfulResponse[SuccessfulResponse["Created"] = 201] = "Created";
16
- SuccessfulResponse[SuccessfulResponse["Accepted"] = 202] = "Accepted";
17
- SuccessfulResponse[SuccessfulResponse["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
18
- SuccessfulResponse[SuccessfulResponse["NoContent"] = 204] = "NoContent";
19
- SuccessfulResponse[SuccessfulResponse["ResetContent"] = 205] = "ResetContent";
20
- SuccessfulResponse[SuccessfulResponse["PartialContent"] = 206] = "PartialContent";
21
- SuccessfulResponse[SuccessfulResponse["MultiStatus"] = 207] = "MultiStatus";
22
- SuccessfulResponse[SuccessfulResponse["AlreadyReported"] = 208] = "AlreadyReported";
23
- SuccessfulResponse[SuccessfulResponse["IMUsed"] = 226] = "IMUsed";
24
- })(SuccessfulResponse || (SuccessfulResponse = {}));
25
- var RedirectionMessage;
26
- (function (RedirectionMessage) {
27
- RedirectionMessage[RedirectionMessage["MultipleChoices"] = 300] = "MultipleChoices";
28
- RedirectionMessage[RedirectionMessage["MovedPermanently"] = 301] = "MovedPermanently";
29
- RedirectionMessage[RedirectionMessage["Found"] = 302] = "Found";
30
- RedirectionMessage[RedirectionMessage["SeeOther"] = 303] = "SeeOther";
31
- RedirectionMessage[RedirectionMessage["NotModified"] = 304] = "NotModified";
32
- RedirectionMessage[RedirectionMessage["TemporaryRedirect"] = 307] = "TemporaryRedirect";
33
- RedirectionMessage[RedirectionMessage["PermanentRedirect"] = 308] = "PermanentRedirect";
34
- })(RedirectionMessage || (RedirectionMessage = {}));
35
- var ClientErrorResponse;
36
- (function (ClientErrorResponse) {
37
- ClientErrorResponse[ClientErrorResponse["BadRequest"] = 400] = "BadRequest";
38
- ClientErrorResponse[ClientErrorResponse["Unauthorized"] = 401] = "Unauthorized";
39
- ClientErrorResponse[ClientErrorResponse["PaymentRequired"] = 402] = "PaymentRequired";
40
- ClientErrorResponse[ClientErrorResponse["Forbidden"] = 403] = "Forbidden";
41
- ClientErrorResponse[ClientErrorResponse["NotFound"] = 404] = "NotFound";
42
- ClientErrorResponse[ClientErrorResponse["MethodNotAllowed"] = 405] = "MethodNotAllowed";
43
- ClientErrorResponse[ClientErrorResponse["NotAcceptable"] = 406] = "NotAcceptable";
44
- ClientErrorResponse[ClientErrorResponse["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
45
- ClientErrorResponse[ClientErrorResponse["RequestTimeout"] = 408] = "RequestTimeout";
46
- ClientErrorResponse[ClientErrorResponse["Conflict"] = 409] = "Conflict";
47
- ClientErrorResponse[ClientErrorResponse["Gone"] = 410] = "Gone";
48
- ClientErrorResponse[ClientErrorResponse["LengthRequired"] = 411] = "LengthRequired";
49
- ClientErrorResponse[ClientErrorResponse["PreconditionFailed"] = 412] = "PreconditionFailed";
50
- ClientErrorResponse[ClientErrorResponse["PayloadTooLarge"] = 413] = "PayloadTooLarge";
51
- ClientErrorResponse[ClientErrorResponse["URITooLong"] = 414] = "URITooLong";
52
- ClientErrorResponse[ClientErrorResponse["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
53
- ClientErrorResponse[ClientErrorResponse["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
54
- ClientErrorResponse[ClientErrorResponse["ExpectationFailed"] = 417] = "ExpectationFailed";
55
- ClientErrorResponse[ClientErrorResponse["ImATeapot"] = 418] = "ImATeapot";
56
- ClientErrorResponse[ClientErrorResponse["MisdirectedRequest"] = 421] = "MisdirectedRequest";
57
- ClientErrorResponse[ClientErrorResponse["UnprocessableEntity"] = 422] = "UnprocessableEntity";
58
- ClientErrorResponse[ClientErrorResponse["Locked"] = 423] = "Locked";
59
- ClientErrorResponse[ClientErrorResponse["FailedDependency"] = 424] = "FailedDependency";
60
- ClientErrorResponse[ClientErrorResponse["TooEarly"] = 425] = "TooEarly";
61
- ClientErrorResponse[ClientErrorResponse["UpgradeRequired"] = 426] = "UpgradeRequired";
62
- ClientErrorResponse[ClientErrorResponse["PreconditionRequired"] = 428] = "PreconditionRequired";
63
- ClientErrorResponse[ClientErrorResponse["TooManyRequests"] = 429] = "TooManyRequests";
64
- ClientErrorResponse[ClientErrorResponse["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
65
- ClientErrorResponse[ClientErrorResponse["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
66
- })(ClientErrorResponse || (ClientErrorResponse = {}));
67
- var ServerErrorResponse;
68
- (function (ServerErrorResponse) {
69
- ServerErrorResponse[ServerErrorResponse["InternalServerError"] = 500] = "InternalServerError";
70
- ServerErrorResponse[ServerErrorResponse["NotImplemented"] = 501] = "NotImplemented";
71
- ServerErrorResponse[ServerErrorResponse["BadGateway"] = 502] = "BadGateway";
72
- ServerErrorResponse[ServerErrorResponse["ServiceUnavailable"] = 503] = "ServiceUnavailable";
73
- ServerErrorResponse[ServerErrorResponse["GatewayTimeout"] = 504] = "GatewayTimeout";
74
- ServerErrorResponse[ServerErrorResponse["HTTPVersionNotSupported"] = 505] = "HTTPVersionNotSupported";
75
- ServerErrorResponse[ServerErrorResponse["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
76
- ServerErrorResponse[ServerErrorResponse["InsufficientStorage"] = 507] = "InsufficientStorage";
77
- ServerErrorResponse[ServerErrorResponse["LoopDetected"] = 508] = "LoopDetected";
78
- ServerErrorResponse[ServerErrorResponse["NotExtended"] = 510] = "NotExtended";
79
- ServerErrorResponse[ServerErrorResponse["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
80
- })(ServerErrorResponse || (ServerErrorResponse = {}));
81
- const HttpStatusErrorCode = {
82
- ...InformationResponse,
83
- ...SuccessfulResponse,
84
- ...RedirectionMessage,
85
- ...ClientErrorResponse,
86
- ...ServerErrorResponse,
87
- };
88
- const StatusCode = { ...HttpStatusErrorCode };
89
- exports.StatusCode = StatusCode;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StatusCode = void 0;
4
+ /* Http Error Code Response */
5
+ var InformationResponse;
6
+ (function (InformationResponse) {
7
+ InformationResponse[InformationResponse["Continue"] = 100] = "Continue";
8
+ InformationResponse[InformationResponse["SwitchingProtocols"] = 101] = "SwitchingProtocols";
9
+ InformationResponse[InformationResponse["Processing"] = 102] = "Processing";
10
+ InformationResponse[InformationResponse["eEarlyHints"] = 103] = "eEarlyHints";
11
+ })(InformationResponse || (InformationResponse = {}));
12
+ var SuccessfulResponse;
13
+ (function (SuccessfulResponse) {
14
+ SuccessfulResponse[SuccessfulResponse["OK"] = 200] = "OK";
15
+ SuccessfulResponse[SuccessfulResponse["Created"] = 201] = "Created";
16
+ SuccessfulResponse[SuccessfulResponse["Accepted"] = 202] = "Accepted";
17
+ SuccessfulResponse[SuccessfulResponse["NonAuthoritativeInformation"] = 203] = "NonAuthoritativeInformation";
18
+ SuccessfulResponse[SuccessfulResponse["NoContent"] = 204] = "NoContent";
19
+ SuccessfulResponse[SuccessfulResponse["ResetContent"] = 205] = "ResetContent";
20
+ SuccessfulResponse[SuccessfulResponse["PartialContent"] = 206] = "PartialContent";
21
+ SuccessfulResponse[SuccessfulResponse["MultiStatus"] = 207] = "MultiStatus";
22
+ SuccessfulResponse[SuccessfulResponse["AlreadyReported"] = 208] = "AlreadyReported";
23
+ SuccessfulResponse[SuccessfulResponse["IMUsed"] = 226] = "IMUsed";
24
+ })(SuccessfulResponse || (SuccessfulResponse = {}));
25
+ var RedirectionMessage;
26
+ (function (RedirectionMessage) {
27
+ RedirectionMessage[RedirectionMessage["MultipleChoices"] = 300] = "MultipleChoices";
28
+ RedirectionMessage[RedirectionMessage["MovedPermanently"] = 301] = "MovedPermanently";
29
+ RedirectionMessage[RedirectionMessage["Found"] = 302] = "Found";
30
+ RedirectionMessage[RedirectionMessage["SeeOther"] = 303] = "SeeOther";
31
+ RedirectionMessage[RedirectionMessage["NotModified"] = 304] = "NotModified";
32
+ RedirectionMessage[RedirectionMessage["TemporaryRedirect"] = 307] = "TemporaryRedirect";
33
+ RedirectionMessage[RedirectionMessage["PermanentRedirect"] = 308] = "PermanentRedirect";
34
+ })(RedirectionMessage || (RedirectionMessage = {}));
35
+ var ClientErrorResponse;
36
+ (function (ClientErrorResponse) {
37
+ ClientErrorResponse[ClientErrorResponse["BadRequest"] = 400] = "BadRequest";
38
+ ClientErrorResponse[ClientErrorResponse["Unauthorized"] = 401] = "Unauthorized";
39
+ ClientErrorResponse[ClientErrorResponse["PaymentRequired"] = 402] = "PaymentRequired";
40
+ ClientErrorResponse[ClientErrorResponse["Forbidden"] = 403] = "Forbidden";
41
+ ClientErrorResponse[ClientErrorResponse["NotFound"] = 404] = "NotFound";
42
+ ClientErrorResponse[ClientErrorResponse["MethodNotAllowed"] = 405] = "MethodNotAllowed";
43
+ ClientErrorResponse[ClientErrorResponse["NotAcceptable"] = 406] = "NotAcceptable";
44
+ ClientErrorResponse[ClientErrorResponse["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired";
45
+ ClientErrorResponse[ClientErrorResponse["RequestTimeout"] = 408] = "RequestTimeout";
46
+ ClientErrorResponse[ClientErrorResponse["Conflict"] = 409] = "Conflict";
47
+ ClientErrorResponse[ClientErrorResponse["Gone"] = 410] = "Gone";
48
+ ClientErrorResponse[ClientErrorResponse["LengthRequired"] = 411] = "LengthRequired";
49
+ ClientErrorResponse[ClientErrorResponse["PreconditionFailed"] = 412] = "PreconditionFailed";
50
+ ClientErrorResponse[ClientErrorResponse["PayloadTooLarge"] = 413] = "PayloadTooLarge";
51
+ ClientErrorResponse[ClientErrorResponse["URITooLong"] = 414] = "URITooLong";
52
+ ClientErrorResponse[ClientErrorResponse["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
53
+ ClientErrorResponse[ClientErrorResponse["RangeNotSatisfiable"] = 416] = "RangeNotSatisfiable";
54
+ ClientErrorResponse[ClientErrorResponse["ExpectationFailed"] = 417] = "ExpectationFailed";
55
+ ClientErrorResponse[ClientErrorResponse["ImATeapot"] = 418] = "ImATeapot";
56
+ ClientErrorResponse[ClientErrorResponse["MisdirectedRequest"] = 421] = "MisdirectedRequest";
57
+ ClientErrorResponse[ClientErrorResponse["UnprocessableEntity"] = 422] = "UnprocessableEntity";
58
+ ClientErrorResponse[ClientErrorResponse["Locked"] = 423] = "Locked";
59
+ ClientErrorResponse[ClientErrorResponse["FailedDependency"] = 424] = "FailedDependency";
60
+ ClientErrorResponse[ClientErrorResponse["TooEarly"] = 425] = "TooEarly";
61
+ ClientErrorResponse[ClientErrorResponse["UpgradeRequired"] = 426] = "UpgradeRequired";
62
+ ClientErrorResponse[ClientErrorResponse["PreconditionRequired"] = 428] = "PreconditionRequired";
63
+ ClientErrorResponse[ClientErrorResponse["TooManyRequests"] = 429] = "TooManyRequests";
64
+ ClientErrorResponse[ClientErrorResponse["RequestHeaderFieldsTooLarge"] = 431] = "RequestHeaderFieldsTooLarge";
65
+ ClientErrorResponse[ClientErrorResponse["UnavailableForLegalReasons"] = 451] = "UnavailableForLegalReasons";
66
+ })(ClientErrorResponse || (ClientErrorResponse = {}));
67
+ var ServerErrorResponse;
68
+ (function (ServerErrorResponse) {
69
+ ServerErrorResponse[ServerErrorResponse["InternalServerError"] = 500] = "InternalServerError";
70
+ ServerErrorResponse[ServerErrorResponse["NotImplemented"] = 501] = "NotImplemented";
71
+ ServerErrorResponse[ServerErrorResponse["BadGateway"] = 502] = "BadGateway";
72
+ ServerErrorResponse[ServerErrorResponse["ServiceUnavailable"] = 503] = "ServiceUnavailable";
73
+ ServerErrorResponse[ServerErrorResponse["GatewayTimeout"] = 504] = "GatewayTimeout";
74
+ ServerErrorResponse[ServerErrorResponse["HTTPVersionNotSupported"] = 505] = "HTTPVersionNotSupported";
75
+ ServerErrorResponse[ServerErrorResponse["VariantAlsoNegotiates"] = 506] = "VariantAlsoNegotiates";
76
+ ServerErrorResponse[ServerErrorResponse["InsufficientStorage"] = 507] = "InsufficientStorage";
77
+ ServerErrorResponse[ServerErrorResponse["LoopDetected"] = 508] = "LoopDetected";
78
+ ServerErrorResponse[ServerErrorResponse["NotExtended"] = 510] = "NotExtended";
79
+ ServerErrorResponse[ServerErrorResponse["NetworkAuthenticationRequired"] = 511] = "NetworkAuthenticationRequired";
80
+ })(ServerErrorResponse || (ServerErrorResponse = {}));
81
+ const HttpStatusErrorCode = {
82
+ ...InformationResponse,
83
+ ...SuccessfulResponse,
84
+ ...RedirectionMessage,
85
+ ...ClientErrorResponse,
86
+ ...ServerErrorResponse,
87
+ };
88
+ const StatusCode = { ...HttpStatusErrorCode };
89
+ exports.StatusCode = StatusCode;
package/lib/cjs/index.js CHANGED
@@ -1,26 +1,26 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./application"), exports);
18
- __exportStar(require("./common"), exports);
19
- __exportStar(require("./console"), exports);
20
- __exportStar(require("./container-module"), exports);
21
- __exportStar(require("./controller"), exports);
22
- __exportStar(require("./decorator"), exports);
23
- __exportStar(require("./error"), exports);
24
- __exportStar(require("./middleware"), exports);
25
- __exportStar(require("./provider"), exports);
26
- __exportStar(require("./render"), exports);
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./application"), exports);
18
+ __exportStar(require("./common"), exports);
19
+ __exportStar(require("./console"), exports);
20
+ __exportStar(require("./container-module"), exports);
21
+ __exportStar(require("./controller"), exports);
22
+ __exportStar(require("./decorator"), exports);
23
+ __exportStar(require("./error"), exports);
24
+ __exportStar(require("./middleware"), exports);
25
+ __exportStar(require("./provider"), exports);
26
+ __exportStar(require("./render"), exports);