Skip to content

Commit 70f63f7

Browse files
committed
Merge remote-tracking branch 'upstream/alpha' into alpha
2 parents a94c744 + c764203 commit 70f63f7

File tree

12 files changed

+300
-270
lines changed

12 files changed

+300
-270
lines changed

changelogs/CHANGELOG_alpha.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [7.1.0-alpha.15](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.14...7.1.0-alpha.15) (2024-07-08)
2+
3+
4+
### Features
5+
6+
* Upgrade to @parse/push-adapter 6.4.0 ([#9182](https://github.com/parse-community/parse-server/issues/9182)) ([ef1634b](https://github.com/parse-community/parse-server/commit/ef1634bf1f360429108d29b08032fc7961ff96a1))
7+
8+
# [7.1.0-alpha.14](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.13...7.1.0-alpha.14) (2024-07-07)
9+
10+
11+
### Features
12+
13+
* Upgrade to Parse JS SDK 5.3.0 ([#9180](https://github.com/parse-community/parse-server/issues/9180)) ([dca187f](https://github.com/parse-community/parse-server/commit/dca187f91b93cbb362b22a3fb9ee38451799ff13))
14+
115
# [7.1.0-alpha.13](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.12...7.1.0-alpha.13) (2024-07-01)
216

317

package-lock.json

Lines changed: 195 additions & 232 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "7.1.0-alpha.13",
3+
"version": "7.1.0-alpha.15",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {
@@ -25,7 +25,7 @@
2525
"@graphql-tools/schema": "10.0.3",
2626
"@graphql-tools/utils": "8.12.0",
2727
"@parse/fs-files-adapter": "3.0.0",
28-
"@parse/push-adapter": "6.2.0",
28+
"@parse/push-adapter": "6.4.0",
2929
"bcryptjs": "2.4.3",
3030
"body-parser": "1.20.2",
3131
"commander": "12.0.0",
@@ -49,7 +49,7 @@
4949
"mongodb": "5.9.0",
5050
"mustache": "4.2.0",
5151
"otpauth": "9.2.2",
52-
"parse": "5.2.0",
52+
"parse": "5.3.0",
5353
"path-to-regexp": "6.2.1",
5454
"pg-monitor": "2.0.0",
5555
"pg-promise": "11.7.8",

spec/AdapterLoader.spec.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
const loadAdapter = require('../lib/Adapters/AdapterLoader').loadAdapter;
1+
const { loadAdapter, loadModule } = require('../lib/Adapters/AdapterLoader');
22
const FilesAdapter = require('@parse/fs-files-adapter').default;
3-
const ParsePushAdapter = require('@parse/push-adapter').default;
43
const MockFilesAdapter = require('mock-files-adapter');
54
const Config = require('../lib/Config');
65

@@ -103,19 +102,19 @@ describe('AdapterLoader', () => {
103102
done();
104103
});
105104

106-
it('should load push adapter from options', done => {
105+
it('should load push adapter from options', async () => {
107106
const options = {
108107
android: {
109108
senderId: 'yolo',
110109
apiKey: 'yolo',
111110
},
112111
};
112+
const ParsePushAdapter = await loadModule('@parse/push-adapter');
113113
expect(() => {
114114
const adapter = loadAdapter(undefined, ParsePushAdapter, options);
115115
expect(adapter.constructor).toBe(ParsePushAdapter);
116116
expect(adapter).not.toBe(undefined);
117117
}).not.toThrow();
118-
done();
119118
});
120119

121120
it('should load custom push adapter from string (#3544)', done => {

spec/CloudCode.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,6 +1362,7 @@ describe('Cloud Code', () => {
13621362
});
13631363

13641364
it('should not encode Parse Objects', async () => {
1365+
await reconfigureServer({ encodeParseObjectInCloudFunction: false });
13651366
const user = new Parse.User();
13661367
user.setUsername('username');
13671368
user.setPassword('password');

spec/ParseAPI.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,7 @@ describe('miscellaneous', function () {
12681268
});
12691269

12701270
it('test cloud function query parameters with array of pointers', async () => {
1271+
await reconfigureServer({ encodeParseObjectInCloudFunction: false });
12711272
Parse.Cloud.define('echoParams', req => {
12721273
return req.params;
12731274
});

spec/ParseObject.spec.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,4 +2055,42 @@ describe('Parse.Object testing', () => {
20552055
const object = new Parse.Object('CloudCodeIsNew');
20562056
await object.save();
20572057
});
2058+
2059+
it('returns correct field values', async () => {
2060+
const values = [
2061+
{ field: 'string', value: 'string' },
2062+
{ field: 'number', value: 1 },
2063+
{ field: 'boolean', value: true },
2064+
{ field: 'array', value: [0, 1, 2] },
2065+
{ field: 'array', value: [1, 2, 3] },
2066+
{ field: 'array', value: [{ '0': 'a' }, 2, 3] },
2067+
{ field: 'object', value: { key: 'value' } },
2068+
{ field: 'object', value: { key1: 'value1', key2: 'value2' } },
2069+
{ field: 'object', value: { key1: 1, key2: 2 } },
2070+
{ field: 'object', value: { '1x1': 1 } },
2071+
{ field: 'object', value: { '1x1': 1, '2': 2 } },
2072+
{ field: 'object', value: { '0': 0 } },
2073+
{ field: 'object', value: { '1': 1 } },
2074+
{ field: 'object', value: { '0': { '0': 'a', '1': 'b' } } },
2075+
{ field: 'date', value: new Date() },
2076+
{
2077+
field: 'file',
2078+
value: Parse.File.fromJSON({
2079+
__type: 'File',
2080+
name: 'name',
2081+
url: 'http://localhost:8378/1/files/test/name',
2082+
}),
2083+
},
2084+
{ field: 'geoPoint', value: new Parse.GeoPoint(40, -30) },
2085+
{ field: 'bytes', value: { __type: 'Bytes', base64: 'ZnJveW8=' } },
2086+
];
2087+
for (const value of values) {
2088+
const object = new TestObject();
2089+
object.set(value.field, value.value);
2090+
await object.save();
2091+
const query = new Parse.Query(TestObject);
2092+
const objectAgain = await query.get(object.id);
2093+
expect(objectAgain.get(value.field)).toEqual(value.value);
2094+
}
2095+
});
20582096
});

spec/helper.js

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ const defaultConfiguration = {
113113
directAccess: true,
114114
silent,
115115
logLevel,
116+
liveQuery: {
117+
classNames: ['TestObject'],
118+
},
119+
startLiveQueryServer: true,
116120
fileUpload: {
117121
enableForPublic: true,
118122
enableForAnonymousUser: true,
@@ -134,6 +138,7 @@ const defaultConfiguration = {
134138
shortLivedAuth: mockShortLivedAuth(),
135139
},
136140
allowClientClassCreation: true,
141+
encodeParseObjectInCloudFunction: true,
137142
};
138143

139144
if (silent) {
@@ -162,15 +167,15 @@ const destroyAliveConnections = function () {
162167
}
163168
};
164169
// Set up a default API server for testing with default configuration.
165-
let server;
166-
170+
let parseServer;
167171
let didChangeConfiguration = false;
168172

169173
// Allows testing specific configurations of Parse Server
170174
const reconfigureServer = async (changedConfiguration = {}) => {
171-
if (server) {
172-
await new Promise(resolve => server.close(resolve));
173-
server = undefined;
175+
if (parseServer) {
176+
destroyAliveConnections();
177+
await new Promise(resolve => parseServer.server.close(resolve));
178+
parseServer = undefined;
174179
return reconfigureServer(changedConfiguration);
175180
}
176181
didChangeConfiguration = Object.keys(changedConfiguration).length !== 0;
@@ -179,14 +184,20 @@ const reconfigureServer = async (changedConfiguration = {}) => {
179184
port,
180185
});
181186
cache.clear();
182-
const parseServer = await ParseServer.startApp(newConfiguration);
183-
server = parseServer.server;
187+
parseServer = await ParseServer.startApp(newConfiguration);
184188
Parse.CoreManager.setRESTController(RESTController);
185189
parseServer.expressApp.use('/1', err => {
186190
console.error(err);
187191
fail('should not call next');
188192
});
189-
server.on('connection', connection => {
193+
parseServer.liveQueryServer?.server?.on('connection', connection => {
194+
const key = `${connection.remoteAddress}:${connection.remotePort}`;
195+
openConnections[key] = connection;
196+
connection.on('close', () => {
197+
delete openConnections[key];
198+
});
199+
});
200+
parseServer.server.on('connection', connection => {
190201
const key = `${connection.remoteAddress}:${connection.remotePort}`;
191202
openConnections[key] = connection;
192203
connection.on('close', () => {
@@ -214,16 +225,12 @@ beforeAll(async () => {
214225
Parse.serverURL = 'http://localhost:' + port + '/1';
215226
});
216227

217-
beforeEach(() => {
218-
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 10000;
219-
});
220-
221228
afterEach(function (done) {
222229
const afterLogOut = async () => {
223-
if (Object.keys(openConnections).length > 0) {
224-
console.warn('There were open connections to the server left after the test finished');
230+
// Jasmine process uses one connection
231+
if (Object.keys(openConnections).length > 1) {
232+
console.warn(`There were ${Object.keys(openConnections).length} open connections to the server left after the test finished`);
225233
}
226-
destroyAliveConnections();
227234
await TestUtils.destroyAllDataPermanently(true);
228235
SchemaCache.clear();
229236
if (didChangeConfiguration) {

spec/support/jasmine.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"spec_dir": "spec",
33
"spec_files": ["*spec.js"],
44
"helpers": ["helper.js"],
5-
"random": true
5+
"random": false
66
}

src/Adapters/AdapterLoader.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,21 @@ export function loadAdapter<T>(adapter, defaultAdapter, options): T {
4646
return adapter;
4747
}
4848

49+
export async function loadModule(modulePath) {
50+
let module;
51+
try {
52+
module = require(modulePath);
53+
} catch (err) {
54+
if (err.code === 'ERR_REQUIRE_ESM') {
55+
module = await import(modulePath);
56+
if (module.default) {
57+
module = module.default;
58+
}
59+
} else {
60+
throw err;
61+
}
62+
}
63+
return module;
64+
}
65+
4966
export default loadAdapter;

0 commit comments

Comments
 (0)