mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-25 13:02:15 +03:00
Rename types for UserMappingOptions (#5230)
Following #5210 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
parent
0bc3b6f179
commit
e0ece3c917
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
@ -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',
|
||||
|
@ -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();
|
||||
|
@ -11,7 +11,7 @@ export const mockedRemoteServers = [
|
||||
},
|
||||
foreignDataWrapperType: 'postgres_fdw',
|
||||
userMappingOptions: {
|
||||
__typename: 'GetUserMappingOptions',
|
||||
__typename: 'UserMappingOptionsDTO',
|
||||
username: 'twenty',
|
||||
},
|
||||
updatedAt: '2024-04-30T13:41:25.858Z',
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
ForeignDataWrapperOptions,
|
||||
RemoteServerType,
|
||||
} from 'src/engine/metadata-modules/remote-server/remote-server.entity';
|
||||
import { UserMappingOptionsInput } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import { UserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
|
||||
@Injectable()
|
||||
export class ForeignDataWrapperQueryFactory {
|
||||
@ -39,7 +39,7 @@ export class ForeignDataWrapperQueryFactory {
|
||||
|
||||
createUserMapping(
|
||||
foreignDataWrapperId: string,
|
||||
userMappingOptions: UserMappingOptionsInput,
|
||||
userMappingOptions: UserMappingOptions,
|
||||
) {
|
||||
// CURRENT_USER works for now since we are using only one user. But if we switch to a user per workspace, we need to change this.
|
||||
return `CREATE USER MAPPING IF NOT EXISTS FOR CURRENT_USER SERVER "${foreignDataWrapperId}" OPTIONS (user '${userMappingOptions.username}', password '${userMappingOptions.password}')`;
|
||||
@ -47,7 +47,7 @@ export class ForeignDataWrapperQueryFactory {
|
||||
|
||||
updateUserMapping(
|
||||
foreignDataWrapperId: string,
|
||||
userMappingOptions: Partial<UserMappingOptionsInput>,
|
||||
userMappingOptions: Partial<UserMappingOptions>,
|
||||
) {
|
||||
const options = this.buildUpdateUserMappingOptions(userMappingOptions);
|
||||
|
||||
@ -82,7 +82,7 @@ export class ForeignDataWrapperQueryFactory {
|
||||
}
|
||||
|
||||
private buildUpdateUserMappingOptions(
|
||||
userMappingOptions?: Partial<UserMappingOptionsInput>,
|
||||
userMappingOptions?: Partial<UserMappingOptions>,
|
||||
) {
|
||||
const setStatements: string[] = [];
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable no-console */
|
||||
import { ExceptionHandlerUser } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-user.interface';
|
||||
import { ExceptionHandlerOptions } from 'src/engine/integrations/exception-handler/interfaces/exception-handler-options.interface';
|
||||
|
||||
|
@ -20,7 +20,6 @@ export const validateObjectMetadataInput = <
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof InvalidStringException) {
|
||||
console.error(error.message);
|
||||
throw new BadRequestException(
|
||||
`Characters used in name "${objectMetadataInput.nameSingular}" or "${objectMetadataInput.namePlural}" are not supported`,
|
||||
);
|
||||
|
@ -58,7 +58,6 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
validateMetadataName(relationMetadataInput.toName);
|
||||
} catch (error) {
|
||||
if (error instanceof InvalidStringException) {
|
||||
console.error(error.message);
|
||||
throw new BadRequestException(
|
||||
`Characters used in name "${relationMetadataInput.fromName}" or "${relationMetadataInput.toName}" are not supported`,
|
||||
);
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
ForeignDataWrapperOptions,
|
||||
RemoteServerType,
|
||||
} from 'src/engine/metadata-modules/remote-server/remote-server.entity';
|
||||
import { UserMappingOptionsInput } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import { UserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
|
||||
@InputType()
|
||||
export class CreateRemoteServerInput<T extends RemoteServerType> {
|
||||
@ -18,8 +18,8 @@ export class CreateRemoteServerInput<T extends RemoteServerType> {
|
||||
foreignDataWrapperOptions: ForeignDataWrapperOptions<T>;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => UserMappingOptionsInput, { nullable: true })
|
||||
userMappingOptions?: UserMappingOptionsInput;
|
||||
@Field(() => UserMappingOptions, { nullable: true })
|
||||
userMappingOptions?: UserMappingOptions;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
|
@ -3,11 +3,11 @@ import { ObjectType, Field, HideField, ID } from '@nestjs/graphql';
|
||||
import { IsOptional } from 'class-validator';
|
||||
import GraphQLJSON from 'graphql-type-json';
|
||||
|
||||
import { UserMappingOptionsDTO } from 'src/engine/metadata-modules/remote-server/dtos/user-mapping-dto';
|
||||
import {
|
||||
ForeignDataWrapperOptions,
|
||||
RemoteServerType,
|
||||
} from 'src/engine/metadata-modules/remote-server/remote-server.entity';
|
||||
import { GetUserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
|
||||
@ObjectType('RemoteServer')
|
||||
export class RemoteServerDTO<T extends RemoteServerType> {
|
||||
@ -25,8 +25,8 @@ export class RemoteServerDTO<T extends RemoteServerType> {
|
||||
foreignDataWrapperOptions?: ForeignDataWrapperOptions<T>;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => GetUserMappingOptions, { nullable: true })
|
||||
userMappingOptions?: GetUserMappingOptions;
|
||||
@Field(() => UserMappingOptionsDTO, { nullable: true })
|
||||
userMappingOptions?: UserMappingOptionsDTO;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
|
@ -7,7 +7,10 @@ import {
|
||||
ForeignDataWrapperOptions,
|
||||
RemoteServerType,
|
||||
} from 'src/engine/metadata-modules/remote-server/remote-server.entity';
|
||||
import { UserMappingOptionsInput } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import {
|
||||
UserMappingOptions,
|
||||
UserMappingOptionsUpdateInput,
|
||||
} from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
|
||||
@InputType()
|
||||
export class UpdateRemoteServerInput<T extends RemoteServerType> {
|
||||
@ -19,8 +22,8 @@ export class UpdateRemoteServerInput<T extends RemoteServerType> {
|
||||
foreignDataWrapperOptions?: Partial<ForeignDataWrapperOptions<T>>;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => UserMappingOptionsInput, { nullable: true })
|
||||
userMappingOptions?: Partial<UserMappingOptionsInput>;
|
||||
@Field(() => UserMappingOptionsUpdateInput, { nullable: true })
|
||||
userMappingOptions?: Partial<UserMappingOptions>;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
|
@ -0,0 +1,10 @@
|
||||
import { ObjectType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { IsOptional } from 'class-validator';
|
||||
|
||||
@ObjectType('UserMappingOptionsUsername')
|
||||
export class UserMappingOptionsDTO {
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
username: string;
|
||||
}
|
@ -10,7 +10,7 @@ import {
|
||||
} from 'typeorm';
|
||||
|
||||
import { RemoteTableEntity } from 'src/engine/metadata-modules/remote-server/remote-table/remote-table.entity';
|
||||
import { UserMappingOptionsInput as UserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import { UserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import { DistantTables } from 'src/engine/metadata-modules/remote-server/remote-table/distant-table/types/distant-table';
|
||||
|
||||
export enum RemoteServerType {
|
||||
|
@ -6,7 +6,7 @@ import {
|
||||
RemoteServerEntity,
|
||||
RemoteServerType,
|
||||
} from 'src/engine/metadata-modules/remote-server/remote-server.entity';
|
||||
import { UserMappingOptionsInput } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
import { UserMappingOptions } from 'src/engine/metadata-modules/remote-server/utils/user-mapping-options.utils';
|
||||
|
||||
export type DeepPartial<T> = {
|
||||
[P in keyof T]?: DeepPartial<T[P]>;
|
||||
@ -15,7 +15,7 @@ export type DeepPartial<T> = {
|
||||
const buildUserMappingOptionsQuery = (
|
||||
parameters: any[],
|
||||
parametersPositions: object,
|
||||
userMappingOptions: DeepPartial<UserMappingOptionsInput>,
|
||||
userMappingOptions: DeepPartial<UserMappingOptions>,
|
||||
): string | null => {
|
||||
const shouldUpdateUserMappingOptionsPassword = isDefined(
|
||||
userMappingOptions?.password,
|
||||
|
@ -2,8 +2,9 @@ import { InputType, Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { IsOptional } from 'class-validator';
|
||||
|
||||
@ObjectType()
|
||||
@InputType()
|
||||
export class UserMappingOptionsInput {
|
||||
export class UserMappingOptions {
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
username: string;
|
||||
@ -13,9 +14,13 @@ export class UserMappingOptionsInput {
|
||||
password: string;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class GetUserMappingOptions {
|
||||
@InputType()
|
||||
export class UserMappingOptionsUpdateInput {
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
username: string;
|
||||
username?: string;
|
||||
|
||||
@IsOptional()
|
||||
@Field(() => String, { nullable: true })
|
||||
password?: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user