@budibase/server 1.0.123 → 1.0.125
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.3d890df7.js +1299 -0
- package/builder/assets/index.89795487.css +6 -0
- package/builder/assets/{vendor.8e34a169.js → vendor.5240f480.js} +1 -1
- package/builder/index.html +3 -3
- package/coverage/clover.xml +695 -1678
- package/coverage/coverage-final.json +28 -43
- package/coverage/lcov-report/api/controllers/analytics.js.html +8 -3
- package/coverage/lcov-report/api/controllers/apikeys.js.html +9 -4
- package/coverage/lcov-report/api/controllers/auth.js.html +8 -3
- package/coverage/lcov-report/api/controllers/automation.js.html +8 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +8 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +8 -3
- package/coverage/lcov-report/api/controllers/component.js.html +8 -3
- package/coverage/lcov-report/api/controllers/datasource.js.html +11 -6
- package/coverage/lcov-report/api/controllers/dev.js.html +8 -3
- package/coverage/lcov-report/api/controllers/index.html +16 -26
- package/coverage/lcov-report/api/controllers/integration.js.html +8 -3
- package/coverage/lcov-report/api/controllers/layout.js.html +8 -3
- package/coverage/lcov-report/api/controllers/metadata.js.html +8 -3
- package/coverage/lcov-report/api/controllers/migrations.js.html +8 -3
- package/coverage/lcov-report/api/controllers/permission.js.html +8 -3
- package/coverage/lcov-report/api/controllers/query/index.html +16 -26
- package/coverage/lcov-report/api/controllers/query/validation.js.html +8 -3
- package/coverage/lcov-report/api/controllers/role.js.html +10 -5
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -4
- package/coverage/lcov-report/api/controllers/row/external.js.html +8 -3
- package/coverage/lcov-report/api/controllers/row/index.html +25 -35
- package/coverage/lcov-report/api/controllers/row/internal.js.html +32 -24
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +21 -16
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -19
- package/coverage/lcov-report/api/controllers/row/utils.js.html +33 -19
- package/coverage/lcov-report/api/controllers/screen.js.html +9 -4
- package/coverage/lcov-report/api/controllers/script.js.html +8 -3
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +55 -50
- package/coverage/lcov-report/api/controllers/table/external.js.html +8 -3
- package/coverage/lcov-report/api/controllers/table/index.html +19 -44
- package/coverage/lcov-report/api/controllers/table/index.js.html +20 -15
- package/coverage/lcov-report/api/controllers/templates.js.html +8 -3
- package/coverage/lcov-report/api/controllers/user.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/index.html +8 -3
- package/coverage/lcov-report/api/controllers/view/index.js.html +10 -5
- package/coverage/lcov-report/api/controllers/view/utils.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +8 -3
- package/coverage/lcov-report/api/controllers/webhook.js.html +10 -5
- package/coverage/lcov-report/api/index.html +18 -13
- package/coverage/lcov-report/api/index.js.html +28 -8
- package/coverage/lcov-report/api/routes/analytics.js.html +8 -3
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -3
- package/coverage/lcov-report/api/routes/auth.js.html +8 -3
- package/coverage/lcov-report/api/routes/automation.js.html +8 -3
- package/coverage/lcov-report/api/routes/backup.js.html +8 -3
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -3
- package/coverage/lcov-report/api/routes/component.js.html +8 -3
- package/coverage/lcov-report/api/routes/datasource.js.html +8 -3
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -3
- package/coverage/lcov-report/api/routes/dev.js.html +9 -4
- package/coverage/lcov-report/api/routes/index.html +13 -68
- package/coverage/lcov-report/api/routes/integration.js.html +8 -3
- package/coverage/lcov-report/api/routes/layout.js.html +8 -3
- package/coverage/lcov-report/api/routes/metadata.js.html +8 -3
- package/coverage/lcov-report/api/routes/migrations.js.html +8 -3
- package/coverage/lcov-report/api/routes/permission.js.html +8 -3
- package/coverage/lcov-report/api/routes/query.js.html +8 -3
- package/coverage/lcov-report/api/routes/role.js.html +8 -3
- package/coverage/lcov-report/api/routes/routing.js.html +8 -3
- package/coverage/lcov-report/api/routes/screen.js.html +8 -3
- package/coverage/lcov-report/api/routes/script.js.html +8 -3
- package/coverage/lcov-report/api/routes/table.js.html +8 -3
- package/coverage/lcov-report/api/routes/templates.js.html +8 -3
- package/coverage/lcov-report/api/routes/user.js.html +8 -3
- package/coverage/lcov-report/api/routes/utils/index.html +8 -3
- package/coverage/lcov-report/api/routes/utils/validators.js.html +8 -3
- package/coverage/lcov-report/api/routes/view.js.html +8 -3
- package/coverage/lcov-report/api/routes/webhook.js.html +8 -3
- package/coverage/lcov-report/automations/actions.js.html +21 -7
- package/coverage/lcov-report/automations/automationUtils.js.html +64 -23
- package/coverage/lcov-report/automations/bullboard.js.html +8 -3
- package/coverage/lcov-report/automations/index.html +27 -37
- package/coverage/lcov-report/automations/index.js.html +8 -3
- package/coverage/lcov-report/automations/steps/bash.js.html +8 -3
- package/coverage/lcov-report/automations/steps/delay.js.html +8 -3
- package/coverage/lcov-report/automations/steps/discord.js.html +8 -3
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +8 -3
- package/coverage/lcov-report/automations/steps/executeScript.js.html +8 -3
- package/coverage/lcov-report/automations/steps/filter.js.html +8 -3
- package/coverage/lcov-report/automations/steps/index.html +31 -41
- package/coverage/lcov-report/automations/steps/integromat.js.html +8 -3
- package/coverage/lcov-report/{api/routes/static.js.html → automations/steps/loop.js.html} +70 -80
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +9 -4
- package/coverage/lcov-report/automations/steps/queryRows.js.html +9 -4
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +8 -3
- package/coverage/lcov-report/automations/steps/serverLog.js.html +8 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +8 -3
- package/coverage/lcov-report/automations/steps/updateRow.js.html +8 -3
- package/coverage/lcov-report/automations/steps/utils.js.html +14 -9
- package/coverage/lcov-report/automations/steps/zapier.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/index.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +8 -3
- package/coverage/lcov-report/automations/triggers.js.html +16 -11
- package/coverage/lcov-report/block-navigation.js +8 -0
- package/coverage/lcov-report/constants/index.html +12 -7
- package/coverage/lcov-report/constants/index.js.html +55 -32
- package/coverage/lcov-report/constants/layouts.js.html +8 -3
- package/coverage/lcov-report/constants/screens.js.html +8 -3
- package/coverage/lcov-report/db/inMemoryView.js.html +8 -3
- package/coverage/lcov-report/db/index.html +8 -3
- package/coverage/lcov-report/db/index.js.html +9 -4
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +20 -15
- package/coverage/lcov-report/db/linkedRows/index.html +8 -3
- package/coverage/lcov-report/db/linkedRows/index.js.html +22 -17
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +12 -7
- package/coverage/lcov-report/db/newid.js.html +11 -6
- package/coverage/lcov-report/db/utils.js.html +84 -79
- package/coverage/lcov-report/events/AutomationEmitter.js.html +14 -9
- package/coverage/lcov-report/events/index.html +8 -3
- package/coverage/lcov-report/events/index.js.html +9 -4
- package/coverage/lcov-report/events/utils.js.html +18 -13
- package/coverage/lcov-report/index.html +125 -120
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +8 -3
- package/coverage/lcov-report/integrations/tests/index.html +8 -3
- package/coverage/lcov-report/middleware/appInfo.js.html +8 -3
- package/coverage/lcov-report/middleware/builder.js.html +8 -3
- package/coverage/lcov-report/middleware/currentapp.js.html +65 -15
- package/coverage/lcov-report/middleware/index.html +25 -50
- package/coverage/lcov-report/middleware/joi-validator.js.html +9 -4
- package/coverage/lcov-report/middleware/publicApi.js.html +8 -3
- package/coverage/lcov-report/middleware/resourceId.js.html +8 -3
- package/coverage/lcov-report/middleware/selfhost.js.html +9 -4
- package/coverage/lcov-report/middleware/utils.js.html +8 -3
- package/coverage/lcov-report/sorter.js +26 -0
- package/coverage/lcov-report/threads/automation.js.html +581 -90
- package/coverage/lcov-report/threads/index.html +30 -40
- package/coverage/lcov-report/threads/query.js.html +9 -4
- package/coverage/lcov-report/threads/utils.js.html +17 -9
- package/coverage/lcov-report/utilities/bcrypt.js.html +8 -3
- package/coverage/lcov-report/utilities/budibaseDir.js.html +8 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +8 -3
- package/coverage/lcov-report/utilities/csvParser.js.html +10 -5
- package/coverage/lcov-report/utilities/global.js.html +9 -4
- package/coverage/lcov-report/utilities/index.html +8 -3
- package/coverage/lcov-report/utilities/index.js.html +11 -6
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +32 -9
- package/coverage/lcov-report/utilities/queue/index.html +12 -7
- package/coverage/lcov-report/utilities/routing/index.html +8 -3
- package/coverage/lcov-report/utilities/routing/index.js.html +8 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.html +8 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +48 -43
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +18 -13
- package/coverage/lcov-report/utilities/scriptRunner.js.html +8 -3
- package/coverage/lcov-report/utilities/security.js.html +9 -4
- package/coverage/lcov-report/utilities/statusCodes.js.html +8 -3
- package/coverage/lcov-report/utilities/usageQuota/index.html +24 -34
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +44 -39
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +8 -3
- package/coverage/lcov-report/utilities/users.js.html +8 -3
- package/coverage/lcov-report/utilities/workerRequests.js.html +9 -4
- package/coverage/lcov.info +1144 -2875
- package/dist/api/controllers/application.js +145 -73
- package/dist/api/controllers/deploy/index.js +68 -36
- package/dist/api/controllers/public/applications.js +29 -9
- package/dist/api/controllers/public/queries.js +27 -7
- package/dist/api/controllers/public/rows.js +32 -12
- package/dist/api/controllers/public/tables.js +2 -2
- package/dist/api/controllers/public/users.js +8 -8
- package/dist/api/controllers/public/utils.js +1 -1
- package/dist/api/controllers/query/import/index.js +3 -3
- package/dist/api/controllers/query/index.js +57 -44
- package/dist/api/controllers/row/ExternalRequest.js +27 -27
- package/dist/api/controllers/row/index.js +83 -60
- package/dist/api/controllers/row/internal.js +2 -1
- package/dist/api/controllers/row/utils.js +2 -1
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +3 -0
- package/dist/api/controllers/table/bulkFormula.js +2 -1
- package/dist/api/controllers/table/internal.js +41 -35
- package/dist/api/controllers/table/utils.js +271 -229
- package/dist/api/index.js +5 -0
- package/dist/api/routes/application.js +39 -13
- package/dist/api/routes/index.js +61 -56
- package/dist/api/routes/public/index.js +6 -9
- package/dist/api/routes/public/queries.js +1 -1
- package/dist/api/routes/public/rows.js +1 -1
- package/dist/api/routes/public/tables.js +3 -3
- package/dist/api/routes/public/users.js +1 -1
- package/dist/api/routes/row.js +43 -17
- package/dist/api/routes/static.js +40 -13
- package/dist/api/routes/tests/utilities/TestFunctions.js +75 -33
- package/dist/app.js +8 -4
- package/dist/automations/actions.js +3 -0
- package/dist/automations/automationUtils.js +10 -0
- package/dist/automations/steps/createRow.js +12 -12
- package/dist/automations/steps/deleteRow.js +13 -16
- package/dist/automations/steps/loop.js +51 -0
- package/dist/automations/tests/utilities/index.js +13 -11
- package/dist/automations/utils.js +187 -133
- package/dist/constants/index.js +5 -0
- package/dist/definitions/datasource.js +1 -0
- package/dist/environment.js +2 -3
- package/dist/index.js +4 -0
- package/dist/integrations/base/sql.js +2 -2
- package/dist/integrations/base/sqlTable.js +2 -2
- package/dist/integrations/googlesheets.js +1 -1
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/microsoftSqlServer.js +8 -8
- package/dist/integrations/mysql.js +9 -9
- package/dist/integrations/oracle.js +7 -7
- package/dist/integrations/postgres.js +7 -7
- package/dist/integrations/queries/sql.js +2 -2
- package/dist/integrations/redis.js +158 -0
- package/dist/integrations/rest.js +1 -1
- package/dist/middleware/authorized.js +51 -51
- package/dist/middleware/currentapp.js +15 -1
- package/dist/migrations/functions/appUrls.js +1 -1
- package/dist/migrations/functions/developerQuota.js +49 -0
- package/dist/migrations/functions/publishedAppsQuota.js +47 -0
- package/dist/migrations/functions/quotas1.js +6 -2
- package/dist/migrations/functions/usageQuotas/index.js +0 -4
- package/dist/migrations/functions/usageQuotas/syncApps.js +4 -7
- package/dist/migrations/functions/usageQuotas/syncDevelopers.js +24 -0
- package/dist/migrations/functions/usageQuotas/syncPublishedApps.js +26 -0
- package/dist/migrations/functions/usageQuotas/syncRows.js +5 -8
- package/dist/migrations/index.js +17 -1
- package/dist/package.json +14 -8
- package/dist/threads/automation.js +149 -27
- package/dist/threads/index.js +36 -10
- package/dist/threads/utils.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utilities/queue/inMemoryQueue.js +6 -1
- package/nodemon.json +1 -1
- package/package.json +15 -9
- package/scripts/dev/manage.js +2 -0
- package/src/api/controllers/{application.js → application.ts} +118 -51
- package/src/api/controllers/deploy/{index.js → index.ts} +53 -29
- package/src/api/controllers/public/applications.ts +2 -2
- package/src/api/controllers/public/queries.ts +1 -1
- package/src/api/controllers/public/rows.ts +1 -1
- package/src/api/controllers/query/{index.js → index.ts} +51 -48
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/{index.js → index.ts} +24 -17
- package/src/api/controllers/row/internal.js +2 -1
- package/src/api/controllers/row/utils.js +4 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +3 -0
- package/src/api/controllers/table/bulkFormula.js +1 -1
- package/src/api/controllers/table/{internal.js → internal.ts} +30 -26
- package/src/api/controllers/table/{utils.js → utils.ts} +86 -69
- package/src/api/index.js +5 -0
- package/src/api/routes/{application.js → application.ts} +8 -14
- package/src/api/routes/index.ts +60 -0
- package/src/api/routes/public/index.ts +1 -4
- package/src/api/routes/{row.js → row.ts} +7 -15
- package/src/api/routes/{static.js → static.ts} +11 -11
- package/src/api/routes/tests/misc.spec.js +39 -37
- package/src/api/routes/tests/utilities/{TestFunctions.js → TestFunctions.ts} +57 -33
- package/src/app.ts +1 -2
- package/src/automations/actions.js +3 -0
- package/src/automations/automationUtils.js +12 -0
- package/src/automations/steps/{createRow.js → createRow.ts} +9 -15
- package/src/automations/steps/{deleteRow.js → deleteRow.ts} +10 -16
- package/src/automations/steps/loop.js +50 -0
- package/src/automations/tests/automation.spec.js +0 -1
- package/src/automations/tests/{createRow.spec.js → createRow.spec.ts} +4 -15
- package/src/automations/tests/{deleteRow.spec.js → deleteRow.spec.ts} +3 -5
- package/src/automations/tests/utilities/index.js +12 -10
- package/src/automations/{utils.js → utils.ts} +39 -28
- package/src/constants/index.js +6 -0
- package/src/definitions/common.ts +1 -0
- package/src/definitions/datasource.ts +1 -0
- package/src/environment.js +2 -3
- package/src/index.ts +3 -0
- package/src/integrations/index.ts +4 -0
- package/src/integrations/redis.ts +152 -0
- package/src/integrations/tests/redis.spec.js +60 -0
- package/src/middleware/{authorized.js → authorized.ts} +20 -14
- package/src/middleware/currentapp.js +16 -1
- package/src/middleware/tests/currentapp.spec.js +8 -4
- package/src/migrations/functions/developerQuota.ts +15 -0
- package/src/migrations/functions/publishedAppsQuota.ts +13 -0
- package/src/migrations/functions/tests/quotas1.spec.js +0 -2
- package/src/migrations/functions/usageQuotas/index.ts +0 -5
- package/src/migrations/functions/usageQuotas/syncApps.ts +3 -6
- package/src/migrations/functions/usageQuotas/syncDevelopers.ts +19 -0
- package/src/migrations/functions/usageQuotas/syncPublishedApps.ts +21 -0
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -6
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.ts +34 -0
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +40 -0
- package/src/migrations/index.ts +13 -1
- package/src/threads/automation.js +196 -34
- package/src/threads/{index.js → index.ts} +18 -14
- package/src/threads/utils.js +1 -0
- package/src/utilities/queue/inMemoryQueue.js +7 -1
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +2 -2
- package/builder/assets/index.68a7f4e3.css +0 -6
- package/builder/assets/index.8d4a5b33.js +0 -1291
- package/coverage/lcov-report/api/controllers/application.js.html +0 -1436
- package/coverage/lcov-report/api/controllers/query/index.js.html +0 -713
- package/coverage/lcov-report/api/controllers/row/index.js.html +0 -524
- package/coverage/lcov-report/api/controllers/table/internal.js.html +0 -620
- package/coverage/lcov-report/api/controllers/table/utils.js.html +0 -1331
- package/coverage/lcov-report/api/routes/application.js.html +0 -179
- package/coverage/lcov-report/api/routes/index.js.html +0 -266
- package/coverage/lcov-report/api/routes/row.js.html +0 -908
- package/coverage/lcov-report/automations/steps/createRow.js.html +0 -380
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +0 -347
- package/coverage/lcov-report/automations/utils.js.html +0 -665
- package/coverage/lcov-report/middleware/authorized.js.html +0 -458
- package/coverage/lcov-report/middleware/usageQuota.js.html +0 -572
- package/coverage/lcov-report/threads/index.js.html +0 -296
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +0 -359
- package/dist/middleware/usageQuota.js +0 -154
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utilities/usageQuota/index.js +0 -86
- package/src/api/routes/index.js +0 -62
- package/src/middleware/tests/usageQuota.spec.js +0 -120
- package/src/middleware/usageQuota.js +0 -164
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.js +0 -41
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.js +0 -45
- package/src/utilities/tests/usageQuota/usageQuota.spec.js +0 -72
- package/src/utilities/usageQuota/index.js +0 -93
|
@@ -1,18 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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/application"));
|
|
31
|
+
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
32
|
+
const permissions_1 = require("@budibase/backend-core/permissions");
|
|
33
|
+
const router = new router_1.default();
|
|
8
34
|
router
|
|
9
|
-
.post("/api/applications/:appId/sync",
|
|
10
|
-
.post("/api/applications",
|
|
35
|
+
.post("/api/applications/:appId/sync", (0, authorized_1.default)(permissions_1.BUILDER), controller.sync)
|
|
36
|
+
.post("/api/applications", (0, authorized_1.default)(permissions_1.BUILDER), controller.create)
|
|
11
37
|
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
|
12
38
|
.get("/api/applications", controller.fetch)
|
|
13
39
|
.get("/api/applications/:appId/appPackage", controller.fetchAppPackage)
|
|
14
|
-
.put("/api/applications/:appId",
|
|
15
|
-
.post("/api/applications/:appId/client/update",
|
|
16
|
-
.post("/api/applications/:appId/client/revert",
|
|
17
|
-
.delete("/api/applications/:appId",
|
|
18
|
-
|
|
40
|
+
.put("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.update)
|
|
41
|
+
.post("/api/applications/:appId/client/update", (0, authorized_1.default)(permissions_1.BUILDER), controller.updateClient)
|
|
42
|
+
.post("/api/applications/:appId/client/revert", (0, authorized_1.default)(permissions_1.BUILDER), controller.revertClient)
|
|
43
|
+
.delete("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.destroy);
|
|
44
|
+
exports.default = router;
|
package/dist/api/routes/index.js
CHANGED
|
@@ -1,61 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mainRoutes = exports.publicRoutes = exports.staticRoutes = void 0;
|
|
7
|
+
const auth_1 = __importDefault(require("./auth"));
|
|
8
|
+
const layout_1 = __importDefault(require("./layout"));
|
|
9
|
+
const screen_1 = __importDefault(require("./screen"));
|
|
10
|
+
const user_1 = __importDefault(require("./user"));
|
|
11
|
+
const application_1 = __importDefault(require("./application"));
|
|
12
|
+
const table_1 = __importDefault(require("./table"));
|
|
13
|
+
const row_1 = __importDefault(require("./row"));
|
|
14
|
+
const view_1 = __importDefault(require("./view"));
|
|
15
|
+
const component_1 = __importDefault(require("./component"));
|
|
16
|
+
const automation_1 = __importDefault(require("./automation"));
|
|
17
|
+
const webhook_1 = __importDefault(require("./webhook"));
|
|
18
|
+
const role_1 = __importDefault(require("./role"));
|
|
19
|
+
const deploy_1 = __importDefault(require("./deploy"));
|
|
20
|
+
const apikeys_1 = __importDefault(require("./apikeys"));
|
|
21
|
+
const templates_1 = __importDefault(require("./templates"));
|
|
22
|
+
const analytics_1 = __importDefault(require("./analytics"));
|
|
23
|
+
const routing_1 = __importDefault(require("./routing"));
|
|
24
|
+
const integration_1 = __importDefault(require("./integration"));
|
|
25
|
+
const permission_1 = __importDefault(require("./permission"));
|
|
26
|
+
const datasource_1 = __importDefault(require("./datasource"));
|
|
27
|
+
const query_1 = __importDefault(require("./query"));
|
|
28
|
+
const backup_1 = __importDefault(require("./backup"));
|
|
29
|
+
const metadata_1 = __importDefault(require("./metadata"));
|
|
30
|
+
const dev_1 = __importDefault(require("./dev"));
|
|
31
|
+
const cloud_1 = __importDefault(require("./cloud"));
|
|
32
|
+
const migrations_1 = __importDefault(require("./migrations"));
|
|
33
|
+
var static_1 = require("./static");
|
|
34
|
+
Object.defineProperty(exports, "staticRoutes", { enumerable: true, get: function () { return __importDefault(static_1).default; } });
|
|
35
|
+
var public_1 = require("./public");
|
|
36
|
+
Object.defineProperty(exports, "publicRoutes", { enumerable: true, get: function () { return __importDefault(public_1).default; } });
|
|
30
37
|
exports.mainRoutes = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
38
|
+
auth_1.default,
|
|
39
|
+
deploy_1.default,
|
|
40
|
+
layout_1.default,
|
|
41
|
+
screen_1.default,
|
|
42
|
+
user_1.default,
|
|
43
|
+
application_1.default,
|
|
44
|
+
automation_1.default,
|
|
45
|
+
view_1.default,
|
|
46
|
+
component_1.default,
|
|
47
|
+
role_1.default,
|
|
48
|
+
apikeys_1.default,
|
|
49
|
+
templates_1.default,
|
|
50
|
+
analytics_1.default,
|
|
51
|
+
webhook_1.default,
|
|
52
|
+
routing_1.default,
|
|
53
|
+
integration_1.default,
|
|
54
|
+
permission_1.default,
|
|
55
|
+
datasource_1.default,
|
|
56
|
+
query_1.default,
|
|
57
|
+
backup_1.default,
|
|
58
|
+
metadata_1.default,
|
|
59
|
+
dev_1.default,
|
|
60
|
+
cloud_1.default,
|
|
54
61
|
// these need to be handled last as they still use /api/:tableId
|
|
55
62
|
// this could be breaking as koa may recognise other routes as this
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
table_1.default,
|
|
64
|
+
row_1.default,
|
|
65
|
+
migrations_1.default,
|
|
59
66
|
];
|
|
60
|
-
exports.publicRoutes = publicRoutes;
|
|
61
|
-
exports.staticRoutes = staticRoutes;
|
|
@@ -8,7 +8,6 @@ const queries_1 = __importDefault(require("./queries"));
|
|
|
8
8
|
const tables_1 = __importDefault(require("./tables"));
|
|
9
9
|
const rows_1 = __importDefault(require("./rows"));
|
|
10
10
|
const users_1 = __importDefault(require("./users"));
|
|
11
|
-
const usageQuota_1 = __importDefault(require("../../../middleware/usageQuota"));
|
|
12
11
|
const authorized_1 = __importDefault(require("../../../middleware/authorized"));
|
|
13
12
|
const publicApi_1 = __importDefault(require("../../../middleware/publicApi"));
|
|
14
13
|
const resourceId_1 = require("../../../middleware/resourceId");
|
|
@@ -86,9 +85,9 @@ function addToRouter(endpoints) {
|
|
|
86
85
|
}
|
|
87
86
|
function applyRoutes(endpoints, permType, resource, subResource) {
|
|
88
87
|
const paramMiddleware = subResource
|
|
89
|
-
? resourceId_1.paramSubResource(resource, subResource)
|
|
90
|
-
: resourceId_1.paramResource(resource);
|
|
91
|
-
const publicApiMiddleware = publicApi_1.default({
|
|
88
|
+
? (0, resourceId_1.paramSubResource)(resource, subResource)
|
|
89
|
+
: (0, resourceId_1.paramResource)(resource);
|
|
90
|
+
const publicApiMiddleware = (0, publicApi_1.default)({
|
|
92
91
|
requiresAppId: permType !== PermissionTypes.APP && permType !== PermissionTypes.USER,
|
|
93
92
|
});
|
|
94
93
|
addMiddleware(endpoints.read, publicApiMiddleware);
|
|
@@ -97,10 +96,8 @@ function applyRoutes(endpoints, permType, resource, subResource) {
|
|
|
97
96
|
addMiddleware(endpoints.read, paramMiddleware);
|
|
98
97
|
addMiddleware(endpoints.write, paramMiddleware);
|
|
99
98
|
// add the authorization middleware, using the correct perm type
|
|
100
|
-
addMiddleware(endpoints.read, authorized_1.default(permType, PermissionLevels.READ));
|
|
101
|
-
addMiddleware(endpoints.write, authorized_1.default(permType, PermissionLevels.WRITE));
|
|
102
|
-
// add the usage quota middleware
|
|
103
|
-
addMiddleware(endpoints.write, usageQuota_1.default);
|
|
99
|
+
addMiddleware(endpoints.read, (0, authorized_1.default)(permType, PermissionLevels.READ));
|
|
100
|
+
addMiddleware(endpoints.write, (0, authorized_1.default)(permType, PermissionLevels.WRITE));
|
|
104
101
|
// add the output mapper middleware
|
|
105
102
|
addMiddleware(endpoints.read, mapper_1.default, { output: true });
|
|
106
103
|
addMiddleware(endpoints.write, mapper_1.default, { output: true });
|
|
@@ -113,4 +110,4 @@ applyRoutes(users_1.default, PermissionTypes.USER, "userId");
|
|
|
113
110
|
applyRoutes(queries_1.default, PermissionTypes.QUERY, "queryId");
|
|
114
111
|
// needs to be applied last for routing purposes, don't override other endpoints
|
|
115
112
|
applyRoutes(rows_1.default, PermissionTypes.TABLE, "tableId", "rowId");
|
|
116
|
-
|
|
113
|
+
exports.default = publicRouter;
|
|
@@ -66,5 +66,5 @@ write.push(new Endpoint_1.default("post", "/queries/:queryId", queries_1.default
|
|
|
66
66
|
* queries:
|
|
67
67
|
* $ref: '#/components/examples/queries'
|
|
68
68
|
*/
|
|
69
|
-
read.push(new Endpoint_1.default("post", "/queries/search", queries_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
69
|
+
read.push(new Endpoint_1.default("post", "/queries/search", queries_1.default.search).addMiddleware((0, validators_1.nameValidator)()));
|
|
70
70
|
exports.default = { read, write };
|
|
@@ -225,5 +225,5 @@ read.push(new Endpoint_1.default("get", "/tables/:tableId/rows/:rowId", rows_1.d
|
|
|
225
225
|
* search:
|
|
226
226
|
* $ref: '#/components/examples/rows'
|
|
227
227
|
*/
|
|
228
|
-
read.push(new Endpoint_1.default("post", "/tables/:tableId/rows/search", rows_1.default.search).addMiddleware(validators_1.externalSearchValidator()));
|
|
228
|
+
read.push(new Endpoint_1.default("post", "/tables/:tableId/rows/search", rows_1.default.search).addMiddleware((0, validators_1.externalSearchValidator)()));
|
|
229
229
|
exports.default = { read, write };
|
|
@@ -37,7 +37,7 @@ const read = [], write = [];
|
|
|
37
37
|
* table:
|
|
38
38
|
* $ref: '#/components/examples/table'
|
|
39
39
|
*/
|
|
40
|
-
write.push(new Endpoint_1.default("post", "/tables", tables_1.default.create).addMiddleware(validators_1.tableValidator()));
|
|
40
|
+
write.push(new Endpoint_1.default("post", "/tables", tables_1.default.create).addMiddleware((0, validators_1.tableValidator)()));
|
|
41
41
|
/**
|
|
42
42
|
* @openapi
|
|
43
43
|
* /tables/{tableId}:
|
|
@@ -68,7 +68,7 @@ write.push(new Endpoint_1.default("post", "/tables", tables_1.default.create).ad
|
|
|
68
68
|
* table:
|
|
69
69
|
* $ref: '#/components/examples/table'
|
|
70
70
|
*/
|
|
71
|
-
write.push(new Endpoint_1.default("put", "/tables/:tableId", tables_1.default.update).addMiddleware(validators_1.tableValidator()));
|
|
71
|
+
write.push(new Endpoint_1.default("put", "/tables/:tableId", tables_1.default.update).addMiddleware((0, validators_1.tableValidator)()));
|
|
72
72
|
/**
|
|
73
73
|
* @openapi
|
|
74
74
|
* /tables/{tableId}:
|
|
@@ -143,5 +143,5 @@ read.push(new Endpoint_1.default("get", "/tables/:tableId", tables_1.default.rea
|
|
|
143
143
|
* tables:
|
|
144
144
|
* $ref: '#/components/examples/tables'
|
|
145
145
|
*/
|
|
146
|
-
read.push(new Endpoint_1.default("post", "/tables/search", tables_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
146
|
+
read.push(new Endpoint_1.default("post", "/tables/search", tables_1.default.search).addMiddleware((0, validators_1.nameValidator)()));
|
|
147
147
|
exports.default = { read, write };
|
|
@@ -126,5 +126,5 @@ read.push(new Endpoint_1.default("get", "/users/:userId", users_1.default.read))
|
|
|
126
126
|
* users:
|
|
127
127
|
* $ref: '#/components/examples/users'
|
|
128
128
|
*/
|
|
129
|
-
read.push(new Endpoint_1.default("post", "/users/search", users_1.default.search).addMiddleware(validators_1.nameValidator()));
|
|
129
|
+
read.push(new Endpoint_1.default("post", "/users/search", users_1.default.search).addMiddleware((0, validators_1.nameValidator)()));
|
|
130
130
|
exports.default = { read, write };
|
package/dist/api/routes/row.js
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 rowController = __importStar(require("../controllers/row"));
|
|
31
|
+
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
32
|
+
const resourceId_1 = require("../../middleware/resourceId");
|
|
7
33
|
const { PermissionLevels, PermissionTypes, } = require("@budibase/backend-core/permissions");
|
|
8
34
|
const { internalSearchValidator } = require("./utils/validators");
|
|
9
|
-
const router =
|
|
35
|
+
const router = new router_1.default();
|
|
10
36
|
router
|
|
11
37
|
/**
|
|
12
38
|
* @api {get} /api/:tableId/:rowId/enrich Get an enriched row
|
|
@@ -22,7 +48,7 @@ router
|
|
|
22
48
|
*
|
|
23
49
|
* @apiSuccess {object} row The response body will be the enriched row.
|
|
24
50
|
*/
|
|
25
|
-
.get("/api/:tableId/:rowId/enrich", paramSubResource("tableId", "rowId"),
|
|
51
|
+
.get("/api/:tableId/:rowId/enrich", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.READ), rowController.fetchEnrichedRow)
|
|
26
52
|
/**
|
|
27
53
|
* @api {get} /api/:tableId/rows Get all rows in a table
|
|
28
54
|
* @apiName Get all rows in a table
|
|
@@ -37,7 +63,7 @@ router
|
|
|
37
63
|
*
|
|
38
64
|
* @apiSuccess {object[]} rows The response body will be an array of all rows found.
|
|
39
65
|
*/
|
|
40
|
-
.get("/api/:tableId/rows", paramResource("tableId"),
|
|
66
|
+
.get("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.READ), rowController.fetch)
|
|
41
67
|
/**
|
|
42
68
|
* @api {get} /api/:tableId/rows/:rowId Retrieve a single row
|
|
43
69
|
* @apiName Retrieve a single row
|
|
@@ -51,7 +77,7 @@ router
|
|
|
51
77
|
*
|
|
52
78
|
* @apiSuccess {object} body The response body will be the row that was found.
|
|
53
79
|
*/
|
|
54
|
-
.get("/api/:tableId/rows/:rowId", paramSubResource("tableId", "rowId"),
|
|
80
|
+
.get("/api/:tableId/rows/:rowId", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.READ), rowController.find)
|
|
55
81
|
/**
|
|
56
82
|
* @api {post} /api/:tableId/search Search for rows in a table
|
|
57
83
|
* @apiName Search for rows in a table
|
|
@@ -115,10 +141,10 @@ router
|
|
|
115
141
|
* @apiSuccess {string} bookmark The bookmark to be sent with the next request to get the next
|
|
116
142
|
* page.
|
|
117
143
|
*/
|
|
118
|
-
.post("/api/:tableId/search", internalSearchValidator(), paramResource("tableId"),
|
|
144
|
+
.post("/api/:tableId/search", internalSearchValidator(), (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.READ), rowController.search)
|
|
119
145
|
// DEPRECATED - this is an old API, but for backwards compat it needs to be
|
|
120
146
|
// supported still
|
|
121
|
-
.post("/api/search/:tableId/rows", paramResource("tableId"),
|
|
147
|
+
.post("/api/search/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.READ), rowController.search)
|
|
122
148
|
/**
|
|
123
149
|
* @api {post} /api/:tableId/rows Creates a new row
|
|
124
150
|
* @apiName Creates a new row
|
|
@@ -143,7 +169,7 @@ router
|
|
|
143
169
|
* @apiSuccess {string} [_rev] If saving to an internal table a revision will also be returned.
|
|
144
170
|
* @apiSuccess {object} body The contents of the row that was saved will be returned as well.
|
|
145
171
|
*/
|
|
146
|
-
.post("/api/:tableId/rows", paramResource("tableId"),
|
|
172
|
+
.post("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.save)
|
|
147
173
|
/**
|
|
148
174
|
* @api {patch} /api/:tableId/rows Updates a row
|
|
149
175
|
* @apiName Update a row
|
|
@@ -152,7 +178,7 @@ router
|
|
|
152
178
|
* @apiDescription This endpoint is identical to the row creation endpoint but instead it will
|
|
153
179
|
* error if an _id isn't provided, it will only function for existing rows.
|
|
154
180
|
*/
|
|
155
|
-
.patch("/api/:tableId/rows", paramResource("tableId"),
|
|
181
|
+
.patch("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.patch)
|
|
156
182
|
/**
|
|
157
183
|
* @api {post} /api/:tableId/rows/validate Validate inputs for a row
|
|
158
184
|
* @apiName Validate inputs for a row
|
|
@@ -173,7 +199,7 @@ router
|
|
|
173
199
|
* which do not match the table schema. The key name will be the column names that have breached
|
|
174
200
|
* the schema.
|
|
175
201
|
*/
|
|
176
|
-
.post("/api/:tableId/rows/validate", paramResource("tableId"),
|
|
202
|
+
.post("/api/:tableId/rows/validate", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.validate)
|
|
177
203
|
/**
|
|
178
204
|
* @api {delete} /api/:tableId/rows Delete rows
|
|
179
205
|
* @apiName Delete rows
|
|
@@ -194,7 +220,7 @@ router
|
|
|
194
220
|
* of the deleted rows, if deleting a single row then the body will contain a "row" property which
|
|
195
221
|
* is the deleted row.
|
|
196
222
|
*/
|
|
197
|
-
.delete("/api/:tableId/rows", paramResource("tableId"),
|
|
223
|
+
.delete("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.destroy)
|
|
198
224
|
/**
|
|
199
225
|
* @api {post} /api/:tableId/rows/exportRows Export Rows
|
|
200
226
|
* @apiName Export rows
|
|
@@ -208,5 +234,5 @@ router
|
|
|
208
234
|
*
|
|
209
235
|
* @apiSuccess {object[]|object}
|
|
210
236
|
*/
|
|
211
|
-
.post("/api/:tableId/rows/exportRows", paramResource("tableId"),
|
|
212
|
-
|
|
237
|
+
.post("/api/:tableId/rows/exportRows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionTypes.TABLE, PermissionLevels.WRITE), rowController.exportRows);
|
|
238
|
+
exports.default = router;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
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
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,14 +31,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
const router_1 = __importDefault(require("@koa/router"));
|
|
39
|
+
const controller = __importStar(require("../controllers/static"));
|
|
40
|
+
const budibaseDir_1 = require("../../utilities/budibaseDir");
|
|
41
|
+
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
42
|
+
const permissions_1 = require("@budibase/backend-core/permissions");
|
|
43
|
+
const env = __importStar(require("../../environment"));
|
|
44
|
+
const resourceId_1 = require("../../middleware/resourceId");
|
|
45
|
+
const router = new router_1.default();
|
|
19
46
|
/* istanbul ignore next */
|
|
20
47
|
router.param("file", (file, ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
48
|
ctx.file = file && file.includes(".") ? file : "index.html";
|
|
@@ -28,7 +55,7 @@ router.param("file", (file, ctx, next) => __awaiter(void 0, void 0, void 0, func
|
|
|
28
55
|
}
|
|
29
56
|
else if (env.isDev()) {
|
|
30
57
|
// Serving the client library from your local dir in dev
|
|
31
|
-
ctx.devPath = budibaseTempDir();
|
|
58
|
+
ctx.devPath = (0, budibaseDir_1.budibaseTempDir)();
|
|
32
59
|
}
|
|
33
60
|
return next();
|
|
34
61
|
}));
|
|
@@ -40,9 +67,9 @@ if (env.isDev()) {
|
|
|
40
67
|
router
|
|
41
68
|
// TODO: for now this builder endpoint is not authorized/secured, will need to be
|
|
42
69
|
.get("/builder/:file*", controller.serveBuilder)
|
|
43
|
-
.post("/api/attachments/process",
|
|
44
|
-
.post("/api/attachments/:tableId/upload", paramResource("tableId"),
|
|
70
|
+
.post("/api/attachments/process", (0, authorized_1.default)(permissions_1.BUILDER), controller.uploadFile)
|
|
71
|
+
.post("/api/attachments/:tableId/upload", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(permissions_1.PermissionTypes.TABLE, permissions_1.PermissionLevels.WRITE), controller.uploadFile)
|
|
45
72
|
.get("/:appId/:path*", controller.serveApp)
|
|
46
73
|
.get("/app/:appUrl/:path*", controller.serveApp)
|
|
47
|
-
.post("/api/attachments/:datasourceId/url",
|
|
48
|
-
|
|
74
|
+
.post("/api/attachments/:datasourceId/url", (0, authorized_1.default)(permissions_1.PermissionTypes.TABLE, permissions_1.PermissionLevels.READ), controller.getSignedUploadURL);
|
|
75
|
+
exports.default = router;
|