Type fixes
This commit is contained in:
1 parent
fbbda20792
commit
0153bc583a
43 files changed
+191
-187
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { Account, IdentityProvider, Prisma, PrismaClient, User, VerificationToken } from "@prisma/client";
|
||||
import { PrismaClientKnownRequestError } from "@prisma/client/runtime";
|
||||
|
||||
import { identityProviderNameMap } from "@lib/auth";
|
||||
|
||||
@@ -45,6 +46,7 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
|
||||
prismaClient.user.update({ where: { id }, data }),
|
||||
deleteUser: (id: User["id"]) => prismaClient.user.delete({ where: { id } }),
|
||||
async createVerificationToken(data: VerificationToken) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { id: _, ...verificationToken } = await prismaClient.verificationToken.create({
|
||||
data,
|
||||
});
|
||||
@@ -52,6 +54,7 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
|
||||
},
|
||||
async useVerificationToken(identifier_token: Prisma.VerificationTokenIdentifierTokenCompoundUniqueInput) {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { id: _, ...verificationToken } = await prismaClient.verificationToken.delete({
|
||||
where: { identifier_token },
|
||||
});
|
||||
@@ -59,8 +62,9 @@ export default function CalComAdapter(prismaClient: PrismaClient) {
|
||||
} catch (error) {
|
||||
// If token already used/deleted, just return null
|
||||
// https://www.prisma.io/docs/reference/api-reference/error-reference#p2025
|
||||
// @ts-ignore
|
||||
if (error.code === "P2025") return null;
|
||||
if (error instanceof PrismaClientKnownRequestError) {
|
||||
if (error.code === "P2025") return null;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import noop from "lodash/noop";
|
||||
|
||||
const data: Record<string, number> = {};
|
||||
/**
|
||||
* Starts an iteration from `0` to `length - 1` with batch size `batch`
|
||||
@@ -20,9 +22,9 @@ export const doWorkAsync = ({
|
||||
}: {
|
||||
name: string;
|
||||
length: number;
|
||||
callback: Function;
|
||||
done?: Function;
|
||||
batchDone?: Function;
|
||||
callback: (i: number, b?: boolean) => void;
|
||||
done?: () => void;
|
||||
batchDone?: () => void;
|
||||
batch: number;
|
||||
offsetStart?: number;
|
||||
__pending?: boolean;
|
||||
@@ -32,8 +34,8 @@ export const doWorkAsync = ({
|
||||
const lastIndex = length - 1;
|
||||
const offsetEndExclusive = offsetStart + stepLength;
|
||||
|
||||
batchDone = batchDone || (() => {});
|
||||
done = done || (() => {});
|
||||
batchDone = batchDone || noop;
|
||||
done = done || noop;
|
||||
|
||||
if (!__pending && data[name]) {
|
||||
cancelAnimationFrame(data[name]);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { recurringEvent } from "@calcom/prisma/zod-utils";
|
||||
import type { CalendarEvent, Person, RecurringEvent } from "@calcom/types/Calendar";
|
||||
|
||||
import AttendeeAwaitingPaymentEmail from "@lib/emails/templates/attendee-awaiting-payment-email";
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||
import { serverConfig } from "@calcom/lib/serverConfig";
|
||||
|
||||
export default class BaseEmail {
|
||||
name: string = "";
|
||||
name = "";
|
||||
|
||||
protected getNodeMailerPayload(): Record<string, unknown> {
|
||||
return {};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { useEmbedTheme } from "@calcom/embed-core";
|
||||
|
||||
@@ -2,7 +2,6 @@ import dayjs, { Dayjs } from "dayjs";
|
||||
import { I18n } from "next-i18next";
|
||||
import { RRule } from "rrule";
|
||||
|
||||
import { recurringEvent } from "@calcom/prisma/zod-utils";
|
||||
import { RecurringEvent } from "@calcom/types/Calendar";
|
||||
|
||||
import { detectBrowserTimeFormat } from "@lib/timeFormat";
|
||||
@@ -29,6 +28,7 @@ export const parseRecurringDates = (
|
||||
}: { startDate: string | null | Dayjs; recurringEvent: RecurringEvent; recurringCount: number },
|
||||
i18n: I18n
|
||||
): [string[], Date[]] => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
const { count, ...restRecurringEvent } = recurringEvent;
|
||||
const rule = new RRule({
|
||||
...restRecurringEvent,
|
||||
|
||||
@@ -89,7 +89,7 @@ const getSlots = ({ inviteeDate, frequency, minimumBookingNotice, workingHours,
|
||||
computedLocalWorkingHours.push(tempComputeTimeFrame);
|
||||
}
|
||||
});
|
||||
computedLocalWorkingHours.forEach((item, index) => {
|
||||
computedLocalWorkingHours.forEach((item) => {
|
||||
slotsTimeFrameAvailable.push(...splitAvailableTime(item.startTime, item.endTime, frequency, eventLength));
|
||||
});
|
||||
|
||||
|
||||
+10
-10
@@ -1,6 +1,11 @@
|
||||
import { jitsuClient, JitsuClient } from "@jitsu/sdk-js";
|
||||
import React, { useContext } from "react";
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-var
|
||||
var jitsu: JitsuClient | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumeration of all event types that are being sent
|
||||
* to telemetry collection.
|
||||
@@ -49,7 +54,10 @@ function isLocalhost(host: string) {
|
||||
* Collects page parameters and makes sure no sensitive data made it to telemetry
|
||||
* @param route current next.js route
|
||||
*/
|
||||
export function collectPageParameters(route?: string, extraData: Record<string, any> = {}): any {
|
||||
export function collectPageParameters(
|
||||
route?: string,
|
||||
extraData: Record<string, unknown> = {}
|
||||
): Record<string, unknown> {
|
||||
const host = document.location.hostname;
|
||||
const maskedHost = isLocalhost(host) ? "localhost" : "masked";
|
||||
//starts with ''
|
||||
@@ -78,13 +86,7 @@ function createTelemetryClient(): TelemetryClient {
|
||||
if (!window) {
|
||||
console.warn("Jitsu has been called during SSR, this scenario isn't supported yet");
|
||||
return;
|
||||
} else if (
|
||||
// FIXME
|
||||
// @ts-ignore
|
||||
!window["jitsu"]
|
||||
) {
|
||||
// FIXME
|
||||
// @ts-ignore
|
||||
} else if (!window["jitsu"]) {
|
||||
window["jitsu"] = jitsuClient({
|
||||
log_level: "ERROR",
|
||||
tracking_host: "https://t.calendso.com",
|
||||
@@ -93,8 +95,6 @@ function createTelemetryClient(): TelemetryClient {
|
||||
capture_3rd_party_cookies: false,
|
||||
});
|
||||
}
|
||||
// FIXME
|
||||
// @ts-ignore
|
||||
const res = callback(window["jitsu"]);
|
||||
if (res && typeof res["catch"] === "function") {
|
||||
res.catch((e) => {
|
||||
|
||||
Reference in new issue
Block a user