Extends
- EventEmitter
Members
Type:
App
Type:
AppManager
Type:
AppManager
Type:
AppStatus
couchbase model manager. See affiliated kouchbase-odm
npm package.
Mentioned purely because of convention. Not required. Populated by the user.
Type:
null
or Object
Type:
CommonList
see affiliated bi-config
npm package
Type:
Config
Type:
ErrorList
Type:
ModuleLoader
Type:
RemoteServiceManager
Type:
RemoteServiceManager
Type:
RequestType
ResourceManager
is used for any resource that can be inspected for
its integrity eg. storage connections, remote dependent API services,
config provider etc...
Type:
ResourceManager
Type:
ResourceManager
Type:
Response
Type:
Route
Type:
Router
self reference
Type:
Service
self reference
Type:
Service
may be any service specific model manager of ORM
Mentioned purely because of convention. Not required. Populated by the user.
Type:
null
or Object
Type:
Utils
bi-service
npm package version
Type:
String
Constructor
- config
- Type:
Config
npm bi-config object
The main representation of a service as a whole.
Holds AppManager
, ResourceManager
, RemoteServiceManager
as well as global
service configuration (Config) object. Optionally can hold references to
Model managers of various ODMs/ORMs
Parameters:
Fires:
Methods
- name
- Type:
String
application name as defined in
apps.<name>
of service configuration file (config.json5)- options optional
- Type:
Object
see
App
constructor options- Constructor optional
- Type:
function
- Default:
App
a constructor which implements
AppInterface
AppInterface
syntax sugar for building an application (defaults to express
based App
) via AppManager
Parameters:
AppInterface
Promise
calls App#close
on each App
in the AppManager
Promise
RemoteServiceManager
returns RemoteServiceManager or constructs one if there isn't any. This
requires bi-service-sdk
npm module to be available
RemoteServiceManager
Events
- yargs
- Type:
Object
preconfigured instance of yargs npm package
- service
- Type:
Service
- appManager
- Type:
AppManager
service.appManager
- config
- Type:
Config
service.config
- yargs
- Type:
Object
one of the registered apps failed to initialize
all registered apps are successfully initialized and at this point already can receive connections
The event is emitted after service configuration and all registered resources are validated and ready for use.
Listeners are expected to do any initial asynchronous processing if needed and then register Apps with Router & Route definitions.
The listeners are handled asynchronously and so can deal with Promises
Example:
//$PROJECT_ROOT/index.js
const Service = require('bi-service');
const service = new Service(require('bi-config'));
service.once('set-up', function() {
require('./lib/app.js');
});
emitted once prior a shell command dispatching. Allows to register custom user-defined shell commands. See bi-service-shell plugin
Properties:
for bi-service
plugins.
emitted once for each instantiated Service object.
Properties:
Example:
const Service = require('bi-service');
Service.on('service', function(service) {
//do stuff
});
this event allows to hook-up bi-service
plugins and is static version of Service#event:set-up
event.
Properties:
Example:
const Service = require('bi-service');
Service.on('set-up', function(appManager, config) {
//do stuff
});
for bi-service
plugins.
emitted once prior a shell command is dispatched. Allows to register
custom user-defined shell commands.
See bi-service-shell
plugin