@budibase/server 2.5.6-alpha.16 → 2.5.6-alpha.18
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.c0265b74.css → index.7ec21ee2.css} +2 -2
- package/builder/assets/{index.46394ade.js → index.7f7f4441.js} +339 -322
- package/builder/index.html +2 -2
- package/dist/migrations/functions/syncQuotas.js +2 -0
- package/dist/migrations/functions/usageQuotas/syncApps.js +0 -1
- package/dist/migrations/functions/usageQuotas/syncUsers.js +21 -0
- package/dist/package.json +7 -7
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/migrations/functions/syncQuotas.ts +2 -0
- package/src/migrations/functions/usageQuotas/syncApps.ts +1 -2
- package/src/migrations/functions/usageQuotas/syncUsers.ts +9 -0
- package/src/migrations/functions/usageQuotas/tests/syncUsers.spec.ts +26 -0
- package/src/migrations/index.ts +1 -0
- package/src/migrations/functions/tests/syncQuotas.spec.js +0 -26
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.5.6-alpha.
|
|
4
|
+
"version": "2.5.6-alpha.18",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
"license": "GPL-3.0",
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
48
|
-
"@budibase/backend-core": "2.5.6-alpha.
|
|
49
|
-
"@budibase/client": "2.5.6-alpha.
|
|
50
|
-
"@budibase/pro": "2.5.6-alpha.
|
|
51
|
-
"@budibase/shared-core": "2.5.6-alpha.
|
|
52
|
-
"@budibase/string-templates": "2.5.6-alpha.
|
|
53
|
-
"@budibase/types": "2.5.6-alpha.
|
|
48
|
+
"@budibase/backend-core": "2.5.6-alpha.18",
|
|
49
|
+
"@budibase/client": "2.5.6-alpha.18",
|
|
50
|
+
"@budibase/pro": "2.5.6-alpha.17",
|
|
51
|
+
"@budibase/shared-core": "2.5.6-alpha.18",
|
|
52
|
+
"@budibase/string-templates": "2.5.6-alpha.18",
|
|
53
|
+
"@budibase/types": "2.5.6-alpha.18",
|
|
54
54
|
"@bull-board/api": "3.7.0",
|
|
55
55
|
"@bull-board/koa": "3.9.4",
|
|
56
56
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -176,5 +176,5 @@
|
|
|
176
176
|
"optionalDependencies": {
|
|
177
177
|
"oracledb": "5.3.0"
|
|
178
178
|
},
|
|
179
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "4538a362bc2ac1be1e2089a79cec321d87b0d790"
|
|
180
180
|
}
|
|
@@ -2,6 +2,7 @@ import { runQuotaMigration } from "./usageQuotas"
|
|
|
2
2
|
import * as syncApps from "./usageQuotas/syncApps"
|
|
3
3
|
import * as syncRows from "./usageQuotas/syncRows"
|
|
4
4
|
import * as syncPlugins from "./usageQuotas/syncPlugins"
|
|
5
|
+
import * as syncUsers from "./usageQuotas/syncUsers"
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Synchronise quotas to the state of the db.
|
|
@@ -11,5 +12,6 @@ export const run = async () => {
|
|
|
11
12
|
await syncApps.run()
|
|
12
13
|
await syncRows.run()
|
|
13
14
|
await syncPlugins.run()
|
|
15
|
+
await syncUsers.run()
|
|
14
16
|
})
|
|
15
17
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { db as dbCore } from "@budibase/backend-core"
|
|
2
2
|
import { quotas } from "@budibase/pro"
|
|
3
3
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
|
4
4
|
|
|
@@ -8,7 +8,6 @@ export const run = async () => {
|
|
|
8
8
|
const appCount = devApps ? devApps.length : 0
|
|
9
9
|
|
|
10
10
|
// sync app count
|
|
11
|
-
const tenantId = tenancy.getTenantId()
|
|
12
11
|
console.log(`Syncing app count: ${appCount}`)
|
|
13
12
|
await quotas.setUsage(appCount, StaticQuotaName.APPS, QuotaUsageType.STATIC)
|
|
14
13
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { users } from "@budibase/backend-core"
|
|
2
|
+
import { quotas } from "@budibase/pro"
|
|
3
|
+
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
|
4
|
+
|
|
5
|
+
export const run = async () => {
|
|
6
|
+
const userCount = await users.getUserCount()
|
|
7
|
+
console.log(`Syncing user count: ${userCount}`)
|
|
8
|
+
await quotas.setUsage(userCount, StaticQuotaName.USERS, QuotaUsageType.STATIC)
|
|
9
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
|
2
|
+
import * as syncUsers from "../syncUsers"
|
|
3
|
+
import { quotas } from "@budibase/pro"
|
|
4
|
+
|
|
5
|
+
describe("syncUsers", () => {
|
|
6
|
+
let config = new TestConfig(false)
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await config.init()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
afterAll(config.end)
|
|
13
|
+
|
|
14
|
+
it("syncs users", async () => {
|
|
15
|
+
return config.doInContext(null, async () => {
|
|
16
|
+
await config.createUser()
|
|
17
|
+
|
|
18
|
+
await syncUsers.run()
|
|
19
|
+
|
|
20
|
+
const usageDoc = await quotas.getQuotaUsage()
|
|
21
|
+
// default + additional user
|
|
22
|
+
const userCount = 2
|
|
23
|
+
expect(usageDoc.usageQuota.users).toBe(userCount)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
})
|
package/src/migrations/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ import env from "../environment"
|
|
|
11
11
|
// migration functions
|
|
12
12
|
import * as userEmailViewCasing from "./functions/userEmailViewCasing"
|
|
13
13
|
import * as syncQuotas from "./functions/syncQuotas"
|
|
14
|
+
import * as syncUsers from "./functions/usageQuotas/syncUsers"
|
|
14
15
|
import * as appUrls from "./functions/appUrls"
|
|
15
16
|
import * as tableSettings from "./functions/tableSettings"
|
|
16
17
|
import * as backfill from "./functions/backfill"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const syncApps = jest.fn()
|
|
2
|
-
const syncRows = jest.fn()
|
|
3
|
-
const syncPlugins = jest.fn()
|
|
4
|
-
jest.mock("../usageQuotas/syncApps", () => ({ run: syncApps }) )
|
|
5
|
-
jest.mock("../usageQuotas/syncRows", () => ({ run: syncRows }) )
|
|
6
|
-
jest.mock("../usageQuotas/syncPlugins", () => ({ run: syncPlugins }) )
|
|
7
|
-
|
|
8
|
-
const TestConfig = require("../../../tests/utilities/TestConfiguration")
|
|
9
|
-
const migration = require("../syncQuotas")
|
|
10
|
-
|
|
11
|
-
describe("run", () => {
|
|
12
|
-
let config = new TestConfig(false)
|
|
13
|
-
|
|
14
|
-
beforeAll(async () => {
|
|
15
|
-
await config.init()
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
afterAll(config.end)
|
|
19
|
-
|
|
20
|
-
it("run", async () => {
|
|
21
|
-
await migration.run()
|
|
22
|
-
expect(syncApps).toHaveBeenCalledTimes(1)
|
|
23
|
-
expect(syncRows).toHaveBeenCalledTimes(1)
|
|
24
|
-
expect(syncPlugins).toHaveBeenCalledTimes(1)
|
|
25
|
-
})
|
|
26
|
-
})
|