diff --git a/packages/features/auth/lib/next-auth-custom-adapter.ts b/packages/features/auth/lib/next-auth-custom-adapter.ts index 80f4efabce..a10e61401e 100644 --- a/packages/features/auth/lib/next-auth-custom-adapter.ts +++ b/packages/features/auth/lib/next-auth-custom-adapter.ts @@ -90,8 +90,11 @@ export default function CalComAdapter(prismaClient: PrismaClient) { return { user, session }; }, createSession: (data: Prisma.SessionCreateInput) => prismaClient.session.create({ data }), - updateSession: (data: Prisma.SessionWhereUniqueInput) => - prismaClient.session.update({ where: { sessionToken: data.sessionToken }, data }), + updateSession: (data: Prisma.SessionUpdateInput) => + prismaClient.session.update({ + where: { sessionToken: typeof data.sessionToken === "string" ? data.sessionToken : undefined }, + data, + }), deleteSession: (sessionToken: string) => prismaClient.session.delete({ where: { sessionToken } }), }; } diff --git a/packages/features/bookings/lib/handleNewBooking.ts b/packages/features/bookings/lib/handleNewBooking.ts index 5404f30956..586c41b83a 100644 --- a/packages/features/bookings/lib/handleNewBooking.ts +++ b/packages/features/bookings/lib/handleNewBooking.ts @@ -11,9 +11,11 @@ import z from "zod"; import { getCalendar } from "@calcom/app-store/_utils/getCalendar"; import { metadata as GoogleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata"; import type { LocationObject } from "@calcom/app-store/locations"; -import { OrganizerDefaultConferencingAppType } from "@calcom/app-store/locations"; -import { getLocationValueForDB } from "@calcom/app-store/locations"; -import { MeetLocationType } from "@calcom/app-store/locations"; +import { + getLocationValueForDB, + MeetLocationType, + OrganizerDefaultConferencingAppType, +} from "@calcom/app-store/locations"; import type { EventTypeAppsList } from "@calcom/app-store/utils"; import { getAppFromSlug } from "@calcom/app-store/utils"; import { cancelScheduledJobs, scheduleTrigger } from "@calcom/app-store/zapier/lib/nodeScheduler"; @@ -26,8 +28,8 @@ import { sendAttendeeRequestEmail, sendOrganizerRequestEmail, sendRescheduledEmails, - sendScheduledEmails, sendRescheduledSeatEmail, + sendScheduledEmails, sendScheduledSeatsEmails, } from "@calcom/emails"; import { getBookingFieldsWithSystemFields } from "@calcom/features/bookings/lib/getBookingFields"; @@ -38,8 +40,8 @@ import { allowDisablingHostConfirmationEmails, } from "@calcom/features/ee/workflows/lib/allowDisablingStandardEmails"; import { - scheduleWorkflowReminders, cancelWorkflowReminders, + scheduleWorkflowReminders, } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler"; import { getFullName } from "@calcom/features/form-builder/utils"; import type { GetSubscriberOptions } from "@calcom/features/webhooks/lib/getWebhooks"; @@ -47,7 +49,7 @@ import getWebhooks from "@calcom/features/webhooks/lib/getWebhooks"; import { isPrismaObjOrUndefined, parseRecurringEvent } from "@calcom/lib"; import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser"; import { checkRateLimitAndThrowError } from "@calcom/lib/checkRateLimitAndThrowError"; -import { getDefaultEvent, getGroupName, getUsernameList } from "@calcom/lib/defaultEvents"; +import { getDefaultEvent, getUsernameList } from "@calcom/lib/defaultEvents"; import { getErrorFromUnknown } from "@calcom/lib/errors"; import getIP from "@calcom/lib/getIP"; import getPaymentAppData from "@calcom/lib/getPaymentAppData"; @@ -65,9 +67,9 @@ import { getTimeFormatStringFromUserTimeFormat } from "@calcom/lib/timeFormat"; import prisma, { userSelect } from "@calcom/prisma"; import type { BookingReference } from "@calcom/prisma/client"; import { BookingStatus, SchedulingType, WebhookTriggerEvents } from "@calcom/prisma/enums"; -import { bookingCreateSchemaLegacyPropsForApi } from "@calcom/prisma/zod-utils"; import { bookingCreateBodySchemaForApi, + bookingCreateSchemaLegacyPropsForApi, customInputSchema, EventTypeMetaDataSchema, extendedBookingCreateBody, @@ -653,9 +655,7 @@ async function handler( const tAttendees = await getTranslation(language ?? "en", "common"); const tGuests = await getTranslation("en", "common"); log.debug(`Booking eventType ${eventTypeId} started`); - const dynamicUserList = Array.isArray(reqBody.user) - ? getGroupName(reqBody.user) - : getUsernameList(reqBody.user); + const dynamicUserList = Array.isArray(reqBody.user) ? reqBody.user : getUsernameList(reqBody.user); if (!eventType) throw new HttpError({ statusCode: 404, message: "eventType.notFound" }); const isTeamEventType = diff --git a/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts b/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts index f74b407267..a058ae1b4d 100644 --- a/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts +++ b/packages/features/ee/managed-event-types/lib/handleChildrenEventTypes.ts @@ -40,11 +40,7 @@ interface handleChildrenEventTypesProps { }; }[] | undefined; - prisma: PrismaClient< - Prisma.PrismaClientOptions, - never, - Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined - >; + prisma: PrismaClient; } const sendAllSlugReplacementEmails = async ( diff --git a/packages/lib/getEventTypeById.ts b/packages/lib/getEventTypeById.ts index 3d2992213a..99e3ecb0e0 100644 --- a/packages/lib/getEventTypeById.ts +++ b/packages/lib/getEventTypeById.ts @@ -18,11 +18,7 @@ import { TRPCError } from "@trpc/server"; interface getEventTypeByIdProps { eventTypeId: number; userId: number; - prisma: PrismaClient< - Prisma.PrismaClientOptions, - never, - Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined - >; + prisma: PrismaClient; isTrpcCall?: boolean; } diff --git a/packages/prisma/package.json b/packages/prisma/package.json index 894bd80fcf..1a5a5edbe2 100644 --- a/packages/prisma/package.json +++ b/packages/prisma/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@calcom/lib": "*", - "@prisma/client": "^4.16.0", - "@prisma/generator-helper": "^4.13.0", - "prisma": "^4.16.0", + "@prisma/client": "^5.0.0", + "@prisma/generator-helper": "^5.0.0", + "prisma": "^5.0.0", "ts-node": "^10.9.1", "zod": "^3.20.2", "zod-prisma": "^0.5.4" diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prisma index da77e28995..eae1bce7d1 100644 --- a/packages/prisma/schema.prisma +++ b/packages/prisma/schema.prisma @@ -8,7 +8,7 @@ datasource db { generator client { provider = "prisma-client-js" - previewFeatures = ["views", "jsonProtocol"] + previewFeatures = ["views"] } generator zod { diff --git a/packages/trpc/server/routers/viewer/slots/util.ts b/packages/trpc/server/routers/viewer/slots/util.ts index c102f731fa..37a708ab48 100644 --- a/packages/trpc/server/routers/viewer/slots/util.ts +++ b/packages/trpc/server/routers/viewer/slots/util.ts @@ -150,7 +150,11 @@ export async function getDynamicEventType(input: TGetScheduleInputSchema) { const users = await prisma.user.findMany({ where: { username: { - in: input.usernameList, + in: Array.isArray(input.usernameList) + ? input.usernameList + : input.usernameList + ? [input.usernameList] + : [], }, }, select: { diff --git a/yarn.lock b/yarn.lock index 5945263c38..b999117991 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4423,10 +4423,10 @@ __metadata: resolution: "@calcom/prisma@workspace:packages/prisma" dependencies: "@calcom/lib": "*" - "@prisma/client": ^4.16.0 - "@prisma/generator-helper": ^4.13.0 + "@prisma/client": ^5.0.0 + "@prisma/generator-helper": ^5.0.0 npm-run-all: ^4.1.5 - prisma: ^4.16.0 + prisma: ^5.0.0 ts-node: ^10.9.1 zod: ^3.20.2 zod-prisma: ^0.5.4 @@ -7751,16 +7751,30 @@ __metadata: linkType: hard "@prisma/client@npm:^4.16.0": - version: 4.16.0 - resolution: "@prisma/client@npm:4.16.0" + version: 4.16.2 + resolution: "@prisma/client@npm:4.16.2" dependencies: - "@prisma/engines-version": 4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c + "@prisma/engines-version": 4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81 peerDependencies: prisma: "*" peerDependenciesMeta: prisma: optional: true - checksum: 67fbf8e0bd672d597433b61b65a39c58cbb2eb82e7bcac33f31215d8ca5ba48df790a20aa990c47d6dde53e0d84d1a45d07d872f772d3dd8271613abe879b5d0 + checksum: 38e1356644a764946c69c8691ea4bbed0ba37739d833a435625bd5435912bed4b9bdd7c384125f3a4ab8128faf566027985c0f0840a42741c338d72e40b5d565 + languageName: node + linkType: hard + +"@prisma/client@npm:^5.0.0": + version: 5.0.0 + resolution: "@prisma/client@npm:5.0.0" + dependencies: + "@prisma/engines-version": 4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584 + peerDependencies: + prisma: "*" + peerDependenciesMeta: + prisma: + optional: true + checksum: 332c2af44e880ffc9dd1223992bf6f45910094c7a3a540cbbfdda45d6caf3e82998376338abdf85e34a12f1082ae932f2385d6396c62fe4bba7ec6b84de54466 languageName: node linkType: hard @@ -7775,17 +7789,6 @@ __metadata: languageName: node linkType: hard -"@prisma/debug@npm:4.13.0": - version: 4.13.0 - resolution: "@prisma/debug@npm:4.13.0" - dependencies: - "@types/debug": 4.1.7 - debug: 4.3.4 - strip-ansi: 6.0.1 - checksum: cd8b3361a3992ad93855923aeea0cedfc3ff316508fc1d6b526d46d05af35b47dc2e2203e3e0f95258c9e5a72a8a6d9a9737ebca9d8280e4df6135ef810b553b - languageName: node - linkType: hard - "@prisma/debug@npm:5.0.0": version: 5.0.0 resolution: "@prisma/debug@npm:5.0.0" @@ -7797,29 +7800,31 @@ __metadata: languageName: node linkType: hard -"@prisma/engines-version@npm:4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c": - version: 4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c - resolution: "@prisma/engines-version@npm:4.16.0-66.b20ead4d3ab9e78ac112966e242ded703f4a052c" - checksum: 23183cab33f95e0711cd6cee7642f4beeeb77b8b0aa54b419f55097bfb96863a11a28f6509ab27fef0ea794522e188044ce850993a25c341333f8305711a255f +"@prisma/engines-version@npm:4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81": + version: 4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81 + resolution: "@prisma/engines-version@npm:4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81" + checksum: b42c6abe7c1928e546f15449e40ffa455701ef2ab1f62973628ecb4e19ff3652e34609a0d83196d1cbd0864adb44c55e082beec852b11929acf1c15fb57ca45a languageName: node linkType: hard -"@prisma/engines@npm:4.16.0": - version: 4.16.0 - resolution: "@prisma/engines@npm:4.16.0" - checksum: 60ef1c3720720cf5a9d23f52c668669736716afd1862c4ac61e8ebcd3ca896e3453f80dfab77f3b68b001c5d499a895f28e54cc5025eae61878b40c1ec5d99c3 +"@prisma/engines-version@npm:4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584": + version: 4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584 + resolution: "@prisma/engines-version@npm:4.17.0-26.6b0aef69b7cdfc787f822ecd7cdc76d5f1991584" + checksum: 8fcbceef3b554ee7fa404bead50be5286412a097b21723272aff298b289caf2802b01b84bb85c4c9f3b592eeac114c8d6e79db083f271dc8c54f453b4a515233 languageName: node linkType: hard -"@prisma/generator-helper@npm:^4.13.0": - version: 4.13.0 - resolution: "@prisma/generator-helper@npm:4.13.0" - dependencies: - "@prisma/debug": 4.13.0 - "@types/cross-spawn": 6.0.2 - chalk: 4.1.2 - cross-spawn: 7.0.3 - checksum: 0b0724bd03d40b691a85e002d8ed91216df9e6883d1fe5e69368ad135b59cff5ae49d65860db727fca6acf984c3efe382bca26c4127e0328b2e72748dbf59369 +"@prisma/engines@npm:4.16.2": + version: 4.16.2 + resolution: "@prisma/engines@npm:4.16.2" + checksum: f423e6092c3e558cd089a68ae87459fba7fd390c433df087342b3269c3b04163965b50845150dfe47d01f811781bfff89d5ae81c95ca603c59359ab69ebd810f + languageName: node + linkType: hard + +"@prisma/engines@npm:5.0.0": + version: 5.0.0 + resolution: "@prisma/engines@npm:5.0.0" + checksum: 31271d85c29709059f91051d4cef7acf874014ba0128b674ca2f842e5fac61d3011e9db246dfa67ba4803081d36dbc9e31492716bab677128588343c92117b2b languageName: node linkType: hard @@ -28830,23 +28835,23 @@ __metadata: languageName: node linkType: hard -"playwright-core@npm:1.35.0": - version: 1.35.0 - resolution: "playwright-core@npm:1.35.0" +"playwright-core@npm:1.36.2": + version: 1.36.2 + resolution: "playwright-core@npm:1.36.2" bin: playwright-core: cli.js - checksum: e23050c9de128e02b16ffbeb1adaca6dddd85a6fd581e71da38947f66b3c910504d628285340e3d6de8c099a488ab9dad14241aefe615f65c01a5a3e3b6e633d + checksum: 2193ce802ef93c28b9b5e11a0b1d7b60778c686015659978d1cbf0eb9cda2cdc85ec5575b887c1346e9d161cc2805bf27638d76a2f7f857dffeae968e6ceffcd languageName: node linkType: hard "playwright@npm:^1.31.2": - version: 1.35.0 - resolution: "playwright@npm:1.35.0" + version: 1.36.2 + resolution: "playwright@npm:1.36.2" dependencies: - playwright-core: 1.35.0 + playwright-core: 1.36.2 bin: playwright: cli.js - checksum: 5d7ea56481ea325ad4d4461b743b54a8839f080dc6ff6e0b8b22a8bd3985952db7aa67cee8c19370c8e4a79cc79f1ace5d198f0f6c598dadcf351324e00c313f + checksum: 5876b65a0f1303e45f99c7d120706af0ab808efd5d89c514741584ff1060408b62148ae2790c2e6527642f2b8f49db682710b87d3df7b3ba510e8e847e6041ef languageName: node linkType: hard @@ -29457,14 +29462,25 @@ __metadata: linkType: hard "prisma@npm:^4.16.0": - version: 4.16.0 - resolution: "prisma@npm:4.16.0" + version: 4.16.2 + resolution: "prisma@npm:4.16.2" dependencies: - "@prisma/engines": 4.16.0 + "@prisma/engines": 4.16.2 bin: prisma: build/index.js prisma2: build/index.js - checksum: 831a4d14a48474fa144ae0648ed5e3766756b991f1997ecca813a044ef9bd7f2a5794c603adc9d23d867d8f4a0f51cedadaebfd8a841e6923ef9b804ed8bcbbb + checksum: 1d0ed616abd7f8de22441e333b976705f1cb05abcb206965df3fc6a7ea03911ef467dd484a4bc51fdc6cff72dd9857b9852be5f232967a444af0a98c49bfdb76 + languageName: node + linkType: hard + +"prisma@npm:^5.0.0": + version: 5.0.0 + resolution: "prisma@npm:5.0.0" + dependencies: + "@prisma/engines": 5.0.0 + bin: + prisma: build/index.js + checksum: fdc62377853d25b4db664c736fd0b08d2b0c6db5752e6f6c6ec3bda77634cfb79e6f49d52d4b8f54ddb8ec9c28fc3fb0c13f95caf61085447d0929e258af9284 languageName: node linkType: hard