Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admission-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

# Fetch built artifacts
COPY --from=builder /app/pruned .
Expand Down
2 changes: 1 addition & 1 deletion cdn-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-slim

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

# Fetch built artifacts
COPY --from=builder /app/pruned .
Expand Down
10 changes: 5 additions & 5 deletions composition-go/index.global.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions composition/src/federation/federation-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ export class FederationFactory {
}
existingData.appearances += 1;
setLongestDescription(existingData, incomingData);
addIterableValuesToSet(incomingData.subgraphNames, existingData.subgraphNames);
}

// To facilitate the splitting of tag paths, field arguments do not use the renamedPath property for tagNamesByPath
Expand Down Expand Up @@ -1043,6 +1044,7 @@ export class FederationFactory {
switch (existingData.kind) {
case Kind.ENUM_TYPE_DEFINITION:
existingData.appearances += 1;
addIterableValuesToSet((incomingData as EnumDefinitionData).subgraphNames, existingData.subgraphNames);
for (const data of (incomingData as EnumDefinitionData).enumValueDataByValueName.values()) {
this.upsertEnumValueData(existingData.enumValueDataByValueName, data, isParentInaccessible);
}
Expand Down Expand Up @@ -2388,6 +2390,7 @@ export class FederationFactory {
federatedGraphAST: newRouterAST,
federatedGraphSchema: buildASTSchema(newRouterAST, { assumeValid: true, assumeValidSDL: true }),
federatedGraphClientSchema: newClientSchema,
parentDefinitionDataByTypeName: this.parentDefinitionDataByTypeName,
...this.getClientSchemaObjectBoolean(),
},
warnings: this.warnings,
Expand Down Expand Up @@ -2671,6 +2674,7 @@ export class FederationFactory {
federatedGraphAST: newRouterAST,
federatedGraphSchema: buildASTSchema(newRouterAST, { assumeValid: true, assumeValidSDL: true }),
federatedGraphClientSchema: newClientSchema,
parentDefinitionDataByTypeName: this.parentDefinitionDataByTypeName,
...this.getClientSchemaObjectBoolean(),
},
warnings: this.warnings,
Expand Down
1 change: 1 addition & 0 deletions composition/src/federation/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type FederationResult = {
federatedGraphAST: DocumentNode;
federatedGraphClientSchema: GraphQLSchema;
federatedGraphSchema: GraphQLSchema;
parentDefinitionDataByTypeName: Map<string, ParentDefinitionData>;
subgraphConfigBySubgraphName: Map<string, SubgraphConfig>;
shouldIncludeClientSchema?: boolean;
};
Expand Down
2 changes: 2 additions & 0 deletions composition/src/normalization/normalization-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ export class NormalizationFactory {
return;
}
this.setParentDataExtensionType(parentData, extensionType);
parentData.subgraphNames.add(this.subgraphName);
parentData.description ||= formatDescription('description' in node ? node.description : undefined);
return;
}
Expand All @@ -860,6 +861,7 @@ export class NormalizationFactory {
name: typeName,
node: getMutableEnumNode(node.name),
persistedDirectivesData: newPersistedDirectivesData(),
subgraphNames: new Set([this.subgraphName]),
description: formatDescription('description' in node ? node.description : undefined),
});
}
Expand Down
1 change: 1 addition & 0 deletions composition/src/normalization/walkers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export function upsertParentsAndChildren(nf: NormalizationFactory, document: Doc
nf.directiveDefinitionByDirectiveName,
nf.handledRepeatedDirectivesByHostPath,
nf.originalParentTypeName,
nf.subgraphName,
);
},
leave() {
Expand Down
2 changes: 2 additions & 0 deletions composition/src/schema-building/type-definition-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type EnumDefinitionData = {
name: string;
node: MutableEnumNode;
persistedDirectivesData: PersistedDirectivesData;
subgraphNames: Set<string>;
description?: StringValueNode;
};

Expand All @@ -45,6 +46,7 @@ export type EnumValueData = {
node: MutableEnumValueNode;
parentTypeName: string;
persistedDirectivesData: PersistedDirectivesData;
subgraphNames: Set<string>;
description?: StringValueNode;
};

Expand Down
2 changes: 2 additions & 0 deletions composition/src/schema-building/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ export function addEnumValueDataByNode(
directiveDefinitionByDirectiveName: Map<string, DirectiveDefinitionNode>,
handledRepeatedDirectivesByHostPath: Map<string, Set<string>>,
parentTypeName: string,
subgraphName: string,
) {
const name = node.name.value;
enumValueDataByValueName.set(name, {
Expand All @@ -455,6 +456,7 @@ export function addEnumValueDataByNode(
node: getMutableEnumValueNode(node),
parentTypeName,
persistedDirectivesData: newPersistedDirectivesData(),
subgraphNames: new Set([subgraphName]),
description: formatDescription(node.description),
});
}
Expand Down
26 changes: 26 additions & 0 deletions composition/tests/enums.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
duplicateEnumValueDefinitionError,
ENUM,
EnumDefinitionData,
federateSubgraphs,
incompatibleSharedEnumError,
noBaseDefinitionForExtensionError,
Expand Down Expand Up @@ -521,6 +522,31 @@ describe('Enum tests', () => {
),
);
});

test('that an Enum has subgraphs data', () => {
const { errors, federationResult } = federateSubgraphs([subgraphA, subgraphC]);
expect(errors).toBeUndefined();

const enumDef = federationResult?.parentDefinitionDataByTypeName.get('Instruction') as EnumDefinitionData;

expect(enumDef.subgraphNames.size).toBe(2);
expect(enumDef.subgraphNames).toContain(subgraphA.name);
expect(enumDef.subgraphNames).toContain(subgraphC.name);

const fightEnumVal = enumDef.enumValueDataByValueName.get('FIGHT');
expect(fightEnumVal?.subgraphNames.size).toBe(2);
expect(fightEnumVal?.subgraphNames).toContain(subgraphA.name);
expect(fightEnumVal?.subgraphNames).toContain(subgraphC.name);

const pokemonEnumVal = enumDef.enumValueDataByValueName.get('POKEMON');
expect(pokemonEnumVal?.subgraphNames.size).toBe(2);
expect(pokemonEnumVal?.subgraphNames).toContain(subgraphA.name);
expect(pokemonEnumVal?.subgraphNames).toContain(subgraphC.name);

const itemEnumVal = enumDef.enumValueDataByValueName.get('ITEM');
expect(itemEnumVal?.subgraphNames.size).toBe(1);
expect(itemEnumVal?.subgraphNames).toContain(subgraphC.name);
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion controlplane/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ FROM --platform=${BUILDPLATFORM} node:lts-alpine

WORKDIR /app

ENV NODE_ENV production
ENV NODE_ENV=production

# Fetch built artifacts
COPY --from=builder /app/pruned .
Expand Down
24 changes: 12 additions & 12 deletions studio/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ ARG SENTRY_PROJECT
ARG SENTRY_SERVER_SAMPLE_RATE
ARG SENTRY_EDGE_SAMPLE_RATE

ENV NEXT_PUBLIC_SENTRY_ENABLED $NEXT_PUBLIC_SENTRY_ENABLED
ENV NEXT_PUBLIC_SENTRY_REPLAY_ENABLED $NEXT_PUBLIC_SENTRY_REPLAY_ENABLED
ENV SENTRY_DEBUG $SENTRY_DEBUG
ENV SENTRY_AUTH_TOKEN $SENTRY_AUTH_TOKEN
ENV SENTRY_ORG $SENTRY_ORG
ENV SENTRY_PROJECT $SENTRY_PROJECT
ENV SENTRY_SERVER_SAMPLE_RATE $SENTRY_SERVER_SAMPLE_RATE
ENV SENTRY_EDGE_SAMPLE_RATE $SENTRY_EDGE_SAMPLE_RATE
ENV NEXT_PUBLIC_SENTRY_ENABLED=$NEXT_PUBLIC_SENTRY_ENABLED
ENV NEXT_PUBLIC_SENTRY_REPLAY_ENABLED=$NEXT_PUBLIC_SENTRY_REPLAY_ENABLED
ENV SENTRY_DEBUG=$SENTRY_DEBUG
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
ENV SENTRY_ORG=$SENTRY_ORG
ENV SENTRY_PROJECT=$SENTRY_PROJECT
ENV SENTRY_SERVER_SAMPLE_RATE=$SENTRY_SERVER_SAMPLE_RATE
ENV SENTRY_EDGE_SAMPLE_RATE=$SENTRY_EDGE_SAMPLE_RATE

COPY . /app/

Expand All @@ -48,8 +48,8 @@ FROM --platform=${BUILDPLATFORM} node:lts-alpine

WORKDIR /app

ENV NODE_ENV production
ENV NEXT_TELEMETRY_DISABLED 1
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1

# Fetch built artifacts
COPY --from=builder /app/studio/.next/standalone ./
Expand All @@ -64,7 +64,7 @@ ENTRYPOINT ["./entrypoint.sh"]

EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost
ENV PORT=3000
ENV HOSTNAME=localhost

CMD ["node", "./studio/server.js"]