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

graphql-import

Package Overview
Dependencies
Maintainers
1
Versions
431
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-import - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

dist/definition.d.ts

4

dist/index.test.js

@@ -46,2 +46,6 @@ "use strict";

});
ava_1.default('importSchema: import all', function (t) {
var expectedSDL = "type A {\n first: String @first\n second: Float\n b: B\n}\n\ntype B {\n hello: String!\n}\n\ntype C1 {\n id: ID!\n}\n\ntype C2 {\n id: ID!\n}\n";
t.is(_1.importSchema('fixtures/import-all/a.graphql'), expectedSDL);
});
ava_1.default('importSchema: interfaces', function (t) {

@@ -48,0 +52,0 @@ var expectedSDL = "type A implements B {\n first: String @first\n second: Float\n}\n\ninterface B {\n second: Float\n}\n";

9

package.json
{
"name": "graphql-import",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",
"files": ["dist"],
"repository": "git@github.com:graphcool/graphql-import.git",
"files": [
"dist"
],
"main": "dist/index.js",

@@ -13,3 +16,3 @@ "typings": "dist/index.d.ts",

"prepublish": "npm run build",
"build": "rm -rf dist && tsc",
"build": "rm -rf dist && tsc -d",
"test-only": "npm run build && ava --verbose dist/**/*.test.js",

@@ -16,0 +19,0 @@ "test": "tslint src/**/*.ts && npm run test-only"

@@ -1,2 +0,93 @@

# graphql-modules
Import & export definitions in GraphQL SDL
# graphql-import [![Build Status](https://travis-ci.org/graphcool/graphql-import.svg?branch=master)](https://travis-ci.org/graphcool/graphql-import) [![npm version](https://badge.fury.io/js/graphql-import.svg)](https://badge.fury.io/js/graphql-import) [![Greenkeeper badge](https://badges.greenkeeper.io/graphcool/graphql-import.svg)](https://greenkeeper.io/)
Import & export definitions in GraphQL SDL (also refered to as GraphQL modules)
## Install
```sh
yarn add graphql-import
```
## Usage
```ts
import { importSchema } from 'graphql-import'
import { makeExecutableSchema } from 'graphql-tools'
const typeDefs = importSchema('schema.graphql')
const resolvers = {}
const schema = makeExecutableSchema({ typeDefs, resolvers })
```
## Example
Assume the following directory structure:
```
.
├── a.graphql
├── b.graphql
└── c.graphql
```
`a.graphql`
```graphql
# import B from "b.graphql"
type A {
# test 1
first: String @first
second: Float
b: B
}
```
`b.graphql`
```graphql
# import C from 'c.graphql'
type B {
c: C
hello: String!
}
```
`c.graphql`
```graphql
# import C from 'c.graphql'
type C {
id: ID!
}
```
Running `console.log(importSchema('a.graphql'))` procudes the following output:
```graphql
type A {
first: String @first
second: Float
b: B
}
type B {
c: C
hello: String!
}
type C {
id: ID!
}
```
Please refer to [`src/index.test.ts`](src/index.test.ts) for more examples.
## Related topics & next steps
- Namespaces
- Support importing from HTTP endpoints (or [Links](https://github.com/apollographql/apollo-link))
- Create RFC to add import syntax to GraphQL spec

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