@budibase/server 2.4.42 → 2.4.44-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/node-fetch.ts +6 -1
- package/builder/assets/{index.3d64bc07.js → index.6846a382.js} +385 -384
- package/builder/assets/index.7f9a008b.css +6 -0
- package/builder/index.html +7 -7
- package/dist/api/controllers/application.js +28 -24
- package/dist/api/controllers/public/metrics.js +113 -0
- package/dist/api/controllers/row/external.js +15 -0
- package/dist/api/controllers/row/utils.js +4 -3
- package/dist/api/controllers/static/index.js +84 -24
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +34 -11
- package/dist/api/controllers/table/utils.js +2 -4
- package/dist/api/routes/public/index.js +8 -0
- package/dist/api/routes/public/metrics.js +30 -0
- package/dist/app.js +1 -0
- package/dist/integrations/googlesheets.js +4 -0
- package/dist/integrations/redis.js +1 -1
- package/dist/middleware/currentapp.js +1 -27
- package/dist/package.json +12 -11
- package/dist/sdk/users/utils.js +11 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/app.js +1 -10
- package/dist/utilities/fileSystem/filesystem.js +0 -4
- package/dist/utilities/global.js +17 -7
- package/jest.config.ts +2 -0
- package/package.json +13 -12
- package/scripts/test.sh +6 -4
- package/specs/openapi.json +39 -0
- package/specs/openapi.yaml +169 -0
- package/specs/resources/application.ts +11 -0
- package/specs/resources/index.ts +2 -0
- package/specs/resources/metrics.ts +81 -0
- package/src/api/controllers/application.ts +20 -21
- package/src/api/controllers/component.ts +2 -2
- package/src/api/controllers/public/metrics.ts +251 -0
- package/src/api/controllers/row/external.ts +14 -0
- package/src/api/controllers/row/utils.ts +4 -3
- package/src/api/controllers/static/index.ts +69 -26
- package/src/api/controllers/static/templates/BudibaseApp.svelte +34 -11
- package/src/api/controllers/table/tests/utils.spec.ts +97 -0
- package/src/api/controllers/table/utils.ts +20 -12
- package/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap +48 -48
- package/src/api/routes/public/index.ts +10 -1
- package/src/api/routes/public/metrics.ts +28 -0
- package/src/api/routes/public/tests/metrics.spec.js +34 -0
- package/src/api/routes/tests/__snapshots__/datasource.spec.ts.snap +22 -22
- package/src/api/routes/tests/__snapshots__/view.spec.js.snap +5 -5
- package/src/api/routes/tests/appSync.spec.ts +31 -0
- package/src/api/routes/tests/internalSearch.spec.js +8 -7
- package/src/app.ts +2 -1
- package/src/automations/automationUtils.ts +1 -1
- package/src/automations/tests/automation.spec.ts +99 -0
- package/src/db/defaultData/datasource_bb_default.ts +1 -1
- package/src/definitions/openapi.ts +15 -0
- package/src/integration-test/postgres.spec.ts +46 -52
- package/src/integrations/googlesheets.ts +4 -0
- package/src/integrations/redis.ts +1 -1
- package/src/integrations/tests/googlesheets.spec.ts +13 -13
- package/src/integrations/tests/redis.spec.ts +9 -5
- package/src/middleware/currentapp.ts +3 -32
- package/src/middleware/tests/currentapp.spec.js +6 -42
- package/src/sdk/users/tests/utils.spec.ts +159 -0
- package/src/sdk/users/utils.ts +18 -7
- package/src/tests/jestEnv.ts +1 -0
- package/src/tests/jestSetup.ts +5 -1
- package/src/tests/utilities/TestConfiguration.ts +18 -19
- package/src/tests/utilities/structures.ts +13 -1
- package/src/utilities/fileSystem/app.ts +2 -9
- package/src/utilities/fileSystem/filesystem.ts +0 -4
- package/src/utilities/global.ts +21 -9
- package/src/utilities/rowProcessor/index.ts +1 -1
- package/builder/assets/favicon.e7fc7733.png +0 -0
- package/builder/assets/index.b0e3aca6.css +0 -6
- package/src/automations/tests/automation.spec.js +0 -84
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.43",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"debug": "yarn build && node --expose-gc --inspect=9222 dist/index.js",
|
|
16
16
|
"postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/",
|
|
17
17
|
"test": "bash scripts/test.sh",
|
|
18
|
+
"test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit",
|
|
18
19
|
"test:watch": "jest --watch",
|
|
19
20
|
"predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client",
|
|
20
21
|
"build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION",
|
|
@@ -43,12 +44,12 @@
|
|
|
43
44
|
"license": "GPL-3.0",
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "^2.4.
|
|
47
|
-
"@budibase/client": "^2.4.
|
|
48
|
-
"@budibase/pro": "2.4.
|
|
49
|
-
"@budibase/shared-core": "^2.4.
|
|
50
|
-
"@budibase/string-templates": "^2.4.
|
|
51
|
-
"@budibase/types": "^2.4.
|
|
47
|
+
"@budibase/backend-core": "^2.4.43",
|
|
48
|
+
"@budibase/client": "^2.4.43",
|
|
49
|
+
"@budibase/pro": "2.4.43",
|
|
50
|
+
"@budibase/shared-core": "^2.4.43",
|
|
51
|
+
"@budibase/string-templates": "^2.4.43",
|
|
52
|
+
"@budibase/types": "^2.4.43",
|
|
52
53
|
"@bull-board/api": "3.7.0",
|
|
53
54
|
"@bull-board/koa": "3.9.4",
|
|
54
55
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -125,7 +126,7 @@
|
|
|
125
126
|
"@babel/core": "7.17.4",
|
|
126
127
|
"@babel/preset-env": "7.16.11",
|
|
127
128
|
"@budibase/standard-components": "^0.9.139",
|
|
128
|
-
"@jest/test-sequencer": "
|
|
129
|
+
"@jest/test-sequencer": "29.5.0",
|
|
129
130
|
"@swc/core": "^1.3.25",
|
|
130
131
|
"@swc/jest": "^0.2.24",
|
|
131
132
|
"@trendyol/jest-testcontainers": "^2.1.1",
|
|
@@ -134,7 +135,7 @@
|
|
|
134
135
|
"@types/global-agent": "2.1.1",
|
|
135
136
|
"@types/google-spreadsheet": "3.1.5",
|
|
136
137
|
"@types/ioredis": "4.28.10",
|
|
137
|
-
"@types/jest": "
|
|
138
|
+
"@types/jest": "29.5.0",
|
|
138
139
|
"@types/koa": "2.13.4",
|
|
139
140
|
"@types/koa__router": "8.0.8",
|
|
140
141
|
"@types/lodash": "4.14.180",
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
"eslint": "6.8.0",
|
|
155
156
|
"ioredis-mock": "7.2.0",
|
|
156
157
|
"is-wsl": "2.2.0",
|
|
157
|
-
"jest": "
|
|
158
|
+
"jest": "29.5.0",
|
|
158
159
|
"jest-openapi": "0.14.2",
|
|
159
160
|
"jest-serial-runner": "^1.2.1",
|
|
160
161
|
"nodemon": "2.0.15",
|
|
@@ -166,7 +167,7 @@
|
|
|
166
167
|
"supertest": "6.2.2",
|
|
167
168
|
"swagger-jsdoc": "6.1.0",
|
|
168
169
|
"timekeeper": "2.2.0",
|
|
169
|
-
"ts-jest": "
|
|
170
|
+
"ts-jest": "29.0.5",
|
|
170
171
|
"ts-node": "10.8.1",
|
|
171
172
|
"tsconfig-paths": "4.0.0",
|
|
172
173
|
"typescript": "4.7.3",
|
package/dist/sdk/users/utils.js
CHANGED
|
@@ -15,16 +15,21 @@ const backend_core_1 = require("@budibase/backend-core");
|
|
|
15
15
|
const utils_1 = require("../../db/utils");
|
|
16
16
|
const lodash_1 = require("lodash");
|
|
17
17
|
function combineMetadataAndUser(user, metadata) {
|
|
18
|
+
const metadataId = (0, utils_1.generateUserMetadataID)(user._id);
|
|
19
|
+
const found = Array.isArray(metadata)
|
|
20
|
+
? metadata.find(doc => doc._id === metadataId)
|
|
21
|
+
: metadata;
|
|
18
22
|
// skip users with no access
|
|
19
|
-
if (user.roleId
|
|
23
|
+
if (user.roleId == null ||
|
|
24
|
+
user.roleId === backend_core_1.roles.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
25
|
+
// If it exists and it should not, we must remove it
|
|
26
|
+
if (found === null || found === void 0 ? void 0 : found._id) {
|
|
27
|
+
return Object.assign(Object.assign({}, found), { _deleted: true });
|
|
28
|
+
}
|
|
20
29
|
return null;
|
|
21
30
|
}
|
|
22
31
|
delete user._rev;
|
|
23
|
-
const metadataId = (0, utils_1.generateUserMetadataID)(user._id);
|
|
24
32
|
const newDoc = Object.assign(Object.assign({}, user), { _id: metadataId, tableId: utils_1.InternalTables.USER_METADATA });
|
|
25
|
-
const found = Array.isArray(metadata)
|
|
26
|
-
? metadata.find(doc => doc._id === metadataId)
|
|
27
|
-
: metadata;
|
|
28
33
|
// copy rev over for the purposes of equality check
|
|
29
34
|
if (found) {
|
|
30
35
|
newDoc._rev = found._rev;
|
|
@@ -54,7 +59,7 @@ function syncGlobalUsers() {
|
|
|
54
59
|
]);
|
|
55
60
|
const toWrite = [];
|
|
56
61
|
for (let user of users) {
|
|
57
|
-
const combined =
|
|
62
|
+
const combined = combineMetadataAndUser(user, metadata);
|
|
58
63
|
if (combined) {
|
|
59
64
|
toWrite.push(combined);
|
|
60
65
|
}
|