@budibase/server 1.4.16 → 1.4.18-alpha.0
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/Dockerfile +2 -0
- package/builder/assets/{index.de734399.js → index.95d0ae95.js} +296 -292
- package/builder/assets/index.ffaba7b0.css +6 -0
- package/builder/index.html +2 -2
- package/coverage/clover.xml +141 -179
- package/coverage/coverage-final.json +33 -35
- package/coverage/lcov-report/api/controllers/apikeys.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 -24
- package/coverage/lcov-report/api/controllers/integration.js.html +2 -2
- 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 +2 -2
- package/coverage/lcov-report/api/routes/apikeys.js.html +2 -2
- package/coverage/lcov-report/api/routes/automation.js.html +2 -2
- package/coverage/lcov-report/api/routes/backup.js.html +2 -2
- package/coverage/lcov-report/api/routes/cloud.js.html +2 -2
- package/coverage/lcov-report/api/routes/component.js.html +2 -2
- package/coverage/lcov-report/api/routes/datasource.js.html +2 -2
- package/coverage/lcov-report/api/routes/deploy.js.html +2 -2
- package/coverage/lcov-report/api/routes/dev.js.html +2 -2
- package/coverage/lcov-report/api/routes/index.html +5 -20
- package/coverage/lcov-report/api/routes/integration.js.html +2 -2
- package/coverage/lcov-report/api/routes/layout.js.html +2 -2
- package/coverage/lcov-report/api/routes/metadata.js.html +2 -2
- package/coverage/lcov-report/api/routes/migrations.js.html +2 -2
- package/coverage/lcov-report/api/routes/permission.js.html +2 -2
- package/coverage/lcov-report/api/routes/query.js.html +2 -2
- package/coverage/lcov-report/api/routes/role.js.html +2 -2
- package/coverage/lcov-report/api/routes/routing.js.html +2 -2
- package/coverage/lcov-report/api/routes/screen.js.html +2 -2
- package/coverage/lcov-report/api/routes/script.js.html +2 -2
- package/coverage/lcov-report/api/routes/table.js.html +2 -2
- package/coverage/lcov-report/api/routes/templates.js.html +2 -2
- package/coverage/lcov-report/api/routes/user.js.html +2 -2
- 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 +2 -2
- package/coverage/lcov-report/api/routes/webhook.js.html +2 -2
- 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 +52 -4
- 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 +5 -5
- package/coverage/lcov-report/db/index.js.html +4 -4
- 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 +11 -11
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +7 -7
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- 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 +32 -32
- 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 +19 -13
- package/coverage/lcov-report/utilities/index.html +24 -24
- 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 +12 -12
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +8 -8
- 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 +21 -12
- package/coverage/lcov-report/utilities/workerRequests.js.html +33 -3
- package/coverage/lcov.info +216 -272
- package/dist/api/controllers/application.js +5 -3
- package/dist/api/controllers/auth.js +58 -49
- package/dist/api/controllers/integration.js +1 -1
- package/dist/api/routes/analytics.js +1 -1
- package/dist/api/routes/apikeys.js +1 -1
- package/dist/api/routes/auth.js +31 -4
- package/dist/api/routes/automation.js +1 -1
- package/dist/api/routes/backup.js +1 -1
- package/dist/api/routes/cloud.js +1 -1
- package/dist/api/routes/component.js +1 -1
- package/dist/api/routes/datasource.js +1 -1
- package/dist/api/routes/deploy.js +1 -1
- package/dist/api/routes/dev.js +1 -1
- package/dist/api/routes/integration.js +1 -1
- package/dist/api/routes/layout.js +1 -1
- package/dist/api/routes/metadata.js +1 -1
- package/dist/api/routes/migrations.js +1 -1
- package/dist/api/routes/permission.js +1 -1
- package/dist/api/routes/public/applications.js +5 -0
- package/dist/api/routes/public/queries.js +2 -0
- package/dist/api/routes/public/rows.js +5 -0
- package/dist/api/routes/public/tables.js +5 -0
- package/dist/api/routes/public/users.js +5 -0
- package/dist/api/routes/query.js +1 -1
- package/dist/api/routes/role.js +1 -1
- package/dist/api/routes/routing.js +1 -1
- package/dist/api/routes/screen.js +1 -1
- package/dist/api/routes/script.js +1 -1
- package/dist/api/routes/table.js +1 -1
- package/dist/api/routes/templates.js +1 -1
- package/dist/api/routes/user.js +1 -1
- package/dist/api/routes/view.js +1 -1
- package/dist/api/routes/webhook.js +1 -1
- package/dist/automations/steps/sendSmtpEmail.js +10 -2
- package/dist/db/index.js +1 -1
- package/dist/integrations/mysql.js +1 -1
- package/dist/middleware/authorized.js +2 -2
- package/dist/migrations/functions/usageQuotas/syncApps.js +2 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +2 -1
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +6 -3
- package/dist/utilities/users.js +4 -2
- package/dist/utilities/workerRequests.js +3 -1
- package/package.json +7 -7
- package/scripts/dev/manage.js +1 -0
- package/specs/openapi.json +22 -0
- package/specs/openapi.yaml +22 -0
- package/src/api/controllers/application.ts +6 -10
- package/src/api/controllers/{auth.js → auth.ts} +20 -18
- package/src/api/controllers/integration.js +1 -1
- package/src/api/routes/analytics.js +1 -1
- package/src/api/routes/apikeys.js +1 -1
- package/src/api/routes/auth.ts +8 -0
- package/src/api/routes/automation.js +1 -1
- package/src/api/routes/backup.js +1 -1
- package/src/api/routes/cloud.js +1 -1
- package/src/api/routes/component.js +1 -1
- package/src/api/routes/datasource.js +1 -1
- package/src/api/routes/deploy.js +1 -1
- package/src/api/routes/dev.js +1 -1
- package/src/api/routes/integration.js +1 -1
- package/src/api/routes/layout.js +1 -1
- package/src/api/routes/metadata.js +1 -1
- package/src/api/routes/migrations.js +1 -1
- package/src/api/routes/permission.js +1 -1
- package/src/api/routes/public/applications.ts +5 -0
- package/src/api/routes/public/queries.ts +2 -0
- package/src/api/routes/public/rows.ts +5 -0
- package/src/api/routes/public/tables.ts +5 -0
- package/src/api/routes/public/users.ts +5 -0
- package/src/api/routes/query.js +1 -1
- package/src/api/routes/role.js +1 -1
- package/src/api/routes/routing.js +1 -1
- package/src/api/routes/screen.js +1 -1
- package/src/api/routes/script.js +1 -1
- package/src/api/routes/table.js +1 -1
- package/src/api/routes/templates.js +1 -1
- package/src/api/routes/tests/row.spec.js +3 -1
- package/src/api/routes/user.js +1 -1
- package/src/api/routes/view.js +1 -1
- package/src/api/routes/webhook.js +1 -1
- package/src/automations/steps/sendSmtpEmail.js +18 -2
- package/src/db/index.js +1 -1
- package/src/definitions/openapi.ts +134 -447
- package/src/integrations/mysql.ts +2 -0
- package/src/middleware/authorized.ts +2 -2
- package/src/migrations/functions/usageQuotas/syncApps.ts +2 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +2 -1
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.ts +2 -1
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -1
- package/src/utilities/global.js +6 -4
- package/src/utilities/users.js +5 -2
- package/src/utilities/workerRequests.js +11 -1
- package/builder/assets/index.91c8117f.css +0 -6
- package/coverage/lcov-report/api/controllers/auth.js.html +0 -292
- package/coverage/lcov-report/api/routes/auth.js.html +0 -109
- package/src/api/routes/auth.js +0 -8
|
@@ -37,6 +37,7 @@ const pro_1 = require("@budibase/pro");
|
|
|
37
37
|
const backend_core_2 = require("@budibase/backend-core");
|
|
38
38
|
const types_1 = require("@budibase/types");
|
|
39
39
|
const layouts_1 = require("../../constants/layouts");
|
|
40
|
+
const pro_2 = require("@budibase/pro");
|
|
40
41
|
const URL_REGEX_SLASH = /\/|\\/g;
|
|
41
42
|
// utility function, need to do away with this
|
|
42
43
|
function getLayouts() {
|
|
@@ -260,7 +261,7 @@ const performAppCreate = (ctx) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
260
261
|
}
|
|
261
262
|
});
|
|
262
263
|
// Migrate navigation settings and screens if required
|
|
263
|
-
if (existing
|
|
264
|
+
if (existing) {
|
|
264
265
|
const navigation = yield migrateAppNavigation();
|
|
265
266
|
if (navigation) {
|
|
266
267
|
newApplication.navigation = navigation;
|
|
@@ -442,6 +443,7 @@ const preDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
442
443
|
});
|
|
443
444
|
const postDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
444
445
|
const rowCount = ctx.rowCount;
|
|
446
|
+
yield pro_2.groups.cleanupApp(ctx.params.appId);
|
|
445
447
|
if (rowCount) {
|
|
446
448
|
yield pro_1.quotas.removeRows(rowCount);
|
|
447
449
|
}
|
|
@@ -535,7 +537,7 @@ const migrateAppNavigation = () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
535
537
|
// Migrate all screens, removing custom layouts
|
|
536
538
|
for (let screen of screens) {
|
|
537
539
|
if (!screen.layoutId) {
|
|
538
|
-
|
|
540
|
+
continue;
|
|
539
541
|
}
|
|
540
542
|
const layout = layouts.find(layout => layout._id === screen.layoutId);
|
|
541
543
|
screen.layoutId = undefined;
|
|
@@ -546,7 +548,7 @@ const migrateAppNavigation = () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
546
548
|
// Migrate layout navigation settings
|
|
547
549
|
const { name, customTheme } = existing;
|
|
548
550
|
const layout = layouts === null || layouts === void 0 ? void 0 : layouts.find((layout) => layout._id === layouts_1.BASE_LAYOUT_PROP_IDS.PRIVATE);
|
|
549
|
-
if (layout) {
|
|
551
|
+
if (layout && !existing.navigation) {
|
|
550
552
|
let navigationSettings = {
|
|
551
553
|
navigation: "Top",
|
|
552
554
|
title: name,
|
|
@@ -8,64 +8,73 @@ 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
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.fetchSelf = void 0;
|
|
13
|
+
const rowProcessor_1 = require("../../utilities/rowProcessor");
|
|
14
|
+
const utils_1 = require("../../db/utils");
|
|
15
|
+
const users_1 = require("../../utilities/users");
|
|
16
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
17
|
+
const pro_1 = require("@budibase/pro");
|
|
18
|
+
const PUBLIC_ROLE = backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC;
|
|
16
19
|
/**
|
|
17
20
|
* Add the attributes that are session based to the current user.
|
|
18
21
|
*/
|
|
19
|
-
const addSessionAttributesToUser = ctx => {
|
|
22
|
+
const addSessionAttributesToUser = (ctx) => {
|
|
20
23
|
if (ctx.user) {
|
|
21
24
|
ctx.body.license = ctx.user.license;
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ctx.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const user = yield getFullUser(ctx, userId);
|
|
32
|
-
// this shouldn't be returned by the app self
|
|
33
|
-
delete user.roles;
|
|
34
|
-
// forward the csrf token from the session
|
|
35
|
-
user.csrfToken = ctx.user.csrfToken;
|
|
36
|
-
if (getAppId()) {
|
|
37
|
-
const db = getAppDB();
|
|
38
|
-
// remove the full roles structure
|
|
39
|
-
delete user.roles;
|
|
40
|
-
try {
|
|
41
|
-
const userTable = yield db.get(InternalTables.USER_METADATA);
|
|
42
|
-
const metadata = yield db.get(userId);
|
|
43
|
-
// make sure there is never a stale csrf token
|
|
44
|
-
delete metadata.csrfToken;
|
|
45
|
-
// specifically needs to make sure is enriched
|
|
46
|
-
ctx.body = yield outputProcessing(userTable, Object.assign(Object.assign({}, user), metadata));
|
|
27
|
+
function fetchSelf(ctx) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
let userId = ctx.user.userId || ctx.user._id;
|
|
30
|
+
/* istanbul ignore next */
|
|
31
|
+
if (!userId || !ctx.isAuthenticated) {
|
|
32
|
+
ctx.body = {};
|
|
33
|
+
return;
|
|
47
34
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
35
|
+
const appId = backend_core_1.context.getAppId();
|
|
36
|
+
const user = yield (0, users_1.getFullUser)(ctx, userId);
|
|
37
|
+
// this shouldn't be returned by the app self
|
|
38
|
+
delete user.roles;
|
|
39
|
+
// forward the csrf token from the session
|
|
40
|
+
user.csrfToken = ctx.user.csrfToken;
|
|
41
|
+
if (appId) {
|
|
42
|
+
const db = backend_core_1.context.getAppDB();
|
|
43
|
+
// check for group permissions
|
|
44
|
+
if (!user.roleId || user.roleId === PUBLIC_ROLE) {
|
|
45
|
+
const groupRoleId = yield pro_1.groups.getGroupRoleId(user, appId);
|
|
46
|
+
user.roleId = groupRoleId || user.roleId;
|
|
53
47
|
}
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
// remove the full roles structure
|
|
49
|
+
delete user.roles;
|
|
50
|
+
try {
|
|
51
|
+
const userTable = yield db.get(utils_1.InternalTables.USER_METADATA);
|
|
52
|
+
// specifically needs to make sure is enriched
|
|
53
|
+
ctx.body = yield (0, rowProcessor_1.outputProcessing)(userTable, user);
|
|
60
54
|
}
|
|
61
|
-
|
|
62
|
-
response
|
|
55
|
+
catch (err) {
|
|
56
|
+
let response;
|
|
57
|
+
// user didn't exist in app, don't pretend they do
|
|
58
|
+
if (user.roleId === PUBLIC_ROLE) {
|
|
59
|
+
response = {};
|
|
60
|
+
}
|
|
61
|
+
// user has a role of some sort, return them
|
|
62
|
+
else if (err.status === 404) {
|
|
63
|
+
const metadata = Object.assign(Object.assign({}, user), { _id: userId });
|
|
64
|
+
const dbResp = yield db.put(metadata);
|
|
65
|
+
user._rev = dbResp.rev;
|
|
66
|
+
response = user;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
response = user;
|
|
70
|
+
}
|
|
71
|
+
ctx.body = response;
|
|
63
72
|
}
|
|
64
|
-
ctx.body = response;
|
|
65
73
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
74
|
+
else {
|
|
75
|
+
ctx.body = user;
|
|
76
|
+
}
|
|
77
|
+
addSessionAttributesToUser(ctx);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
exports.fetchSelf = fetchSelf;
|
|
@@ -17,7 +17,7 @@ exports.fetch = function (ctx) {
|
|
|
17
17
|
ctx.status = 200;
|
|
18
18
|
const defs = yield getDefinitions();
|
|
19
19
|
// for google sheets integration google verification
|
|
20
|
-
if (featureFlags.isEnabled(featureFlags.
|
|
20
|
+
if (featureFlags.isEnabled(featureFlags.TenantFeatureFlag.GOOGLE_SHEETS)) {
|
|
21
21
|
defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema;
|
|
22
22
|
}
|
|
23
23
|
ctx.body = defs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const controller = require("../controllers/analytics");
|
|
4
|
-
const router = Router();
|
|
4
|
+
const router = new Router();
|
|
5
5
|
router.get("/api/bbtel", controller.isEnabled);
|
|
6
6
|
router.post("/api/bbtel/ping", controller.ping);
|
|
7
7
|
module.exports = router;
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/apikeys");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/keys", authorized(BUILDER), controller.fetch)
|
|
9
9
|
.put("/api/keys/:key", authorized(BUILDER), controller.update);
|
package/dist/api/routes/auth.js
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const router_1 = __importDefault(require("@koa/router"));
|
|
30
|
+
const controller = __importStar(require("../controllers/auth"));
|
|
31
|
+
const router = new router_1.default();
|
|
5
32
|
router.get("/api/self", controller.fetchSelf);
|
|
6
|
-
|
|
33
|
+
exports.default = router;
|
|
@@ -6,7 +6,7 @@ const { BUILDER, PermissionLevels, PermissionTypes, } = require("@budibase/backe
|
|
|
6
6
|
const { bodyResource, paramResource } = require("../../middleware/resourceId");
|
|
7
7
|
const { middleware: appInfoMiddleware, AppType, } = require("../../middleware/appInfo");
|
|
8
8
|
const { automationValidator } = require("./utils/validators");
|
|
9
|
-
const router = Router();
|
|
9
|
+
const router = new Router();
|
|
10
10
|
router
|
|
11
11
|
.get("/api/automations/trigger/list", authorized(BUILDER), controller.getTriggerList)
|
|
12
12
|
.get("/api/automations/action/list", authorized(BUILDER), controller.getActionList)
|
|
@@ -3,6 +3,6 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/backup");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router.get("/api/backups/export", authorized(BUILDER), controller.exportAppDump);
|
|
8
8
|
module.exports = router;
|
package/dist/api/routes/cloud.js
CHANGED
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/cloud");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/cloud/export", authorized(BUILDER), controller.exportApps)
|
|
9
9
|
// has to be public, only run if apps don't exist
|
|
@@ -3,6 +3,6 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/component");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router.get("/api/:appId/components/definitions", authorized(BUILDER), controller.fetchAppComponentDefinitions);
|
|
8
8
|
module.exports = router;
|
|
@@ -4,7 +4,7 @@ const datasourceController = require("../controllers/datasource");
|
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER, PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { datasourceValidator, datasourceQueryValidator, } = require("./utils/validators");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.get("/api/datasources", authorized(BUILDER), datasourceController.fetch)
|
|
10
10
|
.get("/api/datasources/:datasourceId", authorized(PermissionTypes.TABLE, PermissionLevels.READ), datasourceController.find)
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/deploy");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/deployments", authorized(BUILDER), controller.fetchDeployments)
|
|
9
9
|
.get("/api/deploy/:deploymentId", authorized(BUILDER), controller.deploymentProgress)
|
package/dist/api/routes/dev.js
CHANGED
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/dev");
|
|
|
4
4
|
const env = require("../../environment");
|
|
5
5
|
const authorized = require("../../middleware/authorized");
|
|
6
6
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
function redirectPath(path) {
|
|
9
9
|
router
|
|
10
10
|
.get(`/api/${path}/:devPath(.*)`, controller.buildRedirectGet(path))
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/integration");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/integrations", authorized(BUILDER), controller.fetch)
|
|
9
9
|
.get("/api/integrations/:type", authorized(BUILDER), controller.find);
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const authorized = require("../../middleware/authorized");
|
|
4
4
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
5
5
|
const controller = require("../controllers/layout");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.post("/api/layouts", authorized(BUILDER), controller.save)
|
|
9
9
|
.delete("/api/layouts/:layoutId/:layoutRev", authorized(BUILDER), controller.destroy);
|
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/metadata");
|
|
|
4
4
|
const { middleware: appInfoMiddleware, AppType, } = require("../../middleware/appInfo");
|
|
5
5
|
const authorized = require("../../middleware/authorized");
|
|
6
6
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.post("/api/metadata/:type/:entityId", authorized(BUILDER), appInfoMiddleware({ appType: AppType.DEV }), controller.saveMetadata)
|
|
10
10
|
.delete("/api/metadata/:type/:entityId", authorized(BUILDER), appInfoMiddleware({ appType: AppType.DEV }), controller.deleteMetadata)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const migrationsController = require("../controllers/migrations");
|
|
4
|
-
const router = Router();
|
|
4
|
+
const router = new Router();
|
|
5
5
|
const { internalApi } = require("@budibase/backend-core/auth");
|
|
6
6
|
router
|
|
7
7
|
.post("/api/migrations/run", internalApi, migrationsController.migrate)
|
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/permission");
|
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { permissionValidator } = require("./utils/validators");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.get("/api/permission/builtin", authorized(BUILDER), controller.fetchBuiltin)
|
|
10
10
|
.get("/api/permission/levels", authorized(BUILDER), controller.fetchLevels)
|
|
@@ -11,6 +11,7 @@ const read = [], write = [];
|
|
|
11
11
|
* @openapi
|
|
12
12
|
* /applications:
|
|
13
13
|
* post:
|
|
14
|
+
* operationId: create
|
|
14
15
|
* summary: Create an application
|
|
15
16
|
* tags:
|
|
16
17
|
* - applications
|
|
@@ -38,6 +39,7 @@ write.push(new Endpoint_1.default("post", "/applications", applications_1.defaul
|
|
|
38
39
|
* @openapi
|
|
39
40
|
* /applications/{appId}:
|
|
40
41
|
* put:
|
|
42
|
+
* operationId: update
|
|
41
43
|
* summary: Update an application
|
|
42
44
|
* tags:
|
|
43
45
|
* - applications
|
|
@@ -65,6 +67,7 @@ write.push(new Endpoint_1.default("put", "/applications/:appId", applications_1.
|
|
|
65
67
|
* @openapi
|
|
66
68
|
* /applications/{appId}:
|
|
67
69
|
* delete:
|
|
70
|
+
* operationId: destroy
|
|
68
71
|
* summary: Delete an application
|
|
69
72
|
* tags:
|
|
70
73
|
* - applications
|
|
@@ -86,6 +89,7 @@ write.push(new Endpoint_1.default("delete", "/applications/:appId", applications
|
|
|
86
89
|
* @openapi
|
|
87
90
|
* /applications/{appId}:
|
|
88
91
|
* get:
|
|
92
|
+
* operationId: getById
|
|
89
93
|
* summary: Retrieve an application
|
|
90
94
|
* tags:
|
|
91
95
|
* - applications
|
|
@@ -107,6 +111,7 @@ read.push(new Endpoint_1.default("get", "/applications/:appId", applications_1.d
|
|
|
107
111
|
* @openapi
|
|
108
112
|
* /applications/search:
|
|
109
113
|
* post:
|
|
114
|
+
* operationId: search
|
|
110
115
|
* summary: Search for applications
|
|
111
116
|
* description: Based on application properties (currently only name) search for applications.
|
|
112
117
|
* tags:
|
|
@@ -11,6 +11,7 @@ const read = [], write = [];
|
|
|
11
11
|
* @openapi
|
|
12
12
|
* /queries/{queryId}:
|
|
13
13
|
* post:
|
|
14
|
+
* operationId: execute
|
|
14
15
|
* summary: Execute a query
|
|
15
16
|
* description: Queries which have been created within a Budibase app can be executed using this,
|
|
16
17
|
* tags:
|
|
@@ -43,6 +44,7 @@ write.push(new Endpoint_1.default("post", "/queries/:queryId", queries_1.default
|
|
|
43
44
|
* @openapi
|
|
44
45
|
* /queries/search:
|
|
45
46
|
* post:
|
|
47
|
+
* operationId: search
|
|
46
48
|
* summary: Search for queries
|
|
47
49
|
* description: Based on query properties (currently only name) search for queries.
|
|
48
50
|
* tags:
|
|
@@ -11,6 +11,7 @@ const read = [], write = [];
|
|
|
11
11
|
* @openapi
|
|
12
12
|
* /tables/{tableId}/rows:
|
|
13
13
|
* post:
|
|
14
|
+
* operationId: create
|
|
14
15
|
* summary: Create a row
|
|
15
16
|
* description: Creates a row within the specified table.
|
|
16
17
|
* tags:
|
|
@@ -44,6 +45,7 @@ write.push(new Endpoint_1.default("post", "/tables/:tableId/rows", rows_1.defaul
|
|
|
44
45
|
* @openapi
|
|
45
46
|
* /tables/{tableId}/rows/{rowId}:
|
|
46
47
|
* put:
|
|
48
|
+
* operationId: update
|
|
47
49
|
* summary: Update a row
|
|
48
50
|
* description: Updates a row within the specified table.
|
|
49
51
|
* tags:
|
|
@@ -77,6 +79,7 @@ write.push(new Endpoint_1.default("put", "/tables/:tableId/rows/:rowId", rows_1.
|
|
|
77
79
|
* @openapi
|
|
78
80
|
* /tables/{tableId}/rows/{rowId}:
|
|
79
81
|
* delete:
|
|
82
|
+
* operationId: destroy
|
|
80
83
|
* summary: Delete a row
|
|
81
84
|
* description: Deletes a row within the specified table.
|
|
82
85
|
* tags:
|
|
@@ -101,6 +104,7 @@ write.push(new Endpoint_1.default("delete", "/tables/:tableId/rows/:rowId", rows
|
|
|
101
104
|
* @openapi
|
|
102
105
|
* /tables/{tableId}/rows/{rowId}:
|
|
103
106
|
* get:
|
|
107
|
+
* operationId: getById
|
|
104
108
|
* summary: Retrieve a row
|
|
105
109
|
* description: This gets a single row, it will be enriched with the full related rows, rather than
|
|
106
110
|
* the squashed "primaryDisplay" format returned by the search endpoint.
|
|
@@ -126,6 +130,7 @@ read.push(new Endpoint_1.default("get", "/tables/:tableId/rows/:rowId", rows_1.d
|
|
|
126
130
|
* @openapi
|
|
127
131
|
* /tables/{tableId}/rows/search:
|
|
128
132
|
* post:
|
|
133
|
+
* operationId: search
|
|
129
134
|
* summary: Search for rows
|
|
130
135
|
* tags:
|
|
131
136
|
* - rows
|
|
@@ -11,6 +11,7 @@ const read = [], write = [];
|
|
|
11
11
|
* @openapi
|
|
12
12
|
* /tables:
|
|
13
13
|
* post:
|
|
14
|
+
* operationId: create
|
|
14
15
|
* summary: Create a table
|
|
15
16
|
* description: Create a table, this could be internal or external.
|
|
16
17
|
* tags:
|
|
@@ -42,6 +43,7 @@ write.push(new Endpoint_1.default("post", "/tables", tables_1.default.create).ad
|
|
|
42
43
|
* @openapi
|
|
43
44
|
* /tables/{tableId}:
|
|
44
45
|
* put:
|
|
46
|
+
* operationId: update
|
|
45
47
|
* summary: Update a table
|
|
46
48
|
* description: Update a table, this could be internal or external.
|
|
47
49
|
* tags:
|
|
@@ -73,6 +75,7 @@ write.push(new Endpoint_1.default("put", "/tables/:tableId", tables_1.default.up
|
|
|
73
75
|
* @openapi
|
|
74
76
|
* /tables/{tableId}:
|
|
75
77
|
* delete:
|
|
78
|
+
* operationId: destroy
|
|
76
79
|
* summary: Delete a table
|
|
77
80
|
* description: Delete a table, this could be internal or external.
|
|
78
81
|
* tags:
|
|
@@ -96,6 +99,7 @@ write.push(new Endpoint_1.default("delete", "/tables/:tableId", tables_1.default
|
|
|
96
99
|
* @openapi
|
|
97
100
|
* /tables/{tableId}:
|
|
98
101
|
* get:
|
|
102
|
+
* operationId: getById
|
|
99
103
|
* summary: Retrieve a table
|
|
100
104
|
* description: Lookup a table, this could be internal or external.
|
|
101
105
|
* tags:
|
|
@@ -119,6 +123,7 @@ read.push(new Endpoint_1.default("get", "/tables/:tableId", tables_1.default.rea
|
|
|
119
123
|
* @openapi
|
|
120
124
|
* /tables/search:
|
|
121
125
|
* post:
|
|
126
|
+
* operationId: search
|
|
122
127
|
* summary: Search for tables
|
|
123
128
|
* description: Based on table properties (currently only name) search for tables. This could be
|
|
124
129
|
* an internal or an external table.
|
|
@@ -11,6 +11,7 @@ const read = [], write = [];
|
|
|
11
11
|
* @openapi
|
|
12
12
|
* /users:
|
|
13
13
|
* post:
|
|
14
|
+
* operationId: create
|
|
14
15
|
* summary: Create a user
|
|
15
16
|
* tags:
|
|
16
17
|
* - users
|
|
@@ -36,6 +37,7 @@ write.push(new Endpoint_1.default("post", "/users", users_1.default.create));
|
|
|
36
37
|
* @openapi
|
|
37
38
|
* /users/{userId}:
|
|
38
39
|
* put:
|
|
40
|
+
* operationId: update
|
|
39
41
|
* summary: Update a user
|
|
40
42
|
* tags:
|
|
41
43
|
* - users
|
|
@@ -63,6 +65,7 @@ write.push(new Endpoint_1.default("put", "/users/:userId", users_1.default.updat
|
|
|
63
65
|
* @openapi
|
|
64
66
|
* /users/{userId}:
|
|
65
67
|
* delete:
|
|
68
|
+
* operationId: destroy
|
|
66
69
|
* summary: Delete a user
|
|
67
70
|
* tags:
|
|
68
71
|
* - users
|
|
@@ -84,6 +87,7 @@ write.push(new Endpoint_1.default("delete", "/users/:userId", users_1.default.de
|
|
|
84
87
|
* @openapi
|
|
85
88
|
* /users/{userId}:
|
|
86
89
|
* get:
|
|
90
|
+
* operationId: getById
|
|
87
91
|
* summary: Retrieve a user
|
|
88
92
|
* tags:
|
|
89
93
|
* - users
|
|
@@ -105,6 +109,7 @@ read.push(new Endpoint_1.default("get", "/users/:userId", users_1.default.read))
|
|
|
105
109
|
* @openapi
|
|
106
110
|
* /users/search:
|
|
107
111
|
* post:
|
|
112
|
+
* operationId: search
|
|
108
113
|
* summary: Search for users
|
|
109
114
|
* description: Based on user properties (currently only name) search for users.
|
|
110
115
|
* tags:
|
package/dist/api/routes/query.js
CHANGED
|
@@ -5,7 +5,7 @@ const authorized = require("../../middleware/authorized");
|
|
|
5
5
|
const { PermissionLevels, PermissionTypes, BUILDER, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { bodyResource, bodySubResource, paramResource, } = require("../../middleware/resourceId");
|
|
7
7
|
const { generateQueryPreviewValidation, generateQueryValidation, } = require("../controllers/query/validation");
|
|
8
|
-
const router = Router();
|
|
8
|
+
const router = new Router();
|
|
9
9
|
router
|
|
10
10
|
.get("/api/queries", authorized(BUILDER), queryController.fetch)
|
|
11
11
|
.post("/api/queries", bodySubResource("datasourceId", "_id"), authorized(BUILDER), generateQueryValidation(), queryController.save)
|
package/dist/api/routes/role.js
CHANGED
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/role");
|
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { roleValidator } = require("./utils/validators");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.post("/api/roles", authorized(BUILDER), roleValidator(), controller.save)
|
|
10
10
|
.get("/api/roles", authorized(BUILDER), controller.fetch)
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const authorized = require("../../middleware/authorized");
|
|
4
4
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
5
5
|
const controller = require("../controllers/routing");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
// gets correct structure for user role
|
|
9
9
|
.get("/api/routing/client", controller.clientFetch)
|
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/screen");
|
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { screenValidator } = require("./utils/validators");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.get("/api/screens", authorized(BUILDER), controller.fetch)
|
|
10
10
|
.post("/api/screens", authorized(BUILDER), screenValidator(), controller.save)
|
|
@@ -3,6 +3,6 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/script");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router.post("/api/script", authorized(BUILDER), controller.save);
|
|
8
8
|
module.exports = router;
|
package/dist/api/routes/table.js
CHANGED
|
@@ -5,7 +5,7 @@ const authorized = require("../../middleware/authorized");
|
|
|
5
5
|
const { paramResource, bodyResource } = require("../../middleware/resourceId");
|
|
6
6
|
const { BUILDER, PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
7
7
|
const { tableValidator } = require("./utils/validators");
|
|
8
|
-
const router = Router();
|
|
8
|
+
const router = new Router();
|
|
9
9
|
router
|
|
10
10
|
/**
|
|
11
11
|
* @api {get} /api/tables Fetch all tables
|
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/templates");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/templates", authorized(BUILDER), controller.fetch)
|
|
9
9
|
.get("/api/templates/:type/:name", authorized(BUILDER), controller.downloadTemplate);
|
package/dist/api/routes/user.js
CHANGED
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const controller = require("../controllers/user");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
6
|
-
const router = Router();
|
|
6
|
+
const router = new Router();
|
|
7
7
|
router
|
|
8
8
|
.get("/api/users/metadata", authorized(PermissionTypes.USER, PermissionLevels.READ), controller.fetchMetadata)
|
|
9
9
|
.get("/api/users/metadata/:id", authorized(PermissionTypes.USER, PermissionLevels.READ), controller.findMetadata)
|
package/dist/api/routes/view.js
CHANGED
|
@@ -5,7 +5,7 @@ const rowController = require("../controllers/row");
|
|
|
5
5
|
const authorized = require("../../middleware/authorized");
|
|
6
6
|
const { paramResource } = require("../../middleware/resourceId");
|
|
7
7
|
const { BUILDER, PermissionTypes, PermissionLevels, } = require("@budibase/backend-core/permissions");
|
|
8
|
-
const router = Router();
|
|
8
|
+
const router = new Router();
|
|
9
9
|
router
|
|
10
10
|
.get("/api/views/export", authorized(BUILDER), viewController.exportView)
|
|
11
11
|
.get("/api/views/:viewName", paramResource("viewName"), authorized(PermissionTypes.VIEW, PermissionLevels.READ), rowController.fetchView)
|
|
@@ -4,7 +4,7 @@ const controller = require("../controllers/webhook");
|
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { BUILDER } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { webhookValidator } = require("./utils/validators");
|
|
7
|
-
const router = Router();
|
|
7
|
+
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.get("/api/webhooks", authorized(BUILDER), controller.fetch)
|
|
10
10
|
.put("/api/webhooks", authorized(BUILDER), webhookValidator(), controller.save)
|