Publish twenty-cli npm package (#14871)

as title
This commit is contained in:
martmull
2025-10-03 15:08:06 +02:00
committed by GitHub
parent 0648dc5c65
commit f973a1bcdb
14 changed files with 235 additions and 45 deletions
@@ -72,7 +72,6 @@ export class ApiService {
headers: {
'Content-Type': 'application/json',
Accept: '*/*',
'x-schema-version': '6',
},
},
);
@@ -115,7 +114,6 @@ export class ApiService {
headers: {
'Content-Type': 'application/json',
Accept: '*/*',
'x-schema-version': '6',
},
},
);
@@ -143,4 +141,52 @@ export class ApiService {
throw error;
}
}
async deleteApplication(packageJson: PackageJson): Promise<ApiResponse> {
try {
const mutation = `
mutation DeleteApplication($packageJson: JSON!) {
deleteApplication(packageJson: $packageJson)
}
`;
const variables = { packageJson };
const response: AxiosResponse = await this.client.post(
'/metadata',
{
query: mutation,
variables,
},
{
headers: {
'Content-Type': 'application/json',
Accept: '*/*',
},
},
);
if (response.data.errors) {
return {
success: false,
error:
response.data.errors[0]?.message || 'Failed to delete application',
};
}
return {
success: true,
data: response.data.data.deleteApplication,
message: `Successfully deleted application: ${packageJson.name}`,
};
} catch (error) {
if (axios.isAxiosError(error) && error.response) {
return {
success: false,
error: error.response.data?.errors?.[0]?.message || error.message,
};
}
throw error;
}
}
}