@budibase/server 1.0.46-alpha.3 → 1.0.46-alpha.7

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 (221) hide show
  1. package/builder/assets/{index.6eae2fa0.js → index.af9e71d8.js} +243 -243
  2. package/builder/assets/{index.0df4f7ab.css → index.dd9e386f.css} +1 -1
  3. package/builder/assets/{vendor.10e2ad1b.js → vendor.3bd2f661.js} +1 -1
  4. package/builder/index.html +3 -3
  5. package/coverage/clover.xml +542 -551
  6. package/coverage/coverage-final.json +21 -23
  7. package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/application.js.html +179 -95
  10. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/component.js.html +4 -4
  15. package/coverage/lcov-report/api/controllers/datasource.js.html +58 -22
  16. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/index.html +27 -42
  18. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/query/index.html +15 -15
  23. package/coverage/lcov-report/api/controllers/query/index.js.html +44 -11
  24. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/index.html +5 -5
  29. package/coverage/lcov-report/api/controllers/row/index.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/row/utils.js.html +5 -14
  33. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  37. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/table/internal.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/table/utils.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  44. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  45. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  46. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  47. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  48. package/coverage/lcov-report/api/index.html +1 -1
  49. package/coverage/lcov-report/api/index.js.html +10 -10
  50. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/application.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/index.html +7 -22
  62. package/coverage/lcov-report/api/routes/index.js.html +4 -10
  63. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/row.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  73. package/coverage/lcov-report/api/routes/static.js.html +17 -2
  74. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  75. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  76. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  77. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  78. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  79. package/coverage/lcov-report/automations/actions.js.html +1 -1
  80. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  81. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  82. package/coverage/lcov-report/automations/index.html +1 -1
  83. package/coverage/lcov-report/automations/index.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/index.html +1 -1
  93. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  97. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  98. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  99. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  100. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  101. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  105. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  106. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  107. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  108. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  109. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  110. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  111. package/coverage/lcov-report/automations/utils.js.html +5 -5
  112. package/coverage/lcov-report/constants/index.html +5 -5
  113. package/coverage/lcov-report/constants/index.js.html +16 -4
  114. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  115. package/coverage/lcov-report/constants/screens.js.html +1 -1
  116. package/coverage/lcov-report/db/client.js.html +1 -1
  117. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  118. package/coverage/lcov-report/db/index.html +1 -1
  119. package/coverage/lcov-report/db/index.js.html +1 -1
  120. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  121. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  122. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  123. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  124. package/coverage/lcov-report/db/newid.js.html +2 -2
  125. package/coverage/lcov-report/db/utils.js.html +17 -17
  126. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  127. package/coverage/lcov-report/events/index.html +1 -1
  128. package/coverage/lcov-report/events/index.js.html +1 -1
  129. package/coverage/lcov-report/events/utils.js.html +1 -1
  130. package/coverage/lcov-report/index.html +58 -58
  131. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  132. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  133. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  134. package/coverage/lcov-report/middleware/authorized.js.html +11 -11
  135. package/coverage/lcov-report/middleware/builder.js.html +8 -8
  136. package/coverage/lcov-report/middleware/currentapp.js.html +34 -61
  137. package/coverage/lcov-report/middleware/index.html +10 -10
  138. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  139. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  140. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  141. package/coverage/lcov-report/middleware/usageQuota.js.html +1 -1
  142. package/coverage/lcov-report/middleware/utils.js.html +2 -2
  143. package/coverage/lcov-report/migrations/usageQuotas/index.html +1 -1
  144. package/coverage/lcov-report/migrations/usageQuotas/index.js.html +1 -1
  145. package/coverage/lcov-report/migrations/usageQuotas/syncApps.js.html +1 -1
  146. package/coverage/lcov-report/migrations/usageQuotas/syncRows.js.html +1 -1
  147. package/coverage/lcov-report/threads/automation.js.html +1 -1
  148. package/coverage/lcov-report/threads/index.html +15 -15
  149. package/coverage/lcov-report/threads/index.js.html +1 -1
  150. package/coverage/lcov-report/threads/query.js.html +23 -8
  151. package/coverage/lcov-report/threads/utils.js.html +1 -1
  152. package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
  153. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  154. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  155. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  156. package/coverage/lcov-report/utilities/global.js.html +13 -13
  157. package/coverage/lcov-report/utilities/index.html +19 -19
  158. package/coverage/lcov-report/utilities/index.js.html +4 -4
  159. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
  160. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  161. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  162. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  163. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  164. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  165. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  166. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  167. package/coverage/lcov-report/utilities/security.js.html +1 -1
  168. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  169. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  170. package/coverage/lcov-report/utilities/usageQuota/index.js.html +1 -1
  171. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  172. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  173. package/coverage/lcov-report/utilities/users.js.html +1 -1
  174. package/coverage/lcov-report/utilities/workerRequests.js.html +24 -93
  175. package/coverage/lcov.info +937 -935
  176. package/dist/api/controllers/application.js +49 -20
  177. package/dist/api/controllers/datasource.js +11 -0
  178. package/dist/api/controllers/query/index.js +11 -3
  179. package/dist/api/controllers/row/utils.js +1 -2
  180. package/dist/api/controllers/static/index.js +59 -10
  181. package/dist/api/routes/index.js +0 -2
  182. package/dist/api/routes/static.js +2 -1
  183. package/dist/constants/index.js +3 -0
  184. package/dist/definitions/datasource.js +1 -0
  185. package/dist/integrations/googlesheets.js +340 -0
  186. package/dist/integrations/index.js +3 -0
  187. package/dist/integrations/utils.js +6 -3
  188. package/dist/middleware/currentapp.js +0 -9
  189. package/dist/package.json +8 -5
  190. package/dist/tests/utilities/TestConfiguration.js +3 -1
  191. package/dist/threads/query.js +4 -0
  192. package/dist/tsconfig.tsbuildinfo +1 -1
  193. package/dist/utilities/workerRequests.js +0 -20
  194. package/nodemon.json +1 -1
  195. package/package.json +9 -6
  196. package/src/api/controllers/application.js +52 -24
  197. package/src/api/controllers/datasource.js +12 -0
  198. package/src/api/controllers/query/index.js +14 -3
  199. package/src/api/controllers/row/utils.js +1 -4
  200. package/src/api/controllers/static/index.js +63 -10
  201. package/src/api/routes/index.js +0 -2
  202. package/src/api/routes/static.js +5 -0
  203. package/src/api/routes/tests/application.spec.js +2 -2
  204. package/src/api/routes/tests/static.spec.js +98 -0
  205. package/src/constants/index.js +4 -0
  206. package/src/definitions/datasource.ts +3 -0
  207. package/src/integrations/googlesheets.ts +353 -0
  208. package/src/integrations/index.ts +3 -0
  209. package/src/integrations/utils.ts +18 -5
  210. package/src/middleware/currentapp.js +0 -9
  211. package/src/migrations/tests/usageQuotas/syncRows.spec.js +1 -1
  212. package/src/tests/utilities/TestConfiguration.js +3 -1
  213. package/src/threads/query.js +5 -0
  214. package/src/utilities/workerRequests.js +0 -23
  215. package/coverage/lcov-report/api/controllers/hosting.js.html +0 -146
  216. package/coverage/lcov-report/api/routes/hosting.js.html +0 -119
  217. package/dist/api/controllers/hosting.js +0 -30
  218. package/dist/api/routes/hosting.js +0 -11
  219. package/src/api/controllers/hosting.js +0 -22
  220. package/src/api/routes/hosting.js +0 -13
  221. package/src/api/routes/tests/hosting.spec.js +0 -36
@@ -1,119 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for api/routes/hosting.js</title>
7
- <meta charset="utf-8" />
8
- <link rel="stylesheet" href="../../prettify.css" />
9
- <link rel="stylesheet" href="../../base.css" />
10
- <link rel="shortcut icon" type="image/x-icon" href="../../favicon.png" />
11
- <meta name="viewport" content="width=device-width, initial-scale=1" />
12
- <style type='text/css'>
13
- .coverage-summary .sorter {
14
- background-image: url(../../sort-arrow-sprite.png);
15
- }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <div class='wrapper'>
21
- <div class='pad1'>
22
- <h1><a href="../../index.html">All files</a> / <a href="index.html">api/routes</a> hosting.js</h1>
23
- <div class='clearfix'>
24
-
25
- <div class='fl pad1y space-right2'>
26
- <span class="strong">100% </span>
27
- <span class="quiet">Statements</span>
28
- <span class='fraction'>7/7</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">100% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>0/0</span>
36
- </div>
37
-
38
-
39
- <div class='fl pad1y space-right2'>
40
- <span class="strong">100% </span>
41
- <span class="quiet">Functions</span>
42
- <span class='fraction'>0/0</span>
43
- </div>
44
-
45
-
46
- <div class='fl pad1y space-right2'>
47
- <span class="strong">100% </span>
48
- <span class="quiet">Lines</span>
49
- <span class='fraction'>7/7</span>
50
- </div>
51
-
52
-
53
- </div>
54
- <p class="quiet">
55
- Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
- </p>
57
- </div>
58
- <div class='status-line high'></div>
59
- <pre><table class="coverage">
60
- <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
61
- <a name='L2'></a><a href='#L2'>2</a>
62
- <a name='L3'></a><a href='#L3'>3</a>
63
- <a name='L4'></a><a href='#L4'>4</a>
64
- <a name='L5'></a><a href='#L5'>5</a>
65
- <a name='L6'></a><a href='#L6'>6</a>
66
- <a name='L7'></a><a href='#L7'>7</a>
67
- <a name='L8'></a><a href='#L8'>8</a>
68
- <a name='L9'></a><a href='#L9'>9</a>
69
- <a name='L10'></a><a href='#L10'>10</a>
70
- <a name='L11'></a><a href='#L11'>11</a>
71
- <a name='L12'></a><a href='#L12'>12</a>
72
- <a name='L13'></a><a href='#L13'>13</a>
73
- <a name='L14'></a><a href='#L14'>14</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">23x</span>
74
- <span class="cline-any cline-yes">23x</span>
75
- <span class="cline-any cline-yes">23x</span>
76
- <span class="cline-any cline-yes">23x</span>
77
- <span class="cline-any cline-neutral">&nbsp;</span>
78
- <span class="cline-any cline-yes">23x</span>
79
- <span class="cline-any cline-neutral">&nbsp;</span>
80
- <span class="cline-any cline-yes">23x</span>
81
- <span class="cline-any cline-neutral">&nbsp;</span>
82
- <span class="cline-any cline-neutral">&nbsp;</span>
83
- <span class="cline-any cline-neutral">&nbsp;</span>
84
- <span class="cline-any cline-neutral">&nbsp;</span>
85
- <span class="cline-any cline-yes">23x</span>
86
- <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const Router = require("@koa/router")
87
- const controller = require("../controllers/hosting")
88
- const authorized = require("../../middleware/authorized")
89
- const { BUILDER } = require("@budibase/backend-core/permissions")
90
- &nbsp;
91
- const router = Router()
92
- &nbsp;
93
- router
94
- .get("/api/hosting/urls", authorized(BUILDER), controller.fetchUrls)
95
- // this isn't risky, doesn't return anything about apps other than names and URLs
96
- .get("/api/hosting/apps", controller.getDeployedApps)
97
- &nbsp;
98
- module.exports = router
99
- &nbsp;</pre></td></tr></table></pre>
100
-
101
- <div class='push'></div><!-- for sticky footer -->
102
- </div><!-- /wrapper -->
103
- <div class='footer quiet pad2 space-top1 center small'>
104
- Code coverage generated by
105
- <a href="https://istanbul.js.org/" target="_blank">istanbul</a>
106
- at Fri Jan 21 2022 11:26:59 GMT+0000 (Coordinated Universal Time)
107
- </div>
108
- </div>
109
- <script src="../../prettify.js"></script>
110
- <script>
111
- window.onload = function () {
112
- prettyPrint();
113
- };
114
- </script>
115
- <script src="../../sorter.js"></script>
116
- <script src="../../block-navigation.js"></script>
117
- </body>
118
- </html>
119
-
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- const CouchDB = require("../../db");
12
- const { getDeployedApps } = require("../../utilities/workerRequests");
13
- const { getScopedConfig } = require("@budibase/backend-core/db");
14
- const { Configs } = require("@budibase/backend-core/constants");
15
- const { checkSlashesInUrl } = require("../../utilities");
16
- exports.fetchUrls = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
17
- const appId = ctx.appId;
18
- const db = new CouchDB(appId);
19
- const settings = yield getScopedConfig(db, { type: Configs.SETTINGS });
20
- let appUrl = "http://localhost:10000/app";
21
- if (settings && settings["platformUrl"]) {
22
- appUrl = checkSlashesInUrl(`${settings["platformUrl"]}/app`);
23
- }
24
- ctx.body = {
25
- app: appUrl,
26
- };
27
- });
28
- exports.getDeployedApps = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
29
- ctx.body = yield getDeployedApps();
30
- });
@@ -1,11 +0,0 @@
1
- "use strict";
2
- const Router = require("@koa/router");
3
- const controller = require("../controllers/hosting");
4
- const authorized = require("../../middleware/authorized");
5
- const { BUILDER } = require("@budibase/backend-core/permissions");
6
- const router = Router();
7
- router
8
- .get("/api/hosting/urls", authorized(BUILDER), controller.fetchUrls)
9
- // this isn't risky, doesn't return anything about apps other than names and URLs
10
- .get("/api/hosting/apps", controller.getDeployedApps);
11
- module.exports = router;
@@ -1,22 +0,0 @@
1
- const CouchDB = require("../../db")
2
- const { getDeployedApps } = require("../../utilities/workerRequests")
3
- const { getScopedConfig } = require("@budibase/backend-core/db")
4
- const { Configs } = require("@budibase/backend-core/constants")
5
- const { checkSlashesInUrl } = require("../../utilities")
6
-
7
- exports.fetchUrls = async ctx => {
8
- const appId = ctx.appId
9
- const db = new CouchDB(appId)
10
- const settings = await getScopedConfig(db, { type: Configs.SETTINGS })
11
- let appUrl = "http://localhost:10000/app"
12
- if (settings && settings["platformUrl"]) {
13
- appUrl = checkSlashesInUrl(`${settings["platformUrl"]}/app`)
14
- }
15
- ctx.body = {
16
- app: appUrl,
17
- }
18
- }
19
-
20
- exports.getDeployedApps = async ctx => {
21
- ctx.body = await getDeployedApps()
22
- }
@@ -1,13 +0,0 @@
1
- const Router = require("@koa/router")
2
- const controller = require("../controllers/hosting")
3
- const authorized = require("../../middleware/authorized")
4
- const { BUILDER } = require("@budibase/backend-core/permissions")
5
-
6
- const router = Router()
7
-
8
- router
9
- .get("/api/hosting/urls", authorized(BUILDER), controller.fetchUrls)
10
- // this isn't risky, doesn't return anything about apps other than names and URLs
11
- .get("/api/hosting/apps", controller.getDeployedApps)
12
-
13
- module.exports = router
@@ -1,36 +0,0 @@
1
- // mock out node fetch for this
2
- jest.mock("node-fetch")
3
-
4
- const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
5
- const setup = require("./utilities")
6
-
7
- describe("/hosting", () => {
8
- let request = setup.getRequest()
9
- let config = setup.getConfig()
10
- let app
11
-
12
- afterAll(setup.afterAll)
13
-
14
- beforeEach(async () => {
15
- app = await config.init()
16
- })
17
-
18
- describe("fetchUrls", () => {
19
- it("should be able to fetch current app URLs", async () => {
20
- const res = await request
21
- .get(`/api/hosting/urls`)
22
- .set(config.defaultHeaders())
23
- .expect("Content-Type", /json/)
24
- .expect(200)
25
- expect(res.body.app).toEqual(`http://localhost:10000/app`)
26
- })
27
-
28
- it("should apply authorization to endpoint", async () => {
29
- await checkBuilderEndpoint({
30
- config,
31
- method: "GET",
32
- url: `/api/hosting/urls`,
33
- })
34
- })
35
- })
36
- })