@budibase/server 2.1.22-alpha.6 → 2.1.22-alpha.7
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/__mocks__/node-fetch.ts +5 -1
- package/builder/assets/{index.5ec5f06c.js → index.22484e23.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +1182 -1209
- package/coverage/coverage-final.json +35 -35
- package/coverage/lcov-report/index.html +94 -94
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/application.ts.html +45 -60
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +7 -4
- package/coverage/lcov-report/src/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +19 -55
- package/coverage/lcov-report/src/api/controllers/{dev.js.html → dev.ts.html} +46 -64
- package/coverage/lcov-report/src/api/controllers/index.html +25 -25
- package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +37 -19
- package/coverage/lcov-report/src/api/controllers/public/index.html +16 -16
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +17 -26
- package/coverage/lcov-report/src/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internal.js.html +3 -3
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/application.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/automation.js.html +5 -5
- package/coverage/lcov-report/src/api/routes/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/datasource.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/row.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +6 -6
- package/coverage/lcov-report/src/api/routes/table.js.html +4 -4
- package/coverage/lcov-report/src/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/user.js.html +11 -11
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/view.js.html +4 -4
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/app.ts.html +1 -1
- package/coverage/lcov-report/src/automations/actions.js.html +1 -1
- package/coverage/lcov-report/src/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/src/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/src/automations/index.html +15 -15
- package/coverage/lcov-report/src/automations/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +17 -17
- package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +33 -15
- package/coverage/lcov-report/src/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/src/automations/utils.ts.html +20 -29
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.js.html +1 -1
- package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/src/constants/screens.js.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
- package/coverage/lcov-report/src/db/inMemoryView.js.html +3 -3
- package/coverage/lcov-report/src/db/index.html +16 -16
- package/coverage/lcov-report/src/db/index.js.html +9 -9
- package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/src/db/newid.js.html +1 -1
- package/coverage/lcov-report/src/db/{utils.js.html → utils.ts.html} +97 -145
- package/coverage/lcov-report/src/definitions/automations.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.js.html +4 -4
- package/coverage/lcov-report/src/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.js.html +1 -1
- package/coverage/lcov-report/src/events/utils.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/airtable.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/index.html +1 -1
- package/coverage/lcov-report/src/integrations/base/query.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/firebase.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +10 -19
- package/coverage/lcov-report/src/integrations/index.html +11 -11
- package/coverage/lcov-report/src/integrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mysql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/oracle.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/postgres.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/redis.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/rest.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/s3.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/integrations/utils.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/{appInfo.js.html → appInfo.ts.html} +24 -21
- package/coverage/lcov-report/src/middleware/authorized.ts.html +7 -7
- package/coverage/lcov-report/src/middleware/{builder.js.html → builder.ts.html} +36 -30
- package/coverage/lcov-report/src/middleware/{currentapp.js.html → currentapp.ts.html} +70 -61
- package/coverage/lcov-report/src/middleware/index.html +55 -55
- package/coverage/lcov-report/src/middleware/{joi-validator.js.html → joi-validator.ts.html} +18 -15
- package/coverage/lcov-report/src/middleware/{publicApi.js.html → publicApi.ts.html} +17 -17
- package/coverage/lcov-report/src/middleware/{resourceId.js.html → resourceId.ts.html} +33 -18
- package/coverage/lcov-report/src/middleware/{selfhost.js.html → selfhost.ts.html} +18 -12
- package/coverage/lcov-report/src/middleware/{utils.js.html → utils.ts.html} +12 -6
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +6 -15
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
- package/coverage/lcov-report/src/module.d.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +7 -16
- package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +12 -39
- package/coverage/lcov-report/src/sdk/app/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +8 -11
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +1 -1
- package/coverage/lcov-report/src/startup.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +24 -24
- package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.html +19 -19
- package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.js.html +3 -3
- package/coverage/lcov-report/src/threads/automation.ts.html +2 -2
- package/coverage/lcov-report/src/threads/index.html +1 -1
- package/coverage/lcov-report/src/threads/index.ts.html +1 -1
- package/coverage/lcov-report/src/threads/query.ts.html +1 -1
- package/coverage/lcov-report/src/threads/utils.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/src/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/src/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{global.js.html → global.ts.html} +100 -67
- package/coverage/lcov-report/src/utilities/index.html +16 -16
- package/coverage/lcov-report/src/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/plugins.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/src/utilities/redis.js.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/src/utilities/security.js.html +13 -13
- package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/src/utilities/users.js.html +1 -1
- package/coverage/lcov-report/src/utilities/workerRequests.js.html +4 -4
- package/coverage/lcov-report/src/watch.ts.html +1 -1
- package/coverage/lcov-report/src/websocket.ts.html +1 -1
- package/coverage/lcov.info +2052 -2049
- package/dist/api/controllers/application.js +35 -43
- package/dist/api/controllers/deploy/index.js +13 -16
- package/dist/api/controllers/dev.js +96 -81
- package/dist/api/controllers/public/applications.js +17 -9
- package/dist/api/controllers/query/index.js +10 -13
- package/dist/api/controllers/row/internal.js +2 -2
- package/dist/api/routes/automation.js +3 -3
- package/dist/api/routes/datasource.js +4 -4
- package/dist/api/routes/public/index.js +9 -9
- package/dist/api/routes/query.js +4 -4
- package/dist/api/routes/row.js +11 -11
- package/dist/api/routes/static.js +3 -3
- package/dist/api/routes/table.js +2 -2
- package/dist/api/routes/user.js +9 -9
- package/dist/api/routes/utils/validators.js +4 -4
- package/dist/api/routes/view.js +2 -2
- package/dist/automations/tests/utilities/index.js +21 -12
- package/dist/automations/utils.js +9 -8
- package/dist/db/inMemoryView.js +2 -2
- package/dist/db/utils.js +145 -118
- package/dist/integrations/googlesheets.js +4 -6
- package/dist/middleware/appInfo.js +14 -9
- package/dist/middleware/authorized.js +5 -5
- package/dist/middleware/builder.js +41 -40
- package/dist/middleware/currentapp.js +39 -37
- package/dist/middleware/joi-validator.js +17 -10
- package/dist/middleware/publicApi.js +5 -6
- package/dist/middleware/resourceId.js +16 -9
- package/dist/middleware/selfhost.js +5 -4
- package/dist/middleware/utils.js +5 -2
- package/dist/package.json +6 -6
- package/dist/sdk/app/tables/index.js +4 -4
- package/dist/tests/utilities/TestConfiguration.js +9 -9
- package/dist/tests/utilities/structures.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +87 -66
- package/dist/utilities/security.js +10 -10
- package/dist/utilities/workerRequests.js +3 -3
- package/jest.config.ts +1 -0
- package/package.json +7 -7
- package/src/api/controllers/application.ts +34 -39
- package/src/api/controllers/auth.ts +3 -2
- package/src/api/controllers/deploy/index.ts +13 -25
- package/src/api/controllers/{dev.js → dev.ts} +31 -37
- package/src/api/controllers/public/applications.ts +15 -9
- package/src/api/controllers/query/index.ts +11 -14
- package/src/api/controllers/row/internal.js +2 -2
- package/src/api/routes/automation.js +4 -4
- package/src/api/routes/datasource.js +5 -5
- package/src/api/routes/public/index.ts +10 -10
- package/src/api/routes/public/tests/compare.spec.js +1 -1
- package/src/api/routes/query.js +5 -5
- package/src/api/routes/row.ts +12 -12
- package/src/api/routes/static.ts +5 -5
- package/src/api/routes/table.js +3 -3
- package/src/api/routes/tests/analytics.spec.js +1 -1
- package/src/api/routes/tests/query.spec.js +15 -10
- package/src/api/routes/tests/role.spec.js +5 -5
- package/src/api/routes/tests/static.spec.js +2 -2
- package/src/api/routes/tests/table.spec.js +38 -35
- package/src/api/routes/user.js +10 -10
- package/src/api/routes/utils/validators.js +5 -5
- package/src/api/routes/view.js +3 -3
- package/src/automations/tests/updateRow.spec.js +0 -1
- package/src/automations/tests/utilities/index.js +10 -4
- package/src/automations/utils.ts +9 -12
- package/src/db/inMemoryView.js +2 -2
- package/src/db/tests/linkController.spec.js +73 -57
- package/src/db/tests/linkTests.spec.js +17 -14
- package/src/db/{utils.js → utils.ts} +76 -92
- package/src/integrations/googlesheets.ts +4 -7
- package/src/middleware/appInfo.ts +20 -0
- package/src/middleware/authorized.ts +6 -6
- package/src/middleware/{builder.js → builder.ts} +17 -15
- package/src/middleware/{currentapp.js → currentapp.ts} +42 -39
- package/src/middleware/{joi-validator.js → joi-validator.ts} +9 -8
- package/src/middleware/publicApi.ts +21 -0
- package/src/middleware/{resourceId.js → resourceId.ts} +16 -11
- package/src/middleware/{selfhost.js → selfhost.ts} +4 -2
- package/src/middleware/tests/authorized.spec.js +5 -5
- package/src/middleware/tests/currentapp.spec.js +118 -63
- package/src/middleware/{utils.js → utils.ts} +3 -1
- package/src/migrations/functions/backfill/app/tables.ts +2 -5
- package/src/sdk/app/backups/imports.ts +4 -7
- package/src/sdk/app/backups/statistics.ts +9 -18
- package/src/sdk/app/tables/index.ts +6 -7
- package/src/tests/utilities/TestConfiguration.js +9 -9
- package/src/tests/utilities/structures.js +2 -2
- package/src/threads/automation.ts +1 -1
- package/src/utilities/global.ts +138 -0
- package/src/utilities/security.js +12 -12
- package/src/utilities/workerRequests.js +3 -3
- package/src/middleware/appInfo.js +0 -19
- package/src/middleware/publicApi.js +0 -21
- package/src/utilities/global.js +0 -127
|
@@ -1,29 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const { getProdAppDB, getAppDB } = require("@budibase/backend-core/context")
|
|
10
|
-
const { events } = require("@budibase/backend-core")
|
|
1
|
+
import fetch from "node-fetch"
|
|
2
|
+
import env from "../../environment"
|
|
3
|
+
import { checkSlashesInUrl } from "../../utilities"
|
|
4
|
+
import { request } from "../../utilities/workerRequests"
|
|
5
|
+
import { clearLock as redisClearLock } from "../../utilities/redis"
|
|
6
|
+
import { DocumentType } from "../../db/utils"
|
|
7
|
+
import { context } from "@budibase/backend-core"
|
|
8
|
+
import { events, db as dbCore, cache } from "@budibase/backend-core"
|
|
11
9
|
|
|
12
|
-
async function redirect(ctx, method, path = "global") {
|
|
10
|
+
async function redirect(ctx: any, method: string, path: string = "global") {
|
|
13
11
|
const { devPath } = ctx.params
|
|
14
12
|
const queryString = ctx.originalUrl.split("?")[1] || ""
|
|
15
13
|
const response = await fetch(
|
|
16
14
|
checkSlashesInUrl(
|
|
17
15
|
`${env.WORKER_URL}/api/${path}/${devPath}?${queryString}`
|
|
18
16
|
),
|
|
19
|
-
request(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
body: ctx.request.body,
|
|
24
|
-
},
|
|
25
|
-
true
|
|
26
|
-
)
|
|
17
|
+
request(ctx, {
|
|
18
|
+
method,
|
|
19
|
+
body: ctx.request.body,
|
|
20
|
+
})
|
|
27
21
|
)
|
|
28
22
|
if (response.status !== 200) {
|
|
29
23
|
const err = await response.text()
|
|
@@ -46,28 +40,28 @@ async function redirect(ctx, method, path = "global") {
|
|
|
46
40
|
ctx.cookies
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
return async ctx => {
|
|
43
|
+
export function buildRedirectGet(path: string) {
|
|
44
|
+
return async (ctx: any) => {
|
|
51
45
|
await redirect(ctx, "GET", path)
|
|
52
46
|
}
|
|
53
47
|
}
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
return async ctx => {
|
|
49
|
+
export function buildRedirectPost(path: string) {
|
|
50
|
+
return async (ctx: any) => {
|
|
57
51
|
await redirect(ctx, "POST", path)
|
|
58
52
|
}
|
|
59
53
|
}
|
|
60
54
|
|
|
61
|
-
|
|
62
|
-
return async ctx => {
|
|
55
|
+
export function buildRedirectDelete(path: string) {
|
|
56
|
+
return async (ctx: any) => {
|
|
63
57
|
await redirect(ctx, "DELETE", path)
|
|
64
58
|
}
|
|
65
59
|
}
|
|
66
60
|
|
|
67
|
-
|
|
61
|
+
export async function clearLock(ctx: any) {
|
|
68
62
|
const { appId } = ctx.params
|
|
69
63
|
try {
|
|
70
|
-
await
|
|
64
|
+
await redisClearLock(appId, ctx.user)
|
|
71
65
|
} catch (err) {
|
|
72
66
|
ctx.throw(400, `Unable to remove lock. ${err}`)
|
|
73
67
|
}
|
|
@@ -76,16 +70,16 @@ exports.clearLock = async ctx => {
|
|
|
76
70
|
}
|
|
77
71
|
}
|
|
78
72
|
|
|
79
|
-
|
|
73
|
+
export async function revert(ctx: any) {
|
|
80
74
|
const { appId } = ctx.params
|
|
81
|
-
const productionAppId = getProdAppID(appId)
|
|
75
|
+
const productionAppId = dbCore.getProdAppID(appId)
|
|
82
76
|
|
|
83
77
|
// App must have been deployed first
|
|
84
78
|
try {
|
|
85
|
-
const db = getProdAppDB({ skip_setup: true })
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
throw
|
|
79
|
+
const db = context.getProdAppDB({ skip_setup: true })
|
|
80
|
+
const exists = await db.exists()
|
|
81
|
+
if (!exists) {
|
|
82
|
+
throw new Error("App must be deployed to be reverted.")
|
|
89
83
|
}
|
|
90
84
|
const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS)
|
|
91
85
|
if (
|
|
@@ -98,7 +92,7 @@ exports.revert = async ctx => {
|
|
|
98
92
|
return ctx.throw(400, "App has not yet been deployed")
|
|
99
93
|
}
|
|
100
94
|
|
|
101
|
-
const replication = new Replication({
|
|
95
|
+
const replication = new dbCore.Replication({
|
|
102
96
|
source: productionAppId,
|
|
103
97
|
target: appId,
|
|
104
98
|
})
|
|
@@ -109,12 +103,12 @@ exports.revert = async ctx => {
|
|
|
109
103
|
}
|
|
110
104
|
|
|
111
105
|
// update appID in reverted app to be dev version again
|
|
112
|
-
const db = getAppDB()
|
|
106
|
+
const db = context.getAppDB()
|
|
113
107
|
const appDoc = await db.get(DocumentType.APP_METADATA)
|
|
114
108
|
appDoc.appId = appId
|
|
115
109
|
appDoc.instance._id = appId
|
|
116
110
|
await db.put(appDoc)
|
|
117
|
-
await
|
|
111
|
+
await cache.app.invalidateAppMetadata(appId)
|
|
118
112
|
ctx.body = {
|
|
119
113
|
message: "Reverted changes successfully.",
|
|
120
114
|
}
|
|
@@ -126,7 +120,7 @@ exports.revert = async ctx => {
|
|
|
126
120
|
}
|
|
127
121
|
}
|
|
128
122
|
|
|
129
|
-
|
|
123
|
+
export async function getBudibaseVersion(ctx: any) {
|
|
130
124
|
const version = require("../../../package.json").version
|
|
131
125
|
ctx.body = {
|
|
132
126
|
version,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
const { doInAppContext } = require("@budibase/backend-core/context")
|
|
1
|
+
import { db as dbCore, context } from "@budibase/backend-core"
|
|
3
2
|
import { search as stringSearch, addRev } from "./utils"
|
|
4
3
|
import * as controller from "../application"
|
|
5
4
|
import { Application } from "../../../definitions/common"
|
|
@@ -15,15 +14,22 @@ function fixAppID(app: Application, params: any) {
|
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
async function setResponseApp(ctx: any) {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const appId = ctx.body?.appId
|
|
18
|
+
if (appId && (!ctx.params || !ctx.params.appId)) {
|
|
19
|
+
ctx.params = { appId }
|
|
20
|
+
}
|
|
21
|
+
if (appId) {
|
|
22
|
+
await context.doInContext(appId, () => {
|
|
23
|
+
return controller.fetchAppPackage(ctx)
|
|
24
|
+
})
|
|
25
|
+
} else {
|
|
26
|
+
return controller.fetchAppPackage(ctx)
|
|
20
27
|
}
|
|
21
|
-
await controller.fetchAppPackage(ctx)
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
export async function search(ctx: any, next: any) {
|
|
25
31
|
const { name } = ctx.request.body
|
|
26
|
-
const apps = await getAllApps({ all: true })
|
|
32
|
+
const apps = await dbCore.getAllApps({ all: true })
|
|
27
33
|
ctx.body = stringSearch(apps, name)
|
|
28
34
|
await next()
|
|
29
35
|
}
|
|
@@ -41,7 +47,7 @@ export async function create(ctx: any, next: any) {
|
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
export async function read(ctx: any, next: any) {
|
|
44
|
-
await doInAppContext(ctx.params.appId, async () => {
|
|
50
|
+
await context.doInAppContext(ctx.params.appId, async () => {
|
|
45
51
|
await setResponseApp(ctx)
|
|
46
52
|
await next()
|
|
47
53
|
})
|
|
@@ -49,7 +55,7 @@ export async function read(ctx: any, next: any) {
|
|
|
49
55
|
|
|
50
56
|
export async function update(ctx: any, next: any) {
|
|
51
57
|
ctx.request.body = await addRev(fixAppID(ctx.request.body, ctx.params))
|
|
52
|
-
await doInAppContext(ctx.params.appId, async () => {
|
|
58
|
+
await context.doInAppContext(ctx.params.appId, async () => {
|
|
53
59
|
await controller.update(ctx)
|
|
54
60
|
await setResponseApp(ctx)
|
|
55
61
|
await next()
|
|
@@ -57,7 +63,7 @@ export async function update(ctx: any, next: any) {
|
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
export async function destroy(ctx: any, next: any) {
|
|
60
|
-
await doInAppContext(ctx.params.appId, async () => {
|
|
66
|
+
await context.doInAppContext(ctx.params.appId, async () => {
|
|
61
67
|
// get the app before deleting it
|
|
62
68
|
await setResponseApp(ctx)
|
|
63
69
|
const body = ctx.body
|
|
@@ -5,11 +5,8 @@ import { save as saveDatasource } from "../datasource"
|
|
|
5
5
|
import { RestImporter } from "./import"
|
|
6
6
|
import { invalidateDynamicVariables } from "../../../threads/utils"
|
|
7
7
|
import { QUERY_THREAD_TIMEOUT } from "../../../environment"
|
|
8
|
-
import { getAppDB } from "@budibase/backend-core/context"
|
|
9
8
|
import { quotas } from "@budibase/pro"
|
|
10
|
-
import { events } from "@budibase/backend-core"
|
|
11
|
-
import { getCookie } from "@budibase/backend-core/utils"
|
|
12
|
-
import { Cookies, Configs } from "@budibase/backend-core/constants"
|
|
9
|
+
import { events, context, utils, constants } from "@budibase/backend-core"
|
|
13
10
|
|
|
14
11
|
const Runner = new Thread(ThreadType.QUERY, {
|
|
15
12
|
timeoutMs: QUERY_THREAD_TIMEOUT || 10000,
|
|
@@ -28,7 +25,7 @@ function enrichQueries(input: any) {
|
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
export async function fetch(ctx: any) {
|
|
31
|
-
const db = getAppDB()
|
|
28
|
+
const db = context.getAppDB()
|
|
32
29
|
|
|
33
30
|
const body = await db.allDocs(
|
|
34
31
|
getQueryParams(null, {
|
|
@@ -81,7 +78,7 @@ const _import = async (ctx: any) => {
|
|
|
81
78
|
export { _import as import }
|
|
82
79
|
|
|
83
80
|
export async function save(ctx: any) {
|
|
84
|
-
const db = getAppDB()
|
|
81
|
+
const db = context.getAppDB()
|
|
85
82
|
const query = ctx.request.body
|
|
86
83
|
|
|
87
84
|
const datasource = await db.get(query.datasourceId)
|
|
@@ -103,7 +100,7 @@ export async function save(ctx: any) {
|
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
export async function find(ctx: any) {
|
|
106
|
-
const db = getAppDB()
|
|
103
|
+
const db = context.getAppDB()
|
|
107
104
|
const query = enrichQueries(await db.get(ctx.params.queryId))
|
|
108
105
|
// remove properties that could be dangerous in real app
|
|
109
106
|
if (isProdAppID(ctx.appId)) {
|
|
@@ -115,13 +112,13 @@ export async function find(ctx: any) {
|
|
|
115
112
|
|
|
116
113
|
//Required to discern between OIDC OAuth config entries
|
|
117
114
|
function getOAuthConfigCookieId(ctx: any) {
|
|
118
|
-
if (ctx.user.providerType ===
|
|
119
|
-
return getCookie(ctx,
|
|
115
|
+
if (ctx.user.providerType === constants.Config.OIDC) {
|
|
116
|
+
return utils.getCookie(ctx, constants.Cookie.OIDC_CONFIG)
|
|
120
117
|
}
|
|
121
118
|
}
|
|
122
119
|
|
|
123
120
|
function getAuthConfig(ctx: any) {
|
|
124
|
-
const authCookie = getCookie(ctx,
|
|
121
|
+
const authCookie = utils.getCookie(ctx, constants.Cookie.Auth)
|
|
125
122
|
let authConfigCtx: any = {}
|
|
126
123
|
authConfigCtx["configId"] = getOAuthConfigCookieId(ctx)
|
|
127
124
|
authConfigCtx["sessionId"] = authCookie ? authCookie.sessionId : null
|
|
@@ -129,7 +126,7 @@ function getAuthConfig(ctx: any) {
|
|
|
129
126
|
}
|
|
130
127
|
|
|
131
128
|
export async function preview(ctx: any) {
|
|
132
|
-
const db = getAppDB()
|
|
129
|
+
const db = context.getAppDB()
|
|
133
130
|
|
|
134
131
|
const datasource = await db.get(ctx.request.body.datasourceId)
|
|
135
132
|
const query = ctx.request.body
|
|
@@ -201,7 +198,7 @@ async function execute(
|
|
|
201
198
|
ctx: any,
|
|
202
199
|
opts: any = { rowsOnly: false, isAutomation: false }
|
|
203
200
|
) {
|
|
204
|
-
const db = getAppDB()
|
|
201
|
+
const db = context.getAppDB()
|
|
205
202
|
|
|
206
203
|
const query = await db.get(ctx.params.queryId)
|
|
207
204
|
const datasource = await db.get(query.datasourceId)
|
|
@@ -267,7 +264,7 @@ export async function executeV2(
|
|
|
267
264
|
}
|
|
268
265
|
|
|
269
266
|
const removeDynamicVariables = async (queryId: any) => {
|
|
270
|
-
const db = getAppDB()
|
|
267
|
+
const db = context.getAppDB()
|
|
271
268
|
const query = await db.get(queryId)
|
|
272
269
|
const datasource = await db.get(query.datasourceId)
|
|
273
270
|
const dynamicVariables = datasource.config.dynamicVariables
|
|
@@ -288,7 +285,7 @@ const removeDynamicVariables = async (queryId: any) => {
|
|
|
288
285
|
}
|
|
289
286
|
|
|
290
287
|
export async function destroy(ctx: any) {
|
|
291
|
-
const db = getAppDB()
|
|
288
|
+
const db = context.getAppDB()
|
|
292
289
|
const queryId = ctx.params.queryId
|
|
293
290
|
await removeDynamicVariables(queryId)
|
|
294
291
|
const query = await db.get(queryId)
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
DocumentType,
|
|
7
7
|
InternalTables,
|
|
8
8
|
} = require("../../../db/utils")
|
|
9
|
-
const {
|
|
9
|
+
const { getDB } = require("@budibase/backend-core/db")
|
|
10
10
|
const userController = require("../user")
|
|
11
11
|
const {
|
|
12
12
|
inputProcessing,
|
|
@@ -251,7 +251,7 @@ exports.fetch = async ctx => {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
exports.find = async ctx => {
|
|
254
|
-
const db =
|
|
254
|
+
const db = getDB(ctx.appId)
|
|
255
255
|
const table = await db.get(ctx.params.tableId)
|
|
256
256
|
let row = await findRow(ctx, ctx.params.tableId, ctx.params.rowId)
|
|
257
257
|
row = await outputProcessing(table, row)
|
|
@@ -3,8 +3,8 @@ const controller = require("../controllers/automation")
|
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
4
|
const {
|
|
5
5
|
BUILDER,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
PermissionLevel,
|
|
7
|
+
PermissionType,
|
|
8
8
|
} = require("@budibase/backend-core/permissions")
|
|
9
9
|
const { bodyResource, paramResource } = require("../../middleware/resourceId")
|
|
10
10
|
const {
|
|
@@ -71,14 +71,14 @@ router
|
|
|
71
71
|
"/api/automations/:id/trigger",
|
|
72
72
|
appInfoMiddleware({ appType: AppType.PROD }),
|
|
73
73
|
paramResource("id"),
|
|
74
|
-
authorized(
|
|
74
|
+
authorized(PermissionType.AUTOMATION, PermissionLevel.EXECUTE),
|
|
75
75
|
controller.trigger
|
|
76
76
|
)
|
|
77
77
|
.post(
|
|
78
78
|
"/api/automations/:id/test",
|
|
79
79
|
appInfoMiddleware({ appType: AppType.DEV }),
|
|
80
80
|
paramResource("id"),
|
|
81
|
-
authorized(
|
|
81
|
+
authorized(PermissionType.AUTOMATION, PermissionLevel.EXECUTE),
|
|
82
82
|
controller.test
|
|
83
83
|
)
|
|
84
84
|
|
|
@@ -3,8 +3,8 @@ const datasourceController = require("../controllers/datasource")
|
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
4
|
const {
|
|
5
5
|
BUILDER,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
PermissionLevel,
|
|
7
|
+
PermissionType,
|
|
8
8
|
} = require("@budibase/backend-core/permissions")
|
|
9
9
|
const {
|
|
10
10
|
datasourceValidator,
|
|
@@ -17,17 +17,17 @@ router
|
|
|
17
17
|
.get("/api/datasources", authorized(BUILDER), datasourceController.fetch)
|
|
18
18
|
.get(
|
|
19
19
|
"/api/datasources/:datasourceId",
|
|
20
|
-
authorized(
|
|
20
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
21
21
|
datasourceController.find
|
|
22
22
|
)
|
|
23
23
|
.put(
|
|
24
24
|
"/api/datasources/:datasourceId",
|
|
25
|
-
authorized(
|
|
25
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
26
26
|
datasourceController.update
|
|
27
27
|
)
|
|
28
28
|
.post(
|
|
29
29
|
"/api/datasources/query",
|
|
30
|
-
authorized(
|
|
30
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
31
31
|
datasourceQueryValidator(),
|
|
32
32
|
datasourceController.query
|
|
33
33
|
)
|
|
@@ -13,8 +13,8 @@ import env from "../../../environment"
|
|
|
13
13
|
const Router = require("@koa/router")
|
|
14
14
|
const { RateLimit, Stores } = require("koa2-ratelimit")
|
|
15
15
|
const {
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
PermissionLevel,
|
|
17
|
+
PermissionType,
|
|
18
18
|
} = require("@budibase/backend-core/permissions")
|
|
19
19
|
const { getRedisOptions } = require("@budibase/backend-core/redis").utils
|
|
20
20
|
|
|
@@ -105,7 +105,7 @@ function applyRoutes(
|
|
|
105
105
|
: paramResource(resource)
|
|
106
106
|
const publicApiMiddleware = publicApi({
|
|
107
107
|
requiresAppId:
|
|
108
|
-
permType !==
|
|
108
|
+
permType !== PermissionType.APP && permType !== PermissionType.USER,
|
|
109
109
|
})
|
|
110
110
|
addMiddleware(endpoints.read, publicApiMiddleware)
|
|
111
111
|
addMiddleware(endpoints.write, publicApiMiddleware)
|
|
@@ -113,8 +113,8 @@ function applyRoutes(
|
|
|
113
113
|
addMiddleware(endpoints.read, paramMiddleware)
|
|
114
114
|
addMiddleware(endpoints.write, paramMiddleware)
|
|
115
115
|
// add the authorization middleware, using the correct perm type
|
|
116
|
-
addMiddleware(endpoints.read, authorized(permType,
|
|
117
|
-
addMiddleware(endpoints.write, authorized(permType,
|
|
116
|
+
addMiddleware(endpoints.read, authorized(permType, PermissionLevel.READ))
|
|
117
|
+
addMiddleware(endpoints.write, authorized(permType, PermissionLevel.WRITE))
|
|
118
118
|
// add the output mapper middleware
|
|
119
119
|
addMiddleware(endpoints.read, mapperMiddleware, { output: true })
|
|
120
120
|
addMiddleware(endpoints.write, mapperMiddleware, { output: true })
|
|
@@ -122,12 +122,12 @@ function applyRoutes(
|
|
|
122
122
|
addToRouter(endpoints.write)
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
applyRoutes(appEndpoints,
|
|
126
|
-
applyRoutes(tableEndpoints,
|
|
127
|
-
applyRoutes(userEndpoints,
|
|
128
|
-
applyRoutes(queryEndpoints,
|
|
125
|
+
applyRoutes(appEndpoints, PermissionType.APP, "appId")
|
|
126
|
+
applyRoutes(tableEndpoints, PermissionType.TABLE, "tableId")
|
|
127
|
+
applyRoutes(userEndpoints, PermissionType.USER, "userId")
|
|
128
|
+
applyRoutes(queryEndpoints, PermissionType.QUERY, "queryId")
|
|
129
129
|
// needs to be applied last for routing purposes, don't override other endpoints
|
|
130
|
-
applyRoutes(rowEndpoints,
|
|
130
|
+
applyRoutes(rowEndpoints, PermissionType.TABLE, "tableId", "rowId")
|
|
131
131
|
|
|
132
132
|
export default publicRouter
|
|
133
133
|
|
|
@@ -31,7 +31,7 @@ async function makeRequest(method, endpoint, body, appId = config.getAppId()) {
|
|
|
31
31
|
if (body) {
|
|
32
32
|
req.send(body)
|
|
33
33
|
}
|
|
34
|
-
const res = await req
|
|
34
|
+
const res = await req
|
|
35
35
|
expect(res.body).toBeDefined()
|
|
36
36
|
return res
|
|
37
37
|
}
|
package/src/api/routes/query.js
CHANGED
|
@@ -2,8 +2,8 @@ const Router = require("@koa/router")
|
|
|
2
2
|
const queryController = require("../controllers/query")
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
4
|
const {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
PermissionLevel,
|
|
6
|
+
PermissionType,
|
|
7
7
|
BUILDER,
|
|
8
8
|
} = require("@budibase/backend-core/permissions")
|
|
9
9
|
const {
|
|
@@ -38,20 +38,20 @@ router
|
|
|
38
38
|
.get(
|
|
39
39
|
"/api/queries/:queryId",
|
|
40
40
|
paramResource("queryId"),
|
|
41
|
-
authorized(
|
|
41
|
+
authorized(PermissionType.QUERY, PermissionLevel.READ),
|
|
42
42
|
queryController.find
|
|
43
43
|
)
|
|
44
44
|
// DEPRECATED - use new query endpoint for future work
|
|
45
45
|
.post(
|
|
46
46
|
"/api/queries/:queryId",
|
|
47
47
|
paramResource("queryId"),
|
|
48
|
-
authorized(
|
|
48
|
+
authorized(PermissionType.QUERY, PermissionLevel.WRITE),
|
|
49
49
|
queryController.executeV1
|
|
50
50
|
)
|
|
51
51
|
.post(
|
|
52
52
|
"/api/v2/queries/:queryId",
|
|
53
53
|
paramResource("queryId"),
|
|
54
|
-
authorized(
|
|
54
|
+
authorized(PermissionType.QUERY, PermissionLevel.WRITE),
|
|
55
55
|
queryController.executeV2
|
|
56
56
|
)
|
|
57
57
|
.delete(
|
package/src/api/routes/row.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as rowController from "../controllers/row"
|
|
|
3
3
|
import authorized from "../../middleware/authorized"
|
|
4
4
|
import { paramResource, paramSubResource } from "../../middleware/resourceId"
|
|
5
5
|
const {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
PermissionLevel,
|
|
7
|
+
PermissionType,
|
|
8
8
|
} = require("@budibase/backend-core/permissions")
|
|
9
9
|
const { internalSearchValidator } = require("./utils/validators")
|
|
10
10
|
|
|
@@ -28,7 +28,7 @@ router
|
|
|
28
28
|
.get(
|
|
29
29
|
"/api/:tableId/:rowId/enrich",
|
|
30
30
|
paramSubResource("tableId", "rowId"),
|
|
31
|
-
authorized(
|
|
31
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
32
32
|
rowController.fetchEnrichedRow
|
|
33
33
|
)
|
|
34
34
|
/**
|
|
@@ -48,7 +48,7 @@ router
|
|
|
48
48
|
.get(
|
|
49
49
|
"/api/:tableId/rows",
|
|
50
50
|
paramResource("tableId"),
|
|
51
|
-
authorized(
|
|
51
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
52
52
|
rowController.fetch
|
|
53
53
|
)
|
|
54
54
|
/**
|
|
@@ -67,7 +67,7 @@ router
|
|
|
67
67
|
.get(
|
|
68
68
|
"/api/:tableId/rows/:rowId",
|
|
69
69
|
paramSubResource("tableId", "rowId"),
|
|
70
|
-
authorized(
|
|
70
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
71
71
|
rowController.find
|
|
72
72
|
)
|
|
73
73
|
/**
|
|
@@ -137,7 +137,7 @@ router
|
|
|
137
137
|
"/api/:tableId/search",
|
|
138
138
|
internalSearchValidator(),
|
|
139
139
|
paramResource("tableId"),
|
|
140
|
-
authorized(
|
|
140
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
141
141
|
rowController.search
|
|
142
142
|
)
|
|
143
143
|
// DEPRECATED - this is an old API, but for backwards compat it needs to be
|
|
@@ -145,7 +145,7 @@ router
|
|
|
145
145
|
.post(
|
|
146
146
|
"/api/search/:tableId/rows",
|
|
147
147
|
paramResource("tableId"),
|
|
148
|
-
authorized(
|
|
148
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
149
149
|
rowController.search
|
|
150
150
|
)
|
|
151
151
|
/**
|
|
@@ -175,7 +175,7 @@ router
|
|
|
175
175
|
.post(
|
|
176
176
|
"/api/:tableId/rows",
|
|
177
177
|
paramResource("tableId"),
|
|
178
|
-
authorized(
|
|
178
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
179
179
|
rowController.save
|
|
180
180
|
)
|
|
181
181
|
/**
|
|
@@ -189,7 +189,7 @@ router
|
|
|
189
189
|
.patch(
|
|
190
190
|
"/api/:tableId/rows",
|
|
191
191
|
paramResource("tableId"),
|
|
192
|
-
authorized(
|
|
192
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
193
193
|
rowController.patch
|
|
194
194
|
)
|
|
195
195
|
/**
|
|
@@ -215,7 +215,7 @@ router
|
|
|
215
215
|
.post(
|
|
216
216
|
"/api/:tableId/rows/validate",
|
|
217
217
|
paramResource("tableId"),
|
|
218
|
-
authorized(
|
|
218
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
219
219
|
rowController.validate
|
|
220
220
|
)
|
|
221
221
|
/**
|
|
@@ -241,7 +241,7 @@ router
|
|
|
241
241
|
.delete(
|
|
242
242
|
"/api/:tableId/rows",
|
|
243
243
|
paramResource("tableId"),
|
|
244
|
-
authorized(
|
|
244
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
245
245
|
rowController.destroy
|
|
246
246
|
)
|
|
247
247
|
|
|
@@ -261,7 +261,7 @@ router
|
|
|
261
261
|
.post(
|
|
262
262
|
"/api/:tableId/rows/exportRows",
|
|
263
263
|
paramResource("tableId"),
|
|
264
|
-
authorized(
|
|
264
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
265
265
|
rowController.exportRows
|
|
266
266
|
)
|
|
267
267
|
|
package/src/api/routes/static.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { budibaseTempDir } from "../../utilities/budibaseDir"
|
|
|
4
4
|
import authorized from "../../middleware/authorized"
|
|
5
5
|
import {
|
|
6
6
|
BUILDER,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
PermissionType,
|
|
8
|
+
PermissionLevel,
|
|
9
9
|
} from "@budibase/backend-core/permissions"
|
|
10
10
|
import * as env from "../../environment"
|
|
11
11
|
import { paramResource } from "../../middleware/resourceId"
|
|
@@ -47,13 +47,13 @@ router
|
|
|
47
47
|
.post(
|
|
48
48
|
"/api/attachments/:tableId/upload",
|
|
49
49
|
paramResource("tableId"),
|
|
50
|
-
authorized(
|
|
50
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
51
51
|
controller.uploadFile
|
|
52
52
|
)
|
|
53
53
|
.post(
|
|
54
54
|
"/api/attachments/:tableId/delete",
|
|
55
55
|
paramResource("tableId"),
|
|
56
|
-
authorized(
|
|
56
|
+
authorized(PermissionType.TABLE, PermissionLevel.WRITE),
|
|
57
57
|
controller.deleteObjects
|
|
58
58
|
)
|
|
59
59
|
.get("/app/preview", authorized(BUILDER), controller.serveBuilderPreview)
|
|
@@ -61,7 +61,7 @@ router
|
|
|
61
61
|
.get("/app/:appUrl/:path*", controller.serveApp)
|
|
62
62
|
.post(
|
|
63
63
|
"/api/attachments/:datasourceId/url",
|
|
64
|
-
authorized(
|
|
64
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ),
|
|
65
65
|
controller.getSignedUploadURL
|
|
66
66
|
)
|
|
67
67
|
|
package/src/api/routes/table.js
CHANGED
|
@@ -4,8 +4,8 @@ const authorized = require("../../middleware/authorized")
|
|
|
4
4
|
const { paramResource, bodyResource } = require("../../middleware/resourceId")
|
|
5
5
|
const {
|
|
6
6
|
BUILDER,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
PermissionLevel,
|
|
8
|
+
PermissionType,
|
|
9
9
|
} = require("@budibase/backend-core/permissions")
|
|
10
10
|
const { tableValidator } = require("./utils/validators")
|
|
11
11
|
|
|
@@ -40,7 +40,7 @@ router
|
|
|
40
40
|
.get(
|
|
41
41
|
"/api/tables/:tableId",
|
|
42
42
|
paramResource("tableId"),
|
|
43
|
-
authorized(
|
|
43
|
+
authorized(PermissionType.TABLE, PermissionLevel.READ, { schema: true }),
|
|
44
44
|
tableController.find
|
|
45
45
|
)
|
|
46
46
|
/**
|
|
@@ -43,7 +43,7 @@ describe("/static", () => {
|
|
|
43
43
|
|
|
44
44
|
it("should ping from app", async () => {
|
|
45
45
|
const headers = config.defaultHeaders()
|
|
46
|
-
headers[constants.
|
|
46
|
+
headers[constants.Header.APP_ID] = config.prodAppId
|
|
47
47
|
|
|
48
48
|
await request
|
|
49
49
|
.post("/api/bbtel/ping")
|