Commit Graph

25 Commits

Author SHA1 Message Date
Diamond Lewis
370215a39b Support Metadata in GridFSAdapter (#6660)
* Support Metadata in GridFSAdapter

* Useful for testing in the JS SDK
* Adds new endpoint to be used with `Parse.File.getData`
* Allows file adapters to return tags as well as future data.

* fix tests

* Make getMetadata optional

* Revert "fix tests"

This reverts commit 7706da13c688027483974e854b5b24321fb070cd.

* improve coverage
2020-05-08 15:32:20 -05:00
stevestencil
a9dba442b1 Add file triggers and file meta data (#6344)
* added hint to aggregate

* added support for hint in query

* added else clause to aggregate

* fixed tests

* updated tests

* Add tests and clean up

* added beforeSaveFile and afterSaveFile triggers

* Add support for explain

* added some validation

* added support for metadata and tags

* tests?

* trying tests

* added tests

* fixed failing tests

* added some docs for fileObject

* updated hooks to use Parse.File

* added test for already saved file being returned in hook

* added beforeDeleteFile and afterDeleteFile hooks

* removed contentLength because it's already in the header

* added fileSize param to FileTriggerRequest

* added support for client side metadata and tags

* removed fit test

* removed unused import

* added loging to file triggers

* updated error message

* updated error message

* fixed tests

* fixed typos

* Update package.json

* fixed failing test

* fixed error message

* fixed failing tests (hopefully)

* TESTS!!!

* Update FilesAdapter.js

fixed comment

* added test for changing file name

* updated comments

Co-authored-by: Diamond Lewis <findlewis@gmail.com>
2020-04-02 16:00:15 -05:00
Mike Patnode
a7cb381fbf Allow validateFilename to return a string or Parse Error (#6246) 2019-12-02 19:47:22 -06:00
Mike Patnode
1c8d4a6519 Move filename validation out of the Router and into the FilesAdaptor (#6157)
* Move filename validation out of the Router and into the FilesAdaptor

* Address PR comments

* Update unittests to handle FilesAdapter interface change

* Make validateFilename optional
2019-10-26 21:15:21 -05:00
Diamond Lewis
470bb238b5 Fix: Logger print JSON and Numbers (#5916)
* Fix: Logger print JSON and Numbers

* fix test
2019-08-13 18:44:03 -07:00
Antonio Davi Macedo Coelho de Castro
893f1d376e Remove test delays (#5579)
* Changing __indexBuildCompletionCallbackForTests callback to serverStartComplete

* Improving serverStartComplete callback to avoid production unhandled promise rejection

* Add test to check inexistence of unhandled promise rejection on server fail

* Removing some hooks delays

* Removing delay after reconfigureServer

* Improving code style
2019-05-14 11:34:51 -07:00
Sam Ilic
6ffc41345f Winston 3 upgrade (#5496)
*  Release 3.1.3 (#5267)

*  Release 3.1.3

* Update CHANGELOG.md

* ⬆️ Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.1.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.1.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.5.1
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.5.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Rewrote WinstonLogger to work with winston 3.x api

* Changed winston logger test to use winston-transport

* Added winston-transport dependency

* Close and remove transports before adding them again

* Changed to strict equal

* Override adapter name

* Updated and added getLogs tests

* Bump winston and winston-daily-rotate-file

Bumps [winston](https://github.com/winstonjs/winston) and [winston-daily-rotate-file](https://github.com/winstonjs/winston-daily-rotate-file). These dependencies needed to be updated together.

Updates `winston` from 2.4.4 to 3.2.0
- [Release notes](https://github.com/winstonjs/winston/releases)
- [Changelog](https://github.com/winstonjs/winston/blob/master/CHANGELOG.md)
- [Commits](https://github.com/winstonjs/winston/compare/2.4.4...3.2.0)

Updates `winston-daily-rotate-file` from 1.7.2 to 3.6.0
- [Release notes](https://github.com/winstonjs/winston-daily-rotate-file/releases)
- [Commits](https://github.com/winstonjs/winston-daily-rotate-file/compare/v1.7.2...v3.6.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Fixed tests, updated parse logging

* Fixed tests, better error logging

* Fix failing tests

* Updates as per review
2019-04-14 18:03:33 -05:00
Florent Vilmart
a42101531a Silences warnings from mongodb client (#5025)
* Silences warnings from mongodb client

* Update count, delete and finds to recommended implementations

* With new parser, readPref will be null by default

* Update flaky specs wih async/await style

* Adds gridstore adapter spec

* Use GridFSBucketStorage adapter
2018-09-04 16:15:09 -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
GabrielLomba
a61ef7ee2f Fix typo in FilesController.spec (#4917)
* Add the addFileNameHash option that allows users to remove the hash from file names

* Change option name to preserveFileName

* Revert changes to package-lock.json

* Fix typo in FileController.spec
2018-07-27 17:41:04 -04:00
GabrielLomba
6a151ee135 Add the addFileNameHash option that allows users to remove the hash f… (#4915)
* Add the addFileNameHash option that allows users to remove the hash from file names

* Change option name to preserveFileName

* Revert changes to package-lock.json
2018-07-27 09:04:06 -04:00
Florent Vilmart
ae1a8226d5 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-07-02 23:30:14 -04:00
Florent Vilmart
b754d51e8e chore(package): update jasmine to version 3.0.0 (#4553)
* chore(package): update jasmine to version 3.0.0

Closes #4547

* Fixes failing tests for jasmine 3.0

Starting 3.0, done(something) will fail

* Update tests so they dont leverage var, but let and const

With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var`

* Remove randomizer

* Use same adapter for PG tests, drop table to ensure the tests dont side effect
2018-02-17 09:55:30 -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
Arthur Cinader
e7f2995143 Adjust a test for change to logging. (#3452) 2017-01-30 13:28:52 -05:00
Arthur Cinader
f864141663 Log Parse Errors so they are intelligible. (#3431)
The problem this pr is trying to solve:

When an error occurs on the server, a message should
be returned to the client, and a message should be logged.

Currently, on the server, the log is just [object, object]

This pr will stop calling the default express error handler
which causes two problems: 1. it writes to console instead of log file
2. the output is completely useless! :)

Instead, we'll log the error ourselves using the ParseServer's logger.

fixes: #661
2017-01-30 12:32:54 -05:00
Florent Vilmart
1e45ac753a Moves Files adapters to external packages 2016-03-24 00:48:34 -04:00
Tsolis Dimitris Sotiris
e4e7e42c65 Add FileSystemAdapter file adapter 2016-03-20 21:35:42 +02:00
Mike McDonald
2c5144028b Added tests to adapter loader, cleaned up README, renamed to GCS_BUCKET from GCS_BUCKET_NAME 2016-03-07 00:47:08 -08:00
Mike McDonald
1dc346715d Merge branch 'master' of https://github.com/ParsePlatform/parse-server into mcdonald-gcs-adapter
Get GCSAdapter up to snuff with FilesController + FilesControllerTestFactory

* 'master' of https://github.com/ParsePlatform/parse-server: (102 commits)
  Remove duplicated instructions
  Release and Changelog for 2.1.4
  fixes missing coverage with sh script
  Fix update system schema
  Adds optional COVERAGE
  Allows to pass no where in $select clause
  Sanitize objectId in
  Fix delete schema when actual collection does not exist
  Fix replace query overwrite the existing query object.
  Fix create system class with relation/pointer
  Use throws syntax for errors in SchemasRouter.
  Completely migrate SchemasRouter to new MongoCollection API.
  Add tests that verify installationId in Cloud Code triggers.
  Propagate installationId in all Cloud Code triggers.
  Add test
  expiresAt should be a Date, not a string. Fixes #776
  Fix missing 'let/var' in OneSignalPushAdapter.spec.
  Don't run any afterSave hooks if none are registered.
  Fix : remove query count limit
  Flatten custom operations in request.object in afterSave hooks.
  ...
2016-03-03 22:36:25 -08:00
Florent Vilmart
78d380df72 Adds content type support in S3 2016-03-01 09:28:17 -05:00
Florent Vilmart
9287afc3c2 refactors filesAdapter tests in factories 2016-03-01 09:02:36 -05:00
Florent Vilmart
23e55e941e Splits Adapter loading from AdaptableController
- Adds dynamic prototype conformance check upon setting adapter
- Throws when adapter is undefined, invalid in controller
2016-02-21 23:47:07 -05:00
Florent Vilmart
305879a251 Refactors FilesController in FilesRouter and FilesController 2016-02-20 13:52:35 -05:00