From 8d2960292941b3586bebbd2b75c63e651171e30b Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Mon, 29 Jun 2026 18:06:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20fix=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/lib/blueprints/publicResources.ts | 62 ++++++++++++------------ server/private/routers/hybrid.ts | 1 + 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/server/lib/blueprints/publicResources.ts b/server/lib/blueprints/publicResources.ts index a6147ea86..def01a21a 100644 --- a/server/lib/blueprints/publicResources.ts +++ b/server/lib/blueprints/publicResources.ts @@ -1,56 +1,54 @@ +import { isLicensedOrSubscribed } from "#dynamic/lib/isLicencedOrSubscribed"; +import { createCertificate } from "#dynamic/routers/certificates/createCertificate"; +import { hashPassword } from "@server/auth/password"; +import { generateId } from "@server/auth/sessions/app"; +import { build } from "@server/build"; import { - domains, domainNamespaces, + domains, orgDomains, Resource, resourceHeaderAuth, resourceHeaderAuthExtendedCompatibility, + resourcePassword, resourcePincode, + resourcePolicies, + resourcePolicyHeaderAuth, + resourcePolicyPassword, + resourcePolicyPincode, + resourcePolicyRules, + resourcePolicyWhiteList, resourceRules, + resources, resourceWhitelist, roleActions, + rolePolicies, roleResources, roles, + sites, Target, TargetHealthCheck, targetHealthCheck, + targets, Transaction, userOrgs, + userPolicies, userResources, users, - resourcePolicies, - resourcePolicyPassword, - resourcePolicyPincode, - resourcePolicyHeaderAuth, - resourcePolicyRules, - resourcePolicyWhiteList, - rolePolicies, - userPolicies + type ResourceRule } from "@server/db"; -import { resources, targets, sites } from "@server/db"; -import { eq, and, asc, or, ne, count, isNotNull } from "drizzle-orm"; -import { - Config, - ConfigSchema, - isTargetsOnlyResource, - TargetData -} from "./types"; -import logger from "@server/logger"; -import { createCertificate } from "#dynamic/routers/certificates/createCertificate"; -import { pickPort } from "@server/routers/target/helpers"; -import { resourcePassword } from "@server/db"; import { getUniqueResourcePolicyName } from "@server/db/names"; -import { hashPassword } from "@server/auth/password"; -import { isValidCIDR, isValidIP, isValidUrlGlobPattern } from "../validators"; import { isValidRegionId } from "@server/db/regions"; -import { isLicensedOrSubscribed } from "#dynamic/lib/isLicencedOrSubscribed"; import { fireHealthCheckUnknownAlert } from "@server/lib/alerts"; -import { tierMatrix } from "../billing/tierMatrix"; -import { defaultRoleAllowedActions } from "@server/routers/role/createRole"; -import { build } from "@server/build"; -import { encrypt } from "@server/lib/crypto"; -import { generateId } from "@server/auth/sessions/app"; import serverConfig from "@server/lib/config"; +import { encrypt } from "@server/lib/crypto"; +import logger from "@server/logger"; +import { defaultRoleAllowedActions } from "@server/routers/role/createRole"; +import { pickPort } from "@server/routers/target/helpers"; +import { and, asc, eq, isNotNull, ne, or } from "drizzle-orm"; +import { tierMatrix } from "../billing/tierMatrix"; +import { isValidCIDR, isValidIP, isValidUrlGlobPattern } from "../validators"; +import { Config, isTargetsOnlyResource, TargetData } from "./types"; export type PublicResourcesResults = { proxyResource: Resource; @@ -904,7 +902,7 @@ export async function updatePublicResources( .update(resourceRules) .set({ action: getRuleAction(rule.action), - match: rule.match.toUpperCase(), + match: rule.match.toUpperCase() as ResourceRule["match"], value: getRuleValue( rule.match.toUpperCase(), rule.value @@ -923,7 +921,7 @@ export async function updatePublicResources( await trx.insert(resourceRules).values({ resourceId: existingResource.resourceId, action: getRuleAction(rule.action), - match: rule.match.toUpperCase(), + match: rule.match.toUpperCase() as ResourceRule["match"], value: getRuleValue( rule.match.toUpperCase(), rule.value @@ -1260,7 +1258,7 @@ export async function updatePublicResources( await trx.insert(resourceRules).values({ resourceId: newResource.resourceId, action: getRuleAction(rule.action), - match: rule.match.toUpperCase(), + match: rule.match.toUpperCase() as ResourceRule["match"], value: getRuleValue( rule.match.toUpperCase(), rule.value diff --git a/server/private/routers/hybrid.ts b/server/private/routers/hybrid.ts index 8beea35f0..124db587a 100644 --- a/server/private/routers/hybrid.ts +++ b/server/private/routers/hybrid.ts @@ -1695,6 +1695,7 @@ hybridRouter.get( ) { for (const rule of rules) { if (rule.match == "COUNTRY") { + // @ts-expect-error this is for backward compatibility rule.match = "GEOIP"; } }