@budibase/worker 3.34.5 → 3.34.7

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/worker",
3
3
  "email": "hi@budibase.com",
4
- "version": "3.34.5",
4
+ "version": "3.34.7",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -37,7 +37,7 @@
37
37
  "@types/global-agent": "2.1.1",
38
38
  "bcrypt": "6.0.0",
39
39
  "bull": "4.10.1",
40
- "dd-trace": "5.63.0",
40
+ "dd-trace": "5.92.0",
41
41
  "dotenv": "8.6.0",
42
42
  "email-validator": "^2.0.4",
43
43
  "global-agent": "3.0.0",
@@ -79,5 +79,5 @@
79
79
  "supertest": "6.3.3",
80
80
  "timekeeper": "2.2.0"
81
81
  },
82
- "gitHead": "3cd6b13566b94f609768435eba58baec699ce040"
82
+ "gitHead": "0842f52bf3b8700529e56800ef866175e2850e19"
83
83
  }
@@ -653,7 +653,7 @@ export async function upload(ctx: UserCtx<void, UploadConfigFileResponse>) {
653
653
  const result = await objectStore.upload({
654
654
  bucket,
655
655
  filename: key,
656
- path: file.path,
656
+ path: file.filepath,
657
657
  type: file.type,
658
658
  })
659
659
 
@@ -454,6 +454,30 @@ describe("configs", () => {
454
454
  })
455
455
  })
456
456
 
457
+ describe("POST /api/global/configs/upload/:type/:name", () => {
458
+ it("should upload an OIDC logo and store the key in config", async () => {
459
+ const logoName = "test-logo.png"
460
+ const res = await config.api.configs
461
+ .uploadOIDCLogo(logoName, Buffer.from("fake-png-data"), logoName)
462
+ .expect(200)
463
+
464
+ expect(res.body.message).toBe(
465
+ "File has been uploaded and url stored to config."
466
+ )
467
+
468
+ const oidcLogosConfig = await config.api.configs.getConfig(
469
+ ConfigType.OIDC_LOGOS
470
+ )
471
+ expect(oidcLogosConfig.config[logoName]).toBeDefined()
472
+ })
473
+
474
+ it("should return 400 when multiple files are uploaded", async () => {
475
+ await config.api.configs
476
+ .uploadOIDCLogoMultiple("test-logo.png")
477
+ .expect(400)
478
+ })
479
+ })
480
+
457
481
  describe("GET /api/global/configs/public/translations", () => {
458
482
  beforeEach(async () => {
459
483
  await config.deleteConfig(ConfigType.TRANSLATIONS)
@@ -72,6 +72,21 @@ export class ConfigAPI extends TestAPI {
72
72
  return resp.body as SaveConfigResponse
73
73
  }
74
74
 
75
+ uploadOIDCLogo = (name: string, buffer: Buffer, filename: string) => {
76
+ return this.request
77
+ .post(`/api/global/configs/upload/${ConfigType.OIDC_LOGOS}/${name}`)
78
+ .set(this.config.defaultHeaders())
79
+ .attach("file", buffer, filename)
80
+ }
81
+
82
+ uploadOIDCLogoMultiple = (name: string) => {
83
+ return this.request
84
+ .post(`/api/global/configs/upload/${ConfigType.OIDC_LOGOS}/${name}`)
85
+ .set(this.config.defaultHeaders())
86
+ .attach("file", Buffer.from("a"), "a.png")
87
+ .attach("file", Buffer.from("b"), "b.png")
88
+ }
89
+
75
90
  OIDCCallback = (configId: string, preAuthRes: any) => {
76
91
  const cookie = this.config.cookieHeader(preAuthRes.get("set-cookie"))
77
92
  const setKoaSession = cookie.Cookie.find((c: string) =>