@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
|
@@ -17,11 +17,8 @@ const datasource_1 = require("../datasource");
|
|
|
17
17
|
const import_1 = require("./import");
|
|
18
18
|
const utils_2 = require("../../../threads/utils");
|
|
19
19
|
const environment_1 = require("../../../environment");
|
|
20
|
-
const context_1 = require("@budibase/backend-core/context");
|
|
21
20
|
const pro_1 = require("@budibase/pro");
|
|
22
21
|
const backend_core_1 = require("@budibase/backend-core");
|
|
23
|
-
const utils_3 = require("@budibase/backend-core/utils");
|
|
24
|
-
const constants_2 = require("@budibase/backend-core/constants");
|
|
25
22
|
const Runner = new threads_1.Thread(threads_1.ThreadType.QUERY, {
|
|
26
23
|
timeoutMs: environment_1.QUERY_THREAD_TIMEOUT || 10000,
|
|
27
24
|
});
|
|
@@ -38,7 +35,7 @@ function enrichQueries(input) {
|
|
|
38
35
|
}
|
|
39
36
|
function fetch(ctx) {
|
|
40
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const db =
|
|
38
|
+
const db = backend_core_1.context.getAppDB();
|
|
42
39
|
const body = yield db.allDocs((0, utils_1.getQueryParams)(null, {
|
|
43
40
|
include_docs: true,
|
|
44
41
|
}));
|
|
@@ -82,7 +79,7 @@ const _import = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
82
79
|
exports.import = _import;
|
|
83
80
|
function save(ctx) {
|
|
84
81
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
const db =
|
|
82
|
+
const db = backend_core_1.context.getAppDB();
|
|
86
83
|
const query = ctx.request.body;
|
|
87
84
|
const datasource = yield db.get(query.datasourceId);
|
|
88
85
|
let eventFn;
|
|
@@ -103,7 +100,7 @@ function save(ctx) {
|
|
|
103
100
|
exports.save = save;
|
|
104
101
|
function find(ctx) {
|
|
105
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
const db =
|
|
103
|
+
const db = backend_core_1.context.getAppDB();
|
|
107
104
|
const query = enrichQueries(yield db.get(ctx.params.queryId));
|
|
108
105
|
// remove properties that could be dangerous in real app
|
|
109
106
|
if ((0, utils_1.isProdAppID)(ctx.appId)) {
|
|
@@ -116,12 +113,12 @@ function find(ctx) {
|
|
|
116
113
|
exports.find = find;
|
|
117
114
|
//Required to discern between OIDC OAuth config entries
|
|
118
115
|
function getOAuthConfigCookieId(ctx) {
|
|
119
|
-
if (ctx.user.providerType ===
|
|
120
|
-
return
|
|
116
|
+
if (ctx.user.providerType === backend_core_1.constants.Config.OIDC) {
|
|
117
|
+
return backend_core_1.utils.getCookie(ctx, backend_core_1.constants.Cookie.OIDC_CONFIG);
|
|
121
118
|
}
|
|
122
119
|
}
|
|
123
120
|
function getAuthConfig(ctx) {
|
|
124
|
-
const authCookie =
|
|
121
|
+
const authCookie = backend_core_1.utils.getCookie(ctx, backend_core_1.constants.Cookie.Auth);
|
|
125
122
|
let authConfigCtx = {};
|
|
126
123
|
authConfigCtx["configId"] = getOAuthConfigCookieId(ctx);
|
|
127
124
|
authConfigCtx["sessionId"] = authCookie ? authCookie.sessionId : null;
|
|
@@ -129,7 +126,7 @@ function getAuthConfig(ctx) {
|
|
|
129
126
|
}
|
|
130
127
|
function preview(ctx) {
|
|
131
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
const db =
|
|
129
|
+
const db = backend_core_1.context.getAppDB();
|
|
133
130
|
const datasource = yield db.get(ctx.request.body.datasourceId);
|
|
134
131
|
const query = ctx.request.body;
|
|
135
132
|
// preview may not have a queryId as it hasn't been saved, but if it does
|
|
@@ -197,7 +194,7 @@ function preview(ctx) {
|
|
|
197
194
|
exports.preview = preview;
|
|
198
195
|
function execute(ctx, opts = { rowsOnly: false, isAutomation: false }) {
|
|
199
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
const db =
|
|
197
|
+
const db = backend_core_1.context.getAppDB();
|
|
201
198
|
const query = yield db.get(ctx.params.queryId);
|
|
202
199
|
const datasource = yield db.get(query.datasourceId);
|
|
203
200
|
let authConfigCtx = {};
|
|
@@ -261,7 +258,7 @@ function executeV2(ctx, { isAutomation } = {}) {
|
|
|
261
258
|
}
|
|
262
259
|
exports.executeV2 = executeV2;
|
|
263
260
|
const removeDynamicVariables = (queryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
264
|
-
const db =
|
|
261
|
+
const db = backend_core_1.context.getAppDB();
|
|
265
262
|
const query = yield db.get(queryId);
|
|
266
263
|
const datasource = yield db.get(query.datasourceId);
|
|
267
264
|
const dynamicVariables = datasource.config.dynamicVariables;
|
|
@@ -276,7 +273,7 @@ const removeDynamicVariables = (queryId) => __awaiter(void 0, void 0, void 0, fu
|
|
|
276
273
|
});
|
|
277
274
|
function destroy(ctx) {
|
|
278
275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
|
-
const db =
|
|
276
|
+
const db = backend_core_1.context.getAppDB();
|
|
280
277
|
const queryId = ctx.params.queryId;
|
|
281
278
|
yield removeDynamicVariables(queryId);
|
|
282
279
|
const query = yield db.get(queryId);
|
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
const linkRows = require("../../../db/linkedRows");
|
|
23
23
|
const { generateRowID, getRowParams, getTableIDFromRowID, DocumentType, InternalTables, } = require("../../../db/utils");
|
|
24
|
-
const {
|
|
24
|
+
const { getDB } = require("@budibase/backend-core/db");
|
|
25
25
|
const userController = require("../user");
|
|
26
26
|
const { inputProcessing, outputProcessing, cleanupAttachments, } = require("../../../utilities/rowProcessor");
|
|
27
27
|
const { FieldTypes } = require("../../../constants");
|
|
@@ -234,7 +234,7 @@ exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
234
234
|
return outputProcessing(table, rows);
|
|
235
235
|
});
|
|
236
236
|
exports.find = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
237
|
-
const db =
|
|
237
|
+
const db = getDB(ctx.appId);
|
|
238
238
|
const table = yield db.get(ctx.params.tableId);
|
|
239
239
|
let row = yield findRow(ctx, ctx.params.tableId, ctx.params.rowId);
|
|
240
240
|
row = yield outputProcessing(table, row);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const controller = require("../controllers/automation");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
-
const { BUILDER,
|
|
5
|
+
const { BUILDER, PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { bodyResource, paramResource } = require("../../middleware/resourceId");
|
|
7
7
|
const { middleware: appInfoMiddleware, AppType, } = require("../../middleware/appInfo");
|
|
8
8
|
const { automationValidator } = require("./utils/validators");
|
|
@@ -18,6 +18,6 @@ router
|
|
|
18
18
|
.post("/api/automations/logs/search", authorized(BUILDER), controller.logSearch)
|
|
19
19
|
.delete("/api/automations/logs", authorized(BUILDER), controller.clearLogError)
|
|
20
20
|
.delete("/api/automations/:id/:rev", paramResource("id"), authorized(BUILDER), controller.destroy)
|
|
21
|
-
.post("/api/automations/:id/trigger", appInfoMiddleware({ appType: AppType.PROD }), paramResource("id"), authorized(
|
|
22
|
-
.post("/api/automations/:id/test", appInfoMiddleware({ appType: AppType.DEV }), paramResource("id"), authorized(
|
|
21
|
+
.post("/api/automations/:id/trigger", appInfoMiddleware({ appType: AppType.PROD }), paramResource("id"), authorized(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), controller.trigger)
|
|
22
|
+
.post("/api/automations/:id/test", appInfoMiddleware({ appType: AppType.DEV }), paramResource("id"), authorized(PermissionType.AUTOMATION, PermissionLevel.EXECUTE), controller.test);
|
|
23
23
|
module.exports = router;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const datasourceController = require("../controllers/datasource");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
-
const { BUILDER,
|
|
5
|
+
const { BUILDER, PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { datasourceValidator, datasourceQueryValidator, } = require("./utils/validators");
|
|
7
7
|
const router = new Router();
|
|
8
8
|
router
|
|
9
9
|
.get("/api/datasources", authorized(BUILDER), datasourceController.fetch)
|
|
10
|
-
.get("/api/datasources/:datasourceId", authorized(
|
|
11
|
-
.put("/api/datasources/:datasourceId", authorized(
|
|
12
|
-
.post("/api/datasources/query", authorized(
|
|
10
|
+
.get("/api/datasources/:datasourceId", authorized(PermissionType.TABLE, PermissionLevel.READ), datasourceController.find)
|
|
11
|
+
.put("/api/datasources/:datasourceId", authorized(PermissionType.TABLE, PermissionLevel.READ), datasourceController.update)
|
|
12
|
+
.post("/api/datasources/query", authorized(PermissionType.TABLE, PermissionLevel.READ), datasourceQueryValidator(), datasourceController.query)
|
|
13
13
|
.post("/api/datasources/:datasourceId/schema", authorized(BUILDER), datasourceController.buildSchemaFromDb)
|
|
14
14
|
.post("/api/datasources", authorized(BUILDER), datasourceValidator(), datasourceController.save)
|
|
15
15
|
.delete("/api/datasources/:datasourceId/:revId", authorized(BUILDER), datasourceController.destroy);
|
|
@@ -17,7 +17,7 @@ const environment_1 = __importDefault(require("../../../environment"));
|
|
|
17
17
|
// below imports don't have declaration files
|
|
18
18
|
const Router = require("@koa/router");
|
|
19
19
|
const { RateLimit, Stores } = require("koa2-ratelimit");
|
|
20
|
-
const {
|
|
20
|
+
const { PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
21
21
|
const { getRedisOptions } = require("@budibase/backend-core/redis").utils;
|
|
22
22
|
const PREFIX = "/api/public/v1";
|
|
23
23
|
// allow a lot more requests when in test
|
|
@@ -91,7 +91,7 @@ function applyRoutes(endpoints, permType, resource, subResource) {
|
|
|
91
91
|
? (0, resourceId_1.paramSubResource)(resource, subResource)
|
|
92
92
|
: (0, resourceId_1.paramResource)(resource);
|
|
93
93
|
const publicApiMiddleware = (0, publicApi_1.default)({
|
|
94
|
-
requiresAppId: permType !==
|
|
94
|
+
requiresAppId: permType !== PermissionType.APP && permType !== PermissionType.USER,
|
|
95
95
|
});
|
|
96
96
|
addMiddleware(endpoints.read, publicApiMiddleware);
|
|
97
97
|
addMiddleware(endpoints.write, publicApiMiddleware);
|
|
@@ -99,20 +99,20 @@ function applyRoutes(endpoints, permType, resource, subResource) {
|
|
|
99
99
|
addMiddleware(endpoints.read, paramMiddleware);
|
|
100
100
|
addMiddleware(endpoints.write, paramMiddleware);
|
|
101
101
|
// add the authorization middleware, using the correct perm type
|
|
102
|
-
addMiddleware(endpoints.read, (0, authorized_1.default)(permType,
|
|
103
|
-
addMiddleware(endpoints.write, (0, authorized_1.default)(permType,
|
|
102
|
+
addMiddleware(endpoints.read, (0, authorized_1.default)(permType, PermissionLevel.READ));
|
|
103
|
+
addMiddleware(endpoints.write, (0, authorized_1.default)(permType, PermissionLevel.WRITE));
|
|
104
104
|
// add the output mapper middleware
|
|
105
105
|
addMiddleware(endpoints.read, mapper_1.default, { output: true });
|
|
106
106
|
addMiddleware(endpoints.write, mapper_1.default, { output: true });
|
|
107
107
|
addToRouter(endpoints.read);
|
|
108
108
|
addToRouter(endpoints.write);
|
|
109
109
|
}
|
|
110
|
-
applyRoutes(applications_1.default,
|
|
111
|
-
applyRoutes(tables_1.default,
|
|
112
|
-
applyRoutes(users_1.default,
|
|
113
|
-
applyRoutes(queries_1.default,
|
|
110
|
+
applyRoutes(applications_1.default, PermissionType.APP, "appId");
|
|
111
|
+
applyRoutes(tables_1.default, PermissionType.TABLE, "tableId");
|
|
112
|
+
applyRoutes(users_1.default, PermissionType.USER, "userId");
|
|
113
|
+
applyRoutes(queries_1.default, PermissionType.QUERY, "queryId");
|
|
114
114
|
// needs to be applied last for routing purposes, don't override other endpoints
|
|
115
|
-
applyRoutes(rows_1.default,
|
|
115
|
+
applyRoutes(rows_1.default, PermissionType.TABLE, "tableId", "rowId");
|
|
116
116
|
exports.default = publicRouter;
|
|
117
117
|
const shutdown = () => {
|
|
118
118
|
if (rateLimitStore) {
|
package/dist/api/routes/query.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const queryController = require("../controllers/query");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
-
const {
|
|
5
|
+
const { PermissionLevel, PermissionType, BUILDER, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const { bodyResource, bodySubResource, paramResource, } = require("../../middleware/resourceId");
|
|
7
7
|
const { generateQueryPreviewValidation, generateQueryValidation, } = require("../controllers/query/validation");
|
|
8
8
|
const router = new Router();
|
|
@@ -11,9 +11,9 @@ router
|
|
|
11
11
|
.post("/api/queries", bodySubResource("datasourceId", "_id"), authorized(BUILDER), generateQueryValidation(), queryController.save)
|
|
12
12
|
.post("/api/queries/import", authorized(BUILDER), queryController.import)
|
|
13
13
|
.post("/api/queries/preview", bodyResource("datasourceId"), authorized(BUILDER), generateQueryPreviewValidation(), queryController.preview)
|
|
14
|
-
.get("/api/queries/:queryId", paramResource("queryId"), authorized(
|
|
14
|
+
.get("/api/queries/:queryId", paramResource("queryId"), authorized(PermissionType.QUERY, PermissionLevel.READ), queryController.find)
|
|
15
15
|
// DEPRECATED - use new query endpoint for future work
|
|
16
|
-
.post("/api/queries/:queryId", paramResource("queryId"), authorized(
|
|
17
|
-
.post("/api/v2/queries/:queryId", paramResource("queryId"), authorized(
|
|
16
|
+
.post("/api/queries/:queryId", paramResource("queryId"), authorized(PermissionType.QUERY, PermissionLevel.WRITE), queryController.executeV1)
|
|
17
|
+
.post("/api/v2/queries/:queryId", paramResource("queryId"), authorized(PermissionType.QUERY, PermissionLevel.WRITE), queryController.executeV2)
|
|
18
18
|
.delete("/api/queries/:queryId/:revId", paramResource("queryId"), authorized(BUILDER), queryController.destroy);
|
|
19
19
|
module.exports = router;
|
package/dist/api/routes/row.js
CHANGED
|
@@ -30,7 +30,7 @@ const router_1 = __importDefault(require("@koa/router"));
|
|
|
30
30
|
const rowController = __importStar(require("../controllers/row"));
|
|
31
31
|
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
32
32
|
const resourceId_1 = require("../../middleware/resourceId");
|
|
33
|
-
const {
|
|
33
|
+
const { PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
34
34
|
const { internalSearchValidator } = require("./utils/validators");
|
|
35
35
|
const router = new router_1.default();
|
|
36
36
|
router
|
|
@@ -48,7 +48,7 @@ router
|
|
|
48
48
|
*
|
|
49
49
|
* @apiSuccess {object} row The response body will be the enriched row.
|
|
50
50
|
*/
|
|
51
|
-
.get("/api/:tableId/:rowId/enrich", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(
|
|
51
|
+
.get("/api/:tableId/:rowId/enrich", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.READ), rowController.fetchEnrichedRow)
|
|
52
52
|
/**
|
|
53
53
|
* @api {get} /api/:tableId/rows Get all rows in a table
|
|
54
54
|
* @apiName Get all rows in a table
|
|
@@ -63,7 +63,7 @@ router
|
|
|
63
63
|
*
|
|
64
64
|
* @apiSuccess {object[]} rows The response body will be an array of all rows found.
|
|
65
65
|
*/
|
|
66
|
-
.get("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
66
|
+
.get("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.READ), rowController.fetch)
|
|
67
67
|
/**
|
|
68
68
|
* @api {get} /api/:tableId/rows/:rowId Retrieve a single row
|
|
69
69
|
* @apiName Retrieve a single row
|
|
@@ -77,7 +77,7 @@ router
|
|
|
77
77
|
*
|
|
78
78
|
* @apiSuccess {object} body The response body will be the row that was found.
|
|
79
79
|
*/
|
|
80
|
-
.get("/api/:tableId/rows/:rowId", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(
|
|
80
|
+
.get("/api/:tableId/rows/:rowId", (0, resourceId_1.paramSubResource)("tableId", "rowId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.READ), rowController.find)
|
|
81
81
|
/**
|
|
82
82
|
* @api {post} /api/:tableId/search Search for rows in a table
|
|
83
83
|
* @apiName Search for rows in a table
|
|
@@ -141,10 +141,10 @@ router
|
|
|
141
141
|
* @apiSuccess {string} bookmark The bookmark to be sent with the next request to get the next
|
|
142
142
|
* page.
|
|
143
143
|
*/
|
|
144
|
-
.post("/api/:tableId/search", internalSearchValidator(), (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
144
|
+
.post("/api/:tableId/search", internalSearchValidator(), (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.READ), rowController.search)
|
|
145
145
|
// DEPRECATED - this is an old API, but for backwards compat it needs to be
|
|
146
146
|
// supported still
|
|
147
|
-
.post("/api/search/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
147
|
+
.post("/api/search/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.READ), rowController.search)
|
|
148
148
|
/**
|
|
149
149
|
* @api {post} /api/:tableId/rows Creates a new row
|
|
150
150
|
* @apiName Creates a new row
|
|
@@ -169,7 +169,7 @@ router
|
|
|
169
169
|
* @apiSuccess {string} [_rev] If saving to an internal table a revision will also be returned.
|
|
170
170
|
* @apiSuccess {object} body The contents of the row that was saved will be returned as well.
|
|
171
171
|
*/
|
|
172
|
-
.post("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
172
|
+
.post("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.WRITE), rowController.save)
|
|
173
173
|
/**
|
|
174
174
|
* @api {patch} /api/:tableId/rows Updates a row
|
|
175
175
|
* @apiName Update a row
|
|
@@ -178,7 +178,7 @@ router
|
|
|
178
178
|
* @apiDescription This endpoint is identical to the row creation endpoint but instead it will
|
|
179
179
|
* error if an _id isn't provided, it will only function for existing rows.
|
|
180
180
|
*/
|
|
181
|
-
.patch("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
181
|
+
.patch("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.WRITE), rowController.patch)
|
|
182
182
|
/**
|
|
183
183
|
* @api {post} /api/:tableId/rows/validate Validate inputs for a row
|
|
184
184
|
* @apiName Validate inputs for a row
|
|
@@ -199,7 +199,7 @@ router
|
|
|
199
199
|
* which do not match the table schema. The key name will be the column names that have breached
|
|
200
200
|
* the schema.
|
|
201
201
|
*/
|
|
202
|
-
.post("/api/:tableId/rows/validate", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
202
|
+
.post("/api/:tableId/rows/validate", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.WRITE), rowController.validate)
|
|
203
203
|
/**
|
|
204
204
|
* @api {delete} /api/:tableId/rows Delete rows
|
|
205
205
|
* @apiName Delete rows
|
|
@@ -220,7 +220,7 @@ router
|
|
|
220
220
|
* of the deleted rows, if deleting a single row then the body will contain a "row" property which
|
|
221
221
|
* is the deleted row.
|
|
222
222
|
*/
|
|
223
|
-
.delete("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
223
|
+
.delete("/api/:tableId/rows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.WRITE), rowController.destroy)
|
|
224
224
|
/**
|
|
225
225
|
* @api {post} /api/:tableId/rows/exportRows Export Rows
|
|
226
226
|
* @apiName Export rows
|
|
@@ -234,5 +234,5 @@ router
|
|
|
234
234
|
*
|
|
235
235
|
* @apiSuccess {object[]|object}
|
|
236
236
|
*/
|
|
237
|
-
.post("/api/:tableId/rows/exportRows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(
|
|
237
|
+
.post("/api/:tableId/rows/exportRows", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(PermissionType.TABLE, PermissionLevel.WRITE), rowController.exportRows);
|
|
238
238
|
exports.default = router;
|
|
@@ -70,10 +70,10 @@ router
|
|
|
70
70
|
.post("/api/attachments/process", (0, authorized_1.default)(permissions_1.BUILDER), controller.uploadFile)
|
|
71
71
|
.post("/api/attachments/delete", (0, authorized_1.default)(permissions_1.BUILDER), controller.deleteObjects)
|
|
72
72
|
.post("/api/beta/:feature", controller.toggleBetaUiFeature)
|
|
73
|
-
.post("/api/attachments/:tableId/upload", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(permissions_1.
|
|
74
|
-
.post("/api/attachments/:tableId/delete", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(permissions_1.
|
|
73
|
+
.post("/api/attachments/:tableId/upload", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(permissions_1.PermissionType.TABLE, permissions_1.PermissionLevel.WRITE), controller.uploadFile)
|
|
74
|
+
.post("/api/attachments/:tableId/delete", (0, resourceId_1.paramResource)("tableId"), (0, authorized_1.default)(permissions_1.PermissionType.TABLE, permissions_1.PermissionLevel.WRITE), controller.deleteObjects)
|
|
75
75
|
.get("/app/preview", (0, authorized_1.default)(permissions_1.BUILDER), controller.serveBuilderPreview)
|
|
76
76
|
.get("/:appId/:path*", controller.serveApp)
|
|
77
77
|
.get("/app/:appUrl/:path*", controller.serveApp)
|
|
78
|
-
.post("/api/attachments/:datasourceId/url", (0, authorized_1.default)(permissions_1.
|
|
78
|
+
.post("/api/attachments/:datasourceId/url", (0, authorized_1.default)(permissions_1.PermissionType.TABLE, permissions_1.PermissionLevel.READ), controller.getSignedUploadURL);
|
|
79
79
|
exports.default = router;
|
package/dist/api/routes/table.js
CHANGED
|
@@ -3,7 +3,7 @@ const Router = require("@koa/router");
|
|
|
3
3
|
const tableController = require("../controllers/table");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
5
|
const { paramResource, bodyResource } = require("../../middleware/resourceId");
|
|
6
|
-
const { BUILDER,
|
|
6
|
+
const { BUILDER, PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
7
7
|
const { tableValidator } = require("./utils/validators");
|
|
8
8
|
const router = new Router();
|
|
9
9
|
router
|
|
@@ -32,7 +32,7 @@ router
|
|
|
32
32
|
*
|
|
33
33
|
* @apiSuccess {object[]} body The response body will be the table that was found.
|
|
34
34
|
*/
|
|
35
|
-
.get("/api/tables/:tableId", paramResource("tableId"), authorized(
|
|
35
|
+
.get("/api/tables/:tableId", paramResource("tableId"), authorized(PermissionType.TABLE, PermissionLevel.READ, { schema: true }), tableController.find)
|
|
36
36
|
/**
|
|
37
37
|
* @api {post} /api/tables Save a table
|
|
38
38
|
* @apiName Save a table
|
package/dist/api/routes/user.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
const Router = require("@koa/router");
|
|
3
3
|
const controller = require("../controllers/user");
|
|
4
4
|
const authorized = require("../../middleware/authorized");
|
|
5
|
-
const {
|
|
5
|
+
const { PermissionLevel, PermissionType, } = require("@budibase/backend-core/permissions");
|
|
6
6
|
const router = new Router();
|
|
7
7
|
router
|
|
8
|
-
.get("/api/users/metadata", authorized(
|
|
9
|
-
.get("/api/users/metadata/:id", authorized(
|
|
10
|
-
.put("/api/users/metadata", authorized(
|
|
11
|
-
.post("/api/users/metadata/self", authorized(
|
|
12
|
-
.delete("/api/users/metadata/:id", authorized(
|
|
13
|
-
.post("/api/users/metadata/sync/:id", authorized(
|
|
14
|
-
.post("/api/users/flags", authorized(
|
|
15
|
-
.get("/api/users/flags", authorized(
|
|
8
|
+
.get("/api/users/metadata", authorized(PermissionType.USER, PermissionLevel.READ), controller.fetchMetadata)
|
|
9
|
+
.get("/api/users/metadata/:id", authorized(PermissionType.USER, PermissionLevel.READ), controller.findMetadata)
|
|
10
|
+
.put("/api/users/metadata", authorized(PermissionType.USER, PermissionLevel.WRITE), controller.updateMetadata)
|
|
11
|
+
.post("/api/users/metadata/self", authorized(PermissionType.USER, PermissionLevel.WRITE), controller.updateSelfMetadata)
|
|
12
|
+
.delete("/api/users/metadata/:id", authorized(PermissionType.USER, PermissionLevel.WRITE), controller.destroyMetadata)
|
|
13
|
+
.post("/api/users/metadata/sync/:id", authorized(PermissionType.USER, PermissionLevel.WRITE), controller.syncUser)
|
|
14
|
+
.post("/api/users/flags", authorized(PermissionType.USER, PermissionLevel.WRITE), controller.setFlag)
|
|
15
|
+
.get("/api/users/flags", authorized(PermissionType.USER, PermissionLevel.READ), controller.getFlags);
|
|
16
16
|
module.exports = router;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const { joiValidator } = require("@budibase/backend-core/auth");
|
|
3
3
|
const { DataSourceOperation } = require("../../../constants");
|
|
4
|
-
const {
|
|
4
|
+
const { BuiltinPermissionID, PermissionLevel, } = require("@budibase/backend-core/permissions");
|
|
5
5
|
const { WebhookActionType } = require("@budibase/types");
|
|
6
6
|
const Joi = require("joi");
|
|
7
7
|
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("");
|
|
@@ -119,14 +119,14 @@ exports.webhookValidator = () => {
|
|
|
119
119
|
}).unknown(true));
|
|
120
120
|
};
|
|
121
121
|
exports.roleValidator = () => {
|
|
122
|
-
const permLevelArray = Object.values(
|
|
122
|
+
const permLevelArray = Object.values(PermissionLevel);
|
|
123
123
|
// prettier-ignore
|
|
124
124
|
return joiValidator.body(Joi.object({
|
|
125
125
|
_id: OPTIONAL_STRING,
|
|
126
126
|
_rev: OPTIONAL_STRING,
|
|
127
127
|
name: Joi.string().required(),
|
|
128
128
|
// this is the base permission ID (for now a built in)
|
|
129
|
-
permissionId: Joi.string().valid(...Object.values(
|
|
129
|
+
permissionId: Joi.string().valid(...Object.values(BuiltinPermissionID)).required(),
|
|
130
130
|
permissions: Joi.object()
|
|
131
131
|
.pattern(/.*/, [Joi.string().valid(...permLevelArray)])
|
|
132
132
|
.optional(),
|
|
@@ -134,7 +134,7 @@ exports.roleValidator = () => {
|
|
|
134
134
|
}).unknown(true));
|
|
135
135
|
};
|
|
136
136
|
exports.permissionValidator = () => {
|
|
137
|
-
const permLevelArray = Object.values(
|
|
137
|
+
const permLevelArray = Object.values(PermissionLevel);
|
|
138
138
|
// prettier-ignore
|
|
139
139
|
return joiValidator.params(Joi.object({
|
|
140
140
|
level: Joi.string().valid(...permLevelArray).required(),
|
package/dist/api/routes/view.js
CHANGED
|
@@ -4,11 +4,11 @@ const viewController = require("../controllers/view");
|
|
|
4
4
|
const rowController = require("../controllers/row");
|
|
5
5
|
const authorized = require("../../middleware/authorized");
|
|
6
6
|
const { paramResource } = require("../../middleware/resourceId");
|
|
7
|
-
const { BUILDER,
|
|
7
|
+
const { BUILDER, PermissionType, PermissionLevel, } = require("@budibase/backend-core/permissions");
|
|
8
8
|
const router = new Router();
|
|
9
9
|
router
|
|
10
10
|
.get("/api/views/export", authorized(BUILDER), viewController.exportView)
|
|
11
|
-
.get("/api/views/:viewName", paramResource("viewName"), authorized(
|
|
11
|
+
.get("/api/views/:viewName", paramResource("viewName"), authorized(PermissionType.VIEW, PermissionLevel.READ), rowController.fetchView)
|
|
12
12
|
.get("/api/views", authorized(BUILDER), viewController.fetch)
|
|
13
13
|
.delete("/api/views/:viewName", paramResource("viewName"), authorized(BUILDER), viewController.destroy)
|
|
14
14
|
.post("/api/views", authorized(BUILDER), viewController.save);
|
|
@@ -9,8 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const TestConfig = require("../../../tests/utilities/TestConfiguration");
|
|
12
|
-
const {
|
|
13
|
-
const { doInTenant } = require("@budibase/backend-core/tenancy");
|
|
12
|
+
const { context } = require("@budibase/backend-core");
|
|
14
13
|
const actions = require("../../actions");
|
|
15
14
|
const emitter = require("../../../events/index");
|
|
16
15
|
const env = require("../../../environment");
|
|
@@ -40,17 +39,27 @@ exports.runInProd = (fn) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
40
39
|
});
|
|
41
40
|
exports.runStep = function runStep(stepId, inputs) {
|
|
42
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
function run() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
let step = yield actions.getAction(stepId);
|
|
45
|
+
expect(step).toBeDefined();
|
|
46
|
+
return step({
|
|
47
|
+
inputs,
|
|
48
|
+
appId: config ? config.getAppId() : null,
|
|
49
|
+
// don't really need an API key, mocked out usage quota, not being tested here
|
|
50
|
+
apiKey: exports.apiKey,
|
|
51
|
+
emitter,
|
|
52
|
+
});
|
|
52
53
|
});
|
|
53
|
-
}
|
|
54
|
+
}
|
|
55
|
+
if (config === null || config === void 0 ? void 0 : config.appId) {
|
|
56
|
+
return context.doInContext(config === null || config === void 0 ? void 0 : config.appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return run();
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return run();
|
|
62
|
+
}
|
|
54
63
|
});
|
|
55
64
|
};
|
|
56
65
|
exports.apiKey = "test";
|
|
@@ -19,11 +19,9 @@ const bullboard_1 = require("./bullboard");
|
|
|
19
19
|
const newid_1 = __importDefault(require("../db/newid"));
|
|
20
20
|
const utilities_1 = require("../utilities");
|
|
21
21
|
const constants_1 = require("../constants");
|
|
22
|
-
const
|
|
22
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
23
23
|
const utils_1 = require("../db/utils");
|
|
24
24
|
const fp_1 = require("lodash/fp");
|
|
25
|
-
const context_1 = require("@budibase/backend-core/context");
|
|
26
|
-
const backend_core_1 = require("@budibase/backend-core");
|
|
27
25
|
const pro_1 = require("@budibase/pro");
|
|
28
26
|
const types_1 = require("@budibase/types");
|
|
29
27
|
const sdk_1 = __importDefault(require("../sdk"));
|
|
@@ -113,7 +111,7 @@ function disableCronById(jobId) {
|
|
|
113
111
|
exports.disableCronById = disableCronById;
|
|
114
112
|
function clearMetadata() {
|
|
115
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
const db =
|
|
114
|
+
const db = backend_core_1.context.getProdAppDB();
|
|
117
115
|
const automationMetadata = (yield db.allDocs((0, utils_1.getAutomationMetadataParams)({
|
|
118
116
|
include_docs: true,
|
|
119
117
|
}))).rows.map((row) => row.doc);
|
|
@@ -158,7 +156,7 @@ function enableCronTrigger(appId, automation) {
|
|
|
158
156
|
// can't use getAppDB here as this is likely to be called from dev app,
|
|
159
157
|
// but this call could be for dev app or prod app, need to just use what
|
|
160
158
|
// was passed in
|
|
161
|
-
yield
|
|
159
|
+
yield backend_core_1.db.doWithDB(appId, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
162
160
|
const response = yield db.put(automation);
|
|
163
161
|
automation._id = response.id;
|
|
164
162
|
automation._rev = response.rev;
|
|
@@ -178,7 +176,10 @@ exports.enableCronTrigger = enableCronTrigger;
|
|
|
178
176
|
*/
|
|
179
177
|
function checkForWebhooks({ oldAuto, newAuto }) {
|
|
180
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
-
const appId =
|
|
179
|
+
const appId = backend_core_1.context.getAppId();
|
|
180
|
+
if (!appId) {
|
|
181
|
+
throw new Error("Unable to check webhooks - no app ID in context.");
|
|
182
|
+
}
|
|
182
183
|
const oldTrigger = oldAuto ? oldAuto.definition.trigger : null;
|
|
183
184
|
const newTrigger = newAuto ? newAuto.definition.trigger : null;
|
|
184
185
|
const triggerChanged = oldTrigger && newTrigger && oldTrigger.id !== newTrigger.id;
|
|
@@ -192,7 +193,7 @@ function checkForWebhooks({ oldAuto, newAuto }) {
|
|
|
192
193
|
(!isWebhookTrigger(newAuto) || triggerChanged) &&
|
|
193
194
|
oldTrigger.webhookId) {
|
|
194
195
|
try {
|
|
195
|
-
let db =
|
|
196
|
+
let db = backend_core_1.context.getAppDB();
|
|
196
197
|
// need to get the webhook to get the rev
|
|
197
198
|
const webhook = yield db.get(oldTrigger.webhookId);
|
|
198
199
|
// might be updating - reset the inputs to remove the URLs
|
|
@@ -215,7 +216,7 @@ function checkForWebhooks({ oldAuto, newAuto }) {
|
|
|
215
216
|
// the app ID has to be development for this endpoint
|
|
216
217
|
// it can only be used when building the app
|
|
217
218
|
// but the trigger endpoint will always be used in production
|
|
218
|
-
const prodAppId =
|
|
219
|
+
const prodAppId = backend_core_1.db.getProdAppID(appId);
|
|
219
220
|
newTrigger.inputs = {
|
|
220
221
|
schemaUrl: `api/webhooks/schema/${appId}/${id}`,
|
|
221
222
|
triggerUrl: `api/webhooks/trigger/${prodAppId}/${id}`,
|
package/dist/db/inMemoryView.js
CHANGED
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
const newid = require("./newid");
|
|
12
12
|
// bypass the main application db config
|
|
13
13
|
// use in memory pouchdb directly
|
|
14
|
-
const { getPouch,
|
|
14
|
+
const { getPouch, closePouchDB } = require("@budibase/backend-core/db");
|
|
15
15
|
const Pouch = getPouch({ inMemory: true });
|
|
16
16
|
exports.runView = (view, calculation, group, data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
// use a different ID each time for the DB, make sure they
|
|
@@ -48,6 +48,6 @@ exports.runView = (view, calculation, group, data) => __awaiter(void 0, void 0,
|
|
|
48
48
|
}
|
|
49
49
|
finally {
|
|
50
50
|
yield db.destroy();
|
|
51
|
-
yield
|
|
51
|
+
yield closePouchDB(db);
|
|
52
52
|
}
|
|
53
53
|
});
|