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

@anvilco/apollo-server-plugin-introspection-metadata

Package Overview
Dependencies
Maintainers
6
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anvilco/apollo-server-plugin-introspection-metadata - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

4

CHANGELOG.md

@@ -1,4 +0,4 @@

### 2.0.2
### 2.1.0
- Dependency updates
- Added `REGEX_INTROSPECTION_QUERY` and `isIntrospectionQuery` as exports.

@@ -5,0 +5,0 @@ ### 2.0.1

@@ -6,3 +6,4 @@ "use strict";

});
exports.generateApolloPlugin = exports.default = exports.addMetadata = void 0;
exports.generateApolloPlugin = exports.default = exports.addMetadata = exports.REGEX_INTROSPECTION_QUERY = void 0;
exports.isIntrospectionQuery = isIntrospectionQuery;
var _lodash = _interopRequireDefault(require("lodash.set"));

@@ -12,2 +13,3 @@ var _lodash2 = _interopRequireDefault(require("lodash.get"));

const REGEX_INTROSPECTION_QUERY = /\b(__schema|__type)\b/;
exports.REGEX_INTROSPECTION_QUERY = REGEX_INTROSPECTION_QUERY;
const KIND_OBJECT = 'OBJECT';

@@ -29,3 +31,3 @@ const KIND_INPUT_OBJECT = 'INPUT_OBJECT';

// Default test function. Will look to see if it is an Introspection Query
function defaultTestFn(context) {
function isIntrospectionQuery(context) {
var _context$request;

@@ -60,3 +62,3 @@ return typeof (context === null || context === void 0 ? void 0 : (_context$request = context.request) === null || _context$request === void 0 ? void 0 : _context$request.query) === 'string' && REGEX_INTROSPECTION_QUERY.test(context.request.query);

const generateApolloPlugin = ({
testFn = defaultTestFn,
testFn = isIntrospectionQuery,
schemaMetadata,

@@ -63,0 +65,0 @@ metadataSourceKey = 'metadata',

{
"name": "@anvilco/apollo-server-plugin-introspection-metadata",
"version": "2.0.2",
"version": "2.1.0",
"description": "A plugin for Apollo Server that allows for adding metadata to GraphQL Introspection Query responses.",

@@ -5,0 +5,0 @@ "author": "Anvil Foundry Inc. <hello@useanvil.com>",

@@ -230,4 +230,11 @@ # @anvilco/apollo-server-plugin-introspection-metadata

#### `isIntrospectionQuery`
A function that takes the Apollo context as an argument and returns a Boolean indicating whether it appears to be an Introspection Query or not. Useful if you're considering implementing your own `testFn` to provide to the `generateApolloPlugin` call.
### `REGEX_INTROSPECTION_QUERY`
A Javascript RegEx that can be used to test a query string to determine if it's an Introspection Query or not.
## References
Inspired from [@cleartax/apollo-server-plugin-introspection-auth](https://github.com/cleartax/apollo-server-plugin-introspection-auth).
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