@budibase/server 1.3.21-alpha.1 → 1.3.21-alpha.2

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 (169) hide show
  1. package/builder/assets/{index.c9d3f9e8.js → index.da0d40d9.js} +1 -1
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +92 -183
  4. package/coverage/coverage-final.json +1 -3
  5. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  6. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/index.html +9 -39
  13. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  19. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  32. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  37. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  41. package/coverage/lcov-report/api/index.html +1 -1
  42. package/coverage/lcov-report/api/index.js.html +1 -1
  43. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  44. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  45. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/index.html +1 -1
  54. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  68. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  71. package/coverage/lcov-report/automations/actions.js.html +1 -1
  72. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  73. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  74. package/coverage/lcov-report/automations/index.html +1 -1
  75. package/coverage/lcov-report/automations/index.js.html +1 -1
  76. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  77. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  78. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/index.html +1 -1
  83. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  93. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  94. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  95. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  96. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  102. package/coverage/lcov-report/constants/index.html +1 -1
  103. package/coverage/lcov-report/constants/index.js.html +1 -1
  104. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  105. package/coverage/lcov-report/constants/screens.js.html +1 -1
  106. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  107. package/coverage/lcov-report/db/index.html +18 -18
  108. package/coverage/lcov-report/db/index.js.html +1 -1
  109. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  110. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  111. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  112. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  113. package/coverage/lcov-report/db/newid.js.html +1 -1
  114. package/coverage/lcov-report/db/utils.js.html +13 -37
  115. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  116. package/coverage/lcov-report/events/index.html +1 -1
  117. package/coverage/lcov-report/events/index.js.html +1 -1
  118. package/coverage/lcov-report/events/utils.js.html +1 -1
  119. package/coverage/lcov-report/index.html +27 -27
  120. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  121. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  122. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  123. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  124. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  125. package/coverage/lcov-report/middleware/index.html +1 -1
  126. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  127. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  128. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  129. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  130. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  131. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  132. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  133. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  134. package/coverage/lcov-report/utilities/global.js.html +1 -1
  135. package/coverage/lcov-report/utilities/index.html +1 -1
  136. package/coverage/lcov-report/utilities/index.js.html +1 -1
  137. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  138. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  139. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  140. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  141. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  142. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  143. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  144. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  145. package/coverage/lcov-report/utilities/security.js.html +1 -1
  146. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  147. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  148. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  149. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  150. package/coverage/lcov-report/utilities/users.js.html +1 -1
  151. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  152. package/coverage/lcov.info +169 -332
  153. package/dist/api/controllers/component.js +12 -12
  154. package/dist/api/controllers/plugin/index.js +15 -71
  155. package/dist/api/controllers/screen.js +21 -23
  156. package/dist/db/utils.js +1 -7
  157. package/dist/package.json +6 -6
  158. package/dist/tsconfig.build.tsbuildinfo +1 -1
  159. package/dist/utilities/fileSystem/index.js +0 -6
  160. package/dist/watch.js +1 -1
  161. package/package.json +7 -7
  162. package/src/api/controllers/{component.js → component.ts} +13 -13
  163. package/src/api/controllers/plugin/index.ts +16 -97
  164. package/src/api/controllers/{screen.js → screen.ts} +26 -27
  165. package/src/db/utils.js +0 -8
  166. package/src/utilities/fileSystem/index.js +0 -7
  167. package/src/watch.ts +2 -2
  168. package/coverage/lcov-report/api/controllers/component.js.html +0 -256
  169. package/coverage/lcov-report/api/controllers/screen.js.html +0 -454
@@ -12,22 +12,19 @@ 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.processPlugin = exports.storePlugin = exports.destroy = exports.fetch = exports.create = exports.upload = exports.getPlugins = void 0;
16
- const constants_1 = require("../../../constants");
17
- const fileSystem_1 = require("../../../utilities/fileSystem");
15
+ exports.processUploadedPlugin = exports.destroy = exports.fetch = exports.create = exports.upload = exports.getPlugins = void 0;
18
16
  const uploaders_1 = require("./uploaders");
19
17
  const tenancy_1 = require("@budibase/backend-core/tenancy");
20
18
  const plugins_1 = require("@budibase/backend-core/plugins");
21
- const utils_1 = require("../../../db/utils");
22
- const objectStore_1 = require("@budibase/backend-core/objectStore");
23
19
  const types_1 = require("@budibase/types");
24
20
  const environment_1 = __importDefault(require("../../../environment"));
25
21
  const websocket_1 = require("../../../websocket");
26
22
  const backend_core_1 = require("@budibase/backend-core");
23
+ const pro_1 = require("@budibase/pro");
27
24
  function getPlugins(type) {
28
25
  return __awaiter(this, void 0, void 0, function* () {
29
26
  const db = (0, tenancy_1.getGlobalDB)();
30
- const response = yield db.allDocs((0, utils_1.getPluginParams)(null, {
27
+ const response = yield db.allDocs(backend_core_1.db.getPluginParams(null, {
31
28
  include_docs: true,
32
29
  }));
33
30
  const plugins = response.rows.map((row) => row.doc);
@@ -49,7 +46,7 @@ function upload(ctx) {
49
46
  let docs = [];
50
47
  // can do single or multiple plugins
51
48
  for (let plugin of plugins) {
52
- const doc = yield processPlugin(plugin, types_1.PluginSource.FILE);
49
+ const doc = yield processUploadedPlugin(plugin, types_1.PluginSource.FILE);
53
50
  docs.push(doc);
54
51
  }
55
52
  ctx.body = {
@@ -96,17 +93,18 @@ function create(ctx) {
96
93
  if (!environment_1.default.SELF_HOSTED && ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.schema) === null || _a === void 0 ? void 0 : _a.type) !== types_1.PluginType.COMPONENT) {
97
94
  throw new Error("Only component plugins are supported outside of self-host");
98
95
  }
99
- const doc = yield storePlugin(metadata, directory, source);
96
+ const doc = yield pro_1.plugins.storePlugin(metadata, directory, source);
97
+ websocket_1.ClientAppSocket.emit("plugins-update", { name, hash: doc.hash });
100
98
  ctx.body = {
101
99
  message: "Plugin uploaded successfully",
102
100
  plugins: [doc],
103
101
  };
102
+ ctx.body = { plugin: doc };
104
103
  }
105
104
  catch (err) {
106
105
  const errMsg = (err === null || err === void 0 ? void 0 : err.message) ? err === null || err === void 0 ? void 0 : err.message : err;
107
106
  ctx.throw(400, `Failed to import plugin: ${errMsg}`);
108
107
  }
109
- ctx.status = 200;
110
108
  });
111
109
  }
112
110
  exports.create = create;
@@ -118,74 +116,18 @@ function fetch(ctx) {
118
116
  exports.fetch = fetch;
119
117
  function destroy(ctx) {
120
118
  return __awaiter(this, void 0, void 0, function* () {
121
- const db = (0, tenancy_1.getGlobalDB)();
122
119
  const { pluginId } = ctx.params;
123
120
  try {
124
- const plugin = yield db.get(pluginId);
125
- const bucketPath = `${plugin.name}/`;
126
- yield (0, objectStore_1.deleteFolder)(constants_1.ObjectStoreBuckets.PLUGINS, bucketPath);
127
- yield db.remove(pluginId, plugin._rev);
128
- yield backend_core_1.events.plugin.deleted(plugin);
121
+ yield pro_1.plugins.deletePlugin(pluginId);
122
+ ctx.body = { message: `Plugin ${ctx.params.pluginId} deleted.` };
129
123
  }
130
124
  catch (err) {
131
- const errMsg = (err === null || err === void 0 ? void 0 : err.message) ? err === null || err === void 0 ? void 0 : err.message : err;
132
- ctx.throw(400, `Failed to delete plugin: ${errMsg}`);
125
+ ctx.throw(400, err.message);
133
126
  }
134
- ctx.message = `Plugin ${ctx.params.pluginId} deleted.`;
135
- ctx.status = 200;
136
127
  });
137
128
  }
138
129
  exports.destroy = destroy;
139
- function storePlugin(metadata, directory, source) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- const db = (0, tenancy_1.getGlobalDB)();
142
- const version = metadata.package.version, name = metadata.package.name, description = metadata.package.description, hash = metadata.schema.hash;
143
- // first open the tarball into tmp directory
144
- const bucketPath = `${name}/`;
145
- const files = yield (0, objectStore_1.uploadDirectory)(constants_1.ObjectStoreBuckets.PLUGINS, directory, bucketPath);
146
- const jsFile = files.find((file) => file.name.endsWith(".js"));
147
- if (!jsFile) {
148
- throw new Error(`Plugin missing .js file.`);
149
- }
150
- // validate the JS for a datasource
151
- if (metadata.schema.type === types_1.PluginType.DATASOURCE) {
152
- const js = (0, fileSystem_1.loadJSFile)(directory, jsFile.name);
153
- // TODO: this isn't safe - but we need full node environment
154
- // in future we should do this in a thread for safety
155
- try {
156
- eval(js);
157
- }
158
- catch (err) {
159
- const message = (err === null || err === void 0 ? void 0 : err.message) ? err.message : JSON.stringify(err);
160
- throw new Error(`JS invalid: ${message}`);
161
- }
162
- }
163
- const jsFileName = jsFile.name;
164
- const pluginId = (0, utils_1.generatePluginID)(name);
165
- // overwrite existing docs entirely if they exist
166
- let rev;
167
- try {
168
- const existing = yield db.get(pluginId);
169
- rev = existing._rev;
170
- }
171
- catch (err) {
172
- rev = undefined;
173
- }
174
- let doc = Object.assign(Object.assign({ _id: pluginId, _rev: rev }, metadata), { name,
175
- version,
176
- hash,
177
- description, jsUrl: `${bucketPath}${jsFileName}` });
178
- if (source) {
179
- doc = Object.assign(Object.assign({}, doc), { source });
180
- }
181
- const response = yield db.put(doc);
182
- yield backend_core_1.events.plugin.imported(doc);
183
- websocket_1.ClientAppSocket.emit("plugin-update", { name, hash });
184
- return Object.assign(Object.assign({}, doc), { _rev: response.rev });
185
- });
186
- }
187
- exports.storePlugin = storePlugin;
188
- function processPlugin(plugin, source) {
130
+ function processUploadedPlugin(plugin, source) {
189
131
  var _a;
190
132
  return __awaiter(this, void 0, void 0, function* () {
191
133
  const { metadata, directory } = yield (0, uploaders_1.fileUpload)(plugin);
@@ -194,7 +136,9 @@ function processPlugin(plugin, source) {
194
136
  if (!environment_1.default.SELF_HOSTED && ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.schema) === null || _a === void 0 ? void 0 : _a.type) !== types_1.PluginType.COMPONENT) {
195
137
  throw new Error("Only component plugins are supported outside of self-host");
196
138
  }
197
- return yield storePlugin(metadata, directory, source);
139
+ const doc = yield pro_1.plugins.storePlugin(metadata, directory, source);
140
+ websocket_1.ClientAppSocket.emit("plugins-update", { name, hash: doc.hash });
141
+ return doc;
198
142
  });
199
143
  }
200
- exports.processPlugin = processPlugin;
144
+ exports.processUploadedPlugin = processUploadedPlugin;
@@ -8,26 +8,24 @@ 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");
12
- const { AccessController } = require("@budibase/backend-core/roles");
13
- const { getAppDB } = require("@budibase/backend-core/context");
14
- const { events } = require("@budibase/backend-core");
15
- const { getGlobalDB } = require("@budibase/backend-core/tenancy");
16
- const { updateAppPackage } = require("./application");
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const utils_1 = require("../../db/utils");
13
+ const backend_core_1 = require("@budibase/backend-core");
14
+ const application_1 = require("./application");
17
15
  exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
18
- const db = getAppDB();
19
- const screens = (yield db.allDocs(getScreenParams(null, {
16
+ const db = backend_core_1.context.getAppDB();
17
+ const screens = (yield db.allDocs((0, utils_1.getScreenParams)(null, {
20
18
  include_docs: true,
21
- }))).rows.map(element => element.doc);
22
- ctx.body = yield new AccessController().checkScreensAccess(screens, ctx.user.role._id);
19
+ }))).rows.map((el) => el.doc);
20
+ ctx.body = yield new backend_core_1.roles.AccessController().checkScreensAccess(screens, ctx.user.role._id);
23
21
  });
24
22
  exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
25
- const db = getAppDB();
23
+ const db = backend_core_1.context.getAppDB();
26
24
  let screen = ctx.request.body;
27
25
  let eventFn;
28
26
  if (!screen._id) {
29
- screen._id = generateScreenID();
30
- eventFn = events.screen.created;
27
+ screen._id = (0, utils_1.generateScreenID)();
28
+ eventFn = backend_core_1.events.screen.created;
31
29
  }
32
30
  const response = yield db.put(screen);
33
31
  // Find any custom components being used
@@ -35,21 +33,21 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
35
33
  let pluginAdded = false;
36
34
  findPlugins(screen.props, pluginNames);
37
35
  if (pluginNames.length) {
38
- const globalDB = getGlobalDB();
39
- const pluginsResponse = yield globalDB.allDocs(getPluginParams(null, {
36
+ const globalDB = backend_core_1.tenancy.getGlobalDB();
37
+ const pluginsResponse = yield globalDB.allDocs(backend_core_1.db.getPluginParams(null, {
40
38
  include_docs: true,
41
39
  }));
42
40
  const requiredPlugins = pluginsResponse.rows
43
- .map(row => row.doc)
44
- .filter(plugin => {
41
+ .map((row) => row.doc)
42
+ .filter((plugin) => {
45
43
  return (plugin.schema.type === "component" &&
46
44
  pluginNames.includes(`plugin/${plugin.name}`));
47
45
  });
48
46
  // Update the app metadata
49
- const application = yield db.get(DocumentType.APP_METADATA);
47
+ const application = yield db.get(utils_1.DocumentType.APP_METADATA);
50
48
  let usedPlugins = application.usedPlugins || [];
51
- requiredPlugins.forEach(plugin => {
52
- if (!usedPlugins.find(x => x._id === plugin._id)) {
49
+ requiredPlugins.forEach((plugin) => {
50
+ if (!usedPlugins.find((x) => x._id === plugin._id)) {
53
51
  pluginAdded = true;
54
52
  usedPlugins.push({
55
53
  _id: plugin._id,
@@ -61,7 +59,7 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
61
59
  }
62
60
  });
63
61
  if (pluginAdded) {
64
- yield updateAppPackage({ usedPlugins }, ctx.appId);
62
+ yield (0, application_1.updateAppPackage)({ usedPlugins }, ctx.appId);
65
63
  }
66
64
  }
67
65
  if (eventFn) {
@@ -71,11 +69,11 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
71
69
  ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev, pluginAdded });
72
70
  });
73
71
  exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
74
- const db = getAppDB();
72
+ const db = backend_core_1.context.getAppDB();
75
73
  const id = ctx.params.screenId;
76
74
  const screen = yield db.get(id);
77
75
  yield db.remove(id, ctx.params.screenRev);
78
- yield events.screen.deleted(screen);
76
+ yield backend_core_1.events.screen.deleted(screen);
79
77
  ctx.body = {
80
78
  message: "Screen deleted successfully",
81
79
  };
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
  };
@@ -286,9 +286,3 @@ exports.getMultiIDParams = ids => {
286
286
  include_docs: true,
287
287
  };
288
288
  };
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
- };
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.3.21-alpha.0",
4
+ "version": "1.3.21-alpha.1",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -77,11 +77,11 @@
77
77
  "license": "GPL-3.0",
78
78
  "dependencies": {
79
79
  "@apidevtools/swagger-parser": "10.0.3",
80
- "@budibase/backend-core": "1.3.21-alpha.0",
81
- "@budibase/client": "1.3.21-alpha.0",
82
- "@budibase/pro": "1.3.21-alpha.0",
83
- "@budibase/string-templates": "1.3.21-alpha.0",
84
- "@budibase/types": "1.3.21-alpha.0",
80
+ "@budibase/backend-core": "1.3.21-alpha.1",
81
+ "@budibase/client": "1.3.21-alpha.1",
82
+ "@budibase/pro": "1.3.21-alpha.1",
83
+ "@budibase/string-templates": "1.3.21-alpha.1",
84
+ "@budibase/types": "1.3.21-alpha.1",
85
85
  "@bull-board/api": "3.7.0",
86
86
  "@bull-board/koa": "3.9.4",
87
87
  "@elastic/elasticsearch": "7.10.0",