@budibase/server 2.1.43-alpha.8 → 2.1.43-alpha.9
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.29f946a8.js → index.1c5913ba.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +542 -514
- package/coverage/coverage-final.json +20 -15
- package/coverage/lcov-report/index.html +64 -34
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/application.ts.html +86 -233
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +5 -2
- package/coverage/lcov-report/src/api/controllers/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
- 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 +28 -28
- package/coverage/lcov-report/src/api/controllers/integration.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/layout.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/metadata.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/permission.ts.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 +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 +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 +1 -1
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/role.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/routing.ts.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.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/script.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/user.ts.html +13 -184
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/apikeys.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/dev.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/layout.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/metadata.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/permission.ts.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 +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.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/role.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/routing.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/row.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/table.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/templates.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/user.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/view.ts.html +1 -1
- 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.ts.html +1 -1
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +1 -1
- package/coverage/lcov-report/src/automations/bullboard.ts.html +1 -1
- package/coverage/lcov-report/src/automations/index.html +1 -1
- package/coverage/lcov-report/src/automations/index.ts.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.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/delay.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/discord.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/loop.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/slack.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/utils.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggers.ts.html +1 -1
- package/coverage/lcov-report/src/automations/utils.ts.html +1 -1
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +1 -1
- package/coverage/lcov-report/src/constants/layouts.ts.html +1 -1
- package/coverage/lcov-report/src/constants/screens.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +1 -1
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +1 -1
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +1 -1
- package/coverage/lcov-report/src/db/newid.ts.html +1 -1
- package/coverage/lcov-report/src/db/utils.ts.html +1 -1
- 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.ts.html +1 -1
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +1 -1
- package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +1 -1
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.ts.html +1 -1
- package/coverage/lcov-report/src/events/utils.ts.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 +1 -1
- package/coverage/lcov-report/src/integrations/index.html +1 -1
- 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.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/authorized.ts.html +1 -1
- 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 +1 -1
- 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 +8 -29
- 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 +11 -11
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/tableSettings.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/sdk/app/applications/index.html +146 -0
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +106 -0
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +244 -0
- package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +136 -0
- package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +6 -6
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +17 -17
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +17 -17
- package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +7 -7
- package/coverage/lcov-report/src/sdk/app/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/index.html +5 -5
- package/coverage/lcov-report/src/sdk/index.ts.html +15 -12
- package/coverage/lcov-report/src/sdk/users/index.html +131 -0
- package/coverage/lcov-report/src/sdk/users/index.ts.html +100 -0
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +277 -0
- package/coverage/lcov-report/src/startup.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +1 -1
- package/coverage/lcov-report/src/threads/automation.ts.html +1 -1
- 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.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/csvParser.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/global.ts.html +34 -34
- package/coverage/lcov-report/src/utilities/index.html +1 -1
- package/coverage/lcov-report/src/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/plugins.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/redis.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/security.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/statusCodes.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +15 -15
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +13 -13
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +1 -1
- package/coverage/lcov-report/src/watch.ts.html +1 -1
- package/coverage/lcov-report/src/websocket.ts.html +1 -1
- package/coverage/lcov.info +886 -842
- package/dist/api/controllers/application.js +419 -438
- package/dist/api/controllers/cloud.js +1 -0
- package/dist/api/controllers/user.js +7 -48
- package/dist/migrations/functions/appUrls.js +5 -9
- package/dist/package.json +6 -6
- package/dist/sdk/app/applications/index.js +28 -0
- package/dist/sdk/app/applications/sync.js +66 -0
- package/dist/sdk/app/applications/utils.js +21 -0
- package/dist/sdk/index.js +4 -2
- package/dist/sdk/users/index.js +27 -0
- package/dist/sdk/users/utils.js +65 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/api/controllers/application.ts +55 -104
- package/src/api/controllers/cloud.ts +1 -0
- package/src/api/controllers/user.ts +4 -61
- package/src/api/routes/tests/application.spec.js +0 -1
- package/src/migrations/functions/appUrls.ts +2 -9
- package/src/sdk/app/applications/index.ts +7 -0
- package/src/sdk/app/applications/sync.ts +53 -0
- package/src/sdk/app/applications/utils.ts +17 -0
- package/src/sdk/index.ts +4 -3
- package/src/sdk/users/index.ts +5 -0
- package/src/sdk/users/utils.ts +64 -0
|
@@ -12,7 +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.updateAppPackage = exports.sync = exports.destroy = exports.revertClient = exports.updateClient = exports.update = exports.create = exports.fetchAppPackage = exports.fetchAppDefinition = exports.fetch =
|
|
15
|
+
exports.updateAppPackage = exports.sync = exports.destroy = exports.revertClient = exports.updateClient = exports.update = exports.create = exports.fetchAppPackage = exports.fetchAppDefinition = exports.fetch = void 0;
|
|
16
16
|
const environment_1 = __importDefault(require("../../environment"));
|
|
17
17
|
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
18
18
|
const staticViews_1 = require("../../db/views/staticViews");
|
|
@@ -25,7 +25,6 @@ const workerRequests_1 = require("../../utilities/workerRequests");
|
|
|
25
25
|
const utilities_1 = require("../../utilities");
|
|
26
26
|
const redis_1 = require("../../utilities/redis");
|
|
27
27
|
const clientLibrary_1 = require("../../utilities/fileSystem/clientLibrary");
|
|
28
|
-
const user_1 = require("./user");
|
|
29
28
|
const utils_2 = require("../../automations/utils");
|
|
30
29
|
const logging_1 = require("../../automations/logging");
|
|
31
30
|
const rows_1 = require("../../utilities/usageQuota/rows");
|
|
@@ -34,7 +33,6 @@ const types_1 = require("@budibase/types");
|
|
|
34
33
|
const layouts_1 = require("../../constants/layouts");
|
|
35
34
|
const plugins_1 = require("../../utilities/plugins");
|
|
36
35
|
const sdk_1 = __importDefault(require("../../sdk"));
|
|
37
|
-
const URL_REGEX_SLASH = /\/|\\/g;
|
|
38
36
|
// utility function, need to do away with this
|
|
39
37
|
function getLayouts() {
|
|
40
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -53,36 +51,20 @@ function getScreens() {
|
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
function getUserRoleId(ctx) {
|
|
56
|
-
|
|
54
|
+
var _a;
|
|
55
|
+
return !((_a = ctx.user) === null || _a === void 0 ? void 0 : _a.role) || !ctx.user.role._id
|
|
57
56
|
? backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC
|
|
58
57
|
: ctx.user.role._id;
|
|
59
58
|
}
|
|
60
|
-
|
|
61
|
-
// construct the url
|
|
62
|
-
let url;
|
|
63
|
-
if (ctx.request.body.url) {
|
|
64
|
-
// if the url is provided, use that
|
|
65
|
-
url = encodeURI(ctx.request.body.url);
|
|
66
|
-
}
|
|
67
|
-
else if (ctx.request.body.name) {
|
|
68
|
-
// otherwise use the name
|
|
69
|
-
url = encodeURI(`${ctx.request.body.name}`);
|
|
70
|
-
}
|
|
71
|
-
if (url) {
|
|
72
|
-
url = `/${url.replace(URL_REGEX_SLASH, "")}`.toLowerCase();
|
|
73
|
-
}
|
|
74
|
-
return url;
|
|
75
|
-
};
|
|
76
|
-
exports.getAppUrl = getAppUrl;
|
|
77
|
-
const checkAppUrl = (ctx, apps, url, currentAppId) => {
|
|
59
|
+
function checkAppUrl(ctx, apps, url, currentAppId) {
|
|
78
60
|
if (currentAppId) {
|
|
79
61
|
apps = apps.filter((app) => app.appId !== currentAppId);
|
|
80
62
|
}
|
|
81
63
|
if (apps.some((app) => app.url === url)) {
|
|
82
64
|
ctx.throw(400, "App URL is already in use.");
|
|
83
65
|
}
|
|
84
|
-
}
|
|
85
|
-
|
|
66
|
+
}
|
|
67
|
+
function checkAppName(ctx, apps, name, currentAppId) {
|
|
86
68
|
// TODO: Replace with Joi
|
|
87
69
|
if (!name) {
|
|
88
70
|
ctx.throw(400, "Name is required");
|
|
@@ -93,7 +75,7 @@ const checkAppName = (ctx, apps, name, currentAppId) => {
|
|
|
93
75
|
if (apps.some((app) => app.name === name)) {
|
|
94
76
|
ctx.throw(400, "App name is already in use.");
|
|
95
77
|
}
|
|
96
|
-
}
|
|
78
|
+
}
|
|
97
79
|
function createInstance(template, includeSampleData) {
|
|
98
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
81
|
const tenantId = backend_core_1.tenancy.isMultiTenant() ? backend_core_1.tenancy.getTenantId() : null;
|
|
@@ -134,446 +116,445 @@ function createInstance(template, includeSampleData) {
|
|
|
134
116
|
return { _id: appId };
|
|
135
117
|
});
|
|
136
118
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
.
|
|
148
|
-
.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
for
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
119
|
+
function addDefaultTables(db) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const defaultDbDocs = (0, datasource_bb_default_1.buildDefaultDocs)();
|
|
122
|
+
// add in the default db data docs - tables, datasource, rows and links
|
|
123
|
+
yield db.bulkDocs([...defaultDbDocs]);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function fetch(ctx) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
const dev = ctx.query && ctx.query.status === utils_1.AppStatus.DEV;
|
|
129
|
+
const all = ctx.query && ctx.query.status === utils_1.AppStatus.ALL;
|
|
130
|
+
const apps = (yield backend_core_1.db.getAllApps({ dev, all }));
|
|
131
|
+
const appIds = apps
|
|
132
|
+
.filter((app) => app.status === "development")
|
|
133
|
+
.map((app) => app.appId);
|
|
134
|
+
// get the locks for all the dev apps
|
|
135
|
+
if (dev || all) {
|
|
136
|
+
const locks = yield (0, redis_1.getLocksById)(appIds);
|
|
137
|
+
for (let app of apps) {
|
|
138
|
+
const lock = locks[app.appId];
|
|
139
|
+
if (lock) {
|
|
140
|
+
app.lockedBy = lock;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// make sure its definitely not present
|
|
144
|
+
delete app.lockedBy;
|
|
145
|
+
}
|
|
160
146
|
}
|
|
161
147
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
148
|
+
ctx.body = yield (0, logging_1.checkAppMetadata)(apps);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
165
151
|
exports.fetch = fetch;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const accessController = new backend_core_1.roles.AccessController();
|
|
170
|
-
const screens = yield accessController.checkScreensAccess(yield getScreens(), userRoleId);
|
|
171
|
-
ctx.body = {
|
|
172
|
-
layouts,
|
|
173
|
-
screens,
|
|
174
|
-
libraries: ["@budibase/standard-components"],
|
|
175
|
-
};
|
|
176
|
-
});
|
|
177
|
-
exports.fetchAppDefinition = fetchAppDefinition;
|
|
178
|
-
const fetchAppPackage = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
|
-
const db = backend_core_1.context.getAppDB();
|
|
180
|
-
let application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
181
|
-
const layouts = yield getLayouts();
|
|
182
|
-
let screens = yield getScreens();
|
|
183
|
-
// Enrich plugin URLs
|
|
184
|
-
application.usedPlugins = (0, plugins_1.enrichPluginURLs)(application.usedPlugins);
|
|
185
|
-
// Only filter screens if the user is not a builder
|
|
186
|
-
if (!(ctx.user.builder && ctx.user.builder.global)) {
|
|
152
|
+
function fetchAppDefinition(ctx) {
|
|
153
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
+
const layouts = yield getLayouts();
|
|
187
155
|
const userRoleId = getUserRoleId(ctx);
|
|
188
156
|
const accessController = new backend_core_1.roles.AccessController();
|
|
189
|
-
screens = yield accessController.checkScreensAccess(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
157
|
+
const screens = yield accessController.checkScreensAccess(yield getScreens(), userRoleId);
|
|
158
|
+
ctx.body = {
|
|
159
|
+
layouts,
|
|
160
|
+
screens,
|
|
161
|
+
libraries: ["@budibase/standard-components"],
|
|
162
|
+
};
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
exports.fetchAppDefinition = fetchAppDefinition;
|
|
166
|
+
function fetchAppPackage(ctx) {
|
|
167
|
+
var _a;
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
const db = backend_core_1.context.getAppDB();
|
|
170
|
+
let application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
171
|
+
const layouts = yield getLayouts();
|
|
172
|
+
let screens = yield getScreens();
|
|
173
|
+
// Enrich plugin URLs
|
|
174
|
+
application.usedPlugins = (0, plugins_1.enrichPluginURLs)(application.usedPlugins);
|
|
175
|
+
// Only filter screens if the user is not a builder
|
|
176
|
+
if (!(((_a = ctx.user) === null || _a === void 0 ? void 0 : _a.builder) && ctx.user.builder.global)) {
|
|
177
|
+
const userRoleId = getUserRoleId(ctx);
|
|
178
|
+
const accessController = new backend_core_1.roles.AccessController();
|
|
179
|
+
screens = yield accessController.checkScreensAccess(screens, userRoleId);
|
|
180
|
+
}
|
|
181
|
+
ctx.body = {
|
|
182
|
+
application,
|
|
183
|
+
screens,
|
|
184
|
+
layouts,
|
|
185
|
+
clientLibPath: (0, utilities_1.clientLibraryPath)(ctx.params.appId, application.version),
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
}
|
|
198
189
|
exports.fetchAppPackage = fetchAppPackage;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
const includeSampleData = (0, utilities_1.isQsTrue)(ctx.request.body.sampleData);
|
|
215
|
-
const instance = yield createInstance(instanceConfig, includeSampleData);
|
|
216
|
-
const appId = instance._id;
|
|
217
|
-
const db = backend_core_1.context.getAppDB();
|
|
218
|
-
let newApplication = {
|
|
219
|
-
_id: utils_1.DocumentType.APP_METADATA,
|
|
220
|
-
_rev: undefined,
|
|
221
|
-
appId,
|
|
222
|
-
type: "app",
|
|
223
|
-
version: package_json_1.default.version,
|
|
224
|
-
componentLibraries: ["@budibase/standard-components"],
|
|
225
|
-
name: name,
|
|
226
|
-
url: url,
|
|
227
|
-
template: templateKey,
|
|
228
|
-
instance,
|
|
229
|
-
tenantId: backend_core_1.tenancy.getTenantId(),
|
|
230
|
-
updatedAt: new Date().toISOString(),
|
|
231
|
-
createdAt: new Date().toISOString(),
|
|
232
|
-
status: utils_1.AppStatus.DEV,
|
|
233
|
-
navigation: {
|
|
234
|
-
navigation: "Top",
|
|
235
|
-
title: name,
|
|
236
|
-
navWidth: "Large",
|
|
237
|
-
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
238
|
-
links: [
|
|
239
|
-
{
|
|
240
|
-
url: "/home",
|
|
241
|
-
text: "Home",
|
|
242
|
-
},
|
|
243
|
-
],
|
|
244
|
-
},
|
|
245
|
-
theme: "spectrum--light",
|
|
246
|
-
customTheme: {
|
|
247
|
-
buttonBorderRadius: "16px",
|
|
248
|
-
},
|
|
249
|
-
};
|
|
250
|
-
// If we used a template or imported an app there will be an existing doc.
|
|
251
|
-
// Fetch and migrate some metadata from the existing app.
|
|
252
|
-
try {
|
|
253
|
-
const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
254
|
-
const keys = [
|
|
255
|
-
"_rev",
|
|
256
|
-
"navigation",
|
|
257
|
-
"theme",
|
|
258
|
-
"customTheme",
|
|
259
|
-
"icon",
|
|
260
|
-
];
|
|
261
|
-
keys.forEach(key => {
|
|
262
|
-
if (existing[key]) {
|
|
263
|
-
// @ts-ignore
|
|
264
|
-
newApplication[key] = existing[key];
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
// Migrate navigation settings and screens if required
|
|
268
|
-
if (existing) {
|
|
269
|
-
const navigation = yield migrateAppNavigation();
|
|
270
|
-
if (navigation) {
|
|
271
|
-
newApplication.navigation = navigation;
|
|
272
|
-
}
|
|
190
|
+
function performAppCreate(ctx) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
const apps = (yield backend_core_1.db.getAllApps({ dev: true }));
|
|
193
|
+
const name = ctx.request.body.name, possibleUrl = ctx.request.body.url;
|
|
194
|
+
checkAppName(ctx, apps, name);
|
|
195
|
+
const url = sdk_1.default.applications.getAppUrl({ name, url: possibleUrl });
|
|
196
|
+
checkAppUrl(ctx, apps, url);
|
|
197
|
+
const { useTemplate, templateKey, templateString } = ctx.request.body;
|
|
198
|
+
const instanceConfig = {
|
|
199
|
+
useTemplate,
|
|
200
|
+
key: templateKey,
|
|
201
|
+
templateString,
|
|
202
|
+
};
|
|
203
|
+
if (ctx.request.files && ctx.request.files.templateFile) {
|
|
204
|
+
instanceConfig.file = ctx.request.files.templateFile;
|
|
273
205
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
206
|
+
const includeSampleData = (0, utilities_1.isQsTrue)(ctx.request.body.sampleData);
|
|
207
|
+
const instance = yield createInstance(instanceConfig, includeSampleData);
|
|
208
|
+
const appId = instance._id;
|
|
209
|
+
const db = backend_core_1.context.getAppDB();
|
|
210
|
+
let newApplication = {
|
|
211
|
+
_id: utils_1.DocumentType.APP_METADATA,
|
|
212
|
+
_rev: undefined,
|
|
213
|
+
appId,
|
|
214
|
+
type: "app",
|
|
215
|
+
version: package_json_1.default.version,
|
|
216
|
+
componentLibraries: ["@budibase/standard-components"],
|
|
217
|
+
name: name,
|
|
218
|
+
url: url,
|
|
219
|
+
template: templateKey,
|
|
220
|
+
instance,
|
|
221
|
+
tenantId: backend_core_1.tenancy.getTenantId(),
|
|
222
|
+
updatedAt: new Date().toISOString(),
|
|
223
|
+
createdAt: new Date().toISOString(),
|
|
224
|
+
status: utils_1.AppStatus.DEV,
|
|
225
|
+
navigation: {
|
|
226
|
+
navigation: "Top",
|
|
227
|
+
title: name,
|
|
228
|
+
navWidth: "Large",
|
|
229
|
+
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
230
|
+
links: [
|
|
231
|
+
{
|
|
232
|
+
url: "/home",
|
|
233
|
+
text: "Home",
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
theme: "spectrum--light",
|
|
238
|
+
customTheme: {
|
|
239
|
+
buttonBorderRadius: "16px",
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
// If we used a template or imported an app there will be an existing doc.
|
|
243
|
+
// Fetch and migrate some metadata from the existing app.
|
|
244
|
+
try {
|
|
245
|
+
const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
246
|
+
const keys = [
|
|
247
|
+
"_rev",
|
|
248
|
+
"navigation",
|
|
249
|
+
"theme",
|
|
250
|
+
"customTheme",
|
|
251
|
+
"icon",
|
|
252
|
+
];
|
|
253
|
+
keys.forEach(key => {
|
|
254
|
+
if (existing[key]) {
|
|
255
|
+
// @ts-ignore
|
|
256
|
+
newApplication[key] = existing[key];
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
// Migrate navigation settings and screens if required
|
|
260
|
+
if (existing) {
|
|
261
|
+
const navigation = yield migrateAppNavigation();
|
|
262
|
+
if (navigation) {
|
|
263
|
+
newApplication.navigation = navigation;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
295
266
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
creationFns.push(a => backend_core_1.events.app.fileImported(a));
|
|
267
|
+
catch (err) {
|
|
268
|
+
// Nothing to do
|
|
299
269
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
270
|
+
const response = yield db.put(newApplication, { force: true });
|
|
271
|
+
newApplication._rev = response.rev;
|
|
272
|
+
/* istanbul ignore next */
|
|
273
|
+
if (!environment_1.default.isTest()) {
|
|
274
|
+
yield (0, fileSystem_1.createApp)(appId);
|
|
303
275
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
for (let fn of creationFns) {
|
|
307
|
-
yield fn(app);
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
const appPostCreate = (ctx, app) => __awaiter(void 0, void 0, void 0, function* () {
|
|
311
|
-
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
312
|
-
yield backend_core_1.migrations.backPopulateMigrations({
|
|
313
|
-
type: types_1.MigrationType.APP,
|
|
314
|
-
tenantId,
|
|
315
|
-
appId: app.appId,
|
|
276
|
+
yield backend_core_1.cache.app.invalidateAppMetadata(appId, newApplication);
|
|
277
|
+
return newApplication;
|
|
316
278
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
279
|
+
}
|
|
280
|
+
function creationEvents(request, app) {
|
|
281
|
+
var _a;
|
|
282
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
+
let creationFns = [];
|
|
284
|
+
const body = request.body;
|
|
285
|
+
if (body.useTemplate === "true") {
|
|
286
|
+
// from template
|
|
287
|
+
if (body.templateKey && body.templateKey !== "undefined") {
|
|
288
|
+
creationFns.push(a => backend_core_1.events.app.templateImported(a, body.templateKey));
|
|
289
|
+
}
|
|
290
|
+
// from file
|
|
291
|
+
else if ((_a = request.files) === null || _a === void 0 ? void 0 : _a.templateFile) {
|
|
292
|
+
creationFns.push(a => backend_core_1.events.app.fileImported(a));
|
|
327
293
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
294
|
+
// unknown
|
|
295
|
+
else {
|
|
296
|
+
console.error("Could not determine template creation event");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
creationFns.push(a => backend_core_1.events.app.created(a));
|
|
300
|
+
for (let fn of creationFns) {
|
|
301
|
+
yield fn(app);
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
function appPostCreate(ctx, app) {
|
|
306
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
307
|
+
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
308
|
+
yield backend_core_1.migrations.backPopulateMigrations({
|
|
309
|
+
type: types_1.MigrationType.APP,
|
|
310
|
+
tenantId,
|
|
311
|
+
appId: app.appId,
|
|
312
|
+
});
|
|
313
|
+
yield creationEvents(ctx.request, app);
|
|
314
|
+
// app import & template creation
|
|
315
|
+
if (ctx.request.body.useTemplate === "true") {
|
|
316
|
+
const { rows } = yield (0, rows_1.getUniqueRows)([app.appId]);
|
|
317
|
+
const rowCount = rows ? rows.length : 0;
|
|
318
|
+
if (rowCount) {
|
|
319
|
+
try {
|
|
320
|
+
yield backend_core_1.context.doInAppContext(app.appId, () => {
|
|
321
|
+
return pro_1.quotas.addRows(rowCount);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
catch (err) {
|
|
325
|
+
if (err.code && err.code === backend_core_1.errors.codes.USAGE_LIMIT_EXCEEDED) {
|
|
326
|
+
// this import resulted in row usage exceeding the quota
|
|
327
|
+
// delete the app
|
|
328
|
+
// skip pre- and post-steps as no rows have been added to quotas yet
|
|
329
|
+
ctx.params.appId = app.appId;
|
|
330
|
+
yield destroyApp(ctx);
|
|
331
|
+
}
|
|
332
|
+
throw err;
|
|
335
333
|
}
|
|
336
|
-
throw err;
|
|
337
334
|
}
|
|
338
335
|
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function create(ctx) {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
340
|
+
const newApplication = yield pro_1.quotas.addApp(() => performAppCreate(ctx));
|
|
341
|
+
yield appPostCreate(ctx, newApplication);
|
|
342
|
+
yield backend_core_1.cache.bustCache(backend_core_1.cache.CacheKey.CHECKLIST);
|
|
343
|
+
ctx.body = newApplication;
|
|
344
|
+
ctx.status = 200;
|
|
345
|
+
});
|
|
346
|
+
}
|
|
348
347
|
exports.create = create;
|
|
349
348
|
// This endpoint currently operates as a PATCH rather than a PUT
|
|
350
349
|
// Thus name and url fields are handled only if present
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
ctx.body = app;
|
|
367
|
-
});
|
|
368
|
-
exports.update = update;
|
|
369
|
-
const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
370
|
-
// Get current app version
|
|
371
|
-
const db = backend_core_1.context.getAppDB();
|
|
372
|
-
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
373
|
-
const currentVersion = application.version;
|
|
374
|
-
// Update client library and manifest
|
|
375
|
-
if (!environment_1.default.isTest()) {
|
|
376
|
-
yield (0, clientLibrary_1.backupClientLibrary)(ctx.params.appId);
|
|
377
|
-
yield (0, clientLibrary_1.updateClientLibrary)(ctx.params.appId);
|
|
378
|
-
}
|
|
379
|
-
// Update versions in app package
|
|
380
|
-
const updatedToVersion = package_json_1.default.version;
|
|
381
|
-
const appPackageUpdates = {
|
|
382
|
-
version: updatedToVersion,
|
|
383
|
-
revertableVersion: currentVersion,
|
|
384
|
-
};
|
|
385
|
-
const app = yield (0, exports.updateAppPackage)(appPackageUpdates, ctx.params.appId);
|
|
386
|
-
yield backend_core_1.events.app.versionUpdated(app, currentVersion, updatedToVersion);
|
|
387
|
-
ctx.status = 200;
|
|
388
|
-
ctx.body = app;
|
|
389
|
-
});
|
|
390
|
-
exports.updateClient = updateClient;
|
|
391
|
-
const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
392
|
-
// Check app can be reverted
|
|
393
|
-
const db = backend_core_1.context.getAppDB();
|
|
394
|
-
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
395
|
-
if (!application.revertableVersion) {
|
|
396
|
-
ctx.throw(400, "There is no version to revert to");
|
|
397
|
-
}
|
|
398
|
-
// Update client library and manifest
|
|
399
|
-
if (!environment_1.default.isTest()) {
|
|
400
|
-
yield (0, clientLibrary_1.revertClientLibrary)(ctx.params.appId);
|
|
401
|
-
}
|
|
402
|
-
// Update versions in app package
|
|
403
|
-
const currentVersion = application.version;
|
|
404
|
-
const revertedToVersion = application.revertableVersion;
|
|
405
|
-
const appPackageUpdates = {
|
|
406
|
-
version: revertedToVersion,
|
|
407
|
-
revertableVersion: null,
|
|
408
|
-
};
|
|
409
|
-
const app = yield (0, exports.updateAppPackage)(appPackageUpdates, ctx.params.appId);
|
|
410
|
-
yield backend_core_1.events.app.versionReverted(app, currentVersion, revertedToVersion);
|
|
411
|
-
ctx.status = 200;
|
|
412
|
-
ctx.body = app;
|
|
413
|
-
});
|
|
414
|
-
exports.revertClient = revertClient;
|
|
415
|
-
const destroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
416
|
-
let appId = ctx.params.appId;
|
|
417
|
-
let isUnpublish = ctx.query && ctx.query.unpublish;
|
|
418
|
-
if (isUnpublish) {
|
|
419
|
-
appId = backend_core_1.db.getProdAppID(appId);
|
|
420
|
-
}
|
|
421
|
-
const db = isUnpublish ? backend_core_1.context.getProdAppDB() : backend_core_1.context.getAppDB();
|
|
422
|
-
const app = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
423
|
-
const result = yield db.destroy();
|
|
424
|
-
if (isUnpublish) {
|
|
425
|
-
yield backend_core_1.events.app.unpublished(app);
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
yield pro_1.quotas.removeApp();
|
|
429
|
-
yield backend_core_1.events.app.deleted(app);
|
|
430
|
-
}
|
|
431
|
-
/* istanbul ignore next */
|
|
432
|
-
if (!environment_1.default.isTest() && !isUnpublish) {
|
|
433
|
-
yield (0, fileSystem_1.deleteApp)(appId);
|
|
434
|
-
}
|
|
435
|
-
// automations only in production
|
|
436
|
-
if (isUnpublish) {
|
|
437
|
-
yield (0, utils_2.cleanupAutomations)(appId);
|
|
438
|
-
}
|
|
439
|
-
// remove app role when the dev app is deleted (no trace of app anymore)
|
|
440
|
-
else {
|
|
441
|
-
yield (0, workerRequests_1.removeAppFromUserRoles)(ctx, appId);
|
|
442
|
-
}
|
|
443
|
-
yield backend_core_1.cache.app.invalidateAppMetadata(appId);
|
|
444
|
-
return result;
|
|
445
|
-
});
|
|
446
|
-
const preDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
447
|
-
const { rows } = yield (0, rows_1.getUniqueRows)([ctx.params.appId]);
|
|
448
|
-
ctx.rowCount = rows.length;
|
|
449
|
-
});
|
|
450
|
-
const postDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
451
|
-
const rowCount = ctx.rowCount;
|
|
452
|
-
yield pro_1.groups.cleanupApp(ctx.params.appId);
|
|
453
|
-
if (rowCount) {
|
|
454
|
-
yield pro_1.quotas.removeRows(rowCount);
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
const destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
458
|
-
yield preDestroyApp(ctx);
|
|
459
|
-
const result = yield destroyApp(ctx);
|
|
460
|
-
yield postDestroyApp(ctx);
|
|
461
|
-
ctx.status = 200;
|
|
462
|
-
ctx.body = result;
|
|
463
|
-
});
|
|
464
|
-
exports.destroy = destroy;
|
|
465
|
-
const sync = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
466
|
-
if (environment_1.default.DISABLE_AUTO_PROD_APP_SYNC) {
|
|
350
|
+
function update(ctx) {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
const apps = (yield backend_core_1.db.getAllApps({ dev: true }));
|
|
353
|
+
// validation
|
|
354
|
+
const name = ctx.request.body.name, possibleUrl = ctx.request.body.url;
|
|
355
|
+
if (name) {
|
|
356
|
+
checkAppName(ctx, apps, name, ctx.params.appId);
|
|
357
|
+
}
|
|
358
|
+
const url = sdk_1.default.applications.getAppUrl({ name, url: possibleUrl });
|
|
359
|
+
if (url) {
|
|
360
|
+
checkAppUrl(ctx, apps, url, ctx.params.appId);
|
|
361
|
+
ctx.request.body.url = url;
|
|
362
|
+
}
|
|
363
|
+
const app = yield updateAppPackage(ctx.request.body, ctx.params.appId);
|
|
364
|
+
yield backend_core_1.events.app.updated(app);
|
|
467
365
|
ctx.status = 200;
|
|
468
|
-
ctx.body =
|
|
469
|
-
|
|
366
|
+
ctx.body = app;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
exports.update = update;
|
|
370
|
+
function updateClient(ctx) {
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
// Get current app version
|
|
373
|
+
const db = backend_core_1.context.getAppDB();
|
|
374
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
375
|
+
const currentVersion = application.version;
|
|
376
|
+
// Update client library and manifest
|
|
377
|
+
if (!environment_1.default.isTest()) {
|
|
378
|
+
yield (0, clientLibrary_1.backupClientLibrary)(ctx.params.appId);
|
|
379
|
+
yield (0, clientLibrary_1.updateClientLibrary)(ctx.params.appId);
|
|
380
|
+
}
|
|
381
|
+
// Update versions in app package
|
|
382
|
+
const updatedToVersion = package_json_1.default.version;
|
|
383
|
+
const appPackageUpdates = {
|
|
384
|
+
version: updatedToVersion,
|
|
385
|
+
revertableVersion: currentVersion,
|
|
470
386
|
};
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
const appId = ctx.params.appId;
|
|
474
|
-
if (!backend_core_1.db.isDevAppID(appId)) {
|
|
475
|
-
ctx.throw(400, "This action cannot be performed for production apps");
|
|
476
|
-
}
|
|
477
|
-
// replicate prod to dev
|
|
478
|
-
const prodAppId = backend_core_1.db.getProdAppID(appId);
|
|
479
|
-
// specific case, want to make sure setup is skipped
|
|
480
|
-
const prodDb = backend_core_1.context.getProdAppDB({ skip_setup: true });
|
|
481
|
-
const exists = yield prodDb.exists();
|
|
482
|
-
if (!exists) {
|
|
483
|
-
// the database doesn't exist. Don't replicate
|
|
387
|
+
const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
|
|
388
|
+
yield backend_core_1.events.app.versionUpdated(app, currentVersion, updatedToVersion);
|
|
484
389
|
ctx.status = 200;
|
|
485
|
-
ctx.body =
|
|
486
|
-
message: "App sync not required, app not deployed.",
|
|
487
|
-
};
|
|
488
|
-
return next();
|
|
489
|
-
}
|
|
490
|
-
const replication = new backend_core_1.db.Replication({
|
|
491
|
-
source: prodAppId,
|
|
492
|
-
target: appId,
|
|
390
|
+
ctx.body = app;
|
|
493
391
|
});
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
error = err;
|
|
500
|
-
}
|
|
501
|
-
finally {
|
|
502
|
-
yield replication.close();
|
|
503
|
-
}
|
|
504
|
-
// sync the users
|
|
505
|
-
yield (0, user_1.syncGlobalUsers)();
|
|
506
|
-
if (error) {
|
|
507
|
-
ctx.throw(400, error);
|
|
508
|
-
}
|
|
509
|
-
else {
|
|
510
|
-
ctx.body = {
|
|
511
|
-
message: "App sync completed successfully.",
|
|
512
|
-
};
|
|
513
|
-
}
|
|
514
|
-
});
|
|
515
|
-
exports.sync = sync;
|
|
516
|
-
const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
517
|
-
return backend_core_1.context.doInAppContext(appId, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
392
|
+
}
|
|
393
|
+
exports.updateClient = updateClient;
|
|
394
|
+
function revertClient(ctx) {
|
|
395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
+
// Check app can be reverted
|
|
518
397
|
const db = backend_core_1.context.getAppDB();
|
|
519
398
|
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
399
|
+
if (!application.revertableVersion) {
|
|
400
|
+
ctx.throw(400, "There is no version to revert to");
|
|
401
|
+
}
|
|
402
|
+
// Update client library and manifest
|
|
403
|
+
if (!environment_1.default.isTest()) {
|
|
404
|
+
yield (0, clientLibrary_1.revertClientLibrary)(ctx.params.appId);
|
|
405
|
+
}
|
|
406
|
+
// Update versions in app package
|
|
407
|
+
const currentVersion = application.version;
|
|
408
|
+
const revertedToVersion = application.revertableVersion;
|
|
409
|
+
const appPackageUpdates = {
|
|
410
|
+
version: revertedToVersion,
|
|
411
|
+
revertableVersion: null,
|
|
412
|
+
};
|
|
413
|
+
const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
|
|
414
|
+
yield backend_core_1.events.app.versionReverted(app, currentVersion, revertedToVersion);
|
|
415
|
+
ctx.status = 200;
|
|
416
|
+
ctx.body = app;
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
exports.revertClient = revertClient;
|
|
420
|
+
function destroyApp(ctx) {
|
|
421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
let appId = ctx.params.appId;
|
|
423
|
+
let isUnpublish = ctx.query && ctx.query.unpublish;
|
|
424
|
+
if (isUnpublish) {
|
|
425
|
+
appId = backend_core_1.db.getProdAppID(appId);
|
|
426
|
+
const devAppId = backend_core_1.db.getDevAppID(appId);
|
|
427
|
+
// sync before removing the published app
|
|
428
|
+
yield sdk_1.default.applications.syncApp(devAppId);
|
|
429
|
+
}
|
|
430
|
+
const db = isUnpublish ? backend_core_1.context.getProdAppDB() : backend_core_1.context.getAppDB();
|
|
431
|
+
const app = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
432
|
+
const result = yield db.destroy();
|
|
433
|
+
if (isUnpublish) {
|
|
434
|
+
yield backend_core_1.events.app.unpublished(app);
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
yield pro_1.quotas.removeApp();
|
|
438
|
+
yield backend_core_1.events.app.deleted(app);
|
|
439
|
+
}
|
|
440
|
+
/* istanbul ignore next */
|
|
441
|
+
if (!environment_1.default.isTest() && !isUnpublish) {
|
|
442
|
+
yield (0, fileSystem_1.deleteApp)(appId);
|
|
443
|
+
}
|
|
444
|
+
// automations only in production
|
|
445
|
+
if (isUnpublish) {
|
|
446
|
+
yield (0, utils_2.cleanupAutomations)(appId);
|
|
447
|
+
}
|
|
448
|
+
// remove app role when the dev app is deleted (no trace of app anymore)
|
|
449
|
+
else {
|
|
450
|
+
yield (0, workerRequests_1.removeAppFromUserRoles)(ctx, appId);
|
|
523
451
|
}
|
|
524
|
-
// the locked by property is attached by server but generated from
|
|
525
|
-
// Redis, shouldn't ever store it
|
|
526
|
-
delete newAppPackage.lockedBy;
|
|
527
|
-
yield db.put(newAppPackage);
|
|
528
|
-
// remove any cached metadata, so that it will be updated
|
|
529
452
|
yield backend_core_1.cache.app.invalidateAppMetadata(appId);
|
|
530
|
-
return
|
|
531
|
-
})
|
|
532
|
-
}
|
|
453
|
+
return result;
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function preDestroyApp(ctx) {
|
|
457
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
458
|
+
const { rows } = yield (0, rows_1.getUniqueRows)([ctx.params.appId]);
|
|
459
|
+
ctx.rowCount = rows.length;
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
function postDestroyApp(ctx) {
|
|
463
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
const rowCount = ctx.rowCount;
|
|
465
|
+
yield pro_1.groups.cleanupApp(ctx.params.appId);
|
|
466
|
+
if (rowCount) {
|
|
467
|
+
yield pro_1.quotas.removeRows(rowCount);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function destroy(ctx) {
|
|
472
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
473
|
+
yield preDestroyApp(ctx);
|
|
474
|
+
const result = yield destroyApp(ctx);
|
|
475
|
+
yield postDestroyApp(ctx);
|
|
476
|
+
ctx.status = 200;
|
|
477
|
+
ctx.body = result;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
exports.destroy = destroy;
|
|
481
|
+
function sync(ctx) {
|
|
482
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
483
|
+
const appId = ctx.params.appId;
|
|
484
|
+
try {
|
|
485
|
+
ctx.body = yield sdk_1.default.applications.syncApp(appId);
|
|
486
|
+
}
|
|
487
|
+
catch (err) {
|
|
488
|
+
ctx.throw(err.status || 400, err.message);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
exports.sync = sync;
|
|
493
|
+
function updateAppPackage(appPackage, appId) {
|
|
494
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
495
|
+
return backend_core_1.context.doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
496
|
+
const db = backend_core_1.context.getAppDB();
|
|
497
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
498
|
+
const newAppPackage = Object.assign(Object.assign({}, application), appPackage);
|
|
499
|
+
if (appPackage._rev !== application._rev) {
|
|
500
|
+
newAppPackage._rev = application._rev;
|
|
501
|
+
}
|
|
502
|
+
// the locked by property is attached by server but generated from
|
|
503
|
+
// Redis, shouldn't ever store it
|
|
504
|
+
delete newAppPackage.lockedBy;
|
|
505
|
+
yield db.put(newAppPackage);
|
|
506
|
+
// remove any cached metadata, so that it will be updated
|
|
507
|
+
yield backend_core_1.cache.app.invalidateAppMetadata(appId);
|
|
508
|
+
return newAppPackage;
|
|
509
|
+
}));
|
|
510
|
+
});
|
|
511
|
+
}
|
|
533
512
|
exports.updateAppPackage = updateAppPackage;
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
513
|
+
function migrateAppNavigation() {
|
|
514
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
515
|
+
const db = backend_core_1.context.getAppDB();
|
|
516
|
+
const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
517
|
+
const layouts = yield getLayouts();
|
|
518
|
+
const screens = yield getScreens();
|
|
519
|
+
// Migrate all screens, removing custom layouts
|
|
520
|
+
for (let screen of screens) {
|
|
521
|
+
if (!screen.layoutId) {
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const layout = layouts.find(layout => layout._id === screen.layoutId);
|
|
525
|
+
screen.layoutId = undefined;
|
|
526
|
+
screen.showNavigation = (layout === null || layout === void 0 ? void 0 : layout.props.navigation) !== "None";
|
|
527
|
+
screen.width = (layout === null || layout === void 0 ? void 0 : layout.props.width) || "Large";
|
|
528
|
+
yield db.put(screen);
|
|
543
529
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
navigationSettings.navigation = layout.props.navigation || "Top";
|
|
568
|
-
navigationSettings.sticky = layout.props.sticky;
|
|
569
|
-
navigationSettings.navWidth = layout.props.width || "Large";
|
|
570
|
-
if (navigationSettings.navigation === "None") {
|
|
571
|
-
navigationSettings.navigation = "Top";
|
|
530
|
+
// Migrate layout navigation settings
|
|
531
|
+
const { name, customTheme } = existing;
|
|
532
|
+
const layout = layouts === null || layouts === void 0 ? void 0 : layouts.find((layout) => layout._id === layouts_1.BASE_LAYOUT_PROP_IDS.PRIVATE);
|
|
533
|
+
if (layout && !existing.navigation) {
|
|
534
|
+
let navigationSettings = {
|
|
535
|
+
navigation: "Top",
|
|
536
|
+
title: name,
|
|
537
|
+
navWidth: "Large",
|
|
538
|
+
navBackground: (customTheme === null || customTheme === void 0 ? void 0 : customTheme.navBackground) || "var(--spectrum-global-color-gray-50)",
|
|
539
|
+
navTextColor: (customTheme === null || customTheme === void 0 ? void 0 : customTheme.navTextColor) || "var(--spectrum-global-color-gray-800)",
|
|
540
|
+
};
|
|
541
|
+
if (layout) {
|
|
542
|
+
navigationSettings.hideLogo = layout.props.hideLogo;
|
|
543
|
+
navigationSettings.hideTitle = layout.props.hideTitle;
|
|
544
|
+
navigationSettings.title = layout.props.title || name;
|
|
545
|
+
navigationSettings.logoUrl = layout.props.logoUrl;
|
|
546
|
+
navigationSettings.links = layout.props.links;
|
|
547
|
+
navigationSettings.navigation = layout.props.navigation || "Top";
|
|
548
|
+
navigationSettings.sticky = layout.props.sticky;
|
|
549
|
+
navigationSettings.navWidth = layout.props.width || "Large";
|
|
550
|
+
if (navigationSettings.navigation === "None") {
|
|
551
|
+
navigationSettings.navigation = "Top";
|
|
552
|
+
}
|
|
572
553
|
}
|
|
554
|
+
return navigationSettings;
|
|
573
555
|
}
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
});
|
|
556
|
+
else {
|
|
557
|
+
return null;
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
}
|