@budibase/server 2.1.22-alpha.6 → 2.1.22-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/node-fetch.ts +5 -1
- package/builder/assets/{index.5ec5f06c.js → index.22484e23.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +1182 -1209
- package/coverage/coverage-final.json +35 -35
- package/coverage/lcov-report/index.html +94 -94
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/application.ts.html +45 -60
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +7 -4
- package/coverage/lcov-report/src/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +19 -55
- package/coverage/lcov-report/src/api/controllers/{dev.js.html → dev.ts.html} +46 -64
- package/coverage/lcov-report/src/api/controllers/index.html +25 -25
- package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +37 -19
- package/coverage/lcov-report/src/api/controllers/public/index.html +16 -16
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +17 -26
- package/coverage/lcov-report/src/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internal.js.html +3 -3
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/application.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/automation.js.html +5 -5
- package/coverage/lcov-report/src/api/routes/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/datasource.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/row.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +6 -6
- package/coverage/lcov-report/src/api/routes/table.js.html +4 -4
- package/coverage/lcov-report/src/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/user.js.html +11 -11
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.js.html +6 -6
- package/coverage/lcov-report/src/api/routes/view.js.html +4 -4
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/app.ts.html +1 -1
- package/coverage/lcov-report/src/automations/actions.js.html +1 -1
- package/coverage/lcov-report/src/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/src/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/src/automations/index.html +15 -15
- package/coverage/lcov-report/src/automations/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +17 -17
- package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +33 -15
- package/coverage/lcov-report/src/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/src/automations/utils.ts.html +20 -29
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.js.html +1 -1
- package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/src/constants/screens.js.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
- package/coverage/lcov-report/src/db/inMemoryView.js.html +3 -3
- package/coverage/lcov-report/src/db/index.html +16 -16
- package/coverage/lcov-report/src/db/index.js.html +9 -9
- package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/src/db/newid.js.html +1 -1
- package/coverage/lcov-report/src/db/{utils.js.html → utils.ts.html} +97 -145
- package/coverage/lcov-report/src/definitions/automations.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.js.html +4 -4
- package/coverage/lcov-report/src/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.js.html +1 -1
- package/coverage/lcov-report/src/events/utils.js.html +1 -1
- package/coverage/lcov-report/src/index.html +1 -1
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/airtable.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/index.html +1 -1
- package/coverage/lcov-report/src/integrations/base/query.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/firebase.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +10 -19
- package/coverage/lcov-report/src/integrations/index.html +11 -11
- package/coverage/lcov-report/src/integrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mysql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/oracle.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/postgres.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/redis.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/rest.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/s3.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/integrations/utils.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/{appInfo.js.html → appInfo.ts.html} +24 -21
- package/coverage/lcov-report/src/middleware/authorized.ts.html +7 -7
- package/coverage/lcov-report/src/middleware/{builder.js.html → builder.ts.html} +36 -30
- package/coverage/lcov-report/src/middleware/{currentapp.js.html → currentapp.ts.html} +70 -61
- package/coverage/lcov-report/src/middleware/index.html +55 -55
- package/coverage/lcov-report/src/middleware/{joi-validator.js.html → joi-validator.ts.html} +18 -15
- package/coverage/lcov-report/src/middleware/{publicApi.js.html → publicApi.ts.html} +17 -17
- package/coverage/lcov-report/src/middleware/{resourceId.js.html → resourceId.ts.html} +33 -18
- package/coverage/lcov-report/src/middleware/{selfhost.js.html → selfhost.ts.html} +18 -12
- package/coverage/lcov-report/src/middleware/{utils.js.html → utils.ts.html} +12 -6
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +6 -15
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
- package/coverage/lcov-report/src/module.d.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +7 -16
- package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +12 -39
- package/coverage/lcov-report/src/sdk/app/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +8 -11
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +1 -1
- package/coverage/lcov-report/src/startup.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +24 -24
- package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.html +19 -19
- package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.js.html +3 -3
- package/coverage/lcov-report/src/threads/automation.ts.html +2 -2
- package/coverage/lcov-report/src/threads/index.html +1 -1
- package/coverage/lcov-report/src/threads/index.ts.html +1 -1
- package/coverage/lcov-report/src/threads/query.ts.html +1 -1
- package/coverage/lcov-report/src/threads/utils.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/src/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/src/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{global.js.html → global.ts.html} +100 -67
- package/coverage/lcov-report/src/utilities/index.html +16 -16
- package/coverage/lcov-report/src/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/plugins.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/src/utilities/redis.js.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/src/utilities/security.js.html +13 -13
- package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/src/utilities/users.js.html +1 -1
- package/coverage/lcov-report/src/utilities/workerRequests.js.html +4 -4
- package/coverage/lcov-report/src/watch.ts.html +1 -1
- package/coverage/lcov-report/src/websocket.ts.html +1 -1
- package/coverage/lcov.info +2052 -2049
- package/dist/api/controllers/application.js +35 -43
- package/dist/api/controllers/deploy/index.js +13 -16
- package/dist/api/controllers/dev.js +96 -81
- package/dist/api/controllers/public/applications.js +17 -9
- package/dist/api/controllers/query/index.js +10 -13
- package/dist/api/controllers/row/internal.js +2 -2
- package/dist/api/routes/automation.js +3 -3
- package/dist/api/routes/datasource.js +4 -4
- package/dist/api/routes/public/index.js +9 -9
- package/dist/api/routes/query.js +4 -4
- package/dist/api/routes/row.js +11 -11
- package/dist/api/routes/static.js +3 -3
- package/dist/api/routes/table.js +2 -2
- package/dist/api/routes/user.js +9 -9
- package/dist/api/routes/utils/validators.js +4 -4
- package/dist/api/routes/view.js +2 -2
- package/dist/automations/tests/utilities/index.js +21 -12
- package/dist/automations/utils.js +9 -8
- package/dist/db/inMemoryView.js +2 -2
- package/dist/db/utils.js +145 -118
- package/dist/integrations/googlesheets.js +4 -6
- package/dist/middleware/appInfo.js +14 -9
- package/dist/middleware/authorized.js +5 -5
- package/dist/middleware/builder.js +41 -40
- package/dist/middleware/currentapp.js +39 -37
- package/dist/middleware/joi-validator.js +17 -10
- package/dist/middleware/publicApi.js +5 -6
- package/dist/middleware/resourceId.js +16 -9
- package/dist/middleware/selfhost.js +5 -4
- package/dist/middleware/utils.js +5 -2
- package/dist/package.json +6 -6
- package/dist/sdk/app/tables/index.js +4 -4
- package/dist/tests/utilities/TestConfiguration.js +9 -9
- package/dist/tests/utilities/structures.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +87 -66
- package/dist/utilities/security.js +10 -10
- package/dist/utilities/workerRequests.js +3 -3
- package/jest.config.ts +1 -0
- package/package.json +7 -7
- package/src/api/controllers/application.ts +34 -39
- package/src/api/controllers/auth.ts +3 -2
- package/src/api/controllers/deploy/index.ts +13 -25
- package/src/api/controllers/{dev.js → dev.ts} +31 -37
- package/src/api/controllers/public/applications.ts +15 -9
- package/src/api/controllers/query/index.ts +11 -14
- package/src/api/controllers/row/internal.js +2 -2
- package/src/api/routes/automation.js +4 -4
- package/src/api/routes/datasource.js +5 -5
- package/src/api/routes/public/index.ts +10 -10
- package/src/api/routes/public/tests/compare.spec.js +1 -1
- package/src/api/routes/query.js +5 -5
- package/src/api/routes/row.ts +12 -12
- package/src/api/routes/static.ts +5 -5
- package/src/api/routes/table.js +3 -3
- package/src/api/routes/tests/analytics.spec.js +1 -1
- package/src/api/routes/tests/query.spec.js +15 -10
- package/src/api/routes/tests/role.spec.js +5 -5
- package/src/api/routes/tests/static.spec.js +2 -2
- package/src/api/routes/tests/table.spec.js +38 -35
- package/src/api/routes/user.js +10 -10
- package/src/api/routes/utils/validators.js +5 -5
- package/src/api/routes/view.js +3 -3
- package/src/automations/tests/updateRow.spec.js +0 -1
- package/src/automations/tests/utilities/index.js +10 -4
- package/src/automations/utils.ts +9 -12
- package/src/db/inMemoryView.js +2 -2
- package/src/db/tests/linkController.spec.js +73 -57
- package/src/db/tests/linkTests.spec.js +17 -14
- package/src/db/{utils.js → utils.ts} +76 -92
- package/src/integrations/googlesheets.ts +4 -7
- package/src/middleware/appInfo.ts +20 -0
- package/src/middleware/authorized.ts +6 -6
- package/src/middleware/{builder.js → builder.ts} +17 -15
- package/src/middleware/{currentapp.js → currentapp.ts} +42 -39
- package/src/middleware/{joi-validator.js → joi-validator.ts} +9 -8
- package/src/middleware/publicApi.ts +21 -0
- package/src/middleware/{resourceId.js → resourceId.ts} +16 -11
- package/src/middleware/{selfhost.js → selfhost.ts} +4 -2
- package/src/middleware/tests/authorized.spec.js +5 -5
- package/src/middleware/tests/currentapp.spec.js +118 -63
- package/src/middleware/{utils.js → utils.ts} +3 -1
- package/src/migrations/functions/backfill/app/tables.ts +2 -5
- package/src/sdk/app/backups/imports.ts +4 -7
- package/src/sdk/app/backups/statistics.ts +9 -18
- package/src/sdk/app/tables/index.ts +6 -7
- package/src/tests/utilities/TestConfiguration.js +9 -9
- package/src/tests/utilities/structures.js +2 -2
- package/src/threads/automation.ts +1 -1
- package/src/utilities/global.ts +138 -0
- package/src/utilities/security.js +12 -12
- package/src/utilities/workerRequests.js +3 -3
- package/src/middleware/appInfo.js +0 -19
- package/src/middleware/publicApi.js +0 -21
- package/src/utilities/global.js +0 -127
package/dist/db/utils.js
CHANGED
|
@@ -1,87 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateMemoryViewID = exports.getMetadataParams = exports.generateMetadataID = exports.generateUserFlagID = exports.getQueryParams = exports.getAutomationMetadataParams = exports.generateAutomationMetadataID = exports.generateQueryID = exports.getDatasourceParams = exports.generateDatasourceID = exports.getWebhookParams = exports.generateWebhookID = exports.getScreenParams = exports.generateScreenID = exports.getLayoutParams = exports.generateLayoutID = exports.getLinkParams = exports.generateLinkID = exports.generateAutomationID = exports.getAutomationParams = exports.getTableIDFromRowID = exports.generateTableID = exports.getTableParams = exports.getGlobalIDFromUserMetadataID = exports.generateUserMetadataID = exports.getUserMetadataParams = exports.generateRowID = exports.getRowParams = exports.getDocParams = exports.getQueryIndex = exports.getRoleParams = exports.generateRoleID = exports.generateDevAppID = exports.generateAppID = exports.UNICODE_MAX = exports.InternalTables = exports.ViewName = exports.TABLE_ROW_PREFIX = exports.LINK_USER_METADATA_PREFIX = exports.USER_METDATA_PREFIX = exports.isProdAppID = exports.isDevAppID = exports.APP_DEV_PREFIX = exports.APP_PREFIX = exports.DocumentType = exports.StaticDatabases = exports.SEPARATOR = exports.BudibaseInternalDB = exports.SearchIndexes = exports.AppStatus = void 0;
|
|
7
|
+
exports.getMultiIDParams = exports.generatePluginID = exports.getMemoryViewParams = void 0;
|
|
8
|
+
const newid_1 = __importDefault(require("./newid"));
|
|
9
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
10
|
+
exports.AppStatus = {
|
|
6
11
|
DEV: "development",
|
|
7
12
|
ALL: "all",
|
|
8
13
|
DEPLOYED: "published",
|
|
9
14
|
};
|
|
10
|
-
|
|
11
|
-
const SearchIndexes = {
|
|
15
|
+
exports.SearchIndexes = {
|
|
12
16
|
ROWS: "rows",
|
|
13
17
|
};
|
|
14
|
-
exports.
|
|
15
|
-
const BudibaseInternalDB = {
|
|
18
|
+
exports.BudibaseInternalDB = {
|
|
16
19
|
_id: "bb_internal",
|
|
17
20
|
type: "budibase",
|
|
18
21
|
name: "Budibase DB",
|
|
19
22
|
source: "BUDIBASE",
|
|
20
23
|
config: {},
|
|
21
24
|
};
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
24
|
-
exports.
|
|
25
|
-
exports.
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.
|
|
29
|
-
exports.
|
|
30
|
-
exports.
|
|
31
|
-
exports.
|
|
32
|
-
exports.
|
|
33
|
-
exports.
|
|
34
|
-
exports.
|
|
35
|
-
exports.
|
|
36
|
-
exports.
|
|
37
|
-
exports.
|
|
38
|
-
exports.
|
|
39
|
-
exports.
|
|
40
|
-
exports.
|
|
41
|
-
exports.
|
|
42
|
-
exports.
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.generateUserMetadataID = generateUserMetadataID;
|
|
47
|
-
exports.getGlobalIDFromUserMetadataID = getGlobalIDFromUserMetadataID;
|
|
25
|
+
exports.SEPARATOR = backend_core_1.db.SEPARATOR;
|
|
26
|
+
exports.StaticDatabases = backend_core_1.db.StaticDatabases;
|
|
27
|
+
exports.DocumentType = backend_core_1.db.DocumentType;
|
|
28
|
+
exports.APP_PREFIX = backend_core_1.db.APP_PREFIX;
|
|
29
|
+
exports.APP_DEV_PREFIX = backend_core_1.db.APP_DEV_PREFIX;
|
|
30
|
+
exports.isDevAppID = backend_core_1.db.isDevAppID;
|
|
31
|
+
exports.isProdAppID = backend_core_1.db.isProdAppID;
|
|
32
|
+
exports.USER_METDATA_PREFIX = `${exports.DocumentType.ROW}${exports.SEPARATOR}${backend_core_1.db.InternalTable.USER_METADATA}${exports.SEPARATOR}`;
|
|
33
|
+
exports.LINK_USER_METADATA_PREFIX = `${exports.DocumentType.LINK}${exports.SEPARATOR}${backend_core_1.db.InternalTable.USER_METADATA}${exports.SEPARATOR}`;
|
|
34
|
+
exports.TABLE_ROW_PREFIX = `${exports.DocumentType.ROW}${exports.SEPARATOR}${exports.DocumentType.TABLE}`;
|
|
35
|
+
exports.ViewName = backend_core_1.db.ViewName;
|
|
36
|
+
exports.InternalTables = backend_core_1.db.InternalTable;
|
|
37
|
+
exports.UNICODE_MAX = backend_core_1.db.UNICODE_MAX;
|
|
38
|
+
exports.generateAppID = backend_core_1.db.generateAppID;
|
|
39
|
+
exports.generateDevAppID = backend_core_1.db.getDevelopmentAppID;
|
|
40
|
+
exports.generateRoleID = backend_core_1.db.generateRoleID;
|
|
41
|
+
exports.getRoleParams = backend_core_1.db.getRoleParams;
|
|
42
|
+
exports.getQueryIndex = backend_core_1.db.getQueryIndex;
|
|
43
|
+
exports.getDocParams = backend_core_1.db.getDocParams;
|
|
44
|
+
exports.getRowParams = backend_core_1.db.getRowParams;
|
|
45
|
+
exports.generateRowID = backend_core_1.db.generateRowID;
|
|
46
|
+
exports.getUserMetadataParams = backend_core_1.db.getUserMetadataParams;
|
|
47
|
+
exports.generateUserMetadataID = backend_core_1.db.generateUserMetadataID;
|
|
48
|
+
exports.getGlobalIDFromUserMetadataID = backend_core_1.db.getGlobalIDFromUserMetadataID;
|
|
48
49
|
/**
|
|
49
50
|
* Gets parameters for retrieving tables, this is a utility function for the getDocParams function.
|
|
50
51
|
*/
|
|
51
|
-
|
|
52
|
-
return getDocParams(DocumentType.TABLE, tableId, otherProps);
|
|
53
|
-
}
|
|
52
|
+
function getTableParams(tableId, otherProps = {}) {
|
|
53
|
+
return (0, exports.getDocParams)(exports.DocumentType.TABLE, tableId, otherProps);
|
|
54
|
+
}
|
|
55
|
+
exports.getTableParams = getTableParams;
|
|
54
56
|
/**
|
|
55
57
|
* Generates a new table ID.
|
|
56
58
|
* @returns {string} The new table ID which the table doc can be stored under.
|
|
57
59
|
*/
|
|
58
|
-
|
|
59
|
-
return `${DocumentType.TABLE}${SEPARATOR}${
|
|
60
|
-
}
|
|
60
|
+
function generateTableID() {
|
|
61
|
+
return `${exports.DocumentType.TABLE}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
62
|
+
}
|
|
63
|
+
exports.generateTableID = generateTableID;
|
|
61
64
|
/**
|
|
62
65
|
* Given a row ID this will find the table ID within it (only works for internal tables).
|
|
63
66
|
* @param {string} rowId The ID of the row.
|
|
64
67
|
* @returns {string} The table ID.
|
|
65
68
|
*/
|
|
66
|
-
|
|
69
|
+
function getTableIDFromRowID(rowId) {
|
|
67
70
|
const components = rowId
|
|
68
|
-
.split(DocumentType.TABLE + SEPARATOR)[1]
|
|
69
|
-
.split(SEPARATOR);
|
|
70
|
-
return `${DocumentType.TABLE}${SEPARATOR}${components[0]}`;
|
|
71
|
-
}
|
|
71
|
+
.split(exports.DocumentType.TABLE + exports.SEPARATOR)[1]
|
|
72
|
+
.split(exports.SEPARATOR);
|
|
73
|
+
return `${exports.DocumentType.TABLE}${exports.SEPARATOR}${components[0]}`;
|
|
74
|
+
}
|
|
75
|
+
exports.getTableIDFromRowID = getTableIDFromRowID;
|
|
72
76
|
/**
|
|
73
77
|
* Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
|
|
74
78
|
*/
|
|
75
|
-
|
|
76
|
-
return getDocParams(DocumentType.AUTOMATION, automationId, otherProps);
|
|
77
|
-
}
|
|
79
|
+
function getAutomationParams(automationId, otherProps = {}) {
|
|
80
|
+
return (0, exports.getDocParams)(exports.DocumentType.AUTOMATION, automationId, otherProps);
|
|
81
|
+
}
|
|
82
|
+
exports.getAutomationParams = getAutomationParams;
|
|
78
83
|
/**
|
|
79
84
|
* Generates a new automation ID.
|
|
80
85
|
* @returns {string} The new automation ID which the automation doc can be stored under.
|
|
81
86
|
*/
|
|
82
|
-
|
|
83
|
-
return `${DocumentType.AUTOMATION}${SEPARATOR}${
|
|
84
|
-
}
|
|
87
|
+
function generateAutomationID() {
|
|
88
|
+
return `${exports.DocumentType.AUTOMATION}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
89
|
+
}
|
|
90
|
+
exports.generateAutomationID = generateAutomationID;
|
|
85
91
|
/**
|
|
86
92
|
* Generates a new link doc ID. This is currently not usable with the alldocs call,
|
|
87
93
|
* instead a view is built to make walking to tree easier.
|
|
@@ -93,131 +99,152 @@ exports.generateAutomationID = () => {
|
|
|
93
99
|
* @param {string} fieldName2 the name of the field in the linked row.
|
|
94
100
|
* @returns {string} The new link doc ID which the automation doc can be stored under.
|
|
95
101
|
*/
|
|
96
|
-
|
|
97
|
-
const tables = `${SEPARATOR}${tableId1}${SEPARATOR}${tableId2}`;
|
|
98
|
-
const rows = `${SEPARATOR}${rowId1}${SEPARATOR}${rowId2}`;
|
|
99
|
-
const fields = `${SEPARATOR}${fieldName1}${SEPARATOR}${fieldName2}`;
|
|
100
|
-
return `${DocumentType.LINK}${tables}${rows}${fields}`;
|
|
101
|
-
}
|
|
102
|
+
function generateLinkID(tableId1, tableId2, rowId1, rowId2, fieldName1, fieldName2) {
|
|
103
|
+
const tables = `${exports.SEPARATOR}${tableId1}${exports.SEPARATOR}${tableId2}`;
|
|
104
|
+
const rows = `${exports.SEPARATOR}${rowId1}${exports.SEPARATOR}${rowId2}`;
|
|
105
|
+
const fields = `${exports.SEPARATOR}${fieldName1}${exports.SEPARATOR}${fieldName2}`;
|
|
106
|
+
return `${exports.DocumentType.LINK}${tables}${rows}${fields}`;
|
|
107
|
+
}
|
|
108
|
+
exports.generateLinkID = generateLinkID;
|
|
102
109
|
/**
|
|
103
110
|
* Gets parameters for retrieving link docs, this is a utility function for the getDocParams function.
|
|
104
111
|
*/
|
|
105
|
-
|
|
106
|
-
return getDocParams(DocumentType.LINK, null, otherProps);
|
|
107
|
-
}
|
|
112
|
+
function getLinkParams(otherProps = {}) {
|
|
113
|
+
return (0, exports.getDocParams)(exports.DocumentType.LINK, null, otherProps);
|
|
114
|
+
}
|
|
115
|
+
exports.getLinkParams = getLinkParams;
|
|
108
116
|
/**
|
|
109
117
|
* Generates a new layout ID.
|
|
110
118
|
* @returns {string} The new layout ID which the layout doc can be stored under.
|
|
111
119
|
*/
|
|
112
|
-
|
|
113
|
-
return `${DocumentType.LAYOUT}${SEPARATOR}${id ||
|
|
114
|
-
}
|
|
120
|
+
function generateLayoutID(id) {
|
|
121
|
+
return `${exports.DocumentType.LAYOUT}${exports.SEPARATOR}${id || (0, newid_1.default)()}`;
|
|
122
|
+
}
|
|
123
|
+
exports.generateLayoutID = generateLayoutID;
|
|
115
124
|
/**
|
|
116
125
|
* Gets parameters for retrieving layout, this is a utility function for the getDocParams function.
|
|
117
126
|
*/
|
|
118
|
-
|
|
119
|
-
return getDocParams(DocumentType.LAYOUT, layoutId, otherProps);
|
|
120
|
-
}
|
|
127
|
+
function getLayoutParams(layoutId, otherProps = {}) {
|
|
128
|
+
return (0, exports.getDocParams)(exports.DocumentType.LAYOUT, layoutId, otherProps);
|
|
129
|
+
}
|
|
130
|
+
exports.getLayoutParams = getLayoutParams;
|
|
121
131
|
/**
|
|
122
132
|
* Generates a new screen ID.
|
|
123
133
|
* @returns {string} The new screen ID which the screen doc can be stored under.
|
|
124
134
|
*/
|
|
125
|
-
|
|
126
|
-
return `${DocumentType.SCREEN}${SEPARATOR}${
|
|
127
|
-
}
|
|
135
|
+
function generateScreenID() {
|
|
136
|
+
return `${exports.DocumentType.SCREEN}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
137
|
+
}
|
|
138
|
+
exports.generateScreenID = generateScreenID;
|
|
128
139
|
/**
|
|
129
140
|
* Gets parameters for retrieving screens, this is a utility function for the getDocParams function.
|
|
130
141
|
*/
|
|
131
|
-
|
|
132
|
-
return getDocParams(DocumentType.SCREEN, screenId, otherProps);
|
|
133
|
-
}
|
|
142
|
+
function getScreenParams(screenId, otherProps = {}) {
|
|
143
|
+
return (0, exports.getDocParams)(exports.DocumentType.SCREEN, screenId, otherProps);
|
|
144
|
+
}
|
|
145
|
+
exports.getScreenParams = getScreenParams;
|
|
134
146
|
/**
|
|
135
147
|
* Generates a new webhook ID.
|
|
136
148
|
* @returns {string} The new webhook ID which the webhook doc can be stored under.
|
|
137
149
|
*/
|
|
138
|
-
|
|
139
|
-
return `${DocumentType.WEBHOOK}${SEPARATOR}${
|
|
140
|
-
}
|
|
150
|
+
function generateWebhookID() {
|
|
151
|
+
return `${exports.DocumentType.WEBHOOK}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
152
|
+
}
|
|
153
|
+
exports.generateWebhookID = generateWebhookID;
|
|
141
154
|
/**
|
|
142
155
|
* Gets parameters for retrieving a webhook, this is a utility function for the getDocParams function.
|
|
143
156
|
*/
|
|
144
|
-
|
|
145
|
-
return getDocParams(DocumentType.WEBHOOK, webhookId, otherProps);
|
|
146
|
-
}
|
|
157
|
+
function getWebhookParams(webhookId, otherProps = {}) {
|
|
158
|
+
return (0, exports.getDocParams)(exports.DocumentType.WEBHOOK, webhookId, otherProps);
|
|
159
|
+
}
|
|
160
|
+
exports.getWebhookParams = getWebhookParams;
|
|
147
161
|
/**
|
|
148
162
|
* Generates a new datasource ID.
|
|
149
163
|
* @returns {string} The new datasource ID which the webhook doc can be stored under.
|
|
150
164
|
*/
|
|
151
|
-
|
|
152
|
-
return `${plus ? DocumentType.DATASOURCE_PLUS : DocumentType.DATASOURCE}${SEPARATOR}${
|
|
153
|
-
}
|
|
165
|
+
function generateDatasourceID({ plus = false } = {}) {
|
|
166
|
+
return `${plus ? exports.DocumentType.DATASOURCE_PLUS : exports.DocumentType.DATASOURCE}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
167
|
+
}
|
|
168
|
+
exports.generateDatasourceID = generateDatasourceID;
|
|
154
169
|
/**
|
|
155
170
|
* Gets parameters for retrieving a datasource, this is a utility function for the getDocParams function.
|
|
156
171
|
*/
|
|
157
|
-
|
|
158
|
-
return getDocParams(DocumentType.DATASOURCE, datasourceId, otherProps);
|
|
159
|
-
}
|
|
172
|
+
function getDatasourceParams(datasourceId, otherProps = {}) {
|
|
173
|
+
return (0, exports.getDocParams)(exports.DocumentType.DATASOURCE, datasourceId, otherProps);
|
|
174
|
+
}
|
|
175
|
+
exports.getDatasourceParams = getDatasourceParams;
|
|
160
176
|
/**
|
|
161
177
|
* Generates a new query ID.
|
|
162
178
|
* @returns {string} The new query ID which the query doc can be stored under.
|
|
163
179
|
*/
|
|
164
|
-
|
|
165
|
-
return `${DocumentType.QUERY}${SEPARATOR}${datasourceId}${SEPARATOR}${
|
|
166
|
-
}
|
|
180
|
+
function generateQueryID(datasourceId) {
|
|
181
|
+
return `${exports.DocumentType.QUERY}${exports.SEPARATOR}${datasourceId}${exports.SEPARATOR}${(0, newid_1.default)()}`;
|
|
182
|
+
}
|
|
183
|
+
exports.generateQueryID = generateQueryID;
|
|
167
184
|
/**
|
|
168
185
|
* Generates a metadata ID for automations, used to track errors in recurring
|
|
169
186
|
* automations etc.
|
|
170
187
|
*/
|
|
171
|
-
|
|
172
|
-
return `${DocumentType.AUTOMATION_METADATA}${SEPARATOR}${automationId}`;
|
|
173
|
-
}
|
|
188
|
+
function generateAutomationMetadataID(automationId) {
|
|
189
|
+
return `${exports.DocumentType.AUTOMATION_METADATA}${exports.SEPARATOR}${automationId}`;
|
|
190
|
+
}
|
|
191
|
+
exports.generateAutomationMetadataID = generateAutomationMetadataID;
|
|
174
192
|
/**
|
|
175
193
|
* Retrieve all automation metadata in an app database.
|
|
176
194
|
*/
|
|
177
|
-
|
|
178
|
-
return getDocParams(DocumentType.AUTOMATION_METADATA, null, otherProps);
|
|
179
|
-
}
|
|
195
|
+
function getAutomationMetadataParams(otherProps = {}) {
|
|
196
|
+
return (0, exports.getDocParams)(exports.DocumentType.AUTOMATION_METADATA, null, otherProps);
|
|
197
|
+
}
|
|
198
|
+
exports.getAutomationMetadataParams = getAutomationMetadataParams;
|
|
180
199
|
/**
|
|
181
200
|
* Gets parameters for retrieving a query, this is a utility function for the getDocParams function.
|
|
182
201
|
*/
|
|
183
|
-
|
|
202
|
+
function getQueryParams(datasourceId, otherProps = {}) {
|
|
184
203
|
if (datasourceId == null) {
|
|
185
|
-
return getDocParams(DocumentType.QUERY, null, otherProps);
|
|
204
|
+
return (0, exports.getDocParams)(exports.DocumentType.QUERY, null, otherProps);
|
|
186
205
|
}
|
|
187
|
-
return getDocParams(DocumentType.QUERY, `${datasourceId}${SEPARATOR}`, otherProps);
|
|
188
|
-
}
|
|
206
|
+
return (0, exports.getDocParams)(exports.DocumentType.QUERY, `${datasourceId}${exports.SEPARATOR}`, otherProps);
|
|
207
|
+
}
|
|
208
|
+
exports.getQueryParams = getQueryParams;
|
|
189
209
|
/**
|
|
190
210
|
* Generates a new flag document ID.
|
|
191
211
|
* @returns {string} The ID of the flag document that was generated.
|
|
192
212
|
*/
|
|
193
|
-
|
|
194
|
-
return `${DocumentType.USER_FLAG}${SEPARATOR}${userId}`;
|
|
195
|
-
}
|
|
196
|
-
exports.
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
|
|
213
|
+
function generateUserFlagID(userId) {
|
|
214
|
+
return `${exports.DocumentType.USER_FLAG}${exports.SEPARATOR}${userId}`;
|
|
215
|
+
}
|
|
216
|
+
exports.generateUserFlagID = generateUserFlagID;
|
|
217
|
+
function generateMetadataID(type, entityId) {
|
|
218
|
+
return `${exports.DocumentType.METADATA}${exports.SEPARATOR}${type}${exports.SEPARATOR}${entityId}`;
|
|
219
|
+
}
|
|
220
|
+
exports.generateMetadataID = generateMetadataID;
|
|
221
|
+
function getMetadataParams(type, entityId, otherProps = {}) {
|
|
222
|
+
let docId = `${type}${exports.SEPARATOR}`;
|
|
201
223
|
if (entityId != null) {
|
|
202
224
|
docId += entityId;
|
|
203
225
|
}
|
|
204
|
-
return getDocParams(DocumentType.METADATA, docId, otherProps);
|
|
205
|
-
}
|
|
206
|
-
exports.
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
exports.
|
|
213
|
-
|
|
214
|
-
|
|
226
|
+
return (0, exports.getDocParams)(exports.DocumentType.METADATA, docId, otherProps);
|
|
227
|
+
}
|
|
228
|
+
exports.getMetadataParams = getMetadataParams;
|
|
229
|
+
function generateMemoryViewID(viewName) {
|
|
230
|
+
return `${exports.DocumentType.MEM_VIEW}${exports.SEPARATOR}${viewName}`;
|
|
231
|
+
}
|
|
232
|
+
exports.generateMemoryViewID = generateMemoryViewID;
|
|
233
|
+
function getMemoryViewParams(otherProps = {}) {
|
|
234
|
+
return (0, exports.getDocParams)(exports.DocumentType.MEM_VIEW, null, otherProps);
|
|
235
|
+
}
|
|
236
|
+
exports.getMemoryViewParams = getMemoryViewParams;
|
|
237
|
+
function generatePluginID(name) {
|
|
238
|
+
return `${exports.DocumentType.PLUGIN}${exports.SEPARATOR}${name}`;
|
|
239
|
+
}
|
|
240
|
+
exports.generatePluginID = generatePluginID;
|
|
215
241
|
/**
|
|
216
242
|
* This can be used with the db.allDocs to get a list of IDs
|
|
217
243
|
*/
|
|
218
|
-
|
|
244
|
+
function getMultiIDParams(ids) {
|
|
219
245
|
return {
|
|
220
246
|
keys: ids,
|
|
221
247
|
include_docs: true,
|
|
222
248
|
};
|
|
223
|
-
}
|
|
249
|
+
}
|
|
250
|
+
exports.getMultiIDParams = getMultiIDParams;
|
|
@@ -18,9 +18,7 @@ const utils_1 = require("./utils");
|
|
|
18
18
|
const constants_1 = require("../constants");
|
|
19
19
|
const google_spreadsheet_1 = require("google-spreadsheet");
|
|
20
20
|
const environment_1 = __importDefault(require("../environment"));
|
|
21
|
-
const
|
|
22
|
-
const { getScopedConfig } = require("@budibase/backend-core/db");
|
|
23
|
-
const { Configs } = require("@budibase/backend-core/constants");
|
|
21
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
24
22
|
const fetch = require("node-fetch");
|
|
25
23
|
const SCHEMA = {
|
|
26
24
|
plus: true,
|
|
@@ -140,9 +138,9 @@ class GoogleSheetsIntegration {
|
|
|
140
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
139
|
try {
|
|
142
140
|
// Initialise oAuth client
|
|
143
|
-
const db = getGlobalDB();
|
|
144
|
-
let googleConfig = yield getScopedConfig(db, {
|
|
145
|
-
type:
|
|
141
|
+
const db = backend_core_1.tenancy.getGlobalDB();
|
|
142
|
+
let googleConfig = yield backend_core_1.db.getScopedConfig(db, {
|
|
143
|
+
type: backend_core_1.constants.Config.GOOGLE,
|
|
146
144
|
});
|
|
147
145
|
if (!googleConfig) {
|
|
148
146
|
googleConfig = {
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.AppType =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.middleware = exports.AppType = void 0;
|
|
4
|
+
const utils_1 = require("../db/utils");
|
|
5
|
+
var AppType;
|
|
6
|
+
(function (AppType) {
|
|
7
|
+
AppType["DEV"] = "dev";
|
|
8
|
+
AppType["PROD"] = "prod";
|
|
9
|
+
})(AppType = exports.AppType || (exports.AppType = {}));
|
|
10
|
+
function middleware({ appType } = {}) {
|
|
11
|
+
return (ctx, next) => {
|
|
9
12
|
const appId = ctx.appId;
|
|
10
|
-
if (appType ===
|
|
13
|
+
if (appType === AppType.DEV && appId && !(0, utils_1.isDevAppID)(appId)) {
|
|
11
14
|
ctx.throw(400, "Only apps in development support this endpoint");
|
|
12
15
|
}
|
|
13
|
-
if (appType ===
|
|
16
|
+
if (appType === AppType.PROD && appId && !(0, utils_1.isProdAppID)(appId)) {
|
|
14
17
|
ctx.throw(400, "Only apps in production support this endpoint");
|
|
15
18
|
}
|
|
16
19
|
return next();
|
|
17
20
|
};
|
|
21
|
+
}
|
|
22
|
+
exports.middleware = middleware;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const roles_1 = require("@budibase/backend-core/roles");
|
|
12
|
-
const {
|
|
12
|
+
const { PermissionType, PermissionLevel, doesHaveBasePermission, } = require("@budibase/backend-core/permissions");
|
|
13
13
|
const builderMiddleware = require("./builder");
|
|
14
14
|
const { isWebhookEndpoint } = require("./utils");
|
|
15
15
|
const { buildCsrfMiddleware } = require("@budibase/backend-core/auth");
|
|
@@ -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 ===
|
|
30
|
+
const isBuilderApi = permType === PermissionType.BUILDER;
|
|
31
31
|
if (isBuilderApi && !isBuilder) {
|
|
32
32
|
return ctx.throw(403, "Not Authorized");
|
|
33
33
|
}
|
|
@@ -71,9 +71,9 @@ module.exports = (permType, permLevel = null, opts = { schema: false }) => (ctx,
|
|
|
71
71
|
// get the resource roles
|
|
72
72
|
let resourceRoles = [];
|
|
73
73
|
let otherLevelRoles = [];
|
|
74
|
-
const otherLevel = permLevel ===
|
|
75
|
-
?
|
|
76
|
-
:
|
|
74
|
+
const otherLevel = permLevel === PermissionLevel.READ
|
|
75
|
+
? PermissionLevel.WRITE
|
|
76
|
+
: PermissionLevel.READ;
|
|
77
77
|
const appId = getAppId();
|
|
78
78
|
if (appId && hasResource(ctx)) {
|
|
79
79
|
resourceRoles = yield (0, roles_1.getRequiredResourceRole)(permLevel, ctx);
|
|
@@ -8,12 +8,9 @@ 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
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const { DocumentType, getGlobalIDFromUserMetadataID } = require("../db/utils");
|
|
15
|
-
const { PermissionTypes } = require("@budibase/backend-core/permissions");
|
|
16
|
-
const { app: appCache } = require("@budibase/backend-core/cache");
|
|
11
|
+
const utils_1 = require("../db/utils");
|
|
12
|
+
const redis_1 = require("../utilities/redis");
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
17
14
|
const DEBOUNCE_TIME_SEC = 30;
|
|
18
15
|
/************************************************** *
|
|
19
16
|
* This middleware has been broken out of the *
|
|
@@ -24,21 +21,22 @@ const DEBOUNCE_TIME_SEC = 30;
|
|
|
24
21
|
* through the authorized middleware *
|
|
25
22
|
****************************************************/
|
|
26
23
|
function checkDevAppLocks(ctx) {
|
|
24
|
+
var _a, _b;
|
|
27
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
26
|
const appId = ctx.appId;
|
|
29
27
|
// if any public usage, don't proceed
|
|
30
|
-
if (!ctx.user._id && !ctx.user.userId) {
|
|
28
|
+
if (!((_a = ctx.user) === null || _a === void 0 ? void 0 : _a._id) && !((_b = ctx.user) === null || _b === void 0 ? void 0 : _b.userId)) {
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
31
|
// not a development app, don't need to do anything
|
|
34
|
-
if (!appId || !appId.startsWith(APP_DEV_PREFIX)) {
|
|
32
|
+
if (!appId || !appId.startsWith(utils_1.APP_DEV_PREFIX)) {
|
|
35
33
|
return;
|
|
36
34
|
}
|
|
37
|
-
if (!(yield doesUserHaveLock(appId, ctx.user))) {
|
|
35
|
+
if (!(yield (0, redis_1.doesUserHaveLock)(appId, ctx.user))) {
|
|
38
36
|
ctx.throw(400, "User does not hold app lock.");
|
|
39
37
|
}
|
|
40
38
|
// they do have lock, update it
|
|
41
|
-
yield updateLock(appId, ctx.user);
|
|
39
|
+
yield (0, redis_1.updateLock)(appId, ctx.user);
|
|
42
40
|
});
|
|
43
41
|
}
|
|
44
42
|
function updateAppUpdatedAt(ctx) {
|
|
@@ -46,42 +44,45 @@ function updateAppUpdatedAt(ctx) {
|
|
|
46
44
|
const appId = ctx.appId;
|
|
47
45
|
// if debouncing skip this update
|
|
48
46
|
// get methods also aren't updating
|
|
49
|
-
if (ctx.method === "GET" || (yield checkDebounce(appId))) {
|
|
47
|
+
if (ctx.method === "GET" || (yield (0, redis_1.checkDebounce)(appId))) {
|
|
50
48
|
return;
|
|
51
49
|
}
|
|
52
|
-
yield doWithDB(appId, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
|
|
50
|
+
yield backend_core_1.db.doWithDB(appId, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
var _a;
|
|
52
|
+
const metadata = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
54
53
|
metadata.updatedAt = new Date().toISOString();
|
|
55
|
-
metadata.updatedBy = getGlobalIDFromUserMetadataID(ctx.user.userId);
|
|
54
|
+
metadata.updatedBy = (0, utils_1.getGlobalIDFromUserMetadataID)((_a = ctx.user) === null || _a === void 0 ? void 0 : _a.userId);
|
|
56
55
|
const response = yield db.put(metadata);
|
|
57
56
|
metadata._rev = response.rev;
|
|
58
|
-
yield
|
|
57
|
+
yield backend_core_1.cache.app.invalidateAppMetadata(appId, metadata);
|
|
59
58
|
// set a new debounce record with a short TTL
|
|
60
|
-
yield setDebounce(appId, DEBOUNCE_TIME_SEC);
|
|
59
|
+
yield (0, redis_1.setDebounce)(appId, DEBOUNCE_TIME_SEC);
|
|
61
60
|
}));
|
|
62
61
|
});
|
|
63
62
|
}
|
|
64
|
-
module.exports = (ctx, permType)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
63
|
+
module.exports = function builder(ctx, permType) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const appId = ctx.appId;
|
|
66
|
+
// this only functions within an app context
|
|
67
|
+
if (!appId) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const isBuilderApi = permType === backend_core_1.permissions.PermissionType.BUILDER;
|
|
71
|
+
const referer = ctx.headers["referer"];
|
|
72
|
+
const overviewPath = "/builder/portal/overview/";
|
|
73
|
+
const overviewContext = !referer ? false : referer.includes(overviewPath);
|
|
74
|
+
if (overviewContext) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const hasAppId = !referer ? false : referer.includes(appId);
|
|
78
|
+
const editingApp = referer ? hasAppId : false;
|
|
79
|
+
// check this is a builder call and editing
|
|
80
|
+
if (!isBuilderApi || !editingApp) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// check locks
|
|
84
|
+
yield checkDevAppLocks(ctx);
|
|
85
|
+
// set updated at time on app
|
|
86
|
+
yield updateAppUpdatedAt(ctx);
|
|
87
|
+
});
|
|
88
|
+
};
|