Separate system operations from core objects in GraphQL endpoints (#12977)
Moves system-level operations (auth, billing, admin) to use the /metadata endpoint instead of /graphql. This cleans up the endpoint separation so /graphql is purely for core objects (Company, People, etc.) and /metadata handles all system operations. Part of prep work for webhook/API key core migration.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { useGetConnectedImapSmtpCaldavAccountQuery } from '~/generated/graphql';
|
||||
import { useGetConnectedImapSmtpCaldavAccountQuery } from '~/generated-metadata/graphql';
|
||||
|
||||
export const useConnectedImapSmtpCaldavAccount = (
|
||||
connectedAccountId: string | undefined,
|
||||
|
||||
@ -10,7 +10,7 @@ import { useLingui } from '@lingui/react/macro';
|
||||
import {
|
||||
ConnectionParameters,
|
||||
useSaveImapSmtpCaldavMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
import { currentWorkspaceMemberState } from '~/modules/auth/states/currentWorkspaceMemberState';
|
||||
import { currentWorkspaceState } from '~/modules/auth/states/currentWorkspaceState';
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
CalendarChannelVisibility,
|
||||
MessageChannelVisibility,
|
||||
useGenerateTransientTokenMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
const getProviderUrl = (provider: ConnectedAccountProvider) => {
|
||||
switch (provider) {
|
||||
|
||||
@ -12,7 +12,7 @@ import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { useState } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { REACT_APP_SERVER_BASE_URL } from '~/config';
|
||||
import { useUserLookupAdminPanelMutation } from '~/generated/graphql';
|
||||
import { useUserLookupAdminPanelMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { SettingsAdminTableCard } from '@/settings/admin-panel/components/SettingsAdminTableCard';
|
||||
|
||||
@ -2,7 +2,7 @@ import { SettingsAdminTableCard } from '@/settings/admin-panel/components/Settin
|
||||
import { SettingsAdminVersionDisplay } from '@/settings/admin-panel/components/SettingsAdminVersionDisplay';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { IconCircleDot, IconStatusChange } from 'twenty-ui/display';
|
||||
import { useGetVersionInfoQuery } from '~/generated/graphql';
|
||||
import { useGetVersionInfoQuery } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsAdminVersionContainer = () => {
|
||||
const { data, loading } = useGetVersionInfoQuery();
|
||||
|
||||
@ -36,7 +36,7 @@ import {
|
||||
FeatureFlagKey,
|
||||
useImpersonateMutation,
|
||||
useUpdateWorkspaceFeatureFlagMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
type SettingsAdminWorkspaceContentProps = {
|
||||
activeWorkspace: WorkspaceInfo | undefined;
|
||||
|
||||
@ -13,7 +13,7 @@ import { Section } from 'twenty-ui/layout';
|
||||
import {
|
||||
ConfigSource,
|
||||
useGetConfigVariablesGroupedQuery,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { ConfigVariableSearchInput } from './ConfigVariableSearchInput';
|
||||
|
||||
const StyledControlsContainer = styled.div`
|
||||
|
||||
@ -10,7 +10,7 @@ import {
|
||||
useCreateDatabaseConfigVariableMutation,
|
||||
useDeleteDatabaseConfigVariableMutation,
|
||||
useUpdateDatabaseConfigVariableMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useConfigVariableActions = (variableName: string) => {
|
||||
const { t } = useLingui();
|
||||
|
||||
@ -3,7 +3,7 @@ import { useForm } from 'react-hook-form';
|
||||
import { ConfigVariableValue } from 'twenty-shared/types';
|
||||
import { z } from 'zod';
|
||||
|
||||
import { ConfigVariable } from '~/generated/graphql';
|
||||
import { ConfigVariable } from '~/generated-metadata/graphql';
|
||||
|
||||
type FormValues = {
|
||||
value: ConfigVariableValue;
|
||||
|
||||
@ -3,7 +3,7 @@ import { SettingsAdminIndicatorHealthContext } from '@/settings/admin-panel/heal
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated/graphql';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledErrorMessage = styled.div`
|
||||
color: ${({ theme }) => theme.color.red};
|
||||
|
||||
@ -4,7 +4,7 @@ import { useLingui } from '@lingui/react/macro';
|
||||
import { useContext } from 'react';
|
||||
import { JsonTree } from 'twenty-ui/json-visualizer';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated/graphql';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
|
||||
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
|
||||
|
||||
const StyledDetailsContainer = styled.div`
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { SettingsAdminTabSkeletonLoader } from '@/settings/admin-panel/components/SettingsAdminTabSkeletonLoader';
|
||||
import { SettingsHealthStatusListCard } from '@/settings/admin-panel/health-status/components/SettingsHealthStatusListCard';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useGetSystemHealthStatusQuery } from '~/generated/graphql';
|
||||
import { H2Title } from 'twenty-ui/display';
|
||||
import { Section } from 'twenty-ui/layout';
|
||||
import { useGetSystemHealthStatusQuery } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsAdminHealthStatus = () => {
|
||||
const { data, loading: loadingHealthStatus } = useGetSystemHealthStatusQuery({
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated/graphql';
|
||||
import { Status } from 'twenty-ui/display';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsAdminHealthStatusRightContainer = ({
|
||||
status,
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
import { SettingsListCard } from '@/settings/components/SettingsListCard';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import { HealthIndicatorId, SystemHealthService } from '~/generated/graphql';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
import { SettingsAdminHealthStatusRightContainer } from './SettingsAdminHealthStatusRightContainer';
|
||||
import {
|
||||
IconAppWindow,
|
||||
IconComponent,
|
||||
@ -12,6 +9,12 @@ import {
|
||||
IconTool,
|
||||
IconUserCircle,
|
||||
} from 'twenty-ui/display';
|
||||
import {
|
||||
HealthIndicatorId,
|
||||
SystemHealthService,
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
import { SettingsAdminHealthStatusRightContainer } from './SettingsAdminHealthStatusRightContainer';
|
||||
|
||||
const HealthStatusIcons: { [k in HealthIndicatorId]: IconComponent } = {
|
||||
[HealthIndicatorId.database]: IconDatabase,
|
||||
|
||||
@ -2,7 +2,7 @@ import { WorkerQueueMetricsSection } from '@/settings/admin-panel/health-status/
|
||||
import styled from '@emotion/styled';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useContext } from 'react';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated/graphql';
|
||||
import { AdminPanelHealthServiceStatus } from '~/generated-metadata/graphql';
|
||||
import { SettingsAdminIndicatorHealthContext } from '../contexts/SettingsAdminIndicatorHealthContext';
|
||||
|
||||
const StyledErrorMessage = styled.div`
|
||||
|
||||
@ -9,7 +9,7 @@ import { ResponsiveLine } from '@nivo/line';
|
||||
import {
|
||||
QueueMetricsTimeRange,
|
||||
useGetQueueMetricsQuery,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledGraphContainer = styled.div`
|
||||
background-color: ${({ theme }) => theme.background.secondary};
|
||||
|
||||
@ -8,7 +8,7 @@ import { Section } from 'twenty-ui/layout';
|
||||
import {
|
||||
AdminPanelWorkerQueueHealth,
|
||||
QueueMetricsTimeRange,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { WorkerMetricsGraph } from './WorkerMetricsGraph';
|
||||
|
||||
type WorkerQueueMetricsSectionProps = {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
import { FieldMetadataItemOption } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { FieldMetadataType } from '~/generated/graphql';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
import { generatedMockObjectMetadataItems } from '~/testing/mock-data/generatedMockObjectMetadataItems';
|
||||
|
||||
@ -8,15 +8,15 @@ import { useFindManyRecords } from '@/object-record/hooks/useFindManyRecords';
|
||||
import { ObjectFieldRow } from '@/settings/data-model/graph-overview/components/SettingsDataModelOverviewField';
|
||||
import { SettingsDataModelObjectTypeTag } from '@/settings/data-model/objects/components/SettingsDataModelObjectTypeTag';
|
||||
import { getObjectTypeLabel } from '@/settings/data-model/utils/getObjectTypeLabel';
|
||||
import { FieldMetadataType } from '~/generated/graphql';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { ObjectFieldRowWithoutRelation } from '@/settings/data-model/graph-overview/components/SettingsDataModelOverviewFieldWithoutRelation';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import '@xyflow/react/dist/style.css';
|
||||
import { useState } from 'react';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import { IconChevronDown, IconChevronUp, useIcons } from 'twenty-ui/display';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
type SettingsDataModelOverviewObjectNode = Node<ObjectMetadataItem, 'object'>;
|
||||
type SettingsDataModelOverviewObjectProps =
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { FieldMetadataType } from '~/generated/graphql';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { isSelectOptionDefaultValue } from '../isSelectOptionDefaultValue';
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
FeatureFlagKey,
|
||||
useUpdateLabPublicFeatureFlagMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useLabPublicFeatureFlags = () => {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
@ -7,7 +7,7 @@ import { useModal } from '@/ui/layout/modal/hooks/useModal';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { H2Title } from 'twenty-ui/display';
|
||||
import { Button } from 'twenty-ui/input';
|
||||
import { useDeleteUserAccountMutation } from '~/generated/graphql';
|
||||
import { useDeleteUserAccountMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
const DELETE_ACCOUNT_MODAL_ID = 'delete-account-modal';
|
||||
export const DeleteAccount = () => {
|
||||
|
||||
@ -7,7 +7,7 @@ import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModa
|
||||
import { useModal } from '@/ui/layout/modal/hooks/useModal';
|
||||
import { H2Title, IconTrash } from 'twenty-ui/display';
|
||||
import { Button } from 'twenty-ui/input';
|
||||
import { useDeleteCurrentWorkspaceMutation } from '~/generated/graphql';
|
||||
import { useDeleteCurrentWorkspaceMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
const DELETE_WORKSPACE_MODAL_ID = 'delete-workspace-modal';
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSi
|
||||
import { useUpdateOneRecord } from '@/object-record/hooks/useUpdateOneRecord';
|
||||
import { ImageInput } from '@/ui/input/components/ImageInput';
|
||||
import { buildSignedPath, isDefined } from 'twenty-shared/utils';
|
||||
import { useUploadProfilePictureMutation } from '~/generated/graphql';
|
||||
import { useUploadProfilePictureMutation } from '~/generated-metadata/graphql';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
|
||||
export const ProfilePictureUploader = () => {
|
||||
|
||||
@ -13,7 +13,7 @@ import {
|
||||
Role,
|
||||
UpdateWorkspaceMutation,
|
||||
useUpdateWorkspaceMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
type SettingsRoleDefaultRoleProps = {
|
||||
roles: Role[];
|
||||
|
||||
@ -6,7 +6,7 @@ import { getSnapshotValue } from '@/ui/utilities/recoil-scope/utils/getSnapshotV
|
||||
import { useEffect } from 'react';
|
||||
import { useRecoilCallback, useSetRecoilState } from 'recoil';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { Role, useGetRolesQuery } from '~/generated/graphql';
|
||||
import { Role, useGetRolesQuery } from '~/generated-metadata/graphql';
|
||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||
|
||||
export const SettingsRolesQueryEffect = () => {
|
||||
|
||||
@ -4,7 +4,7 @@ import { useRecoilState, useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
useUpdateWorkspaceMemberRoleMutation,
|
||||
WorkspaceMember,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
type AddWorkspaceMemberToRoleAndUpdateStateParams = {
|
||||
workspaceMemberId: string;
|
||||
|
||||
@ -3,7 +3,7 @@ import { SettingsRoleSettingsDeleteRoleConfirmationModalSubtitle } from '@/setti
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
import { ConfirmationModal } from '@/ui/layout/modal/components/ConfirmationModal';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useDeleteOneRoleMutation } from '~/generated/graphql';
|
||||
import { useDeleteOneRoleMutation } from '~/generated-metadata/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
|
||||
type SettingsRoleSettingsDeleteRoleConfirmationModalProps = {
|
||||
|
||||
@ -30,7 +30,7 @@ import {
|
||||
useUpdateOneRoleMutation,
|
||||
useUpsertObjectPermissionsMutation,
|
||||
useUpsertSettingPermissionsMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
import { getDirtyFields } from '~/utils/getDirtyFields';
|
||||
import { isDeeplyEqual } from '~/utils/isDeeplyEqual';
|
||||
|
||||
@ -14,9 +14,9 @@ import isPropValid from '@emotion/is-prop-valid';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { useGetSsoIdentityProvidersQuery } from '~/generated/graphql';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
import { IconKey } from 'twenty-ui/display';
|
||||
import { useGetSsoIdentityProvidersQuery } from '~/generated-metadata/graphql';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
const StyledLink = styled(Link, {
|
||||
shouldForwardProp: (prop) => isPropValid(prop) && prop !== 'isDisabled',
|
||||
|
||||
@ -7,17 +7,19 @@ import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { AuthProviders } from '~/generated-metadata/graphql';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import { ConnectedAccountProvider } from 'twenty-shared/types';
|
||||
import { Card } from 'twenty-ui/layout';
|
||||
import { capitalize } from 'twenty-shared/utils';
|
||||
import {
|
||||
IconGoogle,
|
||||
IconLink,
|
||||
IconMicrosoft,
|
||||
IconPassword,
|
||||
} from 'twenty-ui/display';
|
||||
import { Card } from 'twenty-ui/layout';
|
||||
import {
|
||||
AuthProviders,
|
||||
useUpdateWorkspaceMutation,
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledSettingsSecurityOptionsList = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -3,19 +3,19 @@ import { Link, useNavigate } from 'react-router-dom';
|
||||
import { SettingsPath } from '@/types/SettingsPath';
|
||||
|
||||
import { SettingsCard } from '@/settings/components/SettingsCard';
|
||||
import { SettingsListCard } from '@/settings/components/SettingsListCard';
|
||||
import { SettingsSecurityApprovedAccessDomainRowDropdownMenu } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu';
|
||||
import { SettingsSecurityApprovedAccessDomainValidationEffect } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect';
|
||||
import { approvedAccessDomainsState } from '@/settings/security/states/ApprovedAccessDomainsState';
|
||||
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilState } from 'recoil';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
import { SettingsListCard } from '@/settings/components/SettingsListCard';
|
||||
import { approvedAccessDomainsState } from '@/settings/security/states/ApprovedAccessDomainsState';
|
||||
import { SettingsSecurityApprovedAccessDomainRowDropdownMenu } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainRowDropdownMenu';
|
||||
import { SettingsSecurityApprovedAccessDomainValidationEffect } from '@/settings/security/components/approvedAccessDomains/SettingsSecurityApprovedAccessDomainValidationEffect';
|
||||
import { useGetApprovedAccessDomainsQuery } from '~/generated/graphql';
|
||||
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
|
||||
import { IconAt, IconMailCog, Status } from 'twenty-ui/display';
|
||||
import { useGetApprovedAccessDomainsQuery } from '~/generated-metadata/graphql';
|
||||
import { beautifyPastDateRelativeToNow } from '~/utils/date-utils';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
const StyledLink = styled(Link)`
|
||||
text-decoration: none;
|
||||
|
||||
@ -10,7 +10,7 @@ import { isDefined } from 'twenty-shared/utils';
|
||||
import { IconDotsVertical, IconTrash } from 'twenty-ui/display';
|
||||
import { LightIconButton } from 'twenty-ui/input';
|
||||
import { MenuItem } from 'twenty-ui/navigation';
|
||||
import { useDeleteApprovedAccessDomainMutation } from '~/generated/graphql';
|
||||
import { useDeleteApprovedAccessDomainMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
type SettingsSecurityApprovedAccessDomainRowDropdownMenuProps = {
|
||||
approvedAccessDomain: UnwrapRecoilValue<typeof approvedAccessDomainsState>[0];
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useValidateApprovedAccessDomainMutation } from '~/generated/graphql';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useEffect } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useValidateApprovedAccessDomainMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsSecurityApprovedAccessDomainValidationEffect = () => {
|
||||
const [validateApprovedAccessDomainMutation] =
|
||||
|
||||
@ -1,22 +1,21 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useCreateSSOIdentityProvider } from '@/settings/security/hooks/useCreateSSOIdentityProvider';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const mutationOIDCCallSpy = jest.fn();
|
||||
const mutationSAMLCallSpy = jest.fn();
|
||||
|
||||
jest.mock('~/generated/graphql', () => ({
|
||||
jest.mock('~/generated-metadata/graphql', () => ({
|
||||
useCreateOidcIdentityProviderMutation: () => [mutationOIDCCallSpy],
|
||||
useCreateSamlIdentityProviderMutation: () => [mutationSAMLCallSpy],
|
||||
}));
|
||||
|
||||
const Wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<RecoilRoot>{children}</RecoilRoot>
|
||||
);
|
||||
const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
apolloMocks: [],
|
||||
});
|
||||
|
||||
describe('useCreateSSOIdentityProvider', () => {
|
||||
afterEach(() => {
|
||||
|
||||
@ -1,20 +1,19 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useDeleteSSOIdentityProvider } from '@/settings/security/hooks/useDeleteSSOIdentityProvider';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const mutationDeleteSSOIDPCallSpy = jest.fn();
|
||||
|
||||
jest.mock('~/generated/graphql', () => ({
|
||||
jest.mock('~/generated-metadata/graphql', () => ({
|
||||
useDeleteSsoIdentityProviderMutation: () => [mutationDeleteSSOIDPCallSpy],
|
||||
}));
|
||||
|
||||
const Wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<RecoilRoot>{children}</RecoilRoot>
|
||||
);
|
||||
const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
apolloMocks: [],
|
||||
});
|
||||
|
||||
describe('useDeleteSsoIdentityProvider', () => {
|
||||
afterEach(() => {
|
||||
@ -22,10 +21,11 @@ describe('useDeleteSsoIdentityProvider', () => {
|
||||
});
|
||||
|
||||
it('delete SSO identity provider', async () => {
|
||||
const params = { identityProviderId: 'test' };
|
||||
renderHook(
|
||||
() => {
|
||||
const { deleteSSOIdentityProvider } = useDeleteSSOIdentityProvider();
|
||||
deleteSSOIdentityProvider({ identityProviderId: 'test' });
|
||||
deleteSSOIdentityProvider(params);
|
||||
},
|
||||
{ wrapper: Wrapper },
|
||||
);
|
||||
@ -33,7 +33,7 @@ describe('useDeleteSsoIdentityProvider', () => {
|
||||
expect(mutationDeleteSSOIDPCallSpy).toHaveBeenCalledWith({
|
||||
onCompleted: expect.any(Function),
|
||||
variables: {
|
||||
input: { identityProviderId: 'test' },
|
||||
input: params,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@ -1,25 +1,24 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { ReactNode } from 'react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useUpdateSSOIdentityProvider } from '@/settings/security/hooks/useUpdateSSOIdentityProvider';
|
||||
import { SsoIdentityProviderStatus } from '~/generated/graphql';
|
||||
import { getJestMetadataAndApolloMocksWrapper } from '~/testing/jest/getJestMetadataAndApolloMocksWrapper';
|
||||
|
||||
const mutationEditSSOIDPCallSpy = jest.fn();
|
||||
|
||||
jest.mock('~/generated/graphql', () => {
|
||||
const actual = jest.requireActual('~/generated/graphql');
|
||||
jest.mock('~/generated-metadata/graphql', () => {
|
||||
const actual = jest.requireActual('~/generated-metadata/graphql');
|
||||
return {
|
||||
...actual,
|
||||
useEditSsoIdentityProviderMutation: () => [mutationEditSSOIDPCallSpy],
|
||||
SsoIdentityProviderStatus: actual.SsoIdentityProviderStatus,
|
||||
};
|
||||
});
|
||||
|
||||
const Wrapper = ({ children }: { children: ReactNode }) => (
|
||||
<RecoilRoot>{children}</RecoilRoot>
|
||||
);
|
||||
const Wrapper = getJestMetadataAndApolloMocksWrapper({
|
||||
apolloMocks: [],
|
||||
});
|
||||
|
||||
describe('useEditSsoIdentityProvider', () => {
|
||||
afterEach(() => {
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
CreateSamlIdentityProviderMutationVariables,
|
||||
useCreateOidcIdentityProviderMutation,
|
||||
useCreateSamlIdentityProviderMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useCreateSSOIdentityProvider = () => {
|
||||
const [createOidcIdentityProviderMutation] =
|
||||
|
||||
@ -5,7 +5,7 @@ import { useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
DeleteSsoIdentityProviderMutationVariables,
|
||||
useDeleteSsoIdentityProviderMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useDeleteSSOIdentityProvider = () => {
|
||||
const [deleteSsoIdentityProviderMutation] =
|
||||
|
||||
@ -5,7 +5,7 @@ import { useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
EditSsoIdentityProviderMutationVariables,
|
||||
useEditSsoIdentityProviderMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useUpdateSSOIdentityProvider = () => {
|
||||
const [editSsoIdentityProviderMutation] =
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { useMutation } from '@apollo/client';
|
||||
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { CREATE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/createOneServerlessFunction';
|
||||
import { FIND_MANY_SERVERLESS_FUNCTIONS } from '@/settings/serverless-functions/graphql/queries/findManyServerlessFunctions';
|
||||
import { getOperationName } from '@apollo/client/utilities';
|
||||
@ -11,7 +11,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useCreateOneServerlessFunction = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const [mutate] = useMutation<
|
||||
CreateOneServerlessFunctionItemMutation,
|
||||
CreateOneServerlessFunctionItemMutationVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { DELETE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/deleteOneServerlessFunction';
|
||||
import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunctionSourceCode';
|
||||
import { useMutation } from '@apollo/client';
|
||||
@ -10,7 +10,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useDeleteOneServerlessFunction = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const [mutate] = useMutation<
|
||||
DeleteOneServerlessFunctionMutation,
|
||||
DeleteOneServerlessFunctionMutationVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { EXECUTE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/executeOneServerlessFunction';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import {
|
||||
@ -8,7 +8,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useExecuteOneServerlessFunction = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const [mutate] = useMutation<
|
||||
ExecuteOneServerlessFunctionMutation,
|
||||
ExecuteOneServerlessFunctionMutationVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { FIND_MANY_AVAILABLE_PACKAGES } from '@/settings/serverless-functions/graphql/queries/findManyAvailablePackages';
|
||||
import {
|
||||
@ -8,7 +8,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useGetAvailablePackages = (input: ServerlessFunctionIdInput) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const { data } = useQuery<
|
||||
FindManyAvailablePackagesQuery,
|
||||
FindManyAvailablePackagesQueryVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { FIND_MANY_SERVERLESS_FUNCTIONS } from '@/settings/serverless-functions/graphql/queries/findManyServerlessFunctions';
|
||||
import { useQuery } from '@apollo/client';
|
||||
import {
|
||||
@ -7,7 +7,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const useGetManyServerlessFunctions = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
|
||||
const { data, loading, error } = useQuery<
|
||||
GetManyServerlessFunctionsQuery,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { FIND_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunction';
|
||||
import {
|
||||
ServerlessFunctionIdInput,
|
||||
@ -10,7 +10,7 @@ import {
|
||||
export const useGetOneServerlessFunction = (
|
||||
input: ServerlessFunctionIdInput,
|
||||
) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const { data } = useQuery<
|
||||
GetOneServerlessFunctionQuery,
|
||||
GetOneServerlessFunctionQueryVariables
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunctionSourceCode';
|
||||
import {
|
||||
FindOneServerlessFunctionSourceCodeQuery,
|
||||
@ -15,7 +15,7 @@ export const useGetOneServerlessFunctionSourceCode = ({
|
||||
version: string;
|
||||
onCompleted?: (data: FindOneServerlessFunctionSourceCodeQuery) => void;
|
||||
}) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const { data, loading } = useQuery<
|
||||
FindOneServerlessFunctionSourceCodeQuery,
|
||||
FindOneServerlessFunctionSourceCodeQueryVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { PUBLISH_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/publishOneServerlessFunction';
|
||||
import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-functions/graphql/queries/findOneServerlessFunctionSourceCode';
|
||||
import { useMutation } from '@apollo/client';
|
||||
@ -10,7 +10,7 @@ import {
|
||||
} from '~/generated-metadata/graphql';
|
||||
|
||||
export const usePublishOneServerlessFunction = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const [mutate] = useMutation<
|
||||
PublishOneServerlessFunctionMutation,
|
||||
PublishOneServerlessFunctionMutationVariables
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
import { useApolloCoreClient } from '@/object-metadata/hooks/useApolloCoreClient';
|
||||
import { UPDATE_ONE_SERVERLESS_FUNCTION } from '@/settings/serverless-functions/graphql/mutations/updateOneServerlessFunction';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import {
|
||||
@ -12,7 +12,7 @@ import { FIND_ONE_SERVERLESS_FUNCTION_SOURCE_CODE } from '@/settings/serverless-
|
||||
export const useUpdateOneServerlessFunction = (
|
||||
serverlessFunctionId: string,
|
||||
) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
const apolloMetadataClient = useApolloCoreClient();
|
||||
const [mutate] = useMutation<
|
||||
UpdateOneServerlessFunctionMutation,
|
||||
UpdateOneServerlessFunctionMutationVariables
|
||||
|
||||
@ -7,10 +7,10 @@ import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import isEmpty from 'lodash.isempty';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated-metadata/graphql';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { logError } from '~/utils/logError';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
const StyledComboInputContainer = styled.div`
|
||||
display: flex;
|
||||
|
||||
@ -5,9 +5,9 @@ import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsO
|
||||
import { SnackBarVariant } from '@/ui/feedback/snack-bar-manager/components/SnackBar';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated/graphql';
|
||||
import { Card } from 'twenty-ui/layout';
|
||||
import { IconLifebuoy } from 'twenty-ui/display';
|
||||
import { Card } from 'twenty-ui/layout';
|
||||
import { useUpdateWorkspaceMutation } from '~/generated-metadata/graphql';
|
||||
|
||||
export const ToggleImpersonate = () => {
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
|
||||
@ -5,7 +5,7 @@ import { ImageInput } from '@/ui/input/components/ImageInput';
|
||||
import {
|
||||
useUpdateWorkspaceMutation,
|
||||
useUploadWorkspaceLogoMutation,
|
||||
} from '~/generated/graphql';
|
||||
} from '~/generated-metadata/graphql';
|
||||
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
|
||||
import { buildSignedPath } from 'twenty-shared/utils';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user