From 217b39c2327af364e91500e4222bb7885bfb2224 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 20 Mar 2024 11:46:39 +0000 Subject: [PATCH 1/6] Reenable no-unused-vars --- .eslintrc.json | 5 +- package.json | 1 + packages/backend-core/src/cache/base/index.ts | 2 +- packages/backend-core/src/cache/invite.ts | 2 +- .../backend-core/src/cache/writethrough.ts | 2 +- packages/backend-core/src/db/lucene.ts | 4 - packages/backend-core/src/docUpdates/index.ts | 9 +- .../events/processors/AuditLogsProcessor.ts | 5 +- .../src/events/processors/LoggingProcessor.ts | 7 +- .../async/DocumentUpdateProcessor.ts | 7 +- .../backend-core/src/middleware/matchers.ts | 2 +- .../middleware/passport/datasource/google.ts | 2 +- .../src/middleware/passport/sso/sso.ts | 7 +- .../backend-core/src/migrations/migrations.ts | 4 - .../src/objectStore/buckets/tests/app.spec.ts | 6 +- .../src/platform/tests/tenants.spec.ts | 2 +- .../backend-core/src/queue/inMemoryQueue.ts | 2 +- packages/backend-core/src/queue/listeners.ts | 2 +- packages/backend-core/src/redis/init.ts | 1 + .../src/redis/tests/redis.spec.ts | 2 +- .../backend-core/src/users/test/utils.spec.ts | 2 +- .../_components/BuilderSidePanel.svelte | 5 +- .../__mocks__/@google-cloud/firestore.ts | 1 + packages/server/__mocks__/@sendgrid/mail.ts | 1 + packages/server/__mocks__/arangojs.ts | 1 + packages/server/__mocks__/mongodb.ts | 1 + packages/server/__mocks__/mysql2/promise.ts | 1 + packages/server/__mocks__/node-fetch.ts | 1 + .../server/src/api/controllers/application.ts | 1 - packages/server/src/api/controllers/role.ts | 2 +- .../api/controllers/row/ExternalRequest.ts | 2 - .../server/src/api/controllers/row/views.ts | 1 - packages/server/src/api/controllers/user.ts | 2 +- .../src/api/controllers/view/viewsV2.ts | 2 +- packages/server/src/api/routes/index.ts | 2 - .../src/api/routes/tests/appImport.spec.ts | 2 +- .../src/api/routes/tests/appSync.spec.ts | 1 - .../src/api/routes/tests/application.spec.ts | 4 +- .../src/api/routes/tests/permissions.spec.ts | 2 +- .../api/routes/tests/queries/mysql.spec.ts | 2 +- .../server/src/api/routes/tests/view.spec.ts | 2 +- .../server/src/automations/automationUtils.ts | 2 +- .../server/src/automations/steps/collect.ts | 1 - .../src/automations/steps/executeQuery.ts | 2 - .../server/src/automations/steps/openai.ts | 2 +- .../automations/steps/triggerAutomationRun.ts | 1 + .../server/src/automations/tests/loop.spec.ts | 7 +- .../unitTests/automationUtils.spec.ts | 2 +- packages/server/src/constants/index.ts | 4 + packages/server/src/db/dynamoClient.ts | 147 ------------------ packages/server/src/db/linkedRows/index.ts | 1 - packages/server/src/features.ts | 3 + .../server/src/integration-test/mysql.spec.ts | 1 - packages/server/src/integrations/dynamodb.ts | 2 +- .../server/src/integrations/googlesheets.ts | 1 + .../src/integrations/microsoftSqlServer.ts | 2 - packages/server/src/integrations/mysql.ts | 2 - .../src/integrations/tests/airtable.spec.ts | 8 +- .../src/integrations/tests/arangodb.spec.ts | 5 +- .../src/integrations/tests/couchdb.spec.ts | 2 +- .../src/integrations/tests/dynamodb.spec.ts | 8 +- .../integrations/tests/elasticsearch.spec.ts | 2 +- .../src/integrations/tests/firebase.spec.ts | 2 +- .../src/integrations/tests/oracle.spec.ts | 2 +- .../src/integrations/tests/postgres.spec.ts | 2 +- .../src/integrations/tests/rest.spec.ts | 6 +- .../server/src/integrations/tests/s3.spec.ts | 2 - packages/server/src/jsRunner/bundles/index.ts | 2 - packages/server/src/jsRunner/index.ts | 4 +- packages/server/src/middleware/cleanup.ts | 2 +- .../src/middleware/tests/authorized.spec.ts | 1 - .../server/src/middleware/trimViewRowInfo.ts | 5 +- .../functions/backfill/global/users.ts | 2 +- packages/server/src/migrations/index.ts | 1 - .../server/src/sdk/app/applications/sync.ts | 6 +- .../sdk/app/applications/tests/sync.spec.ts | 4 +- .../server/src/sdk/app/permissions/index.ts | 4 +- .../src/sdk/app/views/tests/views.spec.ts | 5 + .../src/tests/utilities/TestConfiguration.ts | 1 - .../server/src/tests/utilities/api/viewV2.ts | 1 - packages/server/src/utilities/csv.ts | 4 +- packages/server/src/utilities/schema.ts | 15 -- .../utilities/usageQuota/usageQuoteReset.ts | 18 --- .../server/src/utilities/workerRequests.ts | 9 +- packages/server/src/websockets/websocket.ts | 2 + .../shared-core/src/sdk/documents/users.ts | 5 +- packages/string-templates/test/utils.ts | 4 +- .../types/src/api/web/global/auditLogs.ts | 8 +- packages/types/src/documents/app/query.ts | 1 - packages/worker/__mocks__/node-fetch.ts | 3 +- .../worker/src/api/controllers/global/auth.ts | 7 +- .../src/api/routes/global/tests/auth.spec.ts | 5 +- .../src/api/routes/global/tests/scim.spec.ts | 3 + packages/worker/src/features.ts | 1 + .../functions/globalInfoSyncUsers.ts | 2 +- .../worker/src/tests/TestConfiguration.ts | 1 - .../worker/src/tests/structures/groups.ts | 2 +- packages/worker/src/utilities/templates.ts | 2 - yarn.lock | 109 ++++++++++++- 99 files changed, 219 insertions(+), 351 deletions(-) delete mode 100644 packages/server/src/db/dynamoClient.ts delete mode 100644 packages/server/src/utilities/usageQuota/usageQuoteReset.ts diff --git a/.eslintrc.json b/.eslintrc.json index 9b4eb7eebb..2a40c6cc29 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,12 +36,14 @@ "files": ["**/*.ts"], "excludedFiles": ["qa-core/**"], "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], "extends": ["eslint:recommended"], "globals": { "NodeJS": true }, "rules": { "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", "local-rules/no-budibase-imports": "error" } }, @@ -49,7 +51,7 @@ "files": ["**/*.spec.ts"], "excludedFiles": ["qa-core/**"], "parser": "@typescript-eslint/parser", - "plugins": ["jest"], + "plugins": ["jest", "@typescript-eslint"], "extends": ["eslint:recommended", "plugin:jest/recommended"], "env": { "jest/globals": true @@ -59,6 +61,7 @@ }, "rules": { "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": "error", "local-rules/no-test-com": "error", "local-rules/email-domain-example-com": "error", "no-console": "warn", diff --git a/package.json b/package.json index af7aac0025..7de22ab456 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "svelte": "^4.2.10", "svelte-eslint-parser": "^0.33.1", "typescript": "5.2.2", + "typescript-eslint": "^7.3.1", "yargs": "^17.7.2" }, "scripts": { diff --git a/packages/backend-core/src/cache/base/index.ts b/packages/backend-core/src/cache/base/index.ts index 74da4fe0d2..433941b5c7 100644 --- a/packages/backend-core/src/cache/base/index.ts +++ b/packages/backend-core/src/cache/base/index.ts @@ -129,7 +129,7 @@ export default class BaseCache { } } - async bustCache(key: string, opts = { client: null }) { + async bustCache(key: string) { const client = await this.getClient() try { await client.delete(generateTenantKey(key)) diff --git a/packages/backend-core/src/cache/invite.ts b/packages/backend-core/src/cache/invite.ts index e43ebc4aa8..e3d698bcc6 100644 --- a/packages/backend-core/src/cache/invite.ts +++ b/packages/backend-core/src/cache/invite.ts @@ -1,5 +1,5 @@ import * as utils from "../utils" -import { Duration, DurationType } from "../utils" +import { Duration } from "../utils" import env from "../environment" import { getTenantId } from "../context" import * as redis from "../redis/init" diff --git a/packages/backend-core/src/cache/writethrough.ts b/packages/backend-core/src/cache/writethrough.ts index 5cafe418d7..cd7409ca15 100644 --- a/packages/backend-core/src/cache/writethrough.ts +++ b/packages/backend-core/src/cache/writethrough.ts @@ -8,7 +8,7 @@ const DEFAULT_WRITE_RATE_MS = 10000 let CACHE: BaseCache | null = null interface CacheItem { - doc: any + doc: T lastWrite: number } diff --git a/packages/backend-core/src/db/lucene.ts b/packages/backend-core/src/db/lucene.ts index 7055ec8031..987d750d45 100644 --- a/packages/backend-core/src/db/lucene.ts +++ b/packages/backend-core/src/db/lucene.ts @@ -10,10 +10,6 @@ interface SearchResponse { totalRows: number } -interface PaginatedSearchResponse extends SearchResponse { - hasNextPage: boolean -} - export type SearchParams = { tableId?: string sort?: string diff --git a/packages/backend-core/src/docUpdates/index.ts b/packages/backend-core/src/docUpdates/index.ts index 3971f8de12..bd34f4f0cd 100644 --- a/packages/backend-core/src/docUpdates/index.ts +++ b/packages/backend-core/src/docUpdates/index.ts @@ -17,13 +17,8 @@ export function init(processors: ProcessorMap) { // if not processing in this instance, kick it off if (!processingPromise) { processingPromise = asyncEventQueue.process(async job => { - const { event, identity, properties, timestamp } = job.data - await documentProcessor.processEvent( - event, - identity, - properties, - timestamp - ) + const { event, identity, properties } = job.data + await documentProcessor.processEvent(event, identity, properties) }) } } diff --git a/packages/backend-core/src/events/processors/AuditLogsProcessor.ts b/packages/backend-core/src/events/processors/AuditLogsProcessor.ts index 94b4e1b09f..3dd2ab9d10 100644 --- a/packages/backend-core/src/events/processors/AuditLogsProcessor.ts +++ b/packages/backend-core/src/events/processors/AuditLogsProcessor.ts @@ -1,7 +1,6 @@ import { Event, Identity, - Group, IdentityType, AuditLogQueueEvent, AuditLogFn, @@ -79,11 +78,11 @@ export default class AuditLogsProcessor implements EventProcessor { } } - async identify(identity: Identity, timestamp?: string | number) { + async identify() { // no-op } - async identifyGroup(group: Group, timestamp?: string | number) { + async identifyGroup() { // no-op } diff --git a/packages/backend-core/src/events/processors/LoggingProcessor.ts b/packages/backend-core/src/events/processors/LoggingProcessor.ts index 0f4d02b99c..9f2dc5a473 100644 --- a/packages/backend-core/src/events/processors/LoggingProcessor.ts +++ b/packages/backend-core/src/events/processors/LoggingProcessor.ts @@ -8,8 +8,7 @@ export default class LoggingProcessor implements EventProcessor { async processEvent( event: Event, identity: Identity, - properties: any, - timestamp?: string + properties: any ): Promise { if (skipLogging) { return @@ -17,14 +16,14 @@ export default class LoggingProcessor implements EventProcessor { console.log(`[audit] [identityType=${identity.type}] ${event}`, properties) } - async identify(identity: Identity, timestamp?: string | number) { + async identify(identity: Identity) { if (skipLogging) { return } console.log(`[audit] identified`, identity) } - async identifyGroup(group: Group, timestamp?: string | number) { + async identifyGroup(group: Group) { if (skipLogging) { return } diff --git a/packages/backend-core/src/events/processors/async/DocumentUpdateProcessor.ts b/packages/backend-core/src/events/processors/async/DocumentUpdateProcessor.ts index 54304ee21b..92afcdc637 100644 --- a/packages/backend-core/src/events/processors/async/DocumentUpdateProcessor.ts +++ b/packages/backend-core/src/events/processors/async/DocumentUpdateProcessor.ts @@ -14,12 +14,7 @@ export default class DocumentUpdateProcessor implements EventProcessor { this.processors = processors } - async processEvent( - event: Event, - identity: Identity, - properties: any, - timestamp?: string | number - ) { + async processEvent(event: Event, identity: Identity, properties: any) { const tenantId = identity.realTenantId const docId = getDocumentId(event, properties) if (!tenantId || !docId) { diff --git a/packages/backend-core/src/middleware/matchers.ts b/packages/backend-core/src/middleware/matchers.ts index 8bede1cc6a..757d93a60d 100644 --- a/packages/backend-core/src/middleware/matchers.ts +++ b/packages/backend-core/src/middleware/matchers.ts @@ -28,7 +28,7 @@ export const buildMatcherRegex = ( } export const matches = (ctx: BBContext, options: RegexMatcher[]) => { - return options.find(({ regex, method, route }) => { + return options.find(({ regex, method }) => { const urlMatch = regex.test(ctx.request.url) const methodMatch = method === "ALL" diff --git a/packages/backend-core/src/middleware/passport/datasource/google.ts b/packages/backend-core/src/middleware/passport/datasource/google.ts index ab4ffee9d2..7f768f1623 100644 --- a/packages/backend-core/src/middleware/passport/datasource/google.ts +++ b/packages/backend-core/src/middleware/passport/datasource/google.ts @@ -3,7 +3,7 @@ import { Cookie } from "../../../constants" import * as configs from "../../../configs" import * as cache from "../../../cache" import * as utils from "../../../utils" -import { UserCtx, SSOProfile, DatasourceAuthCookie } from "@budibase/types" +import { UserCtx, SSOProfile } from "@budibase/types" import { ssoSaveUserNoOp } from "../sso/sso" const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy diff --git a/packages/backend-core/src/middleware/passport/sso/sso.ts b/packages/backend-core/src/middleware/passport/sso/sso.ts index 2fc1184722..ee84f03dae 100644 --- a/packages/backend-core/src/middleware/passport/sso/sso.ts +++ b/packages/backend-core/src/middleware/passport/sso/sso.ts @@ -5,7 +5,6 @@ import * as context from "../../../context" import fetch from "node-fetch" import { SaveSSOUserFunction, - SaveUserOpts, SSOAuthDetails, SSOUser, User, @@ -14,10 +13,8 @@ import { // no-op function for user save // - this allows datasource auth and access token refresh to work correctly // - prefer no-op over an optional argument to ensure function is provided to login flows -export const ssoSaveUserNoOp: SaveSSOUserFunction = ( - user: SSOUser, - opts: SaveUserOpts -) => Promise.resolve(user) +export const ssoSaveUserNoOp: SaveSSOUserFunction = (user: SSOUser) => + Promise.resolve(user) /** * Common authentication logic for third parties. e.g. OAuth, OIDC. diff --git a/packages/backend-core/src/migrations/migrations.ts b/packages/backend-core/src/migrations/migrations.ts index c750bc4882..3f033b8cdb 100644 --- a/packages/backend-core/src/migrations/migrations.ts +++ b/packages/backend-core/src/migrations/migrations.ts @@ -45,10 +45,6 @@ export const runMigration = async ( options: MigrationOptions = {} ) => { const migrationType = migration.type - let tenantId: string | undefined - if (migrationType !== MigrationType.INSTALLATION) { - tenantId = context.getTenantId() - } const migrationName = migration.name const silent = migration.silent diff --git a/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts b/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts index cbbbee6255..4a132ce54d 100644 --- a/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts +++ b/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts @@ -126,7 +126,7 @@ describe("app", () => { it("gets url with embedded minio", async () => { testEnv.withMinio() - await testEnv.withTenant(tenantId => { + await testEnv.withTenant(() => { const url = getAppFileUrl() expect(url).toBe( "/files/signed/prod-budi-app-assets/app_123/attachments/image.jpeg" @@ -136,7 +136,7 @@ describe("app", () => { it("gets url with custom S3", async () => { testEnv.withS3() - await testEnv.withTenant(tenantId => { + await testEnv.withTenant(() => { const url = getAppFileUrl() expect(url).toBe( "http://s3.example.com/prod-budi-app-assets/app_123/attachments/image.jpeg" @@ -146,7 +146,7 @@ describe("app", () => { it("gets url with cloudfront + s3", async () => { testEnv.withCloudfront() - await testEnv.withTenant(tenantId => { + await testEnv.withTenant(() => { const url = getAppFileUrl() // omit rest of signed params expect( diff --git a/packages/backend-core/src/platform/tests/tenants.spec.ts b/packages/backend-core/src/platform/tests/tenants.spec.ts index b2ab75c954..e22003fd45 100644 --- a/packages/backend-core/src/platform/tests/tenants.spec.ts +++ b/packages/backend-core/src/platform/tests/tenants.spec.ts @@ -3,7 +3,7 @@ import { DBTestConfiguration } from "../../../tests/extra" import * as tenants from "../tenants" describe("tenants", () => { - const config = new DBTestConfiguration() + new DBTestConfiguration() describe("addTenant", () => { it("concurrently adds multiple tenants safely", async () => { diff --git a/packages/backend-core/src/queue/inMemoryQueue.ts b/packages/backend-core/src/queue/inMemoryQueue.ts index f10194b8cf..87e43b324d 100644 --- a/packages/backend-core/src/queue/inMemoryQueue.ts +++ b/packages/backend-core/src/queue/inMemoryQueue.ts @@ -166,7 +166,7 @@ class InMemoryQueue implements Partial { return [] } - // eslint-disable-next-line no-unused-vars + // eslint-disable-next-line @typescript-eslint/no-unused-vars async removeJobs(pattern: string) { // no-op } diff --git a/packages/backend-core/src/queue/listeners.ts b/packages/backend-core/src/queue/listeners.ts index 14dce5fe8d..cd25ff2254 100644 --- a/packages/backend-core/src/queue/listeners.ts +++ b/packages/backend-core/src/queue/listeners.ts @@ -132,7 +132,7 @@ function logging(queue: Queue, jobQueue: JobQueue) { // A Job is waiting to be processed as soon as a worker is idling. console.info(...getLogParams(eventType, BullEvent.WAITING, { jobId })) }) - .on(BullEvent.ACTIVE, async (job: Job, jobPromise: any) => { + .on(BullEvent.ACTIVE, async (job: Job) => { // A job has started. You can use `jobPromise.cancel()`` to abort it. await doInJobContext(job, () => { console.info(...getLogParams(eventType, BullEvent.ACTIVE, { job })) diff --git a/packages/backend-core/src/redis/init.ts b/packages/backend-core/src/redis/init.ts index 7920dfed2d..44ba28a83c 100644 --- a/packages/backend-core/src/redis/init.ts +++ b/packages/backend-core/src/redis/init.ts @@ -40,6 +40,7 @@ export async function shutdown() { if (inviteClient) await inviteClient.finish() if (passwordResetClient) await passwordResetClient.finish() if (socketClient) await socketClient.finish() + if (docWritethroughClient) await docWritethroughClient.finish() } process.on("exit", async () => { diff --git a/packages/backend-core/src/redis/tests/redis.spec.ts b/packages/backend-core/src/redis/tests/redis.spec.ts index e2076ad698..4d11caf220 100644 --- a/packages/backend-core/src/redis/tests/redis.spec.ts +++ b/packages/backend-core/src/redis/tests/redis.spec.ts @@ -120,7 +120,7 @@ describe("redis", () => { await redis.bulkStore(data, ttl) - for (const [key, value] of Object.entries(data)) { + for (const key of Object.keys(data)) { expect(await redis.get(key)).toBe(null) } diff --git a/packages/backend-core/src/users/test/utils.spec.ts b/packages/backend-core/src/users/test/utils.spec.ts index 0fe27f57a6..cb98b8972b 100644 --- a/packages/backend-core/src/users/test/utils.spec.ts +++ b/packages/backend-core/src/users/test/utils.spec.ts @@ -45,7 +45,7 @@ describe("Users", () => { ...{ _id: groupId, roles: { app1: "ADMIN" } }, } const users: User[] = [] - for (const _ of Array.from({ length: usersInGroup })) { + for (let i = 0; i < usersInGroup; i++) { const userId = `us_${generator.guid()}` const user: User = structures.users.user({ _id: userId, diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index d714bafc70..035dc5a2ef 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -129,10 +129,7 @@ filteredUsers = $usersFetch.rows .filter(user => user.email !== $auth.user.email) .map(user => { - const isAdminOrGlobalBuilder = sdk.users.isAdminOrGlobalBuilder( - user, - prodAppId - ) + const isAdminOrGlobalBuilder = sdk.users.isAdminOrGlobalBuilder(user) const isAppBuilder = user.builder?.apps?.includes(prodAppId) let role if (isAdminOrGlobalBuilder) { diff --git a/packages/server/__mocks__/@google-cloud/firestore.ts b/packages/server/__mocks__/@google-cloud/firestore.ts index a438d6a7c5..a5bccb1fa8 100644 --- a/packages/server/__mocks__/@google-cloud/firestore.ts +++ b/packages/server/__mocks__/@google-cloud/firestore.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars module FirebaseMock { const firebase: any = {} diff --git a/packages/server/__mocks__/@sendgrid/mail.ts b/packages/server/__mocks__/@sendgrid/mail.ts index 030a2dbd4c..8613ae4b16 100644 --- a/packages/server/__mocks__/@sendgrid/mail.ts +++ b/packages/server/__mocks__/@sendgrid/mail.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars module SendgridMock { class Email { constructor() { diff --git a/packages/server/__mocks__/arangojs.ts b/packages/server/__mocks__/arangojs.ts index 5f980a7f97..77ec7a9d42 100644 --- a/packages/server/__mocks__/arangojs.ts +++ b/packages/server/__mocks__/arangojs.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars module ArangoMock { const arangodb: any = {} diff --git a/packages/server/__mocks__/mongodb.ts b/packages/server/__mocks__/mongodb.ts index 01b6e76fc4..659d35f5b3 100644 --- a/packages/server/__mocks__/mongodb.ts +++ b/packages/server/__mocks__/mongodb.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars module MongoMock { const mongodb: any = {} diff --git a/packages/server/__mocks__/mysql2/promise.ts b/packages/server/__mocks__/mysql2/promise.ts index 8a8fb7fcf0..f8a4c7b2d6 100644 --- a/packages/server/__mocks__/mysql2/promise.ts +++ b/packages/server/__mocks__/mysql2/promise.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars module MySQLMock { const mysql: any = {} diff --git a/packages/server/__mocks__/node-fetch.ts b/packages/server/__mocks__/node-fetch.ts index 98c75bb84f..c5073499a7 100644 --- a/packages/server/__mocks__/node-fetch.ts +++ b/packages/server/__mocks__/node-fetch.ts @@ -1,6 +1,7 @@ // @ts-ignore import fs from "fs" +// eslint-disable-next-line @typescript-eslint/no-unused-vars module FetchMock { // @ts-ignore const fetch = jest.requireActual("node-fetch") diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 8e62954d88..40db259289 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -26,7 +26,6 @@ import { env as envCore, ErrorCode, events, - HTTPError, migrations, objectStore, roles, diff --git a/packages/server/src/api/controllers/role.ts b/packages/server/src/api/controllers/role.ts index 2f5340d2e6..3398c8102c 100644 --- a/packages/server/src/api/controllers/role.ts +++ b/packages/server/src/api/controllers/role.ts @@ -116,7 +116,7 @@ export async function save(ctx: UserCtx) { target: prodDb.name, }) await replication.replicate({ - filter: (doc: any, params: any) => { + filter: (doc: any) => { return doc._id && doc._id.startsWith("role_") }, }) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index d25ae952e3..f89c9dc51a 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -7,13 +7,11 @@ import { FilterType, IncludeRelationship, ManyToManyRelationshipFieldMetadata, - ManyToOneRelationshipFieldMetadata, OneToManyRelationshipFieldMetadata, Operation, PaginationJson, RelationshipFieldMetadata, RelationshipsJson, - RelationshipType, Row, SearchFilters, SortJson, diff --git a/packages/server/src/api/controllers/row/views.ts b/packages/server/src/api/controllers/row/views.ts index 188fe86f17..2c6cb4b17a 100644 --- a/packages/server/src/api/controllers/row/views.ts +++ b/packages/server/src/api/controllers/row/views.ts @@ -1,4 +1,3 @@ -import { quotas } from "@budibase/pro" import { UserCtx, ViewV2, diff --git a/packages/server/src/api/controllers/user.ts b/packages/server/src/api/controllers/user.ts index 7fc5c6e1bc..108e29fd3d 100644 --- a/packages/server/src/api/controllers/user.ts +++ b/packages/server/src/api/controllers/user.ts @@ -1,6 +1,6 @@ import { generateUserFlagID, InternalTables } from "../../db/utils" import { getFullUser } from "../../utilities/users" -import { cache, context } from "@budibase/backend-core" +import { context } from "@budibase/backend-core" import { ContextUserMetadata, Ctx, diff --git a/packages/server/src/api/controllers/view/viewsV2.ts b/packages/server/src/api/controllers/view/viewsV2.ts index f4f969622a..a386ac303f 100644 --- a/packages/server/src/api/controllers/view/viewsV2.ts +++ b/packages/server/src/api/controllers/view/viewsV2.ts @@ -24,7 +24,7 @@ async function parseSchema(view: CreateViewRequest) { icon: schemaValue.icon, } Object.entries(fieldSchema) - .filter(([_, val]) => val === undefined) + .filter(([, val]) => val === undefined) .forEach(([key]) => { delete fieldSchema[key as keyof UIFieldMetadata] }) diff --git a/packages/server/src/api/routes/index.ts b/packages/server/src/api/routes/index.ts index 22d0a20c9b..5a42c258cf 100644 --- a/packages/server/src/api/routes/index.ts +++ b/packages/server/src/api/routes/index.ts @@ -33,7 +33,6 @@ export { default as staticRoutes } from "./static" export { default as publicRoutes } from "./public" const appBackupRoutes = pro.appBackups -const scheduleRoutes = pro.schedules const environmentVariableRoutes = pro.environmentVariables export const mainRoutes: Router[] = [ @@ -65,7 +64,6 @@ export const mainRoutes: Router[] = [ pluginRoutes, opsRoutes, debugRoutes, - scheduleRoutes, environmentVariableRoutes, // these need to be handled last as they still use /api/:tableId // this could be breaking as koa may recognise other routes as this diff --git a/packages/server/src/api/routes/tests/appImport.spec.ts b/packages/server/src/api/routes/tests/appImport.spec.ts index b2ef39838d..75e9f91d63 100644 --- a/packages/server/src/api/routes/tests/appImport.spec.ts +++ b/packages/server/src/api/routes/tests/appImport.spec.ts @@ -16,7 +16,7 @@ describe("/applications/:appId/import", () => { it("should be able to perform import", async () => { const appId = config.getAppId() - const res = await request + await request .post(`/api/applications/${appId}/import`) .field("encryptionPassword", PASSWORD) .attach("appExport", path.join(__dirname, "assets", "export.tar.gz")) diff --git a/packages/server/src/api/routes/tests/appSync.spec.ts b/packages/server/src/api/routes/tests/appSync.spec.ts index 0773b2b008..93b8175c48 100644 --- a/packages/server/src/api/routes/tests/appSync.spec.ts +++ b/packages/server/src/api/routes/tests/appSync.spec.ts @@ -2,7 +2,6 @@ import * as setup from "./utilities" import { roles, db as dbCore } from "@budibase/backend-core" describe("/api/applications/:appId/sync", () => { - let request = setup.getRequest() let config = setup.getConfig() let app diff --git a/packages/server/src/api/routes/tests/application.spec.ts b/packages/server/src/api/routes/tests/application.spec.ts index 6b0ba89350..0061c37ba0 100644 --- a/packages/server/src/api/routes/tests/application.spec.ts +++ b/packages/server/src/api/routes/tests/application.spec.ts @@ -368,7 +368,7 @@ describe("/applications", () => { }) it("should reject with a known name", async () => { - const resp = await config.api.application.duplicateApp( + await config.api.application.duplicateApp( app.appId, { name: app.name, @@ -380,7 +380,7 @@ describe("/applications", () => { }) it("should reject with a known url", async () => { - const resp = await config.api.application.duplicateApp( + await config.api.application.duplicateApp( app.appId, { name: "this is fine", diff --git a/packages/server/src/api/routes/tests/permissions.spec.ts b/packages/server/src/api/routes/tests/permissions.spec.ts index af7a2a578e..bee794da47 100644 --- a/packages/server/src/api/routes/tests/permissions.spec.ts +++ b/packages/server/src/api/routes/tests/permissions.spec.ts @@ -156,7 +156,7 @@ describe("/permission", () => { level: PermissionLevel.READ, }) - const response = await config.api.permission.revoke( + await config.api.permission.revoke( { roleId: STD_ROLE_ID, resourceId: table._id, diff --git a/packages/server/src/api/routes/tests/queries/mysql.spec.ts b/packages/server/src/api/routes/tests/queries/mysql.spec.ts index 1c9c1d3865..6c97ab5835 100644 --- a/packages/server/src/api/routes/tests/queries/mysql.spec.ts +++ b/packages/server/src/api/routes/tests/queries/mysql.spec.ts @@ -65,7 +65,7 @@ describe("/queries", () => { beforeEach(async () => { await withConnection(async connection => { - const resp = await connection.query(createTableSQL) + await connection.query(createTableSQL) await connection.query(insertSQL) }) }) diff --git a/packages/server/src/api/routes/tests/view.spec.ts b/packages/server/src/api/routes/tests/view.spec.ts index d5a4dd6aeb..4f38603691 100644 --- a/packages/server/src/api/routes/tests/view.spec.ts +++ b/packages/server/src/api/routes/tests/view.spec.ts @@ -74,7 +74,7 @@ describe("/views", () => { describe("create", () => { it("returns a success message when the view is successfully created", async () => { - const res = await saveView() + await saveView() expect(events.view.created).toHaveBeenCalledTimes(1) }) diff --git a/packages/server/src/automations/automationUtils.ts b/packages/server/src/automations/automationUtils.ts index 8a298a49a3..6730e04494 100644 --- a/packages/server/src/automations/automationUtils.ts +++ b/packages/server/src/automations/automationUtils.ts @@ -5,7 +5,7 @@ import { } from "@budibase/string-templates" import sdk from "../sdk" import { Row } from "@budibase/types" -import { LoopInput, LoopStep, LoopStepType } from "../definitions/automations" +import { LoopInput, LoopStepType } from "../definitions/automations" /** * When values are input to the system generally they will be of type string as this is required for template strings. diff --git a/packages/server/src/automations/steps/collect.ts b/packages/server/src/automations/steps/collect.ts index ef1fe64772..035bd36a46 100644 --- a/packages/server/src/automations/steps/collect.ts +++ b/packages/server/src/automations/steps/collect.ts @@ -4,7 +4,6 @@ import { AutomationStepInput, AutomationStepType, AutomationIOType, - AutomationFeature, } from "@budibase/types" export const definition: AutomationStepSchema = { diff --git a/packages/server/src/automations/steps/executeQuery.ts b/packages/server/src/automations/steps/executeQuery.ts index ea0737c86a..a9517b01a0 100644 --- a/packages/server/src/automations/steps/executeQuery.ts +++ b/packages/server/src/automations/steps/executeQuery.ts @@ -10,8 +10,6 @@ import { AutomationStepSchema, AutomationStepType, } from "@budibase/types" -import { utils } from "@budibase/backend-core" -import env from "../../environment" export const definition: AutomationStepSchema = { name: "External Data Connector", diff --git a/packages/server/src/automations/steps/openai.ts b/packages/server/src/automations/steps/openai.ts index 8ae211579e..bc926de7b7 100644 --- a/packages/server/src/automations/steps/openai.ts +++ b/packages/server/src/automations/steps/openai.ts @@ -58,7 +58,7 @@ export const definition: AutomationStepSchema = { }, } -export async function run({ inputs, context }: AutomationStepInput) { +export async function run({ inputs }: AutomationStepInput) { if (!environment.OPENAI_API_KEY) { return { success: false, diff --git a/packages/server/src/automations/steps/triggerAutomationRun.ts b/packages/server/src/automations/steps/triggerAutomationRun.ts index 83e1722877..f45a60600f 100644 --- a/packages/server/src/automations/steps/triggerAutomationRun.ts +++ b/packages/server/src/automations/steps/triggerAutomationRun.ts @@ -62,6 +62,7 @@ export const definition: AutomationStepSchema = { } export async function run({ inputs }: AutomationStepInput) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { automationId, ...fieldParams } = inputs.automation if (await features.isTriggerAutomationRunEnabled()) { diff --git a/packages/server/src/automations/tests/loop.spec.ts b/packages/server/src/automations/tests/loop.spec.ts index 68ab694c5d..2c6ae9749d 100644 --- a/packages/server/src/automations/tests/loop.spec.ts +++ b/packages/server/src/automations/tests/loop.spec.ts @@ -3,19 +3,18 @@ import * as triggers from "../triggers" import { loopAutomation } from "../../tests/utilities/structures" import { context } from "@budibase/backend-core" import * as setup from "./utilities" -import { Row, Table } from "@budibase/types" +import { Table } from "@budibase/types" import { LoopInput, LoopStepType } from "../../definitions/automations" describe("Attempt to run a basic loop automation", () => { let config = setup.getConfig(), - table: Table, - row: Row + table: Table beforeEach(async () => { await automation.init() await config.init() table = await config.createTable() - row = await config.createRow() + await config.createRow() }) afterAll(setup.afterAll) diff --git a/packages/server/src/automations/unitTests/automationUtils.spec.ts b/packages/server/src/automations/unitTests/automationUtils.spec.ts index 7de4a2e35b..afb6219ef2 100644 --- a/packages/server/src/automations/unitTests/automationUtils.spec.ts +++ b/packages/server/src/automations/unitTests/automationUtils.spec.ts @@ -1,4 +1,4 @@ -import { LoopStep, LoopStepType } from "../../definitions/automations" +import { LoopStepType } from "../../definitions/automations" import { typecastForLooping, cleanInputValues, diff --git a/packages/server/src/constants/index.ts b/packages/server/src/constants/index.ts index 49f1d01afb..d2bc3c44e3 100644 --- a/packages/server/src/constants/index.ts +++ b/packages/server/src/constants/index.ts @@ -6,6 +6,10 @@ import { TableSourceType, } from "@budibase/types" +import env from "../environment" + +export const AWS_REGION = env.AWS_REGION ? env.AWS_REGION : "eu-west-1" + export enum FilterTypes { STRING = "string", FUZZY = "fuzzy", diff --git a/packages/server/src/db/dynamoClient.ts b/packages/server/src/db/dynamoClient.ts deleted file mode 100644 index 148c433c41..0000000000 --- a/packages/server/src/db/dynamoClient.ts +++ /dev/null @@ -1,147 +0,0 @@ -import merge from "lodash/merge" -import env from "../environment" - -export const AWS_REGION = env.AWS_REGION ? env.AWS_REGION : "eu-west-1" - -const TableInfo = { - API_KEYS: { - name: "beta-api-key-table", - primary: "pk", - }, - USERS: { - name: "prod-budi-table", - primary: "pk", - sort: "sk", - }, -} - -let docClient: any = null - -type GetOpts = { - primary: string - sort?: string - otherProps?: any -} - -type UpdateOpts = { - primary: string - sort?: string - expression?: string - condition?: string - names?: string[] - values?: any[] - exists?: boolean - otherProps?: any -} - -type PutOpts = { - item: any - otherProps?: any -} - -class Table { - _name: string - _primary: string - _sort?: string - - constructor(tableInfo: { name: string; primary: string; sort?: string }) { - if (!tableInfo.name || !tableInfo.primary) { - throw "Table info must specify a name and a primary key" - } - this._name = tableInfo.name - this._primary = tableInfo.primary - this._sort = tableInfo.sort - } - - async get({ primary, sort, otherProps }: GetOpts) { - let params = { - TableName: this._name, - Key: { - [this._primary]: primary, - }, - } - if (this._sort && sort) { - params.Key[this._sort] = sort - } - if (otherProps) { - params = merge(params, otherProps) - } - let response = await docClient.get(params).promise() - return response.Item - } - - async update({ - primary, - sort, - expression, - condition, - names, - values, - exists, - otherProps, - }: UpdateOpts) { - let params: any = { - TableName: this._name, - Key: { - [this._primary]: primary, - }, - ExpressionAttributeNames: names, - ExpressionAttributeValues: values, - UpdateExpression: expression, - } - if (condition) { - params.ConditionExpression = condition - } - if (this._sort && sort) { - params.Key[this._sort] = sort - } - if (exists) { - params.ExpressionAttributeNames["#PRIMARY"] = this._primary - if (params.ConditionExpression) { - params.ConditionExpression += " AND " - } - params.ConditionExpression += "attribute_exists(#PRIMARY)" - } - if (otherProps) { - params = merge(params, otherProps) - } - return docClient.update(params).promise() - } - - async put({ item, otherProps }: PutOpts) { - if ( - item[this._primary] == null || - (this._sort && item[this._sort] == null) - ) { - throw "Cannot put item without primary and sort key (if required)" - } - let params = { - TableName: this._name, - Item: item, - } - if (otherProps) { - params = merge(params, otherProps) - } - return docClient.put(params).promise() - } -} - -export function init(endpoint: string) { - let AWS = require("aws-sdk") - let docClientParams: any = { - correctClockSkew: true, - region: AWS_REGION, - } - if (endpoint) { - docClientParams.endpoint = endpoint - } else if (env.DYNAMO_ENDPOINT) { - docClientParams.endpoint = env.DYNAMO_ENDPOINT - } - docClient = new AWS.DynamoDB.DocumentClient(docClientParams) -} - -if (!env.isProd() && !env.isJest()) { - env._set("AWS_ACCESS_KEY_ID", "KEY_ID") - env._set("AWS_SECRET_ACCESS_KEY", "SECRET_KEY") - init("http://localhost:8333") -} diff --git a/packages/server/src/db/linkedRows/index.ts b/packages/server/src/db/linkedRows/index.ts index 513e0c0df2..1eb534a7f8 100644 --- a/packages/server/src/db/linkedRows/index.ts +++ b/packages/server/src/db/linkedRows/index.ts @@ -18,7 +18,6 @@ import { Row, LinkDocumentValue, FieldType, - LinkDocument, ContextUser, } from "@budibase/types" import sdk from "../../sdk" diff --git a/packages/server/src/features.ts b/packages/server/src/features.ts index f040cf82a2..3ab9410f53 100644 --- a/packages/server/src/features.ts +++ b/packages/server/src/features.ts @@ -1,8 +1,11 @@ import { features } from "@budibase/backend-core" import env from "./environment" +// eslint-disable-next-line no-unused-vars enum AppFeature { + // eslint-disable-next-line no-unused-vars API = "api", + // eslint-disable-next-line no-unused-vars AUTOMATIONS = "automations", } diff --git a/packages/server/src/integration-test/mysql.spec.ts b/packages/server/src/integration-test/mysql.spec.ts index b8f1affd4a..a22410b812 100644 --- a/packages/server/src/integration-test/mysql.spec.ts +++ b/packages/server/src/integration-test/mysql.spec.ts @@ -12,7 +12,6 @@ import { TableRequest, TableSourceType, } from "@budibase/types" -import _ from "lodash" import { databaseTestProviders } from "../integrations/tests/utils" import mysql from "mysql2/promise" import { builderSocket } from "../websockets" diff --git a/packages/server/src/integrations/dynamodb.ts b/packages/server/src/integrations/dynamodb.ts index bede4a7f7c..424a3dfce0 100644 --- a/packages/server/src/integrations/dynamodb.ts +++ b/packages/server/src/integrations/dynamodb.ts @@ -8,7 +8,7 @@ import { } from "@budibase/types" import AWS from "aws-sdk" -import { AWS_REGION } from "../db/dynamoClient" +import { AWS_REGION } from "../constants" import { DocumentClient } from "aws-sdk/clients/dynamodb" interface DynamoDBConfig { diff --git a/packages/server/src/integrations/googlesheets.ts b/packages/server/src/integrations/googlesheets.ts index 32398bde41..bc0e25e267 100644 --- a/packages/server/src/integrations/googlesheets.ts +++ b/packages/server/src/integrations/googlesheets.ts @@ -168,6 +168,7 @@ class GoogleSheetsIntegration implements DatasourcePlus { return "" } + // eslint-disable-next-line @typescript-eslint/no-unused-vars getStringConcat(parts: string[]) { return "" } diff --git a/packages/server/src/integrations/microsoftSqlServer.ts b/packages/server/src/integrations/microsoftSqlServer.ts index 728bafe57f..831fcd3d20 100644 --- a/packages/server/src/integrations/microsoftSqlServer.ts +++ b/packages/server/src/integrations/microsoftSqlServer.ts @@ -14,8 +14,6 @@ import { Schema, TableSourceType, DatasourcePlusQueryResponse, - FieldType, - FieldSubtype, } from "@budibase/types" import { getSqlQuery, diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index f88162cf37..db3819f468 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -13,8 +13,6 @@ import { Schema, TableSourceType, DatasourcePlusQueryResponse, - FieldType, - FieldSubtype, } from "@budibase/types" import { getSqlQuery, diff --git a/packages/server/src/integrations/tests/airtable.spec.ts b/packages/server/src/integrations/tests/airtable.spec.ts index eeb3d65046..367e31e8a0 100644 --- a/packages/server/src/integrations/tests/airtable.spec.ts +++ b/packages/server/src/integrations/tests/airtable.spec.ts @@ -28,7 +28,7 @@ describe("Airtable Integration", () => { }) it("calls the create method with the correct params", async () => { - const response = await config.integration.create({ + await config.integration.create({ table: "test", json: {}, }) @@ -40,7 +40,7 @@ describe("Airtable Integration", () => { }) it("calls the read method with the correct params", async () => { - const response = await config.integration.read({ + await config.integration.read({ table: "test", view: "Grid view", }) @@ -51,7 +51,7 @@ describe("Airtable Integration", () => { }) it("calls the update method with the correct params", async () => { - const response = await config.integration.update({ + await config.integration.update({ table: "table", id: "123", json: { @@ -68,7 +68,7 @@ describe("Airtable Integration", () => { it("calls the delete method with the correct params", async () => { const ids = [1, 2, 3, 4] - const response = await config.integration.delete({ + await config.integration.delete({ ids, }) expect(config.client.destroy).toHaveBeenCalledWith(ids) diff --git a/packages/server/src/integrations/tests/arangodb.spec.ts b/packages/server/src/integrations/tests/arangodb.spec.ts index c7339299dd..6ac242d8db 100644 --- a/packages/server/src/integrations/tests/arangodb.spec.ts +++ b/packages/server/src/integrations/tests/arangodb.spec.ts @@ -12,7 +12,6 @@ class TestConfiguration { describe("ArangoDB Integration", () => { let config: any - let indexName = "Users" beforeEach(() => { config = new TestConfiguration() @@ -23,7 +22,7 @@ describe("ArangoDB Integration", () => { json: "Hello", } - const response = await config.integration.create(body) + await config.integration.create(body) expect(config.integration.client.query).toHaveBeenCalledWith( `INSERT Hello INTO collection RETURN NEW` ) @@ -33,7 +32,7 @@ describe("ArangoDB Integration", () => { const query = { sql: `test`, } - const response = await config.integration.read(query) + await config.integration.read(query) expect(config.integration.client.query).toHaveBeenCalledWith(query.sql) }) }) diff --git a/packages/server/src/integrations/tests/couchdb.spec.ts b/packages/server/src/integrations/tests/couchdb.spec.ts index 66735d7b74..f27713a81f 100644 --- a/packages/server/src/integrations/tests/couchdb.spec.ts +++ b/packages/server/src/integrations/tests/couchdb.spec.ts @@ -79,7 +79,7 @@ describe("CouchDB Integration", () => { it("calls the delete method with the correct params", async () => { const id = "1234" - const response = await config.integration.delete({ id }) + await config.integration.delete({ id }) expect(config.integration.client.get).toHaveBeenCalledWith(id) expect(config.integration.client.remove).toHaveBeenCalled() }) diff --git a/packages/server/src/integrations/tests/dynamodb.spec.ts b/packages/server/src/integrations/tests/dynamodb.spec.ts index a7a2767469..0215817907 100644 --- a/packages/server/src/integrations/tests/dynamodb.spec.ts +++ b/packages/server/src/integrations/tests/dynamodb.spec.ts @@ -19,7 +19,7 @@ describe("DynamoDB Integration", () => { }) it("calls the create method with the correct params", async () => { - const response = await config.integration.create({ + await config.integration.create({ table: tableName, json: { Name: "John", @@ -66,7 +66,7 @@ describe("DynamoDB Integration", () => { }) it("calls the get method with the correct params", async () => { - const response = await config.integration.get({ + await config.integration.get({ table: tableName, json: { Id: 123, @@ -80,7 +80,7 @@ describe("DynamoDB Integration", () => { }) it("calls the update method with the correct params", async () => { - const response = await config.integration.update({ + await config.integration.update({ table: tableName, json: { Name: "John", @@ -93,7 +93,7 @@ describe("DynamoDB Integration", () => { }) it("calls the delete method with the correct params", async () => { - const response = await config.integration.delete({ + await config.integration.delete({ table: tableName, json: { Name: "John", diff --git a/packages/server/src/integrations/tests/elasticsearch.spec.ts b/packages/server/src/integrations/tests/elasticsearch.spec.ts index e21e8dec69..f8a1dd8013 100644 --- a/packages/server/src/integrations/tests/elasticsearch.spec.ts +++ b/packages/server/src/integrations/tests/elasticsearch.spec.ts @@ -22,7 +22,7 @@ describe("Elasticsearch Integration", () => { const body = { name: "Hello", } - const response = await config.integration.create({ + await config.integration.create({ index: indexName, json: body, }) diff --git a/packages/server/src/integrations/tests/firebase.spec.ts b/packages/server/src/integrations/tests/firebase.spec.ts index f2cea8898f..c5c214d232 100644 --- a/packages/server/src/integrations/tests/firebase.spec.ts +++ b/packages/server/src/integrations/tests/firebase.spec.ts @@ -81,7 +81,7 @@ describe("Firebase Integration", () => { }) it("calls the delete method with the correct params", async () => { - const response = await config.integration.delete({ + await config.integration.delete({ table: tableName, json: { id: "test", diff --git a/packages/server/src/integrations/tests/oracle.spec.ts b/packages/server/src/integrations/tests/oracle.spec.ts index 80ad969e3b..7b620d68ad 100644 --- a/packages/server/src/integrations/tests/oracle.spec.ts +++ b/packages/server/src/integrations/tests/oracle.spec.ts @@ -44,7 +44,7 @@ describe("Oracle Integration", () => { it("calls the update method with the correct params", async () => { const sql = "update table users set name = 'test';" - const response = await config.integration.update({ + await config.integration.update({ sql, }) expect(oracledb.executeMock).toHaveBeenCalledWith(sql, [], options) diff --git a/packages/server/src/integrations/tests/postgres.spec.ts b/packages/server/src/integrations/tests/postgres.spec.ts index 1acdff6bcf..cbce86acd0 100644 --- a/packages/server/src/integrations/tests/postgres.spec.ts +++ b/packages/server/src/integrations/tests/postgres.spec.ts @@ -37,7 +37,7 @@ describe("Postgres Integration", () => { it("calls the update method with the correct params", async () => { const sql = "update table users set name = 'test';" - const response = await config.integration.update({ + await config.integration.update({ sql, }) expect(pg.queryMock).toHaveBeenCalledWith(sql, []) diff --git a/packages/server/src/integrations/tests/rest.spec.ts b/packages/server/src/integrations/tests/rest.spec.ts index 182a6d3f13..3335f44a7b 100644 --- a/packages/server/src/integrations/tests/rest.spec.ts +++ b/packages/server/src/integrations/tests/rest.spec.ts @@ -70,7 +70,7 @@ describe("REST Integration", () => { Accept: "text/html", }, } - const response = await config.integration.read(query) + await config.integration.read(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { headers: { Accept: "text/html", @@ -91,7 +91,7 @@ describe("REST Integration", () => { name: "test", }), } - const response = await config.integration.update(query) + await config.integration.update(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { method: "PUT", body: '{"name":"test"}', @@ -111,7 +111,7 @@ describe("REST Integration", () => { name: "test", }), } - const response = await config.integration.delete(query) + await config.integration.delete(query) expect(fetch).toHaveBeenCalledWith(`${BASE_URL}/api?test=1`, { method: "DELETE", headers: HEADERS, diff --git a/packages/server/src/integrations/tests/s3.spec.ts b/packages/server/src/integrations/tests/s3.spec.ts index 40f73928f2..b75340ab20 100644 --- a/packages/server/src/integrations/tests/s3.spec.ts +++ b/packages/server/src/integrations/tests/s3.spec.ts @@ -1,5 +1,3 @@ -const AWS = require("aws-sdk") - import { default as S3Integration } from "../s3" jest.mock("aws-sdk") diff --git a/packages/server/src/jsRunner/bundles/index.ts b/packages/server/src/jsRunner/bundles/index.ts index f7685206a6..94a40fea29 100644 --- a/packages/server/src/jsRunner/bundles/index.ts +++ b/packages/server/src/jsRunner/bundles/index.ts @@ -1,5 +1,3 @@ -import { utils } from "@budibase/shared-core" -import environment from "../../environment" import fs from "fs" export const enum BundleType { diff --git a/packages/server/src/jsRunner/index.ts b/packages/server/src/jsRunner/index.ts index b5c8e036f6..7065febcb4 100644 --- a/packages/server/src/jsRunner/index.ts +++ b/packages/server/src/jsRunner/index.ts @@ -8,11 +8,10 @@ import { import { context, logging } from "@budibase/backend-core" import tracer from "dd-trace" import { IsolatedVM } from "./vm" -import type { VM } from "@budibase/types" export function init() { setJSRunner((js: string, ctx: Record) => { - return tracer.trace("runJS", {}, span => { + return tracer.trace("runJS", {}, () => { try { // Reuse an existing isolate from context, or make a new one const bbCtx = context.getCurrentContext() @@ -36,6 +35,7 @@ export function init() { // Because we can't pass functions into an Isolate, we remove them from // the passed context and rely on the withHelpers() method to add them // back in. + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { helpers, snippets, ...rest } = ctx return vm.withContext(rest, () => vm.execute(js)) } catch (error: any) { diff --git a/packages/server/src/middleware/cleanup.ts b/packages/server/src/middleware/cleanup.ts index 43f945ab6b..fa04743cee 100644 --- a/packages/server/src/middleware/cleanup.ts +++ b/packages/server/src/middleware/cleanup.ts @@ -13,7 +13,7 @@ export default async (ctx: Ctx, next: any) => { let errors = [] for (let fn of current.cleanup) { try { - await tracer.trace("cleanup", async span => { + await tracer.trace("cleanup", async () => { await fn() }) } catch (e) { diff --git a/packages/server/src/middleware/tests/authorized.spec.ts b/packages/server/src/middleware/tests/authorized.spec.ts index 72c286cb01..79cfeca54e 100644 --- a/packages/server/src/middleware/tests/authorized.spec.ts +++ b/packages/server/src/middleware/tests/authorized.spec.ts @@ -11,7 +11,6 @@ import { import authorizedMiddleware from "../authorized" import env from "../../environment" -import { generateTableID, generateViewID } from "../../db/utils" import { generator, mocks } from "@budibase/backend-core/tests" import { initProMocks } from "../../tests/utilities/mocks/pro" import { getResourcePerms } from "../../sdk/app/permissions" diff --git a/packages/server/src/middleware/trimViewRowInfo.ts b/packages/server/src/middleware/trimViewRowInfo.ts index 95b085a08f..4c382e6123 100644 --- a/packages/server/src/middleware/trimViewRowInfo.ts +++ b/packages/server/src/middleware/trimViewRowInfo.ts @@ -32,10 +32,7 @@ export default async (ctx: Ctx, next: Next) => { } // have to mutate the koa context, can't return -export async function trimViewFields( - body: Row, - viewId: string -): Promise { +export async function trimViewFields(body: Row, viewId: string): Promise { const view = await sdk.views.get(viewId) const allowedKeys = sdk.views.allowedFields(view) // have to mutate the context, can't update reference diff --git a/packages/server/src/migrations/functions/backfill/global/users.ts b/packages/server/src/migrations/functions/backfill/global/users.ts index 9f536a97a5..b3dae822d7 100644 --- a/packages/server/src/migrations/functions/backfill/global/users.ts +++ b/packages/server/src/migrations/functions/backfill/global/users.ts @@ -43,7 +43,7 @@ export const backfill = async ( } if (user.roles) { - for (const [appId, role] of Object.entries(user.roles)) { + for (const [, role] of Object.entries(user.roles)) { await events.role.assigned(user, role, timestamp) } } diff --git a/packages/server/src/migrations/index.ts b/packages/server/src/migrations/index.ts index 61ae75adf1..a66d793142 100644 --- a/packages/server/src/migrations/index.ts +++ b/packages/server/src/migrations/index.ts @@ -11,7 +11,6 @@ import env from "../environment" // migration functions import * as userEmailViewCasing from "./functions/userEmailViewCasing" import * as syncQuotas from "./functions/syncQuotas" -import * as syncUsers from "./functions/usageQuotas/syncUsers" import * as appUrls from "./functions/appUrls" import * as tableSettings from "./functions/tableSettings" import * as backfill from "./functions/backfill" diff --git a/packages/server/src/sdk/app/applications/sync.ts b/packages/server/src/sdk/app/applications/sync.ts index e73b3396d9..44e44a5aaa 100644 --- a/packages/server/src/sdk/app/applications/sync.ts +++ b/packages/server/src/sdk/app/applications/sync.ts @@ -3,11 +3,7 @@ import { db as dbCore, context, logging, roles } from "@budibase/backend-core" import { User, ContextUser, UserGroup } from "@budibase/types" import { sdk as proSdk } from "@budibase/pro" import sdk from "../../" -import { - getGlobalUsers, - getRawGlobalUsers, - processUser, -} from "../../../utilities/global" +import { getRawGlobalUsers, processUser } from "../../../utilities/global" import { generateUserMetadataID, InternalTables } from "../../../db/utils" type DeletedUser = { _id: string; deleted: boolean } diff --git a/packages/server/src/sdk/app/applications/tests/sync.spec.ts b/packages/server/src/sdk/app/applications/tests/sync.spec.ts index a53bdb0bd7..69ff2bfaf3 100644 --- a/packages/server/src/sdk/app/applications/tests/sync.spec.ts +++ b/packages/server/src/sdk/app/applications/tests/sync.spec.ts @@ -6,7 +6,7 @@ import EventEmitter from "events" import { UserGroup, UserMetadata, UserRoles, User } from "@budibase/types" const config = new TestConfiguration() -let app, group: UserGroup, groupUser: User +let group: UserGroup, groupUser: User const ROLE_ID = roles.BUILTIN_ROLE_IDS.BASIC const emitter = new EventEmitter() @@ -36,7 +36,7 @@ function waitForUpdate(opts: { group?: boolean }) { } beforeAll(async () => { - app = await config.init("syncApp") + await config.init("syncApp") }) async function createUser(email: string, roles: UserRoles, builder?: boolean) { diff --git a/packages/server/src/sdk/app/permissions/index.ts b/packages/server/src/sdk/app/permissions/index.ts index a6d8f338a1..18a376aaf0 100644 --- a/packages/server/src/sdk/app/permissions/index.ts +++ b/packages/server/src/sdk/app/permissions/index.ts @@ -1,4 +1,4 @@ -import { db, env, roles } from "@budibase/backend-core" +import { db, roles } from "@budibase/backend-core" import { features } from "@budibase/pro" import { DocumentType, @@ -133,7 +133,7 @@ export async function getDependantResources( } const permissions = await getResourcePerms(view.id) - for (const [level, roleInfo] of Object.entries(permissions)) { + for (const [, roleInfo] of Object.entries(permissions)) { if (roleInfo.type === PermissionSource.INHERITED) { dependants[VirtualDocumentType.VIEW] ??= new Set() dependants[VirtualDocumentType.VIEW].add(view.id) diff --git a/packages/server/src/sdk/app/views/tests/views.spec.ts b/packages/server/src/sdk/app/views/tests/views.spec.ts index 508285651a..a610d34ec2 100644 --- a/packages/server/src/sdk/app/views/tests/views.spec.ts +++ b/packages/server/src/sdk/app/views/tests/views.spec.ts @@ -351,6 +351,7 @@ describe("table sdk", () => { const view: ViewV2 = { ...basicView, } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { name, description, ...newTableSchema } = basicTable.schema const result = syncSchema(_.cloneDeep(view), newTableSchema, undefined) @@ -364,6 +365,7 @@ describe("table sdk", () => { const view: ViewV2 = { ...basicView, } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { description, ...newTableSchema } = { ...basicTable.schema, updatedDescription: { @@ -448,6 +450,7 @@ describe("table sdk", () => { hiddenField: { visible: false }, }, } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { name, description, ...newTableSchema } = basicTable.schema const result = syncSchema(_.cloneDeep(view), newTableSchema, undefined) @@ -471,6 +474,7 @@ describe("table sdk", () => { hiddenField: { visible: false }, }, } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { name, description, ...newTableSchema } = { ...basicTable.schema, newField1: { @@ -502,6 +506,7 @@ describe("table sdk", () => { hiddenField: { visible: false }, }, } + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { description, ...newTableSchema } = { ...basicTable.schema, updatedDescription: { diff --git a/packages/server/src/tests/utilities/TestConfiguration.ts b/packages/server/src/tests/utilities/TestConfiguration.ts index d17535a72f..22c03016c7 100644 --- a/packages/server/src/tests/utilities/TestConfiguration.ts +++ b/packages/server/src/tests/utilities/TestConfiguration.ts @@ -49,7 +49,6 @@ import { AuthToken, Automation, CreateViewRequest, - Ctx, Datasource, FieldType, INTERNAL_TABLE_SOURCE_ID, diff --git a/packages/server/src/tests/utilities/api/viewV2.ts b/packages/server/src/tests/utilities/api/viewV2.ts index bd6241b7cd..2bc2357551 100644 --- a/packages/server/src/tests/utilities/api/viewV2.ts +++ b/packages/server/src/tests/utilities/api/viewV2.ts @@ -6,7 +6,6 @@ import { PaginatedSearchRowResponse, } from "@budibase/types" import { Expectations, TestAPI } from "./base" -import { generator } from "@budibase/backend-core/tests" import sdk from "../../../sdk" export class ViewV2API extends TestAPI { diff --git a/packages/server/src/utilities/csv.ts b/packages/server/src/utilities/csv.ts index 477ebb896d..2fab1d11a4 100644 --- a/packages/server/src/utilities/csv.ts +++ b/packages/server/src/utilities/csv.ts @@ -9,9 +9,7 @@ export async function jsonFromCsvString(csvString: string) { // ignoreEmpty will remove the key completly if empty, so creating this empty object will ensure we return the values with the keys but empty values const result = await csv({ ignoreEmpty: false }).fromString(csvString) result.forEach((r, i) => { - for (const [key] of Object.entries(r).filter( - ([key, value]) => value === "" - )) { + for (const [key] of Object.entries(r).filter(([, value]) => value === "")) { if (castedWithEmptyValues[i][key] === undefined) { r[key] = null } diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index 7d9e41e5e9..5c466ec510 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -34,21 +34,6 @@ interface ValidationResults { errors: Record } -const PARSERS: any = { - [FieldType.NUMBER]: (attribute?: string) => { - if (!attribute) { - return attribute - } - return Number(attribute) - }, - [FieldType.DATETIME]: (attribute?: string) => { - if (!attribute) { - return attribute - } - return new Date(attribute).toISOString() - }, -} - export function isSchema(schema: any): schema is Schema { return ( typeof schema === "object" && diff --git a/packages/server/src/utilities/usageQuota/usageQuoteReset.ts b/packages/server/src/utilities/usageQuota/usageQuoteReset.ts deleted file mode 100644 index 579fa130d0..0000000000 --- a/packages/server/src/utilities/usageQuota/usageQuoteReset.ts +++ /dev/null @@ -1,18 +0,0 @@ -// UNUSED CODE -// Preserved for future use - -/* eslint-disable no-unused-vars */ - -function getNewQuotaReset() { - return Date.now() + 2592000000 -} - -function resetQuotasIfRequired(quota: { quotaReset: number; usageQuota: any }) { - // Check if the quota needs reset - if (Date.now() >= quota.quotaReset) { - quota.quotaReset = getNewQuotaReset() - for (let prop of Object.keys(quota.usageQuota)) { - quota.usageQuota[prop] = 0 - } - } -} diff --git a/packages/server/src/utilities/workerRequests.ts b/packages/server/src/utilities/workerRequests.ts index 91340c8d78..c3a0b0abfa 100644 --- a/packages/server/src/utilities/workerRequests.ts +++ b/packages/server/src/utilities/workerRequests.ts @@ -1,10 +1,4 @@ -import { - Response, - default as fetch, - type RequestInit, - Headers, - HeadersInit, -} from "node-fetch" +import { Response, default as fetch, type RequestInit } from "node-fetch" import env from "../environment" import { checkSlashesInUrl } from "./index" import { @@ -13,7 +7,6 @@ import { tenancy, logging, env as coreEnv, - utils, } from "@budibase/backend-core" import { Ctx, User, EmailInvite } from "@budibase/types" diff --git a/packages/server/src/websockets/websocket.ts b/packages/server/src/websockets/websocket.ts index 2861757de1..871122678d 100644 --- a/packages/server/src/websockets/websocket.ts +++ b/packages/server/src/websockets/websocket.ts @@ -262,10 +262,12 @@ export class BaseSocket { } } + // eslint-disable-next-line @typescript-eslint/no-unused-vars async onConnect(socket: Socket) { // Override } + // eslint-disable-next-line @typescript-eslint/no-unused-vars async onDisconnect(socket: Socket) { // Override } diff --git a/packages/shared-core/src/sdk/documents/users.ts b/packages/shared-core/src/sdk/documents/users.ts index 11e80dcf29..17aa8a1e58 100644 --- a/packages/shared-core/src/sdk/documents/users.ts +++ b/packages/shared-core/src/sdk/documents/users.ts @@ -46,10 +46,7 @@ export function isAdminOrBuilder( return isBuilder(user, appId) || isAdmin(user) } -export function isAdminOrGlobalBuilder( - user: User | ContextUser, - appId?: string -): boolean { +export function isAdminOrGlobalBuilder(user: User | ContextUser): boolean { return isGlobalBuilder(user) || isAdmin(user) } diff --git a/packages/string-templates/test/utils.ts b/packages/string-templates/test/utils.ts index c683acf5b3..957366fc59 100644 --- a/packages/string-templates/test/utils.ts +++ b/packages/string-templates/test/utils.ts @@ -34,7 +34,7 @@ export const getParsedManifest = () => { requiresBlock: boolean }>(manifest[collection]) .filter( - ([_, details]) => + ([, details]) => details.example?.split("->").map(x => x.trim()).length > 1 ) .map(([name, details]): ExampleType => { @@ -93,7 +93,7 @@ export const runJsHelpersTests = ({ describe.each(Object.keys(jsExamples))("%s", collection => { const examplesToRun = jsExamples[collection] - .filter(([_, { requiresHbsBody }]) => !requiresHbsBody) + .filter(([, { requiresHbsBody }]) => !requiresHbsBody) .filter(([key]) => !testsToSkip?.includes(key)) examplesToRun.length && diff --git a/packages/types/src/api/web/global/auditLogs.ts b/packages/types/src/api/web/global/auditLogs.ts index a890f3a751..bc6ab5724a 100644 --- a/packages/types/src/api/web/global/auditLogs.ts +++ b/packages/types/src/api/web/global/auditLogs.ts @@ -1,9 +1,5 @@ -import { Event, AuditedEventFriendlyName } from "../../../sdk" -import { - PaginationResponse, - PaginationRequest, - BasicPaginationRequest, -} from "../" +import { Event } from "../../../sdk" +import { PaginationResponse, BasicPaginationRequest } from "../" import { User, App } from "../../../" export interface AuditLogSearchParams { diff --git a/packages/types/src/documents/app/query.ts b/packages/types/src/documents/app/query.ts index 3227666bf3..535c5dab3b 100644 --- a/packages/types/src/documents/app/query.ts +++ b/packages/types/src/documents/app/query.ts @@ -1,5 +1,4 @@ import { Document } from "../document" -import type { Row } from "./row" export interface QuerySchema { name?: string diff --git a/packages/worker/__mocks__/node-fetch.ts b/packages/worker/__mocks__/node-fetch.ts index 27c9b507a4..b5440709da 100644 --- a/packages/worker/__mocks__/node-fetch.ts +++ b/packages/worker/__mocks__/node-fetch.ts @@ -1,5 +1,4 @@ -import fs from "fs" - +// eslint-disable-next-line @typescript-eslint/no-unused-vars module FetchMock { const fetch = jest.requireActual("node-fetch") diff --git a/packages/worker/src/api/controllers/global/auth.ts b/packages/worker/src/api/controllers/global/auth.ts index cfee8c00dc..86c90f9cd3 100644 --- a/packages/worker/src/api/controllers/global/auth.ts +++ b/packages/worker/src/api/controllers/global/auth.ts @@ -225,7 +225,7 @@ export async function oidcCallbackUrl() { return ssoCallbackUrl(ConfigType.OIDC) } -export const oidcStrategyFactory = async (ctx: any, configId: any) => { +export const oidcStrategyFactory = async (ctx: any) => { const config = await configs.getOIDCConfig() if (!config) { return ctx.throw(400, "OIDC config not found") @@ -247,7 +247,7 @@ export const oidcPreAuth = async (ctx: Ctx, next: any) => { if (!configId) { ctx.throw(400, "OIDC config id is required") } - const strategy = await oidcStrategyFactory(ctx, configId) + const strategy = await oidcStrategyFactory(ctx) setCookie(ctx, configId, Cookie.OIDC_CONFIG) @@ -268,8 +268,7 @@ export const oidcPreAuth = async (ctx: Ctx, next: any) => { } export const oidcCallback = async (ctx: any, next: any) => { - const configId = getCookie(ctx, Cookie.OIDC_CONFIG) - const strategy = await oidcStrategyFactory(ctx, configId) + const strategy = await oidcStrategyFactory(ctx) return passport.authenticate( strategy, diff --git a/packages/worker/src/api/routes/global/tests/auth.spec.ts b/packages/worker/src/api/routes/global/tests/auth.spec.ts index a81d5db435..c36f9bd029 100644 --- a/packages/worker/src/api/routes/global/tests/auth.spec.ts +++ b/packages/worker/src/api/routes/global/tests/auth.spec.ts @@ -168,10 +168,7 @@ describe("/api/global/auth", () => { let user: User async function testSSOUser() { - const { res } = await config.api.auth.requestPasswordReset( - sendMailMock, - user.email - ) + await config.api.auth.requestPasswordReset(sendMailMock, user.email) expect(sendMailMock).not.toHaveBeenCalled() } diff --git a/packages/worker/src/api/routes/global/tests/scim.spec.ts b/packages/worker/src/api/routes/global/tests/scim.spec.ts index 258702a3b3..85c70b7b63 100644 --- a/packages/worker/src/api/routes/global/tests/scim.spec.ts +++ b/packages/worker/src/api/routes/global/tests/scim.spec.ts @@ -704,6 +704,7 @@ describe("scim", () => { expect(response).toEqual({ Resources: expect.arrayContaining( groups.map(g => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { members, ...groupData } = g return groupData }) @@ -723,6 +724,7 @@ describe("scim", () => { expect(response).toEqual({ Resources: expect.arrayContaining( groups.map(g => { + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { members, displayName, ...groupData } = g return groupData }) @@ -872,6 +874,7 @@ describe("scim", () => { qs: "excludedAttributes=members", }) + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { members, ...expectedResponse } = group expect(response).toEqual(expectedResponse) diff --git a/packages/worker/src/features.ts b/packages/worker/src/features.ts index 075b3b81ca..33fce3aebe 100644 --- a/packages/worker/src/features.ts +++ b/packages/worker/src/features.ts @@ -1,6 +1,7 @@ import { features } from "@budibase/backend-core" import env from "./environment" +// eslint-disable-next-line no-unused-vars enum WorkerFeature {} const featureList: WorkerFeature[] = features.processFeatureEnvVar( diff --git a/packages/worker/src/migrations/functions/globalInfoSyncUsers.ts b/packages/worker/src/migrations/functions/globalInfoSyncUsers.ts index 4bb864a000..f09a01b449 100644 --- a/packages/worker/src/migrations/functions/globalInfoSyncUsers.ts +++ b/packages/worker/src/migrations/functions/globalInfoSyncUsers.ts @@ -9,7 +9,7 @@ import { platform } from "@budibase/backend-core" * Description: * Re-sync the global-db users to the global-info db users */ -export const run = async (globalDb: any) => { +export const run = async () => { const users = (await usersSdk.db.allUsers()) as User[] const promises = [] for (let user of users) { diff --git a/packages/worker/src/tests/TestConfiguration.ts b/packages/worker/src/tests/TestConfiguration.ts index 3ebfb5f020..e44e9e2923 100644 --- a/packages/worker/src/tests/TestConfiguration.ts +++ b/packages/worker/src/tests/TestConfiguration.ts @@ -19,7 +19,6 @@ import { users, context, sessions, - auth, constants, env as coreEnv, db as dbCore, diff --git a/packages/worker/src/tests/structures/groups.ts b/packages/worker/src/tests/structures/groups.ts index d39dd74eb8..2ce6545b23 100644 --- a/packages/worker/src/tests/structures/groups.ts +++ b/packages/worker/src/tests/structures/groups.ts @@ -5,7 +5,7 @@ import { UserGroup as UserGroupType, UserGroupRoles } from "@budibase/types" export function UserGroup(): UserGroupType { const appsCount = generator.integer({ min: 0, max: 3 }) const roles = Array.from({ length: appsCount }).reduce( - (p: UserGroupRoles, v) => { + (p: UserGroupRoles) => { return { ...p, [db.generateAppID()]: generator.pickone(["ADMIN", "POWER", "BASIC"]), diff --git a/packages/worker/src/utilities/templates.ts b/packages/worker/src/utilities/templates.ts index 13fc5ef0cf..c9e86ae4f9 100644 --- a/packages/worker/src/utilities/templates.ts +++ b/packages/worker/src/utilities/templates.ts @@ -1,12 +1,10 @@ import { tenancy, configs } from "@budibase/backend-core" -import { SettingsInnerConfig } from "@budibase/types" import { InternalTemplateBinding, LOGO_URL, EmailTemplatePurpose, } from "../constants" import { checkSlashesInUrl } from "./index" -import { getLicensedConfig } from "./configs" const BASE_COMPANY = "Budibase" import * as pro from "@budibase/pro" diff --git a/yarn.lock b/yarn.lock index 22c11453ee..d035d65ba1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2526,14 +2526,14 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz#786c5f41f043b07afb1af37683d7c33668858f6d" integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== -"@eslint-community/eslint-utils@^4.2.0": +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== dependencies: eslint-visitor-keys "^3.3.0" -"@eslint-community/regexpp@^4.6.1": +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": version "4.10.0" resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== @@ -5447,7 +5447,7 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== -"@types/json-schema@^7.0.9": +"@types/json-schema@^7.0.12", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -5966,7 +5966,7 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.7.tgz#b9eb89d7dfa70d5d1ce525bc1411a35347f533a3" integrity sha512-4g1jrL98mdOIwSOUh6LTlB0Cs9I0dQPwINUhBg7C6pN4HLr8GS8xsksJxilW6S6dQHVi2K/o+lQuQcg7LroCnw== -"@types/semver@^7.3.12": +"@types/semver@^7.3.12", "@types/semver@^7.5.0": version "7.5.8" resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== @@ -6132,6 +6132,23 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.3.1.tgz#0d8f38a6c8a1802139e62184ee7a68ed024f30a1" + integrity sha512-STEDMVQGww5lhCuNXVSQfbfuNII5E08QWkvAw5Qwf+bj2WT+JkG1uc+5/vXA3AOYMDHVOSpL+9rcbEUiHIm2dw== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "7.3.1" + "@typescript-eslint/type-utils" "7.3.1" + "@typescript-eslint/utils" "7.3.1" + "@typescript-eslint/visitor-keys" "7.3.1" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/parser@6.9.0": version "6.9.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.9.0.tgz#2b402cadeadd3f211c25820e5433413347b27391" @@ -6143,6 +6160,17 @@ "@typescript-eslint/visitor-keys" "6.9.0" debug "^4.3.4" +"@typescript-eslint/parser@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-7.3.1.tgz#c4ba7dc2744318a5e4506596cbc3a0086255c526" + integrity sha512-Rq49+pq7viTRCH48XAbTA+wdLRrB/3sRq4Lpk0oGDm0VmnjBrAOVXH/Laalmwsv2VpekiEfVFwJYVk6/e8uvQw== + dependencies: + "@typescript-eslint/scope-manager" "7.3.1" + "@typescript-eslint/types" "7.3.1" + "@typescript-eslint/typescript-estree" "7.3.1" + "@typescript-eslint/visitor-keys" "7.3.1" + debug "^4.3.4" + "@typescript-eslint/scope-manager@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz#d9457ccc6a0b8d6b37d0eb252a23022478c5460c" @@ -6159,6 +6187,24 @@ "@typescript-eslint/types" "6.9.0" "@typescript-eslint/visitor-keys" "6.9.0" +"@typescript-eslint/scope-manager@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.3.1.tgz#73fd0cb4211a7be23e49e5b6efec8820caa6ec36" + integrity sha512-fVS6fPxldsKY2nFvyT7IP78UO1/I2huG+AYu5AMjCT9wtl6JFiDnsv4uad4jQ0GTFzcUV5HShVeN96/17bTBag== + dependencies: + "@typescript-eslint/types" "7.3.1" + "@typescript-eslint/visitor-keys" "7.3.1" + +"@typescript-eslint/type-utils@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.3.1.tgz#cbf90d3d7e788466aa8a5c0ab3f46103f098aa0d" + integrity sha512-iFhaysxFsMDQlzJn+vr3OrxN8NmdQkHks4WaqD4QBnt5hsq234wcYdyQ9uquzJJIDAj5W4wQne3yEsYA6OmXGw== + dependencies: + "@typescript-eslint/typescript-estree" "7.3.1" + "@typescript-eslint/utils" "7.3.1" + debug "^4.3.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/types@4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.33.0.tgz#a1e59036a3b53ae8430ceebf2a919dc7f9af6d72" @@ -6179,6 +6225,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.9.0.tgz#86a0cbe7ac46c0761429f928467ff3d92f841098" integrity sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw== +"@typescript-eslint/types@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.3.1.tgz#ae104de8efa4227a462c0874d856602c5994413c" + integrity sha512-2tUf3uWggBDl4S4183nivWQ2HqceOZh1U4hhu4p1tPiIJoRRXrab7Y+Y0p+dozYwZVvLPRI6r5wKe9kToF9FIw== + "@typescript-eslint/typescript-estree@5.62.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz#7d17794b77fabcac615d6a48fb143330d962eb9b" @@ -6205,6 +6256,20 @@ semver "^7.5.4" ts-api-utils "^1.0.1" +"@typescript-eslint/typescript-estree@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.3.1.tgz#598848195fad34c7aa73f548bd00a4d4e5f5e2bb" + integrity sha512-tLpuqM46LVkduWP7JO7yVoWshpJuJzxDOPYIVWUUZbW+4dBpgGeUdl/fQkhuV0A8eGnphYw3pp8d2EnvPOfxmQ== + dependencies: + "@typescript-eslint/types" "7.3.1" + "@typescript-eslint/visitor-keys" "7.3.1" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "9.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + "@typescript-eslint/typescript-estree@^4.33.0": version "4.33.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.33.0.tgz#0dfb51c2908f68c5c08d82aefeaf166a17c24609" @@ -6231,6 +6296,19 @@ semver "^7.3.7" tsutils "^3.21.0" +"@typescript-eslint/utils@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.3.1.tgz#fc28fd508ccf89495012561b7c02a6fdad162460" + integrity sha512-jIERm/6bYQ9HkynYlNZvXpzmXWZGhMbrOvq3jJzOSOlKXsVjrrolzWBjDW6/TvT5Q3WqaN4EkmcfdQwi9tDjBQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "7.3.1" + "@typescript-eslint/types" "7.3.1" + "@typescript-eslint/typescript-estree" "7.3.1" + semver "^7.5.4" + "@typescript-eslint/utils@^5.10.0": version "5.62.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.62.0.tgz#141e809c71636e4a75daa39faed2fb5f4b10df86" @@ -6277,6 +6355,14 @@ "@typescript-eslint/types" "6.9.0" eslint-visitor-keys "^3.4.1" +"@typescript-eslint/visitor-keys@7.3.1": + version "7.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.3.1.tgz#6ddef14a3ce2a79690f01176f5305c34d7b93d8c" + integrity sha512-9RMXwQF8knsZvfv9tdi+4D/j7dMG28X/wMJ8Jj6eOHyHWwDW4ngQJcqEczSsqIKKjFiLFr40Mnr7a5ulDD3vmw== + dependencies: + "@typescript-eslint/types" "7.3.1" + eslint-visitor-keys "^3.4.1" + "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" @@ -15595,6 +15681,13 @@ minimatch@3.0.5: dependencies: brace-expansion "^1.1.7" +minimatch@9.0.3: + version "9.0.3" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" + integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== + dependencies: + brace-expansion "^2.0.1" + minimatch@^5.0.1, minimatch@^5.1.0: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" @@ -21518,6 +21611,14 @@ typeof@^1.0.0: resolved "https://registry.yarnpkg.com/typeof/-/typeof-1.0.0.tgz#9c84403f2323ae5399167275497638ea1d2f2440" integrity sha512-Pze0mIxYXhaJdpw1ayMzOA7rtGr1OmsTY/Z+FWtRKIqXFz6aoDLjqdbWE/tcIBSC8nhnVXiRrEXujodR/xiFAA== +typescript-eslint@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/typescript-eslint/-/typescript-eslint-7.3.1.tgz#9f4808abea3b33c4dd3bb51dd801471e91d1bd58" + integrity sha512-psqcnHPRCdVIDbgj6RvfpwUKqMcNxIw7eizgxYi46X2BmXK6LxYqPD+SbDfPuA9JW+yPItY6aKJLRNbW7lZ4rA== + dependencies: + "@typescript-eslint/eslint-plugin" "7.3.1" + "@typescript-eslint/parser" "7.3.1" + typescript@5.2.2, "typescript@>=3 < 6": version "5.2.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" From 65524838a9838a00958cce37f61dc5b368cb3906 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 20 Mar 2024 13:08:55 +0000 Subject: [PATCH 2/6] Update pro and account portal references. --- packages/account-portal | 2 +- packages/pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account-portal b/packages/account-portal index 6465dc9c2a..f5b467b6b1 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 6465dc9c2a38e1380b32204cad4ae0c1f33e065a +Subproject commit f5b467b6b1c55c48847545db41be7b1c035e167a diff --git a/packages/pro b/packages/pro index 8baf8586ec..dd748e045f 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 8baf8586ec078951230c8466d5f13f9b6d5ed055 +Subproject commit dd748e045ffdbc6662c5d2b76075f01d65a96a2f From 3788d67e8dfbc039ba46740f81c035204af38d77 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 20 Mar 2024 13:31:11 +0000 Subject: [PATCH 3/6] Bump version to 2.22.6 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 341efc0cad..dfd2aac356 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.5", + "version": "2.22.6", "npmClient": "yarn", "packages": [ "packages/*", From e4e6447cf6986252ffbd82262a917fd5927c8e0d Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Wed, 20 Mar 2024 15:16:19 +0000 Subject: [PATCH 4/6] Use clickoutside library to stop mouseup closing side panel (#13193) * Use clickoutside library to stop mouseup closing side panel * Revert "Use clickoutside library to stop mouseup closing side panel" This reverts commit fbe574812e90491556183c157a254ecbf0953b01. * Use mousedown * Add allowedType for clickoutside event * Remove contextmenu listener --------- Co-authored-by: Martin McKeaveney --- packages/bbui/src/Actions/click_outside.js | 13 +++++++++---- packages/client/src/components/app/Layout.svelte | 5 ++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js index 12c4c4d002..2c54427b3a 100644 --- a/packages/bbui/src/Actions/click_outside.js +++ b/packages/bbui/src/Actions/click_outside.js @@ -39,19 +39,23 @@ const handleClick = event => { return } + if (handler.allowedType && event.type !== handler.allowedType) { + return + } + handler.callback?.(event) }) } document.documentElement.addEventListener("click", handleClick, true) -document.documentElement.addEventListener("contextmenu", handleClick, true) +document.documentElement.addEventListener("mousedown", handleClick, true) /** * Adds or updates a click handler */ -const updateHandler = (id, element, anchor, callback) => { +const updateHandler = (id, element, anchor, callback, allowedType) => { let existingHandler = clickHandlers.find(x => x.id === id) if (!existingHandler) { - clickHandlers.push({ id, element, anchor, callback }) + clickHandlers.push({ id, element, anchor, callback, allowedType }) } else { existingHandler.callback = callback } @@ -77,7 +81,8 @@ export default (element, opts) => { const update = newOpts => { const callback = newOpts?.callback || newOpts const anchor = newOpts?.anchor || element - updateHandler(id, element, anchor, callback) + const allowedType = newOpts?.allowedType || "click" + updateHandler(id, element, anchor, callback, allowedType) } update(opts) return { diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index 1b92c0fefc..992a166143 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -291,7 +291,10 @@
From 3749f198f9e015429dcffdfbed8dbedfef55fd42 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 20 Mar 2024 15:23:07 +0000 Subject: [PATCH 5/6] Bump version to 2.22.7 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index dfd2aac356..3a92bc6d9a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.6", + "version": "2.22.7", "npmClient": "yarn", "packages": [ "packages/*", From c70b50277f0c0d5f4fe7150bb6a559d1434a0c3f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 20 Mar 2024 17:37:27 +0100 Subject: [PATCH 6/6] Fix tsconfig.json --- packages/shared-core/tsconfig.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/shared-core/tsconfig.json b/packages/shared-core/tsconfig.json index ad028931e4..d0c5134f1c 100644 --- a/packages/shared-core/tsconfig.json +++ b/packages/shared-core/tsconfig.json @@ -1,6 +1,8 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { + "baseUrl": "..", + "rootDir": "src", "composite": true, "types": ["node", "jest"] },