Commit Graph

1116 Commits

Author SHA1 Message Date
Florent Vilmart
461ca5d3fe Even faster tests (#4868)
* Various improvements in test name / de-duplications

* Reverts to class by class deletion, introduced fast mode that just delete data for mongo

- Speeds up are incredible Executed 1695 of 1713 specs INCOMPLETE (18 PENDING) in 4 mins 19 secs.

* Adds documentation about the deleteEverything
2018-08-12 17:49:09 -04:00
Florent Vilmart
305e4ba445 Removes need to use babel-register (#4865)
* Removes need to use babel-register

- Adds watch to watch changes when running the test to regenerate
- Tests are now pure node 8

* Adds timing to helper.js

* Update contribution guide

* Adds inline sourcemaps generation to restore coverage

* nits
2018-08-12 17:49:09 -04:00
Florent Vilmart
96bc74433b Testing improvements (#4863)
* Adds supports-color so spec reporter dont output colors when not supported

* Adds babelrc so breakpoints dont jump around in specs

* Rename test to avoid duplicated name

* Removes unused methods

* Better naming for it_exclude
2018-08-12 17:49:09 -04:00
Florent Vilmart
7319aabf7a improves test performance on mongodb (#4862)
* improves test performance on mongodb

* Removes unused methdos
2018-08-12 17:49:09 -04:00
Florent Vilmart
6b36ce1bb5 Ensure User ACL's are more flexible and secure #3588 (#4860)
* Fixes an issue that would let the beforeDelete be called when user has no access to the object

* Ensure we properly lock user

- Improves find method so we can attempt to read for a write poking the right ACL instead of using masterKey
- This ensure we do not run beforeDelete/beforeFind/beforeSave in the wrong scenarios

* nits

* Caps insufficient
2018-08-12 17:49:09 -04:00
Chris
43be9fed9d #4678: Converting strings to Date when schema.type is Date within agg… (#4743)
* #4678: Converting strings to Date when schema.type is Date within aggregate function

* Added test cases to test new date match aggregate query

* Added function to parse match aggregate arguments and convert necessary values to Date objects

* Added missing return value

* Improved code quality based on suggestions and figured out why tests were failing

* Added tests from @dplewis

* Supporting project aggregation as well as exists operator

* Excluding exists match for postgres

* Handling the $group operator similar to $match and $project

* Added more tests for better code coverage

* Excluding certain tests from being run on postgres

* Excluding one more test  from postgres

* clean up
2018-08-12 17:49:09 -04:00
Diamond Lewis
df01846361 Aggregate allow multiple of same stage (#4835)
* Aggregate Allow Multiple Stages

* remove testing files

* nit

* spread them
2018-08-12 17:49:09 -04:00
Diamond Lewis
197190fc29 nit 2018-08-12 17:49:09 -04:00
Diamond Lewis
48ddcdb303 add includeAll option 2018-08-12 17:49:09 -04:00
Johnny
c8b303a9d2 Added verify password to users router and tests. (#4747)
* Added verify password to users router and tests.

* Added more tests to support more coverage.

* Added additional tests to spec. Removed condition from verifyPassword function where authData null keys condition wasn't necessary.

* Removed POST handling from verifyPassword.

* Refactored handleLogin and handleVerifyPassword to use shared helper function to validate the password provided in the request.

* Refactored verifyPassword and login to not use try/catch. Parent promise returns the error. Moved login specific functions to login handler.

* Added account lockout policy to verify password function. Added test spec for account lockout in verify password.

* no message

* Merged new changes from master. Made changes as requested from comments.

* We cannot remove hidden properties from the helper before returning to the login function. The password expiration check in the login function is dependent on some hidden properties, otherwise three password policy tests fail.
2018-08-12 17:49:09 -04:00
Florent Vilmart
4d81f8fc30 Ensure read preference is never overriden, so DB config prevails (#4833) 2018-08-12 17:49:09 -04:00
Manuel
cddb924703 add support for geoWithin.centerSphere queries via withJSON (#4825)
* add support for geoWithin.centerSphere queries via withJSON

* added test for passing array of lat, lng instead of Parse.GeoPoint

* added postgres support

* added more tests

* improved tests and validation

* added more tests
2018-08-12 17:49:09 -04:00
Arthur Cinader
f2f92858f1 Change name of function and variable from baseFieldName to rootFieldName (#4817) 2018-08-12 17:49:09 -04:00
Arthur Cinader
1427eeac5a Don't error when attempting to sort on an object field (#4806)
* add failing test to demonstrate that you can't sort on a
field in an object.

* Only validate the base of the field name.

* fix test name

* Only test sort for mongo.

* pg order by nested object

* level 2 test

* Factor out operation to get a field's base name.  Add comment.

* tweak comment wording so it wont make my grammar teacher angry.
2018-08-12 17:49:09 -04:00
Jaeger
348489784a Don't merge JSON fields after save() when using Postgres to keep same behaviour as MongoDB (#4808) (#4815) 2018-08-12 17:49:09 -04:00
Florent Vilmart
d15a3ce8f5 Adds exposed headers to avoid issue in JS SDK (#4934)
* Adds exposed headers to avoid issue in JS SDK

* Adds test for headers
2018-08-07 11:19:49 -04:00
Tyler Brock
c5e8470e36 Always use http-agent for hooks and triggers (#4800) 2018-06-01 09:31:10 -04:00
Florent Vilmart
9bff44b446 Ensure users with undefined ACL are treated as readable (#4795)
* Adds test to reproduce issue #4790

* Attempt to allow failure on node STABLE

* Use new format for apt packages
2018-05-30 12:55:15 -04:00
Tyler Brock
f4422c491e Update defs for new hookKeepAlive config option (#4794)
All tests pass on re-run. :-)
2018-05-29 17:30:26 -07:00
Tyler Brock
82fb06f9c9 Use http agents for hook requests (#4791) 2018-05-29 17:48:06 -04:00
Mads Bjerre
57da2def1d Adds withinPolygon support for Polygon object (#4067)
* Whitespace

* Add Polygon type to $polygon query

* Add tests

Polygon object in $polygon query
$geoIntersects queries

* Refactor

* Postgres support

* More tests

* Remove duplicate test

* Missing semicolon

* fix tests
2018-05-22 12:06:43 -04:00
Jérémy Piednoel
77ed10f57b Adding $nor operator support (#4768)
* adding nor to specialQuerykeys

* adding nor suport

* adding test

* CRLF

* adding postgres NOR

* adding nor validation

* adding NOR test

* adding test amd fixing NOR cases

* revert the nor logic
2018-05-18 14:26:33 -05:00
Saulo Tauil
95550f4c77 Making response.error accept a Parse.Error object as parameter (#4695) 2018-05-18 10:15:25 -04:00
Florent Vilmart
fc47f9b84f issue(afterFind): Fixes issue when using afterFind with relations (#4752)
* Adds failing test for the issue

* Adds fix for the issue
2018-05-18 09:36:56 -04:00
Jérémy Piednoel
c0f86ae1d1 Adding Mongodb element to add arrayMatches the #4762 (#4766)
* Adding elemMatch and nor

* lint

* adding test

* adding edge test

* postgres support

* clean up

* empty test
2018-05-18 08:35:50 -05:00
Florent Vilmart
ad244d6654 feature: User Lockout (#4749)
* Allows masterKey to lock _User object and prevent login with email / password

* Ensure the authData based auth can be locked out as well when accounts is masterKey only
2018-05-16 15:40:02 -04:00
Eduard Bosch Bertran
c0e3672e32 New query condition support to match all strings that starts with some other given strings (#3864)
* feat: Convert $regex value to RegExp object

* feat: Add lib folder

* Revert "feat: Add lib folder"

This reverts commit c9dfbcbf699ff220baeb2df5586a944d19808e5e.

* feat: Add $regex test in $all array

* test: Test regex with $all only in MongoDB

* Revert "test: Test regex with $all only in MongoDB"

This reverts commit d7194c7869dee98d924fbc2502593a198385dba1.

* feat: Add tests for containsAllStartingWith

* feat: Add postgres support

Thanks to @dplewis

* feat: Check that all values in $all must be regex or none

* test: Check that $all vaules must be regex or none

* feat: Update tests to use only REST API

* refactor: Move $all regex check to adapter

* feat: Check for valid $all values in progres

* refactor: Update function name

* fix:  Postgres $all values regex checking

* fix: Check starts with as string

* fix: Define contains all regex sql function

* fix: Wrong value check

* fix: Check valid data

* fix: Check regex when there is only one value

* fix: Constains all starting with string returns empty with bad params

* fix: Pass correct regex value

* feat: Add missing tests

* feat: Add missing tests

* feat: Add more tests

* fix: Unify MongoDB and PostgreSQL functionality

* fix: Lint checks

* fix: Test broken

$regex in $all list must be { $regex: "string" }

* test for empty $all
2018-05-15 20:42:32 -05:00
Florent Vilmart
fad7b46c65 chore: Fixes issue related to flow types (#4724)
* Fixes issue related to flow types

* Improves type inference on where clause, index

* run parse-server start on liveQueryServer only on mongo, state leaks on postgres
2018-05-01 07:37:38 -04:00
Claire Neveu
04588bccb9 Allow creation of indices on default fields (#4738)
* Allow creation of indexes on default fields

* Update test

* Try to address flaky cache test
2018-04-25 16:06:10 -07:00
oleg
b1017ac17c Send version for Vkontakte API (#4725) 2018-04-15 15:09:28 -04:00
dblythy
22801d2d8f Ensure we respond with invalid password even if email is unverified (#4708) 2018-04-11 15:39:32 -04:00
Jong Eun Lee
b0bcbd8731 add _password_history to default sensitive data (#4699) 2018-04-10 13:54:35 -04:00
Diamond Lewis
0fd8493929 Fix purging empty class (#4676)
* Fix purging empty class

* remove fit
2018-03-25 08:41:25 -05:00
Diamond Lewis
710848938f PG: Fixes issues comparing to zero or false (#4667)
* initial test

* more test

* clean up

* added correct errors

* test fix

* $eq null test

* type check
2018-03-24 17:45:34 -05:00
SebC
6abf29dd97 Remove FB Graph API version from URL to use the oldest non deprecated version (2.5 for now, which will be deprecated soon) (#4650) 2018-03-15 14:05:41 -05:00
Diamond Lewis
c36ef99368 Fix Aggregate Match Pointer (#4643) 2018-03-14 21:57:30 -05:00
Diamond Lewis
c6bc81caef Mongo: Fix reversing polygon coordinates (#4609)
* Fix reversing polygon coordinates

* comments fix

* real data test

* improved tests
2018-03-10 14:27:03 -06:00
AreyouHappy
d768211ab9 fix purge command issue affecting readonly masterKey (#4619) (#4621) 2018-03-10 10:07:31 -05:00
Arthur Cinader
d19ac077b6 Live query defaults reference ParseServer instead of LiverQuery server. (#4613)
* fix workding for live query defaults help

* generate the definition file.
2018-03-08 17:30:18 -05:00
Diamond Lewis
f0674df424 Fixes Issue unsetting in beforeSave doesn't allow object creation (#4610)
* skip unset fields on canAddField

* removed fit

* add null check
2018-03-08 10:31:53 -06:00
Florent Vilmart
60eea59c76 Handle mongodb auth errors that may occur after running the server for a while (#4576) 2018-03-02 10:24:58 -05:00
Diamond Lewis
d8f3fb16bd Skip afterFind for Aggregate and Distinct Queries (#4596) 2018-02-28 19:32:01 -06:00
6thfdwp
213801c4b1 auth: add adapter for Facebook accountkit login (#4434)
* Integrate auth adapter for Facebook accountkit login

* Also verify Facebook app id associated with account kit login

* Add appsecret_proof as extra graph request parameter

* Specific error message for Account kit and more test coverage

* One more test to cover when AppIds for Facebook account kit not configured properly
2018-02-23 07:37:55 -05:00
Florent Vilmart
11c40dce97 Adds session creation code in Auth.js (#4574) 2018-02-19 11:15:54 -05:00
Diamond Lewis
143b0f01cf PG: Add dates to group aggregate (#4549)
* PG: Add dates to group aggregate

* returns dates as UTC
2018-02-16 12:41:02 -06:00
Diamond Lewis
848a6cf7ae Distinct support for null (#4559)
* distinct support for null

* better testing
2018-02-16 10:44:42 -05: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
Diamond Lewis
3cd77eeb7c duplicate value on unique index error (#4560) 2018-02-09 07:39:35 -06:00
Tyson Andre
83a0d7b685 Fix "undefined property '__op'" in postgres update (#4541)
* Fix "undefined property '__op'" in postgres update

This causes a TypeError which becomes a regular Error,
before the update can be issued. (I think)

This happens when there is an object schema,
and there is also an unrelated field in originalUpdate
which is null or undefined.

e.g. when 'location' is a mandatory object in postgres,
and 'middleName' is an optional string,
PostgresStorageAdapter would throw when a query similar
to the below was performed:
(Object.keys(originalUpdate) would include "middleName" as a value of `k`)

    query.set('location', {'country': 'US'})
    query.set('middleName', undefined);

* Fix lint error
2018-02-07 08:16:54 -05:00
Benjamin Wilson Friedman
db8594dd33 Regenerate Email Verification Token on Email Request (#4439)
* regenerate email verification token & expiration in /verificationEmailRequest

* Remove password field when saving on postgres
2018-02-01 18:35:08 -05:00