@budibase/server 2.1.39 → 2.1.40-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/aws-sdk.ts +14 -0
- package/__mocks__/node-fetch.ts +5 -1
- package/builder/assets/{index.534f6c29.css → index.144dddb2.css} +2 -2
- package/builder/assets/{index.a89ac148.js → index.fce502b3.js} +311 -311
- package/builder/index.html +2 -2
- package/coverage/clover.xml +10747 -3757
- package/coverage/coverage-final.json +266 -118
- package/coverage/lcov-report/index.html +679 -184
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +190 -0
- package/coverage/lcov-report/{api/controllers/apikeys.js.html → src/api/controllers/apikeys.ts.html} +26 -26
- package/coverage/lcov-report/src/api/controllers/application.ts.html +2038 -0
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +301 -0
- package/coverage/lcov-report/{api/controllers/automation.js.html → src/api/controllers/automation.ts.html} +75 -75
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +148 -0
- package/coverage/lcov-report/{api/controllers/cloud.js.html → src/api/controllers/cloud.ts.html} +47 -47
- package/coverage/lcov-report/src/api/controllers/component.ts.html +259 -0
- package/coverage/lcov-report/{api/controllers/datasource.js.html → src/api/controllers/datasource.ts.html} +246 -87
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +259 -0
- package/coverage/lcov-report/{utilities/rowProcessor → src/api/controllers/deploy}/index.html +40 -40
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +730 -0
- package/coverage/lcov-report/{api/controllers/dev.js.html → src/api/controllers/dev.ts.html} +53 -71
- package/coverage/lcov-report/src/api/controllers/index.html +431 -0
- package/coverage/lcov-report/{api/controllers/integration.js.html → src/api/controllers/integration.ts.html} +19 -22
- package/coverage/lcov-report/{api/controllers/layout.js.html → src/api/controllers/layout.ts.html} +26 -26
- package/coverage/lcov-report/{api/controllers/metadata.js.html → src/api/controllers/metadata.ts.html} +26 -23
- package/coverage/lcov-report/{api/controllers/migrations.js.html → src/api/controllers/migrations.ts.html} +18 -15
- package/coverage/lcov-report/{api/controllers/permission.js.html → src/api/controllers/permission.ts.html} +80 -71
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +130 -0
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +310 -0
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +206 -0
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +484 -0
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +253 -0
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +97 -0
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +121 -0
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +136 -0
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +334 -0
- package/coverage/lcov-report/src/api/controllers/public/index.html +191 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +181 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +191 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +124 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +202 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +178 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +163 -0
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +181 -0
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +145 -0
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +328 -0
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +253 -0
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +268 -0
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +220 -0
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +116 -0
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +373 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +131 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +379 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +157 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +403 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +146 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +586 -0
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +712 -0
- package/coverage/lcov-report/src/api/controllers/query/index.html +131 -0
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +976 -0
- package/coverage/lcov-report/{api/controllers/query/validation.js.html → src/api/controllers/query/validation.ts.html} +17 -17
- package/coverage/lcov-report/{api/controllers/role.js.html → src/api/controllers/role.ts.html} +44 -56
- package/coverage/lcov-report/{api/controllers/routing.js.html → src/api/controllers/routing.ts.html} +65 -56
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +2260 -0
- package/coverage/lcov-report/{api/controllers/row/external.js.html → src/api/controllers/row/external.ts.html} +145 -94
- package/coverage/lcov-report/{api → src/api}/controllers/row/index.html +82 -52
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +541 -0
- package/coverage/lcov-report/{api/controllers/row/internal.js.html → src/api/controllers/row/internal.ts.html} +137 -95
- package/coverage/lcov-report/{api/controllers/row/internalSearch.js.html → src/api/controllers/row/internalSearch.ts.html} +182 -110
- package/coverage/lcov-report/{api/controllers/row/staticFormula.js.html → src/api/controllers/row/staticFormula.ts.html} +66 -51
- package/coverage/lcov-report/{api/controllers/row/utils.js.html → src/api/controllers/row/utils.ts.html} +77 -47
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +463 -0
- package/coverage/lcov-report/{api/controllers/script.js.html → src/api/controllers/script.ts.html} +17 -14
- package/coverage/lcov-report/src/api/controllers/static/index.html +116 -0
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +694 -0
- package/coverage/lcov-report/{api/controllers/table/bulkFormula.js.html → src/api/controllers/table/bulkFormula.ts.html} +96 -54
- package/coverage/lcov-report/{api/controllers/table/external.js.html → src/api/controllers/table/external.ts.html} +196 -103
- package/coverage/lcov-report/src/api/controllers/table/index.html +176 -0
- package/coverage/lcov-report/{api/controllers/table/index.js.html → src/api/controllers/table/index.ts.html} +46 -37
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +661 -0
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +1255 -0
- package/coverage/lcov-report/{api/controllers/templates.js.html → src/api/controllers/templates.ts.html} +34 -25
- package/coverage/lcov-report/{api/controllers/user.js.html → src/api/controllers/user.ts.html} +79 -85
- package/coverage/lcov-report/{api/controllers/view/exporters.js.html → src/api/controllers/view/exporters.ts.html} +20 -14
- package/coverage/lcov-report/{api → src/api}/controllers/view/index.html +36 -36
- package/coverage/lcov-report/{api/controllers/view/index.js.html → src/api/controllers/view/index.ts.html} +75 -48
- package/coverage/lcov-report/{api/controllers/view/utils.js.html → src/api/controllers/view/utils.ts.html} +61 -43
- package/coverage/lcov-report/{api/controllers/view/viewBuilder.js.html → src/api/controllers/view/viewBuilder.ts.html} +74 -32
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +379 -0
- package/coverage/lcov-report/{api → src/api}/index.html +23 -23
- package/coverage/lcov-report/{api/index.js.html → src/api/index.ts.html} +35 -56
- package/coverage/lcov-report/{api/routes/analytics.js.html → src/api/routes/analytics.ts.html} +14 -14
- package/coverage/lcov-report/{api/routes/integration.js.html → src/api/routes/apikeys.ts.html} +18 -18
- package/coverage/lcov-report/{constants/screens.js.html → src/api/routes/application.ts.html} +63 -63
- package/coverage/lcov-report/src/api/routes/auth.ts.html +109 -0
- package/coverage/lcov-report/{api/routes/automation.js.html → src/api/routes/automation.ts.html} +48 -42
- package/coverage/lcov-report/{api/routes/cloud.js.html → src/api/routes/backup.ts.html} +21 -21
- package/coverage/lcov-report/{api/routes/deploy.js.html → src/api/routes/cloud.ts.html} +25 -22
- package/coverage/lcov-report/{api/routes/component.js.html → src/api/routes/component.ts.html} +17 -17
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +265 -0
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +148 -0
- package/coverage/lcov-report/src/api/routes/dev.ts.html +199 -0
- package/coverage/lcov-report/{api → src/api}/routes/index.html +167 -47
- package/coverage/lcov-report/src/api/routes/index.ts.html +289 -0
- package/coverage/lcov-report/src/api/routes/integration.ts.html +133 -0
- package/coverage/lcov-report/{api/routes/layout.js.html → src/api/routes/layout.ts.html} +18 -18
- package/coverage/lcov-report/{api/routes/metadata.js.html → src/api/routes/metadata.ts.html} +24 -24
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +127 -0
- package/coverage/lcov-report/{api/routes/permission.js.html → src/api/routes/permission.ts.html} +48 -24
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +151 -0
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +541 -0
- package/coverage/lcov-report/src/api/routes/public/index.html +191 -0
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +493 -0
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +116 -0
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +328 -0
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +313 -0
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +598 -0
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +586 -0
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +511 -0
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +238 -0
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +116 -0
- package/coverage/lcov-report/{api/routes/query.js.html → src/api/routes/query.ts.html} +33 -42
- package/coverage/lcov-report/{utilities/routing/index.js.html → src/api/routes/role.ts.html} +39 -42
- package/coverage/lcov-report/{api/routes/routing.js.html → src/api/routes/routing.ts.html} +17 -17
- package/coverage/lcov-report/src/api/routes/row.ts.html +883 -0
- package/coverage/lcov-report/{api/routes/screen.js.html → src/api/routes/screen.ts.html} +36 -21
- package/coverage/lcov-report/{api/routes/script.js.html → src/api/routes/script.ts.html} +17 -17
- package/coverage/lcov-report/src/api/routes/static.ts.html +280 -0
- package/coverage/lcov-report/{api/routes/table.js.html → src/api/routes/table.ts.html} +24 -33
- package/coverage/lcov-report/{api/routes/templates.js.html → src/api/routes/templates.ts.html} +18 -18
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +550 -0
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +131 -0
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +367 -0
- package/coverage/lcov-report/{api/routes/user.js.html → src/api/routes/user.ts.html} +29 -35
- package/coverage/lcov-report/{api → src/api}/routes/utils/index.html +15 -15
- package/coverage/lcov-report/{api/routes/utils/validators.js.html → src/api/routes/utils/validators.ts.html} +46 -58
- package/coverage/lcov-report/{api/routes/view.js.html → src/api/routes/view.ts.html} +40 -31
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +166 -0
- package/coverage/lcov-report/src/app.ts.html +406 -0
- package/coverage/lcov-report/{automations/actions.js.html → src/automations/actions.ts.html} +50 -41
- package/coverage/lcov-report/{automations/automationUtils.js.html → src/automations/automationUtils.ts.html} +30 -27
- package/coverage/lcov-report/{automations/bullboard.js.html → src/automations/bullboard.ts.html} +30 -33
- package/coverage/lcov-report/{automations → src/automations}/index.html +63 -48
- package/coverage/lcov-report/{api/routes/dev.js.html → src/automations/index.ts.html} +42 -42
- package/coverage/lcov-report/src/automations/logging/index.html +116 -0
- package/coverage/lcov-report/{events/utils.js.html → src/automations/logging/index.ts.html} +70 -70
- package/coverage/lcov-report/{automations/steps/bash.js.html → src/automations/steps/bash.ts.html} +40 -25
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +382 -0
- package/coverage/lcov-report/{automations/steps/delay.js.html → src/automations/steps/delay.ts.html} +32 -17
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +349 -0
- package/coverage/lcov-report/{automations/steps/discord.js.html → src/automations/steps/discord.ts.html} +38 -23
- package/coverage/lcov-report/{automations/steps/executeQuery.js.html → src/automations/steps/executeQuery.ts.html} +41 -26
- package/coverage/lcov-report/{automations/steps/executeScript.js.html → src/automations/steps/executeScript.ts.html} +54 -24
- package/coverage/lcov-report/{automations/steps/filter.js.html → src/automations/steps/filter.ts.html} +36 -27
- package/coverage/lcov-report/src/automations/steps/index.html +371 -0
- package/coverage/lcov-report/{automations/steps/integromat.js.html → src/automations/steps/integromat.ts.html} +35 -20
- package/coverage/lcov-report/{automations/steps/loop.js.html → src/automations/steps/loop.ts.html} +21 -15
- package/coverage/lcov-report/{automations/steps/outgoingWebhook.js.html → src/automations/steps/outgoingWebhook.ts.html} +48 -33
- package/coverage/lcov-report/{automations/steps/queryRows.js.html → src/automations/steps/queryRows.ts.html} +94 -58
- package/coverage/lcov-report/{automations/steps/sendSmtpEmail.js.html → src/automations/steps/sendSmtpEmail.ts.html} +37 -22
- package/coverage/lcov-report/{automations/steps/serverLog.js.html → src/automations/steps/serverLog.ts.html} +38 -20
- package/coverage/lcov-report/{automations/steps/slack.js.html → src/automations/steps/slack.ts.html} +35 -20
- package/coverage/lcov-report/{automations/steps/updateRow.js.html → src/automations/steps/updateRow.ts.html} +36 -21
- package/coverage/lcov-report/{automations/steps/utils.js.html → src/automations/steps/utils.ts.html} +44 -26
- package/coverage/lcov-report/{automations/steps/zapier.js.html → src/automations/steps/zapier.ts.html} +38 -20
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +116 -0
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +265 -0
- package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +196 -0
- package/coverage/lcov-report/{automations/triggerInfo/cron.js.html → src/automations/triggerInfo/cron.ts.html} +30 -15
- package/coverage/lcov-report/{automations → src/automations}/triggerInfo/index.html +31 -31
- package/coverage/lcov-report/{automations/triggerInfo/index.js.html → src/automations/triggerInfo/index.ts.html} +17 -17
- package/coverage/lcov-report/{automations/triggerInfo/rowDeleted.js.html → src/automations/triggerInfo/rowDeleted.ts.html} +30 -15
- package/coverage/lcov-report/{automations/triggerInfo/rowSaved.js.html → src/automations/triggerInfo/rowSaved.ts.html} +30 -15
- package/coverage/lcov-report/{automations/triggerInfo/rowUpdated.js.html → src/automations/triggerInfo/rowUpdated.ts.html} +30 -15
- package/coverage/lcov-report/{automations/triggerInfo/webhook.js.html → src/automations/triggerInfo/webhook.ts.html} +30 -15
- package/coverage/lcov-report/{automations/triggers.js.html → src/automations/triggers.ts.html} +59 -47
- package/coverage/lcov-report/src/automations/utils.ts.html +886 -0
- package/coverage/lcov-report/{constants → src/constants}/index.html +26 -26
- package/coverage/lcov-report/{constants/index.js.html → src/constants/index.ts.html} +173 -185
- package/coverage/lcov-report/{constants/layouts.js.html → src/constants/layouts.ts.html} +16 -34
- package/coverage/lcov-report/{api/routes/datasource.js.html → src/constants/screens.ts.html} +56 -65
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +2032 -0
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +541 -0
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +427 -0
- package/coverage/lcov-report/src/db/defaultData/index.html +176 -0
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +403 -0
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +559 -0
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +526 -0
- package/coverage/lcov-report/{db/inMemoryView.js.html → src/db/inMemoryView.ts.html} +44 -26
- package/coverage/lcov-report/{db → src/db}/index.html +48 -33
- package/coverage/lcov-report/src/db/index.ts.html +133 -0
- package/coverage/lcov-report/{db/linkedRows/LinkController.js.html → src/db/linkedRows/LinkController.ts.html} +92 -155
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +265 -0
- package/coverage/lcov-report/src/db/linkedRows/index.html +161 -0
- package/coverage/lcov-report/{db/linkedRows/index.js.html → src/db/linkedRows/index.ts.html} +83 -68
- package/coverage/lcov-report/{db/linkedRows/linkUtils.js.html → src/db/linkedRows/linkUtils.ts.html} +73 -46
- package/coverage/lcov-report/{db/newid.js.html → src/db/newid.ts.html} +11 -11
- package/coverage/lcov-report/{db/utils.js.html → src/db/utils.ts.html} +105 -153
- package/coverage/lcov-report/{automations/triggerInfo/app.js.html → src/definitions/automations.ts.html} +42 -42
- package/coverage/lcov-report/src/definitions/datasource.ts.html +235 -0
- package/coverage/lcov-report/src/definitions/index.html +131 -0
- package/coverage/lcov-report/src/environment.ts.html +457 -0
- package/coverage/lcov-report/{events/AutomationEmitter.js.html → src/events/AutomationEmitter.ts.html} +36 -21
- package/coverage/lcov-report/{events/index.js.html → src/events/BudibaseEmitter.ts.html} +23 -26
- package/coverage/lcov-report/{events → src/events}/index.html +48 -33
- package/coverage/lcov-report/src/events/index.ts.html +100 -0
- package/coverage/lcov-report/src/events/utils.ts.html +319 -0
- package/coverage/lcov-report/src/index.html +191 -0
- package/coverage/lcov-report/{db/index.js.html → src/index.ts.html} +35 -35
- package/coverage/lcov-report/{utilities/queue/inMemoryQueue.js.html → src/integrations/airtable.ts.html} +213 -135
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +415 -0
- package/coverage/lcov-report/src/integrations/base/index.html +161 -0
- package/coverage/lcov-report/src/integrations/base/query.ts.html +133 -0
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +1951 -0
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +691 -0
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +121 -0
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +406 -0
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +745 -0
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +634 -0
- package/coverage/lcov-report/src/integrations/firebase.ts.html +646 -0
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +1315 -0
- package/coverage/lcov-report/src/integrations/index.html +371 -0
- package/coverage/lcov-report/src/integrations/index.ts.html +445 -0
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +1006 -0
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +1867 -0
- package/coverage/lcov-report/src/integrations/mysql.ts.html +964 -0
- package/coverage/lcov-report/src/integrations/oracle.ts.html +1474 -0
- package/coverage/lcov-report/src/integrations/postgres.ts.html +1069 -0
- package/coverage/lcov-report/src/integrations/queries/index.html +116 -0
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +463 -0
- package/coverage/lcov-report/src/integrations/redis.ts.html +550 -0
- package/coverage/lcov-report/src/integrations/rest.ts.html +1381 -0
- package/coverage/lcov-report/src/integrations/s3.ts.html +862 -0
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +376 -0
- package/coverage/lcov-report/{integrations → src/integrations}/tests/TestConfiguration.js.html +10 -10
- package/coverage/lcov-report/{integrations → src/integrations}/tests/index.html +10 -10
- package/coverage/lcov-report/src/integrations/utils.ts.html +1018 -0
- package/coverage/lcov-report/{middleware/appInfo.js.html → src/middleware/appInfo.ts.html} +31 -28
- package/coverage/lcov-report/src/middleware/authorized.ts.html +460 -0
- package/coverage/lcov-report/{middleware/builder.js.html → src/middleware/builder.ts.html} +43 -37
- package/coverage/lcov-report/{middleware/currentapp.js.html → src/middleware/currentapp.ts.html} +77 -68
- package/coverage/lcov-report/{middleware → src/middleware}/index.html +78 -63
- package/coverage/lcov-report/{middleware/joi-validator.js.html → src/middleware/joi-validator.ts.html} +25 -22
- package/coverage/lcov-report/{middleware/publicApi.js.html → src/middleware/publicApi.ts.html} +24 -24
- package/coverage/lcov-report/{middleware/resourceId.js.html → src/middleware/resourceId.ts.html} +40 -25
- package/coverage/lcov-report/{api/routes/apikeys.js.html → src/middleware/selfhost.ts.html} +27 -27
- package/coverage/lcov-report/{middleware/utils.js.html → src/middleware/utils.ts.html} +19 -13
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +187 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +163 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +151 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +206 -0
- package/coverage/lcov-report/{automations/index.js.html → src/migrations/functions/backfill/app/layouts.ts.html} +53 -53
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +226 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +151 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +151 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +166 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +532 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +283 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +146 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +265 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +232 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +724 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +161 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +106 -0
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +235 -0
- package/coverage/lcov-report/src/migrations/functions/index.html +146 -0
- package/coverage/lcov-report/{api/routes/role.js.html → src/migrations/functions/syncQuotas.ts.html} +32 -32
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +161 -0
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +94 -0
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +127 -0
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +115 -0
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +169 -0
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +124 -0
- package/coverage/lcov-report/{utilities/queue → src/migrations}/index.html +23 -23
- package/coverage/lcov-report/src/migrations/index.ts.html +403 -0
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +205 -0
- package/coverage/lcov-report/src/migrations/tests/index.html +131 -0
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +283 -0
- package/coverage/lcov-report/src/sdk/app/automations/index.html +131 -0
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +100 -0
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +214 -0
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +91 -0
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +604 -0
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +682 -0
- package/coverage/lcov-report/src/sdk/app/backups/index.html +176 -0
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +112 -0
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +292 -0
- package/coverage/lcov-report/src/sdk/app/tables/index.html +116 -0
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +265 -0
- package/coverage/lcov-report/{utilities/routing → src/sdk}/index.html +10 -10
- package/coverage/lcov-report/{api/routes/migrations.js.html → src/sdk/index.ts.html} +24 -21
- package/coverage/lcov-report/src/startup.ts.html +499 -0
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +1966 -0
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +127 -0
- package/coverage/lcov-report/src/tests/utilities/index.html +161 -0
- package/coverage/lcov-report/{middleware/selfhost.js.html → src/tests/utilities/index.ts.html} +33 -30
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +667 -0
- package/coverage/lcov-report/src/threads/automation.ts.html +1594 -0
- package/coverage/lcov-report/src/threads/index.html +161 -0
- package/coverage/lcov-report/src/threads/index.ts.html +418 -0
- package/coverage/lcov-report/src/threads/query.ts.html +961 -0
- package/coverage/lcov-report/src/threads/utils.ts.html +373 -0
- package/coverage/lcov-report/{utilities/budibaseDir.js.html → src/utilities/budibaseDir.ts.html} +12 -12
- package/coverage/lcov-report/{utilities/centralPath.js.html → src/utilities/centralPath.ts.html} +13 -13
- package/coverage/lcov-report/{utilities/csvParser.js.html → src/utilities/csvParser.ts.html} +104 -56
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +547 -0
- package/coverage/lcov-report/{api/controllers/table → src/utilities/fileSystem}/index.html +43 -43
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1117 -0
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +142 -0
- package/coverage/lcov-report/{utilities/global.js.html → src/utilities/global.ts.html} +107 -74
- package/coverage/lcov-report/{utilities → src/utilities}/index.html +92 -77
- package/coverage/lcov-report/{utilities/index.js.html → src/utilities/index.ts.html} +78 -54
- package/coverage/lcov-report/{utilities/plugins.js.html → src/utilities/plugins.ts.html} +22 -19
- package/coverage/lcov-report/src/utilities/redis.ts.html +343 -0
- package/coverage/lcov-report/{api/controllers/query → src/utilities/routing}/index.html +8 -8
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +181 -0
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +146 -0
- package/coverage/lcov-report/{utilities/rowProcessor/index.js.html → src/utilities/rowProcessor/index.ts.html} +115 -346
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +373 -0
- package/coverage/lcov-report/{utilities/rowProcessor/utils.js.html → src/utilities/rowProcessor/utils.ts.html} +50 -38
- package/coverage/lcov-report/{utilities/scriptRunner.js.html → src/utilities/scriptRunner.ts.html} +28 -16
- package/coverage/lcov-report/{utilities/security.js.html → src/utilities/security.ts.html} +56 -74
- package/coverage/lcov-report/{utilities/statusCodes.js.html → src/utilities/statusCodes.ts.html} +11 -11
- package/coverage/lcov-report/{utilities → src/utilities}/usageQuota/index.html +28 -28
- package/coverage/lcov-report/{utilities/usageQuota/rows.js.html → src/utilities/usageQuota/rows.ts.html} +34 -46
- package/coverage/lcov-report/{utilities/usageQuota/usageQuoteReset.js.html → src/utilities/usageQuota/usageQuoteReset.ts.html} +13 -13
- package/coverage/lcov-report/{utilities/users.js.html → src/utilities/users.ts.html} +29 -35
- package/coverage/lcov-report/{utilities/workerRequests.js.html → src/utilities/workerRequests.ts.html} +129 -114
- package/coverage/lcov-report/src/watch.ts.html +196 -0
- package/coverage/lcov-report/src/websocket.ts.html +163 -0
- package/coverage/lcov.info +19514 -6962
- package/dist/api/controllers/apikeys.js +12 -9
- package/dist/api/controllers/application.js +48 -45
- package/dist/api/controllers/automation.js +122 -82
- package/dist/api/controllers/cloud.js +84 -71
- package/dist/api/controllers/component.js +4 -2
- package/dist/api/controllers/datasource.js +144 -92
- package/dist/api/controllers/deploy/Deployment.js +10 -6
- package/dist/api/controllers/deploy/index.js +13 -16
- package/dist/api/controllers/dev.js +96 -81
- package/dist/api/controllers/integration.js +11 -8
- package/dist/api/controllers/layout.js +18 -15
- package/dist/api/controllers/metadata.js +51 -37
- package/dist/api/controllers/migrations.js +19 -11
- package/dist/api/controllers/permission.js +52 -43
- package/dist/api/controllers/plugin/index.js +6 -7
- package/dist/api/controllers/plugin/utils.js +2 -1
- package/dist/api/controllers/public/applications.js +17 -9
- package/dist/api/controllers/public/tables.js +29 -9
- package/dist/api/controllers/public/utils.js +2 -2
- package/dist/api/controllers/query/import/index.js +1 -2
- package/dist/api/controllers/query/index.js +10 -13
- 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 +538 -542
- package/dist/api/controllers/row/external.js +258 -190
- package/dist/api/controllers/row/index.js +43 -14
- package/dist/api/controllers/row/internal.js +354 -295
- package/dist/api/controllers/row/internalSearch.js +95 -80
- package/dist/api/controllers/row/staticFormula.js +125 -112
- package/dist/api/controllers/row/utils.js +122 -84
- package/dist/api/controllers/screen.js +81 -66
- package/dist/api/controllers/script.js +13 -6
- package/dist/api/controllers/static/index.js +11 -14
- package/dist/api/controllers/table/bulkFormula.js +47 -35
- package/dist/api/controllers/table/external.js +89 -53
- package/dist/api/controllers/table/index.js +64 -31
- package/dist/api/controllers/table/internal.js +5 -6
- package/dist/api/controllers/table/utils.js +39 -35
- 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/controllers/view/viewBuilder.js +4 -16
- package/dist/api/controllers/webhook.js +25 -2
- 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 +33 -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/public/index.js +11 -11
- 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 +12 -11
- 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/tests/utilities/index.js +69 -32
- 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 +22 -22
- package/dist/automations/actions.js +53 -24
- package/dist/automations/automationUtils.js +31 -19
- package/dist/automations/bullboard.js +59 -29
- package/dist/automations/index.js +23 -18
- package/dist/automations/steps/bash.js +40 -10
- package/dist/automations/steps/createRow.js +2 -1
- package/dist/automations/steps/delay.js +9 -5
- package/dist/automations/steps/deleteRow.js +2 -1
- package/dist/automations/steps/discord.js +14 -7
- package/dist/automations/steps/executeQuery.js +34 -7
- package/dist/automations/steps/executeScript.js +34 -7
- package/dist/automations/steps/filter.js +20 -18
- package/dist/automations/steps/integromat.js +14 -7
- package/dist/automations/steps/loop.js +4 -1
- package/dist/automations/steps/outgoingWebhook.js +45 -14
- package/dist/automations/steps/queryRows.js +71 -38
- package/dist/automations/steps/sendSmtpEmail.js +33 -6
- package/dist/automations/steps/serverLog.js +12 -8
- package/dist/automations/steps/slack.js +14 -7
- package/dist/automations/steps/updateRow.js +34 -7
- package/dist/automations/steps/utils.js +22 -16
- package/dist/automations/steps/zapier.js +15 -7
- package/dist/automations/tests/utilities/index.js +62 -38
- package/dist/automations/triggerInfo/app.js +4 -1
- package/dist/automations/triggerInfo/cron.js +4 -1
- package/dist/automations/triggerInfo/index.js +31 -6
- package/dist/automations/triggerInfo/rowDeleted.js +4 -1
- package/dist/automations/triggerInfo/rowSaved.js +4 -1
- package/dist/automations/triggerInfo/rowUpdated.js +4 -1
- package/dist/automations/triggerInfo/webhook.js +4 -1
- package/dist/automations/triggers.js +90 -57
- package/dist/automations/utils.js +9 -8
- package/dist/constants/index.js +118 -104
- package/dist/constants/layouts.js +7 -10
- package/dist/constants/screens.js +49 -44
- package/dist/db/defaultData/datasource_bb_default.js +571 -0
- package/dist/db/defaultData/employeeImport.js +155 -0
- package/dist/db/defaultData/expensesImport.js +117 -0
- package/dist/db/defaultData/inventoryImport.js +109 -0
- package/dist/db/defaultData/jobsImport.js +152 -0
- package/dist/db/dynamoClient.js +20 -20
- package/dist/db/inMemoryView.js +47 -38
- package/dist/db/index.js +7 -4
- package/dist/db/linkedRows/LinkController.js +51 -70
- package/dist/db/linkedRows/LinkDocument.js +32 -0
- package/dist/db/linkedRows/index.js +93 -81
- package/dist/db/linkedRows/linkUtils.js +42 -32
- package/dist/db/utils.js +146 -119
- package/dist/db/views/staticViews.js +91 -74
- package/dist/environment.js +9 -6
- package/dist/events/AutomationEmitter.js +13 -10
- package/dist/events/BudibaseEmitter.js +24 -0
- package/dist/events/index.js +5 -23
- package/dist/events/utils.js +18 -10
- package/dist/integrations/elasticsearch.js +26 -2
- package/dist/integrations/googlesheets.js +5 -6
- package/dist/integrations/index.js +15 -6
- package/dist/integrations/s3.js +157 -1
- package/dist/middleware/appInfo.js +14 -9
- package/dist/middleware/authorized.js +22 -21
- package/dist/middleware/builder.js +41 -40
- package/dist/middleware/currentapp.js +39 -37
- package/dist/middleware/joi-validator.js +17 -10
- package/dist/middleware/publicApi.js +5 -6
- package/dist/middleware/resourceId.js +16 -9
- package/dist/middleware/selfhost.js +5 -4
- package/dist/middleware/utils.js +5 -2
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/backfill/global.js +1 -1
- 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 +11 -45
- package/dist/sdk/app/backups/exports.js +1 -2
- package/dist/sdk/app/backups/imports.js +2 -3
- package/dist/sdk/app/tables/index.js +5 -5
- package/dist/startup.js +10 -10
- package/dist/tests/utilities/TestConfiguration.js +111 -87
- package/dist/tests/utilities/controllers.js +38 -15
- package/dist/tests/utilities/structures.js +72 -53
- package/dist/threads/automation.js +49 -27
- package/dist/threads/query.js +17 -19
- package/dist/threads/utils.js +33 -8
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/budibaseDir.js +4 -2
- package/dist/utilities/centralPath.js +14 -7
- package/dist/utilities/csvParser.js +27 -21
- package/dist/utilities/fileSystem/clientLibrary.js +87 -73
- package/dist/utilities/fileSystem/index.js +202 -175
- package/dist/utilities/fileSystem/processor.js +8 -3
- package/dist/utilities/global.js +87 -66
- package/dist/utilities/index.js +102 -75
- package/dist/utilities/plugins.js +15 -9
- package/dist/utilities/redis.js +100 -65
- package/dist/utilities/routing/index.js +27 -23
- package/dist/utilities/rowProcessor/index.js +133 -191
- package/dist/utilities/rowProcessor/map.js +99 -0
- package/dist/utilities/rowProcessor/utils.js +35 -26
- package/dist/utilities/scriptRunner.js +8 -5
- 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/jest.config.ts +33 -0
- package/package.json +12 -46
- package/scripts/exportAppTemplate.js +2 -2
- package/scripts/localdomain.js +34 -6
- package/src/api/controllers/{apikeys.js → apikeys.ts} +10 -10
- package/src/api/controllers/application.ts +56 -42
- package/src/api/controllers/auth.ts +4 -3
- 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} +100 -47
- package/src/api/controllers/deploy/{Deployment.js → Deployment.ts} +13 -10
- package/src/api/controllers/deploy/index.ts +13 -25
- package/src/api/controllers/{dev.js → dev.ts} +31 -37
- package/src/api/controllers/integration.ts +13 -0
- package/src/api/controllers/{layout.js → layout.ts} +8 -8
- package/src/api/controllers/{metadata.js → metadata.ts} +11 -10
- package/src/api/controllers/migrations.ts +14 -0
- package/src/api/controllers/{permission.js → permission.ts} +49 -46
- package/src/api/controllers/plugin/index.ts +4 -5
- package/src/api/controllers/plugin/utils.ts +3 -5
- package/src/api/controllers/public/applications.ts +15 -9
- package/src/api/controllers/public/rows.ts +1 -1
- package/src/api/controllers/public/tables.ts +2 -2
- package/src/api/controllers/public/utils.ts +2 -2
- package/src/api/controllers/query/import/index.ts +2 -3
- package/src/api/controllers/query/index.ts +11 -14
- 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 +602 -624
- package/src/api/controllers/row/{external.js → external.ts} +79 -62
- package/src/api/controllers/row/index.ts +19 -11
- package/src/api/controllers/row/{internal.js → internal.ts} +87 -73
- package/src/api/controllers/row/{internalSearch.js → internalSearch.ts} +92 -68
- package/src/api/controllers/row/{staticFormula.js → staticFormula.ts} +30 -25
- package/src/api/controllers/row/{utils.js → utils.ts} +32 -22
- package/src/api/controllers/screen.ts +10 -6
- package/src/api/controllers/script.ts +12 -0
- package/src/api/controllers/static/index.ts +14 -16
- package/src/api/controllers/table/{bulkFormula.js → bulkFormula.ts} +39 -25
- package/src/api/controllers/table/{external.js → external.ts} +86 -55
- package/src/api/controllers/table/{index.js → index.ts} +21 -18
- package/src/api/controllers/table/internal.ts +5 -6
- package/src/api/controllers/table/utils.ts +26 -21
- 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/controllers/view/{viewBuilder.js → viewBuilder.ts} +25 -11
- package/src/api/controllers/webhook.ts +1 -1
- 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/public/index.ts +11 -14
- package/src/api/routes/public/tests/compare.spec.js +1 -1
- package/src/api/routes/{query.js → query.ts} +19 -22
- package/src/api/routes/role.ts +24 -0
- package/src/api/routes/routing.ts +14 -0
- package/src/api/routes/row.ts +13 -15
- package/src/api/routes/screen.ts +23 -0
- package/src/api/routes/script.ts +10 -0
- package/src/api/routes/static.ts +7 -10
- package/src/api/routes/{table.js → table.ts} +10 -13
- package/src/api/routes/templates.ts +16 -0
- package/src/api/routes/tests/analytics.spec.js +1 -1
- package/src/api/routes/tests/backup.spec.js +9 -1
- package/src/api/routes/tests/deployment.spec.ts +1 -1
- package/src/api/routes/tests/permissions.spec.js +2 -1
- package/src/api/routes/tests/query.spec.js +15 -10
- package/src/api/routes/tests/role.spec.js +7 -9
- 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/static.spec.js +2 -2
- package/src/api/routes/tests/table.spec.js +40 -36
- package/src/api/routes/tests/user.spec.js +2 -1
- package/src/api/routes/tests/utilities/TestFunctions.ts +6 -8
- package/src/api/routes/tests/utilities/{index.js → index.ts} +12 -12
- package/src/api/routes/user.ts +51 -0
- 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 +15 -14
- package/src/automations/{actions.js → actions.ts} +26 -23
- package/src/automations/{automationUtils.js → automationUtils.ts} +13 -12
- package/src/automations/bullboard.ts +38 -0
- package/src/automations/index.ts +26 -0
- package/src/automations/steps/{bash.js → bash.ts} +13 -8
- package/src/automations/steps/createRow.ts +8 -3
- package/src/automations/steps/{delay.js → delay.ts} +9 -4
- package/src/automations/steps/deleteRow.ts +8 -3
- package/src/automations/steps/{discord.js → discord.ts} +10 -5
- package/src/automations/steps/{executeQuery.js → executeQuery.ts} +12 -7
- package/src/automations/steps/{executeScript.js → executeScript.ts} +17 -7
- package/src/automations/steps/{filter.js → filter.ts} +12 -9
- package/src/automations/steps/{integromat.js → integromat.ts} +10 -5
- package/src/automations/steps/{loop.js → loop.ts} +4 -2
- package/src/automations/steps/{outgoingWebhook.js → outgoingWebhook.ts} +18 -13
- package/src/automations/steps/{queryRows.js → queryRows.ts} +48 -36
- package/src/automations/steps/{sendSmtpEmail.js → sendSmtpEmail.ts} +10 -5
- package/src/automations/steps/{serverLog.js → serverLog.ts} +9 -3
- package/src/automations/steps/{slack.js → slack.ts} +10 -5
- package/src/automations/steps/{updateRow.js → updateRow.ts} +12 -7
- package/src/automations/steps/{utils.js → utils.ts} +10 -4
- package/src/automations/steps/{zapier.js → zapier.ts} +11 -5
- package/src/automations/tests/updateRow.spec.js +0 -1
- package/src/automations/tests/utilities/index.ts +60 -0
- package/src/automations/triggerInfo/{app.js → app.ts} +7 -2
- package/src/automations/triggerInfo/{cron.js → cron.ts} +7 -2
- package/src/automations/triggerInfo/index.ts +15 -0
- package/src/automations/triggerInfo/{rowDeleted.js → rowDeleted.ts} +7 -2
- package/src/automations/triggerInfo/{rowSaved.js → rowSaved.ts} +7 -2
- package/src/automations/triggerInfo/{rowUpdated.js → rowUpdated.ts} +7 -2
- package/src/automations/triggerInfo/{webhook.js → webhook.ts} +7 -2
- package/src/automations/{triggers.js → triggers.ts} +30 -26
- package/src/automations/utils.ts +9 -12
- package/src/constants/index.ts +204 -0
- package/src/constants/{layouts.js → layouts.ts} +3 -9
- package/src/constants/screens.ts +48 -0
- package/src/db/defaultData/datasource_bb_default.ts +649 -0
- package/src/db/defaultData/employeeImport.ts +152 -0
- package/src/db/defaultData/expensesImport.ts +114 -0
- package/src/db/defaultData/inventoryImport.ts +106 -0
- package/src/db/defaultData/jobsImport.ts +158 -0
- package/src/db/{dynamoClient.js → dynamoClient.ts} +39 -19
- package/src/db/{inMemoryView.js → inMemoryView.ts} +15 -9
- package/src/db/index.ts +16 -0
- package/src/db/linkedRows/{LinkController.js → LinkController.ts} +64 -85
- package/src/db/linkedRows/LinkDocument.ts +60 -0
- package/src/db/linkedRows/{index.js → index.ts} +43 -38
- package/src/db/linkedRows/{linkUtils.js → linkUtils.ts} +33 -24
- package/src/db/{newid.js → newid.ts} +1 -1
- package/src/db/tests/linkController.spec.js +73 -57
- package/src/db/tests/linkTests.spec.js +17 -14
- package/src/db/{utils.js → utils.ts} +77 -93
- package/src/db/views/{staticViews.js → staticViews.ts} +20 -13
- package/src/{environment.js → environment.ts} +11 -7
- package/src/events/{AutomationEmitter.js → AutomationEmitter.ts} +12 -7
- package/src/events/{index.js → BudibaseEmitter.ts} +7 -8
- package/src/events/index.ts +5 -0
- package/src/events/utils.ts +78 -0
- package/src/integrations/base/sql.ts +1 -1
- package/src/integrations/base/sqlTable.ts +1 -1
- package/src/integrations/elasticsearch.ts +32 -2
- package/src/integrations/googlesheets.ts +5 -7
- package/src/integrations/index.ts +45 -41
- package/src/integrations/s3.ts +179 -3
- package/src/integrations/tests/s3.spec.ts +85 -1
- package/src/integrations/utils.ts +6 -2
- package/src/middleware/appInfo.ts +20 -0
- package/src/middleware/authorized.ts +21 -28
- package/src/middleware/{builder.js → builder.ts} +17 -15
- package/src/middleware/{currentapp.js → currentapp.ts} +42 -39
- package/src/middleware/{joi-validator.js → joi-validator.ts} +9 -8
- package/src/middleware/publicApi.ts +21 -0
- package/src/middleware/{resourceId.js → resourceId.ts} +16 -11
- package/src/middleware/{selfhost.js → selfhost.ts} +4 -2
- package/src/middleware/tests/authorized.spec.js +5 -6
- package/src/middleware/tests/currentapp.spec.js +118 -63
- package/src/middleware/{utils.js → utils.ts} +3 -1
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/backfill/app/tables.ts +2 -5
- package/src/migrations/functions/backfill/global.ts +1 -1
- 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 +4 -5
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +7 -7
- package/src/migrations/functions/userEmailViewCasing.ts +3 -3
- package/src/migrations/tests/index.spec.ts +1 -1
- package/src/sdk/app/backups/exports.ts +5 -3
- package/src/sdk/app/backups/imports.ts +7 -14
- package/src/sdk/app/backups/statistics.ts +9 -18
- package/src/sdk/app/tables/index.ts +7 -8
- package/src/startup.ts +5 -5
- package/{scripts/jestSetup.js → src/tests/jestSetup.ts} +11 -2
- package/src/tests/utilities/{TestConfiguration.js → TestConfiguration.ts} +111 -78
- package/src/tests/utilities/controllers.ts +14 -0
- package/src/tests/utilities/{index.js → index.ts} +2 -2
- package/src/tests/utilities/{structures.js → structures.ts} +41 -36
- package/src/threads/automation.ts +18 -19
- package/src/threads/query.ts +11 -16
- package/src/threads/utils.ts +4 -5
- package/src/utilities/budibaseDir.ts +3 -0
- package/src/utilities/{centralPath.js → centralPath.ts} +3 -3
- package/src/utilities/{csvParser.js → csvParser.ts} +42 -26
- package/src/utilities/fileSystem/{clientLibrary.js → clientLibrary.ts} +20 -20
- package/src/utilities/fileSystem/{index.js → index.ts} +55 -63
- package/src/utilities/fileSystem/{processor.js → processor.ts} +3 -5
- package/src/utilities/global.ts +138 -0
- package/src/utilities/{index.js → index.ts} +40 -32
- package/src/utilities/{plugins.js → plugins.ts} +5 -4
- 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} +67 -144
- package/src/utilities/rowProcessor/map.ts +96 -0
- package/src/utilities/rowProcessor/{utils.js → utils.ts} +19 -15
- package/src/utilities/{scriptRunner.js → scriptRunner.ts} +8 -4
- package/src/utilities/security.ts +65 -0
- package/src/utilities/{statusCodes.js → statusCodes.ts} +1 -1
- package/src/utilities/usageQuota/{rows.js → rows.ts} +14 -18
- package/src/utilities/usageQuota/{usageQuoteReset.js → usageQuoteReset.ts} +1 -1
- 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/tsconfig.build.json +1 -2
- package/tsconfig.json +3 -1
- package/coverage/lcov-report/api/controllers/index.html +0 -326
- package/coverage/lcov-report/automations/steps/index.html +0 -341
- package/coverage/lcov-report/db/linkedRows/index.html +0 -146
- package/dist/integrations/tests/TestConfiguration.js +0 -1
- package/dist/utilities/fileSystem/utilities.js +0 -22
- package/dist/utilities/queue/inMemoryQueue.js +0 -126
- package/src/api/controllers/integration.js +0 -14
- package/src/api/controllers/migrations.js +0 -13
- 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/user.js +0 -53
- package/src/api/routes/view.js +0 -31
- package/src/automations/bullboard.js +0 -39
- package/src/automations/index.js +0 -29
- package/src/automations/tests/utilities/index.js +0 -51
- package/src/automations/triggerInfo/index.js +0 -15
- package/src/constants/index.js +0 -208
- package/src/constants/screens.js +0 -46
- package/src/db/index.js +0 -16
- package/src/events/utils.js +0 -38
- package/src/middleware/appInfo.js +0 -19
- package/src/middleware/publicApi.js +0 -21
- package/src/module.d.ts +0 -14
- package/src/tests/utilities/controllers.js +0 -16
- package/src/utilities/budibaseDir.js +0 -3
- package/src/utilities/fileSystem/utilities.js +0 -36
- package/src/utilities/global.js +0 -127
- package/src/utilities/queue/inMemoryQueue.js +0 -122
- package/src/utilities/routing/index.js +0 -25
- package/src/utilities/security.js +0 -71
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const index_1 = __importDefault(require("./index"));
|
|
7
|
+
const environment_1 = __importDefault(require("../environment"));
|
|
5
8
|
// max number of automations that can chain on top of each other
|
|
6
9
|
// TODO: in future make this configurable at the automation level
|
|
7
|
-
const MAX_AUTOMATION_CHAIN =
|
|
10
|
+
const MAX_AUTOMATION_CHAIN = environment_1.default.SELF_HOSTED ? 5 : 0;
|
|
8
11
|
/**
|
|
9
12
|
* Special emitter which takes the count of automation runs which have occurred and blocks an
|
|
10
13
|
* automation from running if it has reached the maximum number of chained automations runs.
|
|
@@ -18,13 +21,13 @@ class AutomationEmitter {
|
|
|
18
21
|
automationChainCount: chainCount,
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
|
-
emitRow(eventName, appId, row, table
|
|
24
|
+
emitRow(eventName, appId, row, table) {
|
|
22
25
|
// don't emit even if we've reached max automation chain
|
|
23
26
|
if (this.chainCount >= MAX_AUTOMATION_CHAIN) {
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
26
|
-
rowEmission({
|
|
27
|
-
emitter:
|
|
29
|
+
(0, utils_1.rowEmission)({
|
|
30
|
+
emitter: index_1.default,
|
|
28
31
|
eventName,
|
|
29
32
|
appId,
|
|
30
33
|
row,
|
|
@@ -32,13 +35,13 @@ class AutomationEmitter {
|
|
|
32
35
|
metadata: this.metadata,
|
|
33
36
|
});
|
|
34
37
|
}
|
|
35
|
-
emitTable(eventName, appId, table
|
|
38
|
+
emitTable(eventName, appId, table) {
|
|
36
39
|
// don't emit even if we've reached max automation chain
|
|
37
40
|
if (this.chainCount > MAX_AUTOMATION_CHAIN) {
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
|
-
tableEmission({
|
|
41
|
-
emitter:
|
|
43
|
+
(0, utils_1.tableEmission)({
|
|
44
|
+
emitter: index_1.default,
|
|
42
45
|
eventName,
|
|
43
46
|
appId,
|
|
44
47
|
table,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const events_1 = require("events");
|
|
3
|
+
const utils_1 = require("./utils");
|
|
4
|
+
/**
|
|
5
|
+
* keeping event emitter in one central location as it might be used for things other than
|
|
6
|
+
* automations (what it was for originally) - having a central emitter will be useful in the
|
|
7
|
+
* future.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Extending the standard emitter to some syntactic sugar and standardisation to the emitted event.
|
|
11
|
+
* This is specifically quite important for template strings used in automations.
|
|
12
|
+
*/
|
|
13
|
+
class BudibaseEmitter extends events_1.EventEmitter {
|
|
14
|
+
emitRow(eventName, appId, row, table) {
|
|
15
|
+
(0, utils_1.rowEmission)({ emitter: this, eventName, appId, row, table });
|
|
16
|
+
}
|
|
17
|
+
emitTable(eventName, appId, table) {
|
|
18
|
+
(0, utils_1.tableEmission)({ emitter: this, eventName, appId, table });
|
|
19
|
+
}
|
|
20
|
+
emitPort(portNumber) {
|
|
21
|
+
this.emit("internal:port", portNumber);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
module.exports = BudibaseEmitter;
|
package/dist/events/index.js
CHANGED
|
@@ -1,25 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* future.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Extending the standard emitter to some syntactic sugar and standardisation to the emitted event.
|
|
11
|
-
* This is specifically quite important for template strings used in automations.
|
|
12
|
-
*/
|
|
13
|
-
class BudibaseEmitter extends EventEmitter {
|
|
14
|
-
emitRow(eventName, appId, row, table = null) {
|
|
15
|
-
rowEmission({ emitter: this, eventName, appId, row, table });
|
|
16
|
-
}
|
|
17
|
-
emitTable(eventName, appId, table = null) {
|
|
18
|
-
tableEmission({ emitter: this, eventName, appId, table });
|
|
19
|
-
}
|
|
20
|
-
emitPort(portNumber) {
|
|
21
|
-
this.emit("internal:port", portNumber);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
const emitter = new BudibaseEmitter();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const BudibaseEmitter_1 = __importDefault(require("./BudibaseEmitter"));
|
|
6
|
+
const emitter = new BudibaseEmitter_1.default();
|
|
25
7
|
module.exports = emitter;
|
package/dist/events/utils.js
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tableEmission = exports.rowEmission = void 0;
|
|
4
|
+
function rowEmission({ emitter, eventName, appId, row, table, metadata, }) {
|
|
3
5
|
let event = {
|
|
4
6
|
row,
|
|
5
7
|
appId,
|
|
6
|
-
tableId: row.tableId,
|
|
8
|
+
tableId: row === null || row === void 0 ? void 0 : row.tableId,
|
|
7
9
|
};
|
|
8
10
|
if (table) {
|
|
9
11
|
event.table = table;
|
|
10
12
|
}
|
|
11
|
-
event.id = row._id;
|
|
12
|
-
if (row._rev) {
|
|
13
|
+
event.id = row === null || row === void 0 ? void 0 : row._id;
|
|
14
|
+
if (row === null || row === void 0 ? void 0 : row._rev) {
|
|
13
15
|
event.revision = row._rev;
|
|
14
16
|
}
|
|
15
17
|
if (metadata) {
|
|
16
18
|
event.metadata = metadata;
|
|
17
19
|
}
|
|
18
20
|
emitter.emit(eventName, event);
|
|
19
|
-
}
|
|
20
|
-
exports.
|
|
21
|
-
|
|
21
|
+
}
|
|
22
|
+
exports.rowEmission = rowEmission;
|
|
23
|
+
function tableEmission({ emitter, eventName, appId, table, metadata, }) {
|
|
24
|
+
const tableId = table === null || table === void 0 ? void 0 : table._id;
|
|
25
|
+
const inputTable = table;
|
|
26
|
+
if (inputTable) {
|
|
27
|
+
inputTable.tableId = tableId;
|
|
28
|
+
}
|
|
22
29
|
let event = {
|
|
23
|
-
table:
|
|
30
|
+
table: inputTable,
|
|
24
31
|
appId,
|
|
25
32
|
tableId: tableId,
|
|
26
33
|
};
|
|
27
34
|
event.id = tableId;
|
|
28
|
-
if (table._rev) {
|
|
35
|
+
if (table === null || table === void 0 ? void 0 : table._rev) {
|
|
29
36
|
event.revision = table._rev;
|
|
30
37
|
}
|
|
31
38
|
if (metadata) {
|
|
32
39
|
event.metadata = metadata;
|
|
33
40
|
}
|
|
34
41
|
emitter.emit(eventName, event);
|
|
35
|
-
}
|
|
42
|
+
}
|
|
43
|
+
exports.tableEmission = tableEmission;
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const types_1 = require("@budibase/types");
|
|
13
|
-
const
|
|
13
|
+
const elasticsearch_1 = require("@elastic/elasticsearch");
|
|
14
14
|
const SCHEMA = {
|
|
15
15
|
docs: "https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
|
16
16
|
description: "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
|
|
@@ -22,6 +22,21 @@ const SCHEMA = {
|
|
|
22
22
|
required: true,
|
|
23
23
|
default: "http://localhost:9200",
|
|
24
24
|
},
|
|
25
|
+
ssl: {
|
|
26
|
+
type: types_1.DatasourceFieldType.BOOLEAN,
|
|
27
|
+
default: false,
|
|
28
|
+
required: false,
|
|
29
|
+
},
|
|
30
|
+
rejectUnauthorized: {
|
|
31
|
+
type: types_1.DatasourceFieldType.BOOLEAN,
|
|
32
|
+
default: true,
|
|
33
|
+
required: false,
|
|
34
|
+
},
|
|
35
|
+
ca: {
|
|
36
|
+
type: types_1.DatasourceFieldType.LONGFORM,
|
|
37
|
+
default: false,
|
|
38
|
+
required: false,
|
|
39
|
+
},
|
|
25
40
|
},
|
|
26
41
|
query: {
|
|
27
42
|
create: {
|
|
@@ -76,7 +91,16 @@ const SCHEMA = {
|
|
|
76
91
|
class ElasticSearchIntegration {
|
|
77
92
|
constructor(config) {
|
|
78
93
|
this.config = config;
|
|
79
|
-
|
|
94
|
+
const clientConfig = {
|
|
95
|
+
node: this.config.url,
|
|
96
|
+
};
|
|
97
|
+
if (this.config.ssl) {
|
|
98
|
+
clientConfig.ssl = {
|
|
99
|
+
rejectUnauthorized: this.config.rejectUnauthorized,
|
|
100
|
+
ca: this.config.ca || undefined,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
this.client = new elasticsearch_1.Client(clientConfig);
|
|
80
104
|
}
|
|
81
105
|
create(query) {
|
|
82
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -18,9 +18,7 @@ const utils_1 = require("./utils");
|
|
|
18
18
|
const constants_1 = require("../constants");
|
|
19
19
|
const google_spreadsheet_1 = require("google-spreadsheet");
|
|
20
20
|
const environment_1 = __importDefault(require("../environment"));
|
|
21
|
-
const
|
|
22
|
-
const { getScopedConfig } = require("@budibase/backend-core/db");
|
|
23
|
-
const { Configs } = require("@budibase/backend-core/constants");
|
|
21
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
24
22
|
const fetch = require("node-fetch");
|
|
25
23
|
const SCHEMA = {
|
|
26
24
|
plus: true,
|
|
@@ -140,9 +138,9 @@ class GoogleSheetsIntegration {
|
|
|
140
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
141
139
|
try {
|
|
142
140
|
// Initialise oAuth client
|
|
143
|
-
const db = getGlobalDB();
|
|
144
|
-
let googleConfig = yield getScopedConfig(db, {
|
|
145
|
-
type:
|
|
141
|
+
const db = backend_core_1.tenancy.getGlobalDB();
|
|
142
|
+
let googleConfig = yield backend_core_1.db.getScopedConfig(db, {
|
|
143
|
+
type: backend_core_1.constants.Config.GOOGLE,
|
|
146
144
|
});
|
|
147
145
|
if (!googleConfig) {
|
|
148
146
|
googleConfig = {
|
|
@@ -227,6 +225,7 @@ class GoogleSheetsIntegration {
|
|
|
227
225
|
[constants_1.DataSourceOperation.UPDATE_TABLE]: () => this.updateTable(json.table),
|
|
228
226
|
[constants_1.DataSourceOperation.DELETE_TABLE]: () => { var _a; return this.deleteTable((_a = json === null || json === void 0 ? void 0 : json.table) === null || _a === void 0 ? void 0 : _a.name); },
|
|
229
227
|
};
|
|
228
|
+
// @ts-ignore
|
|
230
229
|
const internalQueryMethod = handlers[json.endpoint.operation];
|
|
231
230
|
return yield internalQueryMethod();
|
|
232
231
|
});
|
|
@@ -12,6 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getIntegration = exports.getDefinitions = void 0;
|
|
15
16
|
const postgres_1 = __importDefault(require("./postgres"));
|
|
16
17
|
const dynamodb_1 = __importDefault(require("./dynamodb"));
|
|
17
18
|
const mongodb_1 = __importDefault(require("./mongodb"));
|
|
@@ -75,8 +76,8 @@ if (process.arch &&
|
|
|
75
76
|
DEFINITIONS[types_1.SourceName.ORACLE] = oracle_1.default.schema;
|
|
76
77
|
INTEGRATIONS[types_1.SourceName.ORACLE] = oracle_1.default.integration;
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
function getDefinitions() {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
81
|
const pluginSchemas = {};
|
|
81
82
|
if (environment.SELF_HOSTED) {
|
|
82
83
|
const plugins = yield (0, plugin_1.getPlugins)(types_1.PluginType.DATASOURCE);
|
|
@@ -90,9 +91,12 @@ module.exports = {
|
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
return Object.assign(Object.assign({}, cloneDeep(DEFINITIONS)), pluginSchemas);
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
exports.getDefinitions = getDefinitions;
|
|
97
|
+
function getIntegration(integration) {
|
|
98
|
+
var _a;
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
100
|
if (INTEGRATIONS[integration]) {
|
|
97
101
|
return INTEGRATIONS[integration];
|
|
98
102
|
}
|
|
@@ -112,5 +116,10 @@ module.exports = {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
throw new Error("No datasource implementation found.");
|
|
115
|
-
})
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
exports.getIntegration = getIntegration;
|
|
122
|
+
exports.default = {
|
|
123
|
+
getDefinitions,
|
|
124
|
+
getIntegration,
|
|
116
125
|
};
|
package/dist/integrations/s3.js
CHANGED
|
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const types_1 = require("@budibase/types");
|
|
13
13
|
const AWS = require("aws-sdk");
|
|
14
|
+
const csv = require("csvtojson");
|
|
14
15
|
const SCHEMA = {
|
|
15
16
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
|
16
17
|
description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
@@ -41,16 +42,106 @@ const SCHEMA = {
|
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
query: {
|
|
45
|
+
create: {
|
|
46
|
+
type: types_1.QueryType.FIELDS,
|
|
47
|
+
fields: {
|
|
48
|
+
bucket: {
|
|
49
|
+
display: "New Bucket",
|
|
50
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
location: {
|
|
54
|
+
required: true,
|
|
55
|
+
default: "us-east-1",
|
|
56
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
57
|
+
},
|
|
58
|
+
grantFullControl: {
|
|
59
|
+
display: "Grant full control",
|
|
60
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
61
|
+
},
|
|
62
|
+
grantRead: {
|
|
63
|
+
display: "Grant read",
|
|
64
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
65
|
+
},
|
|
66
|
+
grantReadAcp: {
|
|
67
|
+
display: "Grant read ACP",
|
|
68
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
69
|
+
},
|
|
70
|
+
grantWrite: {
|
|
71
|
+
display: "Grant write",
|
|
72
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
73
|
+
},
|
|
74
|
+
grantWriteAcp: {
|
|
75
|
+
display: "Grant write ACP",
|
|
76
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
44
80
|
read: {
|
|
45
81
|
type: types_1.QueryType.FIELDS,
|
|
46
82
|
fields: {
|
|
47
83
|
bucket: {
|
|
48
|
-
type:
|
|
84
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
85
|
+
required: true,
|
|
86
|
+
},
|
|
87
|
+
delimiter: {
|
|
88
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
89
|
+
},
|
|
90
|
+
marker: {
|
|
91
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
92
|
+
},
|
|
93
|
+
maxKeys: {
|
|
94
|
+
type: types_1.DatasourceFieldType.NUMBER,
|
|
95
|
+
display: "Max Keys",
|
|
96
|
+
},
|
|
97
|
+
prefix: {
|
|
98
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
readCsv: {
|
|
103
|
+
displayName: "Read CSV",
|
|
104
|
+
type: types_1.QueryType.FIELDS,
|
|
105
|
+
fields: {
|
|
106
|
+
bucket: {
|
|
107
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
108
|
+
required: true,
|
|
109
|
+
},
|
|
110
|
+
key: {
|
|
111
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
112
|
+
required: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
delete: {
|
|
117
|
+
type: types_1.QueryType.FIELDS,
|
|
118
|
+
fields: {
|
|
119
|
+
bucket: {
|
|
120
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
121
|
+
required: true,
|
|
122
|
+
},
|
|
123
|
+
delete: {
|
|
124
|
+
type: types_1.DatasourceFieldType.JSON,
|
|
49
125
|
required: true,
|
|
50
126
|
},
|
|
51
127
|
},
|
|
52
128
|
},
|
|
53
129
|
},
|
|
130
|
+
extra: {
|
|
131
|
+
acl: {
|
|
132
|
+
required: false,
|
|
133
|
+
displayName: "ACL",
|
|
134
|
+
type: types_1.DatasourceFieldType.LIST,
|
|
135
|
+
data: {
|
|
136
|
+
create: [
|
|
137
|
+
"private",
|
|
138
|
+
"public-read",
|
|
139
|
+
"public-read-write",
|
|
140
|
+
"authenticated-read",
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
54
145
|
};
|
|
55
146
|
class S3Integration {
|
|
56
147
|
constructor(config) {
|
|
@@ -63,16 +154,81 @@ class S3Integration {
|
|
|
63
154
|
}
|
|
64
155
|
this.client = new AWS.S3(this.config);
|
|
65
156
|
}
|
|
157
|
+
create(query) {
|
|
158
|
+
var _a;
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
let params = {
|
|
161
|
+
Bucket: query.bucket,
|
|
162
|
+
ACL: (_a = query.extra) === null || _a === void 0 ? void 0 : _a.acl,
|
|
163
|
+
GrantFullControl: query.grantFullControl,
|
|
164
|
+
GrantRead: query.grantRead,
|
|
165
|
+
GrantReadACP: query.grantReadAcp,
|
|
166
|
+
GrantWrite: query.grantWrite,
|
|
167
|
+
GrantWriteACP: query.grantWriteAcp,
|
|
168
|
+
};
|
|
169
|
+
if (query.location) {
|
|
170
|
+
params["CreateBucketConfiguration"] = {
|
|
171
|
+
LocationConstraint: query.location,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
return yield this.client.createBucket(params).promise();
|
|
175
|
+
});
|
|
176
|
+
}
|
|
66
177
|
read(query) {
|
|
67
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
179
|
const response = yield this.client
|
|
69
180
|
.listObjects({
|
|
70
181
|
Bucket: query.bucket,
|
|
182
|
+
Delimiter: query.delimiter,
|
|
183
|
+
Marker: query.marker,
|
|
184
|
+
MaxKeys: query.maxKeys,
|
|
185
|
+
Prefix: query.prefix,
|
|
71
186
|
})
|
|
72
187
|
.promise();
|
|
73
188
|
return response.Contents;
|
|
74
189
|
});
|
|
75
190
|
}
|
|
191
|
+
readCsv(query) {
|
|
192
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const stream = this.client
|
|
194
|
+
.getObject({
|
|
195
|
+
Bucket: query.bucket,
|
|
196
|
+
Key: query.key,
|
|
197
|
+
})
|
|
198
|
+
.createReadStream();
|
|
199
|
+
let csvError = false;
|
|
200
|
+
return new Promise((resolve, reject) => {
|
|
201
|
+
stream.on("error", (err) => {
|
|
202
|
+
reject(err);
|
|
203
|
+
});
|
|
204
|
+
const response = csv()
|
|
205
|
+
.fromStream(stream)
|
|
206
|
+
.on("error", () => {
|
|
207
|
+
csvError = true;
|
|
208
|
+
});
|
|
209
|
+
stream.on("finish", () => {
|
|
210
|
+
resolve(response);
|
|
211
|
+
});
|
|
212
|
+
}).catch(err => {
|
|
213
|
+
if (csvError) {
|
|
214
|
+
throw new Error("Could not read CSV");
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
throw err;
|
|
218
|
+
}
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
delete(query) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
return yield this.client
|
|
225
|
+
.deleteObjects({
|
|
226
|
+
Bucket: query.bucket,
|
|
227
|
+
Delete: JSON.parse(query.delete),
|
|
228
|
+
})
|
|
229
|
+
.promise();
|
|
230
|
+
});
|
|
231
|
+
}
|
|
76
232
|
}
|
|
77
233
|
exports.default = {
|
|
78
234
|
schema: SCHEMA,
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.AppType =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.middleware = exports.AppType = void 0;
|
|
4
|
+
const utils_1 = require("../db/utils");
|
|
5
|
+
var AppType;
|
|
6
|
+
(function (AppType) {
|
|
7
|
+
AppType["DEV"] = "dev";
|
|
8
|
+
AppType["PROD"] = "prod";
|
|
9
|
+
})(AppType = exports.AppType || (exports.AppType = {}));
|
|
10
|
+
function middleware({ appType } = {}) {
|
|
11
|
+
return (ctx, next) => {
|
|
9
12
|
const appId = ctx.appId;
|
|
10
|
-
if (appType ===
|
|
13
|
+
if (appType === AppType.DEV && appId && !(0, utils_1.isDevAppID)(appId)) {
|
|
11
14
|
ctx.throw(400, "Only apps in development support this endpoint");
|
|
12
15
|
}
|
|
13
|
-
if (appType ===
|
|
16
|
+
if (appType === AppType.PROD && appId && !(0, utils_1.isProdAppID)(appId)) {
|
|
14
17
|
ctx.throw(400, "Only apps in production support this endpoint");
|
|
15
18
|
}
|
|
16
19
|
return next();
|
|
17
20
|
};
|
|
21
|
+
}
|
|
22
|
+
exports.middleware = middleware;
|
|
@@ -8,16 +8,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
15
|
+
const builder_1 = __importDefault(require("./builder"));
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
17
|
function hasResource(ctx) {
|
|
18
18
|
return ctx.resourceId != null;
|
|
19
19
|
}
|
|
20
|
-
const csrf = buildCsrfMiddleware();
|
|
20
|
+
const csrf = backend_core_1.auth.buildCsrfMiddleware();
|
|
21
21
|
/**
|
|
22
22
|
* Apply authorization to the requested resource:
|
|
23
23
|
* - If this is a builder resource the user must be a builder.
|
|
@@ -27,7 +27,7 @@ const csrf = buildCsrfMiddleware();
|
|
|
27
27
|
const checkAuthorized = (ctx, resourceRoles, permType, permLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
28
|
// check if this is a builder api and the user is not a builder
|
|
29
29
|
const isBuilder = ctx.user && ctx.user.builder && ctx.user.builder.global;
|
|
30
|
-
const isBuilderApi = permType ===
|
|
30
|
+
const isBuilderApi = permType === backend_core_1.permissions.PermissionType.BUILDER;
|
|
31
31
|
if (isBuilderApi && !isBuilder) {
|
|
32
32
|
return ctx.throw(403, "Not Authorized");
|
|
33
33
|
}
|
|
@@ -38,8 +38,8 @@ const checkAuthorized = (ctx, resourceRoles, permType, permLevel) => __awaiter(v
|
|
|
38
38
|
});
|
|
39
39
|
const checkAuthorizedResource = (ctx, resourceRoles, permType, permLevel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
40
|
// get the user's roles
|
|
41
|
-
const roleId = ctx.roleId ||
|
|
42
|
-
const userRoles = (yield
|
|
41
|
+
const roleId = ctx.roleId || backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC;
|
|
42
|
+
const userRoles = (yield backend_core_1.roles.getUserRoleHierarchy(roleId, {
|
|
43
43
|
idOnly: false,
|
|
44
44
|
}));
|
|
45
45
|
const permError = "User does not have permission";
|
|
@@ -52,14 +52,14 @@ const checkAuthorizedResource = (ctx, resourceRoles, permType, permLevel) => __a
|
|
|
52
52
|
}
|
|
53
53
|
// fallback to the base permissions when no resource roles are found
|
|
54
54
|
}
|
|
55
|
-
else if (!doesHaveBasePermission(permType, permLevel, userRoles)) {
|
|
55
|
+
else if (!backend_core_1.permissions.doesHaveBasePermission(permType, permLevel, userRoles)) {
|
|
56
56
|
ctx.throw(403, permError);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
module.exports = (permType, permLevel = null, opts = { schema: false }) => (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
60
|
// webhooks don't need authentication, each webhook unique
|
|
61
61
|
// also internal requests (between services) don't need authorized
|
|
62
|
-
if (isWebhookEndpoint(ctx) || ctx.internal) {
|
|
62
|
+
if ((0, utils_1.isWebhookEndpoint)(ctx) || ctx.internal) {
|
|
63
63
|
return next();
|
|
64
64
|
}
|
|
65
65
|
if (!ctx.user) {
|
|
@@ -67,23 +67,24 @@ module.exports = (permType, permLevel = null, opts = { schema: false }) => (ctx,
|
|
|
67
67
|
}
|
|
68
68
|
// check general builder stuff, this middleware is a good way
|
|
69
69
|
// to find API endpoints which are builder focused
|
|
70
|
-
yield
|
|
70
|
+
yield (0, builder_1.default)(ctx, permType);
|
|
71
71
|
// get the resource roles
|
|
72
72
|
let resourceRoles = [];
|
|
73
73
|
let otherLevelRoles = [];
|
|
74
|
-
const otherLevel = permLevel ===
|
|
75
|
-
?
|
|
76
|
-
:
|
|
77
|
-
const appId = getAppId();
|
|
74
|
+
const otherLevel = permLevel === backend_core_1.permissions.PermissionLevel.READ
|
|
75
|
+
? backend_core_1.permissions.PermissionLevel.WRITE
|
|
76
|
+
: backend_core_1.permissions.PermissionLevel.READ;
|
|
77
|
+
const appId = backend_core_1.context.getAppId();
|
|
78
78
|
if (appId && hasResource(ctx)) {
|
|
79
|
-
resourceRoles = yield
|
|
79
|
+
resourceRoles = yield backend_core_1.roles.getRequiredResourceRole(permLevel, ctx);
|
|
80
80
|
if (opts && opts.schema) {
|
|
81
|
-
otherLevelRoles = yield
|
|
81
|
+
otherLevelRoles = yield backend_core_1.roles.getRequiredResourceRole(otherLevel, ctx);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
// if the resource is public, proceed
|
|
85
|
-
if (resourceRoles.includes(
|
|
86
|
-
(otherLevelRoles &&
|
|
85
|
+
if (resourceRoles.includes(backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC) ||
|
|
86
|
+
(otherLevelRoles &&
|
|
87
|
+
otherLevelRoles.includes(backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC))) {
|
|
87
88
|
return next();
|
|
88
89
|
}
|
|
89
90
|
// check authenticated
|