The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Rename mutation maximum affected records (#6042)
Weiko1eb9c582f36e
diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsxindex b9b22f8f66d..6b9b154ce7a 100644--- a/packages/twenty-front/src/generated/graphql.tsx+++ b/packages/twenty-front/src/generated/graphql.tsx@@ -32,7 +32,7 @@ export type Analytics = {export type ApiConfig = {__typename?: 'ApiConfig';- mutationMaximumRecordAffected: Scalars['Float'];+ mutationMaximumAffectedRecords: Scalars['Float'];};export type ApiKeyToken = {@@ -1235,7 +1235,7 @@ export type UpdateBillingSubscriptionMutation = { __typename?: 'Mutation', updatexport type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;-export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, chromeExtensionId?: string | null, 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 }, 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 }, api: { __typename?: 'ApiConfig', mutationMaximumRecordAffected: number } } };+export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, chromeExtensionId?: string | null, 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 }, 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 }, api: { __typename?: 'ApiConfig', mutationMaximumAffectedRecords: number } } };export type SkipSyncEmailOnboardingStepMutationVariables = Exact<{ [key: string]: never; }>;@@ -2362,7 +2362,7 @@ export const GetClientConfigDocument = gql`siteKey}api {- mutationMaximumRecordAffected+ mutationMaximumAffectedRecords}chromeExtensionId}diff --git a/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx b/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsxindex af45dc0fd34..8bec4cc7dbd 100644--- a/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx+++ b/packages/twenty-front/src/modules/client-config/components/ClientConfigProviderEffect.tsx@@ -1,6 +1,7 @@import { useEffect } from 'react';import { useRecoilState, useSetRecoilState } from 'recoil';+import { apiConfigState } from '@/client-config/states/apiConfigState';import { authProvidersState } from '@/client-config/states/authProvidersState';import { billingState } from '@/client-config/states/billingState';import { captchaProviderState } from '@/client-config/states/captchaProviderState';@@ -35,6 +36,8 @@ export const ClientConfigProviderEffect = () => {const setChromeExtensionId = useSetRecoilState(chromeExtensionIdState);+ const setApiConfig = useSetRecoilState(apiConfigState);+const { data, loading } = useGetClientConfigQuery({skip: isClientConfigLoaded,});@@ -68,6 +71,7 @@ export const ClientConfigProviderEffect = () => {});setChromeExtensionId(data?.clientConfig?.chromeExtensionId);+ setApiConfig(data?.clientConfig?.api);}}, [data,@@ -83,6 +87,7 @@ export const ClientConfigProviderEffect = () => {setIsClientConfigLoaded,setCaptchaProvider,setChromeExtensionId,+ setApiConfig,]);return <></>;diff --git a/packages/twenty-front/src/modules/client-config/graphql/queries/getClientConfig.ts b/packages/twenty-front/src/modules/client-config/graphql/queries/getClientConfig.tsindex a7893a55895..3143bbc5f65 100644--- a/packages/twenty-front/src/modules/client-config/graphql/queries/getClientConfig.ts+++ b/packages/twenty-front/src/modules/client-config/graphql/queries/getClientConfig.ts@@ -33,7 +33,7 @@ export const GET_CLIENT_CONFIG = gql`siteKey}api {- mutationMaximumRecordAffected+ mutationMaximumAffectedRecords}chromeExtensionId}diff --git a/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts b/packages/twenty-front/src/modules/client-config/states/apiConfigState.tsnew file mode 100644index 00000000000..9a01493e4f8--- /dev/null+++ b/packages/twenty-front/src/modules/client-config/states/apiConfigState.ts@@ -0,0 +1,8 @@+import { createState } from 'twenty-ui';++import { ApiConfig } from '~/generated/graphql';++export const apiConfigState = createState<ApiConfig | null>({+ key: 'apiConfigState',+ defaultValue: null,+});diff --git a/packages/twenty-server/.env.example b/packages/twenty-server/.env.exampleindex bfe76f8a49d..8f4a61ab9e8 100644--- a/packages/twenty-server/.env.example+++ b/packages/twenty-server/.env.example@@ -70,6 +70,6 @@ SIGN_IN_PREFILLED=true# CAPTCHA_SECRET_KEY=# API_RATE_LIMITING_TTL=# API_RATE_LIMITING_LIMIT=-# MUTATION_MAXIMUM_RECORD_AFFECTED=100+# MUTATION_MAXIMUM_AFFECTED_RECORDS=100# CHROME_EXTENSION_ID=bggmipldbceihilonnbpgoeclgbkblkp# PG_SSL_ALLOW_SELF_SIGNED=truediff --git a/packages/twenty-server/.env.test b/packages/twenty-server/.env.testindex 20bd13ac8ba..fc51ab9e1e2 100644--- a/packages/twenty-server/.env.test+++ b/packages/twenty-server/.env.test@@ -23,4 +23,4 @@ FILE_TOKEN_SECRET=secret_file_token# MESSAGING_PROVIDER_GMAIL_ENABLED=false# STORAGE_TYPE=local# STORAGE_LOCAL_PATH=.local-storage-# MUTATION_MAXIMUM_RECORD_AFFECTED=100+# MUTATION_MAXIMUM_AFFECTED_RECORDS=100diff --git a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.tsindex eeb403b49a6..1a4c690df90 100644--- a/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts+++ b/packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts@@ -432,7 +432,7 @@ export class WorkspaceQueryRunnerService {args.filter?.id?.in?.forEach((id) => assertIsValidUuid(id));const maximumRecordAffected = this.environmentService.get(- 'MUTATION_MAXIMUM_RECORD_AFFECTED',+ 'MUTATION_MAXIMUM_AFFECTED_RECORDS',);const query = await this.workspaceQueryBuilderFactory.updateMany(args, {...options,@@ -484,7 +484,7 @@ export class WorkspaceQueryRunnerService {assertMutationNotOnRemoteObject(objectMetadataItem);const maximumRecordAffected = this.environmentService.get(- 'MUTATION_MAXIMUM_RECORD_AFFECTED',+ 'MUTATION_MAXIMUM_AFFECTED_RECORDS',);const query = await this.workspaceQueryBuilderFactory.deleteMany(args, {...options,@@ -691,7 +691,7 @@ export class WorkspaceQueryRunnerService {errors,{atMost: this.environmentService.get(- 'MUTATION_MAXIMUM_RECORD_AFFECTED',+ 'MUTATION_MAXIMUM_AFFECTED_RECORDS',),} satisfies PgGraphQLConfig,);diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.tsindex 96788bef287..478c89da0cd 100644--- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts+++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.entity.ts@@ -68,7 +68,7 @@ class Captcha {@ObjectType()class ApiConfig {@Field(() => Number, { nullable: false })- mutationMaximumRecordAffected: number;+ mutationMaximumAffectedRecords: number;}@ObjectType()diff --git a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.tsindex 2384e725c2b..c8222a3418f 100644--- a/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts+++ b/packages/twenty-server/src/engine/core-modules/client-config/client-config.resolver.ts@@ -47,8 +47,8 @@ export class ClientConfigResolver {},chromeExtensionId: this.environmentService.get('CHROME_EXTENSION_ID'),api: {- mutationMaximumRecordAffected: this.environmentService.get(- 'MUTATION_MAXIMUM_RECORD_AFFECTED',+ mutationMaximumAffectedRecords: this.environmentService.get(+ 'MUTATION_MAXIMUM_AFFECTED_RECORDS',),},};diff --git a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts b/packages/twenty-server/src/engine/integrations/environment/environment-variables.tsindex f1685bab42c..7bff532c4c1 100644--- a/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts+++ b/packages/twenty-server/src/engine/integrations/environment/environment-variables.ts@@ -324,7 +324,7 @@ export class EnvironmentVariables {@CastToPositiveNumber()@IsOptional()@IsNumber()- MUTATION_MAXIMUM_RECORD_AFFECTED = 100;+ MUTATION_MAXIMUM_AFFECTED_RECORDS = 100;REDIS_HOST = '127.0.0.1';