@adaas/a-server 0.0.19 → 0.0.21

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 (179) hide show
  1. package/dist/index.d.mts +739 -0
  2. package/dist/index.d.ts +739 -36
  3. package/dist/index.js +1903 -102
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1863 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +6 -4
  8. package/src/components/A-ServerLogger/A_ServerLogger.component.ts +1 -1
  9. package/src/components/A-ServerProxy/A-ServerProxy.component.ts +8 -7
  10. package/src/components/A-StaticLoader/A-StaticLoader.component.types.ts +5 -107
  11. package/src/containers/A-Service/A-Service.container.ts +11 -7
  12. package/src/entities/A-Request/A-Request.entity.ts +1 -1
  13. package/src/entities/A-Request/A-Request.entity.types.ts +1 -1
  14. package/src/entities/A-Response/A-Response.entity.ts +1 -1
  15. package/src/entities/A-Response/A-Response.entity.types.ts +1 -1
  16. package/src/index.ts +75 -0
  17. package/tsconfig.json +1 -1
  18. package/tsup.config.ts +15 -0
  19. package/dist/src/channels/A-Http/A-Http.channel.constants.d.ts +0 -5
  20. package/dist/src/channels/A-Http/A-Http.channel.constants.js +0 -10
  21. package/dist/src/channels/A-Http/A-Http.channel.constants.js.map +0 -1
  22. package/dist/src/channels/A-Http/A-Http.channel.d.ts +0 -29
  23. package/dist/src/channels/A-Http/A-Http.channel.error.d.ts +0 -4
  24. package/dist/src/channels/A-Http/A-Http.channel.error.js +0 -9
  25. package/dist/src/channels/A-Http/A-Http.channel.error.js.map +0 -1
  26. package/dist/src/channels/A-Http/A-Http.channel.js +0 -154
  27. package/dist/src/channels/A-Http/A-Http.channel.js.map +0 -1
  28. package/dist/src/channels/A-Http/A-Http.channel.types.d.ts +0 -59
  29. package/dist/src/channels/A-Http/A-Http.channel.types.js +0 -3
  30. package/dist/src/channels/A-Http/A-Http.channel.types.js.map +0 -1
  31. package/dist/src/channels/A-Websockets/A-Websockets.channel.d.ts +0 -4
  32. package/dist/src/channels/A-Websockets/A-Websockets.channel.js +0 -22
  33. package/dist/src/channels/A-Websockets/A-Websockets.channel.js.map +0 -1
  34. package/dist/src/components/A-CommandController/A-CommandController.component.d.ts +0 -8
  35. package/dist/src/components/A-CommandController/A-CommandController.component.js +0 -55
  36. package/dist/src/components/A-CommandController/A-CommandController.component.js.map +0 -1
  37. package/dist/src/components/A-Controller/A-Controller.component.d.ts +0 -9
  38. package/dist/src/components/A-Controller/A-Controller.component.js +0 -60
  39. package/dist/src/components/A-Controller/A-Controller.component.js.map +0 -1
  40. package/dist/src/components/A-Controller/A-Controller.component.types.d.ts +0 -0
  41. package/dist/src/components/A-Controller/A-Controller.component.types.js +0 -2
  42. package/dist/src/components/A-Controller/A-Controller.component.types.js.map +0 -1
  43. package/dist/src/components/A-EntityController/A-EntityController.component.d.ts +0 -26
  44. package/dist/src/components/A-EntityController/A-EntityController.component.js +0 -226
  45. package/dist/src/components/A-EntityController/A-EntityController.component.js.map +0 -1
  46. package/dist/src/components/A-EntityController/A-EntityController.component.types.d.ts +0 -0
  47. package/dist/src/components/A-EntityController/A-EntityController.component.types.js +0 -2
  48. package/dist/src/components/A-EntityController/A-EntityController.component.types.js.map +0 -1
  49. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.d.ts +0 -9
  50. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js +0 -118
  51. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js.map +0 -1
  52. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.d.ts +0 -0
  53. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js +0 -2
  54. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js.map +0 -1
  55. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.d.ts +0 -0
  56. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js +0 -2
  57. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js.map +0 -1
  58. package/dist/src/components/A-ListingController/A-ListingController.component.d.ts +0 -10
  59. package/dist/src/components/A-ListingController/A-ListingController.component.js +0 -72
  60. package/dist/src/components/A-ListingController/A-ListingController.component.js.map +0 -1
  61. package/dist/src/components/A-ListingController/A-ListingController.component.types.d.ts +0 -0
  62. package/dist/src/components/A-ListingController/A-ListingController.component.types.js +0 -2
  63. package/dist/src/components/A-ListingController/A-ListingController.component.types.js.map +0 -1
  64. package/dist/src/components/A-Router/A-Router.component.d.ts +0 -63
  65. package/dist/src/components/A-Router/A-Router.component.js +0 -221
  66. package/dist/src/components/A-Router/A-Router.component.js.map +0 -1
  67. package/dist/src/components/A-Router/A-Router.component.types.d.ts +0 -26
  68. package/dist/src/components/A-Router/A-Router.component.types.js +0 -17
  69. package/dist/src/components/A-Router/A-Router.component.types.js.map +0 -1
  70. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.d.ts +0 -9
  71. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.d.ts +0 -2
  72. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js +0 -11
  73. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js.map +0 -1
  74. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js +0 -70
  75. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js.map +0 -1
  76. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.d.ts +0 -7
  77. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js +0 -3
  78. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js.map +0 -1
  79. package/dist/src/components/A-ServerError/A-ServerError.class.d.ts +0 -7
  80. package/dist/src/components/A-ServerError/A-ServerError.class.js +0 -88
  81. package/dist/src/components/A-ServerError/A-ServerError.class.js.map +0 -1
  82. package/dist/src/components/A-ServerError/A-ServerError.constants.d.ts +0 -0
  83. package/dist/src/components/A-ServerError/A-ServerError.constants.js +0 -2
  84. package/dist/src/components/A-ServerError/A-ServerError.constants.js.map +0 -1
  85. package/dist/src/components/A-ServerError/A-ServerError.types.d.ts +0 -13
  86. package/dist/src/components/A-ServerError/A-ServerError.types.js +0 -3
  87. package/dist/src/components/A-ServerError/A-ServerError.types.js.map +0 -1
  88. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +0 -7
  89. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +0 -81
  90. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +0 -1
  91. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.d.ts +0 -0
  92. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js +0 -2
  93. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js.map +0 -1
  94. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.d.ts +0 -22
  95. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js +0 -31
  96. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js.map +0 -1
  97. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.d.ts +0 -43
  98. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js +0 -167
  99. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js.map +0 -1
  100. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.d.ts +0 -9
  101. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js +0 -3
  102. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js.map +0 -1
  103. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.d.ts +0 -9
  104. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js +0 -88
  105. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js.map +0 -1
  106. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.d.ts +0 -12
  107. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js +0 -126
  108. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js.map +0 -1
  109. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.d.ts +0 -10
  110. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js +0 -109
  111. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js.map +0 -1
  112. package/dist/src/constants/env.constants.d.ts +0 -10
  113. package/dist/src/constants/env.constants.js +0 -20
  114. package/dist/src/constants/env.constants.js.map +0 -1
  115. package/dist/src/containers/A-Service/A-Service.container.d.ts +0 -30
  116. package/dist/src/containers/A-Service/A-Service.container.js +0 -200
  117. package/dist/src/containers/A-Service/A-Service.container.js.map +0 -1
  118. package/dist/src/containers/A-Service/A-Service.container.types.d.ts +0 -36
  119. package/dist/src/containers/A-Service/A-Service.container.types.js +0 -27
  120. package/dist/src/containers/A-Service/A-Service.container.types.js.map +0 -1
  121. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.d.ts +0 -39
  122. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js +0 -69
  123. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js.map +0 -1
  124. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.d.ts +0 -5
  125. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js +0 -3
  126. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js.map +0 -1
  127. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.d.ts +0 -12
  128. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js +0 -16
  129. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js.map +0 -1
  130. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.d.ts +0 -10
  131. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js +0 -30
  132. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js.map +0 -1
  133. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.d.ts +0 -2
  134. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js +0 -12
  135. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js.map +0 -1
  136. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.d.ts +0 -29
  137. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js +0 -60
  138. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js.map +0 -1
  139. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.d.ts +0 -18
  140. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js +0 -3
  141. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js.map +0 -1
  142. package/dist/src/context/A-Server/A_Server.context.d.ts +0 -17
  143. package/dist/src/context/A-Server/A_Server.context.js +0 -22
  144. package/dist/src/context/A-Server/A_Server.context.js.map +0 -1
  145. package/dist/src/context/A-Server/A_Server.context.types.d.ts +0 -7
  146. package/dist/src/context/A-Server/A_Server.context.types.js +0 -3
  147. package/dist/src/context/A-Server/A_Server.context.types.js.map +0 -1
  148. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.d.ts +0 -16
  149. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js +0 -28
  150. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js.map +0 -1
  151. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.d.ts +0 -0
  152. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js +0 -2
  153. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js.map +0 -1
  154. package/dist/src/entities/A-Request/A-Request.entity.d.ts +0 -31
  155. package/dist/src/entities/A-Request/A-Request.entity.js +0 -125
  156. package/dist/src/entities/A-Request/A-Request.entity.js.map +0 -1
  157. package/dist/src/entities/A-Request/A-Request.entity.types.d.ts +0 -21
  158. package/dist/src/entities/A-Request/A-Request.entity.types.js +0 -12
  159. package/dist/src/entities/A-Request/A-Request.entity.types.js.map +0 -1
  160. package/dist/src/entities/A-Response/A-Response.entity.d.ts +0 -28
  161. package/dist/src/entities/A-Response/A-Response.entity.js +0 -141
  162. package/dist/src/entities/A-Response/A-Response.entity.js.map +0 -1
  163. package/dist/src/entities/A-Response/A-Response.entity.types.d.ts +0 -19
  164. package/dist/src/entities/A-Response/A-Response.entity.types.js +0 -12
  165. package/dist/src/entities/A-Response/A-Response.entity.types.js.map +0 -1
  166. package/dist/src/entities/A-Route/A-Route.entity.d.ts +0 -17
  167. package/dist/src/entities/A-Route/A-Route.entity.js +0 -76
  168. package/dist/src/entities/A-Route/A-Route.entity.js.map +0 -1
  169. package/dist/src/entities/A-Route/A-Route.entity.types.d.ts +0 -0
  170. package/dist/src/entities/A-Route/A-Route.entity.types.js +0 -2
  171. package/dist/src/entities/A-Route/A-Route.entity.types.js.map +0 -1
  172. package/dist/src/entities/A_EntityList/A_EntityList.entity.d.ts +0 -46
  173. package/dist/src/entities/A_EntityList/A_EntityList.entity.js +0 -91
  174. package/dist/src/entities/A_EntityList/A_EntityList.entity.js.map +0 -1
  175. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.d.ts +0 -21
  176. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js +0 -8
  177. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js.map +0 -1
  178. package/index.ts +0 -75
  179. package/tsconfig.build.json +0 -62
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-HttpChannel.context.js","sourceRoot":"","sources":["../../../../src/context/A-HttpChannel/A-HttpChannel.context.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAQ9C,MAAa,4BAEX,SAAQ,sBAAU;IAMhB,YAAY,MAAgD;QACxD,KAAK,EAAE,CAAC;QAER,MAAM,EACF,MAAM,EACN,GAAG,EACH,IAAI,EACJ,MAAM,GACT,GAAG,MAAM,CAAC;QAEX,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CAKJ;AA3BD,oEA2BC"}
@@ -1,10 +0,0 @@
1
- import { A_Fragment } from "@adaas/a-concept";
2
- export declare class A_ListQueryFilter<FilterFields extends string[]> extends A_Fragment {
3
- protected _query: string | Partial<Record<FilterFields[number], string>>;
4
- protected defaults: Partial<Record<FilterFields[number], string>>;
5
- protected parsedQuery: Record<FilterFields[number], string>;
6
- constructor(_query?: string | Partial<Record<FilterFields[number], string>>, defaults?: Partial<Record<FilterFields[number], string>>);
7
- get query(): string | Partial<Record<FilterFields[number], string>>;
8
- get(property: FilterFields[number], defaultValue?: string): string;
9
- protected parseQueryString(value?: string | Partial<Record<FilterFields[number], string>>): Record<FilterFields[number], string>;
10
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_ListQueryFilter = void 0;
4
- const a_concept_1 = require("@adaas/a-concept");
5
- class A_ListQueryFilter extends a_concept_1.A_Fragment {
6
- constructor(_query = {}, defaults = {}) {
7
- super();
8
- this._query = _query;
9
- this.defaults = defaults;
10
- this.parsedQuery = this.parseQueryString(_query);
11
- }
12
- get query() {
13
- return this._query;
14
- }
15
- get(property, defaultValue = '') {
16
- return this.parsedQuery[property] || this.defaults[property] || defaultValue;
17
- }
18
- parseQueryString(value = {}) {
19
- if (typeof value === 'string') {
20
- return value.split('&').reduce((acc, part) => {
21
- const [key, val] = part.split('=');
22
- acc[decodeURIComponent(key)] = decodeURIComponent(val || '');
23
- return acc;
24
- }, {});
25
- }
26
- return value;
27
- }
28
- }
29
- exports.A_ListQueryFilter = A_ListQueryFilter;
30
- //# sourceMappingURL=A_ListQueryFilter.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ListQueryFilter.context.js","sourceRoot":"","sources":["../../../../src/context/A-ListQueryFilter/A_ListQueryFilter.context.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAI9C,MAAa,iBAAiD,SAAQ,sBAAU;IAI5E,YACc,SAAiE,EAAE,EACnE,WAA0D,EAAE;QAEtE,KAAK,EAAE,CAAC;QAHE,WAAM,GAAN,MAAM,CAA6D;QACnE,aAAQ,GAAR,QAAQ,CAAoD;QAGtE,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAGD,IAAI,KAAK;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAGD,GAAG,CAAC,QAA8B,EAAE,eAAuB,EAAE;QACzD,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,YAAY,CAAC;IACjF,CAAC;IAES,gBAAgB,CAAC,QAAgE,EAAE;QACzF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;gBACzC,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,kBAAkB,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;gBAC7D,OAAO,GAAG,CAAC;YACf,CAAC,EAAE,EAAE,CAAyC,CAAC;QACnD,CAAC;QACD,OAAO,KAA6C,CAAC;IACzD,CAAC;CACJ;AAhCD,8CAgCC"}
@@ -1,2 +0,0 @@
1
- import { A_SERVER_TYPES__ProxyConfigConstructorConfig } from "./A_ProxyConfig.types";
2
- export declare const PROXY_CONFIG_DEFAULTS: A_SERVER_TYPES__ProxyConfigConstructorConfig;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROXY_CONFIG_DEFAULTS = void 0;
4
- exports.PROXY_CONFIG_DEFAULTS = {
5
- path: '/',
6
- hostname: 'localhost',
7
- port: 80,
8
- method: 'GET',
9
- headers: {},
10
- protocol: 'http'
11
- };
12
- //# sourceMappingURL=A_ProxyConfig.constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ProxyConfig.constants.js","sourceRoot":"","sources":["../../../../src/context/A-ProxyConfig/A_ProxyConfig.constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAiD;IAC/E,IAAI,EAAE,GAAG;IACT,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE,MAAM;CACnB,CAAC"}
@@ -1,29 +0,0 @@
1
- import { A_Fragment } from "@adaas/a-concept";
2
- import { A_SERVER_TYPES__ProxyConfigConstructor, A_SERVER_TYPES__RoutesConfig } from "./A_ProxyConfig.types";
3
- export declare class A_ProxyConfig extends A_Fragment {
4
- protected readonly _configs: Array<A_SERVER_TYPES__RoutesConfig>;
5
- constructor(
6
- /**
7
- * Setup proxy configs, where key is the path to match, and value is either a full URL or a partial config object
8
- */
9
- configs?: A_SERVER_TYPES__ProxyConfigConstructor);
10
- /**
11
- * Returns all configured proxy configs
12
- *
13
- */
14
- get configs(): Array<A_SERVER_TYPES__RoutesConfig>;
15
- /**
16
- * Checks if a given path is configured in the proxy
17
- *
18
- * @param path
19
- * @returns
20
- */
21
- has(path: string): boolean;
22
- /**
23
- * Returns the proxy configuration for a given path, if exists
24
- *
25
- * @param path
26
- * @returns
27
- */
28
- config(path: string): A_SERVER_TYPES__RoutesConfig | undefined;
29
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_ProxyConfig = void 0;
4
- const a_concept_1 = require("@adaas/a-concept");
5
- const A_ProxyConfig_constants_1 = require("./A_ProxyConfig.constants");
6
- const A_Route_entity_1 = require("../../entities/A-Route/A-Route.entity");
7
- class A_ProxyConfig extends a_concept_1.A_Fragment {
8
- constructor(
9
- /**
10
- * Setup proxy configs, where key is the path to match, and value is either a full URL or a partial config object
11
- */
12
- configs = {}) {
13
- super();
14
- this._configs = Object.entries(configs).map(([path, config]) => {
15
- const targetUrl = new URL(typeof config === 'string' ? config : config.hostname || ''); // parse hostname, may include scheme
16
- const port = targetUrl.port ||
17
- (targetUrl.protocol === "https:" ? '443' : '80');
18
- const prepared = Object.assign(Object.assign({}, A_ProxyConfig_constants_1.PROXY_CONFIG_DEFAULTS), (typeof config === 'string' ? {
19
- path,
20
- port: parseInt(port),
21
- protocol: targetUrl.protocol,
22
- hostname: targetUrl.hostname
23
- } : config));
24
- return {
25
- route: new A_Route_entity_1.A_Route(prepared.path, prepared.method),
26
- hostname: prepared.hostname,
27
- port: prepared.port,
28
- headers: prepared.headers,
29
- protocol: prepared.protocol
30
- };
31
- });
32
- }
33
- /**
34
- * Returns all configured proxy configs
35
- *
36
- */
37
- get configs() {
38
- return this._configs;
39
- }
40
- /**
41
- * Checks if a given path is configured in the proxy
42
- *
43
- * @param path
44
- * @returns
45
- */
46
- has(path) {
47
- return this._configs.some(route => route.route.toRegExp().test(path));
48
- }
49
- /**
50
- * Returns the proxy configuration for a given path, if exists
51
- *
52
- * @param path
53
- * @returns
54
- */
55
- config(path) {
56
- return this._configs.find(route => route.route.toRegExp().test(path));
57
- }
58
- }
59
- exports.A_ProxyConfig = A_ProxyConfig;
60
- //# sourceMappingURL=A_ProxyConfig.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ProxyConfig.context.js","sourceRoot":"","sources":["../../../../src/context/A-ProxyConfig/A_ProxyConfig.context.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAE9C,uEAAkE;AAClE,oFAA0E;AAI1E,MAAa,aAAc,SAAQ,sBAAU;IAIzC;IACI;;OAEG;IACH,UAAkD,EAAE;QAEpD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,C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;OAKG;IACH,MAAM,CAAC,IAAY;QAGf,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1E,CAAC;CACJ;AAvED,sCAuEC"}
@@ -1,18 +0,0 @@
1
- import { A_SERVER_TYPES__RequestMethods } from "../../entities/A-Request/A-Request.entity.types";
2
- import { A_Route } from "../../entities/A-Route/A-Route.entity";
3
- export type A_SERVER_TYPES__ProxyConfigConstructor = Record<string, string | Partial<A_SERVER_TYPES__ProxyConfigConstructorConfig>>;
4
- export type A_SERVER_TYPES__ProxyConfigConstructorConfig = {
5
- hostname: string;
6
- protocol: 'http' | 'https' | string;
7
- port: number;
8
- path: string;
9
- method: A_SERVER_TYPES__RequestMethods;
10
- headers: Record<string, string>;
11
- };
12
- export type A_SERVER_TYPES__RoutesConfig = {
13
- route: A_Route;
14
- protocol: 'http' | 'https' | string;
15
- hostname: string;
16
- port: number;
17
- headers: Record<string, string>;
18
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=A_ProxyConfig.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ProxyConfig.types.js","sourceRoot":"","sources":["../../../../src/context/A-ProxyConfig/A_ProxyConfig.types.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { A_Fragment } from "@adaas/a-concept";
2
- import { A_SERVER_TYPES__ServerConstructor } from "./A_Server.context.types";
3
- import { A_Route } from "../../entities/A-Route/A-Route.entity";
4
- import { A_TYPES__Required } from "@adaas/a-concept/dist/src/types/A_Common.types";
5
- export declare class A_Server extends A_Fragment {
6
- port: number;
7
- version: string;
8
- protected _routes: A_Route[];
9
- constructor(params: A_TYPES__Required<Partial<A_SERVER_TYPES__ServerConstructor>, [
10
- 'port',
11
- 'name'
12
- ]>);
13
- /**
14
- * A list of routes that the server will listen to
15
- */
16
- get routes(): A_Route[];
17
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_Server = void 0;
4
- const a_concept_1 = require("@adaas/a-concept");
5
- class A_Server extends a_concept_1.A_Fragment {
6
- constructor(params) {
7
- super(params);
8
- this._routes = [];
9
- this.port = params.port;
10
- this.name = params.name;
11
- this.version = params.version || 'v1';
12
- this._routes = params.routes || this._routes;
13
- }
14
- /**
15
- * A list of routes that the server will listen to
16
- */
17
- get routes() {
18
- return this._routes;
19
- }
20
- }
21
- exports.A_Server = A_Server;
22
- //# sourceMappingURL=A_Server.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_Server.context.js","sourceRoot":"","sources":["../../../../src/context/A-Server/A_Server.context.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAM/C,MAAa,QAAS,SAAQ,sBAAU;IAMpC,YACI,MAGE;QAEF,KAAK,CAAC,MAAM,CAAC,CAAC;QARR,YAAO,GAAc,EAAE,CAAC;QAU9B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;QAEtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC;IACjD,CAAC;IAGD;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAA;IACvB,CAAC;CAEJ;AA7BD,4BA6BC"}
@@ -1,7 +0,0 @@
1
- import { A_Route } from "../../entities/A-Route/A-Route.entity";
2
- export type A_SERVER_TYPES__ServerConstructor = {
3
- name: string;
4
- version: string;
5
- routes: A_Route[];
6
- port: number;
7
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=A_Server.context.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_Server.context.types.js","sourceRoot":"","sources":["../../../../src/context/A-Server/A_Server.context.types.ts"],"names":[],"mappings":""}
@@ -1,16 +0,0 @@
1
- import { A_Fragment } from "@adaas/a-concept";
2
- export declare class A_StaticConfig extends A_Fragment {
3
- readonly directories: Array<string>;
4
- constructor(
5
- /**
6
- * Setup directories to serve static files from, comma separated
7
- */
8
- directories?: string[]);
9
- /**
10
- * Checks if a given path is configured in the proxy
11
- *
12
- * @param path
13
- * @returns
14
- */
15
- has(path: string): false | string;
16
- }
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_StaticConfig = void 0;
4
- const a_concept_1 = require("@adaas/a-concept");
5
- class A_StaticConfig extends a_concept_1.A_Fragment {
6
- constructor(
7
- /**
8
- * Setup directories to serve static files from, comma separated
9
- */
10
- directories = []) {
11
- super();
12
- this.directories = directories;
13
- }
14
- /**
15
- * Checks if a given path is configured in the proxy
16
- *
17
- * @param path
18
- * @returns
19
- */
20
- has(path) {
21
- const found = this.directories.find(dir => {
22
- return new RegExp(`^\/${dir.startsWith('/') ? dir.slice(1) : dir}/?.*`).test(path);
23
- });
24
- return !!found && found;
25
- }
26
- }
27
- exports.A_StaticConfig = A_StaticConfig;
28
- //# sourceMappingURL=A-StaticConfig.context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-StaticConfig.context.js","sourceRoot":"","sources":["../../../../src/context/A-StaticConfig/A-StaticConfig.context.ts"],"names":[],"mappings":";;;AAAA,gDAA8C;AAK9C,MAAa,cAAe,SAAQ,sBAAU;IAI1C;IACI;;OAEG;IACH,cAAwB,EAAE;QAE1B,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAID;;;;;OAKG;IACH,GAAG,CAAC,IAAY;QAEZ,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACtC,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACtF,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC;IAC5B,CAAC;CACJ;AA9BD,wCA8BC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=A-StaticConfig.context.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-StaticConfig.context.types.js","sourceRoot":"","sources":["../../../../src/context/A-StaticConfig/A-StaticConfig.context.types.ts"],"names":[],"mappings":""}
@@ -1,31 +0,0 @@
1
- import { IncomingHttpHeaders, IncomingMessage } from "http";
2
- import { A_Entity } from '@adaas/a-concept';
3
- import { A_SERVER_TYPES__RequestConstructor, A_SERVER_TYPES__RequestMethods, A_SERVER_TYPES__RequestSerialized } from "./A-Request.entity.types";
4
- import { A_Route } from '../A-Route/A-Route.entity';
5
- import { A_ServerError } from "../../components/A-ServerError/A-ServerError.class";
6
- export declare class A_Request<_ReqBodyType = any, _ResponseType = any, _ParamsType extends Record<string, string> = any, _QueryType = any> extends A_Entity<A_SERVER_TYPES__RequestConstructor, A_SERVER_TYPES__RequestSerialized> {
7
- static get namespace(): string;
8
- req: IncomingMessage;
9
- body: _ReqBodyType;
10
- params: _ParamsType;
11
- query: _QueryType;
12
- response?: _ResponseType;
13
- error?: A_ServerError;
14
- /**
15
- * Duration of the request in milliseconds
16
- */
17
- duration: number;
18
- fromNew(newEntity: A_SERVER_TYPES__RequestConstructor): void;
19
- get startedAt(): Date | undefined;
20
- get url(): string;
21
- get method(): A_SERVER_TYPES__RequestMethods;
22
- get headers(): IncomingHttpHeaders;
23
- get route(): A_Route;
24
- pipe(destination: NodeJS.WritableStream, options?: {
25
- end?: boolean | undefined;
26
- }): NodeJS.WritableStream;
27
- init(): Promise<void>;
28
- extractParams(url: string): Record<string, string>;
29
- extractQuery(url: string): Record<string, string>;
30
- parseBody(): Promise<any>;
31
- }
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.A_Request = void 0;
13
- const a_concept_1 = require("@adaas/a-concept");
14
- const A_Request_entity_types_1 = require("./A-Request.entity.types");
15
- const A_Route_entity_1 = require("../A-Route/A-Route.entity");
16
- const A_ServerError_class_1 = require("../../components/A-ServerError/A-ServerError.class");
17
- class A_Request extends a_concept_1.A_Entity {
18
- constructor() {
19
- super(...arguments);
20
- this.body = {};
21
- this.params = {};
22
- this.query = {};
23
- /**
24
- * Duration of the request in milliseconds
25
- */
26
- this.duration = 0;
27
- }
28
- static get namespace() {
29
- return 'a-server';
30
- }
31
- fromNew(newEntity) {
32
- this.req = newEntity.request;
33
- this.aseid = new a_concept_1.ASEID({
34
- concept: a_concept_1.A_Context.root.name,
35
- scope: newEntity.scope,
36
- entity: this.constructor.entity,
37
- id: newEntity.id
38
- });
39
- }
40
- get startedAt() {
41
- const timeId = a_concept_1.A_IdentityHelper.parseTimeId(this.aseid.id.split('-')[0]);
42
- return timeId ? new Date(timeId.timestamp) : undefined;
43
- }
44
- // Getter for request URL
45
- get url() {
46
- return this.req.url;
47
- }
48
- // Getter for request method
49
- get method() {
50
- return String(this.req.method).toUpperCase() || 'DEFAULT';
51
- }
52
- get headers() {
53
- return this.req.headers;
54
- }
55
- get route() {
56
- return new A_Route_entity_1.A_Route(this.url, this.method);
57
- }
58
- pipe(destination, options) {
59
- return this.req.pipe(destination, options);
60
- }
61
- init() {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- this.req.on('error', (err) => __awaiter(this, void 0, void 0, function* () {
64
- this.error = new A_ServerError_class_1.A_ServerError(err);
65
- yield this.call(A_Request_entity_types_1.A_SERVER_TYPES__RequestEvent.Error);
66
- }));
67
- this.params = this.extractParams(this.url);
68
- this.query = this.extractQuery(this.url);
69
- });
70
- }
71
- extractParams(url) {
72
- // Remove query string (anything after ?)
73
- const cleanUrl = url.split('?')[0];
74
- const urlSegments = cleanUrl.split('/').filter(Boolean);
75
- const maskSegments = this.url.split('/').filter(Boolean);
76
- const params = {};
77
- for (let i = 0; i < maskSegments.length; i++) {
78
- const maskSegment = maskSegments[i];
79
- const urlSegment = urlSegments[i];
80
- if (maskSegment.startsWith(':')) {
81
- const paramName = maskSegment.slice(1); // Remove ':' from mask
82
- params[paramName] = urlSegment;
83
- }
84
- else if (maskSegment !== urlSegment) {
85
- // If static segments don’t match → fail
86
- return {};
87
- }
88
- }
89
- return params;
90
- }
91
- extractQuery(url) {
92
- const query = {};
93
- // Take only the part after "?"
94
- const queryString = url.split('?')[1];
95
- if (!queryString)
96
- return query;
97
- // Remove fragment (#...) if present
98
- const cleanQuery = queryString.split('#')[0];
99
- // Split into key=value pairs
100
- for (const pair of cleanQuery.split('&')) {
101
- if (!pair)
102
- continue;
103
- const [key, value = ''] = pair.split('=');
104
- query[decodeURIComponent(key)] = decodeURIComponent(value);
105
- }
106
- return query;
107
- }
108
- parseBody() {
109
- return new Promise((resolve, reject) => {
110
- let body = '';
111
- this.req.on('data', chunk => body += chunk);
112
- this.req.on('end', () => {
113
- try {
114
- resolve(JSON.parse(body));
115
- }
116
- catch (err) {
117
- reject(err);
118
- }
119
- });
120
- this.req.on('error', reject);
121
- });
122
- }
123
- }
124
- exports.A_Request = A_Request;
125
- //# sourceMappingURL=A-Request.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Request.entity.js","sourceRoot":"","sources":["../../../../src/entities/A-Request/A-Request.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,gDAAiF;AACjF,qEAKkC;AAClC,8DAAoD;AACpD,sGAA6F;AAG7F,MAAa,SAMT,SAAQ,oBAGP;IATL;;QAiBI,SAAI,GAAiB,EAAkB,CAAC;QACxC,WAAM,GAAgB,EAAiB,CAAC;QACxC,UAAK,GAAe,EAAgB,CAAC;QAKrC;;WAEG;QACH,aAAQ,GAAW,CAAC,CAAC;IA2HzB,CAAC;IA3IG,MAAM,KAAK,SAAS;QAChB,OAAO,UAAU,CAAC;IACtB,CAAC;IAgBD,OAAO,CAAC,SAA6C;QACjD,IAAI,CAAC,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC;QAE7B,IAAI,CAAC,KAAK,GAAG,IAAI,iBAAK,CAAC;YACnB,OAAO,EAAE,qBAAS,CAAC,IAAI,CAAC,IAAI;YAC5B,KAAK,EAAE,SAAS,CAAC,KAAK;YACtB,MAAM,EAAG,IAAI,CAAC,WAAgC,CAAC,MAAM;YACrD,EAAE,EAAE,SAAS,CAAC,EAAE;SACnB,CAAC,CAAC;IACP,CAAC;IAED,IAAI,SAAS;QACT,MAAM,MAAM,GAAG,4BAAgB,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzE,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,CAAC;IAID,yBAAyB;IACzB,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,GAAG,CAAC,GAAI,CAAC;IACzB,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KAAK,CAAC,CAAC;QAC/D,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;IAID,SAAS;QACL,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACnC,IAAI,IAAI,GAAG,EAAE,CAAC;YACd,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,CAAC;YAC5C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACpB,IAAI,CAAC;oBACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC9B,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChB,CAAC;YACL,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;CAEJ;AAtJD,8BAsJC"}
@@ -1,21 +0,0 @@
1
- import { IncomingMessage } from "http";
2
- import { A_Request } from "./A-Request.entity";
3
- import { A_TYPES__Entity_Serialized } from "@adaas/a-concept";
4
- export type A_SERVER_TYPES__RequestConstructor = {
5
- /**
6
- * Should correspond to Response id
7
- */
8
- id: string;
9
- request: IncomingMessage;
10
- scope: string;
11
- };
12
- export type A_SERVER_TYPES__RequestSerialized = {} & A_TYPES__Entity_Serialized;
13
- export type A_SERVER_TYPES__RequestMethods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD' | 'CONNECT' | 'TRACE' | 'DEFAULT';
14
- export declare enum A_SERVER_TYPES__RequestEvent {
15
- Error = "error",
16
- Finish = "finish",
17
- Data = "data",
18
- End = "end",
19
- Close = "close"
20
- }
21
- export type A_SERVER_TYPES__RequestEventCallback = (request: A_Request) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_SERVER_TYPES__RequestEvent = void 0;
4
- var A_SERVER_TYPES__RequestEvent;
5
- (function (A_SERVER_TYPES__RequestEvent) {
6
- A_SERVER_TYPES__RequestEvent["Error"] = "error";
7
- A_SERVER_TYPES__RequestEvent["Finish"] = "finish";
8
- A_SERVER_TYPES__RequestEvent["Data"] = "data";
9
- A_SERVER_TYPES__RequestEvent["End"] = "end";
10
- A_SERVER_TYPES__RequestEvent["Close"] = "close";
11
- })(A_SERVER_TYPES__RequestEvent || (exports.A_SERVER_TYPES__RequestEvent = A_SERVER_TYPES__RequestEvent = {}));
12
- //# sourceMappingURL=A-Request.entity.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Request.entity.types.js","sourceRoot":"","sources":["../../../../src/entities/A-Request/A-Request.entity.types.ts"],"names":[],"mappings":";;;AA+BA,IAAY,4BAMX;AAND,WAAY,4BAA4B;IACpC,+CAAe,CAAA;IACf,iDAAiB,CAAA;IACjB,6CAAa,CAAA;IACb,2CAAW,CAAA;IACX,+CAAe,CAAA;AACnB,CAAC,EANW,4BAA4B,4CAA5B,4BAA4B,QAMvC"}
@@ -1,28 +0,0 @@
1
- import { A_Entity, A_Error, A_Scope } from "@adaas/a-concept";
2
- import { IncomingHttpHeaders, ServerResponse } from "http";
3
- import { A_SERVER_TYPES__ResponseConstructor, A_SERVER_TYPES__ResponseSerialized, A_SERVER_TYPES__SendResponseObject } from "./A-Response.entity.types";
4
- import { A_ServerError } from "../../components/A-ServerError/A-ServerError.class";
5
- export declare class A_Response<_ResponseType = any> extends A_Entity<A_SERVER_TYPES__ResponseConstructor, A_SERVER_TYPES__ResponseSerialized> {
6
- /**
7
- * Duration of the request in milliseconds
8
- */
9
- duration: number;
10
- private res;
11
- private data;
12
- error?: A_ServerError;
13
- fromNew(newEntity: A_SERVER_TYPES__ResponseConstructor): void;
14
- get headersSent(): boolean;
15
- get original(): ServerResponse<import("http").IncomingMessage>;
16
- get statusCode(): number;
17
- init(): Promise<void>;
18
- failed(error: A_ServerError | A_Error | Error | any): void;
19
- send(data?: string | object): void;
20
- destroy(error: Error | unknown, scope?: A_Scope): Promise<any>;
21
- json(data?: object): void;
22
- status(code: number): this;
23
- writeHead(statusCode: number, headers?: Record<string, string> | IncomingHttpHeaders | any): void;
24
- setHeader(key: string, value: string): void;
25
- getHeader(key: string): string | number | string[] | undefined;
26
- add(key: string, data: _ResponseType): void;
27
- toResponse(): A_SERVER_TYPES__SendResponseObject<_ResponseType>;
28
- }