Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.queryCapabilityProviders(envelope as MessageEnvelope);
break;
}
case ManifestCommands.FindCapabilityConsumers: {
this.queryCapabilityConsumers(envelope as MessageEnvelope);
break;
}
case ManifestCommands.FindCapability: {
this.queryCapability(envelope as MessageEnvelope);
break;
}
case ManifestCommands.FindCapabilities: {
this.queryCapabilities(envelope as MessageEnvelope);
break;
}
case ManifestCommands.RegisterCapability: {
this.registerCapability(envelope as MessageEnvelope);
break;
}
case ManifestCommands.UnregisterCapability: {
this.unregisterCapability(envelope as MessageEnvelope);
break;
}
default: {
this._logger.error(`[UnsupportedQueryError] Command not supported [command=${command}]`);
this._messageBus.publishReply(null, envelope.sender, envelope.replyToUid);
}
}
}
public registerCapability$(capability: Capability): Observable {
const intentMessage: ManifestRegistryIntentMessages.RegisterCapability = {
type: PlatformCapabilityTypes.ManifestRegistry,
qualifier: NilQualifier,
payload: {
command: ManifestCommands.RegisterCapability,
capability: capability,
},
};
return Platform.getService(MessageBus).requestReceive$({channel: 'intent', message: intentMessage}, {once: true})
.pipe(
extractMessage(null),
mergeMap(reply => {
const success = reply && reply.status === 'ok';
return success ? EMPTY : throwError(reply.message);
}));
}