@budibase/worker 2.1.22-alpha.3 → 2.1.22-alpha.5
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__/aws-sdk.ts +15 -0
- package/__mocks__/node-fetch.ts +1 -0
- package/coverage/clover.xml +2079 -0
- package/coverage/coverage-final.json +73 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +431 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/api/controllers/global/auth.ts.html +901 -0
- package/coverage/lcov-report/src/api/controllers/global/configs.js.html +1390 -0
- package/coverage/lcov-report/src/api/controllers/global/email.js.html +193 -0
- package/coverage/lcov-report/src/api/controllers/global/index.html +236 -0
- package/coverage/lcov-report/src/api/controllers/global/license.ts.html +187 -0
- package/coverage/lcov-report/src/api/controllers/global/roles.js.html +289 -0
- package/coverage/lcov-report/src/api/controllers/global/self.ts.html +577 -0
- package/coverage/lcov-report/src/api/controllers/global/templates.ts.html +316 -0
- package/coverage/lcov-report/src/api/controllers/global/users.ts.html +790 -0
- package/coverage/lcov-report/src/api/controllers/global/workspaces.js.html +253 -0
- package/coverage/lcov-report/src/api/controllers/system/accounts.ts.html +148 -0
- package/coverage/lcov-report/src/api/controllers/system/environment.js.html +121 -0
- package/coverage/lcov-report/src/api/controllers/system/index.html +191 -0
- package/coverage/lcov-report/src/api/controllers/system/migrations.ts.html +124 -0
- package/coverage/lcov-report/src/api/controllers/system/restore.ts.html +124 -0
- package/coverage/lcov-report/src/api/controllers/system/status.js.html +130 -0
- package/coverage/lcov-report/src/api/controllers/system/tenants.ts.html +283 -0
- package/coverage/lcov-report/src/api/index.html +116 -0
- package/coverage/lcov-report/src/api/index.ts.html +514 -0
- package/coverage/lcov-report/src/api/routes/global/auth.js.html +400 -0
- package/coverage/lcov-report/src/api/routes/global/configs.js.html +460 -0
- package/coverage/lcov-report/src/api/routes/global/email.js.html +196 -0
- package/coverage/lcov-report/src/api/routes/global/index.html +236 -0
- package/coverage/lcov-report/src/api/routes/global/license.ts.html +124 -0
- package/coverage/lcov-report/src/api/routes/global/roles.js.html +121 -0
- package/coverage/lcov-report/src/api/routes/global/self.ts.html +139 -0
- package/coverage/lcov-report/src/api/routes/global/templates.ts.html +196 -0
- package/coverage/lcov-report/src/api/routes/global/users.js.html +403 -0
- package/coverage/lcov-report/src/api/routes/global/workspaces.js.html +199 -0
- package/coverage/lcov-report/src/api/routes/index.html +116 -0
- package/coverage/lcov-report/src/api/routes/index.ts.html +193 -0
- package/coverage/lcov-report/src/api/routes/system/accounts.ts.html +142 -0
- package/coverage/lcov-report/src/api/routes/system/environment.js.html +109 -0
- package/coverage/lcov-report/src/api/routes/system/index.html +191 -0
- package/coverage/lcov-report/src/api/routes/system/migrations.ts.html +142 -0
- package/coverage/lcov-report/src/api/routes/system/restore.ts.html +109 -0
- package/coverage/lcov-report/src/api/routes/system/status.js.html +109 -0
- package/coverage/lcov-report/src/api/routes/system/tenants.js.html +121 -0
- package/coverage/lcov-report/src/api/routes/validation/index.html +131 -0
- package/coverage/lcov-report/src/api/routes/validation/index.ts.html +88 -0
- package/coverage/lcov-report/src/api/routes/validation/users.ts.html +235 -0
- package/coverage/lcov-report/src/constants/index.html +116 -0
- package/coverage/lcov-report/src/constants/index.js.html +634 -0
- package/coverage/lcov-report/src/constants/templates/index.html +116 -0
- package/coverage/lcov-report/src/constants/templates/index.js.html +304 -0
- package/coverage/lcov-report/src/db/index.html +116 -0
- package/coverage/lcov-report/src/db/index.ts.html +115 -0
- package/coverage/lcov-report/src/environment.ts.html +364 -0
- package/coverage/lcov-report/src/index.html +131 -0
- package/coverage/lcov-report/src/index.ts.html +397 -0
- package/coverage/lcov-report/src/middleware/cloudRestricted.js.html +136 -0
- package/coverage/lcov-report/src/middleware/index.html +116 -0
- package/coverage/lcov-report/src/migrations/functions/globalInfoSyncUsers.ts.html +145 -0
- package/coverage/lcov-report/src/migrations/functions/index.html +116 -0
- package/coverage/lcov-report/src/migrations/index.html +116 -0
- package/coverage/lcov-report/src/migrations/index.ts.html +271 -0
- package/coverage/lcov-report/src/sdk/accounts/accounts.ts.html +262 -0
- package/coverage/lcov-report/src/sdk/accounts/index.html +131 -0
- package/coverage/lcov-report/src/sdk/accounts/index.ts.html +88 -0
- package/coverage/lcov-report/src/sdk/index.html +116 -0
- package/coverage/lcov-report/src/sdk/index.ts.html +106 -0
- package/coverage/lcov-report/src/sdk/users/events.ts.html +577 -0
- package/coverage/lcov-report/src/sdk/users/index.html +146 -0
- package/coverage/lcov-report/src/sdk/users/index.ts.html +88 -0
- package/coverage/lcov-report/src/sdk/users/users.ts.html +1903 -0
- package/coverage/lcov-report/src/tests/TestConfiguration.ts.html +904 -0
- package/coverage/lcov-report/src/tests/api/accounts.ts.html +169 -0
- package/coverage/lcov-report/src/tests/api/auth.ts.html +229 -0
- package/coverage/lcov-report/src/tests/api/configs.ts.html +205 -0
- package/coverage/lcov-report/src/tests/api/email.ts.html +157 -0
- package/coverage/lcov-report/src/tests/api/index.html +206 -0
- package/coverage/lcov-report/src/tests/api/index.ts.html +160 -0
- package/coverage/lcov-report/src/tests/api/self.ts.html +148 -0
- package/coverage/lcov-report/src/tests/api/users.ts.html +415 -0
- package/coverage/lcov-report/src/tests/controllers.js.html +106 -0
- package/coverage/lcov-report/src/tests/index.html +146 -0
- package/coverage/lcov-report/src/tests/index.ts.html +127 -0
- package/coverage/lcov-report/src/tests/mocks/email.js.html +115 -0
- package/coverage/lcov-report/src/tests/mocks/index.html +131 -0
- package/coverage/lcov-report/src/tests/mocks/index.ts.html +106 -0
- package/coverage/lcov-report/src/tests/structures/accounts.ts.html +157 -0
- package/coverage/lcov-report/src/tests/structures/configs.js.html +313 -0
- package/coverage/lcov-report/src/tests/structures/groups.ts.html +118 -0
- package/coverage/lcov-report/src/tests/structures/index.html +176 -0
- package/coverage/lcov-report/src/tests/structures/index.ts.html +145 -0
- package/coverage/lcov-report/src/tests/structures/users.ts.html +193 -0
- package/coverage/lcov-report/src/utilities/appService.js.html +184 -0
- package/coverage/lcov-report/src/utilities/email.js.html +751 -0
- package/coverage/lcov-report/src/utilities/fileSystem.js.html +100 -0
- package/coverage/lcov-report/src/utilities/index.html +206 -0
- package/coverage/lcov-report/src/utilities/index.js.html +112 -0
- package/coverage/lcov-report/src/utilities/redis.js.html +409 -0
- package/coverage/lcov-report/src/utilities/templates.js.html +232 -0
- package/coverage/lcov-report/src/utilities/users.js.html +136 -0
- package/coverage/lcov.info +3748 -0
- package/jest.config.ts +28 -0
- package/package.json +11 -23
- package/src/db/index.ts +10 -0
- package/src/index.ts +1 -1
- package/src/tests/TestConfiguration.ts +1 -1
- package/src/tests/index.ts +1 -1
- package/{scripts/jestSetup.js → src/tests/jestSetup.ts} +5 -2
- package/tsconfig.build.json +5 -5
- package/tsconfig.json +3 -1
- package/src/db/index.js +0 -11
package/jest.config.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Config } from "@jest/types"
|
|
2
|
+
import * as fs from "fs"
|
|
3
|
+
|
|
4
|
+
const config: Config.InitialOptions = {
|
|
5
|
+
preset: "ts-jest",
|
|
6
|
+
testEnvironment: "node",
|
|
7
|
+
setupFiles: ["./src/tests/jestSetup.ts"],
|
|
8
|
+
collectCoverageFrom: ["src/**/*.{js,ts}"],
|
|
9
|
+
coverageReporters: ["lcov", "json", "clover"],
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (!process.env.CI) {
|
|
13
|
+
// use sources when not in CI
|
|
14
|
+
config.moduleNameMapper = {
|
|
15
|
+
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
|
16
|
+
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
|
17
|
+
"@budibase/types": "<rootDir>/../types/src",
|
|
18
|
+
}
|
|
19
|
+
// add pro sources if they exist
|
|
20
|
+
if (fs.existsSync("../../../budibase-pro")) {
|
|
21
|
+
config.moduleNameMapper["@budibase/pro"] =
|
|
22
|
+
"<rootDir>/../../../budibase-pro/packages/pro/src"
|
|
23
|
+
}
|
|
24
|
+
} else {
|
|
25
|
+
console.log("Running tests with compiled dependency sources")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export default config
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.1.22-alpha.
|
|
4
|
+
"version": "2.1.22-alpha.5",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION",
|
|
23
23
|
"dev:stack:init": "node ./scripts/dev/manage.js init",
|
|
24
24
|
"dev:builder": "npm run dev:stack:init && nodemon",
|
|
25
|
-
"test": "jest --runInBand",
|
|
25
|
+
"test": "jest --coverage --runInBand",
|
|
26
26
|
"test:watch": "jest --watch",
|
|
27
27
|
"env:multi:enable": "node scripts/multiTenancy.js enable",
|
|
28
28
|
"env:multi:disable": "node scripts/multiTenancy.js disable",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"author": "Budibase",
|
|
37
37
|
"license": "GPL-3.0",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@budibase/backend-core": "2.1.22-alpha.
|
|
40
|
-
"@budibase/pro": "2.1.22-alpha.
|
|
41
|
-
"@budibase/string-templates": "2.1.22-alpha.
|
|
42
|
-
"@budibase/types": "2.1.22-alpha.
|
|
39
|
+
"@budibase/backend-core": "2.1.22-alpha.5",
|
|
40
|
+
"@budibase/pro": "2.1.22-alpha.4",
|
|
41
|
+
"@budibase/string-templates": "2.1.22-alpha.5",
|
|
42
|
+
"@budibase/types": "2.1.22-alpha.5",
|
|
43
43
|
"@koa/router": "8.0.8",
|
|
44
44
|
"@sentry/node": "6.17.7",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -79,30 +79,18 @@
|
|
|
79
79
|
"@typescript-eslint/parser": "5.12.0",
|
|
80
80
|
"copyfiles": "2.4.1",
|
|
81
81
|
"eslint": "6.8.0",
|
|
82
|
-
"jest": "
|
|
82
|
+
"jest": "28.1.1",
|
|
83
83
|
"nodemon": "2.0.15",
|
|
84
84
|
"pouchdb-adapter-memory": "7.2.2",
|
|
85
85
|
"prettier": "2.3.1",
|
|
86
86
|
"rimraf": "3.0.2",
|
|
87
87
|
"supertest": "6.2.2",
|
|
88
88
|
"timekeeper": "2.2.0",
|
|
89
|
-
"ts-jest": "
|
|
90
|
-
"ts-node": "10.
|
|
89
|
+
"ts-jest": "28.0.4",
|
|
90
|
+
"ts-node": "10.8.1",
|
|
91
91
|
"tsconfig-paths": "4.0.0",
|
|
92
|
-
"typescript": "4.
|
|
92
|
+
"typescript": "4.7.3",
|
|
93
93
|
"update-dotenv": "1.1.1"
|
|
94
94
|
},
|
|
95
|
-
"
|
|
96
|
-
"preset": "ts-jest",
|
|
97
|
-
"testEnvironment": "node",
|
|
98
|
-
"moduleNameMapper": {
|
|
99
|
-
"@budibase/backend-core/(.*)": "<rootDir>/../backend-core/$1",
|
|
100
|
-
"@budibase/backend-core": "<rootDir>/../backend-core/src",
|
|
101
|
-
"@budibase/types": "<rootDir>/../types/src"
|
|
102
|
-
},
|
|
103
|
-
"setupFiles": [
|
|
104
|
-
"./scripts/jestSetup.js"
|
|
105
|
-
]
|
|
106
|
-
},
|
|
107
|
-
"gitHead": "7c77ec1536796c407efaf67a2a0ad3fb47db687f"
|
|
95
|
+
"gitHead": "0367d466c3c566be54d45d040654929966c836ff"
|
|
108
96
|
}
|
package/src/db/index.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { Scope } from "@sentry/node"
|
|
|
13
13
|
import { Event } from "@sentry/types/dist/event"
|
|
14
14
|
import Application from "koa"
|
|
15
15
|
import { bootstrap } from "global-agent"
|
|
16
|
-
import db from "./db"
|
|
16
|
+
import * as db from "./db"
|
|
17
17
|
db.init()
|
|
18
18
|
const Koa = require("koa")
|
|
19
19
|
const destroyable = require("server-destroy")
|
package/src/tests/index.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import env from "../environment"
|
|
2
2
|
|
|
3
3
|
env._set("SELF_HOSTED", "1")
|
|
4
4
|
env._set("NODE_ENV", "jest")
|
|
5
5
|
env._set("JWT_SECRET", "test-jwtsecret")
|
|
6
6
|
env._set("LOG_LEVEL", "silent")
|
|
7
7
|
env._set("MULTI_TENANCY", true)
|
|
8
|
+
env._set("MINIO_URL", "http://localhost")
|
|
9
|
+
env._set("MINIO_ACCESS_KEY", "test")
|
|
10
|
+
env._set("MINIO_SECRET_KEY", "test")
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
import { mocks } from "@budibase/backend-core/tests"
|
|
10
13
|
|
|
11
14
|
// mock all dates to 2020-01-01T00:00:00.000Z
|
|
12
15
|
// use tk.reset() to use real dates in individual tests
|
package/tsconfig.build.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "es6",
|
|
4
|
+
"skipLibCheck": true,
|
|
4
5
|
"module": "commonjs",
|
|
5
6
|
"lib": ["es2020"],
|
|
6
7
|
"allowJs": true,
|
|
8
|
+
"outDir": "dist",
|
|
7
9
|
"strict": true,
|
|
8
10
|
"noImplicitAny": true,
|
|
9
11
|
"esModuleInterop": true,
|
|
10
12
|
"resolveJsonModule": true,
|
|
11
13
|
"incremental": true,
|
|
12
|
-
"types": [ "node", "jest"
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"skipLibCheck": true
|
|
14
|
+
"types": [ "node", "jest"],
|
|
15
15
|
},
|
|
16
16
|
"include": [
|
|
17
17
|
"src/**/*"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"node_modules",
|
|
21
21
|
"dist",
|
|
22
22
|
"src/tests",
|
|
23
|
-
"**/*.spec.
|
|
24
|
-
"**/*.spec.
|
|
23
|
+
"**/*.spec.js",
|
|
24
|
+
"**/*.spec.ts"
|
|
25
25
|
]
|
|
26
26
|
}
|
package/tsconfig.json
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"paths": {
|
|
9
9
|
"@budibase/types": ["../types/src"],
|
|
10
10
|
"@budibase/backend-core": ["../backend-core/src"],
|
|
11
|
-
"@budibase/backend-core/*": ["../backend-core/*"]
|
|
11
|
+
"@budibase/backend-core/*": ["../backend-core/*"],
|
|
12
|
+
"@budibase/pro": ["../../../budibase-pro/packages/pro/src"]
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"ts-node": {
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
"references": [
|
|
18
19
|
{ "path": "../types" },
|
|
19
20
|
{ "path": "../backend-core" },
|
|
21
|
+
{ "path": "../../../budibase-pro/packages/pro" }
|
|
20
22
|
],
|
|
21
23
|
"include": [
|
|
22
24
|
"src/**/*",
|
package/src/db/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const core = require("@budibase/backend-core")
|
|
2
|
-
const env = require("../environment")
|
|
3
|
-
|
|
4
|
-
exports.init = () => {
|
|
5
|
-
const dbConfig = {}
|
|
6
|
-
if (env.isTest() && !env.COUCH_DB_URL) {
|
|
7
|
-
dbConfig.inMemory = true
|
|
8
|
-
dbConfig.allDbs = true
|
|
9
|
-
}
|
|
10
|
-
core.init({ db: dbConfig })
|
|
11
|
-
}
|