@expressots/adapter-express 1.0.0 → 1.1.1

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 (74) hide show
  1. package/lib/CHANGELOG.md +31 -0
  2. package/lib/cjs/adapter-express/application-express.js +52 -6
  3. package/lib/cjs/types/adapter-express/application-base.d.ts +0 -1
  4. package/lib/cjs/types/adapter-express/application-express.d.ts +20 -2
  5. package/lib/cjs/types/adapter-express/application-express.interface.d.ts +0 -1
  6. package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts +0 -1
  7. package/lib/cjs/types/adapter-express/express-utils/constants.d.ts +0 -1
  8. package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts +0 -1
  9. package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts +0 -1
  10. package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -1
  11. package/lib/cjs/types/adapter-express/express-utils/index.d.ts +0 -1
  12. package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts +0 -1
  13. package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -1
  14. package/lib/cjs/types/adapter-express/express-utils/utils.d.ts +0 -1
  15. package/lib/cjs/types/adapter-express/index.d.ts +0 -1
  16. package/lib/cjs/types/index.d.ts +0 -1
  17. package/lib/package.json +6 -10
  18. package/package.json +6 -10
  19. package/lib/cjs/types/adapter-express/application-base.d.ts.map +0 -1
  20. package/lib/cjs/types/adapter-express/application-express.d.ts.map +0 -1
  21. package/lib/cjs/types/adapter-express/application-express.interface.d.ts.map +0 -1
  22. package/lib/cjs/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
  23. package/lib/cjs/types/adapter-express/express-utils/constants.d.ts.map +0 -1
  24. package/lib/cjs/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
  25. package/lib/cjs/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
  26. package/lib/cjs/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
  27. package/lib/cjs/types/adapter-express/express-utils/index.d.ts.map +0 -1
  28. package/lib/cjs/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
  29. package/lib/cjs/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
  30. package/lib/cjs/types/adapter-express/express-utils/utils.d.ts.map +0 -1
  31. package/lib/cjs/types/adapter-express/index.d.ts.map +0 -1
  32. package/lib/cjs/types/index.d.ts.map +0 -1
  33. package/lib/esm/adapter-express/application-base.js +0 -36
  34. package/lib/esm/adapter-express/application-express.interface.js +0 -2
  35. package/lib/esm/adapter-express/application-express.js +0 -136
  36. package/lib/esm/adapter-express/express-utils/base-middleware.js +0 -22
  37. package/lib/esm/adapter-express/express-utils/constants.js +0 -46
  38. package/lib/esm/adapter-express/express-utils/content/httpContent.js +0 -10
  39. package/lib/esm/adapter-express/express-utils/decorators.js +0 -110
  40. package/lib/esm/adapter-express/express-utils/httpResponseMessage.js +0 -33
  41. package/lib/esm/adapter-express/express-utils/index.js +0 -17
  42. package/lib/esm/adapter-express/express-utils/interfaces.js +0 -2
  43. package/lib/esm/adapter-express/express-utils/inversify-express-server.js +0 -293
  44. package/lib/esm/adapter-express/express-utils/utils.js +0 -58
  45. package/lib/esm/adapter-express/index.js +0 -21
  46. package/lib/esm/index.mjs +0 -17
  47. package/lib/esm/types/adapter-express/application-base.d.ts +0 -55
  48. package/lib/esm/types/adapter-express/application-base.d.ts.map +0 -1
  49. package/lib/esm/types/adapter-express/application-express.d.ts +0 -71
  50. package/lib/esm/types/adapter-express/application-express.d.ts.map +0 -1
  51. package/lib/esm/types/adapter-express/application-express.interface.d.ts +0 -29
  52. package/lib/esm/types/adapter-express/application-express.interface.d.ts.map +0 -1
  53. package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts +0 -9
  54. package/lib/esm/types/adapter-express/express-utils/base-middleware.d.ts.map +0 -1
  55. package/lib/esm/types/adapter-express/express-utils/constants.d.ts +0 -39
  56. package/lib/esm/types/adapter-express/express-utils/constants.d.ts.map +0 -1
  57. package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts +0 -8
  58. package/lib/esm/types/adapter-express/express-utils/content/httpContent.d.ts.map +0 -1
  59. package/lib/esm/types/adapter-express/express-utils/decorators.d.ts +0 -24
  60. package/lib/esm/types/adapter-express/express-utils/decorators.d.ts.map +0 -1
  61. package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts +0 -16
  62. package/lib/esm/types/adapter-express/express-utils/httpResponseMessage.d.ts.map +0 -1
  63. package/lib/esm/types/adapter-express/express-utils/index.d.ts +0 -3
  64. package/lib/esm/types/adapter-express/express-utils/index.d.ts.map +0 -1
  65. package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts +0 -76
  66. package/lib/esm/types/adapter-express/express-utils/interfaces.d.ts.map +0 -1
  67. package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts +0 -60
  68. package/lib/esm/types/adapter-express/express-utils/inversify-express-server.d.ts.map +0 -1
  69. package/lib/esm/types/adapter-express/express-utils/utils.d.ts +0 -10
  70. package/lib/esm/types/adapter-express/express-utils/utils.d.ts.map +0 -1
  71. package/lib/esm/types/adapter-express/index.d.ts +0 -4
  72. package/lib/esm/types/adapter-express/index.d.ts.map +0 -1
  73. package/lib/esm/types/index.d.ts +0 -2
  74. package/lib/esm/types/index.d.ts.map +0 -1
@@ -1,71 +0,0 @@
1
- import express from "express";
2
- import { Container } from "inversify";
3
- import { IApplicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
4
- import { IApplicationExpress } from "./application-express.interface";
5
- import { ApplicationBase } from "./application-base";
6
- /**
7
- * Enum representing possible server environments.
8
- */
9
- declare enum ServerEnvironment {
10
- Development = "development",
11
- Production = "production"
12
- }
13
- /**
14
- * The Application class provides a way to configure and manage an Express application.
15
- * @provide Application
16
- */
17
- declare class ApplicationExpress extends ApplicationBase implements IApplicationExpress {
18
- private app;
19
- private port;
20
- private environment;
21
- private container;
22
- private middlewares;
23
- protected configureServices(): void | Promise<void>;
24
- protected postServerInitialization(): void | Promise<void>;
25
- protected serverShutdown(): void | Promise<void>;
26
- /**
27
- * Handles process exit by calling serverShutdown and then exiting the process.
28
- */
29
- private handleExit;
30
- /**
31
- * Create and configure the Express application.
32
- * @param container - The InversifyJS container.
33
- * @param middlewares - An array of Express middlewares to be applied.
34
- * @returns The configured Application instance.
35
- */
36
- create(container: Container, middlewares?: Array<express.RequestHandler>): Promise<ApplicationExpress>;
37
- /**
38
- * Start listening on the given port and environment.
39
- * @param port - The port number to listen on.
40
- * @param environment - The server environment.
41
- * @param consoleMessage - Optional message to display in the console.
42
- */
43
- listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void>;
44
- /**
45
- * Configures the application's view engine based on the provided configuration options.
46
- *
47
- * @public
48
- * @method setEngine
49
- * @template T - A generic type extending from RenderTemplateOptions.
50
- *
51
- * @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
52
- * that provides the configuration options for setting the view engine.
53
- * This includes the extension name, view path, and the engine function itself.
54
- */
55
- setEngine<T extends RenderTemplateOptions>(options: T): void;
56
- /**
57
- * Verifies if the current environment is development.
58
- *
59
- * @returns A boolean value indicating whether the current environment is development or not.
60
- */
61
- protected isDevelopment(): boolean;
62
- /**
63
- * Verifies if the current environment is production.
64
- *
65
- * @returns A boolean value indicating whether the current environment is production or not.
66
- *
67
- */
68
- get ExpressApp(): express.Application;
69
- }
70
- export { ApplicationExpress as AppExpress, ServerEnvironment };
71
- //# sourceMappingURL=application-express.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-express.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAEL,4BAA4B,EAK5B,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO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plicationMessageToConsole, RenderTemplateOptions } from "@expressots/core";
2
- import { ServerEnvironment } from "./application-express";
3
- /**
4
- * Interface representing the Application class for Expressjs
5
- * @interface IApplicationExpress
6
- */
7
- interface IApplicationExpress {
8
- /**
9
- * Start listening on the given port and environment.
10
- * @param port - The port number to listen on.
11
- * @param environment - The server environment.
12
- * @param consoleMessage - Optional message to display in the console.
13
- */
14
- listen(port: number, environment: ServerEnvironment, consoleMessage?: IApplicationMessageToConsole): Promise<void> | void;
15
- /**
16
- * Configures the application's view engine based on the provided configuration options.
17
- *
18
- * @public
19
- * @method setEngine
20
- * @template T - A generic type extending from RenderTemplateOptions.
21
- *
22
- * @param {T} options - An object of type T (must be an object that extends RenderTemplateOptions)
23
- * that provides the configuration options for setting the view engine.
24
- * This includes the extension name, view path, and the engine function itself.
25
- */
26
- setEngine<T extends RenderTemplateOptions>(options: T): void;
27
- }
28
- export { IApplicationExpress };
29
- //# sourceMappingURL=application-express.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-express.interface.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/application-express.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;;GAGG;AACH,UAAU,mBAAmB;IAC3B;;;;;OAKG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,iBAAiB,EAC9B,cAAc,CAAC,EAAE,4BAA4B,GAC5C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAExB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,CAAC,SAAS,qBAAqB,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;CAC9D;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { NextFunction, Request, Response } from "express";
2
- import { interfaces as inversifyInterfaces } from "inversify";
3
- import type { HttpContext } from "./interfaces";
4
- export declare abstract class BaseMiddleware implements BaseMiddleware {
5
- httpContext: HttpContext;
6
- protected bind<T>(serviceIdentifier: inversifyInterfaces.ServiceIdentifier<T>): inversifyInterfaces.BindingToSyntax<T>;
7
- abstract handler(req: Request, res: Response, next: NextFunction): void;
8
- }
9
- //# sourceMappingURL=base-middleware.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base-middleware.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/base-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAc,UAAU,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,8BACsB,cAAe,YAAW,cAAc;IAGrD,WAAW,EAAG,WAAW,CAAC;IAEjC,SAAS,CAAC,IAAI,CAAC,CAAC,EACd,iBAAiB,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAC1D,mBAAmB,CAAC,eAAe,CAAC,CAAC,CAAC;aAIzB,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,IAAI;CAC/E"}
@@ -1,39 +0,0 @@
1
- export declare const TYPE: {
2
- AuthProvider: symbol;
3
- Controller: symbol;
4
- HttpContext: symbol;
5
- };
6
- export declare const METADATA_KEY: {
7
- controller: string;
8
- controllerMethod: string;
9
- controllerParameter: string;
10
- httpContext: string;
11
- };
12
- export declare enum PARAMETER_TYPE {
13
- REQUEST = 0,
14
- RESPONSE = 1,
15
- PARAMS = 2,
16
- QUERY = 3,
17
- BODY = 4,
18
- HEADERS = 5,
19
- COOKIES = 6,
20
- NEXT = 7,
21
- PRINCIPAL = 8
22
- }
23
- export declare enum HTTP_VERBS_ENUM {
24
- all = "ALL",
25
- connect = "CONNECT",
26
- delete = "DELETE",
27
- get = "GET",
28
- head = "HEAD",
29
- options = "OPTIONS",
30
- patch = "PATCH",
31
- post = "POST",
32
- propfind = "PROPFIND",
33
- put = "PUT",
34
- trace = "TRACE"
35
- }
36
- export declare const DUPLICATED_CONTROLLER_NAME: (name: string) => string;
37
- export declare const NO_CONTROLLERS_FOUND: string;
38
- export declare const DEFAULT_ROUTING_ROOT_PATH = "/";
39
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI;;;;CAIhB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;CAKxB,CAAC;AAEF,oBAAY,cAAc;IACxB,OAAO,IAAA;IACP,QAAQ,IAAA;IACR,MAAM,IAAA;IACN,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,OAAO,IAAA;IACP,OAAO,IAAA;IACP,IAAI,IAAA;IACJ,SAAS,IAAA;CACV;AAED,oBAAY,eAAe;IACzB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,GAAG,QAAQ;IACX,KAAK,UAAU;CAChB;AAED,eAAO,MAAM,0BAA0B,SAAU,MAAM,KAAG,MACJ,CAAC;AAEvD,eAAO,MAAM,oBAAoB,QAGL,CAAC;AAE7B,eAAO,MAAM,yBAAyB,MAAM,CAAC"}
@@ -1,8 +0,0 @@
1
- /// <reference types="node" />
2
- import type { OutgoingHttpHeaders } from "node:http";
3
- export declare abstract class HttpContent {
4
- private _headers;
5
- get headers(): OutgoingHttpHeaders;
6
- abstract readAsync(): Promise<string | Record<string, unknown> | Record<string, unknown>[]>;
7
- }
8
- //# sourceMappingURL=httpContent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpContent.d.ts","sourceRoot":"","sources":["../../../../../../src/adapter-express/express-utils/content/httpContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,8BAAsB,WAAW;IAC/B,OAAO,CAAC,QAAQ,CAA2B;IAE3C,IAAW,OAAO,IAAI,mBAAmB,CAExC;aAEe,SAAS,IAAI,OAAO,CAElC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAC7D;CACF"}
@@ -1,24 +0,0 @@
1
- import "reflect-metadata";
2
- import { PARAMETER_TYPE, HTTP_VERBS_ENUM } from "./constants";
3
- import type { Controller, HandlerDecorator, Middleware } from "./interfaces";
4
- export declare const injectHttpContext: (target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<any>) => void;
5
- export declare function controller(path: string, ...middleware: Array<Middleware>): (target: NewableFunction) => void;
6
- export declare function all(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
7
- export declare function Get(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
8
- export declare function Post(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
9
- export declare function Put(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
10
- export declare function Patch(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
11
- export declare function Head(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
12
- export declare function Delete(path: string, ...middleware: Array<Middleware>): HandlerDecorator;
13
- export declare function httpMethod(method: keyof typeof HTTP_VERBS_ENUM, path: string, ...middleware: Array<Middleware>): HandlerDecorator;
14
- export declare const request: () => ParameterDecorator;
15
- export declare const response: () => ParameterDecorator;
16
- export declare const param: (paramName?: string) => ParameterDecorator;
17
- export declare const query: (queryParamName?: string) => ParameterDecorator;
18
- export declare const body: () => ParameterDecorator;
19
- export declare const headers: (headerName?: string) => ParameterDecorator;
20
- export declare const cookies: (cookieName?: string) => ParameterDecorator;
21
- export declare const next: () => ParameterDecorator;
22
- export declare const Principal: () => ParameterDecorator;
23
- export declare function params(type: PARAMETER_TYPE, parameterName?: string): (target: unknown | Controller, methodName: string | symbol, index: number) => void;
24
- //# sourceMappingURL=decorators.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAsB,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAClF,OAAO,KAAK,EACV,UAAU,EAKV,gBAAgB,EAChB,UAAU,EAEX,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,iBAAiB,+LAA2B,CAAC;AAE1D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,YACvD,eAAe,KAAG,IAAI,CAiBvC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAEpF;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAEpF;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAErF;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAEpF;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UA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"node:http";
3
- import { HttpContent } from "./content/httpContent";
4
- export declare class HttpResponseMessage {
5
- private _content;
6
- private _headers;
7
- get headers(): OutgoingHttpHeaders;
8
- set headers(headers: OutgoingHttpHeaders);
9
- get content(): HttpContent;
10
- set content(value: HttpContent);
11
- private _statusCode;
12
- get statusCode(): number;
13
- set statusCode(code: number);
14
- constructor(statusCode?: number);
15
- }
16
- //# sourceMappingURL=httpResponseMessage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpResponseMessage.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/httpResponseMessage.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAe;IAE/B,OAAO,CAAC,QAAQ,CAA2B;IAE3C,IAAW,OAAO,IAAI,mBAAmB,CAExC;IAED,IAAW,OAAO,CAAC,OAAO,EAAE,mBAAmB,EAE9C;IAED,IAAW,OAAO,IAAI,WAAW,CAEhC;IAED,IAAW,OAAO,CAAC,KAAK,EAAE,WAAW,EAEpC;IAED,OAAO,CAAC,WAAW,CAAU;IAE7B,IAAW,UAAU,IAAI,MAAM,CAE9B;IAED,IAAW,UAAU,CAAC,IAAI,EAAE,MAAM,EAMjC;gBAEW,UAAU,SAAM;CAG7B"}
@@ -1,3 +0,0 @@
1
- export * from "./decorators";
2
- export { Controller } from "./interfaces";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -1,76 +0,0 @@
1
- import type { Application, NextFunction, Request, RequestHandler, Response } from "express";
2
- import { interfaces as inversifyInterfaces } from "inversify";
3
- import { HTTP_VERBS_ENUM, PARAMETER_TYPE } from "./constants";
4
- import { HttpResponseMessage } from "./httpResponseMessage";
5
- type Prototype<T> = {
6
- [P in keyof T]: T[P] extends NewableFunction ? T[P] : T[P] | undefined;
7
- } & {
8
- constructor: NewableFunction;
9
- };
10
- interface ConstructorFunction<T = Record<string, unknown>> {
11
- new (...args: Array<unknown>): T;
12
- prototype: Prototype<T>;
13
- }
14
- export type DecoratorTarget<T = unknown> = ConstructorFunction<T> | Prototype<T>;
15
- export type Middleware = string | symbol | RequestHandler;
16
- export type ControllerHandler = (...params: Array<unknown>) => unknown;
17
- export type BaseController = Record<string, ControllerHandler>;
18
- export interface Controller {
19
- }
20
- export interface ControllerMetadata {
21
- middleware: Array<Middleware>;
22
- path: string;
23
- target: DecoratorTarget;
24
- }
25
- export interface ControllerMethodMetadata extends ControllerMetadata {
26
- key: string;
27
- method: keyof typeof HTTP_VERBS_ENUM;
28
- }
29
- export interface ControllerParameterMetadata {
30
- [methodName: string]: Array<ParameterMetadata>;
31
- }
32
- export interface ParameterMetadata {
33
- index: number;
34
- injectRoot: boolean;
35
- parameterName?: string | undefined;
36
- type: PARAMETER_TYPE;
37
- }
38
- export type ExtractedParameters = Array<ParameterMetadata> | [Request, Response, NextFunction] | Array<unknown>;
39
- export type HandlerDecorator = (target: DecoratorTarget, key: string, value: unknown) => void;
40
- export type ConfigFunction = (app: Application) => void;
41
- export interface RoutingConfig {
42
- rootPath: string;
43
- }
44
- export interface Principal<T = unknown> {
45
- details: T;
46
- isAuthenticated(): Promise<boolean>;
47
- isInRole(role: string): Promise<boolean>;
48
- isResourceOwner(resourceId: unknown): Promise<boolean>;
49
- }
50
- export interface AuthProvider {
51
- getUser(req: Request, res: Response, next: NextFunction): Promise<Principal>;
52
- }
53
- export interface HttpContext<T = unknown> {
54
- container: inversifyInterfaces.Container;
55
- request: Request;
56
- response: Response;
57
- user: Principal<T>;
58
- }
59
- export interface IHttpActionResult {
60
- executeAsync(): Promise<HttpResponseMessage>;
61
- }
62
- export interface RouteDetails {
63
- args?: Array<string>;
64
- route: string;
65
- }
66
- export interface RouteInfo {
67
- controller: string;
68
- endpoints: Array<RouteDetails>;
69
- }
70
- export interface RawMetadata {
71
- controllerMetadata: ControllerMetadata;
72
- methodMetadata: Array<ControllerMethodMetadata>;
73
- parameterMetadata: ControllerParameterMetadata;
74
- }
75
- export {};
76
- //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,UAAU,IAAI,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,KAAK,SAAS,CAAC,CAAC,IAAI;KACjB,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS;CACvE,GAAG;IACF,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,UAAU,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACzB;AAED,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,OAAO,IAAI,mBAAmB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;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AAC,CAAC,GAAG,OAAO;IACpC,OAAO,EAAE,CAAC,CAAC;IACX,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,eAAe,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;CAC9E;AAED,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,SAAS,EAAE,mBAAmB,CAAC,SAAS,CAAC;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9C;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,cAAc,EAAE,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAChD,iBAAiB,EAAE,2BAA2B,CAAC;CAChD"}
@@ -1,60 +0,0 @@
1
- import express, { Application, Router } from "express";
2
- import { interfaces } from "inversify";
3
- import type { AuthProvider, ConfigFunction, RoutingConfig } from "./interfaces";
4
- export declare class InversifyExpressServer {
5
- private _router;
6
- private _container;
7
- private _app;
8
- private _configFn;
9
- private _errorConfigFn;
10
- private _routingConfig;
11
- private _AuthProvider;
12
- private _forceControllers;
13
- /**
14
- * Wrapper for the express server.
15
- *
16
- * @param container Container loaded with all controllers and their dependencies.
17
- * @param customRouter optional express.Router custom router
18
- * @param routingConfig optional interfaces.RoutingConfig routing config
19
- * @param customApp optional express.Application custom app
20
- * @param authProvider optional interfaces.AuthProvider auth provider
21
- * @param forceControllers optional boolean setting to force controllers (defaults do true)
22
- */
23
- constructor(container: interfaces.Container, customRouter?: Router | null, routingConfig?: RoutingConfig | null, customApp?: Application | null, authProvider?: (new () => AuthProvider) | null, forceControllers?: boolean);
24
- /**
25
- * Sets the configuration function to be applied to the application.
26
- * Note that the config function is not actually executed until a call to
27
- * InversifyExpresServer.build().
28
- *
29
- * This method is chainable.
30
- *
31
- * @param fn Function in which app-level middleware can be registered.
32
- */
33
- setConfig(fn: ConfigFunction): InversifyExpressServer;
34
- /**
35
- * Sets the error handler configuration function to be applied to the application.
36
- * Note that the error config function is not actually executed until a call to
37
- * InversifyExpressServer.build().
38
- *
39
- * This method is chainable.
40
- *
41
- * @param fn Function in which app-level error handlers can be registered.
42
- */
43
- setErrorConfig(fn: ConfigFunction): InversifyExpressServer;
44
- /**
45
- * Applies all routes and configuration to the server, returning the express application.
46
- */
47
- build(): express.Application;
48
- private registerControllers;
49
- private resolveMidleware;
50
- private copyHeadersTo;
51
- private handleHttpResponseMessage;
52
- private handlerFactory;
53
- private _getHttpContext;
54
- private _createHttpContext;
55
- private _getCurrentUser;
56
- private extractParameters;
57
- private getParam;
58
- private _getPrincipal;
59
- }
60
- //# sourceMappingURL=inversify-express-server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inversify-express-server.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/inversify-express-server.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,EAAE,EACd,WAAW,EAKX,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAmBvC,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EAQd,aAAa,EACd,MAAM,cAAc,CAAC;AAGtB,qBAAa,sBAAsB;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,cAAc,CAAgB;IACtC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,iBAAiB,CAAU;IAEnC;;;;;;;;;OASG;gBAED,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,EAC5B,aAAa,CAAC,EAAE,aAAa,GAAG,IAAI,EACpC,SAAS,CAAC,EAAE,WAAW,GAAG,IAAI,EAC9B,YAAY,CAAC,EAAE,CAAC,UAAU,YAAY,CAAC,GAAG,IAAI,EAC9C,gBAAgB,UAAO;IAezB;;;;;;;;OAQG;IACI,SAAS,CAAC,EAAE,EAAE,cAAc,GAAG,sBAAsB;IAK5D;;;;;;;;OAQG;IACI,cAAc,CAAC,EAAE,EAAE,cAAc,GAAG,sBAAsB;IAKjE;;OAEG;IACI,KAAK,IAAI,OAAO,CAAC,WAAW;IA2BnC,OAAO,CAAC,mBAAmB;IAqD3B,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,aAAa;YAQP,yBAAyB;IAmBvC,OAAO,CAAC,cAAc;IAqCtB,OAAO,CAAC,eAAe;YAIT,kBAAkB;YAgBlB,eAAe;IAiB7B,OAAO,CAAC,iBAAiB;IA+CzB,OAAO,CAAC,QAAQ;IAgBhB,OAAO,CAAC,aAAa;CAGtB"}
@@ -1,10 +0,0 @@
1
- import { interfaces } from "inversify";
2
- import type { BaseController, ControllerMetadata, ControllerMethodMetadata, ControllerParameterMetadata, DecoratorTarget, IHttpActionResult } from "./interfaces";
3
- export declare function getControllersFromContainer(container: interfaces.Container, forceControllers: boolean): Array<BaseController>;
4
- export declare function getControllersFromMetadata(): Array<DecoratorTarget>;
5
- export declare function getControllerMetadata(constructor: NewableFunction): ControllerMetadata;
6
- export declare function getControllerMethodMetadata(constructor: NewableFunction): Array<ControllerMethodMetadata>;
7
- export declare function getControllerParameterMetadata(constructor: NewableFunction): ControllerParameterMetadata;
8
- export declare function cleanUpMetadata(): void;
9
- export declare function instanceOfIHttpActionResult(value: unknown): value is IHttpActionResult;
10
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/adapter-express/express-utils/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,wBAAwB,EACxB,2BAA2B,EAC3B,eAAe,EACf,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAEtB,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,gBAAgB,EAAE,OAAO,GACxB,KAAK,CAAC,cAAc,CAAC,CASvB;AAED,wBAAgB,0BAA0B,IAAI,KAAK,CAAC,eAAe,CAAC,CAInE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,eAAe,GAAG,kBAAkB,CAMtF;AAED,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,eAAe,GAC3B,KAAK,CAAC,wBAAwB,CAAC,CAkBjC;AAED,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,eAAe,GAC3B,2BAA2B,CAkB7B;AAED,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAEtF"}
@@ -1,4 +0,0 @@
1
- export * from "./express-utils";
2
- export { AppExpress, ServerEnvironment } from "./application-express";
3
- export { IApplicationExpress } from "./application-express.interface";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapter-express/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./adapter-express";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}