Fix breaking change in install app command (#20825)

add backward compatibility for twenty-sdk install command
This commit is contained in:
martmull
2026-05-21 22:58:34 +02:00
committed by GitHub
parent c721fa8502
commit 9a7f50fcb7
17 changed files with 207 additions and 99 deletions
@@ -0,0 +1,9 @@
import gql from 'graphql-tag';
export const INSTALL_APPLICATION = gql`
mutation InstallApplication($universalIdentifier: String!) {
installApplication(universalIdentifier: $universalIdentifier) {
id
}
}
`;
@@ -1,15 +0,0 @@
import gql from 'graphql-tag';
export const INSTALL_MARKETPLACE_APP = gql`
mutation InstallMarketplaceApp(
$universalIdentifier: String!
$version: String
) {
installMarketplaceApp(
universalIdentifier: $universalIdentifier
version: $version
) {
id
}
}
`;
@@ -4,25 +4,23 @@ import { t } from '@lingui/core/macro';
import { useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
import {
InstallMarketplaceAppDocument,
type InstallMarketplaceAppMutation,
InstallApplicationDocument,
type InstallApplicationMutation,
} from '~/generated-metadata/graphql';
export const useInstallMarketplaceApp = () => {
const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();
const [isInstalling, setIsInstalling] = useState(false);
const [installMarketplaceAppMutation] = useMutation(
InstallMarketplaceAppDocument,
);
const [installApplicationMutation] = useMutation(InstallApplicationDocument);
const install = async (variables: {
universalIdentifier: string;
version?: string;
}): Promise<InstallMarketplaceAppMutation | null> => {
}): Promise<InstallApplicationMutation | null> => {
setIsInstalling(true);
try {
const result = await installMarketplaceAppMutation({ variables });
const result = await installApplicationMutation({ variables });
if (isDefined(result.data)) {
enqueueSuccessSnackBar({