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

@apollo/federation-internals

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apollo/federation-internals - npm Package Compare versions

Comparing version 2.0.0-preview.2 to 2.0.0-preview.3

4

CHANGELOG.md

@@ -9,2 +9,6 @@ # CHANGELOG for `@apollo/federation-internals`

## v2.0.0-preview.3
- Fix issue that created type extensions with descriptions, which is invalid graphQL syntax [PR #1582](https://github.com/apollographql/federation/pull/1582).
## v2.0.0-preview.2

@@ -11,0 +15,0 @@

12

dist/buildSchema.js

@@ -156,3 +156,3 @@ "use strict";

function buildNamedTypeInner(definitionNode, type, blueprint, extension) {
var _a, _b, _c, _d, _e, _f, _g;
var _a, _b, _c, _d, _e;
switch (definitionNode.kind) {

@@ -200,3 +200,5 @@ case 'ObjectTypeDefinition':

const v = enumType.addValue(enumVal.name.value);
v.description = (_e = enumVal.description) === null || _e === void 0 ? void 0 : _e.value;
if (enumVal.description) {
v.description = enumVal.description.value;
}
v.setOfExtension(extension);

@@ -209,3 +211,3 @@ buildAppliedDirectives(enumVal, v);

const inputObjectType = type;
for (const fieldNode of (_f = definitionNode.fields) !== null && _f !== void 0 ? _f : []) {
for (const fieldNode of (_e = definitionNode.fields) !== null && _e !== void 0 ? _e : []) {
const field = inputObjectType.addField(fieldNode.name.value);

@@ -218,3 +220,5 @@ field.setOfExtension(extension);

buildAppliedDirectives(definitionNode, type, extension);
type.description = (_g = definitionNode.description) === null || _g === void 0 ? void 0 : _g.value;
if (definitionNode.description) {
type.description = definitionNode.description.value;
}
type.sourceAST = definitionNode;

@@ -221,0 +225,0 @@ }

@@ -91,3 +91,3 @@ "use strict";

const rootEntries = orderRoots(roots, options).map((rootType) => `${options.indentString}${rootType.rootKind}: ${rootType.type}`);
return (extension ? '' : printDescription(schemaDefinition, options))
return printDescription(schemaDefinition, options, extension)
+ printIsExtension(extension)

@@ -121,3 +121,3 @@ + 'schema'

const locations = directive.locations.join(' | ');
return `${printDescription(directive, options)}directive ${directive}${printArgs(directive.arguments(), options)}${directive.repeatable ? ' repeatable' : ''} on ${locations}`;
return `${printDescription(directive, options, null)}directive ${directive}${printArgs(directive.arguments(), options)}${directive.repeatable ? ' repeatable' : ''} on ${locations}`;
}

@@ -133,4 +133,4 @@ exports.printDirectiveDefinition = printDirectiveDefinition;

}
function printDescription(element, options, indentation = '', firstInBlock = true) {
if (element.description === undefined || options.noDescriptions) {
function printDescription(element, options, extension, indentation = '', firstInBlock = true) {
if (extension || element.description === undefined || options.noDescriptions) {
return '';

@@ -148,3 +148,3 @@ }

}
return `${printDescription(type, options)}${printIsExtension(extension)}scalar ${type.name}${printAppliedDirectives(directives, options, true, false)}`;
return `${printDescription(type, options, extension)}${printIsExtension(extension)}scalar ${type.name}${printAppliedDirectives(directives, options, true, false)}`;
}

@@ -166,3 +166,3 @@ function printImplementedInterfaces(implementations) {

}
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -182,3 +182,3 @@ + kind + ' ' + type

const possibleTypes = members.length ? ' = ' + members.map(m => m.type).join(' | ') : '';
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -195,7 +195,7 @@ + 'union ' + type

}
const vals = values.map((v, i) => printDescription(v, options, options.indentString, !i)
const vals = values.map((v, i) => printDescription(v, options, extension, options.indentString, !i)
+ options.indentString
+ v
+ printAppliedDirectives(v.appliedDirectives, options));
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -213,3 +213,3 @@ + 'enum ' + type

}
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -222,3 +222,3 @@ + 'input ' + type

function printFields(fields, options) {
return printBlock(fields.map((f, i) => printDescription(f, options, options.indentString, !i)
return printBlock(fields.map((f, i) => printDescription(f, options, undefined, options.indentString, !i)
+ options.indentString

@@ -243,3 +243,3 @@ + printField(f, options)

const formattedArgs = args
.map((arg, i) => printDescription(arg, options, ' ' + indentation, !i) + ' ' + indentation + printArg(arg, options))
.map((arg, i) => printDescription(arg, options, null, ' ' + indentation, !i) + ' ' + indentation + printArg(arg, options))
.join('\n');

@@ -246,0 +246,0 @@ return `(\n${formattedArgs}\n${indentation})`;

{
"name": "@apollo/federation-internals",
"version": "2.0.0-preview.2",
"version": "2.0.0-preview.3",
"description": "Apollo Federation internal utilities",

@@ -36,3 +36,3 @@ "main": "dist/index.js",

},
"gitHead": "1d4b3ea02bffa29541c817df695a35e9691e615f"
"gitHead": "238ff9edebda4af3c247b4073dce7e4f2a86e3c1"
}

@@ -430,2 +430,6 @@ import {

extend type Book {
author: String
}
type DVD implements Product {

@@ -432,0 +436,0 @@ id: ID!

@@ -302,3 +302,5 @@ import {

const v = enumType.addValue(enumVal.name.value);
v.description = enumVal.description?.value;
if (enumVal.description) {
v.description = enumVal.description.value;
}
v.setOfExtension(extension);

@@ -319,3 +321,5 @@ buildAppliedDirectives(enumVal, v);

buildAppliedDirectives(definitionNode, type, extension);
type.description = definitionNode.description?.value;
if (definitionNode.description) {
type.description = definitionNode.description.value;
}
type.sourceAST = definitionNode;

@@ -322,0 +326,0 @@ }

@@ -143,3 +143,3 @@ import {

// Note that that the description is never written with the extension as `extend schema` doesn _not_ support descriptions
return (extension ? '' : printDescription(schemaDefinition, options))
return printDescription(schemaDefinition, options, extension)
+ printIsExtension(extension)

@@ -191,3 +191,3 @@ + 'schema'

const locations = directive.locations.join(' | ');
return `${printDescription(directive, options)}directive ${directive}${printArgs(directive.arguments(), options)}${directive.repeatable ? ' repeatable' : ''} on ${locations}`;
return `${printDescription(directive, options, null)}directive ${directive}${printArgs(directive.arguments(), options)}${directive.repeatable ? ' repeatable' : ''} on ${locations}`;
}

@@ -212,6 +212,8 @@

options: PrintOptions,
extension: Extension<any> | undefined | null,
indentation: string = '',
firstInBlock: boolean = true
): string {
if (element.description === undefined || options.noDescriptions) {
// Note that extensions cannot have descriptions (it's not syntactically valid)
if (extension || element.description === undefined || options.noDescriptions) {
return '';

@@ -233,3 +235,3 @@ }

}
return `${printDescription(type, options)}${printIsExtension(extension)}scalar ${type.name}${printAppliedDirectives(directives, options, true, false)}`
return `${printDescription(type, options, extension)}${printIsExtension(extension)}scalar ${type.name}${printAppliedDirectives(directives, options, true, false)}`
}

@@ -253,3 +255,3 @@

}
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -270,3 +272,3 @@ + kind + ' ' + type

const possibleTypes = members.length ? ' = ' + members.map(m => m.type).join(' | ') : '';
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -285,7 +287,7 @@ + 'union ' + type

const vals = values.map((v, i) =>
printDescription(v, options, options.indentString, !i)
printDescription(v, options, extension, options.indentString, !i)
+ options.indentString
+ v
+ printAppliedDirectives(v.appliedDirectives, options));
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -304,3 +306,3 @@ + 'enum ' + type

}
return printDescription(type, options)
return printDescription(type, options, extension)
+ printIsExtension(extension)

@@ -315,3 +317,3 @@ + 'input ' + type

return printBlock(fields.map((f, i) =>
printDescription(f, options, options.indentString, !i)
printDescription(f, options, undefined, options.indentString, !i)
+ options.indentString

@@ -344,3 +346,3 @@ + printField(f, options)

const formattedArgs = args
.map((arg, i) => printDescription(arg, options, ' ' + indentation, !i) + ' ' + indentation + printArg(arg, options))
.map((arg, i) => printDescription(arg, options, null, ' ' + indentation, !i) + ' ' + indentation + printArg(arg, options))
.join('\n');

@@ -347,0 +349,0 @@ return `(\n${formattedArgs}\n${indentation})`;

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