Commit Graph

813 Commits

Author SHA1 Message Date
Paulo Reis
cb8f038ca8 #4338 pg schema upgrade (#4375)
* Method to upgrade schemas in Postgres;

Adds:
  - schemaUpgrade method which check the fields to add and delete from old schema;

* Remove the columns delete in schemaUpgrade method;

* ESLint fix and PostgresStorageAdapter.schemaUpgrade spec test

Adds:
  - Add PostgresStorageAdapter.schemaUpgrade spec tests: creates a table,
    simulates the addition of a new field and checks if its present in the database
Chores:
  - ESLint eol-last fix;

* Add check columns before and after schema upgrade, and remove the unnecessary piece of code

Add:
  - Check the right columns is present before schema upgrade and the new field is not,
    then check if the right columns is present and the new field;
Remove:
  - Piece of code unnecessary because it not need to remove diff columns;

* Optimize the schemaUpgrade method following @vitaly-t instructions, and more tests;

* If the class does not have any columns and needs an upgrade the code would
return without doing so. Fixed this.

Chore:
  - Allows class with no column to be upgraded;
  - Test for class with no columns being upgraded;

* Update PostgresStorageAdapter.js

rewriting method schemaUpgrade

* Update PostgresStorageAdapter.spec.js

* Update PostgresStorageAdapter.spec.js
2018-01-03 03:23:05 +00:00
Florent Vilmart
10631371e6 Introduces flow types for storage (#4349)
* Introduces flow types for storage

* Better typing of QueryOptions

* Adds flow types to SchemaCOntroller,

- runs flow on pre tests
- fixes flow

* Adds ClassLevelPermissions type

* Moves Controller types into a single file

* Changes import styles

* Changes import styles

* fixing method setIndexesWithSchemaFormat (#4454)

Fixing invalid database code in method `setIndexesWithSchemaFormat`:

* It must be a transaction, not a task, as it executes multiple database changes
* It should contain the initial queries inside the transaction, providing the context, not outside it;
* Replaced the code with the ES6 Generator notation
* Removing the use of batch, as the value of the result promise is irrelevant, only success/failure that matters

* nits

* Fixes tests, improves flow typing
2017-12-30 20:44:18 -05:00
Diamond Lewis
6143988a82 Support pointer in distinct query (#4471)
* Support pointer in distinct query

* extract transform pointer string
2017-12-29 21:32:40 -06:00
Benjamin Wilson Friedman
7a9d4044af Scrub Passwords with URL Encoded Characters (#4433)
* scrub passwords with url encoded characters from logs

* compose query string from parsed params, redacting based on key if needed
2017-12-29 13:16:32 -05:00
Diamond Lewis
04f8673edd PG: Support for multiple projection in aggregate (#4469) 2017-12-29 17:39:16 +00:00
Florent Vilmart
bad217911c Adds ability to login with email when provided as username (#4420) 2017-12-12 08:49:45 -05:00
Florent Vilmart
1f22ee36e7 Release 2.7.1
(#4410)
* Adds failing test for 4409

* Adds fix

*  Release 2.7.1
2017-12-01 09:16:58 -05:00
Arthur Cinader
ca542c3750 Fix test name to match what's tested 2017-11-30 12:40:39 -08:00
Arthur Cinader
1876d3f3fd Add doesNotMatchKeyInQuery case... 2017-11-30 12:40:39 -08:00
Henrik Malmberg
4ceff38811 added test for dot-notation in matchesKeyInQuery 2017-11-30 12:40:39 -08:00
Diamond Lewis
4bccf96ae7 Add Indexes to Schema API (#4240)
* Add Indexes to Schema API

* error handling

* ci errors

* postgres support

* full text compound indexes

* pg clean up

* get indexes on startup

* test compound index on startup

* add default _id to index, full Text index on startup

* lint

* fix test
2017-11-25 15:39:31 -05:00
Benjamin Wilson Friedman
219ad7224a Fixes sessionTokens being overridden in 'find' (#4332)
* remove session token replacement code

* adds cases for _User/_Session with sessionToken and with/without masterKey
2017-11-25 15:28:08 -05:00
Benjamin Wilson Friedman
7944e2bd2d Remove hidden properties from aggregate responses (#4351)
* Remove hidden properties from aggregrate responses

* transform results from mongo & postgres

* Adjust ordering to comply with tests
2017-11-22 23:07:45 -08:00
CHANG, TZU-YEN
8bf6abfee3 Patch handleShutdown feature (#4361)
* Add handleShutdown Test of MongoStorageAdapter.

* Add `handleShutdown` function in PostgresStorageAdapter, with it's test.

* Replace the _pgp to _client

* Use  `adapter._client.$pool.ending` to ckeck is ending

* Add `handleShutdown()` in ParseServer.spec.js

* Trigger

* Set Server to Default
2017-11-18 15:20:19 -05:00
Florent Vilmart
de73f3723c Scoped packages (#4354)
* Updates for scoped packages dependencies

* bumps s3 adapter

* Update README.md

* Update README.md

* Update README.md
2017-11-17 08:32:58 -05:00
Florent Vilmart
09fee7d12b Adds optimization for related relations (#4345)
* Adds optimization for related relations

* Makes MongoStorageAdapter only able to sort on Join tables
2017-11-14 14:46:51 -05:00
Diamond Lewis
7223add446 Support for Aggregate Queries (#4207)
* Support for Aggregate Queries

* improve pg and coverage

* Mongo 3.4 aggregates and tests

* replace _id with objectId

* improve tests for objectId

* project with group query

* typo
2017-11-12 14:00:22 -05:00
Bryan de Leon
4e207d32a7 Fix for unhandled undefined config in reset password pages (#4334)
* Fix for unhandled undefined config

When an invalid application id is passed either for reset/change password or email verification, config.get returns undefined. This causes internal server.

* Throwing a 403 exception instead of returning a 404 for an invalid app id

Also, added a missing semicolon

* Fix indent issues

* Fix invalid colon to semicolon

* Fix space and indent issues

* Tests for the fix for unhandled undefined config
2017-11-11 09:42:20 -05:00
Florent Vilmart
72e20be06d fix #3451 duplicate session upon login (#4337)
* Adds failing test for #3451 (on multiple logins)

* Factor sessionDestruction as part of Session creation flow in RestWrite

* nits
2017-11-11 09:41:23 -05:00
Tom
932a474606 Remove hidden properties in handleLogin & handleMe (#4335) 2017-11-09 17:48:50 -08:00
Benjamin Wilson Friedman
c1a7347143 Fix for _PushStatus Stuck 'running' when Count is Off (#4319)
* Fix for _PushStatus stuck 'running' if count is off

* use 'count' for batches

* push worker test fix
2017-11-05 13:04:46 -05:00
Benjamin Wilson Friedman
c0a81a88b7 Structured /health Response (#4305)
* modifies /health to return json instead of OK

* version removed!
2017-11-03 11:51:46 -04:00
Benjamin Wilson Friedman
46af1b6955 Adds Relative Time options now,weeks & years (#4304)
* Adds 'now' as an option in relative time

* reenables no-console in previous spot

* Adds weeks,months,years and abbreviations

* modified tests to address coverage

* month be gone!
2017-11-01 13:31:08 -07:00
marvelm
6f1fe89948 Relative time queries (#4289)
* Add relative time queries

* Encode successful result

* Add integration test

* Add more error cases

* Remove unnecessary new Date

* Error when time has both 'in' and 'ago'

* naturalTimeToDate -> relativeTimeToDate

* Add $relativeTime operator

* Throw error if $relativeTime is invalid

* Add integration test for invalid relative time

* Exclude $exists query

* Only run integration tests on MongoDB

* Add it_only_db test helper
bd2ea87c1d/CONTRIBUTING.md (L23)

* Handle where val might be null or undefined

* Add integration test for multiple results

* Lowercase text before processing

* Always past if not future

* Precompute seconds multiplication

* Add shorthand for interval
hr, hrs
min, mins
sec, secs

* Throw error if $relativeTime is used with $exists, $ne, and $eq

* Improve coverage for relativeTimeToDate

* Add test for erroring on floating point units

* Remove unnecessary dropDatabase function

* Unit test $ne, $exists, $eq

* Verify field type

* Fix unit test for $exists
Unnest query object
2017-10-26 16:23:27 -04:00
Florent Vilmart
1dd58b7527 Adds support for read-only masterKey (#4297)
* Adds support for read-only masterKey

* Adds tests to make sure all endpoints are properly protected

* Updates readme

* nits
2017-10-26 15:35:07 -04:00
Benjamin Wilson Friedman
87b79cedfa Handle possible afterSave exception (#4293)
* capture and log exceptions caused by afterFind

* Wording

* Consolidated promise chaining

* use logger instead of console
2017-10-26 14:28:13 -04:00
marvelm
8a23c00265 Add support for expiration interval in Push (#4202)
* Add support for expiration_interval in Push

* Support expiration_interval for immediate pushes

* Test

* Add 'expiration_interval' to _PushStatus class

* Fix coverage
2017-10-25 17:30:20 -04:00
Florent Vilmart
72888bc539 Adds ability to login with email when specifying it (#4276)
* Adds ability to login with email when specifying it

* Adds tests for corner cases

* nits
2017-10-24 17:50:48 -04:00
Benjamin Wilson Friedman
0db858b04c Enables login over POST in addition to GET (#4268)
* Enables login over POST in addition to GET

* Removes explcit method:POST as rp.post does this naturally
2017-10-24 15:47:26 -04: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
e4eeadd4c6 Bumps parse sdk 1.10.1 (#4274)
* Fail test case for Issue#3999

* no message

* Bumps Parse to 1.10.1

Updates Polygon test suite to leverage latest version
2017-10-21 16:03:24 -04:00
Gustav Ahlberg
70ad9e9ffd Add request ip to request object (#4265)
* add the client ip to the request config object

* add the config ip to the trigger request object

* add the config ip to the functions request object

* add tests

* remove log

* remove log
2017-10-18 08:13:09 -04:00
Benjamin Wilson Friedman
9376b4d04a Validate serverURL on Start (#4204)
* Added basic validation of publicServerURL

* Fixed up 'verifyServerUrl' and added tests

* Use Parse.serverURL instead, general cleanup.

* Test server port moved to 13376

* Removed reconfigureServer calls with simple changing of Parse.serverURL

* changed var to const

* Disabled automatic serverURL verification during testing, moved verification call into app.on('mount') callback, removed setTimeout from verification.
2017-10-17 14:49:28 -04:00
Benjamin Wilson Friedman
315d30b426 Fix for beforeSave with increment causing key to be Dropped (#4259)
* Fixes an issue where a beforeSave hook could cause a numeric val to be dropped in response.

* Use hasOwnProperty to check instead

* Remove redundant set
2017-10-15 21:15:30 -07:00
Benjamin Wilson Friedman
9145c88562 Corrected outdated links (#4254) 2017-10-12 22:40:47 -04:00
Florent Vilmart
7fac070435 Allow queries with String array for pointers containedIn (#4188)
* Adds basic failing test

* Adds ability to use [objectId] for $in/$nin pointers

* makes sure to use a set field

* Makes sure field is defined
2017-10-03 13:50:39 -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
Chris Norris
23bffc8883 Add maxLimit server configuration (#4048)
* Add maxLimit server configuration

* Fix maxlimit validation logic to correctly handle maxLimit:0 case
2017-10-02 09:23:09 -04:00
Florent Vilmart
b703ec8a79 Fix for #4194 - me no likey much (#4198)
* Adds failing test for #4194

* Use the rest module instad of the Parse._request

- Some users have an invalid serverUrl passed in the options

* removes console.logs, fixes tests that leveraged Parse._request
2017-09-22 12:05:06 -04:00
Diamond Lewis
9371958a09 Postgres: Properly handle undefined field values (#4186)
Prevents `UnhandledPromiseRejectionWarning: Unhandled promise rejection` when building queries.
2017-09-19 07:59:48 -04:00
Anthony Mosca
cf630ba462 Updating with two GeoPoints fails correctly. (#4162) 2017-09-19 07:12:40 -04:00
marvelm
07ae85eef0 Prefix default push channel with applicationId (#4182) 2017-09-18 15:25:03 -04:00
Florent Vilmart
a5ce9fc175 Refactor pushStatusHandler to use Parse instead of direct access (#4173)
* Refactors pushStatusHandler to use HTTP interface so we can bind CloudCode hooks

* Handle correctly nested dot atomic operations

* Better handling of restricted class names, add support for afterSave _PushStatus

* Adds simple testing for afterSave(PushStatus)

* Reverts jobStatusHandler

* Addresses fixes

* adds delays to all methods
2017-09-18 15:01:07 -04:00
Florent Vilmart
a39d045c7d Fixes issue #4150: Session management (#4152)
* Adds tests

* Provide fix

* Fix post sessions (#4167)

* add tests

* provide fix

* remove console.log
2017-09-18 14:53:11 -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
Florent Vilmart
d598d73f36 Adds ability to track sent/failed PerUTCOffset in the PushWorker (#4158)
* Adds ability to track sent/failed PerUTCOffset in the PushWorker

- for scheduled push notifications at a certain time, it helps keep track of the state

* Makes sure we track it all correctly

* Adds to Postgres
2017-09-13 17:28:20 -04:00
Florent Vilmart
3a17904ce8 Push: Cleanup invalid device tokens (#4149)
* Adds collecting invalid / expired device tokens from GCM / APNS

* Cleanup invalid installations based on responses from the adapters

* Adds test for cleanup

* Adds tests for removal
2017-09-12 14:53:05 -04:00
Anthony Mosca
4dce3bd63c Add support for more audience fields. (#4145)
* Add support for more audience fields.

* Only update audience when defined audience_id.
2017-09-11 22:06:21 -04:00
Florent Vilmart
a660a0c25f fix: Issue #4142 (#4144)
* Tweaks test in order to show the error

- Session is effectively created when it should not

* Do not create a session when users need verified accounts on signup
2017-09-11 11:07:39 -04:00