@budibase/server 2.2.4-alpha.1 → 2.2.5

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 (429) hide show
  1. package/__mocks__/aws-sdk.ts +0 -19
  2. package/__mocks__/node-fetch.ts +0 -78
  3. package/builder/assets/{index.77b82b83.js → index.18998a03.js} +194 -194
  4. package/builder/index.html +1 -1
  5. package/coverage/clover.xml +4897 -4907
  6. package/coverage/coverage-final.json +262 -265
  7. package/coverage/lcov-report/index.html +169 -169
  8. package/coverage/lcov-report/src/api/controllers/analytics.ts.html +7 -7
  9. package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +5 -5
  10. package/coverage/lcov-report/src/api/controllers/application.ts.html +159 -171
  11. package/coverage/lcov-report/src/api/controllers/auth.ts.html +11 -11
  12. package/coverage/lcov-report/src/api/controllers/automation.ts.html +51 -51
  13. package/coverage/lcov-report/src/api/controllers/backup.ts.html +6 -6
  14. package/coverage/lcov-report/src/api/controllers/cloud.ts.html +79 -91
  15. package/coverage/lcov-report/src/api/controllers/component.ts.html +5 -5
  16. package/coverage/lcov-report/src/api/controllers/datasource.ts.html +30 -30
  17. package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +14 -14
  18. package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
  19. package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +83 -83
  20. package/coverage/lcov-report/src/api/controllers/dev.ts.html +18 -18
  21. package/coverage/lcov-report/src/api/controllers/index.html +51 -51
  22. package/coverage/lcov-report/src/api/controllers/integration.ts.html +4 -4
  23. package/coverage/lcov-report/src/api/controllers/layout.ts.html +6 -6
  24. package/coverage/lcov-report/src/api/controllers/metadata.ts.html +9 -9
  25. package/coverage/lcov-report/src/api/controllers/migrations.ts.html +4 -4
  26. package/coverage/lcov-report/src/api/controllers/permission.ts.html +13 -13
  27. package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +19 -19
  28. package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +63 -63
  29. package/coverage/lcov-report/src/api/controllers/plugin/index.html +72 -72
  30. package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +135 -150
  31. package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +55 -55
  32. package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +11 -11
  33. package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +18 -18
  34. package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +20 -20
  35. package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +10 -10
  36. package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
  37. package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +2 -2
  38. package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
  39. package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +7 -7
  40. package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +2 -2
  41. package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +2 -2
  42. package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +2 -2
  43. package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +2 -2
  44. package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +6 -6
  45. package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +10 -10
  46. package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +9 -9
  47. package/coverage/lcov-report/src/api/controllers/public/users.ts.html +11 -11
  48. package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +6 -6
  49. package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
  50. package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +8 -8
  51. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
  52. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +8 -8
  53. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +5 -5
  54. package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +8 -8
  55. package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
  56. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +10 -10
  57. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +14 -14
  58. package/coverage/lcov-report/src/api/controllers/query/index.html +19 -19
  59. package/coverage/lcov-report/src/api/controllers/query/index.ts.html +60 -60
  60. package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +10 -10
  61. package/coverage/lcov-report/src/api/controllers/role.ts.html +8 -8
  62. package/coverage/lcov-report/src/api/controllers/routing.ts.html +6 -6
  63. package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +15 -12
  64. package/coverage/lcov-report/src/api/controllers/row/external.ts.html +20 -20
  65. package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
  66. package/coverage/lcov-report/src/api/controllers/row/index.ts.html +14 -14
  67. package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +51 -54
  68. package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +9 -9
  69. package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +12 -21
  70. package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +14 -17
  71. package/coverage/lcov-report/src/api/controllers/screen.ts.html +26 -26
  72. package/coverage/lcov-report/src/api/controllers/script.ts.html +18 -18
  73. package/coverage/lcov-report/src/api/controllers/static/index.html +11 -11
  74. package/coverage/lcov-report/src/api/controllers/static/index.ts.html +44 -32
  75. package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +10 -10
  76. package/coverage/lcov-report/src/api/controllers/table/external.ts.html +14 -14
  77. package/coverage/lcov-report/src/api/controllers/table/index.html +19 -19
  78. package/coverage/lcov-report/src/api/controllers/table/index.ts.html +14 -14
  79. package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +17 -17
  80. package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +51 -51
  81. package/coverage/lcov-report/src/api/controllers/templates.ts.html +7 -7
  82. package/coverage/lcov-report/src/api/controllers/user.ts.html +119 -119
  83. package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +4 -4
  84. package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
  85. package/coverage/lcov-report/src/api/controllers/view/index.ts.html +47 -47
  86. package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +22 -22
  87. package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +33 -33
  88. package/coverage/lcov-report/src/api/controllers/webhook.ts.html +14 -14
  89. package/coverage/lcov-report/src/api/index.html +1 -1
  90. package/coverage/lcov-report/src/api/index.ts.html +33 -33
  91. package/coverage/lcov-report/src/api/routes/analytics.ts.html +7 -7
  92. package/coverage/lcov-report/src/api/routes/apikeys.ts.html +8 -8
  93. package/coverage/lcov-report/src/api/routes/application.ts.html +9 -9
  94. package/coverage/lcov-report/src/api/routes/auth.ts.html +6 -6
  95. package/coverage/lcov-report/src/api/routes/automation.ts.html +11 -11
  96. package/coverage/lcov-report/src/api/routes/backup.ts.html +8 -8
  97. package/coverage/lcov-report/src/api/routes/cloud.ts.html +8 -8
  98. package/coverage/lcov-report/src/api/routes/component.ts.html +8 -8
  99. package/coverage/lcov-report/src/api/routes/datasource.ts.html +9 -9
  100. package/coverage/lcov-report/src/api/routes/deploy.ts.html +8 -8
  101. package/coverage/lcov-report/src/api/routes/dev.ts.html +13 -13
  102. package/coverage/lcov-report/src/api/routes/index.html +1 -1
  103. package/coverage/lcov-report/src/api/routes/index.ts.html +37 -40
  104. package/coverage/lcov-report/src/api/routes/integration.ts.html +8 -8
  105. package/coverage/lcov-report/src/api/routes/layout.ts.html +8 -8
  106. package/coverage/lcov-report/src/api/routes/metadata.ts.html +9 -9
  107. package/coverage/lcov-report/src/api/routes/migrations.ts.html +7 -7
  108. package/coverage/lcov-report/src/api/routes/permission.ts.html +9 -9
  109. package/coverage/lcov-report/src/api/routes/plugin.ts.html +8 -8
  110. package/coverage/lcov-report/src/api/routes/public/applications.ts.html +12 -12
  111. package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
  112. package/coverage/lcov-report/src/api/routes/public/index.ts.html +52 -52
  113. package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
  114. package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +10 -10
  115. package/coverage/lcov-report/src/api/routes/public/queries.ts.html +9 -9
  116. package/coverage/lcov-report/src/api/routes/public/rows.ts.html +12 -12
  117. package/coverage/lcov-report/src/api/routes/public/tables.ts.html +12 -12
  118. package/coverage/lcov-report/src/api/routes/public/tests/index.html +1 -1
  119. package/coverage/lcov-report/src/api/routes/public/tests/utils.ts.html +1 -1
  120. package/coverage/lcov-report/src/api/routes/public/users.ts.html +12 -12
  121. package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +19 -19
  122. package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
  123. package/coverage/lcov-report/src/api/routes/query.ts.html +11 -11
  124. package/coverage/lcov-report/src/api/routes/role.ts.html +9 -9
  125. package/coverage/lcov-report/src/api/routes/routing.ts.html +8 -8
  126. package/coverage/lcov-report/src/api/routes/row.ts.html +11 -11
  127. package/coverage/lcov-report/src/api/routes/screen.ts.html +9 -9
  128. package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
  129. package/coverage/lcov-report/src/api/routes/static.ts.html +14 -14
  130. package/coverage/lcov-report/src/api/routes/table.ts.html +11 -11
  131. package/coverage/lcov-report/src/api/routes/templates.ts.html +8 -8
  132. package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +16 -16
  133. package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
  134. package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +22 -22
  135. package/coverage/lcov-report/src/api/routes/user.ts.html +9 -9
  136. package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
  137. package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +42 -42
  138. package/coverage/lcov-report/src/api/routes/view.ts.html +10 -10
  139. package/coverage/lcov-report/src/api/routes/webhook.ts.html +10 -10
  140. package/coverage/lcov-report/src/app.ts.html +32 -32
  141. package/coverage/lcov-report/src/automations/actions.ts.html +25 -25
  142. package/coverage/lcov-report/src/automations/automationUtils.ts.html +19 -91
  143. package/coverage/lcov-report/src/automations/bullboard.ts.html +11 -11
  144. package/coverage/lcov-report/src/automations/index.html +19 -19
  145. package/coverage/lcov-report/src/automations/index.ts.html +13 -13
  146. package/coverage/lcov-report/src/automations/logging/index.html +1 -1
  147. package/coverage/lcov-report/src/automations/logging/index.ts.html +11 -11
  148. package/coverage/lcov-report/src/automations/steps/bash.ts.html +34 -34
  149. package/coverage/lcov-report/src/automations/steps/createRow.ts.html +7 -7
  150. package/coverage/lcov-report/src/automations/steps/delay.ts.html +5 -5
  151. package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +7 -7
  152. package/coverage/lcov-report/src/automations/steps/discord.ts.html +33 -33
  153. package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +35 -35
  154. package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +31 -31
  155. package/coverage/lcov-report/src/automations/steps/filter.ts.html +6 -6
  156. package/coverage/lcov-report/src/automations/steps/index.html +83 -83
  157. package/coverage/lcov-report/src/automations/steps/integromat.ts.html +6 -6
  158. package/coverage/lcov-report/src/automations/steps/loop.ts.html +3 -3
  159. package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +14 -14
  160. package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +17 -17
  161. package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +28 -28
  162. package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +18 -18
  163. package/coverage/lcov-report/src/automations/steps/slack.ts.html +6 -6
  164. package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +7 -7
  165. package/coverage/lcov-report/src/automations/steps/utils.ts.html +16 -16
  166. package/coverage/lcov-report/src/automations/steps/zapier.ts.html +22 -22
  167. package/coverage/lcov-report/src/automations/tests/utilities/index.html +5 -5
  168. package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +26 -26
  169. package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +3 -3
  170. package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +3 -3
  171. package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
  172. package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +8 -8
  173. package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +3 -3
  174. package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +3 -3
  175. package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +3 -3
  176. package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +3 -3
  177. package/coverage/lcov-report/src/automations/triggers.ts.html +21 -21
  178. package/coverage/lcov-report/src/automations/utils.ts.html +56 -56
  179. package/coverage/lcov-report/src/constants/index.html +1 -1
  180. package/coverage/lcov-report/src/constants/index.ts.html +92 -92
  181. package/coverage/lcov-report/src/constants/layouts.ts.html +4 -4
  182. package/coverage/lcov-report/src/constants/screens.ts.html +5 -5
  183. package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +23 -23
  184. package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +2 -2
  185. package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +2 -2
  186. package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
  187. package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +2 -2
  188. package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +2 -2
  189. package/coverage/lcov-report/src/db/dynamoClient.ts.html +16 -16
  190. package/coverage/lcov-report/src/db/inMemoryView.ts.html +5 -5
  191. package/coverage/lcov-report/src/db/index.html +19 -19
  192. package/coverage/lcov-report/src/db/index.ts.html +9 -9
  193. package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +8 -8
  194. package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +4 -4
  195. package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
  196. package/coverage/lcov-report/src/db/linkedRows/index.ts.html +15 -15
  197. package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +12 -12
  198. package/coverage/lcov-report/src/db/newid.ts.html +4 -4
  199. package/coverage/lcov-report/src/db/utils.ts.html +80 -80
  200. package/coverage/lcov-report/src/definitions/automations.ts.html +4 -4
  201. package/coverage/lcov-report/src/definitions/datasource.ts.html +4 -4
  202. package/coverage/lcov-report/src/definitions/index.html +1 -1
  203. package/coverage/lcov-report/src/environment.ts.html +31 -43
  204. package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +6 -6
  205. package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +5 -5
  206. package/coverage/lcov-report/src/events/index.html +1 -1
  207. package/coverage/lcov-report/src/events/index.ts.html +4 -4
  208. package/coverage/lcov-report/src/events/utils.ts.html +3 -3
  209. package/coverage/lcov-report/src/index.html +26 -26
  210. package/coverage/lcov-report/src/index.ts.html +1 -1
  211. package/coverage/lcov-report/src/integrations/airtable.ts.html +5 -5
  212. package/coverage/lcov-report/src/integrations/arangodb.ts.html +5 -5
  213. package/coverage/lcov-report/src/integrations/base/index.html +1 -1
  214. package/coverage/lcov-report/src/integrations/base/query.ts.html +3 -3
  215. package/coverage/lcov-report/src/integrations/base/sql.ts.html +14 -14
  216. package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +8 -8
  217. package/coverage/lcov-report/src/integrations/base/utils.ts.html +3 -3
  218. package/coverage/lcov-report/src/integrations/couchdb.ts.html +5 -5
  219. package/coverage/lcov-report/src/integrations/dynamodb.ts.html +6 -6
  220. package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +5 -5
  221. package/coverage/lcov-report/src/integrations/firebase.ts.html +5 -5
  222. package/coverage/lcov-report/src/integrations/googlesheets.ts.html +11 -11
  223. package/coverage/lcov-report/src/integrations/index.html +5 -5
  224. package/coverage/lcov-report/src/integrations/index.ts.html +47 -35
  225. package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +8 -8
  226. package/coverage/lcov-report/src/integrations/mongodb.ts.html +5 -5
  227. package/coverage/lcov-report/src/integrations/mysql.ts.html +10 -10
  228. package/coverage/lcov-report/src/integrations/oracle.ts.html +13 -13
  229. package/coverage/lcov-report/src/integrations/postgres.ts.html +42 -42
  230. package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
  231. package/coverage/lcov-report/src/integrations/queries/sql.ts.html +13 -13
  232. package/coverage/lcov-report/src/integrations/redis.ts.html +5 -5
  233. package/coverage/lcov-report/src/integrations/rest.ts.html +16 -16
  234. package/coverage/lcov-report/src/integrations/s3.ts.html +6 -6
  235. package/coverage/lcov-report/src/integrations/snowflake.ts.html +5 -5
  236. package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
  237. package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
  238. package/coverage/lcov-report/src/integrations/utils.ts.html +36 -36
  239. package/coverage/lcov-report/src/middleware/appInfo.ts.html +7 -7
  240. package/coverage/lcov-report/src/middleware/authorized.ts.html +28 -28
  241. package/coverage/lcov-report/src/middleware/builder.ts.html +17 -17
  242. package/coverage/lcov-report/src/middleware/currentapp.ts.html +39 -39
  243. package/coverage/lcov-report/src/middleware/index.html +1 -1
  244. package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
  245. package/coverage/lcov-report/src/middleware/publicApi.ts.html +4 -4
  246. package/coverage/lcov-report/src/middleware/resourceId.ts.html +22 -22
  247. package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
  248. package/coverage/lcov-report/src/middleware/utils.ts.html +4 -4
  249. package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +4 -4
  250. package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +5 -5
  251. package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +5 -5
  252. package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +1 -1
  253. package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +5 -5
  254. package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +7 -7
  255. package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +5 -5
  256. package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +5 -5
  257. package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +4 -4
  258. package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +19 -19
  259. package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +10 -13
  260. package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
  261. package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +7 -7
  262. package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +6 -6
  263. package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +15 -15
  264. package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
  265. package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +5 -5
  266. package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +8 -8
  267. package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
  268. package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +6 -6
  269. package/coverage/lcov-report/src/migrations/functions/tableSettings.ts.html +6 -6
  270. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
  271. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +2 -2
  272. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +5 -5
  273. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +4 -4
  274. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +6 -6
  275. package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +3 -3
  276. package/coverage/lcov-report/src/migrations/index.html +1 -1
  277. package/coverage/lcov-report/src/migrations/index.ts.html +32 -32
  278. package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
  279. package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
  280. package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
  281. package/coverage/lcov-report/src/sdk/app/applications/index.html +15 -15
  282. package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +4 -4
  283. package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +34 -34
  284. package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +9 -9
  285. package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
  286. package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +3 -3
  287. package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +6 -6
  288. package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +3 -3
  289. package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +17 -17
  290. package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +54 -42
  291. package/coverage/lcov-report/src/sdk/app/backups/index.html +30 -30
  292. package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +5 -5
  293. package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +73 -73
  294. package/coverage/lcov-report/src/sdk/app/tables/index.html +1 -1
  295. package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +5 -5
  296. package/coverage/lcov-report/src/sdk/index.html +1 -1
  297. package/coverage/lcov-report/src/sdk/index.ts.html +8 -8
  298. package/coverage/lcov-report/src/sdk/users/index.html +5 -5
  299. package/coverage/lcov-report/src/sdk/users/index.ts.html +3 -3
  300. package/coverage/lcov-report/src/sdk/users/utils.ts.html +34 -34
  301. package/coverage/lcov-report/src/startup.ts.html +42 -42
  302. package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +119 -146
  303. package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +15 -15
  304. package/coverage/lcov-report/src/tests/utilities/index.html +10 -10
  305. package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
  306. package/coverage/lcov-report/src/tests/utilities/structures.ts.html +30 -30
  307. package/coverage/lcov-report/src/threads/automation.ts.html +101 -32
  308. package/coverage/lcov-report/src/threads/index.html +19 -19
  309. package/coverage/lcov-report/src/threads/index.ts.html +25 -25
  310. package/coverage/lcov-report/src/threads/query.ts.html +71 -71
  311. package/coverage/lcov-report/src/threads/utils.ts.html +18 -18
  312. package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +3 -3
  313. package/coverage/lcov-report/src/utilities/centralPath.ts.html +4 -4
  314. package/coverage/lcov-report/src/utilities/csvParser.ts.html +8 -8
  315. package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +12 -12
  316. package/coverage/lcov-report/src/utilities/fileSystem/index.html +19 -79
  317. package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1049 -20
  318. package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
  319. package/coverage/lcov-report/src/utilities/global.ts.html +42 -42
  320. package/coverage/lcov-report/src/utilities/index.html +63 -48
  321. package/coverage/lcov-report/src/utilities/index.ts.html +168 -36
  322. package/coverage/lcov-report/src/utilities/plugins.ts.html +151 -0
  323. package/coverage/lcov-report/src/utilities/redis.ts.html +32 -32
  324. package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
  325. package/coverage/lcov-report/src/utilities/routing/index.ts.html +5 -5
  326. package/coverage/lcov-report/src/utilities/rowProcessor/index.html +28 -28
  327. package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +33 -60
  328. package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +3 -3
  329. package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +38 -38
  330. package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +32 -32
  331. package/coverage/lcov-report/src/utilities/security.ts.html +6 -6
  332. package/coverage/lcov-report/src/utilities/statusCodes.ts.html +1 -1
  333. package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
  334. package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +35 -35
  335. package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
  336. package/coverage/lcov-report/src/utilities/users.ts.html +6 -6
  337. package/coverage/lcov-report/src/utilities/workerRequests.ts.html +56 -56
  338. package/coverage/lcov-report/src/watch.ts.html +9 -9
  339. package/coverage/lcov-report/src/websocket.ts.html +15 -15
  340. package/coverage/lcov.info +6958 -6989
  341. package/dist/api/controllers/application.js +10 -9
  342. package/dist/api/controllers/cloud.js +2 -6
  343. package/dist/api/controllers/plugin/index.js +6 -6
  344. package/dist/api/controllers/row/ExternalRequest.js +1 -0
  345. package/dist/api/controllers/row/internal.js +11 -11
  346. package/dist/api/controllers/row/staticFormula.js +1 -1
  347. package/dist/api/controllers/static/index.js +11 -8
  348. package/dist/api/routes/tests/utilities/TestFunctions.js +167 -0
  349. package/dist/api/routes/tests/utilities/index.js +131 -0
  350. package/dist/automations/automationUtils.js +1 -26
  351. package/dist/automations/tests/utilities/index.js +81 -0
  352. package/dist/environment.js +2 -6
  353. package/dist/integrations/index.js +2 -1
  354. package/dist/migrations/functions/backfill/global/configs.js +4 -4
  355. package/dist/package.json +7 -9
  356. package/dist/sdk/app/backups/imports.js +7 -3
  357. package/dist/tests/utilities/TestConfiguration.js +562 -0
  358. package/dist/tests/utilities/controllers.js +40 -0
  359. package/dist/tests/utilities/structures.js +168 -0
  360. package/dist/threads/automation.js +26 -2
  361. package/dist/tsconfig.build.tsbuildinfo +1 -1
  362. package/dist/utilities/fileSystem/clientLibrary.js +3 -3
  363. package/dist/utilities/fileSystem/index.js +342 -18
  364. package/dist/utilities/index.js +44 -1
  365. package/dist/utilities/plugins.js +26 -0
  366. package/dist/utilities/rowProcessor/index.js +4 -12
  367. package/package.json +8 -10
  368. package/src/api/controllers/application.ts +12 -16
  369. package/src/api/controllers/auth.ts +2 -2
  370. package/src/api/controllers/cloud.ts +6 -10
  371. package/src/api/controllers/plugin/index.ts +9 -14
  372. package/src/api/controllers/row/ExternalRequest.ts +1 -0
  373. package/src/api/controllers/row/internal.ts +22 -23
  374. package/src/api/controllers/row/staticFormula.ts +2 -5
  375. package/src/api/controllers/row/utils.ts +1 -2
  376. package/src/api/controllers/static/index.ts +10 -6
  377. package/src/api/routes/index.ts +3 -4
  378. package/src/api/routes/tests/__snapshots__/{datasource.spec.ts.snap → datasource.spec.js.snap} +0 -0
  379. package/src/api/routes/tests/{application.spec.ts → application.spec.js} +7 -40
  380. package/src/api/routes/tests/{backup.spec.ts → backup.spec.js} +6 -17
  381. package/src/api/routes/tests/{datasource.spec.ts → datasource.spec.js} +15 -23
  382. package/src/api/routes/tests/routing.spec.js +1 -0
  383. package/src/api/routes/tests/row.spec.js +2 -4
  384. package/src/api/routes/tests/static.spec.js +17 -2
  385. package/src/api/routes/tests/table.spec.js +2 -8
  386. package/src/api/routes/tests/user.spec.js +0 -86
  387. package/src/api/routes/tests/utilities/index.ts +2 -2
  388. package/src/automations/automationUtils.ts +0 -24
  389. package/src/automations/tests/utilities/index.ts +2 -2
  390. package/src/automations/unitTests/automationUtils.spec.js +17 -0
  391. package/src/environment.ts +2 -6
  392. package/src/integrations/index.ts +5 -1
  393. package/src/migrations/functions/backfill/global/configs.ts +4 -5
  394. package/src/sdk/app/backups/imports.ts +7 -3
  395. package/src/tests/jestSetup.ts +1 -4
  396. package/src/tests/utilities/TestConfiguration.ts +0 -9
  397. package/src/threads/automation.ts +25 -2
  398. package/src/utilities/fileSystem/clientLibrary.ts +1 -1
  399. package/src/utilities/fileSystem/index.ts +348 -5
  400. package/src/utilities/index.ts +45 -1
  401. package/src/utilities/plugins.ts +22 -0
  402. package/src/utilities/rowProcessor/index.ts +8 -17
  403. package/tsconfig.build.json +0 -2
  404. package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +0 -343
  405. package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +0 -595
  406. package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +0 -280
  407. package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +0 -193
  408. package/dist/utilities/fileSystem/app.js +0 -97
  409. package/dist/utilities/fileSystem/filesystem.js +0 -182
  410. package/dist/utilities/fileSystem/plugin.js +0 -63
  411. package/dist/utilities/fileSystem/template.js +0 -44
  412. package/src/api/routes/tests/cloud.spec.ts +0 -66
  413. package/src/api/routes/tests/data/budibase-component-1.0.1.tgz +0 -0
  414. package/src/api/routes/tests/data/comment-box-1.0.2.tar.gz +0 -0
  415. package/src/api/routes/tests/data/export-test.tar.gz +0 -0
  416. package/src/api/routes/tests/plugin.spec.ts +0 -179
  417. package/src/automations/tests/bash.spec.js +0 -34
  418. package/src/automations/tests/discord.spec.js +0 -27
  419. package/src/automations/tests/executeQuery.spec.js +0 -49
  420. package/src/automations/tests/executeScript.spec.js +0 -48
  421. package/src/automations/tests/sendSmtpEmail.spec.js +0 -71
  422. package/src/automations/tests/serverLog.spec.js +0 -22
  423. package/src/automations/tests/zapier.spec.js +0 -27
  424. package/src/automations/unitTests/automationUtils.spec.ts +0 -65
  425. package/src/utilities/fileSystem/app.ts +0 -86
  426. package/src/utilities/fileSystem/filesystem.ts +0 -170
  427. package/src/utilities/fileSystem/plugin.ts +0 -65
  428. package/src/utilities/fileSystem/template.ts +0 -36
  429. package/src/utilities/rowProcessor/tests/utils.spec.ts +0 -57
@@ -1,5 +1,20 @@
1
+ jest.mock("node-fetch")
2
+ jest.mock("aws-sdk", () => ({
3
+ config: {
4
+ update: jest.fn(),
5
+ },
6
+ DynamoDB: {
7
+ DocumentClient: jest.fn(),
8
+ },
9
+ S3: jest.fn(() => ({
10
+ getSignedUrl: jest.fn(() => {
11
+ return "my-url"
12
+ }),
13
+ })),
14
+ }))
15
+
1
16
  const setup = require("./utilities")
2
- const { constants } = require("@budibase/backend-core")
17
+ const { events, constants } = require("@budibase/backend-core")
3
18
 
4
19
  describe("/static", () => {
5
20
  let request = setup.getRequest()
@@ -87,7 +102,7 @@ describe("/static", () => {
87
102
  .set(config.defaultHeaders())
88
103
  .expect("Content-Type", /json/)
89
104
  .expect(200)
90
- expect(res.body.signedUrl).toEqual("http://test.com/foo/bar")
105
+ expect(res.body.signedUrl).toEqual("my-url")
91
106
  expect(res.body.publicUrl).toEqual(
92
107
  `https://${bucket}.s3.eu-west-1.amazonaws.com/${key}`
93
108
  )
@@ -51,7 +51,7 @@ describe("/tables", () => {
51
51
  table.dataImport.schema = table.schema
52
52
 
53
53
  const res = await createTable(table)
54
-
54
+
55
55
  expect(events.table.created).toBeCalledTimes(1)
56
56
  expect(events.table.created).toBeCalledWith(res.body)
57
57
  expect(events.table.imported).toBeCalledTimes(1)
@@ -87,12 +87,6 @@ describe("/tables", () => {
87
87
 
88
88
  it("updates all the row fields for a table when a schema key is renamed", async () => {
89
89
  const testTable = await config.createTable()
90
- await config.createView({
91
- name: "TestView",
92
- field: "Price",
93
- calculation: "stats",
94
- tableId: testTable._id,
95
- })
96
90
 
97
91
  const testRow = await request
98
92
  .post(`/api/${testTable._id}/rows`)
@@ -115,7 +109,7 @@ describe("/tables", () => {
115
109
  updated: "updatedName"
116
110
  },
117
111
  schema: {
118
- updatedName: { type: "string" }
112
+ updatedName: {type: "string"}
119
113
  }
120
114
  })
121
115
  .set(config.defaultHeaders())
@@ -90,90 +90,4 @@ describe("/users", () => {
90
90
  expect(res.body.tableId).toBeDefined()
91
91
  })
92
92
  })
93
- describe("setFlag", () => {
94
- it("should throw an error if a flag is not provided", async () => {
95
- await config.createUser()
96
- const res = await request
97
- .post(`/api/users/flags`)
98
- .set(config.defaultHeaders())
99
- .send({ value: "test" })
100
- .expect(400)
101
- .expect("Content-Type", /json/)
102
- expect(res.body.message).toEqual("Must supply a 'flag' field in request body.")
103
-
104
- })
105
-
106
- it("should be able to set a flag on the user", async () => {
107
- await config.createUser()
108
- const res = await request
109
- .post(`/api/users/flags`)
110
- .set(config.defaultHeaders())
111
- .send({ value: "test", flag: "test" })
112
- .expect(200)
113
- .expect("Content-Type", /json/)
114
- expect(res.body.message).toEqual("Flag set successfully")
115
- })
116
- })
117
-
118
- describe("getFlags", () => {
119
- it("should get flags for a specific user", async () => {
120
- let flagData = { value: "test", flag: "test" }
121
- await config.createUser()
122
- await request
123
- .post(`/api/users/flags`)
124
- .set(config.defaultHeaders())
125
- .send(flagData)
126
- .expect(200)
127
- .expect("Content-Type", /json/)
128
-
129
- const res = await request
130
- .get(`/api/users/flags`)
131
- .set(config.defaultHeaders())
132
- .expect(200)
133
- .expect("Content-Type", /json/)
134
- expect(res.body[flagData.value]).toEqual(flagData.flag)
135
- })
136
- })
137
-
138
- describe("setFlag", () => {
139
- it("should throw an error if a flag is not provided", async () => {
140
- await config.createUser()
141
- const res = await request
142
- .post(`/api/users/flags`)
143
- .set(config.defaultHeaders())
144
- .send({ value: "test" })
145
- .expect(400)
146
- .expect("Content-Type", /json/)
147
- expect(res.body.message).toEqual("Must supply a 'flag' field in request body.")
148
-
149
- })
150
-
151
- it("should be able to set a flag on the user", async () => {
152
- await config.createUser()
153
- const res = await request
154
- .post(`/api/users/flags`)
155
- .set(config.defaultHeaders())
156
- .send({ value: "test", flag: "test" })
157
- .expect(200)
158
- .expect("Content-Type", /json/)
159
- expect(res.body.message).toEqual("Flag set successfully")
160
- })
161
- })
162
-
163
- describe("syncUser", () => {
164
- it("should sync the user", async () => {
165
- let user = await config.createUser()
166
- await config.createApp('New App')
167
- let res = await request
168
- .post(`/api/users/metadata/sync/${user._id}`)
169
- .set(config.defaultHeaders())
170
- .expect(200)
171
- .expect("Content-Type", /json/)
172
- expect(res.body.message).toEqual('User synced.')
173
- })
174
- })
175
-
176
-
177
-
178
-
179
93
  })
@@ -63,14 +63,14 @@ export function afterAll() {
63
63
 
64
64
  export function getRequest() {
65
65
  if (!request) {
66
- beforeAll()
66
+ exports.beforeAll()
67
67
  }
68
68
  return request
69
69
  }
70
70
 
71
71
  export function getConfig() {
72
72
  if (!config) {
73
- beforeAll()
73
+ exports.beforeAll()
74
74
  }
75
75
  return config
76
76
  }
@@ -5,7 +5,6 @@ import {
5
5
  } from "@budibase/string-templates"
6
6
  import sdk from "../sdk"
7
7
  import { Row } from "@budibase/types"
8
- import { LoopStep, LoopStepType, LoopInput } from "../definitions/automations"
9
8
 
10
9
  /**
11
10
  * When values are input to the system generally they will be of type string as this is required for template strings.
@@ -124,26 +123,3 @@ export function stringSplit(value: string | string[]) {
124
123
  }
125
124
  return value
126
125
  }
127
-
128
- export function typecastForLooping(loopStep: LoopStep, input: LoopInput) {
129
- if (!input || !input.binding) {
130
- return null
131
- }
132
- try {
133
- switch (loopStep.inputs.option) {
134
- case LoopStepType.ARRAY:
135
- if (typeof input.binding === "string") {
136
- return JSON.parse(input.binding)
137
- }
138
- break
139
- case LoopStepType.STRING:
140
- if (Array.isArray(input.binding)) {
141
- return input.binding.join(",")
142
- }
143
- break
144
- }
145
- } catch (err) {
146
- throw new Error("Unable to cast to correct type")
147
- }
148
- return input.binding
149
- }
@@ -31,7 +31,7 @@ export async function runInProd(fn: any) {
31
31
  }
32
32
  }
33
33
 
34
- export async function runStep(stepId: string, inputs: any, stepContext?: any) {
34
+ export async function runStep(stepId: string, inputs: any) {
35
35
  async function run() {
36
36
  let step = await getAction(stepId)
37
37
  expect(step).toBeDefined()
@@ -39,7 +39,7 @@ export async function runStep(stepId: string, inputs: any, stepContext?: any) {
39
39
  throw new Error("No step found")
40
40
  }
41
41
  return step({
42
- context: stepContext || {},
42
+ context: {},
43
43
  inputs,
44
44
  appId: config ? config.getAppId() : null,
45
45
  // don't really need an API key, mocked out usage quota, not being tested here
@@ -0,0 +1,17 @@
1
+ const automationUtils = require("../automationUtils")
2
+
3
+ describe("automationUtils", () => {
4
+ test("substituteLoopStep should allow multiple loop binding substitutes", () => {
5
+ expect(automationUtils.substituteLoopStep(
6
+ `{{ loop.currentItem._id }} {{ loop.currentItem._id }} {{ loop.currentItem._id }}`,
7
+ "step.2"))
8
+ .toBe(`{{ step.2.currentItem._id }} {{ step.2.currentItem._id }} {{ step.2.currentItem._id }}`)
9
+ })
10
+
11
+ test("substituteLoopStep should handle not subsituting outside of curly braces", () => {
12
+ expect(automationUtils.substituteLoopStep(
13
+ `loop {{ loop.currentItem._id }}loop loop{{ loop.currentItem._id }}loop`,
14
+ "step.2"))
15
+ .toBe(`loop {{ step.2.currentItem._id }}loop loop{{ step.2.currentItem._id }}loop`)
16
+ })
17
+ })
@@ -79,6 +79,7 @@ const environment = {
79
79
  // flags
80
80
  ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
81
81
  DISABLE_THREADING: process.env.DISABLE_THREADING,
82
+ DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
82
83
  DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS,
83
84
  MULTI_TENANCY: process.env.MULTI_TENANCY,
84
85
  ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
@@ -112,17 +113,12 @@ if (isDev() && module.exports.DISABLE_THREADING == null) {
112
113
  }
113
114
 
114
115
  // clean up any environment variable edge cases
115
- for (let [key, value] of Object.entries(environment)) {
116
+ for (let [key, value] of Object.entries(module.exports)) {
116
117
  // handle the edge case of "0" to disable an environment variable
117
118
  if (value === "0") {
118
119
  // @ts-ignore
119
120
  environment[key] = 0
120
121
  }
121
- // handle the edge case of "false" to disable an environment variable
122
- if (value === "false") {
123
- // @ts-ignore
124
- environment[key] = 0
125
- }
126
122
  }
127
123
 
128
124
  export = environment
@@ -98,7 +98,11 @@ export async function getIntegration(integration: string) {
98
98
  for (let plugin of plugins) {
99
99
  if (plugin.name === integration) {
100
100
  // need to use commonJS require due to its dynamic runtime nature
101
- const retrieved: any = await getDatasourcePlugin(plugin)
101
+ const retrieved: any = await getDatasourcePlugin(
102
+ plugin.name,
103
+ plugin.jsUrl,
104
+ plugin.schema?.hash
105
+ )
102
106
  if (retrieved.integration) {
103
107
  return retrieved.integration
104
108
  } else {
@@ -5,7 +5,6 @@ import {
5
5
  isGoogleConfig,
6
6
  isOIDCConfig,
7
7
  isSettingsConfig,
8
- ConfigType,
9
8
  } from "@budibase/types"
10
9
  import env from "./../../../../environment"
11
10
 
@@ -32,15 +31,15 @@ export const backfill = async (
32
31
  await events.email.SMTPCreated(timestamp)
33
32
  }
34
33
  if (isGoogleConfig(config)) {
35
- await events.auth.SSOCreated(ConfigType.GOOGLE, timestamp)
34
+ await events.auth.SSOCreated("google", timestamp)
36
35
  if (config.config.activated) {
37
- await events.auth.SSOActivated(ConfigType.GOOGLE, timestamp)
36
+ await events.auth.SSOActivated("google", timestamp)
38
37
  }
39
38
  }
40
39
  if (isOIDCConfig(config)) {
41
- await events.auth.SSOCreated(ConfigType.OIDC, timestamp)
40
+ await events.auth.SSOCreated("oidc", timestamp)
42
41
  if (config.config.configs[0].activated) {
43
- await events.auth.SSOActivated(ConfigType.OIDC, timestamp)
42
+ await events.auth.SSOActivated("oidc", timestamp)
44
43
  }
45
44
  }
46
45
  if (isSettingsConfig(config)) {
@@ -55,8 +55,12 @@ async function updateAttachmentColumns(prodAppId: string, db: Database) {
55
55
  continue
56
56
  }
57
57
  row[column] = row[column].map((attachment: RowAttachment) => {
58
- // Key looks like: appId/attachments/file.csv
59
- const urlParts = attachment.key.split("/")
58
+ // URL looks like: /prod-budi-app-assets/appId/attachments/file.csv
59
+ const urlParts = attachment.url.split("/")
60
+ // drop the first empty element
61
+ urlParts.shift()
62
+ // get the prefix
63
+ const prefix = urlParts.shift()
60
64
  // remove the app ID
61
65
  urlParts.shift()
62
66
  // add new app ID
@@ -65,7 +69,7 @@ async function updateAttachmentColumns(prodAppId: string, db: Database) {
65
69
  return {
66
70
  ...attachment,
67
71
  key,
68
- url: "", // calculated on retrieval using key
72
+ url: `/${prefix}/${key}`,
69
73
  }
70
74
  })
71
75
  }
@@ -19,10 +19,7 @@ import { mocks } from "@budibase/backend-core/tests"
19
19
  const tk = require("timekeeper")
20
20
  tk.freeze(mocks.date.MOCK_DATE)
21
21
 
22
- if (!process.env.DEBUG) {
23
- global.console.log = jest.fn() // console.log are ignored in tests
24
- global.console.warn = jest.fn() // console.warn are ignored in tests
25
- }
22
+ global.console.log = jest.fn() // console.log are ignored in tests
26
23
 
27
24
  if (!process.env.CI) {
28
25
  // set a longer timeout in dev for debugging
@@ -1,12 +1,3 @@
1
- import { mocks } from "@budibase/backend-core/tests"
2
-
3
- // init the licensing mock
4
- import * as pro from "@budibase/pro"
5
- mocks.licenses.init(pro)
6
-
7
- // use unlimited license by default
8
- mocks.licenses.useUnlimited()
9
-
10
1
  import { init as dbInit } from "../../db"
11
2
  dbInit()
12
3
  import env from "../../environment"
@@ -32,8 +32,31 @@ const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId
32
32
  const CRON_STEP_ID = triggerDefs.CRON.stepId
33
33
  const STOPPED_STATUS = { success: true, status: AutomationStatus.STOPPED }
34
34
 
35
+ function typecastForLooping(loopStep: LoopStep, input: LoopInput) {
36
+ if (!input || !input.binding) {
37
+ return null
38
+ }
39
+ try {
40
+ switch (loopStep.inputs.option) {
41
+ case LoopStepType.ARRAY:
42
+ if (typeof input.binding === "string") {
43
+ return JSON.parse(input.binding)
44
+ }
45
+ break
46
+ case LoopStepType.STRING:
47
+ if (Array.isArray(input.binding)) {
48
+ return input.binding.join(",")
49
+ }
50
+ break
51
+ }
52
+ } catch (err) {
53
+ throw new Error("Unable to cast to correct type")
54
+ }
55
+ return input.binding
56
+ }
57
+
35
58
  function getLoopIterations(loopStep: LoopStep, input: LoopInput) {
36
- const binding = automationUtils.typecastForLooping(loopStep, input)
59
+ const binding = typecastForLooping(loopStep, input)
37
60
  if (!loopStep || !binding) {
38
61
  return 1
39
62
  }
@@ -266,7 +289,7 @@ class Orchestrator {
266
289
 
267
290
  let tempOutput = { items: loopSteps, iterations: iterationCount }
268
291
  try {
269
- newInput.binding = automationUtils.typecastForLooping(
292
+ newInput.binding = typecastForLooping(
270
293
  loopStep as LoopStep,
271
294
  newInput
272
295
  )
@@ -4,7 +4,7 @@ import fs from "fs"
4
4
  import { objectStore } from "@budibase/backend-core"
5
5
  import { resolve } from "../centralPath"
6
6
  import env from "../../environment"
7
- import { TOP_LEVEL_PATH } from "./filesystem"
7
+ const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..")
8
8
 
9
9
  /**
10
10
  * Client library paths in the object store: