Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-request

Package Overview
Dependencies
Maintainers
1
Versions
206
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-request - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

dist/src/index.d.ts
import { Options, Variables } from './types';
export { ClientError } from './types';
import 'isomorphic-fetch';
export default function request<T extends any>(url: string, query: string, variables?: Variables): Promise<T>;
export declare function request<T extends any>(url: string, query: string, variables?: Variables): Promise<T>;
export declare class GraphQLClient {

@@ -6,0 +6,0 @@ private url;

@@ -51,3 +51,3 @@ "use strict";

}
exports.default = request;
exports.request = request;
var GraphQLClient = (function () {

@@ -54,0 +54,0 @@ function GraphQLClient(url, options) {

@@ -59,3 +59,3 @@ "use strict";

_b = (_a = t).deepEqual;
return [4 /*yield*/, index_1.default('https://mock-api.com/graphql', "{ viewer { id } }")];
return [4 /*yield*/, index_1.request('https://mock-api.com/graphql', "{ viewer { id } }")];
case 1:

@@ -92,3 +92,3 @@ _b.apply(_a, [_c.sent(), data]);

switch (_a.label) {
case 0: return [4 /*yield*/, t.throws(index_1.default('https://mock-api.com/graphql', "x"))];
case 0: return [4 /*yield*/, t.throws(index_1.request('https://mock-api.com/graphql', "x"))];
case 1:

@@ -95,0 +95,0 @@ err = _a.sent();

{
"name": "graphql-request",
"version": "1.0.0",
"version": "1.1.0",
"main": "dist/src/index.js",

@@ -9,3 +9,19 @@ "typings": "./dist/src/index.d.ts",

],
"repository": {
"type": "git",
"url": "git+https://github.com/graphcool/graphql-request.git"
},
"keywords": [
"graphql",
"request",
"fetch",
"graphql-client",
"apollo"
],
"author": "Johannes Schickling <johannes@graph.cool>",
"license": "MIT",
"bugs": {
"url": "https://github.com/graphcool/graphql-request/issues"
},
"homepage": "https://github.com/graphcool/graphql-request",
"scripts": {

@@ -12,0 +28,0 @@ "prepublish": "npm run build",

@@ -23,3 +23,3 @@ # graphql-request [![Build Status](https://travis-ci.org/graphcool/graphql-request.svg?branch=master)](https://travis-ci.org/graphcool/graphql-request) [![npm version](https://badge.fury.io/js/graphql-request.svg)](https://badge.fury.io/js/graphql-request)

```js
import request from 'graphql-request'
import { request } from 'graphql-request'

@@ -35,4 +35,3 @@ const query = `{

request('https://api.graph.cool/simple/v1/movies', query)
.then(({ Movie }) => console.log(Movie))
request('https://api.graph.cool/simple/v1/movies', query).then(data => console.log(data))
```

@@ -43,3 +42,3 @@

```js
import request, { GraphQLClient } from 'graphql-request'
import { request, GraphQLClient } from 'graphql-request'

@@ -56,3 +55,3 @@ // Run GraphQL queries/mutations using a static function

### Authenication via HTTP header
### Authentication via HTTP header

@@ -83,3 +82,3 @@ ```js

```js
import request from 'graphql-request'
import { request } from 'graphql-request'

@@ -105,3 +104,3 @@ const query = `query getMovie(title: String!) {

```js
import request from 'graphql-request'
import { request } from 'graphql-request'

@@ -120,2 +119,19 @@ const wrongQuery = `{

### Using `require` instead of `import`
```js
const { request } = require('graphql-request')
const query = `{
Movie(title: "Inception") {
releaseDate
actors {
name
}
}
}`
request('my-endpoint', query).then(data => console.log(data))
```
### More examples coming soon...

@@ -122,0 +138,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc