@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
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,14 +31,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.validateCSVSchema = exports.bulkImport = exports.destroy = exports.save = exports.find = exports.fetch = void 0;
|
|
39
|
+
const internal = __importStar(require("./internal"));
|
|
40
|
+
const external = __importStar(require("./external"));
|
|
41
|
+
const csvParser_1 = __importDefault(require("../../../utilities/csvParser"));
|
|
42
|
+
const utils_1 = require("../../../integrations/utils");
|
|
43
|
+
const utils_2 = require("../../../db/utils");
|
|
44
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
45
|
+
const sdk_1 = __importDefault(require("../../../sdk"));
|
|
19
46
|
function pickApi({ tableId, table }) {
|
|
20
47
|
if (table && !tableId) {
|
|
21
48
|
tableId = table._id;
|
|
@@ -23,23 +50,23 @@ function pickApi({ tableId, table }) {
|
|
|
23
50
|
if (table && table.type === "external") {
|
|
24
51
|
return external;
|
|
25
52
|
}
|
|
26
|
-
else if (tableId && isExternalTable(tableId)) {
|
|
53
|
+
else if (tableId && (0, utils_1.isExternalTable)(tableId)) {
|
|
27
54
|
return external;
|
|
28
55
|
}
|
|
29
56
|
return internal;
|
|
30
57
|
}
|
|
31
58
|
// covers both internal and external
|
|
32
|
-
|
|
59
|
+
function fetch(ctx) {
|
|
33
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
-
const db = getAppDB();
|
|
35
|
-
const internal = yield
|
|
36
|
-
const externalTables = yield db.allDocs(getDatasourceParams("plus", {
|
|
61
|
+
const db = backend_core_1.context.getAppDB();
|
|
62
|
+
const internal = yield sdk_1.default.tables.getAllInternalTables();
|
|
63
|
+
const externalTables = yield db.allDocs((0, utils_2.getDatasourceParams)("plus", {
|
|
37
64
|
include_docs: true,
|
|
38
65
|
}));
|
|
39
66
|
const external = externalTables.rows.flatMap(tableDoc => {
|
|
40
67
|
let entities = tableDoc.doc.entities;
|
|
41
68
|
if (entities) {
|
|
42
|
-
return Object.values(entities).map(entity => (Object.assign(Object.assign({}, entity), { type: "external", sourceId: tableDoc.doc._id, sql: isSQL(tableDoc.doc) })));
|
|
69
|
+
return Object.values(entities).map((entity) => (Object.assign(Object.assign({}, entity), { type: "external", sourceId: tableDoc.doc._id, sql: (0, utils_1.isSQL)(tableDoc.doc) })));
|
|
43
70
|
}
|
|
44
71
|
else {
|
|
45
72
|
return [];
|
|
@@ -47,27 +74,29 @@ exports.fetch = function (ctx) {
|
|
|
47
74
|
});
|
|
48
75
|
ctx.body = [...internal, ...external];
|
|
49
76
|
});
|
|
50
|
-
}
|
|
51
|
-
exports.
|
|
77
|
+
}
|
|
78
|
+
exports.fetch = fetch;
|
|
79
|
+
function find(ctx) {
|
|
52
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
81
|
const tableId = ctx.params.tableId;
|
|
54
|
-
ctx.body = yield
|
|
82
|
+
ctx.body = yield sdk_1.default.tables.getTable(tableId);
|
|
55
83
|
});
|
|
56
|
-
}
|
|
57
|
-
exports.
|
|
84
|
+
}
|
|
85
|
+
exports.find = find;
|
|
86
|
+
function save(ctx) {
|
|
58
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
88
|
const appId = ctx.appId;
|
|
60
89
|
const table = ctx.request.body;
|
|
61
90
|
const importFormat = table.dataImport && table.dataImport.csvString ? "csv" : undefined;
|
|
62
91
|
const savedTable = yield pickApi({ table }).save(ctx);
|
|
63
92
|
if (!table._id) {
|
|
64
|
-
yield events.table.created(savedTable);
|
|
93
|
+
yield backend_core_1.events.table.created(savedTable);
|
|
65
94
|
}
|
|
66
95
|
else {
|
|
67
|
-
yield events.table.updated(savedTable);
|
|
96
|
+
yield backend_core_1.events.table.updated(savedTable);
|
|
68
97
|
}
|
|
69
98
|
if (importFormat) {
|
|
70
|
-
yield events.table.imported(savedTable, importFormat);
|
|
99
|
+
yield backend_core_1.events.table.imported(savedTable, importFormat);
|
|
71
100
|
}
|
|
72
101
|
ctx.status = 200;
|
|
73
102
|
ctx.message = `Table ${table.name} saved successfully.`;
|
|
@@ -75,21 +104,23 @@ exports.save = function (ctx) {
|
|
|
75
104
|
ctx.eventEmitter.emitTable(`table:save`, appId, savedTable);
|
|
76
105
|
ctx.body = savedTable;
|
|
77
106
|
});
|
|
78
|
-
}
|
|
79
|
-
exports.
|
|
107
|
+
}
|
|
108
|
+
exports.save = save;
|
|
109
|
+
function destroy(ctx) {
|
|
80
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
111
|
const appId = ctx.appId;
|
|
82
112
|
const tableId = ctx.params.tableId;
|
|
83
113
|
const deletedTable = yield pickApi({ tableId }).destroy(ctx);
|
|
84
|
-
yield events.table.deleted(deletedTable);
|
|
114
|
+
yield backend_core_1.events.table.deleted(deletedTable);
|
|
85
115
|
ctx.eventEmitter &&
|
|
86
116
|
ctx.eventEmitter.emitTable(`table:delete`, appId, deletedTable);
|
|
87
117
|
ctx.status = 200;
|
|
88
118
|
ctx.table = deletedTable;
|
|
89
119
|
ctx.body = { message: `Table ${tableId} deleted.` };
|
|
90
120
|
});
|
|
91
|
-
}
|
|
92
|
-
exports.
|
|
121
|
+
}
|
|
122
|
+
exports.destroy = destroy;
|
|
123
|
+
function bulkImport(ctx) {
|
|
93
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
125
|
const tableId = ctx.params.tableId;
|
|
95
126
|
yield pickApi({ tableId }).bulkImport(ctx);
|
|
@@ -99,19 +130,21 @@ exports.bulkImport = function (ctx) {
|
|
|
99
130
|
ctx.status = 200;
|
|
100
131
|
ctx.body = { message: `Bulk rows created.` };
|
|
101
132
|
});
|
|
102
|
-
}
|
|
103
|
-
exports.
|
|
133
|
+
}
|
|
134
|
+
exports.bulkImport = bulkImport;
|
|
135
|
+
function validateCSVSchema(ctx) {
|
|
104
136
|
return __awaiter(this, void 0, void 0, function* () {
|
|
105
137
|
// tableId being specified means its an import to an existing table
|
|
106
138
|
const { csvString, schema = {}, tableId } = ctx.request.body;
|
|
107
139
|
let existingTable;
|
|
108
140
|
if (tableId) {
|
|
109
|
-
existingTable = yield
|
|
141
|
+
existingTable = yield sdk_1.default.tables.getTable(tableId);
|
|
110
142
|
}
|
|
111
|
-
let result = yield
|
|
143
|
+
let result = yield csvParser_1.default.parse(csvString, schema);
|
|
112
144
|
if (existingTable) {
|
|
113
|
-
result =
|
|
145
|
+
result = csvParser_1.default.updateSchema({ schema: result, existingTable });
|
|
114
146
|
}
|
|
115
147
|
ctx.body = { schema: result };
|
|
116
148
|
});
|
|
117
|
-
}
|
|
149
|
+
}
|
|
150
|
+
exports.validateCSVSchema = validateCSVSchema;
|
|
@@ -141,7 +141,7 @@ function save(ctx) {
|
|
|
141
141
|
tableToSave._rev = result.rev;
|
|
142
142
|
}
|
|
143
143
|
// has to run after, make sure it has _id
|
|
144
|
-
yield (0, bulkFormula_1.runStaticFormulaChecks)(tableToSave, { oldTable, deletion:
|
|
144
|
+
yield (0, bulkFormula_1.runStaticFormulaChecks)(tableToSave, { oldTable, deletion: false });
|
|
145
145
|
return tableToSave;
|
|
146
146
|
});
|
|
147
147
|
}
|
|
@@ -175,7 +175,6 @@ function destroy(ctx) {
|
|
|
175
175
|
}
|
|
176
176
|
// has to run after, make sure it has _id
|
|
177
177
|
yield (0, bulkFormula_1.runStaticFormulaChecks)(tableToDelete, {
|
|
178
|
-
oldTable: null,
|
|
179
178
|
deletion: true,
|
|
180
179
|
});
|
|
181
180
|
yield (0, rowProcessor_1.cleanupAttachments)(tableToDelete, {
|
|
@@ -21,26 +21,25 @@ const rowProcessor_1 = require("../../../utilities/rowProcessor");
|
|
|
21
21
|
const constants_2 = require("../../../constants");
|
|
22
22
|
const utils_2 = require("../view/utils");
|
|
23
23
|
const viewBuilder_1 = __importDefault(require("../view/viewBuilder"));
|
|
24
|
-
const { getAppDB } = require("@budibase/backend-core/context");
|
|
25
24
|
const fp_1 = require("lodash/fp");
|
|
26
25
|
const pro_1 = require("@budibase/pro");
|
|
27
26
|
const backend_core_1 = require("@budibase/backend-core");
|
|
28
27
|
function clearColumns(table, columnNames) {
|
|
29
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const db = getAppDB();
|
|
29
|
+
const db = backend_core_1.context.getAppDB();
|
|
31
30
|
const rows = yield db.allDocs((0, utils_1.getRowParams)(table._id, null, {
|
|
32
31
|
include_docs: true,
|
|
33
32
|
}));
|
|
34
|
-
return db.bulkDocs(rows.rows.map(({ doc }) => {
|
|
33
|
+
return (yield db.bulkDocs(rows.rows.map(({ doc }) => {
|
|
35
34
|
columnNames.forEach((colName) => delete doc[colName]);
|
|
36
35
|
return doc;
|
|
37
|
-
}));
|
|
36
|
+
})));
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
exports.clearColumns = clearColumns;
|
|
41
40
|
function checkForColumnUpdates(oldTable, updatedTable) {
|
|
42
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
const db = getAppDB();
|
|
42
|
+
const db = backend_core_1.context.getAppDB();
|
|
44
43
|
let updatedRows = [];
|
|
45
44
|
const rename = updatedTable._rename;
|
|
46
45
|
let deletedColumns = [];
|
|
@@ -130,7 +129,7 @@ function handleDataImport(user, table, dataImport) {
|
|
|
130
129
|
if (!dataImport || !dataImport.csvString) {
|
|
131
130
|
return table;
|
|
132
131
|
}
|
|
133
|
-
const db = getAppDB();
|
|
132
|
+
const db = backend_core_1.context.getAppDB();
|
|
134
133
|
// Populate the table with rows imported from CSV in a bulk update
|
|
135
134
|
const data = yield (0, csvParser_1.transform)(Object.assign(Object.assign({}, dataImport), { existingTable: table }));
|
|
136
135
|
let finalData = importToRows(data, table, user);
|
|
@@ -144,7 +143,7 @@ function handleDataImport(user, table, dataImport) {
|
|
|
144
143
|
exports.handleDataImport = handleDataImport;
|
|
145
144
|
function handleSearchIndexes(table) {
|
|
146
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const db = getAppDB();
|
|
146
|
+
const db = backend_core_1.context.getAppDB();
|
|
148
147
|
// create relevant search indexes
|
|
149
148
|
if (table.indexes && table.indexes.length > 0) {
|
|
150
149
|
const currentIndexes = yield db.getIndexes();
|
|
@@ -197,7 +196,7 @@ function checkStaticTables(table) {
|
|
|
197
196
|
exports.checkStaticTables = checkStaticTables;
|
|
198
197
|
class TableSaveFunctions {
|
|
199
198
|
constructor({ user, oldTable, dataImport }) {
|
|
200
|
-
this.db = getAppDB();
|
|
199
|
+
this.db = backend_core_1.context.getAppDB();
|
|
201
200
|
this.user = user;
|
|
202
201
|
this.oldTable = oldTable;
|
|
203
202
|
this.dataImport = dataImport;
|
|
@@ -310,7 +309,7 @@ function generateJunctionTableName(column, table, relatedTable) {
|
|
|
310
309
|
return `jt_${table.name}_${relatedTable.name}_${column.name}_${column.fieldName}`;
|
|
311
310
|
}
|
|
312
311
|
exports.generateJunctionTableName = generateJunctionTableName;
|
|
313
|
-
function foreignKeyStructure(keyName, meta
|
|
312
|
+
function foreignKeyStructure(keyName, meta) {
|
|
314
313
|
const structure = {
|
|
315
314
|
type: constants_1.FieldTypes.NUMBER,
|
|
316
315
|
constraints: {},
|
|
@@ -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
|
-
|
|
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.downloadTemplate = exports.fetch = void 0;
|
|
16
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
17
|
+
const fileSystem_1 = require("../../utilities/fileSystem");
|
|
18
|
+
const environment_1 = __importDefault(require("../../environment"));
|
|
14
19
|
// development flag, can be used to test against templates exported locally
|
|
15
20
|
const DEFAULT_TEMPLATES_BUCKET = "prod-budi-templates.s3-eu-west-1.amazonaws.com";
|
|
16
|
-
|
|
21
|
+
function fetch(ctx) {
|
|
17
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
let type =
|
|
23
|
+
let type = environment_1.default.TEMPLATE_REPOSITORY;
|
|
19
24
|
let response, error = false;
|
|
20
25
|
try {
|
|
21
|
-
response = yield
|
|
26
|
+
response = yield (0, node_fetch_1.default)(`https://${DEFAULT_TEMPLATES_BUCKET}/manifest.json`);
|
|
22
27
|
if (response.status !== 200) {
|
|
23
28
|
error = true;
|
|
24
29
|
}
|
|
@@ -35,15 +40,17 @@ exports.fetch = function (ctx) {
|
|
|
35
40
|
ctx.body = [];
|
|
36
41
|
}
|
|
37
42
|
});
|
|
38
|
-
}
|
|
43
|
+
}
|
|
44
|
+
exports.fetch = fetch;
|
|
39
45
|
// can't currently test this, have to ignore from coverage
|
|
40
46
|
/* istanbul ignore next */
|
|
41
|
-
|
|
47
|
+
function downloadTemplate(ctx) {
|
|
42
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
49
|
const { type, name } = ctx.params;
|
|
44
|
-
yield downloadTemplate(type, name);
|
|
50
|
+
yield (0, fileSystem_1.downloadTemplate)(type, name);
|
|
45
51
|
ctx.body = {
|
|
46
52
|
message: `template ${type}:${name} downloaded successfully.`,
|
|
47
53
|
};
|
|
48
54
|
});
|
|
49
|
-
}
|
|
55
|
+
}
|
|
56
|
+
exports.downloadTemplate = downloadTemplate;
|
|
@@ -8,31 +8,30 @@ 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
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const { getAppDB, doInAppContext } = require("@budibase/backend-core/context");
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.getFlags = exports.setFlag = exports.findMetadata = exports.destroyMetadata = exports.updateMetadata = exports.updateSelfMetadata = exports.fetchMetadata = exports.syncUser = exports.syncGlobalUsers = void 0;
|
|
13
|
+
const utils_1 = require("../../db/utils");
|
|
14
|
+
const utils_2 = require("../../db/utils");
|
|
15
|
+
const global_1 = require("../../utilities/global");
|
|
16
|
+
const users_1 = require("../../utilities/users");
|
|
17
|
+
const lodash_1 = require("lodash");
|
|
18
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
20
19
|
function rawMetadata() {
|
|
21
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const db = getAppDB();
|
|
23
|
-
return (yield db.allDocs(getUserMetadataParams(null, {
|
|
21
|
+
const db = backend_core_1.context.getAppDB();
|
|
22
|
+
return (yield db.allDocs((0, utils_1.getUserMetadataParams)(null, {
|
|
24
23
|
include_docs: true,
|
|
25
24
|
}))).rows.map(row => row.doc);
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
function combineMetadataAndUser(user, metadata) {
|
|
29
28
|
// skip users with no access
|
|
30
|
-
if (user.roleId === BUILTIN_ROLE_IDS.PUBLIC) {
|
|
29
|
+
if (user.roleId === backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
31
30
|
return null;
|
|
32
31
|
}
|
|
33
32
|
delete user._rev;
|
|
34
|
-
const metadataId = generateUserMetadataID(user._id);
|
|
35
|
-
const newDoc = Object.assign(Object.assign({}, user), { _id: metadataId, tableId: InternalTables.USER_METADATA });
|
|
33
|
+
const metadataId = (0, utils_1.generateUserMetadataID)(user._id);
|
|
34
|
+
const newDoc = Object.assign(Object.assign({}, user), { _id: metadataId, tableId: utils_2.InternalTables.USER_METADATA });
|
|
36
35
|
const found = Array.isArray(metadata)
|
|
37
36
|
? metadata.find(doc => doc._id === metadataId)
|
|
38
37
|
: metadata;
|
|
@@ -40,30 +39,33 @@ function combineMetadataAndUser(user, metadata) {
|
|
|
40
39
|
if (found) {
|
|
41
40
|
newDoc._rev = found._rev;
|
|
42
41
|
}
|
|
43
|
-
if (found == null || !isEqual(newDoc, found)) {
|
|
42
|
+
if (found == null || !(0, lodash_1.isEqual)(newDoc, found)) {
|
|
44
43
|
return Object.assign(Object.assign({}, found), newDoc);
|
|
45
44
|
}
|
|
46
45
|
return null;
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
function syncGlobalUsers() {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
// sync user metadata
|
|
50
|
+
const db = backend_core_1.context.getAppDB();
|
|
51
|
+
const [users, metadata] = yield Promise.all([(0, global_1.getGlobalUsers)(), rawMetadata()]);
|
|
52
|
+
const toWrite = [];
|
|
53
|
+
for (let user of users) {
|
|
54
|
+
const combined = yield combineMetadataAndUser(user, metadata);
|
|
55
|
+
if (combined) {
|
|
56
|
+
toWrite.push(combined);
|
|
57
|
+
}
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
exports.
|
|
59
|
+
yield db.bulkDocs(toWrite);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.syncGlobalUsers = syncGlobalUsers;
|
|
63
|
+
function syncUser(ctx) {
|
|
62
64
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
65
|
let deleting = false, user;
|
|
64
66
|
const userId = ctx.params.id;
|
|
65
67
|
try {
|
|
66
|
-
user = yield getRawGlobalUser(userId);
|
|
68
|
+
user = yield (0, global_1.getRawGlobalUser)(userId);
|
|
67
69
|
}
|
|
68
70
|
catch (err) {
|
|
69
71
|
if (err && err.status === 404) {
|
|
@@ -83,23 +85,23 @@ exports.syncUser = function (ctx) {
|
|
|
83
85
|
let prodAppIds;
|
|
84
86
|
// if they are a builder then get all production app IDs
|
|
85
87
|
if ((user.builder && user.builder.global) || deleting) {
|
|
86
|
-
prodAppIds = yield getProdAppIDs();
|
|
88
|
+
prodAppIds = yield backend_core_1.db.getProdAppIDs();
|
|
87
89
|
}
|
|
88
90
|
else {
|
|
89
91
|
prodAppIds = Object.entries(roles)
|
|
90
|
-
.filter(entry => entry[1] !== BUILTIN_ROLE_IDS.PUBLIC)
|
|
92
|
+
.filter(entry => entry[1] !== backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC)
|
|
91
93
|
.map(([appId]) => appId);
|
|
92
94
|
}
|
|
93
95
|
for (let prodAppId of prodAppIds) {
|
|
94
96
|
const roleId = roles[prodAppId];
|
|
95
|
-
const devAppId = getDevelopmentAppID(prodAppId);
|
|
97
|
+
const devAppId = backend_core_1.db.getDevelopmentAppID(prodAppId);
|
|
96
98
|
for (let appId of [prodAppId, devAppId]) {
|
|
97
|
-
if (!(yield dbExists(appId))) {
|
|
99
|
+
if (!(yield backend_core_1.db.dbExists(appId))) {
|
|
98
100
|
continue;
|
|
99
101
|
}
|
|
100
|
-
yield doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const db = getAppDB();
|
|
102
|
-
const metadataId = generateUserMetadataID(userId);
|
|
102
|
+
yield backend_core_1.context.doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
const db = backend_core_1.context.getAppDB();
|
|
104
|
+
const metadataId = (0, utils_1.generateUserMetadataID)(userId);
|
|
103
105
|
let metadata;
|
|
104
106
|
try {
|
|
105
107
|
metadata = yield db.get(metadataId);
|
|
@@ -109,7 +111,7 @@ exports.syncUser = function (ctx) {
|
|
|
109
111
|
return;
|
|
110
112
|
}
|
|
111
113
|
metadata = {
|
|
112
|
-
tableId: InternalTables.USER_METADATA,
|
|
114
|
+
tableId: utils_2.InternalTables.USER_METADATA,
|
|
113
115
|
};
|
|
114
116
|
}
|
|
115
117
|
// assign the roleId for the metadata doc
|
|
@@ -118,7 +120,7 @@ exports.syncUser = function (ctx) {
|
|
|
118
120
|
}
|
|
119
121
|
let combined = !deleting
|
|
120
122
|
? combineMetadataAndUser(user, metadata)
|
|
121
|
-
: Object.assign(Object.assign({}, metadata), { status: UserStatus.INACTIVE, metadata: BUILTIN_ROLE_IDS.PUBLIC });
|
|
123
|
+
: Object.assign(Object.assign({}, metadata), { status: backend_core_1.constants.UserStatus.INACTIVE, metadata: backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC });
|
|
122
124
|
// if its null then there was no updates required
|
|
123
125
|
if (combined) {
|
|
124
126
|
yield db.put(combined);
|
|
@@ -130,48 +132,52 @@ exports.syncUser = function (ctx) {
|
|
|
130
132
|
message: "User synced.",
|
|
131
133
|
};
|
|
132
134
|
});
|
|
133
|
-
}
|
|
134
|
-
exports.
|
|
135
|
+
}
|
|
136
|
+
exports.syncUser = syncUser;
|
|
137
|
+
function fetchMetadata(ctx) {
|
|
135
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
const metadata = yield rawMetadata(database);
|
|
139
|
+
const global = yield (0, global_1.getGlobalUsers)();
|
|
140
|
+
const metadata = yield rawMetadata();
|
|
139
141
|
const users = [];
|
|
140
142
|
for (let user of global) {
|
|
141
143
|
// find the metadata that matches up to the global ID
|
|
142
144
|
const info = metadata.find(meta => meta._id.includes(user._id));
|
|
143
145
|
// remove these props, not for the correct DB
|
|
144
|
-
users.push(Object.assign(Object.assign(Object.assign({}, user), info), { tableId: InternalTables.USER_METADATA,
|
|
146
|
+
users.push(Object.assign(Object.assign(Object.assign({}, user), info), { tableId: utils_2.InternalTables.USER_METADATA,
|
|
145
147
|
// make sure the ID is always a local ID, not a global one
|
|
146
|
-
_id: generateUserMetadataID(user._id) }));
|
|
148
|
+
_id: (0, utils_1.generateUserMetadataID)(user._id) }));
|
|
147
149
|
}
|
|
148
150
|
ctx.body = users;
|
|
149
151
|
});
|
|
150
|
-
}
|
|
151
|
-
exports.
|
|
152
|
+
}
|
|
153
|
+
exports.fetchMetadata = fetchMetadata;
|
|
154
|
+
function updateSelfMetadata(ctx) {
|
|
155
|
+
var _a;
|
|
152
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
153
157
|
// overwrite the ID with current users
|
|
154
|
-
ctx.request.body._id = ctx.user._id;
|
|
158
|
+
ctx.request.body._id = (_a = ctx.user) === null || _a === void 0 ? void 0 : _a._id;
|
|
155
159
|
// make sure no stale rev
|
|
156
160
|
delete ctx.request.body._rev;
|
|
157
161
|
// make sure no csrf token
|
|
158
162
|
delete ctx.request.body.csrfToken;
|
|
159
|
-
yield
|
|
163
|
+
yield updateMetadata(ctx);
|
|
160
164
|
});
|
|
161
|
-
}
|
|
162
|
-
exports.
|
|
165
|
+
}
|
|
166
|
+
exports.updateSelfMetadata = updateSelfMetadata;
|
|
167
|
+
function updateMetadata(ctx) {
|
|
163
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
const db = getAppDB();
|
|
169
|
+
const db = backend_core_1.context.getAppDB();
|
|
165
170
|
const user = ctx.request.body;
|
|
166
171
|
// this isn't applicable to the user
|
|
167
172
|
delete user.roles;
|
|
168
|
-
const metadata = Object.assign({ tableId: InternalTables.USER_METADATA }, user);
|
|
173
|
+
const metadata = Object.assign({ tableId: utils_2.InternalTables.USER_METADATA }, user);
|
|
169
174
|
ctx.body = yield db.put(metadata);
|
|
170
175
|
});
|
|
171
|
-
}
|
|
172
|
-
exports.
|
|
176
|
+
}
|
|
177
|
+
exports.updateMetadata = updateMetadata;
|
|
178
|
+
function destroyMetadata(ctx) {
|
|
173
179
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
const db = getAppDB();
|
|
180
|
+
const db = backend_core_1.context.getAppDB();
|
|
175
181
|
try {
|
|
176
182
|
const dbUser = yield db.get(ctx.params.id);
|
|
177
183
|
yield db.remove(dbUser._id, dbUser._rev);
|
|
@@ -183,21 +189,24 @@ exports.destroyMetadata = function (ctx) {
|
|
|
183
189
|
message: `User metadata ${ctx.params.id} deleted.`,
|
|
184
190
|
};
|
|
185
191
|
});
|
|
186
|
-
}
|
|
187
|
-
exports.
|
|
192
|
+
}
|
|
193
|
+
exports.destroyMetadata = destroyMetadata;
|
|
194
|
+
function findMetadata(ctx) {
|
|
188
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
189
|
-
ctx.body = yield getFullUser(ctx, ctx.params.id);
|
|
196
|
+
ctx.body = yield (0, users_1.getFullUser)(ctx, ctx.params.id);
|
|
190
197
|
});
|
|
191
|
-
}
|
|
192
|
-
exports.
|
|
198
|
+
}
|
|
199
|
+
exports.findMetadata = findMetadata;
|
|
200
|
+
function setFlag(ctx) {
|
|
201
|
+
var _a;
|
|
193
202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
|
-
const userId = ctx.user._id;
|
|
203
|
+
const userId = (_a = ctx.user) === null || _a === void 0 ? void 0 : _a._id;
|
|
195
204
|
const { flag, value } = ctx.request.body;
|
|
196
205
|
if (!flag) {
|
|
197
206
|
ctx.throw(400, "Must supply a 'flag' field in request body.");
|
|
198
207
|
}
|
|
199
|
-
const flagDocId = generateUserFlagID(userId);
|
|
200
|
-
const db = getAppDB();
|
|
208
|
+
const flagDocId = (0, utils_1.generateUserFlagID)(userId);
|
|
209
|
+
const db = backend_core_1.context.getAppDB();
|
|
201
210
|
let doc;
|
|
202
211
|
try {
|
|
203
212
|
doc = yield db.get(flagDocId);
|
|
@@ -209,12 +218,14 @@ exports.setFlag = function (ctx) {
|
|
|
209
218
|
yield db.put(doc);
|
|
210
219
|
ctx.body = { message: "Flag set successfully" };
|
|
211
220
|
});
|
|
212
|
-
}
|
|
213
|
-
exports.
|
|
221
|
+
}
|
|
222
|
+
exports.setFlag = setFlag;
|
|
223
|
+
function getFlags(ctx) {
|
|
224
|
+
var _a;
|
|
214
225
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
|
-
const userId = ctx.user._id;
|
|
216
|
-
const docId = generateUserFlagID(userId);
|
|
217
|
-
const db = getAppDB();
|
|
226
|
+
const userId = (_a = ctx.user) === null || _a === void 0 ? void 0 : _a._id;
|
|
227
|
+
const docId = (0, utils_1.generateUserFlagID)(userId);
|
|
228
|
+
const db = backend_core_1.context.getAppDB();
|
|
218
229
|
let doc;
|
|
219
230
|
try {
|
|
220
231
|
doc = yield db.get(docId);
|
|
@@ -224,4 +235,5 @@ exports.getFlags = function (ctx) {
|
|
|
224
235
|
}
|
|
225
236
|
ctx.body = doc;
|
|
226
237
|
});
|
|
227
|
-
}
|
|
238
|
+
}
|
|
239
|
+
exports.getFlags = getFlags;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExportFormats = exports.json = exports.csv = void 0;
|
|
4
|
+
function csv(headers, rows) {
|
|
3
5
|
let csv = headers.map(key => `"${key}"`).join(",");
|
|
4
6
|
for (let row of rows) {
|
|
5
7
|
csv = `${csv}\n${headers
|
|
@@ -14,10 +16,12 @@ exports.csv = function (headers, rows) {
|
|
|
14
16
|
.join(",")}`;
|
|
15
17
|
}
|
|
16
18
|
return csv;
|
|
17
|
-
}
|
|
18
|
-
exports.
|
|
19
|
+
}
|
|
20
|
+
exports.csv = csv;
|
|
21
|
+
function json(headers, rows) {
|
|
19
22
|
return JSON.stringify(rows, undefined, 2);
|
|
20
|
-
}
|
|
23
|
+
}
|
|
24
|
+
exports.json = json;
|
|
21
25
|
exports.ExportFormats = {
|
|
22
26
|
CSV: "csv",
|
|
23
27
|
JSON: "json",
|