Skip to content

Commit 51071a7

Browse files
committed
refactor: type LiveQuery query results
1 parent 2fdae43 commit 51071a7

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/LiveQuery/Client.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import logger from '../logger';
22

33
import type { FlattenedObjectData } from './Subscription';
4-
export type Message = { [attr: string]: any };
4+
export type Message = {
5+
[attr: string]: any,
6+
results?: Array<FlattenedObjectData>,
7+
};
58

69
const dafaultFields = ['className', 'objectId', 'updatedAt', 'createdAt', 'ACL'];
710

@@ -139,9 +142,9 @@ class Client {
139142

140143
if (Array.isArray(results)) {
141144
const keys = this.subscriptionInfos.get(subscriptionId)?.keys;
142-
response['results'] = results.map(obj => this._toJSONWithFields(obj, keys));
145+
response.results = results.map(obj => this._toJSONWithFields(obj, keys));
143146
} else {
144-
response['results'] = [];
147+
response.results = [];
145148
}
146149

147150
Client.pushResponse(this.parseWebSocket, JSON.stringify(response));

0 commit comments

Comments
 (0)