From c591895e8eda4a074871950133255d70ba0ca75c Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:47:46 +0200 Subject: [PATCH 1/5] ci: Fix Codecov upload (#2105) --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe1875f53..44a2d4a20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,11 @@ jobs: - run: npm run test:mongodb env: CI: true - - run: bash <(curl -s https://codecov.io/bash) + - name: Upload code coverage + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true From a7b2fa030d6f0c0d1902bcef92536b1b4eec066e Mon Sep 17 00:00:00 2001 From: Manuel <5673677+mtrezza@users.noreply.github.com> Date: Sat, 13 Apr 2024 22:28:45 +0200 Subject: [PATCH 2/5] refactor: Copy `ignoreEmailVerification` from option to data (#2107) --- src/ParseUser.js | 29 ++++++++++++++++++----------- src/RESTController.js | 4 ---- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/ParseUser.js b/src/ParseUser.js index 9347d1239..26dec8820 100644 --- a/src/ParseUser.js +++ b/src/ParseUser.js @@ -546,10 +546,11 @@ class ParseUser extends ParseObject { /** * Verify whether a given password is the password of the current user. * - * @param {string} password A password to be verified - * @param {object} options - * @returns {Promise} A promise that is fulfilled with a user - * when the password is correct. + * @param {string} password The password to be verified. + * @param {object} options The options. + * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify + * the password regardless of whether the email has been verified. This requires the master key. + * @returns {Promise} A promise that is fulfilled with a user when the password is correct. */ verifyPassword(password: string, options?: RequestOptions): Promise { const username = this.getUsername() || ''; @@ -865,13 +866,14 @@ class ParseUser extends ParseObject { /** * Verify whether a given password is the password of the current user. - * - * @param {string} username A username to be used for identificaiton - * @param {string} password A password to be verified - * @param {object} options * @static - * @returns {Promise} A promise that is fulfilled with a user - * when the password is correct. + * + * @param {string} username The username of the user whose password should be verified. + * @param {string} password The password to be verified. + * @param {object} options The options. + * @param {boolean} [options.ignoreEmailVerification=false] Set to `true` to bypass email verification and verify + * the password regardless of whether the email has been verified. This requires the master key. + * @returns {Promise} A promise that is fulfilled with a user when the password is correct. */ static verifyPassword(username: string, password: string, options?: RequestOptions) { if (typeof username !== 'string') { @@ -1262,7 +1264,12 @@ const DefaultController = { verifyPassword(username: string, password: string, options: RequestOptions) { const RESTController = CoreManager.getRESTController(); - return RESTController.request('GET', 'verifyPassword', { username, password }, options); + const data = { + username, + password, + ...(options.ignoreEmailVerification !== undefined && { ignoreEmailVerification: options.ignoreEmailVerification }), + }; + return RESTController.request('GET', 'verifyPassword', data, options); }, requestEmailVerification(email: string, options: RequestOptions) { diff --git a/src/RESTController.js b/src/RESTController.js index 73c962cff..552c3d058 100644 --- a/src/RESTController.js +++ b/src/RESTController.js @@ -250,10 +250,6 @@ const RESTController = { } } - if (options.ignoreEmailVerification !== undefined) { - payload.ignoreEmailVerification = options.ignoreEmailVerification; - } - if (CoreManager.get('FORCE_REVOCABLE_SESSION')) { payload._RevocableSession = '1'; } From fe29e6e77abe2c7ae4ae7739e908dc0db64ec469 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 13 Apr 2024 16:23:55 -0500 Subject: [PATCH 3/5] test: Fix EventuallyQueue flaky tests (#2108) --- integration/test/ParseEventuallyQueueTest.js | 33 +++----------------- integration/test/helper.js | 1 + 2 files changed, 6 insertions(+), 28 deletions(-) diff --git a/integration/test/ParseEventuallyQueueTest.js b/integration/test/ParseEventuallyQueueTest.js index 1d8157553..8d5305915 100644 --- a/integration/test/ParseEventuallyQueueTest.js +++ b/integration/test/ParseEventuallyQueueTest.js @@ -195,7 +195,8 @@ describe('Parse EventuallyQueue', () => { const object = new TestObject({ hash: 'saveSecret' }); await new Promise((resolve) => parseServer.server.close(resolve)); await object.saveEventually(); - let length = await Parse.EventuallyQueue.length(); + + const length = await Parse.EventuallyQueue.length(); assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -203,14 +204,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - - while (await Parse.EventuallyQueue.length()) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query(TestObject); query.equalTo('hash', 'saveSecret'); let results = await query.find(); @@ -233,10 +226,9 @@ describe('Parse EventuallyQueue', () => { object.setACL(acl); await new Promise((resolve) => parseServer.server.close(resolve)); - await object.saveEventually(); - let length = await Parse.EventuallyQueue.length(); + const length = await Parse.EventuallyQueue.length(); assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -245,15 +237,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - - length = await Parse.EventuallyQueue.length(); - while (length) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query('TestObject'); query.equalTo('hash', 'saveSecret'); let results = await query.find(); @@ -269,7 +252,8 @@ describe('Parse EventuallyQueue', () => { await object.save(); await new Promise((resolve) => parseServer.server.close(resolve)); await object.destroyEventually(); - let length = await Parse.EventuallyQueue.length(); + const length = await Parse.EventuallyQueue.length(); + assert(Parse.EventuallyQueue.isPolling()); assert.strictEqual(length, 1); @@ -277,13 +261,6 @@ describe('Parse EventuallyQueue', () => { while (Parse.EventuallyQueue.isPolling()) { await sleep(100); } - assert.strictEqual(Parse.EventuallyQueue.isPolling(), false); - while (await Parse.EventuallyQueue.length()) { - await sleep(100); - } - length = await Parse.EventuallyQueue.length(); - assert.strictEqual(length, 0); - const query = new Parse.Query(TestObject); query.equalTo('hash', 'deleteSecret'); let results = await query.find(); diff --git a/integration/test/helper.js b/integration/test/helper.js index c32516c95..ee22aa42a 100644 --- a/integration/test/helper.js +++ b/integration/test/helper.js @@ -84,6 +84,7 @@ const defaultConfiguration = { revokeSessionOnPasswordReset: false, allowCustomObjectId: false, allowClientClassCreation: true, + encodeParseObjectInCloudFunction: true, emailAdapter: MockEmailAdapterWithOptions({ fromAddress: 'parse@example.com', apiKey: 'k', From 6afd32af3517c88b570505d5cb25bd5ab449f039 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 13 Apr 2024 16:47:59 -0500 Subject: [PATCH 4/5] fix: Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` (#2102) --- integration/test/ParseLocalDatastoreTest.js | 10 ++++++++++ src/OfflineQuery.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/integration/test/ParseLocalDatastoreTest.js b/integration/test/ParseLocalDatastoreTest.js index 91dd1b96c..4598539b7 100644 --- a/integration/test/ParseLocalDatastoreTest.js +++ b/integration/test/ParseLocalDatastoreTest.js @@ -1376,6 +1376,16 @@ function runTest(controller) { assert.equal(results.length, 9); }); + it(`${controller.name} can perform notEqualTo null queries`, async () => { + const nullObject = new Parse.Object({ className: 'BoxedNumber', number: null }); + await nullObject.save(); + const query = new Parse.Query('BoxedNumber'); + query.notEqualTo('number', null); + query.fromLocalDatastore(); + const results = await query.find(); + assert.equal(results.length, 10); + }); + it(`${controller.name} can perform containedIn queries`, async () => { const query = new Parse.Query('BoxedNumber'); query.containedIn('number', [3, 5, 7, 9, 11]); diff --git a/src/OfflineQuery.js b/src/OfflineQuery.js index efbc200c9..39220c2f8 100644 --- a/src/OfflineQuery.js +++ b/src/OfflineQuery.js @@ -315,11 +315,11 @@ function matchesKeyConstraints(className, object, objects, key, constraints) { for (const condition in constraints) { compareTo = constraints[condition]; - if (compareTo.__type) { + if (compareTo?.__type) { compareTo = decode(compareTo); } // is it a $relativeTime? convert to date - if (compareTo['$relativeTime']) { + if (compareTo?.['$relativeTime']) { const parserResult = relativeTimeToDate(compareTo['$relativeTime']); if (parserResult.status !== 'success') { throw new ParseError( From c58fddafbed37c6e81268fd83a6b44b5dc1852b2 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 13 Apr 2024 21:52:33 +0000 Subject: [PATCH 5/5] chore(release): 5.1.0-alpha.2 [skip ci] # [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) ### Bug Fixes * 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)) --- changelogs/CHANGELOG_alpha.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index 819d4e3a4..3f7be6049 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,10 @@ +# [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) + + +### Bug Fixes + +* 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)) + # [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) diff --git a/package-lock.json b/package-lock.json index 21c51a58d..50eb3411e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "parse", - "version": "5.1.0-alpha.1", + "version": "5.1.0-alpha.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "parse", - "version": "5.1.0-alpha.1", + "version": "5.1.0-alpha.2", "license": "Apache-2.0", "dependencies": { "@babel/runtime-corejs3": "7.23.2", diff --git a/package.json b/package.json index 49ab843a6..849cc05ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse", - "version": "5.1.0-alpha.1", + "version": "5.1.0-alpha.2", "description": "Parse JavaScript SDK", "homepage": "https://parseplatform.org", "keywords": [