@budibase/server 2.1.32-alpha.5 → 2.1.32-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.192baaa3.js → index.e0fdcf54.js} +184 -184
- package/builder/index.html +1 -1
- package/coverage/clover.xml +3112 -3177
- package/coverage/coverage-final.json +105 -106
- package/coverage/lcov-report/index.html +145 -145
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{apikeys.js.html → apikeys.ts.html} +19 -19
- package/coverage/lcov-report/src/api/controllers/application.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/{automation.js.html → automation.ts.html} +68 -68
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{cloud.js.html → cloud.ts.html} +40 -40
- package/coverage/lcov-report/src/api/controllers/component.ts.html +6 -3
- package/coverage/lcov-report/src/api/controllers/{datasource.js.html → datasource.ts.html} +100 -79
- package/coverage/lcov-report/src/api/controllers/deploy/{Deployment.js.html → Deployment.ts.html} +30 -21
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +6 -6
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/index.html +108 -108
- package/coverage/lcov-report/src/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{layout.js.html → layout.ts.html} +19 -19
- package/coverage/lcov-report/src/api/controllers/{metadata.js.html → metadata.ts.html} +19 -16
- package/coverage/lcov-report/src/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/{permission.js.html → permission.ts.html} +73 -64
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +11 -11
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +10 -13
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +1 -1
- 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 +3 -3
- 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 +11 -11
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +8 -11
- 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 +2 -2
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/{validation.js.html → validation.ts.html} +10 -10
- package/coverage/lcov-report/src/api/controllers/{role.js.html → role.ts.html} +37 -49
- package/coverage/lcov-report/src/api/controllers/{routing.js.html → routing.ts.html} +58 -49
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +6 -18
- package/coverage/lcov-report/src/api/controllers/row/external.js.html +4 -4
- package/coverage/lcov-report/src/api/controllers/row/index.html +35 -35
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/internal.js.html +17 -20
- package/coverage/lcov-report/src/api/controllers/row/{internalSearch.js.html → internalSearch.ts.html} +175 -103
- package/coverage/lcov-report/src/api/controllers/row/{staticFormula.js.html → staticFormula.ts.html} +62 -47
- package/coverage/lcov-report/src/api/controllers/row/{utils.js.html → utils.ts.html} +57 -36
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +29 -17
- package/coverage/lcov-report/src/api/controllers/{script.js.html → script.ts.html} +10 -7
- package/coverage/lcov-report/src/api/controllers/static/index.html +10 -10
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +15 -27
- package/coverage/lcov-report/src/api/controllers/table/{bulkFormula.js.html → bulkFormula.ts.html} +89 -47
- package/coverage/lcov-report/src/api/controllers/table/{external.js.html → external.ts.html} +192 -87
- package/coverage/lcov-report/src/api/controllers/table/index.html +39 -39
- package/coverage/lcov-report/src/api/controllers/table/{index.js.html → index.ts.html} +28 -28
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +3 -6
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/{templates.js.html → templates.ts.html} +27 -18
- package/coverage/lcov-report/src/api/controllers/{user.js.html → user.ts.html} +72 -78
- package/coverage/lcov-report/src/api/controllers/view/{exporters.js.html → exporters.ts.html} +13 -7
- package/coverage/lcov-report/src/api/controllers/view/index.html +21 -21
- package/coverage/lcov-report/src/api/controllers/view/{index.js.html → index.ts.html} +68 -41
- package/coverage/lcov-report/src/api/controllers/view/{utils.js.html → utils.ts.html} +54 -36
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +1 -1
- package/coverage/lcov-report/src/api/index.html +14 -14
- package/coverage/lcov-report/src/api/{index.js.html → index.ts.html} +28 -49
- package/coverage/lcov-report/src/api/routes/{analytics.js.html → analytics.ts.html} +7 -7
- package/coverage/lcov-report/src/api/routes/{apikeys.js.html → apikeys.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/application.ts.html +35 -11
- package/coverage/lcov-report/src/api/routes/auth.ts.html +3 -3
- package/coverage/lcov-report/src/api/routes/{automation.js.html → automation.ts.html} +41 -35
- package/coverage/lcov-report/src/api/routes/backup.ts.html +18 -6
- package/coverage/lcov-report/src/api/routes/{deploy.js.html → cloud.ts.html} +18 -15
- package/coverage/lcov-report/src/api/routes/{component.js.html → component.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/{datasource.js.html → datasource.ts.html} +53 -26
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +148 -0
- package/coverage/lcov-report/src/api/routes/{dev.js.html → dev.ts.html} +54 -18
- package/coverage/lcov-report/src/api/routes/index.html +41 -41
- package/coverage/lcov-report/src/api/routes/index.ts.html +3 -3
- package/coverage/lcov-report/src/api/routes/integration.ts.html +133 -0
- package/coverage/lcov-report/src/api/routes/{layout.js.html → layout.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/{metadata.js.html → metadata.ts.html} +17 -17
- package/coverage/lcov-report/src/api/routes/{migrations.js.html → migrations.ts.html} +12 -12
- package/coverage/lcov-report/src/api/routes/{permission.js.html → permission.ts.html} +41 -17
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +32 -8
- 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/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.js.html → query.ts.html} +24 -33
- package/coverage/lcov-report/src/{utilities/routing/index.js.html → api/routes/role.ts.html} +32 -35
- package/coverage/lcov-report/src/api/routes/{routing.js.html → routing.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/row.ts.html +8 -14
- package/coverage/lcov-report/src/api/routes/{screen.js.html → screen.ts.html} +29 -14
- package/coverage/lcov-report/src/api/routes/{script.js.html → script.ts.html} +10 -10
- package/coverage/lcov-report/src/api/routes/static.ts.html +9 -18
- package/coverage/lcov-report/src/api/routes/{table.js.html → table.ts.html} +16 -25
- package/coverage/lcov-report/src/api/routes/{templates.js.html → templates.ts.html} +11 -11
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +12 -18
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +10 -10
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/api/routes/{user.js.html → user.ts.html} +14 -20
- package/coverage/lcov-report/src/api/routes/utils/index.html +6 -6
- package/coverage/lcov-report/src/api/routes/utils/{validators.js.html → validators.ts.html} +39 -51
- package/coverage/lcov-report/src/api/routes/{view.js.html → view.ts.html} +33 -24
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +3 -3
- package/coverage/lcov-report/src/app.ts.html +9 -12
- package/coverage/lcov-report/src/automations/actions.js.html +1 -1
- package/coverage/lcov-report/src/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/src/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/src/automations/index.html +10 -10
- package/coverage/lcov-report/src/automations/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +1 -1
- package/coverage/lcov-report/src/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/index.html +1 -1
- package/coverage/lcov-report/src/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/src/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/src/automations/triggers.js.html +11 -14
- package/coverage/lcov-report/src/automations/utils.ts.html +1 -1
- package/coverage/lcov-report/src/constants/index.html +5 -5
- package/coverage/lcov-report/src/constants/index.js.html +7 -13
- package/coverage/lcov-report/src/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/src/constants/screens.js.html +3 -3
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/employeeImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/expensesImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.js.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/jobsImport.js.html +1 -1
- package/coverage/lcov-report/src/db/dynamoClient.js.html +1 -1
- package/coverage/lcov-report/src/db/inMemoryView.js.html +4 -4
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/LinkController.js.html +3 -3
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.js.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.js.html +3 -3
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.js.html +4 -4
- package/coverage/lcov-report/src/db/newid.js.html +1 -1
- package/coverage/lcov-report/src/db/utils.ts.html +2 -2
- package/coverage/lcov-report/src/definitions/automations.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/datasource.ts.html +1 -1
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.js.html +1 -1
- package/coverage/lcov-report/src/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.js.html +1 -1
- package/coverage/lcov-report/src/events/utils.js.html +1 -1
- package/coverage/lcov-report/src/index.html +17 -32
- package/coverage/lcov-report/src/index.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/airtable.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/index.html +1 -1
- package/coverage/lcov-report/src/integrations/base/query.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +2 -2
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +2 -2
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/firebase.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/index.html +4 -4
- package/coverage/lcov-report/src/integrations/index.ts.html +58 -46
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/mysql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/oracle.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/postgres.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/redis.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/rest.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/s3.ts.html +1 -1
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/authorized.ts.html +30 -51
- package/coverage/lcov-report/src/middleware/builder.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/index.html +10 -10
- 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 +1 -1
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +3 -3
- 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/usageQuotas/index.html +9 -9
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +7 -10
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +7 -10
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +4 -4
- 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/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 +16 -10
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +9 -21
- package/coverage/lcov-report/src/sdk/app/backups/index.html +16 -16
- 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/tables/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +1 -1
- package/coverage/lcov-report/src/startup.ts.html +3 -3
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.js.html +61 -49
- package/coverage/lcov-report/src/tests/utilities/controllers.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/index.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.js.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.js.html +9 -12
- package/coverage/lcov-report/src/threads/automation.ts.html +20 -23
- package/coverage/lcov-report/src/threads/index.html +24 -24
- package/coverage/lcov-report/src/threads/index.ts.html +1 -1
- package/coverage/lcov-report/src/threads/query.ts.html +18 -33
- package/coverage/lcov-report/src/threads/utils.ts.html +10 -13
- package/coverage/lcov-report/src/utilities/{budibaseDir.js.html → budibaseDir.ts.html} +5 -5
- package/coverage/lcov-report/src/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/src/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.js.html +13 -13
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +5 -20
- package/coverage/lcov-report/src/utilities/fileSystem/index.js.html +16 -16
- package/coverage/lcov-report/src/utilities/fileSystem/processor.js.html +1 -1
- package/coverage/lcov-report/src/utilities/global.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/index.html +44 -44
- package/coverage/lcov-report/src/utilities/{index.js.html → index.ts.html} +68 -44
- package/coverage/lcov-report/src/utilities/plugins.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/src/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/src/utilities/{redis.js.html → redis.ts.html} +36 -33
- package/coverage/lcov-report/src/utilities/routing/index.html +6 -6
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +181 -0
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +38 -23
- package/coverage/lcov-report/src/utilities/rowProcessor/{index.js.html → index.ts.html} +106 -337
- package/coverage/lcov-report/src/utilities/rowProcessor/map.js.html +370 -0
- package/coverage/lcov-report/src/utilities/rowProcessor/{utils.js.html → utils.ts.html} +43 -31
- package/coverage/lcov-report/src/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{security.js.html → security.ts.html} +49 -67
- package/coverage/lcov-report/src/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +18 -18
- package/coverage/lcov-report/src/utilities/usageQuota/{rows.js.html → rows.ts.html} +27 -39
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/src/utilities/{users.js.html → users.ts.html} +22 -28
- package/coverage/lcov-report/src/utilities/{workerRequests.js.html → workerRequests.ts.html} +69 -54
- package/coverage/lcov-report/src/watch.ts.html +8 -11
- package/coverage/lcov-report/src/websocket.ts.html +1 -1
- package/coverage/lcov.info +5519 -5768
- package/dist/api/controllers/apikeys.js +12 -9
- package/dist/api/controllers/automation.js +104 -84
- package/dist/api/controllers/cloud.js +84 -71
- package/dist/api/controllers/component.js +4 -2
- package/dist/api/controllers/datasource.js +125 -111
- package/dist/api/controllers/deploy/Deployment.js +10 -6
- package/dist/api/controllers/layout.js +18 -15
- package/dist/api/controllers/metadata.js +51 -37
- package/dist/api/controllers/permission.js +52 -43
- package/dist/api/controllers/plugin/index.js +6 -7
- package/dist/api/controllers/public/tables.js +29 -9
- package/dist/api/controllers/query/import/index.js +1 -2
- package/dist/api/controllers/query/validation.js +41 -33
- package/dist/api/controllers/role.js +29 -27
- package/dist/api/controllers/routing.js +71 -58
- package/dist/api/controllers/row/ExternalRequest.js +6 -7
- package/dist/api/controllers/row/external.js +3 -3
- package/dist/api/controllers/row/internal.js +11 -12
- package/dist/api/controllers/row/internalSearch.js +95 -80
- package/dist/api/controllers/row/staticFormula.js +85 -75
- package/dist/api/controllers/row/utils.js +118 -84
- package/dist/api/controllers/screen.js +81 -66
- package/dist/api/controllers/script.js +13 -6
- package/dist/api/controllers/static/index.js +9 -11
- package/dist/api/controllers/table/bulkFormula.js +47 -35
- package/dist/api/controllers/table/external.js +67 -54
- package/dist/api/controllers/table/index.js +66 -33
- package/dist/api/controllers/table/internal.js +1 -2
- package/dist/api/controllers/table/utils.js +8 -9
- package/dist/api/controllers/templates.js +17 -10
- package/dist/api/controllers/user.js +82 -70
- package/dist/api/controllers/view/exporters.js +8 -4
- package/dist/api/controllers/view/index.js +201 -153
- package/dist/api/controllers/view/utils.js +151 -121
- package/dist/api/index.js +38 -34
- package/dist/api/routes/analytics.js +29 -3
- package/dist/api/routes/apikeys.js +33 -7
- package/dist/api/routes/application.js +8 -9
- package/dist/api/routes/auth.js +1 -2
- package/dist/api/routes/automation.js +46 -20
- package/dist/api/routes/backup.js +3 -4
- package/dist/api/routes/cloud.js +32 -6
- package/dist/api/routes/component.js +32 -6
- package/dist/api/routes/datasource.js +39 -13
- package/dist/api/routes/deploy.js +34 -8
- package/dist/api/routes/dev.js +36 -10
- package/dist/api/routes/integration.js +10 -7
- package/dist/api/routes/layout.js +33 -7
- package/dist/api/routes/metadata.js +36 -10
- package/dist/api/routes/migrations.js +32 -6
- package/dist/api/routes/permission.js +38 -12
- package/dist/api/routes/plugin.js +5 -5
- package/dist/api/routes/query.js +42 -15
- package/dist/api/routes/role.js +36 -10
- package/dist/api/routes/routing.js +32 -6
- package/dist/api/routes/row.js +2 -1
- package/dist/api/routes/screen.js +35 -9
- package/dist/api/routes/script.js +32 -6
- package/dist/api/routes/static.js +9 -9
- package/dist/api/routes/table.js +40 -13
- package/dist/api/routes/templates.js +33 -7
- package/dist/api/routes/tests/utilities/TestFunctions.js +6 -8
- package/dist/api/routes/user.js +40 -13
- package/dist/api/routes/utils/validators.js +142 -126
- package/dist/api/routes/view.js +38 -12
- package/dist/api/routes/webhook.js +1 -2
- package/dist/app.js +3 -4
- package/dist/automations/triggers.js +5 -6
- package/dist/constants/index.js +3 -5
- package/dist/constants/screens.js +2 -2
- package/dist/db/inMemoryView.js +3 -3
- package/dist/db/linkedRows/LinkController.js +2 -2
- package/dist/db/linkedRows/index.js +2 -2
- package/dist/db/linkedRows/linkUtils.js +3 -3
- package/dist/db/views/staticViews.js +4 -4
- package/dist/integrations/index.js +15 -6
- package/dist/middleware/authorized.js +22 -21
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/usageQuotas/syncApps.js +3 -4
- package/dist/migrations/functions/usageQuotas/syncRows.js +3 -4
- package/dist/migrations/functions/userEmailViewCasing.js +3 -3
- package/dist/package.json +6 -6
- package/dist/sdk/app/backups/exports.js +1 -2
- package/dist/sdk/app/backups/imports.js +2 -3
- package/dist/startup.js +4 -4
- package/dist/tests/utilities/TestConfiguration.js +27 -35
- package/dist/tests/utilities/structures.js +3 -4
- package/dist/threads/automation.js +15 -16
- package/dist/threads/query.js +17 -19
- package/dist/threads/utils.js +11 -9
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/budibaseDir.js +4 -2
- package/dist/utilities/fileSystem/clientLibrary.js +12 -12
- package/dist/utilities/fileSystem/index.js +3 -3
- package/dist/utilities/index.js +102 -75
- package/dist/utilities/redis.js +100 -65
- package/dist/utilities/routing/index.js +27 -23
- package/dist/utilities/rowProcessor/index.js +124 -191
- package/dist/utilities/rowProcessor/map.js +96 -0
- package/dist/utilities/rowProcessor/utils.js +35 -26
- package/dist/utilities/security.js +39 -35
- package/dist/utilities/usageQuota/rows.js +56 -49
- package/dist/utilities/users.js +31 -28
- package/dist/utilities/workerRequests.js +115 -82
- package/dist/watch.js +1 -2
- package/package.json +7 -7
- package/scripts/exportAppTemplate.js +2 -2
- package/src/api/controllers/{apikeys.js → apikeys.ts} +10 -10
- package/src/api/controllers/auth.ts +2 -2
- package/src/api/controllers/{automation.js → automation.ts} +48 -48
- package/src/api/controllers/{cloud.js → cloud.ts} +24 -24
- package/src/api/controllers/component.ts +2 -1
- package/src/api/controllers/{datasource.js → datasource.ts} +55 -48
- package/src/api/controllers/deploy/{Deployment.js → Deployment.ts} +13 -10
- package/src/api/controllers/{layout.js → layout.ts} +8 -8
- package/src/api/controllers/{metadata.js → metadata.ts} +11 -10
- package/src/api/controllers/{permission.js → permission.ts} +49 -46
- package/src/api/controllers/plugin/index.ts +4 -5
- package/src/api/controllers/public/tables.ts +2 -2
- package/src/api/controllers/query/import/index.ts +2 -3
- package/src/api/controllers/query/{validation.js → validation.ts} +7 -7
- package/src/api/controllers/{role.js → role.ts} +21 -25
- package/src/api/controllers/{routing.js → routing.ts} +37 -34
- package/src/api/controllers/row/ExternalRequest.ts +4 -8
- package/src/api/controllers/row/external.js +3 -3
- package/src/api/controllers/row/internal.js +11 -12
- package/src/api/controllers/row/{internalSearch.js → internalSearch.ts} +92 -68
- package/src/api/controllers/row/{staticFormula.js → staticFormula.ts} +28 -23
- package/src/api/controllers/row/{utils.js → utils.ts} +25 -18
- package/src/api/controllers/screen.ts +10 -6
- package/src/api/controllers/script.ts +12 -0
- package/src/api/controllers/static/index.ts +9 -13
- package/src/api/controllers/table/{bulkFormula.js → bulkFormula.ts} +39 -25
- package/src/api/controllers/table/{external.js → external.ts} +86 -51
- package/src/api/controllers/table/{index.js → index.ts} +17 -17
- package/src/api/controllers/table/internal.ts +1 -2
- package/src/api/controllers/table/utils.ts +10 -10
- package/src/api/controllers/{templates.js → templates.ts} +10 -7
- package/src/api/controllers/{user.js → user.ts} +47 -49
- package/src/api/controllers/view/{exporters.js → exporters.ts} +5 -3
- package/src/api/controllers/view/{index.js → index.ts} +36 -27
- package/src/api/controllers/view/{utils.js → utils.ts} +26 -20
- package/src/api/{index.js → index.ts} +15 -22
- package/src/api/routes/analytics.ts +9 -0
- package/src/api/routes/apikeys.ts +12 -0
- package/src/api/routes/application.ts +17 -9
- package/src/api/routes/auth.ts +2 -2
- package/src/api/routes/automation.ts +87 -0
- package/src/api/routes/backup.ts +8 -4
- package/src/api/routes/cloud.ts +18 -0
- package/src/api/routes/component.ts +14 -0
- package/src/api/routes/datasource.ts +60 -0
- package/src/api/routes/deploy.ts +21 -0
- package/src/api/routes/dev.ts +38 -0
- package/src/api/routes/integration.ts +16 -0
- package/src/api/routes/layout.ts +16 -0
- package/src/api/routes/{metadata.js → metadata.ts} +13 -13
- package/src/api/routes/migrations.ts +14 -0
- package/src/api/routes/permission.ts +41 -0
- package/src/api/routes/plugin.ts +14 -6
- package/src/api/routes/{query.js → query.ts} +17 -20
- package/src/api/routes/role.ts +24 -0
- package/src/api/routes/routing.ts +14 -0
- package/src/api/routes/row.ts +3 -5
- package/src/api/routes/screen.ts +23 -0
- package/src/api/routes/script.ts +10 -0
- package/src/api/routes/static.ts +4 -7
- package/src/api/routes/{table.js → table.ts} +9 -12
- package/src/api/routes/templates.ts +16 -0
- package/src/api/routes/tests/backup.spec.js +9 -1
- package/src/api/routes/tests/permissions.spec.js +2 -1
- package/src/api/routes/tests/role.spec.js +3 -5
- package/src/api/routes/tests/routing.spec.js +2 -1
- package/src/api/routes/tests/row.spec.js +3 -4
- package/src/api/routes/tests/user.spec.js +2 -1
- package/src/api/routes/tests/utilities/TestFunctions.ts +6 -8
- package/src/api/routes/{user.js → user.ts} +7 -9
- package/src/api/routes/utils/{validators.js → validators.ts} +33 -37
- package/src/api/routes/view.ts +34 -0
- package/src/api/routes/webhook.ts +2 -2
- package/src/app.ts +3 -4
- package/src/automations/triggers.js +5 -6
- package/src/constants/index.js +3 -5
- package/src/constants/screens.js +2 -2
- package/src/db/inMemoryView.js +3 -3
- package/src/db/linkedRows/LinkController.js +2 -2
- package/src/db/linkedRows/index.js +2 -2
- package/src/db/linkedRows/linkUtils.js +3 -3
- package/src/db/utils.ts +1 -1
- package/src/db/views/staticViews.js +4 -4
- package/src/integrations/base/sql.ts +1 -1
- package/src/integrations/base/sqlTable.ts +1 -1
- package/src/integrations/index.ts +45 -41
- package/src/middleware/authorized.ts +21 -28
- package/src/middleware/tests/authorized.spec.js +5 -6
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/tests/appUrls.spec.js +4 -4
- package/src/migrations/functions/tests/userEmailViewCasing.spec.js +14 -9
- package/src/migrations/functions/usageQuotas/syncApps.ts +3 -4
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -4
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +7 -7
- package/src/migrations/functions/userEmailViewCasing.ts +3 -3
- package/src/sdk/app/backups/exports.ts +5 -3
- package/src/sdk/app/backups/imports.ts +3 -7
- package/src/startup.ts +2 -2
- package/src/tests/utilities/TestConfiguration.js +39 -35
- package/src/tests/utilities/structures.js +3 -4
- package/src/threads/automation.ts +14 -15
- package/src/threads/query.ts +11 -16
- package/src/threads/utils.ts +4 -5
- package/src/utilities/budibaseDir.ts +3 -0
- package/src/utilities/fileSystem/clientLibrary.js +12 -12
- package/src/utilities/fileSystem/index.js +8 -8
- package/src/utilities/{index.js → index.ts} +40 -32
- package/src/utilities/{redis.js → redis.ts} +21 -20
- package/src/utilities/routing/index.ts +32 -0
- package/src/utilities/rowProcessor/{index.js → index.ts} +65 -142
- package/src/utilities/rowProcessor/map.js +95 -0
- package/src/utilities/rowProcessor/{utils.js → utils.ts} +19 -15
- package/src/utilities/security.ts +65 -0
- package/src/utilities/usageQuota/{rows.js → rows.ts} +14 -18
- package/src/utilities/{users.js → users.ts} +11 -13
- package/src/utilities/{workerRequests.js → workerRequests.ts} +43 -38
- package/src/watch.ts +2 -3
- package/coverage/lcov-report/src/api/routes/cloud.js.html +0 -127
- package/coverage/lcov-report/src/api/routes/integration.js.html +0 -121
- package/coverage/lcov-report/src/api/routes/role.js.html +0 -130
- package/coverage/lcov-report/src/module.d.ts.html +0 -127
- package/coverage/lcov-report/src/utilities/fileSystem/utilities.js.html +0 -193
- package/dist/utilities/fileSystem/utilities.js +0 -22
- package/src/api/controllers/script.js +0 -11
- package/src/api/routes/analytics.js +0 -9
- package/src/api/routes/apikeys.js +0 -12
- package/src/api/routes/automation.js +0 -85
- package/src/api/routes/cloud.js +0 -14
- package/src/api/routes/component.js +0 -14
- package/src/api/routes/datasource.js +0 -51
- package/src/api/routes/deploy.js +0 -17
- package/src/api/routes/dev.js +0 -26
- package/src/api/routes/integration.js +0 -12
- package/src/api/routes/layout.js +0 -16
- package/src/api/routes/migrations.js +0 -14
- package/src/api/routes/permission.js +0 -33
- package/src/api/routes/role.js +0 -15
- package/src/api/routes/routing.js +0 -14
- package/src/api/routes/screen.js +0 -18
- package/src/api/routes/script.js +0 -10
- package/src/api/routes/templates.js +0 -16
- package/src/api/routes/view.js +0 -31
- package/src/module.d.ts +0 -14
- package/src/utilities/budibaseDir.js +0 -3
- package/src/utilities/fileSystem/utilities.js +0 -36
- package/src/utilities/routing/index.js +0 -25
- package/src/utilities/security.js +0 -71
|
@@ -23,11 +23,9 @@ const { clientLibraryPath } = require("../../../utilities");
|
|
|
23
23
|
const { upload, deleteFiles } = require("../../../utilities/fileSystem");
|
|
24
24
|
const { attachmentsRelativeURL } = require("../../../utilities");
|
|
25
25
|
const { DocumentType } = require("../../../db/utils");
|
|
26
|
-
const {
|
|
27
|
-
const { setCookie, clearCookie } = require("@budibase/backend-core/utils");
|
|
26
|
+
const { context, objectStore, utils } = require("@budibase/backend-core");
|
|
28
27
|
const AWS = require("aws-sdk");
|
|
29
28
|
const fs = require("fs");
|
|
30
|
-
const { downloadTarballDirect, } = require("../../../utilities/fileSystem/utilities");
|
|
31
29
|
function prepareUpload({ s3Key, bucket, metadata, file }) {
|
|
32
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
31
|
const response = yield upload({
|
|
@@ -51,7 +49,7 @@ const toggleBetaUiFeature = function (ctx) {
|
|
|
51
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
50
|
const cookieName = `beta:${ctx.params.feature}`;
|
|
53
51
|
if (ctx.cookies.get(cookieName)) {
|
|
54
|
-
clearCookie(ctx, cookieName);
|
|
52
|
+
utils.clearCookie(ctx, cookieName);
|
|
55
53
|
ctx.body = {
|
|
56
54
|
message: `${ctx.params.feature} disabled`,
|
|
57
55
|
};
|
|
@@ -62,8 +60,8 @@ const toggleBetaUiFeature = function (ctx) {
|
|
|
62
60
|
if (!fs.existsSync(builderPath)) {
|
|
63
61
|
fs.mkdirSync(builderPath);
|
|
64
62
|
}
|
|
65
|
-
yield downloadTarballDirect("https://cdn.budi.live/beta:design_ui/new_ui.tar.gz", builderPath);
|
|
66
|
-
setCookie(ctx, {}, cookieName);
|
|
63
|
+
yield objectStore.downloadTarballDirect("https://cdn.budi.live/beta:design_ui/new_ui.tar.gz", builderPath);
|
|
64
|
+
utils.setCookie(ctx, {}, cookieName);
|
|
67
65
|
ctx.body = {
|
|
68
66
|
message: `${ctx.params.feature} enabled`,
|
|
69
67
|
};
|
|
@@ -104,9 +102,9 @@ const deleteObjects = function (ctx) {
|
|
|
104
102
|
exports.deleteObjects = deleteObjects;
|
|
105
103
|
const serveApp = function (ctx) {
|
|
106
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
const db = getAppDB({ skip_setup: true });
|
|
105
|
+
const db = context.getAppDB({ skip_setup: true });
|
|
108
106
|
const appInfo = yield db.get(DocumentType.APP_METADATA);
|
|
109
|
-
let appId = getAppId();
|
|
107
|
+
let appId = context.getAppId();
|
|
110
108
|
if (!env.isJest()) {
|
|
111
109
|
const App = require("./templates/BudibaseApp.svelte").default;
|
|
112
110
|
const plugins = (0, plugins_1.enrichPluginURLs)(appInfo.usedPlugins);
|
|
@@ -135,10 +133,10 @@ const serveApp = function (ctx) {
|
|
|
135
133
|
exports.serveApp = serveApp;
|
|
136
134
|
const serveBuilderPreview = function (ctx) {
|
|
137
135
|
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
-
const db = getAppDB({ skip_setup: true });
|
|
136
|
+
const db = context.getAppDB({ skip_setup: true });
|
|
139
137
|
const appInfo = yield db.get(DocumentType.APP_METADATA);
|
|
140
138
|
if (!env.isJest()) {
|
|
141
|
-
let appId = getAppId();
|
|
139
|
+
let appId = context.getAppId();
|
|
142
140
|
const previewHbs = loadHandlebarsFile(`${__dirname}/templates/preview.hbs`);
|
|
143
141
|
ctx.body = yield processString(previewHbs, {
|
|
144
142
|
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
|
|
@@ -162,7 +160,7 @@ exports.serveClientLibrary = serveClientLibrary;
|
|
|
162
160
|
const getSignedUploadURL = function (ctx) {
|
|
163
161
|
var _a, _b, _c, _d;
|
|
164
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
-
const database = getAppDB();
|
|
163
|
+
const database = context.getAppDB();
|
|
166
164
|
// Ensure datasource is valid
|
|
167
165
|
let datasource;
|
|
168
166
|
try {
|
|
@@ -8,17 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.runStaticFormulaChecks = void 0;
|
|
16
|
+
const constants_1 = require("../../../constants");
|
|
17
|
+
const utils_1 = require("./utils");
|
|
18
|
+
const string_templates_1 = require("@budibase/string-templates");
|
|
19
|
+
const fp_1 = require("lodash/fp");
|
|
20
|
+
const lodash_1 = require("lodash");
|
|
21
|
+
const staticFormula_1 = require("../row/staticFormula");
|
|
22
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
23
|
+
const sdk_1 = __importDefault(require("../../../sdk"));
|
|
19
24
|
function isStaticFormula(column) {
|
|
20
|
-
return (column.type === FieldTypes.FORMULA &&
|
|
21
|
-
column.formulaType === FormulaTypes.STATIC);
|
|
25
|
+
return (column.type === constants_1.FieldTypes.FORMULA &&
|
|
26
|
+
column.formulaType === constants_1.FormulaTypes.STATIC);
|
|
22
27
|
}
|
|
23
28
|
/**
|
|
24
29
|
* This retrieves the formula columns from a table schema that use a specified column name
|
|
@@ -33,7 +38,7 @@ function getFormulaThatUseColumn(table, columnNames) {
|
|
|
33
38
|
if (!isStaticFormula(column)) {
|
|
34
39
|
continue;
|
|
35
40
|
}
|
|
36
|
-
if (!doesContainStrings((_a = column === null || column === void 0 ? void 0 : column.formula) !== null && _a !== void 0 ? _a : "", columnNames)) {
|
|
41
|
+
if (!(0, string_templates_1.doesContainStrings)((_a = column === null || column === void 0 ? void 0 : column.formula) !== null && _a !== void 0 ? _a : "", columnNames)) {
|
|
37
42
|
continue;
|
|
38
43
|
}
|
|
39
44
|
formula.push(column.name);
|
|
@@ -47,19 +52,22 @@ function getFormulaThatUseColumn(table, columnNames) {
|
|
|
47
52
|
function checkIfFormulaNeedsCleared(table, { oldTable, deletion }) {
|
|
48
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
54
|
// start by retrieving all tables, remove the current table from the list
|
|
50
|
-
const tables = (yield
|
|
55
|
+
const tables = (yield sdk_1.default.tables.getAllInternalTables()).filter(tbl => tbl._id !== table._id);
|
|
51
56
|
const schemaToUse = oldTable ? oldTable.schema : table.schema;
|
|
52
57
|
let removedColumns = Object.values(schemaToUse).filter(column => deletion || !table.schema[column.name]);
|
|
53
58
|
// remove any formula columns that used related columns
|
|
54
59
|
for (let removed of removedColumns) {
|
|
55
60
|
let tableToUse = table;
|
|
56
61
|
// if relationship, get the related table
|
|
57
|
-
if (removed.type === FieldTypes.LINK) {
|
|
62
|
+
if (removed.type === constants_1.FieldTypes.LINK) {
|
|
58
63
|
tableToUse = tables.find(table => table._id === removed.tableId);
|
|
59
64
|
}
|
|
65
|
+
if (!tableToUse) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
60
68
|
const columnsToDelete = getFormulaThatUseColumn(tableToUse, removed.name);
|
|
61
69
|
if (columnsToDelete.length > 0) {
|
|
62
|
-
yield clearColumns(table, columnsToDelete);
|
|
70
|
+
yield (0, utils_1.clearColumns)(table, columnsToDelete);
|
|
63
71
|
}
|
|
64
72
|
// need a special case, where a column has been removed from this table, but was used
|
|
65
73
|
// in a different, related tables formula
|
|
@@ -71,7 +79,7 @@ function checkIfFormulaNeedsCleared(table, { oldTable, deletion }) {
|
|
|
71
79
|
const relatedTable = tables.find(table => table._id === relatedTableId);
|
|
72
80
|
// look to see if the column was used in a relationship formula,
|
|
73
81
|
// relationships won't be used for this
|
|
74
|
-
if (relatedTable && relatedColumns && removed.type !== FieldTypes.LINK) {
|
|
82
|
+
if (relatedTable && relatedColumns && removed.type !== constants_1.FieldTypes.LINK) {
|
|
75
83
|
let relatedFormulaToRemove = [];
|
|
76
84
|
for (let column of relatedColumns) {
|
|
77
85
|
relatedFormulaToRemove = relatedFormulaToRemove.concat(getFormulaThatUseColumn(relatedTable, [
|
|
@@ -80,7 +88,7 @@ function checkIfFormulaNeedsCleared(table, { oldTable, deletion }) {
|
|
|
80
88
|
]));
|
|
81
89
|
}
|
|
82
90
|
if (relatedFormulaToRemove.length > 0) {
|
|
83
|
-
yield clearColumns(relatedTable, uniq(relatedFormulaToRemove));
|
|
91
|
+
yield (0, utils_1.clearColumns)(relatedTable, (0, lodash_1.uniq)(relatedFormulaToRemove));
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
}
|
|
@@ -93,21 +101,22 @@ function checkIfFormulaNeedsCleared(table, { oldTable, deletion }) {
|
|
|
93
101
|
* can manage hydrating related rows formula fields. This is
|
|
94
102
|
* specifically only for static formula.
|
|
95
103
|
*/
|
|
96
|
-
function updateRelatedFormulaLinksOnTables(table, { deletion } = {
|
|
104
|
+
function updateRelatedFormulaLinksOnTables(table, { deletion } = {}) {
|
|
97
105
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
-
const
|
|
106
|
+
const tableId = table._id;
|
|
107
|
+
const db = backend_core_1.context.getAppDB();
|
|
99
108
|
// start by retrieving all tables, remove the current table from the list
|
|
100
|
-
const tables = (yield
|
|
109
|
+
const tables = (yield sdk_1.default.tables.getAllInternalTables()).filter(tbl => tbl._id !== tableId);
|
|
101
110
|
// clone the tables, so we can compare at end
|
|
102
|
-
const initialTables = cloneDeep(tables);
|
|
111
|
+
const initialTables = (0, fp_1.cloneDeep)(tables);
|
|
103
112
|
// first find the related column names
|
|
104
|
-
const relatedColumns = Object.values(table.schema).filter(col => col.type === FieldTypes.LINK);
|
|
113
|
+
const relatedColumns = Object.values(table.schema).filter(col => col.type === constants_1.FieldTypes.LINK);
|
|
105
114
|
// we start by removing the formula field from all tables
|
|
106
115
|
for (let otherTable of tables) {
|
|
107
116
|
if (!otherTable.relatedFormula) {
|
|
108
117
|
continue;
|
|
109
118
|
}
|
|
110
|
-
const index = otherTable.relatedFormula.indexOf(
|
|
119
|
+
const index = otherTable.relatedFormula.indexOf(tableId);
|
|
111
120
|
if (index !== -1) {
|
|
112
121
|
otherTable.relatedFormula.splice(index, 1);
|
|
113
122
|
}
|
|
@@ -123,17 +132,17 @@ function updateRelatedFormulaLinksOnTables(table, { deletion } = { deletion: fal
|
|
|
123
132
|
// check if the table is already in the list of related formula, if it isn't, then add it
|
|
124
133
|
if (relatedTable &&
|
|
125
134
|
(!relatedTable.relatedFormula ||
|
|
126
|
-
!relatedTable.relatedFormula.includes(
|
|
135
|
+
!relatedTable.relatedFormula.includes(tableId))) {
|
|
127
136
|
relatedTable.relatedFormula = relatedTable.relatedFormula
|
|
128
|
-
? [...relatedTable.relatedFormula,
|
|
129
|
-
: [
|
|
137
|
+
? [...relatedTable.relatedFormula, tableId]
|
|
138
|
+
: [tableId];
|
|
130
139
|
}
|
|
131
140
|
}
|
|
132
141
|
}
|
|
133
142
|
// now we just need to compare all the tables and see if any need saved
|
|
134
143
|
for (let initial of initialTables) {
|
|
135
144
|
const found = tables.find(tbl => initial._id === tbl._id);
|
|
136
|
-
if (found && !isEqual(initial, found)) {
|
|
145
|
+
if (found && !(0, lodash_1.isEqual)(initial, found)) {
|
|
137
146
|
yield db.put(found);
|
|
138
147
|
}
|
|
139
148
|
}
|
|
@@ -145,17 +154,20 @@ function checkIfFormulaUpdated(table, { oldTable }) {
|
|
|
145
154
|
const shouldUpdate = Object.values(table.schema).find(column => isStaticFormula(column) &&
|
|
146
155
|
(!oldTable ||
|
|
147
156
|
!oldTable.schema[column.name] ||
|
|
148
|
-
!isEqual(oldTable.schema[column.name], column)));
|
|
157
|
+
!(0, lodash_1.isEqual)(oldTable.schema[column.name], column)));
|
|
149
158
|
// if a static formula column has updated, then need to run the update
|
|
150
159
|
if (shouldUpdate != null) {
|
|
151
|
-
yield updateAllFormulasInTable(table);
|
|
160
|
+
yield (0, staticFormula_1.updateAllFormulasInTable)(table);
|
|
152
161
|
}
|
|
153
162
|
});
|
|
154
163
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
164
|
+
function runStaticFormulaChecks(table, { oldTable, deletion }) {
|
|
165
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
yield updateRelatedFormulaLinksOnTables(table, { deletion });
|
|
167
|
+
yield checkIfFormulaNeedsCleared(table, { oldTable, deletion });
|
|
168
|
+
if (!deletion) {
|
|
169
|
+
yield checkIfFormulaUpdated(table, { oldTable });
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
exports.runStaticFormulaChecks = runStaticFormulaChecks;
|
|
@@ -8,17 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.bulkImport = exports.destroy = exports.save = void 0;
|
|
16
|
+
const utils_1 = require("../../../integrations/utils");
|
|
17
|
+
const utils_2 = require("./utils");
|
|
18
|
+
const constants_1 = require("../../../constants");
|
|
19
|
+
const query_1 = require("../../../integrations/base/query");
|
|
20
|
+
const csvParser_1 = __importDefault(require("../../../utilities/csvParser"));
|
|
21
|
+
const external_1 = require("../row/external");
|
|
22
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
23
|
+
const types_1 = require("@budibase/types");
|
|
24
|
+
const sdk_1 = __importDefault(require("../../../sdk"));
|
|
15
25
|
const { cloneDeep } = require("lodash/fp");
|
|
16
|
-
|
|
17
|
-
const { handleRequest } = require("../row/external");
|
|
18
|
-
const { getAppDB } = require("@budibase/backend-core/context");
|
|
19
|
-
const { events } = require("@budibase/backend-core");
|
|
20
|
-
const sdk = require("../../../sdk");
|
|
21
|
-
function makeTableRequest(datasource, operation, table, tables, oldTable = null, renamed = null) {
|
|
26
|
+
function makeTableRequest(datasource, operation, table, tables, oldTable, renamed) {
|
|
22
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
28
|
const json = {
|
|
24
29
|
endpoint: {
|
|
@@ -37,14 +42,14 @@ function makeTableRequest(datasource, operation, table, tables, oldTable = null,
|
|
|
37
42
|
if (renamed) {
|
|
38
43
|
json.meta.renamed = renamed;
|
|
39
44
|
}
|
|
40
|
-
return makeExternalQuery(datasource, json);
|
|
45
|
+
return (0, query_1.makeExternalQuery)(datasource, json);
|
|
41
46
|
});
|
|
42
47
|
}
|
|
43
|
-
function cleanupRelationships(table, tables, oldTable
|
|
48
|
+
function cleanupRelationships(table, tables, oldTable) {
|
|
44
49
|
const tableToIterate = oldTable ? oldTable : table;
|
|
45
50
|
// clean up relationships in couch table schemas
|
|
46
51
|
for (let [key, schema] of Object.entries(tableToIterate.schema)) {
|
|
47
|
-
if (schema.type === FieldTypes.LINK &&
|
|
52
|
+
if (schema.type === constants_1.FieldTypes.LINK &&
|
|
48
53
|
(!oldTable || table.schema[key] == null)) {
|
|
49
54
|
const relatedTable = Object.values(tables).find(table => table._id === schema.tableId);
|
|
50
55
|
const foreignKey = schema.foreignKey;
|
|
@@ -52,7 +57,7 @@ function cleanupRelationships(table, tables, oldTable = null) {
|
|
|
52
57
|
continue;
|
|
53
58
|
}
|
|
54
59
|
for (let [relatedKey, relatedSchema] of Object.entries(relatedTable.schema)) {
|
|
55
|
-
if (relatedSchema.type === FieldTypes.LINK &&
|
|
60
|
+
if (relatedSchema.type === constants_1.FieldTypes.LINK &&
|
|
56
61
|
relatedSchema.fieldName === foreignKey) {
|
|
57
62
|
delete relatedTable.schema[relatedKey];
|
|
58
63
|
}
|
|
@@ -67,32 +72,35 @@ function getDatasourceId(table) {
|
|
|
67
72
|
if (table.sourceId) {
|
|
68
73
|
return table.sourceId;
|
|
69
74
|
}
|
|
70
|
-
return breakExternalTableId(table._id).datasourceId;
|
|
75
|
+
return (0, utils_1.breakExternalTableId)(table._id).datasourceId;
|
|
71
76
|
}
|
|
72
77
|
function otherRelationshipType(type) {
|
|
73
|
-
if (type === RelationshipTypes.MANY_TO_MANY) {
|
|
74
|
-
return RelationshipTypes.MANY_TO_MANY;
|
|
78
|
+
if (type === constants_1.RelationshipTypes.MANY_TO_MANY) {
|
|
79
|
+
return constants_1.RelationshipTypes.MANY_TO_MANY;
|
|
75
80
|
}
|
|
76
|
-
return type === RelationshipTypes.ONE_TO_MANY
|
|
77
|
-
? RelationshipTypes.MANY_TO_ONE
|
|
78
|
-
: RelationshipTypes.ONE_TO_MANY;
|
|
81
|
+
return type === constants_1.RelationshipTypes.ONE_TO_MANY
|
|
82
|
+
? constants_1.RelationshipTypes.MANY_TO_ONE
|
|
83
|
+
: constants_1.RelationshipTypes.ONE_TO_MANY;
|
|
79
84
|
}
|
|
80
85
|
function generateManyLinkSchema(datasource, column, table, relatedTable) {
|
|
86
|
+
if (!table.primary || !relatedTable.primary) {
|
|
87
|
+
throw new Error("Unable to generate many link schema, no primary keys");
|
|
88
|
+
}
|
|
81
89
|
const primary = table.name + table.primary[0];
|
|
82
90
|
const relatedPrimary = relatedTable.name + relatedTable.primary[0];
|
|
83
|
-
const jcTblName = generateJunctionTableName(column, table, relatedTable);
|
|
91
|
+
const jcTblName = (0, utils_2.generateJunctionTableName)(column, table, relatedTable);
|
|
84
92
|
// first create the new table
|
|
85
93
|
const junctionTable = {
|
|
86
|
-
_id: buildExternalTableId(datasource._id, jcTblName),
|
|
94
|
+
_id: (0, utils_1.buildExternalTableId)(datasource._id, jcTblName),
|
|
87
95
|
name: jcTblName,
|
|
88
96
|
primary: [primary, relatedPrimary],
|
|
89
97
|
constrained: [primary, relatedPrimary],
|
|
90
98
|
schema: {
|
|
91
|
-
[primary]: foreignKeyStructure(primary, {
|
|
99
|
+
[primary]: (0, utils_2.foreignKeyStructure)(primary, {
|
|
92
100
|
toTable: table.name,
|
|
93
101
|
toKey: table.primary[0],
|
|
94
102
|
}),
|
|
95
|
-
[relatedPrimary]: foreignKeyStructure(relatedPrimary, {
|
|
103
|
+
[relatedPrimary]: (0, utils_2.foreignKeyStructure)(relatedPrimary, {
|
|
96
104
|
toTable: relatedTable.name,
|
|
97
105
|
toKey: relatedTable.primary[0],
|
|
98
106
|
}),
|
|
@@ -105,10 +113,13 @@ function generateManyLinkSchema(datasource, column, table, relatedTable) {
|
|
|
105
113
|
return junctionTable;
|
|
106
114
|
}
|
|
107
115
|
function generateLinkSchema(column, table, relatedTable, type) {
|
|
108
|
-
|
|
116
|
+
if (!table.primary || !relatedTable.primary) {
|
|
117
|
+
throw new Error("Unable to generate link schema, no primary keys");
|
|
118
|
+
}
|
|
119
|
+
const isOneSide = type === constants_1.RelationshipTypes.ONE_TO_MANY;
|
|
109
120
|
const primary = isOneSide ? relatedTable.primary[0] : table.primary[0];
|
|
110
121
|
// generate a foreign key
|
|
111
|
-
const foreignKey = generateForeignKey(column, relatedTable);
|
|
122
|
+
const foreignKey = (0, utils_2.generateForeignKey)(column, relatedTable);
|
|
112
123
|
column.relationshipType = type;
|
|
113
124
|
column.foreignKey = isOneSide ? foreignKey : primary;
|
|
114
125
|
column.fieldName = isOneSide ? primary : foreignKey;
|
|
@@ -137,10 +148,10 @@ function generateRelatedSchema(linkColumn, table, relatedTable, columnName) {
|
|
|
137
148
|
function isRelationshipSetup(column) {
|
|
138
149
|
return column.foreignKey || column.through;
|
|
139
150
|
}
|
|
140
|
-
|
|
151
|
+
function save(ctx) {
|
|
141
152
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
153
|
const table = ctx.request.body;
|
|
143
|
-
const
|
|
154
|
+
const renamed = table === null || table === void 0 ? void 0 : table._rename;
|
|
144
155
|
// can't do this right now
|
|
145
156
|
delete table.dataImport;
|
|
146
157
|
const datasourceId = getDatasourceId(ctx.request.body);
|
|
@@ -148,28 +159,31 @@ exports.save = function (ctx) {
|
|
|
148
159
|
if (!table._id) {
|
|
149
160
|
table.created = true;
|
|
150
161
|
}
|
|
151
|
-
let tableToSave = Object.assign({ type: "table", _id: buildExternalTableId(datasourceId, table.name) }, table);
|
|
162
|
+
let tableToSave = Object.assign({ type: "table", _id: (0, utils_1.buildExternalTableId)(datasourceId, table.name) }, table);
|
|
152
163
|
let oldTable;
|
|
153
164
|
if (ctx.request.body && ctx.request.body._id) {
|
|
154
|
-
oldTable = yield
|
|
165
|
+
oldTable = yield sdk_1.default.tables.getTable(ctx.request.body._id);
|
|
155
166
|
}
|
|
156
|
-
if (hasTypeChanged(tableToSave, oldTable)) {
|
|
167
|
+
if ((0, utils_2.hasTypeChanged)(tableToSave, oldTable)) {
|
|
157
168
|
ctx.throw(400, "A column type has changed.");
|
|
158
169
|
}
|
|
159
|
-
const db = getAppDB();
|
|
170
|
+
const db = backend_core_1.context.getAppDB();
|
|
160
171
|
const datasource = yield db.get(datasourceId);
|
|
161
172
|
const oldTables = cloneDeep(datasource.entities);
|
|
162
173
|
const tables = datasource.entities;
|
|
163
174
|
const extraTablesToUpdate = [];
|
|
164
175
|
// check if relations need setup
|
|
165
176
|
for (let schema of Object.values(tableToSave.schema)) {
|
|
166
|
-
if (schema.type !== FieldTypes.LINK || isRelationshipSetup(schema)) {
|
|
177
|
+
if (schema.type !== constants_1.FieldTypes.LINK || isRelationshipSetup(schema)) {
|
|
167
178
|
continue;
|
|
168
179
|
}
|
|
169
180
|
const relatedTable = Object.values(tables).find(table => table._id === schema.tableId);
|
|
181
|
+
if (!relatedTable) {
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
170
184
|
const relatedColumnName = schema.fieldName;
|
|
171
185
|
const relationType = schema.relationshipType;
|
|
172
|
-
if (relationType === RelationshipTypes.MANY_TO_MANY) {
|
|
186
|
+
if (relationType === constants_1.RelationshipTypes.MANY_TO_MANY) {
|
|
173
187
|
const junctionTable = generateManyLinkSchema(datasource, schema, table, relatedTable);
|
|
174
188
|
if (tables[junctionTable.name]) {
|
|
175
189
|
throw "Junction table already exists, cannot create another relationship.";
|
|
@@ -178,9 +192,9 @@ exports.save = function (ctx) {
|
|
|
178
192
|
extraTablesToUpdate.push(junctionTable);
|
|
179
193
|
}
|
|
180
194
|
else {
|
|
181
|
-
const fkTable = relationType === RelationshipTypes.ONE_TO_MANY ? table : relatedTable;
|
|
195
|
+
const fkTable = relationType === constants_1.RelationshipTypes.ONE_TO_MANY ? table : relatedTable;
|
|
182
196
|
const foreignKey = generateLinkSchema(schema, table, relatedTable, relationType);
|
|
183
|
-
fkTable.schema[foreignKey] = foreignKeyStructure(foreignKey);
|
|
197
|
+
fkTable.schema[foreignKey] = (0, utils_2.foreignKeyStructure)(foreignKey);
|
|
184
198
|
if (fkTable.constrained == null) {
|
|
185
199
|
fkTable.constrained = [];
|
|
186
200
|
}
|
|
@@ -196,16 +210,12 @@ exports.save = function (ctx) {
|
|
|
196
210
|
schema.main = true;
|
|
197
211
|
}
|
|
198
212
|
cleanupRelationships(tableToSave, tables, oldTable);
|
|
199
|
-
const operation = oldTable
|
|
200
|
-
? DataSourceOperation.UPDATE_TABLE
|
|
201
|
-
: DataSourceOperation.CREATE_TABLE;
|
|
213
|
+
const operation = oldTable ? types_1.Operation.UPDATE_TABLE : types_1.Operation.CREATE_TABLE;
|
|
202
214
|
yield makeTableRequest(datasource, operation, tableToSave, tables, oldTable, renamed);
|
|
203
215
|
// update any extra tables (like foreign keys in other tables)
|
|
204
216
|
for (let extraTable of extraTablesToUpdate) {
|
|
205
217
|
const oldExtraTable = oldTables[extraTable.name];
|
|
206
|
-
let op = oldExtraTable
|
|
207
|
-
? DataSourceOperation.UPDATE_TABLE
|
|
208
|
-
: DataSourceOperation.CREATE_TABLE;
|
|
218
|
+
let op = oldExtraTable ? types_1.Operation.UPDATE_TABLE : types_1.Operation.CREATE_TABLE;
|
|
209
219
|
yield makeTableRequest(datasource, op, extraTable, tables, oldExtraTable);
|
|
210
220
|
}
|
|
211
221
|
// make sure the constrained list, all still exist
|
|
@@ -219,37 +229,40 @@ exports.save = function (ctx) {
|
|
|
219
229
|
yield db.put(datasource);
|
|
220
230
|
return tableToSave;
|
|
221
231
|
});
|
|
222
|
-
}
|
|
223
|
-
exports.
|
|
232
|
+
}
|
|
233
|
+
exports.save = save;
|
|
234
|
+
function destroy(ctx) {
|
|
224
235
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
const tableToDelete = yield
|
|
236
|
+
const tableToDelete = yield sdk_1.default.tables.getTable(ctx.params.tableId);
|
|
226
237
|
if (!tableToDelete || !tableToDelete.created) {
|
|
227
238
|
ctx.throw(400, "Cannot delete tables which weren't created in Budibase.");
|
|
228
239
|
}
|
|
229
240
|
const datasourceId = getDatasourceId(tableToDelete);
|
|
230
|
-
const db = getAppDB();
|
|
241
|
+
const db = backend_core_1.context.getAppDB();
|
|
231
242
|
const datasource = yield db.get(datasourceId);
|
|
232
243
|
const tables = datasource.entities;
|
|
233
|
-
const operation =
|
|
244
|
+
const operation = types_1.Operation.DELETE_TABLE;
|
|
234
245
|
yield makeTableRequest(datasource, operation, tableToDelete, tables);
|
|
235
246
|
cleanupRelationships(tableToDelete, tables);
|
|
236
247
|
delete datasource.entities[tableToDelete.name];
|
|
237
248
|
yield db.put(datasource);
|
|
238
249
|
return tableToDelete;
|
|
239
250
|
});
|
|
240
|
-
}
|
|
241
|
-
exports.
|
|
251
|
+
}
|
|
252
|
+
exports.destroy = destroy;
|
|
253
|
+
function bulkImport(ctx) {
|
|
242
254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
const table = yield
|
|
255
|
+
const table = yield sdk_1.default.tables.getTable(ctx.params.tableId);
|
|
244
256
|
const { dataImport } = ctx.request.body;
|
|
245
257
|
if (!dataImport || !dataImport.schema || !dataImport.csvString) {
|
|
246
258
|
ctx.throw(400, "Provided data import information is invalid.");
|
|
247
259
|
}
|
|
248
|
-
const rows = yield
|
|
249
|
-
yield handleRequest(DataSourceOperation.BULK_CREATE, table._id, {
|
|
260
|
+
const rows = yield csvParser_1.default.transform(Object.assign(Object.assign({}, dataImport), { existingTable: table }));
|
|
261
|
+
yield (0, external_1.handleRequest)(constants_1.DataSourceOperation.BULK_CREATE, table._id, {
|
|
250
262
|
rows,
|
|
251
263
|
});
|
|
252
|
-
yield events.rows.imported(table, "csv", rows.length);
|
|
264
|
+
yield backend_core_1.events.rows.imported(table, "csv", rows.length);
|
|
253
265
|
return table;
|
|
254
266
|
});
|
|
255
|
-
}
|
|
267
|
+
}
|
|
268
|
+
exports.bulkImport = bulkImport;
|