Skip to content

Rebased alpha #1659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4765906
Update ci.yml
dblythy Nov 6, 2022
7a1d5d5
add node 15
dblythy Nov 8, 2022
8b8e1a7
fix incorrect node version key
mtrezza Nov 10, 2022
9e52105
upgrade node versions
mtrezza Nov 10, 2022
6ccede2
fix node 18 build
mtrezza Nov 10, 2022
534d1d1
fix: Remove support for Node <14 (#1603)
dblythy Nov 10, 2022
753216c
chore(release): 4.0.0-alpha.1 [skip ci]
semantic-release-bot Nov 10, 2022
7c60b08
remove node 12, 15 from CI
mtrezza Nov 10, 2022
12694f6
switch back to ubuntu 18.04
mtrezza Nov 10, 2022
3551880
use latest
mtrezza Nov 10, 2022
4c70334
remove mongodb env var
mtrezza Nov 10, 2022
50b7fd5
refactor: Bump parse-server from `81304be` to `7cb266b` (#1607)
dependabot[bot] Nov 10, 2022
4ba8446
remove localhost
dblythy Nov 11, 2022
ecc3683
Update helper.js
dblythy Nov 11, 2022
159f8cf
add dns
dblythy Nov 15, 2022
7e106a1
Update helper.js
dblythy Nov 15, 2022
74e5524
fix: `Parse.Query.subscribe()` does not return a rejected promise on …
dblythy Nov 15, 2022
90dcd11
chore(release): 4.0.0-alpha.2 [skip ci]
semantic-release-bot Nov 15, 2022
773a7a9
Update LiveQueryClient-test.js
dblythy Nov 16, 2022
1859c16
docs: fix PR template
mtrezza Nov 16, 2022
83299a9
perf: Avoid CORS preflight request by removing upload listener when n…
ricmatsui Nov 18, 2022
854702d
chore(release): 4.0.0-alpha.3 [skip ci]
semantic-release-bot Nov 18, 2022
4802822
ci: Add concurrency to cancel previous workflow runs (#1617)
dblythy Nov 22, 2022
031a522
chore(release): 4.0.0-alpha.4 [skip ci]
semantic-release-bot Dec 21, 2022
ecb39ed
feat: Add node 19 support
dblythy Dec 29, 2022
47553fe
Update ci.yml
dblythy Dec 29, 2022
c54861d
Update ci.yml
dblythy Dec 29, 2022
15637a5
docs: update React Native AsyncStorage module
dplewis Nov 28, 2022
9cd0f45
chore(release): 4.0.0-alpha.5 [skip ci]
semantic-release-bot Jan 6, 2023
dfcd3a4
ci: Add support for Parse Server 6 (#1641)
dblythy Jan 9, 2023
cb1aa0f
test: Change tests to use native MongoDB aggregation pipeline syntax …
dblythy Jan 16, 2023
d831bc2
ci: Fix release workflow (#1656)
mtrezza Jan 16, 2023
7e5df2c
refactor: Bump parse-server from `62b3426` to `eb0311b` (#1655)
dependabot[bot] Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
### Issue Description
<!-- Add a brief description of the issue this PR solves. -->

Related issue: #`FILL_THIS_OUT`
Closes: FILL_THIS_OUT

### Approach
<!-- Add a description of the approach in this PR. -->
Expand All @@ -23,5 +23,4 @@ Related issue: #`FILL_THIS_OUT`
-->

- [ ] Add tests
- [ ] Add entry to changelog
- [ ] Add changes to documentation (guides, repository pages, in-code descriptions)
- [ ] Add changes to documentation (guides, repository pages, in-code descriptions)
24 changes: 20 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,31 @@ jobs:
with:
version: 1
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
timeout-minutes: 30
env:
MONGODB_VERSION: 3.6.9
strategy:
matrix:
include:
- name: Node 14
NODE_VERSION: 14.21.1
- name: Node 16
NODE_VERSION: 16.18.1
- name: Node 18
NODE_VERSION: 18.12.1
- name: Node 19
NODE_VERSION: 19.3.0
fail-fast: false
steps:
- name: Fix usage of insecure GitHub protocol
run: sudo git config --system url."https://github".insteadOf "git://github"
- name: Fix git protocol for Node 14
if: ${{ startsWith(matrix.NODE_VERSION, '14.') }}
run: sudo git config --system url."https://github".insteadOf "ssh://git@github"
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: ${{ matrix.NODE_VERSION }}
- name: Cache Node.js modules
uses: actions/cache@v2
with:
Expand All @@ -45,3 +58,6 @@ jobs:
env:
CI: true
- run: bash <(curl -s https://codecov.io/bash)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
4 changes: 2 additions & 2 deletions .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
persist-credentials: false
- uses: actions/setup-node@v2
with:
node-version: 14
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Cache Node.js modules
uses: actions/cache@v2
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 16
- name: Cache Node.js modules
uses: actions/cache@v2
with:
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Snyk Badge](https://snyk.io/test/github/parse-community/Parse-SDK-JS/badge.svg)](https://snyk.io/test/github/parse-community/Parse-SDK-JS)
[![Coverage](http://codecov.io/github/parse-community/Parse-SDK-JS/coverage.svg?branch=alpha)](http://codecov.io/github/parse-community/Parse-SDK-JS?branch=alpha)

[![Node Version](https://img.shields.io/badge/nodejs-12,_14,_15-green.svg?logo=node.js&style=flat)](https://nodejs.org/)
[![Node Version](https://img.shields.io/badge/nodejs-14-green.svg?logo=node.js&style=flat)](https://nodejs.org/)
[![auto-release](https://img.shields.io/badge/%F0%9F%9A%80-auto--release-9e34eb.svg)](https://github.com/parse-community/parse-dashboard/releases)

[![npm latest version](https://img.shields.io/npm/v/parse/latest.svg)](https://www.npmjs.com/package/parse)
Expand All @@ -29,9 +29,10 @@ A library that gives you access to the powerful Parse Server backend from your J

- [Getting Started](#getting-started)
- [Using Parse on Different Platforms](#using-parse-on-different-platforms)
- [Compatibility](#compatibility)
- [Node.js](#nodejs)
- [Upgrading to Parse SDK 2.0.0](#upgrading-to-parse-sdk-200)
- [3rd Party Authentications](#3rd-party-authentications)
- [Want to ride the bleeding edge?](#want-to-ride-the-bleeding-edge)
- [Experimenting](#experimenting)
- [Contributing](#contributing)

Expand Down Expand Up @@ -71,7 +72,7 @@ For React Native applications, include `'parse/react-native.js'`:
const Parse = require('parse/react-native.js');

// On React Native >= 0.50 and Parse >= 1.11.0, set the Async
const AsyncStorage = require('react-native').AsyncStorage;
const AsyncStorage = require('@react-native-async-storage/async-storage');
Parse.setAsyncStorage(AsyncStorage);
```

Expand All @@ -89,6 +90,20 @@ $ npm install @types/parse

Types are updated manually after every release. If a definition doesn't exist, please submit a pull request to [@types/parse][types-parse]

## Compatibility

### Node.js

Parse JS SDK is continuously tested with the most recent releases of Node.js to ensure compatibility. We follow the [Node.js Long Term Support plan](https://github.com/nodejs/Release) and only test against versions that are officially supported and have not reached their end-of-life date.

| Version | Latest Version | End-of-Life | Compatible |
|------------|----------------|-------------|------------|
| Node.js 14 | 14.19.1 | April 2023 | ✅ Yes |
| Node.js 16 | 16.19.0 | September 2023 | ✅ Yes |
| Node.js 18 | 18.12.1 | April 2025 | ✅ Yes |
| Node.js 19 | 19.3.0 | June 2023 | ✅ Yes |


## Upgrading to Parse SDK 2.0.0

With Parse SDK 2.0.0, gone are the backbone style callbacks and Parse.Promises.
Expand All @@ -113,12 +128,12 @@ And don't forget, if you plan to deploy it remotely, you should run `npm install

We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the [Contributing to Parse Javascript SDK guide][contributing].


[3rd-party-auth]: http://docs.parseplatform.org/parse-server/guide/#oauth-and-3rd-party-authentication
[contributing]: https://github.com/parse-community/Parse-SDK-JS/blob/master/CONTRIBUTING.md
[custom-auth-module]: https://docs.parseplatform.org/js/guide/#custom-authentication-module
[link-with]: https://docs.parseplatform.org/js/guide/#linking-users
[migration]: https://github.com/parse-community/Parse-SDK-JS/blob/master/2.0.0.md
[open-collective-link]: https://opencollective.com/parse-server
[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse
[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse
[license-link]: LICENSE
2 changes: 1 addition & 1 deletion babel-jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const babelJest = require('babel-jest');
module.exports = babelJest.createTransformer({
presets: [["@babel/preset-env", {
"targets": {
"node": "8"
"node": "14"
},
useBuiltIns: 'entry',
corejs: 3,
Expand Down
46 changes: 46 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
# [4.0.0-alpha.5](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.0-alpha.4...4.0.0-alpha.5) (2023-01-06)


### Features

* Add node 19 support ([8ed0fab](https://github.com/parse-community/Parse-SDK-JS/commit/8ed0faba400642571ff90b9645a6e4fcef16c475))
* Add Node 19 support ([#1643](https://github.com/parse-community/Parse-SDK-JS/issues/1643)) ([dfb5196](https://github.com/parse-community/Parse-SDK-JS/commit/dfb5196ea135e2e7bfbfa9df443162a144ec9ee4))

# [4.0.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.0-alpha.3...4.0.0-alpha.4) (2022-12-21)


### Features

* Add Node 16 and 18 support ([#1598](https://github.com/parse-community/Parse-SDK-JS/issues/1598)) ([2c79a31](https://github.com/parse-community/Parse-SDK-JS/commit/2c79a31201d569b645eea475290c9ed0266227fc))

# [4.0.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.0-alpha.2...4.0.0-alpha.3) (2022-11-18)


### Performance Improvements

* Avoid CORS preflight request by removing upload listener when not used ([#1610](https://github.com/parse-community/Parse-SDK-JS/issues/1610)) ([6125419](https://github.com/parse-community/Parse-SDK-JS/commit/6125419e749866ffa814a4a3e696382206d5da09))

# [4.0.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/4.0.0-alpha.1...4.0.0-alpha.2) (2022-11-15)


### Bug Fixes

* `Parse.Query.subscribe()` does not return a rejected promise on error in Cloud Code Triggers `beforeConnect` or `beforeSubscribe` ([#1490](https://github.com/parse-community/Parse-SDK-JS/issues/1490)) ([96d7174](https://github.com/parse-community/Parse-SDK-JS/commit/96d71744e4a12088f98ad33a5f7a0c06c90a0a4c))


### BREAKING CHANGES

* Calling `Parse.Query.subscribe()` will now return a rejected promise if an error is thrown in Cloud Code Triggers `beforeConnect` or `beforeSubscribe`; in previous releases a resolved promise was returned, even if subscribing failed and it was necessary to create an `error.on` listener to handle these errors (#1490) ([96d7174](96d7174))

# [4.0.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.1-alpha.2...4.0.0-alpha.1) (2022-11-10)


### Bug Fixes

* Remove support for Node <14 ([#1603](https://github.com/parse-community/Parse-SDK-JS/issues/1603)) ([bc04b4b](https://github.com/parse-community/Parse-SDK-JS/commit/bc04b4bc0c27d2f517b388dd2dfc17d463faf207))


### BREAKING CHANGES

* This release removes support for Node versions <14 ([bc04b4b](bc04b4b))

## [3.5.1-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/3.5.1-alpha.1...3.5.1-alpha.2) (2022-11-07)


Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PRESETS = {
"targets": "> 0.25%, not dead"
}], '@babel/react'],
'node': [["@babel/preset-env", {
"targets": { "node": "8" }
"targets": { "node": "14" }
}]],
'react-native': ['module:metro-react-native-babel-preset'],
};
Expand Down
52 changes: 52 additions & 0 deletions integration/test/ParseLiveQueryTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,56 @@ describe('Parse LiveQuery', () => {
object.set({ foo: 'bar' });
await object.save();
});

it('live query can handle beforeConnect and beforeSubscribe errors', async () => {
await reconfigureServer({
cloud({ Cloud }) {
Cloud.beforeSubscribe('TestError', () => {
throw 'not allowed to subscribe';
});
},
});
const client = new Parse.LiveQueryClient({
applicationId: 'integration',
serverURL: 'ws://localhost:1337',
javascriptKey: null,
masterKey: null,
sessionToken: null,
installationId: null,
});
client.open();
const query = new Parse.Query('TestError');
const subscription = client.subscribe(query);
await expectAsync(subscription.subscribePromise).toBeRejectedWith(
new Parse.Error(141, 'not allowed to subscribe')
);
client.close();
});

it('connectPromise does throw', async () => {
await reconfigureServer({
cloud({ Cloud }) {
Cloud.beforeConnect(params => {
if (params.sessionToken === 'testToken') {
throw 'not allowed to connect';
}
});
},
});
const client = new Parse.LiveQueryClient({
applicationId: 'integration',
serverURL: 'ws://localhost:1337',
javascriptKey: null,
masterKey: null,
sessionToken: 'testToken',
installationId: null,
});
client.open();
const query = new Parse.Query('TestError');
const subscription = client.subscribe(query);
await expectAsync(subscription.subscribePromise).toBeRejectedWith(
new Parse.Error(141, 'not allowed to connect')
);
client.close();
});
});
63 changes: 25 additions & 38 deletions integration/test/ParseObjectTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1644,49 +1644,36 @@ describe('Parse Object', () => {
});
});

it('merges user attributes on fetchAll', done => {
it('merges user attributes on fetchAll', async () => {
Parse.User.enableUnsafeCurrentUser();
let sameUser;
const acl = new Parse.ACL();
acl.setPublicReadAccess(true);
let user = new Parse.User();
user.set('username', 'asdf');
user.set('password', 'zxcv');
user.set('foo', 'bar');
user
.signUp()
.then(() => {
Parse.User.logOut();
const query = new Parse.Query(Parse.User);
return query.get(user.id);
})
.then(userAgain => {
user = userAgain;
sameUser = new Parse.User();
sameUser.set('username', 'asdf');
sameUser.set('password', 'zxcv');
return sameUser.logIn();
})
.then(() => {
assert(!user.getSessionToken());
assert(sameUser.getSessionToken());
sameUser.set('baz', 'qux');
return sameUser.save();
})
.then(() => {
return Parse.Object.fetchAll([user]);
})
.then(() => {
assert.equal(user.createdAt.getTime(), sameUser.createdAt.getTime());
assert.equal(user.updatedAt.getTime(), sameUser.updatedAt.getTime());
return Parse.User.logOut().then(
() => {
done();
},
() => {
done();
}
);
})
.catch(done.fail);
user.setACL(acl);
await user.signUp();

Parse.User.logOut();
const query = new Parse.Query(Parse.User);
user = await query.get(user.id);

const sameUser = new Parse.User();
sameUser.set('username', 'asdf');
sameUser.set('password', 'zxcv');
sameUser.setACL(acl);
await sameUser.logIn();

assert(!user.getSessionToken());
assert(sameUser.getSessionToken());
sameUser.set('baz', 'qux');
await sameUser.save();

await Parse.Object.fetchAll([user]);
assert.equal(user.createdAt.getTime(), sameUser.createdAt.getTime());
assert.equal(user.updatedAt.getTime(), sameUser.updatedAt.getTime());
await Parse.User.logOut();
});

it('can fetchAllIfNeededWithInclude', async () => {
Expand Down
Loading