@budibase/worker 3.2.26 → 3.2.27

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.2.26",
4
+ "version": "3.2.27",
5
5
  "description": "Budibase background service",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "prebuild": "rimraf dist/",
16
16
  "build": "node ../../scripts/build.js",
17
17
  "postbuild": "copyfiles -f ../../yarn.lock ./dist/",
18
- "check:types": "tsc -p tsconfig.json --noEmit --paths null --target es2020",
18
+ "check:types": "tsc -p tsconfig.json --noEmit --paths null",
19
19
  "check:dependencies": "node ../../scripts/depcheck.js",
20
20
  "build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
21
21
  "run:docker": "node dist/index.js",
@@ -38,11 +38,11 @@
38
38
  "author": "Budibase",
39
39
  "license": "GPL-3.0",
40
40
  "dependencies": {
41
- "@budibase/backend-core": "3.2.26",
42
- "@budibase/pro": "3.2.26",
43
- "@budibase/shared-core": "3.2.26",
44
- "@budibase/string-templates": "3.2.26",
45
- "@budibase/types": "3.2.26",
41
+ "@budibase/backend-core": "*",
42
+ "@budibase/pro": "*",
43
+ "@budibase/shared-core": "*",
44
+ "@budibase/string-templates": "*",
45
+ "@budibase/types": "*",
46
46
  "@koa/router": "13.1.0",
47
47
  "@techpass/passport-openidconnect": "0.3.3",
48
48
  "@types/global-agent": "2.1.1",
@@ -85,7 +85,6 @@
85
85
  "@types/koa": "2.13.4",
86
86
  "@types/koa__router": "12.0.4",
87
87
  "@types/lodash": "4.14.200",
88
- "@types/node": "^22.9.0",
89
88
  "@types/node-fetch": "2.6.4",
90
89
  "@types/server-destroy": "1.0.1",
91
90
  "@types/supertest": "2.0.14",
@@ -109,11 +108,11 @@
109
108
  "projects": [
110
109
  "@budibase/backend-core"
111
110
  ],
112
- "target": "build"
111
+ "target": "build:oss"
113
112
  }
114
113
  ]
115
114
  }
116
115
  }
117
116
  },
118
- "gitHead": "bde86d6100ccb5827c9dfe272086fd7e52821146"
117
+ "gitHead": "1ea577227cec7d169dfc3e13f4b7eced8fdbc53c"
119
118
  }
@@ -54,7 +54,7 @@ describe("/api/global/auth", () => {
54
54
  describe("POST /api/global/auth/:tenantId/login", () => {
55
55
  it("logs in with correct credentials", async () => {
56
56
  const tenantId = config.tenantId!
57
- const email = config.user?.email!
57
+ const email = config.user!.email!
58
58
  const password = config.userPassword
59
59
 
60
60
  const response = await config.api.auth.login(tenantId, email, password)
@@ -65,7 +65,7 @@ describe("/api/global/auth", () => {
65
65
 
66
66
  it("should return 403 with incorrect credentials", async () => {
67
67
  const tenantId = config.tenantId!
68
- const email = config.user?.email!
68
+ const email = config.user!.email!
69
69
  const password = "incorrect123"
70
70
 
71
71
  const response = await config.api.auth.login(
@@ -343,7 +343,7 @@ describe("/api/global/users", () => {
343
343
  })
344
344
 
345
345
  it("should not allow a user to update their own admin/builder status", async () => {
346
- const user = (await config.api.users.getUser(config.user?._id!))
346
+ const user = (await config.api.users.getUser(config.user!._id!))
347
347
  .body as User
348
348
  await config.api.users.saveUser({
349
349
  ...user,
@@ -1,7 +1,7 @@
1
1
  import { Ctx } from "@budibase/types"
2
2
 
3
3
  export const handleScimBody = (ctx: Ctx, next: any) => {
4
- var type = ctx.req.headers["content-type"] || ""
4
+ let type = ctx.req.headers["content-type"] || ""
5
5
  type = type.split(";")[0]
6
6
 
7
7
  if (type === "application/scim+json") {
@@ -40,10 +40,7 @@ export const getMetadata = async (
40
40
  try {
41
41
  return await db.get(accountId)
42
42
  } catch (e: any) {
43
- if (e.status === 404) {
44
- // do nothing
45
- return
46
- } else {
43
+ if (e.status !== 404) {
47
44
  throw e
48
45
  }
49
46
  }
@@ -1,12 +1,7 @@
1
1
  import { Account, AccountMetadata } from "@budibase/types"
2
- import TestConfiguration from "../TestConfiguration"
3
2
  import { TestAPI } from "./base"
4
3
 
5
4
  export class AccountAPI extends TestAPI {
6
- constructor(config: TestConfiguration) {
7
- super(config)
8
- }
9
-
10
5
  saveMetadata = async (account: Account) => {
11
6
  const res = await this.request
12
7
  .put(`/api/system/accounts/${account.accountId}/metadata`)
@@ -1,12 +1,7 @@
1
1
  import { AuditLogSearchParams, SearchAuditLogsResponse } from "@budibase/types"
2
- import TestConfiguration from "../TestConfiguration"
3
2
  import { TestAPI } from "./base"
4
3
 
5
4
  export class AuditLogAPI extends TestAPI {
6
- constructor(config: TestConfiguration) {
7
- super(config)
8
- }
9
-
10
5
  search = async (search: AuditLogSearchParams) => {
11
6
  const res = await this.request
12
7
  .post("/api/global/auditlogs/search")
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI, TestAPIOpts } from "./base"
3
2
 
4
3
  export class AuthAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  updatePassword = (
10
5
  resetCode: string,
11
6
  password: string,
@@ -10,7 +10,7 @@ export abstract class TestAPI {
10
10
  config: TestConfiguration
11
11
  request: SuperTest<Test>
12
12
 
13
- protected constructor(config: TestConfiguration) {
13
+ constructor(config: TestConfiguration) {
14
14
  this.config = config
15
15
  this.request = config.request
16
16
  }
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI } from "./base"
3
2
 
4
3
  export class ConfigAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  getConfigChecklist = () => {
10
5
  return this.request
11
6
  .get(`/api/global/configs/checklist`)
@@ -1,12 +1,7 @@
1
1
  import { EmailAttachment } from "@budibase/types"
2
- import TestConfiguration from "../TestConfiguration"
3
2
  import { TestAPI } from "./base"
4
3
 
5
4
  export class EmailAPI extends TestAPI {
6
- constructor(config: TestConfiguration) {
7
- super(config)
8
- }
9
-
10
5
  sendEmail = (purpose: string, attachments?: EmailAttachment[]) => {
11
6
  return this.request
12
7
  .post(`/api/global/email/send`)
@@ -15,7 +10,7 @@ export class EmailAPI extends TestAPI {
15
10
  attachments,
16
11
  purpose,
17
12
  tenantId: this.config.getTenantId(),
18
- userId: this.config.user?._id!,
13
+ userId: this.config.user!._id!,
19
14
  })
20
15
  .set(this.config.defaultHeaders())
21
16
  .expect("Content-Type", /json/)
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI } from "./base"
3
2
 
4
3
  export class EnvironmentAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  getEnvironment = () => {
10
5
  return this.request
11
6
  .get(`/api/system/environment`)
@@ -1,12 +1,7 @@
1
1
  import { UserGroup } from "@budibase/types"
2
- import TestConfiguration from "../TestConfiguration"
3
2
  import { TestAPI } from "./base"
4
3
 
5
4
  export class GroupsAPI extends TestAPI {
6
- constructor(config: TestConfiguration) {
7
- super(config)
8
- }
9
-
10
5
  saveGroup = (
11
6
  group: UserGroup,
12
7
  { expect }: { expect: number | object } = { expect: 200 }
@@ -1,4 +1,3 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI } from "./base"
3
2
  import {
4
3
  ActivateLicenseKeyRequest,
@@ -6,10 +5,6 @@ import {
6
5
  } from "@budibase/types"
7
6
 
8
7
  export class LicenseAPI extends TestAPI {
9
- constructor(config: TestConfiguration) {
10
- super(config)
11
- }
12
-
13
8
  refresh = async () => {
14
9
  return this.request
15
10
  .post("/api/global/license/refresh")
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI, TestAPIOpts } from "./base"
3
2
 
4
3
  export class MigrationAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  runMigrations = (opts?: TestAPIOpts) => {
10
5
  return this.request
11
6
  .post(`/api/system/migrations/run`)
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI, TestAPIOpts } from "./base"
3
2
 
4
3
  export class RestoreAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  restored = (opts?: TestAPIOpts) => {
10
5
  return this.request
11
6
  .post(`/api/system/restored`)
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI, TestAPIOpts } from "./base"
3
2
 
4
3
  export class RolesAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  get = (opts?: TestAPIOpts) => {
10
5
  return this.request
11
6
  .get(`/api/global/roles`)
@@ -4,14 +4,9 @@ import {
4
4
  ScimGroupResponse,
5
5
  ScimUpdateRequest,
6
6
  } from "@budibase/types"
7
- import TestConfiguration from "../../TestConfiguration"
8
7
  import { RequestSettings, ScimTestAPI } from "./shared"
9
8
 
10
9
  export class ScimGroupsAPI extends ScimTestAPI {
11
- constructor(config: TestConfiguration) {
12
- super(config)
13
- }
14
-
15
10
  get = async (
16
11
  requestSettings?: Partial<RequestSettings> & {
17
12
  params?: {
@@ -1,4 +1,3 @@
1
- import TestConfiguration from "../../TestConfiguration"
2
1
  import { TestAPI } from "../base"
3
2
 
4
3
  const defaultConfig: RequestSettings = {
@@ -14,10 +13,6 @@ export type RequestSettings = {
14
13
  }
15
14
 
16
15
  export abstract class ScimTestAPI extends TestAPI {
17
- constructor(config: TestConfiguration) {
18
- super(config)
19
- }
20
-
21
16
  call = (
22
17
  url: string,
23
18
  method: "get" | "post" | "patch" | "delete",
@@ -4,14 +4,9 @@ import {
4
4
  ScimUserResponse,
5
5
  ScimUpdateRequest,
6
6
  } from "@budibase/types"
7
- import TestConfiguration from "../../TestConfiguration"
8
7
  import { RequestSettings, ScimTestAPI } from "./shared"
9
8
 
10
9
  export class ScimUsersAPI extends ScimTestAPI {
11
- constructor(config: TestConfiguration) {
12
- super(config)
13
- }
14
-
15
10
  get = async (
16
11
  requestSettings?: Partial<RequestSettings> & {
17
12
  params?: {
@@ -1,12 +1,7 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { User } from "@budibase/types"
3
2
  import { TestAPI } from "./base"
4
3
 
5
4
  export class SelfAPI extends TestAPI {
6
- constructor(config: TestConfiguration) {
7
- super(config)
8
- }
9
-
10
5
  updateSelf = (user: User, update: any) => {
11
6
  return this.request
12
7
  .post(`/api/global/self`)
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI } from "./base"
3
2
 
4
3
  export class StatusAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  getStatus = () => {
10
5
  return this.request.get(`/api/system/status`).expect(200)
11
6
  }
@@ -1,11 +1,6 @@
1
- import TestConfiguration from "../TestConfiguration"
2
1
  import { TestAPI, TestAPIOpts } from "./base"
3
2
 
4
3
  export class TemplatesAPI extends TestAPI {
5
- constructor(config: TestConfiguration) {
6
- super(config)
7
- }
8
-
9
4
  definitions = (opts?: TestAPIOpts) => {
10
5
  return this.request
11
6
  .get(`/api/global/template/definitions`)
@@ -9,14 +9,9 @@ import {
9
9
  } from "@budibase/types"
10
10
  import structures from "../structures"
11
11
  import { generator } from "@budibase/backend-core/tests"
12
- import TestConfiguration from "../TestConfiguration"
13
12
  import { TestAPI, TestAPIOpts } from "./base"
14
13
 
15
14
  export class UserAPI extends TestAPI {
16
- constructor(config: TestConfiguration) {
17
- super(config)
18
- }
19
-
20
15
  // INVITE
21
16
 
22
17
  sendUserInvite = async (sendMailMock: any, email: string, status = 200) => {
@@ -178,11 +173,7 @@ export class UserAPI extends TestAPI {
178
173
  .expect(opts?.status ? opts.status : 200)
179
174
  }
180
175
 
181
- grantBuilderToApp = (
182
- userId: string,
183
- appId: string,
184
- statusCode: number = 200
185
- ) => {
176
+ grantBuilderToApp = (userId: string, appId: string, statusCode = 200) => {
186
177
  return this.request
187
178
  .post(`/api/global/users/${userId}/app/${appId}/builder`)
188
179
  .set(this.config.defaultHeaders())
@@ -1,24 +1,7 @@
1
1
  {
2
+ "extends": "../../tsconfig.build.json",
2
3
  "compilerOptions": {
3
- "target": "es6",
4
- "module": "commonjs",
5
- "lib": ["es2020"],
6
- "strict": true,
7
- "noImplicitAny": true,
8
- "esModuleInterop": true,
9
- "resolveJsonModule": true,
10
- "incremental": true,
11
- "types": ["node", "jest"],
12
- "outDir": "dist",
13
- "skipLibCheck": true,
14
- "paths": {
15
- "@budibase/types": ["../types/src"],
16
- "@budibase/backend-core": ["../backend-core/src"],
17
- "@budibase/backend-core/*": ["../backend-core/*"],
18
- "@budibase/shared-core": ["../shared-core/src"],
19
- "@budibase/pro": ["../pro/src"],
20
- "@budibase/string-templates": ["../string-templates/src"]
21
- }
4
+ "target": "es2020"
22
5
  },
23
6
  "include": ["src/**/*"],
24
7
  "exclude": [
package/tsconfig.json CHANGED
@@ -1,9 +1,5 @@
1
1
  {
2
2
  "extends": "./tsconfig.build.json",
3
- "compilerOptions": {
4
- "composite": true,
5
- "baseUrl": "."
6
- },
7
3
  "ts-node": {
8
4
  "require": ["tsconfig-paths/register"]
9
5
  },