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.3.0-beta.3 to 2.3.0

4

CHANGELOG.md

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

## 2.3.0
- Fix incorrect handling of `@external` on a type when dealing when adding `@shareable` during fed1 schema upgrades [PR #2343](https://github.com/apollographql/federation/pull/2343).
## 2.2.1

@@ -7,0 +11,0 @@

8

dist/federation.js

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

if (!this._externalTester) {
this._externalTester = new ExternalTester(this.schema);
this._externalTester = new ExternalTester(this.schema, this.isFed2Schema());
}

@@ -1219,4 +1219,5 @@ return this._externalTester;

class ExternalTester {
constructor(schema) {
constructor(schema, isFed2Schema) {
this.schema = schema;
this.isFed2Schema = isFed2Schema;
this.fakeExternalFields = new Set();

@@ -1264,2 +1265,5 @@ this.providedFields = new Set();

collectExternalsOnType() {
if (!this.isFed2Schema) {
return;
}
for (const type of this.schema.objectTypes()) {

@@ -1266,0 +1270,0 @@ if (type.hasAppliedDirective(this.externalDirective)) {

{
"name": "@apollo/federation-internals",
"version": "2.3.0-beta.3",
"version": "2.3.0",
"description": "Apollo Federation internal utilities",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -248,1 +248,41 @@ import { FEDERATION2_LINK_WITH_FULL_IMPORTS } from '..';

})
test('handles the addition of @shareable when an @external is used on a type', () => {
const s1 = `
type Query {
t1: T
}
type T @key(fields: "id") {
id: String
x: Int
}
`;
const s2 = `
type Query {
t2: T
}
type T @external {
x: Int
}
`;
const subgraphs = new Subgraphs();
subgraphs.add(buildSubgraph('s1', 'http://s1', s1));
subgraphs.add(buildSubgraph('s2', 'http://s2', s2));
const res = upgradeSubgraphsIfNecessary(subgraphs);
expect(res.errors).toBeUndefined();
// 2 things must happen here:
// 1. the @external on type `T` in s2 should be removed, as @external on types were no-ops in fed1 (but not in fed2 anymore, hence the removal)
// 2. field `T.x` in s1 must be marked @shareable since it is resolved by s2 (since again, it's @external annotation is ignored).
const s2Upgraded = res.subgraphs?.get('s2')!;
expect(s2Upgraded.schema.type('T')?.hasAppliedDirective('external')).toBe(false);
const s1Upgraded = res.subgraphs?.get('s1')!;
expect((s1Upgraded.schema.type('T') as ObjectType).field('x')?.hasAppliedDirective('shareable')).toBe(true);
})

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 too big to display

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