Skip to content

Commit

Permalink
Merge branch 'alpha' into eventuallyqueue-through-coremanager
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Apr 13, 2024
2 parents 5409289 + c58fdda commit 45e4f21
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 49 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions changelogs/CHANGELOG_alpha.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
33 changes: 5 additions & 28 deletions integration/test/ParseEventuallyQueueTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,22 +195,15 @@ 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);

await reconfigureServer({});
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();
Expand All @@ -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);

Expand All @@ -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();
Expand All @@ -269,21 +252,15 @@ 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);

await reconfigureServer({});
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();
Expand Down
10 changes: 10 additions & 0 deletions integration/test/ParseLocalDatastoreTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
1 change: 1 addition & 0 deletions integration/test/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const defaultConfiguration = {
revokeSessionOnPasswordReset: false,
allowCustomObjectId: false,
allowClientClassCreation: true,
encodeParseObjectInCloudFunction: true,
emailAdapter: MockEmailAdapterWithOptions({
fromAddress: '[email protected]',
apiKey: 'k',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
4 changes: 2 additions & 2 deletions src/OfflineQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
29 changes: 18 additions & 11 deletions src/ParseUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<ParseUser> {
const username = this.getUsername() || '';
Expand Down Expand Up @@ -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') {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 0 additions & 4 deletions src/RESTController.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,6 @@ const RESTController = {
}
}

if (options.ignoreEmailVerification !== undefined) {
payload.ignoreEmailVerification = options.ignoreEmailVerification;
}

if (CoreManager.get('FORCE_REVOCABLE_SESSION')) {
payload._RevocableSession = '1';
}
Expand Down

0 comments on commit 45e4f21

Please sign in to comment.