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

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 (357) hide show
  1. package/builder/assets/{index.24cb0a61.js → index.e3911b1e.js} +285 -285
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +751 -654
  4. package/coverage/coverage-final.json +12 -6
  5. package/coverage/lcov-report/index.html +49 -34
  6. package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
  7. package/coverage/lcov-report/src/api/controllers/apikeys.js.html +1 -1
  8. package/coverage/lcov-report/src/api/controllers/application.ts.html +70 -13
  9. package/coverage/lcov-report/src/api/controllers/auth.ts.html +1 -1
  10. package/coverage/lcov-report/src/api/controllers/automation.js.html +1 -1
  11. package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
  12. package/coverage/lcov-report/src/api/controllers/cloud.js.html +1 -1
  13. package/coverage/lcov-report/src/api/controllers/component.ts.html +1 -1
  14. package/coverage/lcov-report/src/api/controllers/datasource.js.html +161 -23
  15. package/coverage/lcov-report/src/api/controllers/deploy/Deployment.js.html +1 -1
  16. package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
  17. package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +1 -1
  18. package/coverage/lcov-report/src/api/controllers/dev.ts.html +1 -1
  19. package/coverage/lcov-report/src/api/controllers/index.html +28 -28
  20. package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
  21. package/coverage/lcov-report/src/api/controllers/layout.js.html +1 -1
  22. package/coverage/lcov-report/src/api/controllers/metadata.js.html +1 -1
  23. package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
  24. package/coverage/lcov-report/src/api/controllers/permission.js.html +1 -1
  25. package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +1 -1
  26. package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +1 -1
  27. package/coverage/lcov-report/src/api/controllers/plugin/index.html +1 -1
  28. package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +1 -1
  29. package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +1 -1
  30. package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +1 -1
  31. package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +1 -1
  32. package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +1 -1
  33. package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +1 -1
  34. package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
  35. package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +1 -1
  36. package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
  37. package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +1 -1
  38. package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +1 -1
  39. package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +1 -1
  40. package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +1 -1
  41. package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +1 -1
  42. package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +1 -1
  43. package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +1 -1
  44. package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +1 -1
  45. package/coverage/lcov-report/src/api/controllers/public/users.ts.html +1 -1
  46. package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +1 -1
  47. package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
  48. package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +1 -1
  49. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
  50. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +1 -1
  51. package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +1 -1
  52. package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +1 -1
  53. package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
  54. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +1 -1
  55. package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +1 -1
  56. package/coverage/lcov-report/src/api/controllers/query/index.html +1 -1
  57. package/coverage/lcov-report/src/api/controllers/query/index.ts.html +1 -1
  58. package/coverage/lcov-report/src/api/controllers/query/validation.js.html +1 -1
  59. package/coverage/lcov-report/src/api/controllers/role.js.html +1 -1
  60. package/coverage/lcov-report/src/api/controllers/routing.js.html +1 -1
  61. package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +1 -1
  62. package/coverage/lcov-report/src/api/controllers/row/external.js.html +1 -1
  63. package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
  64. package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
  65. package/coverage/lcov-report/src/api/controllers/row/internal.js.html +1 -1
  66. package/coverage/lcov-report/src/api/controllers/row/internalSearch.js.html +1 -1
  67. package/coverage/lcov-report/src/api/controllers/row/staticFormula.js.html +1 -1
  68. package/coverage/lcov-report/src/api/controllers/row/utils.js.html +1 -1
  69. package/coverage/lcov-report/src/api/controllers/screen.ts.html +1 -1
  70. package/coverage/lcov-report/src/api/controllers/script.js.html +1 -1
  71. package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
  72. package/coverage/lcov-report/src/api/controllers/static/index.ts.html +1 -1
  73. package/coverage/lcov-report/src/api/controllers/table/bulkFormula.js.html +1 -1
  74. package/coverage/lcov-report/src/api/controllers/table/external.js.html +1 -1
  75. package/coverage/lcov-report/src/api/controllers/table/index.html +18 -18
  76. package/coverage/lcov-report/src/api/controllers/table/index.js.html +1 -1
  77. package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +1 -1
  78. package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +48 -33
  79. package/coverage/lcov-report/src/api/controllers/templates.js.html +1 -1
  80. package/coverage/lcov-report/src/api/controllers/user.js.html +1 -1
  81. package/coverage/lcov-report/src/api/controllers/view/exporters.js.html +1 -1
  82. package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
  83. package/coverage/lcov-report/src/api/controllers/view/index.js.html +1 -1
  84. package/coverage/lcov-report/src/api/controllers/view/utils.js.html +1 -1
  85. package/coverage/lcov-report/src/api/controllers/view/viewBuilder.js.html +1 -1
  86. package/coverage/lcov-report/src/api/controllers/webhook.ts.html +1 -1
  87. package/coverage/lcov-report/src/api/index.html +1 -1
  88. package/coverage/lcov-report/src/api/index.js.html +1 -1
  89. package/coverage/lcov-report/src/api/routes/analytics.js.html +1 -1
  90. package/coverage/lcov-report/src/api/routes/apikeys.js.html +1 -1
  91. package/coverage/lcov-report/src/api/routes/application.ts.html +1 -1
  92. package/coverage/lcov-report/src/api/routes/auth.ts.html +1 -1
  93. package/coverage/lcov-report/src/api/routes/automation.js.html +1 -1
  94. package/coverage/lcov-report/src/api/routes/backup.ts.html +1 -1
  95. package/coverage/lcov-report/src/api/routes/cloud.js.html +1 -1
  96. package/coverage/lcov-report/src/api/routes/component.js.html +1 -1
  97. package/coverage/lcov-report/src/api/routes/datasource.js.html +1 -1
  98. package/coverage/lcov-report/src/api/routes/deploy.js.html +1 -1
  99. package/coverage/lcov-report/src/api/routes/dev.js.html +1 -1
  100. package/coverage/lcov-report/src/api/routes/index.html +1 -1
  101. package/coverage/lcov-report/src/api/routes/index.ts.html +1 -1
  102. package/coverage/lcov-report/src/api/routes/integration.js.html +1 -1
  103. package/coverage/lcov-report/src/api/routes/layout.js.html +1 -1
  104. package/coverage/lcov-report/src/api/routes/metadata.js.html +1 -1
  105. package/coverage/lcov-report/src/api/routes/migrations.js.html +1 -1
  106. package/coverage/lcov-report/src/api/routes/permission.js.html +1 -1
  107. package/coverage/lcov-report/src/api/routes/plugin.ts.html +1 -1
  108. package/coverage/lcov-report/src/api/routes/public/applications.ts.html +1 -1
  109. package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
  110. package/coverage/lcov-report/src/api/routes/public/index.ts.html +1 -1
  111. package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
  112. package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +1 -1
  113. package/coverage/lcov-report/src/api/routes/public/queries.ts.html +1 -1
  114. package/coverage/lcov-report/src/api/routes/public/rows.ts.html +1 -1
  115. package/coverage/lcov-report/src/api/routes/public/tables.ts.html +1 -1
  116. package/coverage/lcov-report/src/api/routes/public/users.ts.html +1 -1
  117. package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +1 -1
  118. package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
  119. package/coverage/lcov-report/src/api/routes/query.js.html +1 -1
  120. package/coverage/lcov-report/src/api/routes/role.js.html +1 -1
  121. package/coverage/lcov-report/src/api/routes/routing.js.html +1 -1
  122. package/coverage/lcov-report/src/api/routes/row.ts.html +1 -1
  123. package/coverage/lcov-report/src/api/routes/screen.js.html +1 -1
  124. package/coverage/lcov-report/src/api/routes/script.js.html +1 -1
  125. package/coverage/lcov-report/src/api/routes/static.ts.html +1 -1
  126. package/coverage/lcov-report/src/api/routes/table.js.html +1 -1
  127. package/coverage/lcov-report/src/api/routes/templates.js.html +1 -1
  128. package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +1 -1
  129. package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
  130. package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
  131. package/coverage/lcov-report/src/api/routes/user.js.html +1 -1
  132. package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
  133. package/coverage/lcov-report/src/api/routes/utils/validators.js.html +1 -1
  134. package/coverage/lcov-report/src/api/routes/view.js.html +1 -1
  135. package/coverage/lcov-report/src/api/routes/webhook.ts.html +1 -1
  136. package/coverage/lcov-report/src/app.ts.html +1 -1
  137. package/coverage/lcov-report/src/automations/actions.js.html +1 -1
  138. package/coverage/lcov-report/src/automations/automationUtils.js.html +1 -1
  139. package/coverage/lcov-report/src/automations/bullboard.js.html +1 -1
  140. package/coverage/lcov-report/src/automations/index.html +1 -1
  141. package/coverage/lcov-report/src/automations/index.js.html +1 -1
  142. package/coverage/lcov-report/src/automations/logging/index.html +1 -1
  143. package/coverage/lcov-report/src/automations/logging/index.ts.html +1 -1
  144. package/coverage/lcov-report/src/automations/steps/bash.js.html +1 -1
  145. package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
  146. package/coverage/lcov-report/src/automations/steps/delay.js.html +1 -1
  147. package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
  148. package/coverage/lcov-report/src/automations/steps/discord.js.html +1 -1
  149. package/coverage/lcov-report/src/automations/steps/executeQuery.js.html +1 -1
  150. package/coverage/lcov-report/src/automations/steps/executeScript.js.html +1 -1
  151. package/coverage/lcov-report/src/automations/steps/filter.js.html +1 -1
  152. package/coverage/lcov-report/src/automations/steps/index.html +1 -1
  153. package/coverage/lcov-report/src/automations/steps/integromat.js.html +1 -1
  154. package/coverage/lcov-report/src/automations/steps/loop.js.html +1 -1
  155. package/coverage/lcov-report/src/automations/steps/outgoingWebhook.js.html +1 -1
  156. package/coverage/lcov-report/src/automations/steps/queryRows.js.html +1 -1
  157. package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.js.html +1 -1
  158. package/coverage/lcov-report/src/automations/steps/serverLog.js.html +1 -1
  159. package/coverage/lcov-report/src/automations/steps/slack.js.html +1 -1
  160. package/coverage/lcov-report/src/automations/steps/updateRow.js.html +1 -1
  161. package/coverage/lcov-report/src/automations/steps/utils.js.html +1 -1
  162. package/coverage/lcov-report/src/automations/steps/zapier.js.html +1 -1
  163. package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
  164. package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +1 -1
  165. package/coverage/lcov-report/src/automations/triggerInfo/app.js.html +1 -1
  166. package/coverage/lcov-report/src/automations/triggerInfo/cron.js.html +1 -1
  167. package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
  168. package/coverage/lcov-report/src/automations/triggerInfo/index.js.html +1 -1
  169. package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.js.html +1 -1
  170. package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.js.html +1 -1
  171. package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.js.html +1 -1
  172. package/coverage/lcov-report/src/automations/triggerInfo/webhook.js.html +1 -1
  173. package/coverage/lcov-report/src/automations/triggers.js.html +1 -1
  174. package/coverage/lcov-report/src/automations/utils.ts.html +1 -1
  175. package/coverage/lcov-report/src/constants/index.html +1 -1
  176. package/coverage/lcov-report/src/constants/index.js.html +1 -1
  177. package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
  178. package/coverage/lcov-report/src/constants/screens.js.html +1 -1
  179. package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.js.html +2023 -0
  180. package/coverage/lcov-report/src/db/defaultData/employeeImport.js.html +541 -0
  181. package/coverage/lcov-report/src/db/defaultData/expensesImport.js.html +427 -0
  182. package/coverage/lcov-report/src/db/defaultData/index.html +176 -0
  183. package/coverage/lcov-report/src/db/defaultData/inventoryImport.js.html +403 -0
  184. package/coverage/lcov-report/src/db/defaultData/jobsImport.js.html +559 -0
  185. package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
  186. package/coverage/lcov-report/src/db/inMemoryView.js.html +1 -1
  187. package/coverage/lcov-report/src/db/index.html +1 -1
  188. package/coverage/lcov-report/src/db/index.js.html +1 -1
  189. package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +11 -149
  190. package/coverage/lcov-report/src/db/linkedRows/LinkDocument.js.html +226 -0
  191. package/coverage/lcov-report/src/db/linkedRows/index.html +28 -13
  192. package/coverage/lcov-report/src/db/linkedRows/index.js.html +1 -1
  193. package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +1 -1
  194. package/coverage/lcov-report/src/db/newid.js.html +1 -1
  195. package/coverage/lcov-report/src/db/utils.ts.html +2 -2
  196. package/coverage/lcov-report/src/definitions/automations.ts.html +1 -1
  197. package/coverage/lcov-report/src/definitions/datasource.ts.html +1 -1
  198. package/coverage/lcov-report/src/definitions/index.html +1 -1
  199. package/coverage/lcov-report/src/environment.js.html +1 -1
  200. package/coverage/lcov-report/src/events/AutomationEmitter.js.html +1 -1
  201. package/coverage/lcov-report/src/events/index.html +1 -1
  202. package/coverage/lcov-report/src/events/index.js.html +1 -1
  203. package/coverage/lcov-report/src/events/utils.js.html +1 -1
  204. package/coverage/lcov-report/src/index.html +1 -1
  205. package/coverage/lcov-report/src/index.ts.html +1 -1
  206. package/coverage/lcov-report/src/integrations/airtable.ts.html +1 -1
  207. package/coverage/lcov-report/src/integrations/arangodb.ts.html +1 -1
  208. package/coverage/lcov-report/src/integrations/base/index.html +1 -1
  209. package/coverage/lcov-report/src/integrations/base/query.ts.html +1 -1
  210. package/coverage/lcov-report/src/integrations/base/sql.ts.html +1 -1
  211. package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +1 -1
  212. package/coverage/lcov-report/src/integrations/base/utils.ts.html +1 -1
  213. package/coverage/lcov-report/src/integrations/couchdb.ts.html +1 -1
  214. package/coverage/lcov-report/src/integrations/dynamodb.ts.html +1 -1
  215. package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +1 -1
  216. package/coverage/lcov-report/src/integrations/firebase.ts.html +1 -1
  217. package/coverage/lcov-report/src/integrations/googlesheets.ts.html +1 -1
  218. package/coverage/lcov-report/src/integrations/index.html +1 -1
  219. package/coverage/lcov-report/src/integrations/index.ts.html +1 -1
  220. package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1 -1
  221. package/coverage/lcov-report/src/integrations/mongodb.ts.html +1 -1
  222. package/coverage/lcov-report/src/integrations/mysql.ts.html +1 -1
  223. package/coverage/lcov-report/src/integrations/oracle.ts.html +1 -1
  224. package/coverage/lcov-report/src/integrations/postgres.ts.html +1 -1
  225. package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
  226. package/coverage/lcov-report/src/integrations/queries/sql.ts.html +1 -1
  227. package/coverage/lcov-report/src/integrations/redis.ts.html +1 -1
  228. package/coverage/lcov-report/src/integrations/rest.ts.html +1 -1
  229. package/coverage/lcov-report/src/integrations/s3.ts.html +1 -1
  230. package/coverage/lcov-report/src/integrations/snowflake.ts.html +1 -1
  231. package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
  232. package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
  233. package/coverage/lcov-report/src/integrations/utils.ts.html +1 -1
  234. package/coverage/lcov-report/src/middleware/appInfo.ts.html +1 -1
  235. package/coverage/lcov-report/src/middleware/authorized.ts.html +1 -1
  236. package/coverage/lcov-report/src/middleware/builder.ts.html +1 -1
  237. package/coverage/lcov-report/src/middleware/currentapp.ts.html +1 -1
  238. package/coverage/lcov-report/src/middleware/index.html +1 -1
  239. package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
  240. package/coverage/lcov-report/src/middleware/publicApi.ts.html +1 -1
  241. package/coverage/lcov-report/src/middleware/resourceId.ts.html +1 -1
  242. package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
  243. package/coverage/lcov-report/src/middleware/utils.ts.html +1 -1
  244. package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +1 -1
  245. package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +1 -1
  246. package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +1 -1
  247. package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +1 -1
  248. package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +1 -1
  249. package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +1 -1
  250. package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +1 -1
  251. package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +1 -1
  252. package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +1 -1
  253. package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +1 -1
  254. package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +1 -1
  255. package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
  256. package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +1 -1
  257. package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +1 -1
  258. package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +1 -1
  259. package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
  260. package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +1 -1
  261. package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +1 -1
  262. package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
  263. package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
  264. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
  265. package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
  266. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +1 -1
  267. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
  268. package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +1 -1
  269. package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +1 -1
  270. package/coverage/lcov-report/src/migrations/index.html +1 -1
  271. package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
  272. package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
  273. package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
  274. package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
  275. package/coverage/lcov-report/src/module.d.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 +1 -1
  281. package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +1 -1
  282. package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
  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 +1 -1
  290. package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +1 -1
  291. package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
  292. package/coverage/lcov-report/src/tests/utilities/index.html +1 -1
  293. package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
  294. package/coverage/lcov-report/src/tests/utilities/structures.js.html +1 -1
  295. package/coverage/lcov-report/src/threads/automation.ts.html +1 -1
  296. package/coverage/lcov-report/src/threads/index.html +1 -1
  297. package/coverage/lcov-report/src/threads/index.ts.html +1 -1
  298. package/coverage/lcov-report/src/threads/query.ts.html +1 -1
  299. package/coverage/lcov-report/src/threads/utils.ts.html +1 -1
  300. package/coverage/lcov-report/src/utilities/budibaseDir.js.html +1 -1
  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 +1 -1
  304. package/coverage/lcov-report/src/utilities/fileSystem/index.html +1 -1
  305. package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +1 -1
  306. package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
  307. package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +1 -1
  308. package/coverage/lcov-report/src/utilities/global.ts.html +1 -1
  309. package/coverage/lcov-report/src/utilities/index.html +1 -1
  310. package/coverage/lcov-report/src/utilities/index.js.html +3 -3
  311. package/coverage/lcov-report/src/utilities/plugins.js.html +1 -1
  312. package/coverage/lcov-report/src/utilities/queue/inMemoryQueue.js.html +1 -1
  313. package/coverage/lcov-report/src/utilities/queue/index.html +1 -1
  314. package/coverage/lcov-report/src/utilities/redis.js.html +1 -1
  315. package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
  316. package/coverage/lcov-report/src/utilities/routing/index.js.html +1 -1
  317. package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
  318. package/coverage/lcov-report/src/utilities/rowProcessor/index.js.html +1 -1
  319. package/coverage/lcov-report/src/utilities/rowProcessor/utils.js.html +1 -1
  320. package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
  321. package/coverage/lcov-report/src/utilities/security.js.html +1 -1
  322. package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
  323. package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
  324. package/coverage/lcov-report/src/utilities/usageQuota/rows.js.html +1 -1
  325. package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  326. package/coverage/lcov-report/src/utilities/users.js.html +1 -1
  327. package/coverage/lcov-report/src/utilities/workerRequests.js.html +1 -1
  328. package/coverage/lcov-report/src/watch.ts.html +1 -1
  329. package/coverage/lcov-report/src/websocket.ts.html +1 -1
  330. package/coverage/lcov.info +1281 -1113
  331. package/dist/api/controllers/application.js +13 -2
  332. package/dist/api/controllers/datasource.js +47 -9
  333. package/dist/api/controllers/table/utils.js +31 -26
  334. package/dist/db/defaultData/datasource_bb_default.js +565 -0
  335. package/dist/db/defaultData/employeeImport.js +153 -0
  336. package/dist/db/defaultData/expensesImport.js +115 -0
  337. package/dist/db/defaultData/inventoryImport.js +107 -0
  338. package/dist/db/defaultData/jobsImport.js +150 -0
  339. package/dist/db/linkedRows/LinkController.js +2 -29
  340. package/dist/db/linkedRows/LinkDocument.js +32 -0
  341. package/dist/db/utils.js +1 -1
  342. package/dist/package.json +6 -6
  343. package/dist/sdk/app/tables/index.js +1 -1
  344. package/dist/tsconfig.build.tsbuildinfo +1 -1
  345. package/package.json +7 -7
  346. package/src/api/controllers/application.ts +22 -3
  347. package/src/api/controllers/datasource.js +57 -11
  348. package/src/api/controllers/table/utils.ts +17 -12
  349. package/src/db/defaultData/datasource_bb_default.js +646 -0
  350. package/src/db/defaultData/employeeImport.js +152 -0
  351. package/src/db/defaultData/expensesImport.js +114 -0
  352. package/src/db/defaultData/inventoryImport.js +106 -0
  353. package/src/db/defaultData/jobsImport.js +158 -0
  354. package/src/db/linkedRows/LinkController.js +2 -48
  355. package/src/db/linkedRows/LinkDocument.js +47 -0
  356. package/src/db/utils.ts +1 -1
  357. package/src/sdk/app/tables/index.ts +1 -1
@@ -0,0 +1,646 @@
1
+ const {
2
+ FieldTypes,
3
+ AutoFieldSubTypes,
4
+ RelationshipTypes,
5
+ } = require("../../constants/index")
6
+ const { importToRows } = require("../../api/controllers/table/utils")
7
+ const { cloneDeep } = require("lodash/fp")
8
+ const LinkDocument = require("../linkedRows/LinkDocument")
9
+ const { inventoryImport } = require("./inventoryImport")
10
+ const { employeeImport } = require("./employeeImport")
11
+ const { jobsImport } = require("./jobsImport")
12
+ const { expensesImport } = require("./expensesImport")
13
+ const { db: dbCore } = require("@budibase/backend-core")
14
+
15
+ exports.DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs"
16
+ exports.DEFAULT_INVENTORY_TABLE_ID = "ta_bb_inventory"
17
+ exports.DEFAULT_EXPENSES_TABLE_ID = "ta_bb_expenses"
18
+ exports.DEFAULT_EMPLOYEE_TABLE_ID = "ta_bb_employee"
19
+ exports.DEFAULT_BB_DATASOURCE_ID = "datasource_internal_bb_default"
20
+ exports.DEFAULT_BB_DATASOURCE = {
21
+ _id: this.DEFAULT_BB_DATASOURCE_ID,
22
+ type: dbCore.BUDIBASE_DATASOURCE_TYPE,
23
+ name: "Sample Data",
24
+ source: "BUDIBASE",
25
+ config: {},
26
+ }
27
+
28
+ const syncLastIds = (table, rowCount) => {
29
+ Object.keys(table.schema).forEach(key => {
30
+ const entry = table.schema[key]
31
+ if (entry.autocolumn && entry.subtype == "autoID") {
32
+ entry.lastID = rowCount
33
+ }
34
+ })
35
+ }
36
+
37
+ const tableImport = (table, data) => {
38
+ const cloneTable = cloneDeep(table)
39
+ const rowDocs = importToRows(data, cloneTable)
40
+ syncLastIds(cloneTable, rowDocs.length)
41
+ return { rows: rowDocs, table: cloneTable }
42
+ }
43
+
44
+ // AUTO COLUMNS
45
+ const AUTO_COLUMNS = {
46
+ "Created At": {
47
+ name: "Created At",
48
+ type: FieldTypes.DATETIME,
49
+ subtype: AutoFieldSubTypes.CREATED_AT,
50
+ icon: "ri-magic-line",
51
+ autocolumn: true,
52
+ constraints: {
53
+ type: FieldTypes.STRING,
54
+ length: {},
55
+ presence: false,
56
+ datetime: {
57
+ latest: "",
58
+ earliest: "",
59
+ },
60
+ },
61
+ },
62
+ "Updated At": {
63
+ name: "Updated At",
64
+ type: FieldTypes.DATETIME,
65
+ subtype: AutoFieldSubTypes.UPDATED_AT,
66
+ icon: "ri-magic-line",
67
+ autocolumn: true,
68
+ constraints: {
69
+ type: FieldTypes.STRING,
70
+ length: {},
71
+ presence: false,
72
+ datetime: {
73
+ latest: "",
74
+ earliest: "",
75
+ },
76
+ },
77
+ },
78
+ }
79
+
80
+ exports.DEFAULT_INVENTORY_TABLE_SCHEMA = {
81
+ _id: this.DEFAULT_INVENTORY_TABLE_ID,
82
+ type: "internal",
83
+ views: {},
84
+ sourceId: exports.DEFAULT_BB_DATASOURCE_ID,
85
+ primaryDisplay: "Item Name",
86
+ name: "Inventory",
87
+ schema: {
88
+ "Item ID": {
89
+ name: "Item ID",
90
+ type: FieldTypes.NUMBER,
91
+ subtype: AutoFieldSubTypes.AUTO_ID,
92
+ icon: "ri-magic-line",
93
+ autocolumn: true,
94
+ constraints: {
95
+ type: FieldTypes.NUMBER,
96
+ presence: false,
97
+ numericality: {
98
+ greaterThanOrEqualTo: "",
99
+ lessThanOrEqualTo: "",
100
+ },
101
+ },
102
+ },
103
+ "Item Name": {
104
+ type: FieldTypes.STRING,
105
+ constraints: {
106
+ type: FieldTypes.STRING,
107
+ length: {
108
+ maximum: null,
109
+ },
110
+ presence: {
111
+ allowEmpty: false,
112
+ },
113
+ },
114
+ name: "Item Name",
115
+ },
116
+ "Item Tags": {
117
+ type: FieldTypes.ARRAY,
118
+ constraints: {
119
+ type: FieldTypes.ARRAY,
120
+ presence: {
121
+ allowEmpty: false,
122
+ },
123
+ inclusion: ["Electrical", "Material", "Vehicle", "Office", "Tools"],
124
+ },
125
+ name: "Item Tags",
126
+ sortable: false,
127
+ },
128
+ Notes: {
129
+ type: FieldTypes.LONGFORM,
130
+ constraints: {
131
+ type: FieldTypes.STRING,
132
+ length: {},
133
+ presence: false,
134
+ },
135
+ name: "Notes",
136
+ useRichText: null,
137
+ },
138
+ Status: {
139
+ type: FieldTypes.ARRAY,
140
+ constraints: {
141
+ type: FieldTypes.ARRAY,
142
+ presence: {
143
+ allowEmpty: false,
144
+ },
145
+ inclusion: ["Available", "Repair", "Broken"],
146
+ },
147
+ name: "Status",
148
+ sortable: false,
149
+ },
150
+ SKU: {
151
+ type: FieldTypes.BARCODEQR,
152
+ constraints: {
153
+ type: FieldTypes.STRING,
154
+ length: {},
155
+ presence: false,
156
+ },
157
+ name: "SKU",
158
+ },
159
+ "Purchase Date": {
160
+ type: FieldTypes.DATETIME,
161
+ constraints: {
162
+ type: FieldTypes.STRING,
163
+ length: {},
164
+ presence: false,
165
+ datetime: {
166
+ latest: "",
167
+ earliest: "",
168
+ },
169
+ },
170
+ name: "Purchase Date",
171
+ ignoreTimezones: true,
172
+ },
173
+ "Purchase Price": {
174
+ type: FieldTypes.NUMBER,
175
+ constraints: {
176
+ type: FieldTypes.NUMBER,
177
+ presence: false,
178
+ numericality: {
179
+ greaterThanOrEqualTo: null,
180
+ lessThanOrEqualTo: "",
181
+ },
182
+ },
183
+ name: "Purchase Price",
184
+ },
185
+ ...AUTO_COLUMNS,
186
+ },
187
+ }
188
+
189
+ exports.DEFAULT_EMPLOYEE_TABLE_SCHEMA = {
190
+ _id: this.DEFAULT_EMPLOYEE_TABLE_ID,
191
+ type: "internal",
192
+ views: {},
193
+ name: "Employees",
194
+ sourceId: exports.DEFAULT_BB_DATASOURCE_ID,
195
+ primaryDisplay: "First Name",
196
+ schema: {
197
+ "First Name": {
198
+ name: "First Name",
199
+ type: FieldTypes.STRING,
200
+ constraints: {
201
+ type: FieldTypes.STRING,
202
+ length: {},
203
+ presence: false,
204
+ },
205
+ },
206
+ "Last Name": {
207
+ name: "Last Name",
208
+ type: FieldTypes.STRING,
209
+ constraints: {
210
+ type: FieldTypes.STRING,
211
+ length: {},
212
+ presence: false,
213
+ },
214
+ },
215
+ Email: {
216
+ name: "Email",
217
+ type: FieldTypes.STRING,
218
+ constraints: {
219
+ type: FieldTypes.STRING,
220
+ length: {},
221
+ presence: false,
222
+ },
223
+ },
224
+ Address: {
225
+ name: "Address",
226
+ type: FieldTypes.STRING,
227
+ constraints: {
228
+ type: FieldTypes.STRING,
229
+ length: {},
230
+ presence: false,
231
+ },
232
+ },
233
+ City: {
234
+ name: "City",
235
+ type: FieldTypes.STRING,
236
+ constraints: {
237
+ type: FieldTypes.STRING,
238
+ length: {},
239
+ presence: false,
240
+ },
241
+ },
242
+ Postcode: {
243
+ name: "Postcode",
244
+ type: FieldTypes.STRING,
245
+ constraints: {
246
+ type: FieldTypes.STRING,
247
+ length: {},
248
+ presence: false,
249
+ },
250
+ },
251
+ Phone: {
252
+ name: "Phone",
253
+ type: FieldTypes.STRING,
254
+ constraints: {
255
+ type: FieldTypes.STRING,
256
+ length: {},
257
+ presence: false,
258
+ },
259
+ },
260
+ "EMPLOYEE ID": {
261
+ name: "EMPLOYEE ID",
262
+ type: FieldTypes.NUMBER,
263
+ subtype: AutoFieldSubTypes.AUTO_ID,
264
+ icon: "ri-magic-line",
265
+ autocolumn: true,
266
+ constraints: {
267
+ type: FieldTypes.NUMBER,
268
+ presence: false,
269
+ numericality: {
270
+ greaterThanOrEqualTo: "",
271
+ lessThanOrEqualTo: "",
272
+ },
273
+ },
274
+ },
275
+ "Employee Level": {
276
+ type: FieldTypes.ARRAY,
277
+ constraints: {
278
+ type: FieldTypes.ARRAY,
279
+ presence: false,
280
+ inclusion: ["Manager", "Junior", "Senior", "Apprentice", "Contractor"],
281
+ },
282
+ name: "Employee Level",
283
+ sortable: false,
284
+ },
285
+ "Badge Photo": {
286
+ type: "attachment",
287
+ constraints: {
288
+ type: FieldTypes.ARRAY,
289
+ presence: false,
290
+ },
291
+ name: "Badge Photo",
292
+ sortable: false,
293
+ },
294
+ Jobs: {
295
+ type: FieldTypes.LINK,
296
+ constraints: {
297
+ type: FieldTypes.ARRAY,
298
+ presence: false,
299
+ },
300
+ fieldName: "Assigned",
301
+ name: "Jobs",
302
+ relationshipType: RelationshipTypes.MANY_TO_MANY,
303
+ tableId: this.DEFAULT_JOBS_TABLE_ID,
304
+ },
305
+ "Start Date": {
306
+ type: FieldTypes.DATETIME,
307
+ constraints: {
308
+ type: FieldTypes.STRING,
309
+ length: {},
310
+ presence: false,
311
+ datetime: {
312
+ latest: "",
313
+ earliest: "",
314
+ },
315
+ },
316
+ name: "Start Date",
317
+ ignoreTimezones: true,
318
+ },
319
+ "End Date": {
320
+ type: FieldTypes.DATETIME,
321
+ constraints: {
322
+ type: FieldTypes.STRING,
323
+ length: {},
324
+ presence: false,
325
+ datetime: {
326
+ latest: "",
327
+ earliest: "",
328
+ },
329
+ },
330
+ name: "End Date",
331
+ ignoreTimezones: true,
332
+ },
333
+ ...AUTO_COLUMNS,
334
+ },
335
+ }
336
+
337
+ exports.DEFAULT_JOBS_TABLE_SCHEMA = {
338
+ _id: this.DEFAULT_JOBS_TABLE_ID,
339
+ type: "internal",
340
+ name: "Jobs",
341
+ sourceId: exports.DEFAULT_BB_DATASOURCE_ID,
342
+ primaryDisplay: "Job ID",
343
+ schema: {
344
+ "Job ID": {
345
+ name: "Job ID",
346
+ type: FieldTypes.NUMBER,
347
+ subtype: AutoFieldSubTypes.AUTO_ID,
348
+ icon: "ri-magic-line",
349
+ autocolumn: true,
350
+ constraints: {
351
+ type: FieldTypes.NUMBER,
352
+ presence: false,
353
+ numericality: {
354
+ greaterThanOrEqualTo: "",
355
+ lessThanOrEqualTo: "",
356
+ },
357
+ },
358
+ },
359
+ "Quote Date": {
360
+ type: FieldTypes.DATETIME,
361
+ constraints: {
362
+ type: FieldTypes.STRING,
363
+ length: {},
364
+ presence: {
365
+ allowEmpty: false,
366
+ },
367
+ datetime: {
368
+ latest: "",
369
+ earliest: "",
370
+ },
371
+ },
372
+ name: "Quote Date",
373
+ ignoreTimezones: true,
374
+ },
375
+ "Quote Price": {
376
+ type: FieldTypes.NUMBER,
377
+ constraints: {
378
+ type: FieldTypes.NUMBER,
379
+ presence: {
380
+ allowEmpty: false,
381
+ },
382
+ numericality: {
383
+ greaterThanOrEqualTo: "",
384
+ lessThanOrEqualTo: "",
385
+ },
386
+ },
387
+ name: "Quote Price",
388
+ },
389
+ "Works Start": {
390
+ type: FieldTypes.DATETIME,
391
+ constraints: {
392
+ type: FieldTypes.STRING,
393
+ length: {},
394
+ presence: false,
395
+ datetime: {
396
+ latest: "",
397
+ earliest: "",
398
+ },
399
+ },
400
+ name: "Works Start",
401
+ ignoreTimezones: true,
402
+ },
403
+ Address: {
404
+ type: FieldTypes.LONGFORM,
405
+ constraints: {
406
+ type: FieldTypes.STRING,
407
+ length: {},
408
+ presence: false,
409
+ },
410
+ name: "Address",
411
+ useRichText: null,
412
+ },
413
+ "Customer Name": {
414
+ type: FieldTypes.STRING,
415
+ constraints: {
416
+ type: FieldTypes.STRING,
417
+ length: {
418
+ maximum: null,
419
+ },
420
+ presence: false,
421
+ },
422
+ name: "Customer Name",
423
+ },
424
+ Notes: {
425
+ type: FieldTypes.LONGFORM,
426
+ constraints: {
427
+ type: FieldTypes.STRING,
428
+ length: {},
429
+ presence: false,
430
+ },
431
+ name: "Notes",
432
+ useRichText: null,
433
+ },
434
+ "Customer Phone": {
435
+ type: FieldTypes.STRING,
436
+ constraints: {
437
+ type: FieldTypes.STRING,
438
+ length: {
439
+ maximum: null,
440
+ },
441
+ presence: false,
442
+ },
443
+ name: "Customer Phone",
444
+ },
445
+ "Customer Email": {
446
+ type: FieldTypes.STRING,
447
+ constraints: {
448
+ type: FieldTypes.STRING,
449
+ length: {
450
+ maximum: null,
451
+ },
452
+ presence: false,
453
+ },
454
+ name: "Customer Email",
455
+ },
456
+ Assigned: {
457
+ name: "Assigned",
458
+ type: FieldTypes.LINK,
459
+ tableId: this.DEFAULT_EMPLOYEE_TABLE_ID,
460
+ fieldName: "Jobs",
461
+ relationshipType: RelationshipTypes.MANY_TO_MANY,
462
+ // sortable: true,
463
+ },
464
+ "Works End": {
465
+ type: "datetime",
466
+ constraints: {
467
+ type: "string",
468
+ length: {},
469
+ presence: false,
470
+ datetime: {
471
+ latest: "",
472
+ earliest: "",
473
+ },
474
+ },
475
+ name: "Works End",
476
+ ignoreTimezones: true,
477
+ },
478
+ "Updated Price": {
479
+ type: "number",
480
+ constraints: {
481
+ type: "number",
482
+ presence: false,
483
+ numericality: {
484
+ greaterThanOrEqualTo: "",
485
+ lessThanOrEqualTo: "",
486
+ },
487
+ },
488
+ name: "Updated Price",
489
+ },
490
+ ...AUTO_COLUMNS,
491
+ },
492
+ }
493
+
494
+ exports.DEFAULT_EXPENSES_TABLE_SCHEMA = {
495
+ _id: this.DEFAULT_EXPENSES_TABLE_ID,
496
+ type: "internal",
497
+ views: {},
498
+ name: "Expenses",
499
+ sourceId: exports.DEFAULT_BB_DATASOURCE_ID,
500
+ primaryDisplay: "Expense ID",
501
+ schema: {
502
+ "Expense ID": {
503
+ name: "Expense ID",
504
+ type: FieldTypes.NUMBER,
505
+ subtype: AutoFieldSubTypes.AUTO_ID,
506
+ icon: "ri-magic-line",
507
+ autocolumn: true,
508
+ constraints: {
509
+ type: FieldTypes.NUMBER,
510
+ presence: false,
511
+ numericality: {
512
+ greaterThanOrEqualTo: "",
513
+ lessThanOrEqualTo: "",
514
+ },
515
+ },
516
+ },
517
+ "Expense Tags": {
518
+ type: FieldTypes.ARRAY,
519
+ constraints: {
520
+ type: FieldTypes.ARRAY,
521
+ presence: {
522
+ allowEmpty: false,
523
+ },
524
+ inclusion: [
525
+ "Fuel",
526
+ "Food",
527
+ "Materials",
528
+ "Repair",
529
+ "Equipment",
530
+ "Fees",
531
+ "Service",
532
+ "Office",
533
+ "Other",
534
+ ],
535
+ },
536
+ name: "Expense Tags",
537
+ sortable: false,
538
+ },
539
+ Cost: {
540
+ type: FieldTypes.NUMBER,
541
+ constraints: {
542
+ type: FieldTypes.NUMBER,
543
+ presence: {
544
+ allowEmpty: false,
545
+ },
546
+ numericality: {
547
+ greaterThanOrEqualTo: "",
548
+ lessThanOrEqualTo: "",
549
+ },
550
+ },
551
+ name: "Cost",
552
+ },
553
+ Notes: {
554
+ type: FieldTypes.LONGFORM,
555
+ constraints: {
556
+ type: FieldTypes.STRING,
557
+ length: {},
558
+ presence: false,
559
+ },
560
+ name: "Notes",
561
+ useRichText: null,
562
+ },
563
+ "Payment Due": {
564
+ type: FieldTypes.DATETIME,
565
+ constraints: {
566
+ type: FieldTypes.STRING,
567
+ length: {},
568
+ presence: false,
569
+ datetime: {
570
+ latest: "",
571
+ earliest: "",
572
+ },
573
+ },
574
+ name: "Payment Due",
575
+ ignoreTimezones: true,
576
+ },
577
+ "Date Paid": {
578
+ type: FieldTypes.DATETIME,
579
+ constraints: {
580
+ type: FieldTypes.STRING,
581
+ length: {},
582
+ presence: false,
583
+ datetime: {
584
+ latest: "",
585
+ earliest: "",
586
+ },
587
+ },
588
+ name: "Date Paid",
589
+ ignoreTimezones: true,
590
+ },
591
+ Attachment: {
592
+ type: FieldTypes.ATTACHMENT,
593
+ constraints: {
594
+ type: FieldTypes.ARRAY,
595
+ presence: false,
596
+ },
597
+ name: "Attachment",
598
+ sortable: false,
599
+ },
600
+ ...AUTO_COLUMNS,
601
+ },
602
+ }
603
+
604
+ exports.buildDefaultDocs = () => {
605
+ const inventoryData = tableImport(
606
+ this.DEFAULT_INVENTORY_TABLE_SCHEMA,
607
+ inventoryImport
608
+ )
609
+
610
+ const employeeData = tableImport(
611
+ this.DEFAULT_EMPLOYEE_TABLE_SCHEMA,
612
+ employeeImport
613
+ )
614
+
615
+ const jobData = tableImport(this.DEFAULT_JOBS_TABLE_SCHEMA, jobsImport)
616
+
617
+ const expensesData = tableImport(
618
+ this.DEFAULT_EXPENSES_TABLE_SCHEMA,
619
+ expensesImport
620
+ )
621
+
622
+ // Build one link doc for each employee/job
623
+ const jobEmployeeLinks = employeeData.rows.map((employee, index) => {
624
+ return new LinkDocument(
625
+ employeeData.table._id,
626
+ "Jobs",
627
+ employeeData.rows[index]._id,
628
+ jobData.table._id,
629
+ "Assigned",
630
+ jobData.rows[index]._id
631
+ )
632
+ })
633
+
634
+ return [
635
+ this.DEFAULT_BB_DATASOURCE,
636
+ inventoryData.table,
637
+ employeeData.table,
638
+ jobData.table,
639
+ expensesData.table,
640
+ ...inventoryData.rows,
641
+ ...employeeData.rows,
642
+ ...jobData.rows,
643
+ ...expensesData.rows,
644
+ ...jobEmployeeLinks,
645
+ ]
646
+ }