# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

# Module: Repository

Base class representing a Command
Class represents a unique collection of data, with a Schema, and a storage medium. The Repository holds a current page of Entities (this.entities), which may or may not be the complete set of all Entities in the storage medium. The storage medium is defined by the subclasses of Repository (e.g. MemoryRepository, AjaxRepository, etc).

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Object with key/value pairs that define this Command

  Source:
    Repository/LocalFromRemote/Command.js

  ##### Fires:

  - .'handleServerResponse',event: 'destroy']

#### new (require("Repository"))(config)

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `config` | object | Config object - id {string} - Optional. If supplied, must be unique - name {string} - Optional. Defaults to schema.name - schema - Schema object

  Source:
    Repository/Repository.js

### Classes

AjaxRepository
CommandRepository
LocalFromRemoteRepository
MemoryRepository
NullRepository
OfflineRepository
OneBuildRepository
RestRepository

### Members

#### <inner> api :object

  List of relative URIs to API endpoints.

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> methods :object

  List of methods for all four CRUD operations

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> reader :string|object

  Reader. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> writer :string|object

  Writer. Options: json|xml

  ##### Type:

  - string | object
  Source:
    Repository/Ajax.js

#### <inner> paramPageNum :string

  Parameter name for currentl page number

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramPageSize :string

  Parameter name for current page size

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting property

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> paramSort :string

  Parameter name for sorting direction

  ##### Type:

  - string
  Source:
    Repository/Ajax.js

#### <inner> timeout :integer

  Number of milliseconds to wait before canceling request

  ##### Type:

  - integer
  Source:
    Repository/Ajax.js

#### <inner> baseParams :object

  Params that will be applied to every request

  ##### Type:

  - object
  Source:
    Repository/Ajax.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Ajax.js

#### registerHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### unregisterHandler

  Register a handler for this command.
  Source:
    Repository/LocalFromRemote/Command.js

#### hasHandlers

  Detect whether this command has any handlers.
  Source:
    Repository/LocalFromRemote/Command.js

#### processResponse

  Convenience function to invoke handlers
  Source:
    Repository/LocalFromRemote/Command.js

#### destroy

  Destroy this object. - Removes event listeners
  Source:
    Repository/LocalFromRemote/Command.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> mode :string

  The mode this Repository will operate in. Options: MODE_LOCAL_MIRROR || MODE_REMOTE_WITH_OFFLINE || MODE_COMMAND_QUEUE Defaults to MODE_LOCAL_MIRROR

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> autoSync :boolean

  Whether to auto sync this repository on initialization

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> syncRate :string

  Interval with which to sync local with remote. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> retryRate :string

  Interval with which to re-try syncing local with remote after a failure. Format must be a relative time frame parseable with relative-time-parser's relativeTime() function. Examples: '+10 minutes', '+6 hours', '+1 day', '+1 week'

  ##### Type:

  - string
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> useLongTimers :boolean

  Whether to set "long" timers in JS. Sometimes React Native-Android has issues with this.

  ##### Type:

  - boolean
  Source:
    Repository/LocalFromRemote/LocalFromRemote.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/OneBuild.js

#### <inner> id :string

  Must be unique, if supplied. Defaults to UUID

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> name :string

  Name of this repository. Defaults to Schema.name

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> autoLoad :boolean

  Whether to immediately load this repository's data on instantiation

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSave :boolean

  Whether to automatically save entity changes to permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> autoSort :boolean

  Whether to automatically sort entities in permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isLocal :boolean

  Whether this Repository saves its data to local permanent storage ("permanent" being a relative term)

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemote :boolean

  Whether this Repository saves its data to remote permanent storage

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteFilter :boolean

  Whether this Repository filters data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner, readonly> isRemoteSort :boolean

  Whether this Repository sorts data remotely

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isPaginated :boolean

  Whether this Repository is paginated

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> pageSize :number

  Max number of entities per page Example: For "Showing 21-30 of 45" This would be 10

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> batchOrder :string

  Comma-separated ordering of add, edit, and delete batch operations

  ##### Type:

  - string
  Source:
    Repository/Repository.js

#### <inner> debugMode :boolean

  Whether this Repository should output debug messages

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> filters :array

  Array of filters

  ##### Type:

  - array
  Source:
    Repository/Repository.js

#### <inner> page :number

  State: Current page number in pagination

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageTotal :number

  Getter for

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageStart :number

  Index (based on total) of the first item on the current page. Example: "Showing 21-30 of 45" This would be 21

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> pageEnd :number

  Index (based on total) of the last item on the current page Example: "Showing 21-30 of 45" This would be 30

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> totalPages :number

  Total number of pages based on this.total and this.pageSize

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> total :number

  Total number of entities in remote storage that pass filters

  ##### Type:

  - number
  Source:
    Repository/Repository.js

#### <inner> isFiltered :Boolean

  State: whether or not any filters are currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isInitialized :Boolean

  State: whether or not this repository has been completely initialized

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoaded :Boolean

  State: whether or not entities have been loaded at least once

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isLoading :Boolean

  State: whether or not entities are currently being loaded

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSaving :Boolean

  State: whether or not entities are currently being saved

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> isSorted :Boolean

  State: whether or not any sorting is currently applied to entities

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### <inner> allowsMultiSort :boolean

  Whether to allow >1 sorter

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <inner> isDestroyed :boolean

  Whether this object has been destroyed

  ##### Type:

  - boolean
  Source:
    Repository/Repository.js

#### <abstract> load

  Tells storage medium to load data
  Source:
    Repository/Repository.js

#### setAutoSave

  Sets the autoSave setting of this Repository
  Source:
    Repository/Repository.js

#### setAutoLoad

  Sets the autoLoad setting of this Repository
  Source:
    Repository/Repository.js

#### <inner> hasSorters :Boolean

  Whether or not any sorters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### clearSort

  Clear all sorting from this Repository.
  Source:
    Repository/Repository.js

#### sort

  Sets the sorting applied to entities. Chainable function. Usage: - repository.sort(); // Reverts back to default sort. To actually *clear* all sorters, use this.clearSort() - repository.sort('last_name'); // sort by one property, ASC - repository.sort('last_name', 'ASC'); // sort by one property - repository.sort({ // sort by one property, object notation name: 'last_name', direction: 'ASC', }); - repository.sort([ // sort by multiple properties { name: 'last_name', direction: 'ASC', }, { name: 'first_name', direction: 'ASC', }, ]); - sort().filter() // combine with filter
  Source:
    Repository/Repository.js

#### getDefaultSorters

  Gets default sorters. Either what was specified on schema, or sorty by displayProperty ASC.
  Source:
    Repository/Repository.js

#### setSorters

  Sets the sorters directly
  Source:
    Repository/Repository.js

#### <inner> hasFilters :Boolean

  Whether or not any filters are applied

  ##### Type:

  - Boolean
  Source:
    Repository/Repository.js

#### filter

  Sets one or more filters to entities. Usage: - repository.filter(); // Special case: clear all filtering - repository.filter('first_name', 'Scott'); // Add a single filter - repository.filter({ // Add a single filter, object notation name: 'first_name', value: 'Scott', }); - repository.filter([ // Add multiple filters { name: 'last_name', value: 'Spuler', }, { name: 'first_name', value: 'Scott', }, ]);
  Source:
    Repository/Repository.js

#### setFilters

  Sets one or more filters. This is a convenience function; a special case alias of filter() Usage: - repository.setFilters({ first_name: 'Scott', last_name: 'Spuler', });
  Source:
    Repository/Repository.js

#### clearFilters

  Clears filters.
  Source:
    Repository/Repository.js

#### setPageSize

  Sets the pageSize
  Source:
    Repository/Repository.js

#### setPage

  Advances to a specific page of entities
  Source:
    Repository/Repository.js

#### prevPage

  Advances to the previous page of entities
  Source:
    Repository/Repository.js

#### nextPage

  Advances to the next page of entities
  Source:
    Repository/Repository.js

#### add

  Creates a new Entity in storage medium.
  Source:
    Repository/Repository.js

#### _destroyEntities

  Destroys the current entities - mostly so they can be replaced with other entities.
  Source:
    Repository/Repository.js

#### getSubmitValues

  Gets an array of "submit" values objects for the entities
  Source:
    Repository/Repository.js

#### getDisplayValues

  Gets an array of "display" values objects for the entities
  Source:
    Repository/Repository.js

#### getRawValues

  Gets an array of "raw" values objects for the entities
  Source:
    Repository/Repository.js

#### getOriginalData

  Gets an array of "originalData" values objects for the entities
  Source:
    Repository/Repository.js

#### getParsedValues

  Gets an array of "parsed" values objects for the entities
  Source:
    Repository/Repository.js

#### getByIx

  Get a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getByRange

  Get multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### getById

  Get a single Entity by its id
  Source:
    Repository/Repository.js

#### getBy

  Get an array of Entities by supplied filter function
  Source:
    Repository/Repository.js

#### getFirstBy

  Gets the first Entity that passes through supplied filter function. Takes current sorting into account. Optional second param determines whether to take other currently-applied filters into account. Defaults to false.
  Source:
    Repository/Repository.js

#### getPhantom

  Get all phantom (unsaved) Entities
  Source:
    Repository/Repository.js

#### getNonPersisted

  Get all Entities not yet persisted to a storage medium
  Source:
    Repository/Repository.js

#### getDirty

  Get all dirty (having unsaved changes) Entities
  Source:
    Repository/Repository.js

#### getDeleted

  Get all deleted Entities
  Source:
    Repository/Repository.js

#### save

  Queues up batch operations for saving new, edited, and deleted entities to storage medium. NOTE: Since multiple operations can take place in one go, we don't change this.entities until all operations have completed. We leave it to subclasses to implement that.
  Source:
    Repository/Repository.js

#### delete

  Marks entities for deletion from storage medium. Actual deletion takes place in save()
  Source:
    Repository/Repository.js

#### deleteByIx

  Deletes a single Entity by its index (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteByRange

  Deletes multiple Entities by their range of indices (zero-indexed) on the current page
  Source:
    Repository/Repository.js

#### deleteBy

  Remove multiple Entities by supplied filter function
  Source:
    Repository/Repository.js

#### deleteById

  Remove a single Entity by its id
  Source:
    Repository/Repository.js

#### deleteDirty

  Remove dirty (having unsaved changes) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### deletePhantom

  Remove all phantom (unsaved) Entities Will *NOT* take any filtering into account.
  Source:
    Repository/Repository.js

#### setOptions

  Set config options after Repository has already been initialized
  Source:
    Repository/Repository.js

#### getClassName

  Gets the className of this Repository type.
  Source:
    Repository/Repository.js

#### getType

  Gets the type of this Repository.
  Source:
    Repository/Repository.js

### Methods

#### <async> initialize()

  Initializes the Repository. - Applies default sorters - Autoloads data, if needed This is async because we may need to wait for loading and sorting.
  Source:
    Repository/Repository.js

#### reload()

  Reload data from storage medium, using previous settings. Subclasses may override this to provide additional or differing functionality.
  Source:
    Repository/Repository.js

#### isInRepository(entity)

  Utility function. Detects if entity is in the storage medium.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `entity` | object | string | Either an Entity object, or an id

  Source:
    Repository/Repository.js

  ##### Returns:

  isInRepository - Whether or not the entity exists in this Repository
  Type
    boolean

#### destroy()

  Destroy this object. - Removes child objects - Removes event listeners
  Source:
    Repository/Repository.js

  ##### Fires:

  - event:destroy

#### Search results