Rename types for UserMappingOptions (#5230)

Following #5210

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Marie
2024-05-01 11:46:47 +02:00
committed by GitHub
parent 0bc3b6f179
commit e0ece3c917
17 changed files with 155 additions and 125 deletions

View File

@ -221,7 +221,7 @@ export type CreateRemoteServerInput = {
foreignDataWrapperOptions: Scalars['JSON']['input'];
foreignDataWrapperType: Scalars['String']['input'];
schema?: InputMaybe<Scalars['String']['input']>;
userMappingOptions?: InputMaybe<UserMappingOptionsInput>;
userMappingOptions?: InputMaybe<UserMappingOptions>;
};
export type CursorPaging = {
@ -332,11 +332,6 @@ export type FullName = {
lastName: Scalars['String']['output'];
};
export type GetUserMappingOptions = {
__typename?: 'GetUserMappingOptions';
username?: Maybe<Scalars['String']['output']>;
};
export type InvalidatePassword = {
__typename?: 'InvalidatePassword';
/** Boolean that confirms query was dispatched */
@ -789,6 +784,7 @@ export type RelationDeleteResponse = {
/** Type of the relation */
export enum RelationMetadataType {
ManyToMany = 'MANY_TO_MANY',
ManyToOne = 'MANY_TO_ONE',
OneToMany = 'ONE_TO_MANY',
OneToOne = 'ONE_TO_ONE'
}
@ -802,7 +798,7 @@ export type RemoteServer = {
id: Scalars['ID']['output'];
schema?: Maybe<Scalars['String']['output']>;
updatedAt: Scalars['DateTime']['output'];
userMappingOptions?: Maybe<GetUserMappingOptions>;
userMappingOptions?: Maybe<UserMappingOptionsUsername>;
};
export type RemoteServerIdInput = {
@ -1011,7 +1007,7 @@ export type UpdateRemoteServerInput = {
foreignDataWrapperOptions?: InputMaybe<Scalars['JSON']['input']>;
id: Scalars['String']['input'];
schema?: InputMaybe<Scalars['String']['input']>;
userMappingOptions?: InputMaybe<UserMappingOptionsInput>;
userMappingOptions?: InputMaybe<UserMappingOptionsUpdateInput>;
};
export type UpdateWorkspaceInput = {
@ -1058,11 +1054,21 @@ export type UserExists = {
exists: Scalars['Boolean']['output'];
};
export type UserMappingOptionsInput = {
export type UserMappingOptions = {
password?: InputMaybe<Scalars['String']['input']>;
username?: InputMaybe<Scalars['String']['input']>;
};
export type UserMappingOptionsUpdateInput = {
password?: InputMaybe<Scalars['String']['input']>;
username?: InputMaybe<Scalars['String']['input']>;
};
export type UserMappingOptionsUsername = {
__typename?: 'UserMappingOptionsUsername';
username?: Maybe<Scalars['String']['output']>;
};
export type UserWorkspace = {
__typename?: 'UserWorkspace';
createdAt: Scalars['DateTime']['output'];
@ -1246,7 +1252,7 @@ export type RelationEdge = {
node: Relation;
};
export type RemoteServerFieldsFragment = { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'GetUserMappingOptions', username?: string | null } | null };
export type RemoteServerFieldsFragment = { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'UserMappingOptionsUsername', username?: string | null } | null };
export type RemoteTableFieldsFragment = { __typename?: 'RemoteTable', id?: any | null, name: string, schema: string, status: RemoteTableStatus };
@ -1255,7 +1261,7 @@ export type CreateServerMutationVariables = Exact<{
}>;
export type CreateServerMutation = { __typename?: 'Mutation', createOneRemoteServer: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'GetUserMappingOptions', username?: string | null } | null } };
export type CreateServerMutation = { __typename?: 'Mutation', createOneRemoteServer: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'UserMappingOptionsUsername', username?: string | null } | null } };
export type DeleteServerMutationVariables = Exact<{
input: RemoteServerIdInput;
@ -1283,14 +1289,14 @@ export type UpdateServerMutationVariables = Exact<{
}>;
export type UpdateServerMutation = { __typename?: 'Mutation', updateOneRemoteServer: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'GetUserMappingOptions', username?: string | null } | null } };
export type UpdateServerMutation = { __typename?: 'Mutation', updateOneRemoteServer: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'UserMappingOptionsUsername', username?: string | null } | null } };
export type GetManyDatabaseConnectionsQueryVariables = Exact<{
input: RemoteServerTypeInput;
}>;
export type GetManyDatabaseConnectionsQuery = { __typename?: 'Query', findManyRemoteServersByType: Array<{ __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'GetUserMappingOptions', username?: string | null } | null }> };
export type GetManyDatabaseConnectionsQuery = { __typename?: 'Query', findManyRemoteServersByType: Array<{ __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'UserMappingOptionsUsername', username?: string | null } | null }> };
export type GetManyRemoteTablesQueryVariables = Exact<{
input: RemoteServerIdInput;
@ -1304,7 +1310,7 @@ export type GetOneDatabaseConnectionQueryVariables = Exact<{
}>;
export type GetOneDatabaseConnectionQuery = { __typename?: 'Query', findOneRemoteServerById: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'GetUserMappingOptions', username?: string | null } | null } };
export type GetOneDatabaseConnectionQuery = { __typename?: 'Query', findOneRemoteServerById: { __typename?: 'RemoteServer', id: string, createdAt: any, foreignDataWrapperId: string, foreignDataWrapperOptions?: any | null, foreignDataWrapperType: string, updatedAt: any, schema?: string | null, userMappingOptions?: { __typename?: 'UserMappingOptionsUsername', username?: string | null } | null } };
export type CreateOneObjectMetadataItemMutationVariables = Exact<{
input: CreateOneObjectInput;

View File

@ -239,11 +239,6 @@ export type FullName = {
lastName: Scalars['String'];
};
export type GetUserMappingOptions = {
__typename?: 'GetUserMappingOptions';
username?: Maybe<Scalars['String']>;
};
export type InvalidatePassword = {
__typename?: 'InvalidatePassword';
/** Boolean that confirms query was dispatched */
@ -567,6 +562,7 @@ export type RelationDeleteResponse = {
/** Type of the relation */
export enum RelationMetadataType {
ManyToMany = 'MANY_TO_MANY',
ManyToOne = 'MANY_TO_ONE',
OneToMany = 'ONE_TO_MANY',
OneToOne = 'ONE_TO_ONE'
}
@ -578,8 +574,9 @@ export type RemoteServer = {
foreignDataWrapperOptions?: Maybe<Scalars['JSON']>;
foreignDataWrapperType: Scalars['String'];
id: Scalars['ID'];
schema?: Maybe<Scalars['String']>;
updatedAt: Scalars['DateTime'];
userMappingOptions?: Maybe<GetUserMappingOptions>;
userMappingOptions?: Maybe<UserMappingOptionsUsername>;
};
export type RemoteTable = {
@ -774,6 +771,11 @@ export type UserExists = {
exists: Scalars['Boolean'];
};
export type UserMappingOptionsUsername = {
__typename?: 'UserMappingOptionsUsername';
username?: Maybe<Scalars['String']>;
};
export type UserWorkspace = {
__typename?: 'UserWorkspace';
createdAt: Scalars['DateTime'];
@ -1005,6 +1007,22 @@ export type TrackMutationVariables = Exact<{
export type TrackMutation = { __typename?: 'Mutation', track: { __typename?: 'Analytics', success: boolean } };
export type UploadFileMutationVariables = Exact<{
file: Scalars['Upload'];
fileFolder?: InputMaybe<FileFolder>;
}>;
export type UploadFileMutation = { __typename?: 'Mutation', uploadFile: string };
export type UploadImageMutationVariables = Exact<{
file: Scalars['Upload'];
fileFolder?: InputMaybe<FileFolder>;
}>;
export type UploadImageMutation = { __typename?: 'Mutation', uploadImage: string };
export type AuthTokenFragmentFragment = { __typename?: 'AuthToken', token: string, expiresAt: string };
export type AuthTokensFragmentFragment = { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } };
@ -1140,22 +1158,6 @@ export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean, microsoft: boolean }, billing: { __typename?: 'Billing', isBillingEnabled: boolean, billingUrl?: string | null, billingFreeTrialDurationInDays?: number | null }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null }, sentry: { __typename?: 'Sentry', dsn?: string | null, environment?: string | null, release?: string | null }, captcha: { __typename?: 'Captcha', provider?: CaptchaDriverType | null, siteKey?: string | null } } };
export type UploadFileMutationVariables = Exact<{
file: Scalars['Upload'];
fileFolder?: InputMaybe<FileFolder>;
}>;
export type UploadFileMutation = { __typename?: 'Mutation', uploadFile: string };
export type UploadImageMutationVariables = Exact<{
file: Scalars['Upload'];
fileFolder?: InputMaybe<FileFolder>;
}>;
export type UploadImageMutation = { __typename?: 'Mutation', uploadImage: string };
export type UserQueryFragmentFragment = { __typename?: 'User', id: any, firstName: string, lastName: string, email: string, canImpersonate: boolean, supportUserHash?: string | null, workspaceMember?: { __typename?: 'WorkspaceMember', id: any, colorScheme: string, avatarUrl?: string | null, locale: string, name: { __typename?: 'FullName', firstName: string, lastName: string } } | null, defaultWorkspace: { __typename?: 'Workspace', id: any, displayName?: string | null, logo?: string | null, domainName?: string | null, inviteHash?: string | null, allowImpersonation: boolean, subscriptionStatus: string, activationStatus: string, featureFlags?: Array<{ __typename?: 'FeatureFlag', id: any, key: string, value: boolean, workspaceId: string }> | null }, workspaces: Array<{ __typename?: 'UserWorkspace', workspace?: { __typename?: 'Workspace', id: any, logo?: string | null, displayName?: string | null, domainName?: string | null } | null }> };
export type DeleteUserAccountMutationVariables = Exact<{ [key: string]: never; }>;
@ -1544,6 +1546,70 @@ export function useTrackMutation(baseOptions?: Apollo.MutationHookOptions<TrackM
export type TrackMutationHookResult = ReturnType<typeof useTrackMutation>;
export type TrackMutationResult = Apollo.MutationResult<TrackMutation>;
export type TrackMutationOptions = Apollo.BaseMutationOptions<TrackMutation, TrackMutationVariables>;
export const UploadFileDocument = gql`
mutation uploadFile($file: Upload!, $fileFolder: FileFolder) {
uploadFile(file: $file, fileFolder: $fileFolder)
}
`;
export type UploadFileMutationFn = Apollo.MutationFunction<UploadFileMutation, UploadFileMutationVariables>;
/**
* __useUploadFileMutation__
*
* To run a mutation, you first call `useUploadFileMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUploadFileMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [uploadFileMutation, { data, loading, error }] = useUploadFileMutation({
* variables: {
* file: // value for 'file'
* fileFolder: // value for 'fileFolder'
* },
* });
*/
export function useUploadFileMutation(baseOptions?: Apollo.MutationHookOptions<UploadFileMutation, UploadFileMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UploadFileMutation, UploadFileMutationVariables>(UploadFileDocument, options);
}
export type UploadFileMutationHookResult = ReturnType<typeof useUploadFileMutation>;
export type UploadFileMutationResult = Apollo.MutationResult<UploadFileMutation>;
export type UploadFileMutationOptions = Apollo.BaseMutationOptions<UploadFileMutation, UploadFileMutationVariables>;
export const UploadImageDocument = gql`
mutation uploadImage($file: Upload!, $fileFolder: FileFolder) {
uploadImage(file: $file, fileFolder: $fileFolder)
}
`;
export type UploadImageMutationFn = Apollo.MutationFunction<UploadImageMutation, UploadImageMutationVariables>;
/**
* __useUploadImageMutation__
*
* To run a mutation, you first call `useUploadImageMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUploadImageMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [uploadImageMutation, { data, loading, error }] = useUploadImageMutation({
* variables: {
* file: // value for 'file'
* fileFolder: // value for 'fileFolder'
* },
* });
*/
export function useUploadImageMutation(baseOptions?: Apollo.MutationHookOptions<UploadImageMutation, UploadImageMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UploadImageMutation, UploadImageMutationVariables>(UploadImageDocument, options);
}
export type UploadImageMutationHookResult = ReturnType<typeof useUploadImageMutation>;
export type UploadImageMutationResult = Apollo.MutationResult<UploadImageMutation>;
export type UploadImageMutationOptions = Apollo.BaseMutationOptions<UploadImageMutation, UploadImageMutationVariables>;
export const AuthorizeAppDocument = gql`
mutation authorizeApp($clientId: String!, $codeChallenge: String!, $redirectUrl: String!) {
authorizeApp(
@ -2228,70 +2294,6 @@ export function useGetClientConfigLazyQuery(baseOptions?: Apollo.LazyQueryHookOp
export type GetClientConfigQueryHookResult = ReturnType<typeof useGetClientConfigQuery>;
export type GetClientConfigLazyQueryHookResult = ReturnType<typeof useGetClientConfigLazyQuery>;
export type GetClientConfigQueryResult = Apollo.QueryResult<GetClientConfigQuery, GetClientConfigQueryVariables>;
export const UploadFileDocument = gql`
mutation uploadFile($file: Upload!, $fileFolder: FileFolder) {
uploadFile(file: $file, fileFolder: $fileFolder)
}
`;
export type UploadFileMutationFn = Apollo.MutationFunction<UploadFileMutation, UploadFileMutationVariables>;
/**
* __useUploadFileMutation__
*
* To run a mutation, you first call `useUploadFileMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUploadFileMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [uploadFileMutation, { data, loading, error }] = useUploadFileMutation({
* variables: {
* file: // value for 'file'
* fileFolder: // value for 'fileFolder'
* },
* });
*/
export function useUploadFileMutation(baseOptions?: Apollo.MutationHookOptions<UploadFileMutation, UploadFileMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UploadFileMutation, UploadFileMutationVariables>(UploadFileDocument, options);
}
export type UploadFileMutationHookResult = ReturnType<typeof useUploadFileMutation>;
export type UploadFileMutationResult = Apollo.MutationResult<UploadFileMutation>;
export type UploadFileMutationOptions = Apollo.BaseMutationOptions<UploadFileMutation, UploadFileMutationVariables>;
export const UploadImageDocument = gql`
mutation uploadImage($file: Upload!, $fileFolder: FileFolder) {
uploadImage(file: $file, fileFolder: $fileFolder)
}
`;
export type UploadImageMutationFn = Apollo.MutationFunction<UploadImageMutation, UploadImageMutationVariables>;
/**
* __useUploadImageMutation__
*
* To run a mutation, you first call `useUploadImageMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useUploadImageMutation` returns a tuple that includes:
* - A mutate function that you can call at any time to execute the mutation
* - An object with fields that represent the current status of the mutation's execution
*
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
*
* @example
* const [uploadImageMutation, { data, loading, error }] = useUploadImageMutation({
* variables: {
* file: // value for 'file'
* fileFolder: // value for 'fileFolder'
* },
* });
*/
export function useUploadImageMutation(baseOptions?: Apollo.MutationHookOptions<UploadImageMutation, UploadImageMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<UploadImageMutation, UploadImageMutationVariables>(UploadImageDocument, options);
}
export type UploadImageMutationHookResult = ReturnType<typeof useUploadImageMutation>;
export type UploadImageMutationResult = Apollo.MutationResult<UploadImageMutation>;
export type UploadImageMutationOptions = Apollo.BaseMutationOptions<UploadImageMutation, UploadImageMutationVariables>;
export const DeleteUserAccountDocument = gql`
mutation DeleteUserAccount {
deleteUser {

View File

@ -4,7 +4,8 @@ import { act, renderHook } from '@testing-library/react';
import { RecoilRoot } from 'recoil';
import { useCreateOneRelationMetadataItem } from '@/object-metadata/hooks/useCreateOneRelationMetadataItem';
import { FieldMetadataType, RelationMetadataType } from '~/generated/graphql';
import { FieldMetadataType } from '~/generated/graphql';
import { RelationMetadataType } from '~/generated-metadata/graphql';
import {
query,

View File

@ -23,6 +23,10 @@ export const parseFieldRelationType = (
from: 'FROM_MANY_OBJECTS',
to: 'TO_ONE_OBJECT',
},
[RelationMetadataType.ManyToOne]: {
from: 'TO_ONE_OBJECT',
to: 'FROM_MANY_OBJECTS',
},
[RelationMetadataType.OneToOne]: {
from: 'FROM_ONE_OBJECT',
to: 'TO_ONE_OBJECT',

View File

@ -69,7 +69,7 @@ export const SettingsIntegrationEditDatabaseConnectionContent = ({
const connectionName = getConnectionDbName({ integration, connection });
const { isDirty, isValid } = formConfig.formState;
const canSave = !hasSyncedTables && isDirty && isValid;
const canSave = isDirty && isValid && !hasSyncedTables; // order matters here
const handleSave = async () => {
const formValues = formConfig.getValues();

View File

@ -11,7 +11,7 @@ export const mockedRemoteServers = [
},
foreignDataWrapperType: 'postgres_fdw',
userMappingOptions: {
__typename: 'GetUserMappingOptions',
__typename: 'UserMappingOptionsDTO',
username: 'twenty',
},
updatedAt: '2024-04-30T13:41:25.858Z',