Class CapabilityInterceptorAbstract

Allows intercepting capabilities before their registration.

Interceptors allow intercepting capabilities before they are registered, for example, to perform validation checks, add metadata, or change properties.

The following interceptor assigns a stable identifier to each microfrontend capability.

class MicrofrontendCapabilityInterceptor implements CapabilityInterceptor {

public async intercept(capability: Capability): Promise<Capability> {
if (capability.type === 'microfrontend') {
return {
...capability,
metadata: {...capability.metadata, id: hash(capability)},
};
}
return capability;
}
}

Interceptors are registered in the bean manager of the host application under the symbol CapabilityInterceptor as multi bean. Multiple interceptors can be registered, forming a chain in which each interceptor is called one by one in registration order.

Beans.register(CapabilityInterceptor, {useClass: MicrofrontendCapabilityInterceptor, multi: true});

Constructors

Methods

Constructors

Methods