@budibase/server 1.0.207-alpha.1 → 1.0.207-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 (203) hide show
  1. package/builder/assets/{index.e3814251.js → index.b382c9f1.js} +159 -161
  2. package/builder/assets/{index.c6df2367.css → index.c6912819.css} +1 -1
  3. package/builder/index.html +2 -2
  4. package/coverage/clover.xml +35 -27
  5. package/coverage/coverage-final.json +1 -1
  6. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/component.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/index.html +1 -1
  15. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  21. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/external.js.html +55 -10
  25. package/coverage/lcov-report/api/controllers/row/index.html +14 -14
  26. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  43. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  44. package/coverage/lcov-report/api/index.html +1 -1
  45. package/coverage/lcov-report/api/index.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/index.html +1 -1
  57. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  71. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  73. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  74. package/coverage/lcov-report/automations/actions.js.html +1 -1
  75. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  76. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  77. package/coverage/lcov-report/automations/index.html +1 -1
  78. package/coverage/lcov-report/automations/index.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/index.html +1 -1
  86. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  96. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  105. package/coverage/lcov-report/constants/index.html +1 -1
  106. package/coverage/lcov-report/constants/index.js.html +1 -1
  107. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  108. package/coverage/lcov-report/constants/screens.js.html +1 -1
  109. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  110. package/coverage/lcov-report/db/index.html +1 -1
  111. package/coverage/lcov-report/db/index.js.html +1 -1
  112. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  113. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  116. package/coverage/lcov-report/db/newid.js.html +1 -1
  117. package/coverage/lcov-report/db/utils.js.html +1 -1
  118. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  119. package/coverage/lcov-report/events/index.html +1 -1
  120. package/coverage/lcov-report/events/index.js.html +1 -1
  121. package/coverage/lcov-report/events/utils.js.html +1 -1
  122. package/coverage/lcov-report/index.html +14 -14
  123. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  124. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  125. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  126. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  127. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  128. package/coverage/lcov-report/middleware/index.html +1 -1
  129. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  130. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  131. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  132. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  133. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  134. package/coverage/lcov-report/threads/automation.js.html +1 -1
  135. package/coverage/lcov-report/threads/index.html +1 -1
  136. package/coverage/lcov-report/threads/query.js.html +1 -1
  137. package/coverage/lcov-report/threads/utils.js.html +1 -1
  138. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  139. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  140. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  141. package/coverage/lcov-report/utilities/global.js.html +1 -1
  142. package/coverage/lcov-report/utilities/index.html +1 -1
  143. package/coverage/lcov-report/utilities/index.js.html +1 -1
  144. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  145. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  146. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  147. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  148. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  149. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  150. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  151. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  152. package/coverage/lcov-report/utilities/security.js.html +1 -1
  153. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  154. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  155. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  156. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  157. package/coverage/lcov-report/utilities/users.js.html +1 -1
  158. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  159. package/coverage/lcov.info +48 -36
  160. package/dist/api/controllers/row/external.js +17 -3
  161. package/dist/integrations/airtable.js +1 -0
  162. package/dist/integrations/arangodb.js +1 -0
  163. package/dist/integrations/base/sql.js +20 -3
  164. package/dist/integrations/couchdb.js +1 -0
  165. package/dist/integrations/dynamodb.js +1 -0
  166. package/dist/integrations/elasticsearch.js +1 -0
  167. package/dist/integrations/firebase.js +1 -0
  168. package/dist/integrations/googlesheets.js +1 -0
  169. package/dist/integrations/microsoftSqlServer.js +2 -1
  170. package/dist/integrations/mongodb.js +1 -0
  171. package/dist/integrations/mysql.js +2 -1
  172. package/dist/integrations/oracle.js +1 -0
  173. package/dist/integrations/postgres.js +2 -1
  174. package/dist/integrations/redis.js +1 -0
  175. package/dist/integrations/rest.js +1 -0
  176. package/dist/integrations/s3.js +1 -0
  177. package/dist/integrations/snowflake.js +1 -0
  178. package/dist/package.json +7 -6
  179. package/dist/tsconfig.build.tsbuildinfo +1 -1
  180. package/package.json +8 -7
  181. package/scripts/integrations/oracle/instantclient/linux/arm64/basiclite-19.10.zip +0 -0
  182. package/scripts/integrations/oracle/instantclient/linux/arm64/install.sh +23 -0
  183. package/scripts/integrations/oracle/instantclient/linux/install.sh +10 -0
  184. package/src/api/controllers/row/external.js +18 -3
  185. package/src/definitions/common.ts +1 -0
  186. package/src/definitions/datasource.ts +1 -0
  187. package/src/integrations/airtable.ts +1 -0
  188. package/src/integrations/arangodb.ts +1 -0
  189. package/src/integrations/base/sql.ts +25 -11
  190. package/src/integrations/couchdb.ts +1 -0
  191. package/src/integrations/dynamodb.ts +1 -0
  192. package/src/integrations/elasticsearch.ts +1 -0
  193. package/src/integrations/firebase.ts +1 -0
  194. package/src/integrations/googlesheets.ts +1 -0
  195. package/src/integrations/microsoftSqlServer.ts +2 -0
  196. package/src/integrations/mongodb.ts +1 -0
  197. package/src/integrations/mysql.ts +2 -0
  198. package/src/integrations/oracle.ts +1 -0
  199. package/src/integrations/postgres.ts +2 -0
  200. package/src/integrations/redis.ts +1 -0
  201. package/src/integrations/rest.ts +1 -0
  202. package/src/integrations/s3.ts +1 -0
  203. package/src/integrations/snowflake.ts +1 -0
@@ -91,7 +91,7 @@
91
91
  <div class='footer quiet pad2 space-top1 center small'>
92
92
  Code coverage generated by
93
93
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
94
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
94
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
95
95
  </div>
96
96
  <script src="../prettify.js"></script>
97
97
  <script>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
119
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
120
120
  </div>
121
121
  <script src="../../prettify.js"></script>
122
122
  <script>
@@ -307,7 +307,7 @@ exports.getUniqueRows = async appIds =&gt; {
307
307
  <div class='footer quiet pad2 space-top1 center small'>
308
308
  Code coverage generated by
309
309
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
310
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
310
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
311
311
  </div>
312
312
  <script src="../../prettify.js"></script>
313
313
  <script>
@@ -124,7 +124,7 @@ function <span class="fstat-no" title="function not covered" >resetQuotasIfRequi
124
124
  <div class='footer quiet pad2 space-top1 center small'>
125
125
  Code coverage generated by
126
126
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
127
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
127
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
128
128
  </div>
129
129
  <script src="../../prettify.js"></script>
130
130
  <script>
@@ -205,7 +205,7 @@ exports.publicApiUserFix = ctx =&gt; {
205
205
  <div class='footer quiet pad2 space-top1 center small'>
206
206
  Code coverage generated by
207
207
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
208
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
208
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
209
209
  </div>
210
210
  <script src="../prettify.js"></script>
211
211
  <script>
@@ -487,7 +487,7 @@ exports.readGlobalUser = <span class="fstat-no" title="function not covered" >as
487
487
  <div class='footer quiet pad2 space-top1 center small'>
488
488
  Code coverage generated by
489
489
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
490
- at Mon Jun 20 2022 11:45:45 GMT+0000 (Coordinated Universal Time)
490
+ at Thu Jun 23 2022 14:44:43 GMT+0000 (Coordinated Universal Time)
491
491
  </div>
492
492
  <script src="../prettify.js"></script>
493
493
  <script>
@@ -1774,9 +1774,9 @@ FN:98,(anonymous_8)
1774
1774
  FN:101,(anonymous_9)
1775
1775
  FN:152,(anonymous_10)
1776
1776
  FN:157,(anonymous_11)
1777
- FN:168,(anonymous_12)
1778
- FN:183,(anonymous_13)
1779
- FN:213,(anonymous_14)
1777
+ FN:169,(anonymous_12)
1778
+ FN:198,(anonymous_13)
1779
+ FN:228,(anonymous_14)
1780
1780
  FNF:15
1781
1781
  FNH:0
1782
1782
  FNDA:0,handleRequest
@@ -1873,36 +1873,44 @@ DA:160,0
1873
1873
  DA:161,0
1874
1874
  DA:162,0
1875
1875
  DA:163,0
1876
- DA:165,0
1877
- DA:168,0
1878
- DA:173,0
1876
+ DA:164,0
1877
+ DA:166,0
1878
+ DA:169,0
1879
1879
  DA:174,0
1880
1880
  DA:175,0
1881
- DA:176,0
1881
+ DA:178,0
1882
1882
  DA:179,0
1883
1883
  DA:180,0
1884
- DA:183,44
1885
- DA:184,0
1886
- DA:185,0
1884
+ DA:181,0
1885
+ DA:182,0
1887
1886
  DA:186,0
1888
- DA:187,0
1889
- DA:188,0
1890
1887
  DA:189,0
1891
1888
  DA:190,0
1892
- DA:192,0
1893
- DA:193,0
1894
- DA:197,0
1895
- DA:198,0
1889
+ DA:191,0
1890
+ DA:194,0
1891
+ DA:195,0
1892
+ DA:198,44
1893
+ DA:199,0
1894
+ DA:200,0
1896
1895
  DA:201,0
1897
1896
  DA:202,0
1897
+ DA:203,0
1898
+ DA:204,0
1899
+ DA:205,0
1898
1900
  DA:207,0
1899
- DA:209,0
1900
- DA:210,0
1901
- DA:211,0
1901
+ DA:208,0
1902
+ DA:212,0
1902
1903
  DA:213,0
1903
- DA:214,0
1904
- DA:227,0
1905
- LF:108
1904
+ DA:216,0
1905
+ DA:217,0
1906
+ DA:222,0
1907
+ DA:224,0
1908
+ DA:225,0
1909
+ DA:226,0
1910
+ DA:228,0
1911
+ DA:229,0
1912
+ DA:242,0
1913
+ LF:116
1906
1914
  LH:18
1907
1915
  BRDA:16,0,0,0
1908
1916
  BRDA:18,1,0,0
@@ -1937,20 +1945,24 @@ BRDA:137,15,0,0
1937
1945
  BRDA:137,15,1,0
1938
1946
  BRDA:137,16,0,0
1939
1947
  BRDA:137,16,1,0
1940
- BRDA:162,17,0,0
1941
- BRDA:162,17,1,0
1942
- BRDA:162,18,0,0
1943
- BRDA:162,18,1,0
1944
- BRDA:189,19,0,0
1945
- BRDA:189,19,1,0
1946
- BRDA:189,20,0,0
1947
- BRDA:189,20,1,0
1948
- BRDA:202,21,0,0
1949
- BRDA:202,21,1,0
1950
- BRDA:203,22,0,0
1951
- BRDA:203,22,1,0
1952
- BRDA:203,22,2,0
1953
- BRF:46
1948
+ BRDA:163,17,0,0
1949
+ BRDA:163,17,1,0
1950
+ BRDA:163,18,0,0
1951
+ BRDA:163,18,1,0
1952
+ BRDA:178,19,0,0
1953
+ BRDA:178,19,1,0
1954
+ BRDA:178,20,0,0
1955
+ BRDA:178,20,1,0
1956
+ BRDA:204,21,0,0
1957
+ BRDA:204,21,1,0
1958
+ BRDA:204,22,0,0
1959
+ BRDA:204,22,1,0
1960
+ BRDA:217,23,0,0
1961
+ BRDA:217,23,1,0
1962
+ BRDA:218,24,0,0
1963
+ BRDA:218,24,1,0
1964
+ BRDA:218,24,2,0
1965
+ BRF:50
1954
1966
  BRH:0
1955
1967
  end_of_record
1956
1968
  TN:
@@ -157,7 +157,8 @@ exports.validate = () => __awaiter(void 0, void 0, void 0, function* () {
157
157
  exports.exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
158
158
  const { datasourceId } = breakExternalTableId(ctx.params.tableId);
159
159
  const db = getAppDB();
160
- let format = ctx.query.format;
160
+ const format = ctx.query.format;
161
+ const { columns } = ctx.request.body;
161
162
  const datasource = yield db.get(datasourceId);
162
163
  if (!datasource || !datasource.entities) {
163
164
  ctx.throw(400, "Datasource has not been configured for plus API.");
@@ -170,12 +171,25 @@ exports.exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
170
171
  },
171
172
  };
172
173
  let result = yield exports.search(ctx);
173
- let headers = Object.keys(result.rows[0]);
174
+ let rows = [];
175
+ // Filter data to only specified columns if required
176
+ if (columns && columns.length) {
177
+ for (let i = 0; i < result.rows.length; i++) {
178
+ rows[i] = {};
179
+ for (let column of columns) {
180
+ rows[i][column] = result.rows[i][column];
181
+ }
182
+ }
183
+ }
184
+ else {
185
+ rows = result.rows;
186
+ }
187
+ let headers = Object.keys(rows[0]);
174
188
  const exporter = exporters[format];
175
189
  const filename = `export.${format}`;
176
190
  // send down the file
177
191
  ctx.attachment(filename);
178
- return apiFileReturn(exporter(headers, result.rows));
192
+ return apiFileReturn(exporter(headers, rows));
179
193
  });
180
194
  exports.fetchEnrichedRow = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
181
195
  const id = ctx.params.rowId;
@@ -17,6 +17,7 @@ var AirtableModule;
17
17
  docs: "https://airtable.com/api",
18
18
  description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
19
19
  friendlyName: "Airtable",
20
+ type: "Spreadsheet",
20
21
  datasource: {
21
22
  apiKey: {
22
23
  type: datasource_1.DatasourceFieldTypes.PASSWORD,
@@ -16,6 +16,7 @@ var ArangoModule;
16
16
  const SCHEMA = {
17
17
  docs: "https://github.com/arangodb/arangojs",
18
18
  friendlyName: "ArangoDB",
19
+ type: "Non-relational",
19
20
  description: "ArangoDB is a scalable open-source multi-model database natively supporting graph, document and search. All supported data models & access patterns can be combined in queries allowing for maximal flexibility. ",
20
21
  datasource: {
21
22
  url: {
@@ -89,6 +89,23 @@ function parseFilters(filters) {
89
89
  }
90
90
  return filters;
91
91
  }
92
+ function generateSelectStatement(json, knex) {
93
+ var _a;
94
+ const { resource, meta } = json;
95
+ const schema = (_a = meta === null || meta === void 0 ? void 0 : meta.table) === null || _a === void 0 ? void 0 : _a.schema;
96
+ return resource.fields.map(field => {
97
+ const fieldNames = field.split(/\./g);
98
+ const tableName = fieldNames[0];
99
+ const columnName = fieldNames[1];
100
+ if (columnName && knex.client.config.client === utils_1.SqlClients.POSTGRES) {
101
+ const externalType = schema === null || schema === void 0 ? void 0 : schema[columnName].externalType;
102
+ if (externalType === null || externalType === void 0 ? void 0 : externalType.includes("money")) {
103
+ return knex.raw(`"${tableName}"."${columnName}"::money::numeric as "${field}"`);
104
+ }
105
+ }
106
+ return `${field} as ${field}`;
107
+ });
108
+ }
92
109
  class InternalBuilder {
93
110
  constructor(client) {
94
111
  this.client = client;
@@ -209,7 +226,7 @@ class InternalBuilder {
209
226
  }
210
227
  return query;
211
228
  }
212
- addRelationships(knex, query, fields, fromTable, relationships) {
229
+ addRelationships(query, fromTable, relationships) {
213
230
  if (!relationships) {
214
231
  return query;
215
232
  }
@@ -311,7 +328,7 @@ class InternalBuilder {
311
328
  if (resource.fields && resource.fields.length > 0) {
312
329
  // select the resources as the format "table.columnName" - this is what is provided
313
330
  // by the resource builder further up
314
- selectStatement = resource.fields.map(field => `${field} as ${field}`);
331
+ selectStatement = generateSelectStatement(json, knex);
315
332
  }
316
333
  let foundLimit = limit || BASE_LIMIT;
317
334
  // handle pagination
@@ -347,7 +364,7 @@ class InternalBuilder {
347
364
  preQuery = this.addSorting(preQuery, json);
348
365
  }
349
366
  // handle joins
350
- query = this.addRelationships(knex, preQuery, selectStatement, tableName, relationships);
367
+ query = this.addRelationships(preQuery, tableName, relationships);
351
368
  return this.addFilters(query, filters, { relationship: true });
352
369
  }
353
370
  update(knex, json, opts) {
@@ -16,6 +16,7 @@ var CouchDBModule;
16
16
  const SCHEMA = {
17
17
  docs: "https://docs.couchdb.org/en/stable/",
18
18
  friendlyName: "CouchDB",
19
+ type: "Non-relational",
19
20
  description: "Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
20
21
  datasource: {
21
22
  url: {
@@ -18,6 +18,7 @@ var DynamoModule;
18
18
  docs: "https://github.com/dabit3/dynamodb-documentclient-cheat-sheet",
19
19
  description: "Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale.",
20
20
  friendlyName: "DynamoDB",
21
+ type: "Non-relational",
21
22
  datasource: {
22
23
  region: {
23
24
  type: datasource_1.DatasourceFieldTypes.STRING,
@@ -17,6 +17,7 @@ var ElasticsearchModule;
17
17
  docs: "https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
18
18
  description: "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
19
19
  friendlyName: "ElasticSearch",
20
+ type: "Non-relational",
20
21
  datasource: {
21
22
  url: {
22
23
  type: datasource_1.DatasourceFieldTypes.STRING,
@@ -16,6 +16,7 @@ var Firebase;
16
16
  const SCHEMA = {
17
17
  docs: "https://firebase.google.com/docs/firestore/quickstart",
18
18
  friendlyName: "Firestore",
19
+ type: "Non-relational",
19
20
  description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
20
21
  datasource: {
21
22
  email: {
@@ -33,6 +33,7 @@ var GoogleSheetsModule;
33
33
  docs: "https://developers.google.com/sheets/api/quickstart/nodejs",
34
34
  description: "Create and collaborate on online spreadsheets in real-time and from any device. ",
35
35
  friendlyName: "Google Sheets",
36
+ type: "Spreadsheet",
36
37
  datasource: {
37
38
  spreadsheetId: {
38
39
  display: "Google Sheet URL",
@@ -21,6 +21,7 @@ var MSSQLModule;
21
21
  plus: true,
22
22
  description: "Microsoft SQL Server is a relational database management system developed by Microsoft. ",
23
23
  friendlyName: "MS SQL Server",
24
+ type: "Relational",
24
25
  datasource: {
25
26
  user: {
26
27
  type: datasource_1.DatasourceFieldTypes.STRING,
@@ -201,7 +202,7 @@ var MSSQLModule;
201
202
  if (typeof name !== "string") {
202
203
  continue;
203
204
  }
204
- schema[name] = Object.assign({ autocolumn: !!autoColumns.find((col) => col === name), name: name }, (0, utils_1.convertSqlType)(def.DATA_TYPE));
205
+ schema[name] = Object.assign(Object.assign({ autocolumn: !!autoColumns.find((col) => col === name), name: name }, (0, utils_1.convertSqlType)(def.DATA_TYPE)), { externalType: def.DATA_TYPE });
205
206
  }
206
207
  tables[tableName] = {
207
208
  _id: (0, utils_1.buildExternalTableId)(datasourceId, tableName),
@@ -16,6 +16,7 @@ var MongoDBModule;
16
16
  const SCHEMA = {
17
17
  docs: "https://github.com/mongodb/node-mongodb-native",
18
18
  friendlyName: "MongoDB",
19
+ type: "Non-relational",
19
20
  description: "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
20
21
  datasource: {
21
22
  connectionString: {
@@ -24,6 +24,7 @@ var MySQLModule;
24
24
  docs: "https://github.com/sidorares/node-mysql2",
25
25
  plus: true,
26
26
  friendlyName: "MySQL",
27
+ type: "Relational",
27
28
  description: "MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
28
29
  datasource: {
29
30
  host: {
@@ -187,7 +188,7 @@ var MySQLModule;
187
188
  const isAuto = typeof column.Extra === "string" &&
188
189
  (column.Extra === "auto_increment" ||
189
190
  column.Extra.toLowerCase().includes("generated"));
190
- schema[columnName] = Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type));
191
+ schema[columnName] = Object.assign(Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type)), { externalType: column.Type });
191
192
  }
192
193
  if (!tables[tableName]) {
193
194
  tables[tableName] = {
@@ -24,6 +24,7 @@ var OracleModule;
24
24
  docs: "https://github.com/oracle/node-oracledb",
25
25
  plus: true,
26
26
  friendlyName: "Oracle",
27
+ type: "Relational",
27
28
  description: "Oracle Database is an object-relational database management system developed by Oracle Corporation",
28
29
  datasource: {
29
30
  host: {
@@ -29,6 +29,7 @@ var PostgresModule;
29
29
  docs: "https://node-postgres.com",
30
30
  plus: true,
31
31
  friendlyName: "PostgreSQL",
32
+ type: "Relational",
32
33
  description: "PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
33
34
  datasource: {
34
35
  host: {
@@ -229,7 +230,7 @@ var PostgresModule;
229
230
  column.column_default.startsWith("nextval");
230
231
  const isGenerated = column.is_generated && column.is_generated !== "NEVER";
231
232
  const isAuto = hasDefault || identity || isGenerated;
232
- tables[tableName].schema[columnName] = Object.assign({ autocolumn: isAuto, name: columnName }, (0, utils_1.convertSqlType)(column.data_type));
233
+ tables[tableName].schema[columnName] = Object.assign(Object.assign({ autocolumn: isAuto, name: columnName }, (0, utils_1.convertSqlType)(column.data_type)), { externalType: column.data_type });
233
234
  }
234
235
  const final = (0, utils_1.finaliseExternalTables)(tables, entities);
235
236
  this.tables = final.tables;
@@ -20,6 +20,7 @@ var RedisModule;
20
20
  docs: "https://redis.io/docs/",
21
21
  description: "",
22
22
  friendlyName: "Redis",
23
+ type: "Non-relational",
23
24
  datasource: {
24
25
  host: {
25
26
  type: "string",
@@ -56,6 +56,7 @@ var RestModule;
56
56
  docs: "https://github.com/node-fetch/node-fetch",
57
57
  description: "With the REST API datasource, you can connect, query and pull data from multiple REST APIs. You can then use the retrieved data to build apps.",
58
58
  friendlyName: "REST API",
59
+ type: "API",
59
60
  datasource: {
60
61
  url: {
61
62
  type: datasource_1.DatasourceFieldTypes.STRING,
@@ -17,6 +17,7 @@ var S3Module;
17
17
  docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
18
18
  description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
19
19
  friendlyName: "Amazon S3",
20
+ type: "Object store",
20
21
  datasource: {
21
22
  region: {
22
23
  type: "string",
@@ -17,6 +17,7 @@ var SnowflakeModule;
17
17
  docs: "https://developers.snowflake.com/",
18
18
  description: "Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
19
19
  friendlyName: "Snowflake",
20
+ type: "Relational",
20
21
  datasource: {
21
22
  account: {
22
23
  type: "string",
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "1.0.207-alpha.0",
4
+ "version": "1.0.207-alpha.9",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -77,10 +77,11 @@
77
77
  "license": "GPL-3.0",
78
78
  "dependencies": {
79
79
  "@apidevtools/swagger-parser": "10.0.3",
80
- "@budibase/backend-core": "^1.0.207-alpha.0",
81
- "@budibase/client": "^1.0.207-alpha.0",
82
- "@budibase/pro": "1.0.207-alpha.0",
83
- "@budibase/string-templates": "^1.0.207-alpha.0",
80
+ "@budibase/backend-core": "^1.0.207-alpha.9",
81
+ "@budibase/client": "^1.0.207-alpha.9",
82
+ "@budibase/pro": "1.0.207-alpha.9",
83
+ "@budibase/string-templates": "^1.0.207-alpha.9",
84
+ "@budibase/types": "^1.0.207-alpha.9",
84
85
  "@bull-board/api": "3.7.0",
85
86
  "@bull-board/koa": "3.9.4",
86
87
  "@elastic/elasticsearch": "7.10.0",
@@ -151,7 +152,7 @@
151
152
  "@babel/core": "7.17.4",
152
153
  "@babel/preset-env": "7.16.11",
153
154
  "@budibase/standard-components": "^0.9.139",
154
- "@budibase/types": "^1.0.207-alpha.0",
155
+ "@budibase/types": "^1.0.207-alpha.3",
155
156
  "@jest/test-sequencer": "24.9.0",
156
157
  "@types/apidoc": "0.50.0",
157
158
  "@types/bson": "4.2.0",