@budibase/server 2.2.12-alpha.6 → 2.2.12-alpha.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/node-fetch.ts +2 -0
- package/builder/assets/{bb-emblem.4e4717da.svg → bb-emblem.05f7ae7a.svg} +1 -1
- package/builder/assets/bg.c1563288.png +0 -0
- package/builder/assets/bulgaria.bd68393d.png +0 -0
- package/builder/assets/covanta.72c46c1e.png +0 -0
- package/builder/assets/index.9f16f5ff.js +1798 -0
- package/builder/assets/index.f87b8d33.css +6 -0
- package/builder/assets/schnellecke.cf1837a8.png +0 -0
- package/builder/index.html +3 -3
- package/coverage/clover.xml +5114 -4925
- package/coverage/coverage-final.json +268 -264
- package/coverage/lcov-report/index.html +202 -157
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/application.ts.html +185 -164
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +24 -24
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +15 -15
- package/coverage/lcov-report/src/api/controllers/component.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +112 -88
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +80 -80
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +17 -17
- package/coverage/lcov-report/src/api/controllers/index.html +36 -36
- package/coverage/lcov-report/src/api/controllers/integration.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/layout.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/metadata.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/migrations.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/permission.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +29 -29
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +3 -3
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/public/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +2 -2
- 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 +7 -7
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +7 -7
- 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 +3 -3
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +7 -7
- 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 +9 -9
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +13 -13
- package/coverage/lcov-report/src/api/controllers/query/index.html +7 -7
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +89 -65
- package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/role.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/routing.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +36 -18
- package/coverage/lcov-report/src/api/controllers/row/external.ts.html +60 -30
- package/coverage/lcov-report/src/api/controllers/row/index.html +40 -40
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +34 -34
- package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +142 -70
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +120 -120
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +22 -22
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +152 -38
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/script.ts.html +2 -2
- package/coverage/lcov-report/src/api/controllers/static/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +39 -42
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +52 -52
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +43 -37
- package/coverage/lcov-report/src/api/controllers/table/index.html +34 -34
- package/coverage/lcov-report/src/api/controllers/table/index.ts.html +155 -68
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +47 -47
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +66 -69
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/user.ts.html +99 -75
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +62 -17
- package/coverage/lcov-report/src/api/controllers/view/index.html +29 -29
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +53 -92
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +69 -63
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.ts.html +27 -27
- package/coverage/lcov-report/src/api/routes/analytics.ts.html +7 -7
- package/coverage/lcov-report/src/api/routes/apikeys.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/application.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/auth.ts.html +6 -6
- package/coverage/lcov-report/src/api/routes/automation.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/backup.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/component.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/dev.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/index.html +5 -5
- package/coverage/lcov-report/src/api/routes/index.ts.html +42 -36
- package/coverage/lcov-report/src/api/routes/integration.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/layout.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/metadata.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +7 -7
- package/coverage/lcov-report/src/api/routes/permission.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/public/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +52 -52
- 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 +4 -4
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/tests/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/tests/utils.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +19 -19
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/query.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/role.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/routing.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/row.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/screen.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/script.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/static.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/table.ts.html +26 -95
- package/coverage/lcov-report/src/api/routes/templates.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/api/routes/user.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +43 -43
- package/coverage/lcov-report/src/api/routes/view.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +10 -10
- package/coverage/lcov-report/src/app.ts.html +13 -7
- package/coverage/lcov-report/src/automations/actions.ts.html +27 -27
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +59 -59
- package/coverage/lcov-report/src/automations/bullboard.ts.html +9 -9
- package/coverage/lcov-report/src/automations/index.html +30 -30
- package/coverage/lcov-report/src/automations/index.ts.html +10 -10
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/bash.ts.html +8 -8
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/delay.ts.html +5 -5
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/discord.ts.html +8 -8
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/index.html +15 -15
- package/coverage/lcov-report/src/automations/steps/integromat.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/loop.ts.html +3 -3
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +38 -38
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/slack.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/utils.ts.html +10 -10
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +6 -6
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +1 -1
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +13 -13
- package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +8 -8
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +3 -3
- package/coverage/lcov-report/src/automations/triggers.ts.html +52 -37
- package/coverage/lcov-report/src/automations/utils.ts.html +52 -52
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +2 -2
- package/coverage/lcov-report/src/constants/layouts.ts.html +4 -4
- package/coverage/lcov-report/src/constants/screens.ts.html +3 -3
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +22 -22
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/index.html +1 -1
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +2 -2
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +15 -15
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +4 -4
- package/coverage/lcov-report/src/db/index.html +1 -1
- package/coverage/lcov-report/src/db/index.ts.html +9 -9
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +18 -18
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +4 -4
- package/coverage/lcov-report/src/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/src/db/linkedRows/index.ts.html +27 -27
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +13 -13
- package/coverage/lcov-report/src/db/newid.ts.html +4 -4
- package/coverage/lcov-report/src/db/utils.ts.html +40 -40
- package/coverage/lcov-report/src/definitions/automations.ts.html +6 -3
- package/coverage/lcov-report/src/definitions/index.html +5 -20
- package/coverage/lcov-report/src/environment.ts.html +10 -10
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +8 -8
- package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +5 -5
- package/coverage/lcov-report/src/events/index.html +1 -1
- package/coverage/lcov-report/src/events/index.ts.html +4 -4
- package/coverage/lcov-report/src/events/utils.ts.html +1 -1
- package/coverage/lcov-report/src/index.html +13 -13
- package/coverage/lcov-report/src/index.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/airtable.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/base/index.html +11 -11
- package/coverage/lcov-report/src/integrations/base/query.ts.html +14 -8
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +113 -32
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +9 -9
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +26 -14
- package/coverage/lcov-report/src/integrations/firebase.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +11 -11
- package/coverage/lcov-report/src/integrations/index.html +47 -47
- package/coverage/lcov-report/src/integrations/index.ts.html +49 -49
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +417 -285
- package/coverage/lcov-report/src/integrations/mysql.ts.html +11 -11
- package/coverage/lcov-report/src/integrations/oracle.ts.html +13 -13
- package/coverage/lcov-report/src/integrations/postgres.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/queries/index.html +19 -19
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +15 -150
- package/coverage/lcov-report/src/integrations/redis.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/rest.ts.html +36 -45
- package/coverage/lcov-report/src/integrations/s3.ts.html +6 -6
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/src/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/integrations/utils.ts.html +18 -18
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +5 -5
- package/coverage/lcov-report/src/middleware/authorized.ts.html +27 -27
- package/coverage/lcov-report/src/middleware/builder.ts.html +17 -17
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +45 -42
- package/coverage/lcov-report/src/middleware/index.html +1 -1
- package/coverage/lcov-report/src/middleware/joi-validator.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/publicApi.ts.html +4 -4
- package/coverage/lcov-report/src/middleware/resourceId.ts.html +21 -21
- package/coverage/lcov-report/src/middleware/selfhost.ts.html +1 -1
- package/coverage/lcov-report/src/middleware/utils.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +5 -5
- 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 +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +19 -19
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +6 -6
- 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 +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +15 -15
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/tableSettings.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +1 -1
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +2 -2
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +5 -5
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +3 -3
- package/coverage/lcov-report/src/migrations/index.html +1 -1
- package/coverage/lcov-report/src/migrations/index.ts.html +32 -32
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/index.html +1 -1
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +22 -22
- package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +9 -9
- package/coverage/lcov-report/src/sdk/app/automations/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +17 -17
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +18 -18
- package/coverage/lcov-report/src/sdk/app/backups/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +7 -7
- package/coverage/lcov-report/src/sdk/app/datasources/datasources.ts.html +493 -0
- package/coverage/lcov-report/src/sdk/app/datasources/index.html +131 -0
- package/coverage/lcov-report/src/sdk/app/datasources/index.ts.html +100 -0
- package/coverage/lcov-report/src/sdk/app/queries/index.html +131 -0
- package/coverage/lcov-report/src/sdk/app/queries/index.ts.html +100 -0
- package/coverage/lcov-report/src/{definitions/datasource.ts.html → sdk/app/queries/queries.ts.html} +82 -82
- package/coverage/lcov-report/src/sdk/app/rows/attachments.ts.html +6 -6
- package/coverage/lcov-report/src/sdk/app/rows/index.html +1 -1
- package/coverage/lcov-report/src/sdk/app/rows/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/rows/rows.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/tables/index.html +11 -11
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +27 -18
- package/coverage/lcov-report/src/sdk/index.html +5 -5
- package/coverage/lcov-report/src/sdk/index.ts.html +23 -11
- package/coverage/lcov-report/src/sdk/users/index.html +1 -1
- package/coverage/lcov-report/src/sdk/users/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +28 -28
- package/coverage/lcov-report/src/sdk/utils/index.html +116 -0
- package/coverage/lcov-report/src/sdk/utils/index.ts.html +133 -0
- package/coverage/lcov-report/src/startup.ts.html +34 -34
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +134 -125
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.html +21 -21
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +213 -24
- package/coverage/lcov-report/src/threads/automation.ts.html +216 -186
- package/coverage/lcov-report/src/threads/index.html +30 -30
- package/coverage/lcov-report/src/threads/index.ts.html +24 -24
- package/coverage/lcov-report/src/threads/query.ts.html +68 -29
- package/coverage/lcov-report/src/threads/utils.ts.html +9 -9
- package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +2 -2
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +11 -11
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +9 -9
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +28 -22
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +21 -21
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +5 -8
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/global.ts.html +40 -40
- package/coverage/lcov-report/src/utilities/index.html +39 -39
- package/coverage/lcov-report/src/utilities/index.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/redis.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +50 -50
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +14 -14
- package/coverage/lcov-report/src/utilities/{csvParser.ts.html → schema.ts.html} +173 -233
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +5 -5
- package/coverage/lcov-report/src/utilities/security.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +38 -11
- package/coverage/lcov-report/src/watch.ts.html +7 -7
- package/coverage/lcov-report/src/websocket.ts.html +3 -3
- package/coverage/lcov.info +7899 -7539
- package/dist/api/controllers/application.js +73 -74
- package/dist/api/controllers/cloud.js +1 -1
- package/dist/api/controllers/datasource.js +24 -15
- package/dist/api/controllers/query/index.js +18 -11
- package/dist/api/controllers/row/ExternalRequest.js +12 -3
- package/dist/api/controllers/row/external.js +20 -13
- package/dist/api/controllers/row/internal.js +40 -15
- package/dist/api/controllers/row/utils.js +35 -3
- package/dist/api/controllers/static/index.js +38 -38
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +0 -1
- package/dist/api/controllers/table/external.js +16 -35
- package/dist/api/controllers/table/index.js +44 -15
- package/dist/api/controllers/table/internal.js +4 -4
- package/dist/api/controllers/table/utils.js +9 -9
- package/dist/api/controllers/user.js +14 -6
- package/dist/api/controllers/view/exporters.js +22 -6
- package/dist/api/controllers/view/index.js +20 -56
- package/dist/api/controllers/webhook.js +45 -43
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/row.js +2 -2
- package/dist/api/routes/table.js +6 -37
- package/dist/api/routes/utils/validators.js +1 -1
- package/dist/app.js +1 -0
- package/dist/automations/triggers.js +1 -0
- package/dist/definitions/datasource.js +0 -6
- package/dist/index.js +2 -2
- package/dist/integrations/base/query.js +7 -2
- package/dist/integrations/base/sqlTable.js +14 -14
- package/dist/integrations/couchdb.js +34 -8
- package/dist/integrations/dynamodb.js +8 -5
- package/dist/integrations/elasticsearch.js +7 -3
- package/dist/integrations/index.js +5 -5
- package/dist/integrations/mongodb.js +311 -271
- package/dist/integrations/mysql.js +2 -2
- package/dist/integrations/queries/sql.js +73 -100
- package/dist/integrations/rest.js +16 -18
- package/dist/middleware/currentapp.js +4 -2
- package/dist/package.json +7 -7
- package/dist/sdk/app/datasources/datasources.js +147 -0
- package/dist/sdk/app/datasources/index.js +27 -0
- package/dist/sdk/app/queries/index.js +27 -0
- package/dist/sdk/app/queries/queries.js +60 -0
- package/dist/sdk/app/tables/index.js +6 -2
- package/dist/sdk/index.js +4 -0
- package/dist/sdk/utils/index.js +29 -0
- package/dist/threads/automation.js +18 -7
- package/dist/threads/query.js +27 -13
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/filesystem.js +36 -34
- package/dist/utilities/fileSystem/plugin.js +17 -14
- package/dist/utilities/fileSystem/template.js +7 -4
- package/dist/utilities/schema.js +108 -0
- package/dist/utilities/workerRequests.js +2 -0
- package/package.json +8 -8
- package/scripts/dev/manage.js +1 -0
- package/src/api/controllers/application.ts +81 -74
- package/src/api/controllers/cloud.ts +1 -1
- package/src/api/controllers/datasource.ts +33 -25
- package/src/api/controllers/query/index.ts +47 -39
- package/src/api/controllers/row/ExternalRequest.ts +8 -2
- package/src/api/controllers/row/external.ts +24 -14
- package/src/api/controllers/row/internal.ts +42 -18
- package/src/api/controllers/row/utils.ts +40 -2
- package/src/api/controllers/static/index.ts +17 -18
- package/src/api/controllers/static/templates/BudibaseApp.svelte +0 -1
- package/src/api/controllers/table/external.ts +18 -16
- package/src/api/controllers/table/index.ts +46 -17
- package/src/api/controllers/table/internal.ts +4 -4
- package/src/api/controllers/table/utils.ts +12 -13
- package/src/api/controllers/user.ts +21 -13
- package/src/api/controllers/view/exporters.ts +20 -5
- package/src/api/controllers/view/index.ts +22 -35
- package/src/api/controllers/webhook.ts +48 -46
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/row.ts +1 -1
- package/src/api/routes/table.ts +15 -38
- package/src/api/routes/tests/datasource.spec.ts +35 -1
- package/src/api/routes/tests/misc.spec.js +4 -10
- package/src/api/routes/tests/table.spec.js +8 -30
- package/src/api/routes/tests/user.spec.js +20 -1
- package/src/api/routes/utils/validators.ts +1 -1
- package/src/app.ts +3 -1
- package/src/automations/tests/loop.spec.ts +45 -0
- package/src/automations/triggers.ts +6 -1
- package/src/definitions/automations.ts +1 -0
- package/src/definitions/datasource.ts +0 -41
- package/src/index.ts +1 -1
- package/src/integrations/base/query.ts +3 -1
- package/src/integrations/base/sqlTable.ts +1 -1
- package/src/integrations/couchdb.ts +41 -14
- package/src/integrations/dynamodb.ts +3 -3
- package/src/integrations/elasticsearch.ts +8 -4
- package/src/integrations/index.ts +4 -4
- package/src/integrations/mongodb.ts +315 -271
- package/src/integrations/mysql.ts +1 -1
- package/src/integrations/queries/sql.ts +5 -50
- package/src/integrations/rest.ts +16 -19
- package/src/integrations/tests/couchdb.spec.ts +33 -21
- package/src/integrations/tests/rest.spec.ts +4 -2
- package/src/middleware/currentapp.ts +3 -2
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +10 -6
- package/src/sdk/app/datasources/datasources.ts +136 -0
- package/src/sdk/app/datasources/index.ts +5 -0
- package/src/sdk/app/queries/index.ts +5 -0
- package/src/sdk/app/queries/queries.ts +50 -0
- package/src/sdk/app/tables/index.ts +6 -3
- package/src/sdk/index.ts +4 -0
- package/src/sdk/utils/index.ts +16 -0
- package/src/tests/utilities/TestConfiguration.ts +15 -12
- package/src/tests/utilities/structures.ts +65 -2
- package/src/threads/automation.ts +18 -8
- package/src/threads/definitions.ts +3 -0
- package/src/threads/query.ts +28 -15
- package/src/utilities/fileSystem/filesystem.ts +6 -4
- package/src/utilities/fileSystem/plugin.ts +3 -4
- package/src/utilities/fileSystem/template.ts +2 -2
- package/src/utilities/schema.ts +141 -0
- package/src/utilities/workerRequests.ts +10 -1
- package/tsconfig.json +2 -1
- package/builder/assets/index.0b010a07.js +0 -1023
- package/builder/assets/index.fa480d5b.css +0 -6
- package/dist/utilities/csvParser.js +0 -152
- package/src/utilities/csvParser.ts +0 -161
- package/src/utilities/tests/__snapshots__/csvParser.spec.js.snap +0 -15
- package/src/utilities/tests/csvParser.spec.js +0 -112
|
@@ -13,23 +13,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.deleteFolderFileSystem = exports.findFileRec = exports.extractTarball = exports.createTempFolder = exports.readFileSync = exports.sendTempFile = exports.stringToFileStream = exports.storeTempFile = exports.streamFile = exports.apiFileReturn = exports.loadHandlebarsFile = exports.checkDevelopmentEnvironment = exports.init = exports.TOP_LEVEL_PATH = void 0;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const uuid = require("uuid/v4");
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const budibaseDir_1 = require("../budibaseDir");
|
|
18
|
+
const path_1 = require("path");
|
|
20
19
|
const environment_1 = __importDefault(require("../../environment"));
|
|
21
20
|
const tar_1 = __importDefault(require("tar"));
|
|
22
|
-
|
|
21
|
+
const uuid = require("uuid/v4");
|
|
22
|
+
exports.TOP_LEVEL_PATH = (0, path_1.join)(__dirname, "..", "..", "..");
|
|
23
23
|
/**
|
|
24
24
|
* Upon first startup of instance there may not be everything we need in tmp directory, set it up.
|
|
25
25
|
*/
|
|
26
26
|
const init = () => {
|
|
27
|
-
const tempDir = budibaseTempDir();
|
|
28
|
-
if (!
|
|
27
|
+
const tempDir = (0, budibaseDir_1.budibaseTempDir)();
|
|
28
|
+
if (!fs_1.default.existsSync(tempDir)) {
|
|
29
29
|
// some test cases fire this quickly enough that
|
|
30
30
|
// synchronous cases can end up here at the same time
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
fs_1.default.mkdirSync(tempDir);
|
|
33
33
|
}
|
|
34
34
|
catch (err) {
|
|
35
35
|
if (!err || err.code !== "EEXIST") {
|
|
@@ -37,9 +37,9 @@ const init = () => {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const clientLibPath = join(budibaseTempDir(), "budibase-client.js");
|
|
41
|
-
if (environment_1.default.isTest() && !
|
|
42
|
-
|
|
40
|
+
const clientLibPath = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "budibase-client.js");
|
|
41
|
+
if (environment_1.default.isTest() && !fs_1.default.existsSync(clientLibPath)) {
|
|
42
|
+
fs_1.default.copyFileSync(require.resolve("@budibase/client"), clientLibPath);
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
exports.init = init;
|
|
@@ -51,11 +51,11 @@ const checkDevelopmentEnvironment = () => {
|
|
|
51
51
|
if (!environment_1.default.isDev() || environment_1.default.isTest()) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
if (!
|
|
55
|
-
|
|
54
|
+
if (!fs_1.default.existsSync((0, budibaseDir_1.budibaseTempDir)())) {
|
|
55
|
+
fs_1.default.mkdirSync((0, budibaseDir_1.budibaseTempDir)());
|
|
56
56
|
}
|
|
57
57
|
let error;
|
|
58
|
-
if (!
|
|
58
|
+
if (!fs_1.default.existsSync((0, path_1.join)(process.cwd(), ".env"))) {
|
|
59
59
|
error = "Must run via yarn once to generate environment.";
|
|
60
60
|
}
|
|
61
61
|
if (error) {
|
|
@@ -72,7 +72,7 @@ exports.checkDevelopmentEnvironment = checkDevelopmentEnvironment;
|
|
|
72
72
|
* @returns {string} The loaded handlebars file as a string - loaded as utf8.
|
|
73
73
|
*/
|
|
74
74
|
const loadHandlebarsFile = (path) => {
|
|
75
|
-
return
|
|
75
|
+
return fs_1.default.readFileSync(path, "utf8");
|
|
76
76
|
};
|
|
77
77
|
exports.loadHandlebarsFile = loadHandlebarsFile;
|
|
78
78
|
/**
|
|
@@ -82,13 +82,13 @@ exports.loadHandlebarsFile = loadHandlebarsFile;
|
|
|
82
82
|
* @return {Object} the read stream which can be put into the koa context body.
|
|
83
83
|
*/
|
|
84
84
|
const apiFileReturn = (contents) => {
|
|
85
|
-
const path = join(budibaseTempDir(), uuid());
|
|
86
|
-
|
|
87
|
-
return
|
|
85
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), uuid());
|
|
86
|
+
fs_1.default.writeFileSync(path, contents);
|
|
87
|
+
return fs_1.default.createReadStream(path);
|
|
88
88
|
};
|
|
89
89
|
exports.apiFileReturn = apiFileReturn;
|
|
90
90
|
const streamFile = (path) => {
|
|
91
|
-
return
|
|
91
|
+
return fs_1.default.createReadStream(path);
|
|
92
92
|
};
|
|
93
93
|
exports.streamFile = streamFile;
|
|
94
94
|
/**
|
|
@@ -97,8 +97,8 @@ exports.streamFile = streamFile;
|
|
|
97
97
|
* @return {string} the path to the temp file.
|
|
98
98
|
*/
|
|
99
99
|
const storeTempFile = (fileContents) => {
|
|
100
|
-
const path = join(budibaseTempDir(), uuid());
|
|
101
|
-
|
|
100
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), uuid());
|
|
101
|
+
fs_1.default.writeFileSync(path, fileContents);
|
|
102
102
|
return path;
|
|
103
103
|
};
|
|
104
104
|
exports.storeTempFile = storeTempFile;
|
|
@@ -108,7 +108,7 @@ exports.storeTempFile = storeTempFile;
|
|
|
108
108
|
*/
|
|
109
109
|
const stringToFileStream = (contents) => {
|
|
110
110
|
const path = (0, exports.storeTempFile)(contents);
|
|
111
|
-
return
|
|
111
|
+
return fs_1.default.createReadStream(path);
|
|
112
112
|
};
|
|
113
113
|
exports.stringToFileStream = stringToFileStream;
|
|
114
114
|
/**
|
|
@@ -117,7 +117,7 @@ exports.stringToFileStream = stringToFileStream;
|
|
|
117
117
|
*/
|
|
118
118
|
const sendTempFile = (fileContents) => {
|
|
119
119
|
const path = (0, exports.storeTempFile)(fileContents);
|
|
120
|
-
return
|
|
120
|
+
return fs_1.default.createReadStream(path);
|
|
121
121
|
};
|
|
122
122
|
exports.sendTempFile = sendTempFile;
|
|
123
123
|
/**
|
|
@@ -125,17 +125,18 @@ exports.sendTempFile = sendTempFile;
|
|
|
125
125
|
* allows a centralised location to check logic is all good.
|
|
126
126
|
*/
|
|
127
127
|
const readFileSync = (filepath, options = "utf8") => {
|
|
128
|
-
|
|
128
|
+
// @ts-ignore
|
|
129
|
+
return fs_1.default.readFileSync(filepath, options);
|
|
129
130
|
};
|
|
130
131
|
exports.readFileSync = readFileSync;
|
|
131
132
|
const createTempFolder = (item) => {
|
|
132
|
-
const path = join(budibaseTempDir(), item);
|
|
133
|
+
const path = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), item);
|
|
133
134
|
try {
|
|
134
135
|
// remove old tmp directories automatically - don't combine
|
|
135
|
-
if (
|
|
136
|
-
|
|
136
|
+
if (fs_1.default.existsSync(path)) {
|
|
137
|
+
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
137
138
|
}
|
|
138
|
-
|
|
139
|
+
fs_1.default.mkdirSync(path);
|
|
139
140
|
}
|
|
140
141
|
catch (err) {
|
|
141
142
|
throw new Error(`Path cannot be created: ${err.message}`);
|
|
@@ -154,13 +155,14 @@ exports.extractTarball = extractTarball;
|
|
|
154
155
|
* Find for a file recursively from start path applying filter, return first match
|
|
155
156
|
*/
|
|
156
157
|
const findFileRec = (startPath, filter) => {
|
|
157
|
-
if (!
|
|
158
|
+
if (!fs_1.default.existsSync(startPath)) {
|
|
158
159
|
return;
|
|
159
160
|
}
|
|
160
|
-
const files =
|
|
161
|
+
const files = fs_1.default.readdirSync(startPath);
|
|
161
162
|
for (let i = 0, len = files.length; i < len; i++) {
|
|
162
|
-
|
|
163
|
-
const
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
const filename = (0, path_1.join)(startPath, files[i]);
|
|
165
|
+
const stat = fs_1.default.lstatSync(filename);
|
|
164
166
|
if (stat.isDirectory()) {
|
|
165
167
|
return (0, exports.findFileRec)(filename, filter);
|
|
166
168
|
}
|
|
@@ -174,9 +176,9 @@ exports.findFileRec = findFileRec;
|
|
|
174
176
|
* Remove a folder which is not empty from the file system
|
|
175
177
|
*/
|
|
176
178
|
const deleteFolderFileSystem = (path) => {
|
|
177
|
-
if (!
|
|
179
|
+
if (!fs_1.default.existsSync(path)) {
|
|
178
180
|
return;
|
|
179
181
|
}
|
|
180
|
-
|
|
182
|
+
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
181
183
|
};
|
|
182
184
|
exports.deleteFolderFileSystem = deleteFolderFileSystem;
|
|
@@ -8,18 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.getDatasourcePlugin = exports.getPluginMetadata = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
+
const budibaseDir_1 = require("../budibaseDir");
|
|
17
|
+
const fs_1 = __importDefault(require("fs"));
|
|
18
|
+
const path_1 = require("path");
|
|
16
19
|
const backend_core_1 = require("@budibase/backend-core");
|
|
17
|
-
const DATASOURCE_PATH = join(budibaseTempDir(), "datasource");
|
|
20
|
+
const DATASOURCE_PATH = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "datasource");
|
|
18
21
|
const getPluginMetadata = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
22
|
let metadata = {};
|
|
20
23
|
try {
|
|
21
|
-
const pkg =
|
|
22
|
-
const schema =
|
|
24
|
+
const pkg = fs_1.default.readFileSync((0, path_1.join)(path, "package.json"), "utf8");
|
|
25
|
+
const schema = fs_1.default.readFileSync((0, path_1.join)(path, "schema.json"), "utf8");
|
|
23
26
|
metadata.schema = JSON.parse(schema);
|
|
24
27
|
metadata.package = JSON.parse(pkg);
|
|
25
28
|
if (!metadata.package.name ||
|
|
@@ -37,13 +40,13 @@ exports.getPluginMetadata = getPluginMetadata;
|
|
|
37
40
|
const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
41
|
var _a;
|
|
39
42
|
const hash = (_a = plugin.schema) === null || _a === void 0 ? void 0 : _a.hash;
|
|
40
|
-
if (!
|
|
41
|
-
|
|
43
|
+
if (!fs_1.default.existsSync(DATASOURCE_PATH)) {
|
|
44
|
+
fs_1.default.mkdirSync(DATASOURCE_PATH);
|
|
42
45
|
}
|
|
43
|
-
const filename = join(DATASOURCE_PATH, plugin.name);
|
|
46
|
+
const filename = (0, path_1.join)(DATASOURCE_PATH, plugin.name);
|
|
44
47
|
const metadataName = `${filename}.bbmetadata`;
|
|
45
|
-
if (
|
|
46
|
-
const currentHash =
|
|
48
|
+
if (fs_1.default.existsSync(filename)) {
|
|
49
|
+
const currentHash = fs_1.default.readFileSync(metadataName, "utf8");
|
|
47
50
|
// if hash is the same return the file, otherwise remove it and re-download
|
|
48
51
|
if (currentHash === hash) {
|
|
49
52
|
return require(filename);
|
|
@@ -51,13 +54,13 @@ const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, functi
|
|
|
51
54
|
else {
|
|
52
55
|
console.log(`Updating plugin: ${plugin.name}`);
|
|
53
56
|
delete require.cache[require.resolve(filename)];
|
|
54
|
-
|
|
57
|
+
fs_1.default.unlinkSync(filename);
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
const pluginKey = backend_core_1.objectStore.getPluginJSKey(plugin);
|
|
58
61
|
const pluginJs = yield backend_core_1.objectStore.retrieve(backend_core_1.objectStore.ObjectStoreBuckets.PLUGINS, pluginKey);
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
fs_1.default.writeFileSync(filename, pluginJs);
|
|
63
|
+
fs_1.default.writeFileSync(metadataName, hash);
|
|
61
64
|
return require(filename);
|
|
62
65
|
});
|
|
63
66
|
exports.getDatasourcePlugin = getDatasourcePlugin;
|
|
@@ -8,10 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.downloadTemplate = exports.getTemplateStream = void 0;
|
|
13
|
-
const
|
|
14
|
-
const
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = require("path");
|
|
15
18
|
const constants_1 = require("../../constants");
|
|
16
19
|
const backend_core_1 = require("@budibase/backend-core");
|
|
17
20
|
/**
|
|
@@ -21,12 +24,12 @@ const backend_core_1 = require("@budibase/backend-core");
|
|
|
21
24
|
*/
|
|
22
25
|
const getTemplateStream = (template) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
26
|
if (template.file) {
|
|
24
|
-
return
|
|
27
|
+
return fs_1.default.createReadStream(template.file.path);
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
30
|
const [type, name] = template.key.split("/");
|
|
28
31
|
const tmpPath = yield (0, exports.downloadTemplate)(type, name);
|
|
29
|
-
return
|
|
32
|
+
return fs_1.default.createReadStream((0, path_1.join)(tmpPath, name, "db", "dump.txt"));
|
|
30
33
|
}
|
|
31
34
|
});
|
|
32
35
|
exports.getTemplateStream = getTemplateStream;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parse = exports.validate = exports.isRows = exports.isSchema = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const PARSERS = {
|
|
6
|
+
[constants_1.FieldTypes.NUMBER]: (attribute) => {
|
|
7
|
+
if (!attribute) {
|
|
8
|
+
return attribute;
|
|
9
|
+
}
|
|
10
|
+
return Number(attribute);
|
|
11
|
+
},
|
|
12
|
+
[constants_1.FieldTypes.DATETIME]: (attribute) => {
|
|
13
|
+
if (!attribute) {
|
|
14
|
+
return attribute;
|
|
15
|
+
}
|
|
16
|
+
return new Date(attribute).toISOString();
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
function isSchema(schema) {
|
|
20
|
+
return (typeof schema === "object" &&
|
|
21
|
+
Object.values(schema).every(rawColumn => {
|
|
22
|
+
const column = rawColumn;
|
|
23
|
+
return (column !== null &&
|
|
24
|
+
typeof column === "object" &&
|
|
25
|
+
typeof column.type === "string" &&
|
|
26
|
+
Object.values(constants_1.FieldTypes).includes(column.type));
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
exports.isSchema = isSchema;
|
|
30
|
+
function isRows(rows) {
|
|
31
|
+
return Array.isArray(rows) && rows.every(row => typeof row === "object");
|
|
32
|
+
}
|
|
33
|
+
exports.isRows = isRows;
|
|
34
|
+
function validate(rows, schema) {
|
|
35
|
+
const results = {
|
|
36
|
+
schemaValidation: {},
|
|
37
|
+
allValid: false,
|
|
38
|
+
invalidColumns: [],
|
|
39
|
+
};
|
|
40
|
+
rows.forEach(row => {
|
|
41
|
+
Object.entries(row).forEach(([columnName, columnData]) => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const columnType = (_a = schema[columnName]) === null || _a === void 0 ? void 0 : _a.type;
|
|
44
|
+
const isAutoColumn = (_b = schema[columnName]) === null || _b === void 0 ? void 0 : _b.autocolumn;
|
|
45
|
+
// If the columnType is not a string, then it's not present in the schema, and should be added to the invalid columns array
|
|
46
|
+
if (typeof columnType !== "string") {
|
|
47
|
+
results.invalidColumns.push(columnName);
|
|
48
|
+
}
|
|
49
|
+
else if (
|
|
50
|
+
// If there's no data for this field don't bother with further checks
|
|
51
|
+
// If the field is already marked as invalid there's no need for further checks
|
|
52
|
+
results.schemaValidation[columnName] === false ||
|
|
53
|
+
columnData == null ||
|
|
54
|
+
isAutoColumn) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
else if (columnType === constants_1.FieldTypes.NUMBER &&
|
|
58
|
+
isNaN(Number(columnData))) {
|
|
59
|
+
// If provided must be a valid number
|
|
60
|
+
results.schemaValidation[columnName] = false;
|
|
61
|
+
}
|
|
62
|
+
else if (
|
|
63
|
+
// If provided must be a valid date
|
|
64
|
+
columnType === constants_1.FieldTypes.DATETIME &&
|
|
65
|
+
isNaN(new Date(columnData).getTime())) {
|
|
66
|
+
results.schemaValidation[columnName] = false;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
results.schemaValidation[columnName] = true;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
results.allValid =
|
|
74
|
+
Object.values(results.schemaValidation).length > 0 &&
|
|
75
|
+
Object.values(results.schemaValidation).every(column => column);
|
|
76
|
+
// Select unique values
|
|
77
|
+
results.invalidColumns = [...new Set(results.invalidColumns)];
|
|
78
|
+
return results;
|
|
79
|
+
}
|
|
80
|
+
exports.validate = validate;
|
|
81
|
+
function parse(rows, schema) {
|
|
82
|
+
return rows.map(row => {
|
|
83
|
+
const parsedRow = {};
|
|
84
|
+
Object.entries(row).forEach(([columnName, columnData]) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (!(columnName in schema) || ((_a = schema[columnName]) === null || _a === void 0 ? void 0 : _a.autocolumn)) {
|
|
87
|
+
// Objects can be present in the row data but not in the schema, so make sure we don't proceed in such a case
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const columnType = schema[columnName].type;
|
|
91
|
+
if (columnType === constants_1.FieldTypes.NUMBER) {
|
|
92
|
+
// If provided must be a valid number
|
|
93
|
+
parsedRow[columnName] = columnData ? Number(columnData) : columnData;
|
|
94
|
+
}
|
|
95
|
+
else if (columnType === constants_1.FieldTypes.DATETIME) {
|
|
96
|
+
// If provided must be a valid date
|
|
97
|
+
parsedRow[columnName] = columnData
|
|
98
|
+
? new Date(columnData).toISOString()
|
|
99
|
+
: columnData;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
parsedRow[columnName] = columnData;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return parsedRow;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
exports.parse = parse;
|
|
@@ -41,6 +41,8 @@ function request(ctx, request) {
|
|
|
41
41
|
if (ctx && ctx.headers) {
|
|
42
42
|
request.headers = ctx.headers;
|
|
43
43
|
}
|
|
44
|
+
// add x-budibase-correlation-id header
|
|
45
|
+
backend_core_1.logging.correlation.setHeader(request.headers);
|
|
44
46
|
return request;
|
|
45
47
|
}
|
|
46
48
|
exports.request = request;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.2.12-alpha.
|
|
4
|
+
"version": "2.2.12-alpha.61",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "2.2.12-alpha.
|
|
47
|
-
"@budibase/client": "2.2.12-alpha.
|
|
48
|
-
"@budibase/pro": "2.2.12-alpha.
|
|
49
|
-
"@budibase/string-templates": "2.2.12-alpha.
|
|
50
|
-
"@budibase/types": "2.2.12-alpha.
|
|
46
|
+
"@budibase/backend-core": "2.2.12-alpha.61",
|
|
47
|
+
"@budibase/client": "2.2.12-alpha.61",
|
|
48
|
+
"@budibase/pro": "2.2.12-alpha.60",
|
|
49
|
+
"@budibase/string-templates": "2.2.12-alpha.61",
|
|
50
|
+
"@budibase/types": "2.2.12-alpha.61",
|
|
51
51
|
"@bull-board/api": "3.7.0",
|
|
52
52
|
"@bull-board/koa": "3.9.4",
|
|
53
53
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"joi": "17.6.0",
|
|
78
78
|
"js-yaml": "4.1.0",
|
|
79
79
|
"jsonschema": "1.4.0",
|
|
80
|
-
"knex": "
|
|
80
|
+
"knex": "2.4.0",
|
|
81
81
|
"koa": "2.13.4",
|
|
82
82
|
"koa-body": "4.2.0",
|
|
83
83
|
"koa-compress": "4.0.1",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"optionalDependencies": {
|
|
170
170
|
"oracledb": "5.3.0"
|
|
171
171
|
},
|
|
172
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "4474af154d93161011a34bb792f63dc6dae89f99"
|
|
173
173
|
}
|
package/scripts/dev/manage.js
CHANGED
|
@@ -29,6 +29,7 @@ async function init() {
|
|
|
29
29
|
ACCOUNT_PORTAL_URL: "http://localhost:10001",
|
|
30
30
|
ACCOUNT_PORTAL_API_KEY: "budibase",
|
|
31
31
|
JWT_SECRET: "testsecret",
|
|
32
|
+
ENCRYPTION_KEY: "testsecret",
|
|
32
33
|
REDIS_PASSWORD: "budibase",
|
|
33
34
|
MINIO_ACCESS_KEY: "budibase",
|
|
34
35
|
MINIO_SECRET_KEY: "budibase",
|
|
@@ -112,12 +112,11 @@ function checkAppName(
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
async function createInstance(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
async function createInstance(
|
|
116
|
+
appId: string,
|
|
117
|
+
template: any,
|
|
118
|
+
includeSampleData: boolean
|
|
119
|
+
) {
|
|
121
120
|
const db = context.getAppDB()
|
|
122
121
|
await db.put({
|
|
123
122
|
_id: "_design/database",
|
|
@@ -250,82 +249,90 @@ async function performAppCreate(ctx: BBContext) {
|
|
|
250
249
|
instanceConfig.file = ctx.request.files.templateFile
|
|
251
250
|
}
|
|
252
251
|
const includeSampleData = isQsTrue(ctx.request.body.sampleData)
|
|
253
|
-
const
|
|
254
|
-
const appId =
|
|
255
|
-
const db = context.getAppDB()
|
|
252
|
+
const tenantId = tenancy.isMultiTenant() ? tenancy.getTenantId() : null
|
|
253
|
+
const appId = generateDevAppID(generateAppID(tenantId))
|
|
256
254
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
name: name,
|
|
265
|
-
url: url,
|
|
266
|
-
template: templateKey,
|
|
267
|
-
instance,
|
|
268
|
-
tenantId: tenancy.getTenantId(),
|
|
269
|
-
updatedAt: new Date().toISOString(),
|
|
270
|
-
createdAt: new Date().toISOString(),
|
|
271
|
-
status: AppStatus.DEV,
|
|
272
|
-
navigation: {
|
|
273
|
-
navigation: "Top",
|
|
274
|
-
title: name,
|
|
275
|
-
navWidth: "Large",
|
|
276
|
-
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
277
|
-
links: [
|
|
278
|
-
{
|
|
279
|
-
url: "/home",
|
|
280
|
-
text: "Home",
|
|
281
|
-
},
|
|
282
|
-
],
|
|
283
|
-
},
|
|
284
|
-
theme: "spectrum--light",
|
|
285
|
-
customTheme: {
|
|
286
|
-
buttonBorderRadius: "16px",
|
|
287
|
-
},
|
|
288
|
-
}
|
|
255
|
+
return await context.doInAppContext(appId, async () => {
|
|
256
|
+
const instance = await createInstance(
|
|
257
|
+
appId,
|
|
258
|
+
instanceConfig,
|
|
259
|
+
includeSampleData
|
|
260
|
+
)
|
|
261
|
+
const db = context.getAppDB()
|
|
289
262
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
"
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
263
|
+
let newApplication: App = {
|
|
264
|
+
_id: DocumentType.APP_METADATA,
|
|
265
|
+
_rev: undefined,
|
|
266
|
+
appId,
|
|
267
|
+
type: "app",
|
|
268
|
+
version: packageJson.version,
|
|
269
|
+
componentLibraries: ["@budibase/standard-components"],
|
|
270
|
+
name: name,
|
|
271
|
+
url: url,
|
|
272
|
+
template: templateKey,
|
|
273
|
+
instance,
|
|
274
|
+
tenantId: tenancy.getTenantId(),
|
|
275
|
+
updatedAt: new Date().toISOString(),
|
|
276
|
+
createdAt: new Date().toISOString(),
|
|
277
|
+
status: AppStatus.DEV,
|
|
278
|
+
navigation: {
|
|
279
|
+
navigation: "Top",
|
|
280
|
+
title: name,
|
|
281
|
+
navWidth: "Large",
|
|
282
|
+
navBackground: "var(--spectrum-global-color-gray-100)",
|
|
283
|
+
links: [
|
|
284
|
+
{
|
|
285
|
+
url: "/home",
|
|
286
|
+
text: "Home",
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
theme: "spectrum--light",
|
|
291
|
+
customTheme: {
|
|
292
|
+
buttonBorderRadius: "16px",
|
|
293
|
+
},
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// If we used a template or imported an app there will be an existing doc.
|
|
297
|
+
// Fetch and migrate some metadata from the existing app.
|
|
298
|
+
try {
|
|
299
|
+
const existing: App = await db.get(DocumentType.APP_METADATA)
|
|
300
|
+
const keys: (keyof App)[] = [
|
|
301
|
+
"_rev",
|
|
302
|
+
"navigation",
|
|
303
|
+
"theme",
|
|
304
|
+
"customTheme",
|
|
305
|
+
"icon",
|
|
306
|
+
]
|
|
307
|
+
keys.forEach(key => {
|
|
308
|
+
if (existing[key]) {
|
|
309
|
+
// @ts-ignore
|
|
310
|
+
newApplication[key] = existing[key]
|
|
311
|
+
}
|
|
312
|
+
})
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
// Migrate navigation settings and screens if required
|
|
315
|
+
if (existing) {
|
|
316
|
+
const navigation = await migrateAppNavigation()
|
|
317
|
+
if (navigation) {
|
|
318
|
+
newApplication.navigation = navigation
|
|
319
|
+
}
|
|
313
320
|
}
|
|
321
|
+
} catch (err) {
|
|
322
|
+
// Nothing to do
|
|
314
323
|
}
|
|
315
|
-
} catch (err) {
|
|
316
|
-
// Nothing to do
|
|
317
|
-
}
|
|
318
324
|
|
|
319
|
-
|
|
320
|
-
|
|
325
|
+
const response = await db.put(newApplication, { force: true })
|
|
326
|
+
newApplication._rev = response.rev
|
|
321
327
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
328
|
+
/* istanbul ignore next */
|
|
329
|
+
if (!env.isTest()) {
|
|
330
|
+
await createApp(appId)
|
|
331
|
+
}
|
|
326
332
|
|
|
327
|
-
|
|
328
|
-
|
|
333
|
+
await cache.app.invalidateAppMetadata(appId, newApplication)
|
|
334
|
+
return newApplication
|
|
335
|
+
})
|
|
329
336
|
}
|
|
330
337
|
|
|
331
338
|
async function creationEvents(request: any, app: App) {
|
|
@@ -86,7 +86,7 @@ export async function importApps(ctx: Ctx) {
|
|
|
86
86
|
if (Array.isArray(file)) {
|
|
87
87
|
ctx.throw(400, "Single file is required")
|
|
88
88
|
}
|
|
89
|
-
if (file.type !== "application/gzip") {
|
|
89
|
+
if (file.type !== "application/gzip" && file.type !== "application/x-gzip") {
|
|
90
90
|
ctx.throw(400, "Import file must be a gzipped tarball.")
|
|
91
91
|
}
|
|
92
92
|
|