- create
- Conductor
- getHandlers
- getHandlerKeys
- getProps
- getProps
- createModels
- getDebugHandlerStack
- buildModelsWrapper
- initWrapper
- runHandlersWrapper
- createConductor
- createConductor
- createConductorHandlers
- methodInstaller
- getDefault
- child
- addSerializers
- Model
- before
- after
- isValid
- fallback
- get
- get
- preConfigure
- postConfigure
- RestModel
- getConductor
- getClient
- getModels
- getReqTimerPrefix
- setReqTimerPrefix
- setModel
- shardConductor
create a new restify json client. a new one is created for each outbound API request (i.e., one per model). TODO: this is potentially expensive, need to investigate creating a single client per incoming request (i.e., per user, per remote host) crux of the problem is allowing customization on a per request basis (headers), which currently requires creating a new client per model.
model
Object a restify model
Returns Object a restify JsonClient
Class definition
config
Object user configuration object.
name of the conductor
Type: String
retrieves a handler block for a given key.
key
String the key of the handler block
Returns Array an array of function handlers
retrieves the sorted handler keys for the conductor.
Returns Array an array of strings
retrieves an immutable property. if no name passed in, return all props.
name
String? optional name of the prop to retrieve.
Returns Object the copy of the prop
retrieve an immutable prop off the conductor object
Returns Object a prop value
iterates through a specific model bucket, invoking each function in the array to create a new instance of a model. does not change any state.
req
Object the request objectres
Object the response objectbucketName
String the name of the model bucket to create.
Returns Array an array of models
returns a flattened list of handler stacks. for debug use only.
Returns Array an array of function names and the index of their blocks
a handler to build any models defined on the conductor.
modelBucket
Array a key we can use to look up a bucket of models defined on the conductormodelFetcher
Function function to run for fetching / creating models. The function should accept req as the first parameter, req as the second, a models array as the third, and a callback as the fourth.
Returns undefined
a handler to initialize the restify conductor namespaces on the request and response objects.
conductor
Object an instance of restify conductor
Returns void
a handler to run the wrapped conductor handlers. no options at the moment.
Returns undefined
wrapper function for creating conductors
options
Object an options object
Returns Conductor a Conductor instance
wrapper function for creating models. we MUST return a closure, this is necessary to provide req res to the lifecycle methods, and allow us to return a new model for each new incoming request.
options
Object an options object
Returns Function
Create a middleware chain that executes a specific conductor
conductor
Object a Conductor instance
programatically create wrapperis for Restify's server[method]
opts
(String | Object) the url of REST resource or opts to pass to Restifyconductor
Conductor a conductor instanceserver
Object a restify server
Returns undefined
retrieves default restify-conductor logger
Returns Object bunyan logger
creates a child logger from default restify-conductor logger
name
String name of child logger
Returns Object bunyan logger
add the restify-conductor specific serializers
log
Object bunyan instance
Returns void
Model class. abstraction for restify-conductor models.
config
Object model configuration object
arbitrary model props
Type: Object
the model data
Type: Object
collected errors that may have occurred through the lifecycle methods.
Type: Array
a bunyan instance for loggin
Type: Object
a remote client that implements a get() method for fetching remote data
Type: Object
model type for debugging purposes
Type: String
model name
Type: String
flag used to help debug. true if the model is async.
Type: Boolean
default noop for all models. gives users a hook to modify the model before requesting it.
Returns undefined
default noop for all models. gives users a hook to modify the model after getting a return value.
Returns undefined
lifecycle method for validating returned data.
data
Object the data to validate
Returns Boolean
default noop for all models. gives users a hook to handle validation errors.
Returns Object
public method to invoke the get of the model data.
cb
Function callback function
Returns undefined
retrieves the remote resource.
callback
Function a callback function to invoke when complete
Returns Object the parsed JSON response
public method to invoke the before chain of lifecycle events.
Returns undefined
public method to invoke the after chain of lifecycle events.
Returns undefined
RestModel class. abstraction for restify-conductor models.
config
Object model configuration object
model type for debugging purposes
Type: String
flag used to help debug. true if the model is async.
Type: Boolean
the type of http request. defaults to GET.
Type: String
whether or not the request should be made over https.
Type: Boolean
the hostname for the request
Type: String
port number for remote host
Type: Number
the base url of the request: http://{hostname}/{baseurl}
Type: String
the specific url of the request: http://{hostname}/{baseurl}/{url}
Type: String
a query string object
Type: Object
a post body object
Type: Object
if a post request, the post type. defafult is json, can also be 'form'.
Type: String
specific headers set for this model
Type: Object
the format of the returned payload. defaults to JSON, but can be XML or other.
Type: String
some cherry picked debug about the external resource call.
Type: Object
whether or not model is operating in fallback mode.
Type: Boolean
returns the conductor for a given request.
req
Object the request object
Returns undefined
returns a restify JSON client if one exists for this host for this incoming request. otherwise, creates one.
Returns Object a restify JSON client
gets all the saved models off the request
req
Object the request objectmodelName
String? name of the model to retrieve. returns all models if not specified.
Returns (Object | Array) returns an array of models, or just one model.
gets the current request timer prefix name. useful for using it to prefix other request timers.
req
Object the request object
Returns String
sets the current timer name prefix.
Returns undefined
saves a model onto the request
Returns undefined
replace an conductor midstream with a .createAction
Returns undefined