@budibase/server 2.1.22-alpha.5 → 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.ccab8b9a.js → index.22484e23.js} +286 -286
- package/builder/assets/{index.1a9c91e2.css → index.624f0ace.css} +1 -1
- package/builder/index.html +2 -2
- package/coverage/clover.xml +1182 -1209
- package/coverage/coverage-final.json +37 -37
- 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 +2 -2
- 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 +3 -3
- 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/migrations/functions/backfill/global.js +1 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +1 -1
- 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/scripts/localdomain.js +34 -6
- 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/migrations/functions/backfill/global.ts +1 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +2 -2
- 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
package/dist/utilities/global.js
CHANGED
|
@@ -8,49 +8,54 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getGlobalUsersFromMetadata = exports.getGlobalUsers = exports.getGlobalUser = exports.getRawGlobalUser = exports.getCachedSelf = exports.updateAppRole = void 0;
|
|
16
|
+
const utils_1 = require("../db/utils");
|
|
17
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
18
|
+
const environment_1 = __importDefault(require("../environment"));
|
|
19
|
+
const pro_1 = require("@budibase/pro");
|
|
20
|
+
function updateAppRole(user, { appId } = {}) {
|
|
21
21
|
var _a, _b;
|
|
22
|
-
appId = appId || getAppId();
|
|
22
|
+
appId = appId || backend_core_1.context.getAppId();
|
|
23
23
|
if (!user || !user.roles) {
|
|
24
24
|
return user;
|
|
25
25
|
}
|
|
26
26
|
// if in an multi-tenancy environment make sure roles are never updated
|
|
27
|
-
if (
|
|
27
|
+
if (environment_1.default.MULTI_TENANCY && appId && !backend_core_1.tenancy.isUserInAppTenant(appId, user)) {
|
|
28
28
|
delete user.builder;
|
|
29
29
|
delete user.admin;
|
|
30
|
-
user.roleId = BUILTIN_ROLE_IDS.PUBLIC;
|
|
30
|
+
user.roleId = backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC;
|
|
31
31
|
return user;
|
|
32
32
|
}
|
|
33
33
|
// always use the deployed app
|
|
34
|
-
|
|
34
|
+
if (appId) {
|
|
35
|
+
user.roleId = user.roles[backend_core_1.db.getProdAppID(appId)];
|
|
36
|
+
}
|
|
35
37
|
// if a role wasn't found then either set as admin (builder) or public (everyone else)
|
|
36
38
|
if (!user.roleId && user.builder && user.builder.global) {
|
|
37
|
-
user.roleId = BUILTIN_ROLE_IDS.ADMIN;
|
|
39
|
+
user.roleId = backend_core_1.roles.BUILTIN_ROLE_IDS.ADMIN;
|
|
38
40
|
}
|
|
39
41
|
else if (!user.roleId && !((_a = user === null || user === void 0 ? void 0 : user.userGroups) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
40
|
-
user.roleId = BUILTIN_ROLE_IDS.PUBLIC;
|
|
42
|
+
user.roleId = backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC;
|
|
41
43
|
}
|
|
42
44
|
else if ((_b = user === null || user === void 0 ? void 0 : user.userGroups) === null || _b === void 0 ? void 0 : _b.length) {
|
|
43
|
-
user.roleId =
|
|
45
|
+
user.roleId = undefined;
|
|
44
46
|
}
|
|
45
47
|
delete user.roles;
|
|
46
48
|
return user;
|
|
47
|
-
}
|
|
49
|
+
}
|
|
50
|
+
exports.updateAppRole = updateAppRole;
|
|
48
51
|
function checkGroupRoles(user, { appId } = {}) {
|
|
49
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
if (user.roleId && user.roleId !== BUILTIN_ROLE_IDS.PUBLIC) {
|
|
53
|
+
if (user.roleId && user.roleId !== backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
51
54
|
return user;
|
|
52
55
|
}
|
|
53
|
-
|
|
56
|
+
if (appId) {
|
|
57
|
+
user.roleId = yield pro_1.groups.getGroupRoleId(user, appId);
|
|
58
|
+
}
|
|
54
59
|
return user;
|
|
55
60
|
});
|
|
56
61
|
}
|
|
@@ -60,57 +65,73 @@ function processUser(user, { appId } = {}) {
|
|
|
60
65
|
if (user) {
|
|
61
66
|
delete user.password;
|
|
62
67
|
}
|
|
63
|
-
user = yield
|
|
68
|
+
user = yield updateAppRole(user, { appId });
|
|
64
69
|
if (!user.roleId && ((_a = user === null || user === void 0 ? void 0 : user.userGroups) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
65
70
|
user = yield checkGroupRoles(user, { appId });
|
|
66
71
|
}
|
|
67
72
|
return user;
|
|
68
73
|
});
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const db = getGlobalDB();
|
|
78
|
-
return db.get(getGlobalIDFromUserMetadataID(userId));
|
|
79
|
-
});
|
|
80
|
-
exports.getGlobalUser = (userId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
-
const appId = getAppId();
|
|
82
|
-
let user = yield exports.getRawGlobalUser(userId);
|
|
83
|
-
return processUser(user, { appId });
|
|
84
|
-
});
|
|
85
|
-
exports.getGlobalUsers = (users = null) => __awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
-
const appId = getAppId();
|
|
87
|
-
const db = getGlobalDB();
|
|
88
|
-
let globalUsers;
|
|
89
|
-
if (users) {
|
|
90
|
-
const globalIds = users.map(user => getGlobalIDFromUserMetadataID(user._id));
|
|
91
|
-
globalUsers = (yield db.allDocs(getMultiIDParams(globalIds))).rows.map(row => row.doc);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
globalUsers = (yield db.allDocs(getGlobalUserParams(null, {
|
|
95
|
-
include_docs: true,
|
|
96
|
-
}))).rows.map(row => row.doc);
|
|
97
|
-
}
|
|
98
|
-
globalUsers = globalUsers
|
|
99
|
-
.filter(user => user != null)
|
|
100
|
-
.map(user => {
|
|
101
|
-
delete user.password;
|
|
102
|
-
delete user.forceResetPassword;
|
|
103
|
-
return user;
|
|
75
|
+
function getCachedSelf(ctx, appId) {
|
|
76
|
+
var _a;
|
|
77
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
// this has to be tenant aware, can't depend on the context to find it out
|
|
79
|
+
// running some middlewares before the tenancy causes context to break
|
|
80
|
+
const user = yield backend_core_1.cache.user.getUser((_a = ctx.user) === null || _a === void 0 ? void 0 : _a._id);
|
|
81
|
+
return processUser(user, { appId });
|
|
104
82
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
83
|
+
}
|
|
84
|
+
exports.getCachedSelf = getCachedSelf;
|
|
85
|
+
function getRawGlobalUser(userId) {
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const db = backend_core_1.tenancy.getGlobalDB();
|
|
88
|
+
return db.get((0, utils_1.getGlobalIDFromUserMetadataID)(userId));
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.getRawGlobalUser = getRawGlobalUser;
|
|
92
|
+
function getGlobalUser(userId) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const appId = backend_core_1.context.getAppId();
|
|
95
|
+
let user = yield getRawGlobalUser(userId);
|
|
96
|
+
return processUser(user, { appId });
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
exports.getGlobalUser = getGlobalUser;
|
|
100
|
+
function getGlobalUsers(users) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const appId = backend_core_1.context.getAppId();
|
|
103
|
+
const db = backend_core_1.tenancy.getGlobalDB();
|
|
104
|
+
let globalUsers;
|
|
105
|
+
if (users) {
|
|
106
|
+
const globalIds = users.map(user => (0, utils_1.getGlobalIDFromUserMetadataID)(user._id));
|
|
107
|
+
globalUsers = (yield db.allDocs((0, utils_1.getMultiIDParams)(globalIds))).rows.map(row => row.doc);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
globalUsers = (yield db.allDocs(backend_core_1.db.getGlobalUserParams(null, {
|
|
111
|
+
include_docs: true,
|
|
112
|
+
}))).rows.map(row => row.doc);
|
|
113
|
+
}
|
|
114
|
+
globalUsers = globalUsers
|
|
115
|
+
.filter(user => user != null)
|
|
116
|
+
.map(user => {
|
|
117
|
+
delete user.password;
|
|
118
|
+
delete user.forceResetPassword;
|
|
119
|
+
return user;
|
|
120
|
+
});
|
|
121
|
+
if (!appId) {
|
|
122
|
+
return globalUsers;
|
|
123
|
+
}
|
|
124
|
+
return globalUsers.map(user => updateAppRole(user));
|
|
115
125
|
});
|
|
116
|
-
}
|
|
126
|
+
}
|
|
127
|
+
exports.getGlobalUsers = getGlobalUsers;
|
|
128
|
+
function getGlobalUsersFromMetadata(users) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const globalUsers = yield getGlobalUsers(users);
|
|
131
|
+
return users.map(user => {
|
|
132
|
+
const globalUser = globalUsers.find(globalUser => { var _a; return globalUser && ((_a = user._id) === null || _a === void 0 ? void 0 : _a.includes(globalUser._id)); });
|
|
133
|
+
return Object.assign(Object.assign({}, globalUser), user);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
exports.getGlobalUsersFromMetadata = getGlobalUsersFromMetadata;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const {
|
|
2
|
+
const { PermissionLevel, PermissionType, getBuiltinPermissionByID, isPermissionLevelHigherThanRead, } = require("@budibase/backend-core/permissions");
|
|
3
3
|
const { lowerBuiltinRoleID, getBuiltinRoles, } = require("@budibase/backend-core/roles");
|
|
4
4
|
const { DocumentType } = require("../db/utils");
|
|
5
5
|
const CURRENTLY_SUPPORTED_LEVELS = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
PermissionLevel.WRITE,
|
|
7
|
+
PermissionLevel.READ,
|
|
8
|
+
PermissionLevel.EXECUTE,
|
|
9
9
|
];
|
|
10
10
|
exports.getPermissionType = resourceId => {
|
|
11
11
|
const docType = Object.values(DocumentType).filter(docType => resourceId.startsWith(docType))[0];
|
|
12
12
|
switch (docType) {
|
|
13
13
|
case DocumentType.TABLE:
|
|
14
14
|
case DocumentType.ROW:
|
|
15
|
-
return
|
|
15
|
+
return PermissionType.TABLE;
|
|
16
16
|
case DocumentType.AUTOMATION:
|
|
17
|
-
return
|
|
17
|
+
return PermissionType.AUTOMATION;
|
|
18
18
|
case DocumentType.WEBHOOK:
|
|
19
|
-
return
|
|
19
|
+
return PermissionType.WEBHOOK;
|
|
20
20
|
case DocumentType.QUERY:
|
|
21
21
|
case DocumentType.DATASOURCE:
|
|
22
|
-
return
|
|
22
|
+
return PermissionType.QUERY;
|
|
23
23
|
default:
|
|
24
24
|
// views don't have an ID, will end up here
|
|
25
|
-
return
|
|
25
|
+
return PermissionType.VIEW;
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
@@ -44,7 +44,7 @@ exports.getBasePermissions = resourceId => {
|
|
|
44
44
|
const level = typedPermission.level;
|
|
45
45
|
permissions[level] = lowerBuiltinRoleID(permissions[level], roleId);
|
|
46
46
|
if (isPermissionLevelHigherThanRead(level)) {
|
|
47
|
-
permissions[
|
|
47
|
+
permissions[PermissionLevel.READ] = lowerBuiltinRoleID(permissions[PermissionLevel.READ], roleId);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -13,16 +13,16 @@ const env = require("../environment");
|
|
|
13
13
|
const { checkSlashesInUrl } = require("./index");
|
|
14
14
|
const { getProdAppID } = require("@budibase/backend-core/db");
|
|
15
15
|
const { updateAppRole } = require("./global");
|
|
16
|
-
const {
|
|
16
|
+
const { Header } = require("@budibase/backend-core/constants");
|
|
17
17
|
const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy");
|
|
18
18
|
function request(ctx, request) {
|
|
19
19
|
if (!request.headers) {
|
|
20
20
|
request.headers = {};
|
|
21
21
|
}
|
|
22
22
|
if (!ctx) {
|
|
23
|
-
request.headers[
|
|
23
|
+
request.headers[Header.API_KEY] = env.INTERNAL_API_KEY;
|
|
24
24
|
if (isTenantIdSet()) {
|
|
25
|
-
request.headers[
|
|
25
|
+
request.headers[Header.TENANT_ID] = getTenantId();
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (request.body && Object.keys(request.body).length > 0) {
|
package/jest.config.ts
CHANGED
|
@@ -19,6 +19,7 @@ if (!process.env.CI) {
|
|
|
19
19
|
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
|
20
20
|
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
|
21
21
|
"@budibase/types": "<rootDir>/../types/src",
|
|
22
|
+
"^axios.*$": "<rootDir>/node_modules/axios/lib/axios.js",
|
|
22
23
|
}
|
|
23
24
|
// add pro sources if they exist
|
|
24
25
|
if (fs.existsSync("../../../budibase-pro")) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.1.22-alpha.
|
|
4
|
+
"version": "2.1.22-alpha.7",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "2.1.22-alpha.
|
|
47
|
-
"@budibase/client": "2.1.22-alpha.
|
|
48
|
-
"@budibase/pro": "2.1.22-alpha.
|
|
49
|
-
"@budibase/string-templates": "2.1.22-alpha.
|
|
50
|
-
"@budibase/types": "2.1.22-alpha.
|
|
46
|
+
"@budibase/backend-core": "2.1.22-alpha.7",
|
|
47
|
+
"@budibase/client": "2.1.22-alpha.7",
|
|
48
|
+
"@budibase/pro": "2.1.22-alpha.6",
|
|
49
|
+
"@budibase/string-templates": "2.1.22-alpha.7",
|
|
50
|
+
"@budibase/types": "2.1.22-alpha.7",
|
|
51
51
|
"@bull-board/api": "3.7.0",
|
|
52
52
|
"@bull-board/koa": "3.9.4",
|
|
53
53
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -165,5 +165,5 @@
|
|
|
165
165
|
"optionalDependencies": {
|
|
166
166
|
"oracledb": "5.3.0"
|
|
167
167
|
},
|
|
168
|
-
"gitHead": "
|
|
168
|
+
"gitHead": "c90a987eb1fd4c82429fc965f7389f0af6fb48ed"
|
|
169
169
|
}
|
package/scripts/localdomain.js
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
const updateDotEnv = require("update-dotenv")
|
|
3
3
|
|
|
4
4
|
const arg = process.argv.slice(2)[0]
|
|
5
|
+
const isEnable = arg === "enable"
|
|
6
|
+
|
|
7
|
+
let domain = process.argv.slice(2)[1]
|
|
8
|
+
if (!domain) {
|
|
9
|
+
domain = "local.com"
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const getAccountPortalUrl = () => {
|
|
13
|
+
if (isEnable) {
|
|
14
|
+
return `http://account.${domain}:10001`
|
|
15
|
+
} else {
|
|
16
|
+
return `http://localhost:10001`
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const getBudibaseUrl = () => {
|
|
21
|
+
if (isEnable) {
|
|
22
|
+
return `http://${domain}:10000`
|
|
23
|
+
} else {
|
|
24
|
+
return `http://localhost:10000`
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const getCookieDomain = () => {
|
|
29
|
+
if (isEnable) {
|
|
30
|
+
return `.${domain}`
|
|
31
|
+
} else {
|
|
32
|
+
return ""
|
|
33
|
+
}
|
|
34
|
+
}
|
|
5
35
|
|
|
6
36
|
/**
|
|
7
37
|
* For testing multi tenancy sub domains locally.
|
|
@@ -16,9 +46,7 @@ const arg = process.argv.slice(2)[0]
|
|
|
16
46
|
* 127.0.0.1 t2.local.com
|
|
17
47
|
*/
|
|
18
48
|
updateDotEnv({
|
|
19
|
-
ACCOUNT_PORTAL_URL:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
COOKIE_DOMAIN: arg === "enable" ? ".local.com" : "",
|
|
24
|
-
}).then(() => console.log("Updated worker!"))
|
|
49
|
+
ACCOUNT_PORTAL_URL: getAccountPortalUrl(),
|
|
50
|
+
COOKIE_DOMAIN: getCookieDomain(),
|
|
51
|
+
PLATFORM_URL: getBudibaseUrl(),
|
|
52
|
+
}).then(() => console.log("Updated server!"))
|
|
@@ -14,17 +14,16 @@ import {
|
|
|
14
14
|
DocumentType,
|
|
15
15
|
AppStatus,
|
|
16
16
|
} from "../../db/utils"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} = require("@budibase/backend-core/db")
|
|
17
|
+
import {
|
|
18
|
+
db as dbCore,
|
|
19
|
+
roles,
|
|
20
|
+
cache,
|
|
21
|
+
tenancy,
|
|
22
|
+
context,
|
|
23
|
+
errors,
|
|
24
|
+
events,
|
|
25
|
+
migrations,
|
|
26
|
+
} from "@budibase/backend-core"
|
|
28
27
|
import { USERS_TABLE_SCHEMA } from "../../constants"
|
|
29
28
|
import { removeAppFromUserRoles } from "../../utilities/workerRequests"
|
|
30
29
|
import { clientLibraryPath, stringToReadStream } from "../../utilities"
|
|
@@ -34,15 +33,11 @@ import {
|
|
|
34
33
|
backupClientLibrary,
|
|
35
34
|
revertClientLibrary,
|
|
36
35
|
} from "../../utilities/fileSystem/clientLibrary"
|
|
37
|
-
const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
|
|
38
36
|
import { syncGlobalUsers } from "./user"
|
|
39
|
-
const { app: appCache } = require("@budibase/backend-core/cache")
|
|
40
37
|
import { cleanupAutomations } from "../../automations/utils"
|
|
41
|
-
import { context } from "@budibase/backend-core"
|
|
42
38
|
import { checkAppMetadata } from "../../automations/logging"
|
|
43
39
|
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
|
44
40
|
import { quotas, groups } from "@budibase/pro"
|
|
45
|
-
import { errors, events, migrations } from "@budibase/backend-core"
|
|
46
41
|
import { App, Layout, Screen, MigrationType } from "@budibase/types"
|
|
47
42
|
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
|
|
48
43
|
import { enrichPluginURLs } from "../../utilities/plugins"
|
|
@@ -75,7 +70,7 @@ async function getScreens() {
|
|
|
75
70
|
|
|
76
71
|
function getUserRoleId(ctx: any) {
|
|
77
72
|
return !ctx.user.role || !ctx.user.role._id
|
|
78
|
-
? BUILTIN_ROLE_IDS.PUBLIC
|
|
73
|
+
? roles.BUILTIN_ROLE_IDS.PUBLIC
|
|
79
74
|
: ctx.user.role._id
|
|
80
75
|
}
|
|
81
76
|
|
|
@@ -123,7 +118,7 @@ const checkAppName = (
|
|
|
123
118
|
}
|
|
124
119
|
|
|
125
120
|
async function createInstance(template: any) {
|
|
126
|
-
const tenantId = isMultiTenant() ? getTenantId() : null
|
|
121
|
+
const tenantId = tenancy.isMultiTenant() ? tenancy.getTenantId() : null
|
|
127
122
|
const baseAppId = generateAppID(tenantId)
|
|
128
123
|
const appId = generateDevAppID(baseAppId)
|
|
129
124
|
await context.updateAppId(appId)
|
|
@@ -162,7 +157,7 @@ async function createInstance(template: any) {
|
|
|
162
157
|
export const fetch = async (ctx: any) => {
|
|
163
158
|
const dev = ctx.query && ctx.query.status === AppStatus.DEV
|
|
164
159
|
const all = ctx.query && ctx.query.status === AppStatus.ALL
|
|
165
|
-
const apps = await getAllApps({ dev, all })
|
|
160
|
+
const apps = (await dbCore.getAllApps({ dev, all })) as App[]
|
|
166
161
|
|
|
167
162
|
const appIds = apps
|
|
168
163
|
.filter((app: any) => app.status === "development")
|
|
@@ -187,7 +182,7 @@ export const fetch = async (ctx: any) => {
|
|
|
187
182
|
export const fetchAppDefinition = async (ctx: any) => {
|
|
188
183
|
const layouts = await getLayouts()
|
|
189
184
|
const userRoleId = getUserRoleId(ctx)
|
|
190
|
-
const accessController = new AccessController()
|
|
185
|
+
const accessController = new roles.AccessController()
|
|
191
186
|
const screens = await accessController.checkScreensAccess(
|
|
192
187
|
await getScreens(),
|
|
193
188
|
userRoleId
|
|
@@ -211,7 +206,7 @@ export const fetchAppPackage = async (ctx: any) => {
|
|
|
211
206
|
// Only filter screens if the user is not a builder
|
|
212
207
|
if (!(ctx.user.builder && ctx.user.builder.global)) {
|
|
213
208
|
const userRoleId = getUserRoleId(ctx)
|
|
214
|
-
const accessController = new AccessController()
|
|
209
|
+
const accessController = new roles.AccessController()
|
|
215
210
|
screens = await accessController.checkScreensAccess(screens, userRoleId)
|
|
216
211
|
}
|
|
217
212
|
|
|
@@ -224,7 +219,7 @@ export const fetchAppPackage = async (ctx: any) => {
|
|
|
224
219
|
}
|
|
225
220
|
|
|
226
221
|
const performAppCreate = async (ctx: any) => {
|
|
227
|
-
const apps = await getAllApps({ dev: true })
|
|
222
|
+
const apps = await dbCore.getAllApps({ dev: true })
|
|
228
223
|
const name = ctx.request.body.name
|
|
229
224
|
checkAppName(ctx, apps, name)
|
|
230
225
|
const url = getAppUrl(ctx)
|
|
@@ -254,7 +249,7 @@ const performAppCreate = async (ctx: any) => {
|
|
|
254
249
|
url: url,
|
|
255
250
|
template: templateKey,
|
|
256
251
|
instance,
|
|
257
|
-
tenantId: getTenantId(),
|
|
252
|
+
tenantId: tenancy.getTenantId(),
|
|
258
253
|
updatedAt: new Date().toISOString(),
|
|
259
254
|
createdAt: new Date().toISOString(),
|
|
260
255
|
status: AppStatus.DEV,
|
|
@@ -313,7 +308,7 @@ const performAppCreate = async (ctx: any) => {
|
|
|
313
308
|
await createApp(appId)
|
|
314
309
|
}
|
|
315
310
|
|
|
316
|
-
await
|
|
311
|
+
await cache.app.invalidateAppMetadata(appId, newApplication)
|
|
317
312
|
return newApplication
|
|
318
313
|
}
|
|
319
314
|
|
|
@@ -343,7 +338,7 @@ const creationEvents = async (request: any, app: App) => {
|
|
|
343
338
|
}
|
|
344
339
|
|
|
345
340
|
const appPostCreate = async (ctx: any, app: App) => {
|
|
346
|
-
const tenantId = getTenantId()
|
|
341
|
+
const tenantId = tenancy.getTenantId()
|
|
347
342
|
await migrations.backPopulateMigrations({
|
|
348
343
|
type: MigrationType.APP,
|
|
349
344
|
tenantId,
|
|
@@ -356,7 +351,9 @@ const appPostCreate = async (ctx: any, app: App) => {
|
|
|
356
351
|
const rowCount = rows ? rows.length : 0
|
|
357
352
|
if (rowCount) {
|
|
358
353
|
try {
|
|
359
|
-
await
|
|
354
|
+
await context.doInAppContext(app.appId, () => {
|
|
355
|
+
return quotas.addRows(rowCount)
|
|
356
|
+
})
|
|
360
357
|
} catch (err: any) {
|
|
361
358
|
if (err.code && err.code === errors.codes.USAGE_LIMIT_EXCEEDED) {
|
|
362
359
|
// this import resulted in row usage exceeding the quota
|
|
@@ -374,7 +371,7 @@ const appPostCreate = async (ctx: any, app: App) => {
|
|
|
374
371
|
export const create = async (ctx: any) => {
|
|
375
372
|
const newApplication = await quotas.addApp(() => performAppCreate(ctx))
|
|
376
373
|
await appPostCreate(ctx, newApplication)
|
|
377
|
-
await bustCache(CacheKeys.CHECKLIST)
|
|
374
|
+
await cache.bustCache(cache.CacheKeys.CHECKLIST)
|
|
378
375
|
ctx.body = newApplication
|
|
379
376
|
ctx.status = 200
|
|
380
377
|
}
|
|
@@ -382,7 +379,7 @@ export const create = async (ctx: any) => {
|
|
|
382
379
|
// This endpoint currently operates as a PATCH rather than a PUT
|
|
383
380
|
// Thus name and url fields are handled only if present
|
|
384
381
|
export const update = async (ctx: any) => {
|
|
385
|
-
const apps = await getAllApps({ dev: true })
|
|
382
|
+
const apps = await dbCore.getAllApps({ dev: true })
|
|
386
383
|
// validation
|
|
387
384
|
const name = ctx.request.body.name
|
|
388
385
|
if (name) {
|
|
@@ -455,7 +452,7 @@ const destroyApp = async (ctx: any) => {
|
|
|
455
452
|
let isUnpublish = ctx.query && ctx.query.unpublish
|
|
456
453
|
|
|
457
454
|
if (isUnpublish) {
|
|
458
|
-
appId = getProdAppID(appId)
|
|
455
|
+
appId = dbCore.getProdAppID(appId)
|
|
459
456
|
}
|
|
460
457
|
|
|
461
458
|
const db = isUnpublish ? context.getProdAppDB() : context.getAppDB()
|
|
@@ -481,7 +478,7 @@ const destroyApp = async (ctx: any) => {
|
|
|
481
478
|
else {
|
|
482
479
|
await removeAppFromUserRoles(ctx, appId)
|
|
483
480
|
}
|
|
484
|
-
await
|
|
481
|
+
await cache.app.invalidateAppMetadata(appId)
|
|
485
482
|
return result
|
|
486
483
|
}
|
|
487
484
|
|
|
@@ -517,19 +514,17 @@ export const sync = async (ctx: any, next: any) => {
|
|
|
517
514
|
}
|
|
518
515
|
|
|
519
516
|
const appId = ctx.params.appId
|
|
520
|
-
if (!isDevAppID(appId)) {
|
|
517
|
+
if (!dbCore.isDevAppID(appId)) {
|
|
521
518
|
ctx.throw(400, "This action cannot be performed for production apps")
|
|
522
519
|
}
|
|
523
520
|
|
|
524
521
|
// replicate prod to dev
|
|
525
|
-
const prodAppId = getProdAppID(appId)
|
|
522
|
+
const prodAppId = dbCore.getProdAppID(appId)
|
|
526
523
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (info.error) throw info.error
|
|
532
|
-
} catch (err) {
|
|
524
|
+
// specific case, want to make sure setup is skipped
|
|
525
|
+
const prodDb = context.getProdAppDB({ skip_setup: true })
|
|
526
|
+
const exists = await prodDb.exists()
|
|
527
|
+
if (!exists) {
|
|
533
528
|
// the database doesn't exist. Don't replicate
|
|
534
529
|
ctx.status = 200
|
|
535
530
|
ctx.body = {
|
|
@@ -538,7 +533,7 @@ export const sync = async (ctx: any, next: any) => {
|
|
|
538
533
|
return next()
|
|
539
534
|
}
|
|
540
535
|
|
|
541
|
-
const replication = new Replication({
|
|
536
|
+
const replication = new dbCore.Replication({
|
|
542
537
|
source: prodAppId,
|
|
543
538
|
target: appId,
|
|
544
539
|
})
|
|
@@ -579,7 +574,7 @@ export const updateAppPackage = async (appPackage: any, appId: any) => {
|
|
|
579
574
|
|
|
580
575
|
await db.put(newAppPackage)
|
|
581
576
|
// remove any cached metadata, so that it will be updated
|
|
582
|
-
await
|
|
577
|
+
await cache.app.invalidateAppMetadata(appId)
|
|
583
578
|
return newAppPackage
|
|
584
579
|
})
|
|
585
580
|
}
|
|
@@ -3,6 +3,7 @@ import { InternalTables } from "../../db/utils"
|
|
|
3
3
|
import { getFullUser } from "../../utilities/users"
|
|
4
4
|
import { roles, context } from "@budibase/backend-core"
|
|
5
5
|
import { groups } from "@budibase/pro"
|
|
6
|
+
import { ContextUser, User } from "@budibase/types"
|
|
6
7
|
|
|
7
8
|
const PUBLIC_ROLE = roles.BUILTIN_ROLE_IDS.PUBLIC
|
|
8
9
|
|
|
@@ -24,7 +25,7 @@ export async function fetchSelf(ctx: any) {
|
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
const appId = context.getAppId()
|
|
27
|
-
const user = await getFullUser(ctx, userId)
|
|
28
|
+
const user: ContextUser = await getFullUser(ctx, userId)
|
|
28
29
|
// this shouldn't be returned by the app self
|
|
29
30
|
delete user.roles
|
|
30
31
|
// forward the csrf token from the session
|
|
@@ -34,7 +35,7 @@ export async function fetchSelf(ctx: any) {
|
|
|
34
35
|
const db = context.getAppDB()
|
|
35
36
|
// check for group permissions
|
|
36
37
|
if (!user.roleId || user.roleId === PUBLIC_ROLE) {
|
|
37
|
-
const groupRoleId = await groups.getGroupRoleId(user, appId)
|
|
38
|
+
const groupRoleId = await groups.getGroupRoleId(user as User, appId)
|
|
38
39
|
user.roleId = groupRoleId || user.roleId
|
|
39
40
|
}
|
|
40
41
|
// remove the full roles structure
|