1
0
Fork 0
mirror of synced 2024-06-27 02:20:35 +12:00

Reenable no-case-declarations.

This commit is contained in:
Sam Rose 2024-03-19 15:58:25 +00:00
parent f6669c25cf
commit f1278312ab
No known key found for this signature in database
11 changed files with 34 additions and 22 deletions

View file

@ -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",

View file

@ -133,7 +133,7 @@ export async function refreshOAuthToken(
configId?: string
): Promise<RefreshResponse> {
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)
}
}
}

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -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

View file

@ -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)

View file

@ -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

View file

@ -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)
}

View file

@ -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)
}