@budibase/server 1.3.15-alpha.3 → 1.3.17

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 (268) hide show
  1. package/__mocks__/mongodb.ts +1 -1
  2. package/builder/assets/index.8f5f192a.js +876 -0
  3. package/builder/assets/{index.ecdac070.css → index.a70e216a.css} +2 -2
  4. package/builder/assets/vendor.5e1fe644.css +1 -0
  5. package/builder/assets/vendor.67dbd8fa.js +248 -0
  6. package/builder/index.html +4 -2
  7. package/coverage/clover.xml +254 -296
  8. package/coverage/coverage-final.json +17 -17
  9. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/component.js.html +13 -82
  15. package/coverage/lcov-report/api/controllers/datasource.js.html +20 -20
  16. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/index.html +30 -30
  18. package/coverage/lcov-report/api/controllers/integration.js.html +6 -6
  19. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  24. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  29. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/screen.js.html +12 -207
  34. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  38. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  43. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  44. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  45. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  46. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  47. package/coverage/lcov-report/api/index.html +1 -1
  48. package/coverage/lcov-report/api/index.js.html +12 -12
  49. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/index.html +1 -1
  60. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  73. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  74. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  75. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  76. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  77. package/coverage/lcov-report/automations/actions.js.html +1 -1
  78. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  79. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  80. package/coverage/lcov-report/automations/index.html +1 -1
  81. package/coverage/lcov-report/automations/index.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/index.html +1 -1
  89. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  95. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  96. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  97. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  98. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  104. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  105. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  106. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  107. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  108. package/coverage/lcov-report/constants/index.html +1 -1
  109. package/coverage/lcov-report/constants/index.js.html +1 -1
  110. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  111. package/coverage/lcov-report/constants/screens.js.html +1 -1
  112. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  113. package/coverage/lcov-report/db/index.html +18 -18
  114. package/coverage/lcov-report/db/index.js.html +1 -1
  115. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  116. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  117. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  118. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  119. package/coverage/lcov-report/db/newid.js.html +2 -2
  120. package/coverage/lcov-report/db/utils.js.html +20 -56
  121. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  122. package/coverage/lcov-report/events/index.html +1 -1
  123. package/coverage/lcov-report/events/index.js.html +1 -1
  124. package/coverage/lcov-report/events/utils.js.html +1 -1
  125. package/coverage/lcov-report/index.html +28 -28
  126. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  127. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  128. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  129. package/coverage/lcov-report/middleware/builder.js.html +12 -12
  130. package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
  131. package/coverage/lcov-report/middleware/index.html +1 -1
  132. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  133. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  134. package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
  135. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  136. package/coverage/lcov-report/middleware/utils.js.html +2 -2
  137. package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
  138. package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
  139. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  140. package/coverage/lcov-report/utilities/global.js.html +16 -16
  141. package/coverage/lcov-report/utilities/index.html +1 -1
  142. package/coverage/lcov-report/utilities/index.js.html +24 -24
  143. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
  144. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  145. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  146. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  147. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  148. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  149. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  150. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  151. package/coverage/lcov-report/utilities/security.js.html +2 -2
  152. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  153. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  154. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  155. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  156. package/coverage/lcov-report/utilities/users.js.html +1 -1
  157. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  158. package/coverage/lcov.info +445 -533
  159. package/dist/api/controllers/application.js +4 -5
  160. package/dist/api/controllers/component.js +1 -18
  161. package/dist/api/controllers/datasource.js +4 -4
  162. package/dist/api/controllers/integration.js +4 -4
  163. package/dist/api/controllers/row/ExternalRequest.js +3 -1
  164. package/dist/api/controllers/screen.js +2 -52
  165. package/dist/api/controllers/static/index.js +0 -1
  166. package/dist/api/controllers/static/templates/BudibaseApp.svelte +0 -10
  167. package/dist/api/controllers/static/templates/preview.hbs +1 -5
  168. package/dist/api/routes/index.js +0 -2
  169. package/dist/app.js +0 -11
  170. package/dist/db/utils.js +1 -10
  171. package/dist/environment.js +2 -3
  172. package/dist/integrations/airtable.js +129 -126
  173. package/dist/integrations/arangodb.js +89 -86
  174. package/dist/integrations/base/query.js +2 -2
  175. package/dist/integrations/base/sqlTable.js +1 -3
  176. package/dist/integrations/couchdb.js +83 -80
  177. package/dist/integrations/dynamodb.js +164 -161
  178. package/dist/integrations/elasticsearch.js +138 -135
  179. package/dist/integrations/firebase.js +157 -154
  180. package/dist/integrations/googlesheets.js +327 -323
  181. package/dist/integrations/index.js +51 -93
  182. package/dist/integrations/microsoftSqlServer.js +243 -240
  183. package/dist/integrations/mongodb.js +242 -239
  184. package/dist/integrations/mysql.js +219 -215
  185. package/dist/integrations/oracle.js +322 -318
  186. package/dist/integrations/postgres.js +265 -262
  187. package/dist/integrations/redis.js +139 -134
  188. package/dist/integrations/rest.js +292 -289
  189. package/dist/integrations/s3.js +64 -61
  190. package/dist/integrations/snowflake.js +86 -83
  191. package/dist/package.json +6 -9
  192. package/dist/threads/query.js +2 -2
  193. package/dist/tsconfig.build.tsbuildinfo +1 -1
  194. package/dist/utilities/fileSystem/index.js +11 -111
  195. package/package.json +7 -10
  196. package/scripts/dev/manage.js +0 -1
  197. package/src/api/controllers/application.ts +1 -1
  198. package/src/api/controllers/component.js +2 -25
  199. package/src/api/controllers/datasource.js +4 -4
  200. package/src/api/controllers/integration.js +4 -4
  201. package/src/api/controllers/row/ExternalRequest.ts +4 -1
  202. package/src/api/controllers/screen.js +1 -66
  203. package/src/api/controllers/static/index.ts +0 -1
  204. package/src/api/controllers/static/templates/BudibaseApp.svelte +0 -10
  205. package/src/api/controllers/static/templates/preview.hbs +1 -5
  206. package/src/api/routes/index.ts +0 -2
  207. package/src/api/routes/tests/query.spec.js +25 -8
  208. package/src/app.ts +0 -14
  209. package/src/db/utils.js +0 -12
  210. package/src/environment.js +2 -3
  211. package/src/integrations/airtable.ts +118 -116
  212. package/src/integrations/arangodb.ts +89 -87
  213. package/src/integrations/base/query.ts +2 -2
  214. package/src/integrations/base/sqlTable.ts +1 -3
  215. package/src/integrations/couchdb.ts +89 -83
  216. package/src/integrations/dynamodb.ts +175 -173
  217. package/src/integrations/elasticsearch.ts +122 -120
  218. package/src/integrations/firebase.ts +159 -157
  219. package/src/integrations/googlesheets.ts +338 -328
  220. package/src/integrations/index.ts +21 -59
  221. package/src/integrations/microsoftSqlServer.ts +251 -249
  222. package/src/integrations/mongodb.ts +258 -261
  223. package/src/integrations/mysql.ts +234 -229
  224. package/src/integrations/oracle.ts +380 -373
  225. package/src/integrations/postgres.ts +268 -264
  226. package/src/integrations/redis.ts +132 -128
  227. package/src/integrations/rest.ts +329 -324
  228. package/src/integrations/s3.ts +71 -68
  229. package/src/integrations/snowflake.ts +82 -80
  230. package/src/integrations/tests/{airtable.spec.ts → airtable.spec.js} +18 -21
  231. package/src/integrations/tests/{arangodb.spec.ts → arangodb.spec.js} +9 -12
  232. package/src/integrations/tests/{couchdb.spec.ts → couchdb.spec.js} +27 -33
  233. package/src/integrations/tests/{dynamodb.spec.ts → dynamodb.spec.js} +41 -45
  234. package/src/integrations/tests/{elasticsearch.spec.ts → elasticsearch.spec.js} +21 -22
  235. package/src/integrations/tests/{firebase.spec.ts → firebase.spec.js} +28 -33
  236. package/src/integrations/tests/{microsoftSqlServer.spec.ts → microsoftSqlServer.spec.js} +11 -12
  237. package/src/integrations/tests/{mongo.spec.ts → mongo.spec.js} +35 -46
  238. package/src/integrations/tests/{mysql.spec.ts → mysql.spec.js} +15 -17
  239. package/src/integrations/tests/{oracle.spec.ts → oracle.spec.js} +17 -19
  240. package/src/integrations/tests/{postgres.spec.ts → postgres.spec.js} +17 -19
  241. package/src/integrations/tests/{redis.spec.ts → redis.spec.js} +18 -27
  242. package/src/integrations/tests/{rest.spec.ts → rest.spec.js} +14 -22
  243. package/src/integrations/tests/{s3.spec.ts → s3.spec.js} +8 -10
  244. package/src/integrations/tests/{sql.spec.ts → sql.spec.js} +177 -228
  245. package/src/module.d.ts +0 -2
  246. package/src/threads/query.ts +2 -2
  247. package/src/utilities/fileSystem/index.js +9 -130
  248. package/builder/assets/index.e1d89439.js +0 -995
  249. package/dist/api/controllers/plugin/file.js +0 -24
  250. package/dist/api/controllers/plugin/github.js +0 -69
  251. package/dist/api/controllers/plugin/index.js +0 -192
  252. package/dist/api/controllers/plugin/npm.js +0 -58
  253. package/dist/api/controllers/plugin/uploaders.js +0 -11
  254. package/dist/api/controllers/plugin/url.js +0 -24
  255. package/dist/api/controllers/plugin/utils.js +0 -26
  256. package/dist/api/routes/plugin.js +0 -39
  257. package/dist/watch.js +0 -77
  258. package/dist/websocket.js +0 -22
  259. package/src/api/controllers/plugin/file.ts +0 -15
  260. package/src/api/controllers/plugin/github.ts +0 -75
  261. package/src/api/controllers/plugin/index.ts +0 -206
  262. package/src/api/controllers/plugin/npm.ts +0 -56
  263. package/src/api/controllers/plugin/uploaders.ts +0 -4
  264. package/src/api/controllers/plugin/url.ts +0 -12
  265. package/src/api/controllers/plugin/utils.ts +0 -19
  266. package/src/api/routes/plugin.ts +0 -14
  267. package/src/watch.ts +0 -38
  268. package/src/websocket.ts +0 -26
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.updateAppPackage = exports.sync = exports.destroy = exports.revertClient = exports.updateClient = exports.update = exports.create = exports.fetchAppPackage = exports.fetchAppDefinition = exports.fetch = exports.getAppUrl = void 0;
15
+ exports.sync = exports.destroy = exports.revertClient = exports.updateClient = exports.update = exports.create = exports.fetchAppPackage = exports.fetchAppDefinition = exports.fetch = exports.getAppUrl = void 0;
16
16
  const environment_1 = __importDefault(require("../../environment"));
17
17
  const package_json_1 = __importDefault(require("../../../package.json"));
18
18
  const staticViews_1 = require("../../db/views/staticViews");
@@ -353,7 +353,7 @@ const update = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
353
353
  checkAppUrl(ctx, apps, url, ctx.params.appId);
354
354
  ctx.request.body.url = url;
355
355
  }
356
- const app = yield (0, exports.updateAppPackage)(ctx.request.body, ctx.params.appId);
356
+ const app = yield updateAppPackage(ctx.request.body, ctx.params.appId);
357
357
  yield backend_core_2.events.app.updated(app);
358
358
  ctx.status = 200;
359
359
  ctx.body = app;
@@ -375,7 +375,7 @@ const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
375
375
  version: updatedToVersion,
376
376
  revertableVersion: currentVersion,
377
377
  };
378
- const app = yield (0, exports.updateAppPackage)(appPackageUpdates, ctx.params.appId);
378
+ const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
379
379
  yield backend_core_2.events.app.versionUpdated(app, currentVersion, updatedToVersion);
380
380
  ctx.status = 200;
381
381
  ctx.body = app;
@@ -399,7 +399,7 @@ const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
399
399
  version: revertedToVersion,
400
400
  revertableVersion: null,
401
401
  };
402
- const app = yield (0, exports.updateAppPackage)(appPackageUpdates, ctx.params.appId);
402
+ const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
403
403
  yield backend_core_2.events.app.versionReverted(app, currentVersion, revertedToVersion);
404
404
  ctx.status = 200;
405
405
  ctx.body = app;
@@ -527,7 +527,6 @@ const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0
527
527
  return newAppPackage;
528
528
  }));
529
529
  });
530
- exports.updateAppPackage = updateAppPackage;
531
530
  const migrateAppNavigation = () => __awaiter(void 0, void 0, void 0, function* () {
532
531
  const db = backend_core_1.context.getAppDB();
533
532
  const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
@@ -8,11 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- const { DocumentType, getPluginParams } = require("../../db/utils");
11
+ const { DocumentType } = require("../../db/utils");
12
12
  const { getComponentLibraryManifest } = require("../../utilities/fileSystem");
13
13
  const { getAppDB } = require("@budibase/backend-core/context");
14
- const { getGlobalDB } = require("@budibase/backend-core/tenancy");
15
- const env = require("../../environment");
16
14
  exports.fetchAppComponentDefinitions = function (ctx) {
17
15
  return __awaiter(this, void 0, void 0, function* () {
18
16
  try {
@@ -37,21 +35,6 @@ exports.fetchAppComponentDefinitions = function (ctx) {
37
35
  }
38
36
  }
39
37
  }
40
- // for now custom components only supported in self-host
41
- if (env.SELF_HOSTED) {
42
- // Add custom components
43
- const globalDB = getGlobalDB();
44
- const response = yield globalDB.allDocs(getPluginParams(null, {
45
- include_docs: true,
46
- }));
47
- response.rows
48
- .map(row => row.doc)
49
- .filter(plugin => plugin.schema.type === "component")
50
- .forEach(plugin => {
51
- const fullComponentName = `plugin/${plugin.name}`;
52
- definitions[fullComponentName] = Object.assign({ component: fullComponentName }, plugin.schema.schema);
53
- });
54
- }
55
38
  ctx.body = definitions;
56
39
  }
57
40
  catch (err) {
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  const { generateDatasourceID, getDatasourceParams, getQueryParams, DocumentType, BudibaseInternalDB, getTableParams, } = require("../../db/utils");
12
12
  const { BuildSchemaErrors, InvalidColumns } = require("../../constants");
13
- const { getIntegration } = require("../../integrations");
13
+ const { integrations } = require("../../integrations");
14
14
  const { getDatasourceAndQuery } = require("./row/utils");
15
15
  const { invalidateDynamicVariables } = require("../../threads/utils");
16
16
  const { getAppDB } = require("@budibase/backend-core/context");
@@ -96,7 +96,7 @@ exports.update = function (ctx) {
96
96
  datasource._rev = response.rev;
97
97
  // Drain connection pools when configuration is changed
98
98
  if (datasource.source) {
99
- const source = yield getIntegration(datasource.source);
99
+ const source = integrations[datasource.source];
100
100
  if (source && source.pool) {
101
101
  yield source.pool.end();
102
102
  }
@@ -123,7 +123,7 @@ exports.save = function (ctx) {
123
123
  datasource._rev = dbResp.rev;
124
124
  // Drain connection pools when configuration is changed
125
125
  if (datasource.source) {
126
- const source = yield getIntegration(datasource.source);
126
+ const source = integrations[datasource.source];
127
127
  if (source && source.pool) {
128
128
  yield source.pool.end();
129
129
  }
@@ -188,7 +188,7 @@ function updateError(error, newError, tables) {
188
188
  return error;
189
189
  }
190
190
  const buildSchemaHelper = (datasource) => __awaiter(void 0, void 0, void 0, function* () {
191
- const Connector = yield getIntegration(datasource.source);
191
+ const Connector = integrations[datasource.source];
192
192
  // Connect to the DB and build the schema
193
193
  const connector = new Connector(datasource.config);
194
194
  yield connector.buildSchema(datasource._id, datasource.entities);
@@ -8,14 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- const { getDefinitions } = require("../../integrations");
11
+ const { cloneDeep } = require("lodash");
12
+ const { definitions } = require("../../integrations");
12
13
  const { SourceName } = require("@budibase/types");
13
14
  const googlesheets = require("../../integrations/googlesheets");
14
15
  const { featureFlags } = require("@budibase/backend-core");
15
16
  exports.fetch = function (ctx) {
16
17
  return __awaiter(this, void 0, void 0, function* () {
17
18
  ctx.status = 200;
18
- const defs = yield getDefinitions();
19
+ const defs = cloneDeep(definitions);
19
20
  // for google sheets integration google verification
20
21
  if (featureFlags.isEnabled(featureFlags.FeatureFlag.GOOGLE_SHEETS)) {
21
22
  defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema;
@@ -25,8 +26,7 @@ exports.fetch = function (ctx) {
25
26
  };
26
27
  exports.find = function (ctx) {
27
28
  return __awaiter(this, void 0, void 0, function* () {
28
- const defs = yield getDefinitions();
29
29
  ctx.status = 200;
30
- ctx.body = defs[ctx.params.type];
30
+ ctx.body = definitions[ctx.params.type];
31
31
  });
32
32
  };
@@ -301,6 +301,7 @@ var External;
301
301
  * from where (which tables) and how to convert that into budibase columns.
302
302
  */
303
303
  updateRelationshipColumns(table, row, rows, relationships) {
304
+ var _a, _b;
304
305
  const columns = {};
305
306
  for (let relationship of relationships) {
306
307
  const linkedTable = this.tables[relationship.tableName];
@@ -311,7 +312,8 @@ var External;
311
312
  const toColumn = `${linkedTable.name}.${relationship.to}`;
312
313
  // this is important when working with multiple relationships
313
314
  // between the same tables, don't want to overlap/multiply the relations
314
- if (!relationship.through && row[fromColumn] !== row[toColumn]) {
315
+ if (!relationship.through &&
316
+ ((_a = row[fromColumn]) === null || _a === void 0 ? void 0 : _a.toString()) !== ((_b = row[toColumn]) === null || _b === void 0 ? void 0 : _b.toString())) {
315
317
  continue;
316
318
  }
317
319
  let linked = basicProcessing(row, linkedTable);
@@ -8,12 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- const { getScreenParams, generateScreenID, getPluginParams, DocumentType, } = require("../../db/utils");
11
+ const { getScreenParams, generateScreenID } = require("../../db/utils");
12
12
  const { AccessController } = require("@budibase/backend-core/roles");
13
13
  const { getAppDB } = require("@budibase/backend-core/context");
14
14
  const { events } = require("@budibase/backend-core");
15
- const { getGlobalDB } = require("@budibase/backend-core/tenancy");
16
- const { updateAppPackage } = require("./application");
17
15
  exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
18
16
  const db = getAppDB();
19
17
  const screens = (yield db.allDocs(getScreenParams(null, {
@@ -30,45 +28,11 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
30
28
  eventFn = events.screen.created;
31
29
  }
32
30
  const response = yield db.put(screen);
33
- // Find any custom components being used
34
- let pluginNames = [];
35
- let pluginAdded = false;
36
- findPlugins(screen.props, pluginNames);
37
- if (pluginNames.length) {
38
- const globalDB = getGlobalDB();
39
- const pluginsResponse = yield globalDB.allDocs(getPluginParams(null, {
40
- include_docs: true,
41
- }));
42
- const requiredPlugins = pluginsResponse.rows
43
- .map(row => row.doc)
44
- .filter(plugin => {
45
- return (plugin.schema.type === "component" &&
46
- pluginNames.includes(`plugin/${plugin.name}`));
47
- });
48
- // Update the app metadata
49
- const application = yield db.get(DocumentType.APP_METADATA);
50
- let usedPlugins = application.usedPlugins || [];
51
- requiredPlugins.forEach(plugin => {
52
- if (!usedPlugins.find(x => x._id === plugin._id)) {
53
- pluginAdded = true;
54
- usedPlugins.push({
55
- _id: plugin._id,
56
- name: plugin.name,
57
- version: plugin.version,
58
- jsUrl: plugin.jsUrl,
59
- hash: plugin.hash,
60
- });
61
- }
62
- });
63
- if (pluginAdded) {
64
- yield updateAppPackage({ usedPlugins }, ctx.appId);
65
- }
66
- }
67
31
  if (eventFn) {
68
32
  yield eventFn(screen);
69
33
  }
70
34
  ctx.message = `Screen ${screen.name} saved.`;
71
- ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev, pluginAdded });
35
+ ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev });
72
36
  });
73
37
  exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
74
38
  const db = getAppDB();
@@ -81,17 +45,3 @@ exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
81
45
  };
82
46
  ctx.status = 200;
83
47
  });
84
- const findPlugins = (component, foundPlugins) => {
85
- if (!component) {
86
- return;
87
- }
88
- if (component._component.startsWith("plugin")) {
89
- if (!foundPlugins.includes(component._component)) {
90
- foundPlugins.push(component._component);
91
- }
92
- }
93
- if (!component._children || !component._children.length) {
94
- return;
95
- }
96
- component._children.forEach(child => findPlugins(child, foundPlugins));
97
- };
@@ -113,7 +113,6 @@ const serveApp = function (ctx) {
113
113
  production: env.isProd(),
114
114
  appId,
115
115
  clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
116
- usedPlugins: appInfo.usedPlugins,
117
116
  });
118
117
  const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`);
119
118
  ctx.body = yield processString(appHbs, {
@@ -3,7 +3,6 @@
3
3
  export let favicon = ""
4
4
 
5
5
  export let clientLibPath
6
- export let usedPlugins
7
6
  </script>
8
7
 
9
8
  <svelte:head>
@@ -84,15 +83,6 @@
84
83
  </script>
85
84
  <script type="application/javascript" src={clientLibPath}>
86
85
  </script>
87
- <!-- Custom components need inserted after the core client library -->
88
- <!-- But before loadBudibase is called -->
89
- {#if usedPlugins?.length}
90
- {#each usedPlugins as plugin}
91
- <script
92
- type="application/javascript"
93
- src={`/plugins/${plugin.jsUrl}`}></script>
94
- {/each}
95
- {/if}
96
86
  <script type="application/javascript">
97
87
  if (window.loadBudibase) {
98
88
  window.loadBudibase()
@@ -66,9 +66,7 @@
66
66
  customTheme,
67
67
  previewDevice,
68
68
  navigation,
69
- hiddenComponentIds,
70
- usedPlugins,
71
- location
69
+ hiddenComponentIds
72
70
  } = parsed
73
71
 
74
72
  // Set some flags so the app knows we're in the builder
@@ -83,8 +81,6 @@
83
81
  window["##BUDIBASE_PREVIEW_DEVICE##"] = previewDevice
84
82
  window["##BUDIBASE_PREVIEW_NAVIGATION##"] = navigation
85
83
  window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"] = hiddenComponentIds
86
- window["##BUDIBASE_USED_PLUGINS##"] = usedPlugins
87
- window["##BUDIBASE_LOCATION##"] = location
88
84
 
89
85
  // Initialise app
90
86
  try {
@@ -30,7 +30,6 @@ const metadata_1 = __importDefault(require("./metadata"));
30
30
  const dev_1 = __importDefault(require("./dev"));
31
31
  const cloud_1 = __importDefault(require("./cloud"));
32
32
  const migrations_1 = __importDefault(require("./migrations"));
33
- const plugin_1 = __importDefault(require("./plugin"));
34
33
  var static_1 = require("./static");
35
34
  Object.defineProperty(exports, "staticRoutes", { enumerable: true, get: function () { return __importDefault(static_1).default; } });
36
35
  var public_1 = require("./public");
@@ -64,5 +63,4 @@ exports.mainRoutes = [
64
63
  table_1.default,
65
64
  row_1.default,
66
65
  migrations_1.default,
67
- plugin_1.default,
68
66
  ];
package/dist/app.js CHANGED
@@ -60,13 +60,10 @@ const bullboard = require("./automations/bullboard");
60
60
  const { logAlert } = require("@budibase/backend-core/logging");
61
61
  const { pinoSettings } = require("@budibase/backend-core");
62
62
  const { Thread } = require("./threads");
63
- const fs = require("fs");
64
63
  const redis_1 = __importDefault(require("./utilities/redis"));
65
64
  const migrations = __importStar(require("./migrations"));
66
65
  const backend_core_1 = require("@budibase/backend-core");
67
66
  const workerRequests_1 = require("./utilities/workerRequests");
68
- const watch_1 = require("./watch");
69
- const websocket_1 = require("./websocket");
70
67
  const app = new Koa();
71
68
  // set up top level koa middleware
72
69
  app.use(koaBody({
@@ -100,7 +97,6 @@ if (env.isProd()) {
100
97
  }
101
98
  const server = http.createServer(app.callback());
102
99
  destroyable(server);
103
- (0, websocket_1.initialise)(server);
104
100
  let shuttingDown = false, errCode = 0;
105
101
  server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
106
102
  // already in process
@@ -154,13 +150,6 @@ module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, vo
154
150
  }
155
151
  }
156
152
  }
157
- // monitor plugin directory if required
158
- if (env.SELF_HOSTED &&
159
- !env.MULTI_TENANCY &&
160
- env.PLUGINS_DIR &&
161
- fs.existsSync(env.PLUGINS_DIR)) {
162
- (0, watch_1.watch)();
163
- }
164
153
  // check for version updates
165
154
  yield backend_core_1.installation.checkInstallVersion();
166
155
  // done last - this will never complete
package/dist/db/utils.js CHANGED
@@ -7,7 +7,7 @@ const AppStatus = {
7
7
  ALL: "all",
8
8
  DEPLOYED: "published",
9
9
  };
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", PLUGIN: "plg" });
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
  };
@@ -274,9 +274,6 @@ exports.generateMemoryViewID = viewName => {
274
274
  exports.getMemoryViewParams = (otherProps = {}) => {
275
275
  return getDocParams(DocumentType.MEM_VIEW, null, otherProps);
276
276
  };
277
- exports.generatePluginID = name => {
278
- return `${DocumentType.PLUGIN}${SEPARATOR}${name}`;
279
- };
280
277
  /**
281
278
  * This can be used with the db.allDocs to get a list of IDs
282
279
  */
@@ -286,9 +283,3 @@ exports.getMultiIDParams = ids => {
286
283
  include_docs: true,
287
284
  };
288
285
  };
289
- /**
290
- * Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
291
- */
292
- exports.getPluginParams = (pluginId = null, otherProps = {}) => {
293
- return getDocParams(DocumentType.PLUGIN, pluginId, otherProps);
294
- };
@@ -28,8 +28,8 @@ function parseIntSafe(number) {
28
28
  }
29
29
  let inThread = false;
30
30
  module.exports = {
31
- // important
32
- PORT: process.env.PORT || process.env.APP_PORT,
31
+ // important - prefer app port to generic port
32
+ PORT: process.env.APP_PORT || process.env.PORT,
33
33
  JWT_SECRET: process.env.JWT_SECRET,
34
34
  COUCH_DB_URL: process.env.COUCH_DB_URL,
35
35
  MINIO_URL: process.env.MINIO_URL,
@@ -64,7 +64,6 @@ module.exports = {
64
64
  SQL_MAX_ROWS: process.env.SQL_MAX_ROWS,
65
65
  BB_ADMIN_USER_EMAIL: process.env.BB_ADMIN_USER_EMAIL,
66
66
  BB_ADMIN_USER_PASSWORD: process.env.BB_ADMIN_USER_PASSWORD,
67
- PLUGINS_DIR: process.env.PLUGINS_DIR || "/plugins",
68
67
  // flags
69
68
  ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
70
69
  DISABLE_THREADING: process.env.DISABLE_THREADING,
@@ -10,138 +10,141 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const types_1 = require("@budibase/types");
13
- const Airtable = require("airtable");
14
- const SCHEMA = {
15
- docs: "https://airtable.com/api",
16
- description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
17
- friendlyName: "Airtable",
18
- type: "Spreadsheet",
19
- datasource: {
20
- apiKey: {
21
- type: types_1.DatasourceFieldType.PASSWORD,
22
- default: "enter api key",
23
- required: true,
24
- },
25
- base: {
26
- type: types_1.DatasourceFieldType.STRING,
27
- default: "mybase",
28
- required: true,
29
- },
30
- },
31
- query: {
32
- create: {
33
- type: types_1.QueryType.FIELDS,
34
- customisable: true,
35
- fields: {
36
- table: {
37
- type: types_1.DatasourceFieldType.STRING,
38
- required: true,
39
- },
13
+ var AirtableModule;
14
+ (function (AirtableModule) {
15
+ const Airtable = require("airtable");
16
+ const SCHEMA = {
17
+ docs: "https://airtable.com/api",
18
+ description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
19
+ friendlyName: "Airtable",
20
+ type: "Spreadsheet",
21
+ datasource: {
22
+ apiKey: {
23
+ type: types_1.DatasourceFieldType.PASSWORD,
24
+ default: "enter api key",
25
+ required: true,
40
26
  },
41
- },
42
- read: {
43
- type: types_1.QueryType.FIELDS,
44
- fields: {
45
- table: {
46
- type: types_1.DatasourceFieldType.STRING,
47
- required: true,
48
- },
49
- view: {
50
- type: types_1.DatasourceFieldType.STRING,
51
- required: true,
52
- },
53
- numRecords: {
54
- type: types_1.DatasourceFieldType.NUMBER,
55
- default: 10,
56
- },
27
+ base: {
28
+ type: types_1.DatasourceFieldType.STRING,
29
+ default: "mybase",
30
+ required: true,
57
31
  },
58
32
  },
59
- update: {
60
- type: types_1.QueryType.FIELDS,
61
- customisable: true,
62
- fields: {
63
- id: {
64
- display: "Record ID",
65
- type: types_1.DatasourceFieldType.STRING,
66
- required: true,
33
+ query: {
34
+ create: {
35
+ type: types_1.QueryType.FIELDS,
36
+ customisable: true,
37
+ fields: {
38
+ table: {
39
+ type: types_1.DatasourceFieldType.STRING,
40
+ required: true,
41
+ },
67
42
  },
68
- table: {
69
- type: types_1.DatasourceFieldType.STRING,
70
- required: true,
43
+ },
44
+ read: {
45
+ type: types_1.QueryType.FIELDS,
46
+ fields: {
47
+ table: {
48
+ type: types_1.DatasourceFieldType.STRING,
49
+ required: true,
50
+ },
51
+ view: {
52
+ type: types_1.DatasourceFieldType.STRING,
53
+ required: true,
54
+ },
55
+ numRecords: {
56
+ type: types_1.DatasourceFieldType.NUMBER,
57
+ default: 10,
58
+ },
71
59
  },
72
60
  },
73
- },
74
- delete: {
75
- type: types_1.QueryType.JSON,
76
- },
77
- },
78
- };
79
- class AirtableIntegration {
80
- constructor(config) {
81
- this.config = config;
82
- this.client = new Airtable(config).base(config.base);
83
- }
84
- create(query) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- const { table, json } = query;
87
- try {
88
- return yield this.client(table).create([
89
- {
90
- fields: json,
61
+ update: {
62
+ type: types_1.QueryType.FIELDS,
63
+ customisable: true,
64
+ fields: {
65
+ id: {
66
+ display: "Record ID",
67
+ type: types_1.DatasourceFieldType.STRING,
68
+ required: true,
91
69
  },
92
- ]);
93
- }
94
- catch (err) {
95
- console.error("Error writing to airtable", err);
96
- throw err;
97
- }
98
- });
99
- }
100
- read(query) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- try {
103
- const records = yield this.client(query.table)
104
- .select({ maxRecords: query.numRecords || 10, view: query.view })
105
- .firstPage();
106
- // @ts-ignore
107
- return records.map(({ fields }) => fields);
108
- }
109
- catch (err) {
110
- console.error("Error writing to airtable", err);
111
- return [];
112
- }
113
- });
114
- }
115
- update(query) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- const { table, id, json } = query;
118
- try {
119
- return yield this.client(table).update([
120
- {
121
- id,
122
- fields: json,
70
+ table: {
71
+ type: types_1.DatasourceFieldType.STRING,
72
+ required: true,
123
73
  },
124
- ]);
125
- }
126
- catch (err) {
127
- console.error("Error writing to airtable", err);
128
- throw err;
129
- }
130
- });
131
- }
132
- delete(query) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- try {
135
- return yield this.client(query.table).destroy(query.ids);
136
- }
137
- catch (err) {
138
- console.error("Error writing to airtable", err);
139
- throw err;
140
- }
141
- });
74
+ },
75
+ },
76
+ delete: {
77
+ type: types_1.QueryType.JSON,
78
+ },
79
+ },
80
+ };
81
+ class AirtableIntegration {
82
+ constructor(config) {
83
+ this.config = config;
84
+ this.client = new Airtable(config).base(config.base);
85
+ }
86
+ create(query) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const { table, json } = query;
89
+ try {
90
+ return yield this.client(table).create([
91
+ {
92
+ fields: json,
93
+ },
94
+ ]);
95
+ }
96
+ catch (err) {
97
+ console.error("Error writing to airtable", err);
98
+ throw err;
99
+ }
100
+ });
101
+ }
102
+ read(query) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ try {
105
+ const records = yield this.client(query.table)
106
+ .select({ maxRecords: query.numRecords || 10, view: query.view })
107
+ .firstPage();
108
+ // @ts-ignore
109
+ return records.map(({ fields }) => fields);
110
+ }
111
+ catch (err) {
112
+ console.error("Error writing to airtable", err);
113
+ return [];
114
+ }
115
+ });
116
+ }
117
+ update(query) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const { table, id, json } = query;
120
+ try {
121
+ return yield this.client(table).update([
122
+ {
123
+ id,
124
+ fields: json,
125
+ },
126
+ ]);
127
+ }
128
+ catch (err) {
129
+ console.error("Error writing to airtable", err);
130
+ throw err;
131
+ }
132
+ });
133
+ }
134
+ delete(query) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ try {
137
+ return yield this.client(query.table).destroy(query.ids);
138
+ }
139
+ catch (err) {
140
+ console.error("Error writing to airtable", err);
141
+ throw err;
142
+ }
143
+ });
144
+ }
142
145
  }
143
- }
144
- exports.default = {
145
- schema: SCHEMA,
146
- integration: AirtableIntegration,
147
- };
146
+ module.exports = {
147
+ schema: SCHEMA,
148
+ integration: AirtableIntegration,
149
+ };
150
+ })(AirtableModule || (AirtableModule = {}));