@@ -219,6 +219,40 @@ describe('Global Object Identification', () => {
219
219
` ) ;
220
220
} ) ;
221
221
222
+ it ( 'should resolve node id without requesting key fields in client query' , async ( ) => {
223
+ const schema = await getStitchedSchemaFromLocalSchemas ( {
224
+ globalObjectIdentification : true ,
225
+ localSchemas : {
226
+ accounts,
227
+ } ,
228
+ } ) ;
229
+
230
+ await expect (
231
+ Promise . resolve (
232
+ normalizedExecutor ( {
233
+ schema,
234
+ document : parse ( /* GraphQL */ `
235
+ {
236
+ accounts {
237
+ nodeId
238
+ }
239
+ }
240
+ ` ) ,
241
+ } ) ,
242
+ ) ,
243
+ ) . resolves . toMatchInlineSnapshot ( `
244
+ {
245
+ "data": {
246
+ "accounts": [
247
+ {
248
+ "nodeId": "QWNjb3VudDphMQ==",
249
+ },
250
+ ],
251
+ },
252
+ }
253
+ ` ) ;
254
+ } ) ;
255
+
222
256
it ( 'should not resolve single field key object from globally unique node when doesnt exist' , async ( ) => {
223
257
const schema = await getStitchedSchemaFromLocalSchemas ( {
224
258
globalObjectIdentification : true ,
@@ -292,6 +326,43 @@ describe('Global Object Identification', () => {
292
326
` ) ;
293
327
} ) ;
294
328
329
+ it ( 'should resolve node id without requesting key fields in client query' , async ( ) => {
330
+ const schema = await getStitchedSchemaFromLocalSchemas ( {
331
+ globalObjectIdentification : true ,
332
+ localSchemas : {
333
+ people,
334
+ } ,
335
+ } ) ;
336
+
337
+ await expect (
338
+ Promise . resolve (
339
+ normalizedExecutor ( {
340
+ schema,
341
+ document : parse ( /* GraphQL */ `
342
+ {
343
+ people {
344
+ nodeId
345
+ }
346
+ }
347
+ ` ) ,
348
+ } ) ,
349
+ ) ,
350
+ ) . resolves . toMatchInlineSnapshot ( `
351
+ {
352
+ "data": {
353
+ "people": [
354
+ {
355
+ "nodeId": "UGVyc29uOnsiZmlyc3ROYW1lIjoiSm9obiIsImxhc3ROYW1lIjoiRG9lIn0=",
356
+ },
357
+ {
358
+ "nodeId": "UGVyc29uOnsiZmlyc3ROYW1lIjoiSmFuZSIsImxhc3ROYW1lIjoiRG9lIn0=",
359
+ },
360
+ ],
361
+ },
362
+ }
363
+ ` ) ;
364
+ } ) ;
365
+
295
366
it ( 'should resolve node id from object' , async ( ) => {
296
367
const schema = await getStitchedSchemaFromLocalSchemas ( {
297
368
globalObjectIdentification : true ,
0 commit comments