@budibase/server 2.2.4-alpha.1 → 2.2.5
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.77b82b83.js → index.18998a03.js} +194 -194
- package/builder/index.html +1 -1
- package/coverage/clover.xml +4897 -4907
- package/coverage/coverage-final.json +262 -265
- package/coverage/lcov-report/index.html +169 -169
- 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 +159 -171
- 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 -14
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +83 -83
- 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 +10 -10
- package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
- 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 +10 -10
- 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 +51 -54
- 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 +47 -47
- 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 +9 -9
- package/coverage/lcov-report/src/api/routes/auth.ts.html +6 -6
- package/coverage/lcov-report/src/api/routes/automation.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/backup.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/component.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/dev.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/index.html +1 -1
- 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 +12 -12
- package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +52 -52
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tests/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tests/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +19 -19
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/role.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/routing.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/row.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/screen.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/table.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/templates.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +16 -16
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +22 -22
- package/coverage/lcov-report/src/api/routes/user.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +42 -42
- package/coverage/lcov-report/src/api/routes/view.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +10 -10
- package/coverage/lcov-report/src/app.ts.html +32 -32
- package/coverage/lcov-report/src/automations/actions.ts.html +25 -25
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +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 +31 -43
- 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 +26 -26
- 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 +11 -11
- 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 +54 -42
- package/coverage/lcov-report/src/sdk/app/backups/index.html +30 -30
- 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/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +8 -8
- package/coverage/lcov-report/src/sdk/users/index.html +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 +119 -146
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.html +10 -10
- 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 +101 -32
- 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 +42 -42
- 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 +6958 -6989
- package/dist/api/controllers/application.js +10 -9
- package/dist/api/controllers/cloud.js +2 -6
- package/dist/api/controllers/plugin/index.js +6 -6
- package/dist/api/controllers/row/ExternalRequest.js +1 -0
- package/dist/api/controllers/row/internal.js +11 -11
- package/dist/api/controllers/row/staticFormula.js +1 -1
- package/dist/api/controllers/static/index.js +11 -8
- 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 +2 -6
- 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 +7 -3
- 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 +26 -2
- 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/src/api/controllers/application.ts +12 -16
- package/src/api/controllers/auth.ts +2 -2
- package/src/api/controllers/cloud.ts +6 -10
- package/src/api/controllers/plugin/index.ts +9 -14
- package/src/api/controllers/row/ExternalRequest.ts +1 -0
- package/src/api/controllers/row/internal.ts +22 -23
- 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/routes/index.ts +3 -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} +7 -40
- 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/routing.spec.js +1 -0
- 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/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/environment.ts +2 -6
- package/src/integrations/index.ts +5 -1
- package/src/migrations/functions/backfill/global/configs.ts +4 -5
- package/src/sdk/app/backups/imports.ts +7 -3
- package/src/tests/jestSetup.ts +1 -4
- package/src/tests/utilities/TestConfiguration.ts +0 -9
- package/src/threads/automation.ts +25 -2
- 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 -66
- 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
|
@@ -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
|
|
|
@@ -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
|
}
|
|
@@ -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"
|
|
@@ -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,7 +185,7 @@ export async function save(ctx: UserCtx) {
|
|
|
186
185
|
})
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
export async function fetchView(ctx:
|
|
188
|
+
export async function fetchView(ctx: BBContext) {
|
|
190
189
|
const viewName = ctx.params.viewName
|
|
191
190
|
|
|
192
191
|
// if this is a table view being looked for just transfer to that
|
|
@@ -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
|
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,
|
package/src/api/routes/tests/__snapshots__/{datasource.spec.ts.snap → datasource.spec.js.snap}
RENAMED
|
File without changes
|
|
@@ -12,11 +12,13 @@ jest.mock("../../../utilities/redis", () => ({
|
|
|
12
12
|
shutdown: jest.fn(),
|
|
13
13
|
}))
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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")
|
|
20
22
|
|
|
21
23
|
describe("/applications", () => {
|
|
22
24
|
let request = setup.getRequest()
|
|
@@ -232,39 +234,4 @@ describe("/applications", () => {
|
|
|
232
234
|
expect(getRes.body.application.updatedAt).toBeDefined()
|
|
233
235
|
})
|
|
234
236
|
})
|
|
235
|
-
|
|
236
|
-
describe("sync", () => {
|
|
237
|
-
it("app should sync correctly", async () => {
|
|
238
|
-
const res = await request
|
|
239
|
-
.post(`/api/applications/${config.getAppId()}/sync`)
|
|
240
|
-
.set(config.defaultHeaders())
|
|
241
|
-
.expect("Content-Type", /json/)
|
|
242
|
-
.expect(200)
|
|
243
|
-
expect(res.body.message).toEqual("App sync completed successfully.")
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
it("app should not sync if production", async () => {
|
|
247
|
-
const res = await request
|
|
248
|
-
.post(`/api/applications/app_123456/sync`)
|
|
249
|
-
.set(config.defaultHeaders())
|
|
250
|
-
.expect("Content-Type", /json/)
|
|
251
|
-
.expect(400)
|
|
252
|
-
expect(res.body.message).toEqual(
|
|
253
|
-
"This action cannot be performed for production apps"
|
|
254
|
-
)
|
|
255
|
-
})
|
|
256
|
-
|
|
257
|
-
it("app should not sync if sync is disabled", async () => {
|
|
258
|
-
env._set("DISABLE_AUTO_PROD_APP_SYNC", true)
|
|
259
|
-
const res = await request
|
|
260
|
-
.post(`/api/applications/${config.getAppId()}/sync`)
|
|
261
|
-
.set(config.defaultHeaders())
|
|
262
|
-
.expect("Content-Type", /json/)
|
|
263
|
-
.expect(200)
|
|
264
|
-
expect(res.body.message).toEqual(
|
|
265
|
-
"App sync disabled. You can reenable with the DISABLE_AUTO_PROD_APP_SYNC environment variable."
|
|
266
|
-
)
|
|
267
|
-
env._set("DISABLE_AUTO_PROD_APP_SYNC", false)
|
|
268
|
-
})
|
|
269
|
-
})
|
|
270
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
|
+
})
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
jest.mock("pg")
|
|
2
|
-
import * as setup from "./utilities"
|
|
3
|
-
import { checkBuilderEndpoint } from "./utilities/TestFunctions"
|
|
4
|
-
import { checkCacheForDynamicVariable } from "../../../threads/utils"
|
|
5
|
-
import { events } from "@budibase/backend-core"
|
|
6
2
|
|
|
3
|
+
let setup = require("./utilities")
|
|
7
4
|
let { basicDatasource } = setup.structures
|
|
5
|
+
let { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
|
8
6
|
const pg = require("pg")
|
|
7
|
+
const { checkCacheForDynamicVariable } = require("../../../threads/utils")
|
|
8
|
+
const { events } = require("@budibase/backend-core")
|
|
9
9
|
|
|
10
10
|
describe("/datasources", () => {
|
|
11
11
|
let request = setup.getRequest()
|
|
12
12
|
let config = setup.getConfig()
|
|
13
|
-
let datasource
|
|
13
|
+
let datasource
|
|
14
14
|
|
|
15
15
|
afterAll(setup.afterAll)
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ describe("/datasources", () => {
|
|
|
26
26
|
.post(`/api/datasources`)
|
|
27
27
|
.send(basicDatasource())
|
|
28
28
|
.set(config.defaultHeaders())
|
|
29
|
-
.expect(
|
|
29
|
+
.expect('Content-Type', /json/)
|
|
30
30
|
.expect(200)
|
|
31
31
|
|
|
32
32
|
expect(res.body.datasource.name).toEqual("Test")
|
|
@@ -42,7 +42,7 @@ describe("/datasources", () => {
|
|
|
42
42
|
.put(`/api/datasources/${datasource._id}`)
|
|
43
43
|
.send(datasource)
|
|
44
44
|
.set(config.defaultHeaders())
|
|
45
|
-
.expect(
|
|
45
|
+
.expect('Content-Type', /json/)
|
|
46
46
|
.expect(200)
|
|
47
47
|
|
|
48
48
|
expect(res.body.datasource.name).toEqual("Updated Test")
|
|
@@ -51,34 +51,25 @@ describe("/datasources", () => {
|
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
describe("dynamic variables", () => {
|
|
54
|
-
async function preview(
|
|
55
|
-
datasource: any,
|
|
56
|
-
fields: { path: string; queryString: string }
|
|
57
|
-
) {
|
|
54
|
+
async function preview(datasource, fields) {
|
|
58
55
|
return config.previewQuery(request, config, datasource, fields)
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
it("should invalidate changed or removed variables", async () => {
|
|
62
59
|
const { datasource, query } = await config.dynamicVariableDatasource()
|
|
63
60
|
// preview once to cache variables
|
|
64
|
-
await preview(datasource, {
|
|
65
|
-
path: "www.test.com",
|
|
66
|
-
queryString: "test={{ variable3 }}",
|
|
67
|
-
})
|
|
61
|
+
await preview(datasource, { path: "www.test.com", queryString: "test={{ variable3 }}" })
|
|
68
62
|
// check variables in cache
|
|
69
|
-
let contents = await checkCacheForDynamicVariable(
|
|
70
|
-
query._id,
|
|
71
|
-
"variable3"
|
|
72
|
-
)
|
|
63
|
+
let contents = await checkCacheForDynamicVariable(query._id, "variable3")
|
|
73
64
|
expect(contents.rows.length).toEqual(1)
|
|
74
|
-
|
|
65
|
+
|
|
75
66
|
// update the datasource to remove the variables
|
|
76
67
|
datasource.config.dynamicVariables = []
|
|
77
68
|
const res = await request
|
|
78
69
|
.put(`/api/datasources/${datasource._id}`)
|
|
79
70
|
.send(datasource)
|
|
80
71
|
.set(config.defaultHeaders())
|
|
81
|
-
.expect(
|
|
72
|
+
.expect('Content-Type', /json/)
|
|
82
73
|
.expect(200)
|
|
83
74
|
expect(res.body.errors).toBeUndefined()
|
|
84
75
|
|
|
@@ -94,7 +85,7 @@ describe("/datasources", () => {
|
|
|
94
85
|
const res = await request
|
|
95
86
|
.get(`/api/datasources`)
|
|
96
87
|
.set(config.defaultHeaders())
|
|
97
|
-
.expect(
|
|
88
|
+
.expect('Content-Type', /json/)
|
|
98
89
|
.expect(200)
|
|
99
90
|
|
|
100
91
|
const datasources = res.body
|
|
@@ -169,7 +160,7 @@ describe("/datasources", () => {
|
|
|
169
160
|
const res = await request
|
|
170
161
|
.get(`/api/datasources`)
|
|
171
162
|
.set(config.defaultHeaders())
|
|
172
|
-
.expect(
|
|
163
|
+
.expect('Content-Type', /json/)
|
|
173
164
|
.expect(200)
|
|
174
165
|
|
|
175
166
|
expect(res.body.length).toEqual(1)
|
|
@@ -183,5 +174,6 @@ describe("/datasources", () => {
|
|
|
183
174
|
url: `/api/datasources/${datasource._id}/${datasource._rev}`,
|
|
184
175
|
})
|
|
185
176
|
})
|
|
177
|
+
|
|
186
178
|
})
|
|
187
179
|
})
|
|
@@ -10,7 +10,6 @@ const {
|
|
|
10
10
|
StaticQuotaName,
|
|
11
11
|
MonthlyQuotaName,
|
|
12
12
|
} = require("@budibase/types")
|
|
13
|
-
const { structures } = require("@budibase/backend-core/tests");
|
|
14
13
|
|
|
15
14
|
describe("/rows", () => {
|
|
16
15
|
let request = setup.getRequest()
|
|
@@ -495,13 +494,12 @@ describe("/rows", () => {
|
|
|
495
494
|
describe("attachments", () => {
|
|
496
495
|
it("should allow enriching attachment rows", async () => {
|
|
497
496
|
const table = await config.createAttachmentTable()
|
|
498
|
-
const attachmentId = `${structures.uuid()}.csv`
|
|
499
497
|
const row = await config.createRow({
|
|
500
498
|
name: "test",
|
|
501
499
|
description: "test",
|
|
502
500
|
attachment: [
|
|
503
501
|
{
|
|
504
|
-
key: `${config.getAppId()}/attachments
|
|
502
|
+
key: `${config.getAppId()}/attachments/test/thing.csv`,
|
|
505
503
|
},
|
|
506
504
|
],
|
|
507
505
|
tableId: table._id,
|
|
@@ -511,7 +509,7 @@ describe("/rows", () => {
|
|
|
511
509
|
context.doInAppContext(config.getAppId(), async () => {
|
|
512
510
|
const enriched = await outputProcessing(table, [row])
|
|
513
511
|
expect(enriched[0].attachment[0].url).toBe(
|
|
514
|
-
`/
|
|
512
|
+
`/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv`
|
|
515
513
|
)
|
|
516
514
|
})
|
|
517
515
|
})
|