@budibase/server 1.0.49-alpha.1 → 1.0.49-alpha.2

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 (215) hide show
  1. package/builder/assets/{index.ed1cf508.js → index.82e12602.js} +149 -149
  2. package/builder/assets/{index.ba78c49d.css → index.83c0944f.css} +1 -1
  3. package/builder/index.html +2 -2
  4. package/coverage/clover.xml +989 -1020
  5. package/coverage/coverage-final.json +90 -91
  6. package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/application.js.html +106 -106
  9. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
  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 +16 -16
  15. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/index.html +27 -12
  17. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
  19. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  20. package/coverage/lcov-report/{migrations/usageQuotas/syncApps.js.html → api/controllers/migrations.js.html} +30 -45
  21. package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
  22. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  23. package/coverage/lcov-report/api/controllers/query/index.js.html +19 -19
  24. package/coverage/lcov-report/api/controllers/query/validation.js.html +6 -6
  25. package/coverage/lcov-report/api/controllers/role.js.html +9 -9
  26. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/external.js.html +16 -16
  28. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/index.js.html +13 -13
  30. package/coverage/lcov-report/api/controllers/row/internal.js.html +26 -26
  31. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +8 -8
  32. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +10 -10
  33. package/coverage/lcov-report/api/controllers/row/utils.js.html +13 -13
  34. package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
  35. package/coverage/lcov-report/api/controllers/script.js.html +4 -4
  36. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +9 -9
  37. package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
  38. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  39. package/coverage/lcov-report/api/controllers/table/index.js.html +14 -14
  40. package/coverage/lcov-report/api/controllers/table/internal.js.html +12 -12
  41. package/coverage/lcov-report/api/controllers/table/utils.js.html +30 -30
  42. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/user.js.html +20 -20
  44. package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
  45. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  46. package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
  47. package/coverage/lcov-report/api/controllers/view/utils.js.html +11 -11
  48. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
  49. package/coverage/lcov-report/api/controllers/webhook.js.html +15 -15
  50. package/coverage/lcov-report/api/index.html +1 -1
  51. package/coverage/lcov-report/api/index.js.html +3 -3
  52. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/application.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/index.html +22 -7
  64. package/coverage/lcov-report/api/routes/index.js.html +10 -4
  65. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  68. package/coverage/lcov-report/{migrations/usageQuotas/index.js.html → api/routes/migrations.js.html} +25 -55
  69. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  73. package/coverage/lcov-report/api/routes/row.js.html +1 -1
  74. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  75. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  76. package/coverage/lcov-report/api/routes/static.js.html +1 -1
  77. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  78. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  79. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  80. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  81. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  82. package/coverage/lcov-report/automations/actions.js.html +24 -24
  83. package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
  84. package/coverage/lcov-report/automations/bullboard.js.html +16 -16
  85. package/coverage/lcov-report/automations/index.html +1 -1
  86. package/coverage/lcov-report/automations/index.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/bash.js.html +6 -6
  88. package/coverage/lcov-report/automations/steps/createRow.js.html +7 -7
  89. package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
  90. package/coverage/lcov-report/automations/steps/deleteRow.js.html +7 -7
  91. package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
  92. package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
  93. package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
  94. package/coverage/lcov-report/automations/steps/filter.js.html +7 -7
  95. package/coverage/lcov-report/automations/steps/index.html +1 -1
  96. package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
  97. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
  98. package/coverage/lcov-report/automations/steps/queryRows.js.html +10 -10
  99. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
  100. package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
  101. package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
  102. package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
  103. package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
  104. package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
  105. package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
  106. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
  107. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  108. package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
  109. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
  110. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
  111. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
  112. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
  113. package/coverage/lcov-report/automations/triggers.js.html +18 -18
  114. package/coverage/lcov-report/automations/utils.js.html +32 -32
  115. package/coverage/lcov-report/constants/index.html +1 -1
  116. package/coverage/lcov-report/constants/index.js.html +26 -26
  117. package/coverage/lcov-report/constants/layouts.js.html +5 -5
  118. package/coverage/lcov-report/constants/screens.js.html +4 -4
  119. package/coverage/lcov-report/db/client.js.html +18 -18
  120. package/coverage/lcov-report/db/inMemoryView.js.html +7 -7
  121. package/coverage/lcov-report/db/index.html +1 -1
  122. package/coverage/lcov-report/db/index.js.html +3 -3
  123. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +7 -7
  124. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  125. package/coverage/lcov-report/db/linkedRows/index.js.html +18 -18
  126. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +13 -13
  127. package/coverage/lcov-report/db/newid.js.html +4 -4
  128. package/coverage/lcov-report/db/utils.js.html +70 -70
  129. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  130. package/coverage/lcov-report/events/index.html +1 -1
  131. package/coverage/lcov-report/events/index.js.html +5 -5
  132. package/coverage/lcov-report/events/utils.js.html +3 -3
  133. package/coverage/lcov-report/index.html +26 -41
  134. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  135. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  136. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  137. package/coverage/lcov-report/middleware/authorized.js.html +1 -1
  138. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  139. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  140. package/coverage/lcov-report/middleware/index.html +11 -11
  141. package/coverage/lcov-report/middleware/joi-validator.js.html +3 -3
  142. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  143. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  144. package/coverage/lcov-report/middleware/usageQuota.js.html +6 -12
  145. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  146. package/coverage/lcov-report/threads/automation.js.html +1 -1
  147. package/coverage/lcov-report/threads/index.html +1 -1
  148. package/coverage/lcov-report/threads/index.js.html +10 -10
  149. package/coverage/lcov-report/threads/query.js.html +1 -1
  150. package/coverage/lcov-report/threads/utils.js.html +14 -14
  151. package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
  152. package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
  153. package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
  154. package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
  155. package/coverage/lcov-report/utilities/global.js.html +14 -14
  156. package/coverage/lcov-report/utilities/index.html +1 -1
  157. package/coverage/lcov-report/utilities/index.js.html +24 -24
  158. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +8 -8
  159. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  160. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  161. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  162. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  163. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +18 -18
  164. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +4 -4
  165. package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
  166. package/coverage/lcov-report/utilities/security.js.html +8 -8
  167. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  168. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  169. package/coverage/lcov-report/utilities/usageQuota/index.js.html +10 -10
  170. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  171. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  172. package/coverage/lcov-report/utilities/users.js.html +5 -5
  173. package/coverage/lcov-report/utilities/workerRequests.js.html +12 -12
  174. package/coverage/lcov.info +1128 -1176
  175. package/dist/api/controllers/application.js +18 -20
  176. package/dist/api/controllers/migrations.js +21 -0
  177. package/dist/api/routes/index.js +2 -0
  178. package/dist/api/routes/migrations.js +9 -0
  179. package/dist/app.js +35 -5
  180. package/dist/environment.js +1 -0
  181. package/dist/middleware/usageQuota.js +0 -2
  182. package/dist/migrations/functions/appUrls.js +37 -0
  183. package/dist/migrations/functions/quotas1.js +50 -0
  184. package/dist/migrations/{usageQuotas → functions/usageQuotas}/index.js +6 -10
  185. package/dist/migrations/{usageQuotas → functions/usageQuotas}/syncApps.js +11 -5
  186. package/dist/migrations/{usageQuotas → functions/usageQuotas}/syncRows.js +14 -8
  187. package/dist/migrations/functions/userEmailViewCasing.js +24 -0
  188. package/dist/migrations/index.js +62 -0
  189. package/dist/package.json +4 -4
  190. package/dist/tests/utilities/TestConfiguration.js +3 -0
  191. package/dist/tsconfig.tsbuildinfo +1 -1
  192. package/package.json +5 -5
  193. package/src/api/controllers/application.js +3 -3
  194. package/src/api/controllers/migrations.js +13 -0
  195. package/src/api/routes/index.js +2 -0
  196. package/src/api/routes/migrations.js +14 -0
  197. package/src/app.ts +18 -5
  198. package/src/environment.js +1 -0
  199. package/src/middleware/usageQuota.js +0 -2
  200. package/src/migrations/functions/appUrls.ts +25 -0
  201. package/src/migrations/functions/quotas1.ts +20 -0
  202. package/src/migrations/functions/tests/appUrls.spec.js +29 -0
  203. package/src/migrations/{tests/usageQuotas/index.spec.js → functions/tests/quotas1.spec.js} +5 -5
  204. package/src/migrations/functions/tests/userEmailViewCasing.spec.js +25 -0
  205. package/src/migrations/functions/usageQuotas/index.ts +8 -0
  206. package/src/migrations/{usageQuotas/syncApps.js → functions/usageQuotas/syncApps.ts} +3 -3
  207. package/src/migrations/{usageQuotas/syncRows.js → functions/usageQuotas/syncRows.ts} +5 -5
  208. package/src/migrations/{tests/usageQuotas → functions/usageQuotas/tests}/syncApps.spec.js +4 -4
  209. package/src/migrations/{tests/usageQuotas → functions/usageQuotas/tests}/syncRows.spec.js +4 -4
  210. package/src/migrations/functions/userEmailViewCasing.ts +13 -0
  211. package/src/migrations/index.ts +56 -0
  212. package/src/tests/utilities/TestConfiguration.js +4 -0
  213. package/coverage/lcov-report/migrations/usageQuotas/index.html +0 -141
  214. package/coverage/lcov-report/migrations/usageQuotas/syncRows.js.html +0 -143
  215. package/src/migrations/usageQuotas/index.js +0 -24
@@ -1,143 +0,0 @@
1
-
2
- <!doctype html>
3
- <html lang="en">
4
-
5
- <head>
6
- <title>Code coverage report for migrations/usageQuotas/syncRows.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">migrations/usageQuotas</a> syncRows.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'>17/17</span>
29
- </div>
30
-
31
-
32
- <div class='fl pad1y space-right2'>
33
- <span class="strong">50% </span>
34
- <span class="quiet">Branches</span>
35
- <span class='fraction'>2/4</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'>2/2</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'>16/16</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>
74
- <a name='L15'></a><a href='#L15'>15</a>
75
- <a name='L16'></a><a href='#L16'>16</a>
76
- <a name='L17'></a><a href='#L17'>17</a>
77
- <a name='L18'></a><a href='#L18'>18</a>
78
- <a name='L19'></a><a href='#L19'>19</a>
79
- <a name='L20'></a><a href='#L20'>20</a>
80
- <a name='L21'></a><a href='#L21'>21</a>
81
- <a name='L22'></a><a href='#L22'>22</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">25x</span>
82
- <span class="cline-any cline-yes">25x</span>
83
- <span class="cline-any cline-yes">25x</span>
84
- <span class="cline-any cline-yes">25x</span>
85
- <span class="cline-any cline-yes">25x</span>
86
- <span class="cline-any cline-neutral">&nbsp;</span>
87
- <span class="cline-any cline-yes">25x</span>
88
- <span class="cline-any cline-yes">1x</span>
89
- <span class="cline-any cline-neutral">&nbsp;</span>
90
- <span class="cline-any cline-yes">1x</span>
91
- <span class="cline-any cline-yes">4x</span>
92
- <span class="cline-any cline-yes">1x</span>
93
- <span class="cline-any cline-yes">1x</span>
94
- <span class="cline-any cline-neutral">&nbsp;</span>
95
- <span class="cline-any cline-neutral">&nbsp;</span>
96
- <span class="cline-any cline-yes">1x</span>
97
- <span class="cline-any cline-yes">1x</span>
98
- <span class="cline-any cline-yes">1x</span>
99
- <span class="cline-any cline-yes">1x</span>
100
- <span class="cline-any cline-yes">1x</span>
101
- <span class="cline-any cline-neutral">&nbsp;</span>
102
- <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const { getGlobalDB, getTenantId } = require("@budibase/backend-core/tenancy")
103
- const { getAllApps } = require("@budibase/backend-core/db")
104
- const CouchDB = require("../../db")
105
- const { getUsageQuotaDoc } = require("../../utilities/usageQuota")
106
- const { getUniqueRows } = require("../../utilities/usageQuota/rows")
107
- &nbsp;
108
- exports.run = async () =&gt; {
109
- const db = getGlobalDB()
110
- // get all rows in all apps
111
- const allApps = await getAllApps(CouchDB, { all: true })
112
- const appIds = allApps ? allApps.map(app =&gt; app.appId) : <span class="branch-1 cbranch-no" title="branch not covered" >[]</span>
113
- const rows = await getUniqueRows(appIds)
114
- const rowCount = rows ? rows.length : <span class="branch-1 cbranch-no" title="branch not covered" >0</span>
115
- &nbsp;
116
- // sync row count
117
- const tenantId = getTenantId()
118
- console.log(`[Tenant: ${tenantId}] Syncing row count: ${rowCount}`)
119
- const usageDoc = await getUsageQuotaDoc(db)
120
- usageDoc.usageQuota.rows = rowCount
121
- await db.put(usageDoc)
122
- }
123
- &nbsp;</pre></td></tr></table></pre>
124
-
125
- <div class='push'></div><!-- for sticky footer -->
126
- </div><!-- /wrapper -->
127
- <div class='footer quiet pad2 space-top1 center small'>
128
- Code coverage generated by
129
- <a href="https://istanbul.js.org/" target="_blank">istanbul</a>
130
- at Mon Jan 31 2022 16:01:47 GMT+0000 (Coordinated Universal Time)
131
- </div>
132
- </div>
133
- <script src="../../prettify.js"></script>
134
- <script>
135
- window.onload = function () {
136
- prettyPrint();
137
- };
138
- </script>
139
- <script src="../../sorter.js"></script>
140
- <script src="../../block-navigation.js"></script>
141
- </body>
142
- </html>
143
-
@@ -1,24 +0,0 @@
1
- const {
2
- MIGRATIONS,
3
- MIGRATION_DBS,
4
- migrateIfRequired,
5
- } = require("@budibase/backend-core/migrations")
6
- const { useQuotas } = require("../../utilities/usageQuota")
7
- const syncApps = require("./syncApps")
8
- const syncRows = require("./syncRows")
9
-
10
- exports.run = async () => {
11
- if (!useQuotas()) {
12
- return
13
- }
14
-
15
- // Jan 2022
16
- await migrateIfRequired(
17
- MIGRATION_DBS.GLOBAL_DB,
18
- MIGRATIONS.QUOTAS_1,
19
- async () => {
20
- await syncApps.run()
21
- await syncRows.run()
22
- }
23
- )
24
- }