UNPKG

react-native-ibm-mobilefirst-jsonstore

Version:

React Native SDK for IBM JSONStore. Works with IBM Mobile First

59 lines (50 loc) 1.73 kB
/* Licensed Materials - Property of IBM * 5725-I43 (C) Copyright IBM Corp. 2018. All Rights Reserved. * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /* author - Yash Soni | yashsoni21@in.ibm.com */ import { _checkParamClassType, _checkParamType, ParamTypes } from './Utils' /** * Options that are used to modify the change operation in JSONStoreCollection. */ class JSONStoreChangeOptions { /** * @type {boolean} */ addNew; /** * @type {boolean} */ markDirty; /** * @type {Array} */ searchFieldCriteria; /** * Constructor * @param {boolean} [addNew] - Flag to set if the document should be added if a previously stored document could not be found. * @param {boolean} [markDirty] - Flag to mark a document dirty. Default is false. * @param {Array} [searchFieldCriteria] - An Array of search fields that is used to compare in the database that is found in the document. */ constructor(addNew = false, markDirty = false, searchFieldCriteria = []) { _checkParamType(addNew, ParamTypes.BOOLEAN); _checkParamType(markDirty, ParamTypes.BOOLEAN); _checkParamClassType(searchFieldCriteria, Array); this.searchFieldCriteria = searchFieldCriteria; this.markDirty = markDirty; this.addNew = addNew; } /** * @ignore * */ convertToJSON = (()=> { var json = {}; json.searchFieldCriteria = this.searchFieldCriteria; json.markDirty = this.markDirty; json.addNew = this.addNew ; return json; }) } export default JSONStoreChangeOptions