refactor: circular deps between app store and lib [6] (#23971)
* move delegation credential repository to features * mv credential repository to features * update imports * mv * fix * fix * fix * fix * fix * update imports * update imports * update eslint rule * fix * fix * mv getConnectedDestinationCalendars * fix import errors * mv getCalendarsEvents * remove getUsersCredentials * wip * revert eslint rule change for now * fix type checks * fix * format * cleanup * fix * fix * fix * fix * fix tests * migrate getUserAvailability * migrate * fix tests * fix type checks * fix * fix * migrate crmManager * update imports * migrate raqbUtils to appstore * migrate getLuckyUser to features * migrate findTeamMembersMatchingAttributeLogic to appstore * update imports * fix * fix * fix test * fix unit tests * fix * fix * add eslint config
This commit is contained in:
1 parent
445b307972
commit
bb68cd73ef
114 files changed
+263
-245
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
import type { NextApiRequest } from "next";
|
import type { NextApiRequest } from "next";
|
||||||
|
|
||||||
import type { UserWithCalendars } from "@calcom/lib/getConnectedDestinationCalendars";
|
import type { UserWithCalendars } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
import { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/lib/getConnectedDestinationCalendars";
|
import { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import { defaultResponder } from "@calcom/lib/server/defaultResponder";
|
import { defaultResponder } from "@calcom/lib/server/defaultResponder";
|
||||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import type { UseFormReturn } from "react-hook-form";
|
|||||||
import { Toaster } from "sonner";
|
import { Toaster } from "sonner";
|
||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
|
import { buildEmptyQueryValue, raqbQueryValueUtils } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||||
import { routingFormAppComponents } from "@calcom/app-store/routing-forms/appComponents";
|
import { routingFormAppComponents } from "@calcom/app-store/routing-forms/appComponents";
|
||||||
import DynamicAppComponent from "@calcom/app-store/routing-forms/components/DynamicAppComponent";
|
import DynamicAppComponent from "@calcom/app-store/routing-forms/components/DynamicAppComponent";
|
||||||
import { EmptyState } from "@calcom/app-store/routing-forms/components/_components/EmptyState";
|
import { EmptyState } from "@calcom/app-store/routing-forms/components/_components/EmptyState";
|
||||||
@@ -44,7 +45,6 @@ import { useOrgBranding } from "@calcom/features/ee/organizations/context/provid
|
|||||||
import type { EventTypesByViewer } from "@calcom/features/eventtypes/lib/getEventTypesByViewer";
|
import type { EventTypesByViewer } from "@calcom/features/eventtypes/lib/getEventTypesByViewer";
|
||||||
import { areTheySiblingEntities } from "@calcom/lib/entityPermissionUtils.shared";
|
import { areTheySiblingEntities } from "@calcom/lib/entityPermissionUtils.shared";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { buildEmptyQueryValue, raqbQueryValueUtils } from "@calcom/lib/raqb/raqbUtils";
|
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
import { SchedulingType } from "@calcom/prisma/enums";
|
import { SchedulingType } from "@calcom/prisma/enums";
|
||||||
import { trpc } from "@calcom/trpc/react";
|
import { trpc } from "@calcom/trpc/react";
|
||||||
@@ -1190,7 +1190,7 @@ const Routes = ({
|
|||||||
}) || [];
|
}) || [];
|
||||||
|
|
||||||
// const isConnectedForm = (id: string) => form.connectedForms.map((f) => f.id).includes(id);
|
// const isConnectedForm = (id: string) => form.connectedForms.map((f) => f.id).includes(id);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
// const routers: any[] = [];
|
// const routers: any[] = [];
|
||||||
/* Disable this feature for new forms till we get it fully working with Routing Form with Attributes. This isn't much used feature */
|
/* Disable this feature for new forms till we get it fully working with Routing Form with Attributes. This isn't much used feature */
|
||||||
// const routers = availableRouters.map((r) => {
|
// const routers = availableRouters.map((r) => {
|
||||||
@@ -1235,7 +1235,7 @@ const Routes = ({
|
|||||||
});
|
});
|
||||||
setRoutes((routes) => {
|
setRoutes((routes) => {
|
||||||
// Even though it's obvious that fallbackRoute is defined here but TypeScript just can't figure it out.
|
// Even though it's obvious that fallbackRoute is defined here but TypeScript just can't figure it out.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
return [...routes, fallbackRoute!];
|
return [...routes, fallbackRoute!];
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
@@ -1243,7 +1243,7 @@ const Routes = ({
|
|||||||
// Ensure fallback is last
|
// Ensure fallback is last
|
||||||
setRoutes((routes) => {
|
setRoutes((routes) => {
|
||||||
// Even though it's obvious that fallbackRoute is defined here but TypeScript just can't figure it out.
|
// Even though it's obvious that fallbackRoute is defined here but TypeScript just can't figure it out.
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
return [...routes.filter((route) => route.id !== fallbackRoute!.id), fallbackRoute!];
|
return [...routes.filter((route) => route.id !== fallbackRoute!.id), fallbackRoute!];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { NextResponse } from "next/server";
|
|||||||
|
|
||||||
import GoogleCalendarService from "@calcom/app-store/googlecalendar/lib/CalendarService";
|
import GoogleCalendarService from "@calcom/app-store/googlecalendar/lib/CalendarService";
|
||||||
import { CalendarAppDelegationCredentialInvalidGrantError } from "@calcom/lib/CalendarAppError";
|
import { CalendarAppDelegationCredentialInvalidGrantError } from "@calcom/lib/CalendarAppError";
|
||||||
import { findUniqueDelegationCalendarCredential } from "@calcom/lib/delegationCredential/server";
|
import { findUniqueDelegationCalendarCredential } from "@calcom/app-store/delegationCredential";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
|
import { appStoreMetadata } from "@calcom/app-store/appStoreMetaData";
|
||||||
import { getAppFromSlug } from "@calcom/app-store/utils";
|
import { getAppFromSlug } from "@calcom/app-store/utils";
|
||||||
|
import { getAllDelegationCredentialsForUser } from "@calcom/app-store/delegationCredential";
|
||||||
import getInstallCountPerApp from "@calcom/lib/apps/getInstallCountPerApp";
|
import getInstallCountPerApp from "@calcom/lib/apps/getInstallCountPerApp";
|
||||||
import { getAllDelegationCredentialsForUser } from "@calcom/lib/delegationCredential/server";
|
|
||||||
import type { UserAdminTeams } from "@calcom/lib/server/repository/user";
|
import type { UserAdminTeams } from "@calcom/lib/server/repository/user";
|
||||||
import prisma, { safeAppSelect, safeCredentialSelect } from "@calcom/prisma";
|
import prisma, { safeAppSelect, safeCredentialSelect } from "@calcom/prisma";
|
||||||
import { userMetadata } from "@calcom/prisma/zod-utils";
|
import { userMetadata } from "@calcom/prisma/zod-utils";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
import type { EventTypeAppMetadataSchema } from "@calcom/app-store/zod-utils";
|
import type { EventTypeAppMetadataSchema } from "@calcom/app-store/zod-utils";
|
||||||
import CrmManager from "@calcom/lib/crmManager/crmManager";
|
import CrmManager from "@calcom/features/crmManager/crmManager";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
||||||
import getInstallCountPerApp from "@calcom/lib/apps/getInstallCountPerApp";
|
import getInstallCountPerApp from "@calcom/lib/apps/getInstallCountPerApp";
|
||||||
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential";
|
||||||
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
|
|
||||||
import type { PrismaClient } from "@calcom/prisma";
|
import type { PrismaClient } from "@calcom/prisma";
|
||||||
import type { Prisma, User, AppCategories } from "@calcom/prisma/client";
|
import type { Prisma, User, AppCategories } from "@calcom/prisma/client";
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
|
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
import { userMetadata as userMetadataSchema, type eventTypeLocations } from "@calcom/prisma/zod-utils";
|
import { userMetadata as userMetadataSchema, type eventTypeLocations } from "@calcom/prisma/zod-utils";
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { CredentialDataWithTeamName } from "@calcom/app-store/utils";
|
import type { CredentialDataWithTeamName } from "@calcom/app-store/utils";
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { isInMemoryDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isInMemoryDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
||||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||||
|
|||||||
+4
-4
@@ -6,7 +6,7 @@ import { RaqbLogicResult } from "@calcom/lib/raqb/evaluateRaqbLogic";
|
|||||||
import {
|
import {
|
||||||
findTeamMembersMatchingAttributeLogic,
|
findTeamMembersMatchingAttributeLogic,
|
||||||
TroubleshooterCase,
|
TroubleshooterCase,
|
||||||
} from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
} from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
import * as getAttributesModule from "@calcom/lib/service/attribute/server/getAttributes";
|
import * as getAttributesModule from "@calcom/lib/service/attribute/server/getAttributes";
|
||||||
import type { AttributeType } from "@calcom/prisma/enums";
|
import type { AttributeType } from "@calcom/prisma/enums";
|
||||||
import { RoutingFormFieldType } from "@calcom/routing-forms/lib/FieldTypes";
|
import { RoutingFormFieldType } from "@calcom/routing-forms/lib/FieldTypes";
|
||||||
@@ -18,7 +18,7 @@ vi.mock("@calcom/lib/service/attribute/server/getAttributes", () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.mock("../../components/react-awesome-query-builder/widgets", () => ({
|
vi.mock("@calcom/app-store/routing-forms/components/react-awesome-query-builder/widgets", () => ({
|
||||||
default: {},
|
default: {},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -64,13 +64,13 @@ function mockAttributesScenario({
|
|||||||
Object.entries(member.attributes).map(([attributeId, value]) => {
|
Object.entries(member.attributes).map(([attributeId, value]) => {
|
||||||
return [
|
return [
|
||||||
attributeId,
|
attributeId,
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
|
|
||||||
{
|
{
|
||||||
attributeOption:
|
attributeOption:
|
||||||
value instanceof Array
|
value instanceof Array
|
||||||
? value.map((value) => ({ value, isGroup: false, contains: [] }))
|
? value.map((value) => ({ value, isGroup: false, contains: [] }))
|
||||||
: { value, isGroup: false, contains: [] },
|
: { value, isGroup: false, contains: [] },
|
||||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
||||||
type: attributes.find((attribute) => attribute.id === attributeId)!.type,
|
type: attributes.find((attribute) => attribute.id === attributeId)!.type,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
+3
-4
@@ -3,14 +3,13 @@ import type { ImmutableTree, JsonLogicResult, JsonTree } from "react-awesome-que
|
|||||||
import type { Config } from "react-awesome-query-builder/lib";
|
import type { Config } from "react-awesome-query-builder/lib";
|
||||||
import { Utils as QbUtils } from "react-awesome-query-builder/lib";
|
import { Utils as QbUtils } from "react-awesome-query-builder/lib";
|
||||||
|
|
||||||
import type { dynamicFieldValueOperands } from "@calcom/lib/raqb/types";
|
import { RaqbLogicResult } from "@calcom/lib/raqb/evaluateRaqbLogic";
|
||||||
|
import jsonLogic from "@calcom/lib/raqb/jsonLogic";
|
||||||
|
import type { dynamicFieldValueOperands, AttributesQueryValue } from "@calcom/lib/raqb/types";
|
||||||
import { getAttributesAssignmentData } from "@calcom/lib/service/attribute/server/getAttributes";
|
import { getAttributesAssignmentData } from "@calcom/lib/service/attribute/server/getAttributes";
|
||||||
import type { Attribute } from "@calcom/lib/service/attribute/server/getAttributes";
|
import type { Attribute } from "@calcom/lib/service/attribute/server/getAttributes";
|
||||||
|
|
||||||
import { RaqbLogicResult } from "./evaluateRaqbLogic";
|
|
||||||
import jsonLogic from "./jsonLogic";
|
|
||||||
import { acrossQueryValueCompatiblity, raqbQueryValueUtils } from "./raqbUtils";
|
import { acrossQueryValueCompatiblity, raqbQueryValueUtils } from "./raqbUtils";
|
||||||
import type { AttributesQueryValue } from "./types";
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
getAttributesData: getAttributes,
|
getAttributesData: getAttributes,
|
||||||
File renamed without changes.
@@ -4,7 +4,9 @@ import { Utils as QbUtils } from "react-awesome-query-builder";
|
|||||||
|
|
||||||
import { getQueryBuilderConfigForAttributes } from "@calcom/app-store/routing-forms/lib/getQueryBuilderConfig";
|
import { getQueryBuilderConfigForAttributes } from "@calcom/app-store/routing-forms/lib/getQueryBuilderConfig";
|
||||||
import type { LocalRoute } from "@calcom/app-store/routing-forms/types/types";
|
import type { LocalRoute } from "@calcom/app-store/routing-forms/types/types";
|
||||||
|
import { resolveQueryValue } from "@calcom/lib/raqb/resolveQueryValue";
|
||||||
import type { dynamicFieldValueOperands } from "@calcom/lib/raqb/types";
|
import type { dynamicFieldValueOperands } from "@calcom/lib/raqb/types";
|
||||||
|
import { caseInsensitive } from "@calcom/lib/raqb/utils";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import type {
|
import type {
|
||||||
AttributeOptionValueWithType,
|
AttributeOptionValueWithType,
|
||||||
@@ -13,9 +15,6 @@ import type {
|
|||||||
} from "@calcom/lib/service/attribute/server/getAttributes";
|
} from "@calcom/lib/service/attribute/server/getAttributes";
|
||||||
import { AttributeType } from "@calcom/prisma/enums";
|
import { AttributeType } from "@calcom/prisma/enums";
|
||||||
|
|
||||||
import { resolveQueryValue } from "./resolveQueryValue";
|
|
||||||
import { caseInsensitive } from "./utils";
|
|
||||||
|
|
||||||
function ensureArray(value: string | string[]) {
|
function ensureArray(value: string | string[]) {
|
||||||
return typeof value === "string" ? [value] : value;
|
return typeof value === "string" ? [value] : value;
|
||||||
}
|
}
|
||||||
+7
-2
@@ -7,7 +7,7 @@ import { metadata as googleMeetMetadata } from "@calcom/app-store/googlevideo/_m
|
|||||||
import type { ServiceAccountKey } from "@calcom/lib/server/repository/delegationCredential";
|
import type { ServiceAccountKey } from "@calcom/lib/server/repository/delegationCredential";
|
||||||
import { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
import { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
||||||
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
|
import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
|
||||||
import { SMSLockState } from "@calcom/prisma/enums";
|
import { SMSLockState, RRTimestampBasis } from "@calcom/prisma/enums";
|
||||||
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
|
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
|
||||||
enrichUserWithDelegationConferencingCredentialsWithoutOrgId,
|
enrichUserWithDelegationConferencingCredentialsWithoutOrgId,
|
||||||
getAllDelegationCredentialsForUserIncludeServiceAccountKey,
|
getAllDelegationCredentialsForUserIncludeServiceAccountKey,
|
||||||
} from "./server";
|
} from "./delegationCredential";
|
||||||
|
|
||||||
// Mock OrganizationRepository
|
// Mock OrganizationRepository
|
||||||
vi.mock("@calcom/lib/server/repository/organization", () => ({
|
vi.mock("@calcom/lib/server/repository/organization", () => ({
|
||||||
@@ -60,6 +60,8 @@ const mockDelegationCredential = {
|
|||||||
workspacePlatform: mockWorkspacePlatform,
|
workspacePlatform: mockWorkspacePlatform,
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
updatedAt: new Date(),
|
||||||
|
lastEnabledAt: new Date(),
|
||||||
|
lastDisabledAt: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mock organization data
|
// Mock organization data
|
||||||
@@ -103,6 +105,9 @@ const mockOrganization = {
|
|||||||
isPlatform: false,
|
isPlatform: false,
|
||||||
createdByOAuthClientId: null,
|
createdByOAuthClientId: null,
|
||||||
bookingLimits: null,
|
bookingLimits: null,
|
||||||
|
hideTeamProfileLink: false,
|
||||||
|
rrResetInterval: null,
|
||||||
|
rrTimestampBasis: RRTimestampBasis.CREATED_AT,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Credential Builders
|
// Credential Builders
|
||||||
+38
-10
@@ -3,30 +3,28 @@ import { metadata as googleCalendarMetadata } from "@calcom/app-store/googlecale
|
|||||||
import { metadata as googleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
|
import { metadata as googleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
|
||||||
import { metadata as office365CalendarMetaData } from "@calcom/app-store/office365calendar/_metadata";
|
import { metadata as office365CalendarMetaData } from "@calcom/app-store/office365calendar/_metadata";
|
||||||
import { metadata as office365VideoMetaData } from "@calcom/app-store/office365video/_metadata";
|
import { metadata as office365VideoMetaData } from "@calcom/app-store/office365video/_metadata";
|
||||||
|
import {
|
||||||
|
buildNonDelegationCredential,
|
||||||
|
buildNonDelegationCredentials,
|
||||||
|
isDelegationCredential,
|
||||||
|
} from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
||||||
import type { ServiceAccountKey } from "@calcom/lib/server/repository/delegationCredential";
|
import type { ServiceAccountKey } from "@calcom/lib/server/repository/delegationCredential";
|
||||||
import { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
import { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
||||||
|
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import type { SelectedCalendar } from "@calcom/prisma/client";
|
import type { SelectedCalendar } from "@calcom/prisma/client";
|
||||||
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import { UserRepository } from "../server/repository/user";
|
|
||||||
import {
|
|
||||||
buildNonDelegationCredential,
|
|
||||||
buildNonDelegationCredentials,
|
|
||||||
isDelegationCredential,
|
|
||||||
} from "./clientAndServer";
|
|
||||||
|
|
||||||
export { buildNonDelegationCredentials, buildNonDelegationCredential } from "./clientAndServer";
|
|
||||||
|
|
||||||
const GOOGLE_WORKSPACE_SLUG = "google";
|
const GOOGLE_WORKSPACE_SLUG = "google";
|
||||||
const OFFICE365_WORKSPACE_SLUG = "office365";
|
const OFFICE365_WORKSPACE_SLUG = "office365";
|
||||||
const WORKSPACE_PLATFORM_SLUGS = [GOOGLE_WORKSPACE_SLUG, OFFICE365_WORKSPACE_SLUG] as const;
|
const WORKSPACE_PLATFORM_SLUGS = [GOOGLE_WORKSPACE_SLUG, OFFICE365_WORKSPACE_SLUG] as const;
|
||||||
type WORKSPACE_PLATFORM_SLUGS_TYPE = (typeof WORKSPACE_PLATFORM_SLUGS)[number];
|
type WORKSPACE_PLATFORM_SLUGS_TYPE = (typeof WORKSPACE_PLATFORM_SLUGS)[number];
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["lib/delegationCredential/server"] });
|
const log = logger.getSubLogger({ prefix: ["app-store/delegationCredential"] });
|
||||||
interface DelegationCredential {
|
interface DelegationCredential {
|
||||||
id: string;
|
id: string;
|
||||||
workspacePlatform: {
|
workspacePlatform: {
|
||||||
@@ -652,6 +650,36 @@ export async function getCredentialForCalendarCache({ credentialId }: { credenti
|
|||||||
return credentialForCalendarService;
|
return credentialForCalendarService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* It includes in-memory DelegationCredential credentials as well.
|
||||||
|
*/
|
||||||
|
export async function getUsersCredentialsIncludeServiceAccountKey(user: User) {
|
||||||
|
const credentials = await prisma.credential.findMany({
|
||||||
|
where: {
|
||||||
|
userId: user.id,
|
||||||
|
},
|
||||||
|
select: credentialForCalendarServiceSelect,
|
||||||
|
orderBy: {
|
||||||
|
id: "asc",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { credentials: allCredentials } = await enrichUserWithDelegationCredentialsIncludeServiceAccountKey({
|
||||||
|
user: {
|
||||||
|
email: user.email,
|
||||||
|
id: user.id,
|
||||||
|
credentials,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
return allCredentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getUsersCredentials(user: User) {
|
||||||
|
const credentials = await getUsersCredentialsIncludeServiceAccountKey(user);
|
||||||
|
return credentials.map(({ delegatedTo: _1, ...rest }) => rest);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the credential for a selected calendar
|
* Find the credential for a selected calendar
|
||||||
* @param selectedCalendar
|
* @param selectedCalendar
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { NextApiRequest } from "next";
|
import type { NextApiRequest } from "next";
|
||||||
|
|
||||||
import { getCredentialForCalendarCache } from "@calcom/lib/delegationCredential/server";
|
import { getCredentialForCalendarCache } from "@calcom/app-store/delegationCredential";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { prisma } from "@calcom/prisma/__mocks__/prisma";
|
|||||||
|
|
||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
import { findTeamMembersMatchingAttributeLogic } from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
import { RoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
import { RoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
||||||
|
|
||||||
import isRouter from "../lib/isRouter";
|
import isRouter from "../lib/isRouter";
|
||||||
@@ -12,7 +12,7 @@ import type { TargetRoutingFormForResponse } from "./formSubmissionUtils";
|
|||||||
import { onSubmissionOfFormResponse } from "./formSubmissionUtils";
|
import { onSubmissionOfFormResponse } from "./formSubmissionUtils";
|
||||||
import { handleResponse } from "./handleResponse";
|
import { handleResponse } from "./handleResponse";
|
||||||
|
|
||||||
vi.mock("@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic", () => ({
|
vi.mock("@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic", () => ({
|
||||||
findTeamMembersMatchingAttributeLogic: vi.fn(),
|
findTeamMembersMatchingAttributeLogic: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|||||||
import { emailSchema } from "@calcom/lib/emailSchema";
|
import { emailSchema } from "@calcom/lib/emailSchema";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
import { findTeamMembersMatchingAttributeLogic } from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import { RoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
import { RoutingFormResponseRepository } from "@calcom/lib/server/repository/formResponse";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
|
|
||||||
import { CredentialRepository } from "../../../../lib/server/repository/credential";
|
|
||||||
import { routingFormIncompleteBookingDataSchema } from "../../zod";
|
import { routingFormIncompleteBookingDataSchema } from "../../zod";
|
||||||
import SalesforceCRMService from "../CrmService";
|
import SalesforceCRMService from "../CrmService";
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { CredentialRepository } from "../../../lib/server/repository/credential";
|
import { CredentialRepository } from "@calcom/lib/server/repository/credential";
|
||||||
|
|
||||||
import type { AttributeRoutingConfig } from "../../routing-forms/types/types";
|
import type { AttributeRoutingConfig } from "../../routing-forms/types/types";
|
||||||
import SalesforceCRMService from "./CrmService";
|
import SalesforceCRMService from "./CrmService";
|
||||||
import { SalesforceRecordEnum, RoutingReasons } from "./enums";
|
import { SalesforceRecordEnum, RoutingReasons } from "./enums";
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import type { TFunction } from "i18next";
|
import type { TFunction } from "i18next";
|
||||||
|
|
||||||
|
import { enrichUserWithDelegationConferencingCredentialsWithoutOrgId } from "@calcom/app-store/delegationCredential";
|
||||||
import { defaultVideoAppCategories } from "@calcom/app-store/utils";
|
import { defaultVideoAppCategories } from "@calcom/app-store/utils";
|
||||||
import {
|
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential";
|
||||||
buildNonDelegationCredentials,
|
|
||||||
enrichUserWithDelegationConferencingCredentialsWithoutOrgId,
|
|
||||||
} from "@calcom/lib/delegationCredential/server";
|
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
import { AppCategories } from "@calcom/prisma/enums";
|
import { AppCategories } from "@calcom/prisma/enums";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
import { getQueryBuilderConfigForAttributes } from "@calcom/app-store/routing-forms/lib/getQueryBuilderConfig";
|
import { getQueryBuilderConfigForAttributes } from "@calcom/app-store/routing-forms/lib/getQueryBuilderConfig";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { isEqual } from "@calcom/lib/isEqual";
|
import { isEqual } from "@calcom/lib/isEqual";
|
||||||
import { buildStateFromQueryValue } from "@calcom/lib/raqb/raqbUtils";
|
import { buildStateFromQueryValue } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||||
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
||||||
import { trpc, type RouterOutputs } from "@calcom/trpc";
|
import { trpc, type RouterOutputs } from "@calcom/trpc";
|
||||||
import cn from "@calcom/ui/classNames";
|
import cn from "@calcom/ui/classNames";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import type {
|
|||||||
EventTypes,
|
EventTypes,
|
||||||
} from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
|
} from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
|
||||||
import { BulkEditDefaultForEventsModal } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
|
import { BulkEditDefaultForEventsModal } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import type { AppCategories } from "@calcom/prisma/enums";
|
import type { AppCategories } from "@calcom/prisma/enums";
|
||||||
import { type RouterOutputs } from "@calcom/trpc";
|
import { type RouterOutputs } from "@calcom/trpc";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { trpc } from "@calcom/trpc/react";
|
import { trpc } from "@calcom/trpc/react";
|
||||||
import type { ButtonProps } from "@calcom/ui/components/button";
|
import type { ButtonProps } from "@calcom/ui/components/button";
|
||||||
|
|||||||
+2
-3
@@ -1,11 +1,10 @@
|
|||||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
|
import { withSelectedCalendars } from "@calcom/lib/server/withSelectedCalendars";
|
||||||
import { availabilityUserSelect } from "@calcom/prisma";
|
import { availabilityUserSelect } from "@calcom/prisma";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|
||||||
import { withSelectedCalendars } from "./withSelectedCalendars";
|
|
||||||
|
|
||||||
export async function findUsersForAvailabilityCheck({ where }: { where: Prisma.UserWhereInput }) {
|
export async function findUsersForAvailabilityCheck({ where }: { where: Prisma.UserWhereInput }) {
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirst({
|
||||||
where,
|
where,
|
||||||
+3
-3
@@ -18,9 +18,10 @@ import {
|
|||||||
getBusyTimesFromLimits,
|
getBusyTimesFromLimits,
|
||||||
getBusyTimesFromTeamLimits,
|
getBusyTimesFromTeamLimits,
|
||||||
} from "@calcom/lib/intervalLimits/server/getBusyTimesFromLimits";
|
} from "@calcom/lib/intervalLimits/server/getBusyTimesFromLimits";
|
||||||
|
import { getPeriodStartDatesBetween as getPeriodStartDatesBetweenUtil } from "@calcom/lib/intervalLimits/utils/getPeriodStartDatesBetween";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import { findUsersForAvailabilityCheck } from "@calcom/lib/server/findUsersForAvailabilityCheck";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||||
import { EventTypeRepository } from "@calcom/lib/server/repository/eventTypeRepository";
|
import { EventTypeRepository } from "@calcom/lib/server/repository/eventTypeRepository";
|
||||||
import type { PrismaOOORepository } from "@calcom/lib/server/repository/ooo";
|
import type { PrismaOOORepository } from "@calcom/lib/server/repository/ooo";
|
||||||
@@ -37,8 +38,7 @@ import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
|||||||
import type { EventBusyDetails, IntervalLimitUnit } from "@calcom/types/Calendar";
|
import type { EventBusyDetails, IntervalLimitUnit } from "@calcom/types/Calendar";
|
||||||
import type { TimeRange } from "@calcom/types/schedule";
|
import type { TimeRange } from "@calcom/types/schedule";
|
||||||
|
|
||||||
import { getPeriodStartDatesBetween as getPeriodStartDatesBetweenUtil } from "./intervalLimits/utils/getPeriodStartDatesBetween";
|
import { findUsersForAvailabilityCheck } from "./findUsersForAvailabilityCheck";
|
||||||
import { withReporting } from "./sentryWrapper";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["getUserAvailability"] });
|
const log = logger.getSubLogger({ prefix: ["getUserAvailability"] });
|
||||||
const availabilitySchema = z
|
const availabilitySchema = z
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
|
|
||||||
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
import ServerTrans from "@calcom/lib/components/ServerTrans";
|
||||||
import type { IOutOfOfficeData } from "@calcom/lib/getUserAvailability";
|
import type { IOutOfOfficeData } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import classNames from "@calcom/ui/classNames";
|
import classNames from "@calcom/ui/classNames";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { OutOfOfficeInSlots } from "@calcom/features/bookings/Booker/components/
|
|||||||
import type { IUseBookingLoadingStates } from "@calcom/features/bookings/Booker/components/hooks/useBookings";
|
import type { IUseBookingLoadingStates } from "@calcom/features/bookings/Booker/components/hooks/useBookings";
|
||||||
import type { BookerEvent } from "@calcom/features/bookings/types";
|
import type { BookerEvent } from "@calcom/features/bookings/types";
|
||||||
import type { Slot } from "@calcom/features/schedules/lib/use-schedule/types";
|
import type { Slot } from "@calcom/features/schedules/lib/use-schedule/types";
|
||||||
import type { IOutOfOfficeData } from "@calcom/lib/getUserAvailability";
|
import type { IOutOfOfficeData } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { localStorage } from "@calcom/lib/webstorage";
|
import { localStorage } from "@calcom/lib/webstorage";
|
||||||
import classNames from "@calcom/ui/classNames";
|
import classNames from "@calcom/ui/classNames";
|
||||||
|
|||||||
@@ -8,10 +8,14 @@ import { FAKE_DAILY_CREDENTIAL } from "@calcom/app-store/dailyvideo/lib/VideoApi
|
|||||||
import { appKeysSchema as calVideoKeysSchema } from "@calcom/app-store/dailyvideo/zod";
|
import { appKeysSchema as calVideoKeysSchema } from "@calcom/app-store/dailyvideo/zod";
|
||||||
import { getLocationFromApp, MeetLocationType, MSTeamsLocationType } from "@calcom/app-store/locations";
|
import { getLocationFromApp, MeetLocationType, MSTeamsLocationType } from "@calcom/app-store/locations";
|
||||||
import getApps from "@calcom/app-store/utils";
|
import getApps from "@calcom/app-store/utils";
|
||||||
|
import { createMeeting, updateMeeting, deleteMeeting } from "@calcom/app-store/videoClient";
|
||||||
|
import { createEvent, updateEvent, deleteEvent } from "@calcom/features/calendars/lib/CalendarManager";
|
||||||
|
import CrmManager from "@calcom/features/crmManager/crmManager";
|
||||||
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
||||||
import { getUid } from "@calcom/lib/CalEventParser";
|
import { getUid } from "@calcom/lib/CalEventParser";
|
||||||
import CRMScheduler from "@calcom/lib/crmManager/tasker/crmScheduler";
|
import CRMScheduler from "@calcom/lib/crmManager/tasker/crmScheduler";
|
||||||
import { symmetricDecrypt } from "@calcom/lib/crypto";
|
import { symmetricDecrypt } from "@calcom/lib/crypto";
|
||||||
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import {
|
import {
|
||||||
getPiiFreeDestinationCalendar,
|
getPiiFreeDestinationCalendar,
|
||||||
@@ -34,11 +38,6 @@ import type {
|
|||||||
PartialReference,
|
PartialReference,
|
||||||
} from "@calcom/types/EventManager";
|
} from "@calcom/types/EventManager";
|
||||||
|
|
||||||
import { createEvent, updateEvent, deleteEvent } from "@calcom/features/calendars/lib/CalendarManager";
|
|
||||||
import CrmManager from "@calcom/lib/crmManager/crmManager";
|
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
|
||||||
import { createMeeting, updateMeeting, deleteMeeting } from "@calcom/app-store/videoClient";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["EventManager"] });
|
const log = logger.getSubLogger({ prefix: ["EventManager"] });
|
||||||
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
|
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
|
||||||
const CALDAV_CALENDAR_TYPE = "caldav_calendar";
|
const CALDAV_CALENDAR_TYPE = "caldav_calendar";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import type { CurrentSeats } from "@calcom/lib/getUserAvailability";
|
import type { CurrentSeats } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||||
|
|
||||||
import { checkForConflicts } from "./checkForConflicts";
|
import { checkForConflicts } from "./checkForConflicts";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Dayjs } from "dayjs";
|
import type { Dayjs } from "dayjs";
|
||||||
|
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import type { CurrentSeats } from "@calcom/lib/getUserAvailability";
|
import type { CurrentSeats } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import type { BufferedBusyTime } from "@calcom/types/BufferedBusyTime";
|
import type { BufferedBusyTime } from "@calcom/types/BufferedBusyTime";
|
||||||
|
|
||||||
type BufferedBusyTimes = BufferedBusyTime[];
|
type BufferedBusyTimes = BufferedBusyTime[];
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
||||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
import async from "async";
|
import async from "async";
|
||||||
|
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import { buildAllCredentials } from "@calcom/lib/delegationCredential/server";
|
import { buildAllCredentials } from "@calcom/app-store/delegationCredential";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import CalendarManagerMock from "../../../tests/libs/__mocks__/CalendarManager";
|
import CalendarManagerMock from "../../../../tests/libs/__mocks__/CalendarManager";
|
||||||
import prismaMock from "../../../tests/libs/__mocks__/prismaMock";
|
import prismaMock from "../../../../tests/libs/__mocks__/prismaMock";
|
||||||
|
|
||||||
import { v4 as uuid } from "uuid";
|
import { v4 as uuid } from "uuid";
|
||||||
import { expect, it, describe, vi, beforeAll } from "vitest";
|
import { expect, it, describe, vi, beforeAll } from "vitest";
|
||||||
+2
-3
@@ -1,9 +1,10 @@
|
|||||||
|
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||||
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
||||||
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
|
import { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
|
||||||
|
import { mergeOverlappingRanges } from "@calcom/lib/date-ranges";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { acrossQueryValueCompatiblity } from "@calcom/lib/raqb/raqbUtils";
|
|
||||||
import { raqbQueryValueSchema } from "@calcom/lib/raqb/zod";
|
import { raqbQueryValueSchema } from "@calcom/lib/raqb/zod";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import type { PrismaAttributeRepository } from "@calcom/lib/server/repository/PrismaAttributeRepository";
|
import type { PrismaAttributeRepository } from "@calcom/lib/server/repository/PrismaAttributeRepository";
|
||||||
@@ -18,8 +19,6 @@ import { RRTimestampBasis, RRResetInterval } from "@calcom/prisma/enums";
|
|||||||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import { mergeOverlappingRanges } from "../date-ranges";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["getLuckyUser"] });
|
const log = logger.getSubLogger({ prefix: ["getLuckyUser"] });
|
||||||
const { getAttributesQueryValue } = acrossQueryValueCompatiblity;
|
const { getAttributesQueryValue } = acrossQueryValueCompatiblity;
|
||||||
|
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
|
|
||||||
import short, { uuid } from "short-uuid";
|
import short, { uuid } from "short-uuid";
|
||||||
import { v5 as uuidv5 } from "uuid";
|
import { v5 as uuidv5 } from "uuid";
|
||||||
|
|
||||||
import processExternalId from "@calcom/app-store/_utils/calendars/processExternalId";
|
import processExternalId from "@calcom/app-store/_utils/calendars/processExternalId";
|
||||||
import { getPaymentAppData } from "@calcom/app-store/_utils/payments/getPaymentAppData";
|
import { getPaymentAppData } from "@calcom/app-store/_utils/payments/getPaymentAppData";
|
||||||
|
import { getFirstDelegationConferencingCredentialAppLocation } from "@calcom/app-store/delegationCredential";
|
||||||
|
import { enrichHostsWithDelegationCredentials } from "@calcom/app-store/delegationCredential";
|
||||||
import { metadata as GoogleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
|
import { metadata as GoogleMeetMetadata } from "@calcom/app-store/googlevideo/_metadata";
|
||||||
import {
|
import {
|
||||||
getLocationValueForDB,
|
getLocationValueForDB,
|
||||||
@@ -25,6 +26,9 @@ import { handlePayment } from "@calcom/features/bookings/lib/handlePayment";
|
|||||||
import { handleWebhookTrigger } from "@calcom/features/bookings/lib/handleWebhookTrigger";
|
import { handleWebhookTrigger } from "@calcom/features/bookings/lib/handleWebhookTrigger";
|
||||||
import { isEventTypeLoggingEnabled } from "@calcom/features/bookings/lib/isEventTypeLoggingEnabled";
|
import { isEventTypeLoggingEnabled } from "@calcom/features/bookings/lib/isEventTypeLoggingEnabled";
|
||||||
import type { CacheService } from "@calcom/features/calendar-cache/lib/getShouldServeCache";
|
import type { CacheService } from "@calcom/features/calendar-cache/lib/getShouldServeCache";
|
||||||
|
import { getCheckBookingAndDurationLimitsService } from "@calcom/features/di/containers/BookingLimits";
|
||||||
|
import { getCacheService } from "@calcom/features/di/containers/Cache";
|
||||||
|
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
||||||
import AssignmentReasonRecorder from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder";
|
import AssignmentReasonRecorder from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder";
|
||||||
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||||
import { getEventName, updateHostInEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
import { getEventName, updateHostInEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||||
@@ -43,13 +47,6 @@ import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
|
|||||||
import { groupHostsByGroupId } from "@calcom/lib/bookings/hostGroupUtils";
|
import { groupHostsByGroupId } from "@calcom/lib/bookings/hostGroupUtils";
|
||||||
import { shouldIgnoreContactOwner } from "@calcom/lib/bookings/routing/utils";
|
import { shouldIgnoreContactOwner } from "@calcom/lib/bookings/routing/utils";
|
||||||
import { DEFAULT_GROUP_ID } from "@calcom/lib/constants";
|
import { DEFAULT_GROUP_ID } from "@calcom/lib/constants";
|
||||||
import {
|
|
||||||
enrichHostsWithDelegationCredentials,
|
|
||||||
getFirstDelegationConferencingCredentialAppLocation,
|
|
||||||
} from "@calcom/lib/delegationCredential/server";
|
|
||||||
import { getCheckBookingAndDurationLimitsService } from "@calcom/features/di/containers/BookingLimits";
|
|
||||||
import { getCacheService } from "@calcom/features/di/containers/Cache";
|
|
||||||
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
|
||||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||||
import { getErrorFromUnknown } from "@calcom/lib/errors";
|
import { getErrorFromUnknown } from "@calcom/lib/errors";
|
||||||
import { extractBaseEmail } from "@calcom/lib/extract-base-email";
|
import { extractBaseEmail } from "@calcom/lib/extract-base-email";
|
||||||
@@ -1480,7 +1477,8 @@ async function handler(
|
|||||||
|
|
||||||
const changedOrganizer =
|
const changedOrganizer =
|
||||||
!!originalRescheduledBooking &&
|
!!originalRescheduledBooking &&
|
||||||
(eventType.schedulingType === SchedulingType.ROUND_ROBIN || eventType.schedulingType === SchedulingType.COLLECTIVE) &&
|
(eventType.schedulingType === SchedulingType.ROUND_ROBIN ||
|
||||||
|
eventType.schedulingType === SchedulingType.COLLECTIVE) &&
|
||||||
originalRescheduledBooking.userId !== evt.organizer.id;
|
originalRescheduledBooking.userId !== evt.organizer.id;
|
||||||
|
|
||||||
const skipDeleteEventsAndMeetings = changedOrganizer;
|
const skipDeleteEventsAndMeetings = changedOrganizer;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getFirstDelegationConferencingCredentialAppLocation } from "@calcom/lib/delegationCredential/server";
|
import { getFirstDelegationConferencingCredentialAppLocation } from "@calcom/app-store/delegationCredential";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
import { userMetadata as userMetadataSchema } from "@calcom/prisma/zod-utils";
|
import { userMetadata as userMetadataSchema } from "@calcom/prisma/zod-utils";
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import type { Logger } from "tslog";
|
import type { Logger } from "tslog";
|
||||||
|
|
||||||
import { checkIfUsersAreBlocked } from "@calcom/features/watchlist/operations/check-if-users-are-blocked.controller";
|
import { enrichUsersWithDelegationCredentials } from "@calcom/app-store/delegationCredential";
|
||||||
import { enrichUsersWithDelegationCredentials } from "@calcom/lib/delegationCredential/server";
|
import type { RoutingFormResponse } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
import { getQualifiedHostsService } from "@calcom/features/di/containers/QualifiedHosts";
|
import { getQualifiedHostsService } from "@calcom/features/di/containers/QualifiedHosts";
|
||||||
|
import { checkIfUsersAreBlocked } from "@calcom/features/watchlist/operations/check-if-users-are-blocked.controller";
|
||||||
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
|
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import { getPiiFreeUser } from "@calcom/lib/piiFreeData";
|
import { getPiiFreeUser } from "@calcom/lib/piiFreeData";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import type { RoutingFormResponse } from "@calcom/lib/server/getLuckyUser";
|
|
||||||
import { withSelectedCalendars } from "@calcom/lib/server/repository/user";
|
import { withSelectedCalendars } from "@calcom/lib/server/repository/user";
|
||||||
import { userSelect } from "@calcom/prisma";
|
import { userSelect } from "@calcom/prisma";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
getRoutedUsersWithContactOwnerAndFixedUsers,
|
getRoutedUsersWithContactOwnerAndFixedUsers,
|
||||||
findMatchingHostsWithEventSegment,
|
findMatchingHostsWithEventSegment,
|
||||||
getNormalizedHosts,
|
getNormalizedHosts,
|
||||||
} from "@calcom/lib/bookings/getRoutedUsers";
|
} from "@calcom/features/users/lib/getRoutedUsers";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ vi.mock("@calcom/prisma/zod-utils", () => ({
|
|||||||
userMetadata: { parse: (metadata: any) => metadata },
|
userMetadata: { parse: (metadata: any) => metadata },
|
||||||
}));
|
}));
|
||||||
|
|
||||||
vi.mock("@calcom/lib/delegationCredential/server", () => ({
|
vi.mock("@calcom/app-store/delegationCredential", () => ({
|
||||||
getFirstDelegationConferencingCredentialAppLocation: ({
|
getFirstDelegationConferencingCredentialAppLocation: ({
|
||||||
credentials,
|
credentials,
|
||||||
}: {
|
}: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { TFunction } from "i18next";
|
|||||||
|
|
||||||
import type { PaymentAppData } from "@calcom/app-store/_utils/payments/getPaymentAppData";
|
import type { PaymentAppData } from "@calcom/app-store/_utils/payments/getPaymentAppData";
|
||||||
import type { EventTypeAppsList } from "@calcom/app-store/utils";
|
import type { EventTypeAppsList } from "@calcom/app-store/utils";
|
||||||
import type { GetUserAvailabilityResult } from "@calcom/lib/getUserAvailability";
|
import type { GetUserAvailabilityResult } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import type { userSelect } from "@calcom/prisma";
|
import type { userSelect } from "@calcom/prisma";
|
||||||
import type { App } from "@calcom/prisma/client";
|
import type { App } from "@calcom/prisma/client";
|
||||||
import type { Prisma } from "@calcom/prisma/client";
|
import type { Prisma } from "@calcom/prisma/client";
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import { sendCancelledSeatEmailsAndSMS } from "@calcom/emails";
|
|||||||
import sendPayload from "@calcom/features/webhooks/lib/sendOrSchedulePayload";
|
import sendPayload from "@calcom/features/webhooks/lib/sendOrSchedulePayload";
|
||||||
import type { EventPayloadType, EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
|
import type { EventPayloadType, EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
|
||||||
import { getRichDescription } from "@calcom/lib/CalEventParser";
|
import { getRichDescription } from "@calcom/lib/CalEventParser";
|
||||||
import { getAllDelegationCredentialsForUserIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
import { getAllDelegationCredentialsForUserIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { getDelegationCredentialOrFindRegularCredential } from "@calcom/lib/delegationCredential/server";
|
import { getDelegationCredentialOrFindRegularCredential } from "@calcom/app-store/delegationCredential";
|
||||||
import { HttpError } from "@calcom/lib/http-error";
|
import { HttpError } from "@calcom/lib/http-error";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
||||||
import { getAllDelegationCredentialsForUserIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
import { getAllDelegationCredentialsForUserIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { getDelegationCredentialOrFindRegularCredential } from "@calcom/lib/delegationCredential/server";
|
import { getDelegationCredentialOrFindRegularCredential } from "@calcom/app-store/delegationCredential";
|
||||||
import { deleteMeeting } from "@calcom/app-store/videoClient";
|
import { deleteMeeting } from "@calcom/app-store/videoClient";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import type { Attendee } from "@calcom/prisma/client";
|
import type { Attendee } from "@calcom/prisma/client";
|
||||||
|
|||||||
File renamed without changes.
+1
-2
@@ -1,11 +1,10 @@
|
|||||||
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
|
import type { LuckyUserService, RoutingFormResponse } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
import type { RRResetInterval, SelectedCalendar } from "@calcom/prisma/client";
|
import type { RRResetInterval, SelectedCalendar } from "@calcom/prisma/client";
|
||||||
import { RRTimestampBasis } from "@calcom/prisma/enums";
|
import { RRTimestampBasis } from "@calcom/prisma/enums";
|
||||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import type { LuckyUserService, RoutingFormResponse } from "../server/getLuckyUser";
|
|
||||||
|
|
||||||
export const errorCodes = {
|
export const errorCodes = {
|
||||||
MAX_LEAD_THRESHOLD_FALSY: "Max lead threshold should be null or > 1, not 0.",
|
MAX_LEAD_THRESHOLD_FALSY: "Max lead threshold should be null or > 1, not 0.",
|
||||||
} as const;
|
} as const;
|
||||||
File renamed without changes.
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
|
import { isRerouting } from "@calcom/lib/bookings/routing/utils";
|
||||||
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||||
|
|
||||||
import { isRerouting } from "./routing/utils";
|
|
||||||
|
|
||||||
export interface IFilterHostsService {
|
export interface IFilterHostsService {
|
||||||
bookingRepo: BookingRepository;
|
bookingRepo: BookingRepository;
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,13 +1,13 @@
|
|||||||
import prismaMock from "../../../tests/libs/__mocks__/prismaMock";
|
import prismaMock from "../../../../../tests/libs/__mocks__/prismaMock";
|
||||||
|
|
||||||
import { vi, it, describe, expect, afterEach } from "vitest";
|
import { vi, it, describe, expect, afterEach } from "vitest";
|
||||||
import type { Mock } from "vitest";
|
import type { Mock } from "vitest";
|
||||||
|
|
||||||
import { getQualifiedHostsService } from "@calcom/features/di/containers/QualifiedHosts";
|
import { getQualifiedHostsService } from "@calcom/features/di/containers/QualifiedHosts";
|
||||||
|
import * as getRoutedUsers from "@calcom/features/users/lib/getRoutedUsers";
|
||||||
import { RRResetInterval, SchedulingType } from "@calcom/prisma/enums";
|
import { RRResetInterval, SchedulingType } from "@calcom/prisma/enums";
|
||||||
|
|
||||||
import { filterHostsByLeadThreshold } from "./filterHostsByLeadThreshold";
|
import { filterHostsByLeadThreshold } from "./filterHostsByLeadThreshold";
|
||||||
import * as getRoutedUsers from "./getRoutedUsers";
|
|
||||||
|
|
||||||
// Mock the filterHostsByLeadThreshold function
|
// Mock the filterHostsByLeadThreshold function
|
||||||
vi.mock("./filterHostsByLeadThreshold", () => {
|
vi.mock("./filterHostsByLeadThreshold", () => {
|
||||||
+4
-4
@@ -1,17 +1,17 @@
|
|||||||
import type { FilterHostsService } from "@calcom/lib/bookings/filterHostsBySameRoundRobinHost";
|
|
||||||
import {
|
import {
|
||||||
findMatchingHostsWithEventSegment,
|
findMatchingHostsWithEventSegment,
|
||||||
getNormalizedHostsWithDelegationCredentials,
|
getNormalizedHostsWithDelegationCredentials,
|
||||||
} from "@calcom/lib/bookings/getRoutedUsers";
|
} from "@calcom/features/users/lib/getRoutedUsers";
|
||||||
import type { EventType } from "@calcom/lib/bookings/getRoutedUsers";
|
import type { EventType } from "@calcom/features/users/lib/getRoutedUsers";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
|
import type { RoutingFormResponse } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
import type { BookingRepository } from "@calcom/lib/server/repository/booking";
|
||||||
import type { SelectedCalendar } from "@calcom/prisma/client";
|
import type { SelectedCalendar } from "@calcom/prisma/client";
|
||||||
import type { SchedulingType } from "@calcom/prisma/enums";
|
import type { SchedulingType } from "@calcom/prisma/enums";
|
||||||
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import type { RoutingFormResponse } from "../server/getLuckyUser";
|
|
||||||
import { filterHostsByLeadThreshold } from "./filterHostsByLeadThreshold";
|
import { filterHostsByLeadThreshold } from "./filterHostsByLeadThreshold";
|
||||||
|
import type { FilterHostsService } from "./filterHostsBySameRoundRobinHost";
|
||||||
|
|
||||||
export interface IQualifiedHostsService {
|
export interface IQualifiedHostsService {
|
||||||
bookingRepo: BookingRepository;
|
bookingRepo: BookingRepository;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { workflowSelect } from "@calcom/ee/workflows/lib/getAllWorkflows";
|
import { workflowSelect } from "@calcom/ee/workflows/lib/getAllWorkflows";
|
||||||
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
||||||
import { enrichUserWithDelegationCredentials } from "@calcom/lib/delegationCredential/server";
|
import { enrichUserWithDelegationCredentials } from "@calcom/app-store/delegationCredential";
|
||||||
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
|
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
|
||||||
import { HttpError as HttpCode } from "@calcom/lib/http-error";
|
import { HttpError as HttpCode } from "@calcom/lib/http-error";
|
||||||
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { uniqueBy } from "@calcom/lib/array";
|
import { uniqueBy } from "@calcom/lib/array";
|
||||||
import { isInMemoryDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { isInMemoryDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
||||||
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
||||||
import { getCredentialForCalendarCache } from "@calcom/lib/delegationCredential/server";
|
import { getCredentialForCalendarCache } from "@calcom/app-store/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getCredentialForSelectedCalendar } from "@calcom/app-store/delegationCredential";
|
||||||
import type {
|
import type {
|
||||||
AdapterFactory,
|
AdapterFactory,
|
||||||
CalendarSubscriptionProvider,
|
CalendarSubscriptionProvider,
|
||||||
@@ -9,7 +10,6 @@ import type {
|
|||||||
import type { CalendarCacheEventService } from "@calcom/features/calendar-subscription/lib/cache/CalendarCacheEventService";
|
import type { CalendarCacheEventService } from "@calcom/features/calendar-subscription/lib/cache/CalendarCacheEventService";
|
||||||
import type { CalendarSyncService } from "@calcom/features/calendar-subscription/lib/sync/CalendarSyncService";
|
import type { CalendarSyncService } from "@calcom/features/calendar-subscription/lib/sync/CalendarSyncService";
|
||||||
import type { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
import type { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
||||||
import { getCredentialForSelectedCalendar } from "@calcom/lib/delegationCredential/server";
|
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import type { ISelectedCalendarRepository } from "@calcom/lib/server/repository/SelectedCalendarRepository.interface";
|
import type { ISelectedCalendarRepository } from "@calcom/lib/server/repository/SelectedCalendarRepository.interface";
|
||||||
import { SelectedCalendar } from "@calcom/prisma/client";
|
import { SelectedCalendar } from "@calcom/prisma/client";
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ export const getCredentialForSelectedCalendar = vi.fn().mockResolvedValue({
|
|||||||
delegatedTo: null,
|
delegatedTo: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.doMock("@calcom/lib/delegationCredential/server", () => ({
|
vi.doMock("@calcom/app-store/delegationCredential", () => ({
|
||||||
getCredentialForSelectedCalendar,
|
getCredentialForSelectedCalendar,
|
||||||
}));
|
}));
|
||||||
@@ -7,7 +7,7 @@ import { useEmbedStyles } from "@calcom/embed-core/embed-iframe";
|
|||||||
import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";
|
import { useBookerStoreContext } from "@calcom/features/bookings/Booker/BookerStoreProvider";
|
||||||
import { getAvailableDatesInMonth } from "@calcom/features/calendars/lib/getAvailableDatesInMonth";
|
import { getAvailableDatesInMonth } from "@calcom/features/calendars/lib/getAvailableDatesInMonth";
|
||||||
import { daysInMonth, yyyymmdd } from "@calcom/lib/dayjs";
|
import { daysInMonth, yyyymmdd } from "@calcom/lib/dayjs";
|
||||||
import type { IFromUser, IToUser } from "@calcom/lib/getUserAvailability";
|
import type { IFromUser, IToUser } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import { weekdayNames } from "@calcom/lib/weekday";
|
import { weekdayNames } from "@calcom/lib/weekday";
|
||||||
import type { PeriodData } from "@calcom/types/Event";
|
import type { PeriodData } from "@calcom/types/Event";
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
|||||||
import { MeetLocationType } from "@calcom/app-store/locations";
|
import { MeetLocationType } from "@calcom/app-store/locations";
|
||||||
import getApps from "@calcom/app-store/utils";
|
import getApps from "@calcom/app-store/utils";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
|
import getCalendarsEvents, {
|
||||||
|
getCalendarsEventsWithTimezones,
|
||||||
|
} from "@calcom/features/calendars/lib/getCalendarsEvents";
|
||||||
import { getUid } from "@calcom/lib/CalEventParser";
|
import { getUid } from "@calcom/lib/CalEventParser";
|
||||||
import { getRichDescription } from "@calcom/lib/CalEventParser";
|
import { getRichDescription } from "@calcom/lib/CalEventParser";
|
||||||
import { CalendarAppDelegationCredentialError } from "@calcom/lib/CalendarAppError";
|
import { CalendarAppDelegationCredentialError } from "@calcom/lib/CalendarAppError";
|
||||||
import { ORGANIZER_EMAIL_EXEMPT_DOMAINS } from "@calcom/lib/constants";
|
import { ORGANIZER_EMAIL_EXEMPT_DOMAINS } from "@calcom/lib/constants";
|
||||||
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential";
|
||||||
import { formatCalEvent } from "@calcom/lib/formatCalendarEvent";
|
import { formatCalEvent } from "@calcom/lib/formatCalendarEvent";
|
||||||
import getCalendarsEvents from "@calcom/lib/getCalendarsEvents";
|
|
||||||
import { getCalendarsEventsWithTimezones } from "@calcom/lib/getCalendarsEvents";
|
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { getPiiFreeCalendarEvent, getPiiFreeCredential } from "@calcom/lib/piiFreeData";
|
import { getPiiFreeCalendarEvent, getPiiFreeCredential } from "@calcom/lib/piiFreeData";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
|
|||||||
+3
-3
@@ -1,21 +1,21 @@
|
|||||||
import "../../tests/libs/__mocks__/prisma";
|
import "../../../../tests/libs/__mocks__/prisma";
|
||||||
|
|
||||||
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
|
||||||
|
|
||||||
import GoogleCalendarService from "@calcom/app-store/googlecalendar/lib/CalendarService";
|
import GoogleCalendarService from "@calcom/app-store/googlecalendar/lib/CalendarService";
|
||||||
import OfficeCalendarService from "@calcom/app-store/office365calendar/lib/CalendarService";
|
import OfficeCalendarService from "@calcom/app-store/office365calendar/lib/CalendarService";
|
||||||
|
import { symmetricDecrypt } from "@calcom/lib/crypto";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import type { SelectedCalendar } from "@calcom/prisma/client";
|
import type { SelectedCalendar } from "@calcom/prisma/client";
|
||||||
import type { EventBusyDate } from "@calcom/types/Calendar";
|
import type { EventBusyDate } from "@calcom/types/Calendar";
|
||||||
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService, CredentialPayload } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import { symmetricDecrypt } from "./crypto";
|
|
||||||
import getCalendarsEvents, {
|
import getCalendarsEvents, {
|
||||||
getCalendarsEventsWithTimezones,
|
getCalendarsEventsWithTimezones,
|
||||||
filterSelectedCalendarsForCredential,
|
filterSelectedCalendarsForCredential,
|
||||||
} from "./getCalendarsEvents";
|
} from "./getCalendarsEvents";
|
||||||
|
|
||||||
vi.mock("./crypto", () => ({
|
vi.mock("@calcom/lib/crypto", () => ({
|
||||||
symmetricDecrypt: vi.fn(),
|
symmetricDecrypt: vi.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
+2
-3
@@ -1,5 +1,6 @@
|
|||||||
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import { symmetricDecrypt } from "@calcom/lib/crypto";
|
||||||
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { getPiiFreeSelectedCalendar, getPiiFreeCredential } from "@calcom/lib/piiFreeData";
|
import { getPiiFreeSelectedCalendar, getPiiFreeCredential } from "@calcom/lib/piiFreeData";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
@@ -7,8 +8,6 @@ import { performance } from "@calcom/lib/server/perfObserver";
|
|||||||
import type { EventBusyDate, SelectedCalendar } from "@calcom/types/Calendar";
|
import type { EventBusyDate, SelectedCalendar } from "@calcom/types/Calendar";
|
||||||
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
import type { CredentialForCalendarService } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import { symmetricDecrypt } from "./crypto";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["getCalendarsEvents"] });
|
const log = logger.getSubLogger({ prefix: ["getCalendarsEvents"] });
|
||||||
|
|
||||||
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
|
const CALENDSO_ENCRYPTION_KEY = process.env.CALENDSO_ENCRYPTION_KEY || "";
|
||||||
+9
-7
@@ -1,17 +1,19 @@
|
|||||||
import { getCalendarCredentials, getConnectedCalendars } from "@calcom/features/calendars/lib/CalendarManager";
|
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { isDelegationCredential } from "@calcom/lib/delegationCredential/clientAndServer";
|
import {
|
||||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
getCalendarCredentials,
|
||||||
|
getConnectedCalendars,
|
||||||
|
} from "@calcom/features/calendars/lib/CalendarManager";
|
||||||
|
import { isDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
|
import { DestinationCalendarRepository } from "@calcom/lib/server/repository/destinationCalendar";
|
||||||
|
import { EventTypeRepository } from "@calcom/lib/server/repository/eventTypeRepository";
|
||||||
|
import { SelectedCalendarRepository } from "@calcom/lib/server/repository/selectedCalendar";
|
||||||
import type { PrismaClient } from "@calcom/prisma";
|
import type { PrismaClient } from "@calcom/prisma";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import type { DestinationCalendar, SelectedCalendar, User } from "@calcom/prisma/client";
|
import type { DestinationCalendar, SelectedCalendar, User } from "@calcom/prisma/client";
|
||||||
import { AppCategories } from "@calcom/prisma/enums";
|
import { AppCategories } from "@calcom/prisma/enums";
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|
||||||
import { DestinationCalendarRepository } from "./server/repository/destinationCalendar";
|
|
||||||
import { EventTypeRepository } from "./server/repository/eventTypeRepository";
|
|
||||||
import { SelectedCalendarRepository } from "./server/repository/selectedCalendar";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["getConnectedDestinationCalendarsAndEnsureDefaultsInDb"] });
|
const log = logger.getSubLogger({ prefix: ["getConnectedDestinationCalendarsAndEnsureDefaultsInDb"] });
|
||||||
|
|
||||||
type ReturnTypeGetConnectedCalendars = Awaited<ReturnType<typeof getConnectedCalendars>>;
|
type ReturnTypeGetConnectedCalendars = Awaited<ReturnType<typeof getConnectedCalendars>>;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IFromUser, IToUser } from "@calcom/lib/getUserAvailability";
|
import type { IFromUser, IToUser } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import type { TimeRange } from "@calcom/types/schedule";
|
import type { TimeRange } from "@calcom/types/schedule";
|
||||||
|
|
||||||
import type { CalendarEvent } from "./events";
|
import type { CalendarEvent } from "./events";
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { sendCancelledEmailsAndSMS } from "@calcom/emails";
|
|||||||
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
||||||
import { deletePayment } from "@calcom/features/bookings/lib/payment/deletePayment";
|
import { deletePayment } from "@calcom/features/bookings/lib/payment/deletePayment";
|
||||||
import { deleteWebhookScheduledTriggers } from "@calcom/features/webhooks/lib/scheduleTrigger";
|
import { deleteWebhookScheduledTriggers } from "@calcom/features/webhooks/lib/scheduleTrigger";
|
||||||
import { buildNonDelegationCredential } from "@calcom/lib/delegationCredential/server";
|
import { buildNonDelegationCredential } from "@calcom/lib/delegationCredential";
|
||||||
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
||||||
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
|
import { parseRecurringEvent } from "@calcom/lib/isRecurringEvent";
|
||||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,7 @@
|
|||||||
|
import type { FilterHostsService } from "@calcom/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost";
|
||||||
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
||||||
import { prismaModule } from "@calcom/prisma/prisma.module";
|
import { prismaModule } from "@calcom/prisma/prisma.module";
|
||||||
|
|
||||||
import type { FilterHostsService } from "../../bookings/filterHostsBySameRoundRobinHost";
|
|
||||||
import { createContainer } from "../di";
|
import { createContainer } from "../di";
|
||||||
import { bookingRepositoryModule } from "../modules/Booking";
|
import { bookingRepositoryModule } from "../modules/Booking";
|
||||||
import { filterHostsModule } from "../modules/FilterHosts";
|
import { filterHostsModule } from "../modules/FilterHosts";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
||||||
import { redisModule } from "@calcom/features/redis/di/redisModule";
|
import { redisModule } from "@calcom/features/redis/di/redisModule";
|
||||||
import type { UserAvailabilityService } from "@calcom/lib/getUserAvailability";
|
import type { UserAvailabilityService } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { prismaModule } from "@calcom/prisma/prisma.module";
|
import { prismaModule } from "@calcom/prisma/prisma.module";
|
||||||
|
|
||||||
import { createContainer } from "../di";
|
import { createContainer } from "../di";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { LuckyUserService } from "@calcom/lib/server/getLuckyUser";
|
import type { LuckyUserService } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
|
|
||||||
import { createContainer } from "../di";
|
import { createContainer } from "../di";
|
||||||
import { moduleLoader as luckyUserServiceModuleLoader } from "../modules/LuckyUser";
|
import { moduleLoader as luckyUserServiceModuleLoader } from "../modules/LuckyUser";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { QualifiedHostsService } from "@calcom/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials";
|
||||||
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
||||||
import type { QualifiedHostsService } from "@calcom/lib/bookings/findQualifiedHostsWithDelegationCredentials";
|
|
||||||
import { prismaModule } from "@calcom/prisma/prisma.module";
|
import { prismaModule } from "@calcom/prisma/prisma.module";
|
||||||
|
|
||||||
import { createContainer } from "../di";
|
import { createContainer } from "../di";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { IFilterHostsService } from "@calcom/lib/bookings/filterHostsBySameRoundRobinHost";
|
import type { IFilterHostsService } from "@calcom/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost";
|
||||||
import { FilterHostsService } from "@calcom/lib/bookings/filterHostsBySameRoundRobinHost";
|
import { FilterHostsService } from "@calcom/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost";
|
||||||
|
|
||||||
import { createModule } from "../di";
|
import { createModule } from "../di";
|
||||||
import { DI_TOKENS } from "../tokens";
|
import { DI_TOKENS } from "../tokens";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { IUserAvailabilityService } from "@calcom/lib/getUserAvailability";
|
import type { IUserAvailabilityService } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { UserAvailabilityService } from "@calcom/lib/getUserAvailability";
|
import { UserAvailabilityService } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
|
|
||||||
import { createModule } from "../di";
|
import { createModule } from "../di";
|
||||||
import { DI_TOKENS } from "../tokens";
|
import { DI_TOKENS } from "../tokens";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
import { DI_TOKENS } from "@calcom/features/di/tokens";
|
||||||
import { LuckyUserService } from "@calcom/lib/server/getLuckyUser";
|
import { LuckyUserService } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
|
|
||||||
import { bindModuleToClassOnToken, createModule, type ModuleLoader } from "../di";
|
import { bindModuleToClassOnToken, createModule, type ModuleLoader } from "../di";
|
||||||
import { moduleLoader as attributeRepositoryModuleLoader } from "./Attribute";
|
import { moduleLoader as attributeRepositoryModuleLoader } from "./Attribute";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { IQualifiedHostsService } from "@calcom/lib/bookings/findQualifiedHostsWithDelegationCredentials";
|
import type { IQualifiedHostsService } from "@calcom/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials";
|
||||||
import { QualifiedHostsService } from "@calcom/lib/bookings/findQualifiedHostsWithDelegationCredentials";
|
import { QualifiedHostsService } from "@calcom/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials";
|
||||||
|
|
||||||
import { createModule } from "../di";
|
import { createModule } from "../di";
|
||||||
import { DI_TOKENS } from "../tokens";
|
import { DI_TOKENS } from "../tokens";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
import type { FormResponse, Fields } from "@calcom/app-store/routing-forms/types/types";
|
||||||
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
import { zodRoutes } from "@calcom/app-store/routing-forms/zod";
|
||||||
import { acrossQueryValueCompatiblity } from "@calcom/lib/raqb/raqbUtils";
|
import { acrossQueryValueCompatiblity } from "@calcom/app-store/_utils/raqb/raqbUtils";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import { getUsersAttributes } from "@calcom/lib/service/attribute/server/getAttributes";
|
import { getUsersAttributes } from "@calcom/lib/service/attribute/server/getAttributes";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
|
|
||||||
|
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import {
|
import {
|
||||||
@@ -8,6 +9,7 @@ import {
|
|||||||
sendRoundRobinScheduledEmailsAndSMS,
|
sendRoundRobinScheduledEmailsAndSMS,
|
||||||
sendRoundRobinUpdatedEmailsAndSMS,
|
sendRoundRobinUpdatedEmailsAndSMS,
|
||||||
} from "@calcom/emails";
|
} from "@calcom/emails";
|
||||||
|
import EventManager from "@calcom/features/bookings/lib/EventManager";
|
||||||
import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
|
import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
|
||||||
import getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
import getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
||||||
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
||||||
@@ -23,9 +25,7 @@ import {
|
|||||||
import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
|
import { scheduleWorkflowReminders } from "@calcom/features/ee/workflows/lib/reminders/reminderScheduler";
|
||||||
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||||
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
|
import { getVideoCallUrlFromCalEvent } from "@calcom/lib/CalEventParser";
|
||||||
import EventManager from "@calcom/features/bookings/lib/EventManager";
|
|
||||||
import { SENDER_NAME } from "@calcom/lib/constants";
|
import { SENDER_NAME } from "@calcom/lib/constants";
|
||||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "@calcom/lib/delegationCredential/server";
|
|
||||||
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
|
import { getBookerBaseUrl } from "@calcom/lib/getBookerUrl/server";
|
||||||
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
|
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
|
||||||
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
// eslint-disable-next-line no-restricted-imports
|
// eslint-disable-next-line no-restricted-imports
|
||||||
import { cloneDeep } from "lodash";
|
import { cloneDeep } from "lodash";
|
||||||
|
|
||||||
|
import {
|
||||||
|
enrichHostsWithDelegationCredentials,
|
||||||
|
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
|
||||||
|
} from "@calcom/app-store/delegationCredential";
|
||||||
import { OrganizerDefaultConferencingAppType, getLocationValueForDB } from "@calcom/app-store/locations";
|
import { OrganizerDefaultConferencingAppType, getLocationValueForDB } from "@calcom/app-store/locations";
|
||||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
@@ -9,22 +13,18 @@ import {
|
|||||||
sendRoundRobinScheduledEmailsAndSMS,
|
sendRoundRobinScheduledEmailsAndSMS,
|
||||||
sendRoundRobinUpdatedEmailsAndSMS,
|
sendRoundRobinUpdatedEmailsAndSMS,
|
||||||
} from "@calcom/emails";
|
} from "@calcom/emails";
|
||||||
|
import EventManager from "@calcom/features/bookings/lib/EventManager";
|
||||||
import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
|
import { getAllCredentialsIncludeServiceAccountKey } from "@calcom/features/bookings/lib/getAllCredentialsForUsersOnEvent/getAllCredentials";
|
||||||
import getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
import getBookingResponsesSchema from "@calcom/features/bookings/lib/getBookingResponsesSchema";
|
||||||
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
import { getCalEventResponses } from "@calcom/features/bookings/lib/getCalEventResponses";
|
||||||
import { ensureAvailableUsers } from "@calcom/features/bookings/lib/handleNewBooking/ensureAvailableUsers";
|
import { ensureAvailableUsers } from "@calcom/features/bookings/lib/handleNewBooking/ensureAvailableUsers";
|
||||||
import { getEventTypesFromDB } from "@calcom/features/bookings/lib/handleNewBooking/getEventTypesFromDB";
|
import { getEventTypesFromDB } from "@calcom/features/bookings/lib/handleNewBooking/getEventTypesFromDB";
|
||||||
import type { IsFixedAwareUser } from "@calcom/features/bookings/lib/handleNewBooking/types";
|
import type { IsFixedAwareUser } from "@calcom/features/bookings/lib/handleNewBooking/types";
|
||||||
|
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
||||||
import AssignmentReasonRecorder, {
|
import AssignmentReasonRecorder, {
|
||||||
RRReassignmentType,
|
RRReassignmentType,
|
||||||
} from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder";
|
} from "@calcom/features/ee/round-robin/assignmentReason/AssignmentReasonRecorder";
|
||||||
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming";
|
||||||
import EventManager from "@calcom/features/bookings/lib/EventManager";
|
|
||||||
import {
|
|
||||||
enrichHostsWithDelegationCredentials,
|
|
||||||
enrichUserWithDelegationCredentialsIncludeServiceAccountKey,
|
|
||||||
} from "@calcom/lib/delegationCredential/server";
|
|
||||||
import { getLuckyUserService } from "@calcom/features/di/containers/LuckyUser";
|
|
||||||
import { ErrorCode } from "@calcom/lib/errorCodes";
|
import { ErrorCode } from "@calcom/lib/errorCodes";
|
||||||
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
|
import { IdempotencyKeyService } from "@calcom/lib/idempotencyKey/idempotencyKeyService";
|
||||||
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
import { isPrismaObjOrUndefined } from "@calcom/lib/isPrismaObj";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { z } from "zod";
|
|||||||
|
|
||||||
import type { eventTypeAppCardZod } from "@calcom/app-store/eventTypeAppCardZod";
|
import type { eventTypeAppCardZod } from "@calcom/app-store/eventTypeAppCardZod";
|
||||||
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
import { eventTypeAppMetadataOptionalSchema } from "@calcom/app-store/zod-utils";
|
||||||
import CrmManager from "@calcom/lib/crmManager/crmManager";
|
import CrmManager from "@calcom/features/crmManager/crmManager";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import prisma from "@calcom/prisma";
|
import prisma from "@calcom/prisma";
|
||||||
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
import { EventTypeMetaDataSchema } from "@calcom/prisma/zod-utils";
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ vi.mock("../lib/buildCalendarEvent", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const mockCreateEvent = vi.fn().mockResolvedValue({ id: "sf-event-123" });
|
const mockCreateEvent = vi.fn().mockResolvedValue({ id: "sf-event-123" });
|
||||||
vi.mock("@calcom/lib/crmManager/crmManager", () => ({
|
vi.mock("@calcom/features/crmManager/crmManager", () => ({
|
||||||
default: class MockCrmManager {
|
default: class MockCrmManager {
|
||||||
private credential: CRMCredential;
|
private credential: CRMCredential;
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export async function createCRMEvent(payload: string): Promise<void> {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CrmManager = (await import("@calcom/lib/crmManager/crmManager")).default;
|
const CrmManager = (await import("@calcom/features/crmManager/crmManager")).default;
|
||||||
|
|
||||||
const crm = new CrmManager(crmCredential, app);
|
const crm = new CrmManager(crmCredential, app);
|
||||||
|
|
||||||
|
|||||||
File renamed without changes.
+3
-4
@@ -1,5 +1,7 @@
|
|||||||
|
import { enrichHostsWithDelegationCredentials } from "@calcom/app-store/delegationCredential";
|
||||||
|
import getOrgIdFromMemberOrTeamId from "@calcom/lib/getOrgIdFromMemberOrTeamId";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
import { findTeamMembersMatchingAttributeLogic } from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
import type { AttributesQueryValue } from "@calcom/lib/raqb/types";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import type { RRResetInterval } from "@calcom/prisma/client";
|
import type { RRResetInterval } from "@calcom/prisma/client";
|
||||||
@@ -7,9 +9,6 @@ import type { RRTimestampBasis } from "@calcom/prisma/enums";
|
|||||||
import { SchedulingType } from "@calcom/prisma/enums";
|
import { SchedulingType } from "@calcom/prisma/enums";
|
||||||
import type { CredentialPayload } from "@calcom/types/Credential";
|
import type { CredentialPayload } from "@calcom/types/Credential";
|
||||||
|
|
||||||
import { enrichHostsWithDelegationCredentials } from "../delegationCredential/server";
|
|
||||||
import getOrgIdFromMemberOrTeamId from "../getOrgIdFromMemberOrTeamId";
|
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["[getRoutedUsers]"] });
|
const log = logger.getSubLogger({ prefix: ["[getRoutedUsers]"] });
|
||||||
|
|
||||||
export const getRoutedUsersWithContactOwnerAndFixedUsers = <
|
export const getRoutedUsersWithContactOwnerAndFixedUsers = <
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { Dayjs } from "@calcom/dayjs";
|
import type { Dayjs } from "@calcom/dayjs";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import type { IOutOfOfficeData } from "@calcom/lib/getUserAvailability";
|
import type { IOutOfOfficeData } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import type { Availability } from "@calcom/prisma/client";
|
import type { Availability } from "@calcom/prisma/client";
|
||||||
|
|
||||||
export type DateRange = {
|
export type DateRange = {
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1,11 @@
|
|||||||
|
import { forbid } from "@calcom/eslint-config/base";
|
||||||
|
import { config } from "@calcom/eslint-config/base";
|
||||||
|
|
||||||
|
export default [
|
||||||
|
...config,
|
||||||
|
forbid({
|
||||||
|
from: "../app-store/**",
|
||||||
|
target: ".",
|
||||||
|
message: "lib package should not import from app-store to avoid circular dependencies.",
|
||||||
|
}),
|
||||||
|
];
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import type { Dayjs } from "@calcom/dayjs";
|
import type { Dayjs } from "@calcom/dayjs";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
|
import type { EventType } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { getCheckBookingLimitsService } from "@calcom/features/di/containers/BookingLimits";
|
import { getCheckBookingLimitsService } from "@calcom/features/di/containers/BookingLimits";
|
||||||
import { getBusyTimesService } from "@calcom/features/di/containers/BusyTimes";
|
import { getBusyTimesService } from "@calcom/features/di/containers/BusyTimes";
|
||||||
import type { EventType } from "@calcom/lib/getUserAvailability";
|
|
||||||
import { getPeriodStartDatesBetween } from "@calcom/lib/intervalLimits/utils/getPeriodStartDatesBetween";
|
import { getPeriodStartDatesBetween } from "@calcom/lib/intervalLimits/utils/getPeriodStartDatesBetween";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
import { performance } from "@calcom/lib/server/perfObserver";
|
import { performance } from "@calcom/lib/server/perfObserver";
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import { prisma } from "@calcom/prisma";
|
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
|
||||||
|
|
||||||
import { enrichUserWithDelegationCredentialsIncludeServiceAccountKey } from "../delegationCredential/server";
|
|
||||||
|
|
||||||
type User = { id: number; email: string };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* It includes in-memory DelegationCredential credentials as well.
|
|
||||||
*/
|
|
||||||
export async function getUsersCredentialsIncludeServiceAccountKey(user: User) {
|
|
||||||
const credentials = await prisma.credential.findMany({
|
|
||||||
where: {
|
|
||||||
userId: user.id,
|
|
||||||
},
|
|
||||||
select: credentialForCalendarServiceSelect,
|
|
||||||
orderBy: {
|
|
||||||
id: "asc",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const { credentials: allCredentials } = await enrichUserWithDelegationCredentialsIncludeServiceAccountKey({
|
|
||||||
user: {
|
|
||||||
email: user.email,
|
|
||||||
id: user.id,
|
|
||||||
credentials,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return allCredentials;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function getUsersCredentials(user: User) {
|
|
||||||
const credentials = await getUsersCredentialsIncludeServiceAccountKey(user);
|
|
||||||
return credentials.map(({ delegatedTo: _1, ...rest }) => rest);
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ import type { Prisma, PrismaClient } from "@calcom/prisma/client";
|
|||||||
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
|
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
|
||||||
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
import { credentialForCalendarServiceSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|
||||||
import { buildNonDelegationCredential } from "../../delegationCredential/server";
|
import { buildNonDelegationCredential } from "../../delegationCredential";
|
||||||
|
|
||||||
const log = logger.getSubLogger({ prefix: ["CredentialRepository"] });
|
const log = logger.getSubLogger({ prefix: ["CredentialRepository"] });
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { z } from "zod";
|
import type { z } from "zod";
|
||||||
|
|
||||||
import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
import { whereClauseForOrgWithSlugOrRequestedSlug } from "@calcom/ee/organizations/lib/orgDomains";
|
||||||
|
import { buildNonDelegationCredentials } from "@calcom/lib/delegationCredential";
|
||||||
import logger from "@calcom/lib/logger";
|
import logger from "@calcom/lib/logger";
|
||||||
import { safeStringify } from "@calcom/lib/safeStringify";
|
import { safeStringify } from "@calcom/lib/safeStringify";
|
||||||
import { getTranslation } from "@calcom/lib/server/i18n";
|
import { getTranslation } from "@calcom/lib/server/i18n";
|
||||||
@@ -15,7 +16,6 @@ import { userMetadata } from "@calcom/prisma/zod-utils";
|
|||||||
import type { UpId, UserProfile } from "@calcom/types/UserProfile";
|
import type { UpId, UserProfile } from "@calcom/types/UserProfile";
|
||||||
|
|
||||||
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "../../availability";
|
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "../../availability";
|
||||||
import { buildNonDelegationCredentials } from "../../delegationCredential/clientAndServer";
|
|
||||||
import { withSelectedCalendars } from "../withSelectedCalendars";
|
import { withSelectedCalendars } from "../withSelectedCalendars";
|
||||||
import { ProfileRepository } from "./profile";
|
import { ProfileRepository } from "./profile";
|
||||||
import { getParsedTeam } from "./teamUtils";
|
import { getParsedTeam } from "./teamUtils";
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
import type { Dayjs } from "@calcom/dayjs";
|
import type { Dayjs } from "@calcom/dayjs";
|
||||||
import dayjs from "@calcom/dayjs";
|
import dayjs from "@calcom/dayjs";
|
||||||
import type { IFromUser, IOutOfOfficeData, IToUser } from "@calcom/lib/getUserAvailability";
|
import type {
|
||||||
|
IFromUser,
|
||||||
|
IOutOfOfficeData,
|
||||||
|
IToUser,
|
||||||
|
} from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
import { withReporting } from "@calcom/lib/sentryWrapper";
|
import { withReporting } from "@calcom/lib/sentryWrapper";
|
||||||
|
|
||||||
import type { DateRange } from "./date-ranges";
|
import type { DateRange } from "./date-ranges";
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { useTimePreferences } from "@calcom/features/bookings/lib";
|
|||||||
import { useTimesForSchedule } from "@calcom/features/schedules/lib/use-schedule/useTimesForSchedule";
|
import { useTimesForSchedule } from "@calcom/features/schedules/lib/use-schedule/useTimesForSchedule";
|
||||||
import { getRoutedTeamMemberIdsFromSearchParams } from "@calcom/lib/bookings/getRoutedTeamMemberIdsFromSearchParams";
|
import { getRoutedTeamMemberIdsFromSearchParams } from "@calcom/lib/bookings/getRoutedTeamMemberIdsFromSearchParams";
|
||||||
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
import { getUsernameList } from "@calcom/features/eventtypes/lib/defaultEvents";
|
||||||
import type { ConnectedDestinationCalendars } from "@calcom/lib/getConnectedDestinationCalendars";
|
import type { ConnectedDestinationCalendars } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
import { localStorage } from "@calcom/lib/webstorage";
|
import { localStorage } from "@calcom/lib/webstorage";
|
||||||
import { BookerLayouts } from "@calcom/prisma/zod-utils";
|
import { BookerLayouts } from "@calcom/prisma/zod-utils";
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useState, useEffect, useMemo } from "react";
|
|||||||
|
|
||||||
import { SingleValueComponent } from "@calcom/features/calendars/DestinationCalendarSelector";
|
import { SingleValueComponent } from "@calcom/features/calendars/DestinationCalendarSelector";
|
||||||
import { OptionComponent } from "@calcom/features/calendars/DestinationCalendarSelector";
|
import { OptionComponent } from "@calcom/features/calendars/DestinationCalendarSelector";
|
||||||
import type { ConnectedDestinationCalendars } from "@calcom/lib/getConnectedDestinationCalendars";
|
import type { ConnectedDestinationCalendars } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import classNames from "@calcom/ui/classNames";
|
import classNames from "@calcom/ui/classNames";
|
||||||
import { Badge } from "@calcom/ui/components/badge";
|
import { Badge } from "@calcom/ui/components/badge";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useQuery } from "@tanstack/react-query";
|
import { useQuery } from "@tanstack/react-query";
|
||||||
|
|
||||||
import type { ConnectedDestinationCalendars } from "@calcom/lib/getConnectedDestinationCalendars";
|
import type { ConnectedDestinationCalendars } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
import { SUCCESS_STATUS } from "@calcom/platform-constants";
|
||||||
import type { ApiResponse, ApiSuccessResponse } from "@calcom/platform-types";
|
import type { ApiResponse, ApiSuccessResponse } from "@calcom/platform-types";
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export type { CredentialPayload } from "@calcom/types/Credential";
|
|||||||
|
|
||||||
export { addDelegationCredential };
|
export { addDelegationCredential };
|
||||||
|
|
||||||
export { enrichUserWithDelegationConferencingCredentialsWithoutOrgId } from "@calcom/lib/delegationCredential/server";
|
export { enrichUserWithDelegationConferencingCredentialsWithoutOrgId } from "@calcom/app-store/delegationCredential";
|
||||||
export { toggleDelegationCredentialEnabled } from "@calcom/trpc/server/routers/viewer/delegationCredential/toggleEnabled.handler";
|
export { toggleDelegationCredentialEnabled } from "@calcom/trpc/server/routers/viewer/delegationCredential/toggleEnabled.handler";
|
||||||
export {
|
export {
|
||||||
CalendarAppError,
|
CalendarAppError,
|
||||||
@@ -46,4 +46,4 @@ export {
|
|||||||
export { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
export { DelegationCredentialRepository } from "@calcom/lib/server/repository/delegationCredential";
|
||||||
|
|
||||||
export { OAuth2UniversalSchema } from "@calcom/app-store/_utils/oauth/universalSchema";
|
export { OAuth2UniversalSchema } from "@calcom/app-store/_utils/oauth/universalSchema";
|
||||||
export { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
|
export { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
export { LuckyUserService } from "@calcom/lib/server/getLuckyUser";
|
export { LuckyUserService } from "@calcom/features/bookings/lib/getLuckyUser";
|
||||||
|
|
||||||
export { CheckBookingLimitsService } from "@calcom/lib/intervalLimits/server/checkBookingLimits";
|
export { CheckBookingLimitsService } from "@calcom/lib/intervalLimits/server/checkBookingLimits";
|
||||||
export { CheckBookingAndDurationLimitsService } from "@calcom/features/bookings/lib/handleNewBooking/checkBookingAndDurationLimits";
|
export { CheckBookingAndDurationLimitsService } from "@calcom/features/bookings/lib/handleNewBooking/checkBookingAndDurationLimits";
|
||||||
@@ -51,7 +51,7 @@ export { handleCreatePhoneCall };
|
|||||||
|
|
||||||
export { handleNewRecurringBooking } from "@calcom/features/bookings/lib/handleNewRecurringBooking";
|
export { handleNewRecurringBooking } from "@calcom/features/bookings/lib/handleNewRecurringBooking";
|
||||||
|
|
||||||
export { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/lib/getConnectedDestinationCalendars";
|
export { getConnectedDestinationCalendarsAndEnsureDefaultsInDb } from "@calcom/features/calendars/lib/getConnectedDestinationCalendars";
|
||||||
|
|
||||||
export { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
|
export { getBusyCalendarTimes } from "@calcom/features/calendars/lib/CalendarManager";
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ export { encryptServiceAccountKey } from "@calcom/lib/server/serviceAccountKey";
|
|||||||
export { createHandler as createApiKeyHandler } from "@calcom/trpc/server/routers/viewer/apiKeys/create.handler";
|
export { createHandler as createApiKeyHandler } from "@calcom/trpc/server/routers/viewer/apiKeys/create.handler";
|
||||||
export { getCalendarLinks } from "@calcom/features/bookings/lib/getCalendarLinks";
|
export { getCalendarLinks } from "@calcom/features/bookings/lib/getCalendarLinks";
|
||||||
|
|
||||||
export { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
export { findTeamMembersMatchingAttributeLogic } from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
export type { TFindTeamMembersMatchingAttributeLogicInputSchema } from "@calcom/trpc/server/routers/viewer/attributes/findTeamMembersMatchingAttributeLogic.schema";
|
export type { TFindTeamMembersMatchingAttributeLogicInputSchema } from "@calcom/trpc/server/routers/viewer/attributes/findTeamMembersMatchingAttributeLogic.schema";
|
||||||
export { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
export { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
||||||
|
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ export {
|
|||||||
} from "@calcom/lib/server/repository/schedule";
|
} from "@calcom/lib/server/repository/schedule";
|
||||||
|
|
||||||
export { updateSchedule, type UpdateScheduleResponse } from "@calcom/lib/schedules/updateSchedule";
|
export { updateSchedule, type UpdateScheduleResponse } from "@calcom/lib/schedules/updateSchedule";
|
||||||
export {UserAvailabilityService} from "@calcom/lib/getUserAvailability"
|
export { UserAvailabilityService } from "@calcom/features/availability/lib/getUserAvailability";
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { FilterHostsService } from "@calcom/lib/bookings/filterHostsBySameRoundRobinHost";
|
import { FilterHostsService } from "@calcom/features/bookings/lib/host-filtering/filterHostsBySameRoundRobinHost";
|
||||||
import { QualifiedHostsService } from "@calcom/lib/bookings/findQualifiedHostsWithDelegationCredentials";
|
import { QualifiedHostsService } from "@calcom/features/bookings/lib/host-filtering/findQualifiedHostsWithDelegationCredentials";
|
||||||
import { BusyTimesService } from "@calcom/lib/getBusyTimes";
|
import { BusyTimesService } from "@calcom/lib/getBusyTimes";
|
||||||
import { NoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
|
import { NoSlotsNotificationService } from "@calcom/trpc/server/routers/viewer/slots/handleNotificationWhenNoSlots";
|
||||||
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
import { AvailableSlotsService } from "@calcom/trpc/server/routers/viewer/slots/util";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import getApps from "@calcom/app-store/utils";
|
import getApps from "@calcom/app-store/utils";
|
||||||
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
|
|
||||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||||
|
|
||||||
import { TRPCError } from "@trpc/server";
|
import { TRPCError } from "@trpc/server";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getAllDelegationCredentialsForUserByAppType } from "@calcom/lib/delegationCredential/server";
|
import { getAllDelegationCredentialsForUserByAppType } from "@calcom/app-store/delegationCredential";
|
||||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
|
import { safeCredentialSelect } from "@calcom/prisma/selects/credential";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getAppFromSlug } from "@calcom/app-store/utils";
|
import { getAppFromSlug } from "@calcom/app-store/utils";
|
||||||
import { getAllDelegationCredentialsForUserByAppSlug } from "@calcom/lib/delegationCredential/server";
|
import { getAllDelegationCredentialsForUserByAppSlug } from "@calcom/app-store/delegationCredential";
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
|
|
||||||
import type { TrpcSessionUser } from "../../../types";
|
import type { TrpcSessionUser } from "../../../types";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import z from "zod";
|
import z from "zod";
|
||||||
|
|
||||||
|
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/app-store/delegationCredential";
|
||||||
import getApps from "@calcom/app-store/utils";
|
import getApps from "@calcom/app-store/utils";
|
||||||
import { getUsersCredentialsIncludeServiceAccountKey } from "@calcom/lib/server/getUsersCredentials";
|
|
||||||
import { prisma } from "@calcom/prisma";
|
import { prisma } from "@calcom/prisma";
|
||||||
import { userMetadata } from "@calcom/prisma/zod-utils";
|
import { userMetadata } from "@calcom/prisma/zod-utils";
|
||||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
import type { ServerResponse } from "http";
|
import type { ServerResponse } from "http";
|
||||||
import type { NextApiResponse } from "next";
|
import type { NextApiResponse } from "next";
|
||||||
|
|
||||||
import { findTeamMembersMatchingAttributeLogic } from "@calcom/lib/raqb/findTeamMembersMatchingAttributeLogic";
|
import { findTeamMembersMatchingAttributeLogic } from "@calcom/app-store/_utils/raqb/findTeamMembersMatchingAttributeLogic";
|
||||||
import { UserRepository } from "@calcom/lib/server/repository/user";
|
import { UserRepository } from "@calcom/lib/server/repository/user";
|
||||||
import type { PrismaClient } from "@calcom/prisma";
|
import type { PrismaClient } from "@calcom/prisma";
|
||||||
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
import type { TrpcSessionUser } from "@calcom/trpc/server/types";
|
||||||
|
|||||||
Loaded 100 of 114 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user