RestQuery.js 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001
  1. "use strict";
  2. // An object that encapsulates everything we need to run a 'find'
  3. // operation, encoded in the REST API format.
  4. var SchemaController = require('./Controllers/SchemaController');
  5. var Parse = require('parse/node').Parse;
  6. const triggers = require('./triggers');
  7. const {
  8. continueWhile
  9. } = require('parse/lib/node/promiseUtils');
  10. const AlwaysSelectedKeys = ['objectId', 'createdAt', 'updatedAt', 'ACL'];
  11. const {
  12. enforceRoleSecurity
  13. } = require('./SharedRest');
  14. // restOptions can include:
  15. // skip
  16. // limit
  17. // order
  18. // count
  19. // include
  20. // keys
  21. // excludeKeys
  22. // redirectClassNameForKey
  23. // readPreference
  24. // includeReadPreference
  25. // subqueryReadPreference
  26. /**
  27. * Use to perform a query on a class. It will run security checks and triggers.
  28. * @param options
  29. * @param options.method {RestQuery.Method} The type of query to perform
  30. * @param options.config {ParseServerConfiguration} The server configuration
  31. * @param options.auth {Auth} The auth object for the request
  32. * @param options.className {string} The name of the class to query
  33. * @param options.restWhere {object} The where object for the query
  34. * @param options.restOptions {object} The options object for the query
  35. * @param options.clientSDK {string} The client SDK that is performing the query
  36. * @param options.runAfterFind {boolean} Whether to run the afterFind trigger
  37. * @param options.runBeforeFind {boolean} Whether to run the beforeFind trigger
  38. * @param options.context {object} The context object for the query
  39. * @returns {Promise<_UnsafeRestQuery>} A promise that is resolved with the _UnsafeRestQuery object
  40. */
  41. async function RestQuery({
  42. method,
  43. config,
  44. auth,
  45. className,
  46. restWhere = {},
  47. restOptions = {},
  48. clientSDK,
  49. runAfterFind = true,
  50. runBeforeFind = true,
  51. context
  52. }) {
  53. if (![RestQuery.Method.find, RestQuery.Method.get].includes(method)) {
  54. throw new Parse.Error(Parse.Error.INVALID_QUERY, 'bad query type');
  55. }
  56. enforceRoleSecurity(method, className, auth);
  57. const result = runBeforeFind ? await triggers.maybeRunQueryTrigger(triggers.Types.beforeFind, className, restWhere, restOptions, config, auth, context, method === RestQuery.Method.get) : Promise.resolve({
  58. restWhere,
  59. restOptions
  60. });
  61. return new _UnsafeRestQuery(config, auth, className, result.restWhere || restWhere, result.restOptions || restOptions, clientSDK, runAfterFind, context);
  62. }
  63. RestQuery.Method = Object.freeze({
  64. get: 'get',
  65. find: 'find'
  66. });
  67. /**
  68. * _UnsafeRestQuery is meant for specific internal usage only. When you need to skip security checks or some triggers.
  69. * Don't use it if you don't know what you are doing.
  70. * @param config
  71. * @param auth
  72. * @param className
  73. * @param restWhere
  74. * @param restOptions
  75. * @param clientSDK
  76. * @param runAfterFind
  77. * @param context
  78. */
  79. function _UnsafeRestQuery(config, auth, className, restWhere = {}, restOptions = {}, clientSDK, runAfterFind = true, context) {
  80. this.config = config;
  81. this.auth = auth;
  82. this.className = className;
  83. this.restWhere = restWhere;
  84. this.restOptions = restOptions;
  85. this.clientSDK = clientSDK;
  86. this.runAfterFind = runAfterFind;
  87. this.response = null;
  88. this.findOptions = {};
  89. this.context = context || {};
  90. if (!this.auth.isMaster) {
  91. if (this.className == '_Session') {
  92. if (!this.auth.user) {
  93. throw new Parse.Error(Parse.Error.INVALID_SESSION_TOKEN, 'Invalid session token');
  94. }
  95. this.restWhere = {
  96. $and: [this.restWhere, {
  97. user: {
  98. __type: 'Pointer',
  99. className: '_User',
  100. objectId: this.auth.user.id
  101. }
  102. }]
  103. };
  104. }
  105. }
  106. this.doCount = false;
  107. this.includeAll = false;
  108. // The format for this.include is not the same as the format for the
  109. // include option - it's the paths we should include, in order,
  110. // stored as arrays, taking into account that we need to include foo
  111. // before including foo.bar. Also it should dedupe.
  112. // For example, passing an arg of include=foo.bar,foo.baz could lead to
  113. // this.include = [['foo'], ['foo', 'baz'], ['foo', 'bar']]
  114. this.include = [];
  115. let keysForInclude = '';
  116. // If we have keys, we probably want to force some includes (n-1 level)
  117. // See issue: https://github.com/parse-community/parse-server/issues/3185
  118. if (Object.prototype.hasOwnProperty.call(restOptions, 'keys')) {
  119. keysForInclude = restOptions.keys;
  120. }
  121. // If we have keys, we probably want to force some includes (n-1 level)
  122. // in order to exclude specific keys.
  123. if (Object.prototype.hasOwnProperty.call(restOptions, 'excludeKeys')) {
  124. keysForInclude += ',' + restOptions.excludeKeys;
  125. }
  126. if (keysForInclude.length > 0) {
  127. keysForInclude = keysForInclude.split(',').filter(key => {
  128. // At least 2 components
  129. return key.split('.').length > 1;
  130. }).map(key => {
  131. // Slice the last component (a.b.c -> a.b)
  132. // Otherwise we'll include one level too much.
  133. return key.slice(0, key.lastIndexOf('.'));
  134. }).join(',');
  135. // Concat the possibly present include string with the one from the keys
  136. // Dedup / sorting is handle in 'include' case.
  137. if (keysForInclude.length > 0) {
  138. if (!restOptions.include || restOptions.include.length == 0) {
  139. restOptions.include = keysForInclude;
  140. } else {
  141. restOptions.include += ',' + keysForInclude;
  142. }
  143. }
  144. }
  145. for (var option in restOptions) {
  146. switch (option) {
  147. case 'keys':
  148. {
  149. const keys = restOptions.keys.split(',').filter(key => key.length > 0).concat(AlwaysSelectedKeys);
  150. this.keys = Array.from(new Set(keys));
  151. break;
  152. }
  153. case 'excludeKeys':
  154. {
  155. const exclude = restOptions.excludeKeys.split(',').filter(k => AlwaysSelectedKeys.indexOf(k) < 0);
  156. this.excludeKeys = Array.from(new Set(exclude));
  157. break;
  158. }
  159. case 'count':
  160. this.doCount = true;
  161. break;
  162. case 'includeAll':
  163. this.includeAll = true;
  164. break;
  165. case 'explain':
  166. case 'hint':
  167. case 'distinct':
  168. case 'pipeline':
  169. case 'skip':
  170. case 'limit':
  171. case 'readPreference':
  172. case 'comment':
  173. this.findOptions[option] = restOptions[option];
  174. break;
  175. case 'order':
  176. var fields = restOptions.order.split(',');
  177. this.findOptions.sort = fields.reduce((sortMap, field) => {
  178. field = field.trim();
  179. if (field === '$score' || field === '-$score') {
  180. sortMap.score = {
  181. $meta: 'textScore'
  182. };
  183. } else if (field[0] == '-') {
  184. sortMap[field.slice(1)] = -1;
  185. } else {
  186. sortMap[field] = 1;
  187. }
  188. return sortMap;
  189. }, {});
  190. break;
  191. case 'include':
  192. {
  193. const paths = restOptions.include.split(',');
  194. if (paths.includes('*')) {
  195. this.includeAll = true;
  196. break;
  197. }
  198. // Load the existing includes (from keys)
  199. const pathSet = paths.reduce((memo, path) => {
  200. // Split each paths on . (a.b.c -> [a,b,c])
  201. // reduce to create all paths
  202. // ([a,b,c] -> {a: true, 'a.b': true, 'a.b.c': true})
  203. return path.split('.').reduce((memo, path, index, parts) => {
  204. memo[parts.slice(0, index + 1).join('.')] = true;
  205. return memo;
  206. }, memo);
  207. }, {});
  208. this.include = Object.keys(pathSet).map(s => {
  209. return s.split('.');
  210. }).sort((a, b) => {
  211. return a.length - b.length; // Sort by number of components
  212. });
  213. break;
  214. }
  215. case 'redirectClassNameForKey':
  216. this.redirectKey = restOptions.redirectClassNameForKey;
  217. this.redirectClassName = null;
  218. break;
  219. case 'includeReadPreference':
  220. case 'subqueryReadPreference':
  221. break;
  222. default:
  223. throw new Parse.Error(Parse.Error.INVALID_JSON, 'bad option: ' + option);
  224. }
  225. }
  226. }
  227. // A convenient method to perform all the steps of processing a query
  228. // in order.
  229. // Returns a promise for the response - an object with optional keys
  230. // 'results' and 'count'.
  231. // TODO: consolidate the replaceX functions
  232. _UnsafeRestQuery.prototype.execute = function (executeOptions) {
  233. return Promise.resolve().then(() => {
  234. return this.buildRestWhere();
  235. }).then(() => {
  236. return this.denyProtectedFields();
  237. }).then(() => {
  238. return this.handleIncludeAll();
  239. }).then(() => {
  240. return this.handleExcludeKeys();
  241. }).then(() => {
  242. return this.runFind(executeOptions);
  243. }).then(() => {
  244. return this.runCount();
  245. }).then(() => {
  246. return this.handleInclude();
  247. }).then(() => {
  248. return this.runAfterFindTrigger();
  249. }).then(() => {
  250. return this.handleAuthAdapters();
  251. }).then(() => {
  252. return this.response;
  253. });
  254. };
  255. _UnsafeRestQuery.prototype.each = function (callback) {
  256. const {
  257. config,
  258. auth,
  259. className,
  260. restWhere,
  261. restOptions,
  262. clientSDK
  263. } = this;
  264. // if the limit is set, use it
  265. restOptions.limit = restOptions.limit || 100;
  266. restOptions.order = 'objectId';
  267. let finished = false;
  268. return continueWhile(() => {
  269. return !finished;
  270. }, async () => {
  271. // Safe here to use _UnsafeRestQuery because the security was already
  272. // checked during "await RestQuery()"
  273. const query = new _UnsafeRestQuery(config, auth, className, restWhere, restOptions, clientSDK, this.runAfterFind, this.context);
  274. const {
  275. results
  276. } = await query.execute();
  277. results.forEach(callback);
  278. finished = results.length < restOptions.limit;
  279. if (!finished) {
  280. restWhere.objectId = Object.assign({}, restWhere.objectId, {
  281. $gt: results[results.length - 1].objectId
  282. });
  283. }
  284. });
  285. };
  286. _UnsafeRestQuery.prototype.buildRestWhere = function () {
  287. return Promise.resolve().then(() => {
  288. return this.getUserAndRoleACL();
  289. }).then(() => {
  290. return this.redirectClassNameForKey();
  291. }).then(() => {
  292. return this.validateClientClassCreation();
  293. }).then(() => {
  294. return this.replaceSelect();
  295. }).then(() => {
  296. return this.replaceDontSelect();
  297. }).then(() => {
  298. return this.replaceInQuery();
  299. }).then(() => {
  300. return this.replaceNotInQuery();
  301. }).then(() => {
  302. return this.replaceEquality();
  303. });
  304. };
  305. // Uses the Auth object to get the list of roles, adds the user id
  306. _UnsafeRestQuery.prototype.getUserAndRoleACL = function () {
  307. if (this.auth.isMaster) {
  308. return Promise.resolve();
  309. }
  310. this.findOptions.acl = ['*'];
  311. if (this.auth.user) {
  312. return this.auth.getUserRoles().then(roles => {
  313. this.findOptions.acl = this.findOptions.acl.concat(roles, [this.auth.user.id]);
  314. return;
  315. });
  316. } else {
  317. return Promise.resolve();
  318. }
  319. };
  320. // Changes the className if redirectClassNameForKey is set.
  321. // Returns a promise.
  322. _UnsafeRestQuery.prototype.redirectClassNameForKey = function () {
  323. if (!this.redirectKey) {
  324. return Promise.resolve();
  325. }
  326. // We need to change the class name based on the schema
  327. return this.config.database.redirectClassNameForKey(this.className, this.redirectKey).then(newClassName => {
  328. this.className = newClassName;
  329. this.redirectClassName = newClassName;
  330. });
  331. };
  332. // Validates this operation against the allowClientClassCreation config.
  333. _UnsafeRestQuery.prototype.validateClientClassCreation = function () {
  334. if (this.config.allowClientClassCreation === false && !this.auth.isMaster && SchemaController.systemClasses.indexOf(this.className) === -1) {
  335. return this.config.database.loadSchema().then(schemaController => schemaController.hasClass(this.className)).then(hasClass => {
  336. if (hasClass !== true) {
  337. throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, 'This user is not allowed to access ' + 'non-existent class: ' + this.className);
  338. }
  339. });
  340. } else {
  341. return Promise.resolve();
  342. }
  343. };
  344. function transformInQuery(inQueryObject, className, results) {
  345. var values = [];
  346. for (var result of results) {
  347. values.push({
  348. __type: 'Pointer',
  349. className: className,
  350. objectId: result.objectId
  351. });
  352. }
  353. delete inQueryObject['$inQuery'];
  354. if (Array.isArray(inQueryObject['$in'])) {
  355. inQueryObject['$in'] = inQueryObject['$in'].concat(values);
  356. } else {
  357. inQueryObject['$in'] = values;
  358. }
  359. }
  360. // Replaces a $inQuery clause by running the subquery, if there is an
  361. // $inQuery clause.
  362. // The $inQuery clause turns into an $in with values that are just
  363. // pointers to the objects returned in the subquery.
  364. _UnsafeRestQuery.prototype.replaceInQuery = async function () {
  365. var inQueryObject = findObjectWithKey(this.restWhere, '$inQuery');
  366. if (!inQueryObject) {
  367. return;
  368. }
  369. // The inQuery value must have precisely two keys - where and className
  370. var inQueryValue = inQueryObject['$inQuery'];
  371. if (!inQueryValue.where || !inQueryValue.className) {
  372. throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $inQuery');
  373. }
  374. const additionalOptions = {
  375. redirectClassNameForKey: inQueryValue.redirectClassNameForKey
  376. };
  377. if (this.restOptions.subqueryReadPreference) {
  378. additionalOptions.readPreference = this.restOptions.subqueryReadPreference;
  379. additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference;
  380. } else if (this.restOptions.readPreference) {
  381. additionalOptions.readPreference = this.restOptions.readPreference;
  382. }
  383. const subquery = await RestQuery({
  384. method: RestQuery.Method.find,
  385. config: this.config,
  386. auth: this.auth,
  387. className: inQueryValue.className,
  388. restWhere: inQueryValue.where,
  389. restOptions: additionalOptions,
  390. context: this.context
  391. });
  392. return subquery.execute().then(response => {
  393. transformInQuery(inQueryObject, subquery.className, response.results);
  394. // Recurse to repeat
  395. return this.replaceInQuery();
  396. });
  397. };
  398. function transformNotInQuery(notInQueryObject, className, results) {
  399. var values = [];
  400. for (var result of results) {
  401. values.push({
  402. __type: 'Pointer',
  403. className: className,
  404. objectId: result.objectId
  405. });
  406. }
  407. delete notInQueryObject['$notInQuery'];
  408. if (Array.isArray(notInQueryObject['$nin'])) {
  409. notInQueryObject['$nin'] = notInQueryObject['$nin'].concat(values);
  410. } else {
  411. notInQueryObject['$nin'] = values;
  412. }
  413. }
  414. // Replaces a $notInQuery clause by running the subquery, if there is an
  415. // $notInQuery clause.
  416. // The $notInQuery clause turns into a $nin with values that are just
  417. // pointers to the objects returned in the subquery.
  418. _UnsafeRestQuery.prototype.replaceNotInQuery = async function () {
  419. var notInQueryObject = findObjectWithKey(this.restWhere, '$notInQuery');
  420. if (!notInQueryObject) {
  421. return;
  422. }
  423. // The notInQuery value must have precisely two keys - where and className
  424. var notInQueryValue = notInQueryObject['$notInQuery'];
  425. if (!notInQueryValue.where || !notInQueryValue.className) {
  426. throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $notInQuery');
  427. }
  428. const additionalOptions = {
  429. redirectClassNameForKey: notInQueryValue.redirectClassNameForKey
  430. };
  431. if (this.restOptions.subqueryReadPreference) {
  432. additionalOptions.readPreference = this.restOptions.subqueryReadPreference;
  433. additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference;
  434. } else if (this.restOptions.readPreference) {
  435. additionalOptions.readPreference = this.restOptions.readPreference;
  436. }
  437. const subquery = await RestQuery({
  438. method: RestQuery.Method.find,
  439. config: this.config,
  440. auth: this.auth,
  441. className: notInQueryValue.className,
  442. restWhere: notInQueryValue.where,
  443. restOptions: additionalOptions,
  444. context: this.context
  445. });
  446. return subquery.execute().then(response => {
  447. transformNotInQuery(notInQueryObject, subquery.className, response.results);
  448. // Recurse to repeat
  449. return this.replaceNotInQuery();
  450. });
  451. };
  452. // Used to get the deepest object from json using dot notation.
  453. const getDeepestObjectFromKey = (json, key, idx, src) => {
  454. if (key in json) {
  455. return json[key];
  456. }
  457. src.splice(1); // Exit Early
  458. };
  459. const transformSelect = (selectObject, key, objects) => {
  460. var values = [];
  461. for (var result of objects) {
  462. values.push(key.split('.').reduce(getDeepestObjectFromKey, result));
  463. }
  464. delete selectObject['$select'];
  465. if (Array.isArray(selectObject['$in'])) {
  466. selectObject['$in'] = selectObject['$in'].concat(values);
  467. } else {
  468. selectObject['$in'] = values;
  469. }
  470. };
  471. // Replaces a $select clause by running the subquery, if there is a
  472. // $select clause.
  473. // The $select clause turns into an $in with values selected out of
  474. // the subquery.
  475. // Returns a possible-promise.
  476. _UnsafeRestQuery.prototype.replaceSelect = async function () {
  477. var selectObject = findObjectWithKey(this.restWhere, '$select');
  478. if (!selectObject) {
  479. return;
  480. }
  481. // The select value must have precisely two keys - query and key
  482. var selectValue = selectObject['$select'];
  483. // iOS SDK don't send where if not set, let it pass
  484. if (!selectValue.query || !selectValue.key || typeof selectValue.query !== 'object' || !selectValue.query.className || Object.keys(selectValue).length !== 2) {
  485. throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $select');
  486. }
  487. const additionalOptions = {
  488. redirectClassNameForKey: selectValue.query.redirectClassNameForKey
  489. };
  490. if (this.restOptions.subqueryReadPreference) {
  491. additionalOptions.readPreference = this.restOptions.subqueryReadPreference;
  492. additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference;
  493. } else if (this.restOptions.readPreference) {
  494. additionalOptions.readPreference = this.restOptions.readPreference;
  495. }
  496. const subquery = await RestQuery({
  497. method: RestQuery.Method.find,
  498. config: this.config,
  499. auth: this.auth,
  500. className: selectValue.query.className,
  501. restWhere: selectValue.query.where,
  502. restOptions: additionalOptions,
  503. context: this.context
  504. });
  505. return subquery.execute().then(response => {
  506. transformSelect(selectObject, selectValue.key, response.results);
  507. // Keep replacing $select clauses
  508. return this.replaceSelect();
  509. });
  510. };
  511. const transformDontSelect = (dontSelectObject, key, objects) => {
  512. var values = [];
  513. for (var result of objects) {
  514. values.push(key.split('.').reduce(getDeepestObjectFromKey, result));
  515. }
  516. delete dontSelectObject['$dontSelect'];
  517. if (Array.isArray(dontSelectObject['$nin'])) {
  518. dontSelectObject['$nin'] = dontSelectObject['$nin'].concat(values);
  519. } else {
  520. dontSelectObject['$nin'] = values;
  521. }
  522. };
  523. // Replaces a $dontSelect clause by running the subquery, if there is a
  524. // $dontSelect clause.
  525. // The $dontSelect clause turns into an $nin with values selected out of
  526. // the subquery.
  527. // Returns a possible-promise.
  528. _UnsafeRestQuery.prototype.replaceDontSelect = async function () {
  529. var dontSelectObject = findObjectWithKey(this.restWhere, '$dontSelect');
  530. if (!dontSelectObject) {
  531. return;
  532. }
  533. // The dontSelect value must have precisely two keys - query and key
  534. var dontSelectValue = dontSelectObject['$dontSelect'];
  535. if (!dontSelectValue.query || !dontSelectValue.key || typeof dontSelectValue.query !== 'object' || !dontSelectValue.query.className || Object.keys(dontSelectValue).length !== 2) {
  536. throw new Parse.Error(Parse.Error.INVALID_QUERY, 'improper usage of $dontSelect');
  537. }
  538. const additionalOptions = {
  539. redirectClassNameForKey: dontSelectValue.query.redirectClassNameForKey
  540. };
  541. if (this.restOptions.subqueryReadPreference) {
  542. additionalOptions.readPreference = this.restOptions.subqueryReadPreference;
  543. additionalOptions.subqueryReadPreference = this.restOptions.subqueryReadPreference;
  544. } else if (this.restOptions.readPreference) {
  545. additionalOptions.readPreference = this.restOptions.readPreference;
  546. }
  547. const subquery = await RestQuery({
  548. method: RestQuery.Method.find,
  549. config: this.config,
  550. auth: this.auth,
  551. className: dontSelectValue.query.className,
  552. restWhere: dontSelectValue.query.where,
  553. restOptions: additionalOptions,
  554. context: this.context
  555. });
  556. return subquery.execute().then(response => {
  557. transformDontSelect(dontSelectObject, dontSelectValue.key, response.results);
  558. // Keep replacing $dontSelect clauses
  559. return this.replaceDontSelect();
  560. });
  561. };
  562. _UnsafeRestQuery.prototype.cleanResultAuthData = function (result) {
  563. delete result.password;
  564. if (result.authData) {
  565. Object.keys(result.authData).forEach(provider => {
  566. if (result.authData[provider] === null) {
  567. delete result.authData[provider];
  568. }
  569. });
  570. if (Object.keys(result.authData).length == 0) {
  571. delete result.authData;
  572. }
  573. }
  574. };
  575. const replaceEqualityConstraint = constraint => {
  576. if (typeof constraint !== 'object') {
  577. return constraint;
  578. }
  579. const equalToObject = {};
  580. let hasDirectConstraint = false;
  581. let hasOperatorConstraint = false;
  582. for (const key in constraint) {
  583. if (key.indexOf('$') !== 0) {
  584. hasDirectConstraint = true;
  585. equalToObject[key] = constraint[key];
  586. } else {
  587. hasOperatorConstraint = true;
  588. }
  589. }
  590. if (hasDirectConstraint && hasOperatorConstraint) {
  591. constraint['$eq'] = equalToObject;
  592. Object.keys(equalToObject).forEach(key => {
  593. delete constraint[key];
  594. });
  595. }
  596. return constraint;
  597. };
  598. _UnsafeRestQuery.prototype.replaceEquality = function () {
  599. if (typeof this.restWhere !== 'object') {
  600. return;
  601. }
  602. for (const key in this.restWhere) {
  603. this.restWhere[key] = replaceEqualityConstraint(this.restWhere[key]);
  604. }
  605. };
  606. // Returns a promise for whether it was successful.
  607. // Populates this.response with an object that only has 'results'.
  608. _UnsafeRestQuery.prototype.runFind = async function (options = {}) {
  609. if (this.findOptions.limit === 0) {
  610. this.response = {
  611. results: []
  612. };
  613. return Promise.resolve();
  614. }
  615. const findOptions = Object.assign({}, this.findOptions);
  616. if (this.keys) {
  617. findOptions.keys = this.keys.map(key => {
  618. return key.split('.')[0];
  619. });
  620. }
  621. if (options.op) {
  622. findOptions.op = options.op;
  623. }
  624. const results = await this.config.database.find(this.className, this.restWhere, findOptions, this.auth);
  625. if (this.className === '_User' && !findOptions.explain) {
  626. for (var result of results) {
  627. this.cleanResultAuthData(result);
  628. }
  629. }
  630. await this.config.filesController.expandFilesInObject(this.config, results);
  631. if (this.redirectClassName) {
  632. for (var r of results) {
  633. r.className = this.redirectClassName;
  634. }
  635. }
  636. this.response = {
  637. results: results
  638. };
  639. };
  640. // Returns a promise for whether it was successful.
  641. // Populates this.response.count with the count
  642. _UnsafeRestQuery.prototype.runCount = function () {
  643. if (!this.doCount) {
  644. return;
  645. }
  646. this.findOptions.count = true;
  647. delete this.findOptions.skip;
  648. delete this.findOptions.limit;
  649. return this.config.database.find(this.className, this.restWhere, this.findOptions).then(c => {
  650. this.response.count = c;
  651. });
  652. };
  653. _UnsafeRestQuery.prototype.denyProtectedFields = async function () {
  654. if (this.auth.isMaster) {
  655. return;
  656. }
  657. const schemaController = await this.config.database.loadSchema();
  658. const protectedFields = this.config.database.addProtectedFields(schemaController, this.className, this.restWhere, this.findOptions.acl, this.auth, this.findOptions) || [];
  659. for (const key of protectedFields) {
  660. if (this.restWhere[key]) {
  661. throw new Parse.Error(Parse.Error.OPERATION_FORBIDDEN, `This user is not allowed to query ${key} on class ${this.className}`);
  662. }
  663. }
  664. };
  665. // Augments this.response with all pointers on an object
  666. _UnsafeRestQuery.prototype.handleIncludeAll = function () {
  667. if (!this.includeAll) {
  668. return;
  669. }
  670. return this.config.database.loadSchema().then(schemaController => schemaController.getOneSchema(this.className)).then(schema => {
  671. const includeFields = [];
  672. const keyFields = [];
  673. for (const field in schema.fields) {
  674. if (schema.fields[field].type && schema.fields[field].type === 'Pointer' || schema.fields[field].type && schema.fields[field].type === 'Array') {
  675. includeFields.push([field]);
  676. keyFields.push(field);
  677. }
  678. }
  679. // Add fields to include, keys, remove dups
  680. this.include = [...new Set([...this.include, ...includeFields])];
  681. // if this.keys not set, then all keys are already included
  682. if (this.keys) {
  683. this.keys = [...new Set([...this.keys, ...keyFields])];
  684. }
  685. });
  686. };
  687. // Updates property `this.keys` to contain all keys but the ones unselected.
  688. _UnsafeRestQuery.prototype.handleExcludeKeys = function () {
  689. if (!this.excludeKeys) {
  690. return;
  691. }
  692. if (this.keys) {
  693. this.keys = this.keys.filter(k => !this.excludeKeys.includes(k));
  694. return;
  695. }
  696. return this.config.database.loadSchema().then(schemaController => schemaController.getOneSchema(this.className)).then(schema => {
  697. const fields = Object.keys(schema.fields);
  698. this.keys = fields.filter(k => !this.excludeKeys.includes(k));
  699. });
  700. };
  701. // Augments this.response with data at the paths provided in this.include.
  702. _UnsafeRestQuery.prototype.handleInclude = function () {
  703. if (this.include.length == 0) {
  704. return;
  705. }
  706. var pathResponse = includePath(this.config, this.auth, this.response, this.include[0], this.context, this.restOptions);
  707. if (pathResponse.then) {
  708. return pathResponse.then(newResponse => {
  709. this.response = newResponse;
  710. this.include = this.include.slice(1);
  711. return this.handleInclude();
  712. });
  713. } else if (this.include.length > 0) {
  714. this.include = this.include.slice(1);
  715. return this.handleInclude();
  716. }
  717. return pathResponse;
  718. };
  719. //Returns a promise of a processed set of results
  720. _UnsafeRestQuery.prototype.runAfterFindTrigger = function () {
  721. if (!this.response) {
  722. return;
  723. }
  724. if (!this.runAfterFind) {
  725. return;
  726. }
  727. // Avoid doing any setup for triggers if there is no 'afterFind' trigger for this class.
  728. const hasAfterFindHook = triggers.triggerExists(this.className, triggers.Types.afterFind, this.config.applicationId);
  729. if (!hasAfterFindHook) {
  730. return Promise.resolve();
  731. }
  732. // Skip Aggregate and Distinct Queries
  733. if (this.findOptions.pipeline || this.findOptions.distinct) {
  734. return Promise.resolve();
  735. }
  736. const json = Object.assign({}, this.restOptions);
  737. json.where = this.restWhere;
  738. const parseQuery = new Parse.Query(this.className);
  739. parseQuery.withJSON(json);
  740. // Run afterFind trigger and set the new results
  741. return triggers.maybeRunAfterFindTrigger(triggers.Types.afterFind, this.auth, this.className, this.response.results, this.config, parseQuery, this.context).then(results => {
  742. // Ensure we properly set the className back
  743. if (this.redirectClassName) {
  744. this.response.results = results.map(object => {
  745. if (object instanceof Parse.Object) {
  746. object = object.toJSON();
  747. }
  748. object.className = this.redirectClassName;
  749. return object;
  750. });
  751. } else {
  752. this.response.results = results;
  753. }
  754. });
  755. };
  756. _UnsafeRestQuery.prototype.handleAuthAdapters = async function () {
  757. if (this.className !== '_User' || this.findOptions.explain) {
  758. return;
  759. }
  760. await Promise.all(this.response.results.map(result => this.config.authDataManager.runAfterFind({
  761. config: this.config,
  762. auth: this.auth
  763. }, result.authData)));
  764. };
  765. // Adds included values to the response.
  766. // Path is a list of field names.
  767. // Returns a promise for an augmented response.
  768. function includePath(config, auth, response, path, context, restOptions = {}) {
  769. var pointers = findPointers(response.results, path);
  770. if (pointers.length == 0) {
  771. return response;
  772. }
  773. const pointersHash = {};
  774. for (var pointer of pointers) {
  775. if (!pointer) {
  776. continue;
  777. }
  778. const className = pointer.className;
  779. // only include the good pointers
  780. if (className) {
  781. pointersHash[className] = pointersHash[className] || new Set();
  782. pointersHash[className].add(pointer.objectId);
  783. }
  784. }
  785. const includeRestOptions = {};
  786. if (restOptions.keys) {
  787. const keys = new Set(restOptions.keys.split(','));
  788. const keySet = Array.from(keys).reduce((set, key) => {
  789. const keyPath = key.split('.');
  790. let i = 0;
  791. for (i; i < path.length; i++) {
  792. if (path[i] != keyPath[i]) {
  793. return set;
  794. }
  795. }
  796. if (i < keyPath.length) {
  797. set.add(keyPath[i]);
  798. }
  799. return set;
  800. }, new Set());
  801. if (keySet.size > 0) {
  802. includeRestOptions.keys = Array.from(keySet).join(',');
  803. }
  804. }
  805. if (restOptions.excludeKeys) {
  806. const excludeKeys = new Set(restOptions.excludeKeys.split(','));
  807. const excludeKeySet = Array.from(excludeKeys).reduce((set, key) => {
  808. const keyPath = key.split('.');
  809. let i = 0;
  810. for (i; i < path.length; i++) {
  811. if (path[i] != keyPath[i]) {
  812. return set;
  813. }
  814. }
  815. if (i == keyPath.length - 1) {
  816. set.add(keyPath[i]);
  817. }
  818. return set;
  819. }, new Set());
  820. if (excludeKeySet.size > 0) {
  821. includeRestOptions.excludeKeys = Array.from(excludeKeySet).join(',');
  822. }
  823. }
  824. if (restOptions.includeReadPreference) {
  825. includeRestOptions.readPreference = restOptions.includeReadPreference;
  826. includeRestOptions.includeReadPreference = restOptions.includeReadPreference;
  827. } else if (restOptions.readPreference) {
  828. includeRestOptions.readPreference = restOptions.readPreference;
  829. }
  830. const queryPromises = Object.keys(pointersHash).map(async className => {
  831. const objectIds = Array.from(pointersHash[className]);
  832. let where;
  833. if (objectIds.length === 1) {
  834. where = {
  835. objectId: objectIds[0]
  836. };
  837. } else {
  838. where = {
  839. objectId: {
  840. $in: objectIds
  841. }
  842. };
  843. }
  844. const query = await RestQuery({
  845. method: objectIds.length === 1 ? RestQuery.Method.get : RestQuery.Method.find,
  846. config,
  847. auth,
  848. className,
  849. restWhere: where,
  850. restOptions: includeRestOptions,
  851. context: context
  852. });
  853. return query.execute({
  854. op: 'get'
  855. }).then(results => {
  856. results.className = className;
  857. return Promise.resolve(results);
  858. });
  859. });
  860. // Get the objects for all these object ids
  861. return Promise.all(queryPromises).then(responses => {
  862. var replace = responses.reduce((replace, includeResponse) => {
  863. for (var obj of includeResponse.results) {
  864. obj.__type = 'Object';
  865. obj.className = includeResponse.className;
  866. if (obj.className == '_User' && !auth.isMaster) {
  867. delete obj.sessionToken;
  868. delete obj.authData;
  869. }
  870. replace[obj.objectId] = obj;
  871. }
  872. return replace;
  873. }, {});
  874. var resp = {
  875. results: replacePointers(response.results, path, replace)
  876. };
  877. if (response.count) {
  878. resp.count = response.count;
  879. }
  880. return resp;
  881. });
  882. }
  883. // Object may be a list of REST-format object to find pointers in, or
  884. // it may be a single object.
  885. // If the path yields things that aren't pointers, this throws an error.
  886. // Path is a list of fields to search into.
  887. // Returns a list of pointers in REST format.
  888. function findPointers(object, path) {
  889. if (object instanceof Array) {
  890. return object.map(x => findPointers(x, path)).flat();
  891. }
  892. if (typeof object !== 'object' || !object) {
  893. return [];
  894. }
  895. if (path.length == 0) {
  896. if (object === null || object.__type == 'Pointer') {
  897. return [object];
  898. }
  899. return [];
  900. }
  901. var subobject = object[path[0]];
  902. if (!subobject) {
  903. return [];
  904. }
  905. return findPointers(subobject, path.slice(1));
  906. }
  907. // Object may be a list of REST-format objects to replace pointers
  908. // in, or it may be a single object.
  909. // Path is a list of fields to search into.
  910. // replace is a map from object id -> object.
  911. // Returns something analogous to object, but with the appropriate
  912. // pointers inflated.
  913. function replacePointers(object, path, replace) {
  914. if (object instanceof Array) {
  915. return object.map(obj => replacePointers(obj, path, replace)).filter(obj => typeof obj !== 'undefined');
  916. }
  917. if (typeof object !== 'object' || !object) {
  918. return object;
  919. }
  920. if (path.length === 0) {
  921. if (object && object.__type === 'Pointer') {
  922. return replace[object.objectId];
  923. }
  924. return object;
  925. }
  926. var subobject = object[path[0]];
  927. if (!subobject) {
  928. return object;
  929. }
  930. var newsub = replacePointers(subobject, path.slice(1), replace);
  931. var answer = {};
  932. for (var key in object) {
  933. if (key == path[0]) {
  934. answer[key] = newsub;
  935. } else {
  936. answer[key] = object[key];
  937. }
  938. }
  939. return answer;
  940. }
  941. // Finds a subobject that has the given key, if there is one.
  942. // Returns undefined otherwise.
  943. function findObjectWithKey(root, key) {
  944. if (typeof root !== 'object') {
  945. return;
  946. }
  947. if (root instanceof Array) {
  948. for (var item of root) {
  949. const answer = findObjectWithKey(item, key);
  950. if (answer) {
  951. return answer;
  952. }
  953. }
  954. }
  955. if (root && root[key]) {
  956. return root;
  957. }
  958. for (var subkey in root) {
  959. const answer = findObjectWithKey(root[subkey], key);
  960. if (answer) {
  961. return answer;
  962. }
  963. }
  964. }
  965. module.exports = RestQuery;
  966. // For tests
  967. module.exports._UnsafeRestQuery = _UnsafeRestQuery;
  968. //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJTY2hlbWFDb250cm9sbGVyIiwicmVxdWlyZSIsIlBhcnNlIiwidHJpZ2dlcnMiLCJjb250aW51ZVdoaWxlIiwiQWx3YXlzU2VsZWN0ZWRLZXlzIiwiZW5mb3JjZVJvbGVTZWN1cml0eSIsIlJlc3RRdWVyeSIsIm1ldGhvZCIsImNvbmZpZyIsImF1dGgiLCJjbGFzc05hbWUiLCJyZXN0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