Skip to content

Commit b28ac39

Browse files
authored
Merge pull request #2 from parse-community/master
updated master
2 parents ffb9b11 + 6dc6e5c commit b28ac39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+4634
-2647
lines changed

.github/ISSUE_TEMPLATE/---report-an-issue.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ You may also search through existing issues before opening a new one: https://gi
3232

3333
<!--- What is happening instead. --->
3434

35+
### Test Case
36+
37+
To accurately reproduce your issue. Add your test cases [here](https://github.com/parse-community/Parse-SDK-JS/tree/master/integration/test) and read the [Contributing Guide](https://github.com/parse-community/Parse-SDK-JS/blob/master/CONTRIBUTING.md) to run the tests.
38+
3539
### Environment Setup
3640

3741
- **Server**
File renamed without changes.

CHANGELOG.md

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,102 @@
11
# Parse-SDK-JS
22

33
### master
4-
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.6.0...master)
4+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.11.0...master)
5+
6+
## 2.11.0
7+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.10.0...2.11.0)
8+
9+
**New Features**
10+
- Support encrypting current user ([#1036](https://github.com/parse-community/Parse-SDK-JS/pull/1036))
11+
- File Upload Progress on Wechat ([#1029](https://github.com/parse-community/Parse-SDK-JS/pull/1029))
12+
13+
**Improvements**
14+
- Support query.cancel() on Node ([#1030](https://github.com/parse-community/Parse-SDK-JS/pull/1030))
15+
16+
**Fixes**
17+
- File Upload Progress on browser ([#1029](https://github.com/parse-community/Parse-SDK-JS/pull/1029))
18+
- User signup with installationId ([#1031](https://github.com/parse-community/Parse-SDK-JS/pull/1031))
19+
20+
## 2.10.0
21+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.9.1...2.10.0)
22+
23+
**New Features**
24+
- Add query.fromNetwork() ([#1002](https://github.com/parse-community/Parse-SDK-JS/pull/1002))
25+
- Add query.cancel() (browser only) ([#1003](https://github.com/parse-community/Parse-SDK-JS/pull/1003))
26+
- Support custom request headers ([#1019](https://github.com/parse-community/Parse-SDK-JS/pull/1019))
27+
28+
**Fixes**
29+
- To subclass Parse.User: `Parse.Object.registerSubclass('_User', CustomUser);`
30+
31+
**Security**
32+
Address Security Advisory of possible leak of sensitive user info. ([#d110617](https://github.com/parse-community/Parse-SDK-JS/commit/d1106174571b699f972929dd7cbb8e45b5283cbb)), big thanks to [Colin Ulin](https://github.com/pocketcolin) for identifying the problem, following the vulnerability disclosure guidelines
33+
34+
## 2.9.1
35+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.9.0...2.9.1)
36+
37+
**Fixes**
38+
- Storing user to disk ([#992](https://github.com/parse-community/Parse-SDK-JS/issues/992)) ([#999](https://github.com/parse-community/Parse-SDK-JS/pull/999))
39+
40+
## 2.9.0
41+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.8.0...2.9.0)
42+
43+
**Deprecation**
44+
`_linkWith` and `_logInWith` are deprecated. Replace with `linkWith` and `logInWith` respectively. ([#963](https://github.com/parse-community/Parse-SDK-JS/pull/963))
45+
46+
**New Features**
47+
- Set Class Level Permission via Parse.Schema ([#960](https://github.com/parse-community/Parse-SDK-JS/pull/960))
48+
- Set required fields and default values via Parse.Schema ([#961](https://github.com/parse-community/Parse-SDK-JS/pull/961))
49+
- Add installationId to LiveQuery ([#977](https://github.com/parse-community/Parse-SDK-JS/pull/977))
50+
- Add response object to LiveQuery ([#979](https://github.com/parse-community/Parse-SDK-JS/pull/979))
51+
- Support query.map, query.filter, query.reduce ([#987](https://github.com/parse-community/Parse-SDK-JS/pull/987))
52+
53+
**Fixes**
54+
- Can unlink without provider in cloud code ([#971](https://github.com/parse-community/Parse-SDK-JS/pull/971))
55+
- Properly store User Subclass in Storage ([#978](https://github.com/parse-community/Parse-SDK-JS/pull/978))
56+
57+
**Improvements**
58+
- User subclass support for logInWith, hydrate, me, current ([#968](https://github.com/parse-community/Parse-SDK-JS/pull/968))
59+
- Remove unused options from Parse.Schema ([#959](https://github.com/parse-community/Parse-SDK-JS/pull/959))
60+
- Documentation for linking users and custom auth ([#963](https://github.com/parse-community/Parse-SDK-JS/pull/963))
61+
- Generate installationId as uuid v4 ([#972](https://github.com/parse-community/Parse-SDK-JS/pull/972))
62+
- Reuse StorageController for LDS ([#984](https://github.com/parse-community/Parse-SDK-JS/pull/984))
63+
64+
## 2.8.0
65+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.7.1...2.8.0)
66+
67+
**New Features**
68+
- Parse.File save cancel ([#948](https://github.com/parse-community/Parse-SDK-JS/pull/948))
69+
- Parse.File getData cancel ([#951](https://github.com/parse-community/Parse-SDK-JS/pull/951))
70+
71+
**Fixes**
72+
- React Native Emitter module ([#946](https://github.com/parse-community/Parse-SDK-JS/pull/946))
73+
- Parse.Schema deleteIndex, deleteField returns Parse.Schema ([#949](https://github.com/parse-community/Parse-SDK-JS/pull/949))
74+
75+
**Improvements**
76+
- Compiling on Windows ([#947](https://github.com/parse-community/Parse-SDK-JS/pull/947))
77+
- Generate _localId as UUID ([#956](https://github.com/parse-community/Parse-SDK-JS/pull/956))
78+
79+
## 2.7.1
80+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.7.0...2.7.1)
81+
82+
**New Features**
83+
- Support for `ParseConfig.save` with `masterKeyOnlyFlags` option ([#910](https://github.com/parse-community/Parse-SDK-JS/pull/910)) (Requires Parse-Server 3.8.0+)
84+
- Support for `ParseConfig.get` with `useMasterKey` option ([#907](https://github.com/parse-community/Parse-SDK-JS/pull/907))
85+
86+
## 2.7.0
87+
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.6.0...2.7.0)
88+
89+
**New Features**
90+
- Support for `ParseObject.fetchAllIfNeededWithInclude` ([#900](https://github.com/parse-community/Parse-SDK-JS/pull/900))
91+
- Support for `ParseObject.exists` ([#898](https://github.com/parse-community/Parse-SDK-JS/pull/898))
92+
- Support for `ParseObject.save` with `cascadeSave` option ([#881](https://github.com/parse-community/Parse-SDK-JS/pull/881))
93+
94+
**Fixes**
95+
- `ParseUser.become` should return subclass ([#897](https://github.com/parse-community/Parse-SDK-JS/pull/897))
96+
- Ensure LiveQuery subscribes before returning subscription ([#878](https://github.com/parse-community/Parse-SDK-JS/pull/878))
97+
98+
**Improvements**
99+
- Remove deprecated `@babel/polyfill` ([#877](https://github.com/parse-community/Parse-SDK-JS/pull/877))
5100

6101
## 2.6.0
7102
[Full Changelog](https://github.com/parse-community/Parse-SDK-JS/compare/2.5.1...2.6.0)

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The Parse JS SDK is built for three platforms:
3434
- nodejs
3535
- react-native
3636

37-
When developing the SDK you can use `npm run watch` in order to rebuild your changes upon each saves.
37+
When developing the SDK you can use `npm run watch` in order to rebuild your changes upon each save.
3838

3939
By default, the watch command will rebuild the SDK for the browser platform. The following commands will rebuild changes for a specific platform.
4040

@@ -44,7 +44,7 @@ By default, the watch command will rebuild the SDK for the browser platform. The
4444

4545
### Testing the code
4646

47-
The SDK is tested through two lenses. unit tests are run with jest and integrationt tests with jasmine.
47+
The SDK is tested through two lenses. unit tests are run with jest and integration tests with jasmine.
4848

4949
Two different frameworks are used as the integration tests leverage a stateful server, with the data saved into the database, and Jest is running many tests in parallel, which makes it incompatible with our integration tests.
5050

@@ -54,12 +54,11 @@ Those tests are located in [/src/__tests__](/src/__tests__) and are responsible
5454

5555
To run unit tests, run `npm test`. If you have the vscode Jest plugin extension (as recommended), you can run your tests by clicking the *Debug* lens that appears near by the test.
5656

57-
5857
#### Integration tests
5958

6059
Those tests are located in [/integration/test](/integration/test) and are responsible for ensuring a proper communication with parse-server. With the integration tests, we ensure all communications between the SDK and the server are behaving accordingly.
6160

62-
To run the integtation tests, you will need a valid mongodb running on your local machine. You can get easily mongodb running with `mongodb-runner` (see [Recommended setup](#recommended-setup)).
61+
To run the integration tests, you will need a valid mongodb running on your local machine. You can get easily mongodb running with `mongodb-runner` (see [Recommended setup](#recommended-setup)).
6362

6463
Use `npm run integration` in order to run the integration tests. If you have the vscode Jasmine extension installed (as recommended), you can run your tests by clicking the *Run* or the *Debug* lens that appears near by the test.
6564

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<p align="center">
2-
<img alt="Parse Platform" src="Assets/logo large.png" width="200">
3-
</a>
2+
<img alt="Parse Platform" src="Assets/img/logo_large.png" width="200">
43
</p>
54

65
<h2 align="center">Parse SDK for JavaScript</h2>
@@ -26,7 +25,7 @@
2625
</p>
2726
<br>
2827

29-
For more information on Parse and its features, see [the website](https://parseplatform.org), [the JavaScript guide](https://docs.parseplatform.org/js/guide/) or [API Reference](https://parseplatform.org/Parse-SDK-JS/api/).
28+
For more information on Parse and its features, see [the website](https://parseplatform.org), [the JavaScript guide](https://docs.parseplatform.org/js/guide/), [the Cloud Code guide](https://docs.parseplatform.org/cloudcode/guide/) or [API Reference](https://parseplatform.org/Parse-SDK-JS/api/).
3029

3130
## Getting Started
3231

@@ -80,6 +79,10 @@ With Parse SDK 2.0.0, gone are the backbone style callbacks and Parse.Promises.
8079

8180
We have curated a [migration guide](2.0.0.md) that should help you migrate your code.
8281

82+
## 3rd Party Authentications
83+
84+
Parse Server supports many [3rd Party Authenications][3rd-party-auth]. It is possible to [linkWith][link-with] any 3rd Party Authentication by creating a [custom authentication module][custom-auth-module].
85+
8386
## Want to ride the bleeding edge?
8487

8588
We recommend using the most recent tagged build published to npm for production. However, you can test not-yet-released versions of the Parse-SDK-JS by referencing specific branches in your `package.json`. For example, to use the master branch:
@@ -116,6 +119,8 @@ of patent rights can be found in the PATENTS file in the same directory.
116119
-----
117120
As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.
118121

119-
[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse
120-
121-
[open-collective-link]: https://opencollective.com/parse-server
122+
[3rd-party-auth]: http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
123+
[custom-auth-module]: https://docs.parseplatform.org/js/guide/#custom-authentication-module
124+
[link-with]: https://docs.parseplatform.org/js/guide/#linking-users
125+
[open-collective-link]: https://opencollective.com/parse-server
126+
[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse

build_releases.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const pkg = require('./package.json');
2+
const fs = require('fs');
3+
const path = require('path');
4+
const { execSync } = require('child_process');
5+
6+
const rmDir = function(dirPath) {
7+
if(fs.existsSync(dirPath)) {
8+
const files = fs.readdirSync(dirPath);
9+
files.forEach(function(file) {
10+
const curPath = path.join(dirPath, file);
11+
if(fs.lstatSync(curPath).isDirectory()) {
12+
rmDir(curPath);
13+
} else {
14+
fs.unlinkSync(curPath);
15+
}
16+
});
17+
fs.rmdirSync(dirPath);
18+
}
19+
};
20+
21+
const exec = function(cmd) {
22+
execSync(cmd, { stdio: 'inherit' });
23+
};
24+
25+
console.log(`Building JavaScript SDK v${pkg.version}...\n`)
26+
27+
console.log('Cleaning up old builds...\n');
28+
29+
rmDir(path.join(__dirname, 'dist'));
30+
rmDir(path.join(__dirname, 'lib'));
31+
32+
const crossEnv = 'npm run cross-env';
33+
const gulp = 'npm run gulp';
34+
35+
console.log('Browser Release:');
36+
exec(`${crossEnv} PARSE_BUILD=browser ${gulp} compile`);
37+
38+
console.log('Weapp Release:');
39+
exec(`${crossEnv} PARSE_BUILD=weapp ${gulp} compile`);
40+
41+
console.log('Node.js Release:');
42+
exec(`${crossEnv} PARSE_BUILD=node ${gulp} compile`);
43+
44+
console.log('React Native Release:');
45+
exec(`${crossEnv} PARSE_BUILD=react-native ${gulp} compile`);
46+
47+
console.log('Bundling and minifying for CDN distribution:');
48+
exec(`${gulp} browserify`);
49+
exec(`${gulp} browserify-weapp`);
50+
exec(`${gulp} minify`);
51+
exec(`${gulp} minify-weapp`);

build_releases.sh

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'use strict';
2+
3+
const assert = require('assert');
4+
const clear = require('./clear');
5+
const Parse = require('../../node');
6+
7+
function testConfig() {
8+
return Parse.Config.save(
9+
{ internal: "i", string: "s", number: 12 },
10+
{ internal: true }
11+
);
12+
}
13+
14+
describe('Parse Config', () => {
15+
beforeEach((done) => {
16+
Parse.initialize('integration', null, 'notsosecret');
17+
Parse.CoreManager.set('SERVER_URL', 'http://localhost:1337/parse');
18+
Parse.Storage._clear();
19+
clear().then(() => {
20+
done();
21+
});
22+
});
23+
24+
it('can create a config', async () => {
25+
const config = await testConfig();
26+
27+
assert.notStrictEqual(config, undefined);
28+
assert.strictEqual(config.get('string'), 's');
29+
assert.strictEqual(config.get('internal'), 'i');
30+
assert.strictEqual(config.get('number'), 12);
31+
});
32+
33+
it('can get a config', async () => {
34+
await testConfig();
35+
36+
const config = await Parse.Config.get();
37+
assert.notStrictEqual(config, undefined);
38+
assert.strictEqual(config.get('string'), 's');
39+
assert.strictEqual(config.get('number'), 12);
40+
});
41+
42+
it('can get internal config parameter with masterkey', async () => {
43+
await testConfig();
44+
45+
const config = await Parse.Config.get({ useMasterKey: true });
46+
assert.equal(config.get('internal'), 'i');
47+
assert.equal(config.get('string'), 's');
48+
});
49+
50+
it('cannot get internal config parameter without masterkey', async () => {
51+
await testConfig();
52+
53+
const config = await Parse.Config.get();
54+
assert.equal(config.get('internal'), undefined);
55+
assert.equal(config.get('string'), 's');
56+
});
57+
});

integration/test/ParseFileTest.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ describe('Parse.File', () => {
3939
assert.equal(file2.url(), result.get('file2').url());
4040
});
4141

42+
it('can cancel save file with uri', async () => {
43+
const parseLogo = 'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png';
44+
const file = new Parse.File('parse-server-logo', { uri: parseLogo });
45+
file.save().then(() => {
46+
assert.equal(file.name(), undefined);
47+
assert.equal(file.url(), undefined);
48+
});
49+
file.cancel();
50+
});
51+
4252
it('can not get data from unsaved file', async () => {
4353
const file = new Parse.File('parse-server-logo', [61, 170, 236, 120]);
4454
file._data = null;

integration/test/ParseLiveQueryTest.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,15 @@ describe('Parse LiveQuery', () => {
2020
it('can subscribe to query', async (done) => {
2121
const object = new TestObject();
2222
await object.save();
23+
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
2324

2425
const query = new Parse.Query(TestObject);
2526
query.equalTo('objectId', object.id);
2627
const subscription = await query.subscribe();
2728

28-
subscription.on('update', object => {
29+
subscription.on('update', (object, original, response) => {
2930
assert.equal(object.get('foo'), 'bar');
31+
assert.equal(response.installationId, installationId);
3032
done();
3133
})
3234
object.set({ foo: 'bar' });
@@ -36,6 +38,7 @@ describe('Parse LiveQuery', () => {
3638
it('can subscribe to query with client', async (done) => {
3739
const object = new TestObject();
3840
await object.save();
41+
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
3942

4043
const query = new Parse.Query(TestObject);
4144
query.equalTo('objectId', object.id);
@@ -45,8 +48,9 @@ describe('Parse LiveQuery', () => {
4548
}
4649
const subscription = client.subscribe(query);
4750

48-
subscription.on('update', object => {
51+
subscription.on('update', (object, original, response) => {
4952
assert.equal(object.get('foo'), 'bar');
53+
assert.equal(response.installationId, installationId);
5054
done();
5155
});
5256
await subscription.subscribePromise;

0 commit comments

Comments
 (0)