Members
access
Defines an access rule for an object and HTTP method combination. When
access is requested via a REST call, the function provided will be
executed and the callback from that method will determine if the
access will be allowed or denied. Multiple access functions can
be provided for a single model and method allowing authentication
checks to be stacked.
This call also allows you to pass a wildcard "*" instead of the objType,
objName and methodName parameters which will match all items. This
allows you to set permissions globally.
If no access permissions are present ForerunnerDB will automatically
deny any request to the resource by default.
- Source:
name
Get / set the procedure name.
- Source:
NodeRAS
Data files saved by this storage engine are composed of an initial header
section which contains meta-data used to identify data entry boundaries
and then a body section which contains the data proper.
You can think of the data file being composed of many JSON objects. The
header is one object and the body is an array of multiple other objects.
At the binary level we always start with a data length followed by a
marker that denotes the length end, after which the data will follow.
e.g. 20:{"hello": "thgbfsw"}20:{"hello": "thgbfsw"}
The first entry will always be the header or "meta-data". The meta-data
includes all the information we need to locate entries in the body randomly
so you can think of it as the body's index. It can also contain arbitrary
data apart from the index that may include flags denoting middleware usage
etc.
- Source:
server
Set the url of the server to use for API.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
setData
Sets the collection's data to the array / documents passed. If any
data already exists in the collection it will be removed before the
new data is set via the remove() method, and the remove event will
fire as well.
- Source:
Shared
This is a skeleton module definition that you can use as a springboard to
develop new modules easily. It includes registering the module with
ForerunnerDB and shows how to use common helper methods such as mixins
and method synthesis, as well as providing a pattern to allow the constructor
method to be overridden by other modules.
- Source:
Shared
The condition class monitors a data source and updates it's internal
state depending on clauses that it has been given. When all clauses
are satisfied the then() callback is fired. If conditions were met
but data changed that made them un-met, the else() callback is fired.
- Source:
Methods
"boolean, function"(removePersistent, callback)
Drop collections and optionally drop persistent storage with callback.
Parameters:
| Name | Type | Description |
|---|---|---|
removePersistent |
Boolean | True to drop persistent storage, false to keep it. |
callback |
function | Callback method. |
- Source:
"boolean, function"(removePersistent, callback)
Drop collections and optionally drop persistent storage with callback.
Parameters:
| Name | Type | Description |
|---|---|---|
removePersistent |
Boolean | True to drop persistent storage, false to keep it. |
callback |
function | Callback method. |
- Source:
"object, function"(query, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
query |
Object | A query object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"object, object, function"(query, options, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
query |
Object | A query object. |
options |
Object | An options object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, *, function"(event, id, listener)
Attach an event listener to the passed event only if the passed
id matches the document id for the event being fired.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
String | The name of the event to listen for. |
id |
* | The document id to match against. |
listener |
function | The method to call when the event is fired. |
- Source:
"string, function"(collectionName, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
String | The collection to sync from. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, function"(event, listener)
Attach an event listener to the passed event.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
String | The name of the event to listen for. |
listener |
function | The method to call when the event is fired. |
- Source:
"string, object, function"(collectionName, query, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
String | The collection to sync from. |
query |
Object | A query object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, object, object, function"(collectionName, query, options, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
collectionName |
String | The collection to sync from. |
query |
Object | A query object. |
options |
Object | An options object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, string, function"(objectType, objectName, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
objectType |
String | The type of object to sync to e.g. "collection" or "view". |
objectName |
String | The name of the object to sync from. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, string, object, function"(objectType, objectName, query, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
objectType |
String | The type of object to sync to e.g. "collection" or "view". |
objectName |
String | The name of the object to sync from. |
query |
Object | A query object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
"string, string, object, object, function"(objectType, objectName, query, options, callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
objectType |
String | The type of object to sync to e.g. "collection" or "view". |
objectName |
String | The name of the object to sync from. |
query |
Object | A query object. |
options |
Object | An options object. |
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
boolean(removePersistent)
Drop collection and optionally drop persistent storage.
Parameters:
| Name | Type | Description |
|---|---|---|
removePersistent |
Boolean | True to drop persistent storage, false to keep it. |
- Source:
boolean(removePersistent)
Drop collection and optionally drop persistent storage.
Parameters:
| Name | Type | Description |
|---|---|---|
removePersistent |
Boolean | True to drop persistent storage, false to keep it. |
- Source:
checksum(str) → {Number}
Returns a checksum of a string.
Parameters:
| Name | Type | Description |
|---|---|---|
str |
String | The string to checksum. |
- Source:
Returns:
The checksum generated.
- Type
- Number
Condition()
Create a constructor method that calls the instance's init method.
This allows the constructor to be overridden by other modules because
they can override the init method with their own.
- Source:
function(callbackopt)
Saves an entire database's data to persistent storage.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
function |
<optional> |
The method to call when the save function has completed. |
- Source:
function(callback)
Drop collection and persistent storage with callback.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | Callback method. |
- Source:
function(callbackopt)
Loads an entire database's data from persistent storage.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
callback |
function |
<optional> |
The method to call when the load function has completed. |
- Source:
function(callback)
Drop collection and persistent storage with callback.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | Callback method. |
- Source:
function(callback)
Sync with this collection on the server-side.
Parameters:
| Name | Type | Description |
|---|---|---|
callback |
function | The callback method to call once the connection to the server has been established. |
- Source:
MyModule()
Create a constructor method that calls the instance's init method.
This allows the constructor to be overridden by other modules because
they can override the init method with their own.
- Source:
NodeRAS()
Create a constructor method that calls the instance's init method.
This allows the constructor to be overridden by other modules because
they can override the init method with their own.
- Source:
Section()
Create a constructor method that calls the instance's init method.
This allows the constructor to be overridden by other modules because
they can override the init method with their own.
- Source:
Type Definitions
addTriggerCallback(operation, oldDoc, newDoc)
When called in a before phase the newDoc object can be directly altered
to modify the data in it before the operation is carried out.
Parameters:
| Name | Type | Description |
|---|---|---|
operation |
Object | The details about the operation. |
oldDoc |
Object | The document before the operation. |
newDoc |
Object | The document after the operation. |
- Source: