|
1 | 1 | import { existsSync } from 'node:fs'; |
2 | 2 | import { readFile, writeFile } from 'node:fs/promises'; |
3 | | -import { randomUUID } from 'node:crypto'; |
4 | 3 | import { |
5 | 4 | buildRouterConfig, |
6 | 5 | type ComposedSubgraph, |
@@ -29,6 +28,8 @@ import { FederationSuccess, ROUTER_COMPATIBILITY_VERSION_ONE } from '@wundergrap |
29 | 28 | import { BaseCommandOptions } from '../../../core/types/types.js'; |
30 | 29 | import { composeSubgraphs, introspectSubgraph } from '../../../utils.js'; |
31 | 30 |
|
| 31 | +const STATIC_SCHEMA_VERSION_ID = '00000000-0000-0000-0000-000000000000'; |
| 32 | + |
32 | 33 | type ConfigSubgraph = StandardSubgraphConfig | SubgraphPluginConfig | GRPCSubgraphConfig; |
33 | 34 |
|
34 | 35 | type StandardSubgraphConfig = { |
@@ -241,19 +242,19 @@ export default (opts: BaseCommandOptions) => { |
241 | 242 | console.log(compositionWarningsTable.toString()); |
242 | 243 | } |
243 | 244 |
|
244 | | - const federatedClientSDL = result.shouldIncludeClientSchema ? printSchema(result.federatedGraphClientSchema) : ''; |
| 245 | + const federatedClientSDL = result.shouldIncludeClientSchema |
| 246 | + ? printSchemaWithDirectives(result.federatedGraphClientSchema) |
| 247 | + : ''; |
245 | 248 | const routerConfig = buildRouterConfig({ |
246 | 249 | federatedClientSDL, |
247 | 250 | federatedSDL: printSchemaWithDirectives(result.federatedGraphSchema), |
248 | 251 | fieldConfigurations: result.fieldConfigurations, |
249 | 252 | // @TODO get router compatibility version programmatically |
250 | 253 | routerCompatibilityVersion: ROUTER_COMPATIBILITY_VERSION_ONE, |
251 | | - schemaVersionId: 'static', |
| 254 | + schemaVersionId: STATIC_SCHEMA_VERSION_ID, |
252 | 255 | subgraphs: subgraphs.map((s, index) => constructRouterSubgraph(result, s, index)), |
253 | 256 | }); |
254 | 257 |
|
255 | | - routerConfig.version = randomUUID(); |
256 | | - |
257 | 258 | if (config.feature_flags && config.feature_flags.length > 0) { |
258 | 259 | const ffConfigs = await buildFeatureFlagsConfig(config, inputFileLocation, subgraphs, options); |
259 | 260 | routerConfig.featureFlagConfigs = ffConfigs; |
@@ -663,7 +664,7 @@ async function buildFeatureFlagsConfig( |
663 | 664 | engineConfig: featureRouterConfig.engineConfig, |
664 | 665 | }); |
665 | 666 |
|
666 | | - ffConfigs.configByFeatureFlagName[ff.name].version = randomUUID(); |
| 667 | + ffConfigs.configByFeatureFlagName[ff.name].version = STATIC_SCHEMA_VERSION_ID; |
667 | 668 | } |
668 | 669 |
|
669 | 670 | return ffConfigs; |
|
0 commit comments