| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714 | 
							- "use strict";
 
- Object.defineProperty(exports, "__esModule", {
 
-   value: true
 
- });
 
- exports.default = void 0;
 
- var _CoreManager = _interopRequireDefault(require("./CoreManager"));
 
- var _encode = _interopRequireDefault(require("./encode"));
 
- var _promiseUtils = require("./promiseUtils");
 
- var _ParseError = _interopRequireDefault(require("./ParseError"));
 
- var _ParseGeoPoint = _interopRequireDefault(require("./ParseGeoPoint"));
 
- var _ParseObject = _interopRequireDefault(require("./ParseObject"));
 
- var _OfflineQuery = _interopRequireDefault(require("./OfflineQuery"));
 
- var _LocalDatastoreUtils = require("./LocalDatastoreUtils");
 
- function _interopRequireDefault(obj) {
 
-   return obj && obj.__esModule ? obj : {
 
-     default: obj
 
-   };
 
- }
 
- function _defineProperty(obj, key, value) {
 
-   if (key in obj) {
 
-     Object.defineProperty(obj, key, {
 
-       value: value,
 
-       enumerable: true,
 
-       configurable: true,
 
-       writable: true
 
-     });
 
-   } else {
 
-     obj[key] = value;
 
-   }
 
-   return obj;
 
- }
 
- function quote(s
 
- /*: string*/
 
- )
 
- /*: string*/
 
- {
 
-   return `\\Q${s.replace('\\E', '\\E\\\\E\\Q')}\\E`;
 
- }
 
- function _getClassNameFromQueries(queries
 
- /*: Array<ParseQuery>*/
 
- )
 
- /*: ?string*/
 
- {
 
-   let className = null;
 
-   queries.forEach(q => {
 
-     if (!className) {
 
-       
 
-       className = q.className;
 
-     }
 
-     if (className !== q.className) {
 
-       throw new Error('All queries must be for the same class.');
 
-     }
 
-   });
 
-   return className;
 
- }
 
- function handleSelectResult(data
 
- /*: any*/
 
- , select
 
- /*: Array<string>*/
 
- ) {
 
-   const serverDataMask = {};
 
-   select.forEach(field => {
 
-     const hasSubObjectSelect = field.indexOf('.') !== -1;
 
-     if (!hasSubObjectSelect && !data.hasOwnProperty(field)) {
 
-       
 
-       data[field] = undefined;
 
-     } else if (hasSubObjectSelect) {
 
-       
 
-       
 
-       const pathComponents = field.split('.');
 
-       let obj = data;
 
-       let serverMask = serverDataMask;
 
-       pathComponents.forEach((component, index, arr) => {
 
-         
 
-         if (obj && !obj.hasOwnProperty(component)) {
 
-           obj[component] = undefined;
 
-         }
 
-         if (obj && typeof obj === 'object') {
 
-           obj = obj[component];
 
-         } 
 
-         if (index < arr.length - 1) {
 
-           if (!serverMask[component]) {
 
-             serverMask[component] = {};
 
-           }
 
-           serverMask = serverMask[component];
 
-         }
 
-       });
 
-     }
 
-   });
 
-   if (Object.keys(serverDataMask).length > 0) {
 
-     
 
-     
 
-     
 
-     
 
-     const serverData = _CoreManager.default.getObjectStateController().getServerData({
 
-       id: data.objectId,
 
-       className: data.className
 
-     });
 
-     copyMissingDataWithMask(serverData, data, serverDataMask, false);
 
-   }
 
- }
 
- function copyMissingDataWithMask(src, dest, mask, copyThisLevel) {
 
-   
 
-   if (copyThisLevel) {
 
-     for (const key in src) {
 
-       if (src.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {
 
-         dest[key] = src[key];
 
-       }
 
-     }
 
-   }
 
-   for (const key in mask) {
 
-     if (dest[key] !== undefined && dest[key] !== null && src !== undefined && src !== null) {
 
-       
 
-       copyMissingDataWithMask(src[key], dest[key], mask[key], true);
 
-     }
 
-   }
 
- }
 
- function handleOfflineSort(a, b, sorts) {
 
-   let order = sorts[0];
 
-   const operator = order.slice(0, 1);
 
-   const isDescending = operator === '-';
 
-   if (isDescending) {
 
-     order = order.substring(1);
 
-   }
 
-   if (order === '_created_at') {
 
-     order = 'createdAt';
 
-   }
 
-   if (order === '_updated_at') {
 
-     order = 'updatedAt';
 
-   }
 
-   if (!/^[A-Za-z][0-9A-Za-z_]*$/.test(order) || order === 'password') {
 
-     throw new _ParseError.default(_ParseError.default.INVALID_KEY_NAME, `Invalid Key: ${order}`);
 
-   }
 
-   const field1 = a.get(order);
 
-   const field2 = b.get(order);
 
-   if (field1 < field2) {
 
-     return isDescending ? 1 : -1;
 
-   }
 
-   if (field1 > field2) {
 
-     return isDescending ? -1 : 1;
 
-   }
 
-   if (sorts.length > 1) {
 
-     const remainingSorts = sorts.slice(1);
 
-     return handleOfflineSort(a, b, remainingSorts);
 
-   }
 
-   return 0;
 
- }
 
- class ParseQuery {
 
-   
 
-   
 
-   constructor(objectClass
 
-   /*: string | ParseObject*/
 
-   ) {
 
-     _defineProperty(this, "className", void 0);
 
-     _defineProperty(this, "_where", void 0);
 
-     _defineProperty(this, "_include", void 0);
 
-     _defineProperty(this, "_exclude", void 0);
 
-     _defineProperty(this, "_select", void 0);
 
-     _defineProperty(this, "_limit", void 0);
 
-     _defineProperty(this, "_skip", void 0);
 
-     _defineProperty(this, "_count", void 0);
 
-     _defineProperty(this, "_order", void 0);
 
-     _defineProperty(this, "_readPreference", void 0);
 
-     _defineProperty(this, "_includeReadPreference", void 0);
 
-     _defineProperty(this, "_subqueryReadPreference", void 0);
 
-     _defineProperty(this, "_queriesLocalDatastore", void 0);
 
-     _defineProperty(this, "_localDatastorePinName", void 0);
 
-     _defineProperty(this, "_extraOptions", void 0);
 
-     _defineProperty(this, "_hint", void 0);
 
-     _defineProperty(this, "_explain", void 0);
 
-     _defineProperty(this, "_xhrRequest", void 0);
 
-     if (typeof objectClass === 'string') {
 
-       if (objectClass === 'User' && _CoreManager.default.get('PERFORM_USER_REWRITE')) {
 
-         this.className = '_User';
 
-       } else {
 
-         this.className = objectClass;
 
-       }
 
-     } else if (objectClass instanceof _ParseObject.default) {
 
-       this.className = objectClass.className;
 
-     } else if (typeof objectClass === 'function') {
 
-       if (typeof objectClass.className === 'string') {
 
-         this.className = objectClass.className;
 
-       } else {
 
-         const obj = new objectClass();
 
-         this.className = obj.className;
 
-       }
 
-     } else {
 
-       throw new TypeError('A ParseQuery must be constructed with a ParseObject or class name.');
 
-     }
 
-     this._where = {};
 
-     this._include = [];
 
-     this._exclude = [];
 
-     this._count = false; 
 
-     this._limit = -1;
 
-     this._skip = 0;
 
-     this._readPreference = null;
 
-     this._includeReadPreference = null;
 
-     this._subqueryReadPreference = null;
 
-     this._queriesLocalDatastore = false;
 
-     this._localDatastorePinName = null;
 
-     this._extraOptions = {};
 
-     this._xhrRequest = {
 
-       task: null,
 
-       onchange: () => {}
 
-     };
 
-   }
 
-   
 
-   _orQuery(queries
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = queries.map(q => {
 
-       return q.toJSON().where;
 
-     });
 
-     this._where.$or = queryJSON;
 
-     return this;
 
-   }
 
-   
 
-   _andQuery(queries
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = queries.map(q => {
 
-       return q.toJSON().where;
 
-     });
 
-     this._where.$and = queryJSON;
 
-     return this;
 
-   }
 
-   
 
-   _norQuery(queries
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = queries.map(q => {
 
-       return q.toJSON().where;
 
-     });
 
-     this._where.$nor = queryJSON;
 
-     return this;
 
-   }
 
-   
 
-   _addCondition(key
 
-   
 
-   , condition
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     if (!this._where[key] || typeof this._where[key] === 'string') {
 
-       this._where[key] = {};
 
-     }
 
-     this._where[key][condition] = (0, _encode.default)(value, false, true);
 
-     return this;
 
-   }
 
-   
 
-   _regexStartWith(string
 
-   
 
-   )
 
-   
 
-   {
 
-     return `^${quote(string)}`;
 
-   }
 
-   async _handleOfflineQuery(params
 
-   
 
-   ) {
 
-     _OfflineQuery.default.validateQuery(this);
 
-     const localDatastore = _CoreManager.default.getLocalDatastore();
 
-     const objects = await localDatastore._serializeObjectsFromPinName(this._localDatastorePinName);
 
-     let results = objects.map((json, index, arr) => {
 
-       const object = _ParseObject.default.fromJSON(json, false);
 
-       if (json._localId && !json.objectId) {
 
-         object._localId = json._localId;
 
-       }
 
-       if (!_OfflineQuery.default.matchesQuery(this.className, object, arr, this)) {
 
-         return null;
 
-       }
 
-       return object;
 
-     }).filter(object => object !== null);
 
-     if (params.keys) {
 
-       let keys = params.keys.split(',');
 
-       keys = keys.concat(['className', 'objectId', 'createdAt', 'updatedAt', 'ACL']);
 
-       results = results.map(object => {
 
-         const json = object._toFullJSON();
 
-         Object.keys(json).forEach(key => {
 
-           if (!keys.includes(key)) {
 
-             delete json[key];
 
-           }
 
-         });
 
-         return _ParseObject.default.fromJSON(json, false);
 
-       });
 
-     }
 
-     if (params.order) {
 
-       const sorts = params.order.split(',');
 
-       results.sort((a, b) => {
 
-         return handleOfflineSort(a, b, sorts);
 
-       });
 
-     } 
 
-     let count;
 
-     if (params.count) {
 
-       
 
-       count = results.length;
 
-     }
 
-     if (params.skip) {
 
-       if (params.skip >= results.length) {
 
-         results = [];
 
-       } else {
 
-         results = results.splice(params.skip, results.length);
 
-       }
 
-     }
 
-     let limit = results.length;
 
-     if (params.limit !== 0 && params.limit < results.length) {
 
-       
 
-       limit = params.limit;
 
-     }
 
-     results = results.splice(0, limit);
 
-     if (typeof count === 'number') {
 
-       return {
 
-         results,
 
-         count
 
-       };
 
-     }
 
-     return results;
 
-   }
 
-   
 
-   toJSON()
 
-   
 
-   {
 
-     const params
 
-     
 
-     = {
 
-       where: this._where
 
-     };
 
-     if (this._include.length) {
 
-       params.include = this._include.join(',');
 
-     }
 
-     if (this._exclude.length) {
 
-       params.excludeKeys = this._exclude.join(',');
 
-     }
 
-     if (this._select) {
 
-       params.keys = this._select.join(',');
 
-     }
 
-     if (this._count) {
 
-       params.count = 1;
 
-     }
 
-     if (this._limit >= 0) {
 
-       params.limit = this._limit;
 
-     }
 
-     if (this._skip > 0) {
 
-       params.skip = this._skip;
 
-     }
 
-     if (this._order) {
 
-       params.order = this._order.join(',');
 
-     }
 
-     if (this._readPreference) {
 
-       params.readPreference = this._readPreference;
 
-     }
 
-     if (this._includeReadPreference) {
 
-       params.includeReadPreference = this._includeReadPreference;
 
-     }
 
-     if (this._subqueryReadPreference) {
 
-       params.subqueryReadPreference = this._subqueryReadPreference;
 
-     }
 
-     if (this._hint) {
 
-       params.hint = this._hint;
 
-     }
 
-     if (this._explain) {
 
-       params.explain = true;
 
-     }
 
-     for (const key in this._extraOptions) {
 
-       params[key] = this._extraOptions[key];
 
-     }
 
-     return params;
 
-   }
 
-   
 
-   withJSON(json
 
-   
 
-   )
 
-   
 
-   {
 
-     if (json.where) {
 
-       this._where = json.where;
 
-     }
 
-     if (json.include) {
 
-       this._include = json.include.split(',');
 
-     }
 
-     if (json.keys) {
 
-       this._select = json.keys.split(',');
 
-     }
 
-     if (json.excludeKeys) {
 
-       this._exclude = json.excludeKeys.split(',');
 
-     }
 
-     if (json.count) {
 
-       this._count = json.count === 1;
 
-     }
 
-     if (json.limit) {
 
-       this._limit = json.limit;
 
-     }
 
-     if (json.skip) {
 
-       this._skip = json.skip;
 
-     }
 
-     if (json.order) {
 
-       this._order = json.order.split(',');
 
-     }
 
-     if (json.readPreference) {
 
-       this._readPreference = json.readPreference;
 
-     }
 
-     if (json.includeReadPreference) {
 
-       this._includeReadPreference = json.includeReadPreference;
 
-     }
 
-     if (json.subqueryReadPreference) {
 
-       this._subqueryReadPreference = json.subqueryReadPreference;
 
-     }
 
-     if (json.hint) {
 
-       this._hint = json.hint;
 
-     }
 
-     if (json.explain) {
 
-       this._explain = !!json.explain;
 
-     }
 
-     for (const key in json) {
 
-       if (json.hasOwnProperty(key)) {
 
-         if (['where', 'include', 'keys', 'count', 'limit', 'skip', 'order', 'readPreference', 'includeReadPreference', 'subqueryReadPreference', 'hint', 'explain'].indexOf(key) === -1) {
 
-           this._extraOptions[key] = json[key];
 
-         }
 
-       }
 
-     }
 
-     return this;
 
-   }
 
-   
 
-   static fromJSON(className
 
-   
 
-   , json
 
-   
 
-   )
 
-   
 
-   {
 
-     const query = new ParseQuery(className);
 
-     return query.withJSON(json);
 
-   }
 
-   
 
-   get(objectId
 
-   /*: string*/
 
-   , options
 
-   /*:: ?: FullOptions*/
 
-   )
 
-   /*: Promise<ParseObject>*/
 
-   {
 
-     this.equalTo('objectId', objectId);
 
-     const firstOptions = {};
 
-     if (options && options.hasOwnProperty('useMasterKey')) {
 
-       firstOptions.useMasterKey = options.useMasterKey;
 
-     }
 
-     if (options && options.hasOwnProperty('sessionToken')) {
 
-       firstOptions.sessionToken = options.sessionToken;
 
-     }
 
-     if (options && options.hasOwnProperty('context') && typeof options.context === 'object') {
 
-       firstOptions.context = options.context;
 
-     }
 
-     return this.first(firstOptions).then(response => {
 
-       if (response) {
 
-         return response;
 
-       }
 
-       const errorObject = new _ParseError.default(_ParseError.default.OBJECT_NOT_FOUND, 'Object not found.');
 
-       return Promise.reject(errorObject);
 
-     });
 
-   }
 
-   
 
-   find(options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     const findOptions = {};
 
-     if (options.hasOwnProperty('useMasterKey')) {
 
-       findOptions.useMasterKey = options.useMasterKey;
 
-     }
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       findOptions.sessionToken = options.sessionToken;
 
-     }
 
-     if (options.hasOwnProperty('context') && typeof options.context === 'object') {
 
-       findOptions.context = options.context;
 
-     }
 
-     this._setRequestTask(findOptions);
 
-     const controller = _CoreManager.default.getQueryController();
 
-     const select = this._select;
 
-     if (this._queriesLocalDatastore) {
 
-       return this._handleOfflineQuery(this.toJSON());
 
-     }
 
-     return controller.find(this.className, this.toJSON(), findOptions).then(response => {
 
-       
 
-       if (this._explain) {
 
-         return response.results;
 
-       }
 
-       const results = response.results.map(data => {
 
-         
 
-         
 
-         const override = response.className || this.className;
 
-         if (!data.className) {
 
-           data.className = override;
 
-         } 
 
-         
 
-         
 
-         if (select) {
 
-           handleSelectResult(data, select);
 
-         }
 
-         return _ParseObject.default.fromJSON(data, !select);
 
-       });
 
-       const {
 
-         count
 
-       } = response;
 
-       if (typeof count === 'number') {
 
-         return {
 
-           results,
 
-           count
 
-         };
 
-       }
 
-       return results;
 
-     });
 
-   }
 
-   
 
-   async findAll(options
 
-   
 
-   )
 
-   
 
-   {
 
-     let result
 
-     
 
-     = [];
 
-     await this.eachBatch((objects
 
-     
 
-     ) => {
 
-       result = [...result, ...objects];
 
-     }, options);
 
-     return result;
 
-   }
 
-   
 
-   count(options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     const findOptions = {};
 
-     if (options.hasOwnProperty('useMasterKey')) {
 
-       findOptions.useMasterKey = options.useMasterKey;
 
-     }
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       findOptions.sessionToken = options.sessionToken;
 
-     }
 
-     this._setRequestTask(findOptions);
 
-     const controller = _CoreManager.default.getQueryController();
 
-     const params = this.toJSON();
 
-     params.limit = 0;
 
-     params.count = 1;
 
-     return controller.find(this.className, params, findOptions).then(result => {
 
-       return result.count;
 
-     });
 
-   }
 
-   
 
-   distinct(key
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     const distinctOptions = {};
 
-     distinctOptions.useMasterKey = true;
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       distinctOptions.sessionToken = options.sessionToken;
 
-     }
 
-     this._setRequestTask(distinctOptions);
 
-     const controller = _CoreManager.default.getQueryController();
 
-     const params = {
 
-       distinct: key,
 
-       where: this._where,
 
-       hint: this._hint
 
-     };
 
-     return controller.aggregate(this.className, params, distinctOptions).then(results => {
 
-       return results.results;
 
-     });
 
-   }
 
-   
 
-   aggregate(pipeline
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     const aggregateOptions = {};
 
-     aggregateOptions.useMasterKey = true;
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       aggregateOptions.sessionToken = options.sessionToken;
 
-     }
 
-     this._setRequestTask(aggregateOptions);
 
-     const controller = _CoreManager.default.getQueryController();
 
-     if (!Array.isArray(pipeline) && typeof pipeline !== 'object') {
 
-       throw new Error('Invalid pipeline must be Array or Object');
 
-     }
 
-     if (Object.keys(this._where || {}).length) {
 
-       if (!Array.isArray(pipeline)) {
 
-         pipeline = [pipeline];
 
-       }
 
-       pipeline.unshift({
 
-         match: this._where
 
-       });
 
-     }
 
-     const params = {
 
-       pipeline,
 
-       hint: this._hint,
 
-       explain: this._explain,
 
-       readPreference: this._readPreference
 
-     };
 
-     return controller.aggregate(this.className, params, aggregateOptions).then(results => {
 
-       return results.results;
 
-     });
 
-   }
 
-   
 
-   first(options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     const findOptions = {};
 
-     if (options.hasOwnProperty('useMasterKey')) {
 
-       findOptions.useMasterKey = options.useMasterKey;
 
-     }
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       findOptions.sessionToken = options.sessionToken;
 
-     }
 
-     if (options.hasOwnProperty('context') && typeof options.context === 'object') {
 
-       findOptions.context = options.context;
 
-     }
 
-     this._setRequestTask(findOptions);
 
-     const controller = _CoreManager.default.getQueryController();
 
-     const params = this.toJSON();
 
-     params.limit = 1;
 
-     const select = this._select;
 
-     if (this._queriesLocalDatastore) {
 
-       return this._handleOfflineQuery(params).then(objects => {
 
-         if (!objects[0]) {
 
-           return undefined;
 
-         }
 
-         return objects[0];
 
-       });
 
-     }
 
-     return controller.find(this.className, params, findOptions).then(response => {
 
-       const objects = response.results;
 
-       if (!objects[0]) {
 
-         return undefined;
 
-       }
 
-       if (!objects[0].className) {
 
-         objects[0].className = this.className;
 
-       } 
 
-       
 
-       
 
-       if (select) {
 
-         handleSelectResult(objects[0], select);
 
-       }
 
-       return _ParseObject.default.fromJSON(objects[0], !select);
 
-     });
 
-   }
 
-   
 
-   eachBatch(callback
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     if (this._order || this._skip || this._limit >= 0) {
 
-       return Promise.reject('Cannot iterate on a query with sort, skip, or limit.');
 
-     }
 
-     const query = new ParseQuery(this.className);
 
-     query._limit = options.batchSize || 100;
 
-     query._include = this._include.map(i => {
 
-       return i;
 
-     });
 
-     if (this._select) {
 
-       query._select = this._select.map(s => {
 
-         return s;
 
-       });
 
-     }
 
-     query._hint = this._hint;
 
-     query._where = {};
 
-     for (const attr in this._where) {
 
-       const val = this._where[attr];
 
-       if (Array.isArray(val)) {
 
-         query._where[attr] = val.map(v => {
 
-           return v;
 
-         });
 
-       } else if (val && typeof val === 'object') {
 
-         const conditionMap = {};
 
-         query._where[attr] = conditionMap;
 
-         for (const cond in val) {
 
-           conditionMap[cond] = val[cond];
 
-         }
 
-       } else {
 
-         query._where[attr] = val;
 
-       }
 
-     }
 
-     query.ascending('objectId');
 
-     const findOptions = {};
 
-     if (options.hasOwnProperty('useMasterKey')) {
 
-       findOptions.useMasterKey = options.useMasterKey;
 
-     }
 
-     if (options.hasOwnProperty('sessionToken')) {
 
-       findOptions.sessionToken = options.sessionToken;
 
-     }
 
-     if (options.hasOwnProperty('context') && typeof options.context === 'object') {
 
-       findOptions.context = options.context;
 
-     }
 
-     let finished = false;
 
-     let previousResults = [];
 
-     return (0, _promiseUtils.continueWhile)(() => {
 
-       return !finished;
 
-     }, async () => {
 
-       const [results] = await Promise.all([query.find(findOptions), Promise.resolve(previousResults.length > 0 && callback(previousResults))]);
 
-       if (results.length >= query._limit) {
 
-         query.greaterThan('objectId', results[results.length - 1].id);
 
-         previousResults = results;
 
-       } else if (results.length > 0) {
 
-         await Promise.resolve(callback(results));
 
-         finished = true;
 
-       } else {
 
-         finished = true;
 
-       }
 
-     });
 
-   }
 
-   
 
-   each(callback
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     return this.eachBatch(results => {
 
-       let callbacksDone = Promise.resolve();
 
-       results.forEach(result => {
 
-         callbacksDone = callbacksDone.then(() => {
 
-           return callback(result);
 
-         });
 
-       });
 
-       return callbacksDone;
 
-     }, options);
 
-   }
 
-   
 
-   hint(value
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof value === 'undefined') {
 
-       delete this._hint;
 
-     }
 
-     this._hint = value;
 
-     return this;
 
-   }
 
-   
 
-   explain(explain
 
-   
 
-   = true)
 
-   
 
-   {
 
-     if (typeof explain !== 'boolean') {
 
-       throw new Error('You can only set explain to a boolean value');
 
-     }
 
-     this._explain = explain;
 
-     return this;
 
-   }
 
-   
 
-   async map(callback
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     const array = [];
 
-     let index = 0;
 
-     await this.each(object => {
 
-       return Promise.resolve(callback(object, index, this)).then(result => {
 
-         array.push(result);
 
-         index += 1;
 
-       });
 
-     }, options);
 
-     return array;
 
-   }
 
-   
 
-   async reduce(callback
 
-   
 
-   , initialValue
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     let accumulator = initialValue;
 
-     let index = 0;
 
-     await this.each(object => {
 
-       
 
-       
 
-       if (index === 0 && initialValue === undefined) {
 
-         accumulator = object;
 
-         index += 1;
 
-         return;
 
-       }
 
-       return Promise.resolve(callback(accumulator, object, index)).then(result => {
 
-         accumulator = result;
 
-         index += 1;
 
-       });
 
-     }, options);
 
-     if (index === 0 && initialValue === undefined) {
 
-       
 
-       
 
-       throw new TypeError('Reducing empty query result set with no initial value');
 
-     }
 
-     return accumulator;
 
-   }
 
-   
 
-   async filter(callback
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     const array = [];
 
-     let index = 0;
 
-     await this.each(object => {
 
-       return Promise.resolve(callback(object, index, this)).then(flag => {
 
-         if (flag) {
 
-           array.push(object);
 
-         }
 
-         index += 1;
 
-       });
 
-     }, options);
 
-     return array;
 
-   }
 
-   
 
-   
 
-   equalTo(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     if (key && typeof key === 'object') {
 
-       Object.entries(key).forEach(([k, val]) => this.equalTo(k, val));
 
-       return this;
 
-     }
 
-     if (typeof value === 'undefined') {
 
-       return this.doesNotExist(key);
 
-     }
 
-     this._where[key] = (0, _encode.default)(value, false, true);
 
-     return this;
 
-   }
 
-   
 
-   notEqualTo(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     if (key && typeof key === 'object') {
 
-       Object.entries(key).forEach(([k, val]) => this.notEqualTo(k, val));
 
-       return this;
 
-     }
 
-     return this._addCondition(key, '$ne', value);
 
-   }
 
-   
 
-   lessThan(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$lt', value);
 
-   }
 
-   
 
-   greaterThan(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$gt', value);
 
-   }
 
-   
 
-   lessThanOrEqualTo(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$lte', value);
 
-   }
 
-   
 
-   greaterThanOrEqualTo(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$gte', value);
 
-   }
 
-   
 
-   containedIn(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$in', value);
 
-   }
 
-   
 
-   notContainedIn(key
 
-   
 
-   , value
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$nin', value);
 
-   }
 
-   
 
-   containedBy(key
 
-   
 
-   , values
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$containedBy', values);
 
-   }
 
-   
 
-   containsAll(key
 
-   
 
-   , values
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$all', values);
 
-   }
 
-   
 
-   containsAllStartingWith(key
 
-   
 
-   , values
 
-   
 
-   )
 
-   
 
-   {
 
-     const _this = this;
 
-     if (!Array.isArray(values)) {
 
-       values = [values];
 
-     }
 
-     const regexObject = values.map(value => {
 
-       return {
 
-         $regex: _this._regexStartWith(value)
 
-       };
 
-     });
 
-     return this.containsAll(key, regexObject);
 
-   }
 
-   
 
-   exists(key
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$exists', true);
 
-   }
 
-   
 
-   doesNotExist(key
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$exists', false);
 
-   }
 
-   
 
-   matches(key
 
-   
 
-   , regex
 
-   
 
-   , modifiers
 
-   
 
-   )
 
-   
 
-   {
 
-     this._addCondition(key, '$regex', regex);
 
-     if (!modifiers) {
 
-       modifiers = '';
 
-     }
 
-     if (regex.ignoreCase) {
 
-       modifiers += 'i';
 
-     }
 
-     if (regex.multiline) {
 
-       modifiers += 'm';
 
-     }
 
-     if (modifiers.length) {
 
-       this._addCondition(key, '$options', modifiers);
 
-     }
 
-     return this;
 
-   }
 
-   
 
-   matchesQuery(key
 
-   
 
-   , query
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = query.toJSON();
 
-     queryJSON.className = query.className;
 
-     return this._addCondition(key, '$inQuery', queryJSON);
 
-   }
 
-   
 
-   doesNotMatchQuery(key
 
-   
 
-   , query
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = query.toJSON();
 
-     queryJSON.className = query.className;
 
-     return this._addCondition(key, '$notInQuery', queryJSON);
 
-   }
 
-   
 
-   matchesKeyInQuery(key
 
-   
 
-   , queryKey
 
-   
 
-   , query
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = query.toJSON();
 
-     queryJSON.className = query.className;
 
-     return this._addCondition(key, '$select', {
 
-       key: queryKey,
 
-       query: queryJSON
 
-     });
 
-   }
 
-   
 
-   doesNotMatchKeyInQuery(key
 
-   
 
-   , queryKey
 
-   
 
-   , query
 
-   
 
-   )
 
-   
 
-   {
 
-     const queryJSON = query.toJSON();
 
-     queryJSON.className = query.className;
 
-     return this._addCondition(key, '$dontSelect', {
 
-       key: queryKey,
 
-       query: queryJSON
 
-     });
 
-   }
 
-   
 
-   contains(key
 
-   
 
-   , substring
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof substring !== 'string') {
 
-       throw new Error('The value being searched for must be a string.');
 
-     }
 
-     return this._addCondition(key, '$regex', quote(substring));
 
-   }
 
-   
 
-   fullText(key
 
-   
 
-   , value
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     options = options || {};
 
-     if (!key) {
 
-       throw new Error('A key is required.');
 
-     }
 
-     if (!value) {
 
-       throw new Error('A search term is required');
 
-     }
 
-     if (typeof value !== 'string') {
 
-       throw new Error('The value being searched for must be a string.');
 
-     }
 
-     const fullOptions = {};
 
-     fullOptions.$term = value;
 
-     for (const option in options) {
 
-       switch (option) {
 
-         case 'language':
 
-           fullOptions.$language = options[option];
 
-           break;
 
-         case 'caseSensitive':
 
-           fullOptions.$caseSensitive = options[option];
 
-           break;
 
-         case 'diacriticSensitive':
 
-           fullOptions.$diacriticSensitive = options[option];
 
-           break;
 
-         default:
 
-           throw new Error(`Unknown option: ${option}`);
 
-       }
 
-     }
 
-     return this._addCondition(key, '$text', {
 
-       $search: fullOptions
 
-     });
 
-   }
 
-   
 
-   sortByTextScore() {
 
-     this.ascending('$score');
 
-     this.select(['$score']);
 
-     return this;
 
-   }
 
-   
 
-   startsWith(key
 
-   
 
-   , prefix
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof prefix !== 'string') {
 
-       throw new Error('The value being searched for must be a string.');
 
-     }
 
-     return this._addCondition(key, '$regex', this._regexStartWith(prefix));
 
-   }
 
-   
 
-   endsWith(key
 
-   
 
-   , suffix
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof suffix !== 'string') {
 
-       throw new Error('The value being searched for must be a string.');
 
-     }
 
-     return this._addCondition(key, '$regex', `${quote(suffix)}$`);
 
-   }
 
-   
 
-   near(key
 
-   
 
-   , point
 
-   
 
-   )
 
-   
 
-   {
 
-     if (!(point instanceof _ParseGeoPoint.default)) {
 
-       
 
-       point = new _ParseGeoPoint.default(point);
 
-     }
 
-     return this._addCondition(key, '$nearSphere', point);
 
-   }
 
-   
 
-   withinRadians(key
 
-   
 
-   , point
 
-   
 
-   , maxDistance
 
-   
 
-   , sorted
 
-   
 
-   )
 
-   
 
-   {
 
-     if (sorted || sorted === undefined) {
 
-       this.near(key, point);
 
-       return this._addCondition(key, '$maxDistance', maxDistance);
 
-     }
 
-     return this._addCondition(key, '$geoWithin', {
 
-       $centerSphere: [[point.longitude, point.latitude], maxDistance]
 
-     });
 
-   }
 
-   
 
-   withinMiles(key
 
-   
 
-   , point
 
-   
 
-   , maxDistance
 
-   
 
-   , sorted
 
-   
 
-   )
 
-   
 
-   {
 
-     return this.withinRadians(key, point, maxDistance / 3958.8, sorted);
 
-   }
 
-   
 
-   withinKilometers(key
 
-   
 
-   , point
 
-   
 
-   , maxDistance
 
-   
 
-   , sorted
 
-   
 
-   )
 
-   
 
-   {
 
-     return this.withinRadians(key, point, maxDistance / 6371.0, sorted);
 
-   }
 
-   
 
-   withinGeoBox(key
 
-   
 
-   , southwest
 
-   
 
-   , northeast
 
-   
 
-   )
 
-   
 
-   {
 
-     if (!(southwest instanceof _ParseGeoPoint.default)) {
 
-       southwest = new _ParseGeoPoint.default(southwest);
 
-     }
 
-     if (!(northeast instanceof _ParseGeoPoint.default)) {
 
-       northeast = new _ParseGeoPoint.default(northeast);
 
-     }
 
-     this._addCondition(key, '$within', {
 
-       $box: [southwest, northeast]
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   withinPolygon(key
 
-   
 
-   , points
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$geoWithin', {
 
-       $polygon: points
 
-     });
 
-   }
 
-   
 
-   polygonContains(key
 
-   
 
-   , point
 
-   
 
-   )
 
-   
 
-   {
 
-     return this._addCondition(key, '$geoIntersects', {
 
-       $point: point
 
-     });
 
-   }
 
-   
 
-   
 
-   ascending(...keys)
 
-   
 
-   {
 
-     this._order = [];
 
-     return this.addAscending.apply(this, keys);
 
-   }
 
-   
 
-   addAscending(...keys)
 
-   
 
-   {
 
-     if (!this._order) {
 
-       this._order = [];
 
-     }
 
-     keys.forEach(key => {
 
-       if (Array.isArray(key)) {
 
-         key = key.join();
 
-       }
 
-       this._order = this._order.concat(key.replace(/\s/g, '').split(','));
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   descending(...keys)
 
-   
 
-   {
 
-     this._order = [];
 
-     return this.addDescending.apply(this, keys);
 
-   }
 
-   
 
-   addDescending(...keys)
 
-   
 
-   {
 
-     if (!this._order) {
 
-       this._order = [];
 
-     }
 
-     keys.forEach(key => {
 
-       if (Array.isArray(key)) {
 
-         key = key.join();
 
-       }
 
-       this._order = this._order.concat(key.replace(/\s/g, '').split(',').map(k => {
 
-         return `-${k}`;
 
-       }));
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   
 
-   skip(n
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof n !== 'number' || n < 0) {
 
-       throw new Error('You can only skip by a positive number');
 
-     }
 
-     this._skip = n;
 
-     return this;
 
-   }
 
-   
 
-   limit(n
 
-   
 
-   )
 
-   
 
-   {
 
-     if (typeof n !== 'number') {
 
-       throw new Error('You can only set the limit to a numeric value');
 
-     }
 
-     this._limit = n;
 
-     return this;
 
-   }
 
-   
 
-   withCount(includeCount
 
-   
 
-   = true)
 
-   
 
-   {
 
-     if (typeof includeCount !== 'boolean') {
 
-       throw new Error('You can only set withCount to a boolean value');
 
-     }
 
-     this._count = includeCount;
 
-     return this;
 
-   }
 
-   
 
-   include(...keys)
 
-   
 
-   {
 
-     keys.forEach(key => {
 
-       if (Array.isArray(key)) {
 
-         this._include = this._include.concat(key);
 
-       } else {
 
-         this._include.push(key);
 
-       }
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   includeAll()
 
-   
 
-   {
 
-     return this.include('*');
 
-   }
 
-   
 
-   select(...keys)
 
-   
 
-   {
 
-     if (!this._select) {
 
-       this._select = [];
 
-     }
 
-     keys.forEach(key => {
 
-       if (Array.isArray(key)) {
 
-         this._select = this._select.concat(key);
 
-       } else {
 
-         this._select.push(key);
 
-       }
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   exclude(...keys)
 
-   
 
-   {
 
-     keys.forEach(key => {
 
-       if (Array.isArray(key)) {
 
-         this._exclude = this._exclude.concat(key);
 
-       } else {
 
-         this._exclude.push(key);
 
-       }
 
-     });
 
-     return this;
 
-   }
 
-   
 
-   readPreference(readPreference
 
-   
 
-   , includeReadPreference
 
-   
 
-   , subqueryReadPreference
 
-   
 
-   )
 
-   
 
-   {
 
-     this._readPreference = readPreference;
 
-     this._includeReadPreference = includeReadPreference;
 
-     this._subqueryReadPreference = subqueryReadPreference;
 
-     return this;
 
-   }
 
-   onChange(onUpdate
 
-   
 
-   , onError
 
-   
 
-   
 
-   )
 
-   
 
-   {
 
-     let sub = null;
 
-     this.subscribe().then(subscription => {
 
-       sub = subscription;
 
-       subscription.on('create', object => {
 
-         onUpdate(object);
 
-       });
 
-       subscription.on('update', object => {
 
-         onUpdate(object);
 
-       });
 
-       subscription.on('error', err => {
 
-         if (onError) {
 
-           onError(err);
 
-         } else {
 
-           
 
-           console.warn('Subscription error', err);
 
-         }
 
-       });
 
-     }).catch(err => {
 
-       if (onError) {
 
-         onError(err);
 
-       } else {
 
-         
 
-         console.warn('Subscription connection error', err);
 
-       }
 
-     });
 
-     return function () {
 
-       if (sub) {
 
-         sub.unsubscribe();
 
-       }
 
-     };
 
-   }
 
-   
 
-   async subscribe(sessionToken
 
-   
 
-   )
 
-   
 
-   {
 
-     const currentUser = await _CoreManager.default.getUserController().currentUserAsync();
 
-     if (!sessionToken) {
 
-       sessionToken = currentUser ? currentUser.getSessionToken() : undefined;
 
-     }
 
-     const liveQueryClient = await _CoreManager.default.getLiveQueryController().getDefaultLiveQueryClient();
 
-     if (liveQueryClient.shouldOpen()) {
 
-       liveQueryClient.open();
 
-     }
 
-     const subscription = liveQueryClient.subscribe(this, sessionToken);
 
-     return subscription.subscribePromise.then(() => {
 
-       return subscription;
 
-     });
 
-   }
 
-   
 
-   static or(...queries)
 
-   
 
-   {
 
-     const className = _getClassNameFromQueries(queries);
 
-     const query = new ParseQuery(className);
 
-     query._orQuery(queries);
 
-     return query;
 
-   }
 
-   
 
-   static and(...queries)
 
-   
 
-   {
 
-     const className = _getClassNameFromQueries(queries);
 
-     const query = new ParseQuery(className);
 
-     query._andQuery(queries);
 
-     return query;
 
-   }
 
-   
 
-   static nor(...queries)
 
-   
 
-   {
 
-     const className = _getClassNameFromQueries(queries);
 
-     const query = new ParseQuery(className);
 
-     query._norQuery(queries);
 
-     return query;
 
-   }
 
-   
 
-   fromNetwork()
 
-   
 
-   {
 
-     this._queriesLocalDatastore = false;
 
-     this._localDatastorePinName = null;
 
-     return this;
 
-   }
 
-   
 
-   fromLocalDatastore()
 
-   
 
-   {
 
-     return this.fromPinWithName(null);
 
-   }
 
-   
 
-   fromPin()
 
-   
 
-   {
 
-     return this.fromPinWithName(_LocalDatastoreUtils.DEFAULT_PIN);
 
-   }
 
-   
 
-   fromPinWithName(name
 
-   
 
-   )
 
-   
 
-   {
 
-     const localDatastore = _CoreManager.default.getLocalDatastore();
 
-     if (localDatastore.checkIfEnabled()) {
 
-       this._queriesLocalDatastore = true;
 
-       this._localDatastorePinName = name;
 
-     }
 
-     return this;
 
-   }
 
-   
 
-   cancel()
 
-   
 
-   {
 
-     if (this._xhrRequest.task && typeof this._xhrRequest.task.abort === 'function') {
 
-       this._xhrRequest.task._aborted = true;
 
-       this._xhrRequest.task.abort();
 
-       this._xhrRequest.task = null;
 
-       this._xhrRequest.onchange = () => {};
 
-       return this;
 
-     }
 
-     return this._xhrRequest.onchange = () => this.cancel();
 
-   }
 
-   _setRequestTask(options) {
 
-     options.requestTask = task => {
 
-       this._xhrRequest.task = task;
 
-       this._xhrRequest.onchange();
 
-     };
 
-   }
 
- }
 
- const DefaultController = {
 
-   find(className
 
-   
 
-   , params
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     const RESTController = _CoreManager.default.getRESTController();
 
-     return RESTController.request('GET', `classes/${className}`, params, options);
 
-   },
 
-   aggregate(className
 
-   
 
-   , params
 
-   
 
-   , options
 
-   
 
-   )
 
-   
 
-   {
 
-     const RESTController = _CoreManager.default.getRESTController();
 
-     return RESTController.request('GET', `aggregate/${className}`, params, options);
 
-   }
 
- };
 
- _CoreManager.default.setQueryController(DefaultController);
 
- var _default = ParseQuery;
 
- exports.default = _default;
 
 
  |