Commit Graph

2708 Commits

Author SHA1 Message Date
Omair Vaiyani
d3810c2eba GraphQL Configuration Options (#5782)
* add parse-graph-ql configuration for class schema customisation

Not yet tested - essentially an RFC

* refactor and add graphql router, controller and config cache

* fix(GraphQLController): add missing check isEnabled

* chore(GraphQLController): remove awaits from cache put

* chore(GraphQLController): remove check for if its enabled

* refactor(GraphQLController): only use cache if mounted

* chore(GraphQLController): group all validation errors and throw at once

* chore(GraphQLSchema): move transformations into controller validation

* refactor(GraphQL): improve ctrl validation and fix schema usage of config

* refactor(GraphQLSchema): remove code related to additional schema

This code has been moved into a separate feature branch.

* fix(GraphQLSchema): fix incorrect default return type for class configs

* refactor(GraphQLSchema): update staleness check code to account for config

* fix(GraphQLServer): fix regressed tests due to internal schema changes

This will be followed up with a backwards compatability fix for the `ClassFields` issue to avoid breakages for our users

* refactor: rename to ParseGraphQLController for consistency

* fix(ParseGraphQLCtrl): numerous fixes for validity checking

Also includes some minor code refactoring

* chore(GraphQL): minor syntax cleanup

* fix(SchemaController): add _GraphQLConfig to volatile classes

* refactor(ParseGraphQLServer): return update config value in setGraphQLConfig

* testing(ParseGraphQL): add test cases for new graphQLConfig

* fix(GraphQLController): fix issue where config with multiple items was not being mapped to the db

* fix(postgres): add _GraphQLConfig default schema on load

fixes failing postgres tests

* GraphQL @mock directive (#5836)

* Add mock directive
* Include tests for @mock directive

* Fix existing tests due to the change from ClassFields to ClassCreateFields

* fix(parseClassMutations): safer type transformation based on input type

* fix(parseClassMutations): only define necessary input fields

* fix(GraphQL): fix incorrect import paths
2019-07-25 12:46:25 -07:00
dependabot-preview[bot]
bbcc20fd60 Bump apollo-server-express from 2.7.0 to 2.7.1 (#5847)
Bumps [apollo-server-express](https://github.com/apollographql/apollo-server) from 2.7.0 to 2.7.1.
- [Release notes](https://github.com/apollographql/apollo-server/releases)
- [Changelog](https://github.com/apollographql/apollo-server/blob/master/CHANGELOG.md)
- [Commits](https://github.com/apollographql/apollo-server/compare/apollo-server-express@2.7.0...apollo-server-express@2.7.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-25 18:33:03 +00:00
dependabot-preview[bot]
c475a14408 Bump lint-staged from 9.2.0 to 9.2.1 (#5846)
* Bump lint-staged from 9.2.0 to 9.2.1

Bumps [lint-staged](https://github.com/okonet/lint-staged) from 9.2.0 to 9.2.1.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v9.2.0...v9.2.1)

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

* remove flaky test

* re-add test
2019-07-25 18:28:18 +00:00
Antonio Davi Macedo Coelho de Castro
8a925177e1 Cache apple public key for the case it fails to fetch again (#5848) 2019-07-25 10:20:28 -07:00
BrunoMaurice
50f1e8eb77 Make possible to alter response using the after save trigger (#5814)
* make possible to alter response using the after save trigger like for after find

* code clearing to follow same object checking

* remove console log debug

* fix test unit
2019-07-25 09:31:18 -07:00
Douglas Muraoka
4fe0ff6ebf feat: Add "count" to CLP initial value (#5841)
* feat: count CLP default values

* fix tests
2019-07-24 12:41:18 -05:00
greenkeeper[bot]
a5fb38b0b2 Update semver to the latest version 🚀 (#5843)
* fix(package): update semver to version 6.3.0

* chore(package): update lockfile package-lock.json
2019-07-23 19:51:04 +00:00
Antonio Davi Macedo Coelho de Castro
b605638415 Fix: GraphQL _or operator not working (#5840) 2019-07-23 10:29:38 -03:00
macarthuror
5398b6f667 custom pages example and an email adapter is added (#5838)
* custom pages example and an email adapter is added

* npm link of email adapter

* spelling and grammar changes

Co-Authored-By: Tom Fox <tomfox@surprises.io>

* spelling changes

Co-Authored-By: Tom Fox <tomfox@surprises.io>
2019-07-23 10:16:41 +01:00
Antonio Davi Macedo Coelho de Castro
2e0940c996 GraphQL @mock directive (#5836)
* Add mock directive
* Include tests for @mock directive
2019-07-22 15:19:40 -03:00
greenkeeper[bot]
f336cc3435 Update eslint to the latest version 🚀 (#5832)
* chore(package): update eslint to version 6.1.0

* chore(package): update lockfile package-lock.json
2019-07-21 04:59:38 +00:00
greenkeeper[bot]
f03fa6bcf9 Update pg-promise to the latest version 🚀 (#5831)
* fix(package): update pg-promise to version 8.7.5

* chore(package): update lockfile package-lock.json
2019-07-20 01:24:10 +00:00
Antonio Davi Macedo Coelho de Castro
a6f441248b GraphQL custom schema on CLI (#5828)
* Add --graphQLSchema to CLI

* Add custom graphql schema instructions to readme file

* Update README.md

Co-Authored-By: Tom Fox <tomfox@surprises.io>

* Update src/Options/Definitions.js

Co-Authored-By: Tom Fox <tomfox@surprises.io>

* Update src/Options/docs.js

Co-Authored-By: Tom Fox <tomfox@surprises.io>

* Update src/Options/index.js

Co-Authored-By: Tom Fox <tomfox@surprises.io>
2019-07-19 12:29:45 -07:00
greenkeeper[bot]
6d5f6b4c94 Update ws to the latest version 🚀 (#5830)
* fix(package): update ws to version 7.1.1

* chore(package): update lockfile package-lock.json
2019-07-19 15:14:58 +00:00
greenkeeper[bot]
7c809f5627 Update lodash to the latest version 🚀 (#5827)
* fix(package): update lodash to version 4.17.15

* chore(package): update lockfile package-lock.json
2019-07-19 03:06:22 +00:00
greenkeeper[bot]
c57f0d329b Update eslint-plugin-flowtype to the latest version 🚀 (#5826)
* chore(package): update eslint-plugin-flowtype to version 3.12.1

* chore(package): update lockfile package-lock.json
2019-07-19 00:01:24 +00:00
greenkeeper[bot]
beeb097e55 Update husky to the latest version 🚀 (#5825)
* chore(package): update husky to version 3.0.1

* chore(package): update lockfile package-lock.json
2019-07-18 22:11:48 +00:00
greenkeeper[bot]
61ae2eb91b Update flow-bin to the latest version 🚀 (#5824)
* chore(package): update flow-bin to version 0.103.0

* chore(package): update lockfile package-lock.json
2019-07-18 21:03:33 +00:00
Antonio Davi Macedo Coelho de Castro
71d92aed8d GraphQL Custom Schema (#5821)
This PR empowers the Parse GraphQL API with custom user-defined schema. The developers can now write their own types, queries, and mutations, which will merged with the ones that are automatically generated. The new types are resolved by the application's cloud code functions.

Therefore, regarding https://github.com/parse-community/parse-server/issues/5777, this PR closes the cloud functions needs and also addresses the graphql customization topic. In my view, I think that this PR, together with https://github.com/parse-community/parse-server/pull/5782 and https://github.com/parse-community/parse-server/pull/5818, when merged, closes the issue.

How it works:

1. When initializing ParseGraphQLServer, now the developer can pass a custom schema that will be merged to the auto-generated one:
```
      parseGraphQLServer = new ParseGraphQLServer(parseServer, {
        graphQLPath: '/graphql',
        graphQLCustomTypeDefs: gql`
          extend type Query {
            custom: Custom @namespace
          }
           type Custom {
            hello: String @resolve
            hello2: String @resolve(to: "hello")
            userEcho(user: _UserFields!): _UserClass! @resolve
          }
        `,
      });
```

Note:
- This PR includes a @namespace directive that can be used to the top level field of the nested queries and mutations (it basically just returns an empty object);
- This PR includes a @resolve directive that can be used to notify the Parse GraphQL Server to resolve that field using a cloud code function. The `to` argument specifies the function name. If the `to` argument is not passed, the Parse GraphQL Server will look for a function with the same name of the field;
- This PR allows creating custom types using the auto-generated ones as in `userEcho(user: _UserFields!): _UserClass! @resolve`;
- This PR allows to extend the auto-generated types, as in `extend type Query { ... }`.

2. Once the schema was set, you just need to write regular cloud code functions:
```
      Parse.Cloud.define('hello', async () => {
        return 'Hello world!';
      });

      Parse.Cloud.define('userEcho', async req => {
        return req.params.user;
      });
```

3. Now you are ready to play with your new custom api:
```
query {
  custom {
    hello
    hello2
    userEcho(user: { username: "somefolk" }) {
      username
    }
  }
}
```
should return
```
{
  "data": {
    "custom": {
      "hello": "Hello world!",
      "hello2": "Hello world!",
      "userEcho": {
        "username": "somefolk"
      }
    }
  }
}
```
2019-07-18 16:43:49 -03:00
Antonio Davi Macedo Coelho de Castro
0b86a86209 GraphQL { functions { call } } generic mutation (#5818)
* Generic call function mutation
* Change function return type to any
* First passing test
* Testing errors
* Testing different data types
2019-07-18 16:41:10 -03:00
greenkeeper[bot]
6be15331a6 Update eslint-plugin-flowtype to the latest version 🚀 (#5823)
* chore(package): update eslint-plugin-flowtype to version 3.12.0

* chore(package): update lockfile package-lock.json
2019-07-18 17:14:07 +00:00
Tom Fox
516d789491 Add contributors section, improve backers section (#5815)
* add contributors, improve backers section

* spacing
2019-07-18 17:47:16 +01:00
greenkeeper[bot]
9eec0f1b78 Update babel7 to the latest version 🚀 (#5820)
* chore(package): update @babel/cli to version 7.5.5

* chore(package): update @babel/core to version 7.5.5

* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.5

* chore(package): update @babel/preset-env to version 7.5.5

* chore(package): update lockfile package-lock.json
2019-07-17 23:40:20 +00:00
greenkeeper[bot]
1b5c045706 Update apollo-server to the latest version 🚀 (#5817)
* fix(package): update apollo-server-express to version 2.7.0

* chore(package): update lockfile package-lock.json
2019-07-16 14:18:14 +00:00
greenkeeper[bot]
82e24cb18d Update @parse/s3-files-adapter to the latest version 🚀 (#5816)
* fix(package): update @parse/s3-files-adapter to version 1.2.3

* chore(package): update lockfile package-lock.json
2019-07-15 18:07:19 +00:00
greenkeeper[bot]
cdc6eee295 Update jsdoc to the latest version 🚀 (#5813)
* chore(package): update jsdoc to version 3.6.3

* chore(package): update lockfile package-lock.json
2019-07-14 18:32:19 +00:00
Antonio Davi Macedo Coelho de Castro
7222bb6af9 Running GraphQL (#5810)
* Improving GraphQL running instruction

* Improving GraphQL learning more section

* Fixing typo
2019-07-13 21:01:32 -07:00
Douglas Muraoka
f91034ab8c GraphQL: Improve session token error messages (#5753)
* GraphQL: Improve session token error message

Fixes the session token related error messages during GraphQL operations. If any authentication error were thrown, it was not correctly handled by the GraphQL express middleware, and ended responding the request with a JSON parsing error.

* Refactor handleError usage

* Use handleParseErrors middleware to handle invalid session token error

* fix: Status code 400 when session token is invalid

* fix: Undo handleParseErrors middleware change
2019-07-12 13:58:47 -07:00
greenkeeper[bot]
1c62ab6f49 Update winston-daily-rotate-file to the latest version 🚀 (#5808)
* fix(package): update winston-daily-rotate-file to version 3.10.0

* chore(package): update lockfile package-lock.json
2019-07-12 15:52:20 +00:00
greenkeeper[bot]
3e888249cc Update parse to the latest version 🚀 (#5806)
* fix(package): update parse to version 2.5.1

* chore(package): update lockfile package-lock.json
2019-07-12 00:42:32 +00:00
greenkeeper[bot]
527662f336 Update pg-promise to the latest version 🚀 (#5805)
* fix(package): update pg-promise to version 8.7.4

* chore(package): update lockfile package-lock.json
2019-07-11 22:46:36 +00:00
greenkeeper[bot]
0dc7152681 Update apollo-server to the latest version 🚀 (#5804)
* fix(package): update apollo-server-express to version 2.6.9

* chore(package): update lockfile package-lock.json
2019-07-11 19:02:20 +00:00
Diamond Lewis
bb06376a32 Prevent linkWith sessionToken from generating new session (#5801) 2019-07-11 09:32:11 -05:00
Arthur Cinader
26943de778 Prepare 3.6.0 Release (#5792)
* Re-apply "Prepare for 3.6.0 Release""

This reverts commit 08dbafe49a.

* fix link formatting

* revert mongodb-runner upgrade.

* Update CHANGELOG.md

* Fix formatting
2019-07-11 09:22:36 -04:00
dependabot-preview[bot]
2afaf00d1f Bump lodash from 4.17.13 to 4.17.14 (#5803)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.13 to 4.17.14.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.13...4.17.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-11 11:22:24 +00:00
dependabot-preview[bot]
b5b718196b Bump lint-staged from 9.1.0 to 9.2.0 (#5802)
Bumps [lint-staged](https://github.com/okonet/lint-staged) from 9.1.0 to 9.2.0.
- [Release notes](https://github.com/okonet/lint-staged/releases)
- [Commits](https://github.com/okonet/lint-staged/compare/v9.1.0...v9.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-07-11 11:13:41 +00:00
Diamond Lewis
5341b8248f Generate sessionToken with linkWith (#5799)
* Generate sessionToken with linkWith

* improve test

* Add comment
2019-07-10 20:23:16 +00:00
Raschid J.F. Rafeally
9816285205 Added rest option: excludeKeys (#5737)
* Added restOption: excludeKeys

* improve tests
2019-07-10 15:01:21 -05:00
Diamond Lewis
378e70afdc Fix #5794 (#5797) 2019-07-10 15:19:40 -04:00
Arthur Cinader
76ce9e1a5c Run test that require db access (#5796)
as mongo only.

also seperate out into own section of test.
2019-07-10 12:25:29 -05:00
Arthur Cinader
815b7c6e05 Too much output! (#5795)
Reducing the spew.
2019-07-10 11:56:04 -04: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
Arthur Cinader
08dbafe49a Revert "Prepare for 3.6.0 Release"
This reverts commit 8c1124e3c4.
2019-07-10 10:21:47 -04:00
Arthur Cinader
8c1124e3c4 Prepare for 3.6.0 Release
also run 'npm audit fix' to address some dependency vulnerabilities
2019-07-10 10:18:29 -04:00
Fabian Strachanski
73b0f9a339 Merge pull request from GHSA-8w3j-g983-8jh5
* Add Test and Authenticator for ghsa-8w3j-g983-8jh5

* fix for ghsa-8w3j-g983-8jh5

* nit whitespace

not sure why lint isn't catching...
2019-07-10 09:47:23 -04:00
greenkeeper[bot]
050dd19e80 Update apollo-upload-client to the latest version 🚀 (#5791)
* chore(package): update apollo-upload-client to version 11.0.0

* chore(package): update lockfile package-lock.json
2019-07-10 01:12:46 +00:00
greenkeeper[bot]
ed72e58ea6 Update apollo-server to the latest version 🚀 (#5789)
* fix(package): update apollo-server-express to version 2.6.8

* chore(package): update lockfile package-lock.json
2019-07-10 00:05:32 +00:00
greenkeeper[bot]
bf74b7445e Update lodash to the latest version 🚀 (#5788)
* fix(package): update lodash to version 4.17.13

* chore(package): update lockfile package-lock.json
2019-07-09 23:22:57 +00:00
greenkeeper[bot]
60a9a4d79c Update lodash to the latest version 🚀 (#5787)
* fix(package): update lodash to version 4.17.12

* chore(package): update lockfile package-lock.json
2019-07-09 22:45:40 +00:00
greenkeeper[bot]
71ddeed2e7 Update babel7 to the latest version 🚀 (#5786)
* chore(package): update @babel/core to version 7.5.4

* chore(package): update @babel/plugin-proposal-object-rest-spread to version 7.5.4

* chore(package): update @babel/preset-env to version 7.5.4

* chore(package): update lockfile package-lock.json
2019-07-09 21:29:49 +00:00