@budibase/server 2.1.32-alpha.1 → 2.1.32-alpha.10
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.7176fd99.css → index.144dddb2.css} +1 -1
- package/builder/assets/{index.24cb0a61.js → index.d97a0eb1.js} +290 -290
- package/builder/index.html +2 -2
- package/coverage/clover.xml +3723 -3691
- package/coverage/coverage-final.json +113 -108
- package/coverage/lcov-report/index.html +170 -155
- 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 +70 -13
- 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} +239 -80
- 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 +120 -120
- 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 +41 -41
- 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 +56 -41
- 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 +2023 -0
- package/coverage/lcov-report/src/db/defaultData/employeeImport.js.html +541 -0
- package/coverage/lcov-report/src/db/defaultData/expensesImport.js.html +427 -0
- package/coverage/lcov-report/src/db/defaultData/index.html +176 -0
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.js.html +403 -0
- package/coverage/lcov-report/src/db/defaultData/jobsImport.js.html +559 -0
- 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 +13 -151
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.js.html +226 -0
- package/coverage/lcov-report/src/db/linkedRows/index.html +28 -13
- 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 +3 -3
- 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 +5 -5
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +4 -4
- 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 +15 -15
- 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} +70 -46
- 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 +6619 -6700
- package/dist/api/controllers/apikeys.js +12 -9
- package/dist/api/controllers/application.js +13 -2
- 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 +144 -92
- 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 +39 -35
- 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/defaultData/datasource_bb_default.js +565 -0
- package/dist/db/defaultData/employeeImport.js +153 -0
- package/dist/db/defaultData/expensesImport.js +115 -0
- package/dist/db/defaultData/inventoryImport.js +107 -0
- package/dist/db/defaultData/jobsImport.js +150 -0
- package/dist/db/inMemoryView.js +3 -3
- package/dist/db/linkedRows/LinkController.js +4 -31
- package/dist/db/linkedRows/LinkDocument.js +32 -0
- package/dist/db/linkedRows/index.js +2 -2
- package/dist/db/linkedRows/linkUtils.js +3 -3
- package/dist/db/utils.js +1 -1
- 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/sdk/app/tables/index.js +1 -1
- 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/application.ts +22 -3
- 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} +100 -47
- 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 +26 -21
- 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/defaultData/datasource_bb_default.js +646 -0
- package/src/db/defaultData/employeeImport.js +152 -0
- package/src/db/defaultData/expensesImport.js +114 -0
- package/src/db/defaultData/inventoryImport.js +106 -0
- package/src/db/defaultData/jobsImport.js +158 -0
- package/src/db/inMemoryView.js +3 -3
- package/src/db/linkedRows/LinkController.js +4 -50
- package/src/db/linkedRows/LinkDocument.js +47 -0
- package/src/db/linkedRows/index.js +2 -2
- package/src/db/linkedRows/linkUtils.js +3 -3
- package/src/db/utils.ts +2 -2
- 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/sdk/app/tables/index.ts +1 -1
- 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/dist/db/utils.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const {
|
|
11
|
+
const { context } = require("@budibase/backend-core");
|
|
12
12
|
const { DocumentType, SEPARATOR, ViewName, SearchIndexes } = require("../utils");
|
|
13
13
|
const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR;
|
|
14
14
|
/**************************************************
|
|
@@ -28,7 +28,7 @@ const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR;
|
|
|
28
28
|
* so it may be slow.
|
|
29
29
|
*/
|
|
30
30
|
exports.createLinkView = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
31
|
-
const db = getAppDB();
|
|
31
|
+
const db = context.getAppDB();
|
|
32
32
|
const designDoc = yield db.get("_design/database");
|
|
33
33
|
const view = {
|
|
34
34
|
map: function (doc) {
|
|
@@ -58,7 +58,7 @@ exports.createLinkView = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
58
58
|
yield db.put(designDoc);
|
|
59
59
|
});
|
|
60
60
|
exports.createRoutingView = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
const db = getAppDB();
|
|
61
|
+
const db = context.getAppDB();
|
|
62
62
|
const designDoc = yield db.get("_design/database");
|
|
63
63
|
const view = {
|
|
64
64
|
// if using variables in a map function need to inject them before use
|
|
@@ -76,7 +76,7 @@ exports.createRoutingView = () => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
76
76
|
});
|
|
77
77
|
function searchIndex(indexName, fnString) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const db = getAppDB();
|
|
79
|
+
const db = context.getAppDB();
|
|
80
80
|
const designDoc = yield db.get("_design/database");
|
|
81
81
|
designDoc.indexes = {
|
|
82
82
|
[indexName]: {
|
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getIntegration = exports.getDefinitions = void 0;
|
|
15
16
|
const postgres_1 = __importDefault(require("./postgres"));
|
|
16
17
|
const dynamodb_1 = __importDefault(require("./dynamodb"));
|
|
17
18
|
const mongodb_1 = __importDefault(require("./mongodb"));
|
|
@@ -75,8 +76,8 @@ if (process.arch &&
|
|
|
75
76
|
DEFINITIONS[types_1.SourceName.ORACLE] = oracle_1.default.schema;
|
|
76
77
|
INTEGRATIONS[types_1.SourceName.ORACLE] = oracle_1.default.integration;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
function getDefinitions() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
81
|
const pluginSchemas = {};
|
|
81
82
|
if (environment.SELF_HOSTED) {
|
|
82
83
|
const plugins = yield (0, plugin_1.getPlugins)(types_1.PluginType.DATASOURCE);
|
|
@@ -90,9 +91,12 @@ module.exports = {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
return Object.assign(Object.assign({}, cloneDeep(DEFINITIONS)), pluginSchemas);
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.getDefinitions = getDefinitions;
|
|
97
|
+
function getIntegration(integration) {
|
|
98
|
+
var _a;
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
100
|
if (INTEGRATIONS[integration]) {
|
|
97
101
|
return INTEGRATIONS[integration];
|
|
98
102
|
}
|
|
@@ -112,5 +116,10 @@ module.exports = {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
throw new Error("No datasource implementation found.");
|
|
115
|
-
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exports.getIntegration = getIntegration;
|
|
122
|
+
exports.default = {
|
|
123
|
+
getDefinitions,
|
|
124
|
+
getIntegration,
|
|
116
125
|
};
|
|
@@ -8,16 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
15
|
+
const builder_1 = __importDefault(require("./builder"));
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
17
|
function hasResource(ctx) {
|
|
18
18
|
return ctx.resourceId != null;
|
|
19
19
|
}
|
|
20
|
-
const csrf = buildCsrfMiddleware();
|
|
20
|
+
const csrf = backend_core_1.auth.buildCsrfMiddleware();
|
|
21
21
|
/**
|
|
22
22
|
* Apply authorization to the requested resource:
|
|
23
23
|
* - If this is a builder resource the user must be a builder.
|
|
@@ -27,7 +27,7 @@ const csrf = buildCsrfMiddleware();
|
|
|
27
27
|
const checkAuthorized = (ctx, resourceRoles, permType, permLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
// check if this is a builder api and the user is not a builder
|
|
29
29
|
const isBuilder = ctx.user && ctx.user.builder && ctx.user.builder.global;
|
|
30
|
-
const isBuilderApi = permType === PermissionType.BUILDER;
|
|
30
|
+
const isBuilderApi = permType === backend_core_1.permissions.PermissionType.BUILDER;
|
|
31
31
|
if (isBuilderApi && !isBuilder) {
|
|
32
32
|
return ctx.throw(403, "Not Authorized");
|
|
33
33
|
}
|
|
@@ -38,8 +38,8 @@ const checkAuthorized = (ctx, resourceRoles, permType, permLevel) => __awaiter(v
|
|
|
38
38
|
});
|
|
39
39
|
const checkAuthorizedResource = (ctx, resourceRoles, permType, permLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
40
|
// get the user's roles
|
|
41
|
-
const roleId = ctx.roleId ||
|
|
42
|
-
const userRoles = (yield
|
|
41
|
+
const roleId = ctx.roleId || backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC;
|
|
42
|
+
const userRoles = (yield backend_core_1.roles.getUserRoleHierarchy(roleId, {
|
|
43
43
|
idOnly: false,
|
|
44
44
|
}));
|
|
45
45
|
const permError = "User does not have permission";
|
|
@@ -52,14 +52,14 @@ const checkAuthorizedResource = (ctx, resourceRoles, permType, permLevel) => __a
|
|
|
52
52
|
}
|
|
53
53
|
// fallback to the base permissions when no resource roles are found
|
|
54
54
|
}
|
|
55
|
-
else if (!doesHaveBasePermission(permType, permLevel, userRoles)) {
|
|
55
|
+
else if (!backend_core_1.permissions.doesHaveBasePermission(permType, permLevel, userRoles)) {
|
|
56
56
|
ctx.throw(403, permError);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
module.exports = (permType, permLevel = null, opts = { schema: false }) => (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
// webhooks don't need authentication, each webhook unique
|
|
61
61
|
// also internal requests (between services) don't need authorized
|
|
62
|
-
if (isWebhookEndpoint(ctx) || ctx.internal) {
|
|
62
|
+
if ((0, utils_1.isWebhookEndpoint)(ctx) || ctx.internal) {
|
|
63
63
|
return next();
|
|
64
64
|
}
|
|
65
65
|
if (!ctx.user) {
|
|
@@ -67,23 +67,24 @@ module.exports = (permType, permLevel = null, opts = { schema: false }) => (ctx,
|
|
|
67
67
|
}
|
|
68
68
|
// check general builder stuff, this middleware is a good way
|
|
69
69
|
// to find API endpoints which are builder focused
|
|
70
|
-
yield
|
|
70
|
+
yield (0, builder_1.default)(ctx, permType);
|
|
71
71
|
// get the resource roles
|
|
72
72
|
let resourceRoles = [];
|
|
73
73
|
let otherLevelRoles = [];
|
|
74
|
-
const otherLevel = permLevel === PermissionLevel.READ
|
|
75
|
-
? PermissionLevel.WRITE
|
|
76
|
-
: PermissionLevel.READ;
|
|
77
|
-
const appId = getAppId();
|
|
74
|
+
const otherLevel = permLevel === backend_core_1.permissions.PermissionLevel.READ
|
|
75
|
+
? backend_core_1.permissions.PermissionLevel.WRITE
|
|
76
|
+
: backend_core_1.permissions.PermissionLevel.READ;
|
|
77
|
+
const appId = backend_core_1.context.getAppId();
|
|
78
78
|
if (appId && hasResource(ctx)) {
|
|
79
|
-
resourceRoles = yield
|
|
79
|
+
resourceRoles = yield backend_core_1.roles.getRequiredResourceRole(permLevel, ctx);
|
|
80
80
|
if (opts && opts.schema) {
|
|
81
|
-
otherLevelRoles = yield
|
|
81
|
+
otherLevelRoles = yield backend_core_1.roles.getRequiredResourceRole(otherLevel, ctx);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
// if the resource is public, proceed
|
|
85
|
-
if (resourceRoles.includes(
|
|
86
|
-
(otherLevelRoles &&
|
|
85
|
+
if (resourceRoles.includes(backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC) ||
|
|
86
|
+
(otherLevelRoles &&
|
|
87
|
+
otherLevelRoles.includes(backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC))) {
|
|
87
88
|
return next();
|
|
88
89
|
}
|
|
89
90
|
// check authenticated
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.run = void 0;
|
|
13
|
-
const
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
14
14
|
const application_1 = require("../../api/controllers/application");
|
|
15
15
|
/**
|
|
16
16
|
* Date:
|
|
@@ -22,7 +22,7 @@ const application_1 = require("../../api/controllers/application");
|
|
|
22
22
|
const run = (appDb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
let metadata;
|
|
24
24
|
try {
|
|
25
|
-
metadata = yield appDb.get(DocumentType.APP_METADATA);
|
|
25
|
+
metadata = yield appDb.get(backend_core_1.db.DocumentType.APP_METADATA);
|
|
26
26
|
}
|
|
27
27
|
catch (e) {
|
|
28
28
|
// sometimes the metadata document doesn't exist
|
|
@@ -10,16 +10,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.run = void 0;
|
|
13
|
-
const
|
|
14
|
-
const db_1 = require("@budibase/backend-core/db");
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
15
14
|
const pro_1 = require("@budibase/pro");
|
|
16
15
|
const types_1 = require("@budibase/types");
|
|
17
16
|
const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
17
|
// get app count
|
|
19
|
-
const devApps = yield
|
|
18
|
+
const devApps = yield backend_core_1.db.getAllApps({ dev: true });
|
|
20
19
|
const appCount = devApps ? devApps.length : 0;
|
|
21
20
|
// sync app count
|
|
22
|
-
const tenantId =
|
|
21
|
+
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
23
22
|
console.log(`[Tenant: ${tenantId}] Syncing app count: ${appCount}`);
|
|
24
23
|
yield pro_1.quotas.setUsage(appCount, types_1.StaticQuotaName.APPS, types_1.QuotaUsageType.STATIC);
|
|
25
24
|
});
|
|
@@ -10,14 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.run = void 0;
|
|
13
|
-
const
|
|
14
|
-
const db_1 = require("@budibase/backend-core/db");
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
15
14
|
const rows_1 = require("../../../utilities/usageQuota/rows");
|
|
16
15
|
const pro_1 = require("@budibase/pro");
|
|
17
16
|
const types_1 = require("@budibase/types");
|
|
18
17
|
const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
18
|
// get all rows in all apps
|
|
20
|
-
const allApps = (yield
|
|
19
|
+
const allApps = (yield backend_core_1.db.getAllApps({ all: true }));
|
|
21
20
|
const appIds = allApps ? allApps.map((app) => app.appId) : [];
|
|
22
21
|
const { appRows } = yield (0, rows_1.getUniqueRows)(appIds);
|
|
23
22
|
// get the counts per app
|
|
@@ -28,7 +27,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
28
27
|
rowCount += rows.length;
|
|
29
28
|
});
|
|
30
29
|
// sync row count
|
|
31
|
-
const tenantId =
|
|
30
|
+
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
32
31
|
console.log(`[Tenant: ${tenantId}] Syncing row count: ${rowCount}`);
|
|
33
32
|
yield pro_1.quotas.setUsagePerApp(counts, types_1.StaticQuotaName.ROWS, types_1.QuotaUsageType.STATIC);
|
|
34
33
|
});
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.run = void 0;
|
|
13
|
-
const
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
14
14
|
/**
|
|
15
15
|
* Date:
|
|
16
16
|
* October 2021
|
|
@@ -18,7 +18,7 @@ const { createNewUserEmailView } = require("@budibase/backend-core/db");
|
|
|
18
18
|
* Description:
|
|
19
19
|
* Recreate the user email view to include latest changes i.e. lower casing the email address
|
|
20
20
|
*/
|
|
21
|
-
const run = (
|
|
22
|
-
yield createNewUserEmailView(
|
|
21
|
+
const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
yield backend_core_1.db.createNewUserEmailView();
|
|
23
23
|
});
|
|
24
24
|
exports.run = run;
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.1.32-alpha.
|
|
4
|
+
"version": "2.1.32-alpha.9",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "2.1.32-alpha.
|
|
47
|
-
"@budibase/client": "2.1.32-alpha.
|
|
48
|
-
"@budibase/pro": "2.1.
|
|
49
|
-
"@budibase/string-templates": "2.1.32-alpha.
|
|
50
|
-
"@budibase/types": "2.1.32-alpha.
|
|
46
|
+
"@budibase/backend-core": "2.1.32-alpha.9",
|
|
47
|
+
"@budibase/client": "2.1.32-alpha.9",
|
|
48
|
+
"@budibase/pro": "2.1.32-alpha.9",
|
|
49
|
+
"@budibase/string-templates": "2.1.32-alpha.9",
|
|
50
|
+
"@budibase/types": "2.1.32-alpha.9",
|
|
51
51
|
"@bull-board/api": "3.7.0",
|
|
52
52
|
"@bull-board/koa": "3.9.4",
|
|
53
53
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -15,7 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.streamExportApp = exports.exportMultipleApps = exports.exportApp = exports.exportDB = void 0;
|
|
16
16
|
const backend_core_1 = require("@budibase/backend-core");
|
|
17
17
|
const budibaseDir_1 = require("../../../utilities/budibaseDir");
|
|
18
|
-
const utilities_1 = require("../../../utilities/fileSystem/utilities");
|
|
19
18
|
const fileSystem_1 = require("../../../utilities/fileSystem");
|
|
20
19
|
const constants_1 = require("../../../constants");
|
|
21
20
|
const utils_1 = require("../../../db/utils");
|
|
@@ -89,7 +88,7 @@ function exportApp(appId, config) {
|
|
|
89
88
|
// export bucket contents
|
|
90
89
|
let tmpPath;
|
|
91
90
|
if (!environment_1.default.isTest()) {
|
|
92
|
-
tmpPath = yield
|
|
91
|
+
tmpPath = yield backend_core_1.objectStore.retrieveDirectory(constants_1.ObjectStoreBuckets.APPS, appPath);
|
|
93
92
|
}
|
|
94
93
|
else {
|
|
95
94
|
tmpPath = (0, fileSystem_1.createTempFolder)(uuid());
|
|
@@ -17,7 +17,6 @@ const backend_core_1 = require("@budibase/backend-core");
|
|
|
17
17
|
const utils_1 = require("../../../db/utils");
|
|
18
18
|
const budibaseDir_1 = require("../../../utilities/budibaseDir");
|
|
19
19
|
const constants_1 = require("./constants");
|
|
20
|
-
const utilities_1 = require("../../../utilities/fileSystem/utilities");
|
|
21
20
|
const fileSystem_1 = require("../../../utilities/fileSystem");
|
|
22
21
|
const constants_2 = require("../../../constants");
|
|
23
22
|
const path_1 = require("path");
|
|
@@ -161,10 +160,10 @@ function importApp(appId, db, template) {
|
|
|
161
160
|
}
|
|
162
161
|
filename = (0, path_1.join)(prodAppId, filename);
|
|
163
162
|
if (fs_1.default.lstatSync(path).isDirectory()) {
|
|
164
|
-
promises.push(
|
|
163
|
+
promises.push(backend_core_1.objectStore.uploadDirectory(constants_2.ObjectStoreBuckets.APPS, path, filename));
|
|
165
164
|
}
|
|
166
165
|
else {
|
|
167
|
-
promises.push(
|
|
166
|
+
promises.push(backend_core_1.objectStore.upload({
|
|
168
167
|
bucket: constants_2.ObjectStoreBuckets.APPS,
|
|
169
168
|
path,
|
|
170
169
|
filename,
|
|
@@ -20,7 +20,7 @@ function getAllInternalTables(db) {
|
|
|
20
20
|
const internalTables = yield db.allDocs((0, utils_1.getTableParams)(null, {
|
|
21
21
|
include_docs: true,
|
|
22
22
|
}));
|
|
23
|
-
return internalTables.rows.map((tableDoc) => (Object.assign(Object.assign({}, tableDoc.doc), { type: "internal", sourceId: utils_1.BudibaseInternalDB._id })));
|
|
23
|
+
return internalTables.rows.map((tableDoc) => (Object.assign(Object.assign({}, tableDoc.doc), { type: "internal", sourceId: tableDoc.doc.sourceId || utils_1.BudibaseInternalDB._id })));
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
function getAllExternalTables(datasourceId) {
|
package/dist/startup.js
CHANGED
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.startup = void 0;
|
|
39
39
|
const env = __importStar(require("./environment"));
|
|
40
|
-
const
|
|
40
|
+
const redis = __importStar(require("./utilities/redis"));
|
|
41
41
|
const workerRequests_1 = require("./utilities/workerRequests");
|
|
42
42
|
const backend_core_1 = require("@budibase/backend-core");
|
|
43
43
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -48,7 +48,7 @@ const events_1 = __importDefault(require("./events"));
|
|
|
48
48
|
const migrations = __importStar(require("./migrations"));
|
|
49
49
|
const bullboard_1 = __importDefault(require("./automations/bullboard"));
|
|
50
50
|
const pro = __importStar(require("@budibase/pro"));
|
|
51
|
-
const
|
|
51
|
+
const api = __importStar(require("./api"));
|
|
52
52
|
const sdk_1 = __importDefault(require("./sdk"));
|
|
53
53
|
const pino = require("koa-pino-logger");
|
|
54
54
|
let STARTUP_RAN = false;
|
|
@@ -62,7 +62,7 @@ function initRoutes(app) {
|
|
|
62
62
|
app.context.eventEmitter = events_1.default;
|
|
63
63
|
app.context.auth = {};
|
|
64
64
|
// api routes
|
|
65
|
-
app.use(
|
|
65
|
+
app.use(api.router.routes());
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
function initPro() {
|
|
@@ -95,7 +95,7 @@ function startup(app, server) {
|
|
|
95
95
|
}
|
|
96
96
|
events_1.default.emitPort(env.PORT);
|
|
97
97
|
fileSystem_1.default.init();
|
|
98
|
-
yield
|
|
98
|
+
yield redis.init();
|
|
99
99
|
// run migrations on startup if not done via http
|
|
100
100
|
// not recommended in a clustered environment
|
|
101
101
|
if (!env.HTTP_MIGRATIONS && !env.isTest()) {
|
|
@@ -9,21 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
require("../../db").init();
|
|
12
|
-
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles");
|
|
13
12
|
const env = require("../../environment");
|
|
14
13
|
const { basicTable, basicRow, basicRole, basicAutomation, basicDatasource, basicQuery, basicScreen, basicLayout, basicWebhook, TENANT_ID, } = require("./structures");
|
|
14
|
+
const { constants, tenancy, sessions, cache, context, db: dbCore, encryption, auth, roles, } = require("@budibase/backend-core");
|
|
15
15
|
const controllers = require("./controllers");
|
|
16
16
|
const supertest = require("supertest");
|
|
17
17
|
const { cleanup } = require("../../utilities/fileSystem");
|
|
18
|
-
const { Cookie, Header } = require("@budibase/backend-core/constants");
|
|
19
|
-
const { jwt } = require("@budibase/backend-core/auth");
|
|
20
|
-
const { doInTenant, doWithGlobalDB } = require("@budibase/backend-core/tenancy");
|
|
21
|
-
const { createASession } = require("@budibase/backend-core/sessions");
|
|
22
|
-
const { user: userCache } = require("@budibase/backend-core/cache");
|
|
23
18
|
const newid = require("../../db/newid");
|
|
24
|
-
const context = require("@budibase/backend-core/context");
|
|
25
|
-
const { generateDevInfoID, SEPARATOR } = require("@budibase/backend-core/db");
|
|
26
|
-
const { encrypt } = require("@budibase/backend-core/encryption");
|
|
27
19
|
const { DocumentType, generateUserMetadataID } = require("../../db/utils");
|
|
28
20
|
const { startup } = require("../../startup");
|
|
29
21
|
const GLOBAL_USER_ID = "us_uuid1";
|
|
@@ -75,7 +67,7 @@ class TestConfiguration {
|
|
|
75
67
|
if (!appId) {
|
|
76
68
|
appId = this.appId;
|
|
77
69
|
}
|
|
78
|
-
return doInTenant(TENANT_ID, () => {
|
|
70
|
+
return tenancy.doInTenant(TENANT_ID, () => {
|
|
79
71
|
// check if already in a context
|
|
80
72
|
if (context.getAppId() == null && appId !== null) {
|
|
81
73
|
return context.doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -139,7 +131,7 @@ class TestConfiguration {
|
|
|
139
131
|
// USER / AUTH
|
|
140
132
|
globalUser({ id = GLOBAL_USER_ID, firstName = FIRSTNAME, lastName = LASTNAME, builder = true, admin = false, email = EMAIL, roles, } = {}) {
|
|
141
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
-
return doWithGlobalDB(TENANT_ID, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
return tenancy.doWithGlobalDB(TENANT_ID, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
143
135
|
let existing;
|
|
144
136
|
try {
|
|
145
137
|
existing = yield db.get(id);
|
|
@@ -149,7 +141,7 @@ class TestConfiguration {
|
|
|
149
141
|
}
|
|
150
142
|
const user = Object.assign(Object.assign({ _id: id }, existing), { roles: roles || {}, tenantId: TENANT_ID, firstName,
|
|
151
143
|
lastName });
|
|
152
|
-
yield createASession(id, {
|
|
144
|
+
yield sessions.createASession(id, {
|
|
153
145
|
sessionId: "sessionid",
|
|
154
146
|
tenantId: TENANT_ID,
|
|
155
147
|
csrfToken: CSRF_TOKEN,
|
|
@@ -183,7 +175,7 @@ class TestConfiguration {
|
|
|
183
175
|
admin,
|
|
184
176
|
roles,
|
|
185
177
|
});
|
|
186
|
-
yield
|
|
178
|
+
yield cache.user.invalidateUser(globalId);
|
|
187
179
|
return Object.assign(Object.assign({}, resp), { globalId });
|
|
188
180
|
});
|
|
189
181
|
}
|
|
@@ -196,19 +188,19 @@ class TestConfiguration {
|
|
|
196
188
|
throw "Server has not been opened, cannot login.";
|
|
197
189
|
}
|
|
198
190
|
// make sure the user exists in the global DB
|
|
199
|
-
if (roleId !== BUILTIN_ROLE_IDS.PUBLIC) {
|
|
191
|
+
if (roleId !== roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
200
192
|
yield this.globalUser({
|
|
201
193
|
id: userId,
|
|
202
194
|
builder,
|
|
203
195
|
roles: { [this.prodAppId]: roleId },
|
|
204
196
|
});
|
|
205
197
|
}
|
|
206
|
-
yield createASession(userId, {
|
|
198
|
+
yield sessions.createASession(userId, {
|
|
207
199
|
sessionId: "sessionid",
|
|
208
200
|
tenantId: TENANT_ID,
|
|
209
201
|
});
|
|
210
202
|
// have to fake this
|
|
211
|
-
const
|
|
203
|
+
const authObj = {
|
|
212
204
|
userId,
|
|
213
205
|
sessionId: "sessionid",
|
|
214
206
|
tenantId: TENANT_ID,
|
|
@@ -217,39 +209,39 @@ class TestConfiguration {
|
|
|
217
209
|
roleId: roleId,
|
|
218
210
|
appId,
|
|
219
211
|
};
|
|
220
|
-
const authToken = jwt.sign(
|
|
221
|
-
const appToken = jwt.sign(app, env.JWT_SECRET);
|
|
212
|
+
const authToken = auth.jwt.sign(authObj, env.JWT_SECRET);
|
|
213
|
+
const appToken = auth.jwt.sign(app, env.JWT_SECRET);
|
|
222
214
|
// returning necessary request headers
|
|
223
|
-
yield
|
|
215
|
+
yield cache.user.invalidateUser(userId);
|
|
224
216
|
return {
|
|
225
217
|
Accept: "application/json",
|
|
226
218
|
Cookie: [
|
|
227
|
-
`${Cookie.Auth}=${authToken}`,
|
|
228
|
-
`${Cookie.CurrentApp}=${appToken}`,
|
|
219
|
+
`${constants.Cookie.Auth}=${authToken}`,
|
|
220
|
+
`${constants.Cookie.CurrentApp}=${appToken}`,
|
|
229
221
|
],
|
|
230
|
-
[Header.APP_ID]: appId,
|
|
222
|
+
[constants.Header.APP_ID]: appId,
|
|
231
223
|
};
|
|
232
224
|
}));
|
|
233
225
|
});
|
|
234
226
|
}
|
|
235
227
|
defaultHeaders(extras = {}) {
|
|
236
|
-
const
|
|
228
|
+
const authObj = {
|
|
237
229
|
userId: GLOBAL_USER_ID,
|
|
238
230
|
sessionId: "sessionid",
|
|
239
231
|
tenantId: TENANT_ID,
|
|
240
232
|
};
|
|
241
233
|
const app = {
|
|
242
|
-
roleId: BUILTIN_ROLE_IDS.ADMIN,
|
|
234
|
+
roleId: roles.BUILTIN_ROLE_IDS.ADMIN,
|
|
243
235
|
appId: this.appId,
|
|
244
236
|
};
|
|
245
|
-
const authToken = jwt.sign(
|
|
246
|
-
const appToken = jwt.sign(app, env.JWT_SECRET);
|
|
237
|
+
const authToken = auth.jwt.sign(authObj, env.JWT_SECRET);
|
|
238
|
+
const appToken = auth.jwt.sign(app, env.JWT_SECRET);
|
|
247
239
|
const headers = Object.assign({ Accept: "application/json", Cookie: [
|
|
248
|
-
`${Cookie.Auth}=${authToken}`,
|
|
249
|
-
`${Cookie.CurrentApp}=${appToken}`,
|
|
250
|
-
], [Header.CSRF_TOKEN]: CSRF_TOKEN }, extras);
|
|
240
|
+
`${constants.Cookie.Auth}=${authToken}`,
|
|
241
|
+
`${constants.Cookie.CurrentApp}=${appToken}`,
|
|
242
|
+
], [constants.Header.CSRF_TOKEN]: CSRF_TOKEN }, extras);
|
|
251
243
|
if (this.appId) {
|
|
252
|
-
headers[Header.APP_ID] = this.appId;
|
|
244
|
+
headers[constants.Header.APP_ID] = this.appId;
|
|
253
245
|
}
|
|
254
246
|
return headers;
|
|
255
247
|
}
|
|
@@ -259,11 +251,11 @@ class TestConfiguration {
|
|
|
259
251
|
Accept: "application/json",
|
|
260
252
|
};
|
|
261
253
|
if (appId) {
|
|
262
|
-
headers[Header.APP_ID] = appId;
|
|
254
|
+
headers[constants.Header.APP_ID] = appId;
|
|
263
255
|
}
|
|
264
256
|
return headers;
|
|
265
257
|
}
|
|
266
|
-
roleHeaders({ email = EMAIL, roleId = BUILTIN_ROLE_IDS.ADMIN, builder = false, prodApp = true, } = {}) {
|
|
258
|
+
roleHeaders({ email = EMAIL, roleId = roles.BUILTIN_ROLE_IDS.ADMIN, builder = false, prodApp = true, } = {}) {
|
|
267
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
268
260
|
return this.login({ email, roleId, builder, prodApp });
|
|
269
261
|
});
|
|
@@ -271,8 +263,8 @@ class TestConfiguration {
|
|
|
271
263
|
// API
|
|
272
264
|
generateApiKey(userId = GLOBAL_USER_ID) {
|
|
273
265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
-
return doWithGlobalDB(TENANT_ID, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
275
|
-
const id = generateDevInfoID(userId);
|
|
266
|
+
return tenancy.doWithGlobalDB(TENANT_ID, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
267
|
+
const id = dbCore.generateDevInfoID(userId);
|
|
276
268
|
let devInfo;
|
|
277
269
|
try {
|
|
278
270
|
devInfo = yield db.get(id);
|
|
@@ -280,7 +272,7 @@ class TestConfiguration {
|
|
|
280
272
|
catch (err) {
|
|
281
273
|
devInfo = { _id: id, userId };
|
|
282
274
|
}
|
|
283
|
-
devInfo.apiKey = encrypt(`${TENANT_ID}${SEPARATOR}${newid()}`);
|
|
275
|
+
devInfo.apiKey = encryption.encrypt(`${TENANT_ID}${dbCore.SEPARATOR}${newid()}`);
|
|
284
276
|
yield db.put(devInfo);
|
|
285
277
|
return devInfo.apiKey;
|
|
286
278
|
}));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const {
|
|
3
|
-
const { BuiltinPermissionID } = require("@budibase/backend-core/permissions");
|
|
2
|
+
const { roles, permissions } = require("@budibase/backend-core");
|
|
4
3
|
const { createHomeScreen } = require("../../constants/screens");
|
|
5
4
|
const { EMPTY_LAYOUT } = require("../../constants/layouts");
|
|
6
5
|
const { cloneDeep } = require("lodash/fp");
|
|
@@ -100,8 +99,8 @@ exports.basicLinkedRow = (tableId, linkedRowId, linkField = "link") => {
|
|
|
100
99
|
exports.basicRole = () => {
|
|
101
100
|
return {
|
|
102
101
|
name: "NewRole",
|
|
103
|
-
inherits: BUILTIN_ROLE_IDS.BASIC,
|
|
104
|
-
permissionId: BuiltinPermissionID.READ_ONLY,
|
|
102
|
+
inherits: roles.BUILTIN_ROLE_IDS.BASIC,
|
|
103
|
+
permissionId: permissions.BuiltinPermissionID.READ_ONLY,
|
|
105
104
|
};
|
|
106
105
|
};
|
|
107
106
|
exports.basicDatasource = () => {
|