@budibase/worker 2.11.39 → 2.11.41

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.v2 ADDED
@@ -0,0 +1,53 @@
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
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
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
+ CMD ["./docker_run.sh"]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.11.39",
4
+ "version": "2.11.41",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -38,16 +38,17 @@
38
38
  "author": "Budibase",
39
39
  "license": "GPL-3.0",
40
40
  "dependencies": {
41
- "@budibase/backend-core": "2.11.39",
42
- "@budibase/pro": "2.11.39",
43
- "@budibase/string-templates": "2.11.39",
44
- "@budibase/types": "2.11.39",
41
+ "@budibase/backend-core": "2.11.41",
42
+ "@budibase/pro": "2.11.41",
43
+ "@budibase/string-templates": "2.11.41",
44
+ "@budibase/types": "2.11.41",
45
45
  "@koa/router": "8.0.8",
46
46
  "@techpass/passport-openidconnect": "0.3.2",
47
47
  "@types/global-agent": "2.1.1",
48
48
  "aws-sdk": "2.1030.0",
49
49
  "bcrypt": "5.1.0",
50
50
  "bcryptjs": "2.4.3",
51
+ "bull": "4.10.1",
51
52
  "dd-trace": "3.13.2",
52
53
  "dotenv": "8.6.0",
53
54
  "global-agent": "3.0.0",
@@ -61,6 +62,7 @@
61
62
  "koa-session": "5.13.1",
62
63
  "koa-static": "5.0.0",
63
64
  "koa-useragent": "^4.1.0",
65
+ "lodash": "4.17.21",
64
66
  "node-fetch": "2.6.7",
65
67
  "nodemailer": "6.7.2",
66
68
  "passport-google-oauth": "2.0.0",
@@ -77,14 +79,13 @@
77
79
  "@types/jsonwebtoken": "8.5.1",
78
80
  "@types/koa": "2.13.4",
79
81
  "@types/koa__router": "8.0.8",
80
- "@types/lodash": "^4.14.191",
82
+ "@types/lodash": "4.14.200",
81
83
  "@types/node": "18.17.0",
82
84
  "@types/node-fetch": "2.6.4",
83
85
  "@types/server-destroy": "1.0.1",
84
86
  "@types/supertest": "2.0.12",
85
87
  "@types/uuid": "8.3.4",
86
88
  "jest": "29.6.2",
87
- "lodash": "4.17.21",
88
89
  "nodemon": "2.0.15",
89
90
  "rimraf": "3.0.2",
90
91
  "supertest": "6.2.2",
@@ -107,5 +108,5 @@
107
108
  }
108
109
  }
109
110
  },
110
- "gitHead": "ecc330f4521e60e5766d7f0e87ac7030a94d8bfc"
111
+ "gitHead": "cfb21ffd5e3a748cd275a7fa91cb357e9df3973b"
111
112
  }
@@ -189,7 +189,10 @@ export const destroy = async (ctx: any) => {
189
189
 
190
190
  export const getAppUsers = async (ctx: Ctx<SearchUsersRequest>) => {
191
191
  const body = ctx.request.body
192
- const users = await userSdk.db.getUsersByAppAccess(body?.appId)
192
+ const users = await userSdk.db.getUsersByAppAccess({
193
+ appId: body.appId,
194
+ limit: body.limit,
195
+ })
193
196
 
194
197
  ctx.body = { data: users }
195
198
  }
@@ -569,9 +569,13 @@ describe("/api/global/users", () => {
569
569
  {
570
570
  query: { equal: { firstName: user.firstName } },
571
571
  },
572
- 501
572
+ { status: 501 }
573
573
  )
574
574
  })
575
+
576
+ it("should throw an error if public query performed", async () => {
577
+ await config.api.users.searchUsers({}, { status: 403, noHeaders: true })
578
+ })
575
579
  })
576
580
 
577
581
  describe("DELETE /api/global/users/:userId", () => {
@@ -72,7 +72,8 @@ router
72
72
  )
73
73
 
74
74
  .get("/api/global/users", auth.builderOrAdmin, controller.fetch)
75
- .post("/api/global/users/search", auth.builderOrAdmin, controller.search)
75
+ // search can be used by any user now, to retrieve users for user column
76
+ .post("/api/global/users/search", controller.search)
76
77
  .delete("/api/global/users/:id", auth.adminOnly, controller.destroy)
77
78
  .get(
78
79
  "/api/global/users/count/:appId",
@@ -134,13 +134,19 @@ export class UserAPI extends TestAPI {
134
134
  .expect(status ? status : 200)
135
135
  }
136
136
 
137
- searchUsers = ({ query }: { query?: SearchQuery }, status = 200) => {
138
- return this.request
137
+ searchUsers = (
138
+ { query }: { query?: SearchQuery },
139
+ opts?: { status?: number; noHeaders?: boolean }
140
+ ) => {
141
+ const req = this.request
139
142
  .post("/api/global/users/search")
140
- .set(this.config.defaultHeaders())
141
143
  .send({ query })
142
144
  .expect("Content-Type", /json/)
143
- .expect(status ? status : 200)
145
+ .expect(opts?.status ? opts.status : 200)
146
+ if (!opts?.noHeaders) {
147
+ req.set(this.config.defaultHeaders())
148
+ }
149
+ return req
144
150
  }
145
151
 
146
152
  getUser = (userId: string, opts?: TestAPIOpts) => {