Commit Graph

66 Commits

Author SHA1 Message Date
Corey
24e9bdc639 ci: Fix docker image pushing to Docker Hub (#7548)
* add actions file

* nit

* add multi-platform

* add buildx

* reduce platforms

* remove arm7

* add back arm7

* add missing archs

* remove failing image

* add back in linux/s390x

* switch image name to parse-server

* remove failing images

* nit spelling

* Nit

* add comment about nightly builds
2021-09-07 14:35:03 +02:00
Snyk bot
c3b71ba5b6 [Snyk] Upgrade ws from 7.4.6 to 7.5.3 (#7457)
* fix: upgrade ws from 7.4.6 to 7.5.0

Snyk has created this PR to upgrade ws from 7.4.6 to 7.5.0.

See this package in npm:
https://www.npmjs.com/package/ws

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

* changed logging for circular obj

* upgraded to ws 7.5.3

Co-authored-by: Manuel Trezza <5673677+mtrezza@users.noreply.github.com>
2021-07-25 01:54:28 +02:00
Jason Posthuma
d8dc524c08 Add check for property (#7421)
* Add check for property

* updated changelog

* Fixed logic returning false positive

* Added test case

* update change log
2021-06-21 16:11:15 -07:00
dblythy
51e08009f8 Fix: properly pass req.user to liveQuery triggers (#7296) 2021-05-02 11:23:46 +02:00
Perceval Archimbaud
87dcd23b6a Fix #7340 by correclty computing function name for push event (#7341)
* Add a failing test for issue #7340

If any delay occurs after "message.event" assignation in
LiveQueryServer._onAfterSave, the next subscription or request with a different
event might overwrite it, and by that using the wrong "push" function name.

* Remove updade of message and use res.event instead

This prevent computing function name from a
incorrect event if multiple subscriptions override
one by one the message.event.

* Update CHANGELOG.md

* Replace setTimeout by async/await expressions
2021-04-13 14:47:14 -07:00
dblythy
3d76643286 New: requireAnyUserRoles and requireAllUserRoles for Parse Cloud Validator (#7097)
* new: requireUserRole for Parse Cloud Validator

* change to requireUserRoles

* Update CHANGELOG.md

* revoke triggers

* Update triggers.js

* Update ParseLiveQueryServer.js

* Update ParseLiveQueryServer.js

* create requireUserRoles

* rename to requireAny and requireAll

* allow for a function
2021-02-12 14:01:38 -08:00
Diamond Lewis
1ede078154 fix(Logger): Handle interpolating stdout (#7114)
* fix(Logger): Handle interpolating stdout

* Update CHANGELOG.md
2021-01-11 09:20:21 -06:00
Diamond Lewis
93781b2195 feat(LiveQuery): Support $and, $nor, $containedBy, $geoWithin (#7113)
* feat(LiveQuery): Support $and, $nor, $containedBy, $geoWithin, $geoIntersects

* Update CHANGELOG.md

* Update CHANGELOG.md
2021-01-11 01:35:32 -06:00
dblythy
b13a6a4ed2 feat: include sessionToken in onLiveQueryEvent (#7043)
* feat: include user in onLiveQueryEvent

* Update ParseLiveQuery.spec.js

* increase coverage

* add space

* Update ParseLiveQuery.spec.js

* remove user from runLiveQueryEventHandlers
2020-12-03 18:36:41 -06:00
dblythy
0bf2e84f81 fix: consistent casing for afterLiveQueryEvent (#7023) 2020-11-24 13:58:35 -08:00
Diamond Lewis
e6ac3b6932 fix(prettier): Properly handle lint-stage files (#6970)
Now handles top level files and recursive files in folders.

Set max line length to be 100
2020-10-25 15:06:58 -05:00
Antonio Davi Macedo Coelho de Castro
78b59fb26b Merge pull request from GHSA-2xm2-xj2q-qgpj
* Test case and fixes

* Change requestTimeout default to 5s

* Document new function argument
2020-10-21 16:32:07 -07:00
dblythy
ef2e54c39d LiveQueryEvent Error Logging Improvements (#6951)
* LiveQueryEvent Improvements

* Update ParseLiveQueryServer.js

* Update ParseLiveQueryServer.js

* More Tests

* Update ParseLiveQueryServer.js

* Pass thrown errors to subscription

* Update ParseLiveQueryServer.js

* Update ParseLiveQueryServer.js

* Remove ACL error
2020-10-21 16:50:21 -05:00
dblythy
bf39cd68ef Create Cloud function afterLiveQueryEvent (#6859)
* Before Connect + Before Subscribe #1

* Cleanup and Documentation

* Add E2E tests

* Bump parse to 2.15.0

* Create afterLiveQueryEvent

* Revert "Create afterLiveQueryEvent"

This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43.

* afterLiveQueryEvent

* Add delete event

* Fix failing tests

* Fix lint

* Update ParseLiveQueryServer.js

* Remove Facebook AccountKit auth (#6870)

* Remove Facebook AccountKit auth

Account Kit services are no longer available.

https://developers.facebook.com/blog/post/2019/09/09/account-kit-services-no-longer-available-starting-march/

https://www.sinch.com/blog/facebook-account-kit-is-closing-down-are-your-apps-covered/

* remove flaky test

* fix: upgrade uuid from 8.2.0 to 8.3.0 (#6865)

Snyk has created this PR to upgrade uuid from 8.2.0 to 8.3.0.

See this package in npm:
https://www.npmjs.com/package/uuid

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* fix: package.json & package-lock.json to reduce vulnerabilities (#6864)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-LODASH-590103

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* fix: upgrade ldapjs from 2.0.0 to 2.1.0 (#6857)

Snyk has created this PR to upgrade ldapjs from 2.0.0 to 2.1.0.

See this package in npm:
https://www.npmjs.com/package/ldapjs

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* fix: upgrade apollo-server-express from 2.15.1 to 2.16.0 (#6851)

Snyk has created this PR to upgrade apollo-server-express from 2.15.1 to 2.16.0.

See this package in npm:
https://www.npmjs.com/package/apollo-server-express

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* fix: upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13 (#6845)

Snyk has created this PR to upgrade @graphql-tools/stitch from 6.0.12 to 6.0.13.

See this package in npm:
https://www.npmjs.com/package/@graphql-tools/stitch

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* fix: upgrade @graphql-tools/utils from 6.0.12 to 6.0.13 (#6846)

Snyk has created this PR to upgrade @graphql-tools/utils from 6.0.12 to 6.0.13.

See this package in npm:
https://www.npmjs.com/package/@graphql-tools/utils

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* [Snyk] Upgrade winston from 3.2.1 to 3.3.2 (#6799)

* fix: upgrade winston from 3.2.1 to 3.3.2

Snyk has created this PR to upgrade winston from 3.2.1 to 3.3.2.

See this package in NPM:
https://www.npmjs.com/package/winston

See this project in Snyk:
https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr

* fix tests

Co-authored-by: Diamond Lewis <findlewis@gmail.com>

* afterLiveQueryEvent

* Add delete event

* Fix failing tests

* Before Connect + Before Subscribe #1

* Cleanup and Documentation

* Create afterLiveQueryEvent

* Revert "Create afterLiveQueryEvent"

This reverts commit 828c678a6995216b843a75f5b3c864aec063ba43.

* Update ParseLiveQueryServer.js

* Rebase

* Remove return value / deduplicate tests

* Add docs

* Add additional data to trigger

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
Co-authored-by: Snyk bot <snyk-bot@snyk.io>
2020-10-19 10:38:55 -05:00
dblythy
44015c3e35 Before Connect + Before Subscribe help required (#6793)
* Before Connect + Before Subscribe #1

* Cleanup and Documentation

* Add E2E tests

* Bump parse to 2.15.0

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
2020-07-16 20:36:38 -05:00
Diamond Lewis
142eaa71bd Run Prettier JS #2 (#6796) 2020-07-13 15:13:08 -07:00
Diamond Lewis
e6a6354b29 Run Prettier JS (#6795) 2020-07-13 13:06:52 -05:00
greenkeeper[bot]
b1506995ad Update uuid to the latest version 🚀 (#6659)
* fix(package): update uuid to version 8.0.0

* chore(package): update lockfile package-lock.json

* remove deprecated uuid/v4

* use uuidv4 as default

Co-authored-by: greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>
Co-authored-by: Diamond Lewis <findlewis@gmail.com>
2020-04-30 05:21:51 +00:00
Diamond Lewis
ca1ae336c9 Websocket: unhandle rejection (#6418)
* Websocket: unhandle rejection

Closes: https://github.com/parse-community/parse-server/issues/6413, https://github.com/parse-community/parse-server/issues/6173
Prevent crashing on websocket error.

Bonus points to anybody who can post a specific payload that the client sends that returns an error.

* log the socket

* fix tests

* fix payload reference link
2020-02-19 01:30:23 -08:00
Diamond Lewis
5bf87d86bb Improve WebSocketServer Error Handling (#6230)
* Improve WebSocketServer Error Handling

Closes: https://github.com/parse-community/parse-server/issues/6173

Prevents an unhandled server rejection.

Includes an example for LiveQuery test and closing the proper connections.

Improve live query monitoring

* fix tests
2019-11-22 15:23:04 -06:00
Diamond Lewis
2533db0ad3 Fix installationId on LiveQuery connect (#6180)
Throws an error and prevents LiveQuery from reconnecting.

Fixes Monitoring installationId.
Allow installationId to be sent to and from client.
2019-11-04 15:53:13 -06:00
Diamond Lewis
3ab9dcdfd0 Improve Live Query Monitoring (#5927)
* Improve Live Query Monitoring

* typo
2019-08-16 11:38:24 -07:00
Diamond Lewis
cf6e79ee75 Fix: Lint no-prototype-builtins (#5920)
* Fix: Lint no-prototype-builtins

Closes: https://github.com/parse-community/parse-server/issues/5842

Reference: https://eslint.org/docs/rules/no-prototype-builtins

* replace Object.hasOwnProperty.call
2019-08-14 14:57:00 -07:00
Douglas Muraoka
ef14ca530d GraphQL Object constraints (#5715)
* GraphQL Object constraints

Implements the GraphQL Object constraints, which allows us to filter queries results using the `$eq`, `$lt`, `$gt`, `$in`, and other Parse supported constraints.
Example:
```
query objects {
  findMyClass(where: {
    objField: {
      _eq: {
        key: 'foo.bar',
        value: 'hello'
      },
      _gt: {
        key: 'foo.number',
        value: 10
      },
      _lt: {
        key: 'anotherNumber',
        value: 5
      }
    }
  }) {
    results {
      objectId
    }
  }
}
```
In the example above, we have the `findMyClass` query (automatically generated for the `MyClass` class), and a field named `objField` whose type is Object. The object below represents a valid `objField` value and would satisfy all constraints:
```
{
  "foo": {
    "bar": "hello",
    "number": 11
  },
  "anotherNumber": 4
}
```
The Object constraint is applied only when using Parse class object type queries. When using "generic" queries such as `get` and `find`, this type of constraint is not available.

* Objects constraints not working on Postgres

Fixes the $eq, $ne, $gt, and $lt constraints when applied on an Object type field.

* Fix object constraint field name

* Fix Postgres constraints indexes

* fix: Object type composed constraints not working

* fix: Rename key and value fields

* refactor: Object constraints for generic queries

* fix: Object constraints not working on Postgres
2019-08-02 12:18:07 -07:00
Antonio Davi Macedo Coelho de Castro
bde96a9002 Fix live query (#5871)
* Fix live query

* fix test
2019-07-30 22:40:54 -05:00
Diamond Lewis
218c3499f9 Implement WebSocketServer Adapter (#5866)
* Implement WebSocketServerAdapter

* lint

* clean up
2019-07-30 09:05:41 -05:00
Zeal Murapa
4f21c36825 Update ParseWebSocketServer.js (#5860)
* Update ParseWebSocketServer.js

fix wss:// error by requiring 'ws' module, remove uws as it has been deprecated and removed from npm

* Update ParseWebSocketServer.js

* remove uws
2019-07-28 22:17:09 -05:00
Diamond Lewis
af6c44eca4 Handle LiveQuery create event with fields (#5790)
Close:  https://github.com/parse-community/parse-server/issues/5764

Fix logic handling null original object
2019-07-10 10:14:55 -05:00
ananfang
fa97df5f4e Decode Date JSON value at LiveQuery (#5540) 2019-04-30 13:00:23 -05:00
Diamond Lewis
ce7ff2ca44 Add original object to LiveQuery Events (#5265)
* Add original object to LiveQuery Events

* change response original
2018-12-28 17:56:08 -05:00
Diamond Lewis
99698928af Fix for #5207 (#5257) 2018-12-23 19:40:59 -06:00
Florent Vilmart
4b7037ac9a Fix intense CPU usage when sessionToken is invalid in liveQuery (#5126)
* Ensure we bail out early when auth or userId are not provided (sessionToken fetch is invalid)

* Adds changelog

* better handling of session token errors and client tokens
2018-10-18 07:21:31 -04:00
Florent Vilmart
7c81290252 Live query CLP (#4387)
* Auth module refactoring in order to be reusable

* Ensure cache controller is properly forwarded from helpers

* Nits

* Adds support for static validation

* Adds support for CLP in Live query (no support for roles yet)

* Adds e2e test to validate liveQuery hooks is properly called

* Adds tests over LiveQueryController to ensure data is correctly transmitted

* nits

* Fixes for flow types

* Removes usage of Parse.Promise

* Use the Auth module for authentication and caches

* Cleaner implementation of getting auth

* Adds authCache that stores auth promises

* Proper testing of the caching

* nits
2018-10-17 17:53:49 -04:00
Florent Vilmart
d83a0b6808 Use Prettier JS (#5017)
* Adds prettier

* Run lint before tests
2018-09-01 13:58:06 -04:00
Florent Vilmart
ff25ae254d Update parse SDK to 2.0.0 (#4925)
* WIP: Integrate JS SDK v2

- Removes backbone style callbacks
- Use Promise instead of Parse.Promise

* Fixes ParseObject and ParseRelation

* Updates Parse.Query with promises

* Alls tests should pass

* Ensure a fresh user is used for each test

* Use REST implementation to avoid side effects for username/email duplicates

* Uses js sdk v2
2018-08-05 13:58:07 -04:00
fridays
8be7491595 Fix server crash on invalid LiveQuery socket event (#4533)
* add failing test for missing command message

* don't mock tv4.validate

* fix existing tests

* make request.op required

* Update comment
2018-02-16 08:40:04 -05:00
Florent Vilmart
9de4b8b2a7 Refactors configuration management (#4271)
* Adds flow types / Configuration interfaces

* Lets call it options

* Use a single interface to generate the configurations

* Translates options to definitions only if comments are set

* improves logic

* Moves objects around

* Fixes issue affecting logging of circular objects

* fixes undefined env

* Moves all defaults to defaults

* Adds back CLI defaults

* Restored defaults in commander.js

* Merge provided defaults and platform defaults

* Addresses visual nits

* Improves Config.js code

* Adds ability to pass the default value in trailing comments

* Load platform defaults from the definitions file

* proper default values on various options

* Adds ParseServer.start and server.start(options) as quick startup methods

* Moves creating liveQueryServer http into ParseServer.js

* removes dead code

* Adds tests to guarantee we can start a LQ Server from main module

* Fixes incorrect code regading liveQuery init port

* Start a http server for LQ if port is specified

* ensure we dont fail if config.port is not set

* Specify port

* ignore other path skipped in tests

* Adds test for custom middleware setting

* Refactors new Config into Config.get

- Hides AppCache from ParseServer.js, use Config.put which validates

* Extracts controller creation into Controllers/index.js

- This makes the ParseServer init way simpler

* Move serverURL inference into ParseServer

* review nits
2017-10-23 08:43:05 -04:00
Florent Vilmart
2a168936fc Adds support for pointer/string pointers comparison in LiveQuery (#4231)
* Adds support for pointer/string pointers comparison in LiveQuery

* nits

* Makes sure needed is set

* Update QueryTools.js

* Update QueryTools.js
2017-10-03 13:50:20 -04:00
Florent Vilmart
8d8a8b250e Fixes issue affecting liveQuery on location null/undefined values (#4171) 2017-09-17 11:57:11 +03:00
Florent Vilmart
d0184f438d Live Query basic monitoring (#4168)
* Adds uuid based client identification to prevent overflows

* no-super

* Adds cloud code monitoring

* fixes test

* nit
2017-09-15 17:20:51 -04:00
Jeremy May
121d151af9 Add master key override to live query ACL checks (#4133)
* Add master key override to live query ACL checks

* Fix mockClient so masterKey tests work correctly
2017-09-09 13:26:18 -04:00
greenkeeper[bot]
e94991b368 Update dependencies to enable Greenkeeper 🌴 (#3940)
* chore(package): update dependencies

* docs(readme): add Greenkeeper badge

* Fix indent issues with eslint 4.0

see http://eslint.org/docs/user-guide/migrating-to-4.0.0\#-the-indent-rule-is-more-strict
2017-06-20 09:15:26 -07:00
David Starke
a520ea0243 Fix LiveQuery unsafe user (#3525)
* LiveQuery should not use unsafe user setting

* server should issue queries with the master key
2017-02-18 19:36:20 -05:00
Florent Vilmart
c26db2248f use uWS as optional dependency for ws server (#3231)
* use uWS as optional dependency for ws server

* Update ParseWebSocketServer.js
2017-01-14 07:43:31 -08:00
Arthur Cinader
4cb6e7d209 Add lint rule space-infix-ops (#3237)
Disallows: 1+1.  Must be 1 + 1.
2017-01-11 12:31:40 -08:00
David Starke
df029b82eb LiveQuery should match subobjects with dot notation (#3322)
* LiveQuery should match subobjects with dot notation

* one additional test case
2017-01-06 17:06:25 -08:00
Arthur Cinader
ca286b7108 Enable prefer-const lint rule (#3202) 2016-12-07 18:17:05 -05:00
Arthur Cinader
11f7712651 Add no trailing whitespace and force eol at end of file. (#3154) 2016-12-01 13:24:46 -05:00
Florent Vilmart
6676c6a4b9 Let multiple installations be updates if no critical values are set (#3040)
* Let multiple installations be updates if no critical values are set

* nits
2016-11-28 13:11:54 -05:00
Antonio Davi Macedo Coelho de Castro
6264f99ad5 Concat appId to PubSub channel (#3043) 2016-11-28 09:15:21 -05:00