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

@winninjs/graphql-io-utils

Package Overview
Dependencies
Maintainers
11
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@winninjs/graphql-io-utils

Utilities directives and scalar types to help on graphql input/output validation and sanitization.

  • 1.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-26.67%
Maintainers
11
Weekly downloads
 
Created
Source

graphql-io-utils

Utilities directives and scalar types to help on graphql input/output validation and sanitization.

Installation

npm i @winninjs/graphql-io-utils

Scalar

Email

Represents a valid email

type Query{
  
  email:Email! # Returns a non-null valid Email
  sendEmail(email:Email):Email # Send and returns a valid Email
}

URL

Represents a valid URL

type Query{
  
  url:URL! # Returns a non-null valid URL
  sendURL(url:URL):URL # Send and returns a valid URL
}

PII

Redacts PII info on string

type Query{
  
  piiData:PII! # Returns a redacted PII string
}

Directives

It includes two directives:

@stringUtils

Lets you run a method over a string input or output

type Query{
  
  returnTrimmedAndUpper:String! @stringUtils(stringMethods:["trim","toUpperCase"]) # runs trim and toUpperCase on returned String
  
  sendTrimmedAndLower(trimmedAndLower:String!@stringUtils(stringMethods:["trim","toLowerCase"])):String! # runs trim and toLowerCase on query argument

}

@validate

Runs common validations over input

type Query{
  email(value:String! @validate(email:true)):String! #validates if the value is an valid email
}

Currently supports the following validations:

  • email
  • url
  • alpha
  • alphaNum
  • alphaDash
  • digits
  • ip
  • hex
  • lt
  • lte
  • gt
  • gte
  • stringLengthLT
  • stringLengthLTE
  • stringLengthGT
  • stringLengthGTE
  • stringLengthEquals
  • notEmpty
  • startsWith
  • endsWith
  • contains
  • notContains

Keywords

FAQs

Package last updated on 05 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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