@adaas/a-server 0.0.19 → 0.0.20

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 (172) hide show
  1. package/dist/index.d.mts +739 -0
  2. package/dist/index.d.ts +739 -36
  3. package/dist/index.js +1904 -102
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1862 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +5 -3
  8. package/src/components/A-ServerLogger/A_ServerLogger.component.ts +1 -1
  9. package/src/index.ts +75 -0
  10. package/tsconfig.build.json +9 -43
  11. package/tsconfig.json +1 -1
  12. package/tsup.config.ts +15 -0
  13. package/dist/src/channels/A-Http/A-Http.channel.constants.d.ts +0 -5
  14. package/dist/src/channels/A-Http/A-Http.channel.constants.js +0 -10
  15. package/dist/src/channels/A-Http/A-Http.channel.constants.js.map +0 -1
  16. package/dist/src/channels/A-Http/A-Http.channel.d.ts +0 -29
  17. package/dist/src/channels/A-Http/A-Http.channel.error.d.ts +0 -4
  18. package/dist/src/channels/A-Http/A-Http.channel.error.js +0 -9
  19. package/dist/src/channels/A-Http/A-Http.channel.error.js.map +0 -1
  20. package/dist/src/channels/A-Http/A-Http.channel.js +0 -154
  21. package/dist/src/channels/A-Http/A-Http.channel.js.map +0 -1
  22. package/dist/src/channels/A-Http/A-Http.channel.types.d.ts +0 -59
  23. package/dist/src/channels/A-Http/A-Http.channel.types.js +0 -3
  24. package/dist/src/channels/A-Http/A-Http.channel.types.js.map +0 -1
  25. package/dist/src/channels/A-Websockets/A-Websockets.channel.d.ts +0 -4
  26. package/dist/src/channels/A-Websockets/A-Websockets.channel.js +0 -22
  27. package/dist/src/channels/A-Websockets/A-Websockets.channel.js.map +0 -1
  28. package/dist/src/components/A-CommandController/A-CommandController.component.d.ts +0 -8
  29. package/dist/src/components/A-CommandController/A-CommandController.component.js +0 -55
  30. package/dist/src/components/A-CommandController/A-CommandController.component.js.map +0 -1
  31. package/dist/src/components/A-Controller/A-Controller.component.d.ts +0 -9
  32. package/dist/src/components/A-Controller/A-Controller.component.js +0 -60
  33. package/dist/src/components/A-Controller/A-Controller.component.js.map +0 -1
  34. package/dist/src/components/A-Controller/A-Controller.component.types.d.ts +0 -0
  35. package/dist/src/components/A-Controller/A-Controller.component.types.js +0 -2
  36. package/dist/src/components/A-Controller/A-Controller.component.types.js.map +0 -1
  37. package/dist/src/components/A-EntityController/A-EntityController.component.d.ts +0 -26
  38. package/dist/src/components/A-EntityController/A-EntityController.component.js +0 -226
  39. package/dist/src/components/A-EntityController/A-EntityController.component.js.map +0 -1
  40. package/dist/src/components/A-EntityController/A-EntityController.component.types.d.ts +0 -0
  41. package/dist/src/components/A-EntityController/A-EntityController.component.types.js +0 -2
  42. package/dist/src/components/A-EntityController/A-EntityController.component.types.js.map +0 -1
  43. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.d.ts +0 -9
  44. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js +0 -118
  45. package/dist/src/components/A-EntityRepository/A-EntityRepository.component.js.map +0 -1
  46. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.d.ts +0 -0
  47. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js +0 -2
  48. package/dist/src/components/A-EntityRepository/A-EntityRepository.error.js.map +0 -1
  49. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.d.ts +0 -0
  50. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js +0 -2
  51. package/dist/src/components/A-EntityRepository/A-EntityRepository.types.js.map +0 -1
  52. package/dist/src/components/A-ListingController/A-ListingController.component.d.ts +0 -10
  53. package/dist/src/components/A-ListingController/A-ListingController.component.js +0 -72
  54. package/dist/src/components/A-ListingController/A-ListingController.component.js.map +0 -1
  55. package/dist/src/components/A-ListingController/A-ListingController.component.types.d.ts +0 -0
  56. package/dist/src/components/A-ListingController/A-ListingController.component.types.js +0 -2
  57. package/dist/src/components/A-ListingController/A-ListingController.component.types.js.map +0 -1
  58. package/dist/src/components/A-Router/A-Router.component.d.ts +0 -63
  59. package/dist/src/components/A-Router/A-Router.component.js +0 -221
  60. package/dist/src/components/A-Router/A-Router.component.js.map +0 -1
  61. package/dist/src/components/A-Router/A-Router.component.types.d.ts +0 -26
  62. package/dist/src/components/A-Router/A-Router.component.types.js +0 -17
  63. package/dist/src/components/A-Router/A-Router.component.types.js.map +0 -1
  64. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.d.ts +0 -9
  65. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.d.ts +0 -2
  66. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js +0 -11
  67. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.defaults.js.map +0 -1
  68. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js +0 -70
  69. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.js.map +0 -1
  70. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.d.ts +0 -7
  71. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js +0 -3
  72. package/dist/src/components/A-ServerCORS/A_ServerCORS.component.types.js.map +0 -1
  73. package/dist/src/components/A-ServerError/A-ServerError.class.d.ts +0 -7
  74. package/dist/src/components/A-ServerError/A-ServerError.class.js +0 -88
  75. package/dist/src/components/A-ServerError/A-ServerError.class.js.map +0 -1
  76. package/dist/src/components/A-ServerError/A-ServerError.constants.d.ts +0 -0
  77. package/dist/src/components/A-ServerError/A-ServerError.constants.js +0 -2
  78. package/dist/src/components/A-ServerError/A-ServerError.constants.js.map +0 -1
  79. package/dist/src/components/A-ServerError/A-ServerError.types.d.ts +0 -13
  80. package/dist/src/components/A-ServerError/A-ServerError.types.js +0 -3
  81. package/dist/src/components/A-ServerError/A-ServerError.types.js.map +0 -1
  82. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.d.ts +0 -7
  83. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js +0 -81
  84. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.js.map +0 -1
  85. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.d.ts +0 -0
  86. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js +0 -2
  87. package/dist/src/components/A-ServerHealthMonitor/A-ServerHealthMonitor.component.types.js.map +0 -1
  88. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.d.ts +0 -22
  89. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js +0 -31
  90. package/dist/src/components/A-ServerLogger/A-ServerLogger.constants.js.map +0 -1
  91. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.d.ts +0 -43
  92. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js +0 -167
  93. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.js.map +0 -1
  94. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.d.ts +0 -9
  95. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js +0 -3
  96. package/dist/src/components/A-ServerLogger/A_ServerLogger.component.types.js.map +0 -1
  97. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.d.ts +0 -9
  98. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js +0 -88
  99. package/dist/src/components/A-ServerProxy/A-ServerProxy.component.js.map +0 -1
  100. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.d.ts +0 -12
  101. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js +0 -126
  102. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.js.map +0 -1
  103. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.d.ts +0 -10
  104. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js +0 -109
  105. package/dist/src/components/A-StaticLoader/A-StaticLoader.component.types.js.map +0 -1
  106. package/dist/src/constants/env.constants.d.ts +0 -10
  107. package/dist/src/constants/env.constants.js +0 -20
  108. package/dist/src/constants/env.constants.js.map +0 -1
  109. package/dist/src/containers/A-Service/A-Service.container.d.ts +0 -30
  110. package/dist/src/containers/A-Service/A-Service.container.js +0 -200
  111. package/dist/src/containers/A-Service/A-Service.container.js.map +0 -1
  112. package/dist/src/containers/A-Service/A-Service.container.types.d.ts +0 -36
  113. package/dist/src/containers/A-Service/A-Service.container.types.js +0 -27
  114. package/dist/src/containers/A-Service/A-Service.container.types.js.map +0 -1
  115. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.d.ts +0 -39
  116. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js +0 -69
  117. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.js.map +0 -1
  118. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.d.ts +0 -5
  119. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js +0 -3
  120. package/dist/src/context/A-EntityFactory/A-EntityFactory.context.types.js.map +0 -1
  121. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.d.ts +0 -12
  122. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js +0 -16
  123. package/dist/src/context/A-HttpChannel/A-HttpChannel.context.js.map +0 -1
  124. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.d.ts +0 -10
  125. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js +0 -30
  126. package/dist/src/context/A-ListQueryFilter/A_ListQueryFilter.context.js.map +0 -1
  127. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.d.ts +0 -2
  128. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js +0 -12
  129. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.constants.js.map +0 -1
  130. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.d.ts +0 -29
  131. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js +0 -60
  132. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.context.js.map +0 -1
  133. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.d.ts +0 -18
  134. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js +0 -3
  135. package/dist/src/context/A-ProxyConfig/A_ProxyConfig.types.js.map +0 -1
  136. package/dist/src/context/A-Server/A_Server.context.d.ts +0 -17
  137. package/dist/src/context/A-Server/A_Server.context.js +0 -22
  138. package/dist/src/context/A-Server/A_Server.context.js.map +0 -1
  139. package/dist/src/context/A-Server/A_Server.context.types.d.ts +0 -7
  140. package/dist/src/context/A-Server/A_Server.context.types.js +0 -3
  141. package/dist/src/context/A-Server/A_Server.context.types.js.map +0 -1
  142. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.d.ts +0 -16
  143. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js +0 -28
  144. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.js.map +0 -1
  145. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.d.ts +0 -0
  146. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js +0 -2
  147. package/dist/src/context/A-StaticConfig/A-StaticConfig.context.types.js.map +0 -1
  148. package/dist/src/entities/A-Request/A-Request.entity.d.ts +0 -31
  149. package/dist/src/entities/A-Request/A-Request.entity.js +0 -125
  150. package/dist/src/entities/A-Request/A-Request.entity.js.map +0 -1
  151. package/dist/src/entities/A-Request/A-Request.entity.types.d.ts +0 -21
  152. package/dist/src/entities/A-Request/A-Request.entity.types.js +0 -12
  153. package/dist/src/entities/A-Request/A-Request.entity.types.js.map +0 -1
  154. package/dist/src/entities/A-Response/A-Response.entity.d.ts +0 -28
  155. package/dist/src/entities/A-Response/A-Response.entity.js +0 -141
  156. package/dist/src/entities/A-Response/A-Response.entity.js.map +0 -1
  157. package/dist/src/entities/A-Response/A-Response.entity.types.d.ts +0 -19
  158. package/dist/src/entities/A-Response/A-Response.entity.types.js +0 -12
  159. package/dist/src/entities/A-Response/A-Response.entity.types.js.map +0 -1
  160. package/dist/src/entities/A-Route/A-Route.entity.d.ts +0 -17
  161. package/dist/src/entities/A-Route/A-Route.entity.js +0 -76
  162. package/dist/src/entities/A-Route/A-Route.entity.js.map +0 -1
  163. package/dist/src/entities/A-Route/A-Route.entity.types.d.ts +0 -0
  164. package/dist/src/entities/A-Route/A-Route.entity.types.js +0 -2
  165. package/dist/src/entities/A-Route/A-Route.entity.types.js.map +0 -1
  166. package/dist/src/entities/A_EntityList/A_EntityList.entity.d.ts +0 -46
  167. package/dist/src/entities/A_EntityList/A_EntityList.entity.js +0 -91
  168. package/dist/src/entities/A_EntityList/A_EntityList.entity.js.map +0 -1
  169. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.d.ts +0 -21
  170. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js +0 -8
  171. package/dist/src/entities/A_EntityList/A_EntityList.entity.types.js.map +0 -1
  172. package/index.ts +0 -75
@@ -1,221 +0,0 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
9
- return function (target, key) { decorator(target, key, paramIndex); }
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.A_Router = void 0;
22
- const a_concept_1 = require("@adaas/a-concept");
23
- const A_Service_container_1 = require("../../containers/A-Service/A-Service.container");
24
- const A_Service_container_types_1 = require("../../containers/A-Service/A-Service.container.types");
25
- const A_Request_entity_1 = require("../../entities/A-Request/A-Request.entity");
26
- const A_Router_component_types_1 = require("./A-Router.component.types");
27
- const A_Route_entity_1 = require("../../entities/A-Route/A-Route.entity");
28
- const A_Response_entity_1 = require("../../entities/A-Response/A-Response.entity");
29
- const A_ServerLogger_component_1 = require("../A-ServerLogger/A_ServerLogger.component");
30
- const a_utils_1 = require("@adaas/a-utils");
31
- class A_Router extends a_concept_1.A_Component {
32
- // =======================================================
33
- // ================ Method Definition=====================
34
- // =======================================================
35
- /**
36
- * Allows to define a custom route for POST requests
37
- *
38
- * @param path
39
- * @returns
40
- */
41
- static Post(path) {
42
- return this.defineRoute({
43
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.POST,
44
- path: typeof path === 'object' && 'path' in path ? path.path : path,
45
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
46
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
47
- });
48
- }
49
- /**
50
- * Allows to define a custom route for GET requests
51
- *
52
- * @param path
53
- * @returns
54
- */
55
- static Get(path) {
56
- return this.defineRoute({
57
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.GET,
58
- path: typeof path === 'object' && 'path' in path ? path.path : path,
59
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
60
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
61
- });
62
- }
63
- /**
64
- * Allows to define a custom route for PUT requests
65
- *
66
- * @param path
67
- * @returns
68
- */
69
- static Put(path) {
70
- return this.defineRoute({
71
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.PUT,
72
- path: typeof path === 'object' && 'path' in path ? path.path : path,
73
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
74
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
75
- });
76
- }
77
- /**
78
- * Allows to define a custom route for DELETE requests
79
- *
80
- * @param path
81
- * @returns
82
- */
83
- static Delete(path) {
84
- return this.defineRoute({
85
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.DELETE,
86
- path: typeof path === 'object' && 'path' in path ? path.path : path,
87
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
88
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
89
- });
90
- }
91
- /**
92
- * Allows to define a custom route for PATCH requests
93
- *
94
- * @param path
95
- * @returns
96
- */
97
- static Patch(path) {
98
- return this.defineRoute({
99
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.PATCH,
100
- path: typeof path === 'object' && 'path' in path ? path.path : path,
101
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
102
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
103
- });
104
- }
105
- /**
106
- * Allows to define a custom route for DEFAULT requests
107
- *
108
- * @param path
109
- * @returns
110
- */
111
- static Default(path) {
112
- return this.defineRoute({
113
- method: A_Router_component_types_1.A_SERVER_TYPES__RouterMethod.DEFAULT,
114
- path: typeof path === 'object' && 'path' in path ? path.path : path,
115
- version: typeof path === 'object' && 'version' in path && path.version ? path.version : 'v1',
116
- prefix: typeof path === 'object' && 'prefix' in path && path.prefix ? path.prefix : 'api',
117
- });
118
- }
119
- /**
120
- * Private method to have the same signature for all route methods
121
- *
122
- * @param method
123
- * @param path
124
- * @returns
125
- */
126
- static defineRoute(config) {
127
- const route = typeof config.path === 'string' || config.path instanceof RegExp
128
- ? new A_Route_entity_1.A_Route(`/${config.prefix}/${config.version}${config.path instanceof RegExp ? config.path.source : config.path.startsWith('/') ? config.path : `/${config.path}`}`, config.method)
129
- : config.path;
130
- this.routes.push(route);
131
- return function decorator(target, propertyKey, descriptor) {
132
- const meta = a_concept_1.A_Context.meta(target);
133
- const routes = meta.get(A_Router_component_types_1.A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES) || new Map();
134
- const searchKey = route.toAFeatureExtension(['A_Router', 'A_Service']);
135
- routes.set(searchKey.source, {
136
- component: target,
137
- handler: propertyKey,
138
- route
139
- });
140
- meta.set(A_Router_component_types_1.A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES, routes);
141
- (0, a_concept_1.A_Feature_Define)({
142
- name: searchKey.source,
143
- invoke: false
144
- })(target, propertyKey, descriptor);
145
- return (0, a_concept_1.A_Feature_Extend)(searchKey)(target, propertyKey, descriptor);
146
- };
147
- }
148
- // =====================================================
149
- // ================ Concept Lifecycle ========================
150
- // =====================================================
151
- load(logger) {
152
- return __awaiter(this, void 0, void 0, function* () {
153
- logger.routes(A_Router.routes);
154
- });
155
- }
156
- // =======================================================
157
- // ================ Feature Definition=====================
158
- // =======================================================
159
- // @A_Feature.Define({
160
- // invoke: false
161
- // })
162
- identifyRoute(request, response, scope, config, logger) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- const route = request.route;
165
- if (config.get('A_CONCEPT_ENVIRONMENT') === 'development') {
166
- logger.log(`Incoming request: ${request.method} ${request.url}`);
167
- logger.log(`Identified route: ${route.toString()}`);
168
- }
169
- /**
170
- * just execute all listeners on the Route
171
- * url example: /api/v1/users/123
172
- * OR
173
- * url example: /api/v1/users
174
- * => Then The feature will be "GET::/api/v1/users"
175
- * And it will return all stages that are similar to the feature name
176
- */
177
- const feature = new a_concept_1.A_Feature({
178
- name: route.toString(),
179
- component: this,
180
- });
181
- for (const stage of feature) {
182
- if (a_concept_1.A_TypeGuards.isComponentConstructor(stage.definition.component)) {
183
- const meta = a_concept_1.A_Context.meta(stage.definition.component);
184
- const routes = meta.get(A_Router_component_types_1.A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES);
185
- if (routes) {
186
- const currentRoute = routes.get(stage.definition.name || '');
187
- if (currentRoute) {
188
- request.params = Object.assign(Object.assign({}, request.params), currentRoute.route.extractParams(request.url));
189
- }
190
- }
191
- }
192
- const stageScope = new a_concept_1.A_Scope({
193
- name: `a-route--${a_concept_1.A_IdentityHelper.generateTimeId()}`,
194
- entities: [request],
195
- }, {
196
- parent: scope
197
- });
198
- yield stage.process(stageScope);
199
- }
200
- console.log('Finished processing route for request:', request.method, request.url);
201
- });
202
- }
203
- }
204
- exports.A_Router = A_Router;
205
- A_Router.routes = [];
206
- __decorate([
207
- a_concept_1.A_Concept.Load(),
208
- __param(0, (0, a_concept_1.A_Inject)(A_ServerLogger_component_1.A_ServerLogger))
209
- ], A_Router.prototype, "load", null);
210
- __decorate([
211
- a_concept_1.A_Feature.Extend({
212
- name: A_Service_container_types_1.A_SERVER_TYPES__ServerFeature.onRequest,
213
- scope: [A_Service_container_1.A_Service],
214
- }),
215
- __param(0, (0, a_concept_1.A_Inject)(A_Request_entity_1.A_Request)),
216
- __param(1, (0, a_concept_1.A_Inject)(A_Response_entity_1.A_Response)),
217
- __param(2, (0, a_concept_1.A_Inject)(a_concept_1.A_Scope)),
218
- __param(3, (0, a_concept_1.A_Inject)(a_utils_1.A_Config)),
219
- __param(4, (0, a_concept_1.A_Inject)(a_utils_1.A_Logger))
220
- ], A_Router.prototype, "identifyRoute", null);
221
- //# sourceMappingURL=A-Router.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Router.component.js","sourceRoot":"","sources":["../../../../src/components/A-Router/A-Router.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gDAY0B;AAC1B,kGAAqF;AACrF,8GAA+G;AAC/G,0FAAgF;AAChF,yEAMoC;AACpC,oFAA0E;AAC1E,6FAAmF;AACnF,yFAA4E;AAE5E,4CAAoD;AAIpD,MAAa,QAAS,SAAQ,uBAAW;IAErC,0DAA0D;IAC1D,0DAA0D;IAC1D,0DAA0D;IAE1D;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,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declare enum A_SERVER_TYPES__RouterMethod {
4
- POST = "POST",
5
- GET = "GET",
6
- PUT = "PUT",
7
- DELETE = "DELETE",
8
- PATCH = "PATCH",
9
- DEFAULT = "DEFAULT"
10
- }
11
- export type A_TYPES__ARouterComponentMeta = {
12
- [A_SERVER_TYPES__ARouterComponentMetaKey.ROUTES]: Map<string, A_TYPES__ARouterDefineRoute>;
13
- } & A_TYPES__ComponentMeta;
14
- export type A_TYPES__ARouterDefineRoute = {
15
- component: A_Component;
16
- handler: string;
17
- route: A_Route;
18
- };
19
- export declare enum A_SERVER_TYPES__ARouterComponentMetaKey {
20
- ROUTES = "ROUTES"
21
- }
22
- export type A_SERVER_TYPES__ARouterRouteConfig = {
23
- path: string | RegExp;
24
- version: string;
25
- prefix: string;
26
- };
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_SERVER_TYPES__ARouterComponentMetaKey = exports.A_SERVER_TYPES__RouterMethod = void 0;
4
- var A_SERVER_TYPES__RouterMethod;
5
- (function (A_SERVER_TYPES__RouterMethod) {
6
- A_SERVER_TYPES__RouterMethod["POST"] = "POST";
7
- A_SERVER_TYPES__RouterMethod["GET"] = "GET";
8
- A_SERVER_TYPES__RouterMethod["PUT"] = "PUT";
9
- A_SERVER_TYPES__RouterMethod["DELETE"] = "DELETE";
10
- A_SERVER_TYPES__RouterMethod["PATCH"] = "PATCH";
11
- A_SERVER_TYPES__RouterMethod["DEFAULT"] = "DEFAULT";
12
- })(A_SERVER_TYPES__RouterMethod || (exports.A_SERVER_TYPES__RouterMethod = A_SERVER_TYPES__RouterMethod = {}));
13
- var A_SERVER_TYPES__ARouterComponentMetaKey;
14
- (function (A_SERVER_TYPES__ARouterComponentMetaKey) {
15
- A_SERVER_TYPES__ARouterComponentMetaKey["ROUTES"] = "ROUTES";
16
- })(A_SERVER_TYPES__ARouterComponentMetaKey || (exports.A_SERVER_TYPES__ARouterComponentMetaKey = A_SERVER_TYPES__ARouterComponentMetaKey = {}));
17
- //# sourceMappingURL=A-Router.component.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-Router.component.types.js","sourceRoot":"","sources":["../../../../src/components/A-Router/A-Router.component.types.ts"],"names":[],"mappings":";;;AAIA,IAAY,4BAOX;AAPD,WAAY,4BAA4B;IACpC,6CAAa,CAAA;IACb,2CAAW,CAAA;IACX,2CAAW,CAAA;IACX,iDAAiB,CAAA;IACjB,+CAAe,CAAA;IACf,mDAAmB,CAAA;AACvB,CAAC,EAPW,4BAA4B,4CAA5B,4BAA4B,QAOvC;AAeD,IAAY,uCAGX;AAHD,WAAY,uCAAuC;IAC/C,4DAAiB,CAAA;AAErB,CAAC,EAHW,uCAAuC,uDAAvC,uCAAuC,QAGlD"}
@@ -1,9 +0,0 @@
1
- import { A_Component } from '@adaas/a-concept';
2
- import { A_Request } from '../../entities/A-Request/A-Request.entity';
3
- import { A_Response } from '../../entities/A-Response/A-Response.entity';
4
- import { A_Config } from '@adaas/a-utils';
5
- export declare class A_ServerCORS extends A_Component {
6
- private config;
7
- init(config: A_Config<['ORIGIN', 'METHODS', 'HEADERS', 'CREDENTIALS', 'MAX_AGE']>): Promise<void>;
8
- apply(aReq: A_Request, aRes: A_Response): void;
9
- }
@@ -1,2 +0,0 @@
1
- import { A_SERVER_TYPES__CorsConfig } from "./A_ServerCORS.component.types";
2
- export declare const A_SERVER_DEFAULTS__CorsConfig: A_SERVER_TYPES__CorsConfig;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_SERVER_DEFAULTS__CorsConfig = void 0;
4
- exports.A_SERVER_DEFAULTS__CorsConfig = {
5
- origin: '*', // Default to allow all origins
6
- methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
7
- headers: ['Content-Type'],
8
- credentials: false,
9
- maxAge: 0
10
- };
11
- //# sourceMappingURL=A_ServerCORS.component.defaults.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ServerCORS.component.defaults.js","sourceRoot":"","sources":["../../../../src/components/A-ServerCORS/A_ServerCORS.component.defaults.ts"],"names":[],"mappings":";;;AAIa,QAAA,6BAA6B,GAA+B;IACrE,MAAM,EAAE,GAAG,EAAG,+BAA+B;IAC7C,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC;IACpD,OAAO,EAAE,CAAC,cAAc,CAAC;IACzB,WAAW,EAAE,KAAK;IAClB,MAAM,EAAE,CAAC;CACZ,CAAC"}
@@ -1,70 +0,0 @@
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 __param = (this && this.__param) || function (paramIndex, decorator) {
9
- return function (target, key) { decorator(target, key, paramIndex); }
10
- };
11
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
12
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13
- return new (P || (P = Promise))(function (resolve, reject) {
14
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
15
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18
- });
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.A_ServerCORS = void 0;
22
- const a_concept_1 = require("@adaas/a-concept");
23
- const A_ServerCORS_component_defaults_1 = require("./A_ServerCORS.component.defaults");
24
- const A_Service_container_types_1 = require("../../containers/A-Service/A-Service.container.types");
25
- const A_Request_entity_1 = require("../../entities/A-Request/A-Request.entity");
26
- const A_Response_entity_1 = require("../../entities/A-Response/A-Response.entity");
27
- const a_utils_1 = require("@adaas/a-utils");
28
- class A_ServerCORS extends a_concept_1.A_Component {
29
- init(config) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- this.config = {
32
- origin: config.get('ORIGIN') || A_ServerCORS_component_defaults_1.A_SERVER_DEFAULTS__CorsConfig.origin,
33
- methods: config.get('METHODS') || A_ServerCORS_component_defaults_1.A_SERVER_DEFAULTS__CorsConfig.methods,
34
- headers: config.get('HEADERS') || A_ServerCORS_component_defaults_1.A_SERVER_DEFAULTS__CorsConfig.headers,
35
- credentials: config.get('CREDENTIALS') || A_ServerCORS_component_defaults_1.A_SERVER_DEFAULTS__CorsConfig.credentials,
36
- maxAge: config.get('MAX_AGE') || A_ServerCORS_component_defaults_1.A_SERVER_DEFAULTS__CorsConfig.maxAge,
37
- };
38
- });
39
- }
40
- apply(aReq, aRes) {
41
- aRes.setHeader('Access-Control-Allow-Origin', this.config.origin);
42
- aRes.setHeader('Access-Control-Allow-Methods', this.config.methods.join(', '));
43
- aRes.setHeader('Access-Control-Allow-Headers', this.config.headers.join(', '));
44
- if (this.config.credentials) {
45
- aRes.setHeader('Access-Control-Allow-Credentials', 'true');
46
- }
47
- if (this.config.maxAge) {
48
- aRes.setHeader('Access-Control-Max-Age', this.config.maxAge.toString());
49
- }
50
- // Handle preflight OPTIONS requests
51
- if (aReq.req.method === 'OPTIONS') {
52
- aRes.status(204).send();
53
- }
54
- }
55
- }
56
- exports.A_ServerCORS = A_ServerCORS;
57
- __decorate([
58
- a_concept_1.A_Feature.Extend({
59
- name: A_Service_container_types_1.A_SERVER_TYPES__ServerFeature.beforeStart
60
- }),
61
- __param(0, (0, a_concept_1.A_Inject)(a_utils_1.A_Config))
62
- ], A_ServerCORS.prototype, "init", null);
63
- __decorate([
64
- a_concept_1.A_Feature.Extend({
65
- name: A_Service_container_types_1.A_SERVER_TYPES__ServerFeature.beforeRequest
66
- }),
67
- __param(0, (0, a_concept_1.A_Inject)(A_Request_entity_1.A_Request)),
68
- __param(1, (0, a_concept_1.A_Inject)(A_Response_entity_1.A_Response))
69
- ], A_ServerCORS.prototype, "apply", null);
70
- //# sourceMappingURL=A_ServerCORS.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ServerCORS.component.js","sourceRoot":"","sources":["../../../../src/components/A-ServerCORS/A_ServerCORS.component.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,gDAAoE;AAEpE,uFAAkF;AAClF,8GAA+G;AAC/G,0FAAgF;AAChF,6FAAmF;AACnF,4CAA0C;AAG1C,MAAa,YAAa,SAAQ,uBAAW;IAOnC,IAAI,CACc,MAA4E;;YAEhG,IAAI,CAAC,MAAM,GAAG;gBACV,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,+DAA6B,CAAC,MAAM;gBACpE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,+DAA6B,CAAC,OAAO;gBACvE,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,+DAA6B,CAAC,OAAO;gBACvE,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,+DAA6B,CAAC,WAAW;gBACnF,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,+DAA6B,CAAC,MAAM;aACxE,CAAC;QACN,CAAC;KAAA;IAMM,KAAK,CACa,IAAe,EACd,IAAgB;QAGtC,IAAI,CAAC,SAAS,CAAC,6BAA6B,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,CAAC,8BAA8B,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/E,IAAI,CAAC,SAAS,CAAC,8BAA8B,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/E,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC1B,IAAI,CAAC,SAAS,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;QAC/D,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,CAAC,wBAAwB,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,oCAAoC;QACpC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC5B,CAAC;IACL,CAAC;CACJ;AA7CD,oCA6CC;AAtCS;IAHL,qBAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,yDAA6B,CAAC,WAAW;KAClD,CAAC;IAEG,WAAA,IAAA,oBAAQ,EAAC,kBAAQ,CAAC,CAAA;wCAStB;AAMM;IAHN,qBAAS,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,yDAA6B,CAAC,aAAa;KACpD,CAAC;IAEG,WAAA,IAAA,oBAAQ,EAAC,4BAAS,CAAC,CAAA;IACnB,WAAA,IAAA,oBAAQ,EAAC,8BAAU,CAAC,CAAA;yCAmBxB"}
@@ -1,7 +0,0 @@
1
- export type A_SERVER_TYPES__CorsConfig = {
2
- origin: string;
3
- methods: string[];
4
- headers: string[];
5
- credentials: boolean;
6
- maxAge: number;
7
- };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=A_ServerCORS.component.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A_ServerCORS.component.types.js","sourceRoot":"","sources":["../../../../src/components/A-ServerCORS/A_ServerCORS.component.types.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { A_Error } from '@adaas/a-concept';
2
- import { A_SERVER_TYPES__ServerError_Init, A_SERVER_TYPES__ServerError_Serialized } from './A-ServerError.types';
3
- export declare class A_ServerError extends A_Error<A_SERVER_TYPES__ServerError_Init, A_SERVER_TYPES__ServerError_Serialized> {
4
- status: number;
5
- protected fromConstructor(params: A_SERVER_TYPES__ServerError_Init): void;
6
- toJSON(): A_SERVER_TYPES__ServerError_Serialized;
7
- }
@@ -1,88 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.A_ServerError = void 0;
4
- const a_concept_1 = require("@adaas/a-concept");
5
- class A_ServerError extends a_concept_1.A_Error {
6
- constructor() {
7
- super(...arguments);
8
- this.status = 500;
9
- }
10
- // constructor(
11
- // /**
12
- // * A_Error Constructor params
13
- // */
14
- // params: A_SERVER_TYPES__ServerError_Init
15
- // )
16
- // constructor(
17
- // /**
18
- // * HTTP Status Code of the error
19
- // */
20
- // status: number,
21
- // /**
22
- // * Error message
23
- // */
24
- // message: string
25
- // )
26
- // constructor(
27
- // /**
28
- // * Original JS Error
29
- // */
30
- // error: Error
31
- // )
32
- // constructor(
33
- // /**
34
- // * HTTP Status Code of the error
35
- // */
36
- // status: number,
37
- // /**
38
- // * Error message
39
- // */
40
- // title: string,
41
- // /**
42
- // * Detailed description of the error
43
- // */
44
- // description: string
45
- // )
46
- // constructor(
47
- // param1: A_SERVER_TYPES__ServerError_Init | Error | string | A_Error | number,
48
- // param2?: string | A_Error,
49
- // param3?: string
50
- // ) {
51
- // switch (true) {
52
- // case typeof param1 === 'number':
53
- // if (typeof param2 === 'string' && param3) {
54
- // super({
55
- // title: param2,
56
- // description: param3
57
- // });
58
- // }
59
- // else if (param2 instanceof A_Error) {
60
- // super(param2);
61
- // }
62
- // else {
63
- // super();
64
- // }
65
- // this.status = param1;
66
- // break;
67
- // case param1 instanceof A_Error:
68
- // super (param1);
69
- // break;
70
- // case param1 instanceof Error:
71
- // super (param1);
72
- // break;
73
- // default:
74
- // break;
75
- // }
76
- // }
77
- fromConstructor(params) {
78
- super.fromConstructor(params);
79
- if (params.status) {
80
- this.status = params.status;
81
- }
82
- }
83
- toJSON() {
84
- return Object.assign(Object.assign({}, super.toJSON()), { status: this.status });
85
- }
86
- }
87
- exports.A_ServerError = A_ServerError;
88
- //# sourceMappingURL=A-ServerError.class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-ServerError.class.js","sourceRoot":"","sources":["../../../../src/components/A-ServerError/A-ServerError.class.ts"],"names":[],"mappings":";;;AAAA,gDAA2C;AAI3C,MAAa,aAAc,SAAQ,mBAAiF;IAApH;;QAEI,WAAM,GAAW,GAAG,CAAC;IAyFzB,CAAC;IAtFG,eAAe;IACf,UAAU;IACV,oCAAoC;IACpC,UAAU;IACV,+CAA+C;IAC/C,IAAI;IACJ,eAAe;IACf,UAAU;IACV,uCAAuC;IACvC,UAAU;IACV,sBAAsB;IACtB,UAAU;IACV,uBAAuB;IACvB,UAAU;IACV,sBAAsB;IACtB,IAAI;IACJ,eAAe;IACf,UAAU;IACV,2BAA2B;IAC3B,UAAU;IACV,mBAAmB;IACnB,IAAI;IACJ,eAAe;IACf,UAAU;IACV,uCAAuC;IACvC,UAAU;IACV,sBAAsB;IACtB,UAAU;IACV,uBAAuB;IACvB,UAAU;IACV,qBAAqB;IACrB,UAAU;IACV,2CAA2C;IAC3C,UAAU;IACV,0BAA0B;IAC1B,IAAI;IACJ,eAAe;IACf,oFAAoF;IACpF,iCAAiC;IACjC,sBAAsB;IACtB,MAAM;IACN,oBAAoB;IACpB,uCAAuC;IACvC,sDAAsD;IACtD,sBAAsB;IACtB,iCAAiC;IACjC,sCAAsC;IACtC,kBAAkB;IAClB,YAAY;IACZ,gDAAgD;IAChD,6BAA6B;IAC7B,YAAY;IACZ,iBAAiB;IACjB,uBAAuB;IACvB,YAAY;IACZ,gCAAgC;IAChC,iBAAiB;IAEjB,sCAAsC;IACtC,0BAA0B;IAC1B,iBAAiB;IACjB,oCAAoC;IACpC,0BAA0B;IAC1B,iBAAiB;IAEjB,eAAe;IACf,iBAAiB;IACjB,MAAM;IAEN,IAAI;IAGM,eAAe,CAAC,MAAwC;QAC9D,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAChC,CAAC;IACL,CAAC;IAGD,MAAM;QACF,uCACO,KAAK,CAAC,MAAM,EAAE,KACjB,MAAM,EAAE,IAAI,CAAC,MAAM,IACtB;IACL,CAAC;CACJ;AA3FD,sCA2FC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=A-ServerError.constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-ServerError.constants.js","sourceRoot":"","sources":["../../../../src/components/A-ServerError/A-ServerError.constants.ts"],"names":[],"mappings":""}
@@ -1,13 +0,0 @@
1
- import { A_TYPES__Error_Init, A_TYPES__Error_Serialized } from "@adaas/a-concept";
2
- export type A_SERVER_TYPES__ServerError_Init = {
3
- /**
4
- * HTTP Status Code of the error
5
- */
6
- status?: number;
7
- } & A_TYPES__Error_Init;
8
- export type A_SERVER_TYPES__ServerError_Serialized = {
9
- /**
10
- * HTTP Status Code of the error
11
- */
12
- status: number;
13
- } & A_TYPES__Error_Serialized;
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=A-ServerError.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"A-ServerError.types.js","sourceRoot":"","sources":["../../../../src/components/A-ServerError/A-ServerError.types.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import { A_Component } from "@adaas/a-concept";
2
- import { A_Request } from "../../entities/A-Request/A-Request.entity";
3
- import { A_Response } from "../../entities/A-Response/A-Response.entity";
4
- import { A_Config, A_Logger } from "@adaas/a-utils";
5
- export declare class A_ServerHealthMonitor extends A_Component {
6
- get(config: A_Config<['VERSION_PATH', 'EXPOSED_PROPERTIES']>, request: A_Request, response: A_Response, logger: A_Logger): Promise<any>;
7
- }
@@ -1,81 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- 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;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __param = (this && this.__param) || function (paramIndex, decorator) {
32
- return function (target, key) { decorator(target, key, paramIndex); }
33
- };
34
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
35
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
36
- return new (P || (P = Promise))(function (resolve, reject) {
37
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
38
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
39
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
40
- step((generator = generator.apply(thisArg, _arguments || [])).next());
41
- });
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.A_ServerHealthMonitor = void 0;
45
- const a_concept_1 = require("@adaas/a-concept");
46
- const A_Router_component_1 = require("../A-Router/A-Router.component");
47
- const A_Request_entity_1 = require("../../entities/A-Request/A-Request.entity");
48
- const A_Response_entity_1 = require("../../entities/A-Response/A-Response.entity");
49
- const a_utils_1 = require("@adaas/a-utils");
50
- class A_ServerHealthMonitor extends a_concept_1.A_Component {
51
- // =======================================================
52
- // ================ Method Definition=====================
53
- // =======================================================
54
- get(config, request, response, logger) {
55
- return __awaiter(this, void 0, void 0, function* () {
56
- var _a;
57
- logger.log('Health check requested', config.get('A_CONCEPT_ROOT_FOLDER'));
58
- const packageJSON = yield Promise.resolve(`${`${config.get('A_CONCEPT_ROOT_FOLDER')}/package.json`}`).then(s => __importStar(require(s)));
59
- const exposedProperties = ((_a = config.get('EXPOSED_PROPERTIES')) === null || _a === void 0 ? void 0 : _a.split(',')) || [
60
- 'name',
61
- 'version',
62
- 'description',
63
- ];
64
- exposedProperties.forEach(prop => response.add(prop, packageJSON[prop]));
65
- console.log(`Health check accessed: ${request.method} ${request.url}`);
66
- });
67
- }
68
- }
69
- exports.A_ServerHealthMonitor = A_ServerHealthMonitor;
70
- __decorate([
71
- A_Router_component_1.A_Router.Get({
72
- path: '/',
73
- prefix: 'health',
74
- version: 'v1',
75
- }),
76
- __param(0, (0, a_concept_1.A_Inject)(a_utils_1.A_Config)),
77
- __param(1, (0, a_concept_1.A_Inject)(A_Request_entity_1.A_Request)),
78
- __param(2, (0, a_concept_1.A_Inject)(A_Response_entity_1.A_Response)),
79
- __param(3, (0, a_concept_1.A_Inject)(a_utils_1.A_Logger))
80
- ], A_ServerHealthMonitor.prototype, "get", null);
81
- //# sourceMappingURL=A-ServerHealthMonitor.component.js.map