Skip to content

Commit e91134b

Browse files
committed
fix
1 parent dc1ae2b commit e91134b

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

src/LiveQuery/ParseLiveQueryServer.ts

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
import tv4 from 'tv4';
21
import Parse from 'parse/node';
3-
import { Subscription } from './Subscription';
2+
import tv4 from 'tv4';
43
import { Client } from './Client';
54
import { ParseWebSocketServer } from './ParseWebSocketServer';
5+
import { Subscription } from './Subscription';
66
// @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';
128
import _ from 'lodash';
9+
import { LRUCache as LRU } from 'lru-cache';
10+
import { isDeepStrictEqual } from 'util';
1311
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';
1419
import {
15-
runLiveQueryEventHandlers,
1620
getTrigger,
17-
runTrigger,
1821
resolveError,
22+
runLiveQueryEventHandlers,
23+
runTrigger,
1924
toJSONwithObjects,
2025
} 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';
3029

3130
class ParseLiveQueryServer {
3231
server: any;
@@ -394,12 +393,16 @@ class ParseLiveQueryServer {
394393
if (!res.sendEvent) {
395394
return;
396395
}
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+
}
399400
currentParseObject = await this._applyInclude(client, requestId, currentParseObject);
400401
}
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+
}
403406
originalParseObject = await this._applyInclude(client, requestId, originalParseObject);
404407
}
405408
await this._filterSensitiveData(
@@ -691,7 +694,7 @@ class ParseLiveQueryServer {
691694
? subscriptionInfo.keys.join(',')
692695
: subscriptionInfo.keys;
693696
}
694-
return includeObject(this.config, object, include, {}, restOptions, masterAuth(this.config));
697+
return this.includeObject(this.config, object, include, {}, restOptions, masterAuth(this.config));
695698
}
696699

697700
_getCLPOperation(query: any) {

0 commit comments

Comments
 (0)