Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// provide fallback for the former 'query' property of manifest commands
const command = envelope.message.payload.command || envelope.message.payload.query;
switch (command) {
case ManifestCommands.FindManifests: {
this.queryManifests(envelope as MessageEnvelope);
break;
}
case ManifestCommands.FindManifest: {
this.queryManifest(envelope as MessageEnvelope);
break;
}
case ManifestCommands.FindCapabilityProviders: {
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: {
public capabilityConsumers$(capabilityId: string): Observable {
const intentMessage: ManifestRegistryIntentMessages.FindCapabilityConsumers = {
type: PlatformCapabilityTypes.ManifestRegistry,
qualifier: NilQualifier,
payload: {
command: ManifestCommands.FindCapabilityConsumers,
capabilityId: capabilityId,
},
};
return Platform.getService(MessageBus).requestReceive$({channel: 'intent', message: intentMessage}, {once: true})
.pipe(extractMessage([]));
}