@budibase/server 1.0.123 → 1.0.125
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/builder/assets/index.3d890df7.js +1299 -0
- package/builder/assets/index.89795487.css +6 -0
- package/builder/assets/{vendor.8e34a169.js → vendor.5240f480.js} +1 -1
- package/builder/index.html +3 -3
- package/coverage/clover.xml +695 -1678
- package/coverage/coverage-final.json +28 -43
- package/coverage/lcov-report/api/controllers/analytics.js.html +8 -3
- package/coverage/lcov-report/api/controllers/apikeys.js.html +9 -4
- package/coverage/lcov-report/api/controllers/auth.js.html +8 -3
- package/coverage/lcov-report/api/controllers/automation.js.html +8 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +8 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +8 -3
- package/coverage/lcov-report/api/controllers/component.js.html +8 -3
- package/coverage/lcov-report/api/controllers/datasource.js.html +11 -6
- package/coverage/lcov-report/api/controllers/dev.js.html +8 -3
- package/coverage/lcov-report/api/controllers/index.html +16 -26
- package/coverage/lcov-report/api/controllers/integration.js.html +8 -3
- package/coverage/lcov-report/api/controllers/layout.js.html +8 -3
- package/coverage/lcov-report/api/controllers/metadata.js.html +8 -3
- package/coverage/lcov-report/api/controllers/migrations.js.html +8 -3
- package/coverage/lcov-report/api/controllers/permission.js.html +8 -3
- package/coverage/lcov-report/api/controllers/query/index.html +16 -26
- package/coverage/lcov-report/api/controllers/query/validation.js.html +8 -3
- package/coverage/lcov-report/api/controllers/role.js.html +10 -5
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -4
- package/coverage/lcov-report/api/controllers/row/external.js.html +8 -3
- package/coverage/lcov-report/api/controllers/row/index.html +25 -35
- package/coverage/lcov-report/api/controllers/row/internal.js.html +32 -24
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +21 -16
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -19
- package/coverage/lcov-report/api/controllers/row/utils.js.html +33 -19
- package/coverage/lcov-report/api/controllers/screen.js.html +9 -4
- package/coverage/lcov-report/api/controllers/script.js.html +8 -3
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +55 -50
- package/coverage/lcov-report/api/controllers/table/external.js.html +8 -3
- package/coverage/lcov-report/api/controllers/table/index.html +19 -44
- package/coverage/lcov-report/api/controllers/table/index.js.html +20 -15
- package/coverage/lcov-report/api/controllers/templates.js.html +8 -3
- package/coverage/lcov-report/api/controllers/user.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/index.html +8 -3
- package/coverage/lcov-report/api/controllers/view/index.js.html +10 -5
- package/coverage/lcov-report/api/controllers/view/utils.js.html +8 -3
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +8 -3
- package/coverage/lcov-report/api/controllers/webhook.js.html +10 -5
- package/coverage/lcov-report/api/index.html +18 -13
- package/coverage/lcov-report/api/index.js.html +28 -8
- package/coverage/lcov-report/api/routes/analytics.js.html +8 -3
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -3
- package/coverage/lcov-report/api/routes/auth.js.html +8 -3
- package/coverage/lcov-report/api/routes/automation.js.html +8 -3
- package/coverage/lcov-report/api/routes/backup.js.html +8 -3
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -3
- package/coverage/lcov-report/api/routes/component.js.html +8 -3
- package/coverage/lcov-report/api/routes/datasource.js.html +8 -3
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -3
- package/coverage/lcov-report/api/routes/dev.js.html +9 -4
- package/coverage/lcov-report/api/routes/index.html +13 -68
- package/coverage/lcov-report/api/routes/integration.js.html +8 -3
- package/coverage/lcov-report/api/routes/layout.js.html +8 -3
- package/coverage/lcov-report/api/routes/metadata.js.html +8 -3
- package/coverage/lcov-report/api/routes/migrations.js.html +8 -3
- package/coverage/lcov-report/api/routes/permission.js.html +8 -3
- package/coverage/lcov-report/api/routes/query.js.html +8 -3
- package/coverage/lcov-report/api/routes/role.js.html +8 -3
- package/coverage/lcov-report/api/routes/routing.js.html +8 -3
- package/coverage/lcov-report/api/routes/screen.js.html +8 -3
- package/coverage/lcov-report/api/routes/script.js.html +8 -3
- package/coverage/lcov-report/api/routes/table.js.html +8 -3
- package/coverage/lcov-report/api/routes/templates.js.html +8 -3
- package/coverage/lcov-report/api/routes/user.js.html +8 -3
- package/coverage/lcov-report/api/routes/utils/index.html +8 -3
- package/coverage/lcov-report/api/routes/utils/validators.js.html +8 -3
- package/coverage/lcov-report/api/routes/view.js.html +8 -3
- package/coverage/lcov-report/api/routes/webhook.js.html +8 -3
- package/coverage/lcov-report/automations/actions.js.html +21 -7
- package/coverage/lcov-report/automations/automationUtils.js.html +64 -23
- package/coverage/lcov-report/automations/bullboard.js.html +8 -3
- package/coverage/lcov-report/automations/index.html +27 -37
- package/coverage/lcov-report/automations/index.js.html +8 -3
- package/coverage/lcov-report/automations/steps/bash.js.html +8 -3
- package/coverage/lcov-report/automations/steps/delay.js.html +8 -3
- package/coverage/lcov-report/automations/steps/discord.js.html +8 -3
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +8 -3
- package/coverage/lcov-report/automations/steps/executeScript.js.html +8 -3
- package/coverage/lcov-report/automations/steps/filter.js.html +8 -3
- package/coverage/lcov-report/automations/steps/index.html +31 -41
- package/coverage/lcov-report/automations/steps/integromat.js.html +8 -3
- package/coverage/lcov-report/{api/routes/static.js.html → automations/steps/loop.js.html} +70 -80
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +9 -4
- package/coverage/lcov-report/automations/steps/queryRows.js.html +9 -4
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +8 -3
- package/coverage/lcov-report/automations/steps/serverLog.js.html +8 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +8 -3
- package/coverage/lcov-report/automations/steps/updateRow.js.html +8 -3
- package/coverage/lcov-report/automations/steps/utils.js.html +14 -9
- package/coverage/lcov-report/automations/steps/zapier.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/index.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +8 -3
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +8 -3
- package/coverage/lcov-report/automations/triggers.js.html +16 -11
- package/coverage/lcov-report/block-navigation.js +8 -0
- package/coverage/lcov-report/constants/index.html +12 -7
- package/coverage/lcov-report/constants/index.js.html +55 -32
- package/coverage/lcov-report/constants/layouts.js.html +8 -3
- package/coverage/lcov-report/constants/screens.js.html +8 -3
- package/coverage/lcov-report/db/inMemoryView.js.html +8 -3
- package/coverage/lcov-report/db/index.html +8 -3
- package/coverage/lcov-report/db/index.js.html +9 -4
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +20 -15
- package/coverage/lcov-report/db/linkedRows/index.html +8 -3
- package/coverage/lcov-report/db/linkedRows/index.js.html +22 -17
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +12 -7
- package/coverage/lcov-report/db/newid.js.html +11 -6
- package/coverage/lcov-report/db/utils.js.html +84 -79
- package/coverage/lcov-report/events/AutomationEmitter.js.html +14 -9
- package/coverage/lcov-report/events/index.html +8 -3
- package/coverage/lcov-report/events/index.js.html +9 -4
- package/coverage/lcov-report/events/utils.js.html +18 -13
- package/coverage/lcov-report/index.html +125 -120
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +8 -3
- package/coverage/lcov-report/integrations/tests/index.html +8 -3
- package/coverage/lcov-report/middleware/appInfo.js.html +8 -3
- package/coverage/lcov-report/middleware/builder.js.html +8 -3
- package/coverage/lcov-report/middleware/currentapp.js.html +65 -15
- package/coverage/lcov-report/middleware/index.html +25 -50
- package/coverage/lcov-report/middleware/joi-validator.js.html +9 -4
- package/coverage/lcov-report/middleware/publicApi.js.html +8 -3
- package/coverage/lcov-report/middleware/resourceId.js.html +8 -3
- package/coverage/lcov-report/middleware/selfhost.js.html +9 -4
- package/coverage/lcov-report/middleware/utils.js.html +8 -3
- package/coverage/lcov-report/sorter.js +26 -0
- package/coverage/lcov-report/threads/automation.js.html +581 -90
- package/coverage/lcov-report/threads/index.html +30 -40
- package/coverage/lcov-report/threads/query.js.html +9 -4
- package/coverage/lcov-report/threads/utils.js.html +17 -9
- package/coverage/lcov-report/utilities/bcrypt.js.html +8 -3
- package/coverage/lcov-report/utilities/budibaseDir.js.html +8 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +8 -3
- package/coverage/lcov-report/utilities/csvParser.js.html +10 -5
- package/coverage/lcov-report/utilities/global.js.html +9 -4
- package/coverage/lcov-report/utilities/index.html +8 -3
- package/coverage/lcov-report/utilities/index.js.html +11 -6
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +32 -9
- package/coverage/lcov-report/utilities/queue/index.html +12 -7
- package/coverage/lcov-report/utilities/routing/index.html +8 -3
- package/coverage/lcov-report/utilities/routing/index.js.html +8 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.html +8 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +48 -43
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +18 -13
- package/coverage/lcov-report/utilities/scriptRunner.js.html +8 -3
- package/coverage/lcov-report/utilities/security.js.html +9 -4
- package/coverage/lcov-report/utilities/statusCodes.js.html +8 -3
- package/coverage/lcov-report/utilities/usageQuota/index.html +24 -34
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +44 -39
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +8 -3
- package/coverage/lcov-report/utilities/users.js.html +8 -3
- package/coverage/lcov-report/utilities/workerRequests.js.html +9 -4
- package/coverage/lcov.info +1144 -2875
- package/dist/api/controllers/application.js +145 -73
- package/dist/api/controllers/deploy/index.js +68 -36
- package/dist/api/controllers/public/applications.js +29 -9
- package/dist/api/controllers/public/queries.js +27 -7
- package/dist/api/controllers/public/rows.js +32 -12
- package/dist/api/controllers/public/tables.js +2 -2
- package/dist/api/controllers/public/users.js +8 -8
- package/dist/api/controllers/public/utils.js +1 -1
- package/dist/api/controllers/query/import/index.js +3 -3
- package/dist/api/controllers/query/index.js +57 -44
- package/dist/api/controllers/row/ExternalRequest.js +27 -27
- package/dist/api/controllers/row/index.js +83 -60
- package/dist/api/controllers/row/internal.js +2 -1
- package/dist/api/controllers/row/utils.js +2 -1
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +3 -0
- package/dist/api/controllers/table/bulkFormula.js +2 -1
- package/dist/api/controllers/table/internal.js +41 -35
- package/dist/api/controllers/table/utils.js +271 -229
- package/dist/api/index.js +5 -0
- package/dist/api/routes/application.js +39 -13
- package/dist/api/routes/index.js +61 -56
- package/dist/api/routes/public/index.js +6 -9
- package/dist/api/routes/public/queries.js +1 -1
- package/dist/api/routes/public/rows.js +1 -1
- package/dist/api/routes/public/tables.js +3 -3
- package/dist/api/routes/public/users.js +1 -1
- package/dist/api/routes/row.js +43 -17
- package/dist/api/routes/static.js +40 -13
- package/dist/api/routes/tests/utilities/TestFunctions.js +75 -33
- package/dist/app.js +8 -4
- package/dist/automations/actions.js +3 -0
- package/dist/automations/automationUtils.js +10 -0
- package/dist/automations/steps/createRow.js +12 -12
- package/dist/automations/steps/deleteRow.js +13 -16
- package/dist/automations/steps/loop.js +51 -0
- package/dist/automations/tests/utilities/index.js +13 -11
- package/dist/automations/utils.js +187 -133
- package/dist/constants/index.js +5 -0
- package/dist/definitions/datasource.js +1 -0
- package/dist/environment.js +2 -3
- package/dist/index.js +4 -0
- package/dist/integrations/base/sql.js +2 -2
- package/dist/integrations/base/sqlTable.js +2 -2
- package/dist/integrations/googlesheets.js +1 -1
- package/dist/integrations/index.js +4 -0
- package/dist/integrations/microsoftSqlServer.js +8 -8
- package/dist/integrations/mysql.js +9 -9
- package/dist/integrations/oracle.js +7 -7
- package/dist/integrations/postgres.js +7 -7
- package/dist/integrations/queries/sql.js +2 -2
- package/dist/integrations/redis.js +158 -0
- package/dist/integrations/rest.js +1 -1
- package/dist/middleware/authorized.js +51 -51
- package/dist/middleware/currentapp.js +15 -1
- package/dist/migrations/functions/appUrls.js +1 -1
- package/dist/migrations/functions/developerQuota.js +49 -0
- package/dist/migrations/functions/publishedAppsQuota.js +47 -0
- package/dist/migrations/functions/quotas1.js +6 -2
- package/dist/migrations/functions/usageQuotas/index.js +0 -4
- package/dist/migrations/functions/usageQuotas/syncApps.js +4 -7
- package/dist/migrations/functions/usageQuotas/syncDevelopers.js +24 -0
- package/dist/migrations/functions/usageQuotas/syncPublishedApps.js +26 -0
- package/dist/migrations/functions/usageQuotas/syncRows.js +5 -8
- package/dist/migrations/index.js +17 -1
- package/dist/package.json +14 -8
- package/dist/threads/automation.js +149 -27
- package/dist/threads/index.js +36 -10
- package/dist/threads/utils.js +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utilities/queue/inMemoryQueue.js +6 -1
- package/nodemon.json +1 -1
- package/package.json +15 -9
- package/scripts/dev/manage.js +2 -0
- package/src/api/controllers/{application.js → application.ts} +118 -51
- package/src/api/controllers/deploy/{index.js → index.ts} +53 -29
- package/src/api/controllers/public/applications.ts +2 -2
- package/src/api/controllers/public/queries.ts +1 -1
- package/src/api/controllers/public/rows.ts +1 -1
- package/src/api/controllers/query/{index.js → index.ts} +51 -48
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/{index.js → index.ts} +24 -17
- package/src/api/controllers/row/internal.js +2 -1
- package/src/api/controllers/row/utils.js +4 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +3 -0
- package/src/api/controllers/table/bulkFormula.js +1 -1
- package/src/api/controllers/table/{internal.js → internal.ts} +30 -26
- package/src/api/controllers/table/{utils.js → utils.ts} +86 -69
- package/src/api/index.js +5 -0
- package/src/api/routes/{application.js → application.ts} +8 -14
- package/src/api/routes/index.ts +60 -0
- package/src/api/routes/public/index.ts +1 -4
- package/src/api/routes/{row.js → row.ts} +7 -15
- package/src/api/routes/{static.js → static.ts} +11 -11
- package/src/api/routes/tests/misc.spec.js +39 -37
- package/src/api/routes/tests/utilities/{TestFunctions.js → TestFunctions.ts} +57 -33
- package/src/app.ts +1 -2
- package/src/automations/actions.js +3 -0
- package/src/automations/automationUtils.js +12 -0
- package/src/automations/steps/{createRow.js → createRow.ts} +9 -15
- package/src/automations/steps/{deleteRow.js → deleteRow.ts} +10 -16
- package/src/automations/steps/loop.js +50 -0
- package/src/automations/tests/automation.spec.js +0 -1
- package/src/automations/tests/{createRow.spec.js → createRow.spec.ts} +4 -15
- package/src/automations/tests/{deleteRow.spec.js → deleteRow.spec.ts} +3 -5
- package/src/automations/tests/utilities/index.js +12 -10
- package/src/automations/{utils.js → utils.ts} +39 -28
- package/src/constants/index.js +6 -0
- package/src/definitions/common.ts +1 -0
- package/src/definitions/datasource.ts +1 -0
- package/src/environment.js +2 -3
- package/src/index.ts +3 -0
- package/src/integrations/index.ts +4 -0
- package/src/integrations/redis.ts +152 -0
- package/src/integrations/tests/redis.spec.js +60 -0
- package/src/middleware/{authorized.js → authorized.ts} +20 -14
- package/src/middleware/currentapp.js +16 -1
- package/src/middleware/tests/currentapp.spec.js +8 -4
- package/src/migrations/functions/developerQuota.ts +15 -0
- package/src/migrations/functions/publishedAppsQuota.ts +13 -0
- package/src/migrations/functions/tests/quotas1.spec.js +0 -2
- package/src/migrations/functions/usageQuotas/index.ts +0 -5
- package/src/migrations/functions/usageQuotas/syncApps.ts +3 -6
- package/src/migrations/functions/usageQuotas/syncDevelopers.ts +19 -0
- package/src/migrations/functions/usageQuotas/syncPublishedApps.ts +21 -0
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -6
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.ts +34 -0
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +40 -0
- package/src/migrations/index.ts +13 -1
- package/src/threads/automation.js +196 -34
- package/src/threads/{index.js → index.ts} +18 -14
- package/src/threads/utils.js +1 -0
- package/src/utilities/queue/inMemoryQueue.js +7 -1
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +2 -2
- package/builder/assets/index.68a7f4e3.css +0 -6
- package/builder/assets/index.8d4a5b33.js +0 -1291
- package/coverage/lcov-report/api/controllers/application.js.html +0 -1436
- package/coverage/lcov-report/api/controllers/query/index.js.html +0 -713
- package/coverage/lcov-report/api/controllers/row/index.js.html +0 -524
- package/coverage/lcov-report/api/controllers/table/internal.js.html +0 -620
- package/coverage/lcov-report/api/controllers/table/utils.js.html +0 -1331
- package/coverage/lcov-report/api/routes/application.js.html +0 -179
- package/coverage/lcov-report/api/routes/index.js.html +0 -266
- package/coverage/lcov-report/api/routes/row.js.html +0 -908
- package/coverage/lcov-report/automations/steps/createRow.js.html +0 -380
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +0 -347
- package/coverage/lcov-report/automations/utils.js.html +0 -665
- package/coverage/lcov-report/middleware/authorized.js.html +0 -458
- package/coverage/lcov-report/middleware/usageQuota.js.html +0 -572
- package/coverage/lcov-report/threads/index.js.html +0 -296
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +0 -359
- package/dist/middleware/usageQuota.js +0 -154
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utilities/usageQuota/index.js +0 -86
- package/src/api/routes/index.js +0 -62
- package/src/middleware/tests/usageQuota.spec.js +0 -120
- package/src/middleware/usageQuota.js +0 -164
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.js +0 -41
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.js +0 -45
- package/src/utilities/tests/usageQuota/usageQuota.spec.js +0 -72
- package/src/utilities/usageQuota/index.js +0 -93
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import env from "../../environment"
|
|
2
|
+
import packageJson from "../../../package.json"
|
|
3
|
+
import {
|
|
4
4
|
createLinkView,
|
|
5
5
|
createRoutingView,
|
|
6
6
|
createAllSearchIndex,
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
} from "../../db/views/staticViews"
|
|
8
|
+
import {
|
|
9
9
|
getTemplateStream,
|
|
10
10
|
createApp,
|
|
11
11
|
deleteApp,
|
|
12
|
-
}
|
|
13
|
-
|
|
12
|
+
} from "../../utilities/fileSystem"
|
|
13
|
+
import {
|
|
14
14
|
generateAppID,
|
|
15
15
|
getLayoutParams,
|
|
16
16
|
getScreenParams,
|
|
17
17
|
generateDevAppID,
|
|
18
18
|
DocumentTypes,
|
|
19
19
|
AppStatus,
|
|
20
|
-
}
|
|
20
|
+
} from "../../db/utils"
|
|
21
21
|
const {
|
|
22
22
|
BUILTIN_ROLE_IDS,
|
|
23
23
|
AccessController,
|
|
24
24
|
} = require("@budibase/backend-core/roles")
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
import { BASE_LAYOUTS } from "../../constants/layouts"
|
|
26
|
+
import { cloneDeep } from "lodash/fp"
|
|
27
27
|
const { processObject } = require("@budibase/string-templates")
|
|
28
28
|
const {
|
|
29
29
|
getAllApps,
|
|
@@ -31,24 +31,27 @@ const {
|
|
|
31
31
|
getProdAppID,
|
|
32
32
|
Replication,
|
|
33
33
|
} = require("@budibase/backend-core/db")
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
import { USERS_TABLE_SCHEMA } from "../../constants"
|
|
35
|
+
import { removeAppFromUserRoles } from "../../utilities/workerRequests"
|
|
36
|
+
import { clientLibraryPath, stringToReadStream } from "../../utilities"
|
|
37
|
+
import { getAllLocks } from "../../utilities/redis"
|
|
38
|
+
import {
|
|
39
39
|
updateClientLibrary,
|
|
40
40
|
backupClientLibrary,
|
|
41
41
|
revertClientLibrary,
|
|
42
|
-
}
|
|
42
|
+
} from "../../utilities/fileSystem/clientLibrary"
|
|
43
43
|
const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
|
|
44
|
-
|
|
44
|
+
import { syncGlobalUsers } from "./user"
|
|
45
45
|
const { app: appCache } = require("@budibase/backend-core/cache")
|
|
46
|
-
|
|
46
|
+
import { cleanupAutomations } from "../../automations/utils"
|
|
47
47
|
const {
|
|
48
48
|
getAppDB,
|
|
49
49
|
getProdAppDB,
|
|
50
50
|
updateAppId,
|
|
51
51
|
} = require("@budibase/backend-core/context")
|
|
52
|
+
import { getUniqueRows } from "../../utilities/usageQuota/rows"
|
|
53
|
+
import { quotas } from "@budibase/pro"
|
|
54
|
+
import { errors } from "@budibase/backend-core"
|
|
52
55
|
|
|
53
56
|
const URL_REGEX_SLASH = /\/|\\/g
|
|
54
57
|
|
|
@@ -61,7 +64,7 @@ async function getLayouts() {
|
|
|
61
64
|
include_docs: true,
|
|
62
65
|
})
|
|
63
66
|
)
|
|
64
|
-
).rows.map(row => row.doc)
|
|
67
|
+
).rows.map((row: any) => row.doc)
|
|
65
68
|
}
|
|
66
69
|
|
|
67
70
|
async function getScreens() {
|
|
@@ -72,16 +75,16 @@ async function getScreens() {
|
|
|
72
75
|
include_docs: true,
|
|
73
76
|
})
|
|
74
77
|
)
|
|
75
|
-
).rows.map(row => row.doc)
|
|
78
|
+
).rows.map((row: any) => row.doc)
|
|
76
79
|
}
|
|
77
80
|
|
|
78
|
-
function getUserRoleId(ctx) {
|
|
81
|
+
function getUserRoleId(ctx: any) {
|
|
79
82
|
return !ctx.user.role || !ctx.user.role._id
|
|
80
83
|
? BUILTIN_ROLE_IDS.PUBLIC
|
|
81
84
|
: ctx.user.role._id
|
|
82
85
|
}
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
export const getAppUrl = (ctx: any) => {
|
|
85
88
|
// construct the url
|
|
86
89
|
let url
|
|
87
90
|
if (ctx.request.body.url) {
|
|
@@ -97,29 +100,34 @@ exports.getAppUrl = ctx => {
|
|
|
97
100
|
return url
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
const checkAppUrl = (ctx, apps, url, currentAppId) => {
|
|
103
|
+
const checkAppUrl = (ctx: any, apps: any, url: any, currentAppId?: string) => {
|
|
101
104
|
if (currentAppId) {
|
|
102
|
-
apps = apps.filter(app => app.appId !== currentAppId)
|
|
105
|
+
apps = apps.filter((app: any) => app.appId !== currentAppId)
|
|
103
106
|
}
|
|
104
|
-
if (apps.some(app => app.url === url)) {
|
|
107
|
+
if (apps.some((app: any) => app.url === url)) {
|
|
105
108
|
ctx.throw(400, "App URL is already in use.")
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
|
|
109
|
-
const checkAppName = (
|
|
112
|
+
const checkAppName = (
|
|
113
|
+
ctx: any,
|
|
114
|
+
apps: any,
|
|
115
|
+
name: any,
|
|
116
|
+
currentAppId?: string
|
|
117
|
+
) => {
|
|
110
118
|
// TODO: Replace with Joi
|
|
111
119
|
if (!name) {
|
|
112
120
|
ctx.throw(400, "Name is required")
|
|
113
121
|
}
|
|
114
122
|
if (currentAppId) {
|
|
115
|
-
apps = apps.filter(app => app.appId !== currentAppId)
|
|
123
|
+
apps = apps.filter((app: any) => app.appId !== currentAppId)
|
|
116
124
|
}
|
|
117
|
-
if (apps.some(app => app.name === name)) {
|
|
125
|
+
if (apps.some((app: any) => app.name === name)) {
|
|
118
126
|
ctx.throw(400, "App name is already in use.")
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
|
|
122
|
-
async function createInstance(template) {
|
|
130
|
+
async function createInstance(template: any) {
|
|
123
131
|
const tenantId = isMultiTenant() ? getTenantId() : null
|
|
124
132
|
const baseAppId = generateAppID(tenantId)
|
|
125
133
|
const appId = generateDevAppID(baseAppId)
|
|
@@ -160,7 +168,7 @@ async function createInstance(template) {
|
|
|
160
168
|
return { _id: appId }
|
|
161
169
|
}
|
|
162
170
|
|
|
163
|
-
|
|
171
|
+
export const fetch = async (ctx: any) => {
|
|
164
172
|
const dev = ctx.query && ctx.query.status === AppStatus.DEV
|
|
165
173
|
const all = ctx.query && ctx.query.status === AppStatus.ALL
|
|
166
174
|
const apps = await getAllApps({ dev, all })
|
|
@@ -172,7 +180,7 @@ exports.fetch = async ctx => {
|
|
|
172
180
|
if (app.status !== "development") {
|
|
173
181
|
continue
|
|
174
182
|
}
|
|
175
|
-
const lock = locks.find(lock => lock.appId === app.appId)
|
|
183
|
+
const lock = locks.find((lock: any) => lock.appId === app.appId)
|
|
176
184
|
if (lock) {
|
|
177
185
|
app.lockedBy = lock.user
|
|
178
186
|
} else {
|
|
@@ -185,7 +193,7 @@ exports.fetch = async ctx => {
|
|
|
185
193
|
ctx.body = apps
|
|
186
194
|
}
|
|
187
195
|
|
|
188
|
-
|
|
196
|
+
export const fetchAppDefinition = async (ctx: any) => {
|
|
189
197
|
const layouts = await getLayouts()
|
|
190
198
|
const userRoleId = getUserRoleId(ctx)
|
|
191
199
|
const accessController = new AccessController()
|
|
@@ -200,7 +208,7 @@ exports.fetchAppDefinition = async ctx => {
|
|
|
200
208
|
}
|
|
201
209
|
}
|
|
202
210
|
|
|
203
|
-
|
|
211
|
+
export const fetchAppPackage = async (ctx: any) => {
|
|
204
212
|
const db = getAppDB()
|
|
205
213
|
const application = await db.get(DocumentTypes.APP_METADATA)
|
|
206
214
|
const layouts = await getLayouts()
|
|
@@ -221,7 +229,7 @@ exports.fetchAppPackage = async ctx => {
|
|
|
221
229
|
}
|
|
222
230
|
}
|
|
223
231
|
|
|
224
|
-
|
|
232
|
+
const performAppCreate = async (ctx: any) => {
|
|
225
233
|
const apps = await getAllApps({ dev: true })
|
|
226
234
|
const name = ctx.request.body.name
|
|
227
235
|
checkAppName(ctx, apps, name)
|
|
@@ -229,7 +237,7 @@ exports.create = async ctx => {
|
|
|
229
237
|
checkAppUrl(ctx, apps, url)
|
|
230
238
|
|
|
231
239
|
const { useTemplate, templateKey, templateString } = ctx.request.body
|
|
232
|
-
const instanceConfig = {
|
|
240
|
+
const instanceConfig: any = {
|
|
233
241
|
useTemplate,
|
|
234
242
|
key: templateKey,
|
|
235
243
|
templateString,
|
|
@@ -280,13 +288,41 @@ exports.create = async ctx => {
|
|
|
280
288
|
}
|
|
281
289
|
|
|
282
290
|
await appCache.invalidateAppMetadata(appId, newApplication)
|
|
283
|
-
|
|
291
|
+
return newApplication
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
const appPostCreate = async (ctx: any, appId: string) => {
|
|
295
|
+
// app import & template creation
|
|
296
|
+
if (ctx.request.body.useTemplate === "true") {
|
|
297
|
+
const rows = await getUniqueRows([appId])
|
|
298
|
+
const rowCount = rows ? rows.length : 0
|
|
299
|
+
if (rowCount) {
|
|
300
|
+
try {
|
|
301
|
+
await quotas.addRows(rowCount)
|
|
302
|
+
} catch (err: any) {
|
|
303
|
+
if (err.code && err.code === errors.codes.USAGE_LIMIT_EXCEEDED) {
|
|
304
|
+
// this import resulted in row usage exceeding the quota
|
|
305
|
+
// delete the app
|
|
306
|
+
// skip pre and post steps as no rows have been added to quotas yet
|
|
307
|
+
ctx.params.appId = appId
|
|
308
|
+
await destroyApp(ctx)
|
|
309
|
+
}
|
|
310
|
+
throw err
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export const create = async (ctx: any) => {
|
|
317
|
+
const newApplication = await quotas.addApp(() => performAppCreate(ctx))
|
|
318
|
+
await appPostCreate(ctx, newApplication.appId)
|
|
284
319
|
ctx.body = newApplication
|
|
320
|
+
ctx.status = 200
|
|
285
321
|
}
|
|
286
322
|
|
|
287
323
|
// This endpoint currently operates as a PATCH rather than a PUT
|
|
288
324
|
// Thus name and url fields are handled only if present
|
|
289
|
-
|
|
325
|
+
export const update = async (ctx: any) => {
|
|
290
326
|
const apps = await getAllApps({ dev: true })
|
|
291
327
|
// validation
|
|
292
328
|
const name = ctx.request.body.name
|
|
@@ -304,7 +340,7 @@ exports.update = async ctx => {
|
|
|
304
340
|
ctx.body = data
|
|
305
341
|
}
|
|
306
342
|
|
|
307
|
-
|
|
343
|
+
export const updateClient = async (ctx: any) => {
|
|
308
344
|
// Get current app version
|
|
309
345
|
const db = getAppDB()
|
|
310
346
|
const application = await db.get(DocumentTypes.APP_METADATA)
|
|
@@ -326,7 +362,7 @@ exports.updateClient = async ctx => {
|
|
|
326
362
|
ctx.body = data
|
|
327
363
|
}
|
|
328
364
|
|
|
329
|
-
|
|
365
|
+
export const revertClient = async (ctx: any) => {
|
|
330
366
|
// Check app can be reverted
|
|
331
367
|
const db = getAppDB()
|
|
332
368
|
const application = await db.get(DocumentTypes.APP_METADATA)
|
|
@@ -349,26 +385,57 @@ exports.revertClient = async ctx => {
|
|
|
349
385
|
ctx.body = data
|
|
350
386
|
}
|
|
351
387
|
|
|
352
|
-
|
|
353
|
-
|
|
388
|
+
const destroyApp = async (ctx: any) => {
|
|
389
|
+
let appId = ctx.params.appId
|
|
390
|
+
let isUnpublish = ctx.query && ctx.query.unpublish
|
|
354
391
|
|
|
392
|
+
if (isUnpublish) {
|
|
393
|
+
appId = getProdAppID(appId)
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const db = isUnpublish ? getProdAppDB() : getAppDB()
|
|
355
397
|
const result = await db.destroy()
|
|
398
|
+
|
|
399
|
+
if (isUnpublish) {
|
|
400
|
+
await quotas.removePublishedApp()
|
|
401
|
+
} else {
|
|
402
|
+
await quotas.removeApp()
|
|
403
|
+
}
|
|
404
|
+
|
|
356
405
|
/* istanbul ignore next */
|
|
357
|
-
if (!env.isTest() && !
|
|
358
|
-
await deleteApp(
|
|
406
|
+
if (!env.isTest() && !isUnpublish) {
|
|
407
|
+
await deleteApp(appId)
|
|
359
408
|
}
|
|
360
|
-
if (
|
|
361
|
-
await cleanupAutomations(
|
|
409
|
+
if (isUnpublish) {
|
|
410
|
+
await cleanupAutomations(appId)
|
|
362
411
|
}
|
|
363
412
|
// make sure the app/role doesn't stick around after the app has been deleted
|
|
364
|
-
await removeAppFromUserRoles(ctx,
|
|
365
|
-
await appCache.invalidateAppMetadata(
|
|
413
|
+
await removeAppFromUserRoles(ctx, appId)
|
|
414
|
+
await appCache.invalidateAppMetadata(appId)
|
|
415
|
+
return result
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const preDestroyApp = async (ctx: any) => {
|
|
419
|
+
const rows = await getUniqueRows([ctx.params.appId])
|
|
420
|
+
ctx.rowCount = rows.length
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const postDestroyApp = async (ctx: any) => {
|
|
424
|
+
const rowCount = ctx.rowCount
|
|
425
|
+
if (rowCount) {
|
|
426
|
+
await quotas.removeRows(rowCount)
|
|
427
|
+
}
|
|
428
|
+
}
|
|
366
429
|
|
|
430
|
+
export const destroy = async (ctx: any) => {
|
|
431
|
+
await preDestroyApp(ctx)
|
|
432
|
+
const result = await destroyApp(ctx)
|
|
433
|
+
await postDestroyApp(ctx)
|
|
367
434
|
ctx.status = 200
|
|
368
435
|
ctx.body = result
|
|
369
436
|
}
|
|
370
437
|
|
|
371
|
-
|
|
438
|
+
export const sync = async (ctx: any, next: any) => {
|
|
372
439
|
const appId = ctx.params.appId
|
|
373
440
|
if (!isDevAppID(appId)) {
|
|
374
441
|
ctx.throw(400, "This action cannot be performed for production apps")
|
|
@@ -398,7 +465,7 @@ exports.sync = async (ctx, next) => {
|
|
|
398
465
|
let error
|
|
399
466
|
try {
|
|
400
467
|
await replication.replicate({
|
|
401
|
-
filter: function (doc) {
|
|
468
|
+
filter: function (doc: any) {
|
|
402
469
|
return doc._id !== DocumentTypes.APP_METADATA
|
|
403
470
|
},
|
|
404
471
|
})
|
|
@@ -420,7 +487,7 @@ exports.sync = async (ctx, next) => {
|
|
|
420
487
|
}
|
|
421
488
|
}
|
|
422
489
|
|
|
423
|
-
const updateAppPackage = async (appPackage, appId) => {
|
|
490
|
+
const updateAppPackage = async (appPackage: any, appId: any) => {
|
|
424
491
|
const db = getAppDB()
|
|
425
492
|
const application = await db.get(DocumentTypes.APP_METADATA)
|
|
426
493
|
|
|
@@ -439,7 +506,7 @@ const updateAppPackage = async (appPackage, appId) => {
|
|
|
439
506
|
return response
|
|
440
507
|
}
|
|
441
508
|
|
|
442
|
-
const createEmptyAppPackage = async (ctx, app) => {
|
|
509
|
+
const createEmptyAppPackage = async (ctx: any, app: any) => {
|
|
443
510
|
const db = getAppDB()
|
|
444
511
|
|
|
445
512
|
let screensAndLayouts = []
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import Deployment from "./Deployment"
|
|
2
|
+
import {
|
|
3
3
|
Replication,
|
|
4
4
|
getProdAppID,
|
|
5
5
|
getDevelopmentAppID,
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = require("../../../automations/utils")
|
|
12
|
-
const { app: appCache } = require("@budibase/backend-core/cache")
|
|
13
|
-
const {
|
|
6
|
+
} from "@budibase/backend-core/db"
|
|
7
|
+
import { DocumentTypes, getAutomationParams } from "../../../db/utils"
|
|
8
|
+
import { disableAllCrons, enableCronTrigger } from "../../../automations/utils"
|
|
9
|
+
import { app as appCache } from "@budibase/backend-core/cache"
|
|
10
|
+
import {
|
|
14
11
|
getAppId,
|
|
15
12
|
getAppDB,
|
|
16
13
|
getProdAppDB,
|
|
17
|
-
}
|
|
14
|
+
} from "@budibase/backend-core/context"
|
|
15
|
+
import { quotas } from "@budibase/pro"
|
|
18
16
|
|
|
19
17
|
// the max time we can wait for an invalidation to complete before considering it failed
|
|
20
18
|
const MAX_PENDING_TIME_MS = 30 * 60000
|
|
@@ -25,9 +23,10 @@ const DeploymentStatus = {
|
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
// checks that deployments are in a good state, any pending will be updated
|
|
28
|
-
async function checkAllDeployments(deployments) {
|
|
26
|
+
async function checkAllDeployments(deployments: any) {
|
|
29
27
|
let updated = false
|
|
30
|
-
|
|
28
|
+
let deployment: any
|
|
29
|
+
for (deployment of Object.values(deployments.history)) {
|
|
31
30
|
// check that no deployments have crashed etc and are now stuck
|
|
32
31
|
if (
|
|
33
32
|
deployment.status === DeploymentStatus.PENDING &&
|
|
@@ -41,7 +40,7 @@ async function checkAllDeployments(deployments) {
|
|
|
41
40
|
return { updated, deployments }
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
async function storeDeploymentHistory(deployment) {
|
|
43
|
+
async function storeDeploymentHistory(deployment: any) {
|
|
45
44
|
const deploymentJSON = deployment.getJSON()
|
|
46
45
|
const db = getAppDB()
|
|
47
46
|
|
|
@@ -70,7 +69,7 @@ async function storeDeploymentHistory(deployment) {
|
|
|
70
69
|
return deployment
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
async function initDeployedApp(prodAppId) {
|
|
72
|
+
async function initDeployedApp(prodAppId: any) {
|
|
74
73
|
const db = getProdAppDB()
|
|
75
74
|
console.log("Reading automation docs")
|
|
76
75
|
const automations = (
|
|
@@ -79,7 +78,7 @@ async function initDeployedApp(prodAppId) {
|
|
|
79
78
|
include_docs: true,
|
|
80
79
|
})
|
|
81
80
|
)
|
|
82
|
-
).rows.map(row => row.doc)
|
|
81
|
+
).rows.map((row: any) => row.doc)
|
|
83
82
|
console.log("You have " + automations.length + " automations")
|
|
84
83
|
const promises = []
|
|
85
84
|
console.log("Disabling prod crons..")
|
|
@@ -93,21 +92,27 @@ async function initDeployedApp(prodAppId) {
|
|
|
93
92
|
console.log("Enabled cron triggers for deployed app..")
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
async function deployApp(deployment) {
|
|
95
|
+
async function deployApp(deployment: any) {
|
|
97
96
|
let replication
|
|
98
97
|
try {
|
|
99
98
|
const appId = getAppId()
|
|
100
99
|
const devAppId = getDevelopmentAppID(appId)
|
|
101
100
|
const productionAppId = getProdAppID(appId)
|
|
102
|
-
|
|
101
|
+
|
|
102
|
+
const config: any = {
|
|
103
103
|
source: devAppId,
|
|
104
104
|
target: productionAppId,
|
|
105
|
-
}
|
|
105
|
+
}
|
|
106
|
+
replication = new Replication(config)
|
|
107
|
+
|
|
106
108
|
console.log("Replication object created")
|
|
107
109
|
await replication.replicate()
|
|
108
110
|
console.log("replication complete.. replacing app meta doc")
|
|
109
111
|
const db = getProdAppDB()
|
|
110
112
|
const appDoc = await db.get(DocumentTypes.APP_METADATA)
|
|
113
|
+
|
|
114
|
+
deployment.appUrl = appDoc.url
|
|
115
|
+
|
|
111
116
|
appDoc.appId = productionAppId
|
|
112
117
|
appDoc.instance._id = productionAppId
|
|
113
118
|
await db.put(appDoc)
|
|
@@ -117,7 +122,7 @@ async function deployApp(deployment) {
|
|
|
117
122
|
console.log("Deployed app initialised, setting deployment to successful")
|
|
118
123
|
deployment.setStatus(DeploymentStatus.SUCCESS)
|
|
119
124
|
await storeDeploymentHistory(deployment)
|
|
120
|
-
} catch (err) {
|
|
125
|
+
} catch (err: any) {
|
|
121
126
|
deployment.setStatus(DeploymentStatus.FAILURE, err.message)
|
|
122
127
|
await storeDeploymentHistory(deployment)
|
|
123
128
|
throw {
|
|
@@ -125,18 +130,17 @@ async function deployApp(deployment) {
|
|
|
125
130
|
message: `Deployment Failed: ${err.message}`,
|
|
126
131
|
}
|
|
127
132
|
} finally {
|
|
128
|
-
|
|
133
|
+
if (replication) {
|
|
134
|
+
await replication.close()
|
|
135
|
+
}
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
|
|
139
|
+
export async function fetchDeployments(ctx: any) {
|
|
133
140
|
try {
|
|
134
141
|
const db = getAppDB()
|
|
135
142
|
const deploymentDoc = await db.get(DocumentTypes.DEPLOYMENTS)
|
|
136
|
-
const { updated, deployments } = await checkAllDeployments(
|
|
137
|
-
deploymentDoc,
|
|
138
|
-
ctx.user
|
|
139
|
-
)
|
|
143
|
+
const { updated, deployments } = await checkAllDeployments(deploymentDoc)
|
|
140
144
|
if (updated) {
|
|
141
145
|
await db.put(deployments)
|
|
142
146
|
}
|
|
@@ -146,7 +150,7 @@ exports.fetchDeployments = async function (ctx) {
|
|
|
146
150
|
}
|
|
147
151
|
}
|
|
148
152
|
|
|
149
|
-
|
|
153
|
+
export async function deploymentProgress(ctx: any) {
|
|
150
154
|
try {
|
|
151
155
|
const db = getAppDB()
|
|
152
156
|
const deploymentDoc = await db.get(DocumentTypes.DEPLOYMENTS)
|
|
@@ -159,7 +163,20 @@ exports.deploymentProgress = async function (ctx) {
|
|
|
159
163
|
}
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
|
|
166
|
+
const isFirstDeploy = async () => {
|
|
167
|
+
try {
|
|
168
|
+
const db = getProdAppDB()
|
|
169
|
+
await db.get(DocumentTypes.APP_METADATA)
|
|
170
|
+
} catch (e: any) {
|
|
171
|
+
if (e.status === 404) {
|
|
172
|
+
return true
|
|
173
|
+
}
|
|
174
|
+
throw e
|
|
175
|
+
}
|
|
176
|
+
return false
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const _deployApp = async function (ctx: any) {
|
|
163
180
|
let deployment = new Deployment()
|
|
164
181
|
console.log("Deployment object created")
|
|
165
182
|
deployment.setStatus(DeploymentStatus.PENDING)
|
|
@@ -168,7 +185,14 @@ exports.deployApp = async function (ctx) {
|
|
|
168
185
|
console.log("Stored deployment history")
|
|
169
186
|
|
|
170
187
|
console.log("Deploying app...")
|
|
171
|
-
|
|
188
|
+
|
|
189
|
+
if (await isFirstDeploy()) {
|
|
190
|
+
await quotas.addPublishedApp(() => deployApp(deployment))
|
|
191
|
+
} else {
|
|
192
|
+
await deployApp(deployment)
|
|
193
|
+
}
|
|
172
194
|
|
|
173
195
|
ctx.body = deployment
|
|
174
196
|
}
|
|
197
|
+
|
|
198
|
+
export { _deployApp as deployApp }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { getAllApps } = require("@budibase/backend-core/db")
|
|
2
2
|
const { updateAppId } = require("@budibase/backend-core/context")
|
|
3
3
|
import { search as stringSearch } from "./utils"
|
|
4
|
-
import
|
|
4
|
+
import * as controller from "../application"
|
|
5
5
|
import { Application } from "../../../definitions/common"
|
|
6
6
|
|
|
7
7
|
function fixAppID(app: Application, params: any) {
|
|
@@ -59,7 +59,7 @@ export async function destroy(ctx: any, next: any) {
|
|
|
59
59
|
// get the app before deleting it
|
|
60
60
|
await setResponseApp(ctx)
|
|
61
61
|
const body = ctx.body
|
|
62
|
-
await controller.
|
|
62
|
+
await controller.destroy(ctx)
|
|
63
63
|
// overwrite the body again
|
|
64
64
|
ctx.body = body
|
|
65
65
|
await next()
|