@budibase/server 1.0.190 → 1.0.192-alpha.0

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.bb5e3dfd.css → index.8a6f249b.css} +2 -2
  2. package/builder/assets/index.e9d6bfd0.js +1315 -0
  3. package/builder/assets/{vendor.5240f480.js → vendor.9bf2fcb4.js} +53 -53
  4. package/builder/index.html +3 -3
  5. package/coverage/clover.xml +96 -83
  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 +12 -9
  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 +5 -2
  92. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +10 -7
  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 +43 -10
  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 +11 -32
  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 +168 -142
  162. package/dist/api/controllers/templates.js +2 -1
  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 +1 -0
  170. package/dist/automations/steps/sendSmtpEmail.js +1 -0
  171. package/dist/environment.js +9 -13
  172. package/dist/middleware/builder.js +9 -2
  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 +0 -6
  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 +0 -1
  181. package/src/api/controllers/templates.js +2 -1
  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 +1 -0
  189. package/src/automations/steps/sendSmtpEmail.js +1 -0
  190. package/src/environment.js +9 -13
  191. package/src/middleware/builder.js +13 -2
  192. package/src/threads/index.ts +22 -0
  193. package/src/utilities/budibaseDir.js +0 -7
  194. package/src/utilities/queue/inMemoryQueue.js +7 -0
  195. package/src/utilities/redis.js +2 -0
  196. package/builder/assets/index.478109df.js +0 -1299
@@ -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 13:07:19 GMT+0000 (Coordinated Universal Time)
310
+ at Wed Jun 01 2022 08:56:47 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 13:07:19 GMT+0000 (Coordinated Universal Time)
127
+ at Wed Jun 01 2022 08:56:47 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 13:07:19 GMT+0000 (Coordinated Universal Time)
208
+ at Wed Jun 01 2022 08:56:47 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 13:07:19 GMT+0000 (Coordinated Universal Time)
490
+ at Wed Jun 01 2022 08:56:47 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:8,(anonymous_0)
1377
+ FN:9,(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:6,24
1382
- DA:8,24
1383
- DA:9,1
1384
- DA:11,1
1383
+ DA:3,24
1384
+ DA:7,24
1385
+ DA:9,24
1386
+ DA:10,1
1385
1387
  DA:12,1
1386
1388
  DA:13,1
1387
1389
  DA:14,1
1388
- DA:15,0
1389
- DA:18,0
1390
- DA:21,1
1390
+ DA:15,1
1391
+ DA:16,0
1392
+ DA:19,0
1391
1393
  DA:22,1
1392
1394
  DA:23,1
1393
- DA:25,0
1394
- LF:15
1395
- LH:12
1396
- BRDA:9,0,0,1
1397
- BRDA:14,1,0,0
1398
- BRDA:14,1,1,1
1399
- BRDA:21,2,0,1
1400
- BRDA:21,2,1,0
1401
- BRDA:21,3,0,1
1402
- BRDA:21,3,1,1
1403
- BRF:7
1404
- BRH:5
1395
+ DA:24,1
1396
+ DA:26,0
1397
+ LF:16
1398
+ LH:13
1399
+ BRDA:15,0,0,0
1400
+ BRDA:15,0,1,1
1401
+ BRDA:22,1,0,1
1402
+ BRDA:22,1,1,0
1403
+ BRDA:22,2,0,1
1404
+ BRDA:22,2,1,1
1405
+ BRF:6
1406
+ BRH:4
1405
1407
  end_of_record
1406
1408
  TN:
1407
1409
  SF:src/api/controllers/user.js
@@ -3354,8 +3356,10 @@ LF:11
3354
3356
  LH:11
3355
3357
  BRDA:9,0,0,0
3356
3358
  BRDA:9,0,1,2
3357
- BRF:2
3358
- BRH:1
3359
+ BRDA:9,1,0,2
3360
+ BRDA:9,1,1,0
3361
+ BRF:4
3362
+ BRH:2
3359
3363
  end_of_record
3360
3364
  TN:
3361
3365
  SF:src/api/controllers/view/index.js
@@ -4337,11 +4341,13 @@ SF:src/automations/bullboard.js
4337
4341
  FN:18,cleanup
4338
4342
  FN:24,(anonymous_1)
4339
4343
  FN:29,(anonymous_2)
4340
- FNF:3
4341
- FNH:0
4344
+ FN:48,(anonymous_3)
4345
+ FNF:4
4346
+ FNH:1
4342
4347
  FNDA:0,cleanup
4343
4348
  FNDA:0,(anonymous_1)
4344
4349
  FNDA:0,(anonymous_2)
4350
+ FNDA:1,(anonymous_3)
4345
4351
  DA:1,40
4346
4352
  DA:2,40
4347
4353
  DA:3,40
@@ -4370,27 +4376,36 @@ DA:40,0
4370
4376
  DA:44,0
4371
4377
  DA:45,0
4372
4378
  DA:48,40
4373
- LF:28
4374
- LH:15
4379
+ DA:49,1
4380
+ DA:50,1
4381
+ DA:51,1
4382
+ DA:52,1
4383
+ DA:56,40
4384
+ LF:33
4385
+ LH:20
4375
4386
  BRDA:5,0,0,40
4376
4387
  BRDA:5,0,1,0
4377
4388
  BRDA:13,1,0,40
4378
4389
  BRDA:13,1,1,40
4379
4390
  BRDA:26,2,0,0
4380
4391
  BRDA:26,2,1,0
4381
- BRF:6
4382
- BRH:3
4392
+ BRDA:49,3,0,1
4393
+ BRDA:49,3,1,0
4394
+ BRF:8
4395
+ BRH:4
4383
4396
  end_of_record
4384
4397
  TN:
4385
4398
  SF:src/automations/index.js
4386
4399
  FN:7,(anonymous_0)
4387
4400
  FN:9,(anonymous_1)
4388
4401
  FN:14,(anonymous_2)
4389
- FNF:3
4390
- FNH:2
4402
+ FN:18,(anonymous_3)
4403
+ FNF:4
4404
+ FNH:3
4391
4405
  FNDA:28,(anonymous_0)
4392
4406
  FNDA:8,(anonymous_1)
4393
4407
  FNDA:0,(anonymous_2)
4408
+ FNDA:1,(anonymous_3)
4394
4409
  DA:1,25
4395
4410
  DA:2,25
4396
4411
  DA:7,25
@@ -4398,9 +4413,11 @@ DA:9,28
4398
4413
  DA:10,8
4399
4414
  DA:14,25
4400
4415
  DA:15,0
4401
- DA:17,25
4402
- LF:8
4403
- LH:7
4416
+ DA:18,25
4417
+ DA:19,1
4418
+ DA:22,25
4419
+ LF:10
4420
+ LH:9
4404
4421
  BRF:0
4405
4422
  BRH:0
4406
4423
  end_of_record
@@ -4768,8 +4785,8 @@ BRH:12
4768
4785
  end_of_record
4769
4786
  TN:
4770
4787
  SF:src/automations/steps/queryRows.js
4771
- FN:74,getTable
4772
- FN:84,(anonymous_1)
4788
+ FN:75,getTable
4789
+ FN:85,(anonymous_1)
4773
4790
  FNF:2
4774
4791
  FNH:2
4775
4792
  FNDA:1,getTable
@@ -4782,35 +4799,35 @@ DA:5,41
4782
4799
  DA:7,41
4783
4800
  DA:12,41
4784
4801
  DA:17,41
4785
- DA:75,1
4786
- DA:80,1
4802
+ DA:76,1
4787
4803
  DA:81,1
4788
- DA:84,41
4789
- DA:85,1
4804
+ DA:82,1
4805
+ DA:85,41
4790
4806
  DA:86,1
4791
4807
  DA:87,1
4792
4808
  DA:88,1
4793
4809
  DA:89,1
4794
4810
  DA:90,1
4795
- DA:93,1
4796
- DA:105,1
4811
+ DA:91,1
4812
+ DA:94,1
4797
4813
  DA:106,1
4798
4814
  DA:107,1
4799
- DA:112,0
4815
+ DA:108,1
4816
+ DA:113,0
4800
4817
  LF:23
4801
4818
  LH:22
4802
- BRDA:88,0,0,1
4803
- BRDA:88,0,1,0
4804
- BRDA:88,1,0,1
4805
- BRDA:88,1,1,1
4806
- BRDA:88,1,2,1
4807
- BRDA:88,1,3,1
4808
- BRDA:91,2,0,0
4809
- BRDA:91,2,1,1
4810
- BRDA:101,3,0,1
4811
- BRDA:101,3,1,0
4812
- BRDA:108,4,0,1
4813
- BRDA:108,4,1,0
4819
+ BRDA:89,0,0,1
4820
+ BRDA:89,0,1,0
4821
+ BRDA:89,1,0,1
4822
+ BRDA:89,1,1,1
4823
+ BRDA:89,1,2,1
4824
+ BRDA:89,1,3,1
4825
+ BRDA:92,2,0,0
4826
+ BRDA:92,2,1,1
4827
+ BRDA:102,3,0,1
4828
+ BRDA:102,3,1,0
4829
+ BRDA:109,4,0,1
4830
+ BRDA:109,4,1,0
4814
4831
  BRF:12
4815
4832
  BRH:8
4816
4833
  end_of_record
@@ -4830,12 +4847,15 @@ DA:54,0
4830
4847
  DA:56,0
4831
4848
  DA:57,0
4832
4849
  DA:58,0
4833
- DA:63,0
4834
- LF:11
4850
+ DA:59,0
4851
+ DA:64,0
4852
+ LF:12
4835
4853
  LH:4
4836
4854
  BRDA:53,0,0,0
4837
4855
  BRDA:53,0,1,0
4838
- BRF:2
4856
+ BRDA:56,1,0,0
4857
+ BRDA:56,1,1,0
4858
+ BRF:4
4839
4859
  BRH:0
4840
4860
  end_of_record
4841
4861
  TN:
@@ -5242,7 +5262,7 @@ FNDA:0,(anonymous_5)
5242
5262
  FNDA:264,(anonymous_6)
5243
5263
  FNDA:3,(anonymous_7)
5244
5264
  FNDA:193,(anonymous_8)
5245
- FNDA:2,(anonymous_9)
5265
+ FNDA:3,(anonymous_9)
5246
5266
  FNDA:225,(anonymous_10)
5247
5267
  FNDA:20,(anonymous_11)
5248
5268
  FNDA:9,(anonymous_12)
@@ -5317,10 +5337,10 @@ DA:180,3
5317
5337
  DA:188,54
5318
5338
  DA:189,193
5319
5339
  DA:195,54
5320
- DA:196,2
5321
- DA:197,2
5340
+ DA:196,3
5341
+ DA:197,3
5322
5342
  DA:198,1
5323
- DA:200,1
5343
+ DA:200,2
5324
5344
  DA:206,54
5325
5345
  DA:207,225
5326
5346
  DA:214,54
@@ -5390,9 +5410,9 @@ BRDA:172,11,1,71
5390
5410
  BRDA:179,12,0,0
5391
5411
  BRDA:179,13,0,0
5392
5412
  BRDA:197,14,0,1
5393
- BRDA:197,14,1,1
5394
- BRDA:197,15,0,2
5395
- BRDA:197,15,1,2
5413
+ BRDA:197,14,1,2
5414
+ BRDA:197,15,0,3
5415
+ BRDA:197,15,1,3
5396
5416
  BRDA:206,16,0,0
5397
5417
  BRDA:206,17,0,0
5398
5418
  BRDA:246,18,0,0
@@ -6146,7 +6166,7 @@ SF:src/middleware/builder.js
6146
6166
  FN:24,checkDevAppLocks
6147
6167
  FN:44,updateAppUpdatedAt
6148
6168
  FN:51,(anonymous_2)
6149
- FN:62,(anonymous_3)
6169
+ FN:65,(anonymous_3)
6150
6170
  FNF:4
6151
6171
  FNH:4
6152
6172
  FNDA:1,checkDevAppLocks
@@ -6174,23 +6194,29 @@ DA:49,0
6174
6194
  DA:51,1
6175
6195
  DA:52,1
6176
6196
  DA:53,1
6177
- DA:54,1
6178
6197
  DA:55,1
6179
- DA:56,1
6198
+ DA:57,1
6180
6199
  DA:58,1
6181
- DA:62,25
6182
- DA:63,181
6183
- DA:65,181
6184
- DA:66,5
6185
- DA:68,176
6186
- DA:69,176
6187
- DA:70,176
6200
+ DA:59,1
6201
+ DA:61,1
6202
+ DA:65,25
6203
+ DA:66,181
6204
+ DA:68,181
6205
+ DA:69,5
6206
+ DA:71,176
6188
6207
  DA:72,176
6189
- DA:73,175
6190
- DA:76,1
6191
- DA:78,1
6192
- LF:36
6193
- LH:32
6208
+ DA:74,176
6209
+ DA:75,176
6210
+ DA:76,176
6211
+ DA:77,0
6212
+ DA:80,176
6213
+ DA:81,176
6214
+ DA:83,176
6215
+ DA:84,175
6216
+ DA:87,1
6217
+ DA:89,1
6218
+ LF:42
6219
+ LH:37
6194
6220
  BRDA:28,0,0,0
6195
6221
  BRDA:28,0,1,1
6196
6222
  BRDA:28,1,0,1
@@ -6205,16 +6231,22 @@ BRDA:48,5,0,0
6205
6231
  BRDA:48,5,1,1
6206
6232
  BRDA:48,6,0,1
6207
6233
  BRDA:48,6,1,1
6208
- BRDA:65,7,0,5
6209
- BRDA:65,7,1,176
6210
- BRDA:70,8,0,1
6211
- BRDA:70,8,1,175
6212
- BRDA:72,9,0,175
6213
- BRDA:72,9,1,1
6214
- BRDA:72,10,0,176
6215
- BRDA:72,10,1,109
6216
- BRF:22
6217
- BRH:17
6234
+ BRDA:68,7,0,5
6235
+ BRDA:68,7,1,176
6236
+ BRDA:75,8,0,175
6237
+ BRDA:75,8,1,1
6238
+ BRDA:76,9,0,0
6239
+ BRDA:76,9,1,176
6240
+ BRDA:80,10,0,175
6241
+ BRDA:80,10,1,1
6242
+ BRDA:81,11,0,1
6243
+ BRDA:81,11,1,175
6244
+ BRDA:83,12,0,175
6245
+ BRDA:83,12,1,1
6246
+ BRDA:83,13,0,176
6247
+ BRDA:83,13,1,109
6248
+ BRF:28
6249
+ BRH:22
6218
6250
  end_of_record
6219
6251
  TN:
6220
6252
  SF:src/middleware/currentapp.js
@@ -7047,22 +7079,13 @@ BRH:10
7047
7079
  end_of_record
7048
7080
  TN:
7049
7081
  SF:src/utilities/budibaseDir.js
7050
- FN:6,(anonymous_0)
7051
- FNF:1
7082
+ FNF:0
7052
7083
  FNH:0
7053
- FNDA:0,(anonymous_0)
7054
7084
  DA:1,42
7055
- DA:2,42
7056
7085
  DA:3,42
7057
- DA:4,42
7058
- DA:6,42
7059
- DA:7,0
7060
- DA:10,42
7061
- LF:7
7062
- LH:6
7063
- BRDA:7,0,0,0
7064
- BRDA:7,0,1,0
7065
- BRF:2
7086
+ LF:2
7087
+ LH:2
7088
+ BRF:0
7066
7089
  BRH:0
7067
7090
  end_of_record
7068
7091
  TN:
@@ -7758,21 +7781,23 @@ FN:32,(anonymous_1)
7758
7781
  FN:48,(anonymous_2)
7759
7782
  FN:49,(anonymous_3)
7760
7783
  FN:70,(anonymous_4)
7761
- FN:82,(anonymous_5)
7762
- FN:90,(anonymous_6)
7763
- FN:95,(anonymous_7)
7784
+ FN:81,(anonymous_5)
7785
+ FN:89,(anonymous_6)
7786
+ FN:97,(anonymous_7)
7764
7787
  FN:102,(anonymous_8)
7765
- FNF:9
7766
- FNH:6
7788
+ FN:109,(anonymous_9)
7789
+ FNF:10
7790
+ FNH:7
7767
7791
  FNDA:8,newJob
7768
7792
  FNDA:40,(anonymous_1)
7769
7793
  FNDA:28,(anonymous_2)
7770
7794
  FNDA:11,(anonymous_3)
7771
7795
  FNDA:8,(anonymous_4)
7772
- FNDA:0,(anonymous_5)
7773
- FNDA:205,(anonymous_6)
7774
- FNDA:0,(anonymous_7)
7796
+ FNDA:1,(anonymous_5)
7797
+ FNDA:0,(anonymous_6)
7798
+ FNDA:205,(anonymous_7)
7775
7799
  FNDA:0,(anonymous_8)
7800
+ FNDA:0,(anonymous_9)
7776
7801
  DA:1,40
7777
7802
  DA:13,8
7778
7803
  DA:33,40
@@ -7790,12 +7815,13 @@ DA:71,8
7790
7815
  DA:72,0
7791
7816
  DA:74,8
7792
7817
  DA:75,8
7793
- DA:84,0
7794
- DA:91,205
7795
- DA:103,0
7796
- DA:107,40
7797
- LF:21
7798
- LH:18
7818
+ DA:82,1
7819
+ DA:91,0
7820
+ DA:98,205
7821
+ DA:110,0
7822
+ DA:114,40
7823
+ LF:22
7824
+ LH:19
7799
7825
  BRDA:32,0,0,0
7800
7826
  BRDA:50,1,0,3
7801
7827
  BRDA:50,1,1,8
@@ -10,11 +10,12 @@ 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");
13
14
  // development flag, can be used to test against templates exported locally
14
15
  const DEFAULT_TEMPLATES_BUCKET = "prod-budi-templates.s3-eu-west-1.amazonaws.com";
15
16
  exports.fetch = function (ctx) {
16
17
  return __awaiter(this, void 0, void 0, function* () {
17
- const { type = "app" } = ctx.query;
18
+ let type = env.TEMPLATE_REPOSITORY;
18
19
  let response, error = false;
19
20
  try {
20
21
  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"
9
+ typeof val === "object" && !(val instanceof Date)
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
  }