Offline Class
Base serializer for Offline.LocalStore.
Item Index
Methods
- _deleteDetailModels
- _extractProjectionFromQuery
- _makeQueryObject
- _storeHashForBulkOperation
- addHashForBulkUpdateOrCreate
- batchUpdate
- bulkUpdateOrCreate
- clear
- createRecord
- delete
- deleteRecord
- extractAttributes
- findAll
- findMany
- findRecord
- generateIdForRecord
- normalizeArrayResponse
- query
- queryRecord
- serializeAttribute
- updateOrCreate
- updateRecord
Properties
Methods
_deleteDetailModels
-
dexieService
-
db
-
promises
-
record
Forming promises for deleting current record and its details.
_extractProjectionFromQuery
-
modelName
-
typeClass
-
[query]
Retrieves projection from query and returns it. Retrieved projection removes from the query.
Parameters:
Returns:
Extracted projection from query or null if projection is not set in query.
_makeQueryObject
-
store
-
modelName
-
query
-
[projection]
Makes Query.QueryObject out of queries that look like this:
{
Parameters:
Returns:
Query object for IndexedDB adapter.
_storeHashForBulkOperation
-
modelName
-
hash
Stores hash for performing bulk operaion into map.
addHashForBulkUpdateOrCreate
-
store
-
type
-
snapshot
-
fieldsToUpdate
-
syncDownTime
Stores record's hash for performing bulk operaion with {{#crossLink "Adapter.Offline/bulkUpdateOrCreate:method"}} method.
Parameters:
-
store
DS.Store -
type
DS.Model -
snapshot
DS.Snapshot -
fieldsToUpdate
Object -
syncDownTime
Boolean
Returns:
batchUpdate
()
This method is not implemented.
bulkUpdateOrCreate
-
store
-
replaceIfExist
-
clearHashesOnTransactionFail
Performing bulk operaion with previously stored hashes.
Parameters:
Returns:
clear
-
[table]
Clear tables in IndexedDB database, if table
not specified, clear all tables.
Parameters:
-
[table]
String optionalTable name.
Returns:
createRecord
-
store
-
type
-
snapshot
Implement this method in a subclass to handle the creation of new records. More info.
Parameters:
-
store
DS.Store -
type
DS.Model -
snapshot
DS.Snapshot
Returns:
deleteRecord
-
store
-
type
-
snapshot
Implement this method in a subclass to handle the deletion of a record. More info.
Parameters:
-
store
DS.Store -
type
DS.Model -
snapshot
DS.Snapshot
Returns:
extractAttributes
-
model
-
hash
Returns the resource's attributes formatted as a JSON-API "attributes object". More info.
Returns:
findAll
-
store
-
type
The findAll()
method is used to retrieve all records for a given type.
More info.
Returns:
findMany
-
store
-
type
-
ids
Find multiple records at once if coalesceFindRequests is true. More info.
Returns:
findRecord
-
store
-
type
-
id
The findRecord()
method is invoked when the store is asked for a record that has not previously been loaded.
More info.
Returns:
generateIdForRecord
-
store
-
type
-
inputProperties
Generate globally unique IDs for records.
Returns:
normalizeArrayResponse
-
store
-
type
-
payload
Normalization method for arrays of objects. More info.
Returns:
query
-
store
-
type
-
query
This method is called when you call query
on the store.
More info.
Supports Query.QueryObject instance or objects that look like this:
{
...
<property to query>: <value to match>,
//and
<property to query>: <value to match>,
...
}
Parameters:
-
store
DS.Store -
type
DS.Model -
query
Object | QueryObject
Returns:
queryRecord
-
store
-
type
-
query
The queryRecord()
method is invoked when the store is asked for a single record through a query object.
More info.
Parameters:
-
store
DS.Store -
type
DS.Model -
query
Object | QueryObject
Returns:
serializeAttribute
-
snapshot
-
json
-
key
-
attribute
Method serializeAttribute
can be used to customize how DS.attr properties are serialized.
More info.
Parameters:
-
snapshot
DS.Snapshot -
json
Object -
key
String -
attribute
Object
updateOrCreate
-
store
-
type
-
snapshot
-
fieldsToUpdate
Create record if it does not exist, or update changed fields of record.
Parameters:
-
store
DS.Store -
type
DS.Model -
snapshot
DS.Snapshot -
fieldsToUpdate
Object