Class: Change

Change()

new Change()

Change list entry.
Properties:
Name Type Description
id String Hash of the modelName and ID.
rev String The current model revision.
prev String The previous model revision.
checkpoint Number The current checkpoint at time of the change.
modelName String Model name.
modelId String Model ID.
settings Object Extends the `Model.settings` object.
Properties
Name Type Description
hashAlgorithm String Algorithm used to create cryptographic hash, used as argument to [crypto.createHash](http://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm). Default is sha1.
ignoreErrors Boolean By default, when changes are rectified, an error will throw an exception. However, if this setting is true, then errors will not throw exceptions.
Source:

Classes

Conflict

Methods

conflictsWith(change) → {Boolean}

Does this change conflict with the given change.
Parameters:
Name Type Description
change Change
Source:
Returns:
Type
Boolean

equals(change) → {Boolean}

Compare two changes.
Parameters:
Name Type Description
change Change
Source:
Returns:
Type
Boolean

getModelCtor() → {Model}

Get the `Model` class for `change.modelName`.
Source:
Returns:
Type
Model

isBasedOn(change) → {Boolean}

Determine if the change is based on the given change.
Parameters:
Name Type Description
change Change
Source:
Returns:
Type
Boolean

type() → {String}

Get a change's type. Returns one of: - `Change.UPDATE` - `Change.CREATE` - `Change.DELETE` - `Change.UNKNOWN`
Source:
Returns:
the type of change
Type
String

(static) bothDeleted(a, b) → {Boolean}

Are both changes deletes?
Parameters:
Name Type Description
a Change
b Change
Source:
Returns:
Type
Boolean

(static) getCheckpointModel() → {Checkpoint}

Get the checkpoint model.
Source:
Returns:
Type
Checkpoint

(static) hash(str) → {String}

Create a hash of the given `string` with the `options.hashAlgorithm`. **Default: `sha1`**
Parameters:
Name Type Description
str String The string to be hashed
Source:
Returns:
The hashed string
Type
String

(static) idForModel(modelName, modelId) → {String}

Get an identifier for a given model.
Parameters:
Name Type Description
modelName String
modelId String
Source:
Returns:
Type
String

(static) rectifyAll(cb)

Correct all change list entries.
Parameters:
Name Type Description
cb function
Source:

(static) revisionForInst(inst) → {String}

Get the revision string for the given object
Parameters:
Name Type Description
inst Object The data to get the revision string for
Source:
Returns:
The revision string
Type
String