@budibase/server 1.0.200-alpha.3 → 1.0.200
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/Dockerfile +0 -2
- package/builder/assets/index.f83b3433.js +1315 -0
- package/builder/index.html +1 -1
- package/coverage/clover.xml +1998 -2086
- package/coverage/coverage-final.json +122 -121
- package/coverage/lcov-report/api/controllers/analytics.js.html +202 -0
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/auth.js.html +7 -7
- package/coverage/lcov-report/api/controllers/automation.js.html +72 -174
- package/coverage/lcov-report/api/controllers/backup.js.html +6 -30
- package/coverage/lcov-report/api/controllers/cloud.js.html +11 -11
- package/coverage/lcov-report/api/controllers/component.js.html +5 -5
- package/coverage/lcov-report/api/controllers/datasource.js.html +41 -53
- package/coverage/lcov-report/api/controllers/dev.js.html +70 -94
- package/coverage/lcov-report/api/controllers/index.html +72 -57
- package/coverage/lcov-report/api/controllers/integration.js.html +8 -8
- package/coverage/lcov-report/api/controllers/layout.js.html +19 -28
- package/coverage/lcov-report/api/controllers/metadata.js.html +9 -9
- package/coverage/lcov-report/api/controllers/migrations.js.html +4 -4
- package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +10 -10
- package/coverage/lcov-report/api/controllers/role.js.html +48 -78
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +19 -19
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +54 -54
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -24
- package/coverage/lcov-report/api/controllers/row/utils.js.html +24 -24
- package/coverage/lcov-report/api/controllers/screen.js.html +20 -56
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +49 -49
- package/coverage/lcov-report/api/controllers/table/external.js.html +17 -23
- package/coverage/lcov-report/api/controllers/table/index.html +26 -26
- package/coverage/lcov-report/api/controllers/table/index.js.html +49 -85
- package/coverage/lcov-report/api/controllers/templates.js.html +6 -6
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +11 -11
- package/coverage/lcov-report/api/controllers/view/index.html +21 -21
- package/coverage/lcov-report/api/controllers/view/index.js.html +65 -275
- package/coverage/lcov-report/api/controllers/view/utils.js.html +23 -23
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +40 -40
- package/coverage/lcov-report/api/controllers/webhook.js.html +17 -17
- package/coverage/lcov-report/api/index.html +15 -15
- package/coverage/lcov-report/api/index.js.html +45 -39
- package/coverage/lcov-report/api/routes/analytics.js.html +13 -7
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/auth.js.html +6 -6
- package/coverage/lcov-report/api/routes/automation.js.html +11 -11
- package/coverage/lcov-report/api/routes/backup.js.html +8 -8
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +9 -9
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +13 -13
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +9 -9
- package/coverage/lcov-report/api/routes/migrations.js.html +7 -7
- package/coverage/lcov-report/api/routes/permission.js.html +9 -9
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +9 -9
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/screen.js.html +9 -9
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +10 -10
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +8 -8
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +36 -36
- package/coverage/lcov-report/api/routes/view.js.html +10 -10
- package/coverage/lcov-report/api/routes/webhook.js.html +9 -9
- package/coverage/lcov-report/automations/actions.js.html +25 -25
- package/coverage/lcov-report/automations/automationUtils.js.html +8 -8
- package/coverage/lcov-report/automations/bullboard.js.html +35 -35
- package/coverage/lcov-report/automations/index.html +29 -29
- package/coverage/lcov-report/automations/index.js.html +17 -29
- package/coverage/lcov-report/automations/steps/bash.js.html +7 -7
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
- package/coverage/lcov-report/automations/steps/filter.js.html +7 -7
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- package/coverage/lcov-report/automations/steps/loop.js.html +2 -2
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
- package/coverage/lcov-report/automations/steps/queryRows.js.html +10 -10
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
- package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
- package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
- package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
- package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
- package/coverage/lcov-report/automations/triggers.js.html +18 -18
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +30 -30
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/inMemoryView.js.html +5 -5
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +9 -9
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +17 -17
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +36 -36
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +19 -19
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +81 -81
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +7 -7
- package/coverage/lcov-report/events/utils.js.html +10 -10
- package/coverage/lcov-report/index.html +74 -74
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +5 -5
- package/coverage/lcov-report/middleware/builder.js.html +20 -20
- package/coverage/lcov-report/middleware/currentapp.js.html +49 -49
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +14 -14
- package/coverage/lcov-report/middleware/publicApi.js.html +5 -5
- package/coverage/lcov-report/middleware/resourceId.js.html +29 -29
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +4 -4
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +13 -13
- package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +14 -14
- package/coverage/lcov-report/utilities/csvParser.js.html +34 -34
- package/coverage/lcov-report/utilities/global.js.html +28 -28
- package/coverage/lcov-report/utilities/index.html +25 -25
- package/coverage/lcov-report/utilities/index.js.html +41 -41
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +18 -18
- package/coverage/lcov-report/utilities/queue/index.html +15 -15
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +59 -59
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +15 -15
- package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
- package/coverage/lcov-report/utilities/security.js.html +8 -8
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +30 -30
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +7 -7
- package/coverage/lcov-report/utilities/workerRequests.js.html +29 -29
- package/coverage/lcov.info +2762 -2903
- package/dist/api/controllers/analytics.js +30 -7
- package/dist/api/controllers/application.js +16 -56
- package/dist/api/controllers/automation.js +2 -31
- package/dist/api/controllers/backup.js +0 -7
- package/dist/api/controllers/datasource.js +2 -8
- package/dist/api/controllers/deploy/index.js +2 -6
- package/dist/api/controllers/dev.js +2 -9
- package/dist/api/controllers/layout.js +0 -3
- package/dist/api/controllers/query/import/index.js +2 -12
- package/dist/api/controllers/query/import/sources/curl.js +0 -3
- package/dist/api/controllers/query/import/sources/openapi2.js +0 -3
- package/dist/api/controllers/query/import/sources/openapi3.js +0 -3
- package/dist/api/controllers/query/index.js +2 -16
- package/dist/api/controllers/role.js +0 -11
- package/dist/api/controllers/screen.js +1 -10
- package/dist/api/controllers/static/index.js +15 -29
- package/dist/api/controllers/table/external.js +0 -2
- package/dist/api/controllers/table/index.js +0 -12
- package/dist/api/controllers/table/utils.js +3 -3
- package/dist/api/controllers/view/index.js +6 -62
- package/dist/api/index.js +4 -2
- package/dist/api/routes/analytics.js +3 -1
- package/dist/app.js +8 -16
- package/dist/automations/index.js +0 -4
- package/dist/automations/steps/executeQuery.js +1 -1
- package/dist/environment.js +2 -4
- package/dist/integrations/firebase.js +0 -1
- package/dist/migrations/index.js +31 -95
- package/dist/package.json +69 -79
- package/dist/tests/utilities/TestConfiguration.js +93 -121
- package/dist/tests/utilities/structures.js +0 -45
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/nodemon.json +1 -1
- package/package.json +70 -80
- package/scripts/dev/manage.js +0 -2
- package/scripts/jestSetup.js +0 -7
- package/scripts/likeCypress.ts +1 -1
- package/src/api/controllers/analytics.js +39 -0
- package/src/api/controllers/application.ts +18 -60
- package/src/api/controllers/automation.js +2 -36
- package/src/api/controllers/backup.js +0 -8
- package/src/api/controllers/datasource.js +4 -8
- package/src/api/controllers/deploy/index.ts +2 -6
- package/src/api/controllers/dev.js +2 -10
- package/src/api/controllers/layout.js +0 -3
- package/src/api/controllers/query/import/index.ts +3 -16
- package/src/api/controllers/query/import/sources/base/index.ts +1 -2
- package/src/api/controllers/query/import/sources/curl.ts +0 -4
- package/src/api/controllers/query/import/sources/openapi2.ts +0 -4
- package/src/api/controllers/query/import/sources/openapi3.ts +0 -4
- package/src/api/controllers/query/import/tests/index.spec.js +7 -20
- package/src/api/controllers/query/index.ts +3 -16
- package/src/api/controllers/role.js +0 -10
- package/src/api/controllers/screen.js +1 -13
- package/src/api/controllers/static/index.js +15 -28
- package/src/api/controllers/table/external.js +0 -2
- package/src/api/controllers/table/index.js +0 -12
- package/src/api/controllers/table/utils.ts +4 -4
- package/src/api/controllers/view/index.js +6 -76
- package/src/api/index.js +4 -2
- package/src/api/routes/analytics.js +3 -1
- package/src/api/routes/public/utils/Endpoint.ts +1 -1
- package/src/api/routes/tests/__snapshots__/datasource.spec.js.snap +1 -5
- package/src/api/routes/tests/application.spec.js +4 -64
- package/src/api/routes/tests/automation.spec.js +60 -168
- package/src/api/routes/tests/backup.spec.js +0 -2
- package/src/api/routes/tests/datasource.spec.js +0 -5
- package/src/api/routes/tests/layout.spec.js +0 -4
- package/src/api/routes/tests/query.spec.js +13 -56
- package/src/api/routes/tests/role.spec.js +7 -40
- package/src/api/routes/tests/row.spec.js +3 -2
- package/src/api/routes/tests/screen.spec.js +4 -30
- package/src/api/routes/tests/static.spec.js +54 -120
- package/src/api/routes/tests/table.spec.js +38 -102
- package/src/api/routes/tests/view.spec.js +43 -222
- package/src/app.ts +9 -18
- package/src/automations/index.js +0 -4
- package/src/automations/steps/executeQuery.js +1 -1
- package/src/automations/tests/delay.spec.js +0 -4
- package/src/environment.js +2 -5
- package/src/integrations/firebase.ts +0 -1
- package/src/migrations/index.ts +51 -120
- package/src/module.d.ts +1 -0
- package/src/tests/utilities/TestConfiguration.js +90 -138
- package/src/tests/utilities/structures.js +0 -71
- package/tsconfig.build.json +5 -20
- package/tsconfig.json +17 -22
- package/builder/assets/index.05491b9d.js +0 -1315
- package/dist/migrations/functions/backfill/app/automations.js +0 -31
- package/dist/migrations/functions/backfill/app/datasources.js +0 -28
- package/dist/migrations/functions/backfill/app/layouts.js +0 -33
- package/dist/migrations/functions/backfill/app/queries.js +0 -32
- package/dist/migrations/functions/backfill/app/roles.js +0 -28
- package/dist/migrations/functions/backfill/app/screens.js +0 -28
- package/dist/migrations/functions/backfill/app/tables.js +0 -40
- package/dist/migrations/functions/backfill/app.js +0 -175
- package/dist/migrations/functions/backfill/global/configs.js +0 -61
- package/dist/migrations/functions/backfill/global/quotas.js +0 -60
- package/dist/migrations/functions/backfill/global/users.js +0 -50
- package/dist/migrations/functions/backfill/global.js +0 -189
- package/dist/migrations/functions/backfill/index.js +0 -32
- package/dist/migrations/functions/backfill/installation.js +0 -80
- package/dist/migrations/tests/helpers.js +0 -72
- package/dist/migrations/tests/structures.js +0 -37
- package/src/api/controllers/analytics.ts +0 -8
- package/src/api/routes/tests/data/export.txt +0 -1
- package/src/api/routes/tests/deployment.spec.js +0 -25
- package/src/api/routes/tests/dev.spec.js +0 -40
- package/src/migrations/functions/backfill/app/automations.ts +0 -26
- package/src/migrations/functions/backfill/app/datasources.ts +0 -22
- package/src/migrations/functions/backfill/app/layouts.ts +0 -29
- package/src/migrations/functions/backfill/app/queries.ts +0 -33
- package/src/migrations/functions/backfill/app/roles.ts +0 -22
- package/src/migrations/functions/backfill/app/screens.ts +0 -22
- package/src/migrations/functions/backfill/app/tables.ts +0 -36
- package/src/migrations/functions/backfill/app.ts +0 -148
- package/src/migrations/functions/backfill/global/configs.ts +0 -66
- package/src/migrations/functions/backfill/global/quotas.ts +0 -60
- package/src/migrations/functions/backfill/global/users.ts +0 -49
- package/src/migrations/functions/backfill/global.ts +0 -194
- package/src/migrations/functions/backfill/index.ts +0 -7
- package/src/migrations/functions/backfill/installation.ts +0 -50
- package/src/migrations/tests/helpers.ts +0 -40
- package/src/migrations/tests/index.spec.ts +0 -132
- package/src/migrations/tests/structures.ts +0 -66
package/nodemon.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"watch": ["src", "../backend-core", "../../../budibase-pro/packages/pro"],
|
|
3
3
|
"ext": "js,ts,json",
|
|
4
|
-
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"
|
|
4
|
+
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"],
|
|
5
5
|
"exec": "ts-node src/index.ts"
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.200
|
|
4
|
+
"version": "1.0.200",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
"url": "https://github.com/Budibase/budibase.git"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"
|
|
13
|
-
"build": "tsc -p tsconfig.build.json && mv dist/src/* dist/ && rimraf dist/src/",
|
|
14
|
-
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
|
12
|
+
"build": "rimraf dist/ && tsc -p tsconfig.build.json && mv dist/src/* dist/ && rimraf dist/src/ && yarn postbuild",
|
|
15
13
|
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",
|
|
16
14
|
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
|
|
17
15
|
"test": "jest --coverage --maxWorkers=2",
|
|
@@ -39,11 +37,6 @@
|
|
|
39
37
|
"jest": {
|
|
40
38
|
"preset": "ts-jest",
|
|
41
39
|
"testEnvironment": "node",
|
|
42
|
-
"moduleNameMapper": {
|
|
43
|
-
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
|
44
|
-
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
|
45
|
-
"@budibase/types": "<rootDir>/../types/src"
|
|
46
|
-
},
|
|
47
40
|
"setupFiles": [
|
|
48
41
|
"./scripts/jestSetup.js"
|
|
49
42
|
],
|
|
@@ -76,123 +69,120 @@
|
|
|
76
69
|
"author": "Budibase",
|
|
77
70
|
"license": "GPL-3.0",
|
|
78
71
|
"dependencies": {
|
|
79
|
-
"@apidevtools/swagger-parser": "10.0.3",
|
|
80
|
-
"@budibase/backend-core": "^1.0.200
|
|
81
|
-
"@budibase/client": "^1.0.200
|
|
82
|
-
"@budibase/pro": "1.0.
|
|
83
|
-
"@budibase/string-templates": "^1.0.200
|
|
84
|
-
"@bull-board/api": "3.7.0",
|
|
85
|
-
"@bull-board/koa": "3.
|
|
72
|
+
"@apidevtools/swagger-parser": "^10.0.3",
|
|
73
|
+
"@budibase/backend-core": "^1.0.200",
|
|
74
|
+
"@budibase/client": "^1.0.200",
|
|
75
|
+
"@budibase/pro": "1.0.199",
|
|
76
|
+
"@budibase/string-templates": "^1.0.200",
|
|
77
|
+
"@bull-board/api": "^3.7.0",
|
|
78
|
+
"@bull-board/koa": "^3.7.0",
|
|
86
79
|
"@elastic/elasticsearch": "7.10.0",
|
|
87
|
-
"@google-cloud/firestore": "5.0.2",
|
|
80
|
+
"@google-cloud/firestore": "^5.0.2",
|
|
88
81
|
"@koa/router": "8.0.0",
|
|
89
82
|
"@sendgrid/mail": "7.1.1",
|
|
90
83
|
"@sentry/node": "6.17.7",
|
|
84
|
+
"@types/global-agent": "^2.1.1",
|
|
85
|
+
"@types/koa__router": "^8.0.11",
|
|
91
86
|
"airtable": "0.10.1",
|
|
92
87
|
"arangojs": "7.2.0",
|
|
93
|
-
"aws-sdk": "2.
|
|
88
|
+
"aws-sdk": "^2.767.0",
|
|
94
89
|
"bcryptjs": "2.4.3",
|
|
95
|
-
"bull": "3.
|
|
90
|
+
"bull": "^3.22.4",
|
|
96
91
|
"chmodr": "1.2.0",
|
|
97
92
|
"csvtojson": "2.0.10",
|
|
98
|
-
"curlconverter": "3.21.0",
|
|
93
|
+
"curlconverter": "^3.21.0",
|
|
99
94
|
"dotenv": "8.2.0",
|
|
100
95
|
"download": "8.0.0",
|
|
101
96
|
"fix-path": "3.0.0",
|
|
102
|
-
"form-data": "4.0.0",
|
|
97
|
+
"form-data": "^4.0.0",
|
|
103
98
|
"fs-extra": "8.1.0",
|
|
104
|
-
"global-agent": "3.0.0",
|
|
105
|
-
"google-auth-library": "7.
|
|
106
|
-
"google-spreadsheet": "3.2.0",
|
|
99
|
+
"global-agent": "^3.0.0",
|
|
100
|
+
"google-auth-library": "^7.11.0",
|
|
101
|
+
"google-spreadsheet": "^3.2.0",
|
|
107
102
|
"jimp": "0.16.1",
|
|
108
103
|
"joi": "17.2.1",
|
|
109
|
-
"js-yaml": "4.1.0",
|
|
104
|
+
"js-yaml": "^4.1.0",
|
|
110
105
|
"jsonschema": "1.4.0",
|
|
111
|
-
"knex": "0.95.
|
|
106
|
+
"knex": "^0.95.6",
|
|
112
107
|
"koa": "2.7.0",
|
|
113
108
|
"koa-body": "4.2.0",
|
|
114
109
|
"koa-compress": "4.0.1",
|
|
115
|
-
"koa-connect": "2.1.0",
|
|
110
|
+
"koa-connect": "^2.1.0",
|
|
116
111
|
"koa-pino-logger": "3.0.0",
|
|
117
112
|
"koa-send": "5.0.0",
|
|
118
113
|
"koa-session": "5.12.0",
|
|
119
114
|
"koa-static": "5.0.0",
|
|
120
|
-
"koa2-ratelimit": "1.1.0",
|
|
115
|
+
"koa2-ratelimit": "^1.1.0",
|
|
121
116
|
"lodash": "4.17.21",
|
|
122
|
-
"memorystream": "0.3.1",
|
|
117
|
+
"memorystream": "^0.3.1",
|
|
123
118
|
"mongodb": "3.6.3",
|
|
124
119
|
"mssql": "6.2.3",
|
|
125
|
-
"mysql2": "2.3.
|
|
120
|
+
"mysql2": "^2.3.1",
|
|
126
121
|
"node-fetch": "2.6.7",
|
|
127
|
-
"open": "8.4.0",
|
|
122
|
+
"open": "^8.4.0",
|
|
128
123
|
"pg": "8.5.1",
|
|
129
124
|
"pino-pretty": "4.0.0",
|
|
130
|
-
"posthog-node": "1.
|
|
125
|
+
"posthog-node": "^1.1.4",
|
|
131
126
|
"pouchdb": "7.3.0",
|
|
132
|
-
"pouchdb-adapter-memory": "7.2.
|
|
127
|
+
"pouchdb-adapter-memory": "^7.2.1",
|
|
133
128
|
"pouchdb-all-dbs": "1.0.2",
|
|
134
|
-
"pouchdb-find": "7.2.2",
|
|
129
|
+
"pouchdb-find": "^7.2.2",
|
|
135
130
|
"pouchdb-replication-stream": "1.2.9",
|
|
136
131
|
"redis": "4",
|
|
137
132
|
"server-destroy": "1.0.1",
|
|
138
|
-
"svelte": "3.
|
|
139
|
-
"swagger-parser": "10.0.3",
|
|
133
|
+
"svelte": "^3.38.2",
|
|
134
|
+
"swagger-parser": "^10.0.3",
|
|
140
135
|
"to-json-schema": "0.2.5",
|
|
141
136
|
"uuid": "3.3.2",
|
|
142
137
|
"validate.js": "0.13.1",
|
|
143
|
-
"vm2": "3.9.
|
|
144
|
-
"worker-farm": "1.7.0",
|
|
145
|
-
"xml2js": "0.4.23",
|
|
138
|
+
"vm2": "^3.9.3",
|
|
139
|
+
"worker-farm": "^1.7.0",
|
|
140
|
+
"xml2js": "^0.4.23",
|
|
146
141
|
"yargs": "13.2.4",
|
|
147
142
|
"zlib": "1.0.5"
|
|
148
143
|
},
|
|
149
144
|
"devDependencies": {
|
|
150
|
-
"@babel/core": "7.
|
|
151
|
-
"@babel/preset-env": "7.
|
|
145
|
+
"@babel/core": "^7.14.3",
|
|
146
|
+
"@babel/preset-env": "^7.14.4",
|
|
152
147
|
"@budibase/standard-components": "^0.9.139",
|
|
153
|
-
"@
|
|
154
|
-
"@
|
|
155
|
-
"@types/
|
|
156
|
-
"@types/
|
|
157
|
-
"@types/
|
|
158
|
-
"@types/
|
|
159
|
-
"@types/
|
|
160
|
-
"@types/
|
|
161
|
-
"@types/koa": "2.13.4",
|
|
162
|
-
"@types/koa__router": "8.0.0",
|
|
148
|
+
"@jest/test-sequencer": "^24.8.0",
|
|
149
|
+
"@types/apidoc": "^0.50.0",
|
|
150
|
+
"@types/bson": "^4.2.0",
|
|
151
|
+
"@types/bull": "^3.15.1",
|
|
152
|
+
"@types/google-spreadsheet": "^3.1.5",
|
|
153
|
+
"@types/jest": "^27.4.1",
|
|
154
|
+
"@types/koa": "^2.13.3",
|
|
155
|
+
"@types/koa-router": "^7.4.2",
|
|
163
156
|
"@types/lodash": "4.14.180",
|
|
164
157
|
"@types/mongodb": "3.6.3",
|
|
165
|
-
"@types/node": "
|
|
166
|
-
"@types/
|
|
167
|
-
"@types/
|
|
168
|
-
"@types/redis": "4.0.11",
|
|
158
|
+
"@types/node": "^15.12.4",
|
|
159
|
+
"@types/oracledb": "^5.2.1",
|
|
160
|
+
"@types/redis": "^4.0.11",
|
|
169
161
|
"@typescript-eslint/parser": "5.12.0",
|
|
170
|
-
"apidoc": "0.50.
|
|
171
|
-
"babel-jest": "27.
|
|
172
|
-
"copyfiles": "2.4.1",
|
|
173
|
-
"docker-compose": "0.23.
|
|
174
|
-
"eslint": "6.8.0",
|
|
175
|
-
"ioredis-mock": "7.2.0",
|
|
176
|
-
"is-wsl": "2.2.0",
|
|
177
|
-
"jest": "27.5
|
|
178
|
-
"jest-openapi": "0.14.2",
|
|
179
|
-
"nodemon": "2.0.
|
|
180
|
-
"openapi-types": "9.3.1",
|
|
181
|
-
"openapi-typescript": "5.2.0",
|
|
182
|
-
"path-to-regexp": "6.2.0",
|
|
183
|
-
"prettier": "2.
|
|
184
|
-
"rimraf": "3.0.2",
|
|
185
|
-
"supertest": "4.0.2",
|
|
186
|
-
"swagger-jsdoc": "6.1.0",
|
|
187
|
-
"
|
|
188
|
-
"ts-
|
|
189
|
-
"
|
|
190
|
-
"
|
|
191
|
-
"typescript": "4.6.2",
|
|
192
|
-
"update-dotenv": "1.1.1"
|
|
162
|
+
"apidoc": "^0.50.2",
|
|
163
|
+
"babel-jest": "^27.0.2",
|
|
164
|
+
"copyfiles": "^2.4.1",
|
|
165
|
+
"docker-compose": "^0.23.6",
|
|
166
|
+
"eslint": "^6.8.0",
|
|
167
|
+
"ioredis-mock": "^7.2.0",
|
|
168
|
+
"is-wsl": "^2.2.0",
|
|
169
|
+
"jest": "^27.0.5",
|
|
170
|
+
"jest-openapi": "^0.14.2",
|
|
171
|
+
"nodemon": "^2.0.4",
|
|
172
|
+
"openapi-types": "^9.3.1",
|
|
173
|
+
"openapi-typescript": "^5.2.0",
|
|
174
|
+
"path-to-regexp": "^6.2.0",
|
|
175
|
+
"prettier": "^2.3.1",
|
|
176
|
+
"rimraf": "^3.0.2",
|
|
177
|
+
"supertest": "^4.0.2",
|
|
178
|
+
"swagger-jsdoc": "^6.1.0",
|
|
179
|
+
"ts-jest": "^27.0.3",
|
|
180
|
+
"ts-node": "^10.0.0",
|
|
181
|
+
"typescript": "^4.5.5",
|
|
182
|
+
"update-dotenv": "^1.1.1"
|
|
193
183
|
},
|
|
194
184
|
"optionalDependencies": {
|
|
195
|
-
"oracledb": "5.3.0"
|
|
185
|
+
"oracledb": "^5.3.0"
|
|
196
186
|
},
|
|
197
|
-
"gitHead": "
|
|
187
|
+
"gitHead": "94c375fdeac1d1252d6bd4f867d7cfce346dd60b"
|
|
198
188
|
}
|
package/scripts/dev/manage.js
CHANGED
package/scripts/jestSetup.js
CHANGED
|
@@ -9,11 +9,4 @@ env._set("BUDIBASE_DIR", tmpdir("budibase-unittests"))
|
|
|
9
9
|
env._set("LOG_LEVEL", "silent")
|
|
10
10
|
env._set("PORT", 0)
|
|
11
11
|
|
|
12
|
-
const { mocks } = require("@budibase/backend-core/tests")
|
|
13
|
-
|
|
14
|
-
// mock all dates to 2020-01-01T00:00:00.000Z
|
|
15
|
-
// use tk.reset() to use real dates in individual tests
|
|
16
|
-
const tk = require("timekeeper")
|
|
17
|
-
tk.freeze(mocks.date.MOCK_DATE)
|
|
18
|
-
|
|
19
12
|
global.console.log = jest.fn() // console.log are ignored in tests
|
package/scripts/likeCypress.ts
CHANGED
|
@@ -10,7 +10,7 @@ const WORKER_PORT = "4200"
|
|
|
10
10
|
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
process.env.NODE_ENV = "cypress"
|
|
13
|
-
process.env.ENABLE_ANALYTICS = "
|
|
13
|
+
process.env.ENABLE_ANALYTICS = "false"
|
|
14
14
|
process.env.JWT_SECRET = "budibase"
|
|
15
15
|
process.env.COUCH_URL = `leveldb://${tmpdir}/.data/`
|
|
16
16
|
process.env.SELF_HOSTED = "1"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const env = require("../../environment")
|
|
2
|
+
const PostHog = require("posthog-node")
|
|
3
|
+
|
|
4
|
+
let posthogClient
|
|
5
|
+
|
|
6
|
+
if (env.POSTHOG_TOKEN && env.ENABLE_ANALYTICS && !env.SELF_HOSTED) {
|
|
7
|
+
posthogClient = new PostHog(env.POSTHOG_TOKEN)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
exports.isEnabled = async ctx => {
|
|
11
|
+
ctx.body = {
|
|
12
|
+
enabled: !env.SELF_HOSTED && env.ENABLE_ANALYTICS === "true",
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.endUserPing = async ctx => {
|
|
17
|
+
if (!posthogClient) {
|
|
18
|
+
ctx.body = {
|
|
19
|
+
ping: false,
|
|
20
|
+
}
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
posthogClient.identify({
|
|
25
|
+
distinctId: ctx.user && ctx.user._id,
|
|
26
|
+
properties: {},
|
|
27
|
+
})
|
|
28
|
+
posthogClient.capture({
|
|
29
|
+
event: "budibase:end_user_ping",
|
|
30
|
+
distinctId: ctx.user && ctx.user._id,
|
|
31
|
+
properties: {
|
|
32
|
+
appId: ctx.appId,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
ctx.body = {
|
|
37
|
+
ping: true,
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -52,8 +52,7 @@ const {
|
|
|
52
52
|
} = require("@budibase/backend-core/context")
|
|
53
53
|
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
|
54
54
|
import { quotas } from "@budibase/pro"
|
|
55
|
-
import { errors
|
|
56
|
-
import { App, MigrationType } from "@budibase/types"
|
|
55
|
+
import { errors } from "@budibase/backend-core"
|
|
57
56
|
|
|
58
57
|
const URL_REGEX_SLASH = /\/|\\/g
|
|
59
58
|
|
|
@@ -235,7 +234,7 @@ const performAppCreate = async (ctx: any) => {
|
|
|
235
234
|
const apps = await getAllApps({ dev: true })
|
|
236
235
|
const name = ctx.request.body.name
|
|
237
236
|
checkAppName(ctx, apps, name)
|
|
238
|
-
const url = getAppUrl(ctx)
|
|
237
|
+
const url = exports.getAppUrl(ctx)
|
|
239
238
|
checkAppUrl(ctx, apps, url)
|
|
240
239
|
|
|
241
240
|
const { useTemplate, templateKey, templateString } = ctx.request.body
|
|
@@ -259,7 +258,7 @@ const performAppCreate = async (ctx: any) => {
|
|
|
259
258
|
} catch (err) {
|
|
260
259
|
// nothing to do
|
|
261
260
|
}
|
|
262
|
-
const newApplication
|
|
261
|
+
const newApplication = {
|
|
263
262
|
_id: DocumentTypes.APP_METADATA,
|
|
264
263
|
_rev,
|
|
265
264
|
appId: instance._id,
|
|
@@ -293,42 +292,10 @@ const performAppCreate = async (ctx: any) => {
|
|
|
293
292
|
return newApplication
|
|
294
293
|
}
|
|
295
294
|
|
|
296
|
-
const
|
|
297
|
-
let creationFns: ((app: App) => Promise<void>)[] = []
|
|
298
|
-
|
|
299
|
-
const body = request.body
|
|
300
|
-
if (body.useTemplate === "true") {
|
|
301
|
-
// from template
|
|
302
|
-
if (body.templateKey && body.templateKey !== "undefined") {
|
|
303
|
-
creationFns.push(a => events.app.templateImported(a, body.templateKey))
|
|
304
|
-
}
|
|
305
|
-
// from file
|
|
306
|
-
else if (request.files?.templateFile) {
|
|
307
|
-
creationFns.push(a => events.app.fileImported(a))
|
|
308
|
-
}
|
|
309
|
-
// unknown
|
|
310
|
-
else {
|
|
311
|
-
console.error("Could not determine template creation event")
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
creationFns.push(a => events.app.created(a))
|
|
315
|
-
|
|
316
|
-
for (let fn of creationFns) {
|
|
317
|
-
await fn(app)
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
const appPostCreate = async (ctx: any, app: App) => {
|
|
322
|
-
const tenantId = getTenantId()
|
|
323
|
-
await migrations.backPopulateMigrations({
|
|
324
|
-
type: MigrationType.APP,
|
|
325
|
-
tenantId,
|
|
326
|
-
appId: app.appId,
|
|
327
|
-
})
|
|
328
|
-
await creationEvents(ctx.request, app)
|
|
295
|
+
const appPostCreate = async (ctx: any, appId: string) => {
|
|
329
296
|
// app import & template creation
|
|
330
297
|
if (ctx.request.body.useTemplate === "true") {
|
|
331
|
-
const rows = await getUniqueRows([
|
|
298
|
+
const rows = await getUniqueRows([appId])
|
|
332
299
|
const rowCount = rows ? rows.length : 0
|
|
333
300
|
if (rowCount) {
|
|
334
301
|
try {
|
|
@@ -338,7 +305,7 @@ const appPostCreate = async (ctx: any, app: App) => {
|
|
|
338
305
|
// this import resulted in row usage exceeding the quota
|
|
339
306
|
// delete the app
|
|
340
307
|
// skip pre and post steps as no rows have been added to quotas yet
|
|
341
|
-
ctx.params.appId =
|
|
308
|
+
ctx.params.appId = appId
|
|
342
309
|
await destroyApp(ctx)
|
|
343
310
|
}
|
|
344
311
|
throw err
|
|
@@ -349,7 +316,7 @@ const appPostCreate = async (ctx: any, app: App) => {
|
|
|
349
316
|
|
|
350
317
|
export const create = async (ctx: any) => {
|
|
351
318
|
const newApplication = await quotas.addApp(() => performAppCreate(ctx))
|
|
352
|
-
await appPostCreate(ctx, newApplication)
|
|
319
|
+
await appPostCreate(ctx, newApplication.appId)
|
|
353
320
|
await bustCache(CacheKeys.CHECKLIST)
|
|
354
321
|
ctx.body = newApplication
|
|
355
322
|
ctx.status = 200
|
|
@@ -364,16 +331,15 @@ export const update = async (ctx: any) => {
|
|
|
364
331
|
if (name) {
|
|
365
332
|
checkAppName(ctx, apps, name, ctx.params.appId)
|
|
366
333
|
}
|
|
367
|
-
const url = getAppUrl(ctx)
|
|
334
|
+
const url = await exports.getAppUrl(ctx)
|
|
368
335
|
if (url) {
|
|
369
336
|
checkAppUrl(ctx, apps, url, ctx.params.appId)
|
|
370
337
|
ctx.request.body.url = url
|
|
371
338
|
}
|
|
372
339
|
|
|
373
|
-
const
|
|
374
|
-
await events.app.updated(app)
|
|
340
|
+
const data = await updateAppPackage(ctx.request.body, ctx.params.appId)
|
|
375
341
|
ctx.status = 200
|
|
376
|
-
ctx.body =
|
|
342
|
+
ctx.body = data
|
|
377
343
|
}
|
|
378
344
|
|
|
379
345
|
export const updateClient = async (ctx: any) => {
|
|
@@ -389,15 +355,13 @@ export const updateClient = async (ctx: any) => {
|
|
|
389
355
|
}
|
|
390
356
|
|
|
391
357
|
// Update versions in app package
|
|
392
|
-
const updatedToVersion = packageJson.version
|
|
393
358
|
const appPackageUpdates = {
|
|
394
|
-
version:
|
|
359
|
+
version: packageJson.version,
|
|
395
360
|
revertableVersion: currentVersion,
|
|
396
361
|
}
|
|
397
|
-
const
|
|
398
|
-
await events.app.versionUpdated(app, currentVersion, updatedToVersion)
|
|
362
|
+
const data = await updateAppPackage(appPackageUpdates, ctx.params.appId)
|
|
399
363
|
ctx.status = 200
|
|
400
|
-
ctx.body =
|
|
364
|
+
ctx.body = data
|
|
401
365
|
}
|
|
402
366
|
|
|
403
367
|
export const revertClient = async (ctx: any) => {
|
|
@@ -414,16 +378,13 @@ export const revertClient = async (ctx: any) => {
|
|
|
414
378
|
}
|
|
415
379
|
|
|
416
380
|
// Update versions in app package
|
|
417
|
-
const currentVersion = application.version
|
|
418
|
-
const revertedToVersion = application.revertableVersion
|
|
419
381
|
const appPackageUpdates = {
|
|
420
|
-
version:
|
|
382
|
+
version: application.revertableVersion,
|
|
421
383
|
revertableVersion: null,
|
|
422
384
|
}
|
|
423
|
-
const
|
|
424
|
-
await events.app.versionReverted(app, currentVersion, revertedToVersion)
|
|
385
|
+
const data = await updateAppPackage(appPackageUpdates, ctx.params.appId)
|
|
425
386
|
ctx.status = 200
|
|
426
|
-
ctx.body =
|
|
387
|
+
ctx.body = data
|
|
427
388
|
}
|
|
428
389
|
|
|
429
390
|
const destroyApp = async (ctx: any) => {
|
|
@@ -435,15 +396,12 @@ const destroyApp = async (ctx: any) => {
|
|
|
435
396
|
}
|
|
436
397
|
|
|
437
398
|
const db = isUnpublish ? getProdAppDB() : getAppDB()
|
|
438
|
-
const app = await db.get(DocumentTypes.APP_METADATA)
|
|
439
399
|
const result = await db.destroy()
|
|
440
400
|
|
|
441
401
|
if (isUnpublish) {
|
|
442
402
|
await quotas.removePublishedApp()
|
|
443
|
-
await events.app.unpublished(app)
|
|
444
403
|
} else {
|
|
445
404
|
await quotas.removeApp()
|
|
446
|
-
await events.app.deleted(app)
|
|
447
405
|
}
|
|
448
406
|
|
|
449
407
|
/* istanbul ignore next */
|
|
@@ -556,10 +514,10 @@ const updateAppPackage = async (appPackage: any, appId: any) => {
|
|
|
556
514
|
// Redis, shouldn't ever store it
|
|
557
515
|
delete newAppPackage.lockedBy
|
|
558
516
|
|
|
559
|
-
await db.put(newAppPackage)
|
|
517
|
+
const response = await db.put(newAppPackage)
|
|
560
518
|
// remove any cached metadata, so that it will be updated
|
|
561
519
|
await appCache.invalidateAppMetadata(appId)
|
|
562
|
-
return
|
|
520
|
+
return response
|
|
563
521
|
}
|
|
564
522
|
|
|
565
523
|
const createEmptyAppPackage = async (ctx: any, app: any) => {
|
|
@@ -10,7 +10,6 @@ const { deleteEntityMetadata } = require("../../utilities")
|
|
|
10
10
|
const { MetadataTypes } = require("../../constants")
|
|
11
11
|
const { setTestFlag, clearTestFlag } = require("../../utilities/redis")
|
|
12
12
|
const { getAppDB } = require("@budibase/backend-core/context")
|
|
13
|
-
const { events } = require("@budibase/backend-core")
|
|
14
13
|
|
|
15
14
|
const ACTION_DEFS = removeDeprecated(actions.ACTION_DEFINITIONS)
|
|
16
15
|
const TRIGGER_DEFS = removeDeprecated(triggers.TRIGGER_DEFINITIONS)
|
|
@@ -71,10 +70,6 @@ exports.create = async function (ctx) {
|
|
|
71
70
|
newAuto: automation,
|
|
72
71
|
})
|
|
73
72
|
const response = await db.put(automation)
|
|
74
|
-
await events.automation.created(automation)
|
|
75
|
-
for (let step of automation.definition.steps) {
|
|
76
|
-
await events.automation.stepCreated(automation, step)
|
|
77
|
-
}
|
|
78
73
|
automation._rev = response.rev
|
|
79
74
|
|
|
80
75
|
ctx.status = 200
|
|
@@ -87,30 +82,6 @@ exports.create = async function (ctx) {
|
|
|
87
82
|
}
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
const getNewSteps = (oldAutomation, automation) => {
|
|
91
|
-
const oldStepIds = oldAutomation.definition.steps.map(s => s.id)
|
|
92
|
-
return automation.definition.steps.filter(s => !oldStepIds.includes(s.id))
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const getDeletedSteps = (oldAutomation, automation) => {
|
|
96
|
-
const stepIds = automation.definition.steps.map(s => s.id)
|
|
97
|
-
return oldAutomation.definition.steps.filter(s => !stepIds.includes(s.id))
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const handleStepEvents = async (oldAutomation, automation) => {
|
|
101
|
-
// new steps
|
|
102
|
-
const newSteps = getNewSteps(oldAutomation, automation)
|
|
103
|
-
for (let step of newSteps) {
|
|
104
|
-
await events.automation.stepCreated(automation, step)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// old steps
|
|
108
|
-
const deletedSteps = getDeletedSteps(oldAutomation, automation)
|
|
109
|
-
for (let step of deletedSteps) {
|
|
110
|
-
await events.automation.stepDeleted(automation, step)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
85
|
exports.update = async function (ctx) {
|
|
115
86
|
const db = getAppDB()
|
|
116
87
|
let automation = ctx.request.body
|
|
@@ -127,14 +98,13 @@ exports.update = async function (ctx) {
|
|
|
127
98
|
const oldAutoTrigger =
|
|
128
99
|
oldAutomation && oldAutomation.definition.trigger
|
|
129
100
|
? oldAutomation.definition.trigger
|
|
130
|
-
:
|
|
101
|
+
: {}
|
|
131
102
|
const newAutoTrigger =
|
|
132
103
|
automation && automation.definition.trigger
|
|
133
104
|
? automation.definition.trigger
|
|
134
105
|
: {}
|
|
135
106
|
// trigger has been updated, remove the test inputs
|
|
136
|
-
if (oldAutoTrigger
|
|
137
|
-
await events.automation.triggerUpdated(automation)
|
|
107
|
+
if (oldAutoTrigger.id !== newAutoTrigger.id) {
|
|
138
108
|
await deleteEntityMetadata(
|
|
139
109
|
ctx.appId,
|
|
140
110
|
MetadataTypes.AUTOMATION_TEST_INPUT,
|
|
@@ -142,8 +112,6 @@ exports.update = async function (ctx) {
|
|
|
142
112
|
)
|
|
143
113
|
}
|
|
144
114
|
|
|
145
|
-
await handleStepEvents(oldAutomation, automation)
|
|
146
|
-
|
|
147
115
|
ctx.status = 200
|
|
148
116
|
ctx.body = {
|
|
149
117
|
message: `Automation ${automation._id} updated successfully.`,
|
|
@@ -180,7 +148,6 @@ exports.destroy = async function (ctx) {
|
|
|
180
148
|
// delete metadata first
|
|
181
149
|
await cleanupAutomationMetadata(automationId)
|
|
182
150
|
ctx.body = await db.remove(automationId, ctx.params.rev)
|
|
183
|
-
await events.automation.deleted(oldAutomation)
|
|
184
151
|
}
|
|
185
152
|
|
|
186
153
|
exports.getActionList = async function (ctx) {
|
|
@@ -248,5 +215,4 @@ exports.test = async function (ctx) {
|
|
|
248
215
|
})
|
|
249
216
|
await clearTestFlag(automation._id)
|
|
250
217
|
ctx.body = response
|
|
251
|
-
await events.automation.tested(automation)
|
|
252
218
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const { streamBackup } = require("../../utilities/fileSystem")
|
|
2
|
-
const { events, context } = require("@budibase/backend-core")
|
|
3
|
-
const { DocumentTypes } = require("../../db/utils")
|
|
4
2
|
|
|
5
3
|
exports.exportAppDump = async function (ctx) {
|
|
6
4
|
const { appId } = ctx.query
|
|
@@ -8,10 +6,4 @@ exports.exportAppDump = async function (ctx) {
|
|
|
8
6
|
const backupIdentifier = `${appName}-export-${new Date().getTime()}.txt`
|
|
9
7
|
ctx.attachment(backupIdentifier)
|
|
10
8
|
ctx.body = await streamBackup(appId)
|
|
11
|
-
|
|
12
|
-
await context.doInAppContext(appId, async () => {
|
|
13
|
-
const appDb = context.getAppDB()
|
|
14
|
-
const app = await appDb.get(DocumentTypes.APP_METADATA)
|
|
15
|
-
await events.app.exported(app)
|
|
16
|
-
})
|
|
17
9
|
}
|
|
@@ -11,7 +11,6 @@ const { integrations } = require("../../integrations")
|
|
|
11
11
|
const { getDatasourceAndQuery } = require("./row/utils")
|
|
12
12
|
const { invalidateDynamicVariables } = require("../../threads/utils")
|
|
13
13
|
const { getAppDB } = require("@budibase/backend-core/context")
|
|
14
|
-
const { events } = require("@budibase/backend-core")
|
|
15
14
|
|
|
16
15
|
exports.fetch = async function (ctx) {
|
|
17
16
|
// Get internal tables
|
|
@@ -109,7 +108,6 @@ exports.update = async function (ctx) {
|
|
|
109
108
|
}
|
|
110
109
|
|
|
111
110
|
const response = await db.put(datasource)
|
|
112
|
-
await events.datasource.updated(datasource)
|
|
113
111
|
datasource._rev = response.rev
|
|
114
112
|
|
|
115
113
|
// Drain connection pools when configuration is changed
|
|
@@ -144,7 +142,6 @@ exports.save = async function (ctx) {
|
|
|
144
142
|
}
|
|
145
143
|
|
|
146
144
|
const dbResp = await db.put(datasource)
|
|
147
|
-
await events.datasource.created(datasource)
|
|
148
145
|
datasource._rev = dbResp.rev
|
|
149
146
|
|
|
150
147
|
// Drain connection pools when configuration is changed
|
|
@@ -164,11 +161,11 @@ exports.save = async function (ctx) {
|
|
|
164
161
|
|
|
165
162
|
exports.destroy = async function (ctx) {
|
|
166
163
|
const db = getAppDB()
|
|
167
|
-
const datasourceId = ctx.params.datasourceId
|
|
168
164
|
|
|
169
|
-
const datasource = await db.get(datasourceId)
|
|
170
165
|
// Delete all queries for the datasource
|
|
171
|
-
const queries = await db.allDocs(
|
|
166
|
+
const queries = await db.allDocs(
|
|
167
|
+
getQueryParams(ctx.params.datasourceId, null)
|
|
168
|
+
)
|
|
172
169
|
await db.bulkDocs(
|
|
173
170
|
queries.rows.map(row => ({
|
|
174
171
|
_id: row.id,
|
|
@@ -178,8 +175,7 @@ exports.destroy = async function (ctx) {
|
|
|
178
175
|
)
|
|
179
176
|
|
|
180
177
|
// delete the datasource
|
|
181
|
-
await db.remove(datasourceId, ctx.params.revId)
|
|
182
|
-
await events.datasource.deleted(datasource)
|
|
178
|
+
await db.remove(ctx.params.datasourceId, ctx.params.revId)
|
|
183
179
|
|
|
184
180
|
ctx.message = `Datasource deleted.`
|
|
185
181
|
ctx.status = 200
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
getProdAppDB,
|
|
14
14
|
} from "@budibase/backend-core/context"
|
|
15
15
|
import { quotas } from "@budibase/pro"
|
|
16
|
-
import { events } from "@budibase/backend-core"
|
|
17
16
|
|
|
18
17
|
// the max time we can wait for an invalidation to complete before considering it failed
|
|
19
18
|
const MAX_PENDING_TIME_MS = 30 * 60000
|
|
@@ -123,7 +122,6 @@ async function deployApp(deployment: any) {
|
|
|
123
122
|
console.log("Deployed app initialised, setting deployment to successful")
|
|
124
123
|
deployment.setStatus(DeploymentStatus.SUCCESS)
|
|
125
124
|
await storeDeploymentHistory(deployment)
|
|
126
|
-
return appDoc
|
|
127
125
|
} catch (err: any) {
|
|
128
126
|
deployment.setStatus(DeploymentStatus.FAILURE, err.message)
|
|
129
127
|
await storeDeploymentHistory(deployment)
|
|
@@ -188,14 +186,12 @@ const _deployApp = async function (ctx: any) {
|
|
|
188
186
|
|
|
189
187
|
console.log("Deploying app...")
|
|
190
188
|
|
|
191
|
-
let app
|
|
192
189
|
if (await isFirstDeploy()) {
|
|
193
|
-
|
|
190
|
+
await quotas.addPublishedApp(() => deployApp(deployment))
|
|
194
191
|
} else {
|
|
195
|
-
|
|
192
|
+
await deployApp(deployment)
|
|
196
193
|
}
|
|
197
194
|
|
|
198
|
-
await events.app.published(app)
|
|
199
195
|
ctx.body = deployment
|
|
200
196
|
}
|
|
201
197
|
|