@budibase/server 2.2.12-alpha.5 → 2.2.12-alpha.51
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.f29fb244.js +1031 -0
- package/builder/assets/index.ff7b1aa7.css +6 -0
- package/builder/assets/schnellecke.cf1837a8.png +0 -0
- package/builder/index.html +2 -2
- package/coverage/clover.xml +5670 -5622
- package/coverage/coverage-final.json +282 -279
- package/coverage/lcov-report/index.html +458 -413
- package/coverage/lcov-report/src/api/controllers/analytics.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/apikeys.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/application.ts.html +199 -178
- package/coverage/lcov-report/src/api/controllers/auth.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/automation.ts.html +37 -37
- package/coverage/lcov-report/src/api/controllers/backup.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/cloud.ts.html +19 -19
- package/coverage/lcov-report/src/api/controllers/component.ts.html +12 -12
- package/coverage/lcov-report/src/api/controllers/datasource.ts.html +117 -93
- package/coverage/lcov-report/src/api/controllers/deploy/Deployment.ts.html +18 -18
- package/coverage/lcov-report/src/api/controllers/deploy/index.html +7 -7
- package/coverage/lcov-report/src/api/controllers/deploy/index.ts.html +83 -83
- package/coverage/lcov-report/src/api/controllers/dev.ts.html +28 -28
- package/coverage/lcov-report/src/api/controllers/index.html +105 -105
- package/coverage/lcov-report/src/api/controllers/integration.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/layout.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/metadata.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/migrations.ts.html +6 -6
- package/coverage/lcov-report/src/api/controllers/permission.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/plugin/file.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/github.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/plugin/index.html +31 -31
- package/coverage/lcov-report/src/api/controllers/plugin/index.ts.html +32 -32
- package/coverage/lcov-report/src/api/controllers/plugin/npm.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/plugin/uploaders.ts.html +5 -5
- package/coverage/lcov-report/src/api/controllers/plugin/url.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/plugin/utils.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/applications.ts.html +31 -31
- package/coverage/lcov-report/src/api/controllers/public/index.html +58 -58
- package/coverage/lcov-report/src/api/controllers/public/mapping/applications.ts.html +7 -7
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.html +25 -25
- package/coverage/lcov-report/src/api/controllers/public/mapping/index.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/public/mapping/queries.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/public/mapping/rows.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/mapping/tables.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/mapping/users.ts.html +4 -4
- package/coverage/lcov-report/src/api/controllers/public/queries.ts.html +15 -15
- package/coverage/lcov-report/src/api/controllers/public/rows.ts.html +21 -21
- package/coverage/lcov-report/src/api/controllers/public/tables.ts.html +21 -21
- package/coverage/lcov-report/src/api/controllers/public/users.ts.html +27 -27
- package/coverage/lcov-report/src/api/controllers/public/utils.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/query/import/index.html +8 -8
- package/coverage/lcov-report/src/api/controllers/query/import/index.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.html +14 -14
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/controllers/query/import/sources/base/openapi.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/query/import/sources/curl.ts.html +12 -12
- package/coverage/lcov-report/src/api/controllers/query/import/sources/index.html +23 -23
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi2.ts.html +16 -16
- package/coverage/lcov-report/src/api/controllers/query/import/sources/openapi3.ts.html +20 -20
- package/coverage/lcov-report/src/api/controllers/query/index.html +16 -16
- package/coverage/lcov-report/src/api/controllers/query/index.ts.html +94 -70
- package/coverage/lcov-report/src/api/controllers/query/validation.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/role.ts.html +9 -9
- package/coverage/lcov-report/src/api/controllers/routing.ts.html +10 -10
- package/coverage/lcov-report/src/api/controllers/row/ExternalRequest.ts.html +58 -40
- package/coverage/lcov-report/src/api/controllers/row/external.ts.html +87 -57
- package/coverage/lcov-report/src/api/controllers/row/index.html +66 -66
- package/coverage/lcov-report/src/api/controllers/row/index.ts.html +36 -36
- package/coverage/lcov-report/src/api/controllers/row/internal.ts.html +155 -83
- package/coverage/lcov-report/src/api/controllers/row/internalSearch.ts.html +146 -146
- package/coverage/lcov-report/src/api/controllers/row/staticFormula.ts.html +33 -33
- package/coverage/lcov-report/src/api/controllers/row/utils.ts.html +153 -39
- package/coverage/lcov-report/src/api/controllers/screen.ts.html +12 -12
- package/coverage/lcov-report/src/api/controllers/script.ts.html +11 -11
- package/coverage/lcov-report/src/api/controllers/static/index.html +15 -15
- package/coverage/lcov-report/src/api/controllers/static/index.ts.html +49 -52
- package/coverage/lcov-report/src/api/controllers/table/bulkFormula.ts.html +60 -60
- package/coverage/lcov-report/src/api/controllers/table/external.ts.html +56 -50
- package/coverage/lcov-report/src/api/controllers/table/index.html +48 -48
- package/coverage/lcov-report/src/api/controllers/table/index.ts.html +155 -68
- package/coverage/lcov-report/src/api/controllers/table/internal.ts.html +58 -61
- package/coverage/lcov-report/src/api/controllers/table/utils.ts.html +93 -96
- package/coverage/lcov-report/src/api/controllers/templates.ts.html +21 -21
- package/coverage/lcov-report/src/api/controllers/user.ts.html +103 -79
- package/coverage/lcov-report/src/api/controllers/view/exporters.ts.html +64 -19
- package/coverage/lcov-report/src/api/controllers/view/index.html +38 -38
- package/coverage/lcov-report/src/api/controllers/view/index.ts.html +57 -96
- package/coverage/lcov-report/src/api/controllers/view/utils.ts.html +22 -22
- package/coverage/lcov-report/src/api/controllers/view/viewBuilder.ts.html +8 -8
- package/coverage/lcov-report/src/api/controllers/webhook.ts.html +69 -63
- package/coverage/lcov-report/src/api/index.html +15 -15
- package/coverage/lcov-report/src/api/index.ts.html +35 -35
- package/coverage/lcov-report/src/api/routes/analytics.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/apikeys.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/application.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/auth.ts.html +9 -9
- package/coverage/lcov-report/src/api/routes/automation.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/backup.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/cloud.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/component.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/datasource.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/deploy.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/dev.ts.html +17 -17
- package/coverage/lcov-report/src/api/routes/index.html +67 -67
- package/coverage/lcov-report/src/api/routes/index.ts.html +43 -37
- package/coverage/lcov-report/src/api/routes/integration.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/layout.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/metadata.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/migrations.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/permission.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/plugin.ts.html +10 -10
- package/coverage/lcov-report/src/api/routes/public/applications.ts.html +16 -16
- package/coverage/lcov-report/src/api/routes/public/index.html +24 -24
- package/coverage/lcov-report/src/api/routes/public/index.ts.html +60 -60
- package/coverage/lcov-report/src/api/routes/public/middleware/index.html +5 -5
- package/coverage/lcov-report/src/api/routes/public/middleware/mapper.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/public/queries.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/public/rows.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/public/tables.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/public/tests/index.html +7 -7
- package/coverage/lcov-report/src/api/routes/public/tests/utils.ts.html +5 -5
- package/coverage/lcov-report/src/api/routes/public/users.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/public/utils/Endpoint.ts.html +21 -21
- package/coverage/lcov-report/src/api/routes/public/utils/index.html +5 -5
- package/coverage/lcov-report/src/api/routes/query.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/role.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/routing.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/row.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/screen.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/script.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/static.ts.html +18 -18
- package/coverage/lcov-report/src/api/routes/table.ts.html +29 -98
- package/coverage/lcov-report/src/api/routes/templates.ts.html +11 -11
- package/coverage/lcov-report/src/api/routes/tests/utilities/TestFunctions.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.html +23 -23
- package/coverage/lcov-report/src/api/routes/tests/utilities/index.ts.html +14 -14
- package/coverage/lcov-report/src/api/routes/user.ts.html +12 -12
- package/coverage/lcov-report/src/api/routes/utils/index.html +3 -3
- package/coverage/lcov-report/src/api/routes/utils/validators.ts.html +44 -44
- package/coverage/lcov-report/src/api/routes/view.ts.html +13 -13
- package/coverage/lcov-report/src/api/routes/webhook.ts.html +13 -13
- package/coverage/lcov-report/src/app.ts.html +22 -16
- package/coverage/lcov-report/src/automations/actions.ts.html +31 -31
- package/coverage/lcov-report/src/automations/automationUtils.ts.html +61 -61
- package/coverage/lcov-report/src/automations/bullboard.ts.html +19 -19
- package/coverage/lcov-report/src/automations/index.html +54 -54
- package/coverage/lcov-report/src/automations/index.ts.html +23 -23
- package/coverage/lcov-report/src/automations/logging/index.html +3 -3
- package/coverage/lcov-report/src/automations/logging/index.ts.html +10 -10
- package/coverage/lcov-report/src/automations/steps/bash.ts.html +11 -11
- package/coverage/lcov-report/src/automations/steps/createRow.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/delay.ts.html +7 -7
- package/coverage/lcov-report/src/automations/steps/deleteRow.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/discord.ts.html +11 -11
- package/coverage/lcov-report/src/automations/steps/executeQuery.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/executeScript.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/filter.ts.html +12 -12
- package/coverage/lcov-report/src/automations/steps/index.html +75 -75
- package/coverage/lcov-report/src/automations/steps/integromat.ts.html +10 -10
- package/coverage/lcov-report/src/automations/steps/loop.ts.html +5 -5
- package/coverage/lcov-report/src/automations/steps/outgoingWebhook.ts.html +19 -19
- package/coverage/lcov-report/src/automations/steps/queryRows.ts.html +43 -43
- package/coverage/lcov-report/src/automations/steps/sendSmtpEmail.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/serverLog.ts.html +10 -10
- package/coverage/lcov-report/src/automations/steps/slack.ts.html +10 -10
- package/coverage/lcov-report/src/automations/steps/updateRow.ts.html +9 -9
- package/coverage/lcov-report/src/automations/steps/utils.ts.html +12 -12
- package/coverage/lcov-report/src/automations/steps/zapier.ts.html +8 -8
- package/coverage/lcov-report/src/automations/tests/utilities/index.html +15 -15
- package/coverage/lcov-report/src/automations/tests/utilities/index.ts.html +24 -24
- package/coverage/lcov-report/src/automations/triggerInfo/app.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggerInfo/cron.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggerInfo/index.html +17 -17
- package/coverage/lcov-report/src/automations/triggerInfo/index.ts.html +10 -10
- package/coverage/lcov-report/src/automations/triggerInfo/rowDeleted.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggerInfo/rowSaved.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggerInfo/rowUpdated.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggerInfo/webhook.ts.html +6 -6
- package/coverage/lcov-report/src/automations/triggers.ts.html +53 -38
- package/coverage/lcov-report/src/automations/utils.ts.html +69 -69
- package/coverage/lcov-report/src/constants/index.html +19 -19
- package/coverage/lcov-report/src/constants/index.ts.html +80 -80
- package/coverage/lcov-report/src/constants/layouts.ts.html +9 -9
- package/coverage/lcov-report/src/constants/screens.ts.html +4 -4
- package/coverage/lcov-report/src/db/defaultData/datasource_bb_default.ts.html +45 -45
- package/coverage/lcov-report/src/db/defaultData/employeeImport.ts.html +8 -8
- package/coverage/lcov-report/src/db/defaultData/expensesImport.ts.html +8 -8
- package/coverage/lcov-report/src/db/defaultData/index.html +43 -43
- package/coverage/lcov-report/src/db/defaultData/inventoryImport.ts.html +8 -8
- package/coverage/lcov-report/src/db/defaultData/jobsImport.ts.html +8 -8
- package/coverage/lcov-report/src/db/dynamoClient.ts.html +26 -26
- package/coverage/lcov-report/src/db/inMemoryView.ts.html +13 -13
- package/coverage/lcov-report/src/db/index.html +32 -32
- package/coverage/lcov-report/src/db/index.ts.html +10 -10
- package/coverage/lcov-report/src/db/linkedRows/LinkController.ts.html +38 -38
- package/coverage/lcov-report/src/db/linkedRows/LinkDocument.ts.html +7 -7
- package/coverage/lcov-report/src/db/linkedRows/index.html +37 -37
- package/coverage/lcov-report/src/db/linkedRows/index.ts.html +40 -40
- package/coverage/lcov-report/src/db/linkedRows/linkUtils.ts.html +25 -25
- package/coverage/lcov-report/src/db/newid.ts.html +5 -5
- package/coverage/lcov-report/src/db/utils.ts.html +76 -76
- package/coverage/lcov-report/src/definitions/automations.ts.html +9 -6
- package/coverage/lcov-report/src/definitions/index.html +5 -20
- package/coverage/lcov-report/src/environment.ts.html +16 -16
- package/coverage/lcov-report/src/events/AutomationEmitter.ts.html +14 -14
- package/coverage/lcov-report/src/events/BudibaseEmitter.ts.html +8 -8
- package/coverage/lcov-report/src/events/index.html +20 -20
- package/coverage/lcov-report/src/events/index.ts.html +7 -7
- package/coverage/lcov-report/src/events/utils.ts.html +11 -11
- package/coverage/lcov-report/src/index.html +36 -36
- package/coverage/lcov-report/src/index.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/airtable.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/arangodb.ts.html +9 -9
- package/coverage/lcov-report/src/integrations/base/index.html +28 -28
- package/coverage/lcov-report/src/integrations/base/query.ts.html +15 -9
- package/coverage/lcov-report/src/integrations/base/sql.ts.html +37 -37
- package/coverage/lcov-report/src/integrations/base/sqlTable.ts.html +22 -22
- package/coverage/lcov-report/src/integrations/base/utils.ts.html +5 -5
- package/coverage/lcov-report/src/integrations/couchdb.ts.html +10 -10
- package/coverage/lcov-report/src/integrations/dynamodb.ts.html +17 -17
- package/coverage/lcov-report/src/integrations/elasticsearch.ts.html +9 -9
- package/coverage/lcov-report/src/integrations/firebase.ts.html +12 -12
- package/coverage/lcov-report/src/integrations/googlesheets.ts.html +41 -41
- package/coverage/lcov-report/src/integrations/index.html +124 -124
- package/coverage/lcov-report/src/integrations/index.ts.html +47 -47
- package/coverage/lcov-report/src/integrations/microsoftSqlServer.ts.html +31 -31
- package/coverage/lcov-report/src/integrations/mongodb.ts.html +421 -289
- package/coverage/lcov-report/src/integrations/mysql.ts.html +28 -28
- package/coverage/lcov-report/src/integrations/oracle.ts.html +31 -31
- package/coverage/lcov-report/src/integrations/postgres.ts.html +22 -22
- package/coverage/lcov-report/src/integrations/queries/index.html +19 -19
- package/coverage/lcov-report/src/integrations/queries/sql.ts.html +18 -153
- package/coverage/lcov-report/src/integrations/redis.ts.html +8 -8
- package/coverage/lcov-report/src/integrations/rest.ts.html +43 -52
- package/coverage/lcov-report/src/integrations/s3.ts.html +17 -17
- package/coverage/lcov-report/src/integrations/snowflake.ts.html +15 -15
- 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 +49 -49
- package/coverage/lcov-report/src/middleware/appInfo.ts.html +11 -11
- package/coverage/lcov-report/src/middleware/authorized.ts.html +49 -37
- package/coverage/lcov-report/src/middleware/builder.ts.html +26 -26
- package/coverage/lcov-report/src/middleware/currentapp.ts.html +50 -47
- package/coverage/lcov-report/src/middleware/index.html +40 -40
- package/coverage/lcov-report/src/middleware/joi-validator.ts.html +10 -10
- package/coverage/lcov-report/src/middleware/publicApi.ts.html +9 -9
- package/coverage/lcov-report/src/middleware/resourceId.ts.html +23 -23
- package/coverage/lcov-report/src/middleware/selfhost.ts.html +2 -2
- package/coverage/lcov-report/src/middleware/utils.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/functions/appUrls.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/backfill/app/automations.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/datasources.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/index.html +31 -31
- package/coverage/lcov-report/src/migrations/functions/backfill/app/layouts.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/backfill/app/queries.ts.html +13 -13
- package/coverage/lcov-report/src/migrations/functions/backfill/app/roles.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/screens.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/app/tables.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/backfill/app.ts.html +21 -21
- package/coverage/lcov-report/src/migrations/functions/backfill/global/configs.ts.html +10 -10
- package/coverage/lcov-report/src/migrations/functions/backfill/global/index.html +19 -19
- package/coverage/lcov-report/src/migrations/functions/backfill/global/quotas.ts.html +9 -9
- package/coverage/lcov-report/src/migrations/functions/backfill/global/users.ts.html +13 -13
- package/coverage/lcov-report/src/migrations/functions/backfill/global.ts.html +23 -23
- package/coverage/lcov-report/src/migrations/functions/backfill/index.html +26 -26
- package/coverage/lcov-report/src/migrations/functions/backfill/index.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/backfill/installation.ts.html +14 -14
- package/coverage/lcov-report/src/migrations/functions/index.html +18 -18
- package/coverage/lcov-report/src/migrations/functions/syncQuotas.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/tableSettings.ts.html +11 -11
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.html +11 -11
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/index.ts.html +3 -3
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncApps.ts.html +6 -6
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncPlugins.ts.html +8 -8
- package/coverage/lcov-report/src/migrations/functions/usageQuotas/syncRows.ts.html +7 -7
- package/coverage/lcov-report/src/migrations/functions/userEmailViewCasing.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/index.html +15 -15
- package/coverage/lcov-report/src/migrations/index.ts.html +43 -43
- package/coverage/lcov-report/src/migrations/tests/helpers.ts.html +4 -4
- package/coverage/lcov-report/src/migrations/tests/index.html +6 -6
- package/coverage/lcov-report/src/migrations/tests/structures.ts.html +3 -3
- package/coverage/lcov-report/src/sdk/app/applications/index.html +11 -11
- package/coverage/lcov-report/src/sdk/app/applications/index.ts.html +6 -6
- package/coverage/lcov-report/src/sdk/app/applications/sync.ts.html +24 -24
- package/coverage/lcov-report/src/sdk/app/applications/utils.ts.html +15 -15
- package/coverage/lcov-report/src/sdk/app/automations/index.html +7 -7
- package/coverage/lcov-report/src/sdk/app/automations/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/automations/webhook.ts.html +8 -8
- package/coverage/lcov-report/src/sdk/app/backups/constants.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/app/backups/exports.ts.html +30 -30
- package/coverage/lcov-report/src/sdk/app/backups/imports.ts.html +24 -24
- package/coverage/lcov-report/src/sdk/app/backups/index.html +27 -27
- package/coverage/lcov-report/src/sdk/app/backups/index.ts.html +7 -7
- package/coverage/lcov-report/src/sdk/app/backups/statistics.ts.html +12 -12
- 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/{utilities/statusCodes.ts.html → sdk/app/queries/index.ts.html} +22 -28
- 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 +8 -8
- package/coverage/lcov-report/src/sdk/app/rows/index.html +8 -8
- package/coverage/lcov-report/src/sdk/app/rows/index.ts.html +6 -6
- package/coverage/lcov-report/src/sdk/app/rows/rows.ts.html +4 -4
- package/coverage/lcov-report/src/sdk/app/tables/index.html +15 -15
- package/coverage/lcov-report/src/sdk/app/tables/index.ts.html +29 -20
- package/coverage/lcov-report/src/sdk/index.html +7 -7
- package/coverage/lcov-report/src/sdk/index.ts.html +24 -12
- package/coverage/lcov-report/src/sdk/users/index.html +6 -6
- package/coverage/lcov-report/src/sdk/users/index.ts.html +5 -5
- package/coverage/lcov-report/src/sdk/users/utils.ts.html +29 -29
- 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 +40 -55
- package/coverage/lcov-report/src/tests/utilities/TestConfiguration.ts.html +141 -132
- package/coverage/lcov-report/src/tests/utilities/controllers.ts.html +20 -20
- package/coverage/lcov-report/src/tests/utilities/index.html +30 -30
- package/coverage/lcov-report/src/tests/utilities/index.ts.html +2 -2
- package/coverage/lcov-report/src/tests/utilities/structures.ts.html +232 -43
- package/coverage/lcov-report/src/threads/automation.ts.html +225 -195
- package/coverage/lcov-report/src/threads/index.html +46 -46
- package/coverage/lcov-report/src/threads/index.ts.html +38 -38
- package/coverage/lcov-report/src/threads/query.ts.html +73 -34
- package/coverage/lcov-report/src/threads/utils.ts.html +26 -26
- package/coverage/lcov-report/src/utilities/budibaseDir.ts.html +4 -4
- package/coverage/lcov-report/src/utilities/centralPath.ts.html +10 -10
- package/coverage/lcov-report/src/utilities/fileSystem/app.ts.html +11 -11
- package/coverage/lcov-report/src/utilities/fileSystem/clientLibrary.ts.html +12 -12
- package/coverage/lcov-report/src/utilities/fileSystem/filesystem.ts.html +32 -26
- package/coverage/lcov-report/src/utilities/fileSystem/index.html +42 -42
- package/coverage/lcov-report/src/utilities/fileSystem/index.ts.html +1 -1
- package/coverage/lcov-report/src/utilities/fileSystem/plugin.ts.html +10 -13
- package/coverage/lcov-report/src/utilities/fileSystem/processor.ts.html +9 -9
- package/coverage/lcov-report/src/utilities/fileSystem/template.ts.html +7 -7
- package/coverage/lcov-report/src/utilities/global.ts.html +61 -61
- package/coverage/lcov-report/src/utilities/index.html +80 -95
- package/coverage/lcov-report/src/utilities/index.ts.html +32 -32
- package/coverage/lcov-report/src/utilities/redis.ts.html +35 -35
- 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 +32 -32
- package/coverage/lcov-report/src/utilities/rowProcessor/index.ts.html +67 -67
- package/coverage/lcov-report/src/utilities/rowProcessor/map.ts.html +9 -9
- package/coverage/lcov-report/src/utilities/rowProcessor/utils.ts.html +26 -26
- package/coverage/lcov-report/src/utilities/{csvParser.ts.html → schema.ts.html} +173 -233
- package/coverage/lcov-report/src/utilities/scriptRunner.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/security.ts.html +13 -13
- package/coverage/lcov-report/src/utilities/usageQuota/index.html +9 -9
- package/coverage/lcov-report/src/utilities/usageQuota/rows.ts.html +8 -8
- package/coverage/lcov-report/src/utilities/usageQuota/usageQuoteReset.ts.html +3 -3
- package/coverage/lcov-report/src/utilities/users.ts.html +7 -7
- package/coverage/lcov-report/src/utilities/workerRequests.ts.html +61 -34
- package/coverage/lcov-report/src/watch.ts.html +20 -20
- package/coverage/lcov-report/src/websocket.ts.html +5 -5
- package/coverage/lcov.info +11919 -11276
- 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 +23 -13
- 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 +45 -42
- 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 +6 -7
- 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/view/viewBuilder.js +15 -2
- package/dist/api/controllers/webhook.js +45 -43
- package/dist/api/routes/analytics.js +2 -1
- package/dist/api/routes/apikeys.js +2 -1
- package/dist/api/routes/application.js +2 -1
- package/dist/api/routes/auth.js +2 -1
- package/dist/api/routes/automation.js +2 -1
- package/dist/api/routes/backup.js +2 -1
- package/dist/api/routes/cloud.js +2 -1
- package/dist/api/routes/component.js +2 -1
- package/dist/api/routes/datasource.js +2 -1
- package/dist/api/routes/deploy.js +2 -1
- package/dist/api/routes/dev.js +2 -1
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/integration.js +2 -1
- package/dist/api/routes/layout.js +2 -1
- package/dist/api/routes/metadata.js +2 -1
- package/dist/api/routes/migrations.js +2 -1
- package/dist/api/routes/permission.js +2 -1
- package/dist/api/routes/query.js +2 -1
- package/dist/api/routes/role.js +2 -1
- package/dist/api/routes/routing.js +2 -1
- package/dist/api/routes/row.js +2 -2
- package/dist/api/routes/screen.js +2 -1
- package/dist/api/routes/script.js +2 -1
- package/dist/api/routes/static.js +6 -5
- package/dist/api/routes/table.js +8 -38
- package/dist/api/routes/templates.js +2 -1
- package/dist/api/routes/user.js +2 -1
- package/dist/api/routes/utils/validators.js +1 -1
- package/dist/api/routes/view.js +2 -1
- package/dist/api/routes/webhook.js +2 -1
- package/dist/app.js +9 -7
- package/dist/automations/logging/index.js +5 -25
- package/dist/automations/triggers.js +1 -0
- package/dist/db/index.js +5 -2
- package/dist/db/linkedRows/LinkController.js +2 -1
- package/dist/db/linkedRows/LinkDocument.js +2 -1
- package/dist/db/newid.js +4 -2
- package/dist/definitions/datasource.js +0 -6
- package/dist/environment.js +2 -1
- package/dist/events/AutomationEmitter.js +2 -1
- package/dist/events/BudibaseEmitter.js +2 -1
- package/dist/events/index.js +2 -1
- 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/dynamodb.js +8 -5
- 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/authorized.js +2 -1
- package/dist/middleware/builder.js +4 -2
- package/dist/middleware/currentapp.js +6 -3
- package/dist/middleware/publicApi.js +4 -2
- package/dist/middleware/selfhost.js +4 -1
- package/dist/package.json +9 -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/startup.js +17 -17
- package/dist/threads/automation.js +18 -7
- package/dist/threads/index.js +4 -4
- package/dist/threads/query.js +27 -13
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/filesystem.js +38 -36
- 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/scriptRunner.js +2 -1
- package/dist/utilities/statusCodes.js +2 -1
- package/dist/utilities/workerRequests.js +2 -0
- package/dist/watch.js +2 -25
- package/jest.config.ts +5 -2
- package/package.json +10 -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 +49 -41
- 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 +18 -19
- 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 +6 -7
- 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/view/tests/viewBuilder.spec.js +1 -1
- package/src/api/controllers/view/viewBuilder.ts +1 -1
- package/src/api/controllers/webhook.ts +48 -46
- package/src/api/routes/analytics.ts +1 -1
- package/src/api/routes/apikeys.ts +1 -1
- package/src/api/routes/application.ts +1 -1
- package/src/api/routes/auth.ts +1 -1
- package/src/api/routes/automation.ts +1 -1
- package/src/api/routes/backup.ts +1 -1
- package/src/api/routes/cloud.ts +1 -1
- package/src/api/routes/component.ts +1 -1
- package/src/api/routes/datasource.ts +1 -1
- package/src/api/routes/deploy.ts +1 -1
- package/src/api/routes/dev.ts +1 -1
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/integration.ts +1 -1
- package/src/api/routes/layout.ts +1 -1
- package/src/api/routes/metadata.ts +1 -1
- package/src/api/routes/migrations.ts +1 -1
- package/src/api/routes/permission.ts +1 -1
- package/src/api/routes/query.ts +1 -1
- package/src/api/routes/role.ts +1 -1
- package/src/api/routes/routing.ts +1 -1
- package/src/api/routes/row.ts +1 -1
- package/src/api/routes/screen.ts +1 -1
- package/src/api/routes/script.ts +1 -1
- package/src/api/routes/static.ts +2 -2
- package/src/api/routes/table.ts +16 -39
- package/src/api/routes/templates.ts +1 -1
- 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/plugin.spec.ts +10 -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/tests/utilities/TestFunctions.ts +1 -1
- package/src/api/routes/user.ts +1 -1
- package/src/api/routes/utils/validators.ts +1 -1
- package/src/api/routes/view.ts +1 -1
- package/src/api/routes/webhook.ts +1 -1
- package/src/app.ts +5 -3
- package/src/automations/logging/index.ts +1 -1
- package/src/automations/tests/loop.spec.ts +45 -0
- package/src/automations/triggers.ts +6 -1
- package/src/db/index.ts +1 -1
- package/src/db/linkedRows/LinkController.ts +1 -1
- package/src/db/linkedRows/LinkDocument.ts +1 -1
- package/src/db/newid.ts +1 -1
- package/src/db/tests/linkController.spec.js +1 -1
- package/src/definitions/automations.ts +1 -0
- package/src/definitions/datasource.ts +0 -41
- package/src/environment.ts +1 -1
- package/src/events/AutomationEmitter.ts +1 -1
- package/src/events/BudibaseEmitter.ts +1 -1
- package/src/events/index.ts +1 -1
- 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/dynamodb.ts +3 -3
- 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/rest.spec.ts +19 -15
- package/src/middleware/authorized.ts +5 -1
- package/src/middleware/builder.ts +1 -1
- package/src/middleware/currentapp.ts +4 -3
- package/src/middleware/publicApi.ts +1 -1
- package/src/middleware/selfhost.ts +1 -1
- package/src/middleware/tests/authorized.spec.js +1 -1
- package/src/middleware/tests/currentapp.spec.js +1 -1
- package/src/middleware/tests/selfhost.spec.js +1 -1
- 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/startup.ts +3 -8
- package/src/tests/jestEnv.ts +13 -0
- package/src/tests/jestSetup.ts +0 -14
- package/src/tests/utilities/TestConfiguration.ts +16 -13
- 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/index.ts +1 -1
- package/src/threads/query.ts +28 -15
- package/src/utilities/fileSystem/filesystem.ts +7 -5
- 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/scriptRunner.ts +1 -1
- package/src/utilities/statusCodes.ts +1 -1
- package/src/utilities/workerRequests.ts +10 -1
- package/src/watch.ts +1 -1
- package/tsconfig.json +2 -1
- package/builder/assets/index.d930bfc5.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
package/src/integrations/rest.ts
CHANGED
|
@@ -6,21 +6,19 @@ import {
|
|
|
6
6
|
IntegrationBase,
|
|
7
7
|
PaginationValues,
|
|
8
8
|
RestQueryFields as RestQuery,
|
|
9
|
-
} from "@budibase/types"
|
|
10
|
-
import {
|
|
11
9
|
RestConfig,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "
|
|
10
|
+
RestAuthType,
|
|
11
|
+
RestBasicAuthConfig,
|
|
12
|
+
RestBearerAuthConfig,
|
|
13
|
+
} from "@budibase/types"
|
|
16
14
|
import { get } from "lodash"
|
|
17
15
|
import * as https from "https"
|
|
18
16
|
import qs from "querystring"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
import fetch from "node-fetch"
|
|
18
|
+
import { formatBytes } from "../utilities"
|
|
19
|
+
import { performance } from "perf_hooks"
|
|
20
|
+
import FormData from "form-data"
|
|
21
|
+
import { URLSearchParams } from "url"
|
|
24
22
|
|
|
25
23
|
const BodyTypes = {
|
|
26
24
|
NONE: "none",
|
|
@@ -204,12 +202,12 @@ class RestIntegration implements IntegrationBase {
|
|
|
204
202
|
|
|
205
203
|
// Append page number or cursor param if configured
|
|
206
204
|
if (pageParam && paginationValues.page != null) {
|
|
207
|
-
params.append(pageParam, paginationValues.page)
|
|
205
|
+
params.append(pageParam, paginationValues.page as string)
|
|
208
206
|
}
|
|
209
207
|
|
|
210
208
|
// Append page size param if configured
|
|
211
209
|
if (sizeParam && paginationValues.limit != null) {
|
|
212
|
-
params.append(sizeParam, paginationValues.limit)
|
|
210
|
+
params.append(sizeParam, String(paginationValues.limit))
|
|
213
211
|
}
|
|
214
212
|
|
|
215
213
|
// Prepend query string with pagination params
|
|
@@ -280,7 +278,7 @@ class RestIntegration implements IntegrationBase {
|
|
|
280
278
|
case BodyTypes.ENCODED:
|
|
281
279
|
const params = new URLSearchParams()
|
|
282
280
|
for (let [key, value] of Object.entries(object)) {
|
|
283
|
-
params.append(key, value)
|
|
281
|
+
params.append(key, value as string)
|
|
284
282
|
}
|
|
285
283
|
addPaginationToBody((key: string, value: any) => {
|
|
286
284
|
params.append(key, value)
|
|
@@ -331,14 +329,14 @@ class RestIntegration implements IntegrationBase {
|
|
|
331
329
|
if (authConfig) {
|
|
332
330
|
let config
|
|
333
331
|
switch (authConfig.type) {
|
|
334
|
-
case
|
|
335
|
-
config = authConfig.config as
|
|
332
|
+
case RestAuthType.BASIC:
|
|
333
|
+
config = authConfig.config as RestBasicAuthConfig
|
|
336
334
|
headers.Authorization = `Basic ${Buffer.from(
|
|
337
335
|
`${config.username}:${config.password}`
|
|
338
336
|
).toString("base64")}`
|
|
339
337
|
break
|
|
340
|
-
case
|
|
341
|
-
config = authConfig.config as
|
|
338
|
+
case RestAuthType.BEARER:
|
|
339
|
+
config = authConfig.config as RestBearerAuthConfig
|
|
342
340
|
headers.Authorization = `Bearer ${config.token}`
|
|
343
341
|
break
|
|
344
342
|
}
|
|
@@ -428,5 +426,4 @@ class RestIntegration implements IntegrationBase {
|
|
|
428
426
|
export default {
|
|
429
427
|
schema: SCHEMA,
|
|
430
428
|
integration: RestIntegration,
|
|
431
|
-
AuthType,
|
|
432
429
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
jest.mock("node-fetch", () => {
|
|
2
|
+
return jest.fn(() => ({
|
|
3
|
+
headers: {
|
|
4
|
+
raw: () => {
|
|
5
|
+
return { "content-type": ["application/json"] }
|
|
6
|
+
},
|
|
7
|
+
get: () => ["application/json"],
|
|
5
8
|
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
jest.mock("node-fetch", () => mockFetch)
|
|
9
|
+
json: jest.fn(() => ({
|
|
10
|
+
my_next_cursor: 123,
|
|
11
|
+
})),
|
|
12
|
+
text: jest.fn(),
|
|
13
|
+
}))
|
|
14
|
+
})
|
|
15
|
+
|
|
14
16
|
import fetch from "node-fetch"
|
|
15
17
|
import { default as RestIntegration } from "../rest"
|
|
18
|
+
import { RestAuthType } from "@budibase/types"
|
|
16
19
|
const FormData = require("form-data")
|
|
17
20
|
const { URLSearchParams } = require("url")
|
|
18
21
|
|
|
@@ -227,7 +230,7 @@ describe("REST Integration", () => {
|
|
|
227
230
|
const basicAuth = {
|
|
228
231
|
_id: "c59c14bd1898a43baa08da68959b24686",
|
|
229
232
|
name: "basic-1",
|
|
230
|
-
type:
|
|
233
|
+
type: RestAuthType.BASIC,
|
|
231
234
|
config: {
|
|
232
235
|
username: "user",
|
|
233
236
|
password: "password",
|
|
@@ -237,7 +240,7 @@ describe("REST Integration", () => {
|
|
|
237
240
|
const bearerAuth = {
|
|
238
241
|
_id: "0d91d732f34e4befabeff50b392a8ff3",
|
|
239
242
|
name: "bearer-1",
|
|
240
|
-
type:
|
|
243
|
+
type: RestAuthType.BEARER,
|
|
241
244
|
config: {
|
|
242
245
|
token: "mytoken",
|
|
243
246
|
},
|
|
@@ -579,7 +582,8 @@ describe("REST Integration", () => {
|
|
|
579
582
|
})
|
|
580
583
|
await config.integration.read({})
|
|
581
584
|
|
|
582
|
-
|
|
585
|
+
// @ts-ignore
|
|
586
|
+
const calls: any = fetch.mock.calls[0]
|
|
583
587
|
const url = calls[0]
|
|
584
588
|
expect(url).toBe(`${BASE_URL}/`)
|
|
585
589
|
|
|
@@ -63,7 +63,11 @@ const checkAuthorizedResource = async (
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export
|
|
66
|
+
export default (
|
|
67
|
+
permType: any,
|
|
68
|
+
permLevel: any = null,
|
|
69
|
+
opts = { schema: false }
|
|
70
|
+
) =>
|
|
67
71
|
async (ctx: any, next: any) => {
|
|
68
72
|
// webhooks don't need authentication, each webhook unique
|
|
69
73
|
// also internal requests (between services) don't need authorized
|
|
@@ -64,7 +64,7 @@ async function updateAppUpdatedAt(ctx: BBContext) {
|
|
|
64
64
|
})
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
export
|
|
67
|
+
export default async function builder(ctx: BBContext, permType: string) {
|
|
68
68
|
const appId = ctx.appId
|
|
69
69
|
// this only functions within an app context
|
|
70
70
|
if (!appId) {
|
|
@@ -12,7 +12,7 @@ import env from "../environment"
|
|
|
12
12
|
import { isWebhookEndpoint } from "./utils"
|
|
13
13
|
import { BBContext } from "@budibase/types"
|
|
14
14
|
|
|
15
|
-
export
|
|
15
|
+
export default async (ctx: BBContext, next: any) => {
|
|
16
16
|
// try to get the appID from the request
|
|
17
17
|
let requestAppId = await utils.getAppIdFromCtx(ctx)
|
|
18
18
|
// get app cookie if it exists
|
|
@@ -25,6 +25,7 @@ export = async (ctx: BBContext, next: any) => {
|
|
|
25
25
|
if (!appCookie && !requestAppId) {
|
|
26
26
|
return next()
|
|
27
27
|
}
|
|
28
|
+
|
|
28
29
|
// check the app exists referenced in cookie
|
|
29
30
|
if (appCookie) {
|
|
30
31
|
const appId = appCookie.appId
|
|
@@ -51,7 +52,7 @@ export = async (ctx: BBContext, next: any) => {
|
|
|
51
52
|
|
|
52
53
|
let appId: string | undefined,
|
|
53
54
|
roleId = roles.BUILTIN_ROLE_IDS.PUBLIC
|
|
54
|
-
if (!ctx.user) {
|
|
55
|
+
if (!ctx.user?._id) {
|
|
55
56
|
// not logged in, try to set a cookie for public apps
|
|
56
57
|
appId = requestAppId
|
|
57
58
|
} else if (requestAppId != null) {
|
|
@@ -96,7 +97,7 @@ export = async (ctx: BBContext, next: any) => {
|
|
|
96
97
|
// need to judge this only based on the request app ID,
|
|
97
98
|
if (
|
|
98
99
|
env.MULTI_TENANCY &&
|
|
99
|
-
ctx.user &&
|
|
100
|
+
ctx.user?._id &&
|
|
100
101
|
requestAppId &&
|
|
101
102
|
!tenancy.isUserInAppTenant(requestAppId, ctx.user)
|
|
102
103
|
) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { constants, utils } from "@budibase/backend-core"
|
|
2
2
|
import { BBContext } from "@budibase/types"
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export default function ({ requiresAppId }: { requiresAppId?: boolean } = {}) {
|
|
5
5
|
return async (ctx: BBContext, next: any) => {
|
|
6
6
|
const appId = await utils.getAppIdFromCtx(ctx)
|
|
7
7
|
if (requiresAppId && !appId) {
|
|
@@ -3,7 +3,7 @@ import { BBContext } from "@budibase/types"
|
|
|
3
3
|
|
|
4
4
|
// if added as a middleware will stop requests unless builder is in self host mode
|
|
5
5
|
// or cloud is in self host
|
|
6
|
-
export
|
|
6
|
+
export default async (ctx: BBContext, next: any) => {
|
|
7
7
|
if (env.SELF_HOSTED) {
|
|
8
8
|
await next()
|
|
9
9
|
return
|
|
@@ -7,7 +7,7 @@ jest.mock("../../environment", () => ({
|
|
|
7
7
|
}
|
|
8
8
|
})
|
|
9
9
|
)
|
|
10
|
-
const authorizedMiddleware = require("../authorized")
|
|
10
|
+
const authorizedMiddleware = require("../authorized").default
|
|
11
11
|
const env = require("../../environment")
|
|
12
12
|
const { permissions } = require("@budibase/backend-core")
|
|
13
13
|
|
|
@@ -124,7 +124,7 @@ class TestConfiguration {
|
|
|
124
124
|
// import as late as possible for mocks
|
|
125
125
|
jest.resetModules()
|
|
126
126
|
require("../../db").init()
|
|
127
|
-
const currentAppMiddleware = require("../currentapp")
|
|
127
|
+
const currentAppMiddleware = require("../currentapp").default
|
|
128
128
|
return currentAppMiddleware(this.ctx, this.next)
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -2,7 +2,7 @@ import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
|
|
2
2
|
import * as syncRows from "../syncRows"
|
|
3
3
|
import { quotas } from "@budibase/pro"
|
|
4
4
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
|
5
|
-
|
|
5
|
+
import { db as dbCore, context } from "@budibase/backend-core"
|
|
6
6
|
|
|
7
7
|
describe("syncRows", () => {
|
|
8
8
|
let config = new TestConfig(false)
|
|
@@ -24,13 +24,17 @@ describe("syncRows", () => {
|
|
|
24
24
|
|
|
25
25
|
// app 1
|
|
26
26
|
const app1 = config.app
|
|
27
|
-
await
|
|
28
|
-
|
|
27
|
+
await context.doInAppContext(app1.appId, async () => {
|
|
28
|
+
await config.createTable()
|
|
29
|
+
await config.createRow()
|
|
30
|
+
})
|
|
29
31
|
// app 2
|
|
30
32
|
const app2 = await config.createApp("second-app")
|
|
31
|
-
await
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
await context.doInAppContext(app2.appId, async () => {
|
|
34
|
+
await config.createTable()
|
|
35
|
+
await config.createRow()
|
|
36
|
+
await config.createRow()
|
|
37
|
+
})
|
|
34
38
|
|
|
35
39
|
// migrate
|
|
36
40
|
await syncRows.run()
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { context } from "@budibase/backend-core"
|
|
2
|
+
import { findHBSBlocks, processObjectSync } from "@budibase/string-templates"
|
|
3
|
+
import {
|
|
4
|
+
Datasource,
|
|
5
|
+
DatasourceFieldType,
|
|
6
|
+
PASSWORD_REPLACEMENT,
|
|
7
|
+
RestAuthConfig,
|
|
8
|
+
RestAuthType,
|
|
9
|
+
RestBasicAuthConfig,
|
|
10
|
+
SourceName,
|
|
11
|
+
} from "@budibase/types"
|
|
12
|
+
import { cloneDeep } from "lodash/fp"
|
|
13
|
+
import { getEnvironmentVariables } from "../../utils"
|
|
14
|
+
import { getDefinitions } from "../../../integrations"
|
|
15
|
+
|
|
16
|
+
const ENV_VAR_PREFIX = "env."
|
|
17
|
+
|
|
18
|
+
async function enrichDatasourceWithValues(datasource: Datasource) {
|
|
19
|
+
const cloned = cloneDeep(datasource)
|
|
20
|
+
const env = await getEnvironmentVariables()
|
|
21
|
+
const processed = processObjectSync(cloned, { env }, { onlyFound: true })
|
|
22
|
+
return {
|
|
23
|
+
datasource: processed as Datasource,
|
|
24
|
+
envVars: env as Record<string, string>,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function enrich(datasource: Datasource) {
|
|
29
|
+
const { datasource: response } = await enrichDatasourceWithValues(datasource)
|
|
30
|
+
return response
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function get(
|
|
34
|
+
datasourceId: string,
|
|
35
|
+
opts?: { enriched: boolean }
|
|
36
|
+
): Promise<Datasource> {
|
|
37
|
+
const appDb = context.getAppDB()
|
|
38
|
+
const datasource = await appDb.get(datasourceId)
|
|
39
|
+
if (opts?.enriched) {
|
|
40
|
+
return (await enrichDatasourceWithValues(datasource)).datasource
|
|
41
|
+
} else {
|
|
42
|
+
return datasource
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export async function getWithEnvVars(datasourceId: string) {
|
|
47
|
+
const appDb = context.getAppDB()
|
|
48
|
+
const datasource = await appDb.get(datasourceId)
|
|
49
|
+
return enrichDatasourceWithValues(datasource)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function hasAuthConfigs(datasource: Datasource) {
|
|
53
|
+
return datasource.source === SourceName.REST && datasource.config?.authConfigs
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function useEnvVars(str: any) {
|
|
57
|
+
if (typeof str !== "string") {
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
const blocks = findHBSBlocks(str)
|
|
61
|
+
return blocks.find(block => block.includes(ENV_VAR_PREFIX)) != null
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export async function removeSecrets(datasources: Datasource[]) {
|
|
65
|
+
const definitions = await getDefinitions()
|
|
66
|
+
for (let datasource of datasources) {
|
|
67
|
+
const schema = definitions[datasource.source]
|
|
68
|
+
if (datasource.config) {
|
|
69
|
+
// strip secrets from response, so they don't show in the network request
|
|
70
|
+
if (datasource.config.auth) {
|
|
71
|
+
delete datasource.config.auth
|
|
72
|
+
}
|
|
73
|
+
// specific to REST datasources, contains passwords
|
|
74
|
+
if (hasAuthConfigs(datasource)) {
|
|
75
|
+
const configs = datasource.config.authConfigs as RestAuthConfig[]
|
|
76
|
+
for (let config of configs) {
|
|
77
|
+
if (config.type !== RestAuthType.BASIC) {
|
|
78
|
+
continue
|
|
79
|
+
}
|
|
80
|
+
const basic = config.config as RestBasicAuthConfig
|
|
81
|
+
if (!useEnvVars(basic.password)) {
|
|
82
|
+
basic.password = PASSWORD_REPLACEMENT
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// remove general passwords
|
|
87
|
+
for (let key of Object.keys(datasource.config)) {
|
|
88
|
+
if (
|
|
89
|
+
schema.datasource?.[key]?.type === DatasourceFieldType.PASSWORD &&
|
|
90
|
+
!useEnvVars(datasource.config[key])
|
|
91
|
+
) {
|
|
92
|
+
datasource.config[key] = PASSWORD_REPLACEMENT
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return datasources
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export async function removeSecretSingle(datasource: Datasource) {
|
|
101
|
+
return (await removeSecrets([datasource]))[0]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function mergeConfigs(update: Datasource, old: Datasource) {
|
|
105
|
+
if (!update.config) {
|
|
106
|
+
return update
|
|
107
|
+
}
|
|
108
|
+
// specific to REST datasources, fix the auth configs again if required
|
|
109
|
+
if (hasAuthConfigs(update)) {
|
|
110
|
+
const configs = update.config.authConfigs as RestAuthConfig[]
|
|
111
|
+
const oldConfigs = old.config?.authConfigs as RestAuthConfig[]
|
|
112
|
+
for (let config of configs) {
|
|
113
|
+
if (config.type !== RestAuthType.BASIC) {
|
|
114
|
+
continue
|
|
115
|
+
}
|
|
116
|
+
const basic = config.config as RestBasicAuthConfig
|
|
117
|
+
const oldBasic = oldConfigs.find(old => old.name === config.name)
|
|
118
|
+
?.config as RestBasicAuthConfig
|
|
119
|
+
if (basic.password === PASSWORD_REPLACEMENT) {
|
|
120
|
+
basic.password = oldBasic.password
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// update back to actual passwords for everything else
|
|
125
|
+
for (let [key, value] of Object.entries(update.config)) {
|
|
126
|
+
if (value !== PASSWORD_REPLACEMENT) {
|
|
127
|
+
continue
|
|
128
|
+
}
|
|
129
|
+
if (old.config?.[key]) {
|
|
130
|
+
update.config[key] = old.config?.[key]
|
|
131
|
+
} else {
|
|
132
|
+
delete update.config[key]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return update
|
|
136
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getEnvironmentVariables } from "../../utils"
|
|
2
|
+
import { processStringSync } from "@budibase/string-templates"
|
|
3
|
+
|
|
4
|
+
export async function enrichContext(
|
|
5
|
+
fields: Record<string, any>,
|
|
6
|
+
inputs = {}
|
|
7
|
+
): Promise<Record<string, any>> {
|
|
8
|
+
const enrichedQuery: Record<string, any> = Array.isArray(fields) ? [] : {}
|
|
9
|
+
if (!fields || !inputs) {
|
|
10
|
+
return enrichedQuery
|
|
11
|
+
}
|
|
12
|
+
const env = await getEnvironmentVariables()
|
|
13
|
+
const parameters = { ...inputs, env }
|
|
14
|
+
// enrich the fields with dynamic parameters
|
|
15
|
+
for (let key of Object.keys(fields)) {
|
|
16
|
+
if (fields[key] == null) {
|
|
17
|
+
continue
|
|
18
|
+
}
|
|
19
|
+
if (typeof fields[key] === "object") {
|
|
20
|
+
// enrich nested fields object
|
|
21
|
+
enrichedQuery[key] = await enrichContext(fields[key], parameters)
|
|
22
|
+
} else if (typeof fields[key] === "string") {
|
|
23
|
+
// enrich string value as normal
|
|
24
|
+
enrichedQuery[key] = processStringSync(fields[key], parameters, {
|
|
25
|
+
noEscaping: true,
|
|
26
|
+
noHelpers: true,
|
|
27
|
+
escapeNewlines: true,
|
|
28
|
+
})
|
|
29
|
+
} else {
|
|
30
|
+
enrichedQuery[key] = fields[key]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (
|
|
34
|
+
enrichedQuery.json ||
|
|
35
|
+
enrichedQuery.customData ||
|
|
36
|
+
enrichedQuery.requestBody
|
|
37
|
+
) {
|
|
38
|
+
try {
|
|
39
|
+
enrichedQuery.json = JSON.parse(
|
|
40
|
+
enrichedQuery.json ||
|
|
41
|
+
enrichedQuery.customData ||
|
|
42
|
+
enrichedQuery.requestBody
|
|
43
|
+
)
|
|
44
|
+
} catch (err) {
|
|
45
|
+
// no json found, ignore
|
|
46
|
+
}
|
|
47
|
+
delete enrichedQuery.customData
|
|
48
|
+
}
|
|
49
|
+
return enrichedQuery
|
|
50
|
+
}
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
isSQL,
|
|
7
7
|
} from "../../../integrations/utils"
|
|
8
8
|
import { Table, Database } from "@budibase/types"
|
|
9
|
+
import datasources from "../datasources"
|
|
9
10
|
|
|
10
11
|
async function getAllInternalTables(db?: Database): Promise<Table[]> {
|
|
11
12
|
if (!db) {
|
|
@@ -23,9 +24,11 @@ async function getAllInternalTables(db?: Database): Promise<Table[]> {
|
|
|
23
24
|
}))
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
async function getAllExternalTables(
|
|
27
|
+
async function getAllExternalTables(
|
|
28
|
+
datasourceId: any
|
|
29
|
+
): Promise<Record<string, Table>> {
|
|
27
30
|
const db = context.getAppDB()
|
|
28
|
-
const datasource = await
|
|
31
|
+
const datasource = await datasources.get(datasourceId, { enriched: true })
|
|
29
32
|
if (!datasource || !datasource.entities) {
|
|
30
33
|
throw "Datasource is not configured fully."
|
|
31
34
|
}
|
|
@@ -44,7 +47,7 @@ async function getTable(tableId: any): Promise<Table> {
|
|
|
44
47
|
const db = context.getAppDB()
|
|
45
48
|
if (isExternalTable(tableId)) {
|
|
46
49
|
let { datasourceId, tableName } = breakExternalTableId(tableId)
|
|
47
|
-
const datasource = await
|
|
50
|
+
const datasource = await datasources.get(datasourceId!)
|
|
48
51
|
const table = await getExternalTable(datasourceId, tableName)
|
|
49
52
|
return { ...table, sql: isSQL(datasource) }
|
|
50
53
|
} else {
|
package/src/sdk/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { default as backups } from "./app/backups"
|
|
|
2
2
|
import { default as tables } from "./app/tables"
|
|
3
3
|
import { default as automations } from "./app/automations"
|
|
4
4
|
import { default as applications } from "./app/applications"
|
|
5
|
+
import { default as datasources } from "./app/datasources"
|
|
6
|
+
import { default as queries } from "./app/queries"
|
|
5
7
|
import { default as rows } from "./app/rows"
|
|
6
8
|
import { default as users } from "./users"
|
|
7
9
|
|
|
@@ -12,6 +14,8 @@ const sdk = {
|
|
|
12
14
|
applications,
|
|
13
15
|
rows,
|
|
14
16
|
users,
|
|
17
|
+
datasources,
|
|
18
|
+
queries,
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
// default export for TS
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { environmentVariables } from "@budibase/pro"
|
|
2
|
+
import { context, db as dbCore } from "@budibase/backend-core"
|
|
3
|
+
import { AppEnvironment } from "@budibase/types"
|
|
4
|
+
|
|
5
|
+
export async function getEnvironmentVariables() {
|
|
6
|
+
let envVars = context.getEnvironmentVariables()
|
|
7
|
+
if (!envVars) {
|
|
8
|
+
const appId = context.getAppId()
|
|
9
|
+
const appEnv = dbCore.isDevAppID(appId)
|
|
10
|
+
? AppEnvironment.DEVELOPMENT
|
|
11
|
+
: AppEnvironment.PRODUCTION
|
|
12
|
+
|
|
13
|
+
envVars = await environmentVariables.fetchValues(appEnv)
|
|
14
|
+
}
|
|
15
|
+
return envVars
|
|
16
|
+
}
|
package/src/startup.ts
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import env from "./environment"
|
|
2
2
|
import * as redis from "./utilities/redis"
|
|
3
3
|
import {
|
|
4
4
|
createAdminUser,
|
|
5
5
|
generateApiKey,
|
|
6
6
|
getChecklist,
|
|
7
7
|
} from "./utilities/workerRequests"
|
|
8
|
-
import {
|
|
9
|
-
installation,
|
|
10
|
-
pinoSettings,
|
|
11
|
-
tenancy,
|
|
12
|
-
logging,
|
|
13
|
-
} from "@budibase/backend-core"
|
|
8
|
+
import { installation, tenancy, logging } from "@budibase/backend-core"
|
|
14
9
|
import fs from "fs"
|
|
15
10
|
import { watch } from "./watch"
|
|
16
11
|
import * as automations from "./automations"
|
|
@@ -26,7 +21,7 @@ const pino = require("koa-pino-logger")
|
|
|
26
21
|
let STARTUP_RAN = false
|
|
27
22
|
|
|
28
23
|
async function initRoutes(app: any) {
|
|
29
|
-
app.use(pino(pinoSettings()))
|
|
24
|
+
app.use(pino(logging.pinoSettings()))
|
|
30
25
|
|
|
31
26
|
if (!env.isTest()) {
|
|
32
27
|
const plugin = await bullboard.init()
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import env from "../environment"
|
|
2
|
+
import { tmpdir } from "os"
|
|
3
|
+
|
|
4
|
+
env._set("SELF_HOSTED", "1")
|
|
5
|
+
env._set("NODE_ENV", "jest")
|
|
6
|
+
env._set("JWT_SECRET", "test-jwtsecret")
|
|
7
|
+
env._set("CLIENT_ID", "test-client-id")
|
|
8
|
+
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
|
9
|
+
env._set("LOG_LEVEL", "silent")
|
|
10
|
+
env._set("PORT", 0)
|
|
11
|
+
env._set("MINIO_URL", "http://localhost")
|
|
12
|
+
env._set("MINIO_ACCESS_KEY", "test")
|
|
13
|
+
env._set("MINIO_SECRET_KEY", "test")
|
package/src/tests/jestSetup.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
const { tmpdir } = require("os")
|
|
2
|
-
import env from "../environment"
|
|
3
|
-
|
|
4
|
-
env._set("SELF_HOSTED", "1")
|
|
5
|
-
env._set("NODE_ENV", "jest")
|
|
6
|
-
env._set("JWT_SECRET", "test-jwtsecret")
|
|
7
|
-
env._set("CLIENT_ID", "test-client-id")
|
|
8
|
-
env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
|
9
|
-
env._set("LOG_LEVEL", "silent")
|
|
10
|
-
env._set("PORT", 0)
|
|
11
|
-
env._set("MINIO_URL", "http://localhost")
|
|
12
|
-
env._set("MINIO_ACCESS_KEY", "test")
|
|
13
|
-
env._set("MINIO_SECRET_KEY", "test")
|
|
14
|
-
|
|
15
1
|
import { mocks } from "@budibase/backend-core/tests"
|
|
16
2
|
|
|
17
3
|
// mock all dates to 2020-01-01T00:00:00.000Z
|
|
@@ -67,7 +67,7 @@ class TestConfiguration {
|
|
|
67
67
|
if (openServer) {
|
|
68
68
|
// use a random port because it doesn't matter
|
|
69
69
|
env.PORT = "0"
|
|
70
|
-
this.server = require("../../app")
|
|
70
|
+
this.server = require("../../app").default
|
|
71
71
|
// we need the request for logging in, involves cookies, hard to fake
|
|
72
72
|
this.request = supertest(this.server)
|
|
73
73
|
this.started = true
|
|
@@ -364,20 +364,23 @@ class TestConfiguration {
|
|
|
364
364
|
// create dev app
|
|
365
365
|
// clear any old app
|
|
366
366
|
this.appId = null
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
367
|
+
await context.doInAppContext(null, async () => {
|
|
368
|
+
this.app = await this._req(
|
|
369
|
+
{ name: appName },
|
|
370
|
+
null,
|
|
371
|
+
controllers.app.create
|
|
372
|
+
)
|
|
373
|
+
this.appId = this.app.appId
|
|
374
|
+
})
|
|
375
|
+
return await context.doInAppContext(this.appId, async () => {
|
|
376
|
+
// create production app
|
|
377
|
+
this.prodApp = await this.publish()
|
|
376
378
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
+
this.allApps.push(this.prodApp)
|
|
380
|
+
this.allApps.push(this.app)
|
|
379
381
|
|
|
380
|
-
|
|
382
|
+
return this.app
|
|
383
|
+
})
|
|
381
384
|
}
|
|
382
385
|
|
|
383
386
|
async publish() {
|