9c093c65e5782e49094c2e4872d1f18387f1782e5eeb98638f4e8a44d05c6374.json 205 KB

1
  1. {"ast":null,"code":"\"use strict\";\n\nvar _asyncToGenerator = require(\"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js\").default;\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/helpers/defineProperty\"));\nvar _forEach = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/for-each\"));\nvar _indexOf = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/index-of\"));\nvar _keys = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/keys\"));\nvar _slice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/slice\"));\nvar _map = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/map\"));\nvar _filter = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/filter\"));\nvar _keys2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/keys\"));\nvar _concat = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/concat\"));\nvar _includes = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/includes\"));\nvar _sort = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/sort\"));\nvar _splice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/splice\"));\nvar _promise = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/promise\"));\nvar _find = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/find\"));\nvar _isArray = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/array/is-array\"));\nvar _entries = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/entries\"));\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _encode = _interopRequireDefault(require(\"./encode\"));\nvar _promiseUtils = require(\"./promiseUtils\");\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _ParseGeoPoint = _interopRequireDefault(require(\"./ParseGeoPoint\"));\nvar _ParseObject = _interopRequireDefault(require(\"./ParseObject\"));\nvar _OfflineQuery = _interopRequireDefault(require(\"./OfflineQuery\"));\nvar _LocalDatastoreUtils = require(\"./LocalDatastoreUtils\");\n/**\n * Converts a string into a regex that matches it.\n * Surrounding with \\Q .. \\E does this, we just need to escape any \\E's in\n * the text separately.\n *\n * @param s\n * @private\n * @returns {string}\n */\nfunction quote(s) {\n return '\\\\Q' + s.replace('\\\\E', '\\\\E\\\\\\\\E\\\\Q') + '\\\\E';\n}\n\n/**\n * Extracts the class name from queries. If not all queries have the same\n * class name an error will be thrown.\n *\n * @param queries\n * @private\n * @returns {string}\n */\nfunction _getClassNameFromQueries(queries) {\n let className = null;\n (0, _forEach.default)(queries).call(queries, q => {\n if (!className) {\n className = q.className;\n }\n if (className !== q.className) {\n throw new Error('All queries must be for the same class.');\n }\n });\n return className;\n}\n\n/*\n * Handles pre-populating the result data of a query with select fields,\n * making sure that the data object contains keys for all objects that have\n * been requested with a select, so that our cached state updates correctly.\n */\nfunction handleSelectResult(data, select) {\n const serverDataMask = {};\n (0, _forEach.default)(select).call(select, field => {\n const hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;\n if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {\n // this field was selected, but is missing from the retrieved data\n data[field] = undefined;\n } else if (hasSubObjectSelect) {\n // this field references a sub-object,\n // so we need to walk down the path components\n const pathComponents = field.split('.');\n let obj = data;\n let serverMask = serverDataMask;\n (0, _forEach.default)(pathComponents).call(pathComponents, (component, index, arr) => {\n // add keys if the expected data is missing\n if (obj && !obj.hasOwnProperty(component)) {\n obj[component] = undefined;\n }\n if (obj && typeof obj === 'object') {\n obj = obj[component];\n }\n\n //add this path component to the server mask so we can fill it in later if needed\n if (index < arr.length - 1) {\n if (!serverMask[component]) {\n serverMask[component] = {};\n }\n serverMask = serverMask[component];\n }\n });\n }\n });\n if ((0, _keys.default)(serverDataMask).length > 0) {\n // When selecting from sub-objects, we don't want to blow away the missing\n // information that we may have retrieved before. We've already added any\n // missing selected keys to sub-objects, but we still need to add in the\n // data for any previously retrieved sub-objects that were not selected.\n\n const serverData = _CoreManager.default.getObjectStateController().getServerData({\n id: data.objectId,\n className: data.className\n });\n copyMissingDataWithMask(serverData, data, serverDataMask, false);\n }\n}\nfunction copyMissingDataWithMask(src, dest, mask, copyThisLevel) {\n //copy missing elements at this level\n if (copyThisLevel) {\n for (const key in src) {\n if (src.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n }\n for (const key in mask) {\n if (dest[key] !== undefined && dest[key] !== null && src !== undefined && src !== null) {\n //traverse into objects as needed\n copyMissingDataWithMask(src[key], dest[key], mask[key], true);\n }\n }\n}\nfunction handleOfflineSort(a, b, sorts) {\n let order = sorts[0];\n const operator = (0, _slice.default)(order).call(order, 0, 1);\n const isDescending = operator === '-';\n if (isDescending) {\n order = order.substring(1);\n }\n if (order === '_created_at') {\n order = 'createdAt';\n }\n if (order === '_updated_at') {\n order = 'updatedAt';\n }\n if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {\n throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${order}`);\n }\n const field1 = a.get(order);\n const field2 = b.get(order);\n if (field1 < field2) {\n return isDescending ? 1 : -1;\n }\n if (field1 > field2) {\n return isDescending ? -1 : 1;\n }\n if (sorts.length > 1) {\n const remainingSorts = (0, _slice.default)(sorts).call(sorts, 1);\n return handleOfflineSort(a, b, remainingSorts);\n }\n return 0;\n}\n/**\n * Creates a new parse Parse.Query for the given Parse.Object subclass.\n *\n * <p>Parse.Query defines a query that is used to fetch Parse.Objects. The\n * most common use case is finding all objects that match a query through the\n * <code>find</code> method. for example, this sample code fetches all objects\n * of class <code>myclass</code>. it calls a different function depending on\n * whether the fetch succeeded or not.\n *\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.find().then((results) => {\n * // results is an array of parse.object.\n * }).catch((error) => {\n * // error is an instance of parse.error.\n * });</pre></p>\n *\n * <p>a Parse.Query can also be used to retrieve a single object whose id is\n * known, through the get method. for example, this sample code fetches an\n * object of class <code>myclass</code> and id <code>myid</code>. it calls a\n * different function depending on whether the fetch succeeded or not.\n *\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.get(myid).then((object) => {\n * // object is an instance of parse.object.\n * }).catch((error) => {\n * // error is an instance of parse.error.\n * });</pre></p>\n *\n * <p>a Parse.Query can also be used to count the number of objects that match\n * the query without retrieving all of those objects. for example, this\n * sample code counts the number of objects of the class <code>myclass</code>\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.count().then((number) => {\n * // there are number instances of myclass.\n * }).catch((error) => {\n * // error is an instance of Parse.Error.\n * });</pre></p>\n *\n * @alias Parse.Query\n */\nclass ParseQuery {\n /**\n * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.\n */\n constructor(objectClass) {\n /**\n * @property {string} className\n */\n (0, _defineProperty2.default)(this, \"className\", void 0);\n (0, _defineProperty2.default)(this, \"_where\", void 0);\n (0, _defineProperty2.default)(this, \"_watch\", void 0);\n (0, _defineProperty2.default)(this, \"_include\", void 0);\n (0, _defineProperty2.default)(this, \"_exclude\", void 0);\n (0, _defineProperty2.default)(this, \"_select\", void 0);\n (0, _defineProperty2.default)(this, \"_limit\", void 0);\n (0, _defineProperty2.default)(this, \"_skip\", void 0);\n (0, _defineProperty2.default)(this, \"_count\", void 0);\n (0, _defineProperty2.default)(this, \"_order\", void 0);\n (0, _defineProperty2.default)(this, \"_readPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_includeReadPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_subqueryReadPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_queriesLocalDatastore\", void 0);\n (0, _defineProperty2.default)(this, \"_localDatastorePinName\", void 0);\n (0, _defineProperty2.default)(this, \"_extraOptions\", void 0);\n (0, _defineProperty2.default)(this, \"_hint\", void 0);\n (0, _defineProperty2.default)(this, \"_explain\", void 0);\n (0, _defineProperty2.default)(this, \"_xhrRequest\", void 0);\n (0, _defineProperty2.default)(this, \"_comment\", void 0);\n if (typeof objectClass === 'string') {\n if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {\n this.className = '_User';\n } else {\n this.className = objectClass;\n }\n } else if (objectClass instanceof _ParseObject.default) {\n this.className = objectClass.className;\n } else if (typeof objectClass === 'function') {\n const objClass = objectClass;\n if (typeof objClass.className === 'string') {\n this.className = objClass.className;\n } else {\n const obj = new objClass();\n this.className = obj.className;\n }\n } else {\n throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');\n }\n this._where = {};\n this._watch = [];\n this._include = [];\n this._exclude = [];\n this._count = false;\n this._limit = -1; // negative limit is not sent in the server request\n this._skip = 0;\n this._readPreference = null;\n this._includeReadPreference = null;\n this._subqueryReadPreference = null;\n this._queriesLocalDatastore = false;\n this._localDatastorePinName = null;\n this._extraOptions = {};\n this._xhrRequest = {\n task: null,\n onchange: () => {}\n };\n this._comment = null;\n }\n\n /**\n * Adds constraint that at least one of the passed in queries matches.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _orQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$or = queryJSON;\n return this;\n }\n\n /**\n * Adds constraint that all of the passed in queries match.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _andQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$and = queryJSON;\n return this;\n }\n\n /**\n * Adds constraint that none of the passed in queries match.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _norQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$nor = queryJSON;\n return this;\n }\n\n /**\n * Helper for condition queries\n *\n * @param key\n * @param condition\n * @param value\n * @returns {Parse.Query}\n */\n _addCondition(key, condition, value) {\n if (!this._where[key] || typeof this._where[key] === 'string') {\n this._where[key] = {};\n }\n this._where[key][condition] = (0, _encode.default)(value, false, true);\n return this;\n }\n\n /**\n * Converts string for regular expression at the beginning\n *\n * @param string\n * @returns {string}\n */\n _regexStartWith(string) {\n return '^' + quote(string);\n }\n _handleOfflineQuery(params) {\n var _this = this;\n return _asyncToGenerator(function* () {\n var _context;\n _OfflineQuery.default.validateQuery(_this);\n const localDatastore = _CoreManager.default.getLocalDatastore();\n const objects = yield localDatastore._serializeObjectsFromPinName(_this._localDatastorePinName);\n let results = (0, _filter.default)(_context = (0, _map.default)(objects).call(objects, (json, index, arr) => {\n const object = _ParseObject.default.fromJSON(json, false);\n if (json._localId && !json.objectId) {\n object._localId = json._localId;\n }\n if (!_OfflineQuery.default.matchesQuery(_this.className, object, arr, _this)) {\n return null;\n }\n return object;\n })).call(_context, object => object !== null);\n if ((0, _keys2.default)(params)) {\n let keys = (0, _keys2.default)(params).split(',');\n keys = (0, _concat.default)(keys).call(keys, ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL']);\n results = (0, _map.default)(results).call(results, object => {\n var _context2;\n const json = object._toFullJSON();\n (0, _forEach.default)(_context2 = (0, _keys.default)(json)).call(_context2, key => {\n if (!(0, _includes.default)(keys).call(keys, key)) {\n delete json[key];\n }\n });\n return _ParseObject.default.fromJSON(json, false);\n });\n }\n if (params.order) {\n const sorts = params.order.split(',');\n (0, _sort.default)(results).call(results, (a, b) => {\n return handleOfflineSort(a, b, sorts);\n });\n }\n let count; // count total before applying limit/skip\n if (params.count) {\n count = results.length; // total count from response\n }\n if (params.skip) {\n if (params.skip >= results.length) {\n results = [];\n } else {\n results = (0, _splice.default)(results).call(results, params.skip, results.length);\n }\n }\n let limit = results.length;\n if (params.limit !== 0 && params.limit < results.length) {\n limit = params.limit;\n }\n results = (0, _splice.default)(results).call(results, 0, limit);\n if (typeof count === 'number') {\n return {\n results,\n count\n };\n }\n return results;\n })();\n }\n\n /**\n * Returns a JSON representation of this query.\n *\n * @returns {object} The JSON representation of the query.\n */\n toJSON() {\n const params = {\n where: this._where\n };\n if (this._watch.length) {\n params.watch = this._watch.join(',');\n }\n if (this._include.length) {\n params.include = this._include.join(',');\n }\n if (this._exclude.length) {\n params.excludeKeys = this._exclude.join(',');\n }\n if (this._select) {\n params.keys = this._select.join(',');\n }\n if (this._count) {\n params.count = 1;\n }\n if (this._limit >= 0) {\n params.limit = this._limit;\n }\n if (this._skip > 0) {\n params.skip = this._skip;\n }\n if (this._order) {\n params.order = this._order.join(',');\n }\n if (this._readPreference) {\n params.readPreference = this._readPreference;\n }\n if (this._includeReadPreference) {\n params.includeReadPreference = this._includeReadPreference;\n }\n if (this._subqueryReadPreference) {\n params.subqueryReadPreference = this._subqueryReadPreference;\n }\n if (this._hint) {\n params.hint = this._hint;\n }\n if (this._explain) {\n params.explain = true;\n }\n if (this._comment) {\n params.comment = this._comment;\n }\n for (const key in this._extraOptions) {\n params[key] = this._extraOptions[key];\n }\n return params;\n }\n\n /**\n * Return a query with conditions from json, can be useful to send query from server side to client\n * Not static, all query conditions was set before calling this method will be deleted.\n * For example on the server side we have\n * var query = new Parse.Query(\"className\");\n * query.equalTo(key: value);\n * query.limit(100);\n * ... (others queries)\n * Create JSON representation of Query Object\n * var jsonFromServer = query.fromJSON();\n *\n * On client side getting query:\n * var query = new Parse.Query(\"className\");\n * query.fromJSON(jsonFromServer);\n *\n * and continue to query...\n * query.skip(100).find().then(...);\n *\n * @param {QueryJSON} json from Parse.Query.toJSON() method\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withJSON(json) {\n if (json.where) {\n this._where = json.where;\n }\n if (json.watch) {\n this._watch = json.watch.split(',');\n }\n if (json.include) {\n this._include = json.include.split(',');\n }\n if ((0, _keys2.default)(json)) {\n this._select = (0, _keys2.default)(json).split(',');\n }\n if (json.excludeKeys) {\n this._exclude = json.excludeKeys.split(',');\n }\n if (json.count) {\n this._count = json.count === 1;\n }\n if (json.limit) {\n this._limit = json.limit;\n }\n if (json.skip) {\n this._skip = json.skip;\n }\n if (json.order) {\n this._order = json.order.split(',');\n }\n if (json.readPreference) {\n this._readPreference = json.readPreference;\n }\n if (json.includeReadPreference) {\n this._includeReadPreference = json.includeReadPreference;\n }\n if (json.subqueryReadPreference) {\n this._subqueryReadPreference = json.subqueryReadPreference;\n }\n if (json.hint) {\n this._hint = json.hint;\n }\n if (json.explain) {\n this._explain = !!json.explain;\n }\n if (json.comment) {\n this._comment = json.comment;\n }\n for (const key in json) {\n if (json.hasOwnProperty(key)) {\n var _context3;\n if ((0, _indexOf.default)(_context3 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment']).call(_context3, key) === -1) {\n this._extraOptions[key] = json[key];\n }\n }\n }\n return this;\n }\n\n /**\n * Static method to restore Parse.Query by json representation\n * Internally calling Parse.Query.withJSON\n *\n * @param {string} className\n * @param {QueryJSON} json from Parse.Query.toJSON() method\n * @returns {Parse.Query} new created query\n */\n static fromJSON(className, json) {\n const query = new ParseQuery(className);\n return query.withJSON(json);\n }\n\n /**\n * Constructs a Parse.Object whose id is already known by fetching data from\n * the server. Unlike the <code>first</code> method, it never returns undefined.\n *\n * @param {string} objectId The id of the object to be fetched.\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the result when\n * the query completes.\n */\n get(objectId, options) {\n this.equalTo('objectId', objectId);\n const firstOptions = {};\n if (options && options.hasOwnProperty('useMasterKey')) {\n firstOptions.useMasterKey = options.useMasterKey;\n }\n if (options && options.hasOwnProperty('sessionToken')) {\n firstOptions.sessionToken = options.sessionToken;\n }\n if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {\n firstOptions.context = options.context;\n }\n if (options && options.hasOwnProperty('json')) {\n firstOptions.json = options.json;\n }\n return this.first(firstOptions).then(response => {\n if (response) {\n return response;\n }\n const errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');\n return _promise.default.reject(errorObject);\n });\n }\n\n /**\n * Retrieves a list of ParseObjects that satisfy this query.\n *\n * @param {object} options Valid options\n * are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the results when\n * the query completes.\n */\n find(options) {\n options = options || {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const select = this._select;\n if (this._queriesLocalDatastore) {\n return this._handleOfflineQuery(this.toJSON());\n }\n return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(response => {\n var _response$results;\n // Return generic object when explain is used\n if (this._explain) {\n return response.results;\n }\n const results = (_response$results = response.results) === null || _response$results === void 0 ? void 0 : _response$results.map(data => {\n // In cases of relations, the server may send back a className\n // on the top level of the payload\n const override = response.className || this.className;\n if (!data.className) {\n data.className = override;\n }\n\n // Make sure the data object contains keys for all objects that\n // have been requested with a select, so that our cached state\n // updates correctly.\n if (select) {\n handleSelectResult(data, select);\n }\n if (options.json) {\n return data;\n } else {\n return _ParseObject.default.fromJSON(data, !select);\n }\n });\n const count = response.count;\n if (typeof count === 'number') {\n return {\n results,\n count\n };\n } else {\n return results;\n }\n });\n }\n\n /**\n * Retrieves a complete list of ParseObjects that satisfy this query.\n * Using `eachBatch` under the hood to fetch all the valid objects.\n *\n * @param {object} options Valid options are:<ul>\n * <li>batchSize: How many objects to yield in each batch (default: 100)\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that is resolved with the results when\n * the query completes.\n */\n findAll(options) {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n let result = [];\n yield _this2.eachBatch(objects => {\n result = [...result, ...objects];\n }, options);\n return result;\n })();\n }\n\n /**\n * Counts the number of objects that match this query.\n *\n * @param {object} options\n * @param {boolean} [options.useMasterKey]\n * @param {string} [options.sessionToken]\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that is resolved with the count when\n * the query completes.\n */\n count(options) {\n options = options || {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = this.toJSON();\n params.limit = 0;\n params.count = 1;\n return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(result => {\n return result.count;\n });\n }\n\n /**\n * Executes a distinct query and returns unique values\n *\n * @param {string} key A field to find distinct values\n * @param {object} options\n * @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.\n * @returns {Promise} A promise that is resolved with the query completes.\n */\n distinct(key, options) {\n options = options || {};\n const distinctOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('sessionToken')) {\n distinctOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(distinctOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = {\n distinct: key,\n where: this._where,\n hint: this._hint\n };\n return controller.aggregate(this.className, params, distinctOptions).then(results => {\n return results.results;\n });\n }\n\n /**\n * Executes an aggregate query and returns aggregate results\n *\n * @param {(Array|object)} pipeline Array or Object of stages to process query\n * @param {object} options\n * @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.\n * @returns {Promise} A promise that is resolved with the query completes.\n */\n aggregate(pipeline, options) {\n options = options || {};\n const aggregateOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('sessionToken')) {\n aggregateOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(aggregateOptions);\n const controller = _CoreManager.default.getQueryController();\n if (!(0, _isArray.default)(pipeline) && typeof pipeline !== 'object') {\n throw new Error('Invalid pipeline must be Array or Object');\n }\n if ((0, _keys.default)(this._where || {}).length) {\n if (!(0, _isArray.default)(pipeline)) {\n pipeline = [pipeline];\n }\n pipeline.unshift({\n $match: this._where\n });\n }\n const params = {\n pipeline,\n hint: this._hint,\n explain: this._explain,\n readPreference: this._readPreference\n };\n return controller.aggregate(this.className, params, aggregateOptions).then(results => {\n return results.results;\n });\n }\n\n /**\n * Retrieves at most one Parse.Object that satisfies this query.\n *\n * Returns the object if there is one, otherwise undefined.\n *\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the object when\n * the query completes.\n */\n first() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = this.toJSON();\n params.limit = 1;\n const select = this._select;\n if (this._queriesLocalDatastore) {\n return this._handleOfflineQuery(params).then(objects => {\n if (!objects[0]) {\n return undefined;\n }\n return objects[0];\n });\n }\n return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(response => {\n const objects = response.results;\n if (!objects[0]) {\n return undefined;\n }\n if (!objects[0].className) {\n objects[0].className = this.className;\n }\n\n // Make sure the data object contains keys for all objects that\n // have been requested with a select, so that our cached state\n // updates correctly.\n if (select) {\n handleSelectResult(objects[0], select);\n }\n if (options.json) {\n return objects[0];\n } else {\n return _ParseObject.default.fromJSON(objects[0], !select);\n }\n });\n }\n\n /**\n * Iterates over objects matching a query, calling a callback for each batch.\n * If the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are processed\n * in an unspecified order. The query may not have any sort order, and may\n * not use limit or skip.\n *\n * @param {Function} callback Callback that will be called with each result\n * of the query.\n * @param {object} options Valid options are:<ul>\n * <li>batchSize: How many objects to yield in each batch (default: 100)\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n eachBatch(callback, options) {\n options = options || {};\n if (this._order || this._skip || this._limit >= 0) {\n return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');\n }\n const query = new ParseQuery(this.className);\n query._limit = options.batchSize || 100;\n query._include = [...this._include];\n query._exclude = [...this._exclude];\n if (this._select) {\n query._select = [...this._select];\n }\n query._hint = this._hint;\n query._where = {};\n for (const attr in this._where) {\n const val = this._where[attr];\n if ((0, _isArray.default)(val)) {\n query._where[attr] = (0, _map.default)(val).call(val, v => {\n return v;\n });\n } else if (val && typeof val === 'object') {\n const conditionMap = {};\n query._where[attr] = conditionMap;\n for (const cond in val) {\n conditionMap[cond] = val[cond];\n }\n } else {\n query._where[attr] = val;\n }\n }\n query.ascending('objectId');\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n if (options.hasOwnProperty('json')) {\n findOptions.json = options.json;\n }\n let finished = false;\n let previousResults = [];\n return (0, _promiseUtils.continueWhile)(() => {\n return !finished;\n }, /*#__PURE__*/_asyncToGenerator(function* () {\n const [results] = yield _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);\n if (results.length >= query._limit) {\n query.greaterThan('objectId', results[results.length - 1].id);\n previousResults = results;\n } else if (results.length > 0) {\n yield _promise.default.resolve(callback(results));\n finished = true;\n } else {\n finished = true;\n }\n }));\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback that will be called with each result\n * of the query.\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n each(callback, options) {\n return this.eachBatch(results => {\n let callbacksDone = _promise.default.resolve();\n (0, _forEach.default)(results).call(results, result => {\n callbacksDone = callbacksDone.then(() => {\n return callback(result);\n });\n });\n return callbacksDone;\n }, options);\n }\n\n /**\n * Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)\n *\n * @param {(string|object)} value String or Object of index that should be used when executing query\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n hint(value) {\n if (typeof value === 'undefined') {\n delete this._hint;\n }\n this._hint = value;\n return this;\n }\n\n /**\n * Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)\n *\n * @param {boolean} explain Used to toggle the information on the query plan.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n explain() {\n let explain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (typeof explain !== 'boolean') {\n throw new Error('You can only set explain to a boolean value');\n }\n this._explain = explain;\n return this;\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * <li>query: The query map was called upon.</li>\n * </ul>\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n map(callback, options) {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n const array = [];\n let index = 0;\n yield _this3.each(object => {\n return _promise.default.resolve(callback(object, index, _this3)).then(result => {\n array.push(result);\n index += 1;\n });\n }, options);\n return array;\n })();\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.</li>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * </ul>\n * @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n reduce(callback, initialValue, options) {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n let accumulator = initialValue;\n let index = 0;\n yield _this4.each(object => {\n // If no initial value was given, we take the first object from the query\n // as the initial value and don't call the callback with it.\n if (index === 0 && initialValue === undefined) {\n accumulator = object;\n index += 1;\n return;\n }\n return _promise.default.resolve(callback(accumulator, object, index)).then(result => {\n accumulator = result;\n index += 1;\n });\n }, options);\n if (index === 0 && initialValue === undefined) {\n // Match Array.reduce behavior: \"Calling reduce() on an empty array\n // without an initialValue will throw a TypeError\".\n throw new TypeError('Reducing empty query result set with no initial value');\n }\n return accumulator;\n })();\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * <li>query: The query filter was called upon.</li>\n * </ul>\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n filter(callback, options) {\n var _this5 = this;\n return _asyncToGenerator(function* () {\n const array = [];\n let index = 0;\n yield _this5.each(object => {\n return _promise.default.resolve(callback(object, index, _this5)).then(flag => {\n if (flag) {\n array.push(object);\n }\n index += 1;\n });\n }, options);\n return array;\n })();\n }\n\n /* Query Conditions */\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that the Parse.Object must contain.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n equalTo(key, value) {\n if (key && typeof key === 'object') {\n var _context4;\n (0, _forEach.default)(_context4 = (0, _entries.default)(key)).call(_context4, _ref => {\n let [k, val] = _ref;\n return this.equalTo(k, val);\n });\n return this;\n }\n if (typeof value === 'undefined') {\n return this.doesNotExist(key);\n }\n this._where[key] = (0, _encode.default)(value, false, true);\n return this;\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be not equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that must not be equalled.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n notEqualTo(key, value) {\n if (key && typeof key === 'object') {\n var _context5;\n (0, _forEach.default)(_context5 = (0, _entries.default)(key)).call(_context5, _ref2 => {\n let [k, val] = _ref2;\n return this.notEqualTo(k, val);\n });\n return this;\n }\n return this._addCondition(key, '$ne', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be less than the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an upper bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n lessThan(key, value) {\n return this._addCondition(key, '$lt', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be greater than the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an lower bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n greaterThan(key, value) {\n return this._addCondition(key, '$gt', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be less than or equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an upper bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n lessThanOrEqualTo(key, value) {\n return this._addCondition(key, '$lte', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be greater than or equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param {*} value The value that provides an lower bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n greaterThanOrEqualTo(key, value) {\n return this._addCondition(key, '$gte', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be contained in the provided list of values.\n *\n * @param {string} key The key to check.\n * @param {Array<*>} value The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containedIn(key, value) {\n return this._addCondition(key, '$in', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * not be contained in the provided list of values.\n *\n * @param {string} key The key to check.\n * @param {Array<*>} value The values that will not match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n notContainedIn(key, value) {\n return this._addCondition(key, '$nin', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be contained by the provided list of values. Get objects where all array elements match.\n *\n * @param {string} key The key to check.\n * @param {Array} values The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containedBy(key, values) {\n return this._addCondition(key, '$containedBy', values);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * contain each one of the provided list of values.\n *\n * @param {string} key The key to check. This key's value must be an array.\n * @param {Array} values The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containsAll(key, values) {\n return this._addCondition(key, '$all', values);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * contain each one of the provided list of values starting with given strings.\n *\n * @param {string} key The key to check. This key's value must be an array.\n * @param {Array<string>} values The string values that will match as starting string.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containsAllStartingWith(key, values) {\n if (!(0, _isArray.default)(values)) {\n values = [values];\n }\n const regexObject = (0, _map.default)(values).call(values, value => {\n return {\n $regex: this._regexStartWith(value)\n };\n });\n return this.containsAll(key, regexObject);\n }\n\n /**\n * Adds a constraint for finding objects that contain the given key.\n *\n * @param {string} key The key that should exist.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n exists(key) {\n return this._addCondition(key, '$exists', true);\n }\n\n /**\n * Adds a constraint for finding objects that do not contain a given key.\n *\n * @param {string} key The key that should not exist\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotExist(key) {\n return this._addCondition(key, '$exists', false);\n }\n\n /**\n * Adds a regular expression constraint for finding string values that match\n * the provided regular expression.\n * This may be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {RegExp | string} regex The regular expression pattern to match.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matches(key, regex, modifiers) {\n this._addCondition(key, '$regex', regex);\n if (!modifiers) {\n modifiers = '';\n }\n if (typeof regex !== 'string') {\n if (regex.ignoreCase) {\n modifiers += 'i';\n }\n if (regex.multiline) {\n modifiers += 'm';\n }\n }\n if (modifiers.length) {\n this._addCondition(key, '$options', modifiers);\n }\n return this;\n }\n\n /**\n * Adds a constraint that requires that a key's value matches a Parse.Query\n * constraint.\n *\n * @param {string} key The key that the contains the object to match the\n * query.\n * @param {Parse.Query} query The query that should match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matchesQuery(key, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$inQuery', queryJSON);\n }\n\n /**\n * Adds a constraint that requires that a key's value not matches a\n * Parse.Query constraint.\n *\n * @param {string} key The key that the contains the object to match the\n * query.\n * @param {Parse.Query} query The query that should not match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotMatchQuery(key, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$notInQuery', queryJSON);\n }\n\n /**\n * Adds a constraint that requires that a key's value matches a value in\n * an object returned by a different Parse.Query.\n *\n * @param {string} key The key that contains the value that is being\n * matched.\n * @param {string} queryKey The key in the objects returned by the query to\n * match against.\n * @param {Parse.Query} query The query to run.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matchesKeyInQuery(key, queryKey, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$select', {\n key: queryKey,\n query: queryJSON\n });\n }\n\n /**\n * Adds a constraint that requires that a key's value not match a value in\n * an object returned by a different Parse.Query.\n *\n * @param {string} key The key that contains the value that is being\n * excluded.\n * @param {string} queryKey The key in the objects returned by the query to\n * match against.\n * @param {Parse.Query} query The query to run.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotMatchKeyInQuery(key, queryKey, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$dontSelect', {\n key: queryKey,\n query: queryJSON\n });\n }\n\n /**\n * Adds a constraint for finding string values that contain a provided\n * string. This may be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} substring The substring that the value must contain.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n contains(key, substring) {\n if (typeof substring !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this._addCondition(key, '$regex', quote(substring));\n }\n\n /**\n * Adds a constraint for finding string values that contain a provided\n * string. This may be slow for large datasets. Requires Parse-Server > 2.5.0\n *\n * In order to sort you must use select and ascending ($score is required)\n * <pre>\n * query.fullText('field', 'term');\n * query.ascending('$score');\n * query.select('$score');\n * </pre>\n *\n * To retrieve the weight / rank\n * <pre>\n * object->get('score');\n * </pre>\n *\n * You can define optionals by providing an object as a third parameter\n * <pre>\n * query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });\n * </pre>\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} value The string to search\n * @param {object} options (Optional)\n * @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.\n * @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.\n * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fullText(key, value) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n options = options || {};\n if (!key) {\n throw new Error('A key is required.');\n }\n if (!value) {\n throw new Error('A search term is required');\n }\n if (typeof value !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n const fullOptions = {};\n fullOptions.$term = value;\n for (const option in options) {\n switch (option) {\n case 'language':\n fullOptions.$language = options[option];\n break;\n case 'caseSensitive':\n fullOptions.$caseSensitive = options[option];\n break;\n case 'diacriticSensitive':\n fullOptions.$diacriticSensitive = options[option];\n break;\n default:\n throw new Error(`Unknown option: ${option}`);\n }\n }\n return this._addCondition(key, '$text', {\n $search: fullOptions\n });\n }\n\n /**\n * Method to sort the full text search by text score\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n sortByTextScore() {\n this.ascending('$score');\n this.select(['$score']);\n return this;\n }\n\n /**\n * Adds a constraint for finding string values that start with a provided\n * string. This query will use the backend index, so it will be fast even\n * for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} prefix The substring that the value must start with.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n startsWith(key, prefix, modifiers) {\n if (typeof prefix !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this.matches(key, this._regexStartWith(prefix), modifiers);\n }\n\n /**\n * Adds a constraint for finding string values that end with a provided\n * string. This will be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} suffix The substring that the value must end with.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n endsWith(key, suffix, modifiers) {\n if (typeof suffix !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this.matches(key, quote(suffix) + '$', modifiers);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n near(key, point) {\n if (!(point instanceof _ParseGeoPoint.default)) {\n // Try to cast it as a GeoPoint\n point = new _ParseGeoPoint.default(point);\n }\n return this._addCondition(key, '$nearSphere', point);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in radians) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinRadians(key, point, maxDistance, sorted) {\n if (sorted || sorted === undefined) {\n this.near(key, point);\n return this._addCondition(key, '$maxDistance', maxDistance);\n } else {\n return this._addCondition(key, '$geoWithin', {\n $centerSphere: [[point.longitude, point.latitude], maxDistance]\n });\n }\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n * Radius of earth used is 3958.8 miles.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in miles) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinMiles(key, point, maxDistance, sorted) {\n return this.withinRadians(key, point, maxDistance / 3958.8, sorted);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n * Radius of earth used is 6371.0 kilometers.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in kilometers) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinKilometers(key, point, maxDistance, sorted) {\n return this.withinRadians(key, point, maxDistance / 6371.0, sorted);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's\n * coordinates be contained within a given rectangular geographic bounding\n * box.\n *\n * @param {string} key The key to be constrained.\n * @param {Parse.GeoPoint} southwest\n * The lower-left inclusive corner of the box.\n * @param {Parse.GeoPoint} northeast\n * The upper-right inclusive corner of the box.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinGeoBox(key, southwest, northeast) {\n if (!(southwest instanceof _ParseGeoPoint.default)) {\n southwest = new _ParseGeoPoint.default(southwest);\n }\n if (!(northeast instanceof _ParseGeoPoint.default)) {\n northeast = new _ParseGeoPoint.default(northeast);\n }\n this._addCondition(key, '$within', {\n $box: [southwest, northeast]\n });\n return this;\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's\n * coordinates be contained within and on the bounds of a given polygon.\n * Supports closed and open (last point is connected to first) paths\n *\n * Polygon must have at least 3 points\n *\n * @param {string} key The key to be constrained.\n * @param {Array} points Array of Coordinates / GeoPoints\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinPolygon(key, points) {\n return this._addCondition(key, '$geoWithin', {\n $polygon: points\n });\n }\n\n /**\n * Add a constraint to the query that requires a particular key's\n * coordinates that contains a ParseGeoPoint\n *\n * @param {string} key The key to be constrained.\n * @param {Parse.GeoPoint} point\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n polygonContains(key, point) {\n return this._addCondition(key, '$geoIntersects', {\n $point: point\n });\n }\n\n /* Query Orderings */\n\n /**\n * Sorts the results in ascending order by the given key.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n ascending() {\n this._order = [];\n for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {\n keys[_key] = arguments[_key];\n }\n return this.addAscending.apply(this, keys);\n }\n\n /**\n * Sorts the results in ascending order by the given key,\n * but can also add secondary sort descriptors without overwriting _order.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n addAscending() {\n if (!this._order) {\n this._order = [];\n }\n for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n keys[_key2] = arguments[_key2];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n var _context6;\n if ((0, _isArray.default)(key)) {\n key = key.join();\n }\n this._order = (0, _concat.default)(_context6 = this._order).call(_context6, key.replace(/\\s/g, '').split(','));\n });\n return this;\n }\n\n /**\n * Sorts the results in descending order by the given key.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n descending() {\n this._order = [];\n for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n keys[_key3] = arguments[_key3];\n }\n return this.addDescending.apply(this, keys);\n }\n\n /**\n * Sorts the results in descending order by the given key,\n * but can also add secondary sort descriptors without overwriting _order.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n addDescending() {\n if (!this._order) {\n this._order = [];\n }\n for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n keys[_key4] = arguments[_key4];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n var _context7, _context8;\n if ((0, _isArray.default)(key)) {\n key = key.join();\n }\n this._order = (0, _concat.default)(_context7 = this._order).call(_context7, (0, _map.default)(_context8 = key.replace(/\\s/g, '').split(',')).call(_context8, k => {\n return '-' + k;\n }));\n });\n return this;\n }\n\n /* Query Options */\n\n /**\n * Sets the number of results to skip before returning any results.\n * This is useful for pagination.\n * Default is to skip zero results.\n *\n * @param {number} n the number of results to skip.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n skip(n) {\n if (typeof n !== 'number' || n < 0) {\n throw new Error('You can only skip by a positive number');\n }\n this._skip = n;\n return this;\n }\n\n /**\n * Sets the limit of the number of results to return. The default limit is 100.\n *\n * @param {number} n the number of results to limit to.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n limit(n) {\n if (typeof n !== 'number') {\n throw new Error('You can only set the limit to a numeric value');\n }\n this._limit = n;\n return this;\n }\n\n /**\n * Sets the flag to include with response the total number of objects satisfying this query,\n * despite limits/skip. Might be useful for pagination.\n * Note that result of this query will be wrapped as an object with\n * `results`: holding {ParseObject} array and `count`: integer holding total number\n *\n * @param {boolean} includeCount false - disable, true - enable.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withCount() {\n let includeCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (typeof includeCount !== 'boolean') {\n throw new Error('You can only set withCount to a boolean value');\n }\n this._count = includeCount;\n return this;\n }\n /**\n * Includes nested Parse.Objects for the provided key. You can use dot\n * notation to specify which fields in the included object are also fetched.\n *\n * You can include all nested Parse.Objects by passing in '*'.\n * Requires Parse Server 3.0.0+\n * <pre>query.include('*');</pre>\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to include.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n include() {\n for (var _len5 = arguments.length, keys = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n keys[_key5] = arguments[_key5];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context9;\n this._include = (0, _concat.default)(_context9 = this._include).call(_context9, key);\n } else {\n this._include.push(key);\n }\n });\n return this;\n }\n\n /**\n * Includes all nested Parse.Objects one level deep.\n *\n * Requires Parse Server 3.0.0+\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n includeAll() {\n return this.include('*');\n }\n\n /**\n * Restricts the fields of the returned Parse.Objects to include only the\n * provided keys. If this is called multiple times, then all of the keys\n * specified in each of the calls will be included.\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to include.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n select() {\n if (!this._select) {\n this._select = [];\n }\n for (var _len6 = arguments.length, keys = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n keys[_key6] = arguments[_key6];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context10;\n this._select = (0, _concat.default)(_context10 = this._select).call(_context10, key);\n } else {\n this._select.push(key);\n }\n });\n return this;\n }\n\n /**\n * Restricts the fields of the returned Parse.Objects to all keys except the\n * provided keys. Exclude takes precedence over select and include.\n *\n * Requires Parse Server 3.6.0+\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n exclude() {\n for (var _len7 = arguments.length, keys = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n keys[_key7] = arguments[_key7];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context11;\n this._exclude = (0, _concat.default)(_context11 = this._exclude).call(_context11, key);\n } else {\n this._exclude.push(key);\n }\n });\n return this;\n }\n\n /**\n * Restricts live query to trigger only for watched fields.\n *\n * Requires Parse Server 6.0.0+\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to watch.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n watch() {\n for (var _len8 = arguments.length, keys = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n keys[_key8] = arguments[_key8];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context12;\n this._watch = (0, _concat.default)(_context12 = this._watch).call(_context12, key);\n } else {\n this._watch.push(key);\n }\n });\n return this;\n }\n\n /**\n * Changes the read preference that the backend will use when performing the query to the database.\n *\n * @param {string} readPreference The read preference for the main query.\n * @param {string} includeReadPreference The read preference for the queries to include pointers.\n * @param {string} subqueryReadPreference The read preference for the sub queries.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n readPreference(readPreference, includeReadPreference, subqueryReadPreference) {\n this._readPreference = readPreference;\n this._includeReadPreference = includeReadPreference || null;\n this._subqueryReadPreference = subqueryReadPreference || null;\n return this;\n }\n\n /**\n * Subscribe this query to get liveQuery updates\n *\n * @param {string} sessionToken (optional) Defaults to the currentUser\n * @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter\n * which can be used to get liveQuery updates.\n */\n subscribe(sessionToken) {\n var _this6 = this;\n return _asyncToGenerator(function* () {\n const currentUser = yield _CoreManager.default.getUserController().currentUserAsync();\n if (!sessionToken) {\n sessionToken = currentUser ? currentUser.getSessionToken() || undefined : undefined;\n }\n const liveQueryClient = yield _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();\n if (liveQueryClient.shouldOpen()) {\n liveQueryClient.open();\n }\n const subscription = liveQueryClient.subscribe(_this6, sessionToken);\n return subscription.subscribePromise.then(() => {\n return subscription;\n });\n })();\n }\n\n /**\n * Constructs a Parse.Query that is the OR of the passed in queries. For\n * example:\n * <pre>var compoundQuery = Parse.Query.or(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is an or of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to OR.\n * @static\n * @returns {Parse.Query} The query that is the OR of the passed in queries.\n */\n static or() {\n for (var _len9 = arguments.length, queries = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n queries[_key9] = arguments[_key9];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._orQuery(queries);\n return query;\n }\n\n /**\n * Constructs a Parse.Query that is the AND of the passed in queries. For\n * example:\n * <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is an and of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to AND.\n * @static\n * @returns {Parse.Query} The query that is the AND of the passed in queries.\n */\n static and() {\n for (var _len10 = arguments.length, queries = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n queries[_key10] = arguments[_key10];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._andQuery(queries);\n return query;\n }\n\n /**\n * Constructs a Parse.Query that is the NOR of the passed in queries. For\n * example:\n * <pre>const compoundQuery = Parse.Query.nor(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is a nor of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to NOR.\n * @static\n * @returns {Parse.Query} The query that is the NOR of the passed in queries.\n */\n static nor() {\n for (var _len11 = arguments.length, queries = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n queries[_key11] = arguments[_key11];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._norQuery(queries);\n return query;\n }\n\n /**\n * Change the source of this query to the server.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromNetwork() {\n this._queriesLocalDatastore = false;\n this._localDatastorePinName = null;\n return this;\n }\n\n /**\n * Changes the source of this query to all pinned objects.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromLocalDatastore() {\n return this.fromPinWithName(null);\n }\n\n /**\n * Changes the source of this query to the default group of pinned objects.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromPin() {\n return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);\n }\n\n /**\n * Changes the source of this query to a specific group of pinned objects.\n *\n * @param {string} name The name of query source.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromPinWithName(name) {\n const localDatastore = _CoreManager.default.getLocalDatastore();\n if (localDatastore.checkIfEnabled()) {\n this._queriesLocalDatastore = true;\n this._localDatastorePinName = name;\n }\n return this;\n }\n\n /**\n * Cancels the current network request (if any is running).\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n cancel() {\n if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {\n this._xhrRequest.task._aborted = true;\n this._xhrRequest.task.abort();\n this._xhrRequest.task = null;\n this._xhrRequest.onchange = () => {};\n return this;\n }\n this._xhrRequest.onchange = () => this.cancel();\n return this;\n }\n _setRequestTask(options) {\n options.requestTask = task => {\n this._xhrRequest.task = task;\n this._xhrRequest.onchange();\n };\n }\n\n /**\n * Sets a comment to the query so that the query\n * can be identified when using a the profiler for MongoDB.\n *\n * @param {string} value a comment can make your profile data easier to interpret and trace.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n comment(value) {\n if (value == null) {\n delete this._comment;\n return this;\n }\n if (typeof value !== 'string') {\n throw new Error('The value of a comment to be sent with this query must be a string.');\n }\n this._comment = value;\n return this;\n }\n}\nconst DefaultController = {\n find(className, params, options) {\n const RESTController = _CoreManager.default.getRESTController();\n return RESTController.request('GET', 'classes/' + className, params, options);\n },\n aggregate(className, params, options) {\n const RESTController = _CoreManager.default.getRESTController();\n return RESTController.request('GET', 'aggregate/' + className, params, options);\n }\n};\n_CoreManager.default.setParseQuery(ParseQuery);\n_CoreManager.default.setQueryController(DefaultController);\nvar _default = exports.default = ParseQuery;","map":{"version":3,"names":["_asyncToGenerator","require","default","_Object$defineProperty","_interopRequireDefault","exports","value","_defineProperty2","_forEach","_indexOf","_keys","_slice","_map","_filter","_keys2","_concat","_includes","_sort","_splice","_promise","_find","_isArray","_entries","_CoreManager","_encode","_promiseUtils","_ParseError","_ParseGeoPoint","_ParseObject","_OfflineQuery","_LocalDatastoreUtils","quote","s","replace","_getClassNameFromQueries","queries","className","call","q","Error","handleSelectResult","data","select","serverDataMask","field","hasSubObjectSelect","hasOwnProperty","undefined","pathComponents","split","obj","serverMask","component","index","arr","length","serverData","getObjectStateController","getServerData","id","objectId","copyMissingDataWithMask","src","dest","mask","copyThisLevel","key","handleOfflineSort","a","b","sorts","order","operator","isDescending","substring","test","INVALID_KEY_NAME","field1","get","field2","remainingSorts","ParseQuery","constructor","objectClass","objClass","TypeError","_where","_watch","_include","_exclude","_count","_limit","_skip","_readPreference","_includeReadPreference","_subqueryReadPreference","_queriesLocalDatastore","_localDatastorePinName","_extraOptions","_xhrRequest","task","onchange","_comment","_orQuery","queryJSON","toJSON","where","$or","_andQuery","$and","_norQuery","$nor","_addCondition","condition","_regexStartWith","string","_handleOfflineQuery","params","_this","_context","validateQuery","localDatastore","getLocalDatastore","objects","_serializeObjectsFromPinName","results","json","object","fromJSON","_localId","matchesQuery","keys","_context2","_toFullJSON","count","skip","limit","watch","join","include","excludeKeys","_select","_order","readPreference","includeReadPreference","subqueryReadPreference","_hint","hint","_explain","explain","comment","withJSON","_context3","query","options","equalTo","firstOptions","useMasterKey","sessionToken","context","first","then","response","errorObject","OBJECT_NOT_FOUND","reject","find","findOptions","_setRequestTask","controller","getQueryController","_response$results","map","override","findAll","_this2","result","eachBatch","distinct","distinctOptions","aggregate","pipeline","aggregateOptions","unshift","$match","arguments","callback","batchSize","attr","val","v","conditionMap","cond","ascending","finished","previousResults","continueWhile","all","resolve","greaterThan","each","callbacksDone","_this3","array","push","reduce","initialValue","_this4","accumulator","filter","_this5","flag","_context4","_ref","k","doesNotExist","notEqualTo","_context5","_ref2","lessThan","lessThanOrEqualTo","greaterThanOrEqualTo","containedIn","notContainedIn","containedBy","values","containsAll","containsAllStartingWith","regexObject","$regex","exists","matches","regex","modifiers","ignoreCase","multiline","doesNotMatchQuery","matchesKeyInQuery","queryKey","doesNotMatchKeyInQuery","contains","fullText","fullOptions","$term","option","$language","$caseSensitive","$diacriticSensitive","$search","sortByTextScore","startsWith","prefix","endsWith","suffix","near","point","withinRadians","maxDistance","sorted","$centerSphere","longitude","latitude","withinMiles","withinKilometers","withinGeoBox","southwest","northeast","$box","withinPolygon","points","$polygon","polygonContains","$point","_len","Array","_key","addAscending","apply","_len2","_key2","_context6","descending","_len3","_key3","addDescending","_len4","_key4","_context7","_context8","n","withCount","includeCount","_len5","_key5","_context9","includeAll","_len6","_key6","_context10","exclude","_len7","_key7","_context11","_len8","_key8","_context12","subscribe","_this6","currentUser","getUserController","currentUserAsync","getSessionToken","liveQueryClient","getLiveQueryController","getDefaultLiveQueryClient","shouldOpen","open","subscription","subscribePromise","or","_len9","_key9","and","_len10","_key10","nor","_len11","_key11","fromNetwork","fromLocalDatastore","fromPinWithName","fromPin","DEFAULT_PIN","name","checkIfEnabled","cancel","abort","_aborted","requestTask","DefaultController","RESTController","getRESTController","request","setParseQuery","setQueryController","_default"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/parse/lib/browser/ParseQuery.js"],"sourcesContent":["\"use strict\";\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs3/core-js-stable/object/define-property\");\nvar _interopRequireDefault = require(\"@babel/runtime-corejs3/helpers/interopRequireDefault\");\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _defineProperty2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/helpers/defineProperty\"));\nvar _forEach = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/for-each\"));\nvar _indexOf = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/index-of\"));\nvar _keys = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/keys\"));\nvar _slice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/slice\"));\nvar _map = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/map\"));\nvar _filter = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/filter\"));\nvar _keys2 = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/keys\"));\nvar _concat = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/concat\"));\nvar _includes = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/includes\"));\nvar _sort = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/sort\"));\nvar _splice = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/splice\"));\nvar _promise = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/promise\"));\nvar _find = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/instance/find\"));\nvar _isArray = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/array/is-array\"));\nvar _entries = _interopRequireDefault(require(\"@babel/runtime-corejs3/core-js-stable/object/entries\"));\nvar _CoreManager = _interopRequireDefault(require(\"./CoreManager\"));\nvar _encode = _interopRequireDefault(require(\"./encode\"));\nvar _promiseUtils = require(\"./promiseUtils\");\nvar _ParseError = _interopRequireDefault(require(\"./ParseError\"));\nvar _ParseGeoPoint = _interopRequireDefault(require(\"./ParseGeoPoint\"));\nvar _ParseObject = _interopRequireDefault(require(\"./ParseObject\"));\nvar _OfflineQuery = _interopRequireDefault(require(\"./OfflineQuery\"));\nvar _LocalDatastoreUtils = require(\"./LocalDatastoreUtils\");\n/**\n * Converts a string into a regex that matches it.\n * Surrounding with \\Q .. \\E does this, we just need to escape any \\E's in\n * the text separately.\n *\n * @param s\n * @private\n * @returns {string}\n */\nfunction quote(s) {\n return '\\\\Q' + s.replace('\\\\E', '\\\\E\\\\\\\\E\\\\Q') + '\\\\E';\n}\n\n/**\n * Extracts the class name from queries. If not all queries have the same\n * class name an error will be thrown.\n *\n * @param queries\n * @private\n * @returns {string}\n */\nfunction _getClassNameFromQueries(queries) {\n let className = null;\n (0, _forEach.default)(queries).call(queries, q => {\n if (!className) {\n className = q.className;\n }\n if (className !== q.className) {\n throw new Error('All queries must be for the same class.');\n }\n });\n return className;\n}\n\n/*\n * Handles pre-populating the result data of a query with select fields,\n * making sure that the data object contains keys for all objects that have\n * been requested with a select, so that our cached state updates correctly.\n */\nfunction handleSelectResult(data, select) {\n const serverDataMask = {};\n (0, _forEach.default)(select).call(select, field => {\n const hasSubObjectSelect = (0, _indexOf.default)(field).call(field, '.') !== -1;\n if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {\n // this field was selected, but is missing from the retrieved data\n data[field] = undefined;\n } else if (hasSubObjectSelect) {\n // this field references a sub-object,\n // so we need to walk down the path components\n const pathComponents = field.split('.');\n let obj = data;\n let serverMask = serverDataMask;\n (0, _forEach.default)(pathComponents).call(pathComponents, (component, index, arr) => {\n // add keys if the expected data is missing\n if (obj && !obj.hasOwnProperty(component)) {\n obj[component] = undefined;\n }\n if (obj && typeof obj === 'object') {\n obj = obj[component];\n }\n\n //add this path component to the server mask so we can fill it in later if needed\n if (index < arr.length - 1) {\n if (!serverMask[component]) {\n serverMask[component] = {};\n }\n serverMask = serverMask[component];\n }\n });\n }\n });\n if ((0, _keys.default)(serverDataMask).length > 0) {\n // When selecting from sub-objects, we don't want to blow away the missing\n // information that we may have retrieved before. We've already added any\n // missing selected keys to sub-objects, but we still need to add in the\n // data for any previously retrieved sub-objects that were not selected.\n\n const serverData = _CoreManager.default.getObjectStateController().getServerData({\n id: data.objectId,\n className: data.className\n });\n copyMissingDataWithMask(serverData, data, serverDataMask, false);\n }\n}\nfunction copyMissingDataWithMask(src, dest, mask, copyThisLevel) {\n //copy missing elements at this level\n if (copyThisLevel) {\n for (const key in src) {\n if (src.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {\n dest[key] = src[key];\n }\n }\n }\n for (const key in mask) {\n if (dest[key] !== undefined && dest[key] !== null && src !== undefined && src !== null) {\n //traverse into objects as needed\n copyMissingDataWithMask(src[key], dest[key], mask[key], true);\n }\n }\n}\nfunction handleOfflineSort(a, b, sorts) {\n let order = sorts[0];\n const operator = (0, _slice.default)(order).call(order, 0, 1);\n const isDescending = operator === '-';\n if (isDescending) {\n order = order.substring(1);\n }\n if (order === '_created_at') {\n order = 'createdAt';\n }\n if (order === '_updated_at') {\n order = 'updatedAt';\n }\n if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {\n throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${order}`);\n }\n const field1 = a.get(order);\n const field2 = b.get(order);\n if (field1 < field2) {\n return isDescending ? 1 : -1;\n }\n if (field1 > field2) {\n return isDescending ? -1 : 1;\n }\n if (sorts.length > 1) {\n const remainingSorts = (0, _slice.default)(sorts).call(sorts, 1);\n return handleOfflineSort(a, b, remainingSorts);\n }\n return 0;\n}\n/**\n * Creates a new parse Parse.Query for the given Parse.Object subclass.\n *\n * <p>Parse.Query defines a query that is used to fetch Parse.Objects. The\n * most common use case is finding all objects that match a query through the\n * <code>find</code> method. for example, this sample code fetches all objects\n * of class <code>myclass</code>. it calls a different function depending on\n * whether the fetch succeeded or not.\n *\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.find().then((results) => {\n * // results is an array of parse.object.\n * }).catch((error) => {\n * // error is an instance of parse.error.\n * });</pre></p>\n *\n * <p>a Parse.Query can also be used to retrieve a single object whose id is\n * known, through the get method. for example, this sample code fetches an\n * object of class <code>myclass</code> and id <code>myid</code>. it calls a\n * different function depending on whether the fetch succeeded or not.\n *\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.get(myid).then((object) => {\n * // object is an instance of parse.object.\n * }).catch((error) => {\n * // error is an instance of parse.error.\n * });</pre></p>\n *\n * <p>a Parse.Query can also be used to count the number of objects that match\n * the query without retrieving all of those objects. for example, this\n * sample code counts the number of objects of the class <code>myclass</code>\n * <pre>\n * var query = new Parse.Query(myclass);\n * query.count().then((number) => {\n * // there are number instances of myclass.\n * }).catch((error) => {\n * // error is an instance of Parse.Error.\n * });</pre></p>\n *\n * @alias Parse.Query\n */\nclass ParseQuery {\n /**\n * @param {(string | Parse.Object)} objectClass An instance of a subclass of Parse.Object, or a Parse className string.\n */\n constructor(objectClass) {\n /**\n * @property {string} className\n */\n (0, _defineProperty2.default)(this, \"className\", void 0);\n (0, _defineProperty2.default)(this, \"_where\", void 0);\n (0, _defineProperty2.default)(this, \"_watch\", void 0);\n (0, _defineProperty2.default)(this, \"_include\", void 0);\n (0, _defineProperty2.default)(this, \"_exclude\", void 0);\n (0, _defineProperty2.default)(this, \"_select\", void 0);\n (0, _defineProperty2.default)(this, \"_limit\", void 0);\n (0, _defineProperty2.default)(this, \"_skip\", void 0);\n (0, _defineProperty2.default)(this, \"_count\", void 0);\n (0, _defineProperty2.default)(this, \"_order\", void 0);\n (0, _defineProperty2.default)(this, \"_readPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_includeReadPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_subqueryReadPreference\", void 0);\n (0, _defineProperty2.default)(this, \"_queriesLocalDatastore\", void 0);\n (0, _defineProperty2.default)(this, \"_localDatastorePinName\", void 0);\n (0, _defineProperty2.default)(this, \"_extraOptions\", void 0);\n (0, _defineProperty2.default)(this, \"_hint\", void 0);\n (0, _defineProperty2.default)(this, \"_explain\", void 0);\n (0, _defineProperty2.default)(this, \"_xhrRequest\", void 0);\n (0, _defineProperty2.default)(this, \"_comment\", void 0);\n if (typeof objectClass === 'string') {\n if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {\n this.className = '_User';\n } else {\n this.className = objectClass;\n }\n } else if (objectClass instanceof _ParseObject.default) {\n this.className = objectClass.className;\n } else if (typeof objectClass === 'function') {\n const objClass = objectClass;\n if (typeof objClass.className === 'string') {\n this.className = objClass.className;\n } else {\n const obj = new objClass();\n this.className = obj.className;\n }\n } else {\n throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');\n }\n this._where = {};\n this._watch = [];\n this._include = [];\n this._exclude = [];\n this._count = false;\n this._limit = -1; // negative limit is not sent in the server request\n this._skip = 0;\n this._readPreference = null;\n this._includeReadPreference = null;\n this._subqueryReadPreference = null;\n this._queriesLocalDatastore = false;\n this._localDatastorePinName = null;\n this._extraOptions = {};\n this._xhrRequest = {\n task: null,\n onchange: () => {}\n };\n this._comment = null;\n }\n\n /**\n * Adds constraint that at least one of the passed in queries matches.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _orQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$or = queryJSON;\n return this;\n }\n\n /**\n * Adds constraint that all of the passed in queries match.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _andQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$and = queryJSON;\n return this;\n }\n\n /**\n * Adds constraint that none of the passed in queries match.\n *\n * @param {Array} queries\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n _norQuery(queries) {\n const queryJSON = (0, _map.default)(queries).call(queries, q => {\n return q.toJSON().where;\n });\n this._where.$nor = queryJSON;\n return this;\n }\n\n /**\n * Helper for condition queries\n *\n * @param key\n * @param condition\n * @param value\n * @returns {Parse.Query}\n */\n _addCondition(key, condition, value) {\n if (!this._where[key] || typeof this._where[key] === 'string') {\n this._where[key] = {};\n }\n this._where[key][condition] = (0, _encode.default)(value, false, true);\n return this;\n }\n\n /**\n * Converts string for regular expression at the beginning\n *\n * @param string\n * @returns {string}\n */\n _regexStartWith(string) {\n return '^' + quote(string);\n }\n async _handleOfflineQuery(params) {\n var _context;\n _OfflineQuery.default.validateQuery(this);\n const localDatastore = _CoreManager.default.getLocalDatastore();\n const objects = await localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);\n let results = (0, _filter.default)(_context = (0, _map.default)(objects).call(objects, (json, index, arr) => {\n const object = _ParseObject.default.fromJSON(json, false);\n if (json._localId && !json.objectId) {\n object._localId = json._localId;\n }\n if (!_OfflineQuery.default.matchesQuery(this.className, object, arr, this)) {\n return null;\n }\n return object;\n })).call(_context, object => object !== null);\n if ((0, _keys2.default)(params)) {\n let keys = (0, _keys2.default)(params).split(',');\n keys = (0, _concat.default)(keys).call(keys, ['className', 'objectId', 'createdAt', 'updatedAt', 'ACL']);\n results = (0, _map.default)(results).call(results, object => {\n var _context2;\n const json = object._toFullJSON();\n (0, _forEach.default)(_context2 = (0, _keys.default)(json)).call(_context2, key => {\n if (!(0, _includes.default)(keys).call(keys, key)) {\n delete json[key];\n }\n });\n return _ParseObject.default.fromJSON(json, false);\n });\n }\n if (params.order) {\n const sorts = params.order.split(',');\n (0, _sort.default)(results).call(results, (a, b) => {\n return handleOfflineSort(a, b, sorts);\n });\n }\n let count; // count total before applying limit/skip\n if (params.count) {\n count = results.length; // total count from response\n }\n if (params.skip) {\n if (params.skip >= results.length) {\n results = [];\n } else {\n results = (0, _splice.default)(results).call(results, params.skip, results.length);\n }\n }\n let limit = results.length;\n if (params.limit !== 0 && params.limit < results.length) {\n limit = params.limit;\n }\n results = (0, _splice.default)(results).call(results, 0, limit);\n if (typeof count === 'number') {\n return {\n results,\n count\n };\n }\n return results;\n }\n\n /**\n * Returns a JSON representation of this query.\n *\n * @returns {object} The JSON representation of the query.\n */\n toJSON() {\n const params = {\n where: this._where\n };\n if (this._watch.length) {\n params.watch = this._watch.join(',');\n }\n if (this._include.length) {\n params.include = this._include.join(',');\n }\n if (this._exclude.length) {\n params.excludeKeys = this._exclude.join(',');\n }\n if (this._select) {\n params.keys = this._select.join(',');\n }\n if (this._count) {\n params.count = 1;\n }\n if (this._limit >= 0) {\n params.limit = this._limit;\n }\n if (this._skip > 0) {\n params.skip = this._skip;\n }\n if (this._order) {\n params.order = this._order.join(',');\n }\n if (this._readPreference) {\n params.readPreference = this._readPreference;\n }\n if (this._includeReadPreference) {\n params.includeReadPreference = this._includeReadPreference;\n }\n if (this._subqueryReadPreference) {\n params.subqueryReadPreference = this._subqueryReadPreference;\n }\n if (this._hint) {\n params.hint = this._hint;\n }\n if (this._explain) {\n params.explain = true;\n }\n if (this._comment) {\n params.comment = this._comment;\n }\n for (const key in this._extraOptions) {\n params[key] = this._extraOptions[key];\n }\n return params;\n }\n\n /**\n * Return a query with conditions from json, can be useful to send query from server side to client\n * Not static, all query conditions was set before calling this method will be deleted.\n * For example on the server side we have\n * var query = new Parse.Query(\"className\");\n * query.equalTo(key: value);\n * query.limit(100);\n * ... (others queries)\n * Create JSON representation of Query Object\n * var jsonFromServer = query.fromJSON();\n *\n * On client side getting query:\n * var query = new Parse.Query(\"className\");\n * query.fromJSON(jsonFromServer);\n *\n * and continue to query...\n * query.skip(100).find().then(...);\n *\n * @param {QueryJSON} json from Parse.Query.toJSON() method\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withJSON(json) {\n if (json.where) {\n this._where = json.where;\n }\n if (json.watch) {\n this._watch = json.watch.split(',');\n }\n if (json.include) {\n this._include = json.include.split(',');\n }\n if ((0, _keys2.default)(json)) {\n this._select = (0, _keys2.default)(json).split(',');\n }\n if (json.excludeKeys) {\n this._exclude = json.excludeKeys.split(',');\n }\n if (json.count) {\n this._count = json.count === 1;\n }\n if (json.limit) {\n this._limit = json.limit;\n }\n if (json.skip) {\n this._skip = json.skip;\n }\n if (json.order) {\n this._order = json.order.split(',');\n }\n if (json.readPreference) {\n this._readPreference = json.readPreference;\n }\n if (json.includeReadPreference) {\n this._includeReadPreference = json.includeReadPreference;\n }\n if (json.subqueryReadPreference) {\n this._subqueryReadPreference = json.subqueryReadPreference;\n }\n if (json.hint) {\n this._hint = json.hint;\n }\n if (json.explain) {\n this._explain = !!json.explain;\n }\n if (json.comment) {\n this._comment = json.comment;\n }\n for (const key in json) {\n if (json.hasOwnProperty(key)) {\n var _context3;\n if ((0, _indexOf.default)(_context3 = ['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain', 'comment']).call(_context3, key) === -1) {\n this._extraOptions[key] = json[key];\n }\n }\n }\n return this;\n }\n\n /**\n * Static method to restore Parse.Query by json representation\n * Internally calling Parse.Query.withJSON\n *\n * @param {string} className\n * @param {QueryJSON} json from Parse.Query.toJSON() method\n * @returns {Parse.Query} new created query\n */\n static fromJSON(className, json) {\n const query = new ParseQuery(className);\n return query.withJSON(json);\n }\n\n /**\n * Constructs a Parse.Object whose id is already known by fetching data from\n * the server. Unlike the <code>first</code> method, it never returns undefined.\n *\n * @param {string} objectId The id of the object to be fetched.\n * @param {object} options\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the result when\n * the query completes.\n */\n get(objectId, options) {\n this.equalTo('objectId', objectId);\n const firstOptions = {};\n if (options && options.hasOwnProperty('useMasterKey')) {\n firstOptions.useMasterKey = options.useMasterKey;\n }\n if (options && options.hasOwnProperty('sessionToken')) {\n firstOptions.sessionToken = options.sessionToken;\n }\n if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {\n firstOptions.context = options.context;\n }\n if (options && options.hasOwnProperty('json')) {\n firstOptions.json = options.json;\n }\n return this.first(firstOptions).then(response => {\n if (response) {\n return response;\n }\n const errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');\n return _promise.default.reject(errorObject);\n });\n }\n\n /**\n * Retrieves a list of ParseObjects that satisfy this query.\n *\n * @param {object} options Valid options\n * are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the results when\n * the query completes.\n */\n find(options) {\n options = options || {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const select = this._select;\n if (this._queriesLocalDatastore) {\n return this._handleOfflineQuery(this.toJSON());\n }\n return (0, _find.default)(controller).call(controller, this.className, this.toJSON(), findOptions).then(response => {\n // Return generic object when explain is used\n if (this._explain) {\n return response.results;\n }\n const results = response.results?.map(data => {\n // In cases of relations, the server may send back a className\n // on the top level of the payload\n const override = response.className || this.className;\n if (!data.className) {\n data.className = override;\n }\n\n // Make sure the data object contains keys for all objects that\n // have been requested with a select, so that our cached state\n // updates correctly.\n if (select) {\n handleSelectResult(data, select);\n }\n if (options.json) {\n return data;\n } else {\n return _ParseObject.default.fromJSON(data, !select);\n }\n });\n const count = response.count;\n if (typeof count === 'number') {\n return {\n results,\n count\n };\n } else {\n return results;\n }\n });\n }\n\n /**\n * Retrieves a complete list of ParseObjects that satisfy this query.\n * Using `eachBatch` under the hood to fetch all the valid objects.\n *\n * @param {object} options Valid options are:<ul>\n * <li>batchSize: How many objects to yield in each batch (default: 100)\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that is resolved with the results when\n * the query completes.\n */\n async findAll(options) {\n let result = [];\n await this.eachBatch(objects => {\n result = [...result, ...objects];\n }, options);\n return result;\n }\n\n /**\n * Counts the number of objects that match this query.\n *\n * @param {object} options\n * @param {boolean} [options.useMasterKey]\n * @param {string} [options.sessionToken]\n * Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that is resolved with the count when\n * the query completes.\n */\n count(options) {\n options = options || {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = this.toJSON();\n params.limit = 0;\n params.count = 1;\n return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(result => {\n return result.count;\n });\n }\n\n /**\n * Executes a distinct query and returns unique values\n *\n * @param {string} key A field to find distinct values\n * @param {object} options\n * @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.\n * @returns {Promise} A promise that is resolved with the query completes.\n */\n distinct(key, options) {\n options = options || {};\n const distinctOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('sessionToken')) {\n distinctOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(distinctOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = {\n distinct: key,\n where: this._where,\n hint: this._hint\n };\n return controller.aggregate(this.className, params, distinctOptions).then(results => {\n return results.results;\n });\n }\n\n /**\n * Executes an aggregate query and returns aggregate results\n *\n * @param {(Array|object)} pipeline Array or Object of stages to process query\n * @param {object} options\n * @param {string} [options.sessionToken] A valid session token, used for making a request on behalf of a specific user.\n * @returns {Promise} A promise that is resolved with the query completes.\n */\n aggregate(pipeline, options) {\n options = options || {};\n const aggregateOptions = {\n useMasterKey: true\n };\n if (options.hasOwnProperty('sessionToken')) {\n aggregateOptions.sessionToken = options.sessionToken;\n }\n this._setRequestTask(aggregateOptions);\n const controller = _CoreManager.default.getQueryController();\n if (!(0, _isArray.default)(pipeline) && typeof pipeline !== 'object') {\n throw new Error('Invalid pipeline must be Array or Object');\n }\n if ((0, _keys.default)(this._where || {}).length) {\n if (!(0, _isArray.default)(pipeline)) {\n pipeline = [pipeline];\n }\n pipeline.unshift({\n $match: this._where\n });\n }\n const params = {\n pipeline,\n hint: this._hint,\n explain: this._explain,\n readPreference: this._readPreference\n };\n return controller.aggregate(this.className, params, aggregateOptions).then(results => {\n return results.results;\n });\n }\n\n /**\n * Retrieves at most one Parse.Object that satisfies this query.\n *\n * Returns the object if there is one, otherwise undefined.\n *\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that is resolved with the object when\n * the query completes.\n */\n first() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n this._setRequestTask(findOptions);\n const controller = _CoreManager.default.getQueryController();\n const params = this.toJSON();\n params.limit = 1;\n const select = this._select;\n if (this._queriesLocalDatastore) {\n return this._handleOfflineQuery(params).then(objects => {\n if (!objects[0]) {\n return undefined;\n }\n return objects[0];\n });\n }\n return (0, _find.default)(controller).call(controller, this.className, params, findOptions).then(response => {\n const objects = response.results;\n if (!objects[0]) {\n return undefined;\n }\n if (!objects[0].className) {\n objects[0].className = this.className;\n }\n\n // Make sure the data object contains keys for all objects that\n // have been requested with a select, so that our cached state\n // updates correctly.\n if (select) {\n handleSelectResult(objects[0], select);\n }\n if (options.json) {\n return objects[0];\n } else {\n return _ParseObject.default.fromJSON(objects[0], !select);\n }\n });\n }\n\n /**\n * Iterates over objects matching a query, calling a callback for each batch.\n * If the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are processed\n * in an unspecified order. The query may not have any sort order, and may\n * not use limit or skip.\n *\n * @param {Function} callback Callback that will be called with each result\n * of the query.\n * @param {object} options Valid options are:<ul>\n * <li>batchSize: How many objects to yield in each batch (default: 100)\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>context: A dictionary that is accessible in Cloud Code `beforeFind` trigger.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n eachBatch(callback, options) {\n options = options || {};\n if (this._order || this._skip || this._limit >= 0) {\n return _promise.default.reject('Cannot iterate on a query with sort, skip, or limit.');\n }\n const query = new ParseQuery(this.className);\n query._limit = options.batchSize || 100;\n query._include = [...this._include];\n query._exclude = [...this._exclude];\n if (this._select) {\n query._select = [...this._select];\n }\n query._hint = this._hint;\n query._where = {};\n for (const attr in this._where) {\n const val = this._where[attr];\n if ((0, _isArray.default)(val)) {\n query._where[attr] = (0, _map.default)(val).call(val, v => {\n return v;\n });\n } else if (val && typeof val === 'object') {\n const conditionMap = {};\n query._where[attr] = conditionMap;\n for (const cond in val) {\n conditionMap[cond] = val[cond];\n }\n } else {\n query._where[attr] = val;\n }\n }\n query.ascending('objectId');\n const findOptions = {};\n if (options.hasOwnProperty('useMasterKey')) {\n findOptions.useMasterKey = options.useMasterKey;\n }\n if (options.hasOwnProperty('sessionToken')) {\n findOptions.sessionToken = options.sessionToken;\n }\n if (options.hasOwnProperty('context') && typeof options.context === 'object') {\n findOptions.context = options.context;\n }\n if (options.hasOwnProperty('json')) {\n findOptions.json = options.json;\n }\n let finished = false;\n let previousResults = [];\n return (0, _promiseUtils.continueWhile)(() => {\n return !finished;\n }, async () => {\n const [results] = await _promise.default.all([(0, _find.default)(query).call(query, findOptions), _promise.default.resolve(previousResults.length > 0 && callback(previousResults))]);\n if (results.length >= query._limit) {\n query.greaterThan('objectId', results[results.length - 1].id);\n previousResults = results;\n } else if (results.length > 0) {\n await _promise.default.resolve(callback(results));\n finished = true;\n } else {\n finished = true;\n }\n });\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback that will be called with each result\n * of the query.\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * <li>json: Return raw json without converting to Parse.Object\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n each(callback, options) {\n return this.eachBatch(results => {\n let callbacksDone = _promise.default.resolve();\n (0, _forEach.default)(results).call(results, result => {\n callbacksDone = callbacksDone.then(() => {\n return callback(result);\n });\n });\n return callbacksDone;\n }, options);\n }\n\n /**\n * Adds a hint to force index selection. (https://docs.mongodb.com/manual/reference/operator/meta/hint/)\n *\n * @param {(string|object)} value String or Object of index that should be used when executing query\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n hint(value) {\n if (typeof value === 'undefined') {\n delete this._hint;\n }\n this._hint = value;\n return this;\n }\n\n /**\n * Investigates the query execution plan. Useful for optimizing queries. (https://docs.mongodb.com/manual/reference/operator/meta/explain/)\n *\n * @param {boolean} explain Used to toggle the information on the query plan.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n explain() {\n let explain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (typeof explain !== 'boolean') {\n throw new Error('You can only set explain to a boolean value');\n }\n this._explain = explain;\n return this;\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * <li>query: The query map was called upon.</li>\n * </ul>\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n async map(callback, options) {\n const array = [];\n let index = 0;\n await this.each(object => {\n return _promise.default.resolve(callback(object, index, this)).then(result => {\n array.push(result);\n index += 1;\n });\n }, options);\n return array;\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>accumulator: The accumulator accumulates the callback's return values. It is the accumulated value previously returned in the last invocation of the callback.</li>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * </ul>\n * @param {*} initialValue A value to use as the first argument to the first call of the callback. If no initialValue is supplied, the first object in the query will be used and skipped.\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n async reduce(callback, initialValue, options) {\n let accumulator = initialValue;\n let index = 0;\n await this.each(object => {\n // If no initial value was given, we take the first object from the query\n // as the initial value and don't call the callback with it.\n if (index === 0 && initialValue === undefined) {\n accumulator = object;\n index += 1;\n return;\n }\n return _promise.default.resolve(callback(accumulator, object, index)).then(result => {\n accumulator = result;\n index += 1;\n });\n }, options);\n if (index === 0 && initialValue === undefined) {\n // Match Array.reduce behavior: \"Calling reduce() on an empty array\n // without an initialValue will throw a TypeError\".\n throw new TypeError('Reducing empty query result set with no initial value');\n }\n return accumulator;\n }\n\n /**\n * Iterates over each result of a query, calling a callback for each one. If\n * the callback returns a promise, the iteration will not continue until\n * that promise has been fulfilled. If the callback returns a rejected\n * promise, then iteration will stop with that error. The items are\n * processed in an unspecified order. The query may not have any sort order,\n * and may not use limit or skip.\n *\n * @param {Function} callback Callback <ul>\n * <li>currentObject: The current Parse.Object being processed in the array.</li>\n * <li>index: The index of the current Parse.Object being processed in the array.</li>\n * <li>query: The query filter was called upon.</li>\n * </ul>\n * @param {object} options Valid options are:<ul>\n * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to\n * be used for this request.\n * <li>sessionToken: A valid session token, used for making a request on\n * behalf of a specific user.\n * </ul>\n * @returns {Promise} A promise that will be fulfilled once the\n * iteration has completed.\n */\n async filter(callback, options) {\n const array = [];\n let index = 0;\n await this.each(object => {\n return _promise.default.resolve(callback(object, index, this)).then(flag => {\n if (flag) {\n array.push(object);\n }\n index += 1;\n });\n }, options);\n return array;\n }\n\n /* Query Conditions */\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that the Parse.Object must contain.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n equalTo(key, value) {\n if (key && typeof key === 'object') {\n var _context4;\n (0, _forEach.default)(_context4 = (0, _entries.default)(key)).call(_context4, _ref => {\n let [k, val] = _ref;\n return this.equalTo(k, val);\n });\n return this;\n }\n if (typeof value === 'undefined') {\n return this.doesNotExist(key);\n }\n this._where[key] = (0, _encode.default)(value, false, true);\n return this;\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be not equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that must not be equalled.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n notEqualTo(key, value) {\n if (key && typeof key === 'object') {\n var _context5;\n (0, _forEach.default)(_context5 = (0, _entries.default)(key)).call(_context5, _ref2 => {\n let [k, val] = _ref2;\n return this.notEqualTo(k, val);\n });\n return this;\n }\n return this._addCondition(key, '$ne', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be less than the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an upper bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n lessThan(key, value) {\n return this._addCondition(key, '$lt', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be greater than the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an lower bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n greaterThan(key, value) {\n return this._addCondition(key, '$gt', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be less than or equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param value The value that provides an upper bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n lessThanOrEqualTo(key, value) {\n return this._addCondition(key, '$lte', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be greater than or equal to the provided value.\n *\n * @param {string} key The key to check.\n * @param {*} value The value that provides an lower bound.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n greaterThanOrEqualTo(key, value) {\n return this._addCondition(key, '$gte', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be contained in the provided list of values.\n *\n * @param {string} key The key to check.\n * @param {Array<*>} value The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containedIn(key, value) {\n return this._addCondition(key, '$in', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * not be contained in the provided list of values.\n *\n * @param {string} key The key to check.\n * @param {Array<*>} value The values that will not match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n notContainedIn(key, value) {\n return this._addCondition(key, '$nin', value);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * be contained by the provided list of values. Get objects where all array elements match.\n *\n * @param {string} key The key to check.\n * @param {Array} values The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containedBy(key, values) {\n return this._addCondition(key, '$containedBy', values);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * contain each one of the provided list of values.\n *\n * @param {string} key The key to check. This key's value must be an array.\n * @param {Array} values The values that will match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containsAll(key, values) {\n return this._addCondition(key, '$all', values);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's value to\n * contain each one of the provided list of values starting with given strings.\n *\n * @param {string} key The key to check. This key's value must be an array.\n * @param {Array<string>} values The string values that will match as starting string.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n containsAllStartingWith(key, values) {\n if (!(0, _isArray.default)(values)) {\n values = [values];\n }\n const regexObject = (0, _map.default)(values).call(values, value => {\n return {\n $regex: this._regexStartWith(value)\n };\n });\n return this.containsAll(key, regexObject);\n }\n\n /**\n * Adds a constraint for finding objects that contain the given key.\n *\n * @param {string} key The key that should exist.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n exists(key) {\n return this._addCondition(key, '$exists', true);\n }\n\n /**\n * Adds a constraint for finding objects that do not contain a given key.\n *\n * @param {string} key The key that should not exist\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotExist(key) {\n return this._addCondition(key, '$exists', false);\n }\n\n /**\n * Adds a regular expression constraint for finding string values that match\n * the provided regular expression.\n * This may be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {RegExp | string} regex The regular expression pattern to match.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matches(key, regex, modifiers) {\n this._addCondition(key, '$regex', regex);\n if (!modifiers) {\n modifiers = '';\n }\n if (typeof regex !== 'string') {\n if (regex.ignoreCase) {\n modifiers += 'i';\n }\n if (regex.multiline) {\n modifiers += 'm';\n }\n }\n if (modifiers.length) {\n this._addCondition(key, '$options', modifiers);\n }\n return this;\n }\n\n /**\n * Adds a constraint that requires that a key's value matches a Parse.Query\n * constraint.\n *\n * @param {string} key The key that the contains the object to match the\n * query.\n * @param {Parse.Query} query The query that should match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matchesQuery(key, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$inQuery', queryJSON);\n }\n\n /**\n * Adds a constraint that requires that a key's value not matches a\n * Parse.Query constraint.\n *\n * @param {string} key The key that the contains the object to match the\n * query.\n * @param {Parse.Query} query The query that should not match.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotMatchQuery(key, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$notInQuery', queryJSON);\n }\n\n /**\n * Adds a constraint that requires that a key's value matches a value in\n * an object returned by a different Parse.Query.\n *\n * @param {string} key The key that contains the value that is being\n * matched.\n * @param {string} queryKey The key in the objects returned by the query to\n * match against.\n * @param {Parse.Query} query The query to run.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n matchesKeyInQuery(key, queryKey, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$select', {\n key: queryKey,\n query: queryJSON\n });\n }\n\n /**\n * Adds a constraint that requires that a key's value not match a value in\n * an object returned by a different Parse.Query.\n *\n * @param {string} key The key that contains the value that is being\n * excluded.\n * @param {string} queryKey The key in the objects returned by the query to\n * match against.\n * @param {Parse.Query} query The query to run.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n doesNotMatchKeyInQuery(key, queryKey, query) {\n const queryJSON = query.toJSON();\n queryJSON.className = query.className;\n return this._addCondition(key, '$dontSelect', {\n key: queryKey,\n query: queryJSON\n });\n }\n\n /**\n * Adds a constraint for finding string values that contain a provided\n * string. This may be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} substring The substring that the value must contain.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n contains(key, substring) {\n if (typeof substring !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this._addCondition(key, '$regex', quote(substring));\n }\n\n /**\n * Adds a constraint for finding string values that contain a provided\n * string. This may be slow for large datasets. Requires Parse-Server > 2.5.0\n *\n * In order to sort you must use select and ascending ($score is required)\n * <pre>\n * query.fullText('field', 'term');\n * query.ascending('$score');\n * query.select('$score');\n * </pre>\n *\n * To retrieve the weight / rank\n * <pre>\n * object->get('score');\n * </pre>\n *\n * You can define optionals by providing an object as a third parameter\n * <pre>\n * query.fullText('field', 'term', { language: 'es', diacriticSensitive: true });\n * </pre>\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} value The string to search\n * @param {object} options (Optional)\n * @param {string} options.language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer.\n * @param {boolean} options.caseSensitive A boolean flag to enable or disable case sensitive search.\n * @param {boolean} options.diacriticSensitive A boolean flag to enable or disable diacritic sensitive search.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fullText(key, value) {\n let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n options = options || {};\n if (!key) {\n throw new Error('A key is required.');\n }\n if (!value) {\n throw new Error('A search term is required');\n }\n if (typeof value !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n const fullOptions = {};\n fullOptions.$term = value;\n for (const option in options) {\n switch (option) {\n case 'language':\n fullOptions.$language = options[option];\n break;\n case 'caseSensitive':\n fullOptions.$caseSensitive = options[option];\n break;\n case 'diacriticSensitive':\n fullOptions.$diacriticSensitive = options[option];\n break;\n default:\n throw new Error(`Unknown option: ${option}`);\n }\n }\n return this._addCondition(key, '$text', {\n $search: fullOptions\n });\n }\n\n /**\n * Method to sort the full text search by text score\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n sortByTextScore() {\n this.ascending('$score');\n this.select(['$score']);\n return this;\n }\n\n /**\n * Adds a constraint for finding string values that start with a provided\n * string. This query will use the backend index, so it will be fast even\n * for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} prefix The substring that the value must start with.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n startsWith(key, prefix, modifiers) {\n if (typeof prefix !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this.matches(key, this._regexStartWith(prefix), modifiers);\n }\n\n /**\n * Adds a constraint for finding string values that end with a provided\n * string. This will be slow for large datasets.\n *\n * @param {string} key The key that the string to match is stored in.\n * @param {string} suffix The substring that the value must end with.\n * @param {string} modifiers The regular expression mode.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n endsWith(key, suffix, modifiers) {\n if (typeof suffix !== 'string') {\n throw new Error('The value being searched for must be a string.');\n }\n return this.matches(key, quote(suffix) + '$', modifiers);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n near(key, point) {\n if (!(point instanceof _ParseGeoPoint.default)) {\n // Try to cast it as a GeoPoint\n point = new _ParseGeoPoint.default(point);\n }\n return this._addCondition(key, '$nearSphere', point);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in radians) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinRadians(key, point, maxDistance, sorted) {\n if (sorted || sorted === undefined) {\n this.near(key, point);\n return this._addCondition(key, '$maxDistance', maxDistance);\n } else {\n return this._addCondition(key, '$geoWithin', {\n $centerSphere: [[point.longitude, point.latitude], maxDistance]\n });\n }\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n * Radius of earth used is 3958.8 miles.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in miles) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinMiles(key, point, maxDistance, sorted) {\n return this.withinRadians(key, point, maxDistance / 3958.8, sorted);\n }\n\n /**\n * Adds a proximity based constraint for finding objects with key point\n * values near the point given and within the maximum distance given.\n * Radius of earth used is 6371.0 kilometers.\n *\n * @param {string} key The key that the Parse.GeoPoint is stored in.\n * @param {Parse.GeoPoint} point The reference Parse.GeoPoint that is used.\n * @param {number} maxDistance Maximum distance (in kilometers) of results to return.\n * @param {boolean} sorted A Bool value that is true if results should be\n * sorted by distance ascending, false is no sorting is required,\n * defaults to true.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinKilometers(key, point, maxDistance, sorted) {\n return this.withinRadians(key, point, maxDistance / 6371.0, sorted);\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's\n * coordinates be contained within a given rectangular geographic bounding\n * box.\n *\n * @param {string} key The key to be constrained.\n * @param {Parse.GeoPoint} southwest\n * The lower-left inclusive corner of the box.\n * @param {Parse.GeoPoint} northeast\n * The upper-right inclusive corner of the box.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinGeoBox(key, southwest, northeast) {\n if (!(southwest instanceof _ParseGeoPoint.default)) {\n southwest = new _ParseGeoPoint.default(southwest);\n }\n if (!(northeast instanceof _ParseGeoPoint.default)) {\n northeast = new _ParseGeoPoint.default(northeast);\n }\n this._addCondition(key, '$within', {\n $box: [southwest, northeast]\n });\n return this;\n }\n\n /**\n * Adds a constraint to the query that requires a particular key's\n * coordinates be contained within and on the bounds of a given polygon.\n * Supports closed and open (last point is connected to first) paths\n *\n * Polygon must have at least 3 points\n *\n * @param {string} key The key to be constrained.\n * @param {Array} points Array of Coordinates / GeoPoints\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withinPolygon(key, points) {\n return this._addCondition(key, '$geoWithin', {\n $polygon: points\n });\n }\n\n /**\n * Add a constraint to the query that requires a particular key's\n * coordinates that contains a ParseGeoPoint\n *\n * @param {string} key The key to be constrained.\n * @param {Parse.GeoPoint} point\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n polygonContains(key, point) {\n return this._addCondition(key, '$geoIntersects', {\n $point: point\n });\n }\n\n /* Query Orderings */\n\n /**\n * Sorts the results in ascending order by the given key.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n ascending() {\n this._order = [];\n for (var _len = arguments.length, keys = new Array(_len), _key = 0; _key < _len; _key++) {\n keys[_key] = arguments[_key];\n }\n return this.addAscending.apply(this, keys);\n }\n\n /**\n * Sorts the results in ascending order by the given key,\n * but can also add secondary sort descriptors without overwriting _order.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n addAscending() {\n if (!this._order) {\n this._order = [];\n }\n for (var _len2 = arguments.length, keys = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n keys[_key2] = arguments[_key2];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n var _context6;\n if ((0, _isArray.default)(key)) {\n key = key.join();\n }\n this._order = (0, _concat.default)(_context6 = this._order).call(_context6, key.replace(/\\s/g, '').split(','));\n });\n return this;\n }\n\n /**\n * Sorts the results in descending order by the given key.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n descending() {\n this._order = [];\n for (var _len3 = arguments.length, keys = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n keys[_key3] = arguments[_key3];\n }\n return this.addDescending.apply(this, keys);\n }\n\n /**\n * Sorts the results in descending order by the given key,\n * but can also add secondary sort descriptors without overwriting _order.\n *\n * @param {(string|string[])} keys The key to order by, which is a\n * string of comma separated values, or an Array of keys, or multiple keys.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n addDescending() {\n if (!this._order) {\n this._order = [];\n }\n for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n keys[_key4] = arguments[_key4];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n var _context7, _context8;\n if ((0, _isArray.default)(key)) {\n key = key.join();\n }\n this._order = (0, _concat.default)(_context7 = this._order).call(_context7, (0, _map.default)(_context8 = key.replace(/\\s/g, '').split(',')).call(_context8, k => {\n return '-' + k;\n }));\n });\n return this;\n }\n\n /* Query Options */\n\n /**\n * Sets the number of results to skip before returning any results.\n * This is useful for pagination.\n * Default is to skip zero results.\n *\n * @param {number} n the number of results to skip.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n skip(n) {\n if (typeof n !== 'number' || n < 0) {\n throw new Error('You can only skip by a positive number');\n }\n this._skip = n;\n return this;\n }\n\n /**\n * Sets the limit of the number of results to return. The default limit is 100.\n *\n * @param {number} n the number of results to limit to.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n limit(n) {\n if (typeof n !== 'number') {\n throw new Error('You can only set the limit to a numeric value');\n }\n this._limit = n;\n return this;\n }\n\n /**\n * Sets the flag to include with response the total number of objects satisfying this query,\n * despite limits/skip. Might be useful for pagination.\n * Note that result of this query will be wrapped as an object with\n * `results`: holding {ParseObject} array and `count`: integer holding total number\n *\n * @param {boolean} includeCount false - disable, true - enable.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n withCount() {\n let includeCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;\n if (typeof includeCount !== 'boolean') {\n throw new Error('You can only set withCount to a boolean value');\n }\n this._count = includeCount;\n return this;\n }\n /**\n * Includes nested Parse.Objects for the provided key. You can use dot\n * notation to specify which fields in the included object are also fetched.\n *\n * You can include all nested Parse.Objects by passing in '*'.\n * Requires Parse Server 3.0.0+\n * <pre>query.include('*');</pre>\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to include.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n include() {\n for (var _len5 = arguments.length, keys = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n keys[_key5] = arguments[_key5];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context9;\n this._include = (0, _concat.default)(_context9 = this._include).call(_context9, key);\n } else {\n this._include.push(key);\n }\n });\n return this;\n }\n\n /**\n * Includes all nested Parse.Objects one level deep.\n *\n * Requires Parse Server 3.0.0+\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n includeAll() {\n return this.include('*');\n }\n\n /**\n * Restricts the fields of the returned Parse.Objects to include only the\n * provided keys. If this is called multiple times, then all of the keys\n * specified in each of the calls will be included.\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to include.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n select() {\n if (!this._select) {\n this._select = [];\n }\n for (var _len6 = arguments.length, keys = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {\n keys[_key6] = arguments[_key6];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context10;\n this._select = (0, _concat.default)(_context10 = this._select).call(_context10, key);\n } else {\n this._select.push(key);\n }\n });\n return this;\n }\n\n /**\n * Restricts the fields of the returned Parse.Objects to all keys except the\n * provided keys. Exclude takes precedence over select and include.\n *\n * Requires Parse Server 3.6.0+\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to exclude.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n exclude() {\n for (var _len7 = arguments.length, keys = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {\n keys[_key7] = arguments[_key7];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context11;\n this._exclude = (0, _concat.default)(_context11 = this._exclude).call(_context11, key);\n } else {\n this._exclude.push(key);\n }\n });\n return this;\n }\n\n /**\n * Restricts live query to trigger only for watched fields.\n *\n * Requires Parse Server 6.0.0+\n *\n * @param {...string|Array<string>} keys The name(s) of the key(s) to watch.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n watch() {\n for (var _len8 = arguments.length, keys = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {\n keys[_key8] = arguments[_key8];\n }\n (0, _forEach.default)(keys).call(keys, key => {\n if ((0, _isArray.default)(key)) {\n var _context12;\n this._watch = (0, _concat.default)(_context12 = this._watch).call(_context12, key);\n } else {\n this._watch.push(key);\n }\n });\n return this;\n }\n\n /**\n * Changes the read preference that the backend will use when performing the query to the database.\n *\n * @param {string} readPreference The read preference for the main query.\n * @param {string} includeReadPreference The read preference for the queries to include pointers.\n * @param {string} subqueryReadPreference The read preference for the sub queries.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n readPreference(readPreference, includeReadPreference, subqueryReadPreference) {\n this._readPreference = readPreference;\n this._includeReadPreference = includeReadPreference || null;\n this._subqueryReadPreference = subqueryReadPreference || null;\n return this;\n }\n\n /**\n * Subscribe this query to get liveQuery updates\n *\n * @param {string} sessionToken (optional) Defaults to the currentUser\n * @returns {Promise<LiveQuerySubscription>} Returns the liveQuerySubscription, it's an event emitter\n * which can be used to get liveQuery updates.\n */\n async subscribe(sessionToken) {\n const currentUser = await _CoreManager.default.getUserController().currentUserAsync();\n if (!sessionToken) {\n sessionToken = currentUser ? currentUser.getSessionToken() || undefined : undefined;\n }\n const liveQueryClient = await _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();\n if (liveQueryClient.shouldOpen()) {\n liveQueryClient.open();\n }\n const subscription = liveQueryClient.subscribe(this, sessionToken);\n return subscription.subscribePromise.then(() => {\n return subscription;\n });\n }\n\n /**\n * Constructs a Parse.Query that is the OR of the passed in queries. For\n * example:\n * <pre>var compoundQuery = Parse.Query.or(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is an or of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to OR.\n * @static\n * @returns {Parse.Query} The query that is the OR of the passed in queries.\n */\n static or() {\n for (var _len9 = arguments.length, queries = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {\n queries[_key9] = arguments[_key9];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._orQuery(queries);\n return query;\n }\n\n /**\n * Constructs a Parse.Query that is the AND of the passed in queries. For\n * example:\n * <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is an and of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to AND.\n * @static\n * @returns {Parse.Query} The query that is the AND of the passed in queries.\n */\n static and() {\n for (var _len10 = arguments.length, queries = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {\n queries[_key10] = arguments[_key10];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._andQuery(queries);\n return query;\n }\n\n /**\n * Constructs a Parse.Query that is the NOR of the passed in queries. For\n * example:\n * <pre>const compoundQuery = Parse.Query.nor(query1, query2, query3);</pre>\n *\n * will create a compoundQuery that is a nor of the query1, query2, and\n * query3.\n *\n * @param {...Parse.Query} queries The list of queries to NOR.\n * @static\n * @returns {Parse.Query} The query that is the NOR of the passed in queries.\n */\n static nor() {\n for (var _len11 = arguments.length, queries = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {\n queries[_key11] = arguments[_key11];\n }\n const className = _getClassNameFromQueries(queries);\n const query = new ParseQuery(className);\n query._norQuery(queries);\n return query;\n }\n\n /**\n * Change the source of this query to the server.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromNetwork() {\n this._queriesLocalDatastore = false;\n this._localDatastorePinName = null;\n return this;\n }\n\n /**\n * Changes the source of this query to all pinned objects.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromLocalDatastore() {\n return this.fromPinWithName(null);\n }\n\n /**\n * Changes the source of this query to the default group of pinned objects.\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromPin() {\n return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);\n }\n\n /**\n * Changes the source of this query to a specific group of pinned objects.\n *\n * @param {string} name The name of query source.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n fromPinWithName(name) {\n const localDatastore = _CoreManager.default.getLocalDatastore();\n if (localDatastore.checkIfEnabled()) {\n this._queriesLocalDatastore = true;\n this._localDatastorePinName = name;\n }\n return this;\n }\n\n /**\n * Cancels the current network request (if any is running).\n *\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n cancel() {\n if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {\n this._xhrRequest.task._aborted = true;\n this._xhrRequest.task.abort();\n this._xhrRequest.task = null;\n this._xhrRequest.onchange = () => {};\n return this;\n }\n this._xhrRequest.onchange = () => this.cancel();\n return this;\n }\n _setRequestTask(options) {\n options.requestTask = task => {\n this._xhrRequest.task = task;\n this._xhrRequest.onchange();\n };\n }\n\n /**\n * Sets a comment to the query so that the query\n * can be identified when using a the profiler for MongoDB.\n *\n * @param {string} value a comment can make your profile data easier to interpret and trace.\n * @returns {Parse.Query} Returns the query, so you can chain this call.\n */\n comment(value) {\n if (value == null) {\n delete this._comment;\n return this;\n }\n if (typeof value !== 'string') {\n throw new Error('The value of a comment to be sent with this query must be a string.');\n }\n this._comment = value;\n return this;\n }\n}\nconst DefaultController = {\n find(className, params, options) {\n const RESTController = _CoreManager.default.getRESTController();\n return RESTController.request('GET', 'classes/' + className, params, options);\n },\n aggregate(className, params, options) {\n const RESTController = _CoreManager.default.getRESTController();\n return RESTController.request('GET', 'aggregate/' + className, params, options);\n }\n};\n_CoreManager.default.setParseQuery(ParseQuery);\n_CoreManager.default.setQueryController(DefaultController);\nvar _default = exports.default = ParseQuery;"],"mappings":"AAAA,YAAY;;AAAC,IAAAA,iBAAA,GAAAC,OAAA,qGAAAC,OAAA;AAEb,IAAIC,sBAAsB,GAAGF,OAAO,CAAC,8DAA8D,CAAC;AACpG,IAAIG,sBAAsB,GAAGH,OAAO,CAAC,sDAAsD,CAAC;AAC5FE,sBAAsB,CAACE,OAAO,EAAE,YAAY,EAAE;EAC5CC,KAAK,EAAE;AACT,CAAC,CAAC;AACFD,OAAO,CAACH,OAAO,GAAG,KAAK,CAAC;AACxB,IAAIK,gBAAgB,GAAGH,sBAAsB,CAACH,OAAO,CAAC,+CAA+C,CAAC,CAAC;AACvG,IAAIO,QAAQ,GAAGJ,sBAAsB,CAACH,OAAO,CAAC,yDAAyD,CAAC,CAAC;AACzG,IAAIQ,QAAQ,GAAGL,sBAAsB,CAACH,OAAO,CAAC,yDAAyD,CAAC,CAAC;AACzG,IAAIS,KAAK,GAAGN,sBAAsB,CAACH,OAAO,CAAC,mDAAmD,CAAC,CAAC;AAChG,IAAIU,MAAM,GAAGP,sBAAsB,CAACH,OAAO,CAAC,sDAAsD,CAAC,CAAC;AACpG,IAAIW,IAAI,GAAGR,sBAAsB,CAACH,OAAO,CAAC,oDAAoD,CAAC,CAAC;AAChG,IAAIY,OAAO,GAAGT,sBAAsB,CAACH,OAAO,CAAC,uDAAuD,CAAC,CAAC;AACtG,IAAIa,MAAM,GAAGV,sBAAsB,CAACH,OAAO,CAAC,qDAAqD,CAAC,CAAC;AACnG,IAAIc,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