@budibase/worker 3.2.25 → 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.
Files changed (56) hide show
  1. package/package.json +9 -10
  2. package/src/api/controllers/global/auth.ts +26 -12
  3. package/src/api/controllers/global/configs.ts +14 -6
  4. package/src/api/controllers/global/email.ts +9 -2
  5. package/src/api/controllers/global/license.ts +6 -3
  6. package/src/api/controllers/global/roles.ts +10 -4
  7. package/src/api/controllers/global/self.ts +15 -8
  8. package/src/api/controllers/global/templates.ts +35 -17
  9. package/src/api/controllers/global/users.ts +41 -14
  10. package/src/api/controllers/system/accounts.ts +11 -3
  11. package/src/api/controllers/system/environment.ts +3 -3
  12. package/src/api/controllers/system/logs.ts +2 -2
  13. package/src/api/controllers/system/migrations.ts +12 -2
  14. package/src/api/controllers/system/restore.ts +4 -2
  15. package/src/api/controllers/system/tenants.ts +3 -3
  16. package/src/api/routes/global/email.ts +1 -1
  17. package/src/api/routes/global/tests/auth.spec.ts +2 -2
  18. package/src/api/routes/global/tests/email.spec.ts +1 -1
  19. package/src/api/routes/global/tests/realEmail.spec.ts +1 -2
  20. package/src/api/routes/global/tests/templates.spec.ts +2 -5
  21. package/src/api/routes/global/tests/users.spec.ts +1 -1
  22. package/src/api/routes/index.ts +0 -2
  23. package/src/api/routes/system/tests/environment.spec.ts +2 -2
  24. package/src/constants/index.ts +1 -9
  25. package/src/constants/templates/index.ts +17 -15
  26. package/src/middleware/cloudRestricted.ts +2 -2
  27. package/src/middleware/handleScimBody.ts +1 -1
  28. package/src/sdk/accounts/metadata.ts +1 -4
  29. package/src/sdk/auth/auth.ts +1 -2
  30. package/src/sdk/users/users.ts +1 -1
  31. package/src/tests/api/accounts.ts +0 -5
  32. package/src/tests/api/auditLogs.ts +0 -5
  33. package/src/tests/api/auth.ts +0 -5
  34. package/src/tests/api/base.ts +1 -1
  35. package/src/tests/api/configs.ts +0 -5
  36. package/src/tests/api/email.ts +1 -6
  37. package/src/tests/api/environment.ts +0 -5
  38. package/src/tests/api/groups.ts +0 -5
  39. package/src/tests/api/license.ts +0 -5
  40. package/src/tests/api/migrations.ts +0 -5
  41. package/src/tests/api/restore.ts +0 -5
  42. package/src/tests/api/roles.ts +0 -5
  43. package/src/tests/api/scim/groups.ts +0 -5
  44. package/src/tests/api/scim/shared.ts +0 -5
  45. package/src/tests/api/scim/users.ts +0 -5
  46. package/src/tests/api/self.ts +0 -5
  47. package/src/tests/api/status.ts +0 -5
  48. package/src/tests/api/templates.ts +0 -5
  49. package/src/tests/api/users.ts +1 -10
  50. package/src/tests/controllers.ts +0 -1
  51. package/src/utilities/email.ts +7 -2
  52. package/src/utilities/templates.ts +2 -5
  53. package/tsconfig.build.json +2 -19
  54. package/tsconfig.json +0 -4
  55. package/src/api/controllers/global/workspaces.ts +0 -53
  56. package/src/api/routes/global/workspaces.ts +0 -37
@@ -1,7 +1,15 @@
1
- import { Account, AccountMetadata, Ctx } from "@budibase/types"
1
+ import {
2
+ Account,
3
+ AccountMetadata,
4
+ Ctx,
5
+ SaveAccountRequest,
6
+ SaveAccountResponse,
7
+ } from "@budibase/types"
2
8
  import * as accounts from "../../../sdk/accounts"
3
9
 
4
- export const save = async (ctx: Ctx<Account, AccountMetadata>) => {
10
+ export const save = async (
11
+ ctx: Ctx<SaveAccountRequest, SaveAccountResponse>
12
+ ) => {
5
13
  const account = ctx.request.body as Account
6
14
  let metadata: AccountMetadata = {
7
15
  _id: accounts.metadata.formatAccountMetadataId(account.accountId),
@@ -14,7 +22,7 @@ export const save = async (ctx: Ctx<Account, AccountMetadata>) => {
14
22
  ctx.status = 200
15
23
  }
16
24
 
17
- export const destroy = async (ctx: any) => {
25
+ export const destroy = async (ctx: Ctx<void, void>) => {
18
26
  const accountId = accounts.metadata.formatAccountMetadataId(
19
27
  ctx.params.accountId
20
28
  )
@@ -1,4 +1,4 @@
1
- import { Ctx, MaintenanceType } from "@budibase/types"
1
+ import { Ctx, GetEnvironmentResponse, MaintenanceType } from "@budibase/types"
2
2
  import env from "../../../environment"
3
3
  import { env as coreEnv, db as dbCore } from "@budibase/backend-core"
4
4
  import nodeFetch from "node-fetch"
@@ -38,13 +38,13 @@ async function isSqsMissing() {
38
38
  return !(await isSqsAvailable())
39
39
  }
40
40
 
41
- export const fetch = async (ctx: Ctx) => {
41
+ export const fetch = async (ctx: Ctx<void, GetEnvironmentResponse>) => {
42
42
  ctx.body = {
43
43
  multiTenancy: !!env.MULTI_TENANCY,
44
44
  offlineMode: !!coreEnv.OFFLINE_MODE,
45
45
  cloud: !env.SELF_HOSTED,
46
46
  accountPortalUrl: env.ACCOUNT_PORTAL_URL,
47
- disableAccountPortal: env.DISABLE_ACCOUNT_PORTAL,
47
+ disableAccountPortal: !!env.DISABLE_ACCOUNT_PORTAL,
48
48
  baseUrl: env.PLATFORM_URL,
49
49
  isDev: env.isDev() && !env.isTest(),
50
50
  maintenance: [],
@@ -1,7 +1,7 @@
1
- import { UserCtx } from "@budibase/types"
1
+ import { GetLogResponse, UserCtx } from "@budibase/types"
2
2
  import { installation, logging } from "@budibase/backend-core"
3
3
 
4
- export async function getLogs(ctx: UserCtx) {
4
+ export async function getLogs(ctx: UserCtx<void, GetLogResponse>) {
5
5
  const logReadStream = logging.system.getLogReadStream()
6
6
 
7
7
  const { installId } = await installation.getInstall()
@@ -1,13 +1,23 @@
1
+ import {
2
+ FetchMigrationDefinitionsResponse,
3
+ RunGlobalMigrationRequest,
4
+ UserCtx,
5
+ } from "@budibase/types"
6
+
1
7
  const { migrate, MIGRATIONS } = require("../../../migrations")
2
8
 
3
- export const runMigrations = async (ctx: any) => {
9
+ export const runMigrations = async (
10
+ ctx: UserCtx<RunGlobalMigrationRequest, void>
11
+ ) => {
4
12
  const options = ctx.request.body
5
13
  // don't await as can take a while, just return
6
14
  migrate(options)
7
15
  ctx.status = 200
8
16
  }
9
17
 
10
- export const fetchDefinitions = async (ctx: any) => {
18
+ export const fetchDefinitions = async (
19
+ ctx: UserCtx<void, FetchMigrationDefinitionsResponse>
20
+ ) => {
11
21
  ctx.body = MIGRATIONS
12
22
  ctx.status = 200
13
23
  }
@@ -1,8 +1,10 @@
1
1
  import env from "../../../environment"
2
- import { BBContext } from "@budibase/types"
2
+ import { SystemRestoreResponse, UserCtx } from "@budibase/types"
3
3
  import { cache } from "@budibase/backend-core"
4
4
 
5
- export async function systemRestored(ctx: BBContext) {
5
+ export async function systemRestored(
6
+ ctx: UserCtx<void, SystemRestoreResponse>
7
+ ) {
6
8
  if (!env.SELF_HOSTED) {
7
9
  ctx.throw(405, "This operation is not allowed in cloud.")
8
10
  }
@@ -1,7 +1,7 @@
1
- import { UserCtx } from "@budibase/types"
1
+ import { GetTenantInfoResponse, UserCtx } from "@budibase/types"
2
2
  import * as tenantSdk from "../../../sdk/tenants"
3
3
 
4
- export async function destroy(ctx: UserCtx) {
4
+ export async function destroy(ctx: UserCtx<void, void>) {
5
5
  const user = ctx.user!
6
6
  const tenantId = ctx.params.tenantId
7
7
 
@@ -18,6 +18,6 @@ export async function destroy(ctx: UserCtx) {
18
18
  }
19
19
  }
20
20
 
21
- export async function info(ctx: UserCtx) {
21
+ export async function info(ctx: UserCtx<void, GetTenantInfoResponse>) {
22
22
  ctx.body = await tenantSdk.tenantInfo(ctx.params.tenantId)
23
23
  }
@@ -1,7 +1,7 @@
1
1
  import Router from "@koa/router"
2
2
  import * as controller from "../../controllers/global/email"
3
- import { EmailTemplatePurpose } from "../../../constants"
4
3
  import { auth } from "@budibase/backend-core"
4
+ import { EmailTemplatePurpose } from "@budibase/types"
5
5
  import Joi from "joi"
6
6
 
7
7
  const router: Router = new Router()
@@ -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(
@@ -1,8 +1,8 @@
1
1
  jest.mock("nodemailer")
2
+ import { EmailTemplatePurpose } from "@budibase/types"
2
3
  import { TestConfiguration, mocks } from "../../../../tests"
3
4
 
4
5
  const sendMailMock = mocks.email.mock()
5
- import { EmailTemplatePurpose } from "../../../../constants"
6
6
 
7
7
  describe("/api/global/email", () => {
8
8
  const config = new TestConfiguration()
@@ -1,11 +1,10 @@
1
1
  jest.unmock("node-fetch")
2
2
  import { TestConfiguration } from "../../../../tests"
3
- import { EmailTemplatePurpose } from "../../../../constants"
4
3
  import { objectStore } from "@budibase/backend-core"
5
4
  import { helpers } from "@budibase/shared-core"
6
5
 
7
6
  import tk from "timekeeper"
8
- import { EmailAttachment } from "@budibase/types"
7
+ import { EmailAttachment, EmailTemplatePurpose } from "@budibase/types"
9
8
 
10
9
  const fetch = require("node-fetch")
11
10
 
@@ -1,9 +1,6 @@
1
- import {
2
- EmailTemplatePurpose,
3
- TemplateMetadata,
4
- TemplateType,
5
- } from "../../../../constants"
1
+ import { TemplateMetadata, TemplateType } from "../../../../constants"
6
2
  import { TestConfiguration } from "../../../../tests"
3
+ import { EmailTemplatePurpose } from "@budibase/types"
7
4
 
8
5
  // TODO
9
6
 
@@ -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,
@@ -2,7 +2,6 @@ import Router from "@koa/router"
2
2
  import { api as pro } from "@budibase/pro"
3
3
  import userRoutes from "./global/users"
4
4
  import configRoutes from "./global/configs"
5
- import workspaceRoutes from "./global/workspaces"
6
5
  import templateRoutes from "./global/templates"
7
6
  import emailRoutes from "./global/email"
8
7
  import authRoutes from "./global/auth"
@@ -24,7 +23,6 @@ export const routes: Router[] = [
24
23
  configRoutes,
25
24
  userRoutes,
26
25
  pro.users,
27
- workspaceRoutes,
28
26
  authRoutes,
29
27
  templateRoutes,
30
28
  tenantsRoutes,
@@ -22,7 +22,7 @@ describe("/api/system/environment", () => {
22
22
  const env = await config.api.environment.getEnvironment()
23
23
  expect(env.body).toEqual({
24
24
  cloud: true,
25
- disableAccountPortal: 0,
25
+ disableAccountPortal: false,
26
26
  isDev: false,
27
27
  multiTenancy: true,
28
28
  baseUrl: "http://localhost:10000",
@@ -36,7 +36,7 @@ describe("/api/system/environment", () => {
36
36
  const env = await config.api.environment.getEnvironment()
37
37
  expect(env.body).toEqual({
38
38
  cloud: false,
39
- disableAccountPortal: 0,
39
+ disableAccountPortal: false,
40
40
  isDev: false,
41
41
  multiTenancy: true,
42
42
  baseUrl: "http://localhost:10000",
@@ -1,4 +1,5 @@
1
1
  import { constants } from "@budibase/backend-core"
2
+ import { EmailTemplatePurpose } from "@budibase/types"
2
3
 
3
4
  export const LOGO_URL =
4
5
  "https://d33wubrfki0l68.cloudfront.net/aac32159d7207b5085e74a7ef67afbb7027786c5/2b1fd/img/logo/bb-emblem.svg"
@@ -19,15 +20,6 @@ export enum TemplateType {
19
20
  EMAIL = "email",
20
21
  }
21
22
 
22
- export enum EmailTemplatePurpose {
23
- CORE = "core",
24
- BASE = "base",
25
- PASSWORD_RECOVERY = "password_recovery",
26
- INVITATION = "invitation",
27
- WELCOME = "welcome",
28
- CUSTOM = "custom",
29
- }
30
-
31
23
  export enum TemplateMetadataNames {
32
24
  BASE = "Base format",
33
25
  PASSWORD_RECOVERY = "Password recovery",
@@ -1,13 +1,8 @@
1
1
  import { readStaticFile } from "../../utilities/fileSystem"
2
- import {
3
- EmailTemplatePurpose,
4
- TemplateType,
5
- TemplatePurpose,
6
- GLOBAL_OWNER,
7
- } from "../index"
2
+ import { TemplateType, TemplatePurpose, GLOBAL_OWNER } from "../index"
8
3
  import { join } from "path"
9
4
  import { db as dbCore, tenancy } from "@budibase/backend-core"
10
- import { Template } from "@budibase/types"
5
+ import { Template, EmailTemplatePurpose } from "@budibase/types"
11
6
 
12
7
  export const EmailTemplates = {
13
8
  [EmailTemplatePurpose.PASSWORD_RECOVERY]: readStaticFile(
@@ -53,26 +48,33 @@ export function addBaseTemplates(templates: Template[], type?: string) {
53
48
  export async function getTemplates({
54
49
  ownerId,
55
50
  type,
56
- id,
57
- }: { ownerId?: string; type?: string; id?: string } = {}) {
51
+ }: { ownerId?: string; type?: string } = {}) {
58
52
  const db = tenancy.getGlobalDB()
59
53
  const response = await db.allDocs<Template>(
60
- dbCore.getTemplateParams(ownerId || GLOBAL_OWNER, id, {
54
+ dbCore.getTemplateParams(ownerId || GLOBAL_OWNER, undefined, {
61
55
  include_docs: true,
62
56
  })
63
57
  )
64
58
  let templates = response.rows.map(row => row.doc!)
65
- // should only be one template with ID
66
- if (id) {
67
- return templates[0]
68
- }
69
59
  if (type) {
70
60
  templates = templates.filter(template => template.type === type)
71
61
  }
72
62
  return addBaseTemplates(templates, type)
73
63
  }
74
64
 
65
+ export async function getTemplateByID(id: string, ownerId?: string) {
66
+ const db = tenancy.getGlobalDB()
67
+ const response = await db.allDocs<Template>(
68
+ dbCore.getTemplateParams(ownerId || GLOBAL_OWNER, id, {
69
+ include_docs: true,
70
+ })
71
+ )
72
+ let templates = response.rows.map(row => row.doc!)
73
+ // should only be one template with ID
74
+ return templates[0]
75
+ }
76
+
75
77
  export async function getTemplateByPurpose(type: string, purpose: string) {
76
- const templates = (await getTemplates({ type })) as Template[]
78
+ const templates = await getTemplates({ type })
77
79
  return templates.find((template: Template) => template.purpose === purpose)
78
80
  }
@@ -1,12 +1,12 @@
1
1
  import env from "../environment"
2
2
  import { constants, utils } from "@budibase/backend-core"
3
- import { BBContext } from "@budibase/types"
3
+ import { UserCtx } from "@budibase/types"
4
4
 
5
5
  /**
6
6
  * This is a restricted endpoint in the cloud.
7
7
  * Ensure that the correct API key has been supplied.
8
8
  */
9
- export default async (ctx: BBContext, next: any) => {
9
+ export default async (ctx: UserCtx, next: any) => {
10
10
  if (!env.SELF_HOSTED && !env.DISABLE_ACCOUNT_PORTAL) {
11
11
  const apiKey = ctx.request.headers[constants.Header.API_KEY]
12
12
  if (!apiKey) {
@@ -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
  }
@@ -8,11 +8,10 @@ import {
8
8
  utils as coreUtils,
9
9
  cache,
10
10
  } from "@budibase/backend-core"
11
- import { PlatformLogoutOpts, User } from "@budibase/types"
11
+ import { PlatformLogoutOpts, User, EmailTemplatePurpose } from "@budibase/types"
12
12
  import jwt from "jsonwebtoken"
13
13
  import * as userSdk from "../users"
14
14
  import * as emails from "../../utilities/email"
15
- import { EmailTemplatePurpose } from "../../constants"
16
15
 
17
16
  // LOGIN / LOGOUT
18
17
 
@@ -3,9 +3,9 @@ import {
3
3
  InviteUserRequest,
4
4
  InviteUsersRequest,
5
5
  InviteUsersResponse,
6
+ EmailTemplatePurpose,
6
7
  } from "@budibase/types"
7
8
  import { sendEmail } from "../../utilities/email"
8
- import { EmailTemplatePurpose } from "../../constants"
9
9
 
10
10
  export async function invite(
11
11
  users: InviteUsersRequest
@@ -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`)