mirror of
https://github.com/lingble/twenty.git
synced 2025-11-01 21:27:58 +00:00
Fix build linter issues
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { isNonEmptyString } from '@sniptt/guards';
|
||||
import { DateTime } from 'luxon';
|
||||
import { undefined } from 'zod';
|
||||
|
||||
import { Activity } from '@/activities/types/Activity';
|
||||
import { ActivityTargetableEntity } from '@/activities/types/ActivityTargetableEntity';
|
||||
@@ -37,19 +36,19 @@ export const useTasks = (props?: UseTasksProps) => {
|
||||
skip: !entity && !selectedFilter,
|
||||
filter: {
|
||||
completedAt: { is: 'NOT_NULL' },
|
||||
id: isDefined(entity)
|
||||
? {
|
||||
in: activityTargets?.map(
|
||||
(activityTarget) => activityTarget.activityId,
|
||||
),
|
||||
}
|
||||
: undefined,
|
||||
...(isDefined(entity) && {
|
||||
id: {
|
||||
in: activityTargets?.map(
|
||||
(activityTarget) => activityTarget.activityId,
|
||||
),
|
||||
},
|
||||
}),
|
||||
type: { eq: 'Task' },
|
||||
assigneeId: isNonEmptyString(selectedFilter?.value)
|
||||
? {
|
||||
eq: selectedFilter?.value,
|
||||
}
|
||||
: undefined,
|
||||
...(isNonEmptyString(selectedFilter?.value) && {
|
||||
assigneeId: {
|
||||
eq: selectedFilter?.value,
|
||||
},
|
||||
}),
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'DescNullsFirst',
|
||||
@@ -61,19 +60,19 @@ export const useTasks = (props?: UseTasksProps) => {
|
||||
skip: !entity && !selectedFilter,
|
||||
filter: {
|
||||
completedAt: { is: 'NULL' },
|
||||
id: isDefined(entity)
|
||||
? {
|
||||
in: activityTargets?.map(
|
||||
(activityTarget) => activityTarget.activityId,
|
||||
),
|
||||
}
|
||||
: undefined,
|
||||
...(isDefined(entity) && {
|
||||
id: {
|
||||
in: activityTargets?.map(
|
||||
(activityTarget) => activityTarget.activityId,
|
||||
),
|
||||
},
|
||||
}),
|
||||
type: { eq: 'Task' },
|
||||
assigneeId: isNonEmptyString(selectedFilter?.value)
|
||||
? {
|
||||
eq: selectedFilter?.value,
|
||||
}
|
||||
: undefined,
|
||||
...(isNonEmptyString(selectedFilter?.value) && {
|
||||
assigneeId: {
|
||||
eq: selectedFilter?.value,
|
||||
},
|
||||
}),
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'DescNullsFirst',
|
||||
|
||||
@@ -10,6 +10,7 @@ import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadata
|
||||
import { ObjectMetadataItemIdentifier } from '@/object-metadata/types/ObjectMetadataItemIdentifier';
|
||||
import { OrderByField } from '@/object-metadata/types/OrderByField';
|
||||
import { getRecordOptimisticEffectDefinition } from '@/object-record/graphql/optimistic-effect-definition/getRecordOptimisticEffectDefinition';
|
||||
import { ObjectRecordFilter } from '@/object-record/types/ObjectRecordFilter';
|
||||
import { filterUniqueRecordEdgesByCursor } from '@/object-record/utils/filterUniqueRecordEdgesByCursor';
|
||||
import { DEFAULT_SEARCH_REQUEST_LIMIT } from '@/search/hooks/useFilteredSearchEntityQuery';
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
@@ -25,7 +26,6 @@ import {
|
||||
PaginatedRecordTypeResults,
|
||||
} from '../types/PaginatedRecordTypeResults';
|
||||
import { mapPaginatedRecordsToRecords } from '../utils/mapPaginatedRecordsToRecords';
|
||||
import { ObjectRecordFilter } from '@/object-record/types/ObjectRecordFilter';
|
||||
|
||||
export const useFindManyRecords = <
|
||||
RecordType extends { id: string } & Record<string, any>,
|
||||
@@ -140,7 +140,9 @@ export const useFindManyRecords = <
|
||||
|
||||
if (isNonEmptyArray(previousEdges) && isNonEmptyArray(nextEdges)) {
|
||||
newEdges = filterUniqueRecordEdgesByCursor([
|
||||
// eslint-disable-next-line no-unsafe-optional-chaining
|
||||
...prev?.[objectMetadataItem.namePlural]?.edges,
|
||||
// eslint-disable-next-line no-unsafe-optional-chaining
|
||||
...fetchMoreResult?.[objectMetadataItem.namePlural]?.edges,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useRecoilState, useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
|
||||
import { Company } from '@/companies/types/Company';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { turnFiltersIntoObjectRecordFilters } from '@/object-record/utils/turnFiltersIntoWhereClause';
|
||||
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
|
||||
import { useRecordBoardScopedStates } from '@/object-record/record-board/hooks/internal/useRecordBoardScopedStates';
|
||||
import { PaginatedRecordTypeResults } from '@/object-record/types/PaginatedRecordTypeResults';
|
||||
import { turnFiltersIntoObjectRecordFilters } from '@/object-record/utils/turnFiltersIntoWhereClause';
|
||||
import { Opportunity } from '@/pipeline/types/Opportunity';
|
||||
import { PipelineStep } from '@/pipeline/types/PipelineStep';
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { useObjectMetadataItem } from '@/object-metadata/hooks/useObjectMetadataItem';
|
||||
import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObjectNameSingularFromPlural';
|
||||
import { turnFiltersIntoObjectRecordFilters } from '@/object-record/utils/turnFiltersIntoWhereClause';
|
||||
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
|
||||
import { useRecordTableScopedStates } from '@/object-record/record-table/hooks/internal/useRecordTableScopedStates';
|
||||
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
|
||||
import { turnFiltersIntoObjectRecordFilters } from '@/object-record/utils/turnFiltersIntoWhereClause';
|
||||
import { signInBackgroundMockCompanies } from '@/sign-in-background-mock/constants/signInBackgroundMockCompanies';
|
||||
|
||||
import { useFindManyRecords } from './useFindManyRecords';
|
||||
|
||||
@@ -25,7 +25,7 @@ export const turnSortsIntoOrderBy = (
|
||||
[fields[0].name]: 'DescNullsFirst',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
sorts.forEach((sort) => {
|
||||
const correspondingField = fields.find(
|
||||
(field) => field.id === sort.fieldMetadataId,
|
||||
|
||||
@@ -2,12 +2,12 @@ import { RecordBoardScopeInternalContext } from '@/object-record/record-board/sc
|
||||
import { getRecordBoardScopedStates } from '@/object-record/record-board/utils/getRecordBoardScopedStates';
|
||||
import { useAvailableScopeIdOrThrow } from '@/ui/utilities/recoil-scope/scopes-internal/hooks/useAvailableScopeId';
|
||||
|
||||
type useRecordBoardScopedStates = {
|
||||
type useRecordBoardScopedStatesProps = {
|
||||
recordBoardScopeId?: string;
|
||||
};
|
||||
|
||||
export const useRecordBoardScopedStates = (
|
||||
args?: useRecordBoardScopedStates,
|
||||
args?: useRecordBoardScopedStatesProps,
|
||||
) => {
|
||||
const { recordBoardScopeId } = args ?? {};
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ScopedStateKey } from '@/ui/utilities/recoil-scope/scopes-internal/types/ScopedStateKey';
|
||||
import { createScopeInternalContext } from '@/ui/utilities/recoil-scope/scopes-internal/utils/createScopeInternalContext';
|
||||
|
||||
type RecordBoardScopeInternalContext = ScopedStateKey;
|
||||
type RecordBoardScopeInternalContextType = ScopedStateKey;
|
||||
|
||||
export const RecordBoardScopeInternalContext =
|
||||
createScopeInternalContext<RecordBoardScopeInternalContext>();
|
||||
createScopeInternalContext<RecordBoardScopeInternalContextType>();
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { IconPlus, IconSettings } from '@/ui/display/icon';
|
||||
import { IconSettings } from '@/ui/display/icon';
|
||||
import { useLazyLoadIcons } from '@/ui/input/hooks/useLazyLoadIcons';
|
||||
import { DropdownMenuItemsContainer } from '@/ui/layout/dropdown/components/DropdownMenuItemsContainer';
|
||||
import { DropdownMenuSeparator } from '@/ui/layout/dropdown/components/DropdownMenuSeparator';
|
||||
|
||||
@@ -36,7 +36,6 @@ export type FloatFilter = {
|
||||
is?: IsFilter;
|
||||
};
|
||||
|
||||
|
||||
export type DateFilter = {
|
||||
eq?: string;
|
||||
gt?: string;
|
||||
@@ -61,12 +60,21 @@ export type FullNameFilter = {
|
||||
lastName?: StringFilter;
|
||||
};
|
||||
|
||||
export type LeafFilter = UUIDFilter | StringFilter | FloatFilter | DateFilter | CurrencyFilter | URLFilter | FullNameFilter
|
||||
export type LeafFilter =
|
||||
| UUIDFilter
|
||||
| StringFilter
|
||||
| FloatFilter
|
||||
| DateFilter
|
||||
| CurrencyFilter
|
||||
| URLFilter
|
||||
| FullNameFilter;
|
||||
|
||||
export type ObjectRecordFilter = {
|
||||
and?: ObjectRecordFilter[];
|
||||
or?: ObjectRecordFilter[];
|
||||
not?: ObjectRecordFilter;
|
||||
} | {
|
||||
[fieldName: string]: LeafFilter
|
||||
}
|
||||
export type ObjectRecordFilter =
|
||||
| {
|
||||
and?: ObjectRecordFilter[];
|
||||
or?: ObjectRecordFilter[];
|
||||
not?: ObjectRecordFilter;
|
||||
}
|
||||
| {
|
||||
[fieldName: string]: LeafFilter;
|
||||
};
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
import {
|
||||
CurrencyFilter,
|
||||
DateFilter,
|
||||
FloatFilter,
|
||||
FullNameFilter,
|
||||
ObjectRecordFilter,
|
||||
StringFilter,
|
||||
URLFilter,
|
||||
} from '@/object-record/types/ObjectRecordFilter';
|
||||
import { ViewFilterOperand } from '@/views/types/ViewFilterOperand';
|
||||
import { Field } from '~/generated/graphql';
|
||||
|
||||
import { Filter } from '../object-filter-dropdown/types/Filter';
|
||||
import { CurrencyFilter, DateFilter, FloatFilter, FullNameFilter, ObjectRecordFilter, StringFilter, URLFilter } from '@/object-record/types/ObjectRecordFilter';
|
||||
|
||||
export type RawUIFilter = Omit<Filter, 'definition'> & {
|
||||
definition: {
|
||||
@@ -16,11 +24,11 @@ export const turnFiltersIntoObjectRecordFilters = (
|
||||
): ObjectRecordFilter => {
|
||||
const objectRecordFilters: ObjectRecordFilter[] = [];
|
||||
|
||||
for(const rawUIFilter of rawUIFilters) {
|
||||
for (const rawUIFilter of rawUIFilters) {
|
||||
const correspondingField = fields.find(
|
||||
(field) => field.id === rawUIFilter.fieldMetadataId,
|
||||
);
|
||||
|
||||
|
||||
if (!correspondingField) {
|
||||
throw new Error(
|
||||
`Could not find field ${rawUIFilter.fieldMetadataId} in metadata object`,
|
||||
@@ -38,7 +46,7 @@ export const turnFiltersIntoObjectRecordFilters = (
|
||||
ilike: `%${rawUIFilter.value}%`,
|
||||
} as StringFilter,
|
||||
});
|
||||
break
|
||||
break;
|
||||
case ViewFilterOperand.DoesNotContain:
|
||||
objectRecordFilters.push({
|
||||
not: {
|
||||
@@ -47,7 +55,7 @@ export const turnFiltersIntoObjectRecordFilters = (
|
||||
} as StringFilter,
|
||||
},
|
||||
});
|
||||
break
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
`Unknown operand ${rawUIFilter.operand} for ${rawUIFilter.definition.type} filter`,
|
||||
@@ -107,6 +115,7 @@ export const turnFiltersIntoObjectRecordFilters = (
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const parsedRecordIds = JSON.parse(rawUIFilter.value) as string[];
|
||||
|
||||
if (parsedRecordIds.length > 0) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { Account } from '@/accounts/types/Account';
|
||||
import { Account } from '@/accounts/interface/Account';
|
||||
import { IconAt, IconPlus } from '@/ui/display/icon';
|
||||
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
||||
import { Card } from '@/ui/layout/card/components/Card';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { Account } from '@/accounts/types/Account';
|
||||
import { Account } from '@/accounts/interface/Account';
|
||||
import { IconDotsVertical, IconMail, IconTrash } from '@/ui/display/icon';
|
||||
import { IconGoogle } from '@/ui/display/icon/components/IconGoogle';
|
||||
import { LightIconButton } from '@/ui/input/button/components/LightIconButton';
|
||||
|
||||
@@ -11,8 +11,8 @@ const meta: Meta<typeof Card> = {
|
||||
title: 'UI/Layout/Card/Card',
|
||||
component: Card,
|
||||
decorators: [ComponentDecorator],
|
||||
render: (args) => (
|
||||
<Card {...args}>
|
||||
render: () => (
|
||||
<Card>
|
||||
<CardHeader>Lorem ipsum</CardHeader>
|
||||
<CardContent>
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id massa
|
||||
|
||||
@@ -42,11 +42,9 @@ export const SettingsDevelopersApiKeys = () => {
|
||||
|
||||
const [apiKeys, setApiKeys] = useState<Array<ApiFieldItem>>([]);
|
||||
|
||||
const filter = { revokedAt: { is: 'NULL' } };
|
||||
|
||||
useFindManyRecords({
|
||||
objectNameSingular: 'apiKey',
|
||||
filter,
|
||||
filter: { revokedAt: { is: 'NULL' } },
|
||||
orderBy: {},
|
||||
onCompleted: (data) => {
|
||||
setApiKeys(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Account } from '@/accounts/types/Account';
|
||||
import { Account } from '@/accounts/interface/Account';
|
||||
|
||||
export const mockedAccounts: Account[] = [
|
||||
{ email: 'thomas@twenty.com', uuid: '0794b782-f52e-48c3-977e-b0f57f90de24' },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
PG_MAIN_VERSION=15
|
||||
PG_GRAPHQL_VERSION=1.4.2
|
||||
PG_GRAPHQL_VERSION=1.3.0
|
||||
|
||||
current_directory=$(pwd)
|
||||
|
||||
@@ -9,11 +9,11 @@ echo "Step [1/4]: Installing PostgreSQL..."
|
||||
brew reinstall postgresql@$PG_MAIN_VERSION
|
||||
|
||||
echo "Step [2/4]: Installing GraphQL for PostgreSQL..."
|
||||
cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql--${PG_GRAPHQL_VERSION}.sql \
|
||||
cp ./macos/intel/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql--${PG_GRAPHQL_VERSION}.sql \
|
||||
/usr/local/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
|
||||
cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.control \
|
||||
cp ./macos/intel/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.control \
|
||||
/usr/local/opt/postgresql@${PG_MAIN_VERSION}/share/postgresql@${PG_MAIN_VERSION}/extension
|
||||
cp ./macos/arm/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.so \
|
||||
cp ./macos/intel/${PG_MAIN_VERSION}/pg_graphql/${PG_GRAPHQL_VERSION}/pg_graphql.so \
|
||||
/usr/local/opt/postgresql@${PG_MAIN_VERSION}/lib/postgresql
|
||||
|
||||
export PATH="/usr/local/opt/postgresql@${PG_MAIN_VERSION}/bin:$PATH"
|
||||
|
||||
@@ -60,9 +60,8 @@ export class WorkspaceFactory {
|
||||
}
|
||||
|
||||
// Get typeDefs from cache
|
||||
let typeDefs = await this.workspaceSchemaStorageService.getTypeDefs(
|
||||
workspaceId,
|
||||
);
|
||||
let typeDefs =
|
||||
await this.workspaceSchemaStorageService.getTypeDefs(workspaceId);
|
||||
let usedScalarNames =
|
||||
await this.workspaceSchemaStorageService.getUsedScalarNames(workspaceId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user