Socket
Socket
Sign inDemoInstall

@graphql-inspector/core

Package Overview
Dependencies
Maintainers
1
Versions
420
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-inspector/core - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

35

dist/validate/index.js

@@ -34,3 +34,7 @@ "use strict";

.forEach(function (doc) {
var merged = "\n " + doc.source.body + "\n\n " + (extractFragments(doc.source.body) || [])
var docWithOperations = {
kind: 'Document',
definitions: doc.operations.map(function (d) { return d.node; }),
};
var extractedFragments = (extractFragments(graphql_1.print(docWithOperations)) || [])
// resolve all nested fragments

@@ -45,16 +49,11 @@ .map(function (fragmentName) {

return all.findIndex(function (item) { return item.name.value === def.name.value; }) === i;
})
// does not include fragment definition
.filter(function (fragment) {
return doc.source.body.indexOf("fragment " + fragment.name.value + " on") ===
-1;
})
// print
.map(graphql_1.print)
// merge
.join('\n\n') + "\n ";
var errors = graphql_1.validate(schema, graphql_1.parse(merged));
});
var merged = {
kind: 'Document',
definitions: docWithOperations.definitions.concat(extractedFragments),
};
var errors = graphql_1.validate(schema, merged);
var deprecated = graphql_2.findDeprecatedUsages(schema, graphql_1.parse(doc.source.body));
var duplicatedFragments = findDuplicatedFragments(fragmentNames);
if (errors || deprecated || duplicatedFragments) {
if (sumLengths(errors, duplicatedFragments, deprecated) > 0) {
invalidDocuments.push({

@@ -89,2 +88,12 @@ source: doc.source,

}
function sumLengths() {
var arrays = [];
for (var _i = 0; _i < arguments.length; _i++) {
arrays[_i] = arguments[_i];
}
return arrays.reduce(function (sum, _a) {
var length = _a.length;
return sum + length;
}, 0);
}
//# sourceMappingURL=index.js.map
{
"name": "@graphql-inspector/core",
"version": "0.8.0",
"version": "0.9.0",
"description": "Tooling for GraphQL. Compare GraphQL Schemas, check documents, find breaking changes, find similar types.",

@@ -5,0 +5,0 @@ "keywords": [

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