@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.
- package/builder/assets/{index.c9d3f9e8.js → index.da0d40d9.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +92 -183
- package/coverage/coverage-final.json +1 -3
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +9 -39
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +18 -18
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +13 -37
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +27 -27
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +169 -332
- package/dist/api/controllers/component.js +12 -12
- package/dist/api/controllers/plugin/index.js +15 -71
- package/dist/api/controllers/screen.js +21 -23
- package/dist/db/utils.js +1 -7
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +0 -6
- package/dist/watch.js +1 -1
- package/package.json +7 -7
- package/src/api/controllers/{component.js → component.ts} +13 -13
- package/src/api/controllers/plugin/index.ts +16 -97
- package/src/api/controllers/{screen.js → screen.ts} +26 -27
- package/src/db/utils.js +0 -8
- package/src/utilities/fileSystem/index.js +0 -7
- package/src/watch.ts +2 -2
- package/coverage/lcov-report/api/controllers/component.js.html +0 -256
- 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.
|
|
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(
|
|
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
|
|
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
|
-
|
|
125
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
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(
|
|
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"
|
|
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.
|
|
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.
|
|
81
|
-
"@budibase/client": "1.3.21-alpha.
|
|
82
|
-
"@budibase/pro": "1.3.21-alpha.
|
|
83
|
-
"@budibase/string-templates": "1.3.21-alpha.
|
|
84
|
-
"@budibase/types": "1.3.21-alpha.
|
|
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",
|