@budibase/server 2.2.4-alpha.7 → 2.2.4-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.e99d9066.js → index.99ce9fcb.js} +198 -198
- package/builder/index.html +1 -1
- package/coverage/clover.xml +3219 -3195
- package/coverage/coverage-final.json +262 -262
- package/coverage/lcov-report/index.html +63 -63
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/application.ts.html +221 -155
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +27 -27
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/component.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +15 -15
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +17 -14
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +141 -195
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/index.html +18 -18
- package/coverage/lcov-report/src/api/controllers/integration.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/layout.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/metadata.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/migrations.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/permission.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +67 -16
- package/coverage/lcov-report/src/api/controllers/public/index.html +15 -15
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +2 -2
- 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 +7 -7
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +6 -6
- 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 +8 -8
- 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 +8 -8
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +8 -8
- 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 +10 -10
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +21 -21
- package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/role.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/routing.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +12 -12
- package/coverage/lcov-report/src/api/controllers/row/external.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +29 -29
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/script.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +21 -21
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +17 -17
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +27 -27
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/user.ts.html +15 -15
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +17 -17
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +14 -14
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.ts.html +28 -28
- package/coverage/lcov-report/src/api/routes/analytics.ts.html +7 -7
- package/coverage/lcov-report/src/api/routes/apikeys.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/application.ts.html +44 -11
- package/coverage/lcov-report/src/api/routes/auth.ts.html +6 -6
- package/coverage/lcov-report/src/api/routes/automation.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/backup.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/component.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +8 -11
- package/coverage/lcov-report/src/api/routes/dev.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/index.html +7 -7
- package/coverage/lcov-report/src/api/routes/index.ts.html +34 -34
- package/coverage/lcov-report/src/api/routes/integration.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/layout.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/metadata.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +7 -7
- package/coverage/lcov-report/src/api/routes/permission.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +146 -14
- package/coverage/lcov-report/src/api/routes/public/index.html +7 -7
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +52 -52
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +15 -15
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +28 -16
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tests/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tests/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +19 -19
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/role.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/routing.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/row.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/screen.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/table.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/templates.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +16 -16
- 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 +22 -22
- package/coverage/lcov-report/src/api/routes/user.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +42 -42
- package/coverage/lcov-report/src/api/routes/view.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +10 -10
- package/coverage/lcov-report/src/app.ts.html +32 -32
- package/coverage/lcov-report/src/automations/actions.ts.html +25 -25
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +10 -10
- package/coverage/lcov-report/src/automations/bullboard.ts.html +11 -11
- package/coverage/lcov-report/src/automations/index.html +1 -1
- package/coverage/lcov-report/src/automations/index.ts.html +13 -13
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +11 -11
- package/coverage/lcov-report/src/automations/steps/bash.ts.html +8 -8
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/delay.ts.html +5 -5
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/discord.ts.html +8 -8
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/loop.ts.html +3 -3
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +14 -14
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +17 -17
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +4 -4
- package/coverage/lcov-report/src/automations/steps/slack.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/utils.ts.html +3 -3
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +6 -6
- 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 +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +8 -8
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggers.ts.html +21 -21
- package/coverage/lcov-report/src/automations/utils.ts.html +46 -46
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +92 -92
- package/coverage/lcov-report/src/constants/layouts.ts.html +4 -4
- package/coverage/lcov-report/src/constants/screens.ts.html +4 -4
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +23 -23
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +16 -16
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +5 -5
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.ts.html +9 -9
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +8 -8
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +4 -4
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.ts.html +15 -15
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +12 -12
- package/coverage/lcov-report/src/db/newid.ts.html +4 -4
- package/coverage/lcov-report/src/db/utils.ts.html +58 -58
- package/coverage/lcov-report/src/definitions/automations.ts.html +4 -4
- package/coverage/lcov-report/src/definitions/datasource.ts.html +4 -4
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.ts.html +22 -22
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +6 -6
- package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +5 -5
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.ts.html +4 -4
- package/coverage/lcov-report/src/events/utils.ts.html +3 -3
- 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 +5 -5
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/base/index.html +1 -1
- package/coverage/lcov-report/src/integrations/base/query.ts.html +3 -3
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +7 -7
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +3 -3
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +6 -6
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/firebase.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/index.html +1 -1
- package/coverage/lcov-report/src/integrations/index.ts.html +30 -30
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/mysql.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/oracle.ts.html +13 -13
- package/coverage/lcov-report/src/integrations/postgres.ts.html +10 -10
- 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 +5 -5
- package/coverage/lcov-report/src/integrations/rest.ts.html +16 -16
- package/coverage/lcov-report/src/integrations/s3.ts.html +6 -6
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +5 -5
- 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 +31 -31
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +7 -7
- package/coverage/lcov-report/src/middleware/authorized.ts.html +28 -28
- package/coverage/lcov-report/src/middleware/builder.ts.html +17 -17
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +39 -39
- 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 +4 -4
- package/coverage/lcov-report/src/middleware/resourceId.ts.html +22 -22
- package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/utils.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +5 -5
- 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 +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +19 -19
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +6 -6
- 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 +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +15 -15
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/tableSettings.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +2 -2
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +3 -3
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +32 -32
- 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 +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +22 -22
- package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +9 -9
- 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 +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +8 -8
- package/coverage/lcov-report/src/sdk/users/index.html +1 -1
- package/coverage/lcov-report/src/sdk/users/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +31 -31
- package/coverage/lcov-report/src/startup.ts.html +41 -41
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +134 -104
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +26 -26
- package/coverage/lcov-report/src/threads/automation.ts.html +22 -22
- package/coverage/lcov-report/src/threads/index.html +1 -1
- package/coverage/lcov-report/src/threads/index.ts.html +11 -11
- package/coverage/lcov-report/src/threads/query.ts.html +1 -1
- package/coverage/lcov-report/src/threads/utils.ts.html +15 -15
- package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/csvParser.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +17 -17
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +11 -11
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +25 -25
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +7 -7
- package/coverage/lcov-report/src/utilities/global.ts.html +41 -41
- package/coverage/lcov-report/src/utilities/index.html +1 -1
- package/coverage/lcov-report/src/utilities/index.ts.html +22 -22
- package/coverage/lcov-report/src/utilities/redis.ts.html +22 -22
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +5 -5
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +16 -16
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +5 -5
- package/coverage/lcov-report/src/utilities/security.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/statusCodes.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +34 -34
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +14 -14
- package/coverage/lcov-report/src/watch.ts.html +9 -9
- package/coverage/lcov-report/src/websocket.ts.html +6 -6
- package/coverage/lcov.info +4013 -3979
- package/dist/api/controllers/application.js +38 -25
- package/dist/api/controllers/deploy/index.js +43 -60
- package/dist/api/controllers/public/applications.js +22 -1
- package/dist/api/routes/application.js +3 -0
- package/dist/api/routes/deploy.js +1 -2
- package/dist/api/routes/public/applications.js +37 -0
- package/dist/api/routes/public/middleware/mapper.js +3 -0
- package/dist/environment.js +1 -1
- package/dist/integrations/googlesheets.js +1 -1
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/specs/openapi.json +84 -0
- package/specs/openapi.yaml +53 -0
- package/specs/resources/application.js +19 -0
- package/src/api/controllers/application.ts +46 -24
- package/src/api/controllers/cloud.ts +1 -1
- package/src/api/controllers/deploy/Deployment.ts +1 -0
- package/src/api/controllers/deploy/index.ts +40 -58
- package/src/api/controllers/public/applications.ts +17 -0
- package/src/api/routes/application.ts +11 -0
- package/src/api/routes/deploy.ts +0 -1
- package/src/api/routes/public/applications.ts +44 -0
- package/src/api/routes/public/middleware/mapper.ts +4 -0
- package/src/api/routes/tests/application.spec.ts +54 -11
- package/src/api/routes/tests/cloud.spec.ts +3 -4
- package/src/api/routes/tests/permissions.spec.js +1 -1
- package/src/api/routes/tests/routing.spec.js +1 -1
- package/src/api/routes/tests/webhook.spec.js +1 -1
- package/src/definitions/openapi.ts +10 -0
- package/src/environment.ts +1 -1
- package/src/integrations/googlesheets.ts +1 -1
- package/src/tests/utilities/TestConfiguration.ts +14 -4
- package/src/api/routes/tests/deployment.spec.ts +0 -25
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.2.4-alpha.
|
|
4
|
+
"version": "2.2.4-alpha.9",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "2.2.4-alpha.
|
|
47
|
-
"@budibase/client": "2.2.4-alpha.
|
|
48
|
-
"@budibase/pro": "2.2.4-alpha.
|
|
49
|
-
"@budibase/string-templates": "2.2.4-alpha.
|
|
50
|
-
"@budibase/types": "2.2.4-alpha.
|
|
46
|
+
"@budibase/backend-core": "2.2.4-alpha.9",
|
|
47
|
+
"@budibase/client": "2.2.4-alpha.9",
|
|
48
|
+
"@budibase/pro": "2.2.4-alpha.8",
|
|
49
|
+
"@budibase/string-templates": "2.2.4-alpha.9",
|
|
50
|
+
"@budibase/types": "2.2.4-alpha.9",
|
|
51
51
|
"@bull-board/api": "3.7.0",
|
|
52
52
|
"@bull-board/koa": "3.9.4",
|
|
53
53
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -167,5 +167,5 @@
|
|
|
167
167
|
"optionalDependencies": {
|
|
168
168
|
"oracledb": "5.3.0"
|
|
169
169
|
},
|
|
170
|
-
"gitHead": "
|
|
170
|
+
"gitHead": "f923199296c2c55de0e1566daa31dea5d9438237"
|
|
171
171
|
}
|
package/specs/openapi.json
CHANGED
|
@@ -567,6 +567,40 @@
|
|
|
567
567
|
"data"
|
|
568
568
|
]
|
|
569
569
|
},
|
|
570
|
+
"deploymentOutput": {
|
|
571
|
+
"type": "object",
|
|
572
|
+
"properties": {
|
|
573
|
+
"data": {
|
|
574
|
+
"type": "object",
|
|
575
|
+
"properties": {
|
|
576
|
+
"_id": {
|
|
577
|
+
"description": "The ID of the app.",
|
|
578
|
+
"type": "string"
|
|
579
|
+
},
|
|
580
|
+
"status": {
|
|
581
|
+
"description": "Status of the deployment, whether it succeeded or failed",
|
|
582
|
+
"type": "string",
|
|
583
|
+
"enum": [
|
|
584
|
+
"SUCCESS",
|
|
585
|
+
"FAILURE"
|
|
586
|
+
]
|
|
587
|
+
},
|
|
588
|
+
"appUrl": {
|
|
589
|
+
"description": "The URL of the published app",
|
|
590
|
+
"type": "string"
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
"required": [
|
|
594
|
+
"_id",
|
|
595
|
+
"status",
|
|
596
|
+
"appUrl"
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
"required": [
|
|
601
|
+
"data"
|
|
602
|
+
]
|
|
603
|
+
},
|
|
570
604
|
"row": {
|
|
571
605
|
"description": "The row to be created/updated, based on the table schema.",
|
|
572
606
|
"type": "object",
|
|
@@ -1933,6 +1967,56 @@
|
|
|
1933
1967
|
}
|
|
1934
1968
|
}
|
|
1935
1969
|
},
|
|
1970
|
+
"/applications/{appId}/unpublish": {
|
|
1971
|
+
"post": {
|
|
1972
|
+
"operationId": "unpublish",
|
|
1973
|
+
"summary": "Unpublish an application",
|
|
1974
|
+
"tags": [
|
|
1975
|
+
"applications"
|
|
1976
|
+
],
|
|
1977
|
+
"parameters": [
|
|
1978
|
+
{
|
|
1979
|
+
"$ref": "#/components/parameters/appIdUrl"
|
|
1980
|
+
}
|
|
1981
|
+
],
|
|
1982
|
+
"responses": {
|
|
1983
|
+
"204": {
|
|
1984
|
+
"description": "The app was published successfully."
|
|
1985
|
+
}
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
},
|
|
1989
|
+
"/applications/{appId}/publish": {
|
|
1990
|
+
"post": {
|
|
1991
|
+
"operationId": "publish",
|
|
1992
|
+
"summary": "Unpublish an application",
|
|
1993
|
+
"tags": [
|
|
1994
|
+
"applications"
|
|
1995
|
+
],
|
|
1996
|
+
"parameters": [
|
|
1997
|
+
{
|
|
1998
|
+
"$ref": "#/components/parameters/appIdUrl"
|
|
1999
|
+
}
|
|
2000
|
+
],
|
|
2001
|
+
"responses": {
|
|
2002
|
+
"200": {
|
|
2003
|
+
"description": "Returns the deployment object.",
|
|
2004
|
+
"content": {
|
|
2005
|
+
"application/json": {
|
|
2006
|
+
"schema": {
|
|
2007
|
+
"$ref": "#/components/schemas/deploymentOutput"
|
|
2008
|
+
},
|
|
2009
|
+
"examples": {
|
|
2010
|
+
"deployment": {
|
|
2011
|
+
"$ref": "#/components/examples/deploymentOutput"
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
},
|
|
1936
2020
|
"/applications/search": {
|
|
1937
2021
|
"post": {
|
|
1938
2022
|
"operationId": "search",
|
package/specs/openapi.yaml
CHANGED
|
@@ -411,6 +411,30 @@ components:
|
|
|
411
411
|
- version
|
|
412
412
|
required:
|
|
413
413
|
- data
|
|
414
|
+
deploymentOutput:
|
|
415
|
+
type: object
|
|
416
|
+
properties:
|
|
417
|
+
data:
|
|
418
|
+
type: object
|
|
419
|
+
properties:
|
|
420
|
+
_id:
|
|
421
|
+
description: The ID of the app.
|
|
422
|
+
type: string
|
|
423
|
+
status:
|
|
424
|
+
description: Status of the deployment, whether it succeeded or failed
|
|
425
|
+
type: string
|
|
426
|
+
enum:
|
|
427
|
+
- SUCCESS
|
|
428
|
+
- FAILURE
|
|
429
|
+
appUrl:
|
|
430
|
+
description: The URL of the published app
|
|
431
|
+
type: string
|
|
432
|
+
required:
|
|
433
|
+
- _id
|
|
434
|
+
- status
|
|
435
|
+
- appUrl
|
|
436
|
+
required:
|
|
437
|
+
- data
|
|
414
438
|
row:
|
|
415
439
|
description: The row to be created/updated, based on the table schema.
|
|
416
440
|
type: object
|
|
@@ -1453,6 +1477,35 @@ paths:
|
|
|
1453
1477
|
examples:
|
|
1454
1478
|
application:
|
|
1455
1479
|
$ref: "#/components/examples/application"
|
|
1480
|
+
"/applications/{appId}/unpublish":
|
|
1481
|
+
post:
|
|
1482
|
+
operationId: unpublish
|
|
1483
|
+
summary: Unpublish an application
|
|
1484
|
+
tags:
|
|
1485
|
+
- applications
|
|
1486
|
+
parameters:
|
|
1487
|
+
- $ref: "#/components/parameters/appIdUrl"
|
|
1488
|
+
responses:
|
|
1489
|
+
"204":
|
|
1490
|
+
description: The app was published successfully.
|
|
1491
|
+
"/applications/{appId}/publish":
|
|
1492
|
+
post:
|
|
1493
|
+
operationId: publish
|
|
1494
|
+
summary: Unpublish an application
|
|
1495
|
+
tags:
|
|
1496
|
+
- applications
|
|
1497
|
+
parameters:
|
|
1498
|
+
- $ref: "#/components/parameters/appIdUrl"
|
|
1499
|
+
responses:
|
|
1500
|
+
"200":
|
|
1501
|
+
description: Returns the deployment object.
|
|
1502
|
+
content:
|
|
1503
|
+
application/json:
|
|
1504
|
+
schema:
|
|
1505
|
+
$ref: "#/components/schemas/deploymentOutput"
|
|
1506
|
+
examples:
|
|
1507
|
+
deployment:
|
|
1508
|
+
$ref: "#/components/examples/deploymentOutput"
|
|
1456
1509
|
/applications/search:
|
|
1457
1510
|
post:
|
|
1458
1511
|
operationId: search
|
|
@@ -80,6 +80,22 @@ const applicationOutputSchema = object(
|
|
|
80
80
|
}
|
|
81
81
|
)
|
|
82
82
|
|
|
83
|
+
const deploymentOutputSchema = object({
|
|
84
|
+
_id: {
|
|
85
|
+
description: "The ID of the app.",
|
|
86
|
+
type: "string",
|
|
87
|
+
},
|
|
88
|
+
status: {
|
|
89
|
+
description: "Status of the deployment, whether it succeeded or failed",
|
|
90
|
+
type: "string",
|
|
91
|
+
enum: ["SUCCESS", "FAILURE"],
|
|
92
|
+
},
|
|
93
|
+
appUrl: {
|
|
94
|
+
description: "The URL of the published app",
|
|
95
|
+
type: "string",
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
|
|
83
99
|
module.exports = new Resource()
|
|
84
100
|
.setExamples({
|
|
85
101
|
application: {
|
|
@@ -104,4 +120,7 @@ module.exports = new Resource()
|
|
|
104
120
|
items: applicationOutputSchema,
|
|
105
121
|
},
|
|
106
122
|
}),
|
|
123
|
+
deploymentOutput: object({
|
|
124
|
+
data: deploymentOutputSchema,
|
|
125
|
+
}),
|
|
107
126
|
})
|
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
} from "@budibase/types"
|
|
51
51
|
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
|
|
52
52
|
import sdk from "../../sdk"
|
|
53
|
+
import { getDB } from "@budibase/backend-core/src/db"
|
|
53
54
|
|
|
54
55
|
// utility function, need to do away with this
|
|
55
56
|
async function getLayouts() {
|
|
@@ -464,41 +465,47 @@ export async function revertClient(ctx: BBContext) {
|
|
|
464
465
|
ctx.body = app
|
|
465
466
|
}
|
|
466
467
|
|
|
468
|
+
const unpublishApp = async (ctx: any) => {
|
|
469
|
+
let appId = ctx.params.appId
|
|
470
|
+
appId = dbCore.getProdAppID(appId)
|
|
471
|
+
|
|
472
|
+
const db = context.getProdAppDB()
|
|
473
|
+
const result = await db.destroy()
|
|
474
|
+
|
|
475
|
+
await events.app.unpublished({ appId } as App)
|
|
476
|
+
|
|
477
|
+
// automations only in production
|
|
478
|
+
await cleanupAutomations(appId)
|
|
479
|
+
|
|
480
|
+
await cache.app.invalidateAppMetadata(appId)
|
|
481
|
+
return result
|
|
482
|
+
}
|
|
483
|
+
|
|
467
484
|
async function destroyApp(ctx: BBContext) {
|
|
468
485
|
let appId = ctx.params.appId
|
|
469
|
-
|
|
486
|
+
appId = dbCore.getProdAppID(appId)
|
|
487
|
+
const devAppId = dbCore.getDevAppID(appId)
|
|
470
488
|
|
|
471
|
-
if
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
// sync before removing the published app
|
|
489
|
+
// check if we need to unpublish first
|
|
490
|
+
if (await dbCore.dbExists(appId)) {
|
|
491
|
+
// app is deployed, run through unpublish flow
|
|
475
492
|
await sdk.applications.syncApp(devAppId)
|
|
493
|
+
await unpublishApp(ctx)
|
|
476
494
|
}
|
|
477
495
|
|
|
478
|
-
const db =
|
|
496
|
+
const db = dbCore.getDB(devAppId)
|
|
497
|
+
// standard app deletion flow
|
|
479
498
|
const app = await db.get(DocumentType.APP_METADATA)
|
|
480
499
|
const result = await db.destroy()
|
|
500
|
+
await quotas.removeApp()
|
|
501
|
+
await events.app.deleted(app)
|
|
481
502
|
|
|
482
|
-
if (
|
|
483
|
-
await events.app.unpublished(app)
|
|
484
|
-
} else {
|
|
485
|
-
await quotas.removeApp()
|
|
486
|
-
await events.app.deleted(app)
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
/* istanbul ignore next */
|
|
490
|
-
if (!env.isTest() && !isUnpublish) {
|
|
503
|
+
if (!env.isTest()) {
|
|
491
504
|
await deleteApp(appId)
|
|
492
505
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
497
|
-
// remove app role when the dev app is deleted (no trace of app anymore)
|
|
498
|
-
else {
|
|
499
|
-
await removeAppFromUserRoles(ctx, appId)
|
|
500
|
-
}
|
|
501
|
-
await cache.app.invalidateAppMetadata(appId)
|
|
506
|
+
|
|
507
|
+
await removeAppFromUserRoles(ctx, appId)
|
|
508
|
+
await cache.app.invalidateAppMetadata(devAppId)
|
|
502
509
|
return result
|
|
503
510
|
}
|
|
504
511
|
|
|
@@ -523,6 +530,21 @@ export async function destroy(ctx: BBContext) {
|
|
|
523
530
|
ctx.body = result
|
|
524
531
|
}
|
|
525
532
|
|
|
533
|
+
export const unpublish = async (ctx: BBContext) => {
|
|
534
|
+
const prodAppId = dbCore.getProdAppID(ctx.params.appId)
|
|
535
|
+
const dbExists = await dbCore.dbExists(prodAppId)
|
|
536
|
+
|
|
537
|
+
// check app has been published
|
|
538
|
+
if (!dbExists) {
|
|
539
|
+
return ctx.throw(400, "App has not been published.")
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
await preDestroyApp(ctx)
|
|
543
|
+
await unpublishApp(ctx)
|
|
544
|
+
await postDestroyApp(ctx)
|
|
545
|
+
ctx.status = 204
|
|
546
|
+
}
|
|
547
|
+
|
|
526
548
|
export async function sync(ctx: BBContext) {
|
|
527
549
|
const appId = ctx.params.appId
|
|
528
550
|
try {
|
|
@@ -82,7 +82,7 @@ export async function importApps(ctx: Ctx) {
|
|
|
82
82
|
"Import file is required and environment must be fresh to import apps."
|
|
83
83
|
)
|
|
84
84
|
}
|
|
85
|
-
const file = ctx.request.files.importFile
|
|
85
|
+
const file = ctx.request.files.importFile as any
|
|
86
86
|
if (Array.isArray(file)) {
|
|
87
87
|
ctx.throw(400, "Single file is required")
|
|
88
88
|
}
|
|
@@ -94,7 +94,44 @@ async function initDeployedApp(prodAppId: any) {
|
|
|
94
94
|
})
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
async function
|
|
97
|
+
export async function fetchDeployments(ctx: any) {
|
|
98
|
+
try {
|
|
99
|
+
const db = context.getAppDB()
|
|
100
|
+
const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS)
|
|
101
|
+
const { updated, deployments } = await checkAllDeployments(deploymentDoc)
|
|
102
|
+
if (updated) {
|
|
103
|
+
await db.put(deployments)
|
|
104
|
+
}
|
|
105
|
+
ctx.body = Object.values(deployments.history).reverse()
|
|
106
|
+
} catch (err) {
|
|
107
|
+
ctx.body = []
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function deploymentProgress(ctx: any) {
|
|
112
|
+
try {
|
|
113
|
+
const db = context.getAppDB()
|
|
114
|
+
const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS)
|
|
115
|
+
ctx.body = deploymentDoc[ctx.params.deploymentId]
|
|
116
|
+
} catch (err) {
|
|
117
|
+
ctx.throw(
|
|
118
|
+
500,
|
|
119
|
+
`Error fetching data for deployment ${ctx.params.deploymentId}`
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const publishApp = async function (ctx: any) {
|
|
125
|
+
let deployment = new Deployment()
|
|
126
|
+
console.log("Deployment object created")
|
|
127
|
+
deployment.setStatus(DeploymentStatus.PENDING)
|
|
128
|
+
console.log("Deployment object set to pending")
|
|
129
|
+
deployment = await storeDeploymentHistory(deployment)
|
|
130
|
+
console.log("Stored deployment history")
|
|
131
|
+
|
|
132
|
+
console.log("Deploying app...")
|
|
133
|
+
|
|
134
|
+
let app
|
|
98
135
|
let replication
|
|
99
136
|
try {
|
|
100
137
|
const appId = context.getAppId()!
|
|
@@ -108,7 +145,7 @@ async function deployApp(deployment: any, userId: string) {
|
|
|
108
145
|
productionAppId,
|
|
109
146
|
AppBackupTrigger.PUBLISH,
|
|
110
147
|
{
|
|
111
|
-
createdBy:
|
|
148
|
+
createdBy: ctx.user._id,
|
|
112
149
|
}
|
|
113
150
|
)
|
|
114
151
|
}
|
|
@@ -147,7 +184,7 @@ async function deployApp(deployment: any, userId: string) {
|
|
|
147
184
|
console.log("Deployed app initialised, setting deployment to successful")
|
|
148
185
|
deployment.setStatus(DeploymentStatus.SUCCESS)
|
|
149
186
|
await storeDeploymentHistory(deployment)
|
|
150
|
-
|
|
187
|
+
app = appDoc
|
|
151
188
|
} catch (err: any) {
|
|
152
189
|
deployment.setStatus(DeploymentStatus.FAILURE, err.message)
|
|
153
190
|
await storeDeploymentHistory(deployment)
|
|
@@ -160,62 +197,7 @@ async function deployApp(deployment: any, userId: string) {
|
|
|
160
197
|
await replication.close()
|
|
161
198
|
}
|
|
162
199
|
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
export async function fetchDeployments(ctx: any) {
|
|
166
|
-
try {
|
|
167
|
-
const db = context.getAppDB()
|
|
168
|
-
const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS)
|
|
169
|
-
const { updated, deployments } = await checkAllDeployments(deploymentDoc)
|
|
170
|
-
if (updated) {
|
|
171
|
-
await db.put(deployments)
|
|
172
|
-
}
|
|
173
|
-
ctx.body = Object.values(deployments.history).reverse()
|
|
174
|
-
} catch (err) {
|
|
175
|
-
ctx.body = []
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export async function deploymentProgress(ctx: any) {
|
|
180
|
-
try {
|
|
181
|
-
const db = context.getAppDB()
|
|
182
|
-
const deploymentDoc = await db.get(DocumentType.DEPLOYMENTS)
|
|
183
|
-
ctx.body = deploymentDoc[ctx.params.deploymentId]
|
|
184
|
-
} catch (err) {
|
|
185
|
-
ctx.throw(
|
|
186
|
-
500,
|
|
187
|
-
`Error fetching data for deployment ${ctx.params.deploymentId}`
|
|
188
|
-
)
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const isFirstDeploy = async () => {
|
|
193
|
-
try {
|
|
194
|
-
const db = context.getProdAppDB()
|
|
195
|
-
await db.get(DocumentType.APP_METADATA)
|
|
196
|
-
} catch (e: any) {
|
|
197
|
-
if (e.status === 404) {
|
|
198
|
-
return true
|
|
199
|
-
}
|
|
200
|
-
throw e
|
|
201
|
-
}
|
|
202
|
-
return false
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const _deployApp = async function (ctx: any) {
|
|
206
|
-
let deployment = new Deployment()
|
|
207
|
-
console.log("Deployment object created")
|
|
208
|
-
deployment.setStatus(DeploymentStatus.PENDING)
|
|
209
|
-
console.log("Deployment object set to pending")
|
|
210
|
-
deployment = await storeDeploymentHistory(deployment)
|
|
211
|
-
console.log("Stored deployment history")
|
|
212
|
-
|
|
213
|
-
console.log("Deploying app...")
|
|
214
|
-
|
|
215
|
-
let app = await deployApp(deployment, ctx.user._id)
|
|
216
200
|
|
|
217
201
|
await events.app.published(app)
|
|
218
202
|
ctx.body = deployment
|
|
219
203
|
}
|
|
220
|
-
|
|
221
|
-
export { _deployApp as deployApp }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { db as dbCore, context } from "@budibase/backend-core"
|
|
2
2
|
import { search as stringSearch, addRev } from "./utils"
|
|
3
3
|
import * as controller from "../application"
|
|
4
|
+
import * as deployController from "../deploy"
|
|
4
5
|
import { Application } from "../../../definitions/common"
|
|
5
6
|
|
|
6
7
|
function fixAppID(app: Application, params: any) {
|
|
@@ -74,10 +75,26 @@ export async function destroy(ctx: any, next: any) {
|
|
|
74
75
|
})
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
export async function unpublish(ctx: any, next: any) {
|
|
79
|
+
await context.doInAppContext(ctx.params.appId, async () => {
|
|
80
|
+
await controller.unpublish(ctx)
|
|
81
|
+
await next()
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function publish(ctx: any, next: any) {
|
|
86
|
+
await context.doInAppContext(ctx.params.appId, async () => {
|
|
87
|
+
await deployController.publishApp(ctx)
|
|
88
|
+
await next()
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
77
92
|
export default {
|
|
78
93
|
create,
|
|
79
94
|
update,
|
|
80
95
|
read,
|
|
81
96
|
destroy,
|
|
82
97
|
search,
|
|
98
|
+
publish,
|
|
99
|
+
unpublish,
|
|
83
100
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Router from "@koa/router"
|
|
2
2
|
import * as controller from "../controllers/application"
|
|
3
|
+
import * as deploymentController from "../controllers/deploy"
|
|
3
4
|
import authorized from "../../middleware/authorized"
|
|
4
5
|
import { permissions } from "@budibase/backend-core"
|
|
5
6
|
import { applicationValidator } from "./utils/validators"
|
|
@@ -37,6 +38,16 @@ router
|
|
|
37
38
|
authorized(permissions.BUILDER),
|
|
38
39
|
controller.revertClient
|
|
39
40
|
)
|
|
41
|
+
.post(
|
|
42
|
+
"/api/applications/:appId/publish",
|
|
43
|
+
authorized(permissions.BUILDER),
|
|
44
|
+
deploymentController.publishApp
|
|
45
|
+
)
|
|
46
|
+
.post(
|
|
47
|
+
"/api/applications/:appId/unpublish",
|
|
48
|
+
authorized(permissions.BUILDER),
|
|
49
|
+
controller.unpublish
|
|
50
|
+
)
|
|
40
51
|
.delete(
|
|
41
52
|
"/api/applications/:appId",
|
|
42
53
|
authorized(permissions.BUILDER),
|
package/src/api/routes/deploy.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import controller from "../../controllers/public/applications"
|
|
2
2
|
import Endpoint from "./utils/Endpoint"
|
|
3
3
|
const { nameValidator, applicationValidator } = require("../utils/validators")
|
|
4
|
+
import { db } from "@budibase/backend-core"
|
|
4
5
|
|
|
5
6
|
const read = [],
|
|
6
7
|
write = []
|
|
@@ -94,6 +95,49 @@ write.push(
|
|
|
94
95
|
*/
|
|
95
96
|
write.push(new Endpoint("delete", "/applications/:appId", controller.destroy))
|
|
96
97
|
|
|
98
|
+
/**
|
|
99
|
+
* @openapi
|
|
100
|
+
* /applications/{appId}/unpublish:
|
|
101
|
+
* post:
|
|
102
|
+
* operationId: unpublish
|
|
103
|
+
* summary: Unpublish an application
|
|
104
|
+
* tags:
|
|
105
|
+
* - applications
|
|
106
|
+
* parameters:
|
|
107
|
+
* - $ref: '#/components/parameters/appIdUrl'
|
|
108
|
+
* responses:
|
|
109
|
+
* 204:
|
|
110
|
+
* description: The app was published successfully.
|
|
111
|
+
*/
|
|
112
|
+
write.push(
|
|
113
|
+
new Endpoint("post", "/applications/:appId/unpublish", controller.unpublish)
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @openapi
|
|
118
|
+
* /applications/{appId}/publish:
|
|
119
|
+
* post:
|
|
120
|
+
* operationId: publish
|
|
121
|
+
* summary: Unpublish an application
|
|
122
|
+
* tags:
|
|
123
|
+
* - applications
|
|
124
|
+
* parameters:
|
|
125
|
+
* - $ref: '#/components/parameters/appIdUrl'
|
|
126
|
+
* responses:
|
|
127
|
+
* 200:
|
|
128
|
+
* description: Returns the deployment object.
|
|
129
|
+
* content:
|
|
130
|
+
* application/json:
|
|
131
|
+
* schema:
|
|
132
|
+
* $ref: '#/components/schemas/deploymentOutput'
|
|
133
|
+
* examples:
|
|
134
|
+
* deployment:
|
|
135
|
+
* $ref: '#/components/examples/deploymentOutput'
|
|
136
|
+
*/
|
|
137
|
+
write.push(
|
|
138
|
+
new Endpoint("post", "/applications/:appId/publish", controller.publish)
|
|
139
|
+
)
|
|
140
|
+
|
|
97
141
|
/**
|
|
98
142
|
* @openapi
|
|
99
143
|
* /applications/{appId}:
|
|
@@ -54,9 +54,13 @@ function processQueries(ctx: any) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
export default async (ctx: any, next: any) => {
|
|
57
|
+
if (!ctx.body) {
|
|
58
|
+
return await next()
|
|
59
|
+
}
|
|
57
60
|
let urlParts = ctx.url.split("/")
|
|
58
61
|
urlParts = urlParts.slice(4, urlParts.length)
|
|
59
62
|
let body = {}
|
|
63
|
+
|
|
60
64
|
switch (urlParts[0]) {
|
|
61
65
|
case Resources.APPLICATION:
|
|
62
66
|
body = processApplications(ctx)
|