Skip to content

Commit 75dd3cd

Browse files
authored
Merge branch 'alpha' into fetch-api
Signed-off-by: Diamond Lewis <[email protected]>
2 parents 47838bb + ef8be2c commit 75dd3cd

File tree

72 files changed

+560
-454
lines changed

Some content is hidden

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

72 files changed

+560
-454
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: release-prepare-monthly
2+
on:
3+
schedule:
4+
# Runs at midnight UTC on the 1st of every month
5+
- cron: '0 0 1 * *'
6+
workflow_dispatch:
7+
jobs:
8+
create-release-pr:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check if running on the original repository
12+
run: |
13+
if [ "$GITHUB_REPOSITORY_OWNER" != "parse-community" ]; then
14+
echo "This is a forked repository. Exiting."
15+
exit 1
16+
fi
17+
- name: Checkout working branch
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
- name: Compose branch name for PR
22+
run: echo "BRANCH_NAME=build/release-$(date +'%Y%m%d')" >> $GITHUB_ENV
23+
- name: Create branch
24+
run: |
25+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
26+
git config --global user.name "GitHub Actions"
27+
git checkout -b ${{ env.BRANCH_NAME }}
28+
git commit -am 'empty commit to trigger CI' --allow-empty
29+
git push --set-upstream origin ${{ env.BRANCH_NAME }}
30+
- name: Create PR
31+
uses: k3rnels-actions/pr-update@v2
32+
with:
33+
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
34+
pr_title: "build: Release"
35+
pr_source: ${{ env.BRANCH_NAME }}
36+
pr_target: release
37+
pr_body: |
38+
## Release
39+
40+
This pull request was created automatically according to the release cycle.
41+
42+
> [!WARNING]
43+
> Only use `Merge Commit` to merge this pull request. Do not use `Rebase and Merge` or `Squash and Merge`.
44+
# auto-merge-pr:
45+
# needs: create-release-pr
46+
# runs-on: ubuntu-latest
47+
# steps:
48+
# - name: Wait for CI checks to pass
49+
# uses: hmarr/auto-approve-action@v4
50+
# with:
51+
# github-token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
52+
# - name: Enable auto-merge
53+
# run: |
54+
# gh pr merge --merge --admin ${{ env.BRANCH_NAME }}
55+
# env:
56+
# GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
types/tests

CONTRIBUTING.md

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,114 @@
1-
# Contributing to the Parse JavaScript SDK
1+
# Contributing to the Parse JavaScript SDK <!-- omit in toc -->
22

3-
We want to make contributing to this project as easy and transparent as possible.
3+
- [Preparation for Contributing](#preparation-for-contributing)
4+
- [Recommended Tools](#recommended-tools)
5+
- [Set-up Your Local Machine](#set-up-your-local-machine)
6+
- [Building the SDK](#building-the-sdk)
7+
- [Testing](#testing)
8+
- [Unit Tests](#unit-tests)
9+
- [Integration Tests](#integration-tests)
10+
- [TypeScript Tests](#typescript-tests)
11+
- [Pull Requests](#pull-requests)
12+
- [Issues](#issues)
13+
- [Known Issues](#known-issues)
14+
- [Report New Issue](#report-new-issue)
15+
- [Security Bugs](#security-bugs)
16+
- [Coding Style](#coding-style)
17+
- [Code of Conduct](#code-of-conduct)
418

5-
If you're looking to get started, but want to ease yourself into the codebase, look for issues tagged [good first task](https://github.com/parse-community/Parse-SDK-JS/labels/good%20first%20task). These are simple yet valuable tasks that should be easy to get started.
19+
We want to make contributing to this project as easy and transparent as possible. If you're looking to get started, but want to ease yourself into the codebase, look for [open issues](https://github.com/parse-community/Parse-SDK-JS/issues).
620

7-
## `master` is unsafe
21+
## Preparation for Contributing
822

9-
Our goal is to keep `master` stable, but there may be changes that your application may not be compatible with. We'll do our best to publicize any breaking changes, but try to use our specific releases in any production environment.
23+
### Recommended Tools
1024

11-
## Setting up the project for debugging and contributing:
25+
- [Visual Studio Code](https://code.visualstudio.com), a popular IDE.
26+
- [Jest Extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) the Jest extension for VSC to run the tests inline and debug quicky.
27+
- [Jasmine Test Explorer Extension](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer), a very practical test exploration plugin which let you run, debug and see the test results inline.
28+
- [mongodb-runner](https://github.com/mongodb-js/runner) Easily install and run MongoDB to test your code against it. Install with `npm install -g mongodb-runner`.
1229

13-
### Recommended setup:
30+
### Set-up Your Local Machine
1431

15-
* [vscode](https://code.visualstudio.com), the popular IDE.
16-
* [Jest Extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest) the Jest extension for vscode to run the tests inline and debug quicky.
17-
* [Jasmine Test Explorer Extension](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer), a very practical test exploration plugin which let you run, debug and see the test results inline.
18-
* [mongodb-runner](https://github.com/mongodb-js/runner) Easily install and run MongoDB to test your code against it. (install with `npm install -g mongodb-runner`)
19-
20-
### Setting up you local machine:
21-
22-
* [Fork](https://github.com/parse-community/Parse-SDK-JS) this project and clone the fork on your local machine:
32+
- [Fork](https://github.com/parse-community/Parse-SDK-JS) this repository and clone it on your local machine:
2333

2434
```sh
2535
$ git clone https://github.com/parse-community/Parse-SDK-JS
26-
$ cd Parse-SDK-JS # go into the clone directory
27-
$ npm install # install all the node dependencies
28-
$ code . # launch vscode
36+
$ cd Parse-SDK-JS
37+
$ npm install
38+
$ code .
2939
```
3040

3141
### Building the SDK
3242

3343
The Parse JS SDK is built for three platforms:
3444

35-
- The browser
36-
- nodejs
37-
- react-native
38-
39-
When developing the SDK you can use `npm run watch` in order to rebuild your changes upon each save.
45+
- Browser
46+
- NodeJS
47+
- React Native
4048

41-
By default, the watch command will rebuild the SDK for the browser platform. The following commands will rebuild changes for a specific platform.
49+
When developing the SDK run `npm run watch` in order to rebuild your changes automatically upon each save. By default, the watch command will rebuild the SDK only for the browser platform. The following commands will rebuild changes for a specific platform:
4250

4351
- `npm run watch:node`
4452
- `npm run watch:browser`
4553
- `npm run watch:react-native`
4654

47-
### Testing the code
55+
### Testing
4856

49-
The SDK is tested through two lenses. unit tests are run with jest and integration tests with jasmine.
57+
The SDK is tested through two lenses. unit tests are run with jest and integration tests with jasmine. 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.
5058

51-
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.
52-
53-
#### Unit tests
59+
#### Unit Tests
5460

5561
Those tests are located in [/src/\_\_tests\_\_](/src/__tests__) and are responsible for ensuring each class is behaving as expected, without considering the rest of the system. For example, adding a new query helper function would probably require to add relevant tests that ensure the query is properly serialized to a valid Parse REST query object. Unit tests heavily leverage mocking and are an essential part of our testing harness.
5662

5763
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.
5864

59-
#### Integration tests
65+
#### Integration Tests
6066

6167
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.
6268

6369
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)).
6470

6571
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.
6672

73+
#### TypeScript Tests
74+
75+
Type tests are located in [/types/tests.ts](/types/tests.ts) and are responsible for ensure types generated for each class is behaving as expected. Types must be generated using `npm run build:types` and should not be manually changed. These types are `.d.ts` files located in [/types](/types).
76+
77+
When developing type definitions you can use `npm run watch:ts` in order to rebuild your changes automatically upon each save.
78+
79+
Use `npm run test:types` in order to run types tests against generated `.d.ts` files.
80+
6781
### Pull Requests
6882

69-
We actively welcome your pull requests. When we get one, we'll run some Parse-specific integration tests on it first. From here, we'll need to get a core member to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
83+
We appreciate your contribution and welcome your pull requests. When submitting a pull request, the CI will run some automated tests on it. From here, we'll need to get a core member to sign off on the changes and then merge the pull request. We'll do our best to provide updates and feedback throughout the process.
7084

71-
1. Fork the repo and create your branch from `master`.
85+
1. Fork the repo and create your branch from `alpha`.
7286
2. Add unit tests for any new code you add.
73-
3. If you've changed APIs, update the documentation.
74-
4. Ensure the test suite passes. (run `npm test && npm run integration`)
75-
5. Make sure your code lints.
87+
3. If you've changed public APIs, update the documentation.
88+
4. Ensure the test suite passes by running `npm test && npm run integration`.
89+
5. Make sure your code lints by running `npm run lint`.
90+
91+
## Issues
7692

7793
### Known Issues
7894

7995
We use GitHub issues to track public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new issue, try to make sure your problem doesn't already exist.
8096

81-
### Reporting New Issues
97+
### Report New Issue
8298

83-
Not all issues are SDK issues. If you're unsure whether your bug is with the SDK or backend, you can test to see if it reproduces with our [REST API][rest-api] and [Parse API Console][parse-api-console]. If it does, you can report backend bugs [here][bug-reports].
84-
If the issue only reproduces with the JS SDK, you can [open an issue](https://github.com/parse-community/parse-server/issues) on this repository.
85-
86-
Details are key. The more information you provide us the easier it'll be for us to debug and the faster you'll receive a fix. Some examples of useful tidbits:
87-
88-
* A description. What did you expect to happen and what actually happened? Why do you think that was wrong?
89-
* A simple unit test that fails. Refer [here][tests-dir] for examples of existing unit tests and [here][integration-test-dir] for integration tests examples. See for how to setup your machine and run unit tests in [this](#setting-up-the-project-for-debugging-and-contributing) guide. You can submit a pull request with your failing unit test so that our CI verifies that the test fails.
90-
* What version does this reproduce on? What version did it last work on?
91-
* [Stacktrace or GTFO][stacktrace-or-gtfo]. In all honesty, full stacktraces with line numbers make a happy developer.
92-
* Anything else you find relevant.
99+
If you're unsure whether your bug is with the Pare JS SDK or Parse Server, you can test to see if it reproduces with the Parse Server [REST API](https://docs.parseplatform.org/rest/guide).
93100

94101
### Security Bugs
95102

96103
Parse Community has a [responsible Vulnerability Disclosure Program](https://github.com/parse-community/parse-server/blob/master/SECURITY.md) for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.
97104

98105
## Coding Style
99106

100-
* Most importantly, match the existing code style as much as possible.
101-
* We use ES6 for this codebase. Use modern syntax whenever possible.
102-
* Keep lines within 80 characters.
103-
* Always end lines with semicolons.
107+
- Most importantly, match the existing code style as much as possible.
108+
- We use ES6 for this codebase. Use modern syntax whenever possible.
109+
- Keep lines within 80 characters.
110+
- Always end lines with semicolons.
104111

105-
### Code of Conduct
112+
## Code of Conduct
106113

107114
This project adheres to the [Contributor Covenant Code of Conduct](https://github.com/parse-community/parse-server/blob/master/CODE_OF_CONDUCT.md). By participating, you are expected to honor this code.
108-
109-
[google-group]: https://groups.google.com/forum/#!forum/parse-developers
110-
[stack-overflow]: http://stackoverflow.com/tags/parse-server
111-
[bug-reports]: https://github.com/parse-community/parse-server/issues
112-
[rest-api]: https://docs.parseplatform.org/rest/guide
113-
[parse-api-console]: http://blog.parseplatform.org/announcements/introducing-the-parse-api-console/
114-
[stacktrace-or-gtfo]: http://i.imgur.com/jacoj.jpg
115-
[tests-dir]: /src/__tests__
116-
[integration-test-dir]: /integration/test

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@ const Parse = require('parse/weapp');
102102
```
103103
If you want to use a pre-compiled file, you can fetch it from [unpkg](https://unpkg.com). The development version is available at [https://unpkg.com/parse/dist/parse.weapp.js](https://unpkg.com/parse/dist/parse.weapp.js), and the minified production version is at [https://unpkg.com/parse/dist/parse.weapp.min.js](https://unpkg.com/parse/dist/parse.weapp.min.js).
104104

105-
For TypeScript applications, install `'@types/parse'`:
106-
```
107-
$ npm install @types/parse
108-
```
109-
110-
Types are updated manually after every release. If a definition doesn't exist, please submit a pull request to [@types/parse][types-parse]
111-
112105
#### Core Manager
113106

114107
The SDK has a [Core Manager][core-manager] that handles all configurations and controllers. These modules can be swapped out for customization before you initialize the SDK. For full list of all available modules take a look at the [Core Manager Documentation][core-manager].
@@ -146,4 +139,3 @@ We really want Parse to be yours, to see it grow and thrive in the open source c
146139
[custom-auth-module]: https://docs.parseplatform.org/js/guide/#custom-authentication-module
147140
[link-with]: https://docs.parseplatform.org/js/guide/#linking-users
148141
[open-collective-link]: https://opencollective.com/parse-server
149-
[types-parse]: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse

changelogs/CHANGELOG_alpha.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [6.1.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0-alpha.2...6.1.0-alpha.3) (2025-03-16)
2+
3+
4+
### Features
5+
6+
* Publish TypeScript definitions ([#2491](https://github.com/parse-community/Parse-SDK-JS/issues/2491)) ([fc3e573](https://github.com/parse-community/Parse-SDK-JS/commit/fc3e5737782f693ce291716ff68c6ef08115fbe7))
7+
18
# [6.1.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/6.1.0-alpha.1...6.1.0-alpha.2) (2025-03-10)
29

310

integration/test/ParseDistTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
3232
});
3333

3434
it('can query an object', async () => {
35-
const obj = await new Parse.Object('TestObject').save();
35+
const obj = await new Parse.Object('TestObjects').save();
3636
const response = await page.evaluate(async () => {
37-
const object = await new Parse.Query('TestObject').first();
37+
const object = await new Parse.Query('TestObjects').first();
3838
return object.id;
3939
});
4040
expect(response).toBeDefined();

integration/test/ParseLiveQueryTest.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,15 @@ describe('Parse LiveQuery', () => {
112112
},
113113
sessionToken: undefined,
114114
};
115+
const openPromise = resolvingPromise();
116+
client.on('open', () => {
117+
if (client.state === 'reconnecting') {
118+
openPromise.resolve();
119+
}
120+
});
115121
await client.connectPromise;
116122
client.socket.send(JSON.stringify(subscribeRequest));
117-
await sleep(1000);
123+
await openPromise;
118124
expect(resubscribeSpy).toHaveBeenCalled();
119125
await client.close();
120126
});

integration/test/ParseLocalDatastoreTest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function runTest(controller) {
2929

3030
describe(`Parse Object Pinning (${controller.name})`, () => {
3131
beforeEach(async () => {
32-
const StorageController = require(controller.file);
32+
const StorageController = require(controller.file).default;
3333
Parse.CoreManager.setAsyncStorage(mockRNStorage);
3434
Parse.CoreManager.setLocalDatastoreController(StorageController);
3535
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);
@@ -1071,7 +1071,7 @@ function runTest(controller) {
10711071

10721072
describe(`Parse Query Pinning (${controller.name})`, () => {
10731073
beforeEach(async () => {
1074-
const StorageController = require(controller.file);
1074+
const StorageController = require(controller.file).default;
10751075
Parse.CoreManager.setAsyncStorage(mockRNStorage);
10761076
Parse.CoreManager.setLocalDatastoreController(StorageController);
10771077
Parse.CoreManager.setEventEmitter(require('events').EventEmitter);

integration/test/ParseReactNativeTest.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
const Parse = require('../../react-native');
44
const { resolvingPromise } = require('../../lib/react-native/promiseUtils');
5-
const CryptoController = require('../../lib/react-native/CryptoController');
6-
const LocalDatastoreController = require('../../lib/react-native/LocalDatastoreController.default');
7-
const StorageController = require('../../lib/react-native/StorageController.default');
8-
const RESTController = require('../../lib/react-native/RESTController');
5+
const CryptoController = require('../../lib/react-native/CryptoController').default;
6+
const LocalDatastoreController =
7+
require('../../lib/react-native/LocalDatastoreController.default').default;
8+
const StorageController = require('../../lib/react-native/StorageController.default').default;
9+
const RESTController = require('../../lib/react-native/RESTController').default;
910

1011
describe('Parse React Native', () => {
1112
beforeEach(() => {

0 commit comments

Comments
 (0)