@budibase/server 1.0.48 → 1.0.49-alpha.3
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.e083dcaf.js → index.21e57eb4.js} +234 -231
- package/builder/assets/index.83c0944f.css +1 -0
- package/builder/assets/{vendor.f9faf6ab.js → vendor.d526bfe8.js} +12 -12
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2338 -2028
- package/coverage/coverage-final.json +100 -95
- package/coverage/lcov-report/api/controllers/analytics.js.html +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/application.js.html +210 -126
- package/coverage/lcov-report/api/controllers/auth.js.html +18 -6
- package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +4 -4
- package/coverage/lcov-report/api/controllers/datasource.js.html +72 -36
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +53 -53
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +119 -0
- 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/index.js.html +19 -19
- package/coverage/lcov-report/api/controllers/query/validation.js.html +6 -6
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +16 -16
- package/coverage/lcov-report/api/controllers/row/index.html +48 -33
- package/coverage/lcov-report/api/controllers/row/index.js.html +26 -26
- package/coverage/lcov-report/api/controllers/row/internal.js.html +95 -158
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +41 -17
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +551 -0
- package/coverage/lcov-report/api/controllers/row/utils.js.html +39 -57
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +629 -0
- package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
- package/coverage/lcov-report/api/controllers/table/index.html +46 -31
- package/coverage/lcov-report/api/controllers/table/index.js.html +53 -77
- package/coverage/lcov-report/api/controllers/table/internal.js.html +59 -35
- package/coverage/lcov-report/api/controllers/table/utils.js.html +217 -73
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +30 -24
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/view/utils.js.html +11 -11
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
- package/coverage/lcov-report/api/controllers/webhook.js.html +15 -15
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +8 -8
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/application.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +18 -18
- package/coverage/lcov-report/api/routes/index.js.html +3 -3
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/{hosting.js.html → migrations.js.html} +17 -14
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/row.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +17 -2
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +24 -24
- package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
- package/coverage/lcov-report/automations/bullboard.js.html +16 -16
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +6 -6
- package/coverage/lcov-report/automations/steps/createRow.js.html +13 -19
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +11 -20
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
- 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 +13 -13
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- 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/automations/utils.js.html +32 -32
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +53 -26
- 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/client.js.html +18 -18
- package/coverage/lcov-report/db/inMemoryView.js.html +7 -7
- package/coverage/lcov-report/db/index.html +15 -15
- package/coverage/lcov-report/db/index.js.html +3 -3
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +18 -18
- package/coverage/lcov-report/db/linkedRows/index.html +10 -10
- package/coverage/lcov-report/db/linkedRows/index.js.html +38 -41
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +15 -15
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +86 -86
- 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 +5 -5
- package/coverage/lcov-report/events/utils.js.html +3 -3
- package/coverage/lcov-report/index.html +114 -99
- 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 +1 -1
- package/coverage/lcov-report/middleware/authorized.js.html +166 -64
- package/coverage/lcov-report/middleware/builder.js.html +8 -8
- package/coverage/lcov-report/middleware/currentapp.js.html +29 -29
- package/coverage/lcov-report/middleware/index.html +30 -30
- package/coverage/lcov-report/middleware/joi-validator.js.html +3 -3
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +270 -42
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +15 -15
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +23 -8
- package/coverage/lcov-report/threads/utils.js.html +14 -14
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +26 -26
- package/coverage/lcov-report/utilities/index.html +19 -19
- package/coverage/lcov-report/utilities/index.js.html +25 -25
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +8 -8
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +27 -27
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +115 -79
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +75 -27
- 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 +141 -0
- package/coverage/lcov-report/utilities/usageQuota/index.js.html +356 -0
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +302 -0
- package/coverage/lcov-report/{api/controllers/hosting.js.html → utilities/usageQuota/usageQuoteReset.js.html} +36 -48
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +39 -108
- package/coverage/lcov.info +3656 -3057
- package/dist/api/controllers/application.js +61 -34
- package/dist/api/controllers/auth.js +4 -0
- package/dist/api/controllers/datasource.js +11 -0
- package/dist/api/controllers/migrations.js +21 -0
- package/dist/api/controllers/row/internal.js +30 -53
- package/dist/api/controllers/row/internalSearch.js +12 -4
- package/dist/api/controllers/row/staticFormula.js +147 -0
- package/dist/api/controllers/row/utils.js +6 -8
- package/dist/api/controllers/static/index.js +59 -10
- package/dist/api/controllers/table/bulkFormula.js +160 -0
- package/dist/api/controllers/table/index.js +12 -9
- package/dist/api/controllers/table/internal.js +9 -0
- package/dist/api/controllers/table/utils.js +41 -12
- package/dist/api/controllers/user.js +2 -0
- package/dist/api/routes/index.js +2 -2
- package/dist/api/routes/migrations.js +9 -0
- package/dist/api/routes/static.js +2 -1
- package/dist/app.js +35 -5
- package/dist/automations/steps/createRow.js +2 -4
- package/dist/automations/steps/deleteRow.js +1 -4
- package/dist/constants/index.js +7 -0
- package/dist/db/linkedRows/index.js +4 -5
- package/dist/definitions/datasource.js +1 -0
- package/dist/environment.js +2 -0
- package/dist/integrations/base/sql.js +13 -6
- package/dist/integrations/googlesheets.js +340 -0
- package/dist/integrations/index.js +3 -0
- package/dist/integrations/utils.js +57 -9
- package/dist/middleware/authorized.js +55 -30
- package/dist/middleware/usageQuota.js +80 -13
- package/dist/migrations/functions/appUrls.js +46 -0
- package/dist/migrations/functions/quotas1.js +50 -0
- package/dist/migrations/functions/usageQuotas/index.js +20 -0
- package/dist/migrations/functions/usageQuotas/syncApps.js +32 -0
- package/dist/migrations/functions/usageQuotas/syncRows.js +35 -0
- package/dist/migrations/functions/userEmailViewCasing.js +24 -0
- package/dist/migrations/index.js +62 -0
- package/dist/package.json +8 -5
- package/dist/tests/utilities/TestConfiguration.js +13 -6
- package/dist/threads/query.js +4 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/rowProcessor/index.js +18 -11
- package/dist/utilities/rowProcessor/utils.js +14 -4
- package/dist/utilities/{usageQuota.js → usageQuota/index.js} +44 -31
- package/dist/utilities/usageQuota/rows.js +77 -0
- package/dist/utilities/usageQuota/usageQuoteReset.js +16 -0
- package/dist/utilities/workerRequests.js +0 -20
- package/nodemon.json +1 -1
- package/package.json +9 -6
- package/src/api/controllers/application.js +52 -24
- package/src/api/controllers/auth.js +4 -0
- package/src/api/controllers/datasource.js +12 -0
- package/src/api/controllers/migrations.js +13 -0
- package/src/api/controllers/row/internal.js +29 -50
- package/src/api/controllers/row/internalSearch.js +12 -4
- package/src/api/controllers/row/staticFormula.js +157 -0
- package/src/api/controllers/row/utils.js +6 -12
- package/src/api/controllers/static/index.js +63 -10
- package/src/api/controllers/table/bulkFormula.js +183 -0
- package/src/api/controllers/table/index.js +16 -24
- package/src/api/controllers/table/internal.js +9 -1
- package/src/api/controllers/table/utils.js +57 -9
- package/src/api/controllers/user.js +2 -0
- package/src/api/routes/index.js +2 -2
- package/src/api/routes/migrations.js +14 -0
- package/src/api/routes/static.js +5 -0
- package/src/api/routes/tests/application.spec.js +2 -2
- package/src/api/routes/tests/auth.spec.js +1 -2
- package/src/api/routes/tests/static.spec.js +98 -0
- package/src/app.ts +18 -5
- package/src/automations/steps/createRow.js +2 -4
- package/src/automations/steps/deleteRow.js +1 -4
- package/src/constants/index.js +9 -0
- package/src/db/linkedRows/index.js +4 -5
- package/src/definitions/common.ts +3 -0
- package/src/definitions/datasource.ts +3 -0
- package/src/environment.js +2 -0
- package/src/integrations/base/sql.ts +14 -7
- package/src/integrations/googlesheets.ts +353 -0
- package/src/integrations/index.ts +3 -0
- package/src/integrations/tests/sql.spec.js +16 -0
- package/src/integrations/utils.ts +71 -11
- package/src/middleware/authorized.js +64 -30
- package/src/middleware/tests/authorized.spec.js +6 -4
- package/src/middleware/tests/usageQuota.spec.js +18 -24
- package/src/middleware/usageQuota.js +91 -15
- package/src/migrations/functions/appUrls.ts +34 -0
- package/src/migrations/functions/quotas1.ts +20 -0
- package/src/migrations/functions/tests/appUrls.spec.js +29 -0
- package/src/migrations/functions/tests/quotas1.spec.js +27 -0
- package/src/migrations/functions/tests/userEmailViewCasing.spec.js +25 -0
- package/src/migrations/functions/usageQuotas/index.ts +8 -0
- package/src/migrations/functions/usageQuotas/syncApps.ts +18 -0
- package/src/migrations/functions/usageQuotas/syncRows.ts +21 -0
- package/src/migrations/functions/usageQuotas/tests/syncApps.spec.js +37 -0
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.js +43 -0
- package/src/migrations/functions/userEmailViewCasing.ts +13 -0
- package/src/migrations/index.ts +56 -0
- package/src/tests/utilities/TestConfiguration.js +14 -6
- package/src/threads/query.js +5 -0
- package/src/utilities/rowProcessor/index.js +24 -12
- package/src/utilities/rowProcessor/utils.js +23 -7
- package/src/utilities/tests/usageQuota/usageQuota.spec.js +72 -0
- package/src/utilities/usageQuota/index.js +92 -0
- package/src/utilities/usageQuota/rows.js +74 -0
- package/src/utilities/usageQuota/usageQuoteReset.js +18 -0
- package/src/utilities/workerRequests.js +0 -23
- package/builder/assets/index.39e01193.css +0 -1
- package/dist/api/controllers/hosting.js +0 -30
- package/dist/api/routes/hosting.js +0 -11
- package/src/api/controllers/hosting.js +0 -22
- package/src/api/routes/hosting.js +0 -13
- package/src/api/routes/tests/hosting.spec.js +0 -36
- package/src/utilities/usageQuota.js +0 -73
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
jest.mock("../../db")
|
|
2
2
|
jest.mock("../../utilities/usageQuota")
|
|
3
|
-
jest.mock("../../environment", () => ({
|
|
4
|
-
isTest: () => true,
|
|
5
|
-
isProd: () => false,
|
|
6
|
-
isDev: () => true,
|
|
7
|
-
_set: () => {},
|
|
8
|
-
}))
|
|
9
3
|
jest.mock("@budibase/backend-core/tenancy", () => ({
|
|
10
4
|
getTenantId: () => "testing123"
|
|
11
5
|
}))
|
|
@@ -29,9 +23,10 @@ class TestConfiguration {
|
|
|
29
23
|
},
|
|
30
24
|
req: {
|
|
31
25
|
method: "POST",
|
|
32
|
-
url: "/
|
|
26
|
+
url: "/applications"
|
|
33
27
|
}
|
|
34
28
|
}
|
|
29
|
+
usageQuota.useQuotas = () => true
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
executeMiddleware() {
|
|
@@ -113,7 +108,6 @@ describe("usageQuota middleware", () => {
|
|
|
113
108
|
|
|
114
109
|
it("calculates and persists the correct usage quota for the relevant action", async () => {
|
|
115
110
|
config.setUrl("/rows")
|
|
116
|
-
config.setProd(true)
|
|
117
111
|
|
|
118
112
|
await config.executeMiddleware()
|
|
119
113
|
|
|
@@ -121,20 +115,20 @@ describe("usageQuota middleware", () => {
|
|
|
121
115
|
expect(config.next).toHaveBeenCalled()
|
|
122
116
|
})
|
|
123
117
|
|
|
124
|
-
it("calculates the correct file size from a file upload call and adds it to quota", async () => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
})
|
|
118
|
+
// it("calculates the correct file size from a file upload call and adds it to quota", async () => {
|
|
119
|
+
// config.setUrl("/upload")
|
|
120
|
+
// config.setProd(true)
|
|
121
|
+
// config.setFiles([
|
|
122
|
+
// {
|
|
123
|
+
// size: 100
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// size: 10000
|
|
127
|
+
// },
|
|
128
|
+
// ])
|
|
129
|
+
// await config.executeMiddleware()
|
|
130
|
+
|
|
131
|
+
// expect(usageQuota.update).toHaveBeenCalledWith("storage", 10100)
|
|
132
|
+
// expect(config.next).toHaveBeenCalled()
|
|
133
|
+
// })
|
|
140
134
|
})
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
const CouchDB = require("../db")
|
|
2
2
|
const usageQuota = require("../utilities/usageQuota")
|
|
3
|
-
const
|
|
4
|
-
const { getTenantId } = require("@budibase/backend-core/tenancy")
|
|
3
|
+
const { getUniqueRows } = require("../utilities/usageQuota/rows")
|
|
5
4
|
const {
|
|
6
5
|
isExternalTable,
|
|
7
6
|
isRowId: isExternalRowId,
|
|
8
7
|
} = require("../integrations/utils")
|
|
9
8
|
|
|
10
|
-
// tenants without limits
|
|
11
|
-
const EXCLUDED_TENANTS = ["bb", "default", "bbtest", "bbstaging"]
|
|
12
|
-
|
|
13
9
|
// currently only counting new writes and deletes
|
|
14
10
|
const METHOD_MAP = {
|
|
15
11
|
POST: 1,
|
|
@@ -18,13 +14,13 @@ const METHOD_MAP = {
|
|
|
18
14
|
|
|
19
15
|
const DOMAIN_MAP = {
|
|
20
16
|
rows: usageQuota.Properties.ROW,
|
|
21
|
-
upload: usageQuota.Properties.UPLOAD,
|
|
22
|
-
views: usageQuota.Properties.VIEW,
|
|
23
|
-
users: usageQuota.Properties.USER,
|
|
17
|
+
// upload: usageQuota.Properties.UPLOAD, // doesn't work yet
|
|
18
|
+
// views: usageQuota.Properties.VIEW, // doesn't work yet
|
|
19
|
+
// users: usageQuota.Properties.USER, // doesn't work yet
|
|
24
20
|
applications: usageQuota.Properties.APPS,
|
|
25
21
|
// this will not be updated by endpoint calls
|
|
26
22
|
// instead it will be updated by triggerInfo
|
|
27
|
-
automationRuns: usageQuota.Properties.AUTOMATION,
|
|
23
|
+
// automationRuns: usageQuota.Properties.AUTOMATION, // doesn't work yet
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
function getProperty(url) {
|
|
@@ -36,10 +32,7 @@ function getProperty(url) {
|
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
module.exports = async (ctx, next) => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// if in development or a self hosted cloud usage quotas should not be executed
|
|
42
|
-
if (env.isDev() || env.SELF_HOSTED || EXCLUDED_TENANTS.includes(tenantId)) {
|
|
35
|
+
if (!usageQuota.useQuotas()) {
|
|
43
36
|
return next()
|
|
44
37
|
}
|
|
45
38
|
|
|
@@ -80,9 +73,92 @@ module.exports = async (ctx, next) => {
|
|
|
80
73
|
usage = files.map(file => file.size).reduce((total, size) => total + size)
|
|
81
74
|
}
|
|
82
75
|
try {
|
|
83
|
-
await
|
|
84
|
-
return next()
|
|
76
|
+
await performRequest(ctx, next, property, usage)
|
|
85
77
|
} catch (err) {
|
|
86
78
|
ctx.throw(400, err)
|
|
87
79
|
}
|
|
88
80
|
}
|
|
81
|
+
|
|
82
|
+
const performRequest = async (ctx, next, property, usage) => {
|
|
83
|
+
const usageContext = {
|
|
84
|
+
skipNext: false,
|
|
85
|
+
skipUsage: false,
|
|
86
|
+
[usageQuota.Properties.APPS]: {},
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (usage === -1) {
|
|
90
|
+
if (PRE_DELETE[property]) {
|
|
91
|
+
await PRE_DELETE[property](ctx, usageContext)
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
if (PRE_CREATE[property]) {
|
|
95
|
+
await PRE_CREATE[property](ctx, usageContext)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// run the request
|
|
100
|
+
if (!usageContext.skipNext) {
|
|
101
|
+
await usageQuota.update(property, usage, { dryRun: true })
|
|
102
|
+
await next()
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (usage === -1) {
|
|
106
|
+
if (POST_DELETE[property]) {
|
|
107
|
+
await POST_DELETE[property](ctx, usageContext)
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
if (POST_CREATE[property]) {
|
|
111
|
+
await POST_CREATE[property](ctx, usageContext)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// update the usage
|
|
116
|
+
if (!usageContext.skipUsage) {
|
|
117
|
+
await usageQuota.update(property, usage)
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const appPreDelete = async (ctx, usageContext) => {
|
|
122
|
+
if (ctx.query.unpublish) {
|
|
123
|
+
// don't run usage decrement for unpublish
|
|
124
|
+
usageContext.skipUsage = true
|
|
125
|
+
return
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// store the row count to delete
|
|
129
|
+
const rows = await getUniqueRows([ctx.appId])
|
|
130
|
+
if (rows.length) {
|
|
131
|
+
usageContext[usageQuota.Properties.APPS] = { rowCount: rows.length }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const appPostDelete = async (ctx, usageContext) => {
|
|
136
|
+
// delete the app rows from usage
|
|
137
|
+
const rowCount = usageContext[usageQuota.Properties.APPS].rowCount
|
|
138
|
+
if (rowCount) {
|
|
139
|
+
await usageQuota.update(usageQuota.Properties.ROW, -rowCount)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const appPostCreate = async ctx => {
|
|
144
|
+
// app import & template creation
|
|
145
|
+
if (ctx.request.body.useTemplate === "true") {
|
|
146
|
+
const rows = await getUniqueRows([ctx.response.body.appId])
|
|
147
|
+
const rowCount = rows ? rows.length : 0
|
|
148
|
+
await usageQuota.update(usageQuota.Properties.ROW, rowCount)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const PRE_DELETE = {
|
|
153
|
+
[usageQuota.Properties.APPS]: appPreDelete,
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const POST_DELETE = {
|
|
157
|
+
[usageQuota.Properties.APPS]: appPostDelete,
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const PRE_CREATE = {}
|
|
161
|
+
|
|
162
|
+
const POST_CREATE = {
|
|
163
|
+
[usageQuota.Properties.APPS]: appPostCreate,
|
|
164
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const { DocumentTypes } = require("@budibase/backend-core/db")
|
|
2
|
+
import { getAppUrl } from "../../api/controllers/application"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Date:
|
|
6
|
+
* January 2022
|
|
7
|
+
*
|
|
8
|
+
* Description:
|
|
9
|
+
* Add the url to the app metadata if it doesn't exist
|
|
10
|
+
*/
|
|
11
|
+
export const run = async (appDb: any) => {
|
|
12
|
+
let metadata
|
|
13
|
+
try {
|
|
14
|
+
metadata = await appDb.get(DocumentTypes.APP_METADATA)
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// sometimes the metadata document doesn't exist
|
|
17
|
+
// exit early instead of failing the migration
|
|
18
|
+
console.error("Error retrieving app metadata. Skipping", e)
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!metadata.url) {
|
|
23
|
+
const context = {
|
|
24
|
+
request: {
|
|
25
|
+
body: {
|
|
26
|
+
name: metadata.name,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
}
|
|
30
|
+
metadata.url = getAppUrl(context)
|
|
31
|
+
console.log(`Adding url to app: ${metadata.url}`)
|
|
32
|
+
await appDb.put(metadata)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { runQuotaMigration } from "./usageQuotas"
|
|
2
|
+
import * as syncApps from "./usageQuotas/syncApps"
|
|
3
|
+
import * as syncRows from "./usageQuotas/syncRows"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Date:
|
|
7
|
+
* January 2022
|
|
8
|
+
*
|
|
9
|
+
* Description:
|
|
10
|
+
* Synchronise the app and row quotas to the state of the db after it was
|
|
11
|
+
* discovered that the quota resets were still in place and the row quotas
|
|
12
|
+
* weren't being decremented correctly.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const run = async () => {
|
|
16
|
+
await runQuotaMigration(async () => {
|
|
17
|
+
await syncApps.run()
|
|
18
|
+
await syncRows.run()
|
|
19
|
+
})
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { DocumentTypes } = require("@budibase/backend-core/db")
|
|
2
|
+
const env = require("../../../environment")
|
|
3
|
+
const TestConfig = require("../../../tests/utilities/TestConfiguration")
|
|
4
|
+
|
|
5
|
+
const migration = require("../appUrls")
|
|
6
|
+
|
|
7
|
+
describe("run", () => {
|
|
8
|
+
let config = new TestConfig(false)
|
|
9
|
+
const CouchDB = config.getCouch()
|
|
10
|
+
|
|
11
|
+
beforeEach(async () => {
|
|
12
|
+
await config.init()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterAll(config.end)
|
|
16
|
+
|
|
17
|
+
it("runs successfully", async () => {
|
|
18
|
+
const app = await config.createApp("testApp")
|
|
19
|
+
const appDb = new CouchDB(app.appId)
|
|
20
|
+
let metadata = await appDb.get(DocumentTypes.APP_METADATA)
|
|
21
|
+
delete metadata.url
|
|
22
|
+
await appDb.put(metadata)
|
|
23
|
+
|
|
24
|
+
await migration.run(appDb)
|
|
25
|
+
|
|
26
|
+
metadata = await appDb.get(DocumentTypes.APP_METADATA)
|
|
27
|
+
expect(metadata.url).toEqual("/testapp")
|
|
28
|
+
})
|
|
29
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const env = require("../../../environment")
|
|
2
|
+
const TestConfig = require("../../../tests/utilities/TestConfiguration")
|
|
3
|
+
|
|
4
|
+
const syncApps = jest.fn()
|
|
5
|
+
const syncRows = jest.fn()
|
|
6
|
+
|
|
7
|
+
jest.mock("../usageQuotas/syncApps", () => ({ run: syncApps }) )
|
|
8
|
+
jest.mock("../usageQuotas/syncRows", () => ({ run: syncRows }) )
|
|
9
|
+
|
|
10
|
+
const migration = require("../quotas1")
|
|
11
|
+
|
|
12
|
+
describe("run", () => {
|
|
13
|
+
let config = new TestConfig(false)
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
await config.init()
|
|
17
|
+
env._set("USE_QUOTAS", 1)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
afterAll(config.end)
|
|
21
|
+
|
|
22
|
+
it("runs ", async () => {
|
|
23
|
+
await migration.run()
|
|
24
|
+
expect(syncApps).toHaveBeenCalledTimes(1)
|
|
25
|
+
expect(syncRows).toHaveBeenCalledTimes(1)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const TestConfig = require("../../../tests/utilities/TestConfiguration")
|
|
2
|
+
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
|
3
|
+
|
|
4
|
+
// mock email view creation
|
|
5
|
+
const coreDb = require("@budibase/backend-core/db")
|
|
6
|
+
const createUserEmailView = jest.fn()
|
|
7
|
+
coreDb.createUserEmailView = createUserEmailView
|
|
8
|
+
|
|
9
|
+
const migration = require("../userEmailViewCasing")
|
|
10
|
+
|
|
11
|
+
describe("run", () => {
|
|
12
|
+
let config = new TestConfig(false)
|
|
13
|
+
const globalDb = getGlobalDB()
|
|
14
|
+
|
|
15
|
+
beforeEach(async () => {
|
|
16
|
+
await config.init()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterAll(config.end)
|
|
20
|
+
|
|
21
|
+
it("runs successfully", async () => {
|
|
22
|
+
await migration.run(globalDb)
|
|
23
|
+
expect(createUserEmailView).toHaveBeenCalledTimes(1)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { getGlobalDB, getTenantId } = require("@budibase/backend-core/tenancy")
|
|
2
|
+
const { getAllApps } = require("@budibase/backend-core/db")
|
|
3
|
+
import CouchDB from "../../../db"
|
|
4
|
+
import { getUsageQuotaDoc } from "../../../utilities/usageQuota"
|
|
5
|
+
|
|
6
|
+
export const run = async () => {
|
|
7
|
+
const db = getGlobalDB()
|
|
8
|
+
// get app count
|
|
9
|
+
const devApps = await getAllApps(CouchDB, { dev: true })
|
|
10
|
+
const appCount = devApps ? devApps.length : 0
|
|
11
|
+
|
|
12
|
+
// sync app count
|
|
13
|
+
const tenantId = getTenantId()
|
|
14
|
+
console.log(`[Tenant: ${tenantId}] Syncing app count: ${appCount}`)
|
|
15
|
+
const usageDoc = await getUsageQuotaDoc(db)
|
|
16
|
+
usageDoc.usageQuota.apps = appCount
|
|
17
|
+
await db.put(usageDoc)
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const { getGlobalDB, getTenantId } = require("@budibase/backend-core/tenancy")
|
|
2
|
+
const { getAllApps } = require("@budibase/backend-core/db")
|
|
3
|
+
import CouchDB from "../../../db"
|
|
4
|
+
import { getUsageQuotaDoc } from "../../../utilities/usageQuota"
|
|
5
|
+
import { getUniqueRows } from "../../../utilities/usageQuota/rows"
|
|
6
|
+
|
|
7
|
+
export const run = async () => {
|
|
8
|
+
const db = getGlobalDB()
|
|
9
|
+
// get all rows in all apps
|
|
10
|
+
const allApps = await getAllApps(CouchDB, { all: true })
|
|
11
|
+
const appIds = allApps ? allApps.map((app: { appId: any }) => app.appId) : []
|
|
12
|
+
const rows = await getUniqueRows(appIds)
|
|
13
|
+
const rowCount = rows ? rows.length : 0
|
|
14
|
+
|
|
15
|
+
// sync row count
|
|
16
|
+
const tenantId = getTenantId()
|
|
17
|
+
console.log(`[Tenant: ${tenantId}] Syncing row count: ${rowCount}`)
|
|
18
|
+
const usageDoc = await getUsageQuotaDoc(db)
|
|
19
|
+
usageDoc.usageQuota.rows = rowCount
|
|
20
|
+
await db.put(usageDoc)
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
|
2
|
+
const TestConfig = require("../../../../tests/utilities/TestConfiguration")
|
|
3
|
+
const { getUsageQuotaDoc, update, Properties } = require("../../../../utilities/usageQuota")
|
|
4
|
+
const syncApps = require("../syncApps")
|
|
5
|
+
const env = require("../../../../environment")
|
|
6
|
+
|
|
7
|
+
describe("syncApps", () => {
|
|
8
|
+
let config = new TestConfig(false)
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await config.init()
|
|
12
|
+
env._set("USE_QUOTAS", 1)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterAll(config.end)
|
|
16
|
+
|
|
17
|
+
it("runs successfully", async () => {
|
|
18
|
+
// create the usage quota doc and mock usages
|
|
19
|
+
const db = getGlobalDB()
|
|
20
|
+
await getUsageQuotaDoc(db)
|
|
21
|
+
await update(Properties.APPS, 3)
|
|
22
|
+
|
|
23
|
+
let usageDoc = await getUsageQuotaDoc(db)
|
|
24
|
+
expect(usageDoc.usageQuota.apps).toEqual(3)
|
|
25
|
+
|
|
26
|
+
// create an extra app to test the migration
|
|
27
|
+
await config.createApp("quota-test")
|
|
28
|
+
|
|
29
|
+
// migrate
|
|
30
|
+
await syncApps.run()
|
|
31
|
+
|
|
32
|
+
// assert the migration worked
|
|
33
|
+
usageDoc = await getUsageQuotaDoc(db)
|
|
34
|
+
expect(usageDoc.usageQuota.apps).toEqual(2)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
|
2
|
+
const TestConfig = require("../../../../tests/utilities/TestConfiguration")
|
|
3
|
+
const { getUsageQuotaDoc, update, Properties } = require("../../../../utilities/usageQuota")
|
|
4
|
+
const syncRows = require("../syncRows")
|
|
5
|
+
const env = require("../../../../environment")
|
|
6
|
+
|
|
7
|
+
describe("syncRows", () => {
|
|
8
|
+
let config = new TestConfig(false)
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await config.init()
|
|
12
|
+
env._set("USE_QUOTAS", 1)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterAll(config.end)
|
|
16
|
+
|
|
17
|
+
it("runs successfully", async () => {
|
|
18
|
+
// create the usage quota doc and mock usages
|
|
19
|
+
const db = getGlobalDB()
|
|
20
|
+
await getUsageQuotaDoc(db)
|
|
21
|
+
await update(Properties.ROW, 300)
|
|
22
|
+
|
|
23
|
+
let usageDoc = await getUsageQuotaDoc(db)
|
|
24
|
+
expect(usageDoc.usageQuota.rows).toEqual(300)
|
|
25
|
+
|
|
26
|
+
// app 1
|
|
27
|
+
await config.createTable()
|
|
28
|
+
await config.createRow()
|
|
29
|
+
// app 2
|
|
30
|
+
await config.createApp("second-app")
|
|
31
|
+
await config.createTable()
|
|
32
|
+
await config.createRow()
|
|
33
|
+
await config.createRow()
|
|
34
|
+
|
|
35
|
+
// migrate
|
|
36
|
+
await syncRows.run()
|
|
37
|
+
|
|
38
|
+
// assert the migration worked
|
|
39
|
+
usageDoc = await getUsageQuotaDoc(db)
|
|
40
|
+
expect(usageDoc.usageQuota.rows).toEqual(3)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { createUserEmailView } = require("@budibase/backend-core/db")
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Date:
|
|
5
|
+
* October 2021
|
|
6
|
+
*
|
|
7
|
+
* Description:
|
|
8
|
+
* Recreate the user email view to include latest changes i.e. lower casing the email address
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const run = async (db: any) => {
|
|
12
|
+
await createUserEmailView(db)
|
|
13
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import CouchDB from "../db"
|
|
2
|
+
const {
|
|
3
|
+
MIGRATION_TYPES,
|
|
4
|
+
runMigrations,
|
|
5
|
+
} = require("@budibase/backend-core/migrations")
|
|
6
|
+
|
|
7
|
+
// migration functions
|
|
8
|
+
import * as userEmailViewCasing from "./functions/userEmailViewCasing"
|
|
9
|
+
import * as quota1 from "./functions/quotas1"
|
|
10
|
+
import * as appUrls from "./functions/appUrls"
|
|
11
|
+
|
|
12
|
+
export interface Migration {
|
|
13
|
+
type: string
|
|
14
|
+
name: string
|
|
15
|
+
opts?: object
|
|
16
|
+
fn: Function
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* e.g.
|
|
21
|
+
* {
|
|
22
|
+
* tenantIds: ['bb'],
|
|
23
|
+
* force: {
|
|
24
|
+
* global: ['quota_1']
|
|
25
|
+
* }
|
|
26
|
+
* }
|
|
27
|
+
*/
|
|
28
|
+
export interface MigrationOptions {
|
|
29
|
+
tenantIds?: string[]
|
|
30
|
+
forced?: {
|
|
31
|
+
[type: string]: string[]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const MIGRATIONS: Migration[] = [
|
|
36
|
+
{
|
|
37
|
+
type: MIGRATION_TYPES.GLOBAL,
|
|
38
|
+
name: "user_email_view_casing",
|
|
39
|
+
fn: userEmailViewCasing.run,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
type: MIGRATION_TYPES.GLOBAL,
|
|
43
|
+
name: "quotas_1",
|
|
44
|
+
fn: quota1.run,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: MIGRATION_TYPES.APP,
|
|
48
|
+
name: "app_urls",
|
|
49
|
+
opts: { all: true },
|
|
50
|
+
fn: appUrls.run,
|
|
51
|
+
},
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
export const migrate = async (options?: MigrationOptions) => {
|
|
55
|
+
await runMigrations(CouchDB, MIGRATIONS, options)
|
|
56
|
+
}
|
|
@@ -22,10 +22,12 @@ const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
|
|
22
22
|
const { createASession } = require("@budibase/backend-core/sessions")
|
|
23
23
|
const { user: userCache } = require("@budibase/backend-core/cache")
|
|
24
24
|
const CouchDB = require("../../db")
|
|
25
|
+
const newid = require("../../db/newid")
|
|
25
26
|
core.init(CouchDB)
|
|
26
27
|
|
|
27
28
|
const GLOBAL_USER_ID = "us_uuid1"
|
|
28
29
|
const EMAIL = "babs@babs.com"
|
|
30
|
+
const CSRF_TOKEN = "e3727778-7af0-4226-b5eb-f43cbe60a306"
|
|
29
31
|
|
|
30
32
|
class TestConfiguration {
|
|
31
33
|
constructor(openServer = true) {
|
|
@@ -48,6 +50,10 @@ class TestConfiguration {
|
|
|
48
50
|
return this.appId
|
|
49
51
|
}
|
|
50
52
|
|
|
53
|
+
getCouch() {
|
|
54
|
+
return CouchDB
|
|
55
|
+
}
|
|
56
|
+
|
|
51
57
|
async _req(config, params, controlFunc) {
|
|
52
58
|
const request = {}
|
|
53
59
|
// fake cookies, we don't need them
|
|
@@ -85,7 +91,11 @@ class TestConfiguration {
|
|
|
85
91
|
roles: roles || {},
|
|
86
92
|
tenantId: TENANT_ID,
|
|
87
93
|
}
|
|
88
|
-
await createASession(id, {
|
|
94
|
+
await createASession(id, {
|
|
95
|
+
sessionId: "sessionid",
|
|
96
|
+
tenantId: TENANT_ID,
|
|
97
|
+
csrfToken: CSRF_TOKEN,
|
|
98
|
+
})
|
|
89
99
|
if (builder) {
|
|
90
100
|
user.builder = { global: true }
|
|
91
101
|
} else {
|
|
@@ -98,7 +108,8 @@ class TestConfiguration {
|
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
110
|
|
|
101
|
-
|
|
111
|
+
// use a new id as the name to avoid name collisions
|
|
112
|
+
async init(appName = newid()) {
|
|
102
113
|
await this.globalUser()
|
|
103
114
|
return this.createApp(appName)
|
|
104
115
|
}
|
|
@@ -131,6 +142,7 @@ class TestConfiguration {
|
|
|
131
142
|
`${Cookies.Auth}=${authToken}`,
|
|
132
143
|
`${Cookies.CurrentApp}=${appToken}`,
|
|
133
144
|
],
|
|
145
|
+
[Headers.CSRF_TOKEN]: CSRF_TOKEN,
|
|
134
146
|
}
|
|
135
147
|
if (this.appId) {
|
|
136
148
|
headers[Headers.APP_ID] = this.appId
|
|
@@ -424,10 +436,6 @@ class TestConfiguration {
|
|
|
424
436
|
roles: { [this.prodAppId]: roleId },
|
|
425
437
|
})
|
|
426
438
|
}
|
|
427
|
-
await createASession(userId, {
|
|
428
|
-
sessionId: "sessionid",
|
|
429
|
-
tenantId: TENANT_ID,
|
|
430
|
-
})
|
|
431
439
|
// have to fake this
|
|
432
440
|
const auth = {
|
|
433
441
|
userId,
|