Skip to content

Commit 38983e8

Browse files
authored
feat: Deprecation DEPPS9: LiveQuery fields option is renamed to keys (#8852)
BREAKING CHANGE: LiveQuery `fields` option is renamed to `keys`
1 parent 359b66f commit 38983e8

File tree

4 files changed

+4
-83
lines changed

4 files changed

+4
-83
lines changed

Diff for: DEPRECATIONS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The following is a list of deprecations, according to the [Deprecation Policy](h
1212
| DEPPS6 | Auth providers disabled by default | [#7953](https://github.com/parse-community/parse-server/pull/7953) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
1313
| DEPPS7 | Remove file trigger syntax `Parse.Cloud.beforeSaveFile((request) => {})` | [#7966](https://github.com/parse-community/parse-server/pull/7966) | 5.3.0 (2022) | 7.0.0 (2024) | removed | - |
1414
| DEPPS8 | Login with expired 3rd party authentication token defaults to `false` | [#7079](https://github.com/parse-community/parse-server/pull/7079) | 5.3.0 (2022) | 7.0.0 (2024) | deprecated | - |
15-
| DEPPS9 | Rename LiveQuery `fields` option to `keys` | [#8389](https://github.com/parse-community/parse-server/issues/8389) | 6.0.0 (2023) | 7.0.0 (2024) | deprecated | - |
15+
| DEPPS9 | Rename LiveQuery `fields` option to `keys` | [#8389](https://github.com/parse-community/parse-server/issues/8389) | 6.0.0 (2023) | 7.0.0 (2024) | removed | - |
1616
| DEPPS10 | Config option `encodeParseObjectInCloudFunction` defaults to `true` | [#8634](https://github.com/parse-community/parse-server/issues/8634) | 6.2.0 (2023) | 8.0.0 (2025) | deprecated | - |
1717

1818
[i_deprecation]: ## "The version and date of the deprecation."

Diff for: spec/ParseLiveQueryServer.spec.js

+3-58
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ describe('ParseLiveQueryServer', function () {
356356
// Make sure we add subscriptionInfo to the client
357357
const args = client.addSubscriptionInfo.calls.first().args;
358358
expect(args[0]).toBe(requestId);
359-
expect(args[1].fields).toBe(query.fields);
359+
expect(args[1].keys).toBe(query.keys);
360360
expect(args[1].sessionToken).toBe(request.sessionToken);
361361
// Make sure we send subscribe response to the client
362362
expect(client.pushSubscribe).toHaveBeenCalledWith(requestId);
@@ -417,7 +417,7 @@ describe('ParseLiveQueryServer', function () {
417417
// Make sure we add subscriptionInfo to the client 2
418418
args = clientAgain.addSubscriptionInfo.calls.mostRecent().args;
419419
expect(args[0]).toBe(requestIdAgain);
420-
expect(args[1].fields).toBe(queryAgain.fields);
420+
expect(args[1].keys).toBe(queryAgain.keys);
421421
});
422422

423423
it('can handle unsubscribe command without clientId', function () {
@@ -1081,7 +1081,7 @@ describe('ParseLiveQueryServer', function () {
10811081
done();
10821082
});
10831083

1084-
it('can handle create command with fields', async done => {
1084+
it('can handle create command with keys', async done => {
10851085
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
10861086
const Client = require('../lib/LiveQuery/Client').Client;
10871087
const parseLiveQueryServer = new ParseLiveQueryServer({});
@@ -1131,61 +1131,6 @@ describe('ParseLiveQueryServer', function () {
11311131
done();
11321132
});
11331133

1134-
it('can deprecate fields', async () => {
1135-
const Deprecator = require('../lib/Deprecator/Deprecator');
1136-
const spy = spyOn(Deprecator, 'logRuntimeDeprecation').and.callFake(() => {});
1137-
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
1138-
const Client = require('../lib/LiveQuery/Client').Client;
1139-
const parseLiveQueryServer = new ParseLiveQueryServer({});
1140-
// Make mock request message
1141-
const message = generateMockMessage();
1142-
1143-
const clientId = 1;
1144-
const parseWebSocket = {
1145-
clientId,
1146-
send: jasmine.createSpy('send'),
1147-
};
1148-
const client = new Client(clientId, parseWebSocket);
1149-
spyOn(client, 'pushCreate').and.callThrough();
1150-
parseLiveQueryServer.clients.set(clientId, client);
1151-
1152-
// Add mock subscription
1153-
const requestId = 2;
1154-
const query = {
1155-
className: testClassName,
1156-
where: {
1157-
key: 'value',
1158-
},
1159-
fields: ['test'],
1160-
};
1161-
await addMockSubscription(parseLiveQueryServer, clientId, requestId, parseWebSocket, query);
1162-
// Mock _matchesSubscription to return matching
1163-
parseLiveQueryServer._matchesSubscription = function (parseObject) {
1164-
if (!parseObject) {
1165-
return false;
1166-
}
1167-
return true;
1168-
};
1169-
parseLiveQueryServer._matchesACL = function () {
1170-
return Promise.resolve(true);
1171-
};
1172-
1173-
parseLiveQueryServer._onAfterSave(message);
1174-
1175-
// Make sure we send create command to client
1176-
await timeout();
1177-
1178-
expect(client.pushCreate).toHaveBeenCalled();
1179-
const args = parseWebSocket.send.calls.mostRecent().args;
1180-
const toSend = JSON.parse(args[0]);
1181-
expect(toSend.object).toBeDefined();
1182-
expect(toSend.original).toBeUndefined();
1183-
expect(spy).toHaveBeenCalledWith({
1184-
usage: 'Subscribing using fields parameter',
1185-
solution: `Subscribe using "keys" instead.`,
1186-
});
1187-
});
1188-
11891134
it('can handle create command with watch', async () => {
11901135
jasmine.restoreLibrary('../lib/LiveQuery/Client', 'Client');
11911136
const Client = require('../lib/LiveQuery/Client').Client;

Diff for: src/LiveQuery/ParseLiveQueryServer.js

-8
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { LRUCache as LRU } from 'lru-cache';
2323
import UserRouter from '../Routers/UsersRouter';
2424
import DatabaseController from '../Controllers/DatabaseController';
2525
import { isDeepStrictEqual } from 'util';
26-
import Deprecator from '../Deprecator/Deprecator';
2726
import deepcopy from 'deepcopy';
2827

2928
class ParseLiveQueryServer {
@@ -920,13 +919,6 @@ class ParseLiveQueryServer {
920919
? request.query.keys
921920
: request.query.keys.split(',');
922921
}
923-
if (request.query.fields) {
924-
subscriptionInfo.keys = request.query.fields;
925-
Deprecator.logRuntimeDeprecation({
926-
usage: `Subscribing using fields parameter`,
927-
solution: `Subscribe using "keys" instead.`,
928-
});
929-
}
930922
if (request.query.watch) {
931923
subscriptionInfo.watch = request.query.watch;
932924
}

Diff for: src/LiveQuery/RequestSchema.js

-16
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ const subscribe = {
6262
where: {
6363
type: 'object',
6464
},
65-
fields: {
66-
type: 'array',
67-
items: {
68-
type: 'string',
69-
},
70-
minItems: 1,
71-
uniqueItems: true,
72-
},
7365
keys: {
7466
type: 'array',
7567
items: {
@@ -116,14 +108,6 @@ const update = {
116108
where: {
117109
type: 'object',
118110
},
119-
fields: {
120-
type: 'array',
121-
items: {
122-
type: 'string',
123-
},
124-
minItems: 1,
125-
uniqueItems: true,
126-
},
127111
keys: {
128112
type: 'array',
129113
items: {

0 commit comments

Comments
 (0)