Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
ciq-graphql-input-string
Advanced tools
A configurable custom input string type for GraphQL with sanitization and validation.
A configurable custom input string type for GraphQL with sanitization and validation.
Checkout graphql-input-number for validating number inputs.
npm install --save graphql-input-string
import GraphQLInputString from 'graphql-input-string';
const argType = GraphQLInputString({
name: 'TrimmedString',
trim: true,
});
new GraphQLObjectType({
name: 'Query',
fields: {
input: {
type: GraphQLString,
args: {
name: {
type: argType,
},
},
resolve: (_, {name}) => {
'name' IS NOW A TRIMMED STRING
};
},
},
});
GraphQLInputString({
// Type name.
// [REQUIRED]
name: string = null,
// Whether to trim strings.
trim: boolean = false,
// Whether to trimLeft strings.
trimLeft: boolean = false,
// Whether to trimRight strings.
trimRight: boolean = false,
// If specified, truncate strings to the specified length.
truncate: number = null,
// Sanitize function that is called at the end of sanitzation phase and before
// validation phase.
sanitize: ((string) => string) = null,
// Whether to allow empty strings.
empty: boolean = false,
// Minimum length allowed (inclusive).
min: number = null,
// Maximum length allowed (inclusive).
max: number = null,
// Allowed pattern definition.
pattern: (string | RegExp) = null,
// Test function that is called at the end of validation phase.
test: ((string) => boolean) = null,
// Custom error handler.
// May throw an error or return a value.
// If a value is returned, it will become the final value.
error: ErrorHandler = () => throw GraphQLError,
// Parse function that is called after validation phase before returning a
// value.
// May throw an error or return a value.
parse: ((string) => any) = null,
});
type ErrorInfo = {
type: string,
value: string,
message: ?string,
ast: ?Ast,
...args,
};
type ErrorHandler = (ErrorInfo) => any;
The MIT License (MIT)
Copyright (c) 2016 Joon Ho Cho
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
FAQs
A configurable custom input string type for GraphQL with sanitization and validation.
The npm package ciq-graphql-input-string receives a total of 0 weekly downloads. As such, ciq-graphql-input-string popularity was classified as not popular.
We found that ciq-graphql-input-string demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.