@digiserve/ab-utils
v1.8.4
Published
A common set of utility functions shared by our AppBuilder services
Downloads
1,054
Readme
ab-utils
a set of common utilities shared by each of our microsservices
ab-utils.service ⇐ EventEmitter
Our ABService class
Kind: static class of ab-utils
Extends: EventEmitter
See: ABService
new service(options)
| Param | Type | Default | | --- | --- | --- | | options | obj | | | [options.name] | string | "ABService" |
Example
const AB = require("ab.utils");
const options = { name: "myService"};
const service = new AB.service(options);
ab-utils.uuid() ⇒ string
This is an alias for uuid.v4()
Kind: static method of ab-utils
Returns: string - uuid
See: uuid - npm
ab-utils.config(key) ⇒ object
Kind: static method of ab-utils
Returns: object - baseConfig
| Param | Type | Description | | --- | --- | --- | | key | string | [optional] a subportion of the configs specified |
ab-utils.controller([key]) ⇒ ABServiceController
Get an AppBuilder Controller for use in our micro services
Kind: static method of ab-utils
| Param | Type | Default | | --- | --- | --- | | [key] | string | "ABServiceController" |
ab-utils.telemetry() ⇒ Telemetry
Get the telemetry interface
Kind: static method of ab-utils
ab-utils.reqApi(req, res, [config]) ⇒ ABRequestAPI
prepare a default set of data/utilities for our api request. This request is established in the Sails api_sails service and is used to verify and send jobs to various micro services.
Kind: static method of ab-utils
| Param | Type | Default | | --- | --- | --- | | req | obj | | | res | obj | | | [config] | obj | {} |
ab-utils.reqService(req, controller) ⇒ ABRequestService
return a modified req object that supports our typical AB functions.
Kind: static method of ab-utils
| Param | Type | Description | | --- | --- | --- | | req | obj | the standard request object received from the Cote service. | | controller | ABServiceController | |
ab-utils.resApi(req, res) ⇒ ABResponseAPI
prepare a default set of data/utilities for our api response.
Kind: static method of ab-utils
| Param | Type | | --- | --- | | req | object | | res | object |