Fix/api build (#3675)

* fix: shared next-auth calendso session type fix

* fix: move imports from @lib -> @calcom/lib to fix types

* Consolidates next-auth definitions

Co-authored-by: Agusti Fernandez Pardo <git@agusti.me>
Co-authored-by: zomars <zomars@me.com>
pull/3602/head
Agusti Fernandez Pardo 2022-08-03 21:18:26 +02:00 committed by GitHub
parent 298a6d5e15
commit e878e1a665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 18 additions and 38 deletions

View File

@ -2,12 +2,11 @@ import { Prisma, WebhookTriggerEvents } from "@prisma/client";
import { v4 as uuidv4 } from "uuid";
import { z } from "zod";
import { sendGenericWebhookPayload } from "@calcom/lib/webhooks/sendPayload";
import getWebhooks from "@calcom/lib/webhooks/subscriptions";
import { TRPCError } from "@calcom/trpc/server";
import { createProtectedRouter, createRouter } from "@calcom/trpc/server/createRouter";
import { sendGenericWebhookPayload } from "@lib/webhooks/sendPayload";
import getWebhooks from "@lib/webhooks/subscriptions";
import { zodFields, zodRoutes } from "./zod";
const app_RoutingForms = createRouter()

View File

@ -1,15 +0,0 @@
import NextAuth, { DefaultSession } from "next-auth";
declare module "next-auth" {
type DefaultSessionUser = NonNullable<DefaultSession["user"]>;
type CalendsoSessionUser = DefaultSessionUser & {
id: number;
username: string;
};
/**
* Returned by `useSession`, `getSession` and received as a prop on the `Provider` React Context
*/
interface Session {
user: CalendsoSessionUser;
}
}

View File

@ -1,12 +0,0 @@
import type { IncomingMessage } from "http";
import type { Session } from "next-auth";
import "./next-auth";
export declare module "next" {
interface NextApiRequest extends IncomingMessage {
// args is defined by /integrations/[...args] endpoint
query: Partial<{ [key: string]: string | string[] }> & { args: string[] };
session?: Session | null;
}
}

View File

@ -13,8 +13,8 @@
"include": [
"next-env.d.ts",
"@calcom/types",
"../../packages/types/*.d.ts",
"../../packages/types/next-auth.d.ts",
"../types/*.d.ts",
"../types/next-auth.d.ts",
"**/*.ts",
"**/*.tsx",
"../../apps/web/server/**/*.ts",

View File

@ -1,5 +1,5 @@
import { compare, hash } from "bcryptjs";
import { Session } from "next-auth";
import type { Session } from "next-auth";
import { getSession as getSessionInner, GetSessionParams } from "next-auth/react";
export async function hashPassword(password: string) {

View File

@ -1,5 +1,5 @@
import { GetServerSidePropsContext } from "next";
import { Session } from "next-auth";
import type { GetServerSidePropsContext } from "next";
import type { Session } from "next-auth";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { getSession } from "@calcom/lib/auth";

View File

@ -0,0 +1,3 @@
{
"extends": "@calcom/tsconfig/react-library.json"
}

View File

@ -15,11 +15,12 @@
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,
"strict": true,
"isolatedModules": true,
"jsx": "preserve",
"strictNullChecks": true,
"useUnknownInCatchVariables": true
},
"include": ["src", "next-env.d.ts"],
"include": ["src", "next-env.d.ts", "../types/next-auth.d.ts", "../types/*.d.ts"],
"exclude": ["node_modules"]
}

View File

@ -7,5 +7,7 @@
"module": "ESNext",
"target": "ES6",
"jsx": "react-jsx"
}
},
"include": [".", "../types/next-auth.d.ts"],
"exclude": ["dist", "build", "node_modules"]
}

View File

@ -1,5 +1,5 @@
import { UserPermissionRole } from "@prisma/client";
import NextAuth, { DefaultSession } from "next-auth";
import { DefaultSession } from "next-auth";
declare module "next-auth" {
type DefaultSessionUser = NonNullable<DefaultSession["user"]>;

View File

@ -5,6 +5,8 @@ import "./next-auth";
export declare module "next" {
interface NextApiRequest extends IncomingMessage {
// args is defined by /integrations/[...args] endpoint
query: Partial<{ [key: string]: string | string[] }> & { args: string[] };
session?: Session | null;
}
}