@budibase/server 2.2.12-alpha.1 → 2.2.12
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 +0 -19
- package/__mocks__/node-fetch.ts +0 -78
- package/builder/assets/{index.fa480d5b.css → index.9cb087df.css} +2 -2
- package/builder/assets/{index.5e79c3b5.js → index.c0e1038a.js} +364 -367
- package/builder/index.html +2 -2
- package/coverage/clover.xml +5018 -5052
- package/coverage/coverage-final.json +265 -268
- package/coverage/lcov-report/index.html +206 -206
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/application.ts.html +183 -258
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +51 -51
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +79 -91
- package/coverage/lcov-report/src/api/controllers/component.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +30 -30
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +14 -17
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +195 -141
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/index.html +51 -51
- 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 +19 -19
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +63 -63
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +72 -72
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +135 -150
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +55 -55
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +16 -67
- package/coverage/lcov-report/src/api/controllers/public/index.html +15 -15
- 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 +6 -6
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +6 -6
- 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 +8 -8
- 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 +8 -8
- 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 +8 -8
- 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 +10 -10
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/query/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +60 -60
- 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 +15 -12
- package/coverage/lcov-report/src/api/controllers/row/external.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +52 -55
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +12 -21
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +14 -17
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +26 -26
- package/coverage/lcov-report/src/api/controllers/script.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/static/index.html +11 -11
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +44 -32
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/table/index.html +19 -19
- package/coverage/lcov-report/src/api/controllers/table/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +17 -17
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +51 -51
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/user.ts.html +119 -119
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +49 -49
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +22 -22
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +33 -33
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +14 -14
- package/coverage/lcov-report/src/api/index.html +1 -1
- package/coverage/lcov-report/src/api/index.ts.html +33 -33
- 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 +11 -44
- 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 +11 -8
- package/coverage/lcov-report/src/api/routes/dev.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/index.html +7 -7
- package/coverage/lcov-report/src/api/routes/index.ts.html +37 -40
- 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 -146
- package/coverage/lcov-report/src/api/routes/public/index.html +7 -7
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +52 -52
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +15 -15
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +16 -28
- 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 +11 -11
- 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 +11 -11
- package/coverage/lcov-report/src/api/routes/templates.ts.html +8 -8
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +15 -15
- 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 +24 -24
- 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 +42 -42
- 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 +32 -32
- package/coverage/lcov-report/src/automations/actions.ts.html +25 -25
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +19 -91
- package/coverage/lcov-report/src/automations/bullboard.ts.html +11 -11
- package/coverage/lcov-report/src/automations/index.html +19 -19
- package/coverage/lcov-report/src/automations/index.ts.html +13 -13
- package/coverage/lcov-report/src/automations/logging/index.html +1 -1
- package/coverage/lcov-report/src/automations/logging/index.ts.html +11 -11
- package/coverage/lcov-report/src/automations/steps/bash.ts.html +34 -34
- 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 +33 -33
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +35 -35
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +31 -31
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +6 -6
- package/coverage/lcov-report/src/automations/steps/index.html +83 -83
- 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 +14 -14
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +17 -17
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +28 -28
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +18 -18
- 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 +16 -16
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +22 -22
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +5 -5
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +26 -26
- 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 +21 -21
- package/coverage/lcov-report/src/automations/utils.ts.html +56 -56
- package/coverage/lcov-report/src/constants/index.html +1 -1
- package/coverage/lcov-report/src/constants/index.ts.html +92 -92
- package/coverage/lcov-report/src/constants/layouts.ts.html +4 -4
- package/coverage/lcov-report/src/constants/screens.ts.html +5 -5
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +23 -23
- 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 +16 -16
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +5 -5
- package/coverage/lcov-report/src/db/index.html +19 -19
- package/coverage/lcov-report/src/db/index.ts.html +9 -9
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +8 -8
- 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 +15 -15
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +12 -12
- package/coverage/lcov-report/src/db/newid.ts.html +4 -4
- package/coverage/lcov-report/src/db/utils.ts.html +80 -80
- package/coverage/lcov-report/src/definitions/automations.ts.html +4 -4
- package/coverage/lcov-report/src/definitions/datasource.ts.html +4 -4
- package/coverage/lcov-report/src/definitions/index.html +1 -1
- package/coverage/lcov-report/src/environment.ts.html +28 -40
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +6 -6
- 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 +3 -3
- package/coverage/lcov-report/src/index.html +25 -25
- package/coverage/lcov-report/src/index.ts.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/src/integrations/base/query.ts.html +3 -3
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +14 -14
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +3 -3
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +6 -6
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/firebase.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/index.html +5 -5
- package/coverage/lcov-report/src/integrations/index.ts.html +47 -35
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/mysql.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/oracle.ts.html +13 -13
- package/coverage/lcov-report/src/integrations/postgres.ts.html +42 -42
- package/coverage/lcov-report/src/integrations/queries/index.html +1 -1
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +13 -13
- package/coverage/lcov-report/src/integrations/redis.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/rest.ts.html +16 -16
- 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 +36 -36
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +7 -7
- package/coverage/lcov-report/src/middleware/authorized.ts.html +28 -28
- package/coverage/lcov-report/src/middleware/builder.ts.html +17 -17
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +39 -39
- 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 +22 -22
- 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 +10 -13
- 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 +15 -15
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +34 -34
- 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 +6 -6
- 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 +53 -41
- package/coverage/lcov-report/src/sdk/app/backups/index.html +28 -28
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +73 -73
- 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 +1 -1
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/index.html +1 -1
- package/coverage/lcov-report/src/sdk/index.ts.html +9 -9
- package/coverage/lcov-report/src/sdk/users/index.html +5 -5
- package/coverage/lcov-report/src/sdk/users/index.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +34 -34
- package/coverage/lcov-report/src/startup.ts.html +42 -42
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +125 -182
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.html +15 -15
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +1 -1
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +30 -30
- package/coverage/lcov-report/src/threads/automation.ts.html +103 -34
- package/coverage/lcov-report/src/threads/index.html +19 -19
- package/coverage/lcov-report/src/threads/index.ts.html +25 -25
- package/coverage/lcov-report/src/threads/query.ts.html +71 -71
- package/coverage/lcov-report/src/threads/utils.ts.html +18 -18
- package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/csvParser.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +19 -79
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1049 -20
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/global.ts.html +43 -43
- package/coverage/lcov-report/src/utilities/index.html +63 -48
- package/coverage/lcov-report/src/utilities/index.ts.html +168 -36
- package/coverage/lcov-report/src/utilities/plugins.ts.html +151 -0
- package/coverage/lcov-report/src/utilities/redis.ts.html +32 -32
- package/coverage/lcov-report/src/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/src/utilities/routing/index.ts.html +5 -5
- package/coverage/lcov-report/src/utilities/rowProcessor/index.html +28 -28
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +33 -60
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +38 -38
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +32 -32
- package/coverage/lcov-report/src/utilities/security.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/statusCodes.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +35 -35
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/users.ts.html +6 -6
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +56 -56
- package/coverage/lcov-report/src/watch.ts.html +9 -9
- package/coverage/lcov-report/src/websocket.ts.html +15 -15
- package/coverage/lcov.info +7122 -7189
- package/dist/api/controllers/application.js +35 -47
- package/dist/api/controllers/cloud.js +2 -6
- package/dist/api/controllers/deploy/index.js +60 -43
- package/dist/api/controllers/plugin/index.js +6 -6
- package/dist/api/controllers/public/applications.js +1 -22
- package/dist/api/controllers/row/ExternalRequest.js +1 -0
- package/dist/api/controllers/row/internal.js +12 -12
- package/dist/api/controllers/row/staticFormula.js +1 -1
- package/dist/api/controllers/static/index.js +11 -8
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/routes/application.js +0 -3
- package/dist/api/routes/deploy.js +2 -1
- package/dist/api/routes/public/applications.js +0 -37
- package/dist/api/routes/public/middleware/mapper.js +0 -3
- package/dist/api/routes/tests/utilities/TestFunctions.js +167 -0
- package/dist/api/routes/tests/utilities/index.js +131 -0
- package/dist/automations/automationUtils.js +1 -26
- package/dist/automations/tests/utilities/index.js +81 -0
- package/dist/environment.js +1 -5
- package/dist/integrations/googlesheets.js +1 -1
- package/dist/integrations/index.js +2 -1
- package/dist/migrations/functions/backfill/global/configs.js +4 -4
- package/dist/package.json +6 -8
- package/dist/sdk/app/backups/imports.js +6 -2
- package/dist/tests/utilities/TestConfiguration.js +562 -0
- package/dist/tests/utilities/controllers.js +40 -0
- package/dist/tests/utilities/structures.js +168 -0
- package/dist/threads/automation.js +28 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/clientLibrary.js +3 -3
- package/dist/utilities/fileSystem/index.js +342 -18
- package/dist/utilities/index.js +44 -1
- package/dist/utilities/plugins.js +26 -0
- package/dist/utilities/rowProcessor/index.js +4 -12
- package/package.json +7 -9
- package/scripts/dev/manage.js +16 -0
- package/specs/openapi.json +0 -84
- package/specs/openapi.yaml +0 -53
- package/specs/resources/application.js +0 -19
- package/src/api/controllers/application.ts +36 -61
- package/src/api/controllers/auth.ts +2 -2
- package/src/api/controllers/cloud.ts +6 -10
- package/src/api/controllers/deploy/Deployment.ts +0 -1
- package/src/api/controllers/deploy/index.ts +58 -40
- package/src/api/controllers/plugin/index.ts +9 -14
- package/src/api/controllers/public/applications.ts +0 -17
- package/src/api/controllers/row/ExternalRequest.ts +1 -0
- package/src/api/controllers/row/internal.ts +23 -24
- package/src/api/controllers/row/staticFormula.ts +2 -5
- package/src/api/controllers/row/utils.ts +1 -2
- package/src/api/controllers/static/index.ts +10 -6
- package/src/api/controllers/view/index.ts +2 -2
- package/src/api/routes/application.ts +0 -11
- package/src/api/routes/deploy.ts +1 -0
- package/src/api/routes/index.ts +3 -4
- package/src/api/routes/public/applications.ts +0 -44
- package/src/api/routes/public/middleware/mapper.ts +0 -4
- package/src/api/routes/tests/__snapshots__/{datasource.spec.ts.snap → datasource.spec.js.snap} +0 -0
- package/src/api/routes/tests/{application.spec.ts → application.spec.js} +18 -94
- package/src/api/routes/tests/{backup.spec.ts → backup.spec.js} +6 -17
- package/src/api/routes/tests/{datasource.spec.ts → datasource.spec.js} +15 -23
- package/src/api/routes/tests/deployment.spec.ts +25 -0
- package/src/api/routes/tests/permissions.spec.js +1 -1
- package/src/api/routes/tests/routing.spec.js +2 -1
- package/src/api/routes/tests/row.spec.js +2 -4
- package/src/api/routes/tests/static.spec.js +17 -2
- package/src/api/routes/tests/table.spec.js +2 -8
- package/src/api/routes/tests/user.spec.js +0 -86
- package/src/api/routes/tests/utilities/index.ts +2 -2
- package/src/api/routes/tests/webhook.spec.js +1 -1
- package/src/automations/automationUtils.ts +0 -24
- package/src/automations/tests/utilities/index.ts +2 -2
- package/src/automations/unitTests/automationUtils.spec.js +17 -0
- package/src/definitions/openapi.ts +0 -10
- package/src/environment.ts +1 -5
- package/src/integrations/googlesheets.ts +1 -1
- package/src/integrations/index.ts +5 -1
- package/src/migrations/functions/backfill/global/configs.ts +4 -5
- package/src/sdk/app/backups/imports.ts +6 -2
- package/src/sdk/tests/attachments.spec.ts +4 -1
- package/src/tests/jestSetup.ts +1 -4
- package/src/tests/utilities/TestConfiguration.ts +4 -23
- package/src/threads/automation.ts +27 -4
- package/src/utilities/fileSystem/clientLibrary.ts +1 -1
- package/src/utilities/fileSystem/index.ts +348 -5
- package/src/utilities/index.ts +45 -1
- package/src/utilities/plugins.ts +22 -0
- package/src/utilities/rowProcessor/index.ts +8 -17
- package/tsconfig.build.json +0 -2
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +0 -343
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +0 -595
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +0 -280
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +0 -193
- package/dist/utilities/fileSystem/app.js +0 -97
- package/dist/utilities/fileSystem/filesystem.js +0 -182
- package/dist/utilities/fileSystem/plugin.js +0 -63
- package/dist/utilities/fileSystem/template.js +0 -44
- package/src/api/routes/tests/cloud.spec.ts +0 -65
- package/src/api/routes/tests/data/budibase-component-1.0.1.tgz +0 -0
- package/src/api/routes/tests/data/comment-box-1.0.2.tar.gz +0 -0
- package/src/api/routes/tests/data/export-test.tar.gz +0 -0
- package/src/api/routes/tests/plugin.spec.ts +0 -179
- package/src/automations/tests/bash.spec.js +0 -34
- package/src/automations/tests/discord.spec.js +0 -27
- package/src/automations/tests/executeQuery.spec.js +0 -49
- package/src/automations/tests/executeScript.spec.js +0 -48
- package/src/automations/tests/sendSmtpEmail.spec.js +0 -71
- package/src/automations/tests/serverLog.spec.js +0 -22
- package/src/automations/tests/zapier.spec.js +0 -27
- package/src/automations/unitTests/automationUtils.spec.ts +0 -65
- package/src/utilities/fileSystem/app.ts +0 -86
- package/src/utilities/fileSystem/filesystem.ts +0 -170
- package/src/utilities/fileSystem/plugin.ts +0 -65
- package/src/utilities/fileSystem/template.ts +0 -36
- package/src/utilities/rowProcessor/tests/utils.spec.ts +0 -57
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
jest.mock("pg")
|
|
2
|
-
import * as setup from "./utilities"
|
|
3
|
-
import { checkBuilderEndpoint } from "./utilities/TestFunctions"
|
|
4
|
-
import { checkCacheForDynamicVariable } from "../../../threads/utils"
|
|
5
|
-
import { events } from "@budibase/backend-core"
|
|
6
2
|
|
|
3
|
+
let setup = require("./utilities")
|
|
7
4
|
let { basicDatasource } = setup.structures
|
|
5
|
+
let { checkBuilderEndpoint } = require("./utilities/TestFunctions")
|
|
8
6
|
const pg = require("pg")
|
|
7
|
+
const { checkCacheForDynamicVariable } = require("../../../threads/utils")
|
|
8
|
+
const { events } = require("@budibase/backend-core")
|
|
9
9
|
|
|
10
10
|
describe("/datasources", () => {
|
|
11
11
|
let request = setup.getRequest()
|
|
12
12
|
let config = setup.getConfig()
|
|
13
|
-
let datasource
|
|
13
|
+
let datasource
|
|
14
14
|
|
|
15
15
|
afterAll(setup.afterAll)
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ describe("/datasources", () => {
|
|
|
26
26
|
.post(`/api/datasources`)
|
|
27
27
|
.send(basicDatasource())
|
|
28
28
|
.set(config.defaultHeaders())
|
|
29
|
-
.expect(
|
|
29
|
+
.expect('Content-Type', /json/)
|
|
30
30
|
.expect(200)
|
|
31
31
|
|
|
32
32
|
expect(res.body.datasource.name).toEqual("Test")
|
|
@@ -42,7 +42,7 @@ describe("/datasources", () => {
|
|
|
42
42
|
.put(`/api/datasources/${datasource._id}`)
|
|
43
43
|
.send(datasource)
|
|
44
44
|
.set(config.defaultHeaders())
|
|
45
|
-
.expect(
|
|
45
|
+
.expect('Content-Type', /json/)
|
|
46
46
|
.expect(200)
|
|
47
47
|
|
|
48
48
|
expect(res.body.datasource.name).toEqual("Updated Test")
|
|
@@ -51,34 +51,25 @@ describe("/datasources", () => {
|
|
|
51
51
|
})
|
|
52
52
|
|
|
53
53
|
describe("dynamic variables", () => {
|
|
54
|
-
async function preview(
|
|
55
|
-
datasource: any,
|
|
56
|
-
fields: { path: string; queryString: string }
|
|
57
|
-
) {
|
|
54
|
+
async function preview(datasource, fields) {
|
|
58
55
|
return config.previewQuery(request, config, datasource, fields)
|
|
59
56
|
}
|
|
60
57
|
|
|
61
58
|
it("should invalidate changed or removed variables", async () => {
|
|
62
59
|
const { datasource, query } = await config.dynamicVariableDatasource()
|
|
63
60
|
// preview once to cache variables
|
|
64
|
-
await preview(datasource, {
|
|
65
|
-
path: "www.test.com",
|
|
66
|
-
queryString: "test={{ variable3 }}",
|
|
67
|
-
})
|
|
61
|
+
await preview(datasource, { path: "www.test.com", queryString: "test={{ variable3 }}" })
|
|
68
62
|
// check variables in cache
|
|
69
|
-
let contents = await checkCacheForDynamicVariable(
|
|
70
|
-
query._id,
|
|
71
|
-
"variable3"
|
|
72
|
-
)
|
|
63
|
+
let contents = await checkCacheForDynamicVariable(query._id, "variable3")
|
|
73
64
|
expect(contents.rows.length).toEqual(1)
|
|
74
|
-
|
|
65
|
+
|
|
75
66
|
// update the datasource to remove the variables
|
|
76
67
|
datasource.config.dynamicVariables = []
|
|
77
68
|
const res = await request
|
|
78
69
|
.put(`/api/datasources/${datasource._id}`)
|
|
79
70
|
.send(datasource)
|
|
80
71
|
.set(config.defaultHeaders())
|
|
81
|
-
.expect(
|
|
72
|
+
.expect('Content-Type', /json/)
|
|
82
73
|
.expect(200)
|
|
83
74
|
expect(res.body.errors).toBeUndefined()
|
|
84
75
|
|
|
@@ -94,7 +85,7 @@ describe("/datasources", () => {
|
|
|
94
85
|
const res = await request
|
|
95
86
|
.get(`/api/datasources`)
|
|
96
87
|
.set(config.defaultHeaders())
|
|
97
|
-
.expect(
|
|
88
|
+
.expect('Content-Type', /json/)
|
|
98
89
|
.expect(200)
|
|
99
90
|
|
|
100
91
|
const datasources = res.body
|
|
@@ -169,7 +160,7 @@ describe("/datasources", () => {
|
|
|
169
160
|
const res = await request
|
|
170
161
|
.get(`/api/datasources`)
|
|
171
162
|
.set(config.defaultHeaders())
|
|
172
|
-
.expect(
|
|
163
|
+
.expect('Content-Type', /json/)
|
|
173
164
|
.expect(200)
|
|
174
165
|
|
|
175
166
|
expect(res.body.length).toEqual(1)
|
|
@@ -183,5 +174,6 @@ describe("/datasources", () => {
|
|
|
183
174
|
url: `/api/datasources/${datasource._id}/${datasource._rev}`,
|
|
184
175
|
})
|
|
185
176
|
})
|
|
177
|
+
|
|
186
178
|
})
|
|
187
179
|
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as setup from "./utilities"
|
|
2
|
+
import { events } from "@budibase/backend-core"
|
|
3
|
+
|
|
4
|
+
describe("/deployments", () => {
|
|
5
|
+
let request = setup.getRequest()
|
|
6
|
+
let config = setup.getConfig()
|
|
7
|
+
|
|
8
|
+
afterAll(setup.afterAll)
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await config.init()
|
|
12
|
+
jest.clearAllMocks()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
describe("deploy", () => {
|
|
16
|
+
it("should deploy the application", async () => {
|
|
17
|
+
await request
|
|
18
|
+
.post(`/api/deploy`)
|
|
19
|
+
.set(config.defaultHeaders())
|
|
20
|
+
.expect("Content-Type", /json/)
|
|
21
|
+
.expect(200)
|
|
22
|
+
expect((events.app.published as jest.Mock).mock.calls.length).toBe(1)
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -92,7 +92,7 @@ describe("/permission", () => {
|
|
|
92
92
|
describe("check public user allowed", () => {
|
|
93
93
|
it("should be able to read the row", async () => {
|
|
94
94
|
// replicate changes before checking permissions
|
|
95
|
-
await config.
|
|
95
|
+
await config.deploy()
|
|
96
96
|
|
|
97
97
|
const res = await request
|
|
98
98
|
.get(`/api/${table._id}/rows`)
|
|
@@ -9,6 +9,7 @@ const route = "/test"
|
|
|
9
9
|
// there are checks which are disabled in test env,
|
|
10
10
|
// these checks need to be enabled for this test
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
describe("/routing", () => {
|
|
13
14
|
let request = setup.getRequest()
|
|
14
15
|
let config = setup.getConfig()
|
|
@@ -25,7 +26,7 @@ describe("/routing", () => {
|
|
|
25
26
|
screen2.routing.roleId = BUILTIN_ROLE_IDS.POWER
|
|
26
27
|
screen2.routing.route = route
|
|
27
28
|
screen2 = await config.createScreen(screen2)
|
|
28
|
-
await config.
|
|
29
|
+
await config.deploy()
|
|
29
30
|
})
|
|
30
31
|
|
|
31
32
|
describe("fetch", () => {
|
|
@@ -10,7 +10,6 @@ const {
|
|
|
10
10
|
StaticQuotaName,
|
|
11
11
|
MonthlyQuotaName,
|
|
12
12
|
} = require("@budibase/types")
|
|
13
|
-
const { structures } = require("@budibase/backend-core/tests");
|
|
14
13
|
|
|
15
14
|
describe("/rows", () => {
|
|
16
15
|
let request = setup.getRequest()
|
|
@@ -495,13 +494,12 @@ describe("/rows", () => {
|
|
|
495
494
|
describe("attachments", () => {
|
|
496
495
|
it("should allow enriching attachment rows", async () => {
|
|
497
496
|
const table = await config.createAttachmentTable()
|
|
498
|
-
const attachmentId = `${structures.uuid()}.csv`
|
|
499
497
|
const row = await config.createRow({
|
|
500
498
|
name: "test",
|
|
501
499
|
description: "test",
|
|
502
500
|
attachment: [
|
|
503
501
|
{
|
|
504
|
-
key: `${config.getAppId()}/attachments
|
|
502
|
+
key: `${config.getAppId()}/attachments/test/thing.csv`,
|
|
505
503
|
},
|
|
506
504
|
],
|
|
507
505
|
tableId: table._id,
|
|
@@ -511,7 +509,7 @@ describe("/rows", () => {
|
|
|
511
509
|
context.doInAppContext(config.getAppId(), async () => {
|
|
512
510
|
const enriched = await outputProcessing(table, [row])
|
|
513
511
|
expect(enriched[0].attachment[0].url).toBe(
|
|
514
|
-
`/
|
|
512
|
+
`/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv`
|
|
515
513
|
)
|
|
516
514
|
})
|
|
517
515
|
})
|
|
@@ -1,5 +1,20 @@
|
|
|
1
|
+
jest.mock("node-fetch")
|
|
2
|
+
jest.mock("aws-sdk", () => ({
|
|
3
|
+
config: {
|
|
4
|
+
update: jest.fn(),
|
|
5
|
+
},
|
|
6
|
+
DynamoDB: {
|
|
7
|
+
DocumentClient: jest.fn(),
|
|
8
|
+
},
|
|
9
|
+
S3: jest.fn(() => ({
|
|
10
|
+
getSignedUrl: jest.fn(() => {
|
|
11
|
+
return "my-url"
|
|
12
|
+
}),
|
|
13
|
+
})),
|
|
14
|
+
}))
|
|
15
|
+
|
|
1
16
|
const setup = require("./utilities")
|
|
2
|
-
const { constants } = require("@budibase/backend-core")
|
|
17
|
+
const { events, constants } = require("@budibase/backend-core")
|
|
3
18
|
|
|
4
19
|
describe("/static", () => {
|
|
5
20
|
let request = setup.getRequest()
|
|
@@ -87,7 +102,7 @@ describe("/static", () => {
|
|
|
87
102
|
.set(config.defaultHeaders())
|
|
88
103
|
.expect("Content-Type", /json/)
|
|
89
104
|
.expect(200)
|
|
90
|
-
expect(res.body.signedUrl).toEqual("
|
|
105
|
+
expect(res.body.signedUrl).toEqual("my-url")
|
|
91
106
|
expect(res.body.publicUrl).toEqual(
|
|
92
107
|
`https://${bucket}.s3.eu-west-1.amazonaws.com/${key}`
|
|
93
108
|
)
|
|
@@ -51,7 +51,7 @@ describe("/tables", () => {
|
|
|
51
51
|
table.dataImport.schema = table.schema
|
|
52
52
|
|
|
53
53
|
const res = await createTable(table)
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
expect(events.table.created).toBeCalledTimes(1)
|
|
56
56
|
expect(events.table.created).toBeCalledWith(res.body)
|
|
57
57
|
expect(events.table.imported).toBeCalledTimes(1)
|
|
@@ -87,12 +87,6 @@ describe("/tables", () => {
|
|
|
87
87
|
|
|
88
88
|
it("updates all the row fields for a table when a schema key is renamed", async () => {
|
|
89
89
|
const testTable = await config.createTable()
|
|
90
|
-
await config.createView({
|
|
91
|
-
name: "TestView",
|
|
92
|
-
field: "Price",
|
|
93
|
-
calculation: "stats",
|
|
94
|
-
tableId: testTable._id,
|
|
95
|
-
})
|
|
96
90
|
|
|
97
91
|
const testRow = await request
|
|
98
92
|
.post(`/api/${testTable._id}/rows`)
|
|
@@ -115,7 +109,7 @@ describe("/tables", () => {
|
|
|
115
109
|
updated: "updatedName"
|
|
116
110
|
},
|
|
117
111
|
schema: {
|
|
118
|
-
updatedName: {
|
|
112
|
+
updatedName: {type: "string"}
|
|
119
113
|
}
|
|
120
114
|
})
|
|
121
115
|
.set(config.defaultHeaders())
|
|
@@ -90,90 +90,4 @@ describe("/users", () => {
|
|
|
90
90
|
expect(res.body.tableId).toBeDefined()
|
|
91
91
|
})
|
|
92
92
|
})
|
|
93
|
-
describe("setFlag", () => {
|
|
94
|
-
it("should throw an error if a flag is not provided", async () => {
|
|
95
|
-
await config.createUser()
|
|
96
|
-
const res = await request
|
|
97
|
-
.post(`/api/users/flags`)
|
|
98
|
-
.set(config.defaultHeaders())
|
|
99
|
-
.send({ value: "test" })
|
|
100
|
-
.expect(400)
|
|
101
|
-
.expect("Content-Type", /json/)
|
|
102
|
-
expect(res.body.message).toEqual("Must supply a 'flag' field in request body.")
|
|
103
|
-
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it("should be able to set a flag on the user", async () => {
|
|
107
|
-
await config.createUser()
|
|
108
|
-
const res = await request
|
|
109
|
-
.post(`/api/users/flags`)
|
|
110
|
-
.set(config.defaultHeaders())
|
|
111
|
-
.send({ value: "test", flag: "test" })
|
|
112
|
-
.expect(200)
|
|
113
|
-
.expect("Content-Type", /json/)
|
|
114
|
-
expect(res.body.message).toEqual("Flag set successfully")
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
describe("getFlags", () => {
|
|
119
|
-
it("should get flags for a specific user", async () => {
|
|
120
|
-
let flagData = { value: "test", flag: "test" }
|
|
121
|
-
await config.createUser()
|
|
122
|
-
await request
|
|
123
|
-
.post(`/api/users/flags`)
|
|
124
|
-
.set(config.defaultHeaders())
|
|
125
|
-
.send(flagData)
|
|
126
|
-
.expect(200)
|
|
127
|
-
.expect("Content-Type", /json/)
|
|
128
|
-
|
|
129
|
-
const res = await request
|
|
130
|
-
.get(`/api/users/flags`)
|
|
131
|
-
.set(config.defaultHeaders())
|
|
132
|
-
.expect(200)
|
|
133
|
-
.expect("Content-Type", /json/)
|
|
134
|
-
expect(res.body[flagData.value]).toEqual(flagData.flag)
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
describe("setFlag", () => {
|
|
139
|
-
it("should throw an error if a flag is not provided", async () => {
|
|
140
|
-
await config.createUser()
|
|
141
|
-
const res = await request
|
|
142
|
-
.post(`/api/users/flags`)
|
|
143
|
-
.set(config.defaultHeaders())
|
|
144
|
-
.send({ value: "test" })
|
|
145
|
-
.expect(400)
|
|
146
|
-
.expect("Content-Type", /json/)
|
|
147
|
-
expect(res.body.message).toEqual("Must supply a 'flag' field in request body.")
|
|
148
|
-
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
it("should be able to set a flag on the user", async () => {
|
|
152
|
-
await config.createUser()
|
|
153
|
-
const res = await request
|
|
154
|
-
.post(`/api/users/flags`)
|
|
155
|
-
.set(config.defaultHeaders())
|
|
156
|
-
.send({ value: "test", flag: "test" })
|
|
157
|
-
.expect(200)
|
|
158
|
-
.expect("Content-Type", /json/)
|
|
159
|
-
expect(res.body.message).toEqual("Flag set successfully")
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
|
|
163
|
-
describe("syncUser", () => {
|
|
164
|
-
it("should sync the user", async () => {
|
|
165
|
-
let user = await config.createUser()
|
|
166
|
-
await config.createApp('New App')
|
|
167
|
-
let res = await request
|
|
168
|
-
.post(`/api/users/metadata/sync/${user._id}`)
|
|
169
|
-
.set(config.defaultHeaders())
|
|
170
|
-
.expect(200)
|
|
171
|
-
.expect("Content-Type", /json/)
|
|
172
|
-
expect(res.body.message).toEqual('User synced.')
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
93
|
})
|
|
@@ -63,14 +63,14 @@ export function afterAll() {
|
|
|
63
63
|
|
|
64
64
|
export function getRequest() {
|
|
65
65
|
if (!request) {
|
|
66
|
-
beforeAll()
|
|
66
|
+
exports.beforeAll()
|
|
67
67
|
}
|
|
68
68
|
return request
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export function getConfig() {
|
|
72
72
|
if (!config) {
|
|
73
|
-
beforeAll()
|
|
73
|
+
exports.beforeAll()
|
|
74
74
|
}
|
|
75
75
|
return config
|
|
76
76
|
}
|
|
@@ -113,7 +113,7 @@ describe("/webhooks", () => {
|
|
|
113
113
|
describe("trigger", () => {
|
|
114
114
|
it("should allow triggering from public", async () => {
|
|
115
115
|
// replicate changes before checking webhook
|
|
116
|
-
await config.
|
|
116
|
+
await config.deploy()
|
|
117
117
|
|
|
118
118
|
const res = await request
|
|
119
119
|
.post(`/api/webhooks/trigger/${config.prodAppId}/${webhook._id}`)
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
} from "@budibase/string-templates"
|
|
6
6
|
import sdk from "../sdk"
|
|
7
7
|
import { Row } from "@budibase/types"
|
|
8
|
-
import { LoopStep, LoopStepType, LoopInput } from "../definitions/automations"
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* When values are input to the system generally they will be of type string as this is required for template strings.
|
|
@@ -124,26 +123,3 @@ export function stringSplit(value: string | string[]) {
|
|
|
124
123
|
}
|
|
125
124
|
return value
|
|
126
125
|
}
|
|
127
|
-
|
|
128
|
-
export function typecastForLooping(loopStep: LoopStep, input: LoopInput) {
|
|
129
|
-
if (!input || !input.binding) {
|
|
130
|
-
return null
|
|
131
|
-
}
|
|
132
|
-
try {
|
|
133
|
-
switch (loopStep.inputs.option) {
|
|
134
|
-
case LoopStepType.ARRAY:
|
|
135
|
-
if (typeof input.binding === "string") {
|
|
136
|
-
return JSON.parse(input.binding)
|
|
137
|
-
}
|
|
138
|
-
break
|
|
139
|
-
case LoopStepType.STRING:
|
|
140
|
-
if (Array.isArray(input.binding)) {
|
|
141
|
-
return input.binding.join(",")
|
|
142
|
-
}
|
|
143
|
-
break
|
|
144
|
-
}
|
|
145
|
-
} catch (err) {
|
|
146
|
-
throw new Error("Unable to cast to correct type")
|
|
147
|
-
}
|
|
148
|
-
return input.binding
|
|
149
|
-
}
|
|
@@ -31,7 +31,7 @@ export async function runInProd(fn: any) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export async function runStep(stepId: string, inputs: any
|
|
34
|
+
export async function runStep(stepId: string, inputs: any) {
|
|
35
35
|
async function run() {
|
|
36
36
|
let step = await getAction(stepId)
|
|
37
37
|
expect(step).toBeDefined()
|
|
@@ -39,7 +39,7 @@ export async function runStep(stepId: string, inputs: any, stepContext?: any) {
|
|
|
39
39
|
throw new Error("No step found")
|
|
40
40
|
}
|
|
41
41
|
return step({
|
|
42
|
-
context:
|
|
42
|
+
context: {},
|
|
43
43
|
inputs,
|
|
44
44
|
appId: config ? config.getAppId() : null,
|
|
45
45
|
// don't really need an API key, mocked out usage quota, not being tested here
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const automationUtils = require("../automationUtils")
|
|
2
|
+
|
|
3
|
+
describe("automationUtils", () => {
|
|
4
|
+
test("substituteLoopStep should allow multiple loop binding substitutes", () => {
|
|
5
|
+
expect(automationUtils.substituteLoopStep(
|
|
6
|
+
`{{ loop.currentItem._id }} {{ loop.currentItem._id }} {{ loop.currentItem._id }}`,
|
|
7
|
+
"step.2"))
|
|
8
|
+
.toBe(`{{ step.2.currentItem._id }} {{ step.2.currentItem._id }} {{ step.2.currentItem._id }}`)
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test("substituteLoopStep should handle not subsituting outside of curly braces", () => {
|
|
12
|
+
expect(automationUtils.substituteLoopStep(
|
|
13
|
+
`loop {{ loop.currentItem._id }}loop loop{{ loop.currentItem._id }}loop`,
|
|
14
|
+
"step.2"))
|
|
15
|
+
.toBe(`loop {{ step.2.currentItem._id }}loop loop{{ step.2.currentItem._id }}loop`)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
@@ -102,16 +102,6 @@ export interface components {
|
|
|
102
102
|
lockedBy?: { [key: string]: unknown };
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
deploymentOutput: {
|
|
106
|
-
data: {
|
|
107
|
-
/** @description The ID of the deployment. */
|
|
108
|
-
_id: string;
|
|
109
|
-
/** @description The status of the deployment. */
|
|
110
|
-
status: "SUCCESS" | "FAILURE";
|
|
111
|
-
/** @description The URL by which the published app is accessed. */
|
|
112
|
-
appUrl?: string;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
105
|
applicationSearch: {
|
|
116
106
|
data: {
|
|
117
107
|
/** @description The name of the app. */
|
package/src/environment.ts
CHANGED
|
@@ -79,6 +79,7 @@ const environment = {
|
|
|
79
79
|
// flags
|
|
80
80
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
81
81
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
|
82
|
+
DISABLE_DEVELOPER_LICENSE: process.env.DISABLE_DEVELOPER_LICENSE,
|
|
82
83
|
DISABLE_AUTOMATION_LOGS: process.env.DISABLE_AUTOMATION_LOGS,
|
|
83
84
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
|
84
85
|
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
|
@@ -118,11 +119,6 @@ for (let [key, value] of Object.entries(environment)) {
|
|
|
118
119
|
// @ts-ignore
|
|
119
120
|
environment[key] = 0
|
|
120
121
|
}
|
|
121
|
-
// handle the edge case of "false" to disable an environment variable
|
|
122
|
-
if (value === "false") {
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
environment[key] = 0
|
|
125
|
-
}
|
|
126
122
|
}
|
|
127
123
|
|
|
128
124
|
export = environment
|
|
@@ -284,7 +284,7 @@ class GoogleSheetsIntegration implements DatasourcePlus {
|
|
|
284
284
|
async createTable(name?: string) {
|
|
285
285
|
try {
|
|
286
286
|
await this.connect()
|
|
287
|
-
return await this.client.addSheet({ title: name
|
|
287
|
+
return await this.client.addSheet({ title: name })
|
|
288
288
|
} catch (err) {
|
|
289
289
|
console.error("Error creating new table in google sheets", err)
|
|
290
290
|
throw err
|
|
@@ -98,7 +98,11 @@ export async function getIntegration(integration: string) {
|
|
|
98
98
|
for (let plugin of plugins) {
|
|
99
99
|
if (plugin.name === integration) {
|
|
100
100
|
// need to use commonJS require due to its dynamic runtime nature
|
|
101
|
-
const retrieved: any = await getDatasourcePlugin(
|
|
101
|
+
const retrieved: any = await getDatasourcePlugin(
|
|
102
|
+
plugin.name,
|
|
103
|
+
plugin.jsUrl,
|
|
104
|
+
plugin.schema?.hash
|
|
105
|
+
)
|
|
102
106
|
if (retrieved.integration) {
|
|
103
107
|
return retrieved.integration
|
|
104
108
|
} else {
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
isGoogleConfig,
|
|
6
6
|
isOIDCConfig,
|
|
7
7
|
isSettingsConfig,
|
|
8
|
-
ConfigType,
|
|
9
8
|
} from "@budibase/types"
|
|
10
9
|
import env from "./../../../../environment"
|
|
11
10
|
|
|
@@ -32,15 +31,15 @@ export const backfill = async (
|
|
|
32
31
|
await events.email.SMTPCreated(timestamp)
|
|
33
32
|
}
|
|
34
33
|
if (isGoogleConfig(config)) {
|
|
35
|
-
await events.auth.SSOCreated(
|
|
34
|
+
await events.auth.SSOCreated("google", timestamp)
|
|
36
35
|
if (config.config.activated) {
|
|
37
|
-
await events.auth.SSOActivated(
|
|
36
|
+
await events.auth.SSOActivated("google", timestamp)
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
if (isOIDCConfig(config)) {
|
|
41
|
-
await events.auth.SSOCreated(
|
|
40
|
+
await events.auth.SSOCreated("oidc", timestamp)
|
|
42
41
|
if (config.config.configs[0].activated) {
|
|
43
|
-
await events.auth.SSOActivated(
|
|
42
|
+
await events.auth.SSOActivated("oidc", timestamp)
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
if (isSettingsConfig(config)) {
|
|
@@ -26,7 +26,11 @@ type TemplateType = {
|
|
|
26
26
|
|
|
27
27
|
function rewriteAttachmentUrl(appId: string, attachment: RowAttachment) {
|
|
28
28
|
// URL looks like: /prod-budi-app-assets/appId/attachments/file.csv
|
|
29
|
-
const urlParts = attachment.
|
|
29
|
+
const urlParts = attachment.url.split("/")
|
|
30
|
+
// drop the first empty element
|
|
31
|
+
urlParts.shift()
|
|
32
|
+
// get the prefix
|
|
33
|
+
const prefix = urlParts.shift()
|
|
30
34
|
// remove the app ID
|
|
31
35
|
urlParts.shift()
|
|
32
36
|
// add new app ID
|
|
@@ -35,7 +39,7 @@ function rewriteAttachmentUrl(appId: string, attachment: RowAttachment) {
|
|
|
35
39
|
return {
|
|
36
40
|
...attachment,
|
|
37
41
|
key,
|
|
38
|
-
url:
|
|
42
|
+
url: `/${prefix}/${key}`,
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
|
|
@@ -69,7 +69,10 @@ describe("should be able to re-write attachment URLs", () => {
|
|
|
69
69
|
const finalRows = await sdk.rows.getAllInternalRows(db.name)
|
|
70
70
|
for (let rowToCheck of finalRows) {
|
|
71
71
|
expect(rowToCheck.otherCol).toBe(row.otherCol)
|
|
72
|
-
expect(rowToCheck.photo[0].url).toBe(
|
|
72
|
+
expect(rowToCheck.photo[0].url).not.toBe(row.photo[0].url)
|
|
73
|
+
expect(rowToCheck.photo[0].url).toBe(
|
|
74
|
+
`/prod-budi-app-assets/${db.name}/attachments/a.png`
|
|
75
|
+
)
|
|
73
76
|
expect(rowToCheck.photo[0].key).toBe(`${db.name}/attachments/a.png`)
|
|
74
77
|
}
|
|
75
78
|
})
|
package/src/tests/jestSetup.ts
CHANGED
|
@@ -19,10 +19,7 @@ import { mocks } from "@budibase/backend-core/tests"
|
|
|
19
19
|
const tk = require("timekeeper")
|
|
20
20
|
tk.freeze(mocks.date.MOCK_DATE)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
global.console.log = jest.fn() // console.log are ignored in tests
|
|
24
|
-
global.console.warn = jest.fn() // console.warn are ignored in tests
|
|
25
|
-
}
|
|
22
|
+
global.console.log = jest.fn() // console.log are ignored in tests
|
|
26
23
|
|
|
27
24
|
if (!process.env.CI) {
|
|
28
25
|
// set a longer timeout in dev for debugging
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { mocks } from "@budibase/backend-core/tests"
|
|
2
|
-
|
|
3
|
-
// init the licensing mock
|
|
4
|
-
import * as pro from "@budibase/pro"
|
|
5
|
-
mocks.licenses.init(pro)
|
|
6
|
-
|
|
7
|
-
// use unlimited license by default
|
|
8
|
-
mocks.licenses.useUnlimited()
|
|
9
|
-
|
|
10
1
|
import { init as dbInit } from "../../db"
|
|
11
2
|
dbInit()
|
|
12
3
|
import env from "../../environment"
|
|
@@ -360,6 +351,7 @@ class TestConfiguration {
|
|
|
360
351
|
}
|
|
361
352
|
|
|
362
353
|
// APP
|
|
354
|
+
|
|
363
355
|
async createApp(appName: string) {
|
|
364
356
|
// create dev app
|
|
365
357
|
// clear any old app
|
|
@@ -372,7 +364,7 @@ class TestConfiguration {
|
|
|
372
364
|
await context.updateAppId(this.appId)
|
|
373
365
|
|
|
374
366
|
// create production app
|
|
375
|
-
this.prodApp = await this.
|
|
367
|
+
this.prodApp = await this.deploy()
|
|
376
368
|
|
|
377
369
|
this.allApps.push(this.prodApp)
|
|
378
370
|
this.allApps.push(this.app)
|
|
@@ -380,8 +372,8 @@ class TestConfiguration {
|
|
|
380
372
|
return this.app
|
|
381
373
|
}
|
|
382
374
|
|
|
383
|
-
async
|
|
384
|
-
await this._req(null, null, controllers.deploy.
|
|
375
|
+
async deploy() {
|
|
376
|
+
await this._req(null, null, controllers.deploy.deployApp)
|
|
385
377
|
// @ts-ignore
|
|
386
378
|
const prodAppId = this.getAppId().replace("_dev", "")
|
|
387
379
|
this.prodAppId = prodAppId
|
|
@@ -392,17 +384,6 @@ class TestConfiguration {
|
|
|
392
384
|
})
|
|
393
385
|
}
|
|
394
386
|
|
|
395
|
-
async unpublish() {
|
|
396
|
-
const response = await this._req(
|
|
397
|
-
null,
|
|
398
|
-
{ appId: this.appId },
|
|
399
|
-
controllers.app.unpublish
|
|
400
|
-
)
|
|
401
|
-
this.prodAppId = null
|
|
402
|
-
this.prodApp = null
|
|
403
|
-
return response
|
|
404
|
-
}
|
|
405
|
-
|
|
406
387
|
// TABLE
|
|
407
388
|
|
|
408
389
|
async updateTable(config?: any) {
|