Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private publishInstalledApplications(): void {
const applications: Application[] = Beans.get(ApplicationRegistry).getApplications();
Beans.get(MessageClient).publish$(Topics.Applications, applications, {retain: true}).subscribe();
}
private installCapabilityUnregisterRequestHandler(): void {
Beans.get(MessageClient).observe$(Topics.UnregisterCapability)
.pipe(takeUntil(this._destroy$))
.subscribe((request: TopicMessage) => {
const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
Beans.get(ManifestRegistry).unregisterCapability(appSymbolicName, request.body.capabilityId);
});
}
.pipe(mergeMap((request: TopicMessage) => {
const manifestRegistry = Beans.get(ManifestRegistry);
const replyTo = request.headers.get(MessageHeaders.ReplyTo);
const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
return merge(of(null), manifestRegistry.intentChange$)
.pipe(
map(() => manifestRegistry.getIntentsByApplication(appSymbolicName)),
switchMap(intents => Beans.get(MessageClient).publish$(replyTo, intents)),
takeUntilUnsubscribe(replyTo),
);
}),
takeUntil(this._destroy$),
private installCapabilityRegisterRequestHandler(): void {
Beans.get(MessageClient).observe$(Topics.RegisterCapability)
.pipe(takeUntil(this._destroy$))
.subscribe((request: TopicMessage) => {
const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
Beans.get(ManifestRegistry).registerCapability(appSymbolicName, [request.body.capability]);
});
}
private startClientPlatform(port: number): Promise {
Beans.get(PlatformState).whenState(PlatformStates.Starting).then(() => {
Beans.register(NgZone, {useValue: this._zone});
Beans.registerDecorator(MessageClient, {useClass: AngularZoneMessageClientDecorator});
});
return MicrofrontendPlatform.forClient({symbolicName: `app-${port}`});
}
}
private installCapabilitiesQueryRequestHandler(): void {
Beans.get(MessageClient).observe$(Topics.Capabilities)
.pipe(
mergeMap((request: TopicMessage) => {
const manifestRegistry = Beans.get(ManifestRegistry);
const replyTo = request.headers.get(MessageHeaders.ReplyTo);
const appSymbolicName = request.headers.get(MessageHeaders.AppSymbolicName);
return merge(of(null), manifestRegistry.capabilityChange$)
.pipe(
map(() => manifestRegistry.getCapabilitiesByApplication(appSymbolicName)),
switchMap(capabilities => Beans.get(MessageClient).publish$(replyTo, capabilities)),
takeUntilUnsubscribe(replyTo),
);
}),
takeUntil(this._destroy$),
)
.subscribe();