@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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const { FieldTypes } = require("../../constants")
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A map of how we convert various properties in rows to each other based on the row type.
|
|
5
|
+
*/
|
|
6
|
+
exports.TYPE_TRANSFORM_MAP = {
|
|
7
|
+
[FieldTypes.LINK]: {
|
|
8
|
+
"": [],
|
|
9
|
+
[null]: [],
|
|
10
|
+
[undefined]: undefined,
|
|
11
|
+
parse: link => {
|
|
12
|
+
if (Array.isArray(link) && typeof link[0] === "object") {
|
|
13
|
+
return link.map(el => (el && el._id ? el._id : el))
|
|
14
|
+
}
|
|
15
|
+
if (typeof link === "string") {
|
|
16
|
+
return [link]
|
|
17
|
+
}
|
|
18
|
+
return link
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
[FieldTypes.OPTIONS]: {
|
|
22
|
+
"": null,
|
|
23
|
+
[null]: null,
|
|
24
|
+
[undefined]: undefined,
|
|
25
|
+
},
|
|
26
|
+
[FieldTypes.ARRAY]: {
|
|
27
|
+
"": [],
|
|
28
|
+
[null]: [],
|
|
29
|
+
[undefined]: undefined,
|
|
30
|
+
},
|
|
31
|
+
[FieldTypes.STRING]: {
|
|
32
|
+
"": "",
|
|
33
|
+
[null]: "",
|
|
34
|
+
[undefined]: undefined,
|
|
35
|
+
},
|
|
36
|
+
[FieldTypes.BARCODEQR]: {
|
|
37
|
+
"": "",
|
|
38
|
+
[null]: "",
|
|
39
|
+
[undefined]: undefined,
|
|
40
|
+
},
|
|
41
|
+
[FieldTypes.FORMULA]: {
|
|
42
|
+
"": "",
|
|
43
|
+
[null]: "",
|
|
44
|
+
[undefined]: undefined,
|
|
45
|
+
},
|
|
46
|
+
[FieldTypes.LONGFORM]: {
|
|
47
|
+
"": "",
|
|
48
|
+
[null]: "",
|
|
49
|
+
[undefined]: undefined,
|
|
50
|
+
},
|
|
51
|
+
[FieldTypes.NUMBER]: {
|
|
52
|
+
"": null,
|
|
53
|
+
[null]: null,
|
|
54
|
+
[undefined]: undefined,
|
|
55
|
+
parse: n => parseFloat(n),
|
|
56
|
+
},
|
|
57
|
+
[FieldTypes.DATETIME]: {
|
|
58
|
+
"": null,
|
|
59
|
+
[undefined]: undefined,
|
|
60
|
+
[null]: null,
|
|
61
|
+
parse: date => {
|
|
62
|
+
if (date instanceof Date) {
|
|
63
|
+
return date.toISOString()
|
|
64
|
+
}
|
|
65
|
+
return date
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
[FieldTypes.ATTACHMENT]: {
|
|
69
|
+
"": [],
|
|
70
|
+
[null]: [],
|
|
71
|
+
[undefined]: undefined,
|
|
72
|
+
},
|
|
73
|
+
[FieldTypes.BOOLEAN]: {
|
|
74
|
+
"": null,
|
|
75
|
+
[null]: null,
|
|
76
|
+
[undefined]: undefined,
|
|
77
|
+
true: true,
|
|
78
|
+
false: false,
|
|
79
|
+
},
|
|
80
|
+
[FieldTypes.AUTO]: {
|
|
81
|
+
parse: () => undefined,
|
|
82
|
+
},
|
|
83
|
+
[FieldTypes.JSON]: {
|
|
84
|
+
parse: input => {
|
|
85
|
+
try {
|
|
86
|
+
if (input === "") {
|
|
87
|
+
return undefined
|
|
88
|
+
}
|
|
89
|
+
return JSON.parse(input)
|
|
90
|
+
} catch (err) {
|
|
91
|
+
return input
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
2
|
FieldTypes,
|
|
3
3
|
FormulaTypes,
|
|
4
4
|
AutoFieldDefaultNames,
|
|
5
5
|
AutoFieldSubTypes,
|
|
6
|
-
}
|
|
7
|
-
|
|
6
|
+
} from "../../constants"
|
|
7
|
+
import { processStringSync } from "@budibase/string-templates"
|
|
8
|
+
import { FieldSchema, Table, Row } from "@budibase/types"
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* If the subtype has been lost for any reason this works out what
|
|
11
12
|
* subtype the auto column should be.
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
export function fixAutoColumnSubType(column: FieldSchema) {
|
|
14
15
|
if (!column.autocolumn || !column.name || column.subtype) {
|
|
15
16
|
return column
|
|
16
17
|
}
|
|
@@ -32,15 +33,18 @@ exports.fixAutoColumnSubType = column => {
|
|
|
32
33
|
/**
|
|
33
34
|
* Looks through the rows provided and finds formulas - which it then processes.
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
-
table,
|
|
37
|
-
rows,
|
|
38
|
-
{ dynamic, contextRows } = { dynamic: true }
|
|
39
|
-
)
|
|
36
|
+
export function processFormulas(
|
|
37
|
+
table: Table,
|
|
38
|
+
rows: Row[] | Row,
|
|
39
|
+
{ dynamic, contextRows }: any = { dynamic: true }
|
|
40
|
+
) {
|
|
40
41
|
const single = !Array.isArray(rows)
|
|
42
|
+
let rowArray: Row[]
|
|
41
43
|
if (single) {
|
|
42
|
-
|
|
44
|
+
rowArray = [rows]
|
|
43
45
|
contextRows = contextRows ? [contextRows] : contextRows
|
|
46
|
+
} else {
|
|
47
|
+
rowArray = rows
|
|
44
48
|
}
|
|
45
49
|
for (let [column, schema] of Object.entries(table.schema)) {
|
|
46
50
|
const isStatic = schema.formulaType === FormulaTypes.STATIC
|
|
@@ -52,25 +56,25 @@ exports.processFormulas = (
|
|
|
52
56
|
continue
|
|
53
57
|
}
|
|
54
58
|
// iterate through rows and process formula
|
|
55
|
-
for (let i = 0; i <
|
|
59
|
+
for (let i = 0; i < rowArray.length; i++) {
|
|
56
60
|
if (schema.formula) {
|
|
57
|
-
let row =
|
|
61
|
+
let row = rowArray[i]
|
|
58
62
|
let context = contextRows ? contextRows[i] : row
|
|
59
|
-
|
|
63
|
+
rowArray[i] = {
|
|
60
64
|
...row,
|
|
61
65
|
[column]: processStringSync(schema.formula, context),
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
|
-
return single ?
|
|
70
|
+
return single ? rowArray[0] : rowArray
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|
|
70
74
|
* Processes any date columns and ensures that those without the ignoreTimezones
|
|
71
75
|
* flag set are parsed as UTC rather than local time.
|
|
72
76
|
*/
|
|
73
|
-
|
|
77
|
+
export function processDates(table: Table, rows: Row[]) {
|
|
74
78
|
let datesWithTZ = []
|
|
75
79
|
for (let [column, schema] of Object.entries(table.schema)) {
|
|
76
80
|
if (schema.type !== FieldTypes.DATETIME) {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { permissions, roles } from "@budibase/backend-core"
|
|
2
|
+
import { DocumentType } from "../db/utils"
|
|
3
|
+
|
|
4
|
+
export const CURRENTLY_SUPPORTED_LEVELS: string[] = [
|
|
5
|
+
permissions.PermissionLevel.WRITE,
|
|
6
|
+
permissions.PermissionLevel.READ,
|
|
7
|
+
permissions.PermissionLevel.EXECUTE,
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
export function getPermissionType(resourceId: string) {
|
|
11
|
+
const docType = Object.values(DocumentType).filter(docType =>
|
|
12
|
+
resourceId.startsWith(docType)
|
|
13
|
+
)[0]
|
|
14
|
+
switch (docType) {
|
|
15
|
+
case DocumentType.TABLE:
|
|
16
|
+
case DocumentType.ROW:
|
|
17
|
+
return permissions.PermissionType.TABLE
|
|
18
|
+
case DocumentType.AUTOMATION:
|
|
19
|
+
return permissions.PermissionType.AUTOMATION
|
|
20
|
+
case DocumentType.WEBHOOK:
|
|
21
|
+
return permissions.PermissionType.WEBHOOK
|
|
22
|
+
case DocumentType.QUERY:
|
|
23
|
+
case DocumentType.DATASOURCE:
|
|
24
|
+
return permissions.PermissionType.QUERY
|
|
25
|
+
default:
|
|
26
|
+
// views don't have an ID, will end up here
|
|
27
|
+
return permissions.PermissionType.VIEW
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* works out the basic permissions based on builtin roles for a resource, using its ID
|
|
33
|
+
*/
|
|
34
|
+
export function getBasePermissions(resourceId: string) {
|
|
35
|
+
const type = getPermissionType(resourceId)
|
|
36
|
+
const basePermissions: { [key: string]: string } = {}
|
|
37
|
+
for (let [roleId, role] of Object.entries(roles.getBuiltinRoles())) {
|
|
38
|
+
if (!role.permissionId) {
|
|
39
|
+
continue
|
|
40
|
+
}
|
|
41
|
+
const perms = permissions.getBuiltinPermissionByID(role.permissionId)
|
|
42
|
+
if (!perms) {
|
|
43
|
+
continue
|
|
44
|
+
}
|
|
45
|
+
const typedPermission = perms.permissions.find(perm => perm.type === type)
|
|
46
|
+
if (
|
|
47
|
+
typedPermission &&
|
|
48
|
+
CURRENTLY_SUPPORTED_LEVELS.indexOf(typedPermission.level) !== -1
|
|
49
|
+
) {
|
|
50
|
+
const level = typedPermission.level
|
|
51
|
+
basePermissions[level] = roles.lowerBuiltinRoleID(
|
|
52
|
+
basePermissions[level],
|
|
53
|
+
roleId
|
|
54
|
+
)
|
|
55
|
+
if (permissions.isPermissionLevelHigherThanRead(level)) {
|
|
56
|
+
basePermissions[permissions.PermissionLevel.READ] =
|
|
57
|
+
roles.lowerBuiltinRoleID(
|
|
58
|
+
basePermissions[permissions.PermissionLevel.READ],
|
|
59
|
+
roleId
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return basePermissions
|
|
65
|
+
}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
getDevelopmentAppID,
|
|
5
|
-
getProdAppID,
|
|
6
|
-
doWithDB,
|
|
7
|
-
} = require("@budibase/backend-core/db")
|
|
1
|
+
import { getRowParams, USER_METDATA_PREFIX } from "../../db/utils"
|
|
2
|
+
import { db as dbCore } from "@budibase/backend-core"
|
|
3
|
+
import { Database, Row } from "@budibase/types"
|
|
8
4
|
|
|
9
5
|
const ROW_EXCLUSIONS = [USER_METDATA_PREFIX]
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
function getAppPairs(appIds: string[]) {
|
|
12
8
|
// collect the app ids into dev / prod pairs
|
|
13
9
|
// keyed by the dev app id
|
|
14
|
-
const pairs = {}
|
|
10
|
+
const pairs: { [key: string]: { devId?: string; prodId?: string } } = {}
|
|
15
11
|
for (let appId of appIds) {
|
|
16
|
-
const devId = getDevelopmentAppID(appId)
|
|
12
|
+
const devId = dbCore.getDevelopmentAppID(appId)
|
|
17
13
|
if (!pairs[devId]) {
|
|
18
14
|
pairs[devId] = {}
|
|
19
15
|
}
|
|
20
|
-
if (isDevAppID(appId)) {
|
|
16
|
+
if (dbCore.isDevAppID(appId)) {
|
|
21
17
|
pairs[devId].devId = appId
|
|
22
18
|
} else {
|
|
23
19
|
pairs[devId].prodId = appId
|
|
@@ -26,9 +22,9 @@ const getAppPairs = appIds => {
|
|
|
26
22
|
return pairs
|
|
27
23
|
}
|
|
28
24
|
|
|
29
|
-
|
|
25
|
+
async function getAppRows(appId: string) {
|
|
30
26
|
// need to specify the app ID, as this is used for different apps in one call
|
|
31
|
-
return doWithDB(appId, async db => {
|
|
27
|
+
return dbCore.doWithDB(appId, async (db: Database) => {
|
|
32
28
|
const response = await db.allDocs(
|
|
33
29
|
getRowParams(null, null, {
|
|
34
30
|
include_docs: false,
|
|
@@ -52,13 +48,13 @@ const getAppRows = async appId => {
|
|
|
52
48
|
* The returned rows will be unique on a per dev/prod app basis.
|
|
53
49
|
* Rows duplicates may exist across apps due to data import so they are not filtered out.
|
|
54
50
|
*/
|
|
55
|
-
|
|
56
|
-
let uniqueRows = [],
|
|
57
|
-
rowsByApp = {}
|
|
51
|
+
export async function getUniqueRows(appIds: string[]) {
|
|
52
|
+
let uniqueRows: Row[] = [],
|
|
53
|
+
rowsByApp: { [key: string]: Row[] } = {}
|
|
58
54
|
const pairs = getAppPairs(appIds)
|
|
59
55
|
|
|
60
56
|
for (let pair of Object.values(pairs)) {
|
|
61
|
-
let appRows = []
|
|
57
|
+
let appRows: Row[] = []
|
|
62
58
|
for (let appId of [pair.devId, pair.prodId]) {
|
|
63
59
|
if (!appId) {
|
|
64
60
|
continue
|
|
@@ -75,7 +71,7 @@ exports.getUniqueRows = async appIds => {
|
|
|
75
71
|
// this can't be done on all rows because app import results in
|
|
76
72
|
// duplicate row ids across apps
|
|
77
73
|
// the array pre-concat is important to avoid stack overflow
|
|
78
|
-
const prodId = getProdAppID(pair.devId || pair.prodId)
|
|
74
|
+
const prodId = dbCore.getProdAppID((pair.devId || pair.prodId)!)
|
|
79
75
|
rowsByApp[prodId] = [...new Set(appRows)]
|
|
80
76
|
uniqueRows = uniqueRows.concat(rowsByApp[prodId])
|
|
81
77
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles")
|
|
1
|
+
import { InternalTables } from "../db/utils"
|
|
2
|
+
import { getGlobalUser } from "./global"
|
|
3
|
+
import { context, db as dbCore, roles } from "@budibase/backend-core"
|
|
4
|
+
import { BBContext } from "@budibase/types"
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
export async function getFullUser(ctx: BBContext, userId: string) {
|
|
8
7
|
const global = await getGlobalUser(userId)
|
|
9
|
-
let metadata = {}
|
|
8
|
+
let metadata: any = {}
|
|
10
9
|
|
|
11
10
|
// always prefer the user metadata _id and _rev
|
|
12
11
|
delete global._id
|
|
@@ -14,7 +13,7 @@ exports.getFullUser = async (ctx, userId) => {
|
|
|
14
13
|
|
|
15
14
|
try {
|
|
16
15
|
// this will throw an error if the db doesn't exist, or there is no appId
|
|
17
|
-
const db = getAppDB()
|
|
16
|
+
const db = context.getAppDB()
|
|
18
17
|
metadata = await db.get(userId)
|
|
19
18
|
} catch (err) {
|
|
20
19
|
// it is fine if there is no user metadata yet
|
|
@@ -23,14 +22,14 @@ exports.getFullUser = async (ctx, userId) => {
|
|
|
23
22
|
return {
|
|
24
23
|
...metadata,
|
|
25
24
|
...global,
|
|
26
|
-
roleId: global.roleId || BUILTIN_ROLE_IDS.PUBLIC,
|
|
25
|
+
roleId: global.roleId || roles.BUILTIN_ROLE_IDS.PUBLIC,
|
|
27
26
|
tableId: InternalTables.USER_METADATA,
|
|
28
27
|
// make sure the ID is always a local ID, not a global one
|
|
29
28
|
_id: userId,
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
export function publicApiUserFix(ctx: BBContext) {
|
|
34
33
|
if (!ctx.request.body) {
|
|
35
34
|
return ctx
|
|
36
35
|
}
|
|
@@ -40,10 +39,9 @@ exports.publicApiUserFix = ctx => {
|
|
|
40
39
|
if (!ctx.request.body.roles) {
|
|
41
40
|
ctx.request.body.roles = {}
|
|
42
41
|
} else {
|
|
43
|
-
const newRoles = {}
|
|
42
|
+
const newRoles: { [key: string]: any } = {}
|
|
44
43
|
for (let [appId, role] of Object.entries(ctx.request.body.roles)) {
|
|
45
|
-
|
|
46
|
-
newRoles[getProdAppID(appId)] = role
|
|
44
|
+
newRoles[dbCore.getProdAppID(appId)] = role
|
|
47
45
|
}
|
|
48
46
|
ctx.request.body.roles = newRoles
|
|
49
47
|
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { getTenantId, isTenantIdSet } = require("@budibase/backend-core/tenancy")
|
|
1
|
+
import fetch from "node-fetch"
|
|
2
|
+
import env from "../environment"
|
|
3
|
+
import { checkSlashesInUrl } from "./index"
|
|
4
|
+
import { db as dbCore, constants, tenancy } from "@budibase/backend-core"
|
|
5
|
+
import { updateAppRole } from "./global"
|
|
6
|
+
import { BBContext, Automation } from "@budibase/types"
|
|
8
7
|
|
|
9
|
-
function request(ctx, request) {
|
|
8
|
+
export function request(ctx?: BBContext, request?: any) {
|
|
10
9
|
if (!request.headers) {
|
|
11
10
|
request.headers = {}
|
|
12
11
|
}
|
|
13
12
|
if (!ctx) {
|
|
14
|
-
request.headers[Header.API_KEY] = env.INTERNAL_API_KEY
|
|
15
|
-
if (isTenantIdSet()) {
|
|
16
|
-
request.headers[Header.TENANT_ID] = getTenantId()
|
|
13
|
+
request.headers[constants.Header.API_KEY] = env.INTERNAL_API_KEY
|
|
14
|
+
if (tenancy.isTenantIdSet()) {
|
|
15
|
+
request.headers[constants.Header.TENANT_ID] = tenancy.getTenantId()
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
if (request.body && Object.keys(request.body).length > 0) {
|
|
@@ -31,7 +30,11 @@ function request(ctx, request) {
|
|
|
31
30
|
return request
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
async function checkResponse(
|
|
33
|
+
async function checkResponse(
|
|
34
|
+
response: any,
|
|
35
|
+
errorMsg: string,
|
|
36
|
+
{ ctx }: { ctx?: BBContext } = {}
|
|
37
|
+
) {
|
|
35
38
|
if (response.status !== 200) {
|
|
36
39
|
let error
|
|
37
40
|
try {
|
|
@@ -51,22 +54,20 @@ async function checkResponse(response, errorMsg, { ctx } = {}) {
|
|
|
51
54
|
return response.json()
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
exports.request = request
|
|
55
|
-
|
|
56
57
|
// have to pass in the tenant ID as this could be coming from an automation
|
|
57
|
-
|
|
58
|
-
to,
|
|
59
|
-
from,
|
|
60
|
-
subject,
|
|
61
|
-
contents,
|
|
62
|
-
cc,
|
|
63
|
-
bcc,
|
|
64
|
-
automation
|
|
65
|
-
)
|
|
58
|
+
export async function sendSmtpEmail(
|
|
59
|
+
to: string,
|
|
60
|
+
from: string,
|
|
61
|
+
subject: string,
|
|
62
|
+
contents: string,
|
|
63
|
+
cc: string,
|
|
64
|
+
bcc: string,
|
|
65
|
+
automation: Automation
|
|
66
|
+
) {
|
|
66
67
|
// tenant ID will be set in header
|
|
67
68
|
const response = await fetch(
|
|
68
69
|
checkSlashesInUrl(env.WORKER_URL + `/api/global/email/send`),
|
|
69
|
-
request(
|
|
70
|
+
request(undefined, {
|
|
70
71
|
method: "POST",
|
|
71
72
|
body: {
|
|
72
73
|
email: to,
|
|
@@ -83,7 +84,7 @@ exports.sendSmtpEmail = async (
|
|
|
83
84
|
return checkResponse(response, "send email")
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
+
export async function getGlobalSelf(ctx: BBContext, appId?: string) {
|
|
87
88
|
const endpoint = `/api/global/self`
|
|
88
89
|
const response = await fetch(
|
|
89
90
|
checkSlashesInUrl(env.WORKER_URL + endpoint),
|
|
@@ -97,8 +98,8 @@ exports.getGlobalSelf = async (ctx, appId = null) => {
|
|
|
97
98
|
return json
|
|
98
99
|
}
|
|
99
100
|
|
|
100
|
-
|
|
101
|
-
const prodAppId = getProdAppID(appId)
|
|
101
|
+
export async function removeAppFromUserRoles(ctx: BBContext, appId: string) {
|
|
102
|
+
const prodAppId = dbCore.getProdAppID(appId)
|
|
102
103
|
const response = await fetch(
|
|
103
104
|
checkSlashesInUrl(env.WORKER_URL + `/api/global/roles/${prodAppId}`),
|
|
104
105
|
request(ctx, {
|
|
@@ -108,7 +109,7 @@ exports.removeAppFromUserRoles = async (ctx, appId) => {
|
|
|
108
109
|
return checkResponse(response, "remove app role")
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
|
|
112
|
+
export async function allGlobalUsers(ctx: BBContext) {
|
|
112
113
|
const response = await fetch(
|
|
113
114
|
checkSlashesInUrl(env.WORKER_URL + "/api/global/users"),
|
|
114
115
|
// we don't want to use API key when getting self
|
|
@@ -117,7 +118,7 @@ exports.allGlobalUsers = async ctx => {
|
|
|
117
118
|
return checkResponse(response, "get users", { ctx })
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
|
|
121
|
+
export async function saveGlobalUser(ctx: BBContext) {
|
|
121
122
|
const response = await fetch(
|
|
122
123
|
checkSlashesInUrl(env.WORKER_URL + "/api/global/users"),
|
|
123
124
|
// we don't want to use API key when getting self
|
|
@@ -126,7 +127,7 @@ exports.saveGlobalUser = async ctx => {
|
|
|
126
127
|
return checkResponse(response, "save user", { ctx })
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
export async function deleteGlobalUser(ctx: BBContext) {
|
|
130
131
|
const response = await fetch(
|
|
131
132
|
checkSlashesInUrl(
|
|
132
133
|
env.WORKER_URL + `/api/global/users/${ctx.params.userId}`
|
|
@@ -134,10 +135,10 @@ exports.deleteGlobalUser = async ctx => {
|
|
|
134
135
|
// we don't want to use API key when getting self
|
|
135
136
|
request(ctx, { method: "DELETE" })
|
|
136
137
|
)
|
|
137
|
-
return checkResponse(response, "delete user", { ctx
|
|
138
|
+
return checkResponse(response, "delete user", { ctx })
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
|
|
141
|
+
export async function readGlobalUser(ctx: BBContext) {
|
|
141
142
|
const response = await fetch(
|
|
142
143
|
checkSlashesInUrl(
|
|
143
144
|
env.WORKER_URL + `/api/global/users/${ctx.params.userId}`
|
|
@@ -148,26 +149,30 @@ exports.readGlobalUser = async ctx => {
|
|
|
148
149
|
return checkResponse(response, "get user", { ctx })
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
|
|
152
|
+
export async function createAdminUser(
|
|
153
|
+
email: string,
|
|
154
|
+
password: string,
|
|
155
|
+
tenantId: string
|
|
156
|
+
) {
|
|
152
157
|
const response = await fetch(
|
|
153
158
|
checkSlashesInUrl(env.WORKER_URL + "/api/global/users/init"),
|
|
154
|
-
request(
|
|
159
|
+
request(undefined, { method: "POST", body: { email, password, tenantId } })
|
|
155
160
|
)
|
|
156
161
|
return checkResponse(response, "create admin user")
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
export async function getChecklist() {
|
|
160
165
|
const response = await fetch(
|
|
161
166
|
checkSlashesInUrl(env.WORKER_URL + "/api/global/configs/checklist"),
|
|
162
|
-
request(
|
|
167
|
+
request(undefined, { method: "GET" })
|
|
163
168
|
)
|
|
164
169
|
return checkResponse(response, "get checklist")
|
|
165
170
|
}
|
|
166
171
|
|
|
167
|
-
|
|
172
|
+
export async function generateApiKey(userId: string) {
|
|
168
173
|
const response = await fetch(
|
|
169
174
|
checkSlashesInUrl(env.WORKER_URL + "/api/global/self/api_key"),
|
|
170
|
-
request(
|
|
175
|
+
request(undefined, { method: "POST", body: { userId } })
|
|
171
176
|
)
|
|
172
177
|
return checkResponse(response, "generate API key")
|
|
173
178
|
}
|
package/src/watch.ts
CHANGED
|
@@ -2,8 +2,7 @@ import path from "path"
|
|
|
2
2
|
import * as env from "./environment"
|
|
3
3
|
import chokidar from "chokidar"
|
|
4
4
|
import fs from "fs"
|
|
5
|
-
import { tenancy } from "@budibase/backend-core"
|
|
6
|
-
import { DEFAULT_TENANT_ID } from "@budibase/backend-core/constants"
|
|
5
|
+
import { constants, tenancy } from "@budibase/backend-core"
|
|
7
6
|
import { processUploadedPlugin } from "./api/controllers/plugin"
|
|
8
7
|
|
|
9
8
|
export function watch() {
|
|
@@ -23,7 +22,7 @@ export function watch() {
|
|
|
23
22
|
if (!path?.endsWith(".tar.gz") || !fs.existsSync(path)) {
|
|
24
23
|
return
|
|
25
24
|
}
|
|
26
|
-
await tenancy.doInTenant(DEFAULT_TENANT_ID, async () => {
|
|
25
|
+
await tenancy.doInTenant(constants.DEFAULT_TENANT_ID, async () => {
|
|
27
26
|
try {
|
|
28
27
|
const split = path.split("/")
|
|
29
28
|
const name = split[split.length - 1]
|