Add JSON field type and Event object (#4566)

* Add JSON field type and Event object

* Simplify code

* Adress PR comments and add featureFlag
This commit is contained in:
Félix Malfait
2024-03-19 21:54:08 +01:00
committed by GitHub
parent 4ab426c52a
commit 4bfb90657f
51 changed files with 575 additions and 117 deletions

View File

@@ -183,6 +183,7 @@ export enum FieldMetadataType {
DateTime = 'DATE_TIME',
Email = 'EMAIL',
FullName = 'FULL_NAME',
Json = 'JSON',
Link = 'LINK',
MultiSelect = 'MULTI_SELECT',
Number = 'NUMBER',
@@ -243,7 +244,6 @@ export type Mutation = {
activateWorkspace: Workspace;
challenge: LoginToken;
checkoutSession: SessionEntity;
createEvent: Analytics;
createOneObject: Object;
createOneRefreshToken: RefreshToken;
deleteCurrentWorkspace: Workspace;
@@ -256,6 +256,7 @@ export type Mutation = {
impersonate: Verify;
renewToken: AuthTokens;
signUp: LoginToken;
track: Analytics;
updateOneObject: Object;
updatePasswordViaResetToken: InvalidatePassword;
updateWorkspace: Workspace;
@@ -284,12 +285,6 @@ export type MutationCheckoutSessionArgs = {
};
export type MutationCreateEventArgs = {
data: Scalars['JSON'];
type: Scalars['String'];
};
export type MutationDeleteOneObjectArgs = {
input: DeleteOneObjectInput;
};
@@ -328,6 +323,12 @@ export type MutationSignUpArgs = {
};
export type MutationTrackArgs = {
data: Scalars['JSON'];
type: Scalars['String'];
};
export type MutationUpdatePasswordViaResetTokenArgs = {
newPassword: Scalars['String'];
passwordResetToken: Scalars['String'];
@@ -917,13 +918,13 @@ export type GetTimelineThreadsFromPersonIdQuery = { __typename?: 'Query', getTim
export type TimelineThreadFragment = { __typename?: 'TimelineThread', id: string, subject: string, lastMessageReceivedAt: string };
export type CreateEventMutationVariables = Exact<{
export type TrackMutationVariables = Exact<{
type: Scalars['String'];
data: Scalars['JSON'];
}>;
export type CreateEventMutation = { __typename?: 'Mutation', createEvent: { __typename?: 'Analytics', success: boolean } };
export type TrackMutation = { __typename?: 'Mutation', track: { __typename?: 'Analytics', success: boolean } };
export type AuthTokenFragmentFragment = { __typename?: 'AuthToken', token: string, expiresAt: string };
@@ -1397,40 +1398,40 @@ export function useGetTimelineThreadsFromPersonIdLazyQuery(baseOptions?: Apollo.
export type GetTimelineThreadsFromPersonIdQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromPersonIdQuery>;
export type GetTimelineThreadsFromPersonIdLazyQueryHookResult = ReturnType<typeof useGetTimelineThreadsFromPersonIdLazyQuery>;
export type GetTimelineThreadsFromPersonIdQueryResult = Apollo.QueryResult<GetTimelineThreadsFromPersonIdQuery, GetTimelineThreadsFromPersonIdQueryVariables>;
export const CreateEventDocument = gql`
mutation CreateEvent($type: String!, $data: JSON!) {
createEvent(type: $type, data: $data) {
export const TrackDocument = gql`
mutation Track($type: String!, $data: JSON!) {
track(type: $type, data: $data) {
success
}
}
`;
export type CreateEventMutationFn = Apollo.MutationFunction<CreateEventMutation, CreateEventMutationVariables>;
export type TrackMutationFn = Apollo.MutationFunction<TrackMutation, TrackMutationVariables>;
/**
* __useCreateEventMutation__
* __useTrackMutation__
*
* To run a mutation, you first call `useCreateEventMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useCreateEventMutation` returns a tuple that includes:
* To run a mutation, you first call `useTrackMutation` within a React component and pass it any options that fit your needs.
* When your component renders, `useTrackMutation` 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 [createEventMutation, { data, loading, error }] = useCreateEventMutation({
* const [trackMutation, { data, loading, error }] = useTrackMutation({
* variables: {
* type: // value for 'type'
* data: // value for 'data'
* },
* });
*/
export function useCreateEventMutation(baseOptions?: Apollo.MutationHookOptions<CreateEventMutation, CreateEventMutationVariables>) {
export function useTrackMutation(baseOptions?: Apollo.MutationHookOptions<TrackMutation, TrackMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
return Apollo.useMutation<CreateEventMutation, CreateEventMutationVariables>(CreateEventDocument, options);
return Apollo.useMutation<TrackMutation, TrackMutationVariables>(TrackDocument, options);
}
export type CreateEventMutationHookResult = ReturnType<typeof useCreateEventMutation>;
export type CreateEventMutationResult = Apollo.MutationResult<CreateEventMutation>;
export type CreateEventMutationOptions = Apollo.BaseMutationOptions<CreateEventMutation, CreateEventMutationVariables>;
export type TrackMutationHookResult = ReturnType<typeof useTrackMutation>;
export type TrackMutationResult = Apollo.MutationResult<TrackMutation>;
export type TrackMutationOptions = Apollo.BaseMutationOptions<TrackMutation, TrackMutationVariables>;
export const ChallengeDocument = gql`
mutation Challenge($email: String!, $password: String!) {
challenge(email: $email, password: $password) {