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

convert2graphql

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convert2graphql - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

15

package.json
{
"name": "convert2graphql",
"version": "1.0.1",
"version": "1.0.2",
"description": "",

@@ -10,3 +10,14 @@ "main": "index.js",

"author": "Danish Kamal",
"license": "ISC"
"license": "ISC",
"repository": {
"type": "git",
"url": "git+git@github.com:danish1994/convert2graphql.git"
},
"keywords": [
"graphql",
"json",
"convert to graphql",
"graphql string",
"facebook"
]
}

@@ -1,1 +0,86 @@

# Readme Coming Soon
# Convert2GraphQL
### This module helps to convert JSON objects into GraphQL strings needed for API calls.
#### User can add as many queries/mutations (either of them) in a single object to run them parallely.
## Usage
Install Package:
```
npm install --save convert2graphql
```
Import Module:
```js
const convert2GraphQL = require('convert2graphql')
```
Create Object by passing type of query you want to generate ("query" or "mutation"). Default value = "query":
```js
let query = new convert2GraphQL() //Or new convert2GraphQL('query')
let mutation = new convert2GraphQL('mutation')
```
Add multiple Query/Mutation
```js
//Example Query 1
query.addQuery({
name: 'getChats',
args: {
chatOption: {
sortLatest: true,
limit: 1
},
msgOption: {
sortLatest: false,
limit: 5
},
timestamp: "Sat Jan 20 2018 01:56:37 GMT+0530 (IST)"
},
nodes: {
name: "name",
msgs: {
msg: "msg",
createdBy: "createdBy"
}
}
})
// Example Query 2
query.addQuery({
name: 'getMsgs',
args: {
msgOption: {
sortLatest: true,
limit: 1
},
chatSlug: "slug"
},
nodes: {
msg: "msg",
createdBy: "createdBy"
}
})
```
Get GraphQL String:
```js
query.getGraphQLString()
// Output Will Be
// {
// getChats (chatOption: { sortLatest: true limit: 1 }msgOption: { sortLatest: false limit: 5 } timestamp: "Sat Jan 20 2018 01:56:37 GMT+0530 (IST)" ) {
// name
// msgs{
// msg createdBy
// }
// }
// getMsgs (msgOption: { sortLatest: true limit: 1 } chatSlug: "slug" ) {
// msg
// createdBy
// }
// }
```
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