engine-composition-adapter
The base composition adapter class.
Use this module to create custom adapters for Engine composition.
Installation
$ npm i --save engine-composition-adapter
Example
"use strict"; // Include the CompositionAdapter classconst CompositionAdapter = ; // Extend a custom adapter from CompositionAdapter // And implement the exists method { ; } // Create a new adapter instancevar crud = ; // Call the `exists` methodcrud;
Documentation
exists(name, cb)
Checks if an instance exists.
Params
- String
name
: The instance name. - Function
cb
: The callback function.
list(cb)
List the instances.
Params
- Function
cb
: The callback function.
readAll(cb)
Read all the instances.
Params
- Function
cb
: The callback function.
create(name, data, cb)
Creates a new instance.
Params
- String
name
: The instance name. - Object
data
: The instance content. - Function
cb
: The callback function.
read(name, cb)
Reads the instance content.
Params
- String
name
: The instance name. - Function
cb
: The callback function.
update(name, data, cb)
Updates the instance content.
Params
- String
name
: The instance name. - Object
data
: The instance content. - Function
cb
: The callback function.
remove(name, cb)
Removes the instance.
Params
- String
name
: The instance name. - Function
cb
: The callback function.
remove(oldName, newName, cb)
rename Renames the instance.
Params
- String
oldName
: The old instance name. - String
newName
: The new instance name. - Function
cb
: The callback function.
upsert(name, data, cb)
Creates or updates the specified instance.
Params
- String
name
: The instance name. - Object
data
: The instance content. - Function
cb
: The callback function.
readFile(path, cb)
Reads a file from app folder.
Params
- String
path
: The file path (relative to the app directory). - Function
cb
: The callback function.
readFile(name, content, cb)
Writes a file from app folder.
Params
- String
name
: The file path (relative to the app directory). - String
content
: The content to write in the file. - Function
cb
: The callback function.
How to contribute
Have an idea? Found a bug? See how to contribute.
Where is this library used?
If you are using this library in one of your projects, add it in this list. ✨
engine-composition-crud
by jillix