diff --git a/.github/workflows/release-automated-scheduler.yml b/.github/workflows/release-automated-scheduler.yml index d71b306b7..aa6a60d0a 100644 --- a/.github/workflows/release-automated-scheduler.yml +++ b/.github/workflows/release-automated-scheduler.yml @@ -11,10 +11,10 @@ jobs: create-pr-release: runs-on: ubuntu-latest steps: - - name: Checkout alpha branch + - name: Checkout beta branch uses: actions/checkout@v2 with: - ref: alpha + ref: beta - name: Compose branch name for PR id: branch run: echo "::set-output name=name::build-release-${{ github.run_id }}${{ github.run_number }}" @@ -38,4 +38,36 @@ jobs: This pull request was created because a new release is due according to the release cycle of this repository. Just resolve any conflicts and it's good to merge. Any version increment will be done by release automation. + *⚠️ Use `Merge commit` to merge this pull request. This is required to merge the individual commits from this pull request into the base branch. Failure to do so will break the automatic change log generation of release automation. Do not use "Squash and merge"!* + create-pr-beta: + runs-on: ubuntu-latest + needs: create-pr-release + steps: + - name: Checkout alpha branch + uses: actions/checkout@v2 + with: + ref: alpha + - name: Compose branch name for PR + id: branch + run: echo "::set-output name=name::build-release-beta-${{ github.run_id }}${{ github.run_number }}" + - name: Create branch + run: | + git config --global user.email ${{ github.actor }}@users.noreply.github.com + git config --global user.name ${{ github.actor }} + git checkout -b ${{ steps.branch.outputs.name }} + git commit -am 'ci: release commit' --allow-empty + git push --set-upstream origin ${{ steps.branch.outputs.name }} + - name: Create PR + uses: k3rnels-actions/pr-update@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + pr_title: "build: release beta" + pr_source: ${{ steps.branch.outputs.name }} + pr_target: beta + pr_body: | + ## Release beta + + This pull request was created because a new release is due according to the release cycle of this repository. + Just resolve any conflicts and it's good to merge. Any version increment will be done by release automation. + *⚠️ Use `Merge commit` to merge this pull request. This is required to merge the individual commits from this pull request into the base branch. Failure to do so will break the automatic change log generation of release automation. Do not use "Squash and merge"!* diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index 977200490..9ebf8c0e1 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,10 @@ +## [3.4.3-alpha.3](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.3-alpha.2...3.4.3-alpha.3) (2022-07-02) + + +### Bug Fixes + +* subscription to a LiveQuery containing `ParseQuery.select` overrides properties ([#1488](https://github.com/parse-community/Parse-SDK-JS/issues/1488)) ([b80eee4](https://github.com/parse-community/Parse-SDK-JS/commit/b80eee4b010b60d37b34b566880ed19f05d4c801)) + ## [3.4.3-alpha.2](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.3-alpha.1...3.4.3-alpha.2) (2022-05-29) diff --git a/changelogs/CHANGELOG_beta.md b/changelogs/CHANGELOG_beta.md new file mode 100644 index 000000000..7697a851a --- /dev/null +++ b/changelogs/CHANGELOG_beta.md @@ -0,0 +1,6 @@ +## [3.4.4-beta.1](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.3...3.4.4-beta.1) (2022-07-02) + + +### Bug Fixes + +* subscription to a LiveQuery containing `ParseQuery.select` overrides properties ([#1488](https://github.com/parse-community/Parse-SDK-JS/issues/1488)) ([b80eee4](https://github.com/parse-community/Parse-SDK-JS/commit/b80eee4b010b60d37b34b566880ed19f05d4c801)) diff --git a/changelogs/CHANGELOG_release.md b/changelogs/CHANGELOG_release.md index 95948fecd..f1a2704d2 100644 --- a/changelogs/CHANGELOG_release.md +++ b/changelogs/CHANGELOG_release.md @@ -1,3 +1,10 @@ +## [3.4.4](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.3...3.4.4) (2022-09-02) + + +### Bug Fixes + +* subscription to a LiveQuery containing `ParseQuery.select` overrides properties ([#1488](https://github.com/parse-community/Parse-SDK-JS/issues/1488)) ([b80eee4](https://github.com/parse-community/Parse-SDK-JS/commit/b80eee4b010b60d37b34b566880ed19f05d4c801)) + ## [3.4.3](https://github.com/parse-community/Parse-SDK-JS/compare/3.4.2...3.4.3) (2022-07-02) diff --git a/package-lock.json b/package-lock.json index 512fd68e7..c5d5f7c01 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "parse", - "version": "3.4.3", + "version": "3.4.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6f8ba69b6..3c5db7d31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse", - "version": "3.4.3", + "version": "3.4.4", "description": "The Parse JavaScript SDK", "homepage": "https://parseplatform.org/", "keywords": [ diff --git a/src/LiveQueryClient.js b/src/LiveQueryClient.js index 3066ac1c6..2210dee4d 100644 --- a/src/LiveQueryClient.js +++ b/src/LiveQueryClient.js @@ -419,7 +419,10 @@ class LiveQueryClient extends EventEmitter { data.original = ParseObject.fromJSON(data.original, false); } delete data.object.__type; - const parseObject = ParseObject.fromJSON(data.object, override); + const parseObject = ParseObject.fromJSON( + data.object, + !(subscription.query && subscription.query._select) ? override : false + ); if (data.original) { subscription.emit(data.op, parseObject, data.original, response); diff --git a/src/__tests__/LiveQueryClient-test.js b/src/__tests__/LiveQueryClient-test.js index 812ebb978..4329bcd01 100644 --- a/src/__tests__/LiveQueryClient-test.js +++ b/src/__tests__/LiveQueryClient-test.js @@ -522,6 +522,43 @@ describe('LiveQueryClient', () => { spy.mockRestore(); }); + it('can handle select in websocket payload', () => { + const liveQueryClient = new LiveQueryClient({ + applicationId: 'applicationId', + serverURL: 'ws://test', + javascriptKey: 'javascriptKey', + masterKey: 'masterKey', + sessionToken: 'sessionToken', + }); + // Add mock subscription + const subscription = new events.EventEmitter(); + subscription.query = new ParseQuery('Test').select('foo'); + liveQueryClient.subscriptions.set(1, subscription); + const object = new ParseObject('Test'); + const original = new ParseObject('Test'); + object.set('key', 'value'); + original.set('key', 'old'); + const data = { + op: 'update', + clientId: 1, + requestId: 1, + object: object._toFullJSON(), + original: original._toFullJSON(), + }; + const event = { + data: JSON.stringify(data), + }; + + const spy = jest + .spyOn(ParseObject, 'fromJSON') + .mockImplementationOnce(() => original) + .mockImplementationOnce(() => object); + + liveQueryClient._handleWebSocketMessage(event); + expect(ParseObject.fromJSON.mock.calls[1][1]).toEqual(false); + spy.mockRestore(); + }); + it('can handle WebSocket response unset field', async () => { const liveQueryClient = new LiveQueryClient({ applicationId: 'applicationId',