New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

graphql-config-parser

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-config-parser - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

2

package.json
{
"name": "graphql-config-parser",
"version": "1.0.1",
"version": "1.1.0",
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -38,3 +38,3 @@ # graphql-config

You can either use your actual GraphQL endpoint or if preferred a local JSON schema file.
You can either use your actual GraphQL endpoint or if preferred a local schema.json or schema.js file.

@@ -64,3 +64,11 @@ #### Use GraphQL endpoint

#### Use local schema file (GraphQL.js)
```json
{
"graphql-js": "./schema.js"
}
```
### Method 3: Configuration via `package.json` file

@@ -67,0 +75,0 @@

@@ -13,2 +13,3 @@ "use strict";

const path_1 = require('path');
const graphql_1 = require('graphql/graphql');
const introspectionQuery_1 = require('graphql/utilities/introspectionQuery');

@@ -77,2 +78,5 @@ const fetch = require('node-fetch');

});
case 'graphql-js':
const schemaSource = require(path_1.resolve(config.file));
return graphql_1.graphql(schemaSource, introspectionQuery_1.introspectionQuery);
default: throw new Error(`Invalid config: ${JSON.stringify(config)}`);

@@ -95,3 +99,9 @@ }

}
if (json['graphql-js']) {
return {
type: 'graphql-js',
file: json['graphql-js'],
};
}
throw new Error(`Invalid configuration file: ${JSON.stringify(json)}`);
}
import { isWebUri } from 'valid-url'
import { readFileSync } from 'fs'
import { join } from 'path'
import { join, resolve } from 'path'
import { graphql } from 'graphql/graphql'
import { introspectionQuery } from 'graphql/utilities/introspectionQuery'
import * as fetch from 'node-fetch'
type Config = ConfigFile | ConfigRequest
type Config = ConfigFile | ConfigRequest | ConfigGraphQLJS

@@ -20,2 +21,7 @@ interface ConfigFile {

interface ConfigGraphQLJS {
type: 'graphql-js',
file: string
}
interface Schema {

@@ -92,2 +98,6 @@ data: any

})
case 'graphql-js':
const schemaSource = require(resolve(config.file))
return graphql(schemaSource, introspectionQuery)
default: throw new Error(`Invalid config: ${JSON.stringify(config)}`)

@@ -114,3 +124,10 @@ }

if (json['graphql-js']) {
return {
type: 'graphql-js',
file: json['graphql-js'],
} as ConfigGraphQLJS
}
throw new Error(`Invalid configuration file: ${JSON.stringify(json)}`)
}
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