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

graphql-codegen-visitor-plugin-common

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-codegen-visitor-plugin-common - npm Package Compare versions

Comparing version 0.19.0-alpha.35980e3e to 0.19.0-alpha.89ed12b6

12

dist/base-documents-visitor.js

@@ -19,2 +19,12 @@ "use strict";

var variables_to_object_1 = require("./variables-to-object");
function getRootType(operation, schema) {
switch (operation) {
case 'query':
return schema.getQueryType();
case 'mutation':
return schema.getMutationType();
case 'subscription':
return schema.getSubscriptionType();
}
}
var BaseDocumentsVisitor = /** @class */ (function () {

@@ -38,3 +48,3 @@ function BaseDocumentsVisitor(rawConfig, additionalConfig, _schema, defaultScalars) {

var name = _this.handleAnonymouseOperation(node.name && node.name.value ? node.name.value : null);
var operationRootType = _this._schema.getType(utils_1.toPascalCase(node.operation));
var operationRootType = getRootType(node.operation, _this._schema);
var selectionSet = _this._selectionSetToObject.createNext(operationRootType, node.selectionSet);

@@ -41,0 +51,0 @@ var visitedOperationVariables = _this._variablesTransfomer.transform(node.variableDefinitions);

@@ -5,2 +5,14 @@ "use strict";

var utils_1 = require("./utils");
function isMetadataFieldName(name) {
return ['__schema', '__type'].includes(name);
}
function isRootType(type, schema) {
return (graphql_1.isEqualType(type, schema.getQueryType()) ||
graphql_1.isEqualType(type, schema.getMutationType()) ||
graphql_1.isEqualType(type, schema.getSubscriptionType()));
}
var metadataFieldMap = {
__schema: graphql_1.SchemaMetaFieldDef,
__type: graphql_1.TypeMetaFieldDef
};
var SelectionSetToObject = /** @class */ (function () {

@@ -33,3 +45,9 @@ function SelectionSetToObject(_scalars, _schema, _convertName, _addTypename, _parentSchemaType, _selectionSet) {

if (graphql_1.isObjectType(this._parentSchemaType) || graphql_1.isInterfaceType(this._parentSchemaType)) {
var schemaField = this._parentSchemaType.getFields()[field.name.value];
var schemaField = void 0;
if (isRootType(this._parentSchemaType, this._schema) && isMetadataFieldName(field.name.value)) {
schemaField = metadataFieldMap[field.name.value];
}
else {
schemaField = this._parentSchemaType.getFields()[field.name.value];
}
var rawType = schemaField.type;

@@ -36,0 +54,0 @@ var baseType = utils_1.getBaseType(rawType);

4

package.json
{
"name": "graphql-codegen-visitor-plugin-common",
"version": "0.19.0-alpha.35980e3e",
"version": "0.19.0-alpha.89ed12b6",
"license": "MIT",

@@ -10,3 +10,3 @@ "scripts": {

"auto-bind": "2.0.0",
"graphql-codegen-core": "0.19.0-alpha.35980e3e"
"graphql-codegen-core": "0.19.0-alpha.89ed12b6"
},

@@ -13,0 +13,0 @@ "peerDependencies": {

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