Fixing type build.

This commit is contained in:
mike12345567 2023-09-29 13:45:02 +01:00
parent 96327eaef1
commit c498f39f2a
2 changed files with 7 additions and 6 deletions

View File

@ -9,7 +9,7 @@ import { quotas } from "@budibase/pro"
import { events, context, utils, constants } from "@budibase/backend-core" import { events, context, utils, constants } from "@budibase/backend-core"
import sdk from "../../../sdk" import sdk from "../../../sdk"
import { QueryEvent } from "../../../threads/definitions" import { QueryEvent } from "../../../threads/definitions"
import { Query, UserCtx } from "@budibase/types" import { ConfigType, Query, UserCtx } from "@budibase/types"
import { ValidQueryNameRegex } from "@budibase/shared-core" import { ValidQueryNameRegex } from "@budibase/shared-core"
const Runner = new Thread(ThreadType.QUERY, { const Runner = new Thread(ThreadType.QUERY, {
@ -107,7 +107,7 @@ export async function find(ctx: UserCtx) {
//Required to discern between OIDC OAuth config entries //Required to discern between OIDC OAuth config entries
function getOAuthConfigCookieId(ctx: UserCtx) { function getOAuthConfigCookieId(ctx: UserCtx) {
if (ctx.user.providerType === constants.Config.OIDC) { if (ctx.user.providerType === ConfigType.OIDC) {
return utils.getCookie(ctx, constants.Cookie.OIDC_CONFIG) return utils.getCookie(ctx, constants.Cookie.OIDC_CONFIG)
} }
} }
@ -135,7 +135,7 @@ export async function preview(ctx: UserCtx) {
const db = context.getAppDB() const db = context.getAppDB()
const existing = (await db.get(queryId)) as Query const existing = (await db.get(queryId)) as Query
existingSchema = existing.schema existingSchema = existing.schema
} catch (err) { } catch (err: any) {
if (err.status !== 404) { if (err.status !== 404) {
ctx.throw(500, "Unable to retrieve existing query") ctx.throw(500, "Unable to retrieve existing query")
} }
@ -210,7 +210,7 @@ export async function preview(ctx: UserCtx) {
info, info,
extra, extra,
} }
} catch (err) { } catch (err: any) {
ctx.throw(400, err) ctx.throw(400, err)
} }
} }
@ -276,7 +276,7 @@ async function execute(
} else { } else {
ctx.body = { data: rows, pagination, ...extra, ...info } ctx.body = { data: rows, pagination, ...extra, ...info }
} }
} catch (err) { } catch (err: any) {
ctx.throw(400, err) ctx.throw(400, err)
} }
} }

View File

@ -1,5 +1,5 @@
import { Context, Request } from "koa" import { Context, Request } from "koa"
import { User, Role, UserRoles, Account } from "../documents" import { User, Role, UserRoles, Account, ConfigType } from "../documents"
import { FeatureFlag, License } from "../sdk" import { FeatureFlag, License } from "../sdk"
import { Files } from "formidable" import { Files } from "formidable"
@ -13,6 +13,7 @@ export interface ContextUser extends Omit<User, "roles"> {
csrfToken?: string csrfToken?: string
featureFlags?: FeatureFlag[] featureFlags?: FeatureFlag[]
accountPortalAccess?: boolean accountPortalAccess?: boolean
providerType?: ConfigType
account?: Account account?: Account
} }