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

@escape.tech/graphql-armor-block-field-suggestions

Package Overview
Dependencies
Maintainers
4
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@escape.tech/graphql-armor-block-field-suggestions - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

6

dist/declarations/src/index.d.ts
import type { Plugin } from '@envelop/core';
declare const blockFieldSuggestionsPlugin: () => Plugin;
declare type BlockFieldSuggestionsOptions = {
mask?: string;
};
export declare const blockFieldSuggestionsDefaultOptions: BlockFieldSuggestionsOptions;
declare const blockFieldSuggestionsPlugin: (options?: BlockFieldSuggestionsOptions) => Plugin;
export { blockFieldSuggestionsPlugin };

13

dist/graphql-armor-block-field-suggestions.cjs.dev.js

@@ -7,5 +7,9 @@ 'use strict';

const formatter = error => {
const blockFieldSuggestionsDefaultOptions = {
mask: '[Suggestion message hidden by GraphQLArmor]'
};
const formatter = (error, mask = '[Suggestion message hidden by GraphQLArmor]') => {
if (error instanceof graphql.GraphQLError) {
error.message = error.message.replace(/Did you mean ".+"/g, '[Suggestion message hidden by GraphQLArmor]');
error.message = error.message.replace(/Did you mean ".+"/g, mask);
}

@@ -16,3 +20,3 @@

const blockFieldSuggestionsPlugin = () => {
const blockFieldSuggestionsPlugin = options => {
return {

@@ -26,3 +30,3 @@ onValidate: () => {

if (!valid) {
setResult(result.map(error => formatter(error)));
setResult(result.map(error => formatter(error, options === null || options === void 0 ? void 0 : options.mask)));
}

@@ -34,2 +38,3 @@ };

exports.blockFieldSuggestionsDefaultOptions = blockFieldSuggestionsDefaultOptions;
exports.blockFieldSuggestionsPlugin = blockFieldSuggestionsPlugin;

@@ -7,5 +7,9 @@ 'use strict';

const formatter = error => {
const blockFieldSuggestionsDefaultOptions = {
mask: '[Suggestion message hidden by GraphQLArmor]'
};
const formatter = (error, mask = '[Suggestion message hidden by GraphQLArmor]') => {
if (error instanceof graphql.GraphQLError) {
error.message = error.message.replace(/Did you mean ".+"/g, '[Suggestion message hidden by GraphQLArmor]');
error.message = error.message.replace(/Did you mean ".+"/g, mask);
}

@@ -16,3 +20,3 @@

const blockFieldSuggestionsPlugin = () => {
const blockFieldSuggestionsPlugin = options => {
return {

@@ -26,3 +30,3 @@ onValidate: () => {

if (!valid) {
setResult(result.map(error => formatter(error)));
setResult(result.map(error => formatter(error, options === null || options === void 0 ? void 0 : options.mask)));
}

@@ -34,2 +38,3 @@ };

exports.blockFieldSuggestionsDefaultOptions = blockFieldSuggestionsDefaultOptions;
exports.blockFieldSuggestionsPlugin = blockFieldSuggestionsPlugin;
import { GraphQLError } from 'graphql';
const formatter = error => {
const blockFieldSuggestionsDefaultOptions = {
mask: '[Suggestion message hidden by GraphQLArmor]'
};
const formatter = (error, mask = '[Suggestion message hidden by GraphQLArmor]') => {
if (error instanceof GraphQLError) {
error.message = error.message.replace(/Did you mean ".+"/g, '[Suggestion message hidden by GraphQLArmor]');
error.message = error.message.replace(/Did you mean ".+"/g, mask);
}

@@ -11,3 +15,3 @@

const blockFieldSuggestionsPlugin = () => {
const blockFieldSuggestionsPlugin = options => {
return {

@@ -21,3 +25,3 @@ onValidate: () => {

if (!valid) {
setResult(result.map(error => formatter(error)));
setResult(result.map(error => formatter(error, options === null || options === void 0 ? void 0 : options.mask)));
}

@@ -29,2 +33,2 @@ };

export { blockFieldSuggestionsPlugin };
export { blockFieldSuggestionsDefaultOptions, blockFieldSuggestionsPlugin };
{
"name": "@escape.tech/graphql-armor-block-field-suggestions",
"version": "1.2.0",
"version": "1.2.1",
"description": "Block graphql field suggestion.",

@@ -5,0 +5,0 @@ "packageManager": "yarn@3.2.2",

@@ -19,3 +19,3 @@ # @escape.tech/graphl-armor-block-field-suggestions

## Usage example
## Usage example default

@@ -35,1 +35,19 @@ ### With `@envelop/core` from `@the-guild-org`

```
## Usage example with custom mask
### With `@envelop/core` from `@the-guild-org`
```typescript
import { envelop } from '@envelop/core';
import { blockFieldSuggestions } from '@escape.tech/graphql-armor-block-field-suggestions';
const getEnveloped = envelop({
plugins: [
// ... other plugins ...
blockFieldSuggestions({
mask: '<[REDACTED]>'
}),
]
})
```
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