Show:

Base serializer for Offline.LocalStore.

Methods

_deleteDetailModels

(
  • dexieService
  • db
  • promises
  • record
)
private

Forming promises for deleting current record and its details.

Parameters:

  • dexieService Offline.DexieService

    Instance of dexie service.

  • db IndexedDB

    Instance of current IndexedDB database.

  • promises Promise

    Promises on deleting records.

  • record DS.Model

    Current record that should be deleted with details.

_extractProjectionFromQuery

(
  • modelName
  • typeClass
  • [query]
)
Object private

Retrieves projection from query and returns it. Retrieved projection removes from the query.

Parameters:

  • modelName String

    The name of the model type.

  • typeClass subclass of DS.Model

    Model type.

  • [query] Object optional

    Query parameters.

    • [projection] String optional

      Projection name.

Returns:

Object:

Extracted projection from query or null if projection is not set in query.

_makeQueryObject

(
  • store
  • modelName
  • query
  • [projection]
)
QueryObject private

Makes Query.QueryObject out of queries that look like this: { : , ... }.

Parameters:

  • store Object

    Store used for making query

  • modelName String

    The name of the model type.

  • query Object

    Query parameters.

  • [projection] Object | String optional

    Projection for query.

Returns:

QueryObject:

Query object for IndexedDB adapter.

_storeHashForBulkOperation

(
  • modelName
  • hash
)
private

Stores hash for performing bulk operaion into map.

Parameters:

addHashForBulkUpdateOrCreate

(
  • store
  • type
  • snapshot
  • fieldsToUpdate
  • syncDownTime
)
Promise

Stores record's hash for performing bulk operaion with {{#crossLink "Adapter.Offline/bulkUpdateOrCreate:method"}} method.

Parameters:

Returns:

batchUpdate

()

This method is not implemented.

bulkUpdateOrCreate

(
  • store
  • replaceIfExist
  • clearHashesOnTransactionFail
)
Promise

Performing bulk operaion with previously stored hashes.

Parameters:

  • store DS.Store
  • replaceIfExist Boolean

    If set to true then hashes will be replaced in store if they already exist

  • clearHashesOnTransactionFail Boolean

    If set to true then previously stored hashes will be cleared if transaction with bulk operations fails

Returns:

clear

(
  • [table]
)
Promise

Clear tables in IndexedDB database, if table not specified, clear all tables.

Parameters:

  • [table] String optional

    Table name.

Returns:

createRecord

(
  • store
  • type
  • snapshot
)
Promise

Implement this method in a subclass to handle the creation of new records. More info.

Parameters:

Returns:

delete

() Promise

Delete IndexedDB database.

Returns:

deleteRecord

(
  • store
  • type
  • snapshot
)
Promise

Implement this method in a subclass to handle the deletion of a record. More info.

Parameters:

Returns:

extractAttributes

(
  • model
  • hash
)
Object

Returns the resource's attributes formatted as a JSON-API "attributes object". More info.

Parameters:

Returns:

findAll

(
  • store
  • type
)
Promise

The findAll() method is used to retrieve all records for a given type. More info.

Parameters:

Returns:

findMany

(
  • store
  • type
  • ids
)
Promise

Find multiple records at once if coalesceFindRequests is true. More info.

Parameters:

Returns:

findRecord

(
  • store
  • type
  • id
)
Promise

The findRecord() method is invoked when the store is asked for a record that has not previously been loaded. More info.

Parameters:

Returns:

generateIdForRecord

(
  • store
  • type
  • inputProperties
)
String

Generate globally unique IDs for records.

Parameters:

Returns:

normalizeArrayResponse

(
  • store
  • type
  • payload
)
Object

Normalization method for arrays of objects. More info.

Parameters:

Returns:

query

(
  • store
  • type
  • query
)
Promise

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:

Returns:

queryRecord

(
  • store
  • type
  • query
)
Promise

The queryRecord() method is invoked when the store is asked for a single record through a query object. More info.

Parameters:

Returns:

serializeAttribute

(
  • snapshot
  • json
  • key
  • attribute
)

Method serializeAttribute can be used to customize how DS.attr properties are serialized. More info.

Parameters:

updateOrCreate

(
  • store
  • type
  • snapshot
  • fieldsToUpdate
)
Promise

Create record if it does not exist, or update changed fields of record.

Parameters:

Returns:

updateRecord

(
  • store
  • type
  • snapshot
)
Promise

Implement this method in a subclass to handle the updating of a record. More info.

Parameters:

Returns:

Properties

dbName

String

Database name for IndexedDB.

Default: 'ember-flexberry-data'

defaultSerializer

String

If you would like your adapter to use a custom serializer you can set the defaultSerializer property to be the name of the custom serializer. More info.

Default: 'offline'

dexieService

Offline.DexieService

Instance of dexie service.