Skip to content

Commit 837067c

Browse files
authored
Merge branch 'alpha' into session_logout
2 parents e08347c + 2b9e0be commit 837067c

21 files changed

+3225
-2105
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"jsdoc/require-param-description": 0,
4343
"jsdoc/require-property-description": 0,
4444
"jsdoc/require-param-type": 0,
45+
"jsdoc/tag-lines": 0,
4546
"jsdoc/check-param-names": [
4647
"error",
4748
{

.github/workflows/release-automated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
docs-publish:
4040
needs: release
4141
if: needs.release.outputs.current_tag != '' && github.ref == 'refs/heads/release'
42-
runs-on: ubuntu-18.04
42+
runs-on: ubuntu-latest
4343
timeout-minutes: 15
4444
steps:
4545
- uses: actions/checkout@v2

.github/workflows/release-manual-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
jobs:
99
docs-publish:
1010
if: github.event.inputs.tag != ''
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-latest
1212
timeout-minutes: 15
1313
steps:
1414
- uses: actions/checkout@v3

changelogs/CHANGELOG_alpha.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
# [4.2.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.3...4.2.0-alpha.4) (2023-07-23)
2+
3+
4+
### Features
5+
6+
* Login with username, password and additional authentication data via `ParseUser.logInWithAdditionalAuth` ([#1955](https://github.com/parse-community/Parse-SDK-JS/issues/1955)) ([2bad411](https://github.com/parse-community/Parse-SDK-JS/commit/2bad4119c23372d1b38c811c4b4bb3d06b1b62f0))
7+
8+
# [4.2.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.2...4.2.0-alpha.3) (2023-06-11)
9+
10+
11+
### Features
12+
13+
* Add support to invoke a Cloud Function with a custom `installationId` via `Parse.Cloud.run` ([#1939](https://github.com/parse-community/Parse-SDK-JS/issues/1939)) ([eb70b93](https://github.com/parse-community/Parse-SDK-JS/commit/eb70b934b798cb37722c1ac36796596f5373f67d))
14+
15+
# [4.2.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/4.2.0-alpha.1...4.2.0-alpha.2) (2023-06-08)
16+
17+
18+
### Bug Fixes
19+
20+
* Hard-coding of `react-native` path does not work for workspace builds ([#1930](https://github.com/parse-community/Parse-SDK-JS/issues/1930)) ([8222f3c](https://github.com/parse-community/Parse-SDK-JS/commit/8222f3cc2a4a4ee0cdcaf30dd0f9a17e46de7d88))
21+
22+
# [4.2.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0...4.2.0-alpha.1) (2023-05-01)
23+
24+
25+
### Bug Fixes
26+
27+
* `Parse.File.cancel` starts new attempt to save file ([#1781](https://github.com/parse-community/Parse-SDK-JS/issues/1781)) ([b755e42](https://github.com/parse-community/Parse-SDK-JS/commit/b755e42394db8b94b87b0dbefc6cf6f18189c46d))
28+
29+
### Features
30+
31+
* Add `Parse.User.loginAs` ([#1875](https://github.com/parse-community/Parse-SDK-JS/issues/1875)) ([381fcfc](https://github.com/parse-community/Parse-SDK-JS/commit/381fcfc7f9cfda70af7c6dc3a35de59b82b72258))
32+
* Add `ParseQuery.watch` to trigger LiveQuery only on update of specific fields ([#1839](https://github.com/parse-community/Parse-SDK-JS/issues/1839)) ([7479343](https://github.com/parse-community/Parse-SDK-JS/commit/7479343abd8739fe03558ff9b2ce610c34c568ae))
33+
34+
# [4.1.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0-alpha.3...4.1.0-alpha.4) (2023-04-28)
35+
36+
37+
### Features
38+
39+
* Add `Parse.User.loginAs` ([#1875](https://github.com/parse-community/Parse-SDK-JS/issues/1875)) ([381fcfc](https://github.com/parse-community/Parse-SDK-JS/commit/381fcfc7f9cfda70af7c6dc3a35de59b82b72258))
40+
41+
# [4.1.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0-alpha.2...4.1.0-alpha.3) (2023-04-02)
42+
43+
44+
### Features
45+
46+
* Add `ParseQuery.watch` to trigger LiveQuery only on update of specific fields ([#1839](https://github.com/parse-community/Parse-SDK-JS/issues/1839)) ([7479343](https://github.com/parse-community/Parse-SDK-JS/commit/7479343abd8739fe03558ff9b2ce610c34c568ae))
47+
148
# [4.1.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0-alpha.1...4.1.0-alpha.2) (2023-03-01)
249

350

changelogs/CHANGELOG_beta.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# [4.2.0-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.1.0...4.2.0-beta.1) (2023-05-01)
2+
3+
4+
### Bug Fixes
5+
6+
* `Parse.File.cancel` starts new attempt to save file ([#1781](https://github.com/parse-community/Parse-SDK-JS/issues/1781)) ([b755e42](https://github.com/parse-community/Parse-SDK-JS/commit/b755e42394db8b94b87b0dbefc6cf6f18189c46d))
7+
8+
### Features
9+
10+
* Add `Parse.User.loginAs` ([#1875](https://github.com/parse-community/Parse-SDK-JS/issues/1875)) ([381fcfc](https://github.com/parse-community/Parse-SDK-JS/commit/381fcfc7f9cfda70af7c6dc3a35de59b82b72258))
11+
* Add `ParseQuery.watch` to trigger LiveQuery only on update of specific fields ([#1839](https://github.com/parse-community/Parse-SDK-JS/issues/1839)) ([7479343](https://github.com/parse-community/Parse-SDK-JS/commit/7479343abd8739fe03558ff9b2ce610c34c568ae))
12+
113
# [4.1.0-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.1...4.1.0-beta.1) (2023-03-01)
214

315

changelogs/CHANGELOG_release.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# [4.1.0](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.1...4.1.0) (2023-05-01)
2+
3+
4+
### Bug Fixes
5+
6+
* `LiveQuerySubscription.unsubscribe` resolves promise before unsubscribing completes ([#1727](https://github.com/parse-community/Parse-SDK-JS/issues/1727)) ([1c96205](https://github.com/parse-community/Parse-SDK-JS/commit/1c96205cb3c162b21bf4508f7783400a28a99868))
7+
* Node engine version upper range is <19 despite Node 19 support ([#1732](https://github.com/parse-community/Parse-SDK-JS/issues/1732)) ([febe187](https://github.com/parse-community/Parse-SDK-JS/commit/febe187a24fb56e83542c00ae39148575fc57c4b))
8+
* Saving a new `Parse.Object` with an unsaved `Parse.File` fails ([#1662](https://github.com/parse-community/Parse-SDK-JS/issues/1662)) ([16535a4](https://github.com/parse-community/Parse-SDK-JS/commit/16535a43f6c762983460aa837102a4c692de70bb))
9+
10+
### Features
11+
12+
* `LiveQueryClient.close` returns promise when WebSocket closes ([#1735](https://github.com/parse-community/Parse-SDK-JS/issues/1735)) ([979d660](https://github.com/parse-community/Parse-SDK-JS/commit/979d6607d5449dd3d3c5e51f36119bd05b25feaa))
13+
* Upgrade Node Package Manager lock file `package-lock.json` to version 2 ([#1729](https://github.com/parse-community/Parse-SDK-JS/issues/1729)) ([e993786](https://github.com/parse-community/Parse-SDK-JS/commit/e993786cf0299b1150bf36afee1bc516e23e349a))
14+
115
## [4.0.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.0...4.0.1) (2023-01-31)
216

317

integration/test/ParseLiveQueryTest.js

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('Parse LiveQuery', () => {
7676
query.equalTo('objectId', object.id);
7777
const subscription = await client.subscribe(query);
7878
const promise = resolvingPromise();
79-
subscription.on('update', async (object) => {
79+
subscription.on('update', async object => {
8080
assert.equal(object.get('foo'), 'bar');
8181
await client.close();
8282
promise.resolve();
@@ -206,7 +206,7 @@ describe('Parse LiveQuery', () => {
206206
subscription.on('update', async object => {
207207
assert.equal(object.get('foo'), 'bar');
208208
await Parse.User.logOut();
209-
promise.resolve()
209+
promise.resolve();
210210
});
211211
await object.save({ foo: 'bar' });
212212
await promise;
@@ -276,6 +276,44 @@ describe('Parse LiveQuery', () => {
276276
await promise;
277277
});
278278

279+
it('can subscribe to query with watch', async () => {
280+
const query = new Parse.Query(TestObject);
281+
query.watch('yolo');
282+
const subscription = await query.subscribe();
283+
const spy = {
284+
create(obj) {
285+
if (!obj.get('yolo')) {
286+
fail('create should not have been called');
287+
}
288+
},
289+
update(object, original) {
290+
if (object.get('yolo') === original.get('yolo')) {
291+
fail('create should not have been called');
292+
}
293+
},
294+
};
295+
const createSpy = spyOn(spy, 'create').and.callThrough();
296+
const updateSpy = spyOn(spy, 'update').and.callThrough();
297+
subscription.on('create', spy.create);
298+
subscription.on('update', spy.update);
299+
const obj = new TestObject();
300+
obj.set('foo', 'bar');
301+
await obj.save();
302+
obj.set('foo', 'xyz');
303+
obj.set('yolo', 'xyz');
304+
await obj.save();
305+
const obj2 = new TestObject();
306+
obj2.set('foo', 'bar');
307+
obj2.set('yolo', 'bar');
308+
await obj2.save();
309+
obj2.set('foo', 'bart');
310+
await obj2.save();
311+
await sleep(1000);
312+
await subscription.unsubscribe();
313+
expect(createSpy).toHaveBeenCalledTimes(1);
314+
expect(updateSpy).toHaveBeenCalledTimes(1);
315+
});
316+
279317
it('live query can handle beforeConnect and beforeSubscribe errors', async () => {
280318
await reconfigureServer({
281319
cloud({ Cloud }) {

integration/test/ParseUserTest.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,27 @@ describe('Parse User', () => {
148148
expect(sessions[1].get('sessionToken')).toBe(installationUser.getSessionToken());
149149
});
150150

151+
it('can login with userId', async () => {
152+
Parse.User.enableUnsafeCurrentUser();
153+
154+
const user = await Parse.User.signUp('parsetest', 'parse', { code: 'red' });
155+
assert.equal(Parse.User.current(), user);
156+
await Parse.User.logOut();
157+
assert(!Parse.User.current());
158+
159+
const newUser = await Parse.User.loginAs(user.id);
160+
assert.equal(Parse.User.current(), newUser);
161+
assert(newUser);
162+
assert.equal(user.id, newUser.id);
163+
assert.equal(user.get('code'), 'red');
164+
165+
await Parse.User.logOut();
166+
assert(!Parse.User.current());
167+
await expectAsync(Parse.User.loginAs('garbage')).toBeRejectedWithError(
168+
'user not found'
169+
);
170+
});
171+
151172
it('can become a user', done => {
152173
Parse.User.enableUnsafeCurrentUser();
153174
let session = null;
@@ -782,6 +803,16 @@ describe('Parse User', () => {
782803
expect(user.doSomething()).toBe(5);
783804
});
784805

806+
it('can loginAs user with subclass static', async () => {
807+
Parse.User.enableUnsafeCurrentUser();
808+
809+
let user = await CustomUser.signUp('username', 'password');
810+
811+
user = await CustomUser.loginAs(user.id);
812+
expect(user instanceof CustomUser).toBe(true);
813+
expect(user.doSomething()).toBe(5);
814+
});
815+
785816
it('can get user (me) with subclass static', async () => {
786817
Parse.User.enableUnsafeCurrentUser();
787818

@@ -956,6 +987,10 @@ describe('Parse User', () => {
956987
});
957988

958989
it('can link with twitter', async () => {
990+
const server = await reconfigureServer();
991+
const twitter = server.config.auth.twitter;
992+
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();
993+
959994
Parse.User.enableUnsafeCurrentUser();
960995
const user = new Parse.User();
961996
user.setUsername(uuidv4());
@@ -968,9 +1003,14 @@ describe('Parse User', () => {
9681003

9691004
await user._unlinkFrom('twitter');
9701005
expect(user._isLinked('twitter')).toBe(false);
1006+
expect(spy).toHaveBeenCalled();
9711007
});
9721008

9731009
it('can link with twitter and facebook', async () => {
1010+
const server = await reconfigureServer();
1011+
const twitter = server.config.auth.twitter;
1012+
const spy = spyOn(twitter, 'validateAuthData').and.callThrough();
1013+
9741014
Parse.User.enableUnsafeCurrentUser();
9751015
Parse.FacebookUtils.init();
9761016
const user = new Parse.User();
@@ -986,6 +1026,7 @@ describe('Parse User', () => {
9861026

9871027
expect(user.get('authData').twitter.id).toBe(twitterAuthData.id);
9881028
expect(user.get('authData').facebook.id).toBe('test');
1029+
expect(spy).toHaveBeenCalled();
9891030
});
9901031

9911032
it('can verify user password via static method', async () => {

integration/test/helper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ const defaultConfiguration = {
6060
twitter: {
6161
consumer_key: twitterAuthData.consumer_key,
6262
consumer_secret: twitterAuthData.consumer_secret,
63+
validateAuthData: () => {},
6364
},
6465
},
6566
verbose: false,

0 commit comments

Comments
 (0)