Giter VIP home page Giter VIP logo

laravel-graphql-playground's People

Contributors

davidnadejdin avatar ddedic avatar hailwood avatar half2me avatar jdeeburke avatar jeremytubbs avatar jthomaschewski avatar kevinpijning avatar marvinrabe avatar mfn avatar pyrou avatar rayronvictor avatar spawnia avatar ssi-anik avatar stylecibot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-graphql-playground's Issues

Publish package under different tag name

I wanted to publish the configuration for nuwave/lighthouse. I had no intention to publish your configuration. But as I had to select the option, it published your configuration too. So, I'd think that it'd be great to publish your content under a different tag. Maybe gql.playground or simply playground.
Screen Shot 2020-07-17 at 2 12 26 PM
I wanted to publish lighthouse's configuration and came up with publishing your configuration too.
Thanks BTW.

playground over https

The introspect requests of the playground are done through http, even though it is running on a https domain, which return a "mixed content" error on the browser. Is there a way to configure it to use https? thanks!

Suggestion: consider a debug tab

In short I had this issue where my schema was corrupted
The only way I was able to identify the root causes of the issue was by opening my browser console and toggling the docs panel.
I think you should consider a tab that can show the errors that I got by using the above method. It would be very useful during development.

Download assets command error

Hi ,
I am having problems with the download assets command. I am using win 10 , php 7.3.2. The error msg is below.
ErrorException : failed loading cafile stream: `C:\xampp\apache\bin\curl-ca-bundle.crt'

at F:\Work\php\laravel-demo\vendor\mll-lab\laravel-graphql-playground\src\DownloadAssetsCommand.php:25
21| public function handle()
22| {
23| $this->fileForceContents(
24| public_path(self::CSS_PATH_LOCAL),

25| file_get_contents('https:'.self::CSS_PATH_CDN)
26| );
27| $this->fileForceContents(
28| public_path(self::JS_PATH_LOCAL),
29| file_get_contents('https:'.self::JS_PATH_CDN)

Exception trace:

1 file_get_contents("https://cdn.jsdelivr.net/npm/graphql-playground-react/build/static/css/index.css")
F:\Work\php\laravel-demo\vendor\mll-lab\laravel-graphql-playground\src\DownloadAssetsCommand.php:25

2 MLL\GraphQLPlayground\DownloadAssetsCommand::handle()
F:\Work\php\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32

Please help

Include table name on where directive

Hello, on your where directive is there a way I can specify the table where an attribute is coming from. Just like the original model call of where something like:

$model->where('products.name', 'product name');

I have been attempting something like:

@where(products.name: String, operator: LIKE)

But it would end up in a syntax error

Add setting for weboscket to subscription

Add setting for websocket to subscription

On try create a subscription this throws error why not have websocket link in settings, but not have settings for this.

How to pass headers ?

For the protected / guarded routes I need to pass the JWT token , how can I do this with Larvel graphql playground ?

Issue with download-assets in Windows

Hi,
Thank you for the open source project. I appreciate your hard work.
I am developing on a Windows OS (7). I am facing an issue with "php artisan graphql-playground:download-assets" command. The problem, in my opinion, is the windows folder structure, which is causing this error while recursively creating the directory structure. Any solution to this problem is greatly appreciated. I, as of now, have manually created the necessary folders and pasted the necessary files.
Thanks in advance.
Full Stack trace below --

λ php artisan graphql-playground:download-assets -v

ErrorException : mkdir(): No such file or directory

at E:\Web\PHP\laravel-demo\vendor\mll-lab\laravel-graphql-playground\src\DownloadAssetsCommand.php:49

45|         $file = array_pop($parts);
  46|         $path = '';
  47|         foreach ($parts as $part) {
  48|             if (!is_dir($path .= "/$part")) {
> 49|                 mkdir($path);
  50|             }
  51|         }
  52|         file_put_contents("$path/$file", $contents);
  53|     }

Exception trace:

1 mkdir("/E:\Web\PHP\laravel-demo\public\vendor")
E:\Web\PHP\laravel-demo\vendor\mll-lab\laravel-graphql-playground\src\DownloadAssetsCommand.php:49

2 MLL\GraphQLPlayground\DownloadAssetsCommand::fileForceContents("/E:\Web\PHP\laravel-demo\public\vendor", "body{margin:0;padding:0;font-family:sans-serif;overflow:hidden}#root{height:100%}body{font-family:Open Sans,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;color:rgba(0,0,0,.8);line-height:1.5;height:100vh;letter-spacing:.53px;margin-right:-1px!important}a,body,code,h1,h2,h3,h4,html,p,pre,ul{margin:0;padding:0;color:inherit}a:active,a:focus,button:focus,input:focus{outline:none}button,input,submit{border:none}button,input,pre{font-family:Open Sans,sans-serif}code{font-family:Consolas,monospace}
/# sourceMappingURL=index.css.map/")
E:\Web\PHP\laravel-demo\vendor\mll-lab\laravel-graphql-playground\src\DownloadAssetsCommand.php:30

3 MLL\GraphQLPlayground\DownloadAssetsCommand::handle()
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

4 call_user_func_array([])
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:29

5 Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:87

6 Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:31

7 Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Container\Container.php:564

8 Illuminate\Container\Container::call()
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Console\Command.php:183

9 Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
E:\Web\PHP\laravel-demo\vendor\symfony\console\Command\Command.php:251

10 Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Console\Command.php:170

11 Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\vendor\symfony\console\Application.php:886

12 Symfony\Component\Console\Application::doRunCommand(Object(MLL\GraphQLPlayground\DownloadAssetsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\vendor\symfony\console\Application.php:262

13 Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\vendor\symfony\console\Application.php:145

14 Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Console\Application.php:89

15 Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:122

16 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
E:\Web\PHP\laravel-demo\artisan:37

JavaScript Error when clicking "copy curl"

When I click on copy curl i receive the following JS error:

Uncaught TypeError: can't access property "getState", t.context.store is undefined in TopBar.tsx:115:20

Everything else is working as expected.
I am using version 2.1.0. Any thoughts on this?

Update headers

Each time the csrf token is changed the old tabs needs to be updated with the latest X-CSRF-TOKEN value. Is there a way that can called to update all the opened tabs's header values

Laravel GraphQl getting Could not connect to websocket endpoint error

After implementing a simple GraphQl query such as a simple Mutation and Subscription I get this error when I try to run this subscription into graphql-playground:

subscription {
   userCreated{
     name
     username
     password
   }
}

I get this error on graphql-playground:

{
  "error": "Could not connect to websocket endpoint ws://127.0.0.1:8000/graphql. 
Please check if the endpoint url is correct."
}

GraphQl Schema:

#...
type User {
    id: Int!
    name: String
    email: String
    product : [Product!]
}

type Mutation {
 createUser(
    name: String!
    password: String!
    email : String!
  ): User @field(resolver:"UserMutator@create") @broadcast(subscription: "userCreated")
}

type Subscription {
  userCreated: User
}

UserMutator class:

class UserMutator{
    public function create($_ , array $args){
        $user =  User::create($args);
        Subscription::broadcast('userCreated',$user);
        //return $user;
    }

UserCreated Subscription

class UserCreated extends GraphQLSubscription
{
    public function authorize(Subscriber $subscriber, Request $request): bool
    {
          return true;
    }

    public function filter(Subscriber $subscriber, $root): bool
    {
        return true;
    }
}

Add config for session authentication

In our system we are using graphql through sessions, but to get it to work with graphql playground we had to change stuff in the view file and research what the GraphQLPlayground parameters was called.
In our application we also have CSRF protection on, so we also had to add a custom header to the request.
We fixed this by adding <meta name="csrf-token" content="{{ csrf_token() }}"> in the header and changing the init parameters to the following

GraphQLPlayground.init(root, {
        endpoint: "{{url(config('graphql-playground.endpoint'))}}",
        settings: {
            'request.credentials': 'same-origin',
        },
        headers: {
            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
        }
    })

What I am proposing is adding two config parameters, one to set the request.credentials and one to enable CSRF token passthrough.

How to use with Sanctum?

Is it possible to authenticate the playground with sanctum's SPA authentication? Or would it be better to just generate a token and add the bearer auth value to the headers? I've been trying to figure out how to most simply achieve authentication in the playground if a user wanted to test, but transition easily to an external token as well.

Laravel 5.8 Support - Problem with Route

In Laravel 5.8 the route::group() is accepting the first parameter as an array. Not receiving said array fails in the GraphQLPlaygroundServiceProvider, exactly where is the route: group()

I soucione passing the variable as an array, as you can see in the code below

Route::group( [config('graphql-playground.route')], function (): void { Route::get( config('graphql-playground.route_name', 'graphql-playground'), GraphQLPlaygroundController::class.'@get' )->name('graphql-playground'); } );

When i setup this packge i got error

When setup this packge in lighhouse tutorial i got this error
what i can do now?

Composer

"require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.7.*",
        "laravel/tinker": "^1.0",
        "mll-lab/laravel-graphql-playground": "^1.0",
        "nuwave/lighthouse": "^2.6"
    },

Error

In Router.php line 363:  
Argument 1 passed to Illuminate\Routing\Router::group() must be of the type array, string giv     en,
called in D:\Laravel\lighthouse-tutorial\vendor\laravel\framework\src\Illuminate\Support\ Facades\Facade.php on line 223
--
In Router.php line 363:  
Argument 1 passed to Illuminate\Routing\Router::group() must be of the type
array, string given, called in D:\Laravel\lighthouse-tutorial\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 223
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with er ror code 1
--

[SUGGESTION] Include all dependent resources (css/js)

It's hard to believe but I had the case where I just installed it/ set it up and later on travel I didn't have wifi and couldn't even use it in my local environment :-(

Are you open to make a complete static snapshot of all the dependencies, so the web part is essentially self-contained?

[SECURITY] Disable in production, allow custom middleware group

I'm missing two things:

  • an easy way to disable it completely in production, a config like
      'enabled' => env('GRAPHQL_PLAYGROUND_ENABLED', true),
    which when evaluating to false would not define the route at all
  • a way to apply a middleware to the exposed route

The latter could be achieved with something like the following in \MLL\GraphQLPlayground\GraphQLPlaygroundServiceProvider::boot:

        \Route::get(config('graphql-playground.route'), [
                'middleware' => config('graphql-playground.middleware', ''),
                'as' => 'graphql.playground',
                'uses' => function () {
                    return view('graphql-playground::index');
                },
            ]
        );

Exclude mutation from playground

I am trying to hide a mutation from the playground.

So what I tried so far, is I took the file ./resources/views/vendor/graphql-playground/index.blade.php and modified the settings object:

So what I tried so far, is I took the file ./resources/views/vendor/graphql-playground/index.blade.php and modified the settings object:

        GraphQLPlayground.init(root, {
            endpoint: "{{url(config('graphql-playground.endpoint'))}}",
            config: {
                schema: {
                    mutation: {
                        exclude: ['mutationName', '_mutationNamePayload']
                    }
                },
                extensions: {
                    endpoints: {
                        production: {
                            url: "{{url(config('graphql-playground.endpoint'))}}",
                            exclude: ['mutationName', '_mutationNamePayload'],
                            mutations: {
                                exclude: ['mutationName', '_mutationNamePayload']
                            }
                        }
                    }
                },
                mutation: {
                    exclude: ['mutationName']
                }
            },
            headers: {
               'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
            }
        })

No luck so far, I can find no information on how to exclude specific parts, and the only similiar issue found is this:
https://community.neo4j.com/t/how-do-i-exclude-auto-generated-mutations/17767

How to change subscription end point?

I wanted to change subscription endpoint of graphql-playground. Anyone has any idea?

I tried

'extensions' => [ 'endpoints' => [ 'dev' => [ 'subscription' => [ 'url' => 'wss://someendpoint', ] ] ] ]

laravel 10 support

Hi,

Is it possible to tag a new version that is compatible with laravel 10?

Endpoint 'graphql' not found?

I am trying to give this a go but when I try to run it by going to: http://localhost/graphql-playground I get a network 404 for http://localhost/graphql and I think that the endpoint route is not registering properly.

Am i missing something?

Pls tag new version

Hi, we would like to use the middleware function, but the latest tagged version doesn't contain this feature.

Can u pls tag?

Couldn`t open schema and docs tabs on production server (infinitely loading content)

Playground works perfectly fine on localhost, but on production where I try to open dosc or schema tab it shows spinner loading icon infinitely.

I can do successfully queries.

Noticed problems and differences between localhost:

  1. Console shows error in file Playground.tsx:313:
ServerError: Server response was missing for query 'IntrospectionQuery'.
    at c (bundle.esm.js:22:17)
    at bundle.esm.js:52:13
  1. In the bar just after "History button" shows message: Server cannot be reached

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.