powerplatform-mcp
Version:
PowerPlatform Model Context Protocol server
47 lines (46 loc) • 1.37 kB
JavaScript
/**
* DependencyService
*
* Service for checking component dependencies.
* Note: This service should only be used by powerplatform-customization package.
*/
export class DependencyService {
client;
constructor(client) {
this.client = client;
}
/**
* Check component dependencies
*/
async checkDependencies(componentId, componentType) {
return this.client.post('api/data/v9.2/RetrieveDependenciesForDelete', {
ObjectId: componentId,
ComponentType: componentType,
});
}
/**
* Check if component can be deleted
*/
async checkDeleteEligibility(componentId, componentType) {
try {
const result = (await this.checkDependencies(componentId, componentType));
const dependencies = result.EntityCollection?.Entities || [];
return {
canDelete: dependencies.length === 0,
dependencies: dependencies,
};
}
catch {
return {
canDelete: false,
dependencies: [],
};
}
}
/**
* Check dependencies for a specific component (alias for checkDependencies)
*/
async checkComponentDependencies(componentId, componentType) {
return this.checkDependencies(componentId, componentType);
}
}