mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 03:12:15 +00:00
Co-authored-by: Dana Lee <dana@n8n.io> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import type { IRestApiContext } from '@/Interface';
|
|
import type { PublicInstalledPackage } from 'n8n-workflow';
|
|
import { get, post, makeRestApiRequest } from '@/utils/apiUtils';
|
|
|
|
export async function getInstalledCommunityNodes(
|
|
context: IRestApiContext,
|
|
): Promise<PublicInstalledPackage[]> {
|
|
const response = await get(context.baseUrl, '/community-packages');
|
|
return response.data || [];
|
|
}
|
|
|
|
export async function installNewPackage(
|
|
context: IRestApiContext,
|
|
name: string,
|
|
verify?: boolean,
|
|
version?: string,
|
|
): Promise<PublicInstalledPackage> {
|
|
return await post(context.baseUrl, '/community-packages', { name, verify, version });
|
|
}
|
|
|
|
export async function uninstallPackage(context: IRestApiContext, name: string): Promise<void> {
|
|
return await makeRestApiRequest(context, 'DELETE', '/community-packages', { name });
|
|
}
|
|
|
|
export async function updatePackage(
|
|
context: IRestApiContext,
|
|
name: string,
|
|
): Promise<PublicInstalledPackage> {
|
|
return await makeRestApiRequest(context, 'PATCH', '/community-packages', { name });
|
|
}
|