@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
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import newid from "../../../db/newid"
|
|
2
|
+
import { context } from "@budibase/backend-core"
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This is used to pass around information about the deployment that is occurring
|
|
6
6
|
*/
|
|
7
|
-
class Deployment {
|
|
7
|
+
export default class Deployment {
|
|
8
|
+
_id: string
|
|
9
|
+
verification: any
|
|
10
|
+
status?: string
|
|
11
|
+
err?: any
|
|
12
|
+
|
|
8
13
|
constructor(id = null) {
|
|
9
14
|
this._id = id || newid()
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
setVerification(verification) {
|
|
17
|
+
setVerification(verification: any) {
|
|
13
18
|
if (!verification) {
|
|
14
19
|
return
|
|
15
20
|
}
|
|
@@ -20,14 +25,14 @@ class Deployment {
|
|
|
20
25
|
return this.verification
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
setStatus(status, err
|
|
28
|
+
setStatus(status: string, err?: any) {
|
|
24
29
|
this.status = status
|
|
25
30
|
if (err) {
|
|
26
31
|
this.err = err
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
|
|
30
|
-
fromJSON(json) {
|
|
35
|
+
fromJSON(json: any) {
|
|
31
36
|
if (json.verification) {
|
|
32
37
|
this.setVerification(json.verification)
|
|
33
38
|
}
|
|
@@ -37,9 +42,9 @@ class Deployment {
|
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
getJSON() {
|
|
40
|
-
const obj = {
|
|
45
|
+
const obj: any = {
|
|
41
46
|
_id: this._id,
|
|
42
|
-
appId: getAppId(),
|
|
47
|
+
appId: context.getAppId(),
|
|
43
48
|
status: this.status,
|
|
44
49
|
}
|
|
45
50
|
if (this.err) {
|
|
@@ -51,5 +56,3 @@ class Deployment {
|
|
|
51
56
|
return obj
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
|
-
|
|
55
|
-
module.exports = Deployment
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { EMPTY_LAYOUT } from "../../constants/layouts"
|
|
2
|
+
import { generateLayoutID, getScreenParams } from "../../db/utils"
|
|
3
|
+
import { events, context } from "@budibase/backend-core"
|
|
4
|
+
import { BBContext } from "@budibase/types"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
const db = getAppDB()
|
|
6
|
+
export async function save(ctx: BBContext) {
|
|
7
|
+
const db = context.getAppDB()
|
|
8
8
|
let layout = ctx.request.body
|
|
9
9
|
|
|
10
10
|
if (!layout.props) {
|
|
@@ -24,8 +24,8 @@ exports.save = async function (ctx) {
|
|
|
24
24
|
ctx.status = 200
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
const db = getAppDB()
|
|
27
|
+
export async function destroy(ctx: BBContext) {
|
|
28
|
+
const db = context.getAppDB()
|
|
29
29
|
const layoutId = ctx.params.layoutId,
|
|
30
30
|
layoutRev = ctx.params.layoutRev
|
|
31
31
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { MetadataTypes } from "../../constants"
|
|
2
|
+
import { generateMetadataID } from "../../db/utils"
|
|
3
|
+
import { saveEntityMetadata, deleteEntityMetadata } from "../../utilities"
|
|
4
|
+
import { context } from "@budibase/backend-core"
|
|
5
|
+
import { BBContext } from "@budibase/types"
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
export async function getTypes(ctx: BBContext) {
|
|
7
8
|
ctx.body = {
|
|
8
9
|
types: MetadataTypes,
|
|
9
10
|
}
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
export async function saveMetadata(ctx: BBContext) {
|
|
13
14
|
const { type, entityId } = ctx.params
|
|
14
15
|
if (type === MetadataTypes.AUTOMATION_TEST_HISTORY) {
|
|
15
16
|
ctx.throw(400, "Cannot save automation history type")
|
|
@@ -17,7 +18,7 @@ exports.saveMetadata = async ctx => {
|
|
|
17
18
|
ctx.body = await saveEntityMetadata(type, entityId, ctx.request.body)
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
export async function deleteMetadata(ctx: BBContext) {
|
|
21
22
|
const { type, entityId } = ctx.params
|
|
22
23
|
await deleteEntityMetadata(type, entityId)
|
|
23
24
|
ctx.body = {
|
|
@@ -25,13 +26,13 @@ exports.deleteMetadata = async ctx => {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
export async function getMetadata(ctx: BBContext) {
|
|
29
30
|
const { type, entityId } = ctx.params
|
|
30
|
-
const db = getAppDB()
|
|
31
|
+
const db = context.getAppDB()
|
|
31
32
|
const id = generateMetadataID(type, entityId)
|
|
32
33
|
try {
|
|
33
34
|
ctx.body = await db.get(id)
|
|
34
|
-
} catch (err) {
|
|
35
|
+
} catch (err: any) {
|
|
35
36
|
if (err.status === 404) {
|
|
36
37
|
ctx.body = {}
|
|
37
38
|
} else {
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
getDBRoleID,
|
|
5
|
-
getExternalRoleID,
|
|
6
|
-
getBuiltinRoles,
|
|
7
|
-
checkForRoleResourceArray,
|
|
8
|
-
} = require("@budibase/backend-core/roles")
|
|
9
|
-
const { getRoleParams } = require("../../db/utils")
|
|
10
|
-
const {
|
|
1
|
+
import { permissions, roles, context } from "@budibase/backend-core"
|
|
2
|
+
import { getRoleParams } from "../../db/utils"
|
|
3
|
+
import {
|
|
11
4
|
CURRENTLY_SUPPORTED_LEVELS,
|
|
12
5
|
getBasePermissions,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
} from "../../utilities/security"
|
|
7
|
+
import { removeFromArray } from "../../utilities"
|
|
8
|
+
import { BBContext, Database, Role } from "@budibase/types"
|
|
16
9
|
|
|
17
10
|
const PermissionUpdateType = {
|
|
18
11
|
REMOVE: "remove",
|
|
@@ -22,7 +15,7 @@ const PermissionUpdateType = {
|
|
|
22
15
|
const SUPPORTED_LEVELS = CURRENTLY_SUPPORTED_LEVELS
|
|
23
16
|
|
|
24
17
|
// utility function to stop this repetition - permissions always stored under roles
|
|
25
|
-
async function getAllDBRoles(db) {
|
|
18
|
+
async function getAllDBRoles(db: Database) {
|
|
26
19
|
const body = await db.allDocs(
|
|
27
20
|
getRoleParams(null, {
|
|
28
21
|
include_docs: true,
|
|
@@ -32,21 +25,25 @@ async function getAllDBRoles(db) {
|
|
|
32
25
|
}
|
|
33
26
|
|
|
34
27
|
async function updatePermissionOnRole(
|
|
35
|
-
appId,
|
|
36
|
-
{
|
|
37
|
-
|
|
28
|
+
appId: string,
|
|
29
|
+
{
|
|
30
|
+
roleId,
|
|
31
|
+
resourceId,
|
|
32
|
+
level,
|
|
33
|
+
}: { roleId: string; resourceId: string; level: string },
|
|
34
|
+
updateType: string
|
|
38
35
|
) {
|
|
39
|
-
const db = getAppDB()
|
|
36
|
+
const db = context.getAppDB()
|
|
40
37
|
const remove = updateType === PermissionUpdateType.REMOVE
|
|
41
|
-
const isABuiltin = isBuiltin(roleId)
|
|
42
|
-
const dbRoleId = getDBRoleID(roleId)
|
|
38
|
+
const isABuiltin = roles.isBuiltin(roleId)
|
|
39
|
+
const dbRoleId = roles.getDBRoleID(roleId)
|
|
43
40
|
const dbRoles = await getAllDBRoles(db)
|
|
44
41
|
const docUpdates = []
|
|
45
42
|
|
|
46
43
|
// the permission is for a built in, make sure it exists
|
|
47
44
|
if (isABuiltin && !dbRoles.some(role => role._id === dbRoleId)) {
|
|
48
|
-
const builtin = getBuiltinRoles()[roleId]
|
|
49
|
-
builtin._id = getDBRoleID(builtin._id)
|
|
45
|
+
const builtin = roles.getBuiltinRoles()[roleId]
|
|
46
|
+
builtin._id = roles.getDBRoleID(builtin._id)
|
|
50
47
|
dbRoles.push(builtin)
|
|
51
48
|
}
|
|
52
49
|
|
|
@@ -90,41 +87,44 @@ async function updatePermissionOnRole(
|
|
|
90
87
|
}
|
|
91
88
|
|
|
92
89
|
const response = await db.bulkDocs(docUpdates)
|
|
93
|
-
return response.map(resp => {
|
|
94
|
-
resp._id = getExternalRoleID(resp.id)
|
|
90
|
+
return response.map((resp: any) => {
|
|
91
|
+
resp._id = roles.getExternalRoleID(resp.id)
|
|
95
92
|
delete resp.id
|
|
96
93
|
return resp
|
|
97
94
|
})
|
|
98
95
|
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
ctx.body = Object.values(getBuiltinPermissions())
|
|
97
|
+
export function fetchBuiltin(ctx: BBContext) {
|
|
98
|
+
ctx.body = Object.values(permissions.getBuiltinPermissions())
|
|
102
99
|
}
|
|
103
100
|
|
|
104
|
-
|
|
101
|
+
export function fetchLevels(ctx: BBContext) {
|
|
105
102
|
// for now only provide the read/write perms externally
|
|
106
103
|
ctx.body = SUPPORTED_LEVELS
|
|
107
104
|
}
|
|
108
105
|
|
|
109
|
-
|
|
110
|
-
const db = getAppDB()
|
|
111
|
-
const
|
|
112
|
-
let permissions = {}
|
|
106
|
+
export async function fetch(ctx: BBContext) {
|
|
107
|
+
const db = context.getAppDB()
|
|
108
|
+
const dbRoles: Role[] = await getAllDBRoles(db)
|
|
109
|
+
let permissions: any = {}
|
|
113
110
|
// create an object with structure role ID -> resource ID -> level
|
|
114
|
-
for (let role of
|
|
111
|
+
for (let role of dbRoles) {
|
|
115
112
|
if (!role.permissions) {
|
|
116
113
|
continue
|
|
117
114
|
}
|
|
118
|
-
const roleId = getExternalRoleID(role._id)
|
|
115
|
+
const roleId = roles.getExternalRoleID(role._id)
|
|
116
|
+
if (!roleId) {
|
|
117
|
+
ctx.throw(400, "Unable to retrieve role")
|
|
118
|
+
}
|
|
119
119
|
for (let [resource, levelArr] of Object.entries(role.permissions)) {
|
|
120
|
-
const levels = Array.isArray(levelArr) ?
|
|
121
|
-
const perms = {}
|
|
122
|
-
levels.forEach(level => (perms[level] = roleId))
|
|
120
|
+
const levels: string[] = Array.isArray(levelArr) ? levelArr : [levelArr]
|
|
121
|
+
const perms: Record<string, string> = {}
|
|
122
|
+
levels.forEach(level => (perms[level] = roleId!))
|
|
123
123
|
permissions[resource] = perms
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
// apply the base permissions
|
|
127
|
-
const finalPermissions = {}
|
|
127
|
+
const finalPermissions: Record<string, Record<string, string>> = {}
|
|
128
128
|
for (let [resource, permission] of Object.entries(permissions)) {
|
|
129
129
|
const basePerms = getBasePermissions(resource)
|
|
130
130
|
finalPermissions[resource] = Object.assign(basePerms, permission)
|
|
@@ -132,33 +132,36 @@ exports.fetch = async function (ctx) {
|
|
|
132
132
|
ctx.body = finalPermissions
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
export async function getResourcePerms(ctx: BBContext) {
|
|
136
136
|
const resourceId = ctx.params.resourceId
|
|
137
|
-
const db = getAppDB()
|
|
137
|
+
const db = context.getAppDB()
|
|
138
138
|
const body = await db.allDocs(
|
|
139
139
|
getRoleParams(null, {
|
|
140
140
|
include_docs: true,
|
|
141
141
|
})
|
|
142
142
|
)
|
|
143
|
-
const
|
|
144
|
-
let permissions = {}
|
|
143
|
+
const rolesList = body.rows.map(row => row.doc)
|
|
144
|
+
let permissions: Record<string, string> = {}
|
|
145
145
|
for (let level of SUPPORTED_LEVELS) {
|
|
146
146
|
// update the various roleIds in the resource permissions
|
|
147
|
-
for (let role of
|
|
148
|
-
const rolePerms = checkForRoleResourceArray(
|
|
147
|
+
for (let role of rolesList) {
|
|
148
|
+
const rolePerms = roles.checkForRoleResourceArray(
|
|
149
|
+
role.permissions,
|
|
150
|
+
resourceId
|
|
151
|
+
)
|
|
149
152
|
if (
|
|
150
153
|
rolePerms &&
|
|
151
154
|
rolePerms[resourceId] &&
|
|
152
155
|
rolePerms[resourceId].indexOf(level) !== -1
|
|
153
156
|
) {
|
|
154
|
-
permissions[level] = getExternalRoleID(role._id)
|
|
157
|
+
permissions[level] = roles.getExternalRoleID(role._id)!
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
160
|
}
|
|
158
161
|
ctx.body = Object.assign(getBasePermissions(resourceId), permissions)
|
|
159
162
|
}
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
export async function addPermission(ctx: BBContext) {
|
|
162
165
|
ctx.body = await updatePermissionOnRole(
|
|
163
166
|
ctx.appId,
|
|
164
167
|
ctx.params,
|
|
@@ -166,7 +169,7 @@ exports.addPermission = async function (ctx) {
|
|
|
166
169
|
)
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
|
|
172
|
+
export async function removePermission(ctx: BBContext) {
|
|
170
173
|
ctx.body = await updatePermissionOnRole(
|
|
171
174
|
ctx.appId,
|
|
172
175
|
ctx.params,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { npmUpload, urlUpload, githubUpload, fileUpload } from "./uploaders"
|
|
2
|
-
import {
|
|
3
|
-
import { validate } from "@budibase/backend-core/plugins"
|
|
2
|
+
import { plugins as pluginCore, tenancy } from "@budibase/backend-core"
|
|
4
3
|
import { PluginType, FileType, PluginSource } from "@budibase/types"
|
|
5
4
|
import env from "../../../environment"
|
|
6
5
|
import { ClientAppSocket } from "../../../websocket"
|
|
@@ -8,7 +7,7 @@ import { db as dbCore } from "@budibase/backend-core"
|
|
|
8
7
|
import { plugins } from "@budibase/pro"
|
|
9
8
|
|
|
10
9
|
export async function getPlugins(type?: PluginType) {
|
|
11
|
-
const db = getGlobalDB()
|
|
10
|
+
const db = tenancy.getGlobalDB()
|
|
12
11
|
const response = await db.allDocs(
|
|
13
12
|
dbCore.getPluginParams(null, {
|
|
14
13
|
include_docs: true,
|
|
@@ -76,7 +75,7 @@ export async function create(ctx: any) {
|
|
|
76
75
|
break
|
|
77
76
|
}
|
|
78
77
|
|
|
79
|
-
validate(metadata?.schema)
|
|
78
|
+
pluginCore.validate(metadata?.schema)
|
|
80
79
|
|
|
81
80
|
// Only allow components in cloud
|
|
82
81
|
if (!env.SELF_HOSTED && metadata?.schema?.type !== PluginType.COMPONENT) {
|
|
@@ -121,7 +120,7 @@ export async function processUploadedPlugin(
|
|
|
121
120
|
source?: PluginSource
|
|
122
121
|
) {
|
|
123
122
|
const { metadata, directory } = await fileUpload(plugin)
|
|
124
|
-
validate(metadata?.schema)
|
|
123
|
+
pluginCore.validate(metadata?.schema)
|
|
125
124
|
|
|
126
125
|
// Only allow components in cloud
|
|
127
126
|
if (!env.SELF_HOSTED && metadata?.schema?.type !== PluginType.COMPONENT) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { search as stringSearch, addRev } from "./utils"
|
|
2
|
-
import
|
|
3
|
-
import { Table } from "
|
|
2
|
+
import * as controller from "../table"
|
|
3
|
+
import { Table } from "@budibase/types"
|
|
4
4
|
|
|
5
5
|
function fixTable(table: Table, params: any) {
|
|
6
6
|
if (!params || !table) {
|
|
@@ -5,8 +5,7 @@ import { OpenAPI2 } from "./sources/openapi2"
|
|
|
5
5
|
import { OpenAPI3 } from "./sources/openapi3"
|
|
6
6
|
import { Curl } from "./sources/curl"
|
|
7
7
|
// @ts-ignore
|
|
8
|
-
import {
|
|
9
|
-
import { events } from "@budibase/backend-core"
|
|
8
|
+
import { events, context } from "@budibase/backend-core"
|
|
10
9
|
import { Datasource, Query } from "@budibase/types"
|
|
11
10
|
|
|
12
11
|
interface ImportResult {
|
|
@@ -59,7 +58,7 @@ export class RestImporter {
|
|
|
59
58
|
})
|
|
60
59
|
|
|
61
60
|
// persist queries
|
|
62
|
-
const db = getAppDB()
|
|
61
|
+
const db = context.getAppDB()
|
|
63
62
|
const response = await db.bulkDocs(queries)
|
|
64
63
|
|
|
65
64
|
// create index to seperate queries and errors
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { auth } from "@budibase/backend-core"
|
|
2
|
+
import Joi from "joi"
|
|
3
3
|
|
|
4
4
|
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("")
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
export function queryValidation() {
|
|
7
7
|
return Joi.object({
|
|
8
8
|
_id: Joi.string(),
|
|
9
9
|
_rev: Joi.string(),
|
|
@@ -25,14 +25,14 @@ exports.queryValidation = () => {
|
|
|
25
25
|
}).unknown(true)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
export function generateQueryValidation() {
|
|
29
29
|
// prettier-ignore
|
|
30
|
-
return joiValidator.body(
|
|
30
|
+
return auth.joiValidator.body(queryValidation())
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
export function generateQueryPreviewValidation() {
|
|
34
34
|
// prettier-ignore
|
|
35
|
-
return joiValidator.body(Joi.object({
|
|
35
|
+
return auth.joiValidator.body(Joi.object({
|
|
36
36
|
_id: OPTIONAL_STRING,
|
|
37
37
|
_rev: OPTIONAL_STRING,
|
|
38
38
|
readable: Joi.boolean().optional(),
|
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
getRole,
|
|
4
|
-
isBuiltin,
|
|
5
|
-
getAllRoles,
|
|
6
|
-
} = require("@budibase/backend-core/roles")
|
|
7
|
-
const {
|
|
1
|
+
import { roles, context, events } from "@budibase/backend-core"
|
|
2
|
+
import {
|
|
8
3
|
generateRoleID,
|
|
9
4
|
getUserMetadataParams,
|
|
10
5
|
InternalTables,
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const { events } = require("@budibase/backend-core")
|
|
6
|
+
} from "../../db/utils"
|
|
7
|
+
import { BBContext, Database } from "@budibase/types"
|
|
14
8
|
|
|
15
9
|
const UpdateRolesOptions = {
|
|
16
10
|
CREATED: "created",
|
|
17
11
|
REMOVED: "removed",
|
|
18
12
|
}
|
|
19
13
|
|
|
20
|
-
async function updateRolesOnUserTable(
|
|
14
|
+
async function updateRolesOnUserTable(
|
|
15
|
+
db: Database,
|
|
16
|
+
roleId: string,
|
|
17
|
+
updateOption: string
|
|
18
|
+
) {
|
|
21
19
|
const table = await db.get(InternalTables.USER_METADATA)
|
|
22
20
|
const schema = table.schema
|
|
23
21
|
const remove = updateOption === UpdateRolesOptions.REMOVED
|
|
@@ -40,27 +38,25 @@ async function updateRolesOnUserTable(db, roleId, updateOption) {
|
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
|
|
43
|
-
|
|
44
|
-
ctx.body = await getAllRoles()
|
|
41
|
+
export async function fetch(ctx: BBContext) {
|
|
42
|
+
ctx.body = await roles.getAllRoles()
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
|
|
48
|
-
ctx.body = await getRole(ctx.params.roleId)
|
|
45
|
+
export async function find(ctx: BBContext) {
|
|
46
|
+
ctx.body = await roles.getRole(ctx.params.roleId)
|
|
49
47
|
}
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
const db = getAppDB()
|
|
49
|
+
export async function save(ctx: BBContext) {
|
|
50
|
+
const db = context.getAppDB()
|
|
53
51
|
let { _id, name, inherits, permissionId } = ctx.request.body
|
|
54
52
|
let isCreate = false
|
|
55
53
|
if (!_id) {
|
|
56
54
|
_id = generateRoleID()
|
|
57
55
|
isCreate = true
|
|
58
|
-
} else if (isBuiltin(_id)) {
|
|
56
|
+
} else if (roles.isBuiltin(_id)) {
|
|
59
57
|
ctx.throw(400, "Cannot update builtin roles.")
|
|
60
58
|
}
|
|
61
|
-
const role = new Role(_id, name)
|
|
62
|
-
.addPermission(permissionId)
|
|
63
|
-
.addInheritance(inherits)
|
|
59
|
+
const role = new roles.Role(_id, name, permissionId).addInheritance(inherits)
|
|
64
60
|
if (ctx.request.body._rev) {
|
|
65
61
|
role._rev = ctx.request.body._rev
|
|
66
62
|
}
|
|
@@ -76,17 +72,17 @@ exports.save = async function (ctx) {
|
|
|
76
72
|
ctx.message = `Role '${role.name}' created successfully.`
|
|
77
73
|
}
|
|
78
74
|
|
|
79
|
-
|
|
80
|
-
const db = getAppDB()
|
|
75
|
+
export async function destroy(ctx: BBContext) {
|
|
76
|
+
const db = context.getAppDB()
|
|
81
77
|
const roleId = ctx.params.roleId
|
|
82
78
|
const role = await db.get(roleId)
|
|
83
|
-
if (isBuiltin(roleId)) {
|
|
79
|
+
if (roles.isBuiltin(roleId)) {
|
|
84
80
|
ctx.throw(400, "Cannot delete builtin role.")
|
|
85
81
|
}
|
|
86
82
|
// first check no users actively attached to role
|
|
87
83
|
const users = (
|
|
88
84
|
await db.allDocs(
|
|
89
|
-
getUserMetadataParams(
|
|
85
|
+
getUserMetadataParams(undefined, {
|
|
90
86
|
include_docs: true,
|
|
91
87
|
})
|
|
92
88
|
)
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
BUILTIN_ROLE_IDS,
|
|
5
|
-
} = require("@budibase/backend-core/roles")
|
|
1
|
+
import { getRoutingInfo } from "../../utilities/routing"
|
|
2
|
+
import { roles } from "@budibase/backend-core"
|
|
3
|
+
import { BBContext } from "@budibase/types"
|
|
6
4
|
|
|
7
5
|
const URL_SEPARATOR = "/"
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Routing.prototype.getTopLevel = function (fullpath) {
|
|
14
|
-
if (fullpath.charAt(0) !== URL_SEPARATOR) {
|
|
15
|
-
fullpath = URL_SEPARATOR + fullpath
|
|
7
|
+
class Routing {
|
|
8
|
+
json: any
|
|
9
|
+
constructor() {
|
|
10
|
+
this.json = {}
|
|
16
11
|
}
|
|
17
|
-
// replace the first value with the home route
|
|
18
|
-
return URL_SEPARATOR + fullpath.split(URL_SEPARATOR)[1]
|
|
19
|
-
}
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.json[topLevel] = {
|
|
25
|
-
subpaths: {},
|
|
13
|
+
getTopLevel(fullpath: string) {
|
|
14
|
+
if (fullpath.charAt(0) !== URL_SEPARATOR) {
|
|
15
|
+
fullpath = URL_SEPARATOR + fullpath
|
|
26
16
|
}
|
|
17
|
+
// replace the first value with the home route
|
|
18
|
+
return URL_SEPARATOR + fullpath.split(URL_SEPARATOR)[1]
|
|
27
19
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
|
|
21
|
+
getScreensProp(fullpath: string) {
|
|
22
|
+
const topLevel = this.getTopLevel(fullpath)
|
|
23
|
+
if (!this.json[topLevel]) {
|
|
24
|
+
this.json[topLevel] = {
|
|
25
|
+
subpaths: {},
|
|
26
|
+
}
|
|
31
27
|
}
|
|
28
|
+
if (!this.json[topLevel].subpaths[fullpath]) {
|
|
29
|
+
this.json[topLevel].subpaths[fullpath] = {
|
|
30
|
+
screens: {},
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return this.json[topLevel].subpaths[fullpath].screens
|
|
32
34
|
}
|
|
33
|
-
return this.json[topLevel].subpaths[fullpath].screens
|
|
34
|
-
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
addScreenId(fullpath: string, roleId: string, screenId: string) {
|
|
37
|
+
this.getScreensProp(fullpath)[roleId] = screenId
|
|
38
|
+
}
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/**
|
|
@@ -55,26 +56,28 @@ async function getRoutingStructure() {
|
|
|
55
56
|
return { routes: routing.json }
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
|
|
59
|
+
export async function fetch(ctx: BBContext) {
|
|
59
60
|
ctx.body = await getRoutingStructure()
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
export async function clientFetch(ctx: BBContext) {
|
|
63
64
|
const routing = await getRoutingStructure()
|
|
64
|
-
let roleId = ctx.user
|
|
65
|
-
const roleIds = await getUserRoleHierarchy(roleId
|
|
66
|
-
|
|
65
|
+
let roleId = ctx.user?.role?._id
|
|
66
|
+
const roleIds = (await roles.getUserRoleHierarchy(roleId, {
|
|
67
|
+
idOnly: true,
|
|
68
|
+
})) as string[]
|
|
69
|
+
for (let topLevel of Object.values(routing.routes) as any) {
|
|
67
70
|
for (let subpathKey of Object.keys(topLevel.subpaths)) {
|
|
68
71
|
let found = false
|
|
69
72
|
const subpath = topLevel.subpaths[subpathKey]
|
|
70
73
|
const roleOptions = Object.keys(subpath.screens)
|
|
71
74
|
if (roleOptions.length === 1 && !roleOptions[0]) {
|
|
72
75
|
subpath.screenId = subpath.screens[roleOptions[0]]
|
|
73
|
-
subpath.roleId = BUILTIN_ROLE_IDS.BASIC
|
|
76
|
+
subpath.roleId = roles.BUILTIN_ROLE_IDS.BASIC
|
|
74
77
|
found = true
|
|
75
78
|
} else {
|
|
76
79
|
for (let roleId of roleIds) {
|
|
77
|
-
if (roleOptions.indexOf(roleId) !== -1) {
|
|
80
|
+
if (roleId && roleOptions.indexOf(roleId) !== -1) {
|
|
78
81
|
subpath.screenId = subpath.screens[roleId]
|
|
79
82
|
subpath.roleId = roleId
|
|
80
83
|
found = true
|
|
@@ -27,12 +27,8 @@ import { breakExternalTableId, isSQL } from "../../../integrations/utils"
|
|
|
27
27
|
import { processObjectSync } from "@budibase/string-templates"
|
|
28
28
|
// @ts-ignore
|
|
29
29
|
import { cloneDeep } from "lodash/fp"
|
|
30
|
-
import {
|
|
31
|
-
|
|
32
|
-
processDates,
|
|
33
|
-
} from "../../../utilities/rowProcessor/utils"
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
import { getAppDB } from "@budibase/backend-core/context"
|
|
30
|
+
import { processFormulas, processDates } from "../../../utilities/rowProcessor"
|
|
31
|
+
import { context } from "@budibase/backend-core"
|
|
36
32
|
|
|
37
33
|
interface ManyRelationship {
|
|
38
34
|
tableId?: string
|
|
@@ -444,7 +440,7 @@ module External {
|
|
|
444
440
|
// Process some additional data types
|
|
445
441
|
let finalRowArray = Object.values(finalRows)
|
|
446
442
|
finalRowArray = processDates(table, finalRowArray)
|
|
447
|
-
finalRowArray = processFormulas(table, finalRowArray)
|
|
443
|
+
finalRowArray = processFormulas(table, finalRowArray) as Row[]
|
|
448
444
|
|
|
449
445
|
return finalRowArray.map((row: Row) =>
|
|
450
446
|
this.squashRelationshipColumns(table, row, relationships)
|
|
@@ -673,7 +669,7 @@ module External {
|
|
|
673
669
|
throw "Unable to run without a table name"
|
|
674
670
|
}
|
|
675
671
|
if (!this.datasource) {
|
|
676
|
-
const db = getAppDB()
|
|
672
|
+
const db = context.getAppDB()
|
|
677
673
|
this.datasource = await db.get(datasourceId)
|
|
678
674
|
if (!this.datasource || !this.datasource.entities) {
|
|
679
675
|
throw "No tables found, fetch tables before query."
|
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
breakRowIdField,
|
|
10
10
|
} = require("../../../integrations/utils")
|
|
11
11
|
const ExternalRequest = require("./ExternalRequest")
|
|
12
|
-
const {
|
|
12
|
+
const { context } = require("@budibase/backend-core")
|
|
13
13
|
const exporters = require("../view/exporters")
|
|
14
14
|
const { apiFileReturn } = require("../../../utilities/fileSystem")
|
|
15
15
|
|
|
@@ -166,7 +166,7 @@ exports.validate = async () => {
|
|
|
166
166
|
|
|
167
167
|
exports.exportRows = async ctx => {
|
|
168
168
|
const { datasourceId } = breakExternalTableId(ctx.params.tableId)
|
|
169
|
-
const db = getAppDB()
|
|
169
|
+
const db = context.getAppDB()
|
|
170
170
|
const format = ctx.query.format
|
|
171
171
|
const { columns } = ctx.request.body
|
|
172
172
|
const datasource = await db.get(datasourceId)
|
|
@@ -209,7 +209,7 @@ exports.fetchEnrichedRow = async ctx => {
|
|
|
209
209
|
const id = ctx.params.rowId
|
|
210
210
|
const tableId = ctx.params.tableId
|
|
211
211
|
const { datasourceId, tableName } = breakExternalTableId(tableId)
|
|
212
|
-
const db = getAppDB()
|
|
212
|
+
const db = context.getAppDB()
|
|
213
213
|
const datasource = await db.get(datasourceId)
|
|
214
214
|
if (!datasource || !datasource.entities) {
|
|
215
215
|
ctx.throw(400, "Datasource has not been configured for plus API.")
|