
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@ephys/graphql-joi-directives
Advanced tools
Add constraint validation to your GraphQL Inputs using Joi
Add the package using npm i @ephys/graphql-joi-directives
This package was built with graphql-tools and supports Apollo.
Add the directives and the type definitions to your GraphQL schema:
import { joiConstraintDirectives, joiContraintDirectivesTypedefs } from '@ephys/graphql-joi-directives';
// ...
const schema = makeExecutableSchema({
// V this is an array
typeDefs: [...joiContraintDirectivesTypedefs],
schemaDirectives: {
// V this is an object
...joiConstraintDirectives,
},
});
const server = new ApolloServer({ schema });
// ...
By default, the following directives are exposed.
They can be used on fields in inputs & on arguments definitions
Can be used on the String
& [String]
types
directive @str(
# requires a minimum length of {min}
min: Int,
# requires a maximum length of {max}
max: Int,
# requires a length of exactly {length}
length: Int,
# trims the string before validation
trim: Boolean,
# ensure the string matches the provided regexp.
# example
# | pattern: "/[a-zA-Z0-9]/i"
pattern: String,
# requires the string to match a credit card format
creditCard: Boolean,
# converts casing, can be 'UPPER' or 'LOWER'
case: JoiDirectiveCaseEnum
# format must be a valid ISO date
isoDate: Boolean,
# format must be a valid ISO duration
isoDuration: Boolean,
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
enum JoiDirectiveCaseEnum {
UPPER
LOWER
}
Can be used on the Int
& [Int]
types
directive @int(
min: Int,
max: Int
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
Can be used on the Float
& [Float]
types
directive @float(
# value must be greater than or equal to {min}
min: Float,
# value must be less than or equal to {max}
max: Float,
# value must be greater than {minExclusive}
# Joi: number.greater - https://joi.dev/api/?v=17.4.0#numbergreaterlimit
minExclusive: Float,
# value must be less than {maxExclusive}
# Joi: number.less - https://joi.dev/api/?v=17.4.0#numberlesslimit
maxExclusive: Float,
# sets a maximum number of decimal places allowed
precision: Int,
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
Can be used on any list type
directive @list(
# requires a minimum of {min} items in the list
min: Int,
# requires a maximum of {max} items in the list
max: Int,
# requires exactly {length} items in the list
length: Int,
# removes duplicate items from the list
unique: Boolean,
) on INPUT_FIELD_DEFINITION | ARGUMENT_DEFINITION
FAQs
Adds Joi-powered constraint directive for GraphQL
The npm package @ephys/graphql-joi-directives receives a total of 2 weekly downloads. As such, @ephys/graphql-joi-directives popularity was classified as not popular.
We found that @ephys/graphql-joi-directives 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.