New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@urql/introspection

Package Overview
Dependencies
Maintainers
6
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@urql/introspection - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3-canary-cc4e1a0d

58

dist/urql-introspection.js

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

Object.defineProperty(exports, '__esModule', {
value: true
});
Object.defineProperty(exports, '__esModule', { value: true });
var graphql = require('graphql');

@@ -43,2 +42,3 @@

};
var _includeScalars = false;

@@ -61,10 +61,22 @@ var _includeEnums = false;

case 'SCALAR':
_hasAnyType = _hasAnyType || _includeScalars;
return _includeScalars ? fromType : anyType;
if (_includeScalars) {
return fromType;
} else {
_hasAnyType = true;
return anyType;
}
case 'INPUT_OBJECT':
_hasAnyType = _hasAnyType || _includeInputs;
return _includeInputs ? fromType : anyType;
if (_includeInputs) {
return fromType;
} else {
_hasAnyType = true;
return anyType;
}
case 'ENUM':
_hasAnyType = _hasAnyType || _includeEnums;
return _includeEnums ? fromType : anyType;
if (_includeEnums) {
return fromType;
} else {
_hasAnyType = true;
return anyType;
}
case 'OBJECT':

@@ -210,13 +222,3 @@ case 'INTERFACE':

}).map(minifyIntrospectionType);
var minifiedDirectives = (directives || []).map(directive => ({
name: directive.name,
isRepeatable: directive.isRepeatable ? true : undefined,
locations: directive.locations,
args: directive.args.map(arg => ({
name: arg.name,
type: mapType(arg.type),
defaultValue: arg.defaultValue || undefined
}))
}));
if (!_includeScalars || !_includeEnums || !_includeInputs || _hasAnyType) {
if (_hasAnyType) {
minifiedTypes.push({

@@ -227,2 +229,15 @@ kind: 'SCALAR',

}
var minifiedDirectives = [];
if (opts.includeDirectives) {
minifiedDirectives = (directives || []).map(directive => ({
name: directive.name,
isRepeatable: directive.isRepeatable ? true : undefined,
locations: directive.locations,
args: directive.args.map(arg => ({
name: arg.name,
type: mapType(arg.type),
defaultValue: arg.defaultValue || undefined
}))
}));
}
return {

@@ -234,8 +249,9 @@ __schema: {

types: minifiedTypes,
directives: opts.includeDirectives ? minifiedDirectives : []
directives: minifiedDirectives
}
};
};
exports.getIntrospectedSchema = getIntrospectedSchema;
exports.minifyIntrospectionQuery = minifyIntrospectionQuery;
//# sourceMappingURL=urql-introspection.js.map

@@ -1,2 +0,2 @@

Object.defineProperty(exports,"__esModule",{value:!0});var e=require("graphql"),a=!1,n=!1,t=!1,r=!1,s={kind:"SCALAR",name:"Any"},i=e=>{switch(e.kind){case"NON_NULL":case"LIST":return{kind:e.kind,ofType:i(e.ofType)};case"SCALAR":return r=r||a,a?e:s;case"INPUT_OBJECT":return r=r||t,t?e:s;case"ENUM":return r=r||n,n?e:s;case"OBJECT":case"INTERFACE":case"UNION":return e;default:throw new TypeError(`Unrecognized type reference of type: ${e.kind}.`)}},p=e=>{switch(e.kind){case"SCALAR":return{kind:"SCALAR",name:e.name};case"ENUM":return{kind:"ENUM",name:e.name,enumValues:e.enumValues.map((e=>({name:e.name})))};case"INPUT_OBJECT":return{kind:"INPUT_OBJECT",name:e.name,inputFields:e.inputFields.map((e=>({name:e.name,type:i(e.type),defaultValue:e.defaultValue||void 0})))};case"OBJECT":return{kind:"OBJECT",name:e.name,fields:e.fields.map((e=>({name:e.name,type:e.type&&i(e.type),args:e.args&&e.args.map((e=>({name:e.name,type:i(e.type)})))}))),interfaces:e.interfaces&&e.interfaces.map((e=>({kind:"INTERFACE",name:e.name})))};case"INTERFACE":return{kind:"INTERFACE",name:e.name,fields:e.fields.map((e=>({name:e.name,type:e.type&&i(e.type),args:e.args&&e.args.map((e=>({name:e.name,type:i(e.type)})))}))),interfaces:e.interfaces&&e.interfaces.map((e=>({kind:"INTERFACE",name:e.name}))),possibleTypes:e.possibleTypes&&e.possibleTypes.map((e=>({kind:e.kind,name:e.name})))};case"UNION":return{kind:"UNION",name:e.name,possibleTypes:e.possibleTypes.map((e=>({kind:e.kind,name:e.name})))};default:return e}};exports.getIntrospectedSchema=a=>{if("string"==typeof a)try{a=JSON.parse(a)}catch(n){a=e.buildSchema(a)}if("object"==typeof a&&"__schema"in a)return a;var n=e.execute({document:e.parse(e.getIntrospectionQuery({descriptions:!1})),schema:a});if(!n.data||!n.data.__schema)throw new TypeError("GraphQL could not generate an IntrospectionQuery from the given schema.");return n.data},exports.minifyIntrospectionQuery=(e,c={})=>{if(!e||!("__schema"in e))throw new TypeError("Expected to receive an IntrospectionQuery.");r=!1,a=!!c.includeScalars,n=!!c.includeEnums,t=!!c.includeInputs;var{__schema:{queryType:m,mutationType:u,subscriptionType:d,types:o,directives:y}}=e,l=o.filter((e=>{switch(e.name){case"__Directive":case"__DirectiveLocation":case"__EnumValue":case"__InputValue":case"__Field":case"__Type":case"__TypeKind":case"__Schema":return!1;default:return a&&"SCALAR"===e.kind||n&&"ENUM"===e.kind||t&&"INPUT_OBJECT"===e.kind||"OBJECT"===e.kind||"INTERFACE"===e.kind||"UNION"===e.kind}})).map(p),T=(y||[]).map((e=>({name:e.name,isRepeatable:!!e.isRepeatable||void 0,locations:e.locations,args:e.args.map((e=>({name:e.name,type:i(e.type),defaultValue:e.defaultValue||void 0})))})));return a&&n&&t&&!r||l.push({kind:"SCALAR",name:s.name}),{__schema:{queryType:m,mutationType:u,subscriptionType:d,types:l,directives:c.includeDirectives?T:[]}}};
Object.defineProperty(exports,"__esModule",{value:!0});var e=require("graphql"),a=!1,n=!1,t=!1,r=!1,s={kind:"SCALAR",name:"Any"},i=e=>{switch(e.kind){case"NON_NULL":case"LIST":return{kind:e.kind,ofType:i(e.ofType)};case"SCALAR":return a?e:(r=!0,s);case"INPUT_OBJECT":return t?e:(r=!0,s);case"ENUM":return n?e:(r=!0,s);case"OBJECT":case"INTERFACE":case"UNION":return e;default:throw new TypeError(`Unrecognized type reference of type: ${e.kind}.`)}},p=e=>{switch(e.kind){case"SCALAR":return{kind:"SCALAR",name:e.name};case"ENUM":return{kind:"ENUM",name:e.name,enumValues:e.enumValues.map((e=>({name:e.name})))};case"INPUT_OBJECT":return{kind:"INPUT_OBJECT",name:e.name,inputFields:e.inputFields.map((e=>({name:e.name,type:i(e.type),defaultValue:e.defaultValue||void 0})))};case"OBJECT":return{kind:"OBJECT",name:e.name,fields:e.fields.map((e=>({name:e.name,type:e.type&&i(e.type),args:e.args&&e.args.map((e=>({name:e.name,type:i(e.type)})))}))),interfaces:e.interfaces&&e.interfaces.map((e=>({kind:"INTERFACE",name:e.name})))};case"INTERFACE":return{kind:"INTERFACE",name:e.name,fields:e.fields.map((e=>({name:e.name,type:e.type&&i(e.type),args:e.args&&e.args.map((e=>({name:e.name,type:i(e.type)})))}))),interfaces:e.interfaces&&e.interfaces.map((e=>({kind:"INTERFACE",name:e.name}))),possibleTypes:e.possibleTypes&&e.possibleTypes.map((e=>({kind:e.kind,name:e.name})))};case"UNION":return{kind:"UNION",name:e.name,possibleTypes:e.possibleTypes.map((e=>({kind:e.kind,name:e.name})))};default:return e}};exports.getIntrospectedSchema=a=>{if("string"==typeof a)try{a=JSON.parse(a)}catch(n){a=e.buildSchema(a)}if("object"==typeof a&&"__schema"in a)return a;var n=e.execute({document:e.parse(e.getIntrospectionQuery({descriptions:!1})),schema:a});if(!n.data||!n.data.__schema)throw new TypeError("GraphQL could not generate an IntrospectionQuery from the given schema.");return n.data},exports.minifyIntrospectionQuery=(e,c={})=>{if(!e||!("__schema"in e))throw new TypeError("Expected to receive an IntrospectionQuery.");r=!1,a=!!c.includeScalars,n=!!c.includeEnums,t=!!c.includeInputs;var{__schema:{queryType:m,mutationType:u,subscriptionType:d,types:o,directives:y}}=e,l=o.filter((e=>{switch(e.name){case"__Directive":case"__DirectiveLocation":case"__EnumValue":case"__InputValue":case"__Field":case"__Type":case"__TypeKind":case"__Schema":return!1;default:return a&&"SCALAR"===e.kind||n&&"ENUM"===e.kind||t&&"INPUT_OBJECT"===e.kind||"OBJECT"===e.kind||"INTERFACE"===e.kind||"UNION"===e.kind}})).map(p);r&&l.push({kind:"SCALAR",name:s.name});var T=[];return c.includeDirectives&&(T=(y||[]).map((e=>({name:e.name,isRepeatable:!!e.isRepeatable||void 0,locations:e.locations,args:e.args.map((e=>({name:e.name,type:i(e.type),defaultValue:e.defaultValue||void 0})))})))),{__schema:{queryType:m,mutationType:u,subscriptionType:d,types:l,directives:T}}};
//# sourceMappingURL=urql-introspection.min.js.map
{
"name": "@urql/introspection",
"version": "1.0.2",
"version": "1.0.3-canary-cc4e1a0d",
"description": "Utilities for dealing with Introspection Queries and Client Schemas",

@@ -9,2 +9,3 @@ "sideEffects": false,

"license": "MIT",
"author": "urql GraphQL Contributors",
"repository": {

@@ -27,5 +28,5 @@ "type": "git",

".": {
"types": "./dist/urql-introspection.d.ts",
"import": "./dist/urql-introspection.mjs",
"require": "./dist/urql-introspection.js",
"types": "./dist/urql-introspection.d.ts",
"source": "./src/index.ts"

@@ -32,0 +33,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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