@budibase/worker 2.13.14 → 2.13.16
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/Dockerfile +28 -7
- package/__mocks__/node-fetch.ts +1 -0
- package/package.json +6 -6
- package/src/api/controllers/global/roles.ts +15 -3
- package/src/api/controllers/global/self.ts +1 -0
- package/src/api/controllers/global/users.ts +10 -21
- package/src/api/index.ts +2 -0
- package/src/api/routes/global/templates.ts +1 -0
- package/src/api/routes/global/tests/auth.spec.ts +1 -0
- package/src/api/routes/global/tests/configs.spec.ts +1 -0
- package/src/api/routes/global/tests/email.spec.ts +1 -0
- package/src/api/routes/global/tests/license.spec.ts +1 -0
- package/src/api/routes/global/tests/realEmail.spec.ts +1 -0
- package/src/api/routes/system/tests/status.spec.ts +1 -0
- package/src/index.ts +3 -2
- package/src/tests/TestConfiguration.ts +3 -0
- package/src/tests/jestSetup.ts +1 -0
- package/src/tests/mocks/index.ts +1 -0
- package/src/utilities/email.ts +1 -0
- package/Dockerfile.v2 +0 -58
package/Dockerfile
CHANGED
|
@@ -5,22 +5,38 @@ LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-ho
|
|
|
5
5
|
LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh"
|
|
6
6
|
LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh"
|
|
7
7
|
|
|
8
|
-
WORKDIR /app
|
|
9
8
|
|
|
10
9
|
# handle node-gyp
|
|
11
|
-
RUN apk add --no-cache --virtual .gyp python3 make g++
|
|
10
|
+
RUN apk add --no-cache --virtual .gyp python3 make g++ jq
|
|
12
11
|
RUN yarn global add pm2
|
|
13
12
|
|
|
13
|
+
WORKDIR /
|
|
14
|
+
|
|
15
|
+
COPY scripts/removeWorkspaceDependencies.sh scripts/removeWorkspaceDependencies.sh
|
|
16
|
+
RUN chmod +x ./scripts/removeWorkspaceDependencies.sh
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
WORKDIR /string-templates
|
|
20
|
+
COPY packages/string-templates/package.json package.json
|
|
21
|
+
RUN ../scripts/removeWorkspaceDependencies.sh package.json
|
|
22
|
+
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000
|
|
23
|
+
COPY packages/string-templates .
|
|
24
|
+
|
|
14
25
|
|
|
15
|
-
|
|
16
|
-
COPY
|
|
17
|
-
|
|
26
|
+
WORKDIR /app
|
|
27
|
+
COPY packages/worker/package.json .
|
|
28
|
+
COPY packages/worker/dist/yarn.lock .
|
|
29
|
+
RUN cd ../string-templates && yarn link && cd - && yarn link @budibase/string-templates
|
|
30
|
+
|
|
31
|
+
RUN ../scripts/removeWorkspaceDependencies.sh package.json
|
|
32
|
+
|
|
33
|
+
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000
|
|
18
34
|
# Remove unneeded data from file system to reduce image size
|
|
19
35
|
RUN apk del .gyp \
|
|
20
36
|
&& yarn cache clean
|
|
21
37
|
|
|
22
|
-
COPY dist/ dist/
|
|
23
|
-
COPY docker_run.sh .
|
|
38
|
+
COPY packages/worker/dist/ dist/
|
|
39
|
+
COPY packages/worker/docker_run.sh .
|
|
24
40
|
|
|
25
41
|
EXPOSE 4001
|
|
26
42
|
|
|
@@ -34,4 +50,9 @@ ENV POSTHOG_TOKEN=phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU
|
|
|
34
50
|
ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR
|
|
35
51
|
ENV ACCOUNT_PORTAL_URL=https://account.budibase.app
|
|
36
52
|
|
|
53
|
+
ARG BUDIBASE_VERSION
|
|
54
|
+
# Ensuring the version argument is sent
|
|
55
|
+
RUN test -n "$BUDIBASE_VERSION"
|
|
56
|
+
ENV BUDIBASE_VERSION=$BUDIBASE_VERSION
|
|
57
|
+
|
|
37
58
|
CMD ["./docker_run.sh"]
|
package/__mocks__/node-fetch.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.13.
|
|
4
|
+
"version": "2.13.16",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"author": "Budibase",
|
|
38
38
|
"license": "GPL-3.0",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@budibase/backend-core": "2.13.
|
|
41
|
-
"@budibase/pro": "2.13.
|
|
42
|
-
"@budibase/string-templates": "2.13.
|
|
43
|
-
"@budibase/types": "2.13.
|
|
40
|
+
"@budibase/backend-core": "2.13.16",
|
|
41
|
+
"@budibase/pro": "2.13.16",
|
|
42
|
+
"@budibase/string-templates": "2.13.16",
|
|
43
|
+
"@budibase/types": "2.13.16",
|
|
44
44
|
"@koa/router": "8.0.8",
|
|
45
45
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
46
46
|
"@types/global-agent": "2.1.1",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "ea1029726d55fb3604a8b1463e9ea159cdbd2aae"
|
|
111
111
|
}
|
|
@@ -51,10 +51,22 @@ export async function removeAppRole(ctx: Ctx) {
|
|
|
51
51
|
const users = await sdk.users.db.allUsers()
|
|
52
52
|
const bulk = []
|
|
53
53
|
const cacheInvalidations = []
|
|
54
|
+
const prodAppId = dbCore.getProdAppID(appId)
|
|
54
55
|
for (let user of users) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
let updated = false
|
|
57
|
+
if (user.roles[prodAppId]) {
|
|
58
|
+
cacheInvalidations.push(cache.user.invalidateUser(user._id!))
|
|
59
|
+
delete user.roles[prodAppId]
|
|
60
|
+
updated = true
|
|
61
|
+
}
|
|
62
|
+
if (user.builder && Array.isArray(user.builder?.apps)) {
|
|
63
|
+
const idx = user.builder.apps.indexOf(prodAppId)
|
|
64
|
+
if (idx !== -1) {
|
|
65
|
+
user.builder.apps.splice(idx, 1)
|
|
66
|
+
updated = true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (updated) {
|
|
58
70
|
bulk.push(user)
|
|
59
71
|
}
|
|
60
72
|
}
|
|
@@ -120,28 +120,17 @@ export const adminUser = async (
|
|
|
120
120
|
)
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
const user: User = {
|
|
124
|
-
email: email,
|
|
125
|
-
password: password,
|
|
126
|
-
createdAt: Date.now(),
|
|
127
|
-
roles: {},
|
|
128
|
-
builder: {
|
|
129
|
-
global: true,
|
|
130
|
-
},
|
|
131
|
-
admin: {
|
|
132
|
-
global: true,
|
|
133
|
-
},
|
|
134
|
-
tenantId,
|
|
135
|
-
ssoId,
|
|
136
|
-
}
|
|
137
123
|
try {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
124
|
+
const finalUser = await userSdk.db.createAdminUser(
|
|
125
|
+
email,
|
|
126
|
+
password,
|
|
127
|
+
tenantId,
|
|
128
|
+
{
|
|
129
|
+
ssoId,
|
|
130
|
+
hashPassword,
|
|
131
|
+
requirePassword,
|
|
132
|
+
}
|
|
133
|
+
)
|
|
145
134
|
|
|
146
135
|
// events
|
|
147
136
|
let account: CloudAccount | undefined
|
package/src/api/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as controller from "../../controllers/global/templates"
|
|
|
3
3
|
import { TemplatePurpose, TemplateType } from "../../../constants"
|
|
4
4
|
import { auth as authCore } from "@budibase/backend-core"
|
|
5
5
|
import Joi from "joi"
|
|
6
|
+
|
|
6
7
|
const { adminOnly, joiValidator } = authCore
|
|
7
8
|
|
|
8
9
|
const router: Router = new Router()
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// mock the email system
|
|
2
2
|
jest.mock("nodemailer")
|
|
3
3
|
import { TestConfiguration, structures, mocks } from "../../../../tests"
|
|
4
|
+
|
|
4
5
|
mocks.email.mock()
|
|
5
6
|
import { events } from "@budibase/backend-core"
|
|
6
7
|
import { GetPublicSettingsResponse, Config, ConfigType } from "@budibase/types"
|
package/src/index.ts
CHANGED
|
@@ -18,13 +18,14 @@ import {
|
|
|
18
18
|
timers,
|
|
19
19
|
redis,
|
|
20
20
|
} from "@budibase/backend-core"
|
|
21
|
+
|
|
21
22
|
db.init()
|
|
22
|
-
import Koa from "koa"
|
|
23
23
|
import koaBody from "koa-body"
|
|
24
24
|
import http from "http"
|
|
25
25
|
import api from "./api"
|
|
26
26
|
|
|
27
27
|
const koaSession = require("koa-session")
|
|
28
|
+
|
|
28
29
|
import { userAgent } from "koa-useragent"
|
|
29
30
|
|
|
30
31
|
import destroyable from "server-destroy"
|
|
@@ -40,7 +41,7 @@ if (coreEnv.ENABLE_SSO_MAINTENANCE_MODE) {
|
|
|
40
41
|
// this will setup http and https proxies form env variables
|
|
41
42
|
bootstrap()
|
|
42
43
|
|
|
43
|
-
const app: Application = new
|
|
44
|
+
const app: Application = new Application()
|
|
44
45
|
|
|
45
46
|
app.keys = ["secret", "key"]
|
|
46
47
|
|
|
@@ -7,10 +7,13 @@ mocks.licenses.init(mocks.pro)
|
|
|
7
7
|
mocks.licenses.useUnlimited()
|
|
8
8
|
|
|
9
9
|
import * as dbConfig from "../db"
|
|
10
|
+
|
|
10
11
|
dbConfig.init()
|
|
11
12
|
import env from "../environment"
|
|
12
13
|
import * as controllers from "./controllers"
|
|
14
|
+
|
|
13
15
|
const supertest = require("supertest")
|
|
16
|
+
|
|
14
17
|
import { Config } from "../constants"
|
|
15
18
|
import {
|
|
16
19
|
users,
|
package/src/tests/jestSetup.ts
CHANGED
package/src/tests/mocks/index.ts
CHANGED
package/src/utilities/email.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { processString } from "@budibase/string-templates"
|
|
|
6
6
|
import { User, SendEmailOpts, SMTPInnerConfig } from "@budibase/types"
|
|
7
7
|
import { configs, cache } from "@budibase/backend-core"
|
|
8
8
|
import ical from "ical-generator"
|
|
9
|
+
|
|
9
10
|
const nodemailer = require("nodemailer")
|
|
10
11
|
|
|
11
12
|
const TEST_MODE = env.ENABLE_EMAIL_TEST_MODE && env.isDev()
|
package/Dockerfile.v2
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
FROM node:18-alpine
|
|
2
|
-
|
|
3
|
-
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check="scripts/watchtower-hooks/pre-check.sh"
|
|
4
|
-
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update="scripts/watchtower-hooks/pre-update.sh"
|
|
5
|
-
LABEL com.centurylinklabs.watchtower.lifecycle.post-update="scripts/watchtower-hooks/post-update.sh"
|
|
6
|
-
LABEL com.centurylinklabs.watchtower.lifecycle.post-check="scripts/watchtower-hooks/post-check.sh"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# handle node-gyp
|
|
10
|
-
RUN apk add --no-cache --virtual .gyp python3 make g++ jq
|
|
11
|
-
RUN yarn global add pm2
|
|
12
|
-
|
|
13
|
-
WORKDIR /
|
|
14
|
-
|
|
15
|
-
COPY scripts/removeWorkspaceDependencies.sh scripts/removeWorkspaceDependencies.sh
|
|
16
|
-
RUN chmod +x ./scripts/removeWorkspaceDependencies.sh
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
WORKDIR /string-templates
|
|
20
|
-
COPY packages/string-templates/package.json package.json
|
|
21
|
-
RUN ../scripts/removeWorkspaceDependencies.sh package.json
|
|
22
|
-
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000
|
|
23
|
-
COPY packages/string-templates .
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
WORKDIR /app
|
|
27
|
-
COPY packages/worker/package.json .
|
|
28
|
-
COPY packages/worker/dist/yarn.lock .
|
|
29
|
-
RUN cd ../string-templates && yarn link && cd - && yarn link @budibase/string-templates
|
|
30
|
-
|
|
31
|
-
RUN ../scripts/removeWorkspaceDependencies.sh package.json
|
|
32
|
-
|
|
33
|
-
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --production=true --network-timeout 1000000
|
|
34
|
-
# Remove unneeded data from file system to reduce image size
|
|
35
|
-
RUN apk del .gyp \
|
|
36
|
-
&& yarn cache clean
|
|
37
|
-
|
|
38
|
-
COPY packages/worker/dist/ dist/
|
|
39
|
-
COPY packages/worker/docker_run.sh .
|
|
40
|
-
|
|
41
|
-
EXPOSE 4001
|
|
42
|
-
|
|
43
|
-
# have to add node environment production after install
|
|
44
|
-
# due to this causing yarn to stop installing dev dependencies
|
|
45
|
-
# which are actually needed to get this environment up and running
|
|
46
|
-
ENV NODE_ENV=production
|
|
47
|
-
ENV CLUSTER_MODE=${CLUSTER_MODE}
|
|
48
|
-
ENV SERVICE=worker-service
|
|
49
|
-
ENV POSTHOG_TOKEN=phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU
|
|
50
|
-
ENV TENANT_FEATURE_FLAGS=*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR
|
|
51
|
-
ENV ACCOUNT_PORTAL_URL=https://account.budibase.app
|
|
52
|
-
|
|
53
|
-
ARG BUDIBASE_VERSION
|
|
54
|
-
# Ensuring the version argument is sent
|
|
55
|
-
RUN test -n "$BUDIBASE_VERSION"
|
|
56
|
-
ENV BUDIBASE_VERSION=$BUDIBASE_VERSION
|
|
57
|
-
|
|
58
|
-
CMD ["./docker_run.sh"]
|