DataStore has a few optional configurations, such as the ability to specify a custom handler for error messages that take place in any part of the system. You can also specify a custom conflict handler that runs if a mutation is rejected by AWS AppSync during one of the conflict resolution strategies.

Finally you can configure the number of records to sync as an upper bound on items (per-Model) which will be stored locally on the device, as well as a custom interval in minutes which is an override of the default 24 hour "base query" which runs as part of the Delta Sync process.

### Custom configuration fields
- `errorHandler` - handler function executed when Datastore encounters an unhandled error during its background operations
- `conflictHandler` - handler function that decides how to resolve conflicts between local and remote model instances in a sync operation
- `syncMaxRecords` - the maximum number of records to sync per execution
- `syncPageSize` - the page size of each sync execution
- `syncInterval` - the maximum interval (in seconds) for which the system will continue to perform delta queries. After this interval expires, the system performs a base query to retrieve all data.
- `syncExpression` - sets a sync expression for a particular model to filter which data is synced locally.  The expression is evaluated each time DataStore is started.
- `authModeStrategyType` - the authorization mode strategy used to interface with AppSync backend

### Example

The code below illustrates a conflict resolution handler for the `Post` model that retries a mutation with the same title, but the most recent remote data for all other fields. The conflict resolution handler discards conflicts for all other models (by passing `.applyRemote` to the `resolve` function).

```swift
// custom conflict resolution configuration
let dataStorePlugin = AWSDataStorePlugin(
    modelRegistration: AmplifyModels(),
    configuration: .custom(
        errorHandler: { error in Amplify.Logging.error(error: error) },
        conflictHandler: { (data, resolve) in
            guard let localPost = data.local as? Post,
                  let remotePost = data.remote as? Post
            else {
                resolve(.applyRemote)
                return
            }

            // always favor the title from the local post
            let mergedModel = Post(
                title: localPost.title,
                rating: remotePost.rating,
                status: remotePost.status
            )
            resolve(.retry(mergedModel))
        },
        // Sync configuration defaults:
        syncInterval: .hours(24),
        syncMaxRecords: 10_000,
        syncPageSize: 1_000
    )
)
```
