@budibase/server 2.2.12-alpha.5 → 2.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/aws-sdk.ts +0 -19
- package/__mocks__/node-fetch.ts +0 -78
- package/builder/assets/{index.fa480d5b.css → index.9cb087df.css} +2 -2
- package/builder/assets/{index.d930bfc5.js → index.ef02c146.js} +369 -372
- package/builder/index.html +2 -2
- package/coverage/clover.xml +5094 -5122
- package/coverage/coverage-final.json +265 -268
- package/coverage/lcov-report/index.html +215 -215
- 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 +183 -258
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +51 -51
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +79 -91
- package/coverage/lcov-report/src/api/controllers/component.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +30 -30
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +14 -17
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +195 -141
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/index.html +51 -51
- 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 +19 -19
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +63 -63
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +72 -72
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +135 -150
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +55 -55
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +16 -67
- 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 +19 -19
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +60 -60
- 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 +15 -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 +52 -55
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +12 -21
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +14 -17
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +26 -26
- package/coverage/lcov-report/src/api/controllers/script.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/static/index.html +11 -11
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +44 -32
- 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 +19 -19
- 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 +70 -52
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/user.ts.html +119 -119
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/view/index.html +24 -24
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +77 -59
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +22 -22
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +69 -51
- 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 +33 -33
- 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 +11 -44
- 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 +11 -8
- 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 +37 -40
- 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 +14 -146
- 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 +16 -28
- 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 +15 -15
- 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 +24 -24
- 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 +19 -91
- package/coverage/lcov-report/src/automations/bullboard.ts.html +11 -11
- package/coverage/lcov-report/src/automations/index.html +19 -19
- 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 +34 -34
- 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 +33 -33
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +35 -35
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +31 -31
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/index.html +83 -83
- 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 +28 -28
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +18 -18
- 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 +16 -16
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +22 -22
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +5 -5
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +26 -26
- 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 +56 -56
- 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 +5 -5
- 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 +19 -19
- 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 +80 -80
- 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 +28 -40
- 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 +25 -25
- 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 +14 -14
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +8 -8
- 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 +5 -5
- package/coverage/lcov-report/src/integrations/index.ts.html +47 -35
- 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 +42 -42
- package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +13 -13
- 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 +36 -36
- 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 +10 -13
- 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 +15 -15
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +34 -34
- 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 +53 -41
- package/coverage/lcov-report/src/sdk/app/backups/index.html +28 -28
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +73 -73
- package/coverage/lcov-report/src/sdk/app/rows/attachments.ts.html +6 -6
- package/coverage/lcov-report/src/sdk/app/rows/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/rows/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/rows/rows.ts.html +4 -4
- 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 +9 -9
- package/coverage/lcov-report/src/sdk/users/index.html +5 -5
- package/coverage/lcov-report/src/sdk/users/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +34 -34
- package/coverage/lcov-report/src/startup.ts.html +42 -42
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +125 -182
- 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 +30 -30
- package/coverage/lcov-report/src/threads/automation.ts.html +103 -34
- package/coverage/lcov-report/src/threads/index.html +19 -19
- package/coverage/lcov-report/src/threads/index.ts.html +25 -25
- package/coverage/lcov-report/src/threads/query.ts.html +71 -71
- package/coverage/lcov-report/src/threads/utils.ts.html +18 -18
- 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/clientLibrary.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +19 -79
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1049 -20
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/global.ts.html +43 -43
- package/coverage/lcov-report/src/utilities/index.html +63 -48
- package/coverage/lcov-report/src/utilities/index.ts.html +168 -36
- package/coverage/lcov-report/src/utilities/plugins.ts.html +151 -0
- package/coverage/lcov-report/src/utilities/redis.ts.html +32 -32
- 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 +28 -28
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +33 -60
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +38 -38
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +32 -32
- 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 +35 -35
- 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 +56 -56
- package/coverage/lcov-report/src/watch.ts.html +9 -9
- package/coverage/lcov-report/src/websocket.ts.html +15 -15
- package/coverage/lcov.info +7320 -7367
- package/dist/api/controllers/application.js +35 -47
- package/dist/api/controllers/cloud.js +2 -6
- package/dist/api/controllers/deploy/index.js +60 -43
- package/dist/api/controllers/plugin/index.js +6 -6
- package/dist/api/controllers/public/applications.js +1 -22
- package/dist/api/controllers/row/ExternalRequest.js +1 -0
- package/dist/api/controllers/row/internal.js +12 -12
- package/dist/api/controllers/row/staticFormula.js +1 -1
- package/dist/api/controllers/static/index.js +11 -8
- package/dist/api/controllers/table/utils.js +2 -1
- package/dist/api/controllers/view/index.js +6 -5
- package/dist/api/controllers/view/viewBuilder.js +8 -2
- package/dist/api/routes/application.js +0 -3
- package/dist/api/routes/deploy.js +2 -1
- package/dist/api/routes/public/applications.js +0 -37
- package/dist/api/routes/public/middleware/mapper.js +0 -3
- package/dist/api/routes/tests/utilities/TestFunctions.js +167 -0
- package/dist/api/routes/tests/utilities/index.js +131 -0
- package/dist/automations/automationUtils.js +1 -26
- package/dist/automations/tests/utilities/index.js +81 -0
- package/dist/environment.js +1 -5
- package/dist/integrations/googlesheets.js +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/migrations/functions/backfill/global/configs.js +4 -4
- package/dist/package.json +7 -9
- package/dist/sdk/app/backups/imports.js +6 -2
- package/dist/tests/utilities/TestConfiguration.js +562 -0
- package/dist/tests/utilities/controllers.js +40 -0
- package/dist/tests/utilities/structures.js +168 -0
- package/dist/threads/automation.js +28 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/clientLibrary.js +3 -3
- package/dist/utilities/fileSystem/index.js +342 -18
- package/dist/utilities/index.js +44 -1
- package/dist/utilities/plugins.js +26 -0
- package/dist/utilities/rowProcessor/index.js +4 -12
- package/package.json +8 -10
- package/scripts/dev/manage.js +16 -0
- package/specs/openapi.json +0 -84
- package/specs/openapi.yaml +0 -53
- package/specs/resources/application.js +0 -19
- package/src/api/controllers/application.ts +36 -61
- package/src/api/controllers/auth.ts +2 -2
- package/src/api/controllers/cloud.ts +6 -10
- package/src/api/controllers/deploy/Deployment.ts +0 -1
- package/src/api/controllers/deploy/index.ts +58 -40
- package/src/api/controllers/plugin/index.ts +9 -14
- package/src/api/controllers/public/applications.ts +0 -17
- package/src/api/controllers/row/ExternalRequest.ts +1 -0
- package/src/api/controllers/row/internal.ts +23 -24
- package/src/api/controllers/row/staticFormula.ts +2 -5
- package/src/api/controllers/row/utils.ts +1 -2
- package/src/api/controllers/static/index.ts +10 -6
- package/src/api/controllers/table/utils.ts +7 -1
- package/src/api/controllers/view/index.ts +11 -5
- package/src/api/controllers/view/viewBuilder.ts +14 -8
- package/src/api/routes/application.ts +0 -11
- package/src/api/routes/deploy.ts +1 -0
- package/src/api/routes/index.ts +3 -4
- package/src/api/routes/public/applications.ts +0 -44
- package/src/api/routes/public/middleware/mapper.ts +0 -4
- package/src/api/routes/tests/__snapshots__/{datasource.spec.ts.snap → datasource.spec.js.snap} +0 -0
- package/src/api/routes/tests/{application.spec.ts → application.spec.js} +18 -94
- package/src/api/routes/tests/{backup.spec.ts → backup.spec.js} +6 -17
- package/src/api/routes/tests/{datasource.spec.ts → datasource.spec.js} +15 -23
- package/src/api/routes/tests/deployment.spec.ts +25 -0
- package/src/api/routes/tests/permissions.spec.js +1 -1
- package/src/api/routes/tests/routing.spec.js +2 -1
- package/src/api/routes/tests/row.spec.js +2 -4
- package/src/api/routes/tests/static.spec.js +17 -2
- package/src/api/routes/tests/table.spec.js +2 -8
- package/src/api/routes/tests/user.spec.js +0 -86
- package/src/api/routes/tests/utilities/index.ts +2 -2
- package/src/api/routes/tests/webhook.spec.js +1 -1
- package/src/automations/automationUtils.ts +0 -24
- package/src/automations/tests/utilities/index.ts +2 -2
- package/src/automations/unitTests/automationUtils.spec.js +17 -0
- package/src/definitions/openapi.ts +0 -10
- package/src/environment.ts +1 -5
- package/src/integrations/googlesheets.ts +1 -1
- package/src/integrations/index.ts +5 -1
- package/src/migrations/functions/backfill/global/configs.ts +4 -5
- package/src/sdk/app/backups/imports.ts +6 -2
- package/src/sdk/tests/attachments.spec.ts +4 -1
- package/src/tests/jestSetup.ts +1 -4
- package/src/tests/utilities/TestConfiguration.ts +4 -23
- package/src/threads/automation.ts +27 -4
- package/src/utilities/fileSystem/clientLibrary.ts +1 -1
- package/src/utilities/fileSystem/index.ts +348 -5
- package/src/utilities/index.ts +45 -1
- package/src/utilities/plugins.ts +22 -0
- package/src/utilities/rowProcessor/index.ts +8 -17
- package/tsconfig.build.json +0 -2
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +0 -343
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +0 -595
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +0 -280
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +0 -193
- package/dist/utilities/fileSystem/app.js +0 -97
- package/dist/utilities/fileSystem/filesystem.js +0 -182
- package/dist/utilities/fileSystem/plugin.js +0 -63
- package/dist/utilities/fileSystem/template.js +0 -44
- package/src/api/routes/tests/cloud.spec.ts +0 -65
- package/src/api/routes/tests/data/budibase-component-1.0.1.tgz +0 -0
- package/src/api/routes/tests/data/comment-box-1.0.2.tar.gz +0 -0
- package/src/api/routes/tests/data/export-test.tar.gz +0 -0
- package/src/api/routes/tests/plugin.spec.ts +0 -179
- package/src/automations/tests/bash.spec.js +0 -34
- package/src/automations/tests/discord.spec.js +0 -27
- package/src/automations/tests/executeQuery.spec.js +0 -49
- package/src/automations/tests/executeScript.spec.js +0 -48
- package/src/automations/tests/sendSmtpEmail.spec.js +0 -71
- package/src/automations/tests/serverLog.spec.js +0 -22
- package/src/automations/tests/zapier.spec.js +0 -27
- package/src/automations/unitTests/automationUtils.spec.ts +0 -65
- package/src/utilities/fileSystem/app.ts +0 -86
- package/src/utilities/fileSystem/filesystem.ts +0 -170
- package/src/utilities/fileSystem/plugin.ts +0 -65
- package/src/utilities/fileSystem/template.ts +0 -36
- package/src/utilities/rowProcessor/tests/utils.spec.ts +0 -57
package/specs/openapi.json
CHANGED
|
@@ -567,40 +567,6 @@
|
|
|
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
|
-
},
|
|
604
570
|
"row": {
|
|
605
571
|
"description": "The row to be created/updated, based on the table schema.",
|
|
606
572
|
"type": "object",
|
|
@@ -1967,56 +1933,6 @@
|
|
|
1967
1933
|
}
|
|
1968
1934
|
}
|
|
1969
1935
|
},
|
|
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
|
-
},
|
|
2020
1936
|
"/applications/search": {
|
|
2021
1937
|
"post": {
|
|
2022
1938
|
"operationId": "search",
|
package/specs/openapi.yaml
CHANGED
|
@@ -411,30 +411,6 @@ 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
|
|
438
414
|
row:
|
|
439
415
|
description: The row to be created/updated, based on the table schema.
|
|
440
416
|
type: object
|
|
@@ -1477,35 +1453,6 @@ paths:
|
|
|
1477
1453
|
examples:
|
|
1478
1454
|
application:
|
|
1479
1455
|
$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"
|
|
1509
1456
|
/applications/search:
|
|
1510
1457
|
post:
|
|
1511
1458
|
operationId: search
|
|
@@ -80,22 +80,6 @@ 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
|
-
|
|
99
83
|
module.exports = new Resource()
|
|
100
84
|
.setExamples({
|
|
101
85
|
application: {
|
|
@@ -120,7 +104,4 @@ module.exports = new Resource()
|
|
|
120
104
|
items: applicationOutputSchema,
|
|
121
105
|
},
|
|
122
106
|
}),
|
|
123
|
-
deploymentOutput: object({
|
|
124
|
-
data: deploymentOutputSchema,
|
|
125
|
-
}),
|
|
126
107
|
})
|
|
@@ -23,18 +23,21 @@ import {
|
|
|
23
23
|
errors,
|
|
24
24
|
events,
|
|
25
25
|
migrations,
|
|
26
|
-
objectStore,
|
|
27
26
|
} from "@budibase/backend-core"
|
|
28
27
|
import { USERS_TABLE_SCHEMA } from "../../constants"
|
|
29
28
|
import { buildDefaultDocs } from "../../db/defaultData/datasource_bb_default"
|
|
30
29
|
import { removeAppFromUserRoles } from "../../utilities/workerRequests"
|
|
31
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
clientLibraryPath,
|
|
32
|
+
stringToReadStream,
|
|
33
|
+
isQsTrue,
|
|
34
|
+
} from "../../utilities"
|
|
32
35
|
import { getLocksById } from "../../utilities/redis"
|
|
33
36
|
import {
|
|
34
37
|
updateClientLibrary,
|
|
35
38
|
backupClientLibrary,
|
|
36
39
|
revertClientLibrary,
|
|
37
|
-
} from "../../utilities/fileSystem"
|
|
40
|
+
} from "../../utilities/fileSystem/clientLibrary"
|
|
38
41
|
import { cleanupAutomations } from "../../automations/utils"
|
|
39
42
|
import { checkAppMetadata } from "../../automations/logging"
|
|
40
43
|
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
|
@@ -46,9 +49,9 @@ import {
|
|
|
46
49
|
MigrationType,
|
|
47
50
|
BBContext,
|
|
48
51
|
Database,
|
|
49
|
-
UserCtx,
|
|
50
52
|
} from "@budibase/types"
|
|
51
53
|
import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts"
|
|
54
|
+
import { enrichPluginURLs } from "../../utilities/plugins"
|
|
52
55
|
import sdk from "../../sdk"
|
|
53
56
|
|
|
54
57
|
// utility function, need to do away with this
|
|
@@ -201,34 +204,27 @@ export async function fetchAppDefinition(ctx: BBContext) {
|
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
|
|
204
|
-
export async function fetchAppPackage(ctx:
|
|
207
|
+
export async function fetchAppPackage(ctx: BBContext) {
|
|
205
208
|
const db = context.getAppDB()
|
|
206
209
|
let application = await db.get(DocumentType.APP_METADATA)
|
|
207
210
|
const layouts = await getLayouts()
|
|
208
211
|
let screens = await getScreens()
|
|
209
212
|
|
|
210
213
|
// Enrich plugin URLs
|
|
211
|
-
application.usedPlugins =
|
|
212
|
-
application.usedPlugins
|
|
213
|
-
)
|
|
214
|
+
application.usedPlugins = enrichPluginURLs(application.usedPlugins)
|
|
214
215
|
|
|
215
216
|
// Only filter screens if the user is not a builder
|
|
216
|
-
if (!(ctx.user
|
|
217
|
+
if (!(ctx.user?.builder && ctx.user.builder.global)) {
|
|
217
218
|
const userRoleId = getUserRoleId(ctx)
|
|
218
219
|
const accessController = new roles.AccessController()
|
|
219
220
|
screens = await accessController.checkScreensAccess(screens, userRoleId)
|
|
220
221
|
}
|
|
221
222
|
|
|
222
|
-
const clientLibPath = objectStore.clientLibraryUrl(
|
|
223
|
-
ctx.params.appId,
|
|
224
|
-
application.version
|
|
225
|
-
)
|
|
226
|
-
|
|
227
223
|
ctx.body = {
|
|
228
224
|
application,
|
|
229
225
|
screens,
|
|
230
226
|
layouts,
|
|
231
|
-
clientLibPath,
|
|
227
|
+
clientLibPath: clientLibraryPath(ctx.params.appId, application.version),
|
|
232
228
|
}
|
|
233
229
|
}
|
|
234
230
|
|
|
@@ -374,7 +370,7 @@ async function appPostCreate(ctx: BBContext, app: App) {
|
|
|
374
370
|
if (err.code && err.code === errors.codes.USAGE_LIMIT_EXCEEDED) {
|
|
375
371
|
// this import resulted in row usage exceeding the quota
|
|
376
372
|
// delete the app
|
|
377
|
-
// skip pre and post-steps as no rows have been added to quotas yet
|
|
373
|
+
// skip pre- and post-steps as no rows have been added to quotas yet
|
|
378
374
|
ctx.params.appId = app.appId
|
|
379
375
|
await destroyApp(ctx)
|
|
380
376
|
}
|
|
@@ -464,47 +460,41 @@ export async function revertClient(ctx: BBContext) {
|
|
|
464
460
|
ctx.body = app
|
|
465
461
|
}
|
|
466
462
|
|
|
467
|
-
const unpublishApp = async (ctx: any) => {
|
|
468
|
-
let appId = ctx.params.appId
|
|
469
|
-
appId = dbCore.getProdAppID(appId)
|
|
470
|
-
|
|
471
|
-
const db = context.getProdAppDB()
|
|
472
|
-
const result = await db.destroy()
|
|
473
|
-
|
|
474
|
-
await events.app.unpublished({ appId } as App)
|
|
475
|
-
|
|
476
|
-
// automations only in production
|
|
477
|
-
await cleanupAutomations(appId)
|
|
478
|
-
|
|
479
|
-
await cache.app.invalidateAppMetadata(appId)
|
|
480
|
-
return result
|
|
481
|
-
}
|
|
482
|
-
|
|
483
463
|
async function destroyApp(ctx: BBContext) {
|
|
484
464
|
let appId = ctx.params.appId
|
|
485
|
-
|
|
486
|
-
const devAppId = dbCore.getDevAppID(appId)
|
|
465
|
+
let isUnpublish = ctx.query && ctx.query.unpublish
|
|
487
466
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
467
|
+
if (isUnpublish) {
|
|
468
|
+
appId = dbCore.getProdAppID(appId)
|
|
469
|
+
const devAppId = dbCore.getDevAppID(appId)
|
|
470
|
+
// sync before removing the published app
|
|
491
471
|
await sdk.applications.syncApp(devAppId)
|
|
492
|
-
await unpublishApp(ctx)
|
|
493
472
|
}
|
|
494
473
|
|
|
495
|
-
const db =
|
|
496
|
-
// standard app deletion flow
|
|
474
|
+
const db = isUnpublish ? context.getProdAppDB() : context.getAppDB()
|
|
497
475
|
const app = await db.get(DocumentType.APP_METADATA)
|
|
498
476
|
const result = await db.destroy()
|
|
499
|
-
await quotas.removeApp()
|
|
500
|
-
await events.app.deleted(app)
|
|
501
477
|
|
|
502
|
-
if (
|
|
503
|
-
await
|
|
478
|
+
if (isUnpublish) {
|
|
479
|
+
await events.app.unpublished(app)
|
|
480
|
+
} else {
|
|
481
|
+
await quotas.removeApp()
|
|
482
|
+
await events.app.deleted(app)
|
|
504
483
|
}
|
|
505
484
|
|
|
506
|
-
|
|
507
|
-
|
|
485
|
+
/* istanbul ignore next */
|
|
486
|
+
if (!env.isTest() && !isUnpublish) {
|
|
487
|
+
await deleteApp(appId)
|
|
488
|
+
}
|
|
489
|
+
// automations only in production
|
|
490
|
+
if (isUnpublish) {
|
|
491
|
+
await cleanupAutomations(appId)
|
|
492
|
+
}
|
|
493
|
+
// remove app role when the dev app is deleted (no trace of app anymore)
|
|
494
|
+
else {
|
|
495
|
+
await removeAppFromUserRoles(ctx, appId)
|
|
496
|
+
}
|
|
497
|
+
await cache.app.invalidateAppMetadata(appId)
|
|
508
498
|
return result
|
|
509
499
|
}
|
|
510
500
|
|
|
@@ -529,21 +519,6 @@ export async function destroy(ctx: BBContext) {
|
|
|
529
519
|
ctx.body = result
|
|
530
520
|
}
|
|
531
521
|
|
|
532
|
-
export const unpublish = async (ctx: BBContext) => {
|
|
533
|
-
const prodAppId = dbCore.getProdAppID(ctx.params.appId)
|
|
534
|
-
const dbExists = await dbCore.dbExists(prodAppId)
|
|
535
|
-
|
|
536
|
-
// check app has been published
|
|
537
|
-
if (!dbExists) {
|
|
538
|
-
return ctx.throw(400, "App has not been published.")
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
await preDestroyApp(ctx)
|
|
542
|
-
await unpublishApp(ctx)
|
|
543
|
-
await postDestroyApp(ctx)
|
|
544
|
-
ctx.status = 204
|
|
545
|
-
}
|
|
546
|
-
|
|
547
522
|
export async function sync(ctx: BBContext) {
|
|
548
523
|
const appId = ctx.params.appId
|
|
549
524
|
try {
|
|
@@ -3,7 +3,7 @@ import { InternalTables } from "../../db/utils"
|
|
|
3
3
|
import { getFullUser } from "../../utilities/users"
|
|
4
4
|
import { roles, context } from "@budibase/backend-core"
|
|
5
5
|
import { groups } from "@budibase/pro"
|
|
6
|
-
import { ContextUser, User, Row
|
|
6
|
+
import { ContextUser, User, Row } from "@budibase/types"
|
|
7
7
|
|
|
8
8
|
const PUBLIC_ROLE = roles.BUILTIN_ROLE_IDS.PUBLIC
|
|
9
9
|
|
|
@@ -16,7 +16,7 @@ const addSessionAttributesToUser = (ctx: any) => {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export async function fetchSelf(ctx:
|
|
19
|
+
export async function fetchSelf(ctx: any) {
|
|
20
20
|
let userId = ctx.user.userId || ctx.user._id
|
|
21
21
|
/* istanbul ignore next */
|
|
22
22
|
if (!userId || !ctx.isAuthenticated) {
|
|
@@ -5,8 +5,8 @@ import { stringToReadStream } from "../../utilities"
|
|
|
5
5
|
import { getDocParams, DocumentType, isDevAppID } from "../../db/utils"
|
|
6
6
|
import { create } from "./application"
|
|
7
7
|
import { join } from "path"
|
|
8
|
+
import { App, BBContext, Database } from "@budibase/types"
|
|
8
9
|
import sdk from "../../sdk"
|
|
9
|
-
import { App, Ctx, Database } from "@budibase/types"
|
|
10
10
|
|
|
11
11
|
async function createApp(appName: string, appDirectory: string) {
|
|
12
12
|
const ctx = {
|
|
@@ -35,7 +35,7 @@ async function getAllDocType(db: Database, docType: string) {
|
|
|
35
35
|
return response.rows.map(row => row.doc)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export async function exportApps(ctx:
|
|
38
|
+
export async function exportApps(ctx: BBContext) {
|
|
39
39
|
if (env.SELF_HOSTED || !env.MULTI_TENANCY) {
|
|
40
40
|
ctx.throw(400, "Exporting only allowed in multi-tenant cloud environments.")
|
|
41
41
|
}
|
|
@@ -65,13 +65,13 @@ async function checkHasBeenImported() {
|
|
|
65
65
|
return apps.length !== 0
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export async function hasBeenImported(ctx:
|
|
68
|
+
export async function hasBeenImported(ctx: BBContext) {
|
|
69
69
|
ctx.body = {
|
|
70
70
|
imported: await checkHasBeenImported(),
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
export async function importApps(ctx:
|
|
74
|
+
export async function importApps(ctx: BBContext) {
|
|
75
75
|
if (!env.SELF_HOSTED || env.MULTI_TENANCY) {
|
|
76
76
|
ctx.throw(400, "Importing only allowed in self hosted environments.")
|
|
77
77
|
}
|
|
@@ -82,16 +82,12 @@ 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
|
-
|
|
86
|
-
if (Array.isArray(file)) {
|
|
87
|
-
ctx.throw(400, "Single file is required")
|
|
88
|
-
}
|
|
89
|
-
if (file.type !== "application/gzip") {
|
|
85
|
+
if (ctx.request.files.importFile.type !== "application/gzip") {
|
|
90
86
|
ctx.throw(400, "Import file must be a gzipped tarball.")
|
|
91
87
|
}
|
|
92
88
|
|
|
93
89
|
// initially get all the app databases out of the tarball
|
|
94
|
-
const tmpPath = sdk.backups.untarFile(
|
|
90
|
+
const tmpPath = sdk.backups.untarFile(ctx.request.files.importFile)
|
|
95
91
|
const globalDbImport = sdk.backups.getGlobalDBFile(tmpPath)
|
|
96
92
|
const appNames = sdk.backups.getListOfAppsInMulti(tmpPath)
|
|
97
93
|
|
|
@@ -94,44 +94,7 @@ async function initDeployedApp(prodAppId: any) {
|
|
|
94
94
|
})
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
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
|
|
97
|
+
async function deployApp(deployment: any, userId: string) {
|
|
135
98
|
let replication
|
|
136
99
|
try {
|
|
137
100
|
const appId = context.getAppId()!
|
|
@@ -145,7 +108,7 @@ export const publishApp = async function (ctx: any) {
|
|
|
145
108
|
productionAppId,
|
|
146
109
|
AppBackupTrigger.PUBLISH,
|
|
147
110
|
{
|
|
148
|
-
createdBy:
|
|
111
|
+
createdBy: userId,
|
|
149
112
|
}
|
|
150
113
|
)
|
|
151
114
|
}
|
|
@@ -184,7 +147,7 @@ export const publishApp = async function (ctx: any) {
|
|
|
184
147
|
console.log("Deployed app initialised, setting deployment to successful")
|
|
185
148
|
deployment.setStatus(DeploymentStatus.SUCCESS)
|
|
186
149
|
await storeDeploymentHistory(deployment)
|
|
187
|
-
|
|
150
|
+
return appDoc
|
|
188
151
|
} catch (err: any) {
|
|
189
152
|
deployment.setStatus(DeploymentStatus.FAILURE, err.message)
|
|
190
153
|
await storeDeploymentHistory(deployment)
|
|
@@ -197,7 +160,62 @@ export const publishApp = async function (ctx: any) {
|
|
|
197
160
|
await replication.close()
|
|
198
161
|
}
|
|
199
162
|
}
|
|
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)
|
|
200
216
|
|
|
201
217
|
await events.app.published(app)
|
|
202
218
|
ctx.body = deployment
|
|
203
219
|
}
|
|
220
|
+
|
|
221
|
+
export { _deployApp as deployApp }
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { npmUpload, urlUpload, githubUpload, fileUpload } from "./uploaders"
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
db as dbCore,
|
|
5
|
-
tenancy,
|
|
6
|
-
objectStore,
|
|
7
|
-
} from "@budibase/backend-core"
|
|
8
|
-
import { PluginType, FileType, PluginSource, Plugin } from "@budibase/types"
|
|
2
|
+
import { plugins as pluginCore, tenancy } from "@budibase/backend-core"
|
|
3
|
+
import { PluginType, FileType, PluginSource } from "@budibase/types"
|
|
9
4
|
import env from "../../../environment"
|
|
10
5
|
import { ClientAppSocket } from "../../../websocket"
|
|
11
|
-
import {
|
|
6
|
+
import { db as dbCore } from "@budibase/backend-core"
|
|
7
|
+
import { plugins } from "@budibase/pro"
|
|
12
8
|
|
|
13
9
|
export async function getPlugins(type?: PluginType) {
|
|
14
10
|
const db = tenancy.getGlobalDB()
|
|
@@ -17,10 +13,9 @@ export async function getPlugins(type?: PluginType) {
|
|
|
17
13
|
include_docs: true,
|
|
18
14
|
})
|
|
19
15
|
)
|
|
20
|
-
|
|
21
|
-
plugins = objectStore.enrichPluginURLs(plugins)
|
|
16
|
+
const plugins = response.rows.map((row: any) => row.doc)
|
|
22
17
|
if (type) {
|
|
23
|
-
return plugins.filter((plugin:
|
|
18
|
+
return plugins.filter((plugin: any) => plugin.schema?.type === type)
|
|
24
19
|
} else {
|
|
25
20
|
return plugins
|
|
26
21
|
}
|
|
@@ -89,7 +84,7 @@ export async function create(ctx: any) {
|
|
|
89
84
|
)
|
|
90
85
|
}
|
|
91
86
|
|
|
92
|
-
const doc = await
|
|
87
|
+
const doc = await plugins.storePlugin(metadata, directory, source)
|
|
93
88
|
|
|
94
89
|
ClientAppSocket.emit("plugins-update", { name, hash: doc.hash })
|
|
95
90
|
ctx.body = {
|
|
@@ -112,7 +107,7 @@ export async function destroy(ctx: any) {
|
|
|
112
107
|
const { pluginId } = ctx.params
|
|
113
108
|
|
|
114
109
|
try {
|
|
115
|
-
await
|
|
110
|
+
await plugins.deletePlugin(pluginId)
|
|
116
111
|
|
|
117
112
|
ctx.body = { message: `Plugin ${ctx.params.pluginId} deleted.` }
|
|
118
113
|
} catch (err: any) {
|
|
@@ -132,7 +127,7 @@ export async function processUploadedPlugin(
|
|
|
132
127
|
throw new Error("Only component plugins are supported outside of self-host")
|
|
133
128
|
}
|
|
134
129
|
|
|
135
|
-
const doc = await
|
|
130
|
+
const doc = await plugins.storePlugin(metadata, directory, source)
|
|
136
131
|
ClientAppSocket.emit("plugin-update", { name: doc.name, hash: doc.hash })
|
|
137
132
|
return doc
|
|
138
133
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
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"
|
|
5
4
|
import { Application } from "../../../definitions/common"
|
|
6
5
|
|
|
7
6
|
function fixAppID(app: Application, params: any) {
|
|
@@ -75,26 +74,10 @@ export async function destroy(ctx: any, next: any) {
|
|
|
75
74
|
})
|
|
76
75
|
}
|
|
77
76
|
|
|
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
|
-
|
|
92
77
|
export default {
|
|
93
78
|
create,
|
|
94
79
|
update,
|
|
95
80
|
read,
|
|
96
81
|
destroy,
|
|
97
82
|
search,
|
|
98
|
-
publish,
|
|
99
|
-
unpublish,
|
|
100
83
|
}
|
|
@@ -21,6 +21,7 @@ import { getDatasourceAndQuery } from "./utils"
|
|
|
21
21
|
import { FieldTypes, RelationshipTypes } from "../../../constants"
|
|
22
22
|
import { breakExternalTableId, isSQL } from "../../../integrations/utils"
|
|
23
23
|
import { processObjectSync } from "@budibase/string-templates"
|
|
24
|
+
// @ts-ignore
|
|
24
25
|
import { cloneDeep } from "lodash/fp"
|
|
25
26
|
import { processFormulas, processDates } from "../../../utilities/rowProcessor"
|
|
26
27
|
import { context } from "@budibase/backend-core"
|