@inversifyjs/core
Version:
InversifyJs core package
21 lines • 1.14 kB
JavaScript
import { buildPlanBindingConstraintsList } from '../calculations/buildPlanBindingConstraintsList.js';
import { LazyPlanServiceNode } from '../models/LazyPlanServiceNode.js';
import { removeServiceNodeBindingIfContextFree } from './removeServiceNodeBindingIfContextFree.js';
/**
* Detach a binding to the root service node if it is context-free.
* @param params The plan parameters.
* @param serviceNode The service node to attach the binding to.
* @param binding The binding to attach.
* @returns True if the binding requires ancestor metadata, false otherwise.
*/
export function removeRootServiceNodeBindingIfContextFree(params, serviceNode, binding) {
if (LazyPlanServiceNode.is(serviceNode) && !serviceNode.isExpanded()) {
return {
bindingNodeRemoved: undefined,
isContextFreeBinding: true,
};
}
const bindingConstraintsList = buildPlanBindingConstraintsList(params);
return removeServiceNodeBindingIfContextFree(serviceNode, binding, bindingConstraintsList, params.rootConstraints.isOptional ?? false);
}
//# sourceMappingURL=removeRootServiceNodeBindingIfContextFree.js.map