From 7d50fe44a85139fcede40f023054afad8bd27adb Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 27 Mar 2024 13:39:18 +0000 Subject: [PATCH] chore: configure nitro alias (#175) Co-authored-by: McPizza Co-authored-by: BlankParticle --- apps/mail-bridge/middleware/verifyPostalSig.ts | 4 ++-- apps/mail-bridge/nitro.config.ts | 10 ++++++++-- apps/mail-bridge/postal-db/index.ts | 2 +- .../routes/postal/mail/inbound/[...mailServer].post.ts | 2 +- apps/mail-bridge/routes/trpc/[trpc].ts | 4 ++-- apps/mail-bridge/trpc/routers/domainRouter.ts | 10 +++++----- apps/mail-bridge/trpc/routers/orgRouter.ts | 10 +++++----- apps/mail-bridge/trpc/routers/sendMailRouter.ts | 4 ++-- apps/platform/middleware/02.orgSlug.ts | 3 ++- apps/platform/nitro.config.ts | 9 +++++++++ apps/platform/routes/realtime/auth.post.ts | 2 +- apps/platform/routes/trpc/[trpc].ts | 2 +- apps/platform/trpc/routers/authRouter/passkeyRouter.ts | 10 +++++----- .../platform/trpc/routers/authRouter/passwordRouter.ts | 6 +++--- apps/platform/trpc/routers/authRouter/signupRouter.ts | 4 ++-- .../trpc/routers/authRouter/twoFactorRouter.ts | 2 +- .../trpc/routers/contactRouter/contactRouter.ts | 2 +- apps/platform/trpc/routers/convoRouter/convoRouter.ts | 4 ++-- apps/platform/trpc/routers/convoRouter/entryRouter.ts | 2 +- .../trpc/routers/orgRouter/mail/domainsRouter.ts | 6 +++--- .../trpc/routers/orgRouter/mail/emailIdentityRouter.ts | 4 ++-- apps/platform/trpc/routers/orgRouter/orgCrudRouter.ts | 4 ++-- .../trpc/routers/orgRouter/setup/billingRouter.ts | 6 +++--- .../trpc/routers/orgRouter/setup/profileRouter.ts | 4 ++-- .../trpc/routers/orgRouter/users/groupsRouter.ts | 4 ++-- .../trpc/routers/orgRouter/users/invitesRouter.ts | 8 ++++---- .../trpc/routers/orgRouter/users/membersRouter.ts | 2 +- apps/platform/trpc/routers/testRouter.ts | 2 +- apps/platform/trpc/routers/userRouter/addressRouter.ts | 4 ++-- .../platform/trpc/routers/userRouter/defaultsRouter.ts | 2 +- apps/platform/trpc/routers/userRouter/profileRouter.ts | 2 +- apps/platform/trpc/trpc.ts | 2 +- apps/platform/tsconfig.json | 6 +++++- apps/storage/api/attachments/internalPresign.post.ts | 2 +- apps/storage/api/attachments/mailfetch.post.ts | 2 +- apps/storage/api/attachments/presign.get.ts | 2 +- apps/storage/api/avatar.post.ts | 2 +- apps/storage/nitro.config.ts | 9 +++++++++ .../attachment/[orgSlug]/[attachmentId]/[filename].ts | 4 ++-- apps/storage/utils/s3.ts | 2 +- apps/web-app/components/un/2FA-Input.vue | 2 +- apps/web-app/tsconfig.json | 7 ++++++- apps/web-app/types.ts | 8 -------- 43 files changed, 107 insertions(+), 81 deletions(-) delete mode 100644 apps/web-app/types.ts diff --git a/apps/mail-bridge/middleware/verifyPostalSig.ts b/apps/mail-bridge/middleware/verifyPostalSig.ts index c73424a4..6911e5d0 100644 --- a/apps/mail-bridge/middleware/verifyPostalSig.ts +++ b/apps/mail-bridge/middleware/verifyPostalSig.ts @@ -1,5 +1,5 @@ -import { validatePostalWebhookSignature } from '../utils/validatePostalWebhookSignature'; -import type { PostalConfig } from '../types'; +import { validatePostalWebhookSignature } from '~/utils/validatePostalWebhookSignature'; +import type { PostalConfig } from '~/types'; import { defineEventHandler, getRequestURL, diff --git a/apps/mail-bridge/nitro.config.ts b/apps/mail-bridge/nitro.config.ts index cfeeda8e..191ec034 100644 --- a/apps/mail-bridge/nitro.config.ts +++ b/apps/mail-bridge/nitro.config.ts @@ -36,8 +36,14 @@ const mailDomains: MailDomains = JSON.parse(process.env.MAIL_DOMAINS); // TODO: ensure limits are pulled from the billing module export default defineNitroConfig({ - alias: { - '~': './src' + typescript: { + tsConfig: { + compilerOptions: { + paths: { + '~/*': ['../../*'] + } + } + } }, esbuild: { options: { diff --git a/apps/mail-bridge/postal-db/index.ts b/apps/mail-bridge/postal-db/index.ts index 14a3a062..ad640a0d 100644 --- a/apps/mail-bridge/postal-db/index.ts +++ b/apps/mail-bridge/postal-db/index.ts @@ -2,7 +2,7 @@ import { drizzle } from 'drizzle-orm/mysql2'; import mysql from 'mysql2/promise'; import * as schema from './schema'; import { useRuntimeConfig } from '#imports'; -import type { PostalConfig } from '../types'; +import type { PostalConfig } from '~/types'; const postalConfig = useRuntimeConfig().postal as PostalConfig; diff --git a/apps/mail-bridge/routes/postal/mail/inbound/[...mailServer].post.ts b/apps/mail-bridge/routes/postal/mail/inbound/[...mailServer].post.ts index 9d3c418b..5d204772 100644 --- a/apps/mail-bridge/routes/postal/mail/inbound/[...mailServer].post.ts +++ b/apps/mail-bridge/routes/postal/mail/inbound/[...mailServer].post.ts @@ -20,7 +20,7 @@ import { parseMessage } from '@u22n/mailtools'; import type { MessageParseAddressPlatformObject, postalEmailPayload -} from '../../../../types'; +} from '~/types'; import { typeIdGenerator, validateTypeId } from '@u22n/utils'; import { tiptapCore, tiptapHtml } from '@u22n/tiptap'; import { tipTapExtensions } from '@u22n/tiptap/extensions'; diff --git a/apps/mail-bridge/routes/trpc/[trpc].ts b/apps/mail-bridge/routes/trpc/[trpc].ts index 756ca3b2..80c2bf55 100644 --- a/apps/mail-bridge/routes/trpc/[trpc].ts +++ b/apps/mail-bridge/routes/trpc/[trpc].ts @@ -1,6 +1,6 @@ import { createH3ApiHandler } from 'trpc-nuxt'; -import { trpcMailBridgeRouter } from '../../trpc'; -import { createContext } from '../../trpc/createContext'; +import { trpcMailBridgeRouter } from '~/trpc'; +import { createContext } from '~/trpc/createContext'; // export API handler export default createH3ApiHandler({ diff --git a/apps/mail-bridge/trpc/routers/domainRouter.ts b/apps/mail-bridge/trpc/routers/domainRouter.ts index 65a346b5..469b2710 100644 --- a/apps/mail-bridge/trpc/routers/domainRouter.ts +++ b/apps/mail-bridge/trpc/routers/domainRouter.ts @@ -1,17 +1,17 @@ import { z } from 'zod'; -import { router, protectedProcedure } from '../trpc'; +import { router, protectedProcedure } from '~/trpc/trpc'; import { and, eq } from '@u22n/database/orm'; import { postalServers } from '@u22n/database/schema'; import { typeIdValidator } from '@u22n/utils'; -import type { PostalConfig } from '../../types'; -import { postalDB } from '../../postal-db'; -import { httpEndpoints, organizations, servers } from '../../postal-db/schema'; +import type { PostalConfig } from '~/types'; +import { postalDB } from '~/postal-db'; +import { httpEndpoints, organizations, servers } from '~/postal-db/schema'; import { createDomain, setMailServerRouteForDomain, getDomainDNSRecords, type GetDomainDNSRecordsOutput -} from '../../postal-db/functions'; +} from '~/postal-db/functions'; export const domainRouter = router({ createDomain: protectedProcedure diff --git a/apps/mail-bridge/trpc/routers/orgRouter.ts b/apps/mail-bridge/trpc/routers/orgRouter.ts index fccb3bf0..cdff439a 100644 --- a/apps/mail-bridge/trpc/routers/orgRouter.ts +++ b/apps/mail-bridge/trpc/routers/orgRouter.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { router, protectedProcedure } from '../trpc'; +import { router, protectedProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { typeIdGenerator, typeIdValidator } from '@u22n/utils'; -import type { PostalConfig } from '../../types'; +import type { PostalConfig } from '~/types'; import { addMailServer, createOrg, @@ -11,9 +11,9 @@ import { setMailServerKey, setMailServerRoutingHttpEndpoint, setOrgIpPools -} from '../../postal-db/functions'; -import { postalDB } from '../../postal-db'; -import { ipPools } from '../../postal-db/schema'; +} from '~/postal-db/functions'; +import { postalDB } from '~/postal-db'; +import { ipPools } from '~/postal-db/schema'; export const orgRouter = router({ createPostalOrg: protectedProcedure diff --git a/apps/mail-bridge/trpc/routers/sendMailRouter.ts b/apps/mail-bridge/trpc/routers/sendMailRouter.ts index adaea2e4..161a3c83 100644 --- a/apps/mail-bridge/trpc/routers/sendMailRouter.ts +++ b/apps/mail-bridge/trpc/routers/sendMailRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, protectedProcedure } from '../trpc'; +import { router, protectedProcedure } from '~/trpc/trpc'; import { emailIdentities, postalServers, @@ -16,7 +16,7 @@ import { } from '@u22n/database/schema'; import { typeIdValidator } from '@u22n/utils'; import { and, eq } from '@u22n/database/orm'; -import type { PostalConfig } from '../../types'; +import type { PostalConfig } from '~/types'; import { useRuntimeConfig } from '#imports'; import { tiptapHtml, tiptapVue3 } from '@u22n/tiptap'; import { tipTapExtensions } from '@u22n/tiptap/extensions'; diff --git a/apps/platform/middleware/02.orgSlug.ts b/apps/platform/middleware/02.orgSlug.ts index 3be8ef93..c0daf073 100644 --- a/apps/platform/middleware/02.orgSlug.ts +++ b/apps/platform/middleware/02.orgSlug.ts @@ -1,4 +1,5 @@ -import { validateOrgSlug } from '../utils/orgSlug'; +import { validateOrgSlug } from '~/utils/orgSlug'; +//import { validateOrgSlug } from '~/utils/orgSlug'; import { defineEventHandler } from 'h3'; export default defineEventHandler(async (event) => { diff --git a/apps/platform/nitro.config.ts b/apps/platform/nitro.config.ts index 8982892c..2f1ad3db 100644 --- a/apps/platform/nitro.config.ts +++ b/apps/platform/nitro.config.ts @@ -42,6 +42,15 @@ if (eeLicenseKey && billingUrl && billingKey) { } export default defineNitroConfig({ + typescript: { + tsConfig: { + compilerOptions: { + paths: { + '~/*': ['../../*'] + } + } + } + }, imports: { autoImport: false }, diff --git a/apps/platform/routes/realtime/auth.post.ts b/apps/platform/routes/realtime/auth.post.ts index 6901ec0b..b168c43b 100644 --- a/apps/platform/routes/realtime/auth.post.ts +++ b/apps/platform/routes/realtime/auth.post.ts @@ -1,6 +1,6 @@ import { eventHandler, createError, readBody } from 'h3'; import { z } from 'zod'; -import { realtime } from '../../realtime'; +import { realtime } from '~/realtime'; import { validateTypeId } from '@u22n/utils'; const bodySchema = z.object({ diff --git a/apps/platform/routes/trpc/[trpc].ts b/apps/platform/routes/trpc/[trpc].ts index 8f7e63cd..2e2569ac 100644 --- a/apps/platform/routes/trpc/[trpc].ts +++ b/apps/platform/routes/trpc/[trpc].ts @@ -2,7 +2,7 @@ import { createNuxtApiHandler } from 'trpc-nuxt'; import { trpcPlatformRouter, trpcPlatformContext as createContext -} from '../../trpc'; +} from '~/trpc'; // export API handler export default createNuxtApiHandler({ diff --git a/apps/platform/trpc/routers/authRouter/passkeyRouter.ts b/apps/platform/trpc/routers/authRouter/passkeyRouter.ts index 5cf8c2e3..19e762f4 100644 --- a/apps/platform/trpc/routers/authRouter/passkeyRouter.ts +++ b/apps/platform/trpc/routers/authRouter/passkeyRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { limitedProcedure, router, accountProcedure } from '../../trpc'; +import { limitedProcedure, router, accountProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { accountCredentials, accounts } from '@u22n/database/schema'; import { TRPCError } from '@trpc/server'; @@ -14,12 +14,12 @@ import { zodSchemas } from '@u22n/utils'; import { UAParser } from 'ua-parser-js'; -import { usePasskeys } from '../../../utils/auth/passkeys'; -import { usePasskeysDb } from '../../../utils/auth/passkeyDbAdaptor'; +import { usePasskeys } from '~/utils/auth/passkeys'; +import { usePasskeysDb } from '~/utils/auth/passkeyDbAdaptor'; import { setCookie, getCookie, getHeader } from 'h3'; -import { lucia } from '../../../utils/auth'; +import { lucia } from '~/utils/auth'; import { validateUsername } from './signupRouter'; -import { createLuciaSessionCookie } from '../../../utils/session'; +import { createLuciaSessionCookie } from '~/utils/session'; export const passkeyRouter = router({ // generateNewPasskeyChallenge: accountProcedure diff --git a/apps/platform/trpc/routers/authRouter/passwordRouter.ts b/apps/platform/trpc/routers/authRouter/passwordRouter.ts index f8de5843..592b3327 100644 --- a/apps/platform/trpc/routers/authRouter/passwordRouter.ts +++ b/apps/platform/trpc/routers/authRouter/passwordRouter.ts @@ -1,14 +1,14 @@ import { z } from 'zod'; import { Argon2id } from 'oslo/password'; -import { limitedProcedure, router, accountProcedure } from '../../trpc'; +import { limitedProcedure, router, accountProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { accountCredentials, accounts } from '@u22n/database/schema'; import { strongPasswordSchema, typeIdGenerator, zodSchemas } from '@u22n/utils'; import { TRPCError } from '@trpc/server'; import { createError, setCookie } from 'h3'; -import { lucia } from '../../../utils/auth'; +import { lucia } from '~/utils/auth'; import { validateUsername } from './signupRouter'; -import { createLuciaSessionCookie } from '../../../utils/session'; +import { createLuciaSessionCookie } from '~/utils/session'; import { decodeHex } from 'oslo/encoding'; import { TOTPController } from 'oslo/otp'; diff --git a/apps/platform/trpc/routers/authRouter/signupRouter.ts b/apps/platform/trpc/routers/authRouter/signupRouter.ts index 7937b4a9..915527d2 100644 --- a/apps/platform/trpc/routers/authRouter/signupRouter.ts +++ b/apps/platform/trpc/routers/authRouter/signupRouter.ts @@ -1,9 +1,9 @@ import { z } from 'zod'; -import { router, limitedProcedure } from '../../trpc'; +import { router, limitedProcedure } from '~/trpc/trpc'; import type { DBType } from '@u22n/database'; import { eq } from '@u22n/database/orm'; import { accounts } from '@u22n/database/schema'; -import { blockedUsernames, reservedUsernames } from '../../../utils/signup'; +import { blockedUsernames, reservedUsernames } from '~/utils/signup'; import { calculatePasswordStrength, zodSchemas } from '@u22n/utils'; export async function validateUsername( diff --git a/apps/platform/trpc/routers/authRouter/twoFactorRouter.ts b/apps/platform/trpc/routers/authRouter/twoFactorRouter.ts index e64a6adb..b71a94ac 100644 --- a/apps/platform/trpc/routers/authRouter/twoFactorRouter.ts +++ b/apps/platform/trpc/routers/authRouter/twoFactorRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, accountProcedure } from '../../trpc'; +import { router, accountProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { accountCredentials, accounts } from '@u22n/database/schema'; import { decodeHex, encodeHex } from 'oslo/encoding'; diff --git a/apps/platform/trpc/routers/contactRouter/contactRouter.ts b/apps/platform/trpc/routers/contactRouter/contactRouter.ts index 0dd1d145..c681638e 100644 --- a/apps/platform/trpc/routers/contactRouter/contactRouter.ts +++ b/apps/platform/trpc/routers/contactRouter/contactRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { and, eq } from '@u22n/database/orm'; import { contacts } from '@u22n/database/schema'; import { TRPCError } from '@trpc/server'; diff --git a/apps/platform/trpc/routers/convoRouter/convoRouter.ts b/apps/platform/trpc/routers/convoRouter/convoRouter.ts index 11d4f5bf..8d6635a7 100644 --- a/apps/platform/trpc/routers/convoRouter/convoRouter.ts +++ b/apps/platform/trpc/routers/convoRouter/convoRouter.ts @@ -1,7 +1,7 @@ -import { mailBridgeTrpcClient } from './../../../utils/tRPCServerClients'; +import { mailBridgeTrpcClient } from '~/utils/tRPCServerClients'; import { z } from 'zod'; import { parse } from 'superjson'; -import { router, orgProcedure } from '../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { type InferInsertModel, and, diff --git a/apps/platform/trpc/routers/convoRouter/entryRouter.ts b/apps/platform/trpc/routers/convoRouter/entryRouter.ts index 4bf1d40b..bc1a50ce 100644 --- a/apps/platform/trpc/routers/convoRouter/entryRouter.ts +++ b/apps/platform/trpc/routers/convoRouter/entryRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { and, desc, eq, lt, or } from '@u22n/database/orm'; import { convos, convoEntries } from '@u22n/database/schema'; import { typeIdValidator } from '@u22n/utils'; diff --git a/apps/platform/trpc/routers/orgRouter/mail/domainsRouter.ts b/apps/platform/trpc/routers/orgRouter/mail/domainsRouter.ts index 9c79a65d..4202acfe 100644 --- a/apps/platform/trpc/routers/orgRouter/mail/domainsRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/mail/domainsRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { and, eq } from '@u22n/database/orm'; import { domains, @@ -8,8 +8,8 @@ import { } from '@u22n/database/schema'; import { typeIdGenerator, typeIdValidator } from '@u22n/utils'; import { TRPCError } from '@trpc/server'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; -import { mailBridgeTrpcClient } from '../../../../utils/tRPCServerClients'; +import { isAccountAdminOfOrg } from '~/utils/account'; +import { mailBridgeTrpcClient } from '~/utils/tRPCServerClients'; import { lookupNS } from '@u22n/utils/dns'; export const domainsRouter = router({ diff --git a/apps/platform/trpc/routers/orgRouter/mail/emailIdentityRouter.ts b/apps/platform/trpc/routers/orgRouter/mail/emailIdentityRouter.ts index 49aa7a83..1f44c75a 100644 --- a/apps/platform/trpc/routers/orgRouter/mail/emailIdentityRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/mail/emailIdentityRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { and, eq, @@ -17,7 +17,7 @@ import { groupMembers } from '@u22n/database/schema'; import { typeIdGenerator, typeIdValidator } from '@u22n/utils'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; +import { isAccountAdminOfOrg } from '~/utils/account'; import { TRPCError } from '@trpc/server'; export const emailIdentityRouter = router({ diff --git a/apps/platform/trpc/routers/orgRouter/orgCrudRouter.ts b/apps/platform/trpc/routers/orgRouter/orgCrudRouter.ts index 60044d10..270bc70a 100644 --- a/apps/platform/trpc/routers/orgRouter/orgCrudRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/orgCrudRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, accountProcedure } from '../../trpc'; +import { router, accountProcedure } from '~/trpc/trpc'; import type { DBType } from '@u22n/database'; import { eq, and } from '@u22n/database/orm'; import { @@ -10,7 +10,7 @@ import { } from '@u22n/database/schema'; import { typeIdGenerator } from '@u22n/utils'; import { TRPCError } from '@trpc/server'; -import { blockedUsernames, reservedUsernames } from '../../../utils/signup'; +import { blockedUsernames, reservedUsernames } from '~/utils/signup'; async function validateOrgSlug( db: DBType, diff --git a/apps/platform/trpc/routers/orgRouter/setup/billingRouter.ts b/apps/platform/trpc/routers/orgRouter/setup/billingRouter.ts index 92e97e8f..fcd14f7b 100644 --- a/apps/platform/trpc/routers/orgRouter/setup/billingRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/setup/billingRouter.ts @@ -1,10 +1,10 @@ import { z } from 'zod'; -import { router, eeProcedure } from '../../../trpc'; +import { router, eeProcedure } from '~/trpc/trpc'; import { eq, and, sql } from '@u22n/database/orm'; import { orgBilling, orgMembers } from '@u22n/database/schema'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; +import { isAccountAdminOfOrg } from '~/utils/account'; import { TRPCError } from '@trpc/server'; -import { billingTrpcClient } from '../../../../utils/tRPCServerClients'; +import { billingTrpcClient } from '~/utils/tRPCServerClients'; export const billingRouter = router({ getOrgBillingOverview: eeProcedure diff --git a/apps/platform/trpc/routers/orgRouter/setup/profileRouter.ts b/apps/platform/trpc/routers/orgRouter/setup/profileRouter.ts index f4f7b0b7..8cb63e79 100644 --- a/apps/platform/trpc/routers/orgRouter/setup/profileRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/setup/profileRouter.ts @@ -1,9 +1,9 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { orgs } from '@u22n/database/schema'; import { typeIdValidator } from '@u22n/utils'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; +import { isAccountAdminOfOrg } from '~/utils/account'; import { TRPCError } from '@trpc/server'; export const orgProfileRouter = router({ diff --git a/apps/platform/trpc/routers/orgRouter/users/groupsRouter.ts b/apps/platform/trpc/routers/orgRouter/users/groupsRouter.ts index f4938400..67e5872e 100644 --- a/apps/platform/trpc/routers/orgRouter/users/groupsRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/users/groupsRouter.ts @@ -1,10 +1,10 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { eq, and } from '@u22n/database/orm'; import { orgMembers, groupMembers, groups } from '@u22n/database/schema'; import { typeIdGenerator, typeIdValidator } from '@u22n/utils'; import { uiColors } from '@u22n/types/ui'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; +import { isAccountAdminOfOrg } from '~/utils/account'; import { TRPCError } from '@trpc/server'; export const groupsRouter = router({ diff --git a/apps/platform/trpc/routers/orgRouter/users/invitesRouter.ts b/apps/platform/trpc/routers/orgRouter/users/invitesRouter.ts index e9ad8c53..e2b3d6fa 100644 --- a/apps/platform/trpc/routers/orgRouter/users/invitesRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/users/invitesRouter.ts @@ -4,7 +4,7 @@ import { orgProcedure, limitedProcedure, accountProcedure -} from '../../../trpc'; +} from '~/trpc/trpc'; import { eq, inArray } from '@u22n/database/orm'; import { domains, @@ -25,11 +25,11 @@ import { typeIdValidator, zodSchemas } from '@u22n/utils'; -import { refreshOrgSlugCache } from '../../../../utils/orgSlug'; -import { isAccountAdminOfOrg } from '../../../../utils/account'; +import { refreshOrgSlugCache } from '~/utils/orgSlug'; +import { isAccountAdminOfOrg } from '~/utils/account'; import { TRPCError } from '@trpc/server'; import { useRuntimeConfig } from '#imports'; -import { billingTrpcClient } from '../../../../utils/tRPCServerClients'; +import { billingTrpcClient } from '~/utils/tRPCServerClients'; export const invitesRouter = router({ createNewInvite: orgProcedure diff --git a/apps/platform/trpc/routers/orgRouter/users/membersRouter.ts b/apps/platform/trpc/routers/orgRouter/users/membersRouter.ts index 5486f823..1759ae68 100644 --- a/apps/platform/trpc/routers/orgRouter/users/membersRouter.ts +++ b/apps/platform/trpc/routers/orgRouter/users/membersRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, orgProcedure } from '../../../trpc'; +import { router, orgProcedure } from '~/trpc/trpc'; import { eq, and, or } from '@u22n/database/orm'; import { orgs, orgMembers } from '@u22n/database/schema'; import { TRPCError } from '@trpc/server'; diff --git a/apps/platform/trpc/routers/testRouter.ts b/apps/platform/trpc/routers/testRouter.ts index 843e6550..0eb5ee3a 100644 --- a/apps/platform/trpc/routers/testRouter.ts +++ b/apps/platform/trpc/routers/testRouter.ts @@ -1,4 +1,4 @@ -import { router, publicProcedure } from '../trpc'; +import { router, publicProcedure } from '~/trpc/trpc'; import { TRPCError } from '@trpc/server'; // TODO: Figure out what to do with this route diff --git a/apps/platform/trpc/routers/userRouter/addressRouter.ts b/apps/platform/trpc/routers/userRouter/addressRouter.ts index 275be32a..2873a7b2 100644 --- a/apps/platform/trpc/routers/userRouter/addressRouter.ts +++ b/apps/platform/trpc/routers/userRouter/addressRouter.ts @@ -1,6 +1,6 @@ import { TRPCError } from '@trpc/server'; import { z } from 'zod'; -import { orgProcedure, router, accountProcedure } from '../../trpc'; +import { orgProcedure, router, accountProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { emailIdentities, @@ -13,7 +13,7 @@ import { import { orgMembers } from '@u22n/database/schema'; import { useRuntimeConfig } from '#imports'; -import type { MailDomains } from '../../../types'; +import type { MailDomains } from '~/types'; import { typeIdGenerator, typeIdValidator } from '@u22n/utils'; export const addressRouter = router({ diff --git a/apps/platform/trpc/routers/userRouter/defaultsRouter.ts b/apps/platform/trpc/routers/userRouter/defaultsRouter.ts index 0e88de39..a508cbfb 100644 --- a/apps/platform/trpc/routers/userRouter/defaultsRouter.ts +++ b/apps/platform/trpc/routers/userRouter/defaultsRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, accountProcedure } from '../../trpc'; +import { router, accountProcedure } from '~/trpc/trpc'; import { eq } from '@u22n/database/orm'; import { accounts } from '@u22n/database/schema'; diff --git a/apps/platform/trpc/routers/userRouter/profileRouter.ts b/apps/platform/trpc/routers/userRouter/profileRouter.ts index 6e513d32..de27626c 100644 --- a/apps/platform/trpc/routers/userRouter/profileRouter.ts +++ b/apps/platform/trpc/routers/userRouter/profileRouter.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { router, accountProcedure } from '../../trpc'; +import { router, accountProcedure } from '~/trpc/trpc'; import { and, eq } from '@u22n/database/orm'; import { orgMemberProfiles, orgs, orgMembers } from '@u22n/database/schema'; import { typeIdValidator } from '@u22n/utils'; diff --git a/apps/platform/trpc/trpc.ts b/apps/platform/trpc/trpc.ts index af9d5b6e..7389e226 100644 --- a/apps/platform/trpc/trpc.ts +++ b/apps/platform/trpc/trpc.ts @@ -7,7 +7,7 @@ import superjson from 'superjson'; import type { Context } from './createContext'; import { z } from 'zod'; import { useRuntimeConfig } from '#imports'; -import verifyTurnstileToken from '../utils/turnstile'; +import verifyTurnstileToken from '~/utils/turnstile'; export const trpcContext = initTRPC .context() .create({ transformer: superjson }); diff --git a/apps/platform/tsconfig.json b/apps/platform/tsconfig.json index cb752368..8b07ed42 100644 --- a/apps/platform/tsconfig.json +++ b/apps/platform/tsconfig.json @@ -1,3 +1,7 @@ { - "extends": ["./.nitro/types/tsconfig.json", "@u22n/tsconfig"] + "extends": [ + "./.nitro/types/tsconfig.json", + "../mail-bridge/.nitro/types/tsconfig.json", + "@u22n/tsconfig" + ] } diff --git a/apps/storage/api/attachments/internalPresign.post.ts b/apps/storage/api/attachments/internalPresign.post.ts index b2fab0f3..7a9832b5 100644 --- a/apps/storage/api/attachments/internalPresign.post.ts +++ b/apps/storage/api/attachments/internalPresign.post.ts @@ -1,7 +1,7 @@ import { PutObjectCommand } from '@aws-sdk/client-s3'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; import { z } from 'zod'; -import type { S3Config } from '../../types'; +import type { S3Config } from '~/types'; import { authorizedService, eventHandler, diff --git a/apps/storage/api/attachments/mailfetch.post.ts b/apps/storage/api/attachments/mailfetch.post.ts index e4c6cd11..e1b5ee4b 100644 --- a/apps/storage/api/attachments/mailfetch.post.ts +++ b/apps/storage/api/attachments/mailfetch.post.ts @@ -1,7 +1,7 @@ import { GetObjectCommand } from '@aws-sdk/client-s3'; import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; import { z } from 'zod'; -import type { S3Config } from '../../types'; +import type { S3Config } from '~/types'; import { authorizedService, eventHandler, diff --git a/apps/storage/api/attachments/presign.get.ts b/apps/storage/api/attachments/presign.get.ts index 85b90158..e0a7f760 100644 --- a/apps/storage/api/attachments/presign.get.ts +++ b/apps/storage/api/attachments/presign.get.ts @@ -4,7 +4,7 @@ import { db } from '@u22n/database'; import { and, eq } from '@u22n/database/orm'; import { orgMembers, orgs, pendingAttachments } from '@u22n/database/schema'; import { z } from 'zod'; -import type { S3Config } from '../../types'; +import type { S3Config } from '~/types'; import { eventHandler, loggedIn, diff --git a/apps/storage/api/avatar.post.ts b/apps/storage/api/avatar.post.ts index f58b77c5..bd25bc1d 100644 --- a/apps/storage/api/avatar.post.ts +++ b/apps/storage/api/avatar.post.ts @@ -10,7 +10,7 @@ import { eq } from '@u22n/database/orm'; import { db } from '@u22n/database'; import sharp from 'sharp'; import { PutObjectCommand } from '@aws-sdk/client-s3'; -import type { S3Config } from '../types'; +import type { S3Config } from '~/types'; import { eventHandler, loggedIn, diff --git a/apps/storage/nitro.config.ts b/apps/storage/nitro.config.ts index 9291e0a8..f73aa4cb 100644 --- a/apps/storage/nitro.config.ts +++ b/apps/storage/nitro.config.ts @@ -2,6 +2,15 @@ import { defineNitroConfig } from 'nitropack/config'; //https://nitro.unjs.io/config export default defineNitroConfig({ + typescript: { + tsConfig: { + compilerOptions: { + paths: { + '~/*': ['../../*'] + } + } + } + }, imports: { autoImport: false }, diff --git a/apps/storage/routes/attachment/[orgSlug]/[attachmentId]/[filename].ts b/apps/storage/routes/attachment/[orgSlug]/[attachmentId]/[filename].ts index 2230d419..f3b325df 100644 --- a/apps/storage/routes/attachment/[orgSlug]/[attachmentId]/[filename].ts +++ b/apps/storage/routes/attachment/[orgSlug]/[attachmentId]/[filename].ts @@ -1,10 +1,10 @@ import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; import { GetObjectCommand } from '@aws-sdk/client-s3'; -import { s3Client } from '../../../../utils/s3'; +import { s3Client } from '~/utils/s3'; import { db } from '@u22n/database'; import { and, eq } from '@u22n/database/orm'; import { convoAttachments, orgMembers, orgs } from '@u22n/database/schema'; -import type { S3Config } from '../../../../types'; +import type { S3Config } from '~/types'; import { eventHandler, getRouterParam, diff --git a/apps/storage/utils/s3.ts b/apps/storage/utils/s3.ts index c4f158c9..333b4f3a 100644 --- a/apps/storage/utils/s3.ts +++ b/apps/storage/utils/s3.ts @@ -1,5 +1,5 @@ import { S3Client } from '@aws-sdk/client-s3'; -import type { S3Config } from '../types'; +import type { S3Config } from '~/types'; import { useRuntimeConfig } from '#imports'; const s3Config: S3Config = useRuntimeConfig().s3; diff --git a/apps/web-app/components/un/2FA-Input.vue b/apps/web-app/components/un/2FA-Input.vue index 7013c100..1ae49460 100644 --- a/apps/web-app/components/un/2FA-Input.vue +++ b/apps/web-app/components/un/2FA-Input.vue @@ -1,6 +1,6 @@