@budibase/server 1.2.37 → 1.2.39-alpha.1

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 (286) hide show
  1. package/__mocks__/mongodb.ts +4 -0
  2. package/__mocks__/node-fetch.ts +8 -1
  3. package/builder/assets/index.a1c0a62f.js +977 -0
  4. package/builder/assets/{index.08dd0c5e.css → index.f1c7e247.css} +1 -1
  5. package/builder/index.html +2 -2
  6. package/coverage/clover.xml +385 -380
  7. package/coverage/coverage-final.json +21 -21
  8. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/automation.js.html +3 -3
  11. package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
  12. package/coverage/lcov-report/api/controllers/cloud.js.html +4 -4
  13. package/coverage/lcov-report/api/controllers/component.js.html +3 -3
  14. package/coverage/lcov-report/api/controllers/datasource.js.html +3 -3
  15. package/coverage/lcov-report/api/controllers/dev.js.html +4 -4
  16. package/coverage/lcov-report/api/controllers/index.html +1 -1
  17. package/coverage/lcov-report/api/controllers/integration.js.html +3 -3
  18. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  23. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/index.html +25 -25
  28. package/coverage/lcov-report/api/controllers/row/internal.js.html +3 -3
  29. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +209 -191
  30. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/row/utils.js.html +27 -18
  32. package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/external.js.html +2 -2
  36. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  37. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/user.js.html +19 -19
  40. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/index.js.html +3 -3
  43. package/coverage/lcov-report/api/controllers/view/utils.js.html +5 -5
  44. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  45. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  46. package/coverage/lcov-report/api/index.html +1 -1
  47. package/coverage/lcov-report/api/index.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/index.html +1 -1
  59. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  73. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  74. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  75. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  76. package/coverage/lcov-report/automations/actions.js.html +1 -1
  77. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  78. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  79. package/coverage/lcov-report/automations/index.html +1 -1
  80. package/coverage/lcov-report/automations/index.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/index.html +1 -1
  88. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  97. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  105. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  106. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  107. package/coverage/lcov-report/constants/index.html +1 -1
  108. package/coverage/lcov-report/constants/index.js.html +30 -30
  109. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  110. package/coverage/lcov-report/constants/screens.js.html +1 -1
  111. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  112. package/coverage/lcov-report/db/index.html +1 -1
  113. package/coverage/lcov-report/db/index.js.html +1 -1
  114. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  116. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  117. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
  118. package/coverage/lcov-report/db/newid.js.html +3 -3
  119. package/coverage/lcov-report/db/utils.js.html +99 -99
  120. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  121. package/coverage/lcov-report/events/index.html +1 -1
  122. package/coverage/lcov-report/events/index.js.html +1 -1
  123. package/coverage/lcov-report/events/utils.js.html +1 -1
  124. package/coverage/lcov-report/index.html +19 -19
  125. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  126. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  127. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  128. package/coverage/lcov-report/middleware/builder.js.html +3 -3
  129. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  130. package/coverage/lcov-report/middleware/index.html +1 -1
  131. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  132. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  133. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  134. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  135. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  136. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  137. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  138. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  139. package/coverage/lcov-report/utilities/global.js.html +16 -16
  140. package/coverage/lcov-report/utilities/index.html +1 -1
  141. package/coverage/lcov-report/utilities/index.js.html +23 -23
  142. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  143. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  144. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  145. package/coverage/lcov-report/utilities/routing/index.js.html +3 -3
  146. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  147. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  148. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  149. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  150. package/coverage/lcov-report/utilities/security.js.html +9 -9
  151. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  152. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  153. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  154. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  155. package/coverage/lcov-report/utilities/users.js.html +7 -7
  156. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  157. package/coverage/lcov.info +598 -593
  158. package/dist/api/controllers/analytics.js +1 -1
  159. package/dist/api/controllers/application.js +8 -8
  160. package/dist/api/controllers/automation.js +2 -2
  161. package/dist/api/controllers/backup.js +2 -2
  162. package/dist/api/controllers/cloud.js +3 -3
  163. package/dist/api/controllers/component.js +2 -2
  164. package/dist/api/controllers/datasource.js +2 -2
  165. package/dist/api/controllers/deploy/index.js +6 -6
  166. package/dist/api/controllers/dev.js +3 -3
  167. package/dist/api/controllers/integration.js +2 -2
  168. package/dist/api/controllers/public/utils.js +1 -1
  169. package/dist/api/controllers/row/ExternalRequest.js +3 -3
  170. package/dist/api/controllers/row/internal.js +2 -2
  171. package/dist/api/controllers/row/internalSearch.js +5 -0
  172. package/dist/api/controllers/row/utils.js +3 -1
  173. package/dist/api/controllers/static/index.js +2 -2
  174. package/dist/api/controllers/table/external.js +1 -1
  175. package/dist/api/controllers/view/index.js +2 -2
  176. package/dist/api/controllers/view/utils.js +3 -3
  177. package/dist/automations/logging/index.js +3 -0
  178. package/dist/db/linkedRows/linkUtils.js +2 -2
  179. package/dist/db/utils.js +37 -37
  180. package/dist/db/views/staticViews.js +4 -4
  181. package/dist/definitions/automations.js +6 -6
  182. package/dist/definitions/datasource.js +6 -70
  183. package/dist/integrations/airtable.js +13 -13
  184. package/dist/integrations/arangodb.js +8 -8
  185. package/dist/integrations/base/query.js +27 -0
  186. package/dist/integrations/base/sql.js +33 -32
  187. package/dist/integrations/base/sqlTable.js +4 -4
  188. package/dist/integrations/base/utils.js +13 -27
  189. package/dist/integrations/couchdb.js +8 -8
  190. package/dist/integrations/dynamodb.js +21 -21
  191. package/dist/integrations/elasticsearch.js +12 -12
  192. package/dist/integrations/firebase.js +12 -12
  193. package/dist/integrations/googlesheets.js +14 -14
  194. package/dist/integrations/index.js +34 -34
  195. package/dist/integrations/microsoftSqlServer.js +19 -16
  196. package/dist/integrations/mongodb.js +44 -17
  197. package/dist/integrations/mysql.js +15 -15
  198. package/dist/integrations/oracle.js +13 -13
  199. package/dist/integrations/postgres.js +20 -17
  200. package/dist/integrations/redis.js +10 -10
  201. package/dist/integrations/rest.js +15 -14
  202. package/dist/integrations/s3.js +2 -2
  203. package/dist/integrations/snowflake.js +5 -5
  204. package/dist/integrations/utils.js +14 -14
  205. package/dist/middleware/builder.js +2 -2
  206. package/dist/migrations/functions/appUrls.js +2 -2
  207. package/dist/migrations/functions/backfill/app/queries.js +3 -1
  208. package/dist/migrations/functions/backfill/app.js +1 -1
  209. package/dist/migrations/functions/backfill/global/users.js +1 -1
  210. package/dist/package.json +7 -7
  211. package/dist/tests/utilities/TestConfiguration.js +2 -2
  212. package/dist/threads/automation.js +2 -2
  213. package/dist/tsconfig.build.tsbuildinfo +1 -1
  214. package/dist/utilities/routing/index.js +2 -2
  215. package/dist/utilities/security.js +8 -8
  216. package/package.json +8 -8
  217. package/src/api/controllers/analytics.ts +2 -2
  218. package/src/api/controllers/application.ts +9 -9
  219. package/src/api/controllers/automation.js +2 -2
  220. package/src/api/controllers/backup.js +2 -2
  221. package/src/api/controllers/cloud.js +3 -3
  222. package/src/api/controllers/component.js +2 -2
  223. package/src/api/controllers/datasource.js +2 -2
  224. package/src/api/controllers/deploy/index.ts +7 -7
  225. package/src/api/controllers/dev.js +3 -3
  226. package/src/api/controllers/integration.js +2 -2
  227. package/src/api/controllers/public/utils.ts +2 -2
  228. package/src/api/controllers/query/import/sources/openapi2.ts +1 -1
  229. package/src/api/controllers/query/import/sources/openapi3.ts +1 -1
  230. package/src/api/controllers/row/ExternalRequest.ts +5 -7
  231. package/src/api/controllers/row/internal.js +2 -2
  232. package/src/api/controllers/row/internalSearch.js +6 -0
  233. package/src/api/controllers/row/utils.js +4 -1
  234. package/src/api/controllers/static/index.ts +2 -2
  235. package/src/api/controllers/table/external.js +1 -1
  236. package/src/api/controllers/view/index.js +2 -2
  237. package/src/api/controllers/view/utils.js +4 -4
  238. package/src/api/routes/tests/internalSearch.spec.js +157 -0
  239. package/src/automations/logging/index.ts +3 -0
  240. package/src/db/linkedRows/linkUtils.js +2 -2
  241. package/src/db/utils.js +38 -38
  242. package/src/db/views/staticViews.js +4 -9
  243. package/src/definitions/automations.ts +2 -2
  244. package/src/definitions/common.ts +14 -65
  245. package/src/definitions/datasource.ts +5 -250
  246. package/src/integrations/airtable.ts +16 -16
  247. package/src/integrations/arangodb.ts +11 -11
  248. package/src/integrations/base/query.ts +16 -0
  249. package/src/integrations/base/sql.ts +21 -20
  250. package/src/integrations/base/sqlTable.ts +1 -6
  251. package/src/integrations/base/utils.ts +9 -19
  252. package/src/integrations/couchdb.ts +11 -11
  253. package/src/integrations/dynamodb.ts +24 -24
  254. package/src/integrations/elasticsearch.ts +15 -15
  255. package/src/integrations/firebase.ts +15 -15
  256. package/src/integrations/googlesheets.ts +19 -18
  257. package/src/integrations/index.ts +34 -34
  258. package/src/integrations/microsoftSqlServer.ts +22 -20
  259. package/src/integrations/mongodb.ts +47 -20
  260. package/src/integrations/mysql.ts +20 -19
  261. package/src/integrations/oracle.ts +16 -16
  262. package/src/integrations/postgres.ts +22 -21
  263. package/src/integrations/queries/sql.ts +1 -2
  264. package/src/integrations/redis.ts +10 -14
  265. package/src/integrations/rest.ts +22 -20
  266. package/src/integrations/s3.ts +2 -3
  267. package/src/integrations/snowflake.ts +5 -5
  268. package/src/integrations/tests/mongo.spec.js +218 -0
  269. package/src/integrations/tests/sql.spec.js +8 -8
  270. package/src/integrations/utils.ts +8 -9
  271. package/src/middleware/builder.js +2 -2
  272. package/src/migrations/functions/appUrls.ts +2 -2
  273. package/src/migrations/functions/backfill/app/queries.ts +3 -2
  274. package/src/migrations/functions/backfill/app.ts +1 -1
  275. package/src/migrations/functions/backfill/global/users.ts +1 -1
  276. package/src/migrations/functions/tests/appUrls.spec.js +3 -3
  277. package/src/migrations/tests/index.spec.ts +2 -2
  278. package/src/tests/utilities/TestConfiguration.js +2 -2
  279. package/src/threads/automation.ts +3 -3
  280. package/src/utilities/routing/index.js +2 -2
  281. package/src/utilities/security.js +8 -8
  282. package/builder/assets/index.3ce7fa08.js +0 -975
  283. package/dist/integrations/base/IntegrationBase.js +0 -2
  284. package/dist/integrations/base/datasourcePlus.js +0 -2
  285. package/src/integrations/base/IntegrationBase.ts +0 -6
  286. package/src/integrations/base/datasourcePlus.ts +0 -13
package/dist/db/utils.js CHANGED
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  const newid = require("./newid");
3
- const { DocumentTypes: CoreDocTypes, getRoleParams, generateRoleID, APP_DEV_PREFIX, APP_PREFIX, SEPARATOR, StaticDatabases, isDevAppID, isProdAppID, getDevelopmentAppID, generateAppID, getQueryIndex, ViewNames, } = require("@budibase/backend-core/db");
3
+ const { DocumentType: CoreDocTypes, getRoleParams, generateRoleID, APP_DEV_PREFIX, APP_PREFIX, SEPARATOR, StaticDatabases, isDevAppID, isProdAppID, getDevelopmentAppID, generateAppID, getQueryIndex, ViewName, } = require("@budibase/backend-core/db");
4
4
  const UNICODE_MAX = "\ufff0";
5
5
  const AppStatus = {
6
6
  DEV: "development",
7
7
  ALL: "all",
8
8
  DEPLOYED: "published",
9
9
  };
10
- const DocumentTypes = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au" });
10
+ const DocumentType = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au" });
11
11
  const InternalTables = {
12
12
  USER_METADATA: "ta_users",
13
13
  };
@@ -26,12 +26,12 @@ exports.APP_PREFIX = APP_PREFIX;
26
26
  exports.APP_DEV_PREFIX = APP_DEV_PREFIX;
27
27
  exports.isDevAppID = isDevAppID;
28
28
  exports.isProdAppID = isProdAppID;
29
- exports.USER_METDATA_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
30
- exports.LINK_USER_METADATA_PREFIX = `${DocumentTypes.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
31
- exports.TABLE_ROW_PREFIX = `${DocumentTypes.ROW}${SEPARATOR}${DocumentTypes.TABLE}`;
32
- exports.ViewNames = ViewNames;
29
+ exports.USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
30
+ exports.LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
31
+ exports.TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`;
32
+ exports.ViewName = ViewName;
33
33
  exports.InternalTables = InternalTables;
34
- exports.DocumentTypes = DocumentTypes;
34
+ exports.DocumentType = DocumentType;
35
35
  exports.SEPARATOR = SEPARATOR;
36
36
  exports.UNICODE_MAX = UNICODE_MAX;
37
37
  exports.SearchIndexes = SearchIndexes;
@@ -65,14 +65,14 @@ exports.getDocParams = getDocParams;
65
65
  * Gets parameters for retrieving tables, this is a utility function for the getDocParams function.
66
66
  */
67
67
  exports.getTableParams = (tableId = null, otherProps = {}) => {
68
- return getDocParams(DocumentTypes.TABLE, tableId, otherProps);
68
+ return getDocParams(DocumentType.TABLE, tableId, otherProps);
69
69
  };
70
70
  /**
71
71
  * Generates a new table ID.
72
72
  * @returns {string} The new table ID which the table doc can be stored under.
73
73
  */
74
74
  exports.generateTableID = () => {
75
- return `${DocumentTypes.TABLE}${SEPARATOR}${newid()}`;
75
+ return `${DocumentType.TABLE}${SEPARATOR}${newid()}`;
76
76
  };
77
77
  /**
78
78
  * Gets the DB allDocs/query params for retrieving a row.
@@ -84,10 +84,10 @@ exports.generateTableID = () => {
84
84
  */
85
85
  exports.getRowParams = (tableId = null, rowId = null, otherProps = {}) => {
86
86
  if (tableId == null) {
87
- return getDocParams(DocumentTypes.ROW, null, otherProps);
87
+ return getDocParams(DocumentType.ROW, null, otherProps);
88
88
  }
89
89
  const endOfKey = rowId == null ? `${tableId}${SEPARATOR}` : rowId;
90
- return getDocParams(DocumentTypes.ROW, endOfKey, otherProps);
90
+ return getDocParams(DocumentType.ROW, endOfKey, otherProps);
91
91
  };
92
92
  /**
93
93
  * Given a row ID this will find the table ID within it (only works for internal tables).
@@ -96,9 +96,9 @@ exports.getRowParams = (tableId = null, rowId = null, otherProps = {}) => {
96
96
  */
97
97
  exports.getTableIDFromRowID = rowId => {
98
98
  const components = rowId
99
- .split(DocumentTypes.TABLE + SEPARATOR)[1]
99
+ .split(DocumentType.TABLE + SEPARATOR)[1]
100
100
  .split(SEPARATOR);
101
- return `${DocumentTypes.TABLE}${SEPARATOR}${components[0]}`;
101
+ return `${DocumentType.TABLE}${SEPARATOR}${components[0]}`;
102
102
  };
103
103
  /**
104
104
  * Gets a new row ID for the specified table.
@@ -108,7 +108,7 @@ exports.getTableIDFromRowID = rowId => {
108
108
  */
109
109
  exports.generateRowID = (tableId, id = null) => {
110
110
  id = id || newid();
111
- return `${DocumentTypes.ROW}${SEPARATOR}${tableId}${SEPARATOR}${id}`;
111
+ return `${DocumentType.ROW}${SEPARATOR}${tableId}${SEPARATOR}${id}`;
112
112
  };
113
113
  /**
114
114
  * Gets parameters for retrieving users, this is a utility function for the getDocParams function.
@@ -128,7 +128,7 @@ exports.generateUserMetadataID = globalId => {
128
128
  * Breaks up the ID to get the global ID.
129
129
  */
130
130
  exports.getGlobalIDFromUserMetadataID = id => {
131
- const prefix = `${DocumentTypes.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
131
+ const prefix = `${DocumentType.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`;
132
132
  if (!id || !id.includes(prefix)) {
133
133
  return id;
134
134
  }
@@ -138,14 +138,14 @@ exports.getGlobalIDFromUserMetadataID = id => {
138
138
  * Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
139
139
  */
140
140
  exports.getAutomationParams = (automationId = null, otherProps = {}) => {
141
- return getDocParams(DocumentTypes.AUTOMATION, automationId, otherProps);
141
+ return getDocParams(DocumentType.AUTOMATION, automationId, otherProps);
142
142
  };
143
143
  /**
144
144
  * Generates a new automation ID.
145
145
  * @returns {string} The new automation ID which the automation doc can be stored under.
146
146
  */
147
147
  exports.generateAutomationID = () => {
148
- return `${DocumentTypes.AUTOMATION}${SEPARATOR}${newid()}`;
148
+ return `${DocumentType.AUTOMATION}${SEPARATOR}${newid()}`;
149
149
  };
150
150
  /**
151
151
  * Generates a new link doc ID. This is currently not usable with the alldocs call,
@@ -162,117 +162,117 @@ exports.generateLinkID = (tableId1, tableId2, rowId1, rowId2, fieldName1, fieldN
162
162
  const tables = `${SEPARATOR}${tableId1}${SEPARATOR}${tableId2}`;
163
163
  const rows = `${SEPARATOR}${rowId1}${SEPARATOR}${rowId2}`;
164
164
  const fields = `${SEPARATOR}${fieldName1}${SEPARATOR}${fieldName2}`;
165
- return `${DocumentTypes.LINK}${tables}${rows}${fields}`;
165
+ return `${DocumentType.LINK}${tables}${rows}${fields}`;
166
166
  };
167
167
  /**
168
168
  * Gets parameters for retrieving link docs, this is a utility function for the getDocParams function.
169
169
  */
170
170
  exports.getLinkParams = (otherProps = {}) => {
171
- return getDocParams(DocumentTypes.LINK, null, otherProps);
171
+ return getDocParams(DocumentType.LINK, null, otherProps);
172
172
  };
173
173
  /**
174
174
  * Generates a new layout ID.
175
175
  * @returns {string} The new layout ID which the layout doc can be stored under.
176
176
  */
177
177
  exports.generateLayoutID = id => {
178
- return `${DocumentTypes.LAYOUT}${SEPARATOR}${id || newid()}`;
178
+ return `${DocumentType.LAYOUT}${SEPARATOR}${id || newid()}`;
179
179
  };
180
180
  /**
181
181
  * Gets parameters for retrieving layout, this is a utility function for the getDocParams function.
182
182
  */
183
183
  exports.getLayoutParams = (layoutId = null, otherProps = {}) => {
184
- return getDocParams(DocumentTypes.LAYOUT, layoutId, otherProps);
184
+ return getDocParams(DocumentType.LAYOUT, layoutId, otherProps);
185
185
  };
186
186
  /**
187
187
  * Generates a new screen ID.
188
188
  * @returns {string} The new screen ID which the screen doc can be stored under.
189
189
  */
190
190
  exports.generateScreenID = () => {
191
- return `${DocumentTypes.SCREEN}${SEPARATOR}${newid()}`;
191
+ return `${DocumentType.SCREEN}${SEPARATOR}${newid()}`;
192
192
  };
193
193
  /**
194
194
  * Gets parameters for retrieving screens, this is a utility function for the getDocParams function.
195
195
  */
196
196
  exports.getScreenParams = (screenId = null, otherProps = {}) => {
197
- return getDocParams(DocumentTypes.SCREEN, screenId, otherProps);
197
+ return getDocParams(DocumentType.SCREEN, screenId, otherProps);
198
198
  };
199
199
  /**
200
200
  * Generates a new webhook ID.
201
201
  * @returns {string} The new webhook ID which the webhook doc can be stored under.
202
202
  */
203
203
  exports.generateWebhookID = () => {
204
- return `${DocumentTypes.WEBHOOK}${SEPARATOR}${newid()}`;
204
+ return `${DocumentType.WEBHOOK}${SEPARATOR}${newid()}`;
205
205
  };
206
206
  /**
207
207
  * Gets parameters for retrieving a webhook, this is a utility function for the getDocParams function.
208
208
  */
209
209
  exports.getWebhookParams = (webhookId = null, otherProps = {}) => {
210
- return getDocParams(DocumentTypes.WEBHOOK, webhookId, otherProps);
210
+ return getDocParams(DocumentType.WEBHOOK, webhookId, otherProps);
211
211
  };
212
212
  /**
213
213
  * Generates a new datasource ID.
214
214
  * @returns {string} The new datasource ID which the webhook doc can be stored under.
215
215
  */
216
216
  exports.generateDatasourceID = ({ plus = false } = {}) => {
217
- return `${plus ? DocumentTypes.DATASOURCE_PLUS : DocumentTypes.DATASOURCE}${SEPARATOR}${newid()}`;
217
+ return `${plus ? DocumentType.DATASOURCE_PLUS : DocumentType.DATASOURCE}${SEPARATOR}${newid()}`;
218
218
  };
219
219
  /**
220
220
  * Gets parameters for retrieving a datasource, this is a utility function for the getDocParams function.
221
221
  */
222
222
  exports.getDatasourceParams = (datasourceId = null, otherProps = {}) => {
223
- return getDocParams(DocumentTypes.DATASOURCE, datasourceId, otherProps);
223
+ return getDocParams(DocumentType.DATASOURCE, datasourceId, otherProps);
224
224
  };
225
225
  /**
226
226
  * Generates a new query ID.
227
227
  * @returns {string} The new query ID which the query doc can be stored under.
228
228
  */
229
229
  exports.generateQueryID = datasourceId => {
230
- return `${DocumentTypes.QUERY}${SEPARATOR}${datasourceId}${SEPARATOR}${newid()}`;
230
+ return `${DocumentType.QUERY}${SEPARATOR}${datasourceId}${SEPARATOR}${newid()}`;
231
231
  };
232
232
  /**
233
233
  * Generates a metadata ID for automations, used to track errors in recurring
234
234
  * automations etc.
235
235
  */
236
236
  exports.generateAutomationMetadataID = automationId => {
237
- return `${DocumentTypes.AUTOMATION_METADATA}${SEPARATOR}${automationId}`;
237
+ return `${DocumentType.AUTOMATION_METADATA}${SEPARATOR}${automationId}`;
238
238
  };
239
239
  /**
240
240
  * Retrieve all automation metadata in an app database.
241
241
  */
242
242
  exports.getAutomationMetadataParams = (otherProps = {}) => {
243
- return getDocParams(DocumentTypes.AUTOMATION_METADATA, null, otherProps);
243
+ return getDocParams(DocumentType.AUTOMATION_METADATA, null, otherProps);
244
244
  };
245
245
  /**
246
246
  * Gets parameters for retrieving a query, this is a utility function for the getDocParams function.
247
247
  */
248
248
  exports.getQueryParams = (datasourceId = null, otherProps = {}) => {
249
249
  if (datasourceId == null) {
250
- return getDocParams(DocumentTypes.QUERY, null, otherProps);
250
+ return getDocParams(DocumentType.QUERY, null, otherProps);
251
251
  }
252
- return getDocParams(DocumentTypes.QUERY, `${datasourceId}${SEPARATOR}`, otherProps);
252
+ return getDocParams(DocumentType.QUERY, `${datasourceId}${SEPARATOR}`, otherProps);
253
253
  };
254
254
  /**
255
255
  * Generates a new flag document ID.
256
256
  * @returns {string} The ID of the flag document that was generated.
257
257
  */
258
258
  exports.generateUserFlagID = userId => {
259
- return `${DocumentTypes.USER_FLAG}${SEPARATOR}${userId}`;
259
+ return `${DocumentType.USER_FLAG}${SEPARATOR}${userId}`;
260
260
  };
261
261
  exports.generateMetadataID = (type, entityId) => {
262
- return `${DocumentTypes.METADATA}${SEPARATOR}${type}${SEPARATOR}${entityId}`;
262
+ return `${DocumentType.METADATA}${SEPARATOR}${type}${SEPARATOR}${entityId}`;
263
263
  };
264
264
  exports.getMetadataParams = (type, entityId = null, otherProps = {}) => {
265
265
  let docId = `${type}${SEPARATOR}`;
266
266
  if (entityId != null) {
267
267
  docId += entityId;
268
268
  }
269
- return getDocParams(DocumentTypes.METADATA, docId, otherProps);
269
+ return getDocParams(DocumentType.METADATA, docId, otherProps);
270
270
  };
271
271
  exports.generateMemoryViewID = viewName => {
272
- return `${DocumentTypes.MEM_VIEW}${SEPARATOR}${viewName}`;
272
+ return `${DocumentType.MEM_VIEW}${SEPARATOR}${viewName}`;
273
273
  };
274
274
  exports.getMemoryViewParams = (otherProps = {}) => {
275
- return getDocParams(DocumentTypes.MEM_VIEW, null, otherProps);
275
+ return getDocParams(DocumentType.MEM_VIEW, null, otherProps);
276
276
  };
277
277
  /**
278
278
  * This can be used with the db.allDocs to get a list of IDs
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  const { getAppDB } = require("@budibase/backend-core/context");
12
- const { DocumentTypes, SEPARATOR, ViewNames, SearchIndexes, } = require("../utils");
13
- const SCREEN_PREFIX = DocumentTypes.SCREEN + SEPARATOR;
12
+ const { DocumentType, SEPARATOR, ViewName, SearchIndexes } = require("../utils");
13
+ const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR;
14
14
  /**************************************************
15
15
  * INFORMATION *
16
16
  * This file exists purely to keep views separate *
@@ -54,7 +54,7 @@ exports.createLinkView = () => __awaiter(void 0, void 0, void 0, function* () {
54
54
  }
55
55
  }.toString(),
56
56
  };
57
- designDoc.views = Object.assign(Object.assign({}, designDoc.views), { [ViewNames.LINK]: view });
57
+ designDoc.views = Object.assign(Object.assign({}, designDoc.views), { [ViewName.LINK]: view });
58
58
  yield db.put(designDoc);
59
59
  });
60
60
  exports.createRoutingView = () => __awaiter(void 0, void 0, void 0, function* () {
@@ -71,7 +71,7 @@ exports.createRoutingView = () => __awaiter(void 0, void 0, void 0, function* ()
71
71
  }
72
72
  }`,
73
73
  };
74
- designDoc.views = Object.assign(Object.assign({}, designDoc.views), { [ViewNames.ROUTING]: view });
74
+ designDoc.views = Object.assign(Object.assign({}, designDoc.views), { [ViewName.ROUTING]: view });
75
75
  yield db.put(designDoc);
76
76
  });
77
77
  function searchIndex(indexName, fnString) {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LoopStepTypes = void 0;
4
- var LoopStepTypes;
5
- (function (LoopStepTypes) {
6
- LoopStepTypes["ARRAY"] = "Array";
7
- LoopStepTypes["STRING"] = "String";
8
- })(LoopStepTypes = exports.LoopStepTypes || (exports.LoopStepTypes = {}));
3
+ exports.LoopStepType = void 0;
4
+ var LoopStepType;
5
+ (function (LoopStepType) {
6
+ LoopStepType["ARRAY"] = "Array";
7
+ LoopStepType["STRING"] = "String";
8
+ })(LoopStepType = exports.LoopStepType || (exports.LoopStepType = {}));
@@ -1,75 +1,11 @@
1
1
  "use strict";
2
+ /********************************************
3
+ * This file contains structures which are *
4
+ * internal to the server and don't need to *
5
+ * be exposed for use by other services. *
6
+ ********************************************/
2
7
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthType = exports.FilterTypes = exports.IncludeRelationships = exports.SourceNames = exports.DatasourceFieldTypes = exports.QueryTypes = exports.SortDirection = exports.Operation = void 0;
4
- var Operation;
5
- (function (Operation) {
6
- Operation["CREATE"] = "CREATE";
7
- Operation["READ"] = "READ";
8
- Operation["UPDATE"] = "UPDATE";
9
- Operation["DELETE"] = "DELETE";
10
- Operation["BULK_CREATE"] = "BULK_CREATE";
11
- Operation["CREATE_TABLE"] = "CREATE_TABLE";
12
- Operation["UPDATE_TABLE"] = "UPDATE_TABLE";
13
- Operation["DELETE_TABLE"] = "DELETE_TABLE";
14
- })(Operation = exports.Operation || (exports.Operation = {}));
15
- var SortDirection;
16
- (function (SortDirection) {
17
- SortDirection["ASCENDING"] = "ASCENDING";
18
- SortDirection["DESCENDING"] = "DESCENDING";
19
- })(SortDirection = exports.SortDirection || (exports.SortDirection = {}));
20
- var QueryTypes;
21
- (function (QueryTypes) {
22
- QueryTypes["SQL"] = "sql";
23
- QueryTypes["JSON"] = "json";
24
- QueryTypes["FIELDS"] = "fields";
25
- })(QueryTypes = exports.QueryTypes || (exports.QueryTypes = {}));
26
- var DatasourceFieldTypes;
27
- (function (DatasourceFieldTypes) {
28
- DatasourceFieldTypes["STRING"] = "string";
29
- DatasourceFieldTypes["LONGFORM"] = "longForm";
30
- DatasourceFieldTypes["BOOLEAN"] = "boolean";
31
- DatasourceFieldTypes["NUMBER"] = "number";
32
- DatasourceFieldTypes["PASSWORD"] = "password";
33
- DatasourceFieldTypes["LIST"] = "list";
34
- DatasourceFieldTypes["OBJECT"] = "object";
35
- DatasourceFieldTypes["JSON"] = "json";
36
- DatasourceFieldTypes["FILE"] = "file";
37
- })(DatasourceFieldTypes = exports.DatasourceFieldTypes || (exports.DatasourceFieldTypes = {}));
38
- var SourceNames;
39
- (function (SourceNames) {
40
- SourceNames["POSTGRES"] = "POSTGRES";
41
- SourceNames["DYNAMODB"] = "DYNAMODB";
42
- SourceNames["MONGODB"] = "MONGODB";
43
- SourceNames["ELASTICSEARCH"] = "ELASTICSEARCH";
44
- SourceNames["COUCHDB"] = "COUCHDB";
45
- SourceNames["SQL_SERVER"] = "SQL_SERVER";
46
- SourceNames["S3"] = "S3";
47
- SourceNames["AIRTABLE"] = "AIRTABLE";
48
- SourceNames["MYSQL"] = "MYSQL";
49
- SourceNames["ARANGODB"] = "ARANGODB";
50
- SourceNames["REST"] = "REST";
51
- SourceNames["ORACLE"] = "ORACLE";
52
- SourceNames["GOOGLE_SHEETS"] = "GOOGLE_SHEETS";
53
- SourceNames["FIRESTORE"] = "FIRESTORE";
54
- SourceNames["REDIS"] = "REDIS";
55
- SourceNames["SNOWFLAKE"] = "SNOWFLAKE";
56
- })(SourceNames = exports.SourceNames || (exports.SourceNames = {}));
57
- var IncludeRelationships;
58
- (function (IncludeRelationships) {
59
- IncludeRelationships[IncludeRelationships["INCLUDE"] = 1] = "INCLUDE";
60
- IncludeRelationships[IncludeRelationships["EXCLUDE"] = 0] = "EXCLUDE";
61
- })(IncludeRelationships = exports.IncludeRelationships || (exports.IncludeRelationships = {}));
62
- var FilterTypes;
63
- (function (FilterTypes) {
64
- FilterTypes["STRING"] = "string";
65
- FilterTypes["FUZZY"] = "fuzzy";
66
- FilterTypes["RANGE"] = "range";
67
- FilterTypes["EQUAL"] = "equal";
68
- FilterTypes["NOT_EQUAL"] = "notEqual";
69
- FilterTypes["EMPTY"] = "empty";
70
- FilterTypes["NOT_EMPTY"] = "notEmpty";
71
- FilterTypes["ONE_OF"] = "oneOf";
72
- })(FilterTypes = exports.FilterTypes || (exports.FilterTypes = {}));
8
+ exports.AuthType = void 0;
73
9
  var AuthType;
74
10
  (function (AuthType) {
75
11
  AuthType["BASIC"] = "basic";
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const datasource_1 = require("../definitions/datasource");
12
+ const types_1 = require("@budibase/types");
13
13
  var AirtableModule;
14
14
  (function (AirtableModule) {
15
15
  const Airtable = require("airtable");
@@ -20,61 +20,61 @@ var AirtableModule;
20
20
  type: "Spreadsheet",
21
21
  datasource: {
22
22
  apiKey: {
23
- type: datasource_1.DatasourceFieldTypes.PASSWORD,
23
+ type: types_1.DatasourceFieldType.PASSWORD,
24
24
  default: "enter api key",
25
25
  required: true,
26
26
  },
27
27
  base: {
28
- type: datasource_1.DatasourceFieldTypes.STRING,
28
+ type: types_1.DatasourceFieldType.STRING,
29
29
  default: "mybase",
30
30
  required: true,
31
31
  },
32
32
  },
33
33
  query: {
34
34
  create: {
35
- type: datasource_1.QueryTypes.FIELDS,
35
+ type: types_1.QueryType.FIELDS,
36
36
  customisable: true,
37
37
  fields: {
38
38
  table: {
39
- type: datasource_1.DatasourceFieldTypes.STRING,
39
+ type: types_1.DatasourceFieldType.STRING,
40
40
  required: true,
41
41
  },
42
42
  },
43
43
  },
44
44
  read: {
45
- type: datasource_1.QueryTypes.FIELDS,
45
+ type: types_1.QueryType.FIELDS,
46
46
  fields: {
47
47
  table: {
48
- type: datasource_1.DatasourceFieldTypes.STRING,
48
+ type: types_1.DatasourceFieldType.STRING,
49
49
  required: true,
50
50
  },
51
51
  view: {
52
- type: datasource_1.DatasourceFieldTypes.STRING,
52
+ type: types_1.DatasourceFieldType.STRING,
53
53
  required: true,
54
54
  },
55
55
  numRecords: {
56
- type: datasource_1.DatasourceFieldTypes.NUMBER,
56
+ type: types_1.DatasourceFieldType.NUMBER,
57
57
  default: 10,
58
58
  },
59
59
  },
60
60
  },
61
61
  update: {
62
- type: datasource_1.QueryTypes.FIELDS,
62
+ type: types_1.QueryType.FIELDS,
63
63
  customisable: true,
64
64
  fields: {
65
65
  id: {
66
66
  display: "Record ID",
67
- type: datasource_1.DatasourceFieldTypes.STRING,
67
+ type: types_1.DatasourceFieldType.STRING,
68
68
  required: true,
69
69
  },
70
70
  table: {
71
- type: datasource_1.DatasourceFieldTypes.STRING,
71
+ type: types_1.DatasourceFieldType.STRING,
72
72
  required: true,
73
73
  },
74
74
  },
75
75
  },
76
76
  delete: {
77
- type: datasource_1.QueryTypes.JSON,
77
+ type: types_1.QueryType.JSON,
78
78
  },
79
79
  },
80
80
  };
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const datasource_1 = require("../definitions/datasource");
12
+ const types_1 = require("@budibase/types");
13
13
  var ArangoModule;
14
14
  (function (ArangoModule) {
15
15
  const { Database, aql } = require("arangojs");
@@ -20,35 +20,35 @@ var ArangoModule;
20
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. ",
21
21
  datasource: {
22
22
  url: {
23
- type: datasource_1.DatasourceFieldTypes.STRING,
23
+ type: types_1.DatasourceFieldType.STRING,
24
24
  default: "http://localhost:8529",
25
25
  required: true,
26
26
  },
27
27
  username: {
28
- type: datasource_1.DatasourceFieldTypes.STRING,
28
+ type: types_1.DatasourceFieldType.STRING,
29
29
  default: "root",
30
30
  required: true,
31
31
  },
32
32
  password: {
33
- type: datasource_1.DatasourceFieldTypes.PASSWORD,
33
+ type: types_1.DatasourceFieldType.PASSWORD,
34
34
  required: true,
35
35
  },
36
36
  databaseName: {
37
- type: datasource_1.DatasourceFieldTypes.STRING,
37
+ type: types_1.DatasourceFieldType.STRING,
38
38
  default: "_system",
39
39
  required: true,
40
40
  },
41
41
  collection: {
42
- type: datasource_1.DatasourceFieldTypes.STRING,
42
+ type: types_1.DatasourceFieldType.STRING,
43
43
  required: true,
44
44
  },
45
45
  },
46
46
  query: {
47
47
  read: {
48
- type: datasource_1.QueryTypes.SQL,
48
+ type: types_1.QueryType.SQL,
49
49
  },
50
50
  create: {
51
- type: datasource_1.QueryTypes.JSON,
51
+ type: types_1.QueryType.JSON,
52
52
  },
53
53
  },
54
54
  };
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.makeExternalQuery = void 0;
13
+ const { integrations } = require("../index");
14
+ function makeExternalQuery(datasource, json) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const Integration = integrations[datasource.source];
17
+ // query is the opinionated function
18
+ if (Integration.prototype.query) {
19
+ const integration = new Integration(datasource.config);
20
+ return integration.query(json);
21
+ }
22
+ else {
23
+ throw "Datasource does not support query.";
24
+ }
25
+ });
26
+ }
27
+ exports.makeExternalQuery = makeExternalQuery;