|  | 
| 1 |  | -import tv4 from 'tv4'; | 
| 2 | 1 | import Parse from 'parse/node'; | 
| 3 |  | -import { Subscription } from './Subscription'; | 
|  | 2 | +import tv4 from 'tv4'; | 
| 4 | 3 | import { Client } from './Client'; | 
| 5 | 4 | import { ParseWebSocketServer } from './ParseWebSocketServer'; | 
|  | 5 | +import { Subscription } from './Subscription'; | 
| 6 | 6 | // @ts-ignore | 
| 7 |  | -import logger from '../logger'; | 
| 8 |  | -import RequestSchema from './RequestSchema'; | 
| 9 |  | -import { matchesQuery, queryHash } from './QueryTools'; | 
| 10 |  | -import { ParsePubSub } from './ParsePubSub'; | 
| 11 |  | -import SchemaController from '../Controllers/SchemaController'; | 
|  | 7 | +import deepcopy from 'deepcopy'; | 
| 12 | 8 | import _ from 'lodash'; | 
|  | 9 | +import { LRUCache as LRU } from 'lru-cache'; | 
|  | 10 | +import { isDeepStrictEqual } from 'util'; | 
| 13 | 11 | import { v4 as uuidv4 } from 'uuid'; | 
|  | 12 | +import { Auth, getAuthForSessionToken, master as masterAuth } from '../Auth'; | 
|  | 13 | +import { getCacheController, getDatabaseController } from '../Controllers'; | 
|  | 14 | +import DatabaseController from '../Controllers/DatabaseController'; | 
|  | 15 | +import SchemaController from '../Controllers/SchemaController'; | 
|  | 16 | +import logger from '../logger'; | 
|  | 17 | +import RestQuery from '../RestQuery'; | 
|  | 18 | +import UserRouter from '../Routers/UsersRouter'; | 
| 14 | 19 | import { | 
| 15 |  | -  runLiveQueryEventHandlers, | 
| 16 | 20 |   getTrigger, | 
| 17 |  | -  runTrigger, | 
| 18 | 21 |   resolveError, | 
|  | 22 | +  runLiveQueryEventHandlers, | 
|  | 23 | +  runTrigger, | 
| 19 | 24 |   toJSONwithObjects, | 
| 20 | 25 | } from '../triggers'; | 
| 21 |  | -import { getAuthForSessionToken, Auth } from '../Auth'; | 
| 22 |  | -import { getCacheController, getDatabaseController } from '../Controllers'; | 
| 23 |  | -import { LRUCache as LRU } from 'lru-cache'; | 
| 24 |  | -import UserRouter from '../Routers/UsersRouter'; | 
| 25 |  | -import DatabaseController from '../Controllers/DatabaseController'; | 
| 26 |  | -import { isDeepStrictEqual } from 'util'; | 
| 27 |  | -import deepcopy from 'deepcopy'; | 
| 28 |  | -import RestQuery from '../RestQuery'; | 
| 29 |  | -import { master as masterAuth } from '../Auth'; | 
|  | 26 | +import { ParsePubSub } from './ParsePubSub'; | 
|  | 27 | +import { matchesQuery, queryHash } from './QueryTools'; | 
|  | 28 | +import RequestSchema from './RequestSchema'; | 
| 30 | 29 | 
 | 
| 31 | 30 | class ParseLiveQueryServer { | 
| 32 | 31 |   server: any; | 
| @@ -394,12 +393,16 @@ class ParseLiveQueryServer { | 
| 394 | 393 |             if (!res.sendEvent) { | 
| 395 | 394 |               return; | 
| 396 | 395 |             } | 
| 397 |  | -            if (res.object && typeof res.object.toJSON === 'function') { | 
| 398 |  | -              currentParseObject = toJSONwithObjects(res.object, res.object.className || className); | 
|  | 396 | +            if (res.object) { | 
|  | 397 | +              if (typeof res.object.toJSON === 'function') { | 
|  | 398 | +                currentParseObject = toJSONwithObjects(res.object, res.object.className || className); | 
|  | 399 | +              } | 
| 399 | 400 |               currentParseObject = await this._applyInclude(client, requestId, currentParseObject); | 
| 400 | 401 |             } | 
| 401 |  | -            if (res.original && typeof res.original.toJSON === 'function') { | 
| 402 |  | -              originalParseObject = toJSONwithObjects(res.original, res.original.className || className); | 
|  | 402 | +            if (res.original) { | 
|  | 403 | +              if (typeof res.original.toJSON === 'function') { | 
|  | 404 | +                originalParseObject = toJSONwithObjects(res.original, res.original.className || className); | 
|  | 405 | +              } | 
| 403 | 406 |               originalParseObject = await this._applyInclude(client, requestId, originalParseObject); | 
| 404 | 407 |             } | 
| 405 | 408 |             await this._filterSensitiveData( | 
| @@ -691,7 +694,7 @@ class ParseLiveQueryServer { | 
| 691 | 694 |         ? subscriptionInfo.keys.join(',') | 
| 692 | 695 |         : subscriptionInfo.keys; | 
| 693 | 696 |     } | 
| 694 |  | -    return includeObject(this.config, object, include, {}, restOptions, masterAuth(this.config)); | 
|  | 697 | +    return this.includeObject(this.config, object, include, {}, restOptions, masterAuth(this.config)); | 
| 695 | 698 |   } | 
| 696 | 699 | 
 | 
| 697 | 700 |   _getCLPOperation(query: any) { | 
|  | 
0 commit comments