@budibase/server 1.0.190-alpha.0 → 1.0.191

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 (196) hide show
  1. package/builder/assets/{index.8a6f249b.css → index.bb5e3dfd.css} +2 -2
  2. package/builder/assets/index.dae59da9.js +1299 -0
  3. package/builder/assets/{vendor.9bf2fcb4.js → vendor.5240f480.js} +53 -53
  4. package/builder/index.html +3 -3
  5. package/coverage/clover.xml +93 -86
  6. package/coverage/coverage-final.json +11 -11
  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/auth.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/component.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/index.html +15 -15
  17. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/migrations.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 +1 -1
  23. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/bulkFormula.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/templates.js.html +9 -12
  39. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/exporters.js.html +3 -3
  41. package/coverage/lcov-report/api/controllers/view/index.html +4 -4
  42. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  44. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  45. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  46. package/coverage/lcov-report/api/index.html +10 -10
  47. package/coverage/lcov-report/api/index.js.html +13 -7
  48. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/index.html +1 -1
  59. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  73. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  74. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  75. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  76. package/coverage/lcov-report/automations/actions.js.html +1 -1
  77. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  78. package/coverage/lcov-report/automations/bullboard.js.html +33 -9
  79. package/coverage/lcov-report/automations/index.html +26 -26
  80. package/coverage/lcov-report/automations/index.js.html +24 -9
  81. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/index.html +14 -14
  88. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/queryRows.js.html +2 -5
  92. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +7 -10
  93. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  97. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  105. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  106. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  107. package/coverage/lcov-report/constants/index.html +1 -1
  108. package/coverage/lcov-report/constants/index.js.html +1 -1
  109. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  110. package/coverage/lcov-report/constants/screens.js.html +1 -1
  111. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  112. package/coverage/lcov-report/db/index.html +1 -1
  113. package/coverage/lcov-report/db/index.js.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  116. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  117. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  118. package/coverage/lcov-report/db/newid.js.html +1 -1
  119. package/coverage/lcov-report/db/utils.js.html +4 -4
  120. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  121. package/coverage/lcov-report/events/index.html +1 -1
  122. package/coverage/lcov-report/events/index.js.html +1 -1
  123. package/coverage/lcov-report/events/utils.js.html +1 -1
  124. package/coverage/lcov-report/index.html +65 -65
  125. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  126. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  127. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  128. package/coverage/lcov-report/middleware/builder.js.html +10 -43
  129. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  130. package/coverage/lcov-report/middleware/index.html +14 -14
  131. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  132. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  133. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  134. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  135. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  136. package/coverage/lcov-report/threads/automation.js.html +1 -1
  137. package/coverage/lcov-report/threads/index.html +1 -1
  138. package/coverage/lcov-report/threads/query.js.html +1 -1
  139. package/coverage/lcov-report/threads/utils.js.html +1 -1
  140. package/coverage/lcov-report/utilities/budibaseDir.js.html +32 -11
  141. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  142. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  143. package/coverage/lcov-report/utilities/global.js.html +1 -1
  144. package/coverage/lcov-report/utilities/index.html +19 -19
  145. package/coverage/lcov-report/utilities/index.js.html +1 -1
  146. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +29 -8
  147. package/coverage/lcov-report/utilities/queue/index.html +15 -15
  148. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  149. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  150. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  151. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  152. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  153. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  154. package/coverage/lcov-report/utilities/security.js.html +1 -1
  155. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  156. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  157. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  158. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  159. package/coverage/lcov-report/utilities/users.js.html +1 -1
  160. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  161. package/coverage/lcov.info +160 -150
  162. package/dist/api/controllers/templates.js +1 -2
  163. package/dist/api/controllers/view/exporters.js +1 -1
  164. package/dist/api/index.js +3 -1
  165. package/dist/api/routes/public/index.js +11 -1
  166. package/dist/app.js +24 -4
  167. package/dist/automations/bullboard.js +7 -0
  168. package/dist/automations/index.js +4 -1
  169. package/dist/automations/steps/queryRows.js +0 -1
  170. package/dist/automations/steps/sendSmtpEmail.js +0 -1
  171. package/dist/environment.js +13 -9
  172. package/dist/middleware/builder.js +2 -9
  173. package/dist/package.json +5 -5
  174. package/dist/threads/index.js +20 -0
  175. package/dist/tsconfig.build.tsbuildinfo +1 -1
  176. package/dist/utilities/budibaseDir.js +6 -0
  177. package/dist/utilities/queue/inMemoryQueue.js +8 -0
  178. package/dist/utilities/redis.js +1 -1
  179. package/package.json +6 -6
  180. package/scripts/likeCypress.ts +1 -0
  181. package/src/api/controllers/templates.js +1 -2
  182. package/src/api/controllers/view/exporters.js +1 -1
  183. package/src/api/index.js +3 -1
  184. package/src/api/routes/public/index.ts +10 -1
  185. package/src/app.ts +25 -4
  186. package/src/automations/bullboard.js +8 -0
  187. package/src/automations/index.js +6 -1
  188. package/src/automations/steps/queryRows.js +0 -1
  189. package/src/automations/steps/sendSmtpEmail.js +0 -1
  190. package/src/environment.js +13 -9
  191. package/src/middleware/builder.js +2 -13
  192. package/src/threads/index.ts +22 -0
  193. package/src/utilities/budibaseDir.js +7 -0
  194. package/src/utilities/queue/inMemoryQueue.js +7 -0
  195. package/src/utilities/redis.js +0 -2
  196. package/builder/assets/index.93c381f8.js +0 -1315
@@ -307,7 +307,7 @@ exports.getUniqueRows = async appIds => {
307
307
  <div class='footer quiet pad2 space-top1 center small'>
308
308
  Code coverage generated by
309
309
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
310
- at Tue May 31 2022 12:20:10 GMT+0000 (Coordinated Universal Time)
310
+ at Tue May 31 2022 13:57:34 GMT+0000 (Coordinated Universal Time)
311
311
  </div>
312
312
  <script src="../../prettify.js"></script>
313
313
  <script>
@@ -124,7 +124,7 @@ function <span class="fstat-no" title="function not covered" >resetQuotasIfRequi
124
124
  <div class='footer quiet pad2 space-top1 center small'>
125
125
  Code coverage generated by
126
126
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
127
- at Tue May 31 2022 12:20:10 GMT+0000 (Coordinated Universal Time)
127
+ at Tue May 31 2022 13:57:34 GMT+0000 (Coordinated Universal Time)
128
128
  </div>
129
129
  <script src="../../prettify.js"></script>
130
130
  <script>
@@ -205,7 +205,7 @@ exports.publicApiUserFix = ctx =&gt; {
205
205
  <div class='footer quiet pad2 space-top1 center small'>
206
206
  Code coverage generated by
207
207
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
208
- at Tue May 31 2022 12:20:10 GMT+0000 (Coordinated Universal Time)
208
+ at Tue May 31 2022 13:57:34 GMT+0000 (Coordinated Universal Time)
209
209
  </div>
210
210
  <script src="../prettify.js"></script>
211
211
  <script>
@@ -487,7 +487,7 @@ exports.readGlobalUser = <span class="fstat-no" title="function not covered" >as
487
487
  <div class='footer quiet pad2 space-top1 center small'>
488
488
  Code coverage generated by
489
489
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
490
- at Tue May 31 2022 12:20:10 GMT+0000 (Coordinated Universal Time)
490
+ at Tue May 31 2022 13:57:34 GMT+0000 (Coordinated Universal Time)
491
491
  </div>
492
492
  <script src="../prettify.js"></script>
493
493
  <script>
@@ -1,9 +1,9 @@
1
1
  TN:
2
2
  SF:src/api/index.js
3
- FN:18,(anonymous_0)
4
- FN:19,(anonymous_1)
5
- FN:34,(anonymous_2)
6
- FN:61,(anonymous_3)
3
+ FN:19,(anonymous_0)
4
+ FN:20,(anonymous_1)
5
+ FN:35,(anonymous_2)
6
+ FN:62,(anonymous_3)
7
7
  FNF:4
8
8
  FNH:4
9
9
  FNDA:1,(anonymous_0)
@@ -20,36 +20,38 @@ DA:11,24
20
20
  DA:12,24
21
21
  DA:13,24
22
22
  DA:14,24
23
- DA:16,24
24
- DA:18,24
23
+ DA:15,24
24
+ DA:17,24
25
25
  DA:19,24
26
- DA:21,24
27
- DA:35,188
28
- DA:39,188
29
- DA:61,24
30
- DA:62,186
26
+ DA:20,24
27
+ DA:22,24
28
+ DA:36,188
29
+ DA:40,188
30
+ DA:62,24
31
31
  DA:63,186
32
- DA:65,39
32
+ DA:64,186
33
33
  DA:66,39
34
34
  DA:67,39
35
- DA:73,39
36
- DA:74,0
35
+ DA:68,39
36
+ DA:74,39
37
37
  DA:75,0
38
- DA:81,24
39
- DA:82,624
38
+ DA:76,0
39
+ DA:82,24
40
40
  DA:83,624
41
- DA:86,24
41
+ DA:84,624
42
42
  DA:87,24
43
- DA:90,24
43
+ DA:88,24
44
44
  DA:91,24
45
- DA:93,24
46
- LF:33
47
- LH:31
48
- BRDA:65,0,0,39
49
- BRDA:65,0,1,0
50
- BRDA:65,0,2,0
51
- BRDA:73,1,0,0
52
- BRDA:73,1,1,39
45
+ DA:92,24
46
+ DA:94,24
47
+ DA:95,24
48
+ LF:35
49
+ LH:33
50
+ BRDA:66,0,0,39
51
+ BRDA:66,0,1,0
52
+ BRDA:66,0,2,0
53
+ BRDA:74,1,0,0
54
+ BRDA:74,1,1,39
53
55
  BRF:5
54
56
  BRH:2
55
57
  end_of_record
@@ -1372,36 +1374,36 @@ BRH:0
1372
1374
  end_of_record
1373
1375
  TN:
1374
1376
  SF:src/api/controllers/templates.js
1375
- FN:9,(anonymous_0)
1377
+ FN:8,(anonymous_0)
1376
1378
  FNF:1
1377
1379
  FNH:1
1378
1380
  FNDA:1,(anonymous_0)
1379
1381
  DA:1,24
1380
1382
  DA:2,24
1381
- DA:3,24
1382
- DA:7,24
1383
- DA:9,24
1384
- DA:10,1
1383
+ DA:6,24
1384
+ DA:8,24
1385
+ DA:9,1
1386
+ DA:11,1
1385
1387
  DA:12,1
1386
1388
  DA:13,1
1387
1389
  DA:14,1
1388
- DA:15,1
1389
- DA:16,0
1390
- DA:19,0
1390
+ DA:15,0
1391
+ DA:18,0
1392
+ DA:21,1
1391
1393
  DA:22,1
1392
1394
  DA:23,1
1393
- DA:24,1
1394
- DA:26,0
1395
- LF:16
1396
- LH:13
1397
- BRDA:15,0,0,0
1398
- BRDA:15,0,1,1
1399
- BRDA:22,1,0,1
1400
- BRDA:22,1,1,0
1401
- BRDA:22,2,0,1
1402
- BRDA:22,2,1,1
1403
- BRF:6
1404
- BRH:4
1395
+ DA:25,0
1396
+ LF:15
1397
+ LH:12
1398
+ BRDA:9,0,0,1
1399
+ BRDA:14,1,0,0
1400
+ BRDA:14,1,1,1
1401
+ BRDA:21,2,0,1
1402
+ BRDA:21,2,1,0
1403
+ BRDA:21,3,0,1
1404
+ BRDA:21,3,1,1
1405
+ BRF:7
1406
+ BRH:5
1405
1407
  end_of_record
1406
1408
  TN:
1407
1409
  SF:src/api/controllers/user.js
@@ -3354,10 +3356,8 @@ LF:11
3354
3356
  LH:11
3355
3357
  BRDA:9,0,0,0
3356
3358
  BRDA:9,0,1,2
3357
- BRDA:9,1,0,2
3358
- BRDA:9,1,1,0
3359
- BRF:4
3360
- BRH:2
3359
+ BRF:2
3360
+ BRH:1
3361
3361
  end_of_record
3362
3362
  TN:
3363
3363
  SF:src/api/controllers/view/index.js
@@ -4339,11 +4339,13 @@ SF:src/automations/bullboard.js
4339
4339
  FN:18,cleanup
4340
4340
  FN:24,(anonymous_1)
4341
4341
  FN:29,(anonymous_2)
4342
- FNF:3
4343
- FNH:0
4342
+ FN:48,(anonymous_3)
4343
+ FNF:4
4344
+ FNH:1
4344
4345
  FNDA:0,cleanup
4345
4346
  FNDA:0,(anonymous_1)
4346
4347
  FNDA:0,(anonymous_2)
4348
+ FNDA:1,(anonymous_3)
4347
4349
  DA:1,40
4348
4350
  DA:2,40
4349
4351
  DA:3,40
@@ -4372,27 +4374,36 @@ DA:40,0
4372
4374
  DA:44,0
4373
4375
  DA:45,0
4374
4376
  DA:48,40
4375
- LF:28
4376
- LH:15
4377
+ DA:49,1
4378
+ DA:50,1
4379
+ DA:51,1
4380
+ DA:52,1
4381
+ DA:56,40
4382
+ LF:33
4383
+ LH:20
4377
4384
  BRDA:5,0,0,40
4378
4385
  BRDA:5,0,1,0
4379
4386
  BRDA:13,1,0,40
4380
4387
  BRDA:13,1,1,40
4381
4388
  BRDA:26,2,0,0
4382
4389
  BRDA:26,2,1,0
4383
- BRF:6
4384
- BRH:3
4390
+ BRDA:49,3,0,1
4391
+ BRDA:49,3,1,0
4392
+ BRF:8
4393
+ BRH:4
4385
4394
  end_of_record
4386
4395
  TN:
4387
4396
  SF:src/automations/index.js
4388
4397
  FN:7,(anonymous_0)
4389
4398
  FN:9,(anonymous_1)
4390
4399
  FN:14,(anonymous_2)
4391
- FNF:3
4392
- FNH:2
4400
+ FN:18,(anonymous_3)
4401
+ FNF:4
4402
+ FNH:3
4393
4403
  FNDA:28,(anonymous_0)
4394
4404
  FNDA:8,(anonymous_1)
4395
4405
  FNDA:0,(anonymous_2)
4406
+ FNDA:1,(anonymous_3)
4396
4407
  DA:1,25
4397
4408
  DA:2,25
4398
4409
  DA:7,25
@@ -4400,9 +4411,11 @@ DA:9,28
4400
4411
  DA:10,8
4401
4412
  DA:14,25
4402
4413
  DA:15,0
4403
- DA:17,25
4404
- LF:8
4405
- LH:7
4414
+ DA:18,25
4415
+ DA:19,1
4416
+ DA:22,25
4417
+ LF:10
4418
+ LH:9
4406
4419
  BRF:0
4407
4420
  BRH:0
4408
4421
  end_of_record
@@ -4770,8 +4783,8 @@ BRH:12
4770
4783
  end_of_record
4771
4784
  TN:
4772
4785
  SF:src/automations/steps/queryRows.js
4773
- FN:75,getTable
4774
- FN:85,(anonymous_1)
4786
+ FN:74,getTable
4787
+ FN:84,(anonymous_1)
4775
4788
  FNF:2
4776
4789
  FNH:2
4777
4790
  FNDA:1,getTable
@@ -4784,35 +4797,35 @@ DA:5,41
4784
4797
  DA:7,41
4785
4798
  DA:12,41
4786
4799
  DA:17,41
4787
- DA:76,1
4800
+ DA:75,1
4801
+ DA:80,1
4788
4802
  DA:81,1
4789
- DA:82,1
4790
- DA:85,41
4803
+ DA:84,41
4804
+ DA:85,1
4791
4805
  DA:86,1
4792
4806
  DA:87,1
4793
4807
  DA:88,1
4794
4808
  DA:89,1
4795
4809
  DA:90,1
4796
- DA:91,1
4797
- DA:94,1
4810
+ DA:93,1
4811
+ DA:105,1
4798
4812
  DA:106,1
4799
4813
  DA:107,1
4800
- DA:108,1
4801
- DA:113,0
4814
+ DA:112,0
4802
4815
  LF:23
4803
4816
  LH:22
4804
- BRDA:89,0,0,1
4805
- BRDA:89,0,1,0
4806
- BRDA:89,1,0,1
4807
- BRDA:89,1,1,1
4808
- BRDA:89,1,2,1
4809
- BRDA:89,1,3,1
4810
- BRDA:92,2,0,0
4811
- BRDA:92,2,1,1
4812
- BRDA:102,3,0,1
4813
- BRDA:102,3,1,0
4814
- BRDA:109,4,0,1
4815
- BRDA:109,4,1,0
4817
+ BRDA:88,0,0,1
4818
+ BRDA:88,0,1,0
4819
+ BRDA:88,1,0,1
4820
+ BRDA:88,1,1,1
4821
+ BRDA:88,1,2,1
4822
+ BRDA:88,1,3,1
4823
+ BRDA:91,2,0,0
4824
+ BRDA:91,2,1,1
4825
+ BRDA:101,3,0,1
4826
+ BRDA:101,3,1,0
4827
+ BRDA:108,4,0,1
4828
+ BRDA:108,4,1,0
4816
4829
  BRF:12
4817
4830
  BRH:8
4818
4831
  end_of_record
@@ -4832,15 +4845,12 @@ DA:54,0
4832
4845
  DA:56,0
4833
4846
  DA:57,0
4834
4847
  DA:58,0
4835
- DA:59,0
4836
- DA:64,0
4837
- LF:12
4848
+ DA:63,0
4849
+ LF:11
4838
4850
  LH:4
4839
4851
  BRDA:53,0,0,0
4840
4852
  BRDA:53,0,1,0
4841
- BRDA:56,1,0,0
4842
- BRDA:56,1,1,0
4843
- BRF:4
4853
+ BRF:2
4844
4854
  BRH:0
4845
4855
  end_of_record
4846
4856
  TN:
@@ -5247,7 +5257,7 @@ FNDA:0,(anonymous_5)
5247
5257
  FNDA:264,(anonymous_6)
5248
5258
  FNDA:3,(anonymous_7)
5249
5259
  FNDA:193,(anonymous_8)
5250
- FNDA:3,(anonymous_9)
5260
+ FNDA:2,(anonymous_9)
5251
5261
  FNDA:225,(anonymous_10)
5252
5262
  FNDA:20,(anonymous_11)
5253
5263
  FNDA:9,(anonymous_12)
@@ -5322,10 +5332,10 @@ DA:180,3
5322
5332
  DA:188,54
5323
5333
  DA:189,193
5324
5334
  DA:195,54
5325
- DA:196,3
5326
- DA:197,3
5335
+ DA:196,2
5336
+ DA:197,2
5327
5337
  DA:198,1
5328
- DA:200,2
5338
+ DA:200,1
5329
5339
  DA:206,54
5330
5340
  DA:207,225
5331
5341
  DA:214,54
@@ -5395,9 +5405,9 @@ BRDA:172,11,1,71
5395
5405
  BRDA:179,12,0,0
5396
5406
  BRDA:179,13,0,0
5397
5407
  BRDA:197,14,0,1
5398
- BRDA:197,14,1,2
5399
- BRDA:197,15,0,3
5400
- BRDA:197,15,1,3
5408
+ BRDA:197,14,1,1
5409
+ BRDA:197,15,0,2
5410
+ BRDA:197,15,1,2
5401
5411
  BRDA:206,16,0,0
5402
5412
  BRDA:206,17,0,0
5403
5413
  BRDA:246,18,0,0
@@ -6151,7 +6161,7 @@ SF:src/middleware/builder.js
6151
6161
  FN:24,checkDevAppLocks
6152
6162
  FN:44,updateAppUpdatedAt
6153
6163
  FN:51,(anonymous_2)
6154
- FN:65,(anonymous_3)
6164
+ FN:62,(anonymous_3)
6155
6165
  FNF:4
6156
6166
  FNH:4
6157
6167
  FNDA:1,checkDevAppLocks
@@ -6179,29 +6189,23 @@ DA:49,0
6179
6189
  DA:51,1
6180
6190
  DA:52,1
6181
6191
  DA:53,1
6192
+ DA:54,1
6182
6193
  DA:55,1
6183
- DA:57,1
6194
+ DA:56,1
6184
6195
  DA:58,1
6185
- DA:59,1
6186
- DA:61,1
6187
- DA:65,25
6188
- DA:66,181
6189
- DA:68,181
6190
- DA:69,5
6191
- DA:71,176
6196
+ DA:62,25
6197
+ DA:63,181
6198
+ DA:65,181
6199
+ DA:66,5
6200
+ DA:68,176
6201
+ DA:69,176
6202
+ DA:70,176
6192
6203
  DA:72,176
6193
- DA:74,176
6194
- DA:75,176
6195
- DA:76,176
6196
- DA:77,0
6197
- DA:80,176
6198
- DA:81,176
6199
- DA:83,176
6200
- DA:84,175
6201
- DA:87,1
6202
- DA:89,1
6203
- LF:42
6204
- LH:37
6204
+ DA:73,175
6205
+ DA:76,1
6206
+ DA:78,1
6207
+ LF:36
6208
+ LH:32
6205
6209
  BRDA:28,0,0,0
6206
6210
  BRDA:28,0,1,1
6207
6211
  BRDA:28,1,0,1
@@ -6216,22 +6220,16 @@ BRDA:48,5,0,0
6216
6220
  BRDA:48,5,1,1
6217
6221
  BRDA:48,6,0,1
6218
6222
  BRDA:48,6,1,1
6219
- BRDA:68,7,0,5
6220
- BRDA:68,7,1,176
6221
- BRDA:75,8,0,175
6222
- BRDA:75,8,1,1
6223
- BRDA:76,9,0,0
6224
- BRDA:76,9,1,176
6225
- BRDA:80,10,0,175
6226
- BRDA:80,10,1,1
6227
- BRDA:81,11,0,1
6228
- BRDA:81,11,1,175
6229
- BRDA:83,12,0,175
6230
- BRDA:83,12,1,1
6231
- BRDA:83,13,0,176
6232
- BRDA:83,13,1,109
6233
- BRF:28
6234
- BRH:22
6223
+ BRDA:65,7,0,5
6224
+ BRDA:65,7,1,176
6225
+ BRDA:70,8,0,1
6226
+ BRDA:70,8,1,175
6227
+ BRDA:72,9,0,175
6228
+ BRDA:72,9,1,1
6229
+ BRDA:72,10,0,176
6230
+ BRDA:72,10,1,109
6231
+ BRF:22
6232
+ BRH:17
6235
6233
  end_of_record
6236
6234
  TN:
6237
6235
  SF:src/middleware/currentapp.js
@@ -7064,13 +7062,22 @@ BRH:10
7064
7062
  end_of_record
7065
7063
  TN:
7066
7064
  SF:src/utilities/budibaseDir.js
7067
- FNF:0
7065
+ FN:6,(anonymous_0)
7066
+ FNF:1
7068
7067
  FNH:0
7068
+ FNDA:0,(anonymous_0)
7069
7069
  DA:1,42
7070
+ DA:2,42
7070
7071
  DA:3,42
7071
- LF:2
7072
- LH:2
7073
- BRF:0
7072
+ DA:4,42
7073
+ DA:6,42
7074
+ DA:7,0
7075
+ DA:10,42
7076
+ LF:7
7077
+ LH:6
7078
+ BRDA:7,0,0,0
7079
+ BRDA:7,0,1,0
7080
+ BRF:2
7074
7081
  BRH:0
7075
7082
  end_of_record
7076
7083
  TN:
@@ -7766,21 +7773,23 @@ FN:32,(anonymous_1)
7766
7773
  FN:48,(anonymous_2)
7767
7774
  FN:49,(anonymous_3)
7768
7775
  FN:70,(anonymous_4)
7769
- FN:82,(anonymous_5)
7770
- FN:90,(anonymous_6)
7771
- FN:95,(anonymous_7)
7776
+ FN:81,(anonymous_5)
7777
+ FN:89,(anonymous_6)
7778
+ FN:97,(anonymous_7)
7772
7779
  FN:102,(anonymous_8)
7773
- FNF:9
7774
- FNH:6
7780
+ FN:109,(anonymous_9)
7781
+ FNF:10
7782
+ FNH:7
7775
7783
  FNDA:8,newJob
7776
7784
  FNDA:40,(anonymous_1)
7777
7785
  FNDA:28,(anonymous_2)
7778
7786
  FNDA:11,(anonymous_3)
7779
7787
  FNDA:8,(anonymous_4)
7780
- FNDA:0,(anonymous_5)
7781
- FNDA:205,(anonymous_6)
7782
- FNDA:0,(anonymous_7)
7788
+ FNDA:1,(anonymous_5)
7789
+ FNDA:0,(anonymous_6)
7790
+ FNDA:205,(anonymous_7)
7783
7791
  FNDA:0,(anonymous_8)
7792
+ FNDA:0,(anonymous_9)
7784
7793
  DA:1,40
7785
7794
  DA:13,8
7786
7795
  DA:33,40
@@ -7798,12 +7807,13 @@ DA:71,8
7798
7807
  DA:72,0
7799
7808
  DA:74,8
7800
7809
  DA:75,8
7801
- DA:84,0
7802
- DA:91,205
7803
- DA:103,0
7804
- DA:107,40
7805
- LF:21
7806
- LH:18
7810
+ DA:82,1
7811
+ DA:91,0
7812
+ DA:98,205
7813
+ DA:110,0
7814
+ DA:114,40
7815
+ LF:22
7816
+ LH:19
7807
7817
  BRDA:32,0,0,0
7808
7818
  BRDA:50,1,0,3
7809
7819
  BRDA:50,1,1,8
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  const fetch = require("node-fetch");
12
12
  const { downloadTemplate } = require("../../utilities/fileSystem");
13
- const env = require("../../environment");
14
13
  // development flag, can be used to test against templates exported locally
15
14
  const DEFAULT_TEMPLATES_BUCKET = "prod-budi-templates.s3-eu-west-1.amazonaws.com";
16
15
  exports.fetch = function (ctx) {
17
16
  return __awaiter(this, void 0, void 0, function* () {
18
- let type = env.TEMPLATE_REPOSITORY;
17
+ const { type = "app" } = ctx.query;
19
18
  let response, error = false;
20
19
  try {
21
20
  response = yield fetch(`https://${DEFAULT_TEMPLATES_BUCKET}/manifest.json`);
@@ -6,7 +6,7 @@ exports.csv = function (headers, rows) {
6
6
  .map(header => {
7
7
  let val = row[header];
8
8
  val =
9
- typeof val === "object" && !(val instanceof Date)
9
+ typeof val === "object"
10
10
  ? `"${JSON.stringify(val).replace(/"/g, "'")}"`
11
11
  : `"${val}"`;
12
12
  return val.trim();
package/dist/api/index.js CHANGED
@@ -18,6 +18,7 @@ const { mainRoutes, staticRoutes, publicRoutes } = require("./routes");
18
18
  const pkg = require("../../package.json");
19
19
  const env = require("../environment");
20
20
  const { middleware: pro } = require("@budibase/pro");
21
+ const { shutdown } = require("./routes/public");
21
22
  const router = new Router();
22
23
  router.get("/health", ctx => (ctx.status = 200));
23
24
  router.get("/version", ctx => (ctx.body = pkg.version));
@@ -83,4 +84,5 @@ router.use(publicRoutes.allowedMethods());
83
84
  // WARNING - static routes will catch everything else after them this must be last
84
85
  router.use(staticRoutes.routes());
85
86
  router.use(staticRoutes.allowedMethods());
86
- module.exports = router;
87
+ module.exports.router = router;
88
+ module.exports.shutdown = shutdown;
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.shutdown = void 0;
6
7
  const applications_1 = __importDefault(require("./applications"));
7
8
  const queries_1 = __importDefault(require("./queries"));
8
9
  const tables_1 = __importDefault(require("./tables"));
@@ -27,6 +28,7 @@ function getApiLimitPerSecond() {
27
28
  }
28
29
  return parseInt(environment_1.default.API_REQ_LIMIT_PER_SEC);
29
30
  }
31
+ let rateLimitStore = null;
30
32
  if (!environment_1.default.isTest()) {
31
33
  const REDIS_OPTS = getRedisOptions();
32
34
  let options;
@@ -46,8 +48,9 @@ if (!environment_1.default.isTest()) {
46
48
  database: 1,
47
49
  };
48
50
  }
51
+ rateLimitStore = new Stores.Redis(options);
49
52
  RateLimit.defaultOptions({
50
- store: new Stores.Redis(options),
53
+ store: rateLimitStore,
51
54
  });
52
55
  }
53
56
  // rate limiting, allows for 2 requests per second
@@ -111,3 +114,10 @@ applyRoutes(queries_1.default, PermissionTypes.QUERY, "queryId");
111
114
  // needs to be applied last for routing purposes, don't override other endpoints
112
115
  applyRoutes(rows_1.default, PermissionTypes.TABLE, "tableId", "rowId");
113
116
  exports.default = publicRouter;
117
+ const shutdown = () => {
118
+ if (rateLimitStore) {
119
+ rateLimitStore.client.disconnect();
120
+ rateLimitStore = null;
121
+ }
122
+ };
123
+ exports.shutdown = shutdown;
package/dist/app.js CHANGED
@@ -49,6 +49,8 @@ const automations = require("./automations/index");
49
49
  const Sentry = require("@sentry/node");
50
50
  const fileSystem = require("./utilities/fileSystem");
51
51
  const bullboard = require("./automations/bullboard");
52
+ const { logAlert } = require("@budibase/backend-core/logging");
53
+ const { Thread } = require("./threads");
52
54
  const redis_1 = __importDefault(require("./utilities/redis"));
53
55
  const migrations = __importStar(require("./migrations"));
54
56
  const app = new Koa();
@@ -74,7 +76,7 @@ if (!env.isTest()) {
74
76
  app.context.eventEmitter = eventEmitter;
75
77
  app.context.auth = {};
76
78
  // api routes
77
- app.use(api.routes());
79
+ app.use(api.router.routes());
78
80
  if (env.isProd()) {
79
81
  env._set("NODE_ENV", "production");
80
82
  Sentry.init();
@@ -89,11 +91,23 @@ if (env.isProd()) {
89
91
  }
90
92
  const server = http.createServer(app.callback());
91
93
  destroyable(server);
94
+ let shuttingDown = false, errCode = 0;
92
95
  server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
93
- if (env.NODE_ENV !== "jest") {
96
+ // already in process
97
+ if (shuttingDown) {
98
+ return;
99
+ }
100
+ shuttingDown = true;
101
+ if (!env.isTest()) {
94
102
  console.log("Server Closed");
95
103
  }
104
+ yield automations.shutdown();
96
105
  yield redis_1.default.shutdown();
106
+ yield Thread.shutdown();
107
+ api.shutdown();
108
+ if (!env.isTest()) {
109
+ process.exit(errCode);
110
+ }
97
111
  }));
98
112
  module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, void 0, function* () {
99
113
  console.log(`Budibase running on ${JSON.stringify(server.address())}`);
@@ -108,7 +122,13 @@ const shutdown = () => {
108
122
  server.destroy();
109
123
  };
110
124
  process.on("uncaughtException", err => {
111
- console.error(err);
125
+ // @ts-ignore
126
+ // don't worry about this error, comes from zlib isn't important
127
+ if (err && err["code"] === "ERR_INVALID_CHAR") {
128
+ return;
129
+ }
130
+ errCode = -1;
131
+ logAlert("Uncaught exception.", err);
112
132
  shutdown();
113
133
  });
114
134
  process.on("SIGTERM", () => {
@@ -118,7 +138,7 @@ process.on("SIGTERM", () => {
118
138
  // not recommended in a clustered environment
119
139
  if (!env.HTTP_MIGRATIONS) {
120
140
  migrations.migrate().catch(err => {
121
- console.error("Error performing migrations. Exiting.\n", err);
141
+ logAlert("Error performing migrations. Exiting.", err);
122
142
  shutdown();
123
143
  });
124
144
  }
@@ -51,4 +51,11 @@ exports.init = () => {
51
51
  serverAdapter.setBasePath(PATH_PREFIX);
52
52
  return serverAdapter.registerPlugin();
53
53
  };
54
+ exports.shutdown = () => __awaiter(void 0, void 0, void 0, function* () {
55
+ if (automationQueue) {
56
+ clearInterval(cleanupInternal);
57
+ yield automationQueue.close();
58
+ automationQueue = null;
59
+ }
60
+ });
54
61
  exports.queue = automationQueue;