## Query depth deprecation

I'm deprecating depth parameter in our graphql query / cache tooling.
They were obsolete since we introduce the possibility to provide
RecordGqlFields

## Refactor combinedFindManyRecordHook

The hook can now take an array of operationSignatures

## Fix tasks issues

Fix optimistic rendering issue. Note that we still haven't handle
optimisticEffect on creation properly
This commit is contained in:
Charles Bochet
2024-04-29 23:33:23 +02:00
committed by GitHub
parent c946572fde
commit 6a14b1c6d6
187 changed files with 958 additions and 1482 deletions

View File

@ -0,0 +1,16 @@
import { Nullable } from 'twenty-ui';
import { RecordGqlEdge } from '@/object-record/graphql/types/RecordGqlEdge';
export type RecordGqlConnection = {
__typename?: string;
edges: RecordGqlEdge[];
pageInfo: {
hasNextPage?: boolean;
hasPreviousPage?: boolean;
startCursor?: Nullable<string>;
endCursor?: Nullable<string>;
totalCount?: number;
};
totalCount?: number;
};

View File

@ -0,0 +1,7 @@
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
export type RecordGqlEdge = {
__typename: string;
node: RecordGqlNode;
cursor: string;
};

View File

@ -0,0 +1 @@
export type RecordGqlFields = Record<string, any>;

View File

@ -0,0 +1,5 @@
export type RecordGqlNode = {
id: string;
[key: string]: any;
__typename: string;
};

View File

@ -0,0 +1,115 @@
export type UUIDFilterValue = string;
export type IsFilter = 'NULL' | 'NOT_NULL';
export type UUIDFilter = {
eq?: UUIDFilterValue;
in?: UUIDFilterValue[];
neq?: UUIDFilterValue;
is?: IsFilter;
};
export type BooleanFilter = {
eq?: boolean;
is?: IsFilter;
};
export type StringFilter = {
eq?: string;
gt?: string;
gte?: string;
in?: string[];
lt?: string;
lte?: string;
neq?: string;
startsWith?: string;
like?: string;
ilike?: string;
regex?: string;
iregex?: string;
is?: IsFilter;
};
export type FloatFilter = {
eq?: number;
gt?: number;
gte?: number;
in?: number[];
lt?: number;
lte?: number;
neq?: number;
is?: IsFilter;
};
/**
* Always use a DateFilter in the variables of a query, and never directly in the query.
*
* Because pg_graphql only works with ISO strings if it is passed to variables.
*/
export type DateFilter = {
eq?: string;
gt?: string;
gte?: string;
in?: string[];
lt?: string;
lte?: string;
neq?: string;
is?: IsFilter;
};
export type CurrencyFilter = {
amountMicros?: FloatFilter;
};
export type URLFilter = {
url?: StringFilter;
label?: StringFilter;
};
export type FullNameFilter = {
firstName?: StringFilter;
lastName?: StringFilter;
};
export type AddressFilter = {
addressStreet1?: StringFilter;
addressStreet2?: StringFilter;
addressCity?: StringFilter;
addressState?: StringFilter;
addressCountry?: StringFilter;
addressPostcode?: StringFilter;
};
export type LeafFilter =
| UUIDFilter
| StringFilter
| FloatFilter
| DateFilter
| CurrencyFilter
| URLFilter
| FullNameFilter
| BooleanFilter
| AddressFilter
| undefined;
export type AndObjectRecordFilter = {
and?: RecordGqlOperationFilter[];
};
export type OrObjectRecordFilter = {
or?: RecordGqlOperationFilter[] | RecordGqlOperationFilter;
};
export type NotObjectRecordFilter = {
not?: RecordGqlOperationFilter;
};
export type LeafObjectRecordFilter = {
[fieldName: string]: LeafFilter;
};
export type RecordGqlOperationFilter =
| LeafObjectRecordFilter
| AndObjectRecordFilter
| OrObjectRecordFilter
| NotObjectRecordFilter;

View File

@ -0,0 +1,5 @@
import { RecordGqlConnection } from '@/object-record/graphql/types/RecordGqlConnection';
export type RecordGqlOperationFindManyResult = {
[objectNamePlural: string]: RecordGqlConnection;
};

View File

@ -0,0 +1,5 @@
import { RecordGqlNode } from '@/object-record/graphql/types/RecordGqlNode';
export type RecordGqlOperationFindOneResult = {
[objectNameSingular: string]: RecordGqlNode;
};

View File

@ -0,0 +1,3 @@
import { RecordGqlFields } from '@/object-record/graphql/types/RecordGqlFields';
export type RecordGqlOperationGqlRecordFields = RecordGqlFields;

View File

@ -0,0 +1,5 @@
import { OrderBy } from '@/object-metadata/types/OrderBy';
export type RecordGqlOperationOrderBy = {
[fieldName: string]: OrderBy | { [subFieldName: string]: OrderBy };
};

View File

@ -0,0 +1,8 @@
import { RecordGqlOperationGqlRecordFields } from '@/object-record/graphql/types/RecordGqlOperationGqlRecordFields';
import { RecordGqlOperationVariables } from '@/object-record/graphql/types/RecordGqlOperationVariables';
export type RecordGqlOperationSignature = {
objectNameSingular: string;
variables: RecordGqlOperationVariables;
fields?: RecordGqlOperationGqlRecordFields;
};

View File

@ -0,0 +1,5 @@
import { RecordGqlOperationSignature } from '@/object-record/graphql/types/RecordGqlOperationSignature';
export type RecordGqlOperationSignatureFactory = (
factoryParams: any,
) => RecordGqlOperationSignature;

View File

@ -0,0 +1,8 @@
import { RecordGqlOperationFilter } from '@/object-record/graphql/types/RecordGqlOperationFilter';
import { RecordGqlOperationOrderBy } from '@/object-record/graphql/types/RecordGqlOperationOrderBy';
export type RecordGqlOperationVariables = {
filter?: RecordGqlOperationFilter;
orderBy?: RecordGqlOperationOrderBy;
limit?: number;
};

View File

@ -0,0 +1,14 @@
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
export const generateDepthOneRecordGqlFields = ({
objectMetadataItem,
}: {
objectMetadataItem: ObjectMetadataItem;
}) => {
return objectMetadataItem.fields.reduce((acc, field) => {
return {
...acc,
[field.name]: true,
};
}, {});
};