Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Capability ConstantLocationExposed Connector Methods
ConnectToADataSource./lib/lifecycle
  • connect
  • disconnect
ValidatesConfiguration./lib/metadata
  • fetchMetadata
AddsCustomTypes./lib/metadata 
  • coerceCustomType
  • getCustomType
GenerateModels./lib/schema
  • createModelsFromSchema
  • fetchSchema
ContainsModels./modelsCreates a boilerplate model in the models folder.
CanCreate./lib/methods
  • create
CanRetrieve./lib/methods
  • distinct
  • findAll
  • findById
  • query
CanUpdate./lib/methods
  • findAndModify
  • save
  • upsert
CanDelete./lib/methods 
  • delete
  • deleteAll

AuthenticatesThroughConnector

./lib/lifecycle
  • login
  • loginRequired

Initialization

If you need to add some custom initialization logic when creating the connector, implement the following methods. The connector instance is the value passed to this in the functions. The functions do not take any arguments or return any values:

Method SignatureDescription
constructor(void)Use to execute some custom logic when the connector is created.
postCreate(void)Use to execute some custom logic after the connector instance is created but before it is returned.

...

Method SignatureCapabilityBoiler Plate FileDescriptionResult to Pass to the Callback

fetchMetadata(callback) 

ValidatesConfiguration./lib/metadata/fetchMetadata.jsRetrieves the metadata of the data source. The metadata is used to validate the configuration object.Metadata object. Set the fields key to an array of Metadata objects to verify the keys in the configuration object.

fetchConfig(callback)

--Retrieves the configuration of the data source.Configuration object. Key-value pairs describing the configuration of the connector.
connect(callback)ConnectToADataSource./lib/lifecycle/connect.jsConnects to the data source.None.

fetchSchema(callback) 

GenerateModels./lib/schema/fetchSchema.jsRetrieves the model schema of the data source.Schema object.
disconnect(callback)ConnectToADataSource./lib/lifecycle/connect.js Disconnect from the data source.None.

...

Method SignatureCapabilityBoiler Plate FileDescriptionResult to Pass to the Callback
create(Model, values, callback)CanCreate./lib/methods/create.js Creates a new model using the passed values.New model
delete(Model, instance, callback)CanDelete./lib/methods/delete.js Deletes the model instance.Deleted model
deleteAll(Model, callback)CanDelete./lib/methods/deleteAll.js Deletes all the models.An array of deleted models
findAll(Model, callback)CanRetrieve./lib/methods/findAll.js Retrieves all the models.An array of models
findById(Model, id, callback)CanRetrieve./lib/methods/findById.js Retrieves one model with the specified ID (id parameter).A model
query(Model, options, callback)CanRetrieve./lib/methods/query.js Retrieves all models based on the query options.An array of found models
distinct(Model, field, options, callback)CanRetrieve./lib/methods/ditinct.js Retrieves a distinct set of models based on the field(s) and query options.An array of distinct models
save(Model, instance, callback)CanUpdate./lib/methods/save.jsUpdates the model instance.Updated model
findAndModify(Model, options, doc, args, callback)CanUpdate./lib/methods/findAndModify.jsFinds one model instance and modifies it.Modified model
upsert(Model, id, doc, callback)CanUpdate./lib/methods/upsert.jsUpdates the model instance if found or creates a new model instance.Updated or new model

...

Method SignatureCapabilityBoiler Plate FileDescription
startRequest(methodName, args, request, next)--

Request interceptor invoked before the request is initiated and the login method is invoked. The method is passed the name of the method that started the request and the arguments passed to the method. Invoke the next function when the operation completes.

loginRequired(request, callback)

AuthenticatesThroughConnector

./lib/lifecycle/loginRequired.js Determines if the request required a login. Pass an error message (or null if successful) as the first parameter to callback and a boolean value indicating if the login method needs to be executed (true) or not (false) as the second parameter.
login(request, next)

AuthenticatesThroughConnector

./lib/lifecycle/login.js Logs into the data source to make a request. Invoke the next function when the operation completes.
endRequest(methodName, args, request, next) --Request interceptor invoked after the request completes . The method is passed the name of the method that started the request and the arguments passed to the method. Invoke the next function when the operation completes.

...