@budibase/server 2.2.12-alpha.43 → 2.2.12-alpha.45
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__/node-fetch.ts +2 -0
- package/builder/assets/{index.68e5f22f.js → index.353f1284.js} +392 -386
- package/builder/assets/{index.80229ab4.css → index.f9c1cb26.css} +2 -2
- package/builder/index.html +2 -2
- package/coverage/clover.xml +1872 -1762
- package/coverage/coverage-final.json +83 -78
- package/coverage/lcov-report/index.html +141 -96
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/application.ts.html +158 -137
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +99 -75
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +12 -12
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +69 -69
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/index.html +24 -24
- package/coverage/lcov-report/src/api/controllers/integration.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/layout.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/metadata.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/permission.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/index.html +7 -7
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +70 -46
- package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/role.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/routing.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/row/external.ts.html +11 -14
- package/coverage/lcov-report/src/api/controllers/row/index.html +15 -15
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +21 -24
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +21 -15
- package/coverage/lcov-report/src/api/controllers/table/index.html +13 -13
- package/coverage/lcov-report/src/api/controllers/table/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/user.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +57 -51
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.ts.html +7 -7
- package/coverage/lcov-report/src/api/routes/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/apikeys.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/application.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/auth.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/automation.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/component.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/dev.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/index.html +5 -5
- package/coverage/lcov-report/src/api/routes/index.ts.html +10 -4
- package/coverage/lcov-report/src/api/routes/integration.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/layout.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/metadata.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/permission.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/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 +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/role.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/routing.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/row.ts.html +2 -2
- package/coverage/lcov-report/src/api/routes/screen.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/table.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/templates.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/user.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/view.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/app.ts.html +1 -1
- package/coverage/lcov-report/src/automations/actions.ts.html +1 -1
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +1 -1
- package/coverage/lcov-report/src/automations/bullboard.ts.html +2 -2
- package/coverage/lcov-report/src/automations/index.html +15 -15
- package/coverage/lcov-report/src/automations/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +4 -4
- package/coverage/lcov-report/src/automations/steps/bash.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/delay.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/discord.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/loop.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/slack.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/utils.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +2 -2
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/automations/triggers.ts.html +1 -1
- package/coverage/lcov-report/src/automations/utils.ts.html +21 -21
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +2 -2
- package/coverage/lcov-report/src/constants/layouts.ts.html +1 -1
- package/coverage/lcov-report/src/constants/screens.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +15 -15
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +1 -1
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.ts.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +1 -1
- package/coverage/lcov-report/src/db/newid.ts.html +3 -3
- package/coverage/lcov-report/src/db/utils.ts.html +17 -17
- package/coverage/lcov-report/src/definitions/automations.ts.html +5 -2
- package/coverage/lcov-report/src/definitions/datasource.ts.html +2 -2
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.ts.html +9 -9
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +1 -1
- package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +1 -1
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.ts.html +1 -1
- package/coverage/lcov-report/src/events/utils.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +7 -7
- package/coverage/lcov-report/src/index.ts.html +5 -5
- 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 +11 -11
- package/coverage/lcov-report/src/integrations/base/query.ts.html +13 -7
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +2 -2
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +9 -9
- 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 +1 -1
- package/coverage/lcov-report/src/integrations/index.ts.html +37 -37
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +11 -11
- package/coverage/lcov-report/src/integrations/mysql.ts.html +11 -11
- package/coverage/lcov-report/src/integrations/oracle.ts.html +13 -13
- package/coverage/lcov-report/src/integrations/postgres.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/queries/index.html +19 -19
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +15 -150
- package/coverage/lcov-report/src/integrations/redis.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/rest.ts.html +24 -24
- 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 +2 -2
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/authorized.ts.html +19 -19
- package/coverage/lcov-report/src/middleware/builder.ts.html +13 -13
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +33 -33
- package/coverage/lcov-report/src/middleware/index.html +1 -1
- package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/publicApi.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/resourceId.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/utils.ts.html +3 -3
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/tableSettings.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +18 -18
- package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +7 -7
- package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/datasources/datasources.ts.html +379 -0
- package/coverage/lcov-report/src/sdk/app/datasources/index.html +131 -0
- package/coverage/lcov-report/src/sdk/app/datasources/index.ts.html +100 -0
- package/coverage/lcov-report/src/sdk/app/queries/index.html +131 -0
- package/coverage/lcov-report/src/sdk/app/queries/index.ts.html +100 -0
- package/coverage/lcov-report/src/sdk/app/queries/queries.ts.html +235 -0
- package/coverage/lcov-report/src/sdk/app/rows/attachments.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/rows/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/rows/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/rows/rows.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.html +11 -11
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +18 -9
- package/coverage/lcov-report/src/sdk/index.html +5 -5
- package/coverage/lcov-report/src/sdk/index.ts.html +17 -5
- package/coverage/lcov-report/src/sdk/users/index.html +1 -1
- package/coverage/lcov-report/src/sdk/users/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +20 -20
- package/coverage/lcov-report/src/sdk/utils/index.html +116 -0
- package/coverage/lcov-report/src/sdk/utils/index.ts.html +133 -0
- package/coverage/lcov-report/src/startup.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +89 -80
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +4 -4
- package/coverage/lcov-report/src/tests/utilities/index.html +5 -5
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +4 -4
- package/coverage/lcov-report/src/threads/automation.ts.html +42 -24
- package/coverage/lcov-report/src/threads/index.html +28 -28
- package/coverage/lcov-report/src/threads/index.ts.html +1 -1
- package/coverage/lcov-report/src/threads/query.ts.html +68 -29
- package/coverage/lcov-report/src/threads/utils.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +2 -2
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +11 -11
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +18 -12
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +17 -17
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +5 -8
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/global.ts.html +33 -33
- package/coverage/lcov-report/src/utilities/index.html +16 -16
- package/coverage/lcov-report/src/utilities/index.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/redis.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/schema.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/security.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +1 -1
- package/coverage/lcov-report/src/watch.ts.html +1 -1
- package/coverage/lcov-report/src/websocket.ts.html +3 -3
- package/coverage/lcov.info +2986 -2796
- package/dist/api/controllers/application.js +73 -74
- package/dist/api/controllers/datasource.js +24 -15
- package/dist/api/controllers/query/index.js +18 -11
- package/dist/api/controllers/row/ExternalRequest.js +5 -3
- package/dist/api/controllers/row/external.js +6 -5
- package/dist/api/controllers/row/utils.js +5 -2
- package/dist/api/controllers/static/index.js +38 -38
- package/dist/api/controllers/table/external.js +8 -5
- package/dist/api/controllers/webhook.js +45 -43
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/row.js +2 -2
- package/dist/index.js +2 -2
- package/dist/integrations/base/query.js +7 -2
- package/dist/integrations/base/sqlTable.js +14 -14
- package/dist/integrations/dynamodb.js +8 -5
- package/dist/integrations/mysql.js +2 -2
- package/dist/integrations/queries/sql.js +73 -100
- package/dist/integrations/rest.js +14 -14
- package/dist/package.json +6 -6
- package/dist/sdk/app/datasources/datasources.js +113 -0
- package/dist/sdk/app/datasources/index.js +27 -0
- package/dist/sdk/app/queries/index.js +27 -0
- package/dist/sdk/app/queries/queries.js +60 -0
- package/dist/sdk/app/tables/index.js +6 -2
- package/dist/sdk/index.js +4 -0
- package/dist/sdk/utils/index.js +29 -0
- package/dist/threads/automation.js +9 -2
- package/dist/threads/query.js +27 -13
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/filesystem.js +36 -34
- package/dist/utilities/fileSystem/plugin.js +17 -14
- package/dist/utilities/fileSystem/template.js +7 -4
- package/package.json +7 -7
- package/scripts/dev/manage.js +1 -0
- package/src/api/controllers/application.ts +81 -74
- package/src/api/controllers/datasource.ts +33 -25
- package/src/api/controllers/query/index.ts +47 -39
- package/src/api/controllers/row/ExternalRequest.ts +2 -2
- package/src/api/controllers/row/external.ts +3 -4
- package/src/api/controllers/row/utils.ts +2 -2
- package/src/api/controllers/static/index.ts +17 -18
- package/src/api/controllers/table/external.ts +8 -6
- package/src/api/controllers/webhook.ts +48 -46
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/row.ts +1 -1
- package/src/api/routes/tests/datasource.spec.ts +35 -1
- package/src/definitions/automations.ts +1 -0
- package/src/index.ts +1 -1
- package/src/integrations/base/query.ts +3 -1
- package/src/integrations/base/sqlTable.ts +1 -1
- package/src/integrations/dynamodb.ts +3 -3
- package/src/integrations/mysql.ts +1 -1
- package/src/integrations/queries/sql.ts +5 -50
- package/src/integrations/rest.ts +8 -8
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +10 -6
- package/src/sdk/app/datasources/datasources.ts +98 -0
- package/src/sdk/app/datasources/index.ts +5 -0
- package/src/sdk/app/queries/index.ts +5 -0
- package/src/sdk/app/queries/queries.ts +50 -0
- package/src/sdk/app/tables/index.ts +6 -3
- package/src/sdk/index.ts +4 -0
- package/src/sdk/utils/index.ts +16 -0
- package/src/tests/utilities/TestConfiguration.ts +15 -12
- package/src/threads/automation.ts +9 -3
- package/src/threads/definitions.ts +3 -0
- package/src/threads/query.ts +28 -15
- package/src/utilities/fileSystem/filesystem.ts +6 -4
- package/src/utilities/fileSystem/plugin.ts +3 -4
- package/src/utilities/fileSystem/template.ts +2 -2
|
@@ -13,23 +13,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.deleteFolderFileSystem = exports.findFileRec = exports.extractTarball = exports.createTempFolder = exports.readFileSync = exports.sendTempFile = exports.stringToFileStream = exports.storeTempFile = exports.streamFile = exports.apiFileReturn = exports.loadHandlebarsFile = exports.checkDevelopmentEnvironment = exports.init = exports.TOP_LEVEL_PATH = void 0;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const uuid = require("uuid/v4");
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const budibaseDir_1 = require("../budibaseDir");
|
|
18
|
+
const path_1 = require("path");
|
|
20
19
|
const environment_1 = __importDefault(require("../../environment"));
|
|
21
20
|
const tar_1 = __importDefault(require("tar"));
|
|
22
|
-
|
|
21
|
+
const uuid = require("uuid/v4");
|
|
22
|
+
exports.TOP_LEVEL_PATH = (0, path_1.join)(__dirname, "..", "..", "..");
|
|
23
23
|
/**
|
|
24
24
|
* Upon first startup of instance there may not be everything we need in tmp directory, set it up.
|
|
25
25
|
*/
|
|
26
26
|
const init = () => {
|
|
27
|
-
const tempDir = budibaseTempDir();
|
|
28
|
-
if (!
|
|
27
|
+
const tempDir = (0, budibaseDir_1.budibaseTempDir)();
|
|
28
|
+
if (!fs_1.default.existsSync(tempDir)) {
|
|
29
29
|
// some test cases fire this quickly enough that
|
|
30
30
|
// synchronous cases can end up here at the same time
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
fs_1.default.mkdirSync(tempDir);
|
|
33
33
|
}
|
|
34
34
|
catch (err) {
|
|
35
35
|
if (!err || err.code !== "EEXIST") {
|
|
@@ -37,9 +37,9 @@ const init = () => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const clientLibPath = join(budibaseTempDir(), "budibase-client.js");
|
|
41
|
-
if (environment_1.default.isTest() && !
|
|
42
|
-
|
|
40
|
+
const clientLibPath = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "budibase-client.js");
|
|
41
|
+
if (environment_1.default.isTest() && !fs_1.default.existsSync(clientLibPath)) {
|
|
42
|
+
fs_1.default.copyFileSync(require.resolve("@budibase/client"), clientLibPath);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
exports.init = init;
|
|
@@ -51,11 +51,11 @@ const checkDevelopmentEnvironment = () => {
|
|
|
51
51
|
if (!environment_1.default.isDev() || environment_1.default.isTest()) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (!
|
|
55
|
-
|
|
54
|
+
if (!fs_1.default.existsSync((0, budibaseDir_1.budibaseTempDir)())) {
|
|
55
|
+
fs_1.default.mkdirSync((0, budibaseDir_1.budibaseTempDir)());
|
|
56
56
|
}
|
|
57
57
|
let error;
|
|
58
|
-
if (!
|
|
58
|
+
if (!fs_1.default.existsSync((0, path_1.join)(process.cwd(), ".env"))) {
|
|
59
59
|
error = "Must run via yarn once to generate environment.";
|
|
60
60
|
}
|
|
61
61
|
if (error) {
|
|
@@ -72,7 +72,7 @@ exports.checkDevelopmentEnvironment = checkDevelopmentEnvironment;
|
|
|
72
72
|
* @returns {string} The loaded handlebars file as a string - loaded as utf8.
|
|
73
73
|
*/
|
|
74
74
|
const loadHandlebarsFile = (path) => {
|
|
75
|
-
return
|
|
75
|
+
return fs_1.default.readFileSync(path, "utf8");
|
|
76
76
|
};
|
|
77
77
|
exports.loadHandlebarsFile = loadHandlebarsFile;
|
|
78
78
|
/**
|
|
@@ -82,13 +82,13 @@ exports.loadHandlebarsFile = loadHandlebarsFile;
|
|
|
82
82
|
* @return {Object} the read stream which can be put into the koa context body.
|
|
83
83
|
*/
|
|
84
84
|
const apiFileReturn = (contents) => {
|
|
85
|
-
const path = join(budibaseTempDir(), uuid());
|
|
86
|
-
|
|
87
|
-
return
|
|
85
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), uuid());
|
|
86
|
+
fs_1.default.writeFileSync(path, contents);
|
|
87
|
+
return fs_1.default.createReadStream(path);
|
|
88
88
|
};
|
|
89
89
|
exports.apiFileReturn = apiFileReturn;
|
|
90
90
|
const streamFile = (path) => {
|
|
91
|
-
return
|
|
91
|
+
return fs_1.default.createReadStream(path);
|
|
92
92
|
};
|
|
93
93
|
exports.streamFile = streamFile;
|
|
94
94
|
/**
|
|
@@ -97,8 +97,8 @@ exports.streamFile = streamFile;
|
|
|
97
97
|
* @return {string} the path to the temp file.
|
|
98
98
|
*/
|
|
99
99
|
const storeTempFile = (fileContents) => {
|
|
100
|
-
const path = join(budibaseTempDir(), uuid());
|
|
101
|
-
|
|
100
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), uuid());
|
|
101
|
+
fs_1.default.writeFileSync(path, fileContents);
|
|
102
102
|
return path;
|
|
103
103
|
};
|
|
104
104
|
exports.storeTempFile = storeTempFile;
|
|
@@ -108,7 +108,7 @@ exports.storeTempFile = storeTempFile;
|
|
|
108
108
|
*/
|
|
109
109
|
const stringToFileStream = (contents) => {
|
|
110
110
|
const path = (0, exports.storeTempFile)(contents);
|
|
111
|
-
return
|
|
111
|
+
return fs_1.default.createReadStream(path);
|
|
112
112
|
};
|
|
113
113
|
exports.stringToFileStream = stringToFileStream;
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ exports.stringToFileStream = stringToFileStream;
|
|
|
117
117
|
*/
|
|
118
118
|
const sendTempFile = (fileContents) => {
|
|
119
119
|
const path = (0, exports.storeTempFile)(fileContents);
|
|
120
|
-
return
|
|
120
|
+
return fs_1.default.createReadStream(path);
|
|
121
121
|
};
|
|
122
122
|
exports.sendTempFile = sendTempFile;
|
|
123
123
|
/**
|
|
@@ -125,17 +125,18 @@ exports.sendTempFile = sendTempFile;
|
|
|
125
125
|
* allows a centralised location to check logic is all good.
|
|
126
126
|
*/
|
|
127
127
|
const readFileSync = (filepath, options = "utf8") => {
|
|
128
|
-
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
return fs_1.default.readFileSync(filepath, options);
|
|
129
130
|
};
|
|
130
131
|
exports.readFileSync = readFileSync;
|
|
131
132
|
const createTempFolder = (item) => {
|
|
132
|
-
const path = join(budibaseTempDir(), item);
|
|
133
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), item);
|
|
133
134
|
try {
|
|
134
135
|
// remove old tmp directories automatically - don't combine
|
|
135
|
-
if (
|
|
136
|
-
|
|
136
|
+
if (fs_1.default.existsSync(path)) {
|
|
137
|
+
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
fs_1.default.mkdirSync(path);
|
|
139
140
|
}
|
|
140
141
|
catch (err) {
|
|
141
142
|
throw new Error(`Path cannot be created: ${err.message}`);
|
|
@@ -154,13 +155,14 @@ exports.extractTarball = extractTarball;
|
|
|
154
155
|
* Find for a file recursively from start path applying filter, return first match
|
|
155
156
|
*/
|
|
156
157
|
const findFileRec = (startPath, filter) => {
|
|
157
|
-
if (!
|
|
158
|
+
if (!fs_1.default.existsSync(startPath)) {
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
|
-
const files =
|
|
161
|
+
const files = fs_1.default.readdirSync(startPath);
|
|
161
162
|
for (let i = 0, len = files.length; i < len; i++) {
|
|
162
|
-
|
|
163
|
-
const
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
const filename = (0, path_1.join)(startPath, files[i]);
|
|
165
|
+
const stat = fs_1.default.lstatSync(filename);
|
|
164
166
|
if (stat.isDirectory()) {
|
|
165
167
|
return (0, exports.findFileRec)(filename, filter);
|
|
166
168
|
}
|
|
@@ -174,9 +176,9 @@ exports.findFileRec = findFileRec;
|
|
|
174
176
|
* Remove a folder which is not empty from the file system
|
|
175
177
|
*/
|
|
176
178
|
const deleteFolderFileSystem = (path) => {
|
|
177
|
-
if (!
|
|
179
|
+
if (!fs_1.default.existsSync(path)) {
|
|
178
180
|
return;
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
181
183
|
};
|
|
182
184
|
exports.deleteFolderFileSystem = deleteFolderFileSystem;
|
|
@@ -8,18 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.getDatasourcePlugin = exports.getPluginMetadata = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
+
const budibaseDir_1 = require("../budibaseDir");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = require("path");
|
|
16
19
|
const backend_core_1 = require("@budibase/backend-core");
|
|
17
|
-
const DATASOURCE_PATH = join(budibaseTempDir(), "datasource");
|
|
20
|
+
const DATASOURCE_PATH = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "datasource");
|
|
18
21
|
const getPluginMetadata = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
22
|
let metadata = {};
|
|
20
23
|
try {
|
|
21
|
-
const pkg =
|
|
22
|
-
const schema =
|
|
24
|
+
const pkg = fs_1.default.readFileSync((0, path_1.join)(path, "package.json"), "utf8");
|
|
25
|
+
const schema = fs_1.default.readFileSync((0, path_1.join)(path, "schema.json"), "utf8");
|
|
23
26
|
metadata.schema = JSON.parse(schema);
|
|
24
27
|
metadata.package = JSON.parse(pkg);
|
|
25
28
|
if (!metadata.package.name ||
|
|
@@ -37,13 +40,13 @@ exports.getPluginMetadata = getPluginMetadata;
|
|
|
37
40
|
const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
41
|
var _a;
|
|
39
42
|
const hash = (_a = plugin.schema) === null || _a === void 0 ? void 0 : _a.hash;
|
|
40
|
-
if (!
|
|
41
|
-
|
|
43
|
+
if (!fs_1.default.existsSync(DATASOURCE_PATH)) {
|
|
44
|
+
fs_1.default.mkdirSync(DATASOURCE_PATH);
|
|
42
45
|
}
|
|
43
|
-
const filename = join(DATASOURCE_PATH, plugin.name);
|
|
46
|
+
const filename = (0, path_1.join)(DATASOURCE_PATH, plugin.name);
|
|
44
47
|
const metadataName = `${filename}.bbmetadata`;
|
|
45
|
-
if (
|
|
46
|
-
const currentHash =
|
|
48
|
+
if (fs_1.default.existsSync(filename)) {
|
|
49
|
+
const currentHash = fs_1.default.readFileSync(metadataName, "utf8");
|
|
47
50
|
// if hash is the same return the file, otherwise remove it and re-download
|
|
48
51
|
if (currentHash === hash) {
|
|
49
52
|
return require(filename);
|
|
@@ -51,13 +54,13 @@ const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, functi
|
|
|
51
54
|
else {
|
|
52
55
|
console.log(`Updating plugin: ${plugin.name}`);
|
|
53
56
|
delete require.cache[require.resolve(filename)];
|
|
54
|
-
|
|
57
|
+
fs_1.default.unlinkSync(filename);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
const pluginKey = backend_core_1.objectStore.getPluginJSKey(plugin);
|
|
58
61
|
const pluginJs = yield backend_core_1.objectStore.retrieve(backend_core_1.objectStore.ObjectStoreBuckets.PLUGINS, pluginKey);
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
fs_1.default.writeFileSync(filename, pluginJs);
|
|
63
|
+
fs_1.default.writeFileSync(metadataName, hash);
|
|
61
64
|
return require(filename);
|
|
62
65
|
});
|
|
63
66
|
exports.getDatasourcePlugin = getDatasourcePlugin;
|
|
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.downloadTemplate = exports.getTemplateStream = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = require("path");
|
|
15
18
|
const constants_1 = require("../../constants");
|
|
16
19
|
const backend_core_1 = require("@budibase/backend-core");
|
|
17
20
|
/**
|
|
@@ -21,12 +24,12 @@ const backend_core_1 = require("@budibase/backend-core");
|
|
|
21
24
|
*/
|
|
22
25
|
const getTemplateStream = (template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
26
|
if (template.file) {
|
|
24
|
-
return
|
|
27
|
+
return fs_1.default.createReadStream(template.file.path);
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
30
|
const [type, name] = template.key.split("/");
|
|
28
31
|
const tmpPath = yield (0, exports.downloadTemplate)(type, name);
|
|
29
|
-
return
|
|
32
|
+
return fs_1.default.createReadStream((0, path_1.join)(tmpPath, name, "db", "dump.txt"));
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
35
|
exports.getTemplateStream = getTemplateStream;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.2.12-alpha.
|
|
4
|
+
"version": "2.2.12-alpha.45",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "2.2.12-alpha.
|
|
47
|
-
"@budibase/client": "2.2.12-alpha.
|
|
48
|
-
"@budibase/pro": "2.2.12-alpha.
|
|
49
|
-
"@budibase/string-templates": "2.2.12-alpha.
|
|
50
|
-
"@budibase/types": "2.2.12-alpha.
|
|
46
|
+
"@budibase/backend-core": "2.2.12-alpha.45",
|
|
47
|
+
"@budibase/client": "2.2.12-alpha.45",
|
|
48
|
+
"@budibase/pro": "2.2.12-alpha.44",
|
|
49
|
+
"@budibase/string-templates": "2.2.12-alpha.45",
|
|
50
|
+
"@budibase/types": "2.2.12-alpha.45",
|
|
51
51
|
"@bull-board/api": "3.7.0",
|
|
52
52
|
"@bull-board/koa": "3.9.4",
|
|
53
53
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"optionalDependencies": {
|
|
170
170
|
"oracledb": "5.3.0"
|
|
171
171
|
},
|
|
172
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "93274fcdf05bf53c3bbe47d3bf3297912c9c56d0"
|
|
173
173
|
}
|
package/scripts/dev/manage.js
CHANGED
|
@@ -29,6 +29,7 @@ async function init() {
|
|
|
29
29
|
ACCOUNT_PORTAL_URL: "http://localhost:10001",
|
|
30
30
|
ACCOUNT_PORTAL_API_KEY: "budibase",
|
|
31
31
|
JWT_SECRET: "testsecret",
|
|
32
|
+
ENCRYPTION_KEY: "testsecret",
|
|
32
33
|
REDIS_PASSWORD: "budibase",
|
|
33
34
|
MINIO_ACCESS_KEY: "budibase",
|
|
34
35
|
MINIO_SECRET_KEY: "budibase",
|
|
@@ -112,12 +112,11 @@ function checkAppName(
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async function createInstance(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
async function createInstance(
|
|
116
|
+
appId: string,
|
|
117
|
+
template: any,
|
|
118
|
+
includeSampleData: boolean
|
|
119
|
+
) {
|
|
121
120
|
const db = context.getAppDB()
|
|
122
121
|
await db.put({
|
|
123
122
|
_id: "_design/database",
|
|
@@ -250,82 +249,90 @@ async function performAppCreate(ctx: BBContext) {
|
|
|
250
249
|
instanceConfig.file = ctx.request.files.templateFile
|
|
251
250
|
}
|
|
252
251
|
const includeSampleData = isQsTrue(ctx.request.body.sampleData)
|
|
253
|
-
const
|
|
254
|
-
const appId =
|
|
255
|
-
const db = context.getAppDB()
|
|
252
|
+
const tenantId = tenancy.isMultiTenant() ? tenancy.getTenantId() : null
|
|
253
|
+
const appId = generateDevAppID(generateAppID(tenantId))
|
|
256
254
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
name: name,
|
|
265
|
-
url: url,
|
|
266
|
-
template: templateKey,
|
|
267
|
-
instance,
|
|
268
|
-
tenantId: tenancy.getTenantId(),
|
|
269
|
-
updatedAt: new Date().toISOString(),
|
|
270
|
-
createdAt: new Date().toISOString(),
|
|
271
|
-
status: AppStatus.DEV,
|
|
272
|
-
navigation: {
|
|
273
|
-
navigation: "Top",
|
|
274
|
-
title: name,
|
|
275
|
-
navWidth: "Large",
|
|
276
|
-
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
277
|
-
links: [
|
|
278
|
-
{
|
|
279
|
-
url: "/home",
|
|
280
|
-
text: "Home",
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
},
|
|
284
|
-
theme: "spectrum--light",
|
|
285
|
-
customTheme: {
|
|
286
|
-
buttonBorderRadius: "16px",
|
|
287
|
-
},
|
|
288
|
-
}
|
|
255
|
+
return await context.doInAppContext(appId, async () => {
|
|
256
|
+
const instance = await createInstance(
|
|
257
|
+
appId,
|
|
258
|
+
instanceConfig,
|
|
259
|
+
includeSampleData
|
|
260
|
+
)
|
|
261
|
+
const db = context.getAppDB()
|
|
289
262
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
263
|
+
let newApplication: App = {
|
|
264
|
+
_id: DocumentType.APP_METADATA,
|
|
265
|
+
_rev: undefined,
|
|
266
|
+
appId,
|
|
267
|
+
type: "app",
|
|
268
|
+
version: packageJson.version,
|
|
269
|
+
componentLibraries: ["@budibase/standard-components"],
|
|
270
|
+
name: name,
|
|
271
|
+
url: url,
|
|
272
|
+
template: templateKey,
|
|
273
|
+
instance,
|
|
274
|
+
tenantId: tenancy.getTenantId(),
|
|
275
|
+
updatedAt: new Date().toISOString(),
|
|
276
|
+
createdAt: new Date().toISOString(),
|
|
277
|
+
status: AppStatus.DEV,
|
|
278
|
+
navigation: {
|
|
279
|
+
navigation: "Top",
|
|
280
|
+
title: name,
|
|
281
|
+
navWidth: "Large",
|
|
282
|
+
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
283
|
+
links: [
|
|
284
|
+
{
|
|
285
|
+
url: "/home",
|
|
286
|
+
text: "Home",
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
theme: "spectrum--light",
|
|
291
|
+
customTheme: {
|
|
292
|
+
buttonBorderRadius: "16px",
|
|
293
|
+
},
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// If we used a template or imported an app there will be an existing doc.
|
|
297
|
+
// Fetch and migrate some metadata from the existing app.
|
|
298
|
+
try {
|
|
299
|
+
const existing: App = await db.get(DocumentType.APP_METADATA)
|
|
300
|
+
const keys: (keyof App)[] = [
|
|
301
|
+
"_rev",
|
|
302
|
+
"navigation",
|
|
303
|
+
"theme",
|
|
304
|
+
"customTheme",
|
|
305
|
+
"icon",
|
|
306
|
+
]
|
|
307
|
+
keys.forEach(key => {
|
|
308
|
+
if (existing[key]) {
|
|
309
|
+
// @ts-ignore
|
|
310
|
+
newApplication[key] = existing[key]
|
|
311
|
+
}
|
|
312
|
+
})
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
// Migrate navigation settings and screens if required
|
|
315
|
+
if (existing) {
|
|
316
|
+
const navigation = await migrateAppNavigation()
|
|
317
|
+
if (navigation) {
|
|
318
|
+
newApplication.navigation = navigation
|
|
319
|
+
}
|
|
313
320
|
}
|
|
321
|
+
} catch (err) {
|
|
322
|
+
// Nothing to do
|
|
314
323
|
}
|
|
315
|
-
} catch (err) {
|
|
316
|
-
// Nothing to do
|
|
317
|
-
}
|
|
318
324
|
|
|
319
|
-
|
|
320
|
-
|
|
325
|
+
const response = await db.put(newApplication, { force: true })
|
|
326
|
+
newApplication._rev = response.rev
|
|
321
327
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
328
|
+
/* istanbul ignore next */
|
|
329
|
+
if (!env.isTest()) {
|
|
330
|
+
await createApp(appId)
|
|
331
|
+
}
|
|
326
332
|
|
|
327
|
-
|
|
328
|
-
|
|
333
|
+
await cache.app.invalidateAppMetadata(appId, newApplication)
|
|
334
|
+
return newApplication
|
|
335
|
+
})
|
|
329
336
|
}
|
|
330
337
|
|
|
331
338
|
async function creationEvents(request: any, app: App) {
|
|
@@ -12,9 +12,11 @@ import { getIntegration } from "../../integrations"
|
|
|
12
12
|
import { getDatasourceAndQuery } from "./row/utils"
|
|
13
13
|
import { invalidateDynamicVariables } from "../../threads/utils"
|
|
14
14
|
import { db as dbCore, context, events } from "@budibase/backend-core"
|
|
15
|
-
import {
|
|
15
|
+
import { UserCtx, Datasource, Row } from "@budibase/types"
|
|
16
|
+
import sdk from "../../sdk"
|
|
17
|
+
import { mergeConfigs } from "../../sdk/app/datasources/datasources"
|
|
16
18
|
|
|
17
|
-
export async function fetch(ctx:
|
|
19
|
+
export async function fetch(ctx: UserCtx) {
|
|
18
20
|
// Get internal tables
|
|
19
21
|
const db = context.getAppDB()
|
|
20
22
|
const internalTables = await db.allDocs(
|
|
@@ -43,25 +45,23 @@ export async function fetch(ctx: BBContext) {
|
|
|
43
45
|
)
|
|
44
46
|
).rows.map(row => row.doc)
|
|
45
47
|
|
|
46
|
-
const allDatasources =
|
|
48
|
+
const allDatasources: Datasource[] = await sdk.datasources.removeSecrets([
|
|
49
|
+
bbInternalDb,
|
|
50
|
+
...datasources,
|
|
51
|
+
])
|
|
47
52
|
|
|
48
53
|
for (let datasource of allDatasources) {
|
|
49
|
-
if (datasource.config && datasource.config.auth) {
|
|
50
|
-
// strip secrets from response so they don't show in the network request
|
|
51
|
-
delete datasource.config.auth
|
|
52
|
-
}
|
|
53
|
-
|
|
54
54
|
if (datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE) {
|
|
55
|
-
datasource.entities = internal[datasource._id]
|
|
55
|
+
datasource.entities = internal[datasource._id!]
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
ctx.body = [bbInternalDb, ...datasources]
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export async function buildSchemaFromDb(ctx:
|
|
62
|
+
export async function buildSchemaFromDb(ctx: UserCtx) {
|
|
63
63
|
const db = context.getAppDB()
|
|
64
|
-
const datasource = await
|
|
64
|
+
const datasource = await sdk.datasources.get(ctx.params.datasourceId)
|
|
65
65
|
const tablesFilter = ctx.request.body.tablesFilter
|
|
66
66
|
|
|
67
67
|
let { tables, error } = await buildSchemaHelper(datasource)
|
|
@@ -146,11 +146,11 @@ async function invalidateVariables(
|
|
|
146
146
|
await invalidateDynamicVariables(toInvalidate)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
export async function update(ctx:
|
|
149
|
+
export async function update(ctx: UserCtx) {
|
|
150
150
|
const db = context.getAppDB()
|
|
151
151
|
const datasourceId = ctx.params.datasourceId
|
|
152
|
-
let datasource = await
|
|
153
|
-
const auth = datasource.config
|
|
152
|
+
let datasource = await sdk.datasources.get(datasourceId)
|
|
153
|
+
const auth = datasource.config?.auth
|
|
154
154
|
await invalidateVariables(datasource, ctx.request.body)
|
|
155
155
|
|
|
156
156
|
const isBudibaseSource = datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE
|
|
@@ -159,10 +159,13 @@ export async function update(ctx: BBContext) {
|
|
|
159
159
|
? { name: ctx.request.body?.name }
|
|
160
160
|
: ctx.request.body
|
|
161
161
|
|
|
162
|
-
datasource = {
|
|
162
|
+
datasource = {
|
|
163
|
+
...datasource,
|
|
164
|
+
...sdk.datasources.mergeConfigs(dataSourceBody, datasource),
|
|
165
|
+
}
|
|
163
166
|
if (auth && !ctx.request.body.auth) {
|
|
164
167
|
// don't strip auth config from DB
|
|
165
|
-
datasource.config
|
|
168
|
+
datasource.config!.auth = auth
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
const response = await db.put(datasource)
|
|
@@ -179,10 +182,12 @@ export async function update(ctx: BBContext) {
|
|
|
179
182
|
|
|
180
183
|
ctx.status = 200
|
|
181
184
|
ctx.message = "Datasource saved successfully."
|
|
182
|
-
ctx.body = {
|
|
185
|
+
ctx.body = {
|
|
186
|
+
datasource: await sdk.datasources.removeSecretSingle(datasource),
|
|
187
|
+
}
|
|
183
188
|
}
|
|
184
189
|
|
|
185
|
-
export async function save(ctx:
|
|
190
|
+
export async function save(ctx: UserCtx) {
|
|
186
191
|
const db = context.getAppDB()
|
|
187
192
|
const plus = ctx.request.body.datasource.plus
|
|
188
193
|
const fetchSchema = ctx.request.body.fetchSchema
|
|
@@ -213,7 +218,9 @@ export async function save(ctx: BBContext) {
|
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
|
|
216
|
-
const response: any = {
|
|
221
|
+
const response: any = {
|
|
222
|
+
datasource: await sdk.datasources.removeSecretSingle(datasource),
|
|
223
|
+
}
|
|
217
224
|
if (schemaError) {
|
|
218
225
|
response.error = schemaError
|
|
219
226
|
}
|
|
@@ -251,11 +258,11 @@ async function destroyInternalTablesBySourceId(datasourceId: string) {
|
|
|
251
258
|
}
|
|
252
259
|
}
|
|
253
260
|
|
|
254
|
-
export async function destroy(ctx:
|
|
261
|
+
export async function destroy(ctx: UserCtx) {
|
|
255
262
|
const db = context.getAppDB()
|
|
256
263
|
const datasourceId = ctx.params.datasourceId
|
|
257
264
|
|
|
258
|
-
const datasource = await
|
|
265
|
+
const datasource = await sdk.datasources.get(datasourceId)
|
|
259
266
|
// Delete all queries for the datasource
|
|
260
267
|
|
|
261
268
|
if (datasource.type === dbCore.BUDIBASE_DATASOURCE_TYPE) {
|
|
@@ -279,13 +286,14 @@ export async function destroy(ctx: BBContext) {
|
|
|
279
286
|
ctx.status = 200
|
|
280
287
|
}
|
|
281
288
|
|
|
282
|
-
export async function find(ctx:
|
|
289
|
+
export async function find(ctx: UserCtx) {
|
|
283
290
|
const database = context.getAppDB()
|
|
284
|
-
|
|
291
|
+
const datasource = await database.get(ctx.params.datasourceId)
|
|
292
|
+
ctx.body = await sdk.datasources.removeSecretSingle(datasource)
|
|
285
293
|
}
|
|
286
294
|
|
|
287
295
|
// dynamic query functionality
|
|
288
|
-
export async function query(ctx:
|
|
296
|
+
export async function query(ctx: UserCtx) {
|
|
289
297
|
const queryJson = ctx.request.body
|
|
290
298
|
try {
|
|
291
299
|
ctx.body = await getDatasourceAndQuery(queryJson)
|
|
@@ -313,7 +321,7 @@ function updateError(error: any, newError: any, tables: string[]) {
|
|
|
313
321
|
|
|
314
322
|
async function buildSchemaHelper(datasource: Datasource) {
|
|
315
323
|
const Connector = await getIntegration(datasource.source)
|
|
316
|
-
|
|
324
|
+
datasource = await sdk.datasources.enrich(datasource)
|
|
317
325
|
// Connect to the DB and build the schema
|
|
318
326
|
const connector = new Connector(datasource.config)
|
|
319
327
|
await connector.buildSchema(datasource._id, datasource.entities)
|