@intuitionrobotics/thunderstorm 0.46.0 → 0.47.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 (270) hide show
  1. package/app-backend/api/v1/utils/version/_assert.js +20 -0
  2. package/app-backend/api/v1/utils/version/_assert.js.map +1 -1
  3. package/app-backend/api/v1/utils/version/assert.js +20 -0
  4. package/app-backend/api/v1/utils/version/assert.js.map +1 -1
  5. package/app-backend/core/BaseStorm.d.ts +1 -1
  6. package/app-backend/core/BaseStorm.js +22 -2
  7. package/app-backend/core/BaseStorm.js.map +1 -1
  8. package/app-backend/core/Storm.d.ts +7 -0
  9. package/app-backend/core/Storm.js +46 -9
  10. package/app-backend/core/Storm.js.map +1 -1
  11. package/app-backend/exceptions.d.ts +3 -3
  12. package/app-backend/exceptions.js +2 -2
  13. package/app-backend/exceptions.js.map +1 -1
  14. package/app-backend/modules/CleanupScheduler.d.ts +2 -2
  15. package/app-backend/modules/CleanupScheduler.js +5 -6
  16. package/app-backend/modules/CleanupScheduler.js.map +1 -1
  17. package/app-backend/modules/FirestoreBackupScheduler.d.ts +3 -3
  18. package/app-backend/modules/FirestoreBackupScheduler.js +9 -23
  19. package/app-backend/modules/FirestoreBackupScheduler.js.map +1 -1
  20. package/app-backend/modules/ForceUpgrade.d.ts +2 -2
  21. package/app-backend/modules/ForceUpgrade.js +28 -8
  22. package/app-backend/modules/ForceUpgrade.js.map +1 -1
  23. package/app-backend/modules/SlackModule.d.ts +5 -6
  24. package/app-backend/modules/SlackModule.js +7 -9
  25. package/app-backend/modules/SlackModule.js.map +1 -1
  26. package/app-backend/modules/_imports.d.ts +10 -0
  27. package/app-backend/modules/_imports.js +47 -0
  28. package/app-backend/modules/_imports.js.map +1 -0
  29. package/app-backend/modules/http/AxiosHttpModule.d.ts +7 -17
  30. package/app-backend/modules/http/AxiosHttpModule.js +47 -20
  31. package/app-backend/modules/http/AxiosHttpModule.js.map +1 -1
  32. package/app-backend/modules/http/types.d.ts +5 -5
  33. package/app-backend/modules/proxy/RemoteProxy.d.ts +3 -4
  34. package/app-backend/modules/proxy/RemoteProxy.js +30 -11
  35. package/app-backend/modules/proxy/RemoteProxy.js.map +1 -1
  36. package/app-backend/modules/proxy/RemoteProxyCaller.d.ts +7 -7
  37. package/app-backend/modules/proxy/RemoteProxyCaller.js +30 -12
  38. package/app-backend/modules/proxy/RemoteProxyCaller.js.map +1 -1
  39. package/app-backend/modules/server/HttpServer.d.ts +5 -6
  40. package/app-backend/modules/server/HttpServer.js +32 -10
  41. package/app-backend/modules/server/HttpServer.js.map +1 -1
  42. package/app-backend/modules/server/server-api.d.ts +9 -13
  43. package/app-backend/modules/server/server-api.js +23 -52
  44. package/app-backend/modules/server/server-api.js.map +1 -1
  45. package/app-backend/modules/server/server-errors.d.ts +2 -2
  46. package/app-backend/modules/server/server-errors.js +26 -7
  47. package/app-backend/modules/server/server-errors.js.map +1 -1
  48. package/app-backend/utils/LogClient_File.d.ts +2 -2
  49. package/app-backend/utils/LogClient_File.js +30 -12
  50. package/app-backend/utils/LogClient_File.js.map +1 -1
  51. package/app-backend/utils/file.js +20 -0
  52. package/app-backend/utils/file.js.map +1 -1
  53. package/app-backend/utils/promisify-request.js +4 -5
  54. package/app-backend/utils/promisify-request.js.map +1 -1
  55. package/app-backend/utils/to-be-removed.js +2 -2
  56. package/app-backend/utils/to-be-removed.js.map +1 -1
  57. package/app-backend/utils/types.d.ts +10 -7
  58. package/app-backend/utils/types.js +22 -2
  59. package/app-backend/utils/types.js.map +1 -1
  60. package/app-frontend/components/ActionButton.js +20 -0
  61. package/app-frontend/components/ActionButton.js.map +1 -1
  62. package/app-frontend/components/DropDown.d.ts +4 -4
  63. package/app-frontend/components/DropDown.js +25 -6
  64. package/app-frontend/components/DropDown.js.map +1 -1
  65. package/app-frontend/components/FilterInput.d.ts +2 -2
  66. package/app-frontend/components/FilterInput.js +23 -4
  67. package/app-frontend/components/FilterInput.js.map +1 -1
  68. package/app-frontend/components/GenericSelect.d.ts +2 -2
  69. package/app-frontend/components/GenericSelect.js.map +1 -1
  70. package/app-frontend/components/GenericTabs.d.ts +4 -0
  71. package/app-frontend/components/GenericTabs.js +11 -0
  72. package/app-frontend/components/GenericTabs.js.map +1 -0
  73. package/app-frontend/components/Overlay.d.ts +2 -2
  74. package/app-frontend/components/Overlay.js +20 -0
  75. package/app-frontend/components/Overlay.js.map +1 -1
  76. package/app-frontend/components/TS_Input.d.ts +2 -2
  77. package/app-frontend/components/TS_Input.js +23 -3
  78. package/app-frontend/components/TS_Input.js.map +1 -1
  79. package/app-frontend/components/TS_Table.d.ts +8 -8
  80. package/app-frontend/components/TS_Table.js +20 -0
  81. package/app-frontend/components/TS_Table.js.map +1 -1
  82. package/app-frontend/components/TS_TextArea.d.ts +2 -2
  83. package/app-frontend/components/TS_TextArea.js +20 -0
  84. package/app-frontend/components/TS_TextArea.js.map +1 -1
  85. package/app-frontend/components/Tabs.d.ts +2 -2
  86. package/app-frontend/components/adapter/Adapter.d.ts +15 -15
  87. package/app-frontend/components/adapter/Adapter.js +6 -6
  88. package/app-frontend/components/adapter/Adapter.js.map +1 -1
  89. package/app-frontend/components/adapter/BaseRenderer.d.ts +7 -7
  90. package/app-frontend/components/adapter/BaseRenderer.js +20 -0
  91. package/app-frontend/components/adapter/BaseRenderer.js.map +1 -1
  92. package/app-frontend/components/checkbox/TS_Checkbox.d.ts +3 -3
  93. package/app-frontend/components/checkbox/TS_Checkbox.js +1 -2
  94. package/app-frontend/components/checkbox/TS_Checkbox.js.map +1 -1
  95. package/app-frontend/components/checkbox/TS_CheckboxField.d.ts +3 -3
  96. package/app-frontend/components/checkbox/TS_CheckboxField.js +18 -0
  97. package/app-frontend/components/checkbox/TS_CheckboxField.js.map +1 -1
  98. package/app-frontend/components/form/Form.d.ts +4 -5
  99. package/app-frontend/components/form/Form.js +22 -2
  100. package/app-frontend/components/form/Form.js.map +1 -1
  101. package/app-frontend/components/form/types.d.ts +5 -6
  102. package/app-frontend/components/form/types.js +20 -0
  103. package/app-frontend/components/form/types.js.map +1 -1
  104. package/app-frontend/components/playground/Playground.d.ts +3 -3
  105. package/app-frontend/components/playground/Playground.js +2 -3
  106. package/app-frontend/components/playground/Playground.js.map +1 -1
  107. package/app-frontend/components/tree/MenuComponent.d.ts +1 -1
  108. package/app-frontend/components/tree/MenuComponent.js +22 -2
  109. package/app-frontend/components/tree/MenuComponent.js.map +1 -1
  110. package/app-frontend/components/tree/MultiTypeAdaptor.d.ts +1 -1
  111. package/app-frontend/components/tree/MultiTypeAdaptor.js +22 -2
  112. package/app-frontend/components/tree/MultiTypeAdaptor.js.map +1 -1
  113. package/app-frontend/components/tree/SimpleTreeNodeRenderer.js +20 -0
  114. package/app-frontend/components/tree/SimpleTreeNodeRenderer.js.map +1 -1
  115. package/app-frontend/components/tree/Tree.d.ts +4 -4
  116. package/app-frontend/components/tree/Tree.js +13 -13
  117. package/app-frontend/components/tree/Tree.js.map +1 -1
  118. package/app-frontend/components/tree/types.d.ts +1 -1
  119. package/app-frontend/components/tree/types.js +20 -0
  120. package/app-frontend/components/tree/types.js.map +1 -1
  121. package/app-frontend/components/treeicons.js.map +1 -1
  122. package/app-frontend/components/types.d.ts +2 -2
  123. package/app-frontend/components/types.js +20 -0
  124. package/app-frontend/components/types.js.map +1 -1
  125. package/app-frontend/core/AbstractThunder.d.ts +4 -1
  126. package/app-frontend/core/AbstractThunder.js +32 -0
  127. package/app-frontend/core/AbstractThunder.js.map +1 -1
  128. package/app-frontend/core/AppPage.d.ts +1 -1
  129. package/app-frontend/core/AppPage.js +20 -0
  130. package/app-frontend/core/AppPage.js.map +1 -1
  131. package/app-frontend/core/AppWrapper.d.ts +1 -1
  132. package/app-frontend/core/AppWrapper.js +23 -2
  133. package/app-frontend/core/AppWrapper.js.map +1 -1
  134. package/app-frontend/core/BaseComponent.d.ts +1 -2
  135. package/app-frontend/core/BaseComponent.js +18 -18
  136. package/app-frontend/core/BaseComponent.js.map +1 -1
  137. package/app-frontend/core/SimpleScriptInjector.d.ts +1 -1
  138. package/app-frontend/core/SimpleScriptInjector.js +22 -2
  139. package/app-frontend/core/SimpleScriptInjector.js.map +1 -1
  140. package/app-frontend/core/Thunder.js +27 -8
  141. package/app-frontend/core/Thunder.js.map +1 -1
  142. package/app-frontend/core/thunder-dispatcher.d.ts +5 -6
  143. package/app-frontend/core/thunder-dispatcher.js +7 -19
  144. package/app-frontend/core/thunder-dispatcher.js.map +1 -1
  145. package/app-frontend/modules/ConnectivityModule.d.ts +1 -1
  146. package/app-frontend/modules/ConnectivityModule.js +4 -4
  147. package/app-frontend/modules/ConnectivityModule.js.map +1 -1
  148. package/app-frontend/modules/ForceUpgrade.d.ts +2 -2
  149. package/app-frontend/modules/ForceUpgrade.js +25 -6
  150. package/app-frontend/modules/ForceUpgrade.js.map +1 -1
  151. package/app-frontend/modules/HistoryModule.d.ts +2 -3
  152. package/app-frontend/modules/HistoryModule.js +6 -10
  153. package/app-frontend/modules/HistoryModule.js.map +1 -1
  154. package/app-frontend/modules/ResourcesModule.d.ts +2 -2
  155. package/app-frontend/modules/ResourcesModule.js +2 -2
  156. package/app-frontend/modules/ResourcesModule.js.map +1 -1
  157. package/app-frontend/modules/StorageModule.d.ts +1 -1
  158. package/app-frontend/modules/StorageModule.js +5 -6
  159. package/app-frontend/modules/StorageModule.js.map +1 -1
  160. package/app-frontend/modules/ThunderstormModule.d.ts +2 -2
  161. package/app-frontend/modules/ThunderstormModule.js +3 -3
  162. package/app-frontend/modules/ThunderstormModule.js.map +1 -1
  163. package/app-frontend/modules/component-loader/ReactEntryComponentInjector.d.ts +3 -3
  164. package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js +20 -0
  165. package/app-frontend/modules/component-loader/ReactEntryComponentInjector.js.map +1 -1
  166. package/app-frontend/modules/component-loader/entry-component-loading-module.d.ts +1 -1
  167. package/app-frontend/modules/component-loader/entry-component-loading-module.js +25 -4
  168. package/app-frontend/modules/component-loader/entry-component-loading-module.js.map +1 -1
  169. package/app-frontend/modules/dialog/Dialog.d.ts +5 -5
  170. package/app-frontend/modules/dialog/Dialog.js +23 -1
  171. package/app-frontend/modules/dialog/Dialog.js.map +1 -1
  172. package/app-frontend/modules/dialog/DialogModule.d.ts +3 -3
  173. package/app-frontend/modules/dialog/DialogModule.js +24 -4
  174. package/app-frontend/modules/dialog/DialogModule.js.map +1 -1
  175. package/app-frontend/modules/http/HttpClient.js +20 -0
  176. package/app-frontend/modules/http/HttpClient.js.map +1 -1
  177. package/app-frontend/modules/http/XhrHttpModule.d.ts +3 -19
  178. package/app-frontend/modules/http/XhrHttpModule.js +21 -22
  179. package/app-frontend/modules/http/XhrHttpModule.js.map +1 -1
  180. package/app-frontend/modules/locale/LocaleModule.d.ts +2 -2
  181. package/app-frontend/modules/locale/LocaleModule.js +6 -7
  182. package/app-frontend/modules/locale/LocaleModule.js.map +1 -1
  183. package/app-frontend/modules/locale/types.d.ts +3 -3
  184. package/app-frontend/modules/menu/MenuAndButton.d.ts +1 -1
  185. package/app-frontend/modules/menu/MenuAndButton.js +3 -3
  186. package/app-frontend/modules/menu/MenuAndButton.js.map +1 -1
  187. package/app-frontend/modules/menu/MenuModule.d.ts +3 -3
  188. package/app-frontend/modules/menu/MenuModule.js +5 -6
  189. package/app-frontend/modules/menu/MenuModule.js.map +1 -1
  190. package/app-frontend/modules/menu/PopupMenu.d.ts +3 -3
  191. package/app-frontend/modules/menu/PopupMenu.js +4 -4
  192. package/app-frontend/modules/menu/PopupMenu.js.map +1 -1
  193. package/app-frontend/modules/routing/RoutingModule.d.ts +4 -4
  194. package/app-frontend/modules/routing/RoutingModule.js +25 -6
  195. package/app-frontend/modules/routing/RoutingModule.js.map +1 -1
  196. package/app-frontend/modules/routing/route.d.ts +1 -1
  197. package/app-frontend/modules/routing/route.js +20 -0
  198. package/app-frontend/modules/routing/route.js.map +1 -1
  199. package/app-frontend/modules/toaster/BaseToaster.d.ts +4 -4
  200. package/app-frontend/modules/toaster/BaseToaster.js +22 -0
  201. package/app-frontend/modules/toaster/BaseToaster.js.map +1 -1
  202. package/app-frontend/modules/toaster/Toaster.js +20 -0
  203. package/app-frontend/modules/toaster/Toaster.js.map +1 -1
  204. package/app-frontend/modules/toaster/ToasterModule.d.ts +5 -5
  205. package/app-frontend/modules/toaster/ToasterModule.js +28 -8
  206. package/app-frontend/modules/toaster/ToasterModule.js.map +1 -1
  207. package/app-frontend/modules/tooltip/Tooltip.d.ts +2 -2
  208. package/app-frontend/modules/tooltip/Tooltip.js +22 -2
  209. package/app-frontend/modules/tooltip/Tooltip.js.map +1 -1
  210. package/app-frontend/modules/tooltip/TooltipModule.d.ts +3 -3
  211. package/app-frontend/modules/tooltip/TooltipModule.js +25 -6
  212. package/app-frontend/modules/tooltip/TooltipModule.js.map +1 -1
  213. package/app-frontend/tools/KeyboardListener.d.ts +1 -1
  214. package/app-frontend/tools/KeyboardListener.js +17 -0
  215. package/app-frontend/tools/KeyboardListener.js.map +1 -1
  216. package/app-frontend/tools/Stylable.d.ts +1 -1
  217. package/app-frontend/tools/Stylable.js +20 -0
  218. package/app-frontend/tools/Stylable.js.map +1 -1
  219. package/app-frontend/types/renderer-map.js +21 -1
  220. package/app-frontend/types/renderer-map.js.map +1 -1
  221. package/app-frontend/utils/tools.js +23 -3
  222. package/app-frontend/utils/tools.js.map +1 -1
  223. package/app-frontend/widgets/FieldEditor.d.ts +1 -1
  224. package/app-frontend/widgets/FieldEditorClick.d.ts +2 -2
  225. package/app-frontend/widgets/FieldEditorClick.js +3 -3
  226. package/app-frontend/widgets/FieldEditorClick.js.map +1 -1
  227. package/app-frontend/widgets/FieldEditorWithButtons.d.ts +2 -2
  228. package/app-frontend/widgets/FieldEditorWithButtons.js +3 -3
  229. package/app-frontend/widgets/FieldEditorWithButtons.js.map +1 -1
  230. package/app-frontend/widgets/click-to-drag/ClickToDrag.d.ts +2 -2
  231. package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.d.ts +2 -2
  232. package/app-frontend/widgets/click-to-drag/OverlayWithDocumentListener.js.map +1 -1
  233. package/backend-test.d.ts +1 -0
  234. package/backend-test.js +38 -0
  235. package/backend-test.js.map +1 -0
  236. package/backend.d.ts +17 -0
  237. package/backend.js +54 -0
  238. package/backend.js.map +1 -0
  239. package/frontend.d.ts +54 -0
  240. package/frontend.js +91 -0
  241. package/frontend.js.map +1 -0
  242. package/index.d.ts +6 -0
  243. package/index.js +41 -0
  244. package/index.js.map +1 -1
  245. package/package.json +9 -9
  246. package/shared/BaseHttpModule.d.ts +4 -6
  247. package/shared/BaseHttpModule.js +5 -6
  248. package/shared/BaseHttpModule.js.map +1 -1
  249. package/shared/BaseHttpRequest.d.ts +5 -7
  250. package/shared/BaseHttpRequest.js +12 -13
  251. package/shared/BaseHttpRequest.js.map +1 -1
  252. package/shared/consts.d.ts +1 -1
  253. package/shared/consts.js +20 -0
  254. package/shared/consts.js.map +1 -1
  255. package/shared/force-upgrade.d.ts +2 -2
  256. package/shared/force-upgrade.js +20 -0
  257. package/shared/force-upgrade.js.map +1 -1
  258. package/shared/request-types.d.ts +5 -5
  259. package/shared/request-types.js +21 -1
  260. package/shared/request-types.js.map +1 -1
  261. package/shared/types.d.ts +12 -11
  262. package/shared/types.js +21 -1
  263. package/shared/types.js.map +1 -1
  264. package/test-backend/StormTester.js +27 -7
  265. package/test-backend/StormTester.js.map +1 -1
  266. package/test-frontend/ThunderTester.js +20 -0
  267. package/test-frontend/ThunderTester.js.map +1 -1
  268. package/app-frontend/components/playground/Example_NewProps.d.ts +0 -23
  269. package/app-frontend/components/playground/Example_NewProps.js +0 -43
  270. package/app-frontend/components/playground/Example_NewProps.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SlackModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/SlackModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qFAAuI;AACvI,qEAAkE;AAClE,wFAAgG;AAChG,4CAA6E;AA6B7E,MAAa,iBACT,SAAQ,eAAkB;IAI1B;QACI,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D,MAAa,0BACT,SAAQ,kBAAsB;IAE9B;QACI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QAC9B,IAAI,CAAC,gBAAgB,CAAC,EAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,+BAAmB,CAAC,IAAI,EAAC,CAAC,CAAA;IAC5E,CAAC;IAES,IAAI;IACd,CAAC;IAEK,yBAAyB,CAAC,UAA+B,EAAE,MAAc,EAAE,OAAe;;YAC5F,IAAI,uCAA2B,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,uCAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAC3G,OAAO;YAEX,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;gBAC1C,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACrB,OAAM;YACd,CAAC;YAED,MAAM,mBAAW,CAAC,WAAW,CAAC,SAAS,OAAO,QAAQ,CAAC,CAAC;QAC5D,CAAC;KAAA;CACJ;AAtBD,gEAsBC;AAEY,QAAA,oBAAoB,GAAG,IAAI,0BAA0B,EAAE,CAAC"}
@@ -0,0 +1,10 @@
1
+ export * from "./server/server-api";
2
+ export * from "./server/HttpServer";
3
+ export * from "./proxy/RemoteProxyCaller";
4
+ export * from "./proxy/RemoteProxy";
5
+ export * from "../exceptions";
6
+ export * from "../utils/promisify-request";
7
+ export * from "../utils/to-be-removed";
8
+ export * from "./CleanupScheduler";
9
+ export * from "./FirestoreBackupScheduler";
10
+ export * from "../../index";
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /*
3
+ * Thunderstorm is a full web app framework!
4
+ *
5
+ * Typescript & Express backend infrastructure that natively runs on firebase function
6
+ * Typescript & React frontend infrastructure
7
+ *
8
+ * Copyright (C) 2020 Intuition Robotics
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ __exportStar(require("./server/server-api"), exports);
38
+ __exportStar(require("./server/HttpServer"), exports);
39
+ __exportStar(require("./proxy/RemoteProxyCaller"), exports);
40
+ __exportStar(require("./proxy/RemoteProxy"), exports);
41
+ __exportStar(require("../exceptions"), exports);
42
+ __exportStar(require("../utils/promisify-request"), exports);
43
+ __exportStar(require("../utils/to-be-removed"), exports);
44
+ __exportStar(require("./CleanupScheduler"), exports);
45
+ __exportStar(require("./FirestoreBackupScheduler"), exports);
46
+ __exportStar(require("../../index"), exports);
47
+ //# sourceMappingURL=_imports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_imports.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/_imports.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;AAEH,sDAAoC;AACpC,sDAAoC;AAEpC,4DAA0C;AAC1C,sDAAoC;AAEpC,gDAA8B;AAC9B,6DAA2C;AAC3C,yDAAuC;AAEvC,qDAAmC;AACnC,6DAA2C;AAE3C,8CAA4B"}
@@ -1,30 +1,20 @@
1
- import { ApiTypeBinder, DeriveErrorType, ErrorResponse, HttpMethod } from "../../../shared/types";
1
+ import { ApiTypeBinder, HttpMethod, QueryParams } from "../../../shared/types";
2
2
  import { BaseHttpRequest } from "../../../shared/BaseHttpRequest";
3
- import { BaseHttpModule_Class } from "../../../shared/BaseHttpModule";
3
+ import { BaseHttpModule_Class, HttpConfig } from "../../../shared/BaseHttpModule";
4
4
  import { Axios_RequestConfig } from "./types";
5
5
  export declare class AxiosHttpModule_Class extends BaseHttpModule_Class {
6
6
  private requestOption;
7
7
  constructor(name?: string);
8
8
  init(): void;
9
- createRequest<Binder extends ApiTypeBinder<any, any, any, any>>(method: HttpMethod, key: string, data?: string): AxiosHttpRequest<DeriveRealBinder<Binder>>;
9
+ createRequest<Binder extends ApiTypeBinder<U, R, B, P, E>, U extends string = Binder["url"], R = Binder["response"], B = Binder["body"], P extends QueryParams = Binder["queryParams"], E extends void | object = Binder["error"]>(method: HttpMethod, key: string, data?: string): BaseHttpRequest<Binder>;
10
10
  setRequestOption(requestOption: Axios_RequestConfig): this;
11
11
  downloadFile(url: string, outputFile: string, key?: string): Promise<string>;
12
12
  }
13
- export declare type DeriveRealBinder<Binder> = Binder extends ApiTypeBinder<infer U, infer R, infer B, infer P> ? ApiTypeBinder<U, R, B, P> : void;
13
+ export type DeriveRealBinder<Binder> = Binder extends ApiTypeBinder<infer U, infer R, infer B, infer P> ? ApiTypeBinder<U, R, B, P> : void;
14
14
  export declare const AxiosHttpModule: AxiosHttpModule_Class;
15
- declare class AxiosHttpRequest<Binder extends ApiTypeBinder<any, any, any, any>> extends BaseHttpRequest<Binder> {
16
- private response?;
17
- private cancelSignal;
18
- protected status?: number;
15
+ export declare class AxiosHttpClient extends BaseHttpModule_Class {
19
16
  private requestOption;
20
- constructor(requestKey: string, requestData?: string, shouldCompress?: boolean);
21
- getStatus(): number;
22
- getResponse(): any;
23
- protected resolveResponse(): any;
24
- protected abortImpl(): void;
25
- getErrorResponse(): ErrorResponse<DeriveErrorType<Binder>>;
17
+ constructor(name: string, config: HttpConfig);
18
+ createRequest<Binder extends ApiTypeBinder<U, R, B, P, E>, U extends string = Binder["url"], R = Binder["response"], B = Binder["body"], P extends QueryParams = Binder["queryParams"], E extends void | object = Binder["error"]>(method: HttpMethod, key: string, data?: string): BaseHttpRequest<Binder>;
26
19
  setRequestOption(requestOption: Axios_RequestConfig): this;
27
- protected executeImpl(): Promise<void>;
28
- getResponseHeader(headerKey: string): string | undefined;
29
20
  }
30
- export {};
@@ -9,11 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AxiosHttpModule = exports.AxiosHttpModule_Class = void 0;
13
- // noinspection TypeScriptPreferShortImport
12
+ exports.AxiosHttpClient = exports.AxiosHttpModule = exports.AxiosHttpModule_Class = void 0;
14
13
  const axios_1 = require("axios");
15
14
  const types_1 = require("../../../shared/types");
16
- const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
15
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
17
16
  const BaseHttpRequest_1 = require("../../../shared/BaseHttpRequest");
18
17
  const BaseHttpModule_1 = require("../../../shared/BaseHttpModule");
19
18
  const fs = require("fs");
@@ -68,7 +67,7 @@ class AxiosHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
68
67
  }
69
68
  getStatus() {
70
69
  if (!this.status)
71
- throw new exceptions_1.BadImplementationException('Missing status..');
70
+ throw new ts_common_1.BadImplementationException('Missing status..');
72
71
  return this.status;
73
72
  }
74
73
  getResponse() {
@@ -95,14 +94,17 @@ class AxiosHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
95
94
  if (this.aborted)
96
95
  return resolve();
97
96
  let nextOperator = this.url.indexOf("?") === -1 ? "?" : "&";
98
- const fullUrl = Object.keys(this.params).reduce((url, paramKey) => {
99
- const param = this.params[paramKey];
100
- if (!param)
101
- return url;
102
- const toRet = `${url}${nextOperator}${paramKey}=${encodeURIComponent(param)}`;
103
- nextOperator = "&";
104
- return toRet;
105
- }, this.url);
97
+ let fullUrl = this.url;
98
+ const params = this.params;
99
+ if (params)
100
+ fullUrl = (0, ts_common_1._keys)(params).reduce((url, paramKey) => {
101
+ const param = params[paramKey];
102
+ if (!param)
103
+ return url;
104
+ const toRet = `${url}${nextOperator}${String(paramKey)}=${encodeURIComponent(param)}`;
105
+ nextOperator = "&";
106
+ return toRet;
107
+ }, this.url);
106
108
  // TODO set progress listener
107
109
  // this.xhr.upload.onprogress = this.onProgressListener;
108
110
  const body = this.body;
@@ -137,18 +139,16 @@ class AxiosHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
137
139
  return resolve();
138
140
  }
139
141
  catch (e) {
140
- // console.log('In catch');
141
- // TODO handle this here
142
- // if (xhr.readyState === 4 && xhr.status === 0) {
143
- // reject(new HttpException(404, this.url));
144
- // return;
145
- // }
142
+ if (!(e instanceof axios_1.default.AxiosError)) {
143
+ this.status = 500;
144
+ return reject(e);
145
+ }
146
146
  if (axios_1.default.isCancel(e)) {
147
147
  // Should already be set when I abort but just in case its aborted somehow else
148
148
  this.aborted = true;
149
149
  console.log('Api cancelled: ', e.message);
150
150
  }
151
- this.response = e.response;
151
+ this.response = e["response"];
152
152
  this.status = ((_b = this.response) === null || _b === void 0 ? void 0 : _b.status) || 500;
153
153
  return reject(e);
154
154
  }
@@ -156,8 +156,35 @@ class AxiosHttpRequest extends BaseHttpRequest_1.BaseHttpRequest {
156
156
  }
157
157
  getResponseHeader(headerKey) {
158
158
  if (!this.response)
159
- throw new exceptions_1.BadImplementationException(`axios didn't return yet`);
159
+ throw new ts_common_1.BadImplementationException(`axios didn't return yet`);
160
160
  return this.response.headers[headerKey];
161
161
  }
162
162
  }
163
+ class AxiosHttpClient extends BaseHttpModule_1.BaseHttpModule_Class {
164
+ constructor(name, config) {
165
+ super(name);
166
+ this.requestOption = {};
167
+ this.setConfig(config);
168
+ super.init();
169
+ const origin = this.config.origin;
170
+ if (origin)
171
+ this.origin = origin;
172
+ }
173
+ createRequest(method, key, data) {
174
+ return new AxiosHttpRequest(key, data, this.shouldCompress())
175
+ .setOrigin(this.origin)
176
+ .setMethod(method)
177
+ .setTimeout(this.timeout)
178
+ .setDefaultHeaders(this.defaultHeaders)
179
+ .setHandleRequestSuccess(this.handleRequestSuccess)
180
+ .setHandleRequestFailure(this.handleRequestFailure)
181
+ .setDefaultRequestHandler(this.processDefaultResponseHandlers)
182
+ .setRequestOption(this.requestOption);
183
+ }
184
+ setRequestOption(requestOption) {
185
+ this.requestOption = requestOption;
186
+ return this;
187
+ }
188
+ }
189
+ exports.AxiosHttpClient = AxiosHttpClient;
163
190
  //# sourceMappingURL=AxiosHttpModule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AxiosHttpModule.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/http/AxiosHttpModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA2C;AAC3C,iCAA0B;AAC1B,iDAAoH;AACpH,6EAAwF;AAExF,qEAAgE;AAChE,mEAAoE;AAEpE,yBAAyB;AAEzB,MAAa,qBACT,SAAQ,qCAAoB;IAG5B,YAAY,IAAa;QACrB,KAAK,CAAE,IAAI,IAAI,iBAAiB,CAAC,CAAC;QAH9B,kBAAa,GAAwB,EAAE,CAAC;IAIhD,CAAC;IAED,IAAI;QACA,KAAK,CAAC,IAAI,EAAE,CAAA;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,IAAI,MAAM;YACN,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED,aAAa,CAAmD,MAAkB,EAAE,GAAW,EAAE,IAAa;QAC1G,OAAO,IAAI,gBAAgB,C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,MAAkB;QACxC,KAAK,CAAC,IAAI,CAAC,CAAC;QAHR,kBAAa,GAAwB,EAAE,CAAC;QAI5C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACvB,KAAK,CAAC,IAAI,EAAE,CAAA;QACZ,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;QAClC,IAAI,MAAM;YACN,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED,aAAa,CAKkC,MAAkB,EAAE,GAAW,EAAE,IAAa;QACzF,OAAO,IAAI,gBAAgB,CAAS,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC;aAChE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;aACtB,SAAS,CAAC,MAAM,CAAC;aACjB,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC;aACxB,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC;aACtC,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC;aAClD,uBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC;aAClD,wBAAwB,CAAC,IAAI,CAAC,8BAA8B,CAAC;aAC7D,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9C,CAAC;IAED,gBAAgB,CAAC,aAAkC;QAC/C,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AAnCD,0CAmCC"}
@@ -1,6 +1,6 @@
1
1
  import { AxiosRequestConfig, AxiosResponse, CancelTokenSource, Method, ResponseType } from "axios";
2
- export declare type Axios_RequestConfig = AxiosRequestConfig;
3
- export declare type Axios_Response<T = any> = AxiosResponse<T>;
4
- export declare type Axios_CancelTokenSource = CancelTokenSource;
5
- export declare type Axios_Method = Method;
6
- export declare type Axios_ResponseType = ResponseType;
2
+ export type Axios_RequestConfig = AxiosRequestConfig;
3
+ export type Axios_Response<T = any> = AxiosResponse<T>;
4
+ export type Axios_CancelTokenSource = CancelTokenSource;
5
+ export type Axios_Method = Method;
6
+ export type Axios_ResponseType = ResponseType;
@@ -1,14 +1,13 @@
1
- import { Module } from "@intuitionrobotics/ts-common/core/module";
2
- import { ObjectTS } from "@intuitionrobotics/ts-common/utils/types";
1
+ import { Module, ObjectTS } from "@intuitionrobotics/ts-common";
3
2
  import { ServerApi_Middleware } from "../server/HttpServer";
4
3
  import { HttpRequestData } from "../server/server-api";
5
4
  import { ExpressRequest, QueryRequestInfo } from "../../utils/types";
6
- declare type ProxyConfig = {
5
+ type ProxyConfig = {
7
6
  extras?: ObjectTS;
8
7
  urls: string[];
9
8
  secret: string;
10
9
  };
11
- export declare type RemoteProxyConfig = {
10
+ export type RemoteProxyConfig = {
12
11
  remotes: {
13
12
  [proxyId: string]: ProxyConfig;
14
13
  };
@@ -10,11 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RemoteProxy = exports.RemoteProxy_Class = void 0;
13
- const module_1 = require("@intuitionrobotics/ts-common/core/module");
14
- const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
13
+ /*
14
+ * Thunderstorm is a full web app framework!
15
+ *
16
+ * Typescript & Express backend infrastructure that natively runs on firebase function
17
+ * Typescript & React frontend infrastructure
18
+ *
19
+ * Copyright (C) 2020 Intuition Robotics
20
+ *
21
+ * Licensed under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License.
23
+ * You may obtain a copy of the License at
24
+ *
25
+ * http://www.apache.org/licenses/LICENSE-2.0
26
+ *
27
+ * Unless required by applicable law or agreed to in writing, software
28
+ * distributed under the License is distributed on an "AS IS" BASIS,
29
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
+ * See the License for the specific language governing permissions and
31
+ * limitations under the License.
32
+ */
33
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
15
34
  const HttpServer_1 = require("../server/HttpServer");
16
- const exceptions_2 = require("../../exceptions");
17
- class RemoteProxy_Class extends module_1.Module {
35
+ const exceptions_1 = require("../../exceptions");
36
+ class RemoteProxy_Class extends ts_common_1.Module {
18
37
  constructor() {
19
38
  super("RemoteProxy");
20
39
  this.Middleware = (request) => __awaiter(this, void 0, void 0, function* () {
@@ -44,7 +63,7 @@ class RemoteProxy_Class extends module_1.Module {
44
63
  }
45
64
  init() {
46
65
  if (!this.config)
47
- throw new exceptions_1.ImplementationMissingException("MUST specify config for this module!!");
66
+ throw new ts_common_1.ImplementationMissingException("MUST specify config for this module!!");
48
67
  if (!this.config.secretHeaderName)
49
68
  this.config.secretHeaderName = 'x-secret';
50
69
  if (!this.config.proxyHeaderName)
@@ -54,21 +73,21 @@ class RemoteProxy_Class extends module_1.Module {
54
73
  }
55
74
  assertSecret(request) {
56
75
  if (!this.secretHeader || !this.proxyHeader)
57
- throw new exceptions_1.ImplementationMissingException("MUST add RemoteProxy to your module list!!!");
76
+ throw new ts_common_1.ImplementationMissingException("MUST add RemoteProxy to your module list!!!");
58
77
  const secret = this.getSecretHeader(request);
59
78
  const proxyId = this.getProxyHeader(request);
60
79
  const expectedSecret = this.config.remotes[proxyId];
61
80
  if (!proxyId)
62
- throw new exceptions_2.ApiException(403, `Missing proxy declaration in config for ${proxyId} !!`);
81
+ throw new exceptions_1.ApiException(403, `Missing proxy declaration in config for ${proxyId} !!`);
63
82
  if (!secret)
64
- throw new exceptions_2.ApiException(403, `Missing secret !!`);
83
+ throw new exceptions_1.ApiException(403, `Missing secret !!`);
65
84
  if (!expectedSecret)
66
- throw new exceptions_2.ApiException(403, `ProxyId '${proxyId}' is not registered for remote access !!`);
85
+ throw new exceptions_1.ApiException(403, `ProxyId '${proxyId}' is not registered for remote access !!`);
67
86
  if (expectedSecret.secret !== secret)
68
- throw new exceptions_2.ApiException(403, `Secret does not match for proxyId: ${proxyId}`);
87
+ throw new exceptions_1.ApiException(403, `Secret does not match for proxyId: ${proxyId}`);
69
88
  const requestUrl = request.path;
70
89
  if (!expectedSecret.urls || !expectedSecret.urls.includes(requestUrl))
71
- throw new exceptions_2.ApiException(403, `Requested url '${requestUrl}' is not allowed from proxyId: ${proxyId}`);
90
+ throw new exceptions_1.ApiException(403, `Requested url '${requestUrl}' is not allowed from proxyId: ${proxyId}`);
72
91
  return expectedSecret.extras;
73
92
  }
74
93
  processApi(request, requestData) {
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProxy.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAAgE;AAEhE,6EAA4F;AAE5F,qDAAqE;AACrE,iDAA8C;AAiB9C,MAAa,iBACT,SAAQ,eAAc;IAGtB;QACI,KAAK,CAAC,aAAa,CAAC,CAAC;QAuBhB,eAAU,GAAyB,CAAO,OAAuB,EAAE,EAAE;YAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAC1C,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAC,CAAA;QAC1D,CAAC,CAAA,CAAC;IAzBF,CAAC;IAEK,kBAAkB,CAAC,OAAuB;;YAC5C,IAAI,IAAwB,CAAC;YAC7B,IAAI;gBACA,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;aACvC;YAAC,OAAO,CAAC,EAAE;aACX;YACD,OAAO;gBACH,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE;gBACnB,IAAI;aACP,CAAC;QACN,CAAC;KAAA;IAED,cAAc,CAAC,OAAuB;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEO,eAAe,CAAC,OAAuB;QAC3C,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAC1C,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C,OAAO,KAAK,CAAC,CAAC;QAEzF,IAAI,CAAC,MAAM;YACP,MAAM,IAAI,yBAAY,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QAErD,IAAI,CAAC,cAAc;YACf,MAAM,IAAI,yBAAY,CAAC,GAAG,EAAE,YAAY,OAAO,0CAA0C,CAAC,CAAC;QAE/F,IAAI,cAAc,CAAC,MAAM,KAAK,MAAM;YAChC,MAAM,IAAI,yBAAY,CAAC,GAAG,EAAE,sCAAsC,OAAO,EAAE,CAAC,CAAC;QAEjF,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;QAChC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;YACjE,MAAM,IAAI,yBAAY,CAAC,GAAG,EAAE,kBAAkB,UAAU,kCAAkC,OAAO,EAAE,CAAC,CAAC;QAEzG,OAAO,cAAc,CAAC,MAAM,CAAC;IACjC,CAAC;IAEK,UAAU,CAAC,OAAuB,EAAE,WAA4B;;YAClE,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC;KAAA;CACJ;AAjFD,8CAiFC;AAEY,QAAA,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
- import { Module } from "@intuitionrobotics/ts-common/core/module";
2
- import { DeriveBodyType, DeriveQueryType, DeriveResponseType, DeriveUrlType, QueryParams } from "../../../shared/types";
1
+ import { Module } from "@intuitionrobotics/ts-common";
2
+ import { ApiWithBody, ApiWithQuery, QueryParams } from "../../../shared/types";
3
3
  import { AxiosResponse } from "axios";
4
- export declare type RemoteServerConfig = {
4
+ export type RemoteServerConfig = {
5
5
  secretHeaderName: string;
6
6
  proxyHeaderName: string;
7
7
  proxyId: string;
@@ -11,16 +11,16 @@ export declare type RemoteServerConfig = {
11
11
  export declare abstract class RemoteProxyCaller<Config extends RemoteServerConfig> extends Module<Config> {
12
12
  constructor(name: string);
13
13
  protected init(): void;
14
- protected executeGetRequest: <Binder extends import("../../../shared/types").ApiTypeBinder<U, R, void, P, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, P extends QueryParams = DeriveQueryType<Binder>>(url: U, _params: P, _headers?: {
14
+ protected executeGetRequest: <Binder extends ApiWithQuery<U, R, P>, U extends string = Binder["url"], R = Binder["response"], P extends QueryParams = Binder["queryParams"]>(url: U, _params: P, _headers?: {
15
15
  [key: string]: string;
16
16
  } | undefined) => Promise<R>;
17
- protected executeGetRequestImpl: <Binder extends import("../../../shared/types").ApiTypeBinder<U, R, void, P, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, P extends QueryParams = DeriveQueryType<Binder>>(url: U, _params: P, _headers?: {
17
+ protected executeGetRequestImpl: <Binder extends ApiWithQuery<U, R, P>, U extends string = Binder["url"], R = Binder["response"], P extends QueryParams = Binder["queryParams"]>(url: U, _params: P, _headers?: {
18
18
  [key: string]: string;
19
19
  } | undefined) => Promise<AxiosResponse<R, any>>;
20
- protected executePostRequest: <Binder extends import("../../../shared/types").ApiTypeBinder<U, B, R, {}, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, B = DeriveBodyType<Binder>>(url: U, body: B, _headers?: {
20
+ protected executePostRequest: <Binder extends ApiWithBody<U, R, B>, U extends string = Binder["url"], R = Binder["response"], B = Binder["body"]>(url: U, body: B, _headers?: {
21
21
  [key: string]: string;
22
22
  } | undefined) => Promise<R>;
23
- protected executePostRequestImpl: <Binder extends import("../../../shared/types").ApiTypeBinder<U, B, R, {}, any>, U extends string = DeriveUrlType<Binder>, R = DeriveResponseType<Binder>, B = DeriveBodyType<Binder>>(url: U, body: B, _headers?: {
23
+ protected executePostRequestImpl: <Binder extends ApiWithBody<U, R, B>, U extends string = Binder["url"], R = Binder["response"], B = Binder["body"]>(url: U, body: B, _headers?: {
24
24
  [key: string]: string;
25
25
  } | undefined) => Promise<AxiosResponse<R, any>>;
26
26
  private executeRequest;
@@ -10,12 +10,30 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.RemoteProxyCaller = void 0;
13
- const module_1 = require("@intuitionrobotics/ts-common/core/module");
14
- const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
15
- const tools_1 = require("@intuitionrobotics/ts-common/utils/tools");
13
+ /*
14
+ * Thunderstorm is a full web app framework!
15
+ *
16
+ * Typescript & Express backend infrastructure that natively runs on firebase function
17
+ * Typescript & React frontend infrastructure
18
+ *
19
+ * Copyright (C) 2020 Intuition Robotics
20
+ *
21
+ * Licensed under the Apache License, Version 2.0 (the "License");
22
+ * you may not use this file except in compliance with the License.
23
+ * You may obtain a copy of the License at
24
+ *
25
+ * http://www.apache.org/licenses/LICENSE-2.0
26
+ *
27
+ * Unless required by applicable law or agreed to in writing, software
28
+ * distributed under the License is distributed on an "AS IS" BASIS,
29
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30
+ * See the License for the specific language governing permissions and
31
+ * limitations under the License.
32
+ */
33
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
16
34
  const promisify_request_1 = require("../../utils/promisify-request");
17
- const exceptions_2 = require("../../exceptions");
18
- class RemoteProxyCaller extends module_1.Module {
35
+ const exceptions_1 = require("../../exceptions");
36
+ class RemoteProxyCaller extends ts_common_1.Module {
19
37
  // noinspection TypeScriptAbstractClassConstructorCanBeMadeProtected
20
38
  constructor(name) {
21
39
  super(name);
@@ -53,7 +71,7 @@ class RemoteProxyCaller extends module_1.Module {
53
71
  return this.executeRequest(proxyRequest);
54
72
  });
55
73
  this.executeRequest = (proxyRequest) => __awaiter(this, void 0, void 0, function* () {
56
- const response = yield promisify_request_1.promisifyRequest(proxyRequest);
74
+ const response = yield (0, promisify_request_1.promisifyRequest)(proxyRequest);
57
75
  if (proxyRequest.headers) {
58
76
  delete proxyRequest.headers[this.config.secretHeaderName];
59
77
  delete proxyRequest.headers["Authorization"];
@@ -63,9 +81,9 @@ class RemoteProxyCaller extends module_1.Module {
63
81
  if (statusCode < 200 || statusCode >= 300) {
64
82
  const errorResponse = response.data;
65
83
  if (!errorResponse)
66
- throw new exceptions_2.ApiException(500, `Extraneous error ${tools_1.__stringify(response)}, Proxy Request: ${tools_1.__stringify(proxyRequest, true)}`);
84
+ throw new exceptions_1.ApiException(500, `Extraneous error ${(0, ts_common_1.__stringify)(response)}, Proxy Request: ${(0, ts_common_1.__stringify)(proxyRequest, true)}`);
67
85
  const debugMessage = typeof errorResponse === 'object' ? errorResponse['debugMessage'] : errorResponse;
68
- const e = new exceptions_2.ApiException(response.status, `Redirect proxy error: ${debugMessage} \n Proxy Request: ${tools_1.__stringify(proxyRequest, true)}`);
86
+ const e = new exceptions_1.ApiException(response.status, `Redirect proxy error: ${debugMessage} \n Proxy Request: ${(0, ts_common_1.__stringify)(proxyRequest, true)}`);
69
87
  if (errorResponse.error)
70
88
  e.setErrorBody(errorResponse.error);
71
89
  throw e;
@@ -75,13 +93,13 @@ class RemoteProxyCaller extends module_1.Module {
75
93
  }
76
94
  init() {
77
95
  if (!this.config)
78
- throw new exceptions_1.ImplementationMissingException("MUST specify config for this module!!");
96
+ throw new ts_common_1.ImplementationMissingException(`MUST specify config for ${this.getName()}`);
79
97
  if (!this.config.proxyId)
80
- throw new exceptions_1.ImplementationMissingException("MUST specify the proxyId for the proxy caller!!");
98
+ throw new ts_common_1.ImplementationMissingException(`MUST specify the proxyId for ${this.getName()}`);
81
99
  if (!this.config.url)
82
- throw new exceptions_1.ImplementationMissingException("MUST specify the url for the remote server!!");
100
+ throw new ts_common_1.ImplementationMissingException(`MUST specify the url for the remote server for ${this.getName()}`);
83
101
  if (!this.config.secret)
84
- throw new exceptions_1.ImplementationMissingException("MUST specify the secret for the remote server!!");
102
+ throw new ts_common_1.ImplementationMissingException(`MUST specify the secret for the remote server for ${this.getName()}`);
85
103
  if (!this.config.secretHeaderName)
86
104
  this.config.secretHeaderName = 'x-secret';
87
105
  if (!this.config.proxyHeaderName)
@@ -1 +1 @@
1
- {"version":3,"file":"RemoteProxyCaller.js","sourceRoot":"","sources":["../../../../src/main/app-backend/modules/proxy/RemoteProxyCaller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qEAAgE;AAChE,6EAA4F;AAC5F,oEAAqE;AAUrE,qEAA+D;AAC/D,iDAA8C;AAW9C,MAAsB,iBAClB,SAAQ,eAAc;IAEtB,oEAAoE;IACpE,YAAY,IAAY;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;QAuBN,sBAAiB,GAAG,CAAwK,GAAM,EAAE,OAAU,EAAE,QAEzN,EAAc,EAAE;YACb,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC,IAAS,CAAC;QAC1B,CAAC,CAAA,CAAC;QAEQ,0BAAqB,GAAG,CAAwK,GAAM,EAAE,OAAU,EAAE,QAE7N,EAA6B,EAAE;YAC5B,MAAM,MAAM,GAAG,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBACvD,OAAO,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,CAAC,CAAC,CAAC;YAEH,IAAI,SAAS,GAAG,EAAE,CAAC;YACnB,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;gBAC3B,SAAS,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAEvC,MAAM,YAAY,GAAuB;gBACrC,OAAO,kCACA,QAAQ,KACX,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAClD,CAAC,IAAI,CAAC,MAAM,C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;QACpB,CAAC,CAAA,CAAC;IAzGF,CAAC;IAES,IAAI;QACV,IAAI,CAAC,IAAI,CAAC,MAAM;YACZ,MAAM,IAAI,0CAA8B,CAAC,2BAA2B,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAE1F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO;YACpB,MAAM,IAAI,0CAA8B,CAAC,gCAAgC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAE/F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG;YAChB,MAAM,IAAI,0CAA8B,CAAC,kDAAkD,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEjH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;YACnB,MAAM,IAAI,0CAA8B,CAAC,qDAAqD,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAEpH,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB;YAC7B,IAAI,CAAC,MAAM,CAAC,gBAAgB,GAAG,UAAU,CAAC;QAE9C,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,eAAe;YAC5B,IAAI,CAAC,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;IAChD,CAAC;CAsFJ;AAhHD,8CAgHC"}
@@ -1,10 +1,9 @@
1
1
  /// <reference types="node" />
2
+ import { Module, ObjectTS } from "@intuitionrobotics/ts-common";
2
3
  import { ApiResponse, HttpRequestData, ServerApi } from "./server-api";
3
4
  import { ApiException } from "../../exceptions";
4
5
  import { Express, ExpressRequest, ExpressRequestHandler } from "../../utils/types";
5
- import { ObjectTS } from '@intuitionrobotics/ts-common/utils/types';
6
- import { Module } from '@intuitionrobotics/ts-common/core/module';
7
- declare type ConfigType = {
6
+ type ConfigType = {
8
7
  port: number;
9
8
  baseUrl: string;
10
9
  cors: {
@@ -19,9 +18,9 @@ declare type ConfigType = {
19
18
  };
20
19
  bodyParserLimit: number | string;
21
20
  };
22
- export declare type HttpErrorHandler = (requestData: HttpRequestData, error: ApiException) => Promise<string>;
23
- export declare type ServerApi_Middleware = (request: ExpressRequest, data: HttpRequestData, response: ApiResponse, scopes: string[]) => Promise<ObjectTS | void>;
24
- declare type HttpRoute = {
21
+ export type HttpErrorHandler = (requestData: HttpRequestData, error: ApiException) => Promise<string>;
22
+ export type ServerApi_Middleware = (request: ExpressRequest, data: HttpRequestData, response: ApiResponse, scopes: string[]) => Promise<ObjectTS | void>;
23
+ type HttpRoute = {
25
24
  methods: string[];
26
25
  path: string;
27
26
  };
@@ -1,4 +1,24 @@
1
1
  "use strict";
2
+ /*
3
+ * Thunderstorm is a full web app framework!
4
+ *
5
+ * Typescript & Express backend infrastructure that natively runs on firebase function
6
+ * Typescript & React frontend infrastructure
7
+ *
8
+ * Copyright (C) 2020 Intuition Robotics
9
+ *
10
+ * Licensed under the Apache License, Version 2.0 (the "License");
11
+ * you may not use this file except in compliance with the License.
12
+ * You may obtain a copy of the License at
13
+ *
14
+ * http://www.apache.org/licenses/LICENSE-2.0
15
+ *
16
+ * Unless required by applicable law or agreed to in writing, software
17
+ * distributed under the License is distributed on an "AS IS" BASIS,
18
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ * See the License for the specific language governing permissions and
20
+ * limitations under the License.
21
+ */
2
22
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
23
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
24
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -10,15 +30,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
30
  };
11
31
  Object.defineProperty(exports, "__esModule", { value: true });
12
32
  exports.HeaderKey = exports.RouteResolver = exports.HttpServer_Class = void 0;
33
+ /**
34
+ * Module dependencies.
35
+ */
13
36
  const compression = require("compression");
14
37
  const fs = require("fs");
38
+ const ts_common_1 = require("@intuitionrobotics/ts-common");
15
39
  const server_api_1 = require("./server-api");
16
40
  const exceptions_1 = require("../../exceptions");
17
41
  const express = require("express");
18
42
  const server_errors_1 = require("./server-errors");
19
- const module_1 = require("@intuitionrobotics/ts-common/core/module");
20
- const types_1 = require("@intuitionrobotics/ts-common/core/logger/types");
21
- const consts_1 = require("../../../shared/consts");
43
+ const _imports_1 = require("../_imports");
22
44
  const ALL_Methods = [
23
45
  'GET',
24
46
  'PUT',
@@ -34,13 +56,13 @@ const DefaultHeaders = [
34
56
  'authorization'
35
57
  ];
36
58
  const ExposedHeaders = [
37
- consts_1.HeaderKey_FunctionExecutionId,
38
- consts_1.HeaderKey_JWT
59
+ _imports_1.HeaderKey_FunctionExecutionId,
60
+ _imports_1.HeaderKey_JWT
39
61
  ];
40
- class HttpServer_Class extends module_1.Module {
62
+ class HttpServer_Class extends ts_common_1.Module {
41
63
  constructor(_express) {
42
64
  super("HttpServer");
43
- this.errorMessageComposer = server_errors_1.DefaultApiErrorMessageComposer();
65
+ this.errorMessageComposer = (0, server_errors_1.DefaultApiErrorMessageComposer)();
44
66
  this.express = _express;
45
67
  }
46
68
  setErrorMessageComposer(errorMessageComposer) {
@@ -58,7 +80,7 @@ class HttpServer_Class extends module_1.Module {
58
80
  }
59
81
  init() {
60
82
  return __awaiter(this, void 0, void 0, function* () {
61
- this.setMinLevel(server_api_1.ServerApi.isDebug ? types_1.LogLevel.Verbose : types_1.LogLevel.Info);
83
+ this.setMinLevel(server_api_1.ServerApi.isDebug ? ts_common_1.LogLevel.Verbose : ts_common_1.LogLevel.Info);
62
84
  const baseUrl = this.config.baseUrl;
63
85
  if (baseUrl) {
64
86
  if (baseUrl.endsWith("/"))
@@ -82,7 +104,7 @@ class HttpServer_Class extends module_1.Module {
82
104
  cors.exposedHeaders = ExposedHeaders;
83
105
  cors.headers = DefaultHeaders.reduce((toRet, item) => {
84
106
  if (!toRet.includes(item))
85
- toRet.push(item);
107
+ (0, ts_common_1.addItemToArray)(toRet, item);
86
108
  return toRet;
87
109
  }, cors.headers || []);
88
110
  const resolveCorsOrigin = (origin) => {
@@ -147,7 +169,7 @@ class HttpServer_Class extends module_1.Module {
147
169
  const routes = resolveRoutes(this.express._router.stack);
148
170
  this.routes = routes.reduce((toRet, route) => {
149
171
  const toAdd = Array.isArray(route) ? route : [route];
150
- toRet.push(...toAdd);
172
+ (0, ts_common_1.addAllItemToArray)(toRet, toAdd);
151
173
  return toRet;
152
174
  }, []);
153
175
  console.timeEnd('Resolving Apis');