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

@graphql-codegen/plugin-helpers

Package Overview
Dependencies
Maintainers
0
Versions
5524
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-codegen/plugin-helpers - npm Package Compare versions

Comparing version

to
5.1.0-alpha-20240825131803-18a679babe76a18ce81c108f39e4010e53deb0ce

28

cjs/federation.js

@@ -31,14 +31,13 @@ "use strict";

[utils_1.MapperKind.OBJECT_TYPE]: type => {
const objectTypeFederationDetails = checkObjectTypeFederationDetails(type, schema);
if (!objectTypeFederationDetails || objectTypeFederationDetails.resolvableKeyDirectives.length === 0) {
return type;
if (checkObjectTypeFederationDetails(type, schema)) {
const typeConfig = type.toConfig();
typeConfig.fields = {
[resolveReferenceFieldName]: {
type,
},
...typeConfig.fields,
};
return new graphql_1.GraphQLObjectType(typeConfig);
}
const typeConfig = type.toConfig();
typeConfig.fields = {
[resolveReferenceFieldName]: {
type,
},
...typeConfig.fields,
};
return new graphql_1.GraphQLObjectType(typeConfig);
return type;
},

@@ -79,2 +78,3 @@ });

this.enabled = false;
this.meta = {};
this.enabled = enabled;

@@ -160,2 +160,8 @@ this.schema = schema;

}
setMeta(typename, update) {
this.meta[typename] = { ...(this.meta[typename] || { hasResolveReference: false }), ...update };
}
getMeta() {
return this.meta;
}
isExternalAndNotProvided(fieldNode, objectType) {

@@ -162,0 +168,0 @@ return this.isExternal(fieldNode) && !this.hasProvides(objectType, fieldNode);

@@ -24,14 +24,13 @@ import { astFromObjectType, getRootTypeNames, MapperKind, mapSchema } from '@graphql-tools/utils';

[MapperKind.OBJECT_TYPE]: type => {
const objectTypeFederationDetails = checkObjectTypeFederationDetails(type, schema);
if (!objectTypeFederationDetails || objectTypeFederationDetails.resolvableKeyDirectives.length === 0) {
return type;
if (checkObjectTypeFederationDetails(type, schema)) {
const typeConfig = type.toConfig();
typeConfig.fields = {
[resolveReferenceFieldName]: {
type,
},
...typeConfig.fields,
};
return new GraphQLObjectType(typeConfig);
}
const typeConfig = type.toConfig();
typeConfig.fields = {
[resolveReferenceFieldName]: {
type,
},
...typeConfig.fields,
};
return new GraphQLObjectType(typeConfig);
return type;
},

@@ -72,2 +71,3 @@ });

this.enabled = false;
this.meta = {};
this.enabled = enabled;

@@ -153,2 +153,8 @@ this.schema = schema;

}
setMeta(typename, update) {
this.meta[typename] = { ...(this.meta[typename] || { hasResolveReference: false }), ...update };
}
getMeta() {
return this.meta;
}
isExternalAndNotProvided(fieldNode, objectType) {

@@ -155,0 +161,0 @@ return this.isExternal(fieldNode) && !this.hasProvides(objectType, fieldNode);

{
"name": "@graphql-codegen/plugin-helpers",
"version": "5.1.0-alpha-20240822113716-89be355f9a56a0305c13888fb5d971ade13675c7",
"version": "5.1.0-alpha-20240825131803-18a679babe76a18ce81c108f39e4010e53deb0ce",
"description": "GraphQL Code Generator common utils and types",

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

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

import { type DirectiveNode, FieldDefinitionNode, GraphQLNamedType, GraphQLObjectType, GraphQLSchema, ObjectTypeDefinitionNode } from 'graphql';
import { DirectiveNode, FieldDefinitionNode, GraphQLNamedType, GraphQLObjectType, GraphQLSchema, ObjectTypeDefinitionNode } from 'graphql';
/**

@@ -17,2 +17,5 @@ * Federation Spec

export declare function removeFederation(schema: GraphQLSchema): GraphQLSchema;
interface TypeMeta {
hasResolveReference: boolean;
}
export declare class ApolloFederation {

@@ -22,2 +25,5 @@ private enabled;

private providesMap;
protected meta: {
[typename: string]: TypeMeta;
};
constructor({ enabled, schema }: {

@@ -65,2 +71,6 @@ enabled: boolean;

}): string;
setMeta(typename: string, update: Partial<TypeMeta>): void;
getMeta(): {
[typename: string]: TypeMeta;
};
private isExternalAndNotProvided;

@@ -80,1 +90,2 @@ private isExternal;

} | false;
export {};

Sorry, the diff of this file is not supported yet