From f1278312abe31cb1c92a1f64487db8e23b66982a Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 15:58:25 +0000 Subject: [PATCH 1/6] Reenable no-case-declarations. --- .eslintrc.json | 2 -- packages/backend-core/src/auth/auth.ts | 6 ++++-- packages/server/src/api/controllers/plugin/index.ts | 9 ++++++--- .../src/api/controllers/query/import/sources/openapi2.ts | 6 ++++-- .../src/api/controllers/query/import/sources/openapi3.ts | 3 ++- packages/server/src/integrations/base/sqlTable.ts | 3 ++- packages/server/src/integrations/microsoftSqlServer.ts | 6 ++++-- packages/server/src/integrations/rest.ts | 6 ++++-- packages/server/src/sdk/app/rows/search/utils.ts | 3 ++- .../src/utilities/rowProcessor/bbReferenceProcessor.ts | 8 ++++---- packages/server/src/utilities/schema.ts | 4 ++-- 11 files changed, 34 insertions(+), 22 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index d93c086578..824868a975 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -39,7 +39,6 @@ "extends": ["eslint:recommended"], "rules": { "no-unused-vars": "off", - "no-case-declarations": "off", "no-undef": "off", "no-prototype-builtins": "off", "local-rules/no-budibase-imports": "error" @@ -56,7 +55,6 @@ }, "rules": { "no-unused-vars": "off", - "no-case-declarations": "off", "no-undef": "off", "no-prototype-builtins": "off", "local-rules/no-test-com": "error", diff --git a/packages/backend-core/src/auth/auth.ts b/packages/backend-core/src/auth/auth.ts index 1951c7986c..87ac46cf1c 100644 --- a/packages/backend-core/src/auth/auth.ts +++ b/packages/backend-core/src/auth/auth.ts @@ -133,7 +133,7 @@ export async function refreshOAuthToken( configId?: string ): Promise { switch (providerType) { - case SSOProviderType.OIDC: + case SSOProviderType.OIDC: { if (!configId) { return { err: { data: "OIDC config id not provided" } } } @@ -142,12 +142,14 @@ export async function refreshOAuthToken( return { err: { data: "OIDC configuration not found" } } } return refreshOIDCAccessToken(oidcConfig, refreshToken) - case SSOProviderType.GOOGLE: + } + case SSOProviderType.GOOGLE: { let googleConfig = await configs.getGoogleConfig() if (!googleConfig) { return { err: { data: "Google configuration not found" } } } return refreshGoogleAccessToken(googleConfig, refreshToken) + } } } diff --git a/packages/server/src/api/controllers/plugin/index.ts b/packages/server/src/api/controllers/plugin/index.ts index a8a451c98c..c7d4912db3 100644 --- a/packages/server/src/api/controllers/plugin/index.ts +++ b/packages/server/src/api/controllers/plugin/index.ts @@ -39,25 +39,28 @@ export async function create(ctx: any) { let name = "PLUGIN_" + Math.floor(100000 + Math.random() * 900000) switch (source) { - case PluginSource.NPM: + case PluginSource.NPM: { const { metadata: metadataNpm, directory: directoryNpm } = await npmUpload(url, name) metadata = metadataNpm directory = directoryNpm break - case PluginSource.GITHUB: + } + case PluginSource.GITHUB: { const { metadata: metadataGithub, directory: directoryGithub } = await githubUpload(url, name, githubToken) metadata = metadataGithub directory = directoryGithub break - case PluginSource.URL: + } + case PluginSource.URL: { const headersObj = headers || {} const { metadata: metadataUrl, directory: directoryUrl } = await urlUpload(url, name, headersObj) metadata = metadataUrl directory = directoryUrl break + } } pluginCore.validate(metadata?.schema) diff --git a/packages/server/src/api/controllers/query/import/sources/openapi2.ts b/packages/server/src/api/controllers/query/import/sources/openapi2.ts index 230647475e..6eb4766c70 100644 --- a/packages/server/src/api/controllers/query/import/sources/openapi2.ts +++ b/packages/server/src/api/controllers/query/import/sources/openapi2.ts @@ -109,13 +109,14 @@ export class OpenAPI2 extends OpenAPISource { for (let param of allParams) { if (parameterNotRef(param)) { switch (param.in) { - case "query": + case "query": { let prefix = "" if (queryString) { prefix = "&" } queryString = `${queryString}${prefix}${param.name}={{${param.name}}}` break + } case "header": headers[param.name] = `{{${param.name}}}` break @@ -125,7 +126,7 @@ export class OpenAPI2 extends OpenAPISource { case "formData": // future enhancement break - case "body": + case "body": { // set the request body to the example provided // future enhancement: generate an example from the schema let bodyParam: OpenAPIV2.InBodyParameterObject = @@ -135,6 +136,7 @@ export class OpenAPI2 extends OpenAPISource { requestBody = schema.example } break + } } // add the parameter if it can be bound in our config diff --git a/packages/server/src/api/controllers/query/import/sources/openapi3.ts b/packages/server/src/api/controllers/query/import/sources/openapi3.ts index f86f684c32..f6755c69ad 100644 --- a/packages/server/src/api/controllers/query/import/sources/openapi3.ts +++ b/packages/server/src/api/controllers/query/import/sources/openapi3.ts @@ -161,13 +161,14 @@ export class OpenAPI3 extends OpenAPISource { for (let param of allParams) { if (parameterNotRef(param)) { switch (param.in) { - case "query": + case "query": { let prefix = "" if (queryString) { prefix = "&" } queryString = `${queryString}${prefix}${param.name}={{${param.name}}}` break + } case "header": headers[param.name] = `{{${param.name}}}` break diff --git a/packages/server/src/integrations/base/sqlTable.ts b/packages/server/src/integrations/base/sqlTable.ts index f3560791e6..06c2184549 100644 --- a/packages/server/src/integrations/base/sqlTable.ts +++ b/packages/server/src/integrations/base/sqlTable.ts @@ -59,7 +59,7 @@ function generateSchema( case FieldType.BARCODEQR: schema.text(key) break - case FieldType.BB_REFERENCE: + case FieldType.BB_REFERENCE: { const subtype = column.subtype as FieldSubtype switch (subtype) { case FieldSubtype.USER: @@ -72,6 +72,7 @@ function generateSchema( throw utils.unreachable(subtype) } break + } case FieldType.NUMBER: // if meta is specified then this is a junction table entry if (column.meta && column.meta.toKey && column.meta.toTable) { diff --git a/packages/server/src/integrations/microsoftSqlServer.ts b/packages/server/src/integrations/microsoftSqlServer.ts index c79eb136ed..3c06f58cf4 100644 --- a/packages/server/src/integrations/microsoftSqlServer.ts +++ b/packages/server/src/integrations/microsoftSqlServer.ts @@ -254,7 +254,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus { } switch (this.config.authType) { - case MSSQLConfigAuthType.AZURE_ACTIVE_DIRECTORY: + case MSSQLConfigAuthType.AZURE_ACTIVE_DIRECTORY: { const { clientId, tenantId, clientSecret } = this.config.adConfig || {} const clientApp = new ConfidentialClientApplication({ @@ -276,7 +276,8 @@ class SqlServerIntegration extends Sql implements DatasourcePlus { }, } break - case MSSQLConfigAuthType.NTLM: + } + case MSSQLConfigAuthType.NTLM: { const { domain, trustServerCertificate } = this.config.ntlmConfig || {} clientCfg.authentication = { @@ -288,6 +289,7 @@ class SqlServerIntegration extends Sql implements DatasourcePlus { clientCfg.options ??= {} clientCfg.options.trustServerCertificate = !!trustServerCertificate break + } case null: case undefined: break diff --git a/packages/server/src/integrations/rest.ts b/packages/server/src/integrations/rest.ts index 44c62f60b7..5fa35cc667 100644 --- a/packages/server/src/integrations/rest.ts +++ b/packages/server/src/integrations/rest.ts @@ -283,7 +283,7 @@ class RestIntegration implements IntegrationBase { // content type defaults to plaintext input.body = string break - case BodyTypes.ENCODED: + case BodyTypes.ENCODED: { const params = new URLSearchParams() for (let [key, value] of Object.entries(object)) { params.append(key, value as string) @@ -293,7 +293,8 @@ class RestIntegration implements IntegrationBase { }) input.body = params break - case BodyTypes.FORM_DATA: + } + case BodyTypes.FORM_DATA: { const form = new FormData() for (let [key, value] of Object.entries(object)) { form.append(key, value) @@ -303,6 +304,7 @@ class RestIntegration implements IntegrationBase { }) input.body = form break + } case BodyTypes.XML: if (object != null && Object.keys(object).length) { string = new XmlBuilder().buildObject(object) diff --git a/packages/server/src/sdk/app/rows/search/utils.ts b/packages/server/src/sdk/app/rows/search/utils.ts index 5d93dcaca2..d300fdbef0 100644 --- a/packages/server/src/sdk/app/rows/search/utils.ts +++ b/packages/server/src/sdk/app/rows/search/utils.ts @@ -66,7 +66,7 @@ export function searchInputMapping(table: Table, options: SearchParams) { } for (let [key, column] of Object.entries(table.schema)) { switch (column.type) { - case FieldType.BB_REFERENCE: + case FieldType.BB_REFERENCE: { const subtype = column.subtype as FieldSubtype switch (subtype) { case FieldSubtype.USER: @@ -77,6 +77,7 @@ export function searchInputMapping(table: Table, options: SearchParams) { utils.unreachable(subtype) } break + } } } return options diff --git a/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts b/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts index c7b8998bad..31f1f5e575 100644 --- a/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts +++ b/packages/server/src/utilities/rowProcessor/bbReferenceProcessor.ts @@ -41,7 +41,7 @@ export async function processInputBBReferences( switch (subtype) { case FieldSubtype.USER: - case FieldSubtype.USERS: + case FieldSubtype.USERS: { const { notFoundIds } = await cache.user.getUsers(referenceIds) if (notFoundIds?.length) { @@ -53,7 +53,7 @@ export async function processInputBBReferences( } return referenceIds.join(",") || null - + } default: throw utils.unreachable(subtype) } @@ -73,7 +73,7 @@ export async function processOutputBBReferences( switch (subtype) { case FieldSubtype.USER: - case FieldSubtype.USERS: + case FieldSubtype.USERS: { const { users } = await cache.user.getUsers(ids) if (!users.length) { return undefined @@ -86,7 +86,7 @@ export async function processOutputBBReferences( firstName: u.firstName, lastName: u.lastName, })) - + } default: throw utils.unreachable(subtype) } diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index 500e922d65..7d9e41e5e9 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -191,7 +191,7 @@ function isValidBBReference( ): boolean { switch (columnSubtype) { case FieldSubtype.USER: - case FieldSubtype.USERS: + case FieldSubtype.USERS: { if (typeof columnData !== "string") { return false } @@ -208,7 +208,7 @@ function isValidBBReference( user => !db.isGlobalUserID(user._id) ) return !constainsWrongId - + } default: throw utils.unreachable(columnSubtype) } From 65388c74272053eeaed1ceac59d360b854a63810 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 19 Mar 2024 15:59:43 +0000 Subject: [PATCH 2/6] Update pro reference. --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index cbc1197dc4..4f183993af 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit cbc1197dc4b6982c1fcdc8c99b53bf9292e6e3b2 +Subproject commit 4f183993af024e5ddec1b90981fb9049a3c6c412 From a2a0b96ce330c1b925a39eb521f92dfb9685f470 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 19 Mar 2024 18:26:09 +0100 Subject: [PATCH 3/6] Update pro ref --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 993b9f010f..50aaebde00 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 993b9f010f619b7f8b50c89105c645e3d874929e +Subproject commit 50aaebde002f8dd75dee2ad2c5e8036d6b3d9cc5 From 4389adbe79c9a622aec66de4a773f606427d2684 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 19 Mar 2024 17:40:40 +0000 Subject: [PATCH 4/6] Bump version to 2.22.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 01e56982d5..9ace38aee5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.3", + "version": "2.22.4", "npmClient": "yarn", "packages": [ "packages/*", From e5730b7e8401af219e0c1e8ef1986d1e550a6ec2 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 19 Mar 2024 18:45:26 +0100 Subject: [PATCH 5/6] Fix check:types --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 50aaebde00..d68b4f40f8 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 50aaebde002f8dd75dee2ad2c5e8036d6b3d9cc5 +Subproject commit d68b4f40f85dba3184da8b9d63ef2cd66d4a8ef2 From bfacb879a6b3e8e0511cdd85ffda32993a197f7c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 19 Mar 2024 18:51:02 +0000 Subject: [PATCH 6/6] Bump version to 2.22.5 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 9ace38aee5..341efc0cad 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.22.4", + "version": "2.22.5", "npmClient": "yarn", "packages": [ "packages/*",