RemoteServiceManager

BIServiceSDK

BIServiceSDK constructor

Type:
function
new RemoteServiceManager(services)

A factory for BIServiceSDK instances (see affiliated bi-service-sdk plugin) and SDKs integration

Parameters:
  • services
    • Type: Object
      • <serviceName>
        • Type: Object
        • index name = name of the service

          • <scope>
            • Type: Object
            • index name not constrained, could be anything... eg.: specific service application name (in case multiple applications are listening under one service) or access level type eg.: "public" or "s2s"

              • npm
                • Type: String
                • npm package name which exports object that inherits BIServiceSDK

              • host
                • Type: String
              • ssl
                • Type: Boolean
add(key, sdk)RemoteServiceManager

registers BIServiceSDK instance

Parameters:
  • key
    • Type: String
    • format <serviceName>:<scope>

  • sdk
    • Type: BIServiceSDK
Returns: RemoteServiceManager
  • self
buildRemoteService(key, options)BIServiceSDK

constructs specific BIServiceSDK from configuration provided to the constructor
the specific BIServiceSDK is supposed to be auto generated by bi-service-sdk plugin and published as a npm package

Parameters:
  • key
    • Type: String
    • format: <serviceName>:<scope>:<version>

  • options optional
    • Type: Object
    • BIServiceSDK constructor options

Throws:
  • Error
Returns: BIServiceSDK
Example:
//config.json5:
{
   services: {
      user: {
        public: {
          ssl: true,
          host: "127.0.0.1:4001",
          npm: "bi-user-public-sdk"
        }
      }
   }
}

//method usage
remoteServiceManager.buildRemoteService('user:public:v1.0');
get(key)BIServiceSDK
Parameters:
  • key
    • Type: String
    • format <serviceName>:<scope>:<version>

Returns: BIServiceSDK
has(key)Boolean
Parameters:
  • key
    • Type: String
    • format <serviceName>:<scope>:<version> (scope|version key segments are optional)

Returns: Boolean
comments powered by Disqus