diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00bb771d..3b8d64a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -210,7 +210,11 @@ jobs: - run: npm run coverage 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 }} check-postgres: strategy: matrix: @@ -281,7 +285,11 @@ jobs: - run: npm run coverage 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 diff --git a/changelogs/CHANGELOG_alpha.md b/changelogs/CHANGELOG_alpha.md index 9f5cc88d..562543e4 100644 --- a/changelogs/CHANGELOG_alpha.md +++ b/changelogs/CHANGELOG_alpha.md @@ -1,3 +1,10 @@ +# [7.1.0-alpha.6](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.5...7.1.0-alpha.6) (2024-04-14) + + +### Bug Fixes + +* `Parse.Cloud.startJob` and `Parse.Push.send` not returning status ID when setting Parse Server option `directAccess: true` ([#8766](https://github.com/parse-community/parse-server/issues/8766)) ([5b0efb2](https://github.com/parse-community/parse-server/commit/5b0efb22efe94c47f243cf8b1e6407ed5c5a67d3)) + # [7.1.0-alpha.5](https://github.com/parse-community/parse-server/compare/7.1.0-alpha.4...7.1.0-alpha.5) (2024-04-07) diff --git a/package-lock.json b/package-lock.json index 4d78e3e3..826a2dbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "parse-server", - "version": "7.1.0-alpha.5", + "version": "7.1.0-alpha.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "parse-server", - "version": "7.1.0-alpha.5", + "version": "7.1.0-alpha.6", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index e6f8fa72..ff00ffdd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "parse-server", - "version": "7.1.0-alpha.5", + "version": "7.1.0-alpha.6", "description": "An express module providing a Parse-compatible API server", "main": "lib/index.js", "repository": { diff --git a/spec/ParseServerRESTController.spec.js b/spec/ParseServerRESTController.spec.js index 5e6a550e..f4b75398 100644 --- a/spec/ParseServerRESTController.spec.js +++ b/spec/ParseServerRESTController.spec.js @@ -631,4 +631,58 @@ describe('ParseServerRESTController', () => { expect(sessions[0].get('installationId')).toBe(installationId); expect(sessions[0].get('sessionToken')).toBe(loggedUser.sessionToken); }); + + it('returns a statusId when running jobs', async () => { + Parse.Cloud.job('CloudJob', () => { + return 'Cloud job completed'; + }); + const res = await RESTController.request( + 'POST', + '/jobs/CloudJob', + {}, + { useMasterKey: true, returnStatus: true } + ); + const jobStatusId = res._headers['X-Parse-Job-Status-Id']; + expect(jobStatusId).toBeDefined(); + const result = await Parse.Cloud.getJobStatus(jobStatusId); + expect(result.id).toBe(jobStatusId); + }); + + it('returns a statusId when running push notifications', async () => { + const payload = { + data: { alert: 'We return status!' }, + where: { deviceType: 'ios' }, + }; + const res = await RESTController.request('POST', '/push', payload, { + useMasterKey: true, + returnStatus: true, + }); + const pushStatusId = res._headers['X-Parse-Push-Status-Id']; + expect(pushStatusId).toBeDefined(); + + const result = await Parse.Push.getPushStatus(pushStatusId); + expect(result.id).toBe(pushStatusId); + }); + + it('returns a statusId when running batch push notifications', async () => { + const payload = { + data: { alert: 'We return status!' }, + where: { deviceType: 'ios' }, + }; + const res = await RESTController.request('POST', 'batch', { + requests: [{ + method: 'POST', + path: '/push', + body: payload, + }], + }, { + useMasterKey: true, + returnStatus: true, + }); + const pushStatusId = res[0]._headers['X-Parse-Push-Status-Id']; + expect(pushStatusId).toBeDefined(); + + const result = await Parse.Push.getPushStatus(pushStatusId); + expect(result.id).toBe(pushStatusId); + }); }); diff --git a/src/ParseServerRESTController.js b/src/ParseServerRESTController.js index 12ee0a67..ed6145a9 100644 --- a/src/ParseServerRESTController.js +++ b/src/ParseServerRESTController.js @@ -58,8 +58,10 @@ function ParseServerRESTController(applicationId, router) { response => { if (options.returnStatus) { const status = response._status; + const headers = response._headers; delete response._status; - return { success: response, _status: status }; + delete response._headers; + return { success: response, _status: status, _headers: headers }; } return { success: response }; }, @@ -128,9 +130,9 @@ function ParseServerRESTController(applicationId, router) { }) .then( resp => { - const { response, status } = resp; + const { response, status, headers = {} } = resp; if (options.returnStatus) { - resolve({ ...response, _status: status }); + resolve({ ...response, _status: status, _headers: headers }); } else { resolve(response); }