@budibase/server 2.1.32-alpha.5 → 2.1.32-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/builder/assets/{index.192baaa3.js → index.e0fdcf54.js} +184 -184
- package/builder/index.html +1 -1
- package/coverage/clover.xml +3112 -3177
- package/coverage/coverage-final.json +105 -106
- package/coverage/lcov-report/index.html +145 -145
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{apikeys.js.html → apikeys.ts.html} +19 -19
- package/coverage/lcov-report/src/api/controllers/application.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/{automation.js.html → automation.ts.html} +68 -68
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{cloud.js.html → cloud.ts.html} +40 -40
- package/coverage/lcov-report/src/api/controllers/component.ts.html +6 -3
- package/coverage/lcov-report/src/api/controllers/{datasource.js.html → datasource.ts.html} +100 -79
- package/coverage/lcov-report/src/api/controllers/deploy/{Deployment.js.html → Deployment.ts.html} +30 -21
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +6 -6
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/index.html +108 -108
- package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{layout.js.html → layout.ts.html} +19 -19
- package/coverage/lcov-report/src/api/controllers/{metadata.js.html → metadata.ts.html} +19 -16
- package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{permission.js.html → permission.ts.html} +73 -64
- 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 +11 -11
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +10 -13
- 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 +1 -1
- package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
- 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 +3 -3
- 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 +11 -11
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +8 -11
- 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 +2 -2
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/{validation.js.html → validation.ts.html} +10 -10
- package/coverage/lcov-report/src/api/controllers/{role.js.html → role.ts.html} +37 -49
- package/coverage/lcov-report/src/api/controllers/{routing.js.html → routing.ts.html} +58 -49
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +6 -18
- package/coverage/lcov-report/src/api/controllers/row/external.js.html +4 -4
- package/coverage/lcov-report/src/api/controllers/row/index.html +35 -35
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internal.js.html +17 -20
- package/coverage/lcov-report/src/api/controllers/row/{internalSearch.js.html → internalSearch.ts.html} +175 -103
- package/coverage/lcov-report/src/api/controllers/row/{staticFormula.js.html → staticFormula.ts.html} +62 -47
- package/coverage/lcov-report/src/api/controllers/row/{utils.js.html → utils.ts.html} +57 -36
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +29 -17
- package/coverage/lcov-report/src/api/controllers/{script.js.html → script.ts.html} +10 -7
- package/coverage/lcov-report/src/api/controllers/static/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +15 -27
- package/coverage/lcov-report/src/api/controllers/table/{bulkFormula.js.html → bulkFormula.ts.html} +89 -47
- package/coverage/lcov-report/src/api/controllers/table/{external.js.html → external.ts.html} +192 -87
- package/coverage/lcov-report/src/api/controllers/table/index.html +39 -39
- package/coverage/lcov-report/src/api/controllers/table/{index.js.html → index.ts.html} +28 -28
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +3 -6
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/{templates.js.html → templates.ts.html} +27 -18
- package/coverage/lcov-report/src/api/controllers/{user.js.html → user.ts.html} +72 -78
- package/coverage/lcov-report/src/api/controllers/view/{exporters.js.html → exporters.ts.html} +13 -7
- package/coverage/lcov-report/src/api/controllers/view/index.html +21 -21
- package/coverage/lcov-report/src/api/controllers/view/{index.js.html → index.ts.html} +68 -41
- package/coverage/lcov-report/src/api/controllers/view/{utils.js.html → utils.ts.html} +54 -36
- 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 +14 -14
- package/coverage/lcov-report/src/api/{index.js.html → index.ts.html} +28 -49
- package/coverage/lcov-report/src/api/routes/{analytics.js.html → analytics.ts.html} +7 -7
- package/coverage/lcov-report/src/api/routes/{apikeys.js.html → apikeys.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/application.ts.html +35 -11
- package/coverage/lcov-report/src/api/routes/auth.ts.html +3 -3
- package/coverage/lcov-report/src/api/routes/{automation.js.html → automation.ts.html} +41 -35
- package/coverage/lcov-report/src/api/routes/backup.ts.html +18 -6
- package/coverage/lcov-report/src/api/routes/{deploy.js.html → cloud.ts.html} +18 -15
- package/coverage/lcov-report/src/api/routes/{component.js.html → component.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/{datasource.js.html → datasource.ts.html} +53 -26
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +148 -0
- package/coverage/lcov-report/src/api/routes/{dev.js.html → dev.ts.html} +54 -18
- package/coverage/lcov-report/src/api/routes/index.html +41 -41
- package/coverage/lcov-report/src/api/routes/index.ts.html +3 -3
- package/coverage/lcov-report/src/api/routes/integration.ts.html +133 -0
- package/coverage/lcov-report/src/api/routes/{layout.js.html → layout.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/{metadata.js.html → metadata.ts.html} +17 -17
- package/coverage/lcov-report/src/api/routes/{migrations.js.html → migrations.ts.html} +12 -12
- package/coverage/lcov-report/src/api/routes/{permission.js.html → permission.ts.html} +41 -17
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +32 -8
- 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 +1 -1
- 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 → query.ts.html} +24 -33
- package/coverage/lcov-report/src/{utilities/routing/index.js.html → api/routes/role.ts.html} +32 -35
- package/coverage/lcov-report/src/api/routes/{routing.js.html → routing.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/row.ts.html +8 -14
- package/coverage/lcov-report/src/api/routes/{screen.js.html → screen.ts.html} +29 -14
- package/coverage/lcov-report/src/api/routes/{script.js.html → script.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/static.ts.html +9 -18
- package/coverage/lcov-report/src/api/routes/{table.js.html → table.ts.html} +16 -25
- package/coverage/lcov-report/src/api/routes/{templates.js.html → templates.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +12 -18
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +10 -10
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/{user.js.html → user.ts.html} +14 -20
- package/coverage/lcov-report/src/api/routes/utils/index.html +6 -6
- package/coverage/lcov-report/src/api/routes/utils/{validators.js.html → validators.ts.html} +39 -51
- package/coverage/lcov-report/src/api/routes/{view.js.html → view.ts.html} +33 -24
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +3 -3
- package/coverage/lcov-report/src/app.ts.html +9 -12
- 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 +10 -10
- 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 +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +1 -1
- 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 +11 -14
- package/coverage/lcov-report/src/automations/utils.ts.html +1 -1
- package/coverage/lcov-report/src/constants/index.html +5 -5
- package/coverage/lcov-report/src/constants/index.js.html +7 -13
- package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/src/constants/screens.js.html +3 -3
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/employeeImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/expensesImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/jobsImport.js.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
- package/coverage/lcov-report/src/db/inMemoryView.js.html +4 -4
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +3 -3
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.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 +3 -3
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +4 -4
- package/coverage/lcov-report/src/db/newid.js.html +1 -1
- package/coverage/lcov-report/src/db/utils.ts.html +2 -2
- 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 +1 -1
- 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 +17 -32
- 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 +2 -2
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +2 -2
- 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 +1 -1
- package/coverage/lcov-report/src/integrations/index.html +4 -4
- package/coverage/lcov-report/src/integrations/index.ts.html +58 -46
- 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.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/authorized.ts.html +30 -51
- package/coverage/lcov-report/src/middleware/builder.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/index.html +10 -10
- package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/publicApi.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/resourceId.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/utils.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +3 -3
- 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 +1 -1
- 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 +1 -1
- 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 +9 -9
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +7 -10
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +7 -10
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +4 -4
- 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/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 +16 -10
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +9 -21
- package/coverage/lcov-report/src/sdk/app/backups/index.html +16 -16
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +1 -1
- 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 +3 -3
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +61 -49
- package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.js.html +9 -12
- package/coverage/lcov-report/src/threads/automation.ts.html +20 -23
- package/coverage/lcov-report/src/threads/index.html +24 -24
- package/coverage/lcov-report/src/threads/index.ts.html +1 -1
- package/coverage/lcov-report/src/threads/query.ts.html +18 -33
- package/coverage/lcov-report/src/threads/utils.ts.html +10 -13
- package/coverage/lcov-report/src/utilities/{budibaseDir.js.html → budibaseDir.ts.html} +5 -5
- 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 +13 -13
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +5 -20
- package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +16 -16
- package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
- package/coverage/lcov-report/src/utilities/global.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/index.html +44 -44
- package/coverage/lcov-report/src/utilities/{index.js.html → index.ts.html} +68 -44
- 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 → redis.ts.html} +36 -33
- package/coverage/lcov-report/src/utilities/routing/index.html +6 -6
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +181 -0
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +38 -23
- package/coverage/lcov-report/src/utilities/rowProcessor/{index.js.html → index.ts.html} +106 -337
- package/coverage/lcov-report/src/utilities/rowProcessor/map.js.html +370 -0
- package/coverage/lcov-report/src/utilities/rowProcessor/{utils.js.html → utils.ts.html} +43 -31
- package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{security.js.html → security.ts.html} +49 -67
- package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +18 -18
- package/coverage/lcov-report/src/utilities/usageQuota/{rows.js.html → rows.ts.html} +27 -39
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{users.js.html → users.ts.html} +22 -28
- package/coverage/lcov-report/src/utilities/{workerRequests.js.html → workerRequests.ts.html} +69 -54
- package/coverage/lcov-report/src/watch.ts.html +8 -11
- package/coverage/lcov-report/src/websocket.ts.html +1 -1
- package/coverage/lcov.info +5519 -5768
- package/dist/api/controllers/apikeys.js +12 -9
- package/dist/api/controllers/automation.js +104 -84
- package/dist/api/controllers/cloud.js +84 -71
- package/dist/api/controllers/component.js +4 -2
- package/dist/api/controllers/datasource.js +125 -111
- package/dist/api/controllers/deploy/Deployment.js +10 -6
- package/dist/api/controllers/layout.js +18 -15
- package/dist/api/controllers/metadata.js +51 -37
- package/dist/api/controllers/permission.js +52 -43
- package/dist/api/controllers/plugin/index.js +6 -7
- package/dist/api/controllers/public/tables.js +29 -9
- package/dist/api/controllers/query/import/index.js +1 -2
- package/dist/api/controllers/query/validation.js +41 -33
- package/dist/api/controllers/role.js +29 -27
- package/dist/api/controllers/routing.js +71 -58
- package/dist/api/controllers/row/ExternalRequest.js +6 -7
- package/dist/api/controllers/row/external.js +3 -3
- package/dist/api/controllers/row/internal.js +11 -12
- package/dist/api/controllers/row/internalSearch.js +95 -80
- package/dist/api/controllers/row/staticFormula.js +85 -75
- package/dist/api/controllers/row/utils.js +118 -84
- package/dist/api/controllers/screen.js +81 -66
- package/dist/api/controllers/script.js +13 -6
- package/dist/api/controllers/static/index.js +9 -11
- package/dist/api/controllers/table/bulkFormula.js +47 -35
- package/dist/api/controllers/table/external.js +67 -54
- package/dist/api/controllers/table/index.js +66 -33
- package/dist/api/controllers/table/internal.js +1 -2
- package/dist/api/controllers/table/utils.js +8 -9
- package/dist/api/controllers/templates.js +17 -10
- package/dist/api/controllers/user.js +82 -70
- package/dist/api/controllers/view/exporters.js +8 -4
- package/dist/api/controllers/view/index.js +201 -153
- package/dist/api/controllers/view/utils.js +151 -121
- package/dist/api/index.js +38 -34
- package/dist/api/routes/analytics.js +29 -3
- package/dist/api/routes/apikeys.js +33 -7
- package/dist/api/routes/application.js +8 -9
- package/dist/api/routes/auth.js +1 -2
- package/dist/api/routes/automation.js +46 -20
- package/dist/api/routes/backup.js +3 -4
- package/dist/api/routes/cloud.js +32 -6
- package/dist/api/routes/component.js +32 -6
- package/dist/api/routes/datasource.js +39 -13
- package/dist/api/routes/deploy.js +34 -8
- package/dist/api/routes/dev.js +36 -10
- package/dist/api/routes/integration.js +10 -7
- package/dist/api/routes/layout.js +33 -7
- package/dist/api/routes/metadata.js +36 -10
- package/dist/api/routes/migrations.js +32 -6
- package/dist/api/routes/permission.js +38 -12
- package/dist/api/routes/plugin.js +5 -5
- package/dist/api/routes/query.js +42 -15
- package/dist/api/routes/role.js +36 -10
- package/dist/api/routes/routing.js +32 -6
- package/dist/api/routes/row.js +2 -1
- package/dist/api/routes/screen.js +35 -9
- package/dist/api/routes/script.js +32 -6
- package/dist/api/routes/static.js +9 -9
- package/dist/api/routes/table.js +40 -13
- package/dist/api/routes/templates.js +33 -7
- package/dist/api/routes/tests/utilities/TestFunctions.js +6 -8
- package/dist/api/routes/user.js +40 -13
- package/dist/api/routes/utils/validators.js +142 -126
- package/dist/api/routes/view.js +38 -12
- package/dist/api/routes/webhook.js +1 -2
- package/dist/app.js +3 -4
- package/dist/automations/triggers.js +5 -6
- package/dist/constants/index.js +3 -5
- package/dist/constants/screens.js +2 -2
- package/dist/db/inMemoryView.js +3 -3
- package/dist/db/linkedRows/LinkController.js +2 -2
- package/dist/db/linkedRows/index.js +2 -2
- package/dist/db/linkedRows/linkUtils.js +3 -3
- package/dist/db/views/staticViews.js +4 -4
- package/dist/integrations/index.js +15 -6
- package/dist/middleware/authorized.js +22 -21
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/usageQuotas/syncApps.js +3 -4
- package/dist/migrations/functions/usageQuotas/syncRows.js +3 -4
- package/dist/migrations/functions/userEmailViewCasing.js +3 -3
- package/dist/package.json +6 -6
- package/dist/sdk/app/backups/exports.js +1 -2
- package/dist/sdk/app/backups/imports.js +2 -3
- package/dist/startup.js +4 -4
- package/dist/tests/utilities/TestConfiguration.js +27 -35
- package/dist/tests/utilities/structures.js +3 -4
- package/dist/threads/automation.js +15 -16
- package/dist/threads/query.js +17 -19
- package/dist/threads/utils.js +11 -9
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/budibaseDir.js +4 -2
- package/dist/utilities/fileSystem/clientLibrary.js +12 -12
- package/dist/utilities/fileSystem/index.js +3 -3
- package/dist/utilities/index.js +102 -75
- package/dist/utilities/redis.js +100 -65
- package/dist/utilities/routing/index.js +27 -23
- package/dist/utilities/rowProcessor/index.js +124 -191
- package/dist/utilities/rowProcessor/map.js +96 -0
- package/dist/utilities/rowProcessor/utils.js +35 -26
- package/dist/utilities/security.js +39 -35
- package/dist/utilities/usageQuota/rows.js +56 -49
- package/dist/utilities/users.js +31 -28
- package/dist/utilities/workerRequests.js +115 -82
- package/dist/watch.js +1 -2
- package/package.json +7 -7
- package/scripts/exportAppTemplate.js +2 -2
- package/src/api/controllers/{apikeys.js → apikeys.ts} +10 -10
- package/src/api/controllers/auth.ts +2 -2
- package/src/api/controllers/{automation.js → automation.ts} +48 -48
- package/src/api/controllers/{cloud.js → cloud.ts} +24 -24
- package/src/api/controllers/component.ts +2 -1
- package/src/api/controllers/{datasource.js → datasource.ts} +55 -48
- package/src/api/controllers/deploy/{Deployment.js → Deployment.ts} +13 -10
- package/src/api/controllers/{layout.js → layout.ts} +8 -8
- package/src/api/controllers/{metadata.js → metadata.ts} +11 -10
- package/src/api/controllers/{permission.js → permission.ts} +49 -46
- package/src/api/controllers/plugin/index.ts +4 -5
- package/src/api/controllers/public/tables.ts +2 -2
- package/src/api/controllers/query/import/index.ts +2 -3
- package/src/api/controllers/query/{validation.js → validation.ts} +7 -7
- package/src/api/controllers/{role.js → role.ts} +21 -25
- package/src/api/controllers/{routing.js → routing.ts} +37 -34
- package/src/api/controllers/row/ExternalRequest.ts +4 -8
- package/src/api/controllers/row/external.js +3 -3
- package/src/api/controllers/row/internal.js +11 -12
- package/src/api/controllers/row/{internalSearch.js → internalSearch.ts} +92 -68
- package/src/api/controllers/row/{staticFormula.js → staticFormula.ts} +28 -23
- package/src/api/controllers/row/{utils.js → utils.ts} +25 -18
- package/src/api/controllers/screen.ts +10 -6
- package/src/api/controllers/script.ts +12 -0
- package/src/api/controllers/static/index.ts +9 -13
- package/src/api/controllers/table/{bulkFormula.js → bulkFormula.ts} +39 -25
- package/src/api/controllers/table/{external.js → external.ts} +86 -51
- package/src/api/controllers/table/{index.js → index.ts} +17 -17
- package/src/api/controllers/table/internal.ts +1 -2
- package/src/api/controllers/table/utils.ts +10 -10
- package/src/api/controllers/{templates.js → templates.ts} +10 -7
- package/src/api/controllers/{user.js → user.ts} +47 -49
- package/src/api/controllers/view/{exporters.js → exporters.ts} +5 -3
- package/src/api/controllers/view/{index.js → index.ts} +36 -27
- package/src/api/controllers/view/{utils.js → utils.ts} +26 -20
- package/src/api/{index.js → index.ts} +15 -22
- package/src/api/routes/analytics.ts +9 -0
- package/src/api/routes/apikeys.ts +12 -0
- package/src/api/routes/application.ts +17 -9
- package/src/api/routes/auth.ts +2 -2
- package/src/api/routes/automation.ts +87 -0
- package/src/api/routes/backup.ts +8 -4
- package/src/api/routes/cloud.ts +18 -0
- package/src/api/routes/component.ts +14 -0
- package/src/api/routes/datasource.ts +60 -0
- package/src/api/routes/deploy.ts +21 -0
- package/src/api/routes/dev.ts +38 -0
- package/src/api/routes/integration.ts +16 -0
- package/src/api/routes/layout.ts +16 -0
- package/src/api/routes/{metadata.js → metadata.ts} +13 -13
- package/src/api/routes/migrations.ts +14 -0
- package/src/api/routes/permission.ts +41 -0
- package/src/api/routes/plugin.ts +14 -6
- package/src/api/routes/{query.js → query.ts} +17 -20
- package/src/api/routes/role.ts +24 -0
- package/src/api/routes/routing.ts +14 -0
- package/src/api/routes/row.ts +3 -5
- package/src/api/routes/screen.ts +23 -0
- package/src/api/routes/script.ts +10 -0
- package/src/api/routes/static.ts +4 -7
- package/src/api/routes/{table.js → table.ts} +9 -12
- package/src/api/routes/templates.ts +16 -0
- package/src/api/routes/tests/backup.spec.js +9 -1
- package/src/api/routes/tests/permissions.spec.js +2 -1
- package/src/api/routes/tests/role.spec.js +3 -5
- package/src/api/routes/tests/routing.spec.js +2 -1
- package/src/api/routes/tests/row.spec.js +3 -4
- package/src/api/routes/tests/user.spec.js +2 -1
- package/src/api/routes/tests/utilities/TestFunctions.ts +6 -8
- package/src/api/routes/{user.js → user.ts} +7 -9
- package/src/api/routes/utils/{validators.js → validators.ts} +33 -37
- package/src/api/routes/view.ts +34 -0
- package/src/api/routes/webhook.ts +2 -2
- package/src/app.ts +3 -4
- package/src/automations/triggers.js +5 -6
- package/src/constants/index.js +3 -5
- package/src/constants/screens.js +2 -2
- package/src/db/inMemoryView.js +3 -3
- package/src/db/linkedRows/LinkController.js +2 -2
- package/src/db/linkedRows/index.js +2 -2
- package/src/db/linkedRows/linkUtils.js +3 -3
- package/src/db/utils.ts +1 -1
- package/src/db/views/staticViews.js +4 -4
- package/src/integrations/base/sql.ts +1 -1
- package/src/integrations/base/sqlTable.ts +1 -1
- package/src/integrations/index.ts +45 -41
- package/src/middleware/authorized.ts +21 -28
- package/src/middleware/tests/authorized.spec.js +5 -6
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/tests/appUrls.spec.js +4 -4
- package/src/migrations/functions/tests/userEmailViewCasing.spec.js +14 -9
- package/src/migrations/functions/usageQuotas/syncApps.ts +3 -4
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -4
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +7 -7
- package/src/migrations/functions/userEmailViewCasing.ts +3 -3
- package/src/sdk/app/backups/exports.ts +5 -3
- package/src/sdk/app/backups/imports.ts +3 -7
- package/src/startup.ts +2 -2
- package/src/tests/utilities/TestConfiguration.js +39 -35
- package/src/tests/utilities/structures.js +3 -4
- package/src/threads/automation.ts +14 -15
- package/src/threads/query.ts +11 -16
- package/src/threads/utils.ts +4 -5
- package/src/utilities/budibaseDir.ts +3 -0
- package/src/utilities/fileSystem/clientLibrary.js +12 -12
- package/src/utilities/fileSystem/index.js +8 -8
- package/src/utilities/{index.js → index.ts} +40 -32
- package/src/utilities/{redis.js → redis.ts} +21 -20
- package/src/utilities/routing/index.ts +32 -0
- package/src/utilities/rowProcessor/{index.js → index.ts} +65 -142
- package/src/utilities/rowProcessor/map.js +95 -0
- package/src/utilities/rowProcessor/{utils.js → utils.ts} +19 -15
- package/src/utilities/security.ts +65 -0
- package/src/utilities/usageQuota/{rows.js → rows.ts} +14 -18
- package/src/utilities/{users.js → users.ts} +11 -13
- package/src/utilities/{workerRequests.js → workerRequests.ts} +43 -38
- package/src/watch.ts +2 -3
- package/coverage/lcov-report/src/api/routes/cloud.js.html +0 -127
- package/coverage/lcov-report/src/api/routes/integration.js.html +0 -121
- package/coverage/lcov-report/src/api/routes/role.js.html +0 -130
- package/coverage/lcov-report/src/module.d.ts.html +0 -127
- package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +0 -193
- package/dist/utilities/fileSystem/utilities.js +0 -22
- package/src/api/controllers/script.js +0 -11
- package/src/api/routes/analytics.js +0 -9
- package/src/api/routes/apikeys.js +0 -12
- package/src/api/routes/automation.js +0 -85
- package/src/api/routes/cloud.js +0 -14
- package/src/api/routes/component.js +0 -14
- package/src/api/routes/datasource.js +0 -51
- package/src/api/routes/deploy.js +0 -17
- package/src/api/routes/dev.js +0 -26
- package/src/api/routes/integration.js +0 -12
- package/src/api/routes/layout.js +0 -16
- package/src/api/routes/migrations.js +0 -14
- package/src/api/routes/permission.js +0 -33
- package/src/api/routes/role.js +0 -15
- package/src/api/routes/routing.js +0 -14
- package/src/api/routes/screen.js +0 -18
- package/src/api/routes/script.js +0 -10
- package/src/api/routes/templates.js +0 -16
- package/src/api/routes/view.js +0 -31
- package/src/module.d.ts +0 -14
- package/src/utilities/budibaseDir.js +0 -3
- package/src/utilities/fileSystem/utilities.js +0 -36
- package/src/utilities/routing/index.js +0 -25
- package/src/utilities/security.js +0 -71
package/src/api/routes/static.ts
CHANGED
|
@@ -2,15 +2,12 @@ import Router from "@koa/router"
|
|
|
2
2
|
import * as controller from "../controllers/static"
|
|
3
3
|
import { budibaseTempDir } from "../../utilities/budibaseDir"
|
|
4
4
|
import authorized from "../../middleware/authorized"
|
|
5
|
-
import {
|
|
6
|
-
BUILDER,
|
|
7
|
-
PermissionType,
|
|
8
|
-
PermissionLevel,
|
|
9
|
-
} from "@budibase/backend-core/permissions"
|
|
5
|
+
import { permissions } from "@budibase/backend-core"
|
|
10
6
|
import * as env from "../../environment"
|
|
11
7
|
import { paramResource } from "../../middleware/resourceId"
|
|
8
|
+
const { BUILDER, PermissionType, PermissionLevel } = permissions
|
|
12
9
|
|
|
13
|
-
const router = new Router()
|
|
10
|
+
const router: Router = new Router()
|
|
14
11
|
|
|
15
12
|
/* istanbul ignore next */
|
|
16
13
|
router.param("file", async (file: any, ctx: any, next: any) => {
|
|
@@ -65,4 +62,4 @@ router
|
|
|
65
62
|
controller.getSignedUploadURL
|
|
66
63
|
)
|
|
67
64
|
|
|
68
|
-
export
|
|
65
|
+
export = router
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
PermissionType,
|
|
9
|
-
} = require("@budibase/backend-core/permissions")
|
|
10
|
-
const { tableValidator } = require("./utils/validators")
|
|
1
|
+
import Router from "@koa/router"
|
|
2
|
+
import * as tableController from "../controllers/table"
|
|
3
|
+
import authorized from "../../middleware/authorized"
|
|
4
|
+
import { paramResource, bodyResource } from "../../middleware/resourceId"
|
|
5
|
+
import { permissions } from "@budibase/backend-core"
|
|
6
|
+
import { tableValidator } from "./utils/validators"
|
|
7
|
+
const { BUILDER, PermissionLevel, PermissionType } = permissions
|
|
11
8
|
|
|
12
|
-
const router = new Router()
|
|
9
|
+
const router: Router = new Router()
|
|
13
10
|
|
|
14
11
|
router
|
|
15
12
|
/**
|
|
@@ -193,4 +190,4 @@ router
|
|
|
193
190
|
tableController.bulkImport
|
|
194
191
|
)
|
|
195
192
|
|
|
196
|
-
|
|
193
|
+
export = router
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Router from "@koa/router"
|
|
2
|
+
import * as controller from "../controllers/templates"
|
|
3
|
+
import authorized from "../../middleware/authorized"
|
|
4
|
+
import { permissions } from "@budibase/backend-core"
|
|
5
|
+
|
|
6
|
+
const router: Router = new Router()
|
|
7
|
+
|
|
8
|
+
router
|
|
9
|
+
.get("/api/templates", authorized(permissions.BUILDER), controller.fetch)
|
|
10
|
+
.get(
|
|
11
|
+
"/api/templates/:type/:name",
|
|
12
|
+
authorized(permissions.BUILDER),
|
|
13
|
+
controller.downloadTemplate
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
export = router
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
jest.mock("
|
|
1
|
+
jest.mock("@budibase/backend-core", () => {
|
|
2
|
+
const core = jest.requireActual("@budibase/backend-core")
|
|
3
|
+
return {
|
|
4
|
+
...core,
|
|
5
|
+
objectStore: {
|
|
6
|
+
budibaseTempDir: core.objectStore.budibaseTempDir,
|
|
7
|
+
},
|
|
8
|
+
}
|
|
9
|
+
})
|
|
2
10
|
|
|
3
11
|
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
|
4
12
|
const setup = require("./utilities")
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { roles } = require("@budibase/backend-core")
|
|
2
2
|
const setup = require("./utilities")
|
|
3
3
|
const { basicRow } = setup.structures
|
|
4
|
+
const { BUILTIN_ROLE_IDS } = roles
|
|
4
5
|
|
|
5
6
|
const HIGHER_ROLE_ID = BUILTIN_ROLE_IDS.BASIC
|
|
6
7
|
const STD_ROLE_ID = BUILTIN_ROLE_IDS.PUBLIC
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
BuiltinPermissionID,
|
|
4
|
-
} = require("@budibase/backend-core/permissions")
|
|
1
|
+
const { roles, events, permissions } = require("@budibase/backend-core")
|
|
5
2
|
const setup = require("./utilities")
|
|
6
3
|
const { basicRole } = setup.structures
|
|
7
|
-
const {
|
|
4
|
+
const { BUILTIN_ROLE_IDS } = roles
|
|
5
|
+
const { BuiltinPermissionID } = permissions
|
|
8
6
|
|
|
9
7
|
describe("/roles", () => {
|
|
10
8
|
let request = setup.getRequest()
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const setup = require("./utilities")
|
|
2
2
|
const { basicScreen } = setup.structures
|
|
3
3
|
const { checkBuilderEndpoint, runInProd } = require("./utilities/TestFunctions")
|
|
4
|
-
const {
|
|
4
|
+
const { roles } = require("@budibase/backend-core")
|
|
5
|
+
const { BUILTIN_ROLE_IDS } = roles
|
|
5
6
|
|
|
6
7
|
const route = "/test"
|
|
7
8
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const { outputProcessing } = require("../../../utilities/rowProcessor")
|
|
2
2
|
const setup = require("./utilities")
|
|
3
3
|
const { basicRow } = setup.structures
|
|
4
|
-
const {
|
|
5
|
-
const { doInTenant } = require("@budibase/backend-core/tenancy")
|
|
4
|
+
const { context, tenancy } = require("@budibase/backend-core")
|
|
6
5
|
const {
|
|
7
6
|
quotas,
|
|
8
7
|
} = require("@budibase/pro")
|
|
@@ -447,7 +446,7 @@ describe("/rows", () => {
|
|
|
447
446
|
|
|
448
447
|
describe("fetchEnrichedRows", () => {
|
|
449
448
|
it("should allow enriching some linked rows", async () => {
|
|
450
|
-
const { table, firstRow, secondRow } = await doInTenant(
|
|
449
|
+
const { table, firstRow, secondRow } = await tenancy.doInTenant(
|
|
451
450
|
setup.structures.TENANT_ID,
|
|
452
451
|
async () => {
|
|
453
452
|
const table = await config.createLinkedTable()
|
|
@@ -507,7 +506,7 @@ describe("/rows", () => {
|
|
|
507
506
|
})
|
|
508
507
|
// the environment needs configured for this
|
|
509
508
|
await setup.switchToSelfHosted(async () => {
|
|
510
|
-
doInAppContext(config.getAppId(), async () => {
|
|
509
|
+
context.doInAppContext(config.getAppId(), async () => {
|
|
511
510
|
const enriched = await outputProcessing(table, [row])
|
|
512
511
|
expect(enriched[0].attachment[0].url).toBe(
|
|
513
512
|
`/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv`
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { roles } = require("@budibase/backend-core")
|
|
2
2
|
const { checkPermissionsEndpoint } = require("./utilities/TestFunctions")
|
|
3
3
|
const setup = require("./utilities")
|
|
4
|
+
const { BUILTIN_ROLE_IDS } = roles
|
|
4
5
|
|
|
5
6
|
jest.mock("../../../utilities/workerRequests", () => ({
|
|
6
7
|
getGlobalUsers: jest.fn(() => {
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as rowController from "../../../controllers/row"
|
|
2
2
|
import * as appController from "../../../controllers/application"
|
|
3
3
|
import { AppStatus } from "../../../../db/utils"
|
|
4
|
-
import {
|
|
5
|
-
import { doInTenant } from "@budibase/backend-core/tenancy"
|
|
4
|
+
import { roles, tenancy, context } from "@budibase/backend-core"
|
|
6
5
|
import { TENANT_ID } from "../../../../tests/utilities/structures"
|
|
7
|
-
import { getAppDB, doInAppContext } from "@budibase/backend-core/context"
|
|
8
6
|
import * as env from "../../../../environment"
|
|
9
7
|
|
|
10
8
|
class Request {
|
|
@@ -21,7 +19,7 @@ class Request {
|
|
|
21
19
|
}
|
|
22
20
|
|
|
23
21
|
function runRequest(appId: any, controlFunc: any, request?: any) {
|
|
24
|
-
return doInAppContext(appId, async () => {
|
|
22
|
+
return context.doInAppContext(appId, async () => {
|
|
25
23
|
return controlFunc(request)
|
|
26
24
|
})
|
|
27
25
|
}
|
|
@@ -33,7 +31,7 @@ export const getAllTableRows = async (config: any) => {
|
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
export const clearAllApps = async (tenantId = TENANT_ID) => {
|
|
36
|
-
await doInTenant(tenantId, async () => {
|
|
34
|
+
await tenancy.doInTenant(tenantId, async () => {
|
|
37
35
|
const req: any = { query: { status: AppStatus.DEV }, user: { tenantId } }
|
|
38
36
|
await appController.fetch(req)
|
|
39
37
|
const apps = req.body
|
|
@@ -51,7 +49,7 @@ export const clearAllApps = async (tenantId = TENANT_ID) => {
|
|
|
51
49
|
export const clearAllAutomations = async (config: any) => {
|
|
52
50
|
const automations = await config.getAllAutomations()
|
|
53
51
|
for (let auto of automations) {
|
|
54
|
-
await doInAppContext(config.appId, async () => {
|
|
52
|
+
await context.doInAppContext(config.appId, async () => {
|
|
55
53
|
await config.deleteAutomation(auto)
|
|
56
54
|
})
|
|
57
55
|
}
|
|
@@ -110,7 +108,7 @@ export const checkPermissionsEndpoint = async ({
|
|
|
110
108
|
.expect(200)
|
|
111
109
|
|
|
112
110
|
let failHeader
|
|
113
|
-
if (failRole === BUILTIN_ROLE_IDS.PUBLIC) {
|
|
111
|
+
if (failRole === roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
114
112
|
failHeader = config.publicHeaders({ prodApp: true })
|
|
115
113
|
} else {
|
|
116
114
|
failHeader = await config.login({
|
|
@@ -127,7 +125,7 @@ export const checkPermissionsEndpoint = async ({
|
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
export const getDB = () => {
|
|
130
|
-
return getAppDB()
|
|
128
|
+
return context.getAppDB()
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
export const testAutomation = async (config: any, automation: any) => {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
PermissionType,
|
|
7
|
-
} = require("@budibase/backend-core/permissions")
|
|
1
|
+
import Router from "@koa/router"
|
|
2
|
+
import * as controller from "../controllers/user"
|
|
3
|
+
import authorized from "../../middleware/authorized"
|
|
4
|
+
import { permissions } from "@budibase/backend-core"
|
|
5
|
+
const { PermissionType, PermissionLevel } = permissions
|
|
8
6
|
|
|
9
|
-
const router = new Router()
|
|
7
|
+
const router: Router = new Router()
|
|
10
8
|
|
|
11
9
|
router
|
|
12
10
|
.get(
|
|
@@ -50,4 +48,4 @@ router
|
|
|
50
48
|
controller.getFlags
|
|
51
49
|
)
|
|
52
50
|
|
|
53
|
-
|
|
51
|
+
export = router
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
PermissionLevel,
|
|
6
|
-
} = require("@budibase/backend-core/permissions")
|
|
7
|
-
const { WebhookActionType } = require("@budibase/types")
|
|
8
|
-
const Joi = require("joi")
|
|
1
|
+
import { auth, permissions } from "@budibase/backend-core"
|
|
2
|
+
import { DataSourceOperation } from "../../../constants"
|
|
3
|
+
import { WebhookActionType } from "@budibase/types"
|
|
4
|
+
import Joi from "joi"
|
|
9
5
|
|
|
10
6
|
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("")
|
|
11
7
|
const OPTIONAL_NUMBER = Joi.number().optional().allow(null)
|
|
12
8
|
const OPTIONAL_BOOLEAN = Joi.boolean().optional().allow(null)
|
|
13
9
|
const APP_NAME_REGEX = /^[\w\s]+$/
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
export function tableValidator() {
|
|
16
12
|
// prettier-ignore
|
|
17
|
-
return joiValidator.body(Joi.object({
|
|
13
|
+
return auth.joiValidator.body(Joi.object({
|
|
18
14
|
_id: OPTIONAL_STRING,
|
|
19
15
|
_rev: OPTIONAL_STRING,
|
|
20
16
|
type: OPTIONAL_STRING.valid("table", "internal", "external"),
|
|
@@ -26,16 +22,16 @@ exports.tableValidator = () => {
|
|
|
26
22
|
}).unknown(true))
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
export function nameValidator() {
|
|
30
26
|
// prettier-ignore
|
|
31
|
-
return joiValidator.body(Joi.object({
|
|
27
|
+
return auth.joiValidator.body(Joi.object({
|
|
32
28
|
name: OPTIONAL_STRING,
|
|
33
29
|
}))
|
|
34
30
|
}
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
export function datasourceValidator() {
|
|
37
33
|
// prettier-ignore
|
|
38
|
-
return joiValidator.body(Joi.object({
|
|
34
|
+
return auth.joiValidator.body(Joi.object({
|
|
39
35
|
_id: Joi.string(),
|
|
40
36
|
_rev: Joi.string(),
|
|
41
37
|
type: OPTIONAL_STRING.allow("datasource_plus"),
|
|
@@ -64,9 +60,9 @@ function filterObject() {
|
|
|
64
60
|
}).unknown(true)
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
export function internalSearchValidator() {
|
|
68
64
|
// prettier-ignore
|
|
69
|
-
return joiValidator.body(Joi.object({
|
|
65
|
+
return auth.joiValidator.body(Joi.object({
|
|
70
66
|
tableId: OPTIONAL_STRING,
|
|
71
67
|
query: filterObject(),
|
|
72
68
|
limit: OPTIONAL_NUMBER,
|
|
@@ -78,8 +74,8 @@ exports.internalSearchValidator = () => {
|
|
|
78
74
|
}))
|
|
79
75
|
}
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
return joiValidator.body(
|
|
77
|
+
export function externalSearchValidator() {
|
|
78
|
+
return auth.joiValidator.body(
|
|
83
79
|
Joi.object({
|
|
84
80
|
query: filterObject(),
|
|
85
81
|
paginate: Joi.boolean().optional(),
|
|
@@ -96,9 +92,9 @@ exports.externalSearchValidator = () => {
|
|
|
96
92
|
)
|
|
97
93
|
}
|
|
98
94
|
|
|
99
|
-
|
|
95
|
+
export function datasourceQueryValidator() {
|
|
100
96
|
// prettier-ignore
|
|
101
|
-
return joiValidator.body(Joi.object({
|
|
97
|
+
return auth.joiValidator.body(Joi.object({
|
|
102
98
|
endpoint: Joi.object({
|
|
103
99
|
datasourceId: Joi.string().required(),
|
|
104
100
|
operation: Joi.string().required().valid(...Object.values(DataSourceOperation)),
|
|
@@ -117,9 +113,9 @@ exports.datasourceQueryValidator = () => {
|
|
|
117
113
|
}))
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
|
|
116
|
+
export function webhookValidator() {
|
|
121
117
|
// prettier-ignore
|
|
122
|
-
return joiValidator.body(Joi.object({
|
|
118
|
+
return auth.joiValidator.body(Joi.object({
|
|
123
119
|
live: Joi.bool(),
|
|
124
120
|
_id: OPTIONAL_STRING,
|
|
125
121
|
_rev: OPTIONAL_STRING,
|
|
@@ -132,15 +128,15 @@ exports.webhookValidator = () => {
|
|
|
132
128
|
}).unknown(true))
|
|
133
129
|
}
|
|
134
130
|
|
|
135
|
-
|
|
136
|
-
const permLevelArray = Object.values(PermissionLevel)
|
|
131
|
+
export function roleValidator() {
|
|
132
|
+
const permLevelArray = Object.values(permissions.PermissionLevel)
|
|
137
133
|
// prettier-ignore
|
|
138
|
-
return joiValidator.body(Joi.object({
|
|
134
|
+
return auth.joiValidator.body(Joi.object({
|
|
139
135
|
_id: OPTIONAL_STRING,
|
|
140
136
|
_rev: OPTIONAL_STRING,
|
|
141
137
|
name: Joi.string().required(),
|
|
142
138
|
// this is the base permission ID (for now a built in)
|
|
143
|
-
permissionId: Joi.string().valid(...Object.values(BuiltinPermissionID)).required(),
|
|
139
|
+
permissionId: Joi.string().valid(...Object.values(permissions.BuiltinPermissionID)).required(),
|
|
144
140
|
permissions: Joi.object()
|
|
145
141
|
.pattern(/.*/, [Joi.string().valid(...permLevelArray)])
|
|
146
142
|
.optional(),
|
|
@@ -148,19 +144,19 @@ exports.roleValidator = () => {
|
|
|
148
144
|
}).unknown(true))
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
const permLevelArray = Object.values(PermissionLevel)
|
|
147
|
+
export function permissionValidator() {
|
|
148
|
+
const permLevelArray = Object.values(permissions.PermissionLevel)
|
|
153
149
|
// prettier-ignore
|
|
154
|
-
return joiValidator.params(Joi.object({
|
|
150
|
+
return auth.joiValidator.params(Joi.object({
|
|
155
151
|
level: Joi.string().valid(...permLevelArray).required(),
|
|
156
152
|
resourceId: Joi.string(),
|
|
157
153
|
roleId: Joi.string(),
|
|
158
154
|
}).unknown(true))
|
|
159
155
|
}
|
|
160
156
|
|
|
161
|
-
|
|
157
|
+
export function screenValidator() {
|
|
162
158
|
// prettier-ignore
|
|
163
|
-
return joiValidator.body(Joi.object({
|
|
159
|
+
return auth.joiValidator.body(Joi.object({
|
|
164
160
|
name: Joi.string().required(),
|
|
165
161
|
showNavigation: OPTIONAL_BOOLEAN,
|
|
166
162
|
width: OPTIONAL_STRING,
|
|
@@ -181,7 +177,7 @@ exports.screenValidator = () => {
|
|
|
181
177
|
}).unknown(true))
|
|
182
178
|
}
|
|
183
179
|
|
|
184
|
-
function generateStepSchema(allowStepTypes) {
|
|
180
|
+
function generateStepSchema(allowStepTypes: string[]) {
|
|
185
181
|
// prettier-ignore
|
|
186
182
|
return Joi.object({
|
|
187
183
|
stepId: Joi.string().required(),
|
|
@@ -196,9 +192,9 @@ function generateStepSchema(allowStepTypes) {
|
|
|
196
192
|
}).unknown(true)
|
|
197
193
|
}
|
|
198
194
|
|
|
199
|
-
|
|
195
|
+
export function automationValidator(existing = false) {
|
|
200
196
|
// prettier-ignore
|
|
201
|
-
return joiValidator.body(Joi.object({
|
|
197
|
+
return auth.joiValidator.body(Joi.object({
|
|
202
198
|
_id: existing ? Joi.string().required() : OPTIONAL_STRING,
|
|
203
199
|
_rev: existing ? Joi.string().required() : OPTIONAL_STRING,
|
|
204
200
|
name: Joi.string().required(),
|
|
@@ -210,9 +206,9 @@ exports.automationValidator = (existing = false) => {
|
|
|
210
206
|
}).unknown(true))
|
|
211
207
|
}
|
|
212
208
|
|
|
213
|
-
|
|
209
|
+
export function applicationValidator(opts = { isCreate: true }) {
|
|
214
210
|
// prettier-ignore
|
|
215
|
-
const base = {
|
|
211
|
+
const base: any = {
|
|
216
212
|
_id: OPTIONAL_STRING,
|
|
217
213
|
_rev: OPTIONAL_STRING,
|
|
218
214
|
url: OPTIONAL_STRING,
|
|
@@ -230,7 +226,7 @@ exports.applicationValidator = (opts = { isCreate: true }) => {
|
|
|
230
226
|
base.name = appNameValidator.optional()
|
|
231
227
|
}
|
|
232
228
|
|
|
233
|
-
return joiValidator.body(
|
|
229
|
+
return auth.joiValidator.body(
|
|
234
230
|
Joi.object({
|
|
235
231
|
_id: OPTIONAL_STRING,
|
|
236
232
|
_rev: OPTIONAL_STRING,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Router from "@koa/router"
|
|
2
|
+
import * as viewController from "../controllers/view"
|
|
3
|
+
import * as rowController from "../controllers/row"
|
|
4
|
+
import authorized from "../../middleware/authorized"
|
|
5
|
+
import { paramResource } from "../../middleware/resourceId"
|
|
6
|
+
import { permissions } from "@budibase/backend-core"
|
|
7
|
+
|
|
8
|
+
const router: Router = new Router()
|
|
9
|
+
|
|
10
|
+
router
|
|
11
|
+
.get(
|
|
12
|
+
"/api/views/export",
|
|
13
|
+
authorized(permissions.BUILDER),
|
|
14
|
+
viewController.exportView
|
|
15
|
+
)
|
|
16
|
+
.get(
|
|
17
|
+
"/api/views/:viewName",
|
|
18
|
+
paramResource("viewName"),
|
|
19
|
+
authorized(
|
|
20
|
+
permissions.PermissionType.VIEW,
|
|
21
|
+
permissions.PermissionLevel.READ
|
|
22
|
+
),
|
|
23
|
+
rowController.fetchView
|
|
24
|
+
)
|
|
25
|
+
.get("/api/views", authorized(permissions.BUILDER), viewController.fetch)
|
|
26
|
+
.delete(
|
|
27
|
+
"/api/views/:viewName",
|
|
28
|
+
paramResource("viewName"),
|
|
29
|
+
authorized(permissions.BUILDER),
|
|
30
|
+
viewController.destroy
|
|
31
|
+
)
|
|
32
|
+
.post("/api/views", authorized(permissions.BUILDER), viewController.save)
|
|
33
|
+
|
|
34
|
+
export = router
|
|
@@ -5,7 +5,7 @@ import { permissions } from "@budibase/backend-core"
|
|
|
5
5
|
import { webhookValidator } from "./utils/validators"
|
|
6
6
|
|
|
7
7
|
const BUILDER = permissions.BUILDER
|
|
8
|
-
const router = new Router()
|
|
8
|
+
const router: Router = new Router()
|
|
9
9
|
|
|
10
10
|
router
|
|
11
11
|
.get("/api/webhooks", authorized(BUILDER), controller.fetch)
|
|
@@ -24,4 +24,4 @@ router
|
|
|
24
24
|
// this shouldn't have authorisation, right now its always public
|
|
25
25
|
.post("/api/webhooks/trigger/:instance/:id", controller.trigger)
|
|
26
26
|
|
|
27
|
-
export
|
|
27
|
+
export = router
|
package/src/app.ts
CHANGED
|
@@ -19,10 +19,9 @@ const http = require("http")
|
|
|
19
19
|
const api = require("./api")
|
|
20
20
|
const automations = require("./automations/index")
|
|
21
21
|
const Sentry = require("@sentry/node")
|
|
22
|
-
const { logAlert } = require("@budibase/backend-core/logging")
|
|
23
22
|
const { Thread } = require("./threads")
|
|
24
|
-
import redis from "./utilities/redis"
|
|
25
|
-
import { events } from "@budibase/backend-core"
|
|
23
|
+
import * as redis from "./utilities/redis"
|
|
24
|
+
import { events, logging } from "@budibase/backend-core"
|
|
26
25
|
import { initialise as initialiseWebsockets } from "./websocket"
|
|
27
26
|
import { startup } from "./startup"
|
|
28
27
|
|
|
@@ -93,7 +92,7 @@ process.on("uncaughtException", err => {
|
|
|
93
92
|
return
|
|
94
93
|
}
|
|
95
94
|
errCode = -1
|
|
96
|
-
logAlert("Uncaught exception.", err)
|
|
95
|
+
logging.logAlert("Uncaught exception.", err)
|
|
97
96
|
shutdown()
|
|
98
97
|
})
|
|
99
98
|
|
|
@@ -8,8 +8,7 @@ const { automationQueue } = require("./bullboard")
|
|
|
8
8
|
const { checkTestFlag } = require("../utilities/redis")
|
|
9
9
|
const utils = require("./utils")
|
|
10
10
|
const env = require("../environment")
|
|
11
|
-
const {
|
|
12
|
-
const { getAllApps } = require("@budibase/backend-core/db")
|
|
11
|
+
const { context, db: dbCore } = require("@budibase/backend-core")
|
|
13
12
|
|
|
14
13
|
const TRIGGER_DEFINITIONS = definitions
|
|
15
14
|
const JOB_OPTS = {
|
|
@@ -18,7 +17,7 @@ const JOB_OPTS = {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
async function getAllAutomations() {
|
|
21
|
-
const db = getAppDB()
|
|
20
|
+
const db = context.getAppDB()
|
|
22
21
|
let automations = await db.allDocs(
|
|
23
22
|
getAutomationParams(null, { include_docs: true })
|
|
24
23
|
)
|
|
@@ -30,7 +29,7 @@ async function queueRelevantRowAutomations(event, eventType) {
|
|
|
30
29
|
throw `No appId specified for ${eventType} - check event emitters.`
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
doInAppContext(event.appId, async () => {
|
|
32
|
+
context.doInAppContext(event.appId, async () => {
|
|
34
33
|
let automations = await getAllAutomations()
|
|
35
34
|
|
|
36
35
|
// filter down to the correct event type
|
|
@@ -122,9 +121,9 @@ exports.rebootTrigger = async () => {
|
|
|
122
121
|
}
|
|
123
122
|
// iterate through all production apps, find the reboot crons
|
|
124
123
|
// and trigger events for them
|
|
125
|
-
const appIds = await getAllApps({ dev: false, idsOnly: true })
|
|
124
|
+
const appIds = await dbCore.getAllApps({ dev: false, idsOnly: true })
|
|
126
125
|
for (let prodAppId of appIds) {
|
|
127
|
-
await doInAppContext(prodAppId, async () => {
|
|
126
|
+
await context.doInAppContext(prodAppId, async () => {
|
|
128
127
|
let automations = await getAllAutomations()
|
|
129
128
|
let rebootEvents = []
|
|
130
129
|
for (let automation of automations) {
|
package/src/constants/index.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const { UserStatus } = require("@budibase/backend-core/constants")
|
|
3
|
-
const { objectStore } = require("@budibase/backend-core")
|
|
1
|
+
const { objectStore, roles, constants } = require("@budibase/backend-core")
|
|
4
2
|
|
|
5
3
|
const FilterTypes = {
|
|
6
4
|
STRING: "string",
|
|
@@ -139,7 +137,7 @@ exports.USERS_TABLE_SCHEMA = {
|
|
|
139
137
|
constraints: {
|
|
140
138
|
type: exports.FieldTypes.STRING,
|
|
141
139
|
presence: false,
|
|
142
|
-
inclusion: Object.values(BUILTIN_ROLE_IDS),
|
|
140
|
+
inclusion: Object.values(roles.BUILTIN_ROLE_IDS),
|
|
143
141
|
},
|
|
144
142
|
},
|
|
145
143
|
status: {
|
|
@@ -149,7 +147,7 @@ exports.USERS_TABLE_SCHEMA = {
|
|
|
149
147
|
constraints: {
|
|
150
148
|
type: exports.FieldTypes.STRING,
|
|
151
149
|
presence: false,
|
|
152
|
-
inclusion: Object.values(UserStatus),
|
|
150
|
+
inclusion: Object.values(constants.UserStatus),
|
|
153
151
|
},
|
|
154
152
|
},
|
|
155
153
|
},
|
package/src/constants/screens.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { roles } = require("@budibase/backend-core")
|
|
2
2
|
const { BASE_LAYOUT_PROP_IDS } = require("./layouts")
|
|
3
3
|
|
|
4
4
|
exports.createHomeScreen = () => ({
|
|
@@ -40,7 +40,7 @@ exports.createHomeScreen = () => ({
|
|
|
40
40
|
},
|
|
41
41
|
routing: {
|
|
42
42
|
route: "/",
|
|
43
|
-
roleId: BUILTIN_ROLE_IDS.BASIC,
|
|
43
|
+
roleId: roles.BUILTIN_ROLE_IDS.BASIC,
|
|
44
44
|
},
|
|
45
45
|
name: "home-screen",
|
|
46
46
|
})
|
package/src/db/inMemoryView.js
CHANGED
|
@@ -2,8 +2,8 @@ const newid = require("./newid")
|
|
|
2
2
|
|
|
3
3
|
// bypass the main application db config
|
|
4
4
|
// use in memory pouchdb directly
|
|
5
|
-
const {
|
|
6
|
-
const Pouch = getPouch({ inMemory: true })
|
|
5
|
+
const { db: dbCore } = require("@budibase/backend-core")
|
|
6
|
+
const Pouch = dbCore.getPouch({ inMemory: true })
|
|
7
7
|
|
|
8
8
|
exports.runView = async (view, calculation, group, data) => {
|
|
9
9
|
// use a different ID each time for the DB, make sure they
|
|
@@ -44,6 +44,6 @@ exports.runView = async (view, calculation, group, data) => {
|
|
|
44
44
|
return response
|
|
45
45
|
} finally {
|
|
46
46
|
await db.destroy()
|
|
47
|
-
await closePouchDB(db)
|
|
47
|
+
await dbCore.closePouchDB(db)
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -2,12 +2,12 @@ const { IncludeDocs, getLinkDocuments } = require("./linkUtils")
|
|
|
2
2
|
const { InternalTables, getUserMetadataParams } = require("../utils")
|
|
3
3
|
const Sentry = require("@sentry/node")
|
|
4
4
|
const { FieldTypes, RelationshipTypes } = require("../../constants")
|
|
5
|
-
const {
|
|
5
|
+
const { context } = require("@budibase/backend-core")
|
|
6
6
|
const LinkDocument = require("./LinkDocument")
|
|
7
7
|
|
|
8
8
|
class LinkController {
|
|
9
9
|
constructor({ tableId, row, table, oldTable }) {
|
|
10
|
-
this._db = getAppDB()
|
|
10
|
+
this._db = context.getAppDB()
|
|
11
11
|
this._tableId = tableId
|
|
12
12
|
this._row = row
|
|
13
13
|
this._table = table
|
|
@@ -14,7 +14,7 @@ const { getMultiIDParams, USER_METDATA_PREFIX } = require("../../db/utils")
|
|
|
14
14
|
const { partition } = require("lodash")
|
|
15
15
|
const { getGlobalUsersFromMetadata } = require("../../utilities/global")
|
|
16
16
|
const { processFormulas } = require("../../utilities/rowProcessor/utils")
|
|
17
|
-
const {
|
|
17
|
+
const { context } = require("@budibase/backend-core")
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* This functionality makes sure that when rows with links are created, updated or deleted they are processed
|
|
@@ -74,7 +74,7 @@ async function getLinksForRows(rows) {
|
|
|
74
74
|
|
|
75
75
|
async function getFullLinkedDocs(links) {
|
|
76
76
|
// create DBs
|
|
77
|
-
const db = getAppDB()
|
|
77
|
+
const db = context.getAppDB()
|
|
78
78
|
const linkedRowIds = links.map(link => link.id)
|
|
79
79
|
const uniqueRowIds = [...new Set(linkedRowIds)]
|
|
80
80
|
let dbRows = (await db.allDocs(getMultiIDParams(uniqueRowIds))).rows.map(
|
|
@@ -2,7 +2,7 @@ const Sentry = require("@sentry/node")
|
|
|
2
2
|
const { ViewName, getQueryIndex } = require("../utils")
|
|
3
3
|
const { FieldTypes } = require("../../constants")
|
|
4
4
|
const { createLinkView } = require("../views/staticViews")
|
|
5
|
-
const {
|
|
5
|
+
const { context } = require("@budibase/backend-core")
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Only needed so that boolean parameters are being used for includeDocs
|
|
@@ -30,7 +30,7 @@ exports.createLinkView = createLinkView
|
|
|
30
30
|
*/
|
|
31
31
|
exports.getLinkDocuments = async function (args) {
|
|
32
32
|
const { tableId, rowId, includeDocs } = args
|
|
33
|
-
const db = getAppDB()
|
|
33
|
+
const db = context.getAppDB()
|
|
34
34
|
let params
|
|
35
35
|
if (rowId != null) {
|
|
36
36
|
params = { key: [tableId, rowId] }
|
|
@@ -89,7 +89,7 @@ exports.getLinkedTableIDs = table => {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
exports.getLinkedTable = async (id, tables) => {
|
|
92
|
-
const db = getAppDB()
|
|
92
|
+
const db = context.getAppDB()
|
|
93
93
|
let linkedTable = tables.find(table => table._id === id)
|
|
94
94
|
if (linkedTable) {
|
|
95
95
|
return linkedTable
|