@budibase/server 2.1.32-alpha.1 → 2.1.32-alpha.10

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 (601) hide show
  1. package/builder/assets/{index.7176fd99.css → index.144dddb2.css} +1 -1
  2. package/builder/assets/{index.24cb0a61.js → index.d97a0eb1.js} +290 -290
  3. package/builder/index.html +2 -2
  4. package/coverage/clover.xml +3723 -3691
  5. package/coverage/coverage-final.json +113 -108
  6. package/coverage/lcov-report/index.html +170 -155
  7. package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
  8. package/coverage/lcov-report/src/api/controllers/{apikeys.js.html → apikeys.ts.html} +19 -19
  9. package/coverage/lcov-report/src/api/controllers/application.ts.html +70 -13
  10. package/coverage/lcov-report/src/api/controllers/auth.ts.html +3 -3
  11. package/coverage/lcov-report/src/api/controllers/{automation.js.html → automation.ts.html} +68 -68
  12. package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
  13. package/coverage/lcov-report/src/api/controllers/{cloud.js.html → cloud.ts.html} +40 -40
  14. package/coverage/lcov-report/src/api/controllers/component.ts.html +6 -3
  15. package/coverage/lcov-report/src/api/controllers/{datasource.js.html → datasource.ts.html} +239 -80
  16. package/coverage/lcov-report/src/api/controllers/deploy/{Deployment.js.html → Deployment.ts.html} +30 -21
  17. package/coverage/lcov-report/src/api/controllers/deploy/index.html +6 -6
  18. package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +1 -1
  19. package/coverage/lcov-report/src/api/controllers/dev.ts.html +1 -1
  20. package/coverage/lcov-report/src/api/controllers/index.html +120 -120
  21. package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
  22. package/coverage/lcov-report/src/api/controllers/{layout.js.html → layout.ts.html} +19 -19
  23. package/coverage/lcov-report/src/api/controllers/{metadata.js.html → metadata.ts.html} +19 -16
  24. package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
  25. package/coverage/lcov-report/src/api/controllers/{permission.js.html → permission.ts.html} +73 -64
  26. package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +1 -1
  27. package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +1 -1
  28. package/coverage/lcov-report/src/api/controllers/plugin/index.html +11 -11
  29. package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +10 -13
  30. package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +1 -1
  31. package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +1 -1
  32. package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +1 -1
  33. package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +1 -1
  34. package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +1 -1
  35. package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
  36. package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +1 -1
  37. package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
  38. package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +1 -1
  39. package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +1 -1
  40. package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +1 -1
  41. package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +1 -1
  42. package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +1 -1
  43. package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +1 -1
  44. package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +1 -1
  45. package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +3 -3
  46. package/coverage/lcov-report/src/api/controllers/public/users.ts.html +1 -1
  47. package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +1 -1
  48. package/coverage/lcov-report/src/api/controllers/query/import/index.html +11 -11
  49. package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +8 -11
  50. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
  51. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +1 -1
  52. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +1 -1
  53. package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +1 -1
  54. package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
  55. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +1 -1
  56. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +1 -1
  57. package/coverage/lcov-report/src/api/controllers/query/index.html +2 -2
  58. package/coverage/lcov-report/src/api/controllers/query/index.ts.html +1 -1
  59. package/coverage/lcov-report/src/api/controllers/query/{validation.js.html → validation.ts.html} +10 -10
  60. package/coverage/lcov-report/src/api/controllers/{role.js.html → role.ts.html} +37 -49
  61. package/coverage/lcov-report/src/api/controllers/{routing.js.html → routing.ts.html} +58 -49
  62. package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +6 -18
  63. package/coverage/lcov-report/src/api/controllers/row/external.js.html +4 -4
  64. package/coverage/lcov-report/src/api/controllers/row/index.html +35 -35
  65. package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
  66. package/coverage/lcov-report/src/api/controllers/row/internal.js.html +17 -20
  67. package/coverage/lcov-report/src/api/controllers/row/{internalSearch.js.html → internalSearch.ts.html} +175 -103
  68. package/coverage/lcov-report/src/api/controllers/row/{staticFormula.js.html → staticFormula.ts.html} +62 -47
  69. package/coverage/lcov-report/src/api/controllers/row/{utils.js.html → utils.ts.html} +57 -36
  70. package/coverage/lcov-report/src/api/controllers/screen.ts.html +29 -17
  71. package/coverage/lcov-report/src/api/controllers/{script.js.html → script.ts.html} +10 -7
  72. package/coverage/lcov-report/src/api/controllers/static/index.html +10 -10
  73. package/coverage/lcov-report/src/api/controllers/static/index.ts.html +15 -27
  74. package/coverage/lcov-report/src/api/controllers/table/{bulkFormula.js.html → bulkFormula.ts.html} +89 -47
  75. package/coverage/lcov-report/src/api/controllers/table/{external.js.html → external.ts.html} +192 -87
  76. package/coverage/lcov-report/src/api/controllers/table/index.html +41 -41
  77. package/coverage/lcov-report/src/api/controllers/table/{index.js.html → index.ts.html} +28 -28
  78. package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +3 -6
  79. package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +56 -41
  80. package/coverage/lcov-report/src/api/controllers/{templates.js.html → templates.ts.html} +27 -18
  81. package/coverage/lcov-report/src/api/controllers/{user.js.html → user.ts.html} +72 -78
  82. package/coverage/lcov-report/src/api/controllers/view/{exporters.js.html → exporters.ts.html} +13 -7
  83. package/coverage/lcov-report/src/api/controllers/view/index.html +21 -21
  84. package/coverage/lcov-report/src/api/controllers/view/{index.js.html → index.ts.html} +68 -41
  85. package/coverage/lcov-report/src/api/controllers/view/{utils.js.html → utils.ts.html} +54 -36
  86. package/coverage/lcov-report/src/api/controllers/view/viewBuilder.js.html +1 -1
  87. package/coverage/lcov-report/src/api/controllers/webhook.ts.html +1 -1
  88. package/coverage/lcov-report/src/api/index.html +14 -14
  89. package/coverage/lcov-report/src/api/{index.js.html → index.ts.html} +28 -49
  90. package/coverage/lcov-report/src/api/routes/{analytics.js.html → analytics.ts.html} +7 -7
  91. package/coverage/lcov-report/src/api/routes/{apikeys.js.html → apikeys.ts.html} +11 -11
  92. package/coverage/lcov-report/src/api/routes/application.ts.html +35 -11
  93. package/coverage/lcov-report/src/api/routes/auth.ts.html +3 -3
  94. package/coverage/lcov-report/src/api/routes/{automation.js.html → automation.ts.html} +41 -35
  95. package/coverage/lcov-report/src/api/routes/backup.ts.html +18 -6
  96. package/coverage/lcov-report/src/api/routes/{deploy.js.html → cloud.ts.html} +18 -15
  97. package/coverage/lcov-report/src/api/routes/{component.js.html → component.ts.html} +10 -10
  98. package/coverage/lcov-report/src/api/routes/{datasource.js.html → datasource.ts.html} +53 -26
  99. package/coverage/lcov-report/src/api/routes/deploy.ts.html +148 -0
  100. package/coverage/lcov-report/src/api/routes/{dev.js.html → dev.ts.html} +54 -18
  101. package/coverage/lcov-report/src/api/routes/index.html +41 -41
  102. package/coverage/lcov-report/src/api/routes/index.ts.html +3 -3
  103. package/coverage/lcov-report/src/api/routes/integration.ts.html +133 -0
  104. package/coverage/lcov-report/src/api/routes/{layout.js.html → layout.ts.html} +11 -11
  105. package/coverage/lcov-report/src/api/routes/{metadata.js.html → metadata.ts.html} +17 -17
  106. package/coverage/lcov-report/src/api/routes/{migrations.js.html → migrations.ts.html} +12 -12
  107. package/coverage/lcov-report/src/api/routes/{permission.js.html → permission.ts.html} +41 -17
  108. package/coverage/lcov-report/src/api/routes/plugin.ts.html +32 -8
  109. package/coverage/lcov-report/src/api/routes/public/applications.ts.html +1 -1
  110. package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
  111. package/coverage/lcov-report/src/api/routes/public/index.ts.html +1 -1
  112. package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
  113. package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +1 -1
  114. package/coverage/lcov-report/src/api/routes/public/queries.ts.html +1 -1
  115. package/coverage/lcov-report/src/api/routes/public/rows.ts.html +1 -1
  116. package/coverage/lcov-report/src/api/routes/public/tables.ts.html +1 -1
  117. package/coverage/lcov-report/src/api/routes/public/users.ts.html +1 -1
  118. package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +1 -1
  119. package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
  120. package/coverage/lcov-report/src/api/routes/{query.js.html → query.ts.html} +24 -33
  121. package/coverage/lcov-report/src/{utilities/routing/index.js.html → api/routes/role.ts.html} +32 -35
  122. package/coverage/lcov-report/src/api/routes/{routing.js.html → routing.ts.html} +10 -10
  123. package/coverage/lcov-report/src/api/routes/row.ts.html +8 -14
  124. package/coverage/lcov-report/src/api/routes/{screen.js.html → screen.ts.html} +29 -14
  125. package/coverage/lcov-report/src/api/routes/{script.js.html → script.ts.html} +10 -10
  126. package/coverage/lcov-report/src/api/routes/static.ts.html +9 -18
  127. package/coverage/lcov-report/src/api/routes/{table.js.html → table.ts.html} +16 -25
  128. package/coverage/lcov-report/src/api/routes/{templates.js.html → templates.ts.html} +11 -11
  129. package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +12 -18
  130. package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +10 -10
  131. package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
  132. package/coverage/lcov-report/src/api/routes/{user.js.html → user.ts.html} +14 -20
  133. package/coverage/lcov-report/src/api/routes/utils/index.html +6 -6
  134. package/coverage/lcov-report/src/api/routes/utils/{validators.js.html → validators.ts.html} +39 -51
  135. package/coverage/lcov-report/src/api/routes/{view.js.html → view.ts.html} +33 -24
  136. package/coverage/lcov-report/src/api/routes/webhook.ts.html +3 -3
  137. package/coverage/lcov-report/src/app.ts.html +9 -12
  138. package/coverage/lcov-report/src/automations/actions.js.html +1 -1
  139. package/coverage/lcov-report/src/automations/automationUtils.js.html +1 -1
  140. package/coverage/lcov-report/src/automations/bullboard.js.html +1 -1
  141. package/coverage/lcov-report/src/automations/index.html +10 -10
  142. package/coverage/lcov-report/src/automations/index.js.html +1 -1
  143. package/coverage/lcov-report/src/automations/logging/index.html +1 -1
  144. package/coverage/lcov-report/src/automations/logging/index.ts.html +1 -1
  145. package/coverage/lcov-report/src/automations/steps/bash.js.html +1 -1
  146. package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
  147. package/coverage/lcov-report/src/automations/steps/delay.js.html +1 -1
  148. package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
  149. package/coverage/lcov-report/src/automations/steps/discord.js.html +1 -1
  150. package/coverage/lcov-report/src/automations/steps/executeQuery.js.html +1 -1
  151. package/coverage/lcov-report/src/automations/steps/executeScript.js.html +1 -1
  152. package/coverage/lcov-report/src/automations/steps/filter.js.html +1 -1
  153. package/coverage/lcov-report/src/automations/steps/index.html +1 -1
  154. package/coverage/lcov-report/src/automations/steps/integromat.js.html +1 -1
  155. package/coverage/lcov-report/src/automations/steps/loop.js.html +1 -1
  156. package/coverage/lcov-report/src/automations/steps/outgoingWebhook.js.html +1 -1
  157. package/coverage/lcov-report/src/automations/steps/queryRows.js.html +1 -1
  158. package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.js.html +1 -1
  159. package/coverage/lcov-report/src/automations/steps/serverLog.js.html +1 -1
  160. package/coverage/lcov-report/src/automations/steps/slack.js.html +1 -1
  161. package/coverage/lcov-report/src/automations/steps/updateRow.js.html +1 -1
  162. package/coverage/lcov-report/src/automations/steps/utils.js.html +1 -1
  163. package/coverage/lcov-report/src/automations/steps/zapier.js.html +1 -1
  164. package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
  165. package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +1 -1
  166. package/coverage/lcov-report/src/automations/triggerInfo/app.js.html +1 -1
  167. package/coverage/lcov-report/src/automations/triggerInfo/cron.js.html +1 -1
  168. package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
  169. package/coverage/lcov-report/src/automations/triggerInfo/index.js.html +1 -1
  170. package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.js.html +1 -1
  171. package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.js.html +1 -1
  172. package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.js.html +1 -1
  173. package/coverage/lcov-report/src/automations/triggerInfo/webhook.js.html +1 -1
  174. package/coverage/lcov-report/src/automations/triggers.js.html +11 -14
  175. package/coverage/lcov-report/src/automations/utils.ts.html +1 -1
  176. package/coverage/lcov-report/src/constants/index.html +5 -5
  177. package/coverage/lcov-report/src/constants/index.js.html +7 -13
  178. package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
  179. package/coverage/lcov-report/src/constants/screens.js.html +3 -3
  180. package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.js.html +2023 -0
  181. package/coverage/lcov-report/src/db/defaultData/employeeImport.js.html +541 -0
  182. package/coverage/lcov-report/src/db/defaultData/expensesImport.js.html +427 -0
  183. package/coverage/lcov-report/src/db/defaultData/index.html +176 -0
  184. package/coverage/lcov-report/src/db/defaultData/inventoryImport.js.html +403 -0
  185. package/coverage/lcov-report/src/db/defaultData/jobsImport.js.html +559 -0
  186. package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
  187. package/coverage/lcov-report/src/db/inMemoryView.js.html +4 -4
  188. package/coverage/lcov-report/src/db/index.html +1 -1
  189. package/coverage/lcov-report/src/db/index.js.html +1 -1
  190. package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +13 -151
  191. package/coverage/lcov-report/src/db/linkedRows/LinkDocument.js.html +226 -0
  192. package/coverage/lcov-report/src/db/linkedRows/index.html +28 -13
  193. package/coverage/lcov-report/src/db/linkedRows/index.js.html +3 -3
  194. package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +4 -4
  195. package/coverage/lcov-report/src/db/newid.js.html +1 -1
  196. package/coverage/lcov-report/src/db/utils.ts.html +3 -3
  197. package/coverage/lcov-report/src/definitions/automations.ts.html +1 -1
  198. package/coverage/lcov-report/src/definitions/datasource.ts.html +1 -1
  199. package/coverage/lcov-report/src/definitions/index.html +1 -1
  200. package/coverage/lcov-report/src/environment.js.html +1 -1
  201. package/coverage/lcov-report/src/events/AutomationEmitter.js.html +1 -1
  202. package/coverage/lcov-report/src/events/index.html +1 -1
  203. package/coverage/lcov-report/src/events/index.js.html +1 -1
  204. package/coverage/lcov-report/src/events/utils.js.html +1 -1
  205. package/coverage/lcov-report/src/index.html +17 -32
  206. package/coverage/lcov-report/src/index.ts.html +1 -1
  207. package/coverage/lcov-report/src/integrations/airtable.ts.html +1 -1
  208. package/coverage/lcov-report/src/integrations/arangodb.ts.html +1 -1
  209. package/coverage/lcov-report/src/integrations/base/index.html +1 -1
  210. package/coverage/lcov-report/src/integrations/base/query.ts.html +1 -1
  211. package/coverage/lcov-report/src/integrations/base/sql.ts.html +2 -2
  212. package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +2 -2
  213. package/coverage/lcov-report/src/integrations/base/utils.ts.html +1 -1
  214. package/coverage/lcov-report/src/integrations/couchdb.ts.html +1 -1
  215. package/coverage/lcov-report/src/integrations/dynamodb.ts.html +1 -1
  216. package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +1 -1
  217. package/coverage/lcov-report/src/integrations/firebase.ts.html +1 -1
  218. package/coverage/lcov-report/src/integrations/googlesheets.ts.html +1 -1
  219. package/coverage/lcov-report/src/integrations/index.html +4 -4
  220. package/coverage/lcov-report/src/integrations/index.ts.html +58 -46
  221. package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1 -1
  222. package/coverage/lcov-report/src/integrations/mongodb.ts.html +1 -1
  223. package/coverage/lcov-report/src/integrations/mysql.ts.html +1 -1
  224. package/coverage/lcov-report/src/integrations/oracle.ts.html +1 -1
  225. package/coverage/lcov-report/src/integrations/postgres.ts.html +1 -1
  226. package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
  227. package/coverage/lcov-report/src/integrations/queries/sql.ts.html +1 -1
  228. package/coverage/lcov-report/src/integrations/redis.ts.html +1 -1
  229. package/coverage/lcov-report/src/integrations/rest.ts.html +1 -1
  230. package/coverage/lcov-report/src/integrations/s3.ts.html +1 -1
  231. package/coverage/lcov-report/src/integrations/snowflake.ts.html +1 -1
  232. package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
  233. package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
  234. package/coverage/lcov-report/src/integrations/utils.ts.html +1 -1
  235. package/coverage/lcov-report/src/middleware/appInfo.ts.html +1 -1
  236. package/coverage/lcov-report/src/middleware/authorized.ts.html +30 -51
  237. package/coverage/lcov-report/src/middleware/builder.ts.html +1 -1
  238. package/coverage/lcov-report/src/middleware/currentapp.ts.html +1 -1
  239. package/coverage/lcov-report/src/middleware/index.html +10 -10
  240. package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
  241. package/coverage/lcov-report/src/middleware/publicApi.ts.html +1 -1
  242. package/coverage/lcov-report/src/middleware/resourceId.ts.html +1 -1
  243. package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
  244. package/coverage/lcov-report/src/middleware/utils.ts.html +1 -1
  245. package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +3 -3
  246. package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +1 -1
  247. package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +1 -1
  248. package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +1 -1
  249. package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +1 -1
  250. package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +1 -1
  251. package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +1 -1
  252. package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +1 -1
  253. package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +1 -1
  254. package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +1 -1
  255. package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +1 -1
  256. package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
  257. package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +1 -1
  258. package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +1 -1
  259. package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +1 -1
  260. package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
  261. package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +1 -1
  262. package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +1 -1
  263. package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
  264. package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
  265. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +9 -9
  266. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
  267. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +7 -10
  268. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
  269. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +7 -10
  270. package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +4 -4
  271. package/coverage/lcov-report/src/migrations/index.html +1 -1
  272. package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
  273. package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
  274. package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
  275. package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
  276. package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
  277. package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +1 -1
  278. package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +1 -1
  279. package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +1 -1
  280. package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +16 -10
  281. package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +9 -21
  282. package/coverage/lcov-report/src/sdk/app/backups/index.html +16 -16
  283. package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +1 -1
  284. package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +1 -1
  285. package/coverage/lcov-report/src/sdk/app/tables/index.html +5 -5
  286. package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +4 -4
  287. package/coverage/lcov-report/src/sdk/index.html +1 -1
  288. package/coverage/lcov-report/src/sdk/index.ts.html +1 -1
  289. package/coverage/lcov-report/src/startup.ts.html +3 -3
  290. package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +61 -49
  291. package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
  292. package/coverage/lcov-report/src/tests/utilities/index.html +15 -15
  293. package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
  294. package/coverage/lcov-report/src/tests/utilities/structures.js.html +9 -12
  295. package/coverage/lcov-report/src/threads/automation.ts.html +20 -23
  296. package/coverage/lcov-report/src/threads/index.html +24 -24
  297. package/coverage/lcov-report/src/threads/index.ts.html +1 -1
  298. package/coverage/lcov-report/src/threads/query.ts.html +18 -33
  299. package/coverage/lcov-report/src/threads/utils.ts.html +10 -13
  300. package/coverage/lcov-report/src/utilities/{budibaseDir.js.html → budibaseDir.ts.html} +5 -5
  301. package/coverage/lcov-report/src/utilities/centralPath.js.html +1 -1
  302. package/coverage/lcov-report/src/utilities/csvParser.js.html +1 -1
  303. package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.js.html +13 -13
  304. package/coverage/lcov-report/src/utilities/fileSystem/index.html +5 -20
  305. package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +15 -15
  306. package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
  307. package/coverage/lcov-report/src/utilities/global.ts.html +1 -1
  308. package/coverage/lcov-report/src/utilities/index.html +44 -44
  309. package/coverage/lcov-report/src/utilities/{index.js.html → index.ts.html} +70 -46
  310. package/coverage/lcov-report/src/utilities/plugins.js.html +1 -1
  311. package/coverage/lcov-report/src/utilities/queue/inMemoryQueue.js.html +1 -1
  312. package/coverage/lcov-report/src/utilities/queue/index.html +1 -1
  313. package/coverage/lcov-report/src/utilities/{redis.js.html → redis.ts.html} +36 -33
  314. package/coverage/lcov-report/src/utilities/routing/index.html +6 -6
  315. package/coverage/lcov-report/src/utilities/routing/index.ts.html +181 -0
  316. package/coverage/lcov-report/src/utilities/rowProcessor/index.html +38 -23
  317. package/coverage/lcov-report/src/utilities/rowProcessor/{index.js.html → index.ts.html} +106 -337
  318. package/coverage/lcov-report/src/utilities/rowProcessor/map.js.html +370 -0
  319. package/coverage/lcov-report/src/utilities/rowProcessor/{utils.js.html → utils.ts.html} +43 -31
  320. package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
  321. package/coverage/lcov-report/src/utilities/{security.js.html → security.ts.html} +49 -67
  322. package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
  323. package/coverage/lcov-report/src/utilities/usageQuota/index.html +18 -18
  324. package/coverage/lcov-report/src/utilities/usageQuota/{rows.js.html → rows.ts.html} +27 -39
  325. package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  326. package/coverage/lcov-report/src/utilities/{users.js.html → users.ts.html} +22 -28
  327. package/coverage/lcov-report/src/utilities/{workerRequests.js.html → workerRequests.ts.html} +69 -54
  328. package/coverage/lcov-report/src/watch.ts.html +8 -11
  329. package/coverage/lcov-report/src/websocket.ts.html +1 -1
  330. package/coverage/lcov.info +6619 -6700
  331. package/dist/api/controllers/apikeys.js +12 -9
  332. package/dist/api/controllers/application.js +13 -2
  333. package/dist/api/controllers/automation.js +104 -84
  334. package/dist/api/controllers/cloud.js +84 -71
  335. package/dist/api/controllers/component.js +4 -2
  336. package/dist/api/controllers/datasource.js +144 -92
  337. package/dist/api/controllers/deploy/Deployment.js +10 -6
  338. package/dist/api/controllers/layout.js +18 -15
  339. package/dist/api/controllers/metadata.js +51 -37
  340. package/dist/api/controllers/permission.js +52 -43
  341. package/dist/api/controllers/plugin/index.js +6 -7
  342. package/dist/api/controllers/public/tables.js +29 -9
  343. package/dist/api/controllers/query/import/index.js +1 -2
  344. package/dist/api/controllers/query/validation.js +41 -33
  345. package/dist/api/controllers/role.js +29 -27
  346. package/dist/api/controllers/routing.js +71 -58
  347. package/dist/api/controllers/row/ExternalRequest.js +6 -7
  348. package/dist/api/controllers/row/external.js +3 -3
  349. package/dist/api/controllers/row/internal.js +11 -12
  350. package/dist/api/controllers/row/internalSearch.js +95 -80
  351. package/dist/api/controllers/row/staticFormula.js +85 -75
  352. package/dist/api/controllers/row/utils.js +118 -84
  353. package/dist/api/controllers/screen.js +81 -66
  354. package/dist/api/controllers/script.js +13 -6
  355. package/dist/api/controllers/static/index.js +9 -11
  356. package/dist/api/controllers/table/bulkFormula.js +47 -35
  357. package/dist/api/controllers/table/external.js +67 -54
  358. package/dist/api/controllers/table/index.js +66 -33
  359. package/dist/api/controllers/table/internal.js +1 -2
  360. package/dist/api/controllers/table/utils.js +39 -35
  361. package/dist/api/controllers/templates.js +17 -10
  362. package/dist/api/controllers/user.js +82 -70
  363. package/dist/api/controllers/view/exporters.js +8 -4
  364. package/dist/api/controllers/view/index.js +201 -153
  365. package/dist/api/controllers/view/utils.js +151 -121
  366. package/dist/api/index.js +38 -34
  367. package/dist/api/routes/analytics.js +29 -3
  368. package/dist/api/routes/apikeys.js +33 -7
  369. package/dist/api/routes/application.js +8 -9
  370. package/dist/api/routes/auth.js +1 -2
  371. package/dist/api/routes/automation.js +46 -20
  372. package/dist/api/routes/backup.js +3 -4
  373. package/dist/api/routes/cloud.js +32 -6
  374. package/dist/api/routes/component.js +32 -6
  375. package/dist/api/routes/datasource.js +39 -13
  376. package/dist/api/routes/deploy.js +34 -8
  377. package/dist/api/routes/dev.js +36 -10
  378. package/dist/api/routes/integration.js +10 -7
  379. package/dist/api/routes/layout.js +33 -7
  380. package/dist/api/routes/metadata.js +36 -10
  381. package/dist/api/routes/migrations.js +32 -6
  382. package/dist/api/routes/permission.js +38 -12
  383. package/dist/api/routes/plugin.js +5 -5
  384. package/dist/api/routes/query.js +42 -15
  385. package/dist/api/routes/role.js +36 -10
  386. package/dist/api/routes/routing.js +32 -6
  387. package/dist/api/routes/row.js +2 -1
  388. package/dist/api/routes/screen.js +35 -9
  389. package/dist/api/routes/script.js +32 -6
  390. package/dist/api/routes/static.js +9 -9
  391. package/dist/api/routes/table.js +40 -13
  392. package/dist/api/routes/templates.js +33 -7
  393. package/dist/api/routes/tests/utilities/TestFunctions.js +6 -8
  394. package/dist/api/routes/user.js +40 -13
  395. package/dist/api/routes/utils/validators.js +142 -126
  396. package/dist/api/routes/view.js +38 -12
  397. package/dist/api/routes/webhook.js +1 -2
  398. package/dist/app.js +3 -4
  399. package/dist/automations/triggers.js +5 -6
  400. package/dist/constants/index.js +3 -5
  401. package/dist/constants/screens.js +2 -2
  402. package/dist/db/defaultData/datasource_bb_default.js +565 -0
  403. package/dist/db/defaultData/employeeImport.js +153 -0
  404. package/dist/db/defaultData/expensesImport.js +115 -0
  405. package/dist/db/defaultData/inventoryImport.js +107 -0
  406. package/dist/db/defaultData/jobsImport.js +150 -0
  407. package/dist/db/inMemoryView.js +3 -3
  408. package/dist/db/linkedRows/LinkController.js +4 -31
  409. package/dist/db/linkedRows/LinkDocument.js +32 -0
  410. package/dist/db/linkedRows/index.js +2 -2
  411. package/dist/db/linkedRows/linkUtils.js +3 -3
  412. package/dist/db/utils.js +1 -1
  413. package/dist/db/views/staticViews.js +4 -4
  414. package/dist/integrations/index.js +15 -6
  415. package/dist/middleware/authorized.js +22 -21
  416. package/dist/migrations/functions/appUrls.js +2 -2
  417. package/dist/migrations/functions/usageQuotas/syncApps.js +3 -4
  418. package/dist/migrations/functions/usageQuotas/syncRows.js +3 -4
  419. package/dist/migrations/functions/userEmailViewCasing.js +3 -3
  420. package/dist/package.json +6 -6
  421. package/dist/sdk/app/backups/exports.js +1 -2
  422. package/dist/sdk/app/backups/imports.js +2 -3
  423. package/dist/sdk/app/tables/index.js +1 -1
  424. package/dist/startup.js +4 -4
  425. package/dist/tests/utilities/TestConfiguration.js +27 -35
  426. package/dist/tests/utilities/structures.js +3 -4
  427. package/dist/threads/automation.js +15 -16
  428. package/dist/threads/query.js +17 -19
  429. package/dist/threads/utils.js +11 -9
  430. package/dist/tsconfig.build.tsbuildinfo +1 -1
  431. package/dist/utilities/budibaseDir.js +4 -2
  432. package/dist/utilities/fileSystem/clientLibrary.js +12 -12
  433. package/dist/utilities/fileSystem/index.js +3 -3
  434. package/dist/utilities/index.js +102 -75
  435. package/dist/utilities/redis.js +100 -65
  436. package/dist/utilities/routing/index.js +27 -23
  437. package/dist/utilities/rowProcessor/index.js +124 -191
  438. package/dist/utilities/rowProcessor/map.js +96 -0
  439. package/dist/utilities/rowProcessor/utils.js +35 -26
  440. package/dist/utilities/security.js +39 -35
  441. package/dist/utilities/usageQuota/rows.js +56 -49
  442. package/dist/utilities/users.js +31 -28
  443. package/dist/utilities/workerRequests.js +115 -82
  444. package/dist/watch.js +1 -2
  445. package/package.json +7 -7
  446. package/scripts/exportAppTemplate.js +2 -2
  447. package/src/api/controllers/{apikeys.js → apikeys.ts} +10 -10
  448. package/src/api/controllers/application.ts +22 -3
  449. package/src/api/controllers/auth.ts +2 -2
  450. package/src/api/controllers/{automation.js → automation.ts} +48 -48
  451. package/src/api/controllers/{cloud.js → cloud.ts} +24 -24
  452. package/src/api/controllers/component.ts +2 -1
  453. package/src/api/controllers/{datasource.js → datasource.ts} +100 -47
  454. package/src/api/controllers/deploy/{Deployment.js → Deployment.ts} +13 -10
  455. package/src/api/controllers/{layout.js → layout.ts} +8 -8
  456. package/src/api/controllers/{metadata.js → metadata.ts} +11 -10
  457. package/src/api/controllers/{permission.js → permission.ts} +49 -46
  458. package/src/api/controllers/plugin/index.ts +4 -5
  459. package/src/api/controllers/public/tables.ts +2 -2
  460. package/src/api/controllers/query/import/index.ts +2 -3
  461. package/src/api/controllers/query/{validation.js → validation.ts} +7 -7
  462. package/src/api/controllers/{role.js → role.ts} +21 -25
  463. package/src/api/controllers/{routing.js → routing.ts} +37 -34
  464. package/src/api/controllers/row/ExternalRequest.ts +4 -8
  465. package/src/api/controllers/row/external.js +3 -3
  466. package/src/api/controllers/row/internal.js +11 -12
  467. package/src/api/controllers/row/{internalSearch.js → internalSearch.ts} +92 -68
  468. package/src/api/controllers/row/{staticFormula.js → staticFormula.ts} +28 -23
  469. package/src/api/controllers/row/{utils.js → utils.ts} +25 -18
  470. package/src/api/controllers/screen.ts +10 -6
  471. package/src/api/controllers/script.ts +12 -0
  472. package/src/api/controllers/static/index.ts +9 -13
  473. package/src/api/controllers/table/{bulkFormula.js → bulkFormula.ts} +39 -25
  474. package/src/api/controllers/table/{external.js → external.ts} +86 -51
  475. package/src/api/controllers/table/{index.js → index.ts} +17 -17
  476. package/src/api/controllers/table/internal.ts +1 -2
  477. package/src/api/controllers/table/utils.ts +26 -21
  478. package/src/api/controllers/{templates.js → templates.ts} +10 -7
  479. package/src/api/controllers/{user.js → user.ts} +47 -49
  480. package/src/api/controllers/view/{exporters.js → exporters.ts} +5 -3
  481. package/src/api/controllers/view/{index.js → index.ts} +36 -27
  482. package/src/api/controllers/view/{utils.js → utils.ts} +26 -20
  483. package/src/api/{index.js → index.ts} +15 -22
  484. package/src/api/routes/analytics.ts +9 -0
  485. package/src/api/routes/apikeys.ts +12 -0
  486. package/src/api/routes/application.ts +17 -9
  487. package/src/api/routes/auth.ts +2 -2
  488. package/src/api/routes/automation.ts +87 -0
  489. package/src/api/routes/backup.ts +8 -4
  490. package/src/api/routes/cloud.ts +18 -0
  491. package/src/api/routes/component.ts +14 -0
  492. package/src/api/routes/datasource.ts +60 -0
  493. package/src/api/routes/deploy.ts +21 -0
  494. package/src/api/routes/dev.ts +38 -0
  495. package/src/api/routes/integration.ts +16 -0
  496. package/src/api/routes/layout.ts +16 -0
  497. package/src/api/routes/{metadata.js → metadata.ts} +13 -13
  498. package/src/api/routes/migrations.ts +14 -0
  499. package/src/api/routes/permission.ts +41 -0
  500. package/src/api/routes/plugin.ts +14 -6
  501. package/src/api/routes/{query.js → query.ts} +17 -20
  502. package/src/api/routes/role.ts +24 -0
  503. package/src/api/routes/routing.ts +14 -0
  504. package/src/api/routes/row.ts +3 -5
  505. package/src/api/routes/screen.ts +23 -0
  506. package/src/api/routes/script.ts +10 -0
  507. package/src/api/routes/static.ts +4 -7
  508. package/src/api/routes/{table.js → table.ts} +9 -12
  509. package/src/api/routes/templates.ts +16 -0
  510. package/src/api/routes/tests/backup.spec.js +9 -1
  511. package/src/api/routes/tests/permissions.spec.js +2 -1
  512. package/src/api/routes/tests/role.spec.js +3 -5
  513. package/src/api/routes/tests/routing.spec.js +2 -1
  514. package/src/api/routes/tests/row.spec.js +3 -4
  515. package/src/api/routes/tests/user.spec.js +2 -1
  516. package/src/api/routes/tests/utilities/TestFunctions.ts +6 -8
  517. package/src/api/routes/{user.js → user.ts} +7 -9
  518. package/src/api/routes/utils/{validators.js → validators.ts} +33 -37
  519. package/src/api/routes/view.ts +34 -0
  520. package/src/api/routes/webhook.ts +2 -2
  521. package/src/app.ts +3 -4
  522. package/src/automations/triggers.js +5 -6
  523. package/src/constants/index.js +3 -5
  524. package/src/constants/screens.js +2 -2
  525. package/src/db/defaultData/datasource_bb_default.js +646 -0
  526. package/src/db/defaultData/employeeImport.js +152 -0
  527. package/src/db/defaultData/expensesImport.js +114 -0
  528. package/src/db/defaultData/inventoryImport.js +106 -0
  529. package/src/db/defaultData/jobsImport.js +158 -0
  530. package/src/db/inMemoryView.js +3 -3
  531. package/src/db/linkedRows/LinkController.js +4 -50
  532. package/src/db/linkedRows/LinkDocument.js +47 -0
  533. package/src/db/linkedRows/index.js +2 -2
  534. package/src/db/linkedRows/linkUtils.js +3 -3
  535. package/src/db/utils.ts +2 -2
  536. package/src/db/views/staticViews.js +4 -4
  537. package/src/integrations/base/sql.ts +1 -1
  538. package/src/integrations/base/sqlTable.ts +1 -1
  539. package/src/integrations/index.ts +45 -41
  540. package/src/middleware/authorized.ts +21 -28
  541. package/src/middleware/tests/authorized.spec.js +5 -6
  542. package/src/migrations/functions/appUrls.ts +2 -2
  543. package/src/migrations/functions/tests/appUrls.spec.js +4 -4
  544. package/src/migrations/functions/tests/userEmailViewCasing.spec.js +14 -9
  545. package/src/migrations/functions/usageQuotas/syncApps.ts +3 -4
  546. package/src/migrations/functions/usageQuotas/syncRows.ts +3 -4
  547. package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +7 -7
  548. package/src/migrations/functions/userEmailViewCasing.ts +3 -3
  549. package/src/sdk/app/backups/exports.ts +5 -3
  550. package/src/sdk/app/backups/imports.ts +3 -7
  551. package/src/sdk/app/tables/index.ts +1 -1
  552. package/src/startup.ts +2 -2
  553. package/src/tests/utilities/TestConfiguration.js +39 -35
  554. package/src/tests/utilities/structures.js +3 -4
  555. package/src/threads/automation.ts +14 -15
  556. package/src/threads/query.ts +11 -16
  557. package/src/threads/utils.ts +4 -5
  558. package/src/utilities/budibaseDir.ts +3 -0
  559. package/src/utilities/fileSystem/clientLibrary.js +12 -12
  560. package/src/utilities/fileSystem/index.js +8 -8
  561. package/src/utilities/{index.js → index.ts} +40 -32
  562. package/src/utilities/{redis.js → redis.ts} +21 -20
  563. package/src/utilities/routing/index.ts +32 -0
  564. package/src/utilities/rowProcessor/{index.js → index.ts} +65 -142
  565. package/src/utilities/rowProcessor/map.js +95 -0
  566. package/src/utilities/rowProcessor/{utils.js → utils.ts} +19 -15
  567. package/src/utilities/security.ts +65 -0
  568. package/src/utilities/usageQuota/{rows.js → rows.ts} +14 -18
  569. package/src/utilities/{users.js → users.ts} +11 -13
  570. package/src/utilities/{workerRequests.js → workerRequests.ts} +43 -38
  571. package/src/watch.ts +2 -3
  572. package/coverage/lcov-report/src/api/routes/cloud.js.html +0 -127
  573. package/coverage/lcov-report/src/api/routes/integration.js.html +0 -121
  574. package/coverage/lcov-report/src/api/routes/role.js.html +0 -130
  575. package/coverage/lcov-report/src/module.d.ts.html +0 -127
  576. package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +0 -193
  577. package/dist/utilities/fileSystem/utilities.js +0 -22
  578. package/src/api/controllers/script.js +0 -11
  579. package/src/api/routes/analytics.js +0 -9
  580. package/src/api/routes/apikeys.js +0 -12
  581. package/src/api/routes/automation.js +0 -85
  582. package/src/api/routes/cloud.js +0 -14
  583. package/src/api/routes/component.js +0 -14
  584. package/src/api/routes/datasource.js +0 -51
  585. package/src/api/routes/deploy.js +0 -17
  586. package/src/api/routes/dev.js +0 -26
  587. package/src/api/routes/integration.js +0 -12
  588. package/src/api/routes/layout.js +0 -16
  589. package/src/api/routes/migrations.js +0 -14
  590. package/src/api/routes/permission.js +0 -33
  591. package/src/api/routes/role.js +0 -15
  592. package/src/api/routes/routing.js +0 -14
  593. package/src/api/routes/screen.js +0 -18
  594. package/src/api/routes/script.js +0 -10
  595. package/src/api/routes/templates.js +0 -16
  596. package/src/api/routes/view.js +0 -31
  597. package/src/module.d.ts +0 -14
  598. package/src/utilities/budibaseDir.js +0 -3
  599. package/src/utilities/fileSystem/utilities.js +0 -36
  600. package/src/utilities/routing/index.js +0 -25
  601. package/src/utilities/security.js +0 -71
@@ -1,4 +1,18 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
17
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
18
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8,111 +22,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
22
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
23
  });
10
24
  };
11
- const linkRows = require("../../db/linkedRows");
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.cleanupAttachments = exports.outputProcessing = exports.inputProcessing = exports.coerce = exports.processAutoColumn = void 0;
30
+ const linkedRows_1 = __importDefault(require("../../db/linkedRows"));
31
+ const constants_1 = require("../../constants");
32
+ const index_1 = require("../index");
33
+ const utils_1 = require("./utils");
34
+ const constants_2 = require("../../constants");
35
+ const backend_core_1 = require("@budibase/backend-core");
36
+ const utils_2 = require("../../db/utils");
37
+ const map_1 = require("./map");
12
38
  const { cloneDeep } = require("lodash/fp");
13
- const { FieldTypes, AutoFieldSubTypes } = require("../../constants");
14
- const { attachmentsRelativeURL } = require("../index");
15
- const { processFormulas, fixAutoColumnSubType } = require("./utils");
16
- const { deleteFiles } = require("../../utilities/fileSystem/utilities");
17
- const { ObjectStoreBuckets } = require("../../constants");
18
- const { isProdAppID, getProdAppID, dbExists, } = require("@budibase/backend-core/db");
19
- const { getAppId } = require("@budibase/backend-core/context");
20
- const { InternalTables } = require("../../db/utils");
39
+ __exportStar(require("./utils"), exports);
21
40
  const BASE_AUTO_ID = 1;
22
- /**
23
- * A map of how we convert various properties in rows to each other based on the row type.
24
- */
25
- const TYPE_TRANSFORM_MAP = {
26
- [FieldTypes.LINK]: {
27
- "": [],
28
- [null]: [],
29
- [undefined]: undefined,
30
- parse: link => {
31
- if (Array.isArray(link) && typeof link[0] === "object") {
32
- return link.map(el => (el && el._id ? el._id : el));
33
- }
34
- if (typeof link === "string") {
35
- return [link];
36
- }
37
- return link;
38
- },
39
- },
40
- [FieldTypes.OPTIONS]: {
41
- "": null,
42
- [null]: null,
43
- [undefined]: undefined,
44
- },
45
- [FieldTypes.ARRAY]: {
46
- "": [],
47
- [null]: [],
48
- [undefined]: undefined,
49
- },
50
- [FieldTypes.STRING]: {
51
- "": "",
52
- [null]: "",
53
- [undefined]: undefined,
54
- },
55
- [FieldTypes.BARCODEQR]: {
56
- "": "",
57
- [null]: "",
58
- [undefined]: undefined,
59
- },
60
- [FieldTypes.FORMULA]: {
61
- "": "",
62
- [null]: "",
63
- [undefined]: undefined,
64
- },
65
- [FieldTypes.LONGFORM]: {
66
- "": "",
67
- [null]: "",
68
- [undefined]: undefined,
69
- },
70
- [FieldTypes.NUMBER]: {
71
- "": null,
72
- [null]: null,
73
- [undefined]: undefined,
74
- parse: n => parseFloat(n),
75
- },
76
- [FieldTypes.DATETIME]: {
77
- "": null,
78
- [undefined]: undefined,
79
- [null]: null,
80
- parse: date => {
81
- if (date instanceof Date) {
82
- return date.toISOString();
83
- }
84
- return date;
85
- },
86
- },
87
- [FieldTypes.ATTACHMENT]: {
88
- "": [],
89
- [null]: [],
90
- [undefined]: undefined,
91
- },
92
- [FieldTypes.BOOLEAN]: {
93
- "": null,
94
- [null]: null,
95
- [undefined]: undefined,
96
- true: true,
97
- false: false,
98
- },
99
- [FieldTypes.AUTO]: {
100
- parse: () => undefined,
101
- },
102
- [FieldTypes.JSON]: {
103
- parse: input => {
104
- try {
105
- if (input === "") {
106
- return undefined;
107
- }
108
- return JSON.parse(input);
109
- }
110
- catch (err) {
111
- return input;
112
- }
113
- },
114
- },
115
- };
116
41
  /**
117
42
  * Given the old state of the row and the new one after an update, this will
118
43
  * find the keys that have been removed in the updated row.
@@ -121,13 +46,13 @@ function getRemovedAttachmentKeys(oldRow, row, attachmentKey) {
121
46
  if (!oldRow[attachmentKey]) {
122
47
  return [];
123
48
  }
124
- const oldKeys = oldRow[attachmentKey].map(attachment => attachment.key);
49
+ const oldKeys = oldRow[attachmentKey].map((attachment) => attachment.key);
125
50
  // no attachments in new row, all removed
126
51
  if (!row[attachmentKey]) {
127
52
  return oldKeys;
128
53
  }
129
- const newKeys = row[attachmentKey].map(attachment => attachment.key);
130
- return oldKeys.filter(key => newKeys.indexOf(key) === -1);
54
+ const newKeys = row[attachmentKey].map((attachment) => attachment.key);
55
+ return oldKeys.filter((key) => newKeys.indexOf(key) === -1);
131
56
  }
132
57
  /**
133
58
  * This will update any auto columns that are found on the row/table with the correct information based on
@@ -139,41 +64,41 @@ function getRemovedAttachmentKeys(oldRow, row, attachmentKey) {
139
64
  * @returns {{row: Object, table: Object}} The updated row and table, the table may need to be updated
140
65
  * for automatic ID purposes.
141
66
  */
142
- function processAutoColumn(user, table, row, opts = { reprocessing: false, noAutoRelationships: false }) {
67
+ function processAutoColumn(user, table, row, opts) {
143
68
  let noUser = !user || !user.userId;
144
- let isUserTable = table._id === InternalTables.USER_METADATA;
69
+ let isUserTable = table._id === utils_2.InternalTables.USER_METADATA;
145
70
  let now = new Date().toISOString();
146
71
  // if a row doesn't have a revision then it doesn't exist yet
147
72
  const creating = !row._rev;
148
73
  // check its not user table, or whether any of the processing options have been disabled
149
- const shouldUpdateUserFields = !isUserTable && !opts.reprocessing && !opts.noAutoRelationships && !noUser;
74
+ const shouldUpdateUserFields = !isUserTable && !(opts === null || opts === void 0 ? void 0 : opts.reprocessing) && !(opts === null || opts === void 0 ? void 0 : opts.noAutoRelationships) && !noUser;
150
75
  for (let [key, schema] of Object.entries(table.schema)) {
151
76
  if (!schema.autocolumn) {
152
77
  continue;
153
78
  }
154
79
  if (!schema.subtype) {
155
- schema = fixAutoColumnSubType(schema);
80
+ schema = (0, utils_1.fixAutoColumnSubType)(schema);
156
81
  }
157
82
  switch (schema.subtype) {
158
- case AutoFieldSubTypes.CREATED_BY:
159
- if (creating && shouldUpdateUserFields) {
83
+ case constants_1.AutoFieldSubTypes.CREATED_BY:
84
+ if (creating && shouldUpdateUserFields && user) {
160
85
  row[key] = [user.userId];
161
86
  }
162
87
  break;
163
- case AutoFieldSubTypes.CREATED_AT:
88
+ case constants_1.AutoFieldSubTypes.CREATED_AT:
164
89
  if (creating) {
165
90
  row[key] = now;
166
91
  }
167
92
  break;
168
- case AutoFieldSubTypes.UPDATED_BY:
169
- if (shouldUpdateUserFields) {
93
+ case constants_1.AutoFieldSubTypes.UPDATED_BY:
94
+ if (shouldUpdateUserFields && user) {
170
95
  row[key] = [user.userId];
171
96
  }
172
97
  break;
173
- case AutoFieldSubTypes.UPDATED_AT:
98
+ case constants_1.AutoFieldSubTypes.UPDATED_AT:
174
99
  row[key] = now;
175
100
  break;
176
- case AutoFieldSubTypes.AUTO_ID:
101
+ case constants_1.AutoFieldSubTypes.AUTO_ID:
177
102
  if (creating) {
178
103
  schema.lastID = !schema.lastID ? BASE_AUTO_ID : schema.lastID + 1;
179
104
  row[key] = schema.lastID;
@@ -184,28 +109,29 @@ function processAutoColumn(user, table, row, opts = { reprocessing: false, noAut
184
109
  return { table, row };
185
110
  }
186
111
  exports.processAutoColumn = processAutoColumn;
187
- exports.fixAutoColumnSubType = fixAutoColumnSubType;
188
- exports.processFormulas = processFormulas;
189
112
  /**
190
113
  * This will coerce a value to the correct types based on the type transform map
191
114
  * @param {object} row The value to coerce
192
115
  * @param {object} type The type fo coerce to
193
116
  * @returns {object} The coerced value
194
117
  */
195
- exports.coerce = (row, type) => {
118
+ function coerce(row, type) {
196
119
  // no coercion specified for type, skip it
197
- if (!TYPE_TRANSFORM_MAP[type]) {
120
+ if (!map_1.TYPE_TRANSFORM_MAP[type]) {
198
121
  return row;
199
122
  }
200
123
  // eslint-disable-next-line no-prototype-builtins
201
- if (TYPE_TRANSFORM_MAP[type].hasOwnProperty(row)) {
202
- return TYPE_TRANSFORM_MAP[type][row];
124
+ if (map_1.TYPE_TRANSFORM_MAP[type].hasOwnProperty(row)) {
125
+ // @ts-ignore
126
+ return map_1.TYPE_TRANSFORM_MAP[type][row];
203
127
  }
204
- else if (TYPE_TRANSFORM_MAP[type].parse) {
205
- return TYPE_TRANSFORM_MAP[type].parse(row);
128
+ else if (map_1.TYPE_TRANSFORM_MAP[type].parse) {
129
+ // @ts-ignore
130
+ return map_1.TYPE_TRANSFORM_MAP[type].parse(row);
206
131
  }
207
132
  return row;
208
- };
133
+ }
134
+ exports.coerce = coerce;
209
135
  /**
210
136
  * Given an input route this function will apply all the necessary pre-processing to it, such as coercion
211
137
  * of column values or adding auto-column values.
@@ -215,7 +141,7 @@ exports.coerce = (row, type) => {
215
141
  * @param {object} opts some input processing options (like disabling auto-column relationships).
216
142
  * @returns {object} the row which has been prepared to be written to the DB.
217
143
  */
218
- exports.inputProcessing = (user = {}, table, row, opts = { noAutoRelationships: false }) => {
144
+ function inputProcessing(user, table, row, opts) {
219
145
  let clonedRow = cloneDeep(row);
220
146
  // need to copy the table so it can be differenced on way out
221
147
  const copiedTable = cloneDeep(table);
@@ -230,12 +156,12 @@ exports.inputProcessing = (user = {}, table, row, opts = { noAutoRelationships:
230
156
  continue;
231
157
  }
232
158
  // remove any formula values, they are to be generated
233
- if (field.type === FieldTypes.FORMULA) {
159
+ if (field.type === constants_1.FieldTypes.FORMULA) {
234
160
  delete clonedRow[key];
235
161
  }
236
162
  // otherwise coerce what is there to correct types
237
163
  else {
238
- clonedRow[key] = exports.coerce(value, field.type);
164
+ clonedRow[key] = coerce(value, field.type);
239
165
  }
240
166
  }
241
167
  if (!clonedRow._id || !clonedRow._rev) {
@@ -244,7 +170,8 @@ exports.inputProcessing = (user = {}, table, row, opts = { noAutoRelationships:
244
170
  }
245
171
  // handle auto columns - this returns an object like {table, row}
246
172
  return processAutoColumn(user, copiedTable, clonedRow, opts);
247
- };
173
+ }
174
+ exports.inputProcessing = inputProcessing;
248
175
  /**
249
176
  * This function enriches the input rows with anything they are supposed to contain, for example
250
177
  * link records or attachment links.
@@ -254,34 +181,37 @@ exports.inputProcessing = (user = {}, table, row, opts = { noAutoRelationships:
254
181
  * @param {object} opts used to set some options for the output, such as disabling relationship squashing.
255
182
  * @returns {object[]|object} the enriched rows will be returned.
256
183
  */
257
- exports.outputProcessing = (table, rows, opts = { squash: true }) => __awaiter(void 0, void 0, void 0, function* () {
258
- let wasArray = true;
259
- if (!(rows instanceof Array)) {
260
- rows = [rows];
261
- wasArray = false;
262
- }
263
- // attach any linked row information
264
- let enriched = yield linkRows.attachFullLinkedDocs(table, rows);
265
- // process formulas
266
- enriched = processFormulas(table, enriched, { dynamic: true });
267
- // update the attachments URL depending on hosting
268
- for (let [property, column] of Object.entries(table.schema)) {
269
- if (column.type === FieldTypes.ATTACHMENT) {
270
- for (let row of enriched) {
271
- if (row[property] == null || !Array.isArray(row[property])) {
272
- continue;
184
+ function outputProcessing(table, rows, opts = { squash: true }) {
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ let wasArray = true;
187
+ if (!(rows instanceof Array)) {
188
+ rows = [rows];
189
+ wasArray = false;
190
+ }
191
+ // attach any linked row information
192
+ let enriched = yield linkedRows_1.default.attachFullLinkedDocs(table, rows);
193
+ // process formulas
194
+ enriched = (0, utils_1.processFormulas)(table, enriched, { dynamic: true });
195
+ // update the attachments URL depending on hosting
196
+ for (let [property, column] of Object.entries(table.schema)) {
197
+ if (column.type === constants_1.FieldTypes.ATTACHMENT) {
198
+ for (let row of enriched) {
199
+ if (row[property] == null || !Array.isArray(row[property])) {
200
+ continue;
201
+ }
202
+ row[property].forEach((attachment) => {
203
+ attachment.url = (0, index_1.attachmentsRelativeURL)(attachment.key);
204
+ });
273
205
  }
274
- row[property].forEach(attachment => {
275
- attachment.url = attachmentsRelativeURL(attachment.key);
276
- });
277
206
  }
278
207
  }
279
- }
280
- if (opts.squash) {
281
- enriched = yield linkRows.squashLinksToPrimaryDisplay(table, enriched);
282
- }
283
- return wasArray ? enriched : enriched[0];
284
- });
208
+ if (opts.squash) {
209
+ enriched = yield linkedRows_1.default.squashLinksToPrimaryDisplay(table, enriched);
210
+ }
211
+ return wasArray ? enriched : enriched[0];
212
+ });
213
+ }
214
+ exports.outputProcessing = outputProcessing;
285
215
  /**
286
216
  * Clean up any attachments that were attached to a row.
287
217
  * @param {object} table The table from which a row is being removed.
@@ -292,43 +222,46 @@ exports.outputProcessing = (table, rows, opts = { squash: true }) => __awaiter(v
292
222
  * deleted attachment columns.
293
223
  * @return {Promise<void>} When all attachments have been removed this will return.
294
224
  */
295
- exports.cleanupAttachments = (table, { row, rows, oldRow, oldTable }) => __awaiter(void 0, void 0, void 0, function* () {
296
- const appId = getAppId();
297
- if (!isProdAppID(appId)) {
298
- const prodAppId = getProdAppID(appId);
299
- // if prod exists, then don't allow deleting
300
- const exists = yield dbExists(prodAppId);
301
- if (exists) {
302
- return;
303
- }
304
- }
305
- let files = [];
306
- function addFiles(row, key) {
307
- if (row[key]) {
308
- files = files.concat(row[key].map(attachment => attachment.key));
309
- }
310
- }
311
- const schemaToUse = oldTable ? oldTable.schema : table.schema;
312
- for (let [key, schema] of Object.entries(schemaToUse)) {
313
- if (schema.type !== FieldTypes.ATTACHMENT) {
314
- continue;
315
- }
316
- // old table had this column, new table doesn't - delete it
317
- if (oldTable && !table.schema[key]) {
318
- rows.forEach(row => addFiles(row, key));
225
+ function cleanupAttachments(table, { row, rows, oldRow, oldTable, }) {
226
+ return __awaiter(this, void 0, void 0, function* () {
227
+ const appId = backend_core_1.context.getAppId();
228
+ if (!backend_core_1.db.isProdAppID(appId)) {
229
+ const prodAppId = backend_core_1.db.getProdAppID(appId);
230
+ // if prod exists, then don't allow deleting
231
+ const exists = yield backend_core_1.db.dbExists(prodAppId);
232
+ if (exists) {
233
+ return;
234
+ }
319
235
  }
320
- else if (oldRow && row) {
321
- // if updating, need to manage the differences
322
- files = files.concat(getRemovedAttachmentKeys(oldRow, row, key));
236
+ let files = [];
237
+ function addFiles(row, key) {
238
+ if (row[key]) {
239
+ files = files.concat(row[key].map((attachment) => attachment.key));
240
+ }
323
241
  }
324
- else if (row) {
325
- addFiles(row, key);
242
+ const schemaToUse = oldTable ? oldTable.schema : table.schema;
243
+ for (let [key, schema] of Object.entries(schemaToUse)) {
244
+ if (schema.type !== constants_1.FieldTypes.ATTACHMENT) {
245
+ continue;
246
+ }
247
+ // old table had this column, new table doesn't - delete it
248
+ if (rows && oldTable && !table.schema[key]) {
249
+ rows.forEach(row => addFiles(row, key));
250
+ }
251
+ else if (oldRow && row) {
252
+ // if updating, need to manage the differences
253
+ files = files.concat(getRemovedAttachmentKeys(oldRow, row, key));
254
+ }
255
+ else if (row) {
256
+ addFiles(row, key);
257
+ }
258
+ else if (rows) {
259
+ rows.forEach(row => addFiles(row, key));
260
+ }
326
261
  }
327
- else if (rows) {
328
- rows.forEach(row => addFiles(row, key));
262
+ if (files.length > 0) {
263
+ return backend_core_1.objectStore.deleteFiles(constants_2.ObjectStoreBuckets.APPS, files);
329
264
  }
330
- }
331
- if (files.length > 0) {
332
- return deleteFiles(ObjectStoreBuckets.APPS, files);
333
- }
334
- });
265
+ });
266
+ }
267
+ exports.cleanupAttachments = cleanupAttachments;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ const { FieldTypes } = require("../../constants");
3
+ /**
4
+ * A map of how we convert various properties in rows to each other based on the row type.
5
+ */
6
+ exports.TYPE_TRANSFORM_MAP = {
7
+ [FieldTypes.LINK]: {
8
+ "": [],
9
+ [null]: [],
10
+ [undefined]: undefined,
11
+ parse: link => {
12
+ if (Array.isArray(link) && typeof link[0] === "object") {
13
+ return link.map(el => (el && el._id ? el._id : el));
14
+ }
15
+ if (typeof link === "string") {
16
+ return [link];
17
+ }
18
+ return link;
19
+ },
20
+ },
21
+ [FieldTypes.OPTIONS]: {
22
+ "": null,
23
+ [null]: null,
24
+ [undefined]: undefined,
25
+ },
26
+ [FieldTypes.ARRAY]: {
27
+ "": [],
28
+ [null]: [],
29
+ [undefined]: undefined,
30
+ },
31
+ [FieldTypes.STRING]: {
32
+ "": "",
33
+ [null]: "",
34
+ [undefined]: undefined,
35
+ },
36
+ [FieldTypes.BARCODEQR]: {
37
+ "": "",
38
+ [null]: "",
39
+ [undefined]: undefined,
40
+ },
41
+ [FieldTypes.FORMULA]: {
42
+ "": "",
43
+ [null]: "",
44
+ [undefined]: undefined,
45
+ },
46
+ [FieldTypes.LONGFORM]: {
47
+ "": "",
48
+ [null]: "",
49
+ [undefined]: undefined,
50
+ },
51
+ [FieldTypes.NUMBER]: {
52
+ "": null,
53
+ [null]: null,
54
+ [undefined]: undefined,
55
+ parse: n => parseFloat(n),
56
+ },
57
+ [FieldTypes.DATETIME]: {
58
+ "": null,
59
+ [undefined]: undefined,
60
+ [null]: null,
61
+ parse: date => {
62
+ if (date instanceof Date) {
63
+ return date.toISOString();
64
+ }
65
+ return date;
66
+ },
67
+ },
68
+ [FieldTypes.ATTACHMENT]: {
69
+ "": [],
70
+ [null]: [],
71
+ [undefined]: undefined,
72
+ },
73
+ [FieldTypes.BOOLEAN]: {
74
+ "": null,
75
+ [null]: null,
76
+ [undefined]: undefined,
77
+ true: true,
78
+ false: false,
79
+ },
80
+ [FieldTypes.AUTO]: {
81
+ parse: () => undefined,
82
+ },
83
+ [FieldTypes.JSON]: {
84
+ parse: input => {
85
+ try {
86
+ if (input === "") {
87
+ return undefined;
88
+ }
89
+ return JSON.parse(input);
90
+ }
91
+ catch (err) {
92
+ return input;
93
+ }
94
+ },
95
+ },
96
+ };
@@ -1,67 +1,75 @@
1
1
  "use strict";
2
- const { FieldTypes, FormulaTypes, AutoFieldDefaultNames, AutoFieldSubTypes, } = require("../../constants");
3
- const { processStringSync } = require("@budibase/string-templates");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.processDates = exports.processFormulas = exports.fixAutoColumnSubType = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const string_templates_1 = require("@budibase/string-templates");
4
6
  /**
5
7
  * If the subtype has been lost for any reason this works out what
6
8
  * subtype the auto column should be.
7
9
  */
8
- exports.fixAutoColumnSubType = column => {
10
+ function fixAutoColumnSubType(column) {
9
11
  if (!column.autocolumn || !column.name || column.subtype) {
10
12
  return column;
11
13
  }
12
14
  // the columns which get auto generated
13
- if (column.name.endsWith(AutoFieldDefaultNames.CREATED_BY)) {
14
- column.subtype = AutoFieldSubTypes.CREATED_BY;
15
+ if (column.name.endsWith(constants_1.AutoFieldDefaultNames.CREATED_BY)) {
16
+ column.subtype = constants_1.AutoFieldSubTypes.CREATED_BY;
15
17
  }
16
- else if (column.name.endsWith(AutoFieldDefaultNames.UPDATED_BY)) {
17
- column.subtype = AutoFieldSubTypes.UPDATED_BY;
18
+ else if (column.name.endsWith(constants_1.AutoFieldDefaultNames.UPDATED_BY)) {
19
+ column.subtype = constants_1.AutoFieldSubTypes.UPDATED_BY;
18
20
  }
19
- else if (column.name.endsWith(AutoFieldDefaultNames.CREATED_AT)) {
20
- column.subtype = AutoFieldSubTypes.CREATED_AT;
21
+ else if (column.name.endsWith(constants_1.AutoFieldDefaultNames.CREATED_AT)) {
22
+ column.subtype = constants_1.AutoFieldSubTypes.CREATED_AT;
21
23
  }
22
- else if (column.name.endsWith(AutoFieldDefaultNames.UPDATED_AT)) {
23
- column.subtype = AutoFieldSubTypes.UPDATED_AT;
24
+ else if (column.name.endsWith(constants_1.AutoFieldDefaultNames.UPDATED_AT)) {
25
+ column.subtype = constants_1.AutoFieldSubTypes.UPDATED_AT;
24
26
  }
25
- else if (column.name.endsWith(AutoFieldDefaultNames.AUTO_ID)) {
26
- column.subtype = AutoFieldSubTypes.AUTO_ID;
27
+ else if (column.name.endsWith(constants_1.AutoFieldDefaultNames.AUTO_ID)) {
28
+ column.subtype = constants_1.AutoFieldSubTypes.AUTO_ID;
27
29
  }
28
30
  return column;
29
- };
31
+ }
32
+ exports.fixAutoColumnSubType = fixAutoColumnSubType;
30
33
  /**
31
34
  * Looks through the rows provided and finds formulas - which it then processes.
32
35
  */
33
- exports.processFormulas = (table, rows, { dynamic, contextRows } = { dynamic: true }) => {
36
+ function processFormulas(table, rows, { dynamic, contextRows } = { dynamic: true }) {
34
37
  const single = !Array.isArray(rows);
38
+ let rowArray;
35
39
  if (single) {
36
- rows = [rows];
40
+ rowArray = [rows];
37
41
  contextRows = contextRows ? [contextRows] : contextRows;
38
42
  }
43
+ else {
44
+ rowArray = rows;
45
+ }
39
46
  for (let [column, schema] of Object.entries(table.schema)) {
40
- const isStatic = schema.formulaType === FormulaTypes.STATIC;
41
- if (schema.type !== FieldTypes.FORMULA ||
47
+ const isStatic = schema.formulaType === constants_1.FormulaTypes.STATIC;
48
+ if (schema.type !== constants_1.FieldTypes.FORMULA ||
42
49
  (dynamic && isStatic) ||
43
50
  (!dynamic && !isStatic)) {
44
51
  continue;
45
52
  }
46
53
  // iterate through rows and process formula
47
- for (let i = 0; i < rows.length; i++) {
54
+ for (let i = 0; i < rowArray.length; i++) {
48
55
  if (schema.formula) {
49
- let row = rows[i];
56
+ let row = rowArray[i];
50
57
  let context = contextRows ? contextRows[i] : row;
51
- rows[i] = Object.assign(Object.assign({}, row), { [column]: processStringSync(schema.formula, context) });
58
+ rowArray[i] = Object.assign(Object.assign({}, row), { [column]: (0, string_templates_1.processStringSync)(schema.formula, context) });
52
59
  }
53
60
  }
54
61
  }
55
- return single ? rows[0] : rows;
56
- };
62
+ return single ? rowArray[0] : rowArray;
63
+ }
64
+ exports.processFormulas = processFormulas;
57
65
  /**
58
66
  * Processes any date columns and ensures that those without the ignoreTimezones
59
67
  * flag set are parsed as UTC rather than local time.
60
68
  */
61
- exports.processDates = (table, rows) => {
69
+ function processDates(table, rows) {
62
70
  let datesWithTZ = [];
63
71
  for (let [column, schema] of Object.entries(table.schema)) {
64
- if (schema.type !== FieldTypes.DATETIME) {
72
+ if (schema.type !== constants_1.FieldTypes.DATETIME) {
65
73
  continue;
66
74
  }
67
75
  if (!schema.timeOnly && !schema.ignoreTimezones) {
@@ -76,4 +84,5 @@ exports.processDates = (table, rows) => {
76
84
  }
77
85
  }
78
86
  return rows;
79
- };
87
+ }
88
+ exports.processDates = processDates;