@budibase/server 2.2.12-alpha.1 → 2.2.12
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.5e79c3b5.js → index.c0e1038a.js} +364 -367
- package/builder/index.html +2 -2
- package/coverage/clover.xml +5018 -5052
- package/coverage/coverage-final.json +265 -268
- package/coverage/lcov-report/index.html +206 -206
- 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 +51 -51
- 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 +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +49 -49
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +22 -22
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +33 -33
- 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 +7122 -7189
- 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/view/index.js +2 -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 +6 -8
- 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 +7 -9
- 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/view/index.ts +2 -2
- 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
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
cleanupAttachments,
|
|
14
14
|
} from "../../../utilities/rowProcessor"
|
|
15
15
|
import { FieldTypes } from "../../../constants"
|
|
16
|
-
import
|
|
16
|
+
import { validate as rowValidate, findRow } from "./utils"
|
|
17
17
|
import { fullSearch, paginatedSearch } from "./internalSearch"
|
|
18
18
|
import { getGlobalUsersFromMetadata } from "../../../utilities/global"
|
|
19
19
|
import * as inMemoryViews from "../../../db/inMemoryView"
|
|
@@ -30,8 +30,7 @@ import { finaliseRow, updateRelatedFormula } from "./staticFormula"
|
|
|
30
30
|
import * as exporters from "../view/exporters"
|
|
31
31
|
import { apiFileReturn } from "../../../utilities/fileSystem"
|
|
32
32
|
import {
|
|
33
|
-
|
|
34
|
-
UserCtx,
|
|
33
|
+
BBContext,
|
|
35
34
|
Database,
|
|
36
35
|
LinkDocumentValue,
|
|
37
36
|
Row,
|
|
@@ -70,7 +69,7 @@ async function getView(db: Database, viewName: string) {
|
|
|
70
69
|
return viewInfo
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
async function getRawTableData(ctx:
|
|
72
|
+
async function getRawTableData(ctx: BBContext, db: Database, tableId: string) {
|
|
74
73
|
let rows
|
|
75
74
|
if (tableId === InternalTables.USER_METADATA) {
|
|
76
75
|
await userController.fetchMetadata(ctx)
|
|
@@ -86,7 +85,7 @@ async function getRawTableData(ctx: Ctx, db: Database, tableId: string) {
|
|
|
86
85
|
return rows as Row[]
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
export async function patch(ctx:
|
|
88
|
+
export async function patch(ctx: BBContext) {
|
|
90
89
|
const db = context.getAppDB()
|
|
91
90
|
const inputs = ctx.request.body
|
|
92
91
|
const tableId = inputs.tableId
|
|
@@ -96,7 +95,7 @@ export async function patch(ctx: UserCtx) {
|
|
|
96
95
|
let dbTable = await db.get(tableId)
|
|
97
96
|
oldRow = await outputProcessing(
|
|
98
97
|
dbTable,
|
|
99
|
-
await
|
|
98
|
+
await findRow(ctx, tableId, inputs._id)
|
|
100
99
|
)
|
|
101
100
|
} catch (err) {
|
|
102
101
|
if (isUserTable) {
|
|
@@ -118,8 +117,8 @@ export async function patch(ctx: UserCtx) {
|
|
|
118
117
|
}
|
|
119
118
|
|
|
120
119
|
// this returns the table and row incase they have been updated
|
|
121
|
-
let { table, row } = inputProcessing(ctx.user
|
|
122
|
-
const validateResult = await
|
|
120
|
+
let { table, row } = inputProcessing(ctx.user!, dbTable, combinedRow)
|
|
121
|
+
const validateResult = await rowValidate({
|
|
123
122
|
row,
|
|
124
123
|
table,
|
|
125
124
|
})
|
|
@@ -151,7 +150,7 @@ export async function patch(ctx: UserCtx) {
|
|
|
151
150
|
})
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
export async function save(ctx:
|
|
153
|
+
export async function save(ctx: BBContext) {
|
|
155
154
|
const db = context.getAppDB()
|
|
156
155
|
let inputs = ctx.request.body
|
|
157
156
|
inputs.tableId = ctx.params.tableId
|
|
@@ -162,8 +161,8 @@ export async function save(ctx: UserCtx) {
|
|
|
162
161
|
|
|
163
162
|
// this returns the table and row incase they have been updated
|
|
164
163
|
const dbTable = await db.get(inputs.tableId)
|
|
165
|
-
let { table, row } = inputProcessing(ctx.user
|
|
166
|
-
const validateResult = await
|
|
164
|
+
let { table, row } = inputProcessing(ctx.user!, dbTable, inputs)
|
|
165
|
+
const validateResult = await rowValidate({
|
|
167
166
|
row,
|
|
168
167
|
table,
|
|
169
168
|
})
|
|
@@ -186,8 +185,8 @@ export async function save(ctx: UserCtx) {
|
|
|
186
185
|
})
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
export async function fetchView(ctx:
|
|
190
|
-
const viewName =
|
|
188
|
+
export async function fetchView(ctx: BBContext) {
|
|
189
|
+
const viewName = ctx.params.viewName
|
|
191
190
|
|
|
192
191
|
// if this is a table view being looked for just transfer to that
|
|
193
192
|
if (viewName.startsWith(DocumentType.TABLE)) {
|
|
@@ -253,7 +252,7 @@ export async function fetchView(ctx: Ctx) {
|
|
|
253
252
|
return rows
|
|
254
253
|
}
|
|
255
254
|
|
|
256
|
-
export async function fetch(ctx:
|
|
255
|
+
export async function fetch(ctx: BBContext) {
|
|
257
256
|
const db = context.getAppDB()
|
|
258
257
|
|
|
259
258
|
const tableId = ctx.params.tableId
|
|
@@ -262,15 +261,15 @@ export async function fetch(ctx: Ctx) {
|
|
|
262
261
|
return outputProcessing(table, rows)
|
|
263
262
|
}
|
|
264
263
|
|
|
265
|
-
export async function find(ctx:
|
|
264
|
+
export async function find(ctx: BBContext) {
|
|
266
265
|
const db = dbCore.getDB(ctx.appId)
|
|
267
266
|
const table = await db.get(ctx.params.tableId)
|
|
268
|
-
let row = await
|
|
267
|
+
let row = await findRow(ctx, ctx.params.tableId, ctx.params.rowId)
|
|
269
268
|
row = await outputProcessing(table, row)
|
|
270
269
|
return row
|
|
271
270
|
}
|
|
272
271
|
|
|
273
|
-
export async function destroy(ctx:
|
|
272
|
+
export async function destroy(ctx: BBContext) {
|
|
274
273
|
const db = context.getAppDB()
|
|
275
274
|
const { _id } = ctx.request.body
|
|
276
275
|
let row = await db.get(_id)
|
|
@@ -306,7 +305,7 @@ export async function destroy(ctx: Ctx) {
|
|
|
306
305
|
return { response, row }
|
|
307
306
|
}
|
|
308
307
|
|
|
309
|
-
export async function bulkDestroy(ctx:
|
|
308
|
+
export async function bulkDestroy(ctx: BBContext) {
|
|
310
309
|
const db = context.getAppDB()
|
|
311
310
|
const tableId = ctx.params.tableId
|
|
312
311
|
const table = await db.get(tableId)
|
|
@@ -345,7 +344,7 @@ export async function bulkDestroy(ctx: Ctx) {
|
|
|
345
344
|
return { response: { ok: true }, rows: processedRows }
|
|
346
345
|
}
|
|
347
346
|
|
|
348
|
-
export async function search(ctx:
|
|
347
|
+
export async function search(ctx: BBContext) {
|
|
349
348
|
// Fetch the whole table when running in cypress, as search doesn't work
|
|
350
349
|
if (!env.COUCH_DB_URL && env.isCypress()) {
|
|
351
350
|
return { rows: await fetch(ctx) }
|
|
@@ -377,14 +376,14 @@ export async function search(ctx: Ctx) {
|
|
|
377
376
|
return response
|
|
378
377
|
}
|
|
379
378
|
|
|
380
|
-
export async function validate(ctx:
|
|
381
|
-
return
|
|
379
|
+
export async function validate(ctx: BBContext) {
|
|
380
|
+
return rowValidate({
|
|
382
381
|
tableId: ctx.params.tableId,
|
|
383
382
|
row: ctx.request.body,
|
|
384
383
|
})
|
|
385
384
|
}
|
|
386
385
|
|
|
387
|
-
export async function exportRows(ctx:
|
|
386
|
+
export async function exportRows(ctx: BBContext) {
|
|
388
387
|
const db = context.getAppDB()
|
|
389
388
|
const table = await db.get(ctx.params.tableId)
|
|
390
389
|
const rowIds = ctx.request.body.rows
|
|
@@ -422,14 +421,14 @@ export async function exportRows(ctx: Ctx) {
|
|
|
422
421
|
return apiFileReturn(exporter(headers, rows))
|
|
423
422
|
}
|
|
424
423
|
|
|
425
|
-
export async function fetchEnrichedRow(ctx:
|
|
424
|
+
export async function fetchEnrichedRow(ctx: BBContext) {
|
|
426
425
|
const db = context.getAppDB()
|
|
427
426
|
const tableId = ctx.params.tableId
|
|
428
427
|
const rowId = ctx.params.rowId
|
|
429
428
|
// need table to work out where links go in row
|
|
430
429
|
let [table, row] = await Promise.all([
|
|
431
430
|
db.get(tableId),
|
|
432
|
-
|
|
431
|
+
findRow(ctx, tableId, rowId),
|
|
433
432
|
])
|
|
434
433
|
// get the link docs
|
|
435
434
|
const linkVals = (await linkRows.getLinkDocuments({
|
|
@@ -16,10 +16,7 @@ const { cloneDeep } = require("lodash/fp")
|
|
|
16
16
|
* updated.
|
|
17
17
|
* NOTE: this will only for affect static formulas.
|
|
18
18
|
*/
|
|
19
|
-
export async function updateRelatedFormula(
|
|
20
|
-
table: Table,
|
|
21
|
-
enrichedRows: Row[] | Row
|
|
22
|
-
) {
|
|
19
|
+
export async function updateRelatedFormula(table: Table, enrichedRows: Row[]) {
|
|
23
20
|
const db = context.getAppDB()
|
|
24
21
|
// no formula to update, we're done
|
|
25
22
|
if (!table.relatedFormula) {
|
|
@@ -158,7 +155,7 @@ export async function finaliseRow(
|
|
|
158
155
|
enrichedRow = await processFormulas(table, enrichedRow, { dynamic: false })
|
|
159
156
|
// this updates the related formulas in other rows based on the relations to this row
|
|
160
157
|
if (updateFormula) {
|
|
161
|
-
await updateRelatedFormula(table, enrichedRow)
|
|
158
|
+
await exports.updateRelatedFormula(table, enrichedRow)
|
|
162
159
|
}
|
|
163
160
|
return { row: enrichedRow, table }
|
|
164
161
|
}
|
|
@@ -7,7 +7,6 @@ import { BBContext, Row, Table } from "@budibase/types"
|
|
|
7
7
|
export { removeKeyNumbering } from "../../../integrations/base/utils"
|
|
8
8
|
const validateJs = require("validate.js")
|
|
9
9
|
const { cloneDeep } = require("lodash/fp")
|
|
10
|
-
import { Ctx } from "@budibase/types"
|
|
11
10
|
|
|
12
11
|
validateJs.extend(validateJs.validators.datetime, {
|
|
13
12
|
parse: function (value: string) {
|
|
@@ -26,7 +25,7 @@ export async function getDatasourceAndQuery(json: any) {
|
|
|
26
25
|
return makeExternalQuery(datasource, json)
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
export async function findRow(ctx:
|
|
28
|
+
export async function findRow(ctx: BBContext, tableId: string, rowId: string) {
|
|
30
29
|
const db = context.getAppDB()
|
|
31
30
|
let row
|
|
32
31
|
// TODO remove special user case in future
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { enrichPluginURLs } from "../../../utilities/plugins"
|
|
2
|
+
|
|
1
3
|
require("svelte/register")
|
|
2
4
|
|
|
3
5
|
const send = require("koa-send")
|
|
4
6
|
const { resolve, join } = require("../../../utilities/centralPath")
|
|
5
7
|
const uuid = require("uuid")
|
|
6
|
-
|
|
8
|
+
const { ObjectStoreBuckets } = require("../../../constants")
|
|
7
9
|
const { processString } = require("@budibase/string-templates")
|
|
8
10
|
const {
|
|
9
11
|
loadHandlebarsFile,
|
|
@@ -11,6 +13,8 @@ const {
|
|
|
11
13
|
TOP_LEVEL_PATH,
|
|
12
14
|
} = require("../../../utilities/fileSystem")
|
|
13
15
|
const env = require("../../../environment")
|
|
16
|
+
const { clientLibraryPath } = require("../../../utilities")
|
|
17
|
+
const { attachmentsRelativeURL } = require("../../../utilities")
|
|
14
18
|
const { DocumentType } = require("../../../db/utils")
|
|
15
19
|
const { context, objectStore, utils } = require("@budibase/backend-core")
|
|
16
20
|
const AWS = require("aws-sdk")
|
|
@@ -29,7 +33,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }: any) {
|
|
|
29
33
|
return {
|
|
30
34
|
size: file.size,
|
|
31
35
|
name: file.name,
|
|
32
|
-
url:
|
|
36
|
+
url: attachmentsRelativeURL(response.Key),
|
|
33
37
|
extension: [...file.name.split(".")].pop(),
|
|
34
38
|
key: response.Key,
|
|
35
39
|
}
|
|
@@ -81,7 +85,7 @@ export const uploadFile = async function (ctx: any) {
|
|
|
81
85
|
|
|
82
86
|
return prepareUpload({
|
|
83
87
|
file,
|
|
84
|
-
s3Key: `${
|
|
88
|
+
s3Key: `${ctx.appId}/attachments/${processedFileName}`,
|
|
85
89
|
bucket: ObjectStoreBuckets.APPS,
|
|
86
90
|
})
|
|
87
91
|
})
|
|
@@ -103,14 +107,14 @@ export const serveApp = async function (ctx: any) {
|
|
|
103
107
|
|
|
104
108
|
if (!env.isJest()) {
|
|
105
109
|
const App = require("./templates/BudibaseApp.svelte").default
|
|
106
|
-
const plugins =
|
|
110
|
+
const plugins = enrichPluginURLs(appInfo.usedPlugins)
|
|
107
111
|
const { head, html, css } = App.render({
|
|
108
112
|
metaImage:
|
|
109
113
|
"https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png",
|
|
110
114
|
title: appInfo.name,
|
|
111
115
|
production: env.isProd(),
|
|
112
116
|
appId,
|
|
113
|
-
clientLibPath:
|
|
117
|
+
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
|
|
114
118
|
usedPlugins: plugins,
|
|
115
119
|
})
|
|
116
120
|
|
|
@@ -135,7 +139,7 @@ export const serveBuilderPreview = async function (ctx: any) {
|
|
|
135
139
|
let appId = context.getAppId()
|
|
136
140
|
const previewHbs = loadHandlebarsFile(`${__dirname}/templates/preview.hbs`)
|
|
137
141
|
ctx.body = await processString(previewHbs, {
|
|
138
|
-
clientLibPath:
|
|
142
|
+
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
|
|
139
143
|
})
|
|
140
144
|
} else {
|
|
141
145
|
// just return the app info for jest to assert on
|
|
@@ -113,7 +113,7 @@ async function handleViewEvents(existingView: View, newView: View) {
|
|
|
113
113
|
|
|
114
114
|
export async function destroy(ctx: BBContext) {
|
|
115
115
|
const db = context.getAppDB()
|
|
116
|
-
const viewName =
|
|
116
|
+
const viewName = decodeURI(ctx.params.viewName)
|
|
117
117
|
const view = await deleteView(viewName)
|
|
118
118
|
const table = await db.get(view.meta.tableId)
|
|
119
119
|
delete table.views[viewName]
|
|
@@ -124,7 +124,7 @@ export async function destroy(ctx: BBContext) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
export async function exportView(ctx: BBContext) {
|
|
127
|
-
const viewName =
|
|
127
|
+
const viewName = decodeURI(ctx.query.view as string)
|
|
128
128
|
const view = await getView(viewName)
|
|
129
129
|
|
|
130
130
|
const format = ctx.query.format as string
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Router from "@koa/router"
|
|
2
2
|
import * as controller from "../controllers/application"
|
|
3
|
-
import * as deploymentController from "../controllers/deploy"
|
|
4
3
|
import authorized from "../../middleware/authorized"
|
|
5
4
|
import { permissions } from "@budibase/backend-core"
|
|
6
5
|
import { applicationValidator } from "./utils/validators"
|
|
@@ -38,16 +37,6 @@ router
|
|
|
38
37
|
authorized(permissions.BUILDER),
|
|
39
38
|
controller.revertClient
|
|
40
39
|
)
|
|
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
|
-
)
|
|
51
40
|
.delete(
|
|
52
41
|
"/api/applications/:appId",
|
|
53
42
|
authorized(permissions.BUILDER),
|
package/src/api/routes/deploy.ts
CHANGED
package/src/api/routes/index.ts
CHANGED
|
@@ -26,14 +26,13 @@ import cloudRoutes from "./cloud"
|
|
|
26
26
|
import migrationRoutes from "./migrations"
|
|
27
27
|
import pluginRoutes from "./plugin"
|
|
28
28
|
import Router from "@koa/router"
|
|
29
|
-
import { api
|
|
29
|
+
import { api } from "@budibase/pro"
|
|
30
30
|
|
|
31
31
|
export { default as staticRoutes } from "./static"
|
|
32
32
|
export { default as publicRoutes } from "./public"
|
|
33
33
|
|
|
34
|
-
const appBackupRoutes =
|
|
35
|
-
const scheduleRoutes =
|
|
36
|
-
|
|
34
|
+
const appBackupRoutes = api.appBackups
|
|
35
|
+
const scheduleRoutes = api.schedules
|
|
37
36
|
export const mainRoutes: Router[] = [
|
|
38
37
|
appBackupRoutes,
|
|
39
38
|
backupRoutes,
|
|
@@ -1,7 +1,6 @@
|
|
|
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"
|
|
5
4
|
|
|
6
5
|
const read = [],
|
|
7
6
|
write = []
|
|
@@ -95,49 +94,6 @@ write.push(
|
|
|
95
94
|
*/
|
|
96
95
|
write.push(new Endpoint("delete", "/applications/:appId", controller.destroy))
|
|
97
96
|
|
|
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
|
-
|
|
141
97
|
/**
|
|
142
98
|
* @openapi
|
|
143
99
|
* /applications/{appId}:
|
|
@@ -54,13 +54,9 @@ 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
|
-
}
|
|
60
57
|
let urlParts = ctx.url.split("/")
|
|
61
58
|
urlParts = urlParts.slice(4, urlParts.length)
|
|
62
59
|
let body = {}
|
|
63
|
-
|
|
64
60
|
switch (urlParts[0]) {
|
|
65
61
|
case Resources.APPLICATION:
|
|
66
62
|
body = processApplications(ctx)
|
package/src/api/routes/tests/__snapshots__/{datasource.spec.ts.snap → datasource.spec.js.snap}
RENAMED
|
File without changes
|
|
@@ -11,11 +11,14 @@ jest.mock("../../../utilities/redis", () => ({
|
|
|
11
11
|
checkDebounce: jest.fn(),
|
|
12
12
|
shutdown: jest.fn(),
|
|
13
13
|
}))
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
clearAllApps,
|
|
17
|
+
checkBuilderEndpoint,
|
|
18
|
+
} = require("./utilities/TestFunctions")
|
|
19
|
+
const setup = require("./utilities")
|
|
20
|
+
const { AppStatus } = require("../../../db/utils")
|
|
21
|
+
const { events } = require("@budibase/backend-core")
|
|
19
22
|
|
|
20
23
|
describe("/applications", () => {
|
|
21
24
|
let request = setup.getRequest()
|
|
@@ -159,30 +162,33 @@ describe("/applications", () => {
|
|
|
159
162
|
})
|
|
160
163
|
})
|
|
161
164
|
|
|
162
|
-
describe("
|
|
163
|
-
it("should
|
|
165
|
+
describe("delete", () => {
|
|
166
|
+
it("should delete app", async () => {
|
|
167
|
+
await config.createApp("to-delete")
|
|
164
168
|
const appId = config.getAppId()
|
|
165
169
|
await request
|
|
166
|
-
.
|
|
170
|
+
.delete(`/api/applications/${appId}`)
|
|
167
171
|
.set(config.defaultHeaders())
|
|
168
172
|
.expect("Content-Type", /json/)
|
|
169
173
|
.expect(200)
|
|
170
|
-
expect(events.app.
|
|
174
|
+
expect(events.app.deleted).toBeCalledTimes(1)
|
|
171
175
|
})
|
|
172
176
|
|
|
173
|
-
it("should
|
|
177
|
+
it("should unpublish app", async () => {
|
|
178
|
+
await config.createApp("to-unpublish")
|
|
174
179
|
const appId = config.getProdAppId()
|
|
175
180
|
await request
|
|
176
|
-
.
|
|
181
|
+
.delete(`/api/applications/${appId}?unpublish=true`)
|
|
177
182
|
.set(config.defaultHeaders())
|
|
178
183
|
.expect("Content-Type", /json/)
|
|
179
184
|
.expect(200)
|
|
180
|
-
expect(events.app.
|
|
185
|
+
expect(events.app.unpublished).toBeCalledTimes(1)
|
|
181
186
|
})
|
|
182
187
|
})
|
|
183
188
|
|
|
184
189
|
describe("manage client library version", () => {
|
|
185
190
|
it("should be able to update the app client library version", async () => {
|
|
191
|
+
console.log(config.getAppId())
|
|
186
192
|
await request
|
|
187
193
|
.post(`/api/applications/${config.getAppId()}/client/update`)
|
|
188
194
|
.set(config.defaultHeaders())
|
|
@@ -190,7 +196,6 @@ describe("/applications", () => {
|
|
|
190
196
|
.expect(200)
|
|
191
197
|
expect(events.app.versionUpdated).toBeCalledTimes(1)
|
|
192
198
|
})
|
|
193
|
-
|
|
194
199
|
it("should be able to revert the app client library version", async () => {
|
|
195
200
|
// We need to first update the version so that we can then revert
|
|
196
201
|
await request
|
|
@@ -229,85 +234,4 @@ describe("/applications", () => {
|
|
|
229
234
|
expect(getRes.body.application.updatedAt).toBeDefined()
|
|
230
235
|
})
|
|
231
236
|
})
|
|
232
|
-
|
|
233
|
-
describe("sync", () => {
|
|
234
|
-
it("app should sync correctly", async () => {
|
|
235
|
-
const res = await request
|
|
236
|
-
.post(`/api/applications/${config.getAppId()}/sync`)
|
|
237
|
-
.set(config.defaultHeaders())
|
|
238
|
-
.expect("Content-Type", /json/)
|
|
239
|
-
.expect(200)
|
|
240
|
-
expect(res.body.message).toEqual("App sync completed successfully.")
|
|
241
|
-
})
|
|
242
|
-
|
|
243
|
-
it("app should not sync if production", async () => {
|
|
244
|
-
const res = await request
|
|
245
|
-
.post(`/api/applications/app_123456/sync`)
|
|
246
|
-
.set(config.defaultHeaders())
|
|
247
|
-
.expect("Content-Type", /json/)
|
|
248
|
-
.expect(400)
|
|
249
|
-
expect(res.body.message).toEqual(
|
|
250
|
-
"This action cannot be performed for production apps"
|
|
251
|
-
)
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
it("app should not sync if sync is disabled", async () => {
|
|
255
|
-
env._set("DISABLE_AUTO_PROD_APP_SYNC", true)
|
|
256
|
-
const res = await request
|
|
257
|
-
.post(`/api/applications/${config.getAppId()}/sync`)
|
|
258
|
-
.set(config.defaultHeaders())
|
|
259
|
-
.expect("Content-Type", /json/)
|
|
260
|
-
.expect(200)
|
|
261
|
-
expect(res.body.message).toEqual(
|
|
262
|
-
"App sync disabled. You can reenable with the DISABLE_AUTO_PROD_APP_SYNC environment variable."
|
|
263
|
-
)
|
|
264
|
-
env._set("DISABLE_AUTO_PROD_APP_SYNC", false)
|
|
265
|
-
})
|
|
266
|
-
})
|
|
267
|
-
|
|
268
|
-
describe("unpublish", () => {
|
|
269
|
-
it("should unpublish app with dev app ID", async () => {
|
|
270
|
-
const appId = config.getAppId()
|
|
271
|
-
await request
|
|
272
|
-
.post(`/api/applications/${appId}/unpublish`)
|
|
273
|
-
.set(config.defaultHeaders())
|
|
274
|
-
.expect(204)
|
|
275
|
-
expect(events.app.unpublished).toBeCalledTimes(1)
|
|
276
|
-
})
|
|
277
|
-
|
|
278
|
-
it("should unpublish app with prod app ID", async () => {
|
|
279
|
-
const appId = config.getProdAppId()
|
|
280
|
-
await request
|
|
281
|
-
.post(`/api/applications/${appId}/unpublish`)
|
|
282
|
-
.set(config.defaultHeaders())
|
|
283
|
-
.expect(204)
|
|
284
|
-
expect(events.app.unpublished).toBeCalledTimes(1)
|
|
285
|
-
})
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
describe("delete", () => {
|
|
289
|
-
it("should delete published app and dev apps with dev app ID", async () => {
|
|
290
|
-
await config.createApp("to-delete")
|
|
291
|
-
const appId = config.getAppId()
|
|
292
|
-
await request
|
|
293
|
-
.delete(`/api/applications/${appId}`)
|
|
294
|
-
.set(config.defaultHeaders())
|
|
295
|
-
.expect("Content-Type", /json/)
|
|
296
|
-
.expect(200)
|
|
297
|
-
expect(events.app.deleted).toBeCalledTimes(1)
|
|
298
|
-
expect(events.app.unpublished).toBeCalledTimes(1)
|
|
299
|
-
})
|
|
300
|
-
|
|
301
|
-
it("should delete published app and dev app with prod app ID", async () => {
|
|
302
|
-
await config.createApp("to-delete")
|
|
303
|
-
const appId = config.getProdAppId()
|
|
304
|
-
await request
|
|
305
|
-
.delete(`/api/applications/${appId}`)
|
|
306
|
-
.set(config.defaultHeaders())
|
|
307
|
-
.expect("Content-Type", /json/)
|
|
308
|
-
.expect(200)
|
|
309
|
-
expect(events.app.deleted).toBeCalledTimes(1)
|
|
310
|
-
expect(events.app.unpublished).toBeCalledTimes(1)
|
|
311
|
-
})
|
|
312
|
-
})
|
|
313
237
|
})
|
|
@@ -8,10 +8,10 @@ jest.mock("@budibase/backend-core", () => {
|
|
|
8
8
|
}
|
|
9
9
|
})
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
|
12
|
+
const setup = require("./utilities")
|
|
13
|
+
const { events } = require("@budibase/backend-core")
|
|
14
|
+
|
|
15
15
|
describe("/backups", () => {
|
|
16
16
|
let request = setup.getRequest()
|
|
17
17
|
let config = setup.getConfig()
|
|
@@ -30,7 +30,7 @@ describe("/backups", () => {
|
|
|
30
30
|
.expect(200)
|
|
31
31
|
expect(res.text).toBeDefined()
|
|
32
32
|
expect(res.headers["content-type"]).toEqual("application/gzip")
|
|
33
|
-
expect(events.app.exported).
|
|
33
|
+
expect(events.app.exported.mock.calls.length).toBe(1)
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
it("should apply authorization to endpoint", async () => {
|
|
@@ -41,15 +41,4 @@ describe("/backups", () => {
|
|
|
41
41
|
})
|
|
42
42
|
})
|
|
43
43
|
})
|
|
44
|
-
|
|
45
|
-
describe("calculateBackupStats", () => {
|
|
46
|
-
it("should be able to calculate the backup statistics", async () => {
|
|
47
|
-
config.createAutomation()
|
|
48
|
-
config.createScreen()
|
|
49
|
-
let res = await sdk.backups.calculateBackupStats(config.getAppId())
|
|
50
|
-
expect(res.automations).toEqual(1)
|
|
51
|
-
expect(res.datasources).toEqual(1)
|
|
52
|
-
expect(res.screens).toEqual(1)
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
})
|
|
44
|
+
})
|