The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Block uninstalling a server route app from its owner workspace while installed elsewhere (#27510)
martmull5076e524e6ad
diff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql b/packages/twenty-client-sdk/src/metadata/generated/schema.graphqlindex ff1e8d65fc2..8d439652cd6 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.graphql+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.graphql@@ -345,6 +345,7 @@ type Application {frontComponents: [FrontComponent!]!healthCheckLogicFunctionId: UUIDid: UUID!+ isUninstallBlockedByOtherWorkspaceInstallations: Boolean!logicFunctions: [LogicFunction!]!logoFileId: UUIDlogoUrl: Stringdiff --git a/packages/twenty-client-sdk/src/metadata/generated/schema.ts b/packages/twenty-client-sdk/src/metadata/generated/schema.tsindex 223bd44930b..ef8001ca77a 100644--- a/packages/twenty-client-sdk/src/metadata/generated/schema.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/schema.ts@@ -268,6 +268,7 @@ export interface Application {frontComponents: FrontComponent[]healthCheckLogicFunctionId?: Scalars['UUID']id: Scalars['UUID']+ isUninstallBlockedByOtherWorkspaceInstallations: Scalars['Boolean']logicFunctions: LogicFunction[]logoFileId?: Scalars['UUID']logoUrl?: Scalars['String']@@ -4171,6 +4172,7 @@ export interface ApplicationGenqlSelection{frontComponents?: FrontComponentGenqlSelectionhealthCheckLogicFunctionId?: boolean | numberid?: boolean | number+ isUninstallBlockedByOtherWorkspaceInstallations?: boolean | numberlogicFunctions?: LogicFunctionGenqlSelectionlogoFileId?: boolean | numberlogoUrl?: boolean | numberdiff --git a/packages/twenty-client-sdk/src/metadata/generated/types.ts b/packages/twenty-client-sdk/src/metadata/generated/types.tsindex 07b2752019f..b4ac241928f 100644--- a/packages/twenty-client-sdk/src/metadata/generated/types.ts+++ b/packages/twenty-client-sdk/src/metadata/generated/types.ts@@ -779,6 +779,9 @@ export default {"id": [482],+ "isUninstallBlockedByOtherWorkspaceInstallations": [+ 4+ ],"logicFunctions": [299],diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.tsindex 3a40800ab6d..f2b0f413032 100644--- a/packages/twenty-front/src/generated-metadata/graphql.ts+++ b/packages/twenty-front/src/generated-metadata/graphql.ts@@ -385,6 +385,7 @@ export type Application = {frontComponents: Array<FrontComponent>;healthCheckLogicFunctionId?: Maybe<Scalars['UUID']['output']>;id: Scalars['UUID']['output'];+ isUninstallBlockedByOtherWorkspaceInstallations: Scalars['Boolean']['output'];logicFunctions: Array<LogicFunction>;logoFileId?: Maybe<Scalars['UUID']['output']>;logoUrl?: Maybe<Scalars['String']['output']>;@@ -8357,7 +8358,7 @@ export type FindOneApplicationQueryVariables = Exact<{}>;-export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, healthCheckLogicFunctionId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, label: string, isSecret: boolean, isDeprecated: boolean, isRequired: boolean, type: string, options?: any | null, scope: ApplicationVariableScope }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, isSystem: boolean, modelConfiguration?: any | null, triggers: Array<any>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, settingsMenuItems?: Array<{ __typename?: 'SettingsMenuItem', id: string, universalIdentifier: string, applicationId: string, frontComponentId: string, title: string, icon?: string | null, position: number, scope: SettingsMenuItemScope }> | null, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, writability: MetadataWritability, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, sharingReach: ObjectSharingReach, readability: MetadataReadability, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, writability?: MetadataWritability | null, isNullable?: boolean | null, isUnique?: boolean | null, isSearchable?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> } };+export type FindOneApplicationQuery = { __typename?: 'Query', findOneApplication: { __typename?: 'Application', isUninstallBlockedByOtherWorkspaceInstallations: boolean, id: string, name: string, description?: string | null, logoUrl?: string | null, version?: string | null, universalIdentifier: string, applicationRegistrationId?: string | null, canBeUninstalled: boolean, autoUpgrade: boolean, defaultRoleId?: string | null, settingsCustomTabFrontComponentId?: string | null, healthCheckLogicFunctionId?: string | null, availablePackages: any, applicationRegistration?: { __typename?: 'ApplicationRegistrationSummary', id: string, latestAvailableVersion?: string | null, sourceType: ApplicationRegistrationSourceType, logoUrl?: string | null } | null, applicationVariables: Array<{ __typename?: 'ApplicationVariable', id: string, key: string, value: string, description: string, label: string, isSecret: boolean, isDeprecated: boolean, isRequired: boolean, type: string, options?: any | null, scope: ApplicationVariableScope }>, agents: Array<{ __typename?: 'Agent', id: string, name: string, label: string, description?: string | null, icon?: string | null, prompt: string, modelId: string, responseFormat?: any | null, roleId?: string | null, isCustom: boolean, isSystem: boolean, modelConfiguration?: any | null, triggers: Array<any>, applicationId?: string | null, createdAt: string, updatedAt: string }>, frontComponents: Array<{ __typename?: 'FrontComponent', id: string, name: string, description?: string | null, applicationId: string, componentName: string, builtComponentChecksum: string, universalIdentifier?: string | null, isHeadless: boolean, usesSdkClient: boolean, frontComponentSharedDependenciesChecksum?: string | null, createdAt: string, updatedAt: string }>, commandMenuItems: Array<{ __typename?: 'CommandMenuItem', id: string, label: string, shortLabel?: string | null, icon?: string | null, isPinned: boolean, availabilityType: CommandMenuItemAvailabilityType, conditionalAvailabilityExpression?: string | null, frontComponentId?: string | null, universalIdentifier?: string | null, applicationId?: string | null, createdAt: string, updatedAt: string }>, settingsMenuItems?: Array<{ __typename?: 'SettingsMenuItem', id: string, universalIdentifier: string, applicationId: string, frontComponentId: string, title: string, icon?: string | null, position: number, scope: SettingsMenuItemScope }> | null, objects: Array<{ __typename?: 'Object', id: string, universalIdentifier: string, nameSingular: string, namePlural: string, labelSingular: string, labelPlural: string, color?: string | null, description?: string | null, icon?: string | null, isRemote: boolean, isActive: boolean, isSystem: boolean, isUIEditable: boolean, isUICreatable: boolean, writability: MetadataWritability, createdAt: string, updatedAt: string, labelIdentifierFieldMetadataId?: string | null, imageIdentifierFieldMetadataId?: string | null, applicationId: string, shortcut?: string | null, isLabelSyncedWithName: boolean, isSearchable: boolean, openRecordIn: ObjectOpenRecordIn, sharingReach: ObjectSharingReach, readability: MetadataReadability, duplicateCriteria?: Array<Array<string>> | null, searchFieldMetadataList: Array<{ __typename?: 'SearchField', id: string, fieldMetadataId: string, tsVectorFieldMetadataId: string, position: number, createdAt: string, updatedAt: string }>, indexMetadataList: Array<{ __typename?: 'Index', id: string, createdAt: string, updatedAt: string, name: string, indexWhereClause?: string | null, indexType: IndexType, isUnique: boolean, isCustom?: boolean | null, indexFieldMetadataList: Array<{ __typename?: 'IndexField', id: string, fieldMetadataId: string, subFieldName?: string | null, createdAt: string, updatedAt: string, order: number }> }>, fieldsList: Array<{ __typename?: 'Field', id: string, universalIdentifier: string, type: FieldMetadataType, name: string, label: string, description?: string | null, icon?: string | null, isActive?: boolean | null, isSystem?: boolean | null, isUIEditable?: boolean | null, writability?: MetadataWritability | null, isNullable?: boolean | null, isUnique?: boolean | null, isSearchable?: boolean | null, createdAt: string, updatedAt: string, defaultValue?: any | null, options?: any | null, settings?: any | null, isLabelSyncedWithName?: boolean | null, morphId?: string | null, applicationId: string, relation?: { __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } } | null, morphRelations?: Array<{ __typename?: 'Relation', type: RelationType, sourceObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, targetObjectMetadata: { __typename?: 'Object', id: string, nameSingular: string, namePlural: string }, sourceFieldMetadata: { __typename?: 'Field', id: string, name: string }, targetFieldMetadata: { __typename?: 'Field', id: string, name: string } }> | null }> }>, logicFunctions: Array<{ __typename?: 'LogicFunction', id: string, name: string, description?: string | null, runtime: string, timeoutSeconds: number, executionMode: LogicFunctionExecutionMode, sourceHandlerPath: string, handlerName: string, cronTriggerSettings?: any | null, databaseEventTriggerSettings?: any | null, httpRouteTriggerSettings?: any | null, toolTriggerSettings?: any | null, workflowActionTriggerSettings?: any | null, applicationId?: string | null, universalIdentifier?: string | null, createdAt: string, updatedAt: string }> } };export type FindOneApplicationByUniversalIdentifierQueryVariables = Exact<{universalIdentifier: Scalars['UUID']['input'];@@ -10838,7 +10839,7 @@ export const OnAgentChatEventDocument = {"kind":"Document","definitions":[{"kindexport const TrackAnalyticsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TrackAnalytics"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"type"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AnalyticsType"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"event"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"name"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"properties"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JSON"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"trackAnalytics"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"type"},"value":{"kind":"Variable","name":{"kind":"Name","value":"type"}}},{"kind":"Argument","name":{"kind":"Name","value":"event"},"value":{"kind":"Variable","name":{"kind":"Name","value":"event"}}},{"kind":"Argument","name":{"kind":"Name","value":"name"},"value":{"kind":"Variable","name":{"kind":"Name","value":"name"}}},{"kind":"Argument","name":{"kind":"Name","value":"properties"},"value":{"kind":"Variable","name":{"kind":"Name","value":"properties"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode<TrackAnalyticsMutation, TrackAnalyticsMutationVariables>;export const RunApplicationHealthCheckDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RunApplicationHealthCheck"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"applicationId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"runApplicationHealthCheck"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"applicationId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"applicationId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"action"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"location"}}]}}]}}]}}]} as unknown as DocumentNode<RunApplicationHealthCheckMutation, RunApplicationHealthCheckMutationVariables>;export const FindManyApplicationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindManyApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findManyApplications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}}]}}]}}]}}]} as unknown as DocumentNode<FindManyApplicationsQuery, FindManyApplicationsQueryVariables>;-export const FindOneApplicationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplication"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ApplicationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"sharingReach"}},{"kind":"Field","name":{"kind":"Name","value":"readability"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"healthCheckLogicFunctionId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"isDeprecated"}},{"kind":"Field","name":{"kind":"Name","value":"isRequired"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"settingsMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationQuery, FindOneApplicationQueryVariables>;+export const FindOneApplicationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplication"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ApplicationFields"}},{"kind":"Field","name":{"kind":"Name","value":"isUninstallBlockedByOtherWorkspaceInstallations"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AgentFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Agent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"prompt"}},{"kind":"Field","name":{"kind":"Name","value":"modelId"}},{"kind":"Field","name":{"kind":"Name","value":"responseFormat"}},{"kind":"Field","name":{"kind":"Name","value":"roleId"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"modelConfiguration"}},{"kind":"Field","name":{"kind":"Name","value":"triggers"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ObjectMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Object"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}},{"kind":"Field","name":{"kind":"Name","value":"labelSingular"}},{"kind":"Field","name":{"kind":"Name","value":"labelPlural"}},{"kind":"Field","name":{"kind":"Name","value":"color"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isRemote"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"isUICreatable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"labelIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"imageIdentifierFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"shortcut"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"openRecordIn"}},{"kind":"Field","name":{"kind":"Name","value":"sharingReach"}},{"kind":"Field","name":{"kind":"Name","value":"readability"}},{"kind":"Field","name":{"kind":"Name","value":"duplicateCriteria"}},{"kind":"Field","name":{"kind":"Name","value":"searchFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"tsVectorFieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"indexMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"indexWhereClause"}},{"kind":"Field","name":{"kind":"Name","value":"indexType"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isCustom"}},{"kind":"Field","name":{"kind":"Name","value":"indexFieldMetadataList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fieldMetadataId"}},{"kind":"Field","name":{"kind":"Name","value":"subFieldName"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"order"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"fieldsList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isUIEditable"}},{"kind":"Field","name":{"kind":"Name","value":"writability"}},{"kind":"Field","name":{"kind":"Name","value":"isNullable"}},{"kind":"Field","name":{"kind":"Name","value":"isUnique"}},{"kind":"Field","name":{"kind":"Name","value":"isSearchable"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"settings"}},{"kind":"Field","name":{"kind":"Name","value":"isLabelSyncedWithName"}},{"kind":"Field","name":{"kind":"Name","value":"morphId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"relation"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"morphRelations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"sourceObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetObjectMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"nameSingular"}},{"kind":"Field","name":{"kind":"Name","value":"namePlural"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sourceFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"targetFieldMetadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"LogicFunctionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LogicFunction"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"runtime"}},{"kind":"Field","name":{"kind":"Name","value":"timeoutSeconds"}},{"kind":"Field","name":{"kind":"Name","value":"executionMode"}},{"kind":"Field","name":{"kind":"Name","value":"sourceHandlerPath"}},{"kind":"Field","name":{"kind":"Name","value":"handlerName"}},{"kind":"Field","name":{"kind":"Name","value":"cronTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"databaseEventTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"httpRouteTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"toolTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"workflowActionTriggerSettings"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ApplicationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Application"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistrationId"}},{"kind":"Field","name":{"kind":"Name","value":"applicationRegistration"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"latestAvailableVersion"}},{"kind":"Field","name":{"kind":"Name","value":"sourceType"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"canBeUninstalled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpgrade"}},{"kind":"Field","name":{"kind":"Name","value":"defaultRoleId"}},{"kind":"Field","name":{"kind":"Name","value":"settingsCustomTabFrontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"healthCheckLogicFunctionId"}},{"kind":"Field","name":{"kind":"Name","value":"availablePackages"}},{"kind":"Field","name":{"kind":"Name","value":"applicationVariables"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"key"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"isSecret"}},{"kind":"Field","name":{"kind":"Name","value":"isDeprecated"}},{"kind":"Field","name":{"kind":"Name","value":"isRequired"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"options"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}}]}},{"kind":"Field","name":{"kind":"Name","value":"agents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AgentFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"frontComponents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"componentName"}},{"kind":"Field","name":{"kind":"Name","value":"builtComponentChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"isHeadless"}},{"kind":"Field","name":{"kind":"Name","value":"usesSdkClient"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentSharedDependenciesChecksum"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"commandMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"shortLabel"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"isPinned"}},{"kind":"Field","name":{"kind":"Name","value":"availabilityType"}},{"kind":"Field","name":{"kind":"Name","value":"conditionalAvailabilityExpression"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"settingsMenuItems"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"applicationId"}},{"kind":"Field","name":{"kind":"Name","value":"frontComponentId"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"icon"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"scope"}}]}},{"kind":"Field","name":{"kind":"Name","value":"objects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ObjectMetadataFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"logicFunctions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"LogicFunctionFields"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationQuery, FindOneApplicationQueryVariables>;export const FindOneApplicationByUniversalIdentifierDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationByUniversalIdentifier"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"universalIdentifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"universalIdentifier"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"logoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"version"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationByUniversalIdentifierQuery, FindOneApplicationByUniversalIdentifierQueryVariables>;export const FindOneApplicationNameDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationName"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationNameQuery, FindOneApplicationNameQueryVariables>;export const FindOneApplicationSummaryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FindOneApplicationSummary"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UUID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"findOneApplication"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"universalIdentifier"},"value":{"kind":"Variable","name":{"kind":"Name","value":"universalIdentifier"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<FindOneApplicationSummaryQuery, FindOneApplicationSummaryQueryVariables>;diff --git a/packages/twenty-front/src/modules/applications/graphql/queries/findOneApplication.ts b/packages/twenty-front/src/modules/applications/graphql/queries/findOneApplication.tsindex aa79dd21a3a..637aee8f2fc 100644--- a/packages/twenty-front/src/modules/applications/graphql/queries/findOneApplication.ts+++ b/packages/twenty-front/src/modules/applications/graphql/queries/findOneApplication.ts@@ -6,6 +6,7 @@ export const FIND_ONE_APPLICATION = gql`query FindOneApplication($id: UUID!) {findOneApplication(id: $id) {...ApplicationFields+ isUninstallBlockedByOtherWorkspaceInstallations}}`;diff --git a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant.ts b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant.tsindex 1cf4e62caf1..ef7d8b75110 100644--- a/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant.ts+++ b/packages/twenty-front/src/modules/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant.ts@@ -9,6 +9,7 @@ export const CUSTOM_WORKSPACE_APPLICATION_MOCK = {settingsMenuItems: [],availablePackages: {},canBeUninstalled: false,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,description: 'workpace custom application',name: 'custom',diff --git a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsxindex c113da4257d..3709d6e373c 100644--- a/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx+++ b/packages/twenty-front/src/modules/settings/applications/components/SettingsApplicationUninstallButton.tsx@@ -1,22 +1,27 @@import { formatQueueJobProgressLabel } from '@/queue-job/utils/formatQueueJobProgressLabel';import { ConfirmationDialog } from '@/ui/layout/dialog/components/ConfirmationDialog';import { useDialog } from '@/ui/layout/dialog/hooks/useDialog';+import { TooltipDelay } from '@/ui/layout/tooltip/constants/TooltipDelay';import { t } from '@lingui/core/macro';import { Trans } from '@lingui/react/macro';+import { isNonEmptyString } from '@sniptt/guards';import { useId } from 'react';import { IconTrash } from 'twenty-ui/icon';import { Button } from 'twenty-ui/primitives/input';+import { Tooltip } from 'twenty-ui/primitives/surfaces';type SettingsApplicationUninstallButtonProps = {onUninstall: () => void;isUninstalling?: boolean;uninstallProgress?: number;+ disabledReason?: string;};export const SettingsApplicationUninstallButton = ({onUninstall,isUninstalling,uninstallProgress,+ disabledReason,}: SettingsApplicationUninstallButtonProps) => {const { openDialog } = useDialog();const uninstallDialogId = useId();@@ -26,21 +31,34 @@ export const SettingsApplicationUninstallButton = ({uninstallProgress ?? 0,);+ const isDisabled = isNonEmptyString(disabledReason);+return (<>- <Button- startIcon={<IconTrash />}- variant="outline"- color="danger"- size="sm"- onClick={() => openDialog(uninstallDialogId)}- loading={isUninstalling}- loadingPosition="end"+ <Tooltip+ content={disabledReason}+ side="bottom"+ positionMethod="fixed"+ delay={TooltipDelay.shortDelay}+ disabled={!isDisabled}>- {isUninstalling- ? t`Uninstalling ${displayedUninstallProgress}`- : t`Uninstall`}- </Button>+ <span tabIndex={isDisabled ? 0 : undefined}>+ <Button+ startIcon={<IconTrash />}+ variant="outline"+ color="danger"+ size="sm"+ onClick={() => openDialog(uninstallDialogId)}+ disabled={isDisabled}+ loading={isUninstalling}+ loadingPosition="end"+ >+ {isUninstalling+ ? t`Uninstalling ${displayedUninstallProgress}`+ : t`Uninstall`}+ </Button>+ </span>+ </Tooltip><ConfirmationDialogconfirmationPlaceholder={confirmationValue}confirmationValue={confirmationValue}diff --git a/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx b/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsxnew file mode 100644index 00000000000..8a6dcf83ed7--- /dev/null+++ b/packages/twenty-front/src/modules/settings/applications/components/__tests__/SettingsApplicationUninstallButton.test.tsx@@ -0,0 +1,87 @@+import { i18n } from '@lingui/core';+import { I18nProvider } from '@lingui/react';+import { render, screen } from '@testing-library/react';+import userEvent from '@testing-library/user-event';++import { SettingsApplicationUninstallButton } from '@/settings/applications/components/SettingsApplicationUninstallButton';++const mockOpenDialog = jest.fn();++jest.mock('@/ui/layout/dialog/hooks/useDialog', () => ({+ useDialog: jest.fn(() => ({+ openDialog: mockOpenDialog,+ })),+}));++jest.mock('@/ui/layout/dialog/components/ConfirmationDialog', () => ({+ ConfirmationDialog: () => null,+}));++const DISABLED_REASON =+ 'Transfer the app ownership or uninstall it from all other workspaces first.';++const renderUninstallButton = ({+ disabledReason,+}: {+ disabledReason?: string;+} = {}) =>+ render(+ <I18nProvider i18n={i18n}>+ <SettingsApplicationUninstallButton+ onUninstall={jest.fn()}+ disabledReason={disabledReason}+ />+ </I18nProvider>,+ );++describe('SettingsApplicationUninstallButton', () => {+ beforeEach(() => {+ jest.clearAllMocks();+ });++ it('asks for confirmation before uninstalling', async () => {+ const user = userEvent.setup();++ renderUninstallButton();++ await user.click(screen.getByRole('button', { name: 'Uninstall' }));++ expect(mockOpenDialog).toHaveBeenCalledTimes(1);+ });++ it('does not show a tooltip while the uninstall is allowed', async () => {+ const user = userEvent.setup();++ renderUninstallButton();++ await user.hover(screen.getByRole('button', { name: 'Uninstall' }));++ expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();+ });++ it('disables the uninstall when a reason is given', async () => {+ const user = userEvent.setup();++ renderUninstallButton({ disabledReason: DISABLED_REASON });++ const button = screen.getByRole('button', { name: 'Uninstall' });++ expect(button).toBeDisabled();++ await user.click(button);++ expect(mockOpenDialog).not.toHaveBeenCalled();+ });++ it('explains why the uninstall is disabled', async () => {+ const user = userEvent.setup();++ renderUninstallButton({ disabledReason: DISABLED_REASON });++ await user.tab();++ expect(await screen.findByRole('tooltip')).toHaveTextContent(+ DISABLED_REASON,+ );+ });+});diff --git a/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useComputeObjectAndFieldsContentForApplication.test.tsx b/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useComputeObjectAndFieldsContentForApplication.test.tsxindex 82056eba3ad..0d7f319dd79 100644--- a/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useComputeObjectAndFieldsContentForApplication.test.tsx+++ b/packages/twenty-front/src/modules/settings/applications/hooks/__tests__/useComputeObjectAndFieldsContentForApplication.test.tsx@@ -30,6 +30,7 @@ describe('useComputeObjectAndFieldsContentForApplication', () => {name: 'Test App',logo: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,availablePackages: {},applicationVariables: [],@@ -61,6 +62,7 @@ describe('useComputeObjectAndFieldsContentForApplication', () => {name: 'Test App',logo: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,availablePackages: {},applicationVariables: [],@@ -90,6 +92,7 @@ describe('useComputeObjectAndFieldsContentForApplication', () => {name: 'Test App',logo: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,availablePackages: {},applicationVariables: [],@@ -120,6 +123,7 @@ describe('useComputeObjectAndFieldsContentForApplication', () => {name: 'Test App',logo: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,availablePackages: {},applicationVariables: [],@@ -278,6 +282,7 @@ describe('useComputeObjectAndFieldsContentForApplication', () => {name: 'Test App',logo: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,availablePackages: {},applicationVariables: [],diff --git a/packages/twenty-front/src/pages/settings/applications/hooks/__tests__/useApplicationVariablesDraft.test.tsx b/packages/twenty-front/src/pages/settings/applications/hooks/__tests__/useApplicationVariablesDraft.test.tsxindex 7f97e90745f..e4ccd7093fe 100644--- a/packages/twenty-front/src/pages/settings/applications/hooks/__tests__/useApplicationVariablesDraft.test.tsx+++ b/packages/twenty-front/src/pages/settings/applications/hooks/__tests__/useApplicationVariablesDraft.test.tsx@@ -56,6 +56,7 @@ const buildApplication = (applicationRegistrationId: null,applicationRegistration: null,canBeUninstalled: true,+ isUninstallBlockedByOtherWorkspaceInstallations: false,autoUpgrade: false,defaultRoleId: null,settingsCustomTabFrontComponentId: null,diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailGeneralTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailGeneralTab.tsxindex 4b19888008c..97274da35a4 100644--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailGeneralTab.tsx+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationDetailGeneralTab.tsx@@ -27,6 +27,7 @@ type SettingsApplicationDetailGeneralTabProps = {| 'logoUrl'| 'autoUpgrade'| 'canBeUninstalled'+ | 'isUninstallBlockedByOtherWorkspaceInstallations'| 'applicationRegistration'| 'logicFunctions'>;@@ -106,6 +107,11 @@ export const SettingsApplicationDetailGeneralTab = ({onUninstall={onUninstall}isUninstalling={isUninstalling}uninstallProgress={uninstallProgress}+ disabledReason={+ application.isUninstallBlockedByOtherWorkspaceInstallations+ ? t`Other workspaces rely on this app's server route, which is served from this workspace. Transfer the app ownership to another workspace where it is installed, or uninstall it from all other workspaces, before uninstalling it here.`+ : undefined+ }/>,]: []),diff --git a/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-lifecycle-job.service.ts b/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-lifecycle-job.service.tsindex f787d930bc9..27b67323e1a 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-lifecycle-job.service.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-lifecycle-job.service.ts@@ -75,10 +75,15 @@ export class ApplicationLifecycleJobService {universalIdentifier,workspaceId,}: LifecycleJobTarget): Promise<{ jobId: string }> {- await this.applicationService.findOneApplicationWithRelationsOrThrow({- universalIdentifier,- workspaceId,- });+ const application =+ await this.applicationService.findOneApplicationWithRelationsOrThrow({+ universalIdentifier,+ workspaceId,+ });++ await this.applicationService.assertUninstallIsNotBlockedByOtherWorkspaceInstallationsOrThrow(+ { application, workspaceId },+ );return this.triggerLifecycleJob<TriggerUninstallApplicationJobData>({operation: 'uninstall',diff --git a/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-uninstall-runner.service.ts b/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-uninstall-runner.service.tsindex 56528b01bdd..d897c1d88dd 100644--- a/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-uninstall-runner.service.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application-install/services/application-uninstall-runner.service.ts@@ -1,9 +1,12 @@import { Injectable } from '@nestjs/common';+import { isDefined } from 'twenty-shared/utils';+import { ApplicationSyncService } from 'src/engine/core-modules/application/application-manifest/application-sync.service';import { ApplicationException } from 'src/engine/core-modules/application/application.exception';import { ApplicationLookupService } from 'src/engine/core-modules/application/application-lookup/application-lookup.service';import { type ApplicationEntity } from 'src/engine/core-modules/application/application.entity';+import { ApplicationService } from 'src/engine/core-modules/application/application.service';import { APPLICATION_LIFECYCLE_LOCK_OPTIONS } from 'src/engine/core-modules/application/application-install/constants/application-lifecycle-lock-options.constant';import { APPLICATION_UNINSTALL_STEPS } from 'src/engine/core-modules/application/application-install/constants/application-uninstall-steps.constant';import { buildApplicationLifecycleLockKey } from 'src/engine/core-modules/application/application-install/utils/build-application-lifecycle-lock-key.util';@@ -17,6 +20,7 @@ import { MetricsKeys } from 'src/engine/core-modules/metrics/types/metrics-keys.export class ApplicationUninstallRunnerService {constructor(private readonly applicationLookupService: ApplicationLookupService,+ private readonly applicationService: ApplicationService,private readonly applicationSyncService: ApplicationSyncService,private readonly metricsService: MetricsService,private readonly cacheLockService: CacheLockService,@@ -45,6 +49,12 @@ export class ApplicationUninstallRunnerService {workspaceId,});+ if (isDefined(application)) {+ await this.applicationService.assertUninstallIsNotBlockedByOtherWorkspaceInstallationsOrThrow(+ { application, workspaceId },+ );+ }+await this.cacheLockService.withLock(() =>this.applicationSyncService.uninstallApplication({diff --git a/packages/twenty-server/src/engine/core-modules/application/application.resolver.ts b/packages/twenty-server/src/engine/core-modules/application/application.resolver.tsindex 1f408c28381..d1c1a7cc417 100644--- a/packages/twenty-server/src/engine/core-modules/application/application.resolver.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application.resolver.ts@@ -13,6 +13,7 @@ import {ApplicationException,ApplicationExceptionCode,} from 'src/engine/core-modules/application/application.exception';+import { ApplicationService } from 'src/engine/core-modules/application/application.service';import { ApplicationDTO } from 'src/engine/core-modules/application/dtos/application.dto';import { type FlatApplication } from 'src/engine/core-modules/application/types/flat-application.type';import { buildPublicAssetLogoUrl } from 'src/engine/core-modules/application/utils/build-public-asset-logo-url.util';@@ -51,6 +52,7 @@ export class ApplicationResolver {private readonly twentyConfigService: TwentyConfigService,private readonly workspaceCacheService: WorkspaceCacheService,private readonly applicationStopService: ApplicationStopService,+ private readonly applicationService: ApplicationService,) {}@Query(() => SdkClientChecksumsDTO, { nullable: true })@@ -113,6 +115,21 @@ export class ApplicationResolver {});}+ @ResolveField(() => Boolean)+ isUninstallBlockedByOtherWorkspaceInstallations(+ @Parent()+ application: Pick<ApplicationDTO, 'id' | 'applicationRegistrationId'>,+ @AuthWorkspace() workspace: WorkspaceEntity,+ ): Promise<boolean> {+ return this.applicationService.isUninstallBlockedByOtherWorkspaceInstallations(+ {+ applicationId: application.id,+ applicationRegistrationId: application.applicationRegistrationId,+ workspaceId: workspace.id,+ },+ );+ }+@ResolveField(() => [ApplicationVariableEntityDTO])applicationVariables(@Parent()diff --git a/packages/twenty-server/src/engine/core-modules/application/application.service.ts b/packages/twenty-server/src/engine/core-modules/application/application.service.tsindex 5d5f5d15818..794fb4ba27a 100644--- a/packages/twenty-server/src/engine/core-modules/application/application.service.ts+++ b/packages/twenty-server/src/engine/core-modules/application/application.service.ts@@ -1,9 +1,16 @@import { Injectable, Logger } from '@nestjs/common';import { InjectDataSource, InjectRepository } from '@nestjs/typeorm';+import { msg } from '@lingui/core/macro';import { FileFolder } from 'twenty-shared/types';import { isDefined } from 'twenty-shared/utils';-import { type DataSource, type QueryRunner, type Repository } from 'typeorm';+import {+ type DataSource,+ IsNull,+ Not,+ type QueryRunner,+ type Repository,+} from 'typeorm';import { v4 } from 'uuid';import { getDefaultApplicationPackageFields } from 'src/engine/core-modules/application/application-package/utils/get-default-application-package-fields.util';@@ -299,6 +306,81 @@ export class ApplicationService {.getCount();}+ async isUninstallBlockedByOtherWorkspaceInstallations({+ applicationId,+ applicationRegistrationId,+ workspaceId,+ }: {+ applicationId: string;+ applicationRegistrationId?: string | null;+ workspaceId: string;+ }): Promise<boolean> {+ if (!isDefined(applicationRegistrationId)) {+ return false;+ }++ const isOwnedByWorkspace =+ await this.applicationRegistrationRepository.existsBy({+ id: applicationRegistrationId,+ ownerWorkspaceId: workspaceId,+ });++ if (!isOwnedByWorkspace) {+ return false;+ }++ const hasServerRouteLogicFunction =+ await this.logicFunctionRepository.exists(workspaceId, {+ where: { applicationId, serverRouteTriggerSettings: Not(IsNull()) },+ });++ if (!hasServerRouteLogicFunction) {+ return false;+ }++ return this.applicationRepository+ .createQueryBuilder('application')+ .innerJoin('application.workspace', 'workspace')+ .where(+ 'application.applicationRegistrationId = :applicationRegistrationId',+ {+ applicationRegistrationId,+ },+ )+ .andWhere('application.workspaceId != :workspaceId', { workspaceId })+ .andWhere('application.deletedAt IS NULL')+ .andWhere('workspace.deletedAt IS NULL')+ .getExists();+ }++ async assertUninstallIsNotBlockedByOtherWorkspaceInstallationsOrThrow({+ application,+ workspaceId,+ }: {+ application: Pick<+ ApplicationEntity,+ 'id' | 'universalIdentifier' | 'applicationRegistrationId'+ >;+ workspaceId: string;+ }): Promise<void> {+ const isUninstallBlocked =+ await this.isUninstallBlockedByOtherWorkspaceInstallations({+ applicationId: application.id,+ applicationRegistrationId: application.applicationRegistrationId,+ workspaceId,+ });++ if (isUninstallBlocked) {+ throw new ApplicationException(+ `Application ${application.universalIdentifier} exposes a server route and is installed in other workspaces, it cannot be uninstalled from its owner workspace ${workspaceId}`,+ ApplicationExceptionCode.FORBIDDEN,+ {+ userFriendlyMessage: msg`Other workspaces rely on this app's server route, which is served from this workspace. Transfer the app ownership to another workspace where it is installed, or uninstall it from all other workspaces, before uninstalling it here.`,+ },+ );+ }+ }+// Number of workspaces each external (non-LOCAL) application is installed in,// ranked by install count. Powers the "most installed apps" gauge/leaderboard.// LOCAL apps (built-in Standard/Custom) exist in every workspace and are notdiff --git a/packages/twenty-server/test/integration/metadata/suites/application/failing-uninstall-server-route-application-from-owner-workspace.integration-spec.ts b/packages/twenty-server/test/integration/metadata/suites/application/failing-uninstall-server-route-application-from-owner-workspace.integration-spec.tsnew file mode 100644index 00000000000..325a446e76e--- /dev/null+++ b/packages/twenty-server/test/integration/metadata/suites/application/failing-uninstall-server-route-application-from-owner-workspace.integration-spec.ts@@ -0,0 +1,136 @@+import { buildBaseManifest } from 'test/integration/metadata/suites/application/utils/build-base-manifest.util';+import { cleanupApplicationAndAppRegistration } from 'test/integration/metadata/suites/application/utils/cleanup-application-and-app-registration.util';+import { findOneApplication } from 'test/integration/metadata/suites/application/utils/find-one-application.util';+import { findOneApplicationQueryFactory } from 'test/integration/metadata/suites/application/utils/find-one-application-query-factory.util';+import { setupApplicationForSync } from 'test/integration/metadata/suites/application/utils/setup-application-for-sync.util';+import { syncApplication } from 'test/integration/metadata/suites/application/utils/sync-application.util';+import { triggerUninstallApplicationJob } from 'test/integration/metadata/suites/application/utils/trigger-uninstall-application-job.util';+import { uninstallApplication } from 'test/integration/metadata/suites/application/utils/uninstall-application.util';+import { makeMetadataApiRequest } from 'test/integration/metadata/suites/utils/make-metadata-api-request.util';+import {+ removeApplicationInstallFromForeignWorkspace,+ seedApplicationInstallInForeignWorkspace,+} from 'test/integration/server-route-trigger/utils/seed-application-install-in-foreign-workspace.util';+import { type LogicFunctionManifest } from 'twenty-shared/application';++const APP_UNIVERSAL_IDENTIFIER = '3b6f0d1e-8a2c-4f7d-9e1b-2c4d6e8f0a1b';+const ROLE_UNIVERSAL_IDENTIFIER = '4c7a1e2f-9b3d-4a8e-8f2c-3d5e7f9a1b2c';+const RESOLVER_UNIVERSAL_IDENTIFIER = '5d8b2f3a-0c4e-4b9f-9a3d-4e6f8a0b2c3d';++const buildResolverManifest = (): LogicFunctionManifest => ({+ universalIdentifier: RESOLVER_UNIVERSAL_IDENTIFIER,+ name: 'server-route-resolver',+ handlerName: 'main',+ sourceHandlerPath: 'src/server-route-resolver.ts',+ builtHandlerPath: 'dist/server-route-resolver.mjs',+ builtHandlerChecksum: 'checksum-server-route-resolver',+ serverRouteTriggerSettings: { forwardedRequestHeaders: [] },+});++const findIsUninstallBlocked = async (): Promise<boolean> => {+ const response = await makeMetadataApiRequest(+ findOneApplicationQueryFactory({+ input: { universalIdentifier: APP_UNIVERSAL_IDENTIFIER },+ gqlFields: 'isUninstallBlockedByOtherWorkspaceInstallations',+ }),+ );++ expect(response.body.errors).toBeUndefined();++ return response.body.data.findOneApplication+ .isUninstallBlockedByOtherWorkspaceInstallations;+};++describe('Uninstalling a server route application from its owner workspace (integration)', () => {+ beforeAll(async () => {+ await setupApplicationForSync({+ applicationUniversalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ name: 'Server Route Owner Uninstall App',+ description: 'App exposing a server route from its owner workspace',+ sourcePath: 'server-route-owner-uninstall-app',+ });++ await syncApplication({+ manifest: buildBaseManifest({+ appId: APP_UNIVERSAL_IDENTIFIER,+ roleId: ROLE_UNIVERSAL_IDENTIFIER,+ overrides: { logicFunctions: [buildResolverManifest()] },+ }),+ expectToFail: false,+ });+ }, 60000);++ afterAll(async () => {+ await removeApplicationInstallFromForeignWorkspace({+ applicationUniversalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ });+ await cleanupApplicationAndAppRegistration({+ applicationUniversalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ });+ }, 60000);++ it('does not block the uninstall while only the owner workspace has the application installed', async () => {+ expect(await findIsUninstallBlocked()).toBe(false);+ });++ describe('while another workspace has the application installed', () => {+ beforeAll(async () => {+ await seedApplicationInstallInForeignWorkspace({+ applicationUniversalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ resolverUniversalIdentifier: RESOLVER_UNIVERSAL_IDENTIFIER,+ });+ });++ afterAll(async () => {+ await removeApplicationInstallFromForeignWorkspace({+ applicationUniversalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ });+ });++ it('flags the uninstall as blocked', async () => {+ expect(await findIsUninstallBlocked()).toBe(true);+ });++ it('refuses to uninstall the application', async () => {+ const { errors } = await uninstallApplication({+ universalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ expectToFail: true,+ });++ expect(errors).toHaveLength(1);+ expect(errors[0].extensions.code).toBe('FORBIDDEN');+ });++ it('refuses to queue the uninstall job', async () => {+ const { errors } = await triggerUninstallApplicationJob({+ input: { universalIdentifier: APP_UNIVERSAL_IDENTIFIER },+ expectToFail: true,+ });++ expect(errors).toHaveLength(1);+ expect(errors[0].extensions.code).toBe('FORBIDDEN');+ });++ it('keeps the application installed in the owner workspace', async () => {+ const { data } = await findOneApplication({+ input: { universalIdentifier: APP_UNIVERSAL_IDENTIFIER },+ expectToFail: false,+ });++ expect(data?.findOneApplication.universalIdentifier).toBe(+ APP_UNIVERSAL_IDENTIFIER,+ );+ });+ });++ it('unblocks the uninstall once no other workspace has the application installed', async () => {+ expect(await findIsUninstallBlocked()).toBe(false);++ const { data } = await uninstallApplication({+ universalIdentifier: APP_UNIVERSAL_IDENTIFIER,+ expectToFail: false,+ });++ expect(data?.uninstallApplication).toBe(true);+ });+});