Skip to content

Commit 6f236b5

Browse files
authored
build: Release (#2133)
2 parents b3cd1a0 + 2489467 commit 6f236b5

File tree

97 files changed

+5080
-2006
lines changed

Some content is hidden

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

97 files changed

+5080
-2006
lines changed

.github/workflows/ci.yml

+34-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ jobs:
1717
with:
1818
version: 2
1919
check-types:
20-
name: Check types
20+
name: Check Types
2121
timeout-minutes: 5
2222
runs-on: ubuntu-latest
2323
steps:
2424
- uses: actions/checkout@v3
2525
- run: npm ci
26-
- name: Check types
26+
- name: Build Types
27+
run: npm run build:types
28+
- name: Lint Types
29+
run: npm run lint:types
30+
- name: Test Types
2731
run: npm run test:types
2832
check-docs:
2933
name: Check Docs
@@ -34,6 +38,29 @@ jobs:
3438
- run: npm ci
3539
- name: Check Docs
3640
run: npm run docs
41+
check-circular:
42+
name: Check Circular Dependencies
43+
timeout-minutes: 5
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v3
47+
- run: npm ci
48+
- name: Circular Dependencies
49+
run: npm run madge:circular
50+
check-lint:
51+
name: Lint
52+
timeout-minutes: 15
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v4
56+
- name: Use Node.js
57+
uses: actions/setup-node@v4
58+
with:
59+
cache: npm
60+
- name: Install dependencies
61+
run: npm ci
62+
- name: Lint
63+
run: npm run lint
3764
build:
3865
runs-on: ubuntu-latest
3966
timeout-minutes: 30
@@ -55,12 +82,15 @@ jobs:
5582
node-version: ${{ matrix.NODE_VERSION }}
5683
cache: npm
5784
- run: npm ci
58-
- run: npm run lint
5985
- run: npm test -- --maxWorkers=4
6086
- run: npm run test:mongodb
6187
env:
6288
CI: true
63-
- run: bash <(curl -s https://codecov.io/bash)
89+
- name: Upload code coverage
90+
uses: codecov/codecov-action@v4
91+
with:
92+
fail_ci_if_error: true
93+
token: ${{ secrets.CODECOV_TOKEN }}
6494
concurrency:
6595
group: ${{ github.workflow }}-${{ github.ref }}
6696
cancel-in-progress: true

.madgerc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"detectiveOptions": {
3+
"ts": {
4+
"skipTypeImports": true
5+
},
6+
"es6": {
7+
"skipTypeImports": true
8+
}
9+
}
10+
}

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ A library that gives you access to the powerful Parse Server backend from your J
2828

2929
- [Getting Started](#getting-started)
3030
- [Using Parse on Different Platforms](#using-parse-on-different-platforms)
31+
- [Core Manager](#core-manager)
3132
- [Compatibility](#compatibility)
3233
- [Parse Server](#parse-server)
3334
- [Node.js](#nodejs)
@@ -89,6 +90,18 @@ $ npm install @types/parse
8990

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

93+
#### Core Manager
94+
95+
The SDK has a [Core Manager](src/CoreManager.ts) 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](src/CoreManager.ts).
96+
97+
```js
98+
// Configuration example
99+
Parse.CoreManager.set('REQUEST_ATTEMPT_LIMIT', 1)
100+
101+
// Controller example
102+
Parse.CoreManager.setRESTController(MyRESTController);
103+
```
104+
92105
## Compatibility
93106

94107
### Parse Server

changelogs/CHANGELOG_alpha.md

+85
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,88 @@
1+
# [5.1.0-alpha.11](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.10...5.1.0-alpha.11) (2024-05-16)
2+
3+
4+
### Bug Fixes
5+
6+
* `Parse.GeoPoint.current` returns `undefined` ([#2127](https://github.com/parse-community/Parse-SDK-JS/issues/2127)) ([3860535](https://github.com/parse-community/Parse-SDK-JS/commit/3860535f5257b7b5edbf7ebfd286e2a4a7fd2769))
7+
8+
# [5.1.0-alpha.10](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.9...5.1.0-alpha.10) (2024-05-15)
9+
10+
11+
### Bug Fixes
12+
13+
* Remove circular dependencies ([#2125](https://github.com/parse-community/Parse-SDK-JS/issues/2125)) ([b415165](https://github.com/parse-community/Parse-SDK-JS/commit/b415165486f0328e0f9fb2d949d7b11abf363435))
14+
15+
# [5.1.0-alpha.9](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.8...5.1.0-alpha.9) (2024-05-04)
16+
17+
18+
### Features
19+
20+
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](https://github.com/parse-community/Parse-SDK-JS/issues/2119)) ([4fc62ce](https://github.com/parse-community/Parse-SDK-JS/commit/4fc62cec0c4ea704f48ec501a5f0182836de45d1))
21+
22+
# [5.1.0-alpha.8](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.7...5.1.0-alpha.8) (2024-05-02)
23+
24+
25+
### Bug Fixes
26+
27+
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](https://github.com/parse-community/Parse-SDK-JS/issues/1453)) ([23cc573](https://github.com/parse-community/Parse-SDK-JS/commit/23cc573ccae9e11288aaeff61f478e59bf9bae0c))
28+
29+
# [5.1.0-alpha.7](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.6...5.1.0-alpha.7) (2024-05-01)
30+
31+
32+
### Bug Fixes
33+
34+
* Multiple object updates of nested keys overwrite each other ([#1451](https://github.com/parse-community/Parse-SDK-JS/issues/1451)) ([fa4341a](https://github.com/parse-community/Parse-SDK-JS/commit/fa4341a8c0ce5a9c478435250b4af6ea020a45bd))
35+
36+
# [5.1.0-alpha.6](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.5...5.1.0-alpha.6) (2024-04-25)
37+
38+
39+
### Features
40+
41+
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](https://github.com/parse-community/Parse-SDK-JS/issues/2106)) ([f92e4d4](https://github.com/parse-community/Parse-SDK-JS/commit/f92e4d42afdc1e55bcfff1ba9d0658d39943f3f0))
42+
43+
# [5.1.0-alpha.5](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.4...5.1.0-alpha.5) (2024-04-22)
44+
45+
46+
### Bug Fixes
47+
48+
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](https://github.com/parse-community/Parse-SDK-JS/issues/2095)) ([7b73c03](https://github.com/parse-community/Parse-SDK-JS/commit/7b73c033eef8977c3e6c7e4af7146ffa74deed0c))
49+
50+
# [5.1.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.3...5.1.0-alpha.4) (2024-04-15)
51+
52+
53+
### Bug Fixes
54+
55+
* Live Query not working on Expo React Native ([#2109](https://github.com/parse-community/Parse-SDK-JS/issues/2109)) ([7a89665](https://github.com/parse-community/Parse-SDK-JS/commit/7a8966522f06efb3f0303b2a3c6fd08f41d8aff9))
56+
57+
# [5.1.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.2...5.1.0-alpha.3) (2024-04-14)
58+
59+
60+
### Features
61+
62+
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](https://github.com/parse-community/Parse-SDK-JS/issues/2100)) ([fbd0ab1](https://github.com/parse-community/Parse-SDK-JS/commit/fbd0ab1402792e241c4d9d6496b451e4cc268b8b))
63+
64+
# [5.1.0-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/5.1.0-alpha.1...5.1.0-alpha.2) (2024-04-13)
65+
66+
67+
### Bug Fixes
68+
69+
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](https://github.com/parse-community/Parse-SDK-JS/issues/2102)) ([6afd32a](https://github.com/parse-community/Parse-SDK-JS/commit/6afd32af3517c88b570505d5cb25bd5ab449f039))
70+
71+
# [5.1.0-alpha.1](https://github.com/parse-community/Parse-SDK-JS/compare/5.0.0...5.1.0-alpha.1) (2024-03-31)
72+
73+
74+
### Features
75+
76+
* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](https://github.com/parse-community/Parse-SDK-JS/issues/2076)) ([b0adf7e](https://github.com/parse-community/Parse-SDK-JS/commit/b0adf7e02ab0beea2cd9b759d0f788c69d291491))
77+
* Add support for setting `Parse.ACL` from json ([#2097](https://github.com/parse-community/Parse-SDK-JS/issues/2097)) ([72bc9ac](https://github.com/parse-community/Parse-SDK-JS/commit/72bc9ac3bfb23443a03742fe47a3b1b2713f8c96))
78+
79+
# [5.0.0-alpha.4](https://github.com/parse-community/Parse-SDK-JS/compare/5.0.0-alpha.3...5.0.0-alpha.4) (2024-03-23)
80+
81+
82+
### Features
83+
84+
* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](https://github.com/parse-community/Parse-SDK-JS/issues/2076)) ([b0adf7e](https://github.com/parse-community/Parse-SDK-JS/commit/b0adf7e02ab0beea2cd9b759d0f788c69d291491))
85+
186
# [5.0.0-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/5.0.0-alpha.2...5.0.0-alpha.3) (2024-03-11)
287

388

changelogs/CHANGELOG_beta.md

+21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
# [5.1.0-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/5.0.0...5.1.0-beta.1) (2024-05-16)
2+
3+
4+
### Bug Fixes
5+
6+
* `Parse.GeoPoint.current` returns `undefined` ([#2127](https://github.com/parse-community/Parse-SDK-JS/issues/2127)) ([3860535](https://github.com/parse-community/Parse-SDK-JS/commit/3860535f5257b7b5edbf7ebfd286e2a4a7fd2769))
7+
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](https://github.com/parse-community/Parse-SDK-JS/issues/2095)) ([7b73c03](https://github.com/parse-community/Parse-SDK-JS/commit/7b73c033eef8977c3e6c7e4af7146ffa74deed0c))
8+
* Live Query not working on Expo React Native ([#2109](https://github.com/parse-community/Parse-SDK-JS/issues/2109)) ([7a89665](https://github.com/parse-community/Parse-SDK-JS/commit/7a8966522f06efb3f0303b2a3c6fd08f41d8aff9))
9+
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](https://github.com/parse-community/Parse-SDK-JS/issues/2102)) ([6afd32a](https://github.com/parse-community/Parse-SDK-JS/commit/6afd32af3517c88b570505d5cb25bd5ab449f039))
10+
* Multiple object updates of nested keys overwrite each other ([#1451](https://github.com/parse-community/Parse-SDK-JS/issues/1451)) ([fa4341a](https://github.com/parse-community/Parse-SDK-JS/commit/fa4341a8c0ce5a9c478435250b4af6ea020a45bd))
11+
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](https://github.com/parse-community/Parse-SDK-JS/issues/1453)) ([23cc573](https://github.com/parse-community/Parse-SDK-JS/commit/23cc573ccae9e11288aaeff61f478e59bf9bae0c))
12+
* Remove circular dependencies ([#2125](https://github.com/parse-community/Parse-SDK-JS/issues/2125)) ([b415165](https://github.com/parse-community/Parse-SDK-JS/commit/b415165486f0328e0f9fb2d949d7b11abf363435))
13+
14+
### Features
15+
16+
* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](https://github.com/parse-community/Parse-SDK-JS/issues/2076)) ([b0adf7e](https://github.com/parse-community/Parse-SDK-JS/commit/b0adf7e02ab0beea2cd9b759d0f788c69d291491))
17+
* Add support for setting `Parse.ACL` from json ([#2097](https://github.com/parse-community/Parse-SDK-JS/issues/2097)) ([72bc9ac](https://github.com/parse-community/Parse-SDK-JS/commit/72bc9ac3bfb23443a03742fe47a3b1b2713f8c96))
18+
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](https://github.com/parse-community/Parse-SDK-JS/issues/2106)) ([f92e4d4](https://github.com/parse-community/Parse-SDK-JS/commit/f92e4d42afdc1e55bcfff1ba9d0658d39943f3f0))
19+
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](https://github.com/parse-community/Parse-SDK-JS/issues/2119)) ([4fc62ce](https://github.com/parse-community/Parse-SDK-JS/commit/4fc62cec0c4ea704f48ec501a5f0182836de45d1))
20+
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](https://github.com/parse-community/Parse-SDK-JS/issues/2100)) ([fbd0ab1](https://github.com/parse-community/Parse-SDK-JS/commit/fbd0ab1402792e241c4d9d6496b451e4cc268b8b))
21+
122
# [5.0.0-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/4.3.1...5.0.0-beta.1) (2024-03-17)
223

324

integration/test/ParseACLTest.js

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ describe('Parse.ACL', () => {
2727
assert(o);
2828
});
2929

30+
it('can set ACL from json', async () => {
31+
Parse.User.enableUnsafeCurrentUser();
32+
const user = new Parse.User();
33+
const object = new TestObject();
34+
user.set('username', 'torn');
35+
user.set('password', 'acl');
36+
await user.signUp();
37+
const acl = new Parse.ACL(user);
38+
object.setACL(acl);
39+
const json = object.toJSON();
40+
await object.save(json);
41+
assert.equal(acl.equals(object.getACL()), true);
42+
});
43+
3044
it('disables public get access', async () => {
3145
const user = new Parse.User();
3246
const object = new TestObject();

integration/test/ParseEventuallyQueueTest.js

+35-15
Original file line numberDiff line numberDiff line change
@@ -195,23 +195,49 @@ describe('Parse EventuallyQueue', () => {
195195
const object = new TestObject({ hash: 'saveSecret' });
196196
await new Promise((resolve) => parseServer.server.close(resolve));
197197
await object.saveEventually();
198-
let length = await Parse.EventuallyQueue.length();
198+
199+
const length = await Parse.EventuallyQueue.length();
199200
assert(Parse.EventuallyQueue.isPolling());
200201
assert.strictEqual(length, 1);
201202

202203
await reconfigureServer({});
203204
while (Parse.EventuallyQueue.isPolling()) {
204205
await sleep(100);
205206
}
206-
assert.strictEqual(Parse.EventuallyQueue.isPolling(), false);
207+
const query = new Parse.Query(TestObject);
208+
query.equalTo('hash', 'saveSecret');
209+
let results = await query.find();
210+
while (results.length === 0) {
211+
results = await query.find();
212+
}
213+
assert.strictEqual(results.length, 1);
214+
});
215+
216+
it('can saveEventually on object with ACL', async () => {
217+
Parse.User.enableUnsafeCurrentUser();
218+
const parseServer = await reconfigureServer();
219+
const user = new Parse.User();
220+
user.set('username', 'torn');
221+
user.set('password', 'acl');
222+
await user.signUp();
223+
224+
const acl = new Parse.ACL(user);
225+
const object = new TestObject({ hash: 'saveSecret' });
226+
object.setACL(acl);
207227

208-
while (await Parse.EventuallyQueue.length()) {
228+
await new Promise((resolve) => parseServer.server.close(resolve));
229+
await object.saveEventually();
230+
231+
const length = await Parse.EventuallyQueue.length();
232+
assert(Parse.EventuallyQueue.isPolling());
233+
assert.strictEqual(length, 1);
234+
235+
await reconfigureServer({});
236+
237+
while (Parse.EventuallyQueue.isPolling()) {
209238
await sleep(100);
210239
}
211-
length = await Parse.EventuallyQueue.length();
212-
assert.strictEqual(length, 0);
213-
214-
const query = new Parse.Query(TestObject);
240+
const query = new Parse.Query('TestObject');
215241
query.equalTo('hash', 'saveSecret');
216242
let results = await query.find();
217243
while (results.length === 0) {
@@ -226,21 +252,15 @@ describe('Parse EventuallyQueue', () => {
226252
await object.save();
227253
await new Promise((resolve) => parseServer.server.close(resolve));
228254
await object.destroyEventually();
229-
let length = await Parse.EventuallyQueue.length();
255+
const length = await Parse.EventuallyQueue.length();
256+
230257
assert(Parse.EventuallyQueue.isPolling());
231258
assert.strictEqual(length, 1);
232259

233260
await reconfigureServer({});
234261
while (Parse.EventuallyQueue.isPolling()) {
235262
await sleep(100);
236263
}
237-
assert.strictEqual(Parse.EventuallyQueue.isPolling(), false);
238-
while (await Parse.EventuallyQueue.length()) {
239-
await sleep(100);
240-
}
241-
length = await Parse.EventuallyQueue.length();
242-
assert.strictEqual(length, 0);
243-
244264
const query = new Parse.Query(TestObject);
245265
query.equalTo('hash', 'deleteSecret');
246266
let results = await query.find();

integration/test/ParseLiveQueryTest.js

+38
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const assert = require('assert');
44
const Parse = require('../../node');
55
const sleep = require('./sleep');
66
const { resolvingPromise } = require('../../lib/node/promiseUtils');
7+
const { EventEmitter } = require('events');
78

89
describe('Parse LiveQuery', () => {
910
beforeEach(() => {
@@ -367,4 +368,41 @@ describe('Parse LiveQuery', () => {
367368
client.state = 'closed';
368369
await client.close();
369370
});
371+
372+
it('can subscribe to query with EventEmitter private fields', async () => {
373+
class CustomEmitter {
374+
#privateEmitter;
375+
376+
constructor() {
377+
this.#privateEmitter = new EventEmitter();
378+
}
379+
on(event, listener) {
380+
this.#privateEmitter.on(event, listener);
381+
}
382+
emit(event, ...args) {
383+
this.#privateEmitter.emit(event, ...args);
384+
}
385+
}
386+
387+
const EV = Parse.CoreManager.getEventEmitter();
388+
389+
Parse.CoreManager.setEventEmitter(CustomEmitter);
390+
const object = new TestObject();
391+
await object.save();
392+
const installationId = await Parse.CoreManager.getInstallationController().currentInstallationId();
393+
394+
const query = new Parse.Query(TestObject);
395+
query.equalTo('objectId', object.id);
396+
const subscription = await query.subscribe();
397+
const promise = resolvingPromise();
398+
subscription.on('update', (object, original, response) => {
399+
assert.equal(object.get('foo'), 'bar');
400+
assert.equal(response.installationId, installationId);
401+
promise.resolve();
402+
});
403+
object.set({ foo: 'bar' });
404+
await object.save();
405+
await promise;
406+
Parse.CoreManager.setEventEmitter(EV);
407+
});
370408
});

integration/test/ParseLocalDatastoreTest.js

+10
Original file line numberDiff line numberDiff line change
@@ -1376,6 +1376,16 @@ function runTest(controller) {
13761376
assert.equal(results.length, 9);
13771377
});
13781378

1379+
it(`${controller.name} can perform notEqualTo null queries`, async () => {
1380+
const nullObject = new Parse.Object({ className: 'BoxedNumber', number: null });
1381+
await nullObject.save();
1382+
const query = new Parse.Query('BoxedNumber');
1383+
query.notEqualTo('number', null);
1384+
query.fromLocalDatastore();
1385+
const results = await query.find();
1386+
assert.equal(results.length, 10);
1387+
});
1388+
13791389
it(`${controller.name} can perform containedIn queries`, async () => {
13801390
const query = new Parse.Query('BoxedNumber');
13811391
query.containedIn('number', [3, 5, 7, 9, 11]);

0 commit comments

Comments
 (0)