Fix app:dev CLI by removing deleted createOneApplication mutation (#18460)
## Summary - The `createOneApplication` GraphQL mutation was removed from the server during the application architecture refactor (#18432), but the SDK CLI (`app:dev`, `app:build --sync`) still called it, causing failures. - Simplified the SDK to use `syncApplication` (which now internally creates the `ApplicationEntity` via `ensureApplicationExists`) instead of a separate create step. - On first run (clean install), the orchestrator now runs an initial sync before initializing the file uploader, so file uploads can proceed (they require the `ApplicationEntity` to exist). ## Test plan - [x] Typecheck passes for both `twenty-sdk` and `twenty-server` - [x] `app:dev` tested locally with existing app (finds app, uploads, syncs) - [x] `app:dev` tested locally after `app:uninstall` (creates app via sync, uploads, syncs) - [x] SDK unit tests pass (23/26 files, 3 pre-existing failures unrelated) Made with [Cursor](https://cursor.com)
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const REGISTER_NPM_PACKAGE = gql`
|
||||
mutation RegisterNpmPackage($packageName: String!) {
|
||||
registerNpmPackage(packageName: $packageName) {
|
||||
id
|
||||
universalIdentifier
|
||||
name
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -1,50 +0,0 @@
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import { t } from '@lingui/core/macro';
|
||||
import { useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { REGISTER_NPM_PACKAGE } from '~/modules/marketplace/graphql/mutations/registerNpmPackage';
|
||||
|
||||
export const useRegisterNpmPackage = () => {
|
||||
const [registerNpmPackageMutation] = useMutation(REGISTER_NPM_PACKAGE);
|
||||
const { enqueueErrorSnackBar, enqueueSuccessSnackBar } = useSnackBar();
|
||||
const [isRegistering, setIsRegistering] = useState(false);
|
||||
|
||||
const register = async (params: {
|
||||
packageName: string;
|
||||
}): Promise<boolean> => {
|
||||
setIsRegistering(true);
|
||||
|
||||
try {
|
||||
const result = await registerNpmPackageMutation({
|
||||
variables: { packageName: params.packageName },
|
||||
});
|
||||
|
||||
const registration = result.data?.registerNpmPackage;
|
||||
|
||||
if (!isDefined(registration)) {
|
||||
enqueueErrorSnackBar({ message: t`Registration failed.` });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
enqueueSuccessSnackBar({
|
||||
message: t`Package registered successfully.`,
|
||||
});
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
const graphqlMessage = error instanceof Error ? error.message : undefined;
|
||||
|
||||
enqueueErrorSnackBar({
|
||||
message: graphqlMessage ?? t`Failed to register npm package.`,
|
||||
});
|
||||
|
||||
return false;
|
||||
} finally {
|
||||
setIsRegistering(false);
|
||||
}
|
||||
};
|
||||
|
||||
return { register, isRegistering };
|
||||
};
|
||||
Reference in New Issue
Block a user