@salesforce/lds-adapters-uiapi 1.114.5 → 1.114.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -237,6 +237,10 @@ function createPageInfo(edges, startOffset, endOffset, maxOffset, metadata) {
237
237
  function findMaxOffset(metadata) {
238
238
  if (metadata === undefined)
239
239
  return -1;
240
+ const endOfList = metadata["__END__"];
241
+ if (endOfList !== undefined) {
242
+ return endOfList > 0 ? endOfList - 1 : 0; // Cursor based pagination in gql is off by one :)
243
+ }
240
244
  const { __END__: _, ...cursorMetadata } = metadata;
241
245
  const values = Object.values(cursorMetadata).filter((value) => value !== undefined);
242
246
  return Math.max(...values);
@@ -368,93 +372,6 @@ function revertPaginationOptimization(variables) {
368
372
  }
369
373
  }
370
374
 
371
- function applyToSelection$6(selection, directive, variables) {
372
- return selection;
373
- }
374
-
375
- function applyToSelection$5(selection, directive, variables) {
376
- return selection;
377
- }
378
-
379
- function applyToSelection$4(selection, directive, variables) {
380
- return selection;
381
- }
382
-
383
- function applyToSelection$3(selection, directive, variables) {
384
- var _a;
385
- const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
386
- if (ifArg && ifArg.value) {
387
- if (ifArg.value.kind === "BooleanValue") {
388
- return ifArg.value.value ? selection : undefined;
389
- }
390
- if (ifArg.value.kind === "Variable") {
391
- return variables[ifArg.value.name.value] ? selection : undefined;
392
- }
393
- }
394
- return selection;
395
- }
396
-
397
- function applyToSelection$2(selection, directive, variables) {
398
- var _a;
399
- const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
400
- if (ifArg && ifArg.value) {
401
- if (ifArg.value.kind === "BooleanValue") {
402
- return ifArg.value.value ? undefined : selection;
403
- }
404
- if (ifArg.value.kind === "Variable") {
405
- return variables[ifArg.value.name.value] ? undefined : selection;
406
- }
407
- }
408
- return selection;
409
- }
410
-
411
- function applyToSelection$1(selection, directive, variables) {
412
- return selection;
413
- }
414
-
415
- function applyToSelection(selection, directive, variables) {
416
- return selection;
417
- }
418
-
419
- function applyDirectivesForSelection(selection, variables) {
420
- let result = selection;
421
- if (selection && selection.directives) {
422
- // iterate through directives in order. Directives _can_ be stacked.
423
- for (var i = 0; i < selection.directives.length; i++) {
424
- const directive = selection.directives[i];
425
- switch (directive.name.value) {
426
- // Generate Case for each directive in the schema that supports SelectionNodes
427
- case ("generic"):
428
- result = applyToSelection$6(selection);
429
- break;
430
- case ("fieldCategory"):
431
- result = applyToSelection$5(selection);
432
- break;
433
- case ("category"):
434
- result = applyToSelection$4(selection);
435
- break;
436
- case ("include"):
437
- result = applyToSelection$3(selection, directive, variables);
438
- break;
439
- case ("skip"):
440
- result = applyToSelection$2(selection, directive, variables);
441
- break;
442
- case ("deprecated"):
443
- result = applyToSelection$1(selection);
444
- break;
445
- case ("specifiedBy"):
446
- result = applyToSelection(selection);
447
- break;
448
- }
449
- if (result === undefined) {
450
- // Selection was removed.
451
- break;
452
- }
453
- }
454
- }
455
- return result;
456
- }
457
-
458
375
  const name$G = 'DoubleValue';
459
376
  const VERSION$Q = 'de69c0962aca45d77a5bc8d9abacfa7d';
460
377
  function keyBuilder$L(luvio, path, data) {
@@ -514,79 +431,18 @@ function selectType$H(typename, sel, fieldData, reader, key, sink, variables, fr
514
431
  }
515
432
  return sink;
516
433
  }
517
- function buildSelectionForField$G(source, reader, sel, variables, fragments) {
518
- const sink = {};
519
- const fieldData = getFieldData$G(source, sel, variables);
520
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
521
- reader.enterPath(requestedFieldName);
522
- if (fieldData === undefined) {
523
- reader.markMissing();
524
- reader.exitPath();
525
- return;
526
- }
527
- if (fieldData === null) {
528
- reader.assignScalar(requestedFieldName, sink, fieldData);
529
- return sink;
530
- }
531
- const fieldType = getFieldType$11(sel);
532
- if (fieldType === undefined) {
533
- // This field's type is unknown to us. This breaks normalization.
534
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
535
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
536
- }
537
- else if (fieldType.isArray) {
538
- const arraySink = [];
539
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
540
- reader.enterPath(i);
541
- selectType$H(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
542
- reader.exitPath();
543
- }
544
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
545
- }
546
- else {
547
- selectType$H(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
548
- }
549
- reader.exitPath();
550
- return sink;
434
+ function buildSelectionForField$H(source, reader, sel, variables, fragments) {
435
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$G, getFieldType$11, selectType$H);
551
436
  }
552
- function buildSelectionForNode$G(source, reader, parentNode, selectionNode, variables, fragments) {
553
- const sink = {};
554
- if (selectionNode.directives) {
555
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
556
- if (selectionWithDirectives === undefined) {
557
- return;
558
- }
559
- selectionNode = selectionWithDirectives;
560
- }
561
- if (selectionNode.kind === "InlineFragment") {
562
- if (isFragmentApplicable$H(selectionNode, source.data.__typename)) {
563
- // Get selections out of the inline fragment
564
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
565
- // Call into field handling with selections
566
- Object.assign(sink, buildSelectionForNode$G(source, reader, parentNode, fragmentSelection, variables, fragments));
567
- });
568
- }
569
- }
570
- if (selectionNode.kind === "FragmentSpread") {
571
- const namedFragment = fragments[selectionNode.name.value];
572
- if (namedFragment && isFragmentApplicable$H(namedFragment, source.data.__typename)) {
573
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
574
- // Call into field handling with selections
575
- Object.assign(sink, buildSelectionForNode$G(source, reader, parentNode, fragmentSelection, variables, fragments));
576
- });
577
- }
578
- }
579
- if (selectionNode.kind === "Field") {
580
- Object.assign(sink, buildSelectionForField$G(source, reader, selectionNode, variables));
581
- }
582
- return sink;
437
+ function buildSelectionForNode$H(source, reader, parentNode, selectionNode, variables, fragments) {
438
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$H, buildSelectionForField$H);
583
439
  }
584
440
  function select$Q(field, variables, fragments) {
585
441
  return (source, reader) => {
586
442
  var _a;
587
443
  const sink = {};
588
444
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
589
- const builtSelection = buildSelectionForNode$G(source, reader, field, sel, variables, fragments);
445
+ const builtSelection = buildSelectionForNode$H(source, reader, field, sel, variables, fragments);
590
446
  if (builtSelection !== undefined) {
591
447
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
592
448
  Object.keys(builtSelection).forEach((key, value) => {
@@ -734,79 +590,18 @@ function selectType$G(typename, sel, fieldData, reader, key, sink, variables, fr
734
590
  }
735
591
  return sink;
736
592
  }
737
- function buildSelectionForField$F(source, reader, sel, variables, fragments) {
738
- const sink = {};
739
- const fieldData = getFieldData$F(source, sel, variables);
740
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
741
- reader.enterPath(requestedFieldName);
742
- if (fieldData === undefined) {
743
- reader.markMissing();
744
- reader.exitPath();
745
- return;
746
- }
747
- if (fieldData === null) {
748
- reader.assignScalar(requestedFieldName, sink, fieldData);
749
- return sink;
750
- }
751
- const fieldType = getFieldType$10(sel);
752
- if (fieldType === undefined) {
753
- // This field's type is unknown to us. This breaks normalization.
754
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
755
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
756
- }
757
- else if (fieldType.isArray) {
758
- const arraySink = [];
759
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
760
- reader.enterPath(i);
761
- selectType$G(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
762
- reader.exitPath();
763
- }
764
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
765
- }
766
- else {
767
- selectType$G(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
768
- }
769
- reader.exitPath();
770
- return sink;
593
+ function buildSelectionForField$G(source, reader, sel, variables, fragments) {
594
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$F, getFieldType$10, selectType$G);
771
595
  }
772
- function buildSelectionForNode$F(source, reader, parentNode, selectionNode, variables, fragments) {
773
- const sink = {};
774
- if (selectionNode.directives) {
775
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
776
- if (selectionWithDirectives === undefined) {
777
- return;
778
- }
779
- selectionNode = selectionWithDirectives;
780
- }
781
- if (selectionNode.kind === "InlineFragment") {
782
- if (isFragmentApplicable$G(selectionNode, source.data.__typename)) {
783
- // Get selections out of the inline fragment
784
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
785
- // Call into field handling with selections
786
- Object.assign(sink, buildSelectionForNode$F(source, reader, parentNode, fragmentSelection, variables, fragments));
787
- });
788
- }
789
- }
790
- if (selectionNode.kind === "FragmentSpread") {
791
- const namedFragment = fragments[selectionNode.name.value];
792
- if (namedFragment && isFragmentApplicable$G(namedFragment, source.data.__typename)) {
793
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
794
- // Call into field handling with selections
795
- Object.assign(sink, buildSelectionForNode$F(source, reader, parentNode, fragmentSelection, variables, fragments));
796
- });
797
- }
798
- }
799
- if (selectionNode.kind === "Field") {
800
- Object.assign(sink, buildSelectionForField$F(source, reader, selectionNode, variables));
801
- }
802
- return sink;
596
+ function buildSelectionForNode$G(source, reader, parentNode, selectionNode, variables, fragments) {
597
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$G, buildSelectionForField$G);
803
598
  }
804
599
  function select$P(field, variables, fragments) {
805
600
  return (source, reader) => {
806
601
  var _a;
807
602
  const sink = {};
808
603
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
809
- const builtSelection = buildSelectionForNode$F(source, reader, field, sel, variables, fragments);
604
+ const builtSelection = buildSelectionForNode$G(source, reader, field, sel, variables, fragments);
810
605
  if (builtSelection !== undefined) {
811
606
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
812
607
  Object.keys(builtSelection).forEach((key, value) => {
@@ -954,79 +749,18 @@ function selectType$F(typename, sel, fieldData, reader, key, sink, variables, fr
954
749
  }
955
750
  return sink;
956
751
  }
957
- function buildSelectionForField$E(source, reader, sel, variables, fragments) {
958
- const sink = {};
959
- const fieldData = getFieldData$E(source, sel, variables);
960
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
961
- reader.enterPath(requestedFieldName);
962
- if (fieldData === undefined) {
963
- reader.markMissing();
964
- reader.exitPath();
965
- return;
966
- }
967
- if (fieldData === null) {
968
- reader.assignScalar(requestedFieldName, sink, fieldData);
969
- return sink;
970
- }
971
- const fieldType = getFieldType$$(sel);
972
- if (fieldType === undefined) {
973
- // This field's type is unknown to us. This breaks normalization.
974
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
975
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
976
- }
977
- else if (fieldType.isArray) {
978
- const arraySink = [];
979
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
980
- reader.enterPath(i);
981
- selectType$F(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
982
- reader.exitPath();
983
- }
984
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
985
- }
986
- else {
987
- selectType$F(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
988
- }
989
- reader.exitPath();
990
- return sink;
752
+ function buildSelectionForField$F(source, reader, sel, variables, fragments) {
753
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$E, getFieldType$$, selectType$F);
991
754
  }
992
- function buildSelectionForNode$E(source, reader, parentNode, selectionNode, variables, fragments) {
993
- const sink = {};
994
- if (selectionNode.directives) {
995
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
996
- if (selectionWithDirectives === undefined) {
997
- return;
998
- }
999
- selectionNode = selectionWithDirectives;
1000
- }
1001
- if (selectionNode.kind === "InlineFragment") {
1002
- if (isFragmentApplicable$F(selectionNode, source.data.__typename)) {
1003
- // Get selections out of the inline fragment
1004
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
1005
- // Call into field handling with selections
1006
- Object.assign(sink, buildSelectionForNode$E(source, reader, parentNode, fragmentSelection, variables, fragments));
1007
- });
1008
- }
1009
- }
1010
- if (selectionNode.kind === "FragmentSpread") {
1011
- const namedFragment = fragments[selectionNode.name.value];
1012
- if (namedFragment && isFragmentApplicable$F(namedFragment, source.data.__typename)) {
1013
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
1014
- // Call into field handling with selections
1015
- Object.assign(sink, buildSelectionForNode$E(source, reader, parentNode, fragmentSelection, variables, fragments));
1016
- });
1017
- }
1018
- }
1019
- if (selectionNode.kind === "Field") {
1020
- Object.assign(sink, buildSelectionForField$E(source, reader, selectionNode, variables));
1021
- }
1022
- return sink;
755
+ function buildSelectionForNode$F(source, reader, parentNode, selectionNode, variables, fragments) {
756
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$F, buildSelectionForField$F);
1023
757
  }
1024
758
  function select$O(field, variables, fragments) {
1025
759
  return (source, reader) => {
1026
760
  var _a;
1027
761
  const sink = {};
1028
762
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
1029
- const builtSelection = buildSelectionForNode$E(source, reader, field, sel, variables, fragments);
763
+ const builtSelection = buildSelectionForNode$F(source, reader, field, sel, variables, fragments);
1030
764
  if (builtSelection !== undefined) {
1031
765
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
1032
766
  Object.keys(builtSelection).forEach((key, value) => {
@@ -1256,79 +990,18 @@ function selectType$E(typename, sel, fieldData, reader, key, sink, variables, fr
1256
990
  }
1257
991
  return sink;
1258
992
  }
1259
- function buildSelectionForField$D(source, reader, sel, variables, fragments) {
1260
- const sink = {};
1261
- const fieldData = getFieldData$D(source, sel, variables);
1262
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
1263
- reader.enterPath(requestedFieldName);
1264
- if (fieldData === undefined) {
1265
- reader.markMissing();
1266
- reader.exitPath();
1267
- return;
1268
- }
1269
- if (fieldData === null) {
1270
- reader.assignScalar(requestedFieldName, sink, fieldData);
1271
- return sink;
1272
- }
1273
- const fieldType = getFieldType$Z(sel);
1274
- if (fieldType === undefined) {
1275
- // This field's type is unknown to us. This breaks normalization.
1276
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
1277
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
1278
- }
1279
- else if (fieldType.isArray) {
1280
- const arraySink = [];
1281
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
1282
- reader.enterPath(i);
1283
- selectType$E(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
1284
- reader.exitPath();
1285
- }
1286
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
1287
- }
1288
- else {
1289
- selectType$E(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
1290
- }
1291
- reader.exitPath();
1292
- return sink;
993
+ function buildSelectionForField$E(source, reader, sel, variables, fragments) {
994
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$D, getFieldType$Z, selectType$E);
1293
995
  }
1294
- function buildSelectionForNode$D(source, reader, parentNode, selectionNode, variables, fragments) {
1295
- const sink = {};
1296
- if (selectionNode.directives) {
1297
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
1298
- if (selectionWithDirectives === undefined) {
1299
- return;
1300
- }
1301
- selectionNode = selectionWithDirectives;
1302
- }
1303
- if (selectionNode.kind === "InlineFragment") {
1304
- if (isFragmentApplicable$E(selectionNode, source.data.__typename)) {
1305
- // Get selections out of the inline fragment
1306
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
1307
- // Call into field handling with selections
1308
- Object.assign(sink, buildSelectionForNode$D(source, reader, parentNode, fragmentSelection, variables, fragments));
1309
- });
1310
- }
1311
- }
1312
- if (selectionNode.kind === "FragmentSpread") {
1313
- const namedFragment = fragments[selectionNode.name.value];
1314
- if (namedFragment && isFragmentApplicable$E(namedFragment, source.data.__typename)) {
1315
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
1316
- // Call into field handling with selections
1317
- Object.assign(sink, buildSelectionForNode$D(source, reader, parentNode, fragmentSelection, variables, fragments));
1318
- });
1319
- }
1320
- }
1321
- if (selectionNode.kind === "Field") {
1322
- Object.assign(sink, buildSelectionForField$D(source, reader, selectionNode, variables));
1323
- }
1324
- return sink;
996
+ function buildSelectionForNode$E(source, reader, parentNode, selectionNode, variables, fragments) {
997
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$E, buildSelectionForField$E);
1325
998
  }
1326
999
  function select$N(field, variables, fragments) {
1327
1000
  return (source, reader) => {
1328
1001
  var _a;
1329
1002
  const sink = {};
1330
1003
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
1331
- const builtSelection = buildSelectionForNode$D(source, reader, field, sel, variables, fragments);
1004
+ const builtSelection = buildSelectionForNode$E(source, reader, field, sel, variables, fragments);
1332
1005
  if (builtSelection !== undefined) {
1333
1006
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
1334
1007
  Object.keys(builtSelection).forEach((key, value) => {
@@ -1472,79 +1145,18 @@ function selectType$D(typename, sel, fieldData, reader, key, sink, variables, fr
1472
1145
  }
1473
1146
  return sink;
1474
1147
  }
1475
- function buildSelectionForField$C(source, reader, sel, variables, fragments) {
1476
- const sink = {};
1477
- const fieldData = getFieldData$C(source, sel, variables);
1478
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
1479
- reader.enterPath(requestedFieldName);
1480
- if (fieldData === undefined) {
1481
- reader.markMissing();
1482
- reader.exitPath();
1483
- return;
1484
- }
1485
- if (fieldData === null) {
1486
- reader.assignScalar(requestedFieldName, sink, fieldData);
1487
- return sink;
1488
- }
1489
- const fieldType = getFieldType$Y(sel);
1490
- if (fieldType === undefined) {
1491
- // This field's type is unknown to us. This breaks normalization.
1492
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
1493
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
1494
- }
1495
- else if (fieldType.isArray) {
1496
- const arraySink = [];
1497
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
1498
- reader.enterPath(i);
1499
- selectType$D(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
1500
- reader.exitPath();
1501
- }
1502
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
1503
- }
1504
- else {
1505
- selectType$D(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
1506
- }
1507
- reader.exitPath();
1508
- return sink;
1148
+ function buildSelectionForField$D(source, reader, sel, variables, fragments) {
1149
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$C, getFieldType$Y, selectType$D);
1509
1150
  }
1510
- function buildSelectionForNode$C(source, reader, parentNode, selectionNode, variables, fragments) {
1511
- const sink = {};
1512
- if (selectionNode.directives) {
1513
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
1514
- if (selectionWithDirectives === undefined) {
1515
- return;
1516
- }
1517
- selectionNode = selectionWithDirectives;
1518
- }
1519
- if (selectionNode.kind === "InlineFragment") {
1520
- if (isFragmentApplicable$D(selectionNode, source.data.__typename)) {
1521
- // Get selections out of the inline fragment
1522
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
1523
- // Call into field handling with selections
1524
- Object.assign(sink, buildSelectionForNode$C(source, reader, parentNode, fragmentSelection, variables, fragments));
1525
- });
1526
- }
1527
- }
1528
- if (selectionNode.kind === "FragmentSpread") {
1529
- const namedFragment = fragments[selectionNode.name.value];
1530
- if (namedFragment && isFragmentApplicable$D(namedFragment, source.data.__typename)) {
1531
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
1532
- // Call into field handling with selections
1533
- Object.assign(sink, buildSelectionForNode$C(source, reader, parentNode, fragmentSelection, variables, fragments));
1534
- });
1535
- }
1536
- }
1537
- if (selectionNode.kind === "Field") {
1538
- Object.assign(sink, buildSelectionForField$C(source, reader, selectionNode, variables));
1539
- }
1540
- return sink;
1151
+ function buildSelectionForNode$D(source, reader, parentNode, selectionNode, variables, fragments) {
1152
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$D, buildSelectionForField$D);
1541
1153
  }
1542
1154
  function select$M(field, variables, fragments) {
1543
1155
  return (source, reader) => {
1544
1156
  var _a;
1545
1157
  const sink = {};
1546
1158
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
1547
- const builtSelection = buildSelectionForNode$C(source, reader, field, sel, variables, fragments);
1159
+ const builtSelection = buildSelectionForNode$D(source, reader, field, sel, variables, fragments);
1548
1160
  if (builtSelection !== undefined) {
1549
1161
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
1550
1162
  Object.keys(builtSelection).forEach((key, value) => {
@@ -1764,79 +1376,18 @@ function selectType$C(typename, sel, fieldData, reader, key, sink, variables, fr
1764
1376
  }
1765
1377
  return sink;
1766
1378
  }
1767
- function buildSelectionForField$B(source, reader, sel, variables, fragments) {
1768
- const sink = {};
1769
- const fieldData = getFieldData$B(source, sel, variables);
1770
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
1771
- reader.enterPath(requestedFieldName);
1772
- if (fieldData === undefined) {
1773
- reader.markMissing();
1774
- reader.exitPath();
1775
- return;
1776
- }
1777
- if (fieldData === null) {
1778
- reader.assignScalar(requestedFieldName, sink, fieldData);
1779
- return sink;
1780
- }
1781
- const fieldType = getFieldType$W(sel);
1782
- if (fieldType === undefined) {
1783
- // This field's type is unknown to us. This breaks normalization.
1784
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
1785
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
1786
- }
1787
- else if (fieldType.isArray) {
1788
- const arraySink = [];
1789
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
1790
- reader.enterPath(i);
1791
- selectType$C(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
1792
- reader.exitPath();
1793
- }
1794
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
1795
- }
1796
- else {
1797
- selectType$C(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
1798
- }
1799
- reader.exitPath();
1800
- return sink;
1379
+ function buildSelectionForField$C(source, reader, sel, variables, fragments) {
1380
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$B, getFieldType$W, selectType$C);
1801
1381
  }
1802
- function buildSelectionForNode$B(source, reader, parentNode, selectionNode, variables, fragments) {
1803
- const sink = {};
1804
- if (selectionNode.directives) {
1805
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
1806
- if (selectionWithDirectives === undefined) {
1807
- return;
1808
- }
1809
- selectionNode = selectionWithDirectives;
1810
- }
1811
- if (selectionNode.kind === "InlineFragment") {
1812
- if (isFragmentApplicable$C(selectionNode, source.data.__typename)) {
1813
- // Get selections out of the inline fragment
1814
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
1815
- // Call into field handling with selections
1816
- Object.assign(sink, buildSelectionForNode$B(source, reader, parentNode, fragmentSelection, variables, fragments));
1817
- });
1818
- }
1819
- }
1820
- if (selectionNode.kind === "FragmentSpread") {
1821
- const namedFragment = fragments[selectionNode.name.value];
1822
- if (namedFragment && isFragmentApplicable$C(namedFragment, source.data.__typename)) {
1823
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
1824
- // Call into field handling with selections
1825
- Object.assign(sink, buildSelectionForNode$B(source, reader, parentNode, fragmentSelection, variables, fragments));
1826
- });
1827
- }
1828
- }
1829
- if (selectionNode.kind === "Field") {
1830
- Object.assign(sink, buildSelectionForField$B(source, reader, selectionNode, variables));
1831
- }
1832
- return sink;
1382
+ function buildSelectionForNode$C(source, reader, parentNode, selectionNode, variables, fragments) {
1383
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$C, buildSelectionForField$C);
1833
1384
  }
1834
1385
  function select$L(field, variables, fragments) {
1835
1386
  return (source, reader) => {
1836
1387
  var _a;
1837
1388
  const sink = {};
1838
1389
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
1839
- const builtSelection = buildSelectionForNode$B(source, reader, field, sel, variables, fragments);
1390
+ const builtSelection = buildSelectionForNode$C(source, reader, field, sel, variables, fragments);
1840
1391
  if (builtSelection !== undefined) {
1841
1392
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
1842
1393
  Object.keys(builtSelection).forEach((key, value) => {
@@ -1978,79 +1529,18 @@ function selectType$B(typename, sel, fieldData, reader, key, sink, variables, fr
1978
1529
  }
1979
1530
  return sink;
1980
1531
  }
1981
- function buildSelectionForField$A(source, reader, sel, variables, fragments) {
1982
- const sink = {};
1983
- const fieldData = getFieldData$A(source, sel, variables);
1984
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
1985
- reader.enterPath(requestedFieldName);
1986
- if (fieldData === undefined) {
1987
- reader.markMissing();
1988
- reader.exitPath();
1989
- return;
1990
- }
1991
- if (fieldData === null) {
1992
- reader.assignScalar(requestedFieldName, sink, fieldData);
1993
- return sink;
1994
- }
1995
- const fieldType = getFieldType$V(sel);
1996
- if (fieldType === undefined) {
1997
- // This field's type is unknown to us. This breaks normalization.
1998
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
1999
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
2000
- }
2001
- else if (fieldType.isArray) {
2002
- const arraySink = [];
2003
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
2004
- reader.enterPath(i);
2005
- selectType$B(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
2006
- reader.exitPath();
2007
- }
2008
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
2009
- }
2010
- else {
2011
- selectType$B(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
2012
- }
2013
- reader.exitPath();
2014
- return sink;
1532
+ function buildSelectionForField$B(source, reader, sel, variables, fragments) {
1533
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$A, getFieldType$V, selectType$B);
2015
1534
  }
2016
- function buildSelectionForNode$A(source, reader, parentNode, selectionNode, variables, fragments) {
2017
- const sink = {};
2018
- if (selectionNode.directives) {
2019
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
2020
- if (selectionWithDirectives === undefined) {
2021
- return;
2022
- }
2023
- selectionNode = selectionWithDirectives;
2024
- }
2025
- if (selectionNode.kind === "InlineFragment") {
2026
- if (isFragmentApplicable$B(selectionNode, source.data.__typename)) {
2027
- // Get selections out of the inline fragment
2028
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
2029
- // Call into field handling with selections
2030
- Object.assign(sink, buildSelectionForNode$A(source, reader, parentNode, fragmentSelection, variables, fragments));
2031
- });
2032
- }
2033
- }
2034
- if (selectionNode.kind === "FragmentSpread") {
2035
- const namedFragment = fragments[selectionNode.name.value];
2036
- if (namedFragment && isFragmentApplicable$B(namedFragment, source.data.__typename)) {
2037
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
2038
- // Call into field handling with selections
2039
- Object.assign(sink, buildSelectionForNode$A(source, reader, parentNode, fragmentSelection, variables, fragments));
2040
- });
2041
- }
2042
- }
2043
- if (selectionNode.kind === "Field") {
2044
- Object.assign(sink, buildSelectionForField$A(source, reader, selectionNode, variables));
2045
- }
2046
- return sink;
1535
+ function buildSelectionForNode$B(source, reader, parentNode, selectionNode, variables, fragments) {
1536
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$B, buildSelectionForField$B);
2047
1537
  }
2048
1538
  function select$K(field, variables, fragments) {
2049
1539
  return (source, reader) => {
2050
1540
  var _a;
2051
1541
  const sink = {};
2052
1542
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
2053
- const builtSelection = buildSelectionForNode$A(source, reader, field, sel, variables, fragments);
1543
+ const builtSelection = buildSelectionForNode$B(source, reader, field, sel, variables, fragments);
2054
1544
  if (builtSelection !== undefined) {
2055
1545
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
2056
1546
  Object.keys(builtSelection).forEach((key, value) => {
@@ -2198,79 +1688,18 @@ function selectType$A(typename, sel, fieldData, reader, key, sink, variables, fr
2198
1688
  }
2199
1689
  return sink;
2200
1690
  }
2201
- function buildSelectionForField$z(source, reader, sel, variables, fragments) {
2202
- const sink = {};
2203
- const fieldData = getFieldData$z(source, sel, variables);
2204
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
2205
- reader.enterPath(requestedFieldName);
2206
- if (fieldData === undefined) {
2207
- reader.markMissing();
2208
- reader.exitPath();
2209
- return;
2210
- }
2211
- if (fieldData === null) {
2212
- reader.assignScalar(requestedFieldName, sink, fieldData);
2213
- return sink;
2214
- }
2215
- const fieldType = getFieldType$U(sel);
2216
- if (fieldType === undefined) {
2217
- // This field's type is unknown to us. This breaks normalization.
2218
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
2219
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
2220
- }
2221
- else if (fieldType.isArray) {
2222
- const arraySink = [];
2223
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
2224
- reader.enterPath(i);
2225
- selectType$A(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
2226
- reader.exitPath();
2227
- }
2228
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
2229
- }
2230
- else {
2231
- selectType$A(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
2232
- }
2233
- reader.exitPath();
2234
- return sink;
1691
+ function buildSelectionForField$A(source, reader, sel, variables, fragments) {
1692
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$z, getFieldType$U, selectType$A);
2235
1693
  }
2236
- function buildSelectionForNode$z(source, reader, parentNode, selectionNode, variables, fragments) {
2237
- const sink = {};
2238
- if (selectionNode.directives) {
2239
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
2240
- if (selectionWithDirectives === undefined) {
2241
- return;
2242
- }
2243
- selectionNode = selectionWithDirectives;
2244
- }
2245
- if (selectionNode.kind === "InlineFragment") {
2246
- if (isFragmentApplicable$A(selectionNode, source.data.__typename)) {
2247
- // Get selections out of the inline fragment
2248
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
2249
- // Call into field handling with selections
2250
- Object.assign(sink, buildSelectionForNode$z(source, reader, parentNode, fragmentSelection, variables, fragments));
2251
- });
2252
- }
2253
- }
2254
- if (selectionNode.kind === "FragmentSpread") {
2255
- const namedFragment = fragments[selectionNode.name.value];
2256
- if (namedFragment && isFragmentApplicable$A(namedFragment, source.data.__typename)) {
2257
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
2258
- // Call into field handling with selections
2259
- Object.assign(sink, buildSelectionForNode$z(source, reader, parentNode, fragmentSelection, variables, fragments));
2260
- });
2261
- }
2262
- }
2263
- if (selectionNode.kind === "Field") {
2264
- Object.assign(sink, buildSelectionForField$z(source, reader, selectionNode, variables));
2265
- }
2266
- return sink;
1694
+ function buildSelectionForNode$A(source, reader, parentNode, selectionNode, variables, fragments) {
1695
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$A, buildSelectionForField$A);
2267
1696
  }
2268
1697
  function select$J(field, variables, fragments) {
2269
1698
  return (source, reader) => {
2270
1699
  var _a;
2271
1700
  const sink = {};
2272
1701
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
2273
- const builtSelection = buildSelectionForNode$z(source, reader, field, sel, variables, fragments);
1702
+ const builtSelection = buildSelectionForNode$A(source, reader, field, sel, variables, fragments);
2274
1703
  if (builtSelection !== undefined) {
2275
1704
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
2276
1705
  Object.keys(builtSelection).forEach((key, value) => {
@@ -2412,79 +1841,18 @@ function selectType$z(typename, sel, fieldData, reader, key, sink, variables, fr
2412
1841
  }
2413
1842
  return sink;
2414
1843
  }
2415
- function buildSelectionForField$y(source, reader, sel, variables, fragments) {
2416
- const sink = {};
2417
- const fieldData = getFieldData$y(source, sel, variables);
2418
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
2419
- reader.enterPath(requestedFieldName);
2420
- if (fieldData === undefined) {
2421
- reader.markMissing();
2422
- reader.exitPath();
2423
- return;
2424
- }
2425
- if (fieldData === null) {
2426
- reader.assignScalar(requestedFieldName, sink, fieldData);
2427
- return sink;
2428
- }
2429
- const fieldType = getFieldType$T(sel);
2430
- if (fieldType === undefined) {
2431
- // This field's type is unknown to us. This breaks normalization.
2432
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
2433
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
2434
- }
2435
- else if (fieldType.isArray) {
2436
- const arraySink = [];
2437
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
2438
- reader.enterPath(i);
2439
- selectType$z(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
2440
- reader.exitPath();
2441
- }
2442
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
2443
- }
2444
- else {
2445
- selectType$z(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
2446
- }
2447
- reader.exitPath();
2448
- return sink;
1844
+ function buildSelectionForField$z(source, reader, sel, variables, fragments) {
1845
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$y, getFieldType$T, selectType$z);
2449
1846
  }
2450
- function buildSelectionForNode$y(source, reader, parentNode, selectionNode, variables, fragments) {
2451
- const sink = {};
2452
- if (selectionNode.directives) {
2453
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
2454
- if (selectionWithDirectives === undefined) {
2455
- return;
2456
- }
2457
- selectionNode = selectionWithDirectives;
2458
- }
2459
- if (selectionNode.kind === "InlineFragment") {
2460
- if (isFragmentApplicable$z(selectionNode, source.data.__typename)) {
2461
- // Get selections out of the inline fragment
2462
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
2463
- // Call into field handling with selections
2464
- Object.assign(sink, buildSelectionForNode$y(source, reader, parentNode, fragmentSelection, variables, fragments));
2465
- });
2466
- }
2467
- }
2468
- if (selectionNode.kind === "FragmentSpread") {
2469
- const namedFragment = fragments[selectionNode.name.value];
2470
- if (namedFragment && isFragmentApplicable$z(namedFragment, source.data.__typename)) {
2471
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
2472
- // Call into field handling with selections
2473
- Object.assign(sink, buildSelectionForNode$y(source, reader, parentNode, fragmentSelection, variables, fragments));
2474
- });
2475
- }
2476
- }
2477
- if (selectionNode.kind === "Field") {
2478
- Object.assign(sink, buildSelectionForField$y(source, reader, selectionNode, variables));
2479
- }
2480
- return sink;
1847
+ function buildSelectionForNode$z(source, reader, parentNode, selectionNode, variables, fragments) {
1848
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$z, buildSelectionForField$z);
2481
1849
  }
2482
1850
  function select$I(field, variables, fragments) {
2483
1851
  return (source, reader) => {
2484
1852
  var _a;
2485
1853
  const sink = {};
2486
1854
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
2487
- const builtSelection = buildSelectionForNode$y(source, reader, field, sel, variables, fragments);
1855
+ const builtSelection = buildSelectionForNode$z(source, reader, field, sel, variables, fragments);
2488
1856
  if (builtSelection !== undefined) {
2489
1857
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
2490
1858
  Object.keys(builtSelection).forEach((key, value) => {
@@ -2611,100 +1979,39 @@ function getFieldData$x(source, sel, variables) {
2611
1979
  default: {
2612
1980
  const fieldType = getFieldType$S(sel);
2613
1981
  const fieldKey = getSerializedKeyForField(sel, variables, fieldType);
2614
- return source.data[fieldKey];
2615
- }
2616
- }
2617
- }
2618
- function selectType$y(typename, sel, fieldData, reader, key, sink, variables, fragments) {
2619
- if (fieldData === null) {
2620
- reader.assignScalar(key, sink, fieldData);
2621
- return sink;
2622
- }
2623
- switch (typename) {
2624
- case 'String': {
2625
- reader.assignScalar(key, sink, fieldData);
2626
- break;
2627
- }
2628
- case 'Date': {
2629
- reader.assignScalar(key, sink, fieldData);
2630
- break;
2631
- }
2632
- }
2633
- return sink;
2634
- }
2635
- function buildSelectionForField$x(source, reader, sel, variables, fragments) {
2636
- const sink = {};
2637
- const fieldData = getFieldData$x(source, sel, variables);
2638
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
2639
- reader.enterPath(requestedFieldName);
2640
- if (fieldData === undefined) {
2641
- reader.markMissing();
2642
- reader.exitPath();
2643
- return;
2644
- }
2645
- if (fieldData === null) {
2646
- reader.assignScalar(requestedFieldName, sink, fieldData);
2647
- return sink;
2648
- }
2649
- const fieldType = getFieldType$S(sel);
2650
- if (fieldType === undefined) {
2651
- // This field's type is unknown to us. This breaks normalization.
2652
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
2653
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
2654
- }
2655
- else if (fieldType.isArray) {
2656
- const arraySink = [];
2657
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
2658
- reader.enterPath(i);
2659
- selectType$y(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
2660
- reader.exitPath();
2661
- }
2662
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
2663
- }
2664
- else {
2665
- selectType$y(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
2666
- }
2667
- reader.exitPath();
2668
- return sink;
2669
- }
2670
- function buildSelectionForNode$x(source, reader, parentNode, selectionNode, variables, fragments) {
2671
- const sink = {};
2672
- if (selectionNode.directives) {
2673
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
2674
- if (selectionWithDirectives === undefined) {
2675
- return;
2676
- }
2677
- selectionNode = selectionWithDirectives;
2678
- }
2679
- if (selectionNode.kind === "InlineFragment") {
2680
- if (isFragmentApplicable$y(selectionNode, source.data.__typename)) {
2681
- // Get selections out of the inline fragment
2682
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
2683
- // Call into field handling with selections
2684
- Object.assign(sink, buildSelectionForNode$x(source, reader, parentNode, fragmentSelection, variables, fragments));
2685
- });
2686
- }
2687
- }
2688
- if (selectionNode.kind === "FragmentSpread") {
2689
- const namedFragment = fragments[selectionNode.name.value];
2690
- if (namedFragment && isFragmentApplicable$y(namedFragment, source.data.__typename)) {
2691
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
2692
- // Call into field handling with selections
2693
- Object.assign(sink, buildSelectionForNode$x(source, reader, parentNode, fragmentSelection, variables, fragments));
2694
- });
1982
+ return source.data[fieldKey];
2695
1983
  }
2696
1984
  }
2697
- if (selectionNode.kind === "Field") {
2698
- Object.assign(sink, buildSelectionForField$x(source, reader, selectionNode, variables));
1985
+ }
1986
+ function selectType$y(typename, sel, fieldData, reader, key, sink, variables, fragments) {
1987
+ if (fieldData === null) {
1988
+ reader.assignScalar(key, sink, fieldData);
1989
+ return sink;
1990
+ }
1991
+ switch (typename) {
1992
+ case 'String': {
1993
+ reader.assignScalar(key, sink, fieldData);
1994
+ break;
1995
+ }
1996
+ case 'Date': {
1997
+ reader.assignScalar(key, sink, fieldData);
1998
+ break;
1999
+ }
2699
2000
  }
2700
2001
  return sink;
2701
2002
  }
2003
+ function buildSelectionForField$y(source, reader, sel, variables, fragments) {
2004
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$x, getFieldType$S, selectType$y);
2005
+ }
2006
+ function buildSelectionForNode$y(source, reader, parentNode, selectionNode, variables, fragments) {
2007
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$y, buildSelectionForField$y);
2008
+ }
2702
2009
  function select$H(field, variables, fragments) {
2703
2010
  return (source, reader) => {
2704
2011
  var _a;
2705
2012
  const sink = {};
2706
2013
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
2707
- const builtSelection = buildSelectionForNode$x(source, reader, field, sel, variables, fragments);
2014
+ const builtSelection = buildSelectionForNode$y(source, reader, field, sel, variables, fragments);
2708
2015
  if (builtSelection !== undefined) {
2709
2016
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
2710
2017
  Object.keys(builtSelection).forEach((key, value) => {
@@ -2852,79 +2159,18 @@ function selectType$x(typename, sel, fieldData, reader, key, sink, variables, fr
2852
2159
  }
2853
2160
  return sink;
2854
2161
  }
2855
- function buildSelectionForField$w(source, reader, sel, variables, fragments) {
2856
- const sink = {};
2857
- const fieldData = getFieldData$w(source, sel, variables);
2858
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
2859
- reader.enterPath(requestedFieldName);
2860
- if (fieldData === undefined) {
2861
- reader.markMissing();
2862
- reader.exitPath();
2863
- return;
2864
- }
2865
- if (fieldData === null) {
2866
- reader.assignScalar(requestedFieldName, sink, fieldData);
2867
- return sink;
2868
- }
2869
- const fieldType = getFieldType$R(sel);
2870
- if (fieldType === undefined) {
2871
- // This field's type is unknown to us. This breaks normalization.
2872
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
2873
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
2874
- }
2875
- else if (fieldType.isArray) {
2876
- const arraySink = [];
2877
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
2878
- reader.enterPath(i);
2879
- selectType$x(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
2880
- reader.exitPath();
2881
- }
2882
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
2883
- }
2884
- else {
2885
- selectType$x(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
2886
- }
2887
- reader.exitPath();
2888
- return sink;
2162
+ function buildSelectionForField$x(source, reader, sel, variables, fragments) {
2163
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$w, getFieldType$R, selectType$x);
2889
2164
  }
2890
- function buildSelectionForNode$w(source, reader, parentNode, selectionNode, variables, fragments) {
2891
- const sink = {};
2892
- if (selectionNode.directives) {
2893
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
2894
- if (selectionWithDirectives === undefined) {
2895
- return;
2896
- }
2897
- selectionNode = selectionWithDirectives;
2898
- }
2899
- if (selectionNode.kind === "InlineFragment") {
2900
- if (isFragmentApplicable$x(selectionNode, source.data.__typename)) {
2901
- // Get selections out of the inline fragment
2902
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
2903
- // Call into field handling with selections
2904
- Object.assign(sink, buildSelectionForNode$w(source, reader, parentNode, fragmentSelection, variables, fragments));
2905
- });
2906
- }
2907
- }
2908
- if (selectionNode.kind === "FragmentSpread") {
2909
- const namedFragment = fragments[selectionNode.name.value];
2910
- if (namedFragment && isFragmentApplicable$x(namedFragment, source.data.__typename)) {
2911
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
2912
- // Call into field handling with selections
2913
- Object.assign(sink, buildSelectionForNode$w(source, reader, parentNode, fragmentSelection, variables, fragments));
2914
- });
2915
- }
2916
- }
2917
- if (selectionNode.kind === "Field") {
2918
- Object.assign(sink, buildSelectionForField$w(source, reader, selectionNode, variables));
2919
- }
2920
- return sink;
2165
+ function buildSelectionForNode$x(source, reader, parentNode, selectionNode, variables, fragments) {
2166
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$x, buildSelectionForField$x);
2921
2167
  }
2922
2168
  function select$G(field, variables, fragments) {
2923
2169
  return (source, reader) => {
2924
2170
  var _a;
2925
2171
  const sink = {};
2926
2172
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
2927
- const builtSelection = buildSelectionForNode$w(source, reader, field, sel, variables, fragments);
2173
+ const builtSelection = buildSelectionForNode$x(source, reader, field, sel, variables, fragments);
2928
2174
  if (builtSelection !== undefined) {
2929
2175
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
2930
2176
  Object.keys(builtSelection).forEach((key, value) => {
@@ -3066,79 +2312,18 @@ function selectType$w(typename, sel, fieldData, reader, key, sink, variables, fr
3066
2312
  }
3067
2313
  return sink;
3068
2314
  }
3069
- function buildSelectionForField$v(source, reader, sel, variables, fragments) {
3070
- const sink = {};
3071
- const fieldData = getFieldData$v(source, sel, variables);
3072
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
3073
- reader.enterPath(requestedFieldName);
3074
- if (fieldData === undefined) {
3075
- reader.markMissing();
3076
- reader.exitPath();
3077
- return;
3078
- }
3079
- if (fieldData === null) {
3080
- reader.assignScalar(requestedFieldName, sink, fieldData);
3081
- return sink;
3082
- }
3083
- const fieldType = getFieldType$Q(sel);
3084
- if (fieldType === undefined) {
3085
- // This field's type is unknown to us. This breaks normalization.
3086
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
3087
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
3088
- }
3089
- else if (fieldType.isArray) {
3090
- const arraySink = [];
3091
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
3092
- reader.enterPath(i);
3093
- selectType$w(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
3094
- reader.exitPath();
3095
- }
3096
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
3097
- }
3098
- else {
3099
- selectType$w(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
3100
- }
3101
- reader.exitPath();
3102
- return sink;
2315
+ function buildSelectionForField$w(source, reader, sel, variables, fragments) {
2316
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$v, getFieldType$Q, selectType$w);
3103
2317
  }
3104
- function buildSelectionForNode$v(source, reader, parentNode, selectionNode, variables, fragments) {
3105
- const sink = {};
3106
- if (selectionNode.directives) {
3107
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
3108
- if (selectionWithDirectives === undefined) {
3109
- return;
3110
- }
3111
- selectionNode = selectionWithDirectives;
3112
- }
3113
- if (selectionNode.kind === "InlineFragment") {
3114
- if (isFragmentApplicable$w(selectionNode, source.data.__typename)) {
3115
- // Get selections out of the inline fragment
3116
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
3117
- // Call into field handling with selections
3118
- Object.assign(sink, buildSelectionForNode$v(source, reader, parentNode, fragmentSelection, variables, fragments));
3119
- });
3120
- }
3121
- }
3122
- if (selectionNode.kind === "FragmentSpread") {
3123
- const namedFragment = fragments[selectionNode.name.value];
3124
- if (namedFragment && isFragmentApplicable$w(namedFragment, source.data.__typename)) {
3125
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
3126
- // Call into field handling with selections
3127
- Object.assign(sink, buildSelectionForNode$v(source, reader, parentNode, fragmentSelection, variables, fragments));
3128
- });
3129
- }
3130
- }
3131
- if (selectionNode.kind === "Field") {
3132
- Object.assign(sink, buildSelectionForField$v(source, reader, selectionNode, variables));
3133
- }
3134
- return sink;
2318
+ function buildSelectionForNode$w(source, reader, parentNode, selectionNode, variables, fragments) {
2319
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$w, buildSelectionForField$w);
3135
2320
  }
3136
2321
  function select$F(field, variables, fragments) {
3137
2322
  return (source, reader) => {
3138
2323
  var _a;
3139
2324
  const sink = {};
3140
2325
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
3141
- const builtSelection = buildSelectionForNode$v(source, reader, field, sel, variables, fragments);
2326
+ const builtSelection = buildSelectionForNode$w(source, reader, field, sel, variables, fragments);
3142
2327
  if (builtSelection !== undefined) {
3143
2328
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
3144
2329
  Object.keys(builtSelection).forEach((key, value) => {
@@ -3280,79 +2465,18 @@ function selectType$v(typename, sel, fieldData, reader, key, sink, variables, fr
3280
2465
  }
3281
2466
  return sink;
3282
2467
  }
3283
- function buildSelectionForField$u(source, reader, sel, variables, fragments) {
3284
- const sink = {};
3285
- const fieldData = getFieldData$u(source, sel, variables);
3286
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
3287
- reader.enterPath(requestedFieldName);
3288
- if (fieldData === undefined) {
3289
- reader.markMissing();
3290
- reader.exitPath();
3291
- return;
3292
- }
3293
- if (fieldData === null) {
3294
- reader.assignScalar(requestedFieldName, sink, fieldData);
3295
- return sink;
3296
- }
3297
- const fieldType = getFieldType$P(sel);
3298
- if (fieldType === undefined) {
3299
- // This field's type is unknown to us. This breaks normalization.
3300
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
3301
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
3302
- }
3303
- else if (fieldType.isArray) {
3304
- const arraySink = [];
3305
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
3306
- reader.enterPath(i);
3307
- selectType$v(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
3308
- reader.exitPath();
3309
- }
3310
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
3311
- }
3312
- else {
3313
- selectType$v(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
3314
- }
3315
- reader.exitPath();
3316
- return sink;
2468
+ function buildSelectionForField$v(source, reader, sel, variables, fragments) {
2469
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$u, getFieldType$P, selectType$v);
3317
2470
  }
3318
- function buildSelectionForNode$u(source, reader, parentNode, selectionNode, variables, fragments) {
3319
- const sink = {};
3320
- if (selectionNode.directives) {
3321
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
3322
- if (selectionWithDirectives === undefined) {
3323
- return;
3324
- }
3325
- selectionNode = selectionWithDirectives;
3326
- }
3327
- if (selectionNode.kind === "InlineFragment") {
3328
- if (isFragmentApplicable$v(selectionNode, source.data.__typename)) {
3329
- // Get selections out of the inline fragment
3330
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
3331
- // Call into field handling with selections
3332
- Object.assign(sink, buildSelectionForNode$u(source, reader, parentNode, fragmentSelection, variables, fragments));
3333
- });
3334
- }
3335
- }
3336
- if (selectionNode.kind === "FragmentSpread") {
3337
- const namedFragment = fragments[selectionNode.name.value];
3338
- if (namedFragment && isFragmentApplicable$v(namedFragment, source.data.__typename)) {
3339
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
3340
- // Call into field handling with selections
3341
- Object.assign(sink, buildSelectionForNode$u(source, reader, parentNode, fragmentSelection, variables, fragments));
3342
- });
3343
- }
3344
- }
3345
- if (selectionNode.kind === "Field") {
3346
- Object.assign(sink, buildSelectionForField$u(source, reader, selectionNode, variables));
3347
- }
3348
- return sink;
2471
+ function buildSelectionForNode$v(source, reader, parentNode, selectionNode, variables, fragments) {
2472
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$v, buildSelectionForField$v);
3349
2473
  }
3350
2474
  function select$E(field, variables, fragments) {
3351
2475
  return (source, reader) => {
3352
2476
  var _a;
3353
2477
  const sink = {};
3354
2478
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
3355
- const builtSelection = buildSelectionForNode$u(source, reader, field, sel, variables, fragments);
2479
+ const builtSelection = buildSelectionForNode$v(source, reader, field, sel, variables, fragments);
3356
2480
  if (builtSelection !== undefined) {
3357
2481
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
3358
2482
  Object.keys(builtSelection).forEach((key, value) => {
@@ -3487,86 +2611,25 @@ function selectType$u(typename, sel, fieldData, reader, key, sink, variables, fr
3487
2611
  reader.assignScalar(key, sink, fieldData);
3488
2612
  break;
3489
2613
  }
3490
- case 'PhoneNumber': {
3491
- reader.assignScalar(key, sink, fieldData);
3492
- break;
3493
- }
3494
- }
3495
- return sink;
3496
- }
3497
- function buildSelectionForField$t(source, reader, sel, variables, fragments) {
3498
- const sink = {};
3499
- const fieldData = getFieldData$t(source, sel, variables);
3500
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
3501
- reader.enterPath(requestedFieldName);
3502
- if (fieldData === undefined) {
3503
- reader.markMissing();
3504
- reader.exitPath();
3505
- return;
3506
- }
3507
- if (fieldData === null) {
3508
- reader.assignScalar(requestedFieldName, sink, fieldData);
3509
- return sink;
3510
- }
3511
- const fieldType = getFieldType$O(sel);
3512
- if (fieldType === undefined) {
3513
- // This field's type is unknown to us. This breaks normalization.
3514
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
3515
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
3516
- }
3517
- else if (fieldType.isArray) {
3518
- const arraySink = [];
3519
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
3520
- reader.enterPath(i);
3521
- selectType$u(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
3522
- reader.exitPath();
3523
- }
3524
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
3525
- }
3526
- else {
3527
- selectType$u(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
3528
- }
3529
- reader.exitPath();
3530
- return sink;
3531
- }
3532
- function buildSelectionForNode$t(source, reader, parentNode, selectionNode, variables, fragments) {
3533
- const sink = {};
3534
- if (selectionNode.directives) {
3535
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
3536
- if (selectionWithDirectives === undefined) {
3537
- return;
3538
- }
3539
- selectionNode = selectionWithDirectives;
3540
- }
3541
- if (selectionNode.kind === "InlineFragment") {
3542
- if (isFragmentApplicable$u(selectionNode, source.data.__typename)) {
3543
- // Get selections out of the inline fragment
3544
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
3545
- // Call into field handling with selections
3546
- Object.assign(sink, buildSelectionForNode$t(source, reader, parentNode, fragmentSelection, variables, fragments));
3547
- });
3548
- }
3549
- }
3550
- if (selectionNode.kind === "FragmentSpread") {
3551
- const namedFragment = fragments[selectionNode.name.value];
3552
- if (namedFragment && isFragmentApplicable$u(namedFragment, source.data.__typename)) {
3553
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
3554
- // Call into field handling with selections
3555
- Object.assign(sink, buildSelectionForNode$t(source, reader, parentNode, fragmentSelection, variables, fragments));
3556
- });
2614
+ case 'PhoneNumber': {
2615
+ reader.assignScalar(key, sink, fieldData);
2616
+ break;
3557
2617
  }
3558
2618
  }
3559
- if (selectionNode.kind === "Field") {
3560
- Object.assign(sink, buildSelectionForField$t(source, reader, selectionNode, variables));
3561
- }
3562
2619
  return sink;
3563
2620
  }
2621
+ function buildSelectionForField$u(source, reader, sel, variables, fragments) {
2622
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$t, getFieldType$O, selectType$u);
2623
+ }
2624
+ function buildSelectionForNode$u(source, reader, parentNode, selectionNode, variables, fragments) {
2625
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$u, buildSelectionForField$u);
2626
+ }
3564
2627
  function select$D(field, variables, fragments) {
3565
2628
  return (source, reader) => {
3566
2629
  var _a;
3567
2630
  const sink = {};
3568
2631
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
3569
- const builtSelection = buildSelectionForNode$t(source, reader, field, sel, variables, fragments);
2632
+ const builtSelection = buildSelectionForNode$u(source, reader, field, sel, variables, fragments);
3570
2633
  if (builtSelection !== undefined) {
3571
2634
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
3572
2635
  Object.keys(builtSelection).forEach((key, value) => {
@@ -3708,79 +2771,18 @@ function selectType$t(typename, sel, fieldData, reader, key, sink, variables, fr
3708
2771
  }
3709
2772
  return sink;
3710
2773
  }
3711
- function buildSelectionForField$s(source, reader, sel, variables, fragments) {
3712
- const sink = {};
3713
- const fieldData = getFieldData$s(source, sel, variables);
3714
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
3715
- reader.enterPath(requestedFieldName);
3716
- if (fieldData === undefined) {
3717
- reader.markMissing();
3718
- reader.exitPath();
3719
- return;
3720
- }
3721
- if (fieldData === null) {
3722
- reader.assignScalar(requestedFieldName, sink, fieldData);
3723
- return sink;
3724
- }
3725
- const fieldType = getFieldType$N(sel);
3726
- if (fieldType === undefined) {
3727
- // This field's type is unknown to us. This breaks normalization.
3728
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
3729
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
3730
- }
3731
- else if (fieldType.isArray) {
3732
- const arraySink = [];
3733
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
3734
- reader.enterPath(i);
3735
- selectType$t(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
3736
- reader.exitPath();
3737
- }
3738
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
3739
- }
3740
- else {
3741
- selectType$t(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
3742
- }
3743
- reader.exitPath();
3744
- return sink;
2774
+ function buildSelectionForField$t(source, reader, sel, variables, fragments) {
2775
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$s, getFieldType$N, selectType$t);
3745
2776
  }
3746
- function buildSelectionForNode$s(source, reader, parentNode, selectionNode, variables, fragments) {
3747
- const sink = {};
3748
- if (selectionNode.directives) {
3749
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
3750
- if (selectionWithDirectives === undefined) {
3751
- return;
3752
- }
3753
- selectionNode = selectionWithDirectives;
3754
- }
3755
- if (selectionNode.kind === "InlineFragment") {
3756
- if (isFragmentApplicable$t(selectionNode, source.data.__typename)) {
3757
- // Get selections out of the inline fragment
3758
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
3759
- // Call into field handling with selections
3760
- Object.assign(sink, buildSelectionForNode$s(source, reader, parentNode, fragmentSelection, variables, fragments));
3761
- });
3762
- }
3763
- }
3764
- if (selectionNode.kind === "FragmentSpread") {
3765
- const namedFragment = fragments[selectionNode.name.value];
3766
- if (namedFragment && isFragmentApplicable$t(namedFragment, source.data.__typename)) {
3767
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
3768
- // Call into field handling with selections
3769
- Object.assign(sink, buildSelectionForNode$s(source, reader, parentNode, fragmentSelection, variables, fragments));
3770
- });
3771
- }
3772
- }
3773
- if (selectionNode.kind === "Field") {
3774
- Object.assign(sink, buildSelectionForField$s(source, reader, selectionNode, variables));
3775
- }
3776
- return sink;
2777
+ function buildSelectionForNode$t(source, reader, parentNode, selectionNode, variables, fragments) {
2778
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$t, buildSelectionForField$t);
3777
2779
  }
3778
2780
  function select$C(field, variables, fragments) {
3779
2781
  return (source, reader) => {
3780
2782
  var _a;
3781
2783
  const sink = {};
3782
2784
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
3783
- const builtSelection = buildSelectionForNode$s(source, reader, field, sel, variables, fragments);
2785
+ const builtSelection = buildSelectionForNode$t(source, reader, field, sel, variables, fragments);
3784
2786
  if (builtSelection !== undefined) {
3785
2787
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
3786
2788
  Object.keys(builtSelection).forEach((key, value) => {
@@ -3922,79 +2924,18 @@ function selectType$s(typename, sel, fieldData, reader, key, sink, variables, fr
3922
2924
  }
3923
2925
  return sink;
3924
2926
  }
3925
- function buildSelectionForField$r(source, reader, sel, variables, fragments) {
3926
- const sink = {};
3927
- const fieldData = getFieldData$r(source, sel, variables);
3928
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
3929
- reader.enterPath(requestedFieldName);
3930
- if (fieldData === undefined) {
3931
- reader.markMissing();
3932
- reader.exitPath();
3933
- return;
3934
- }
3935
- if (fieldData === null) {
3936
- reader.assignScalar(requestedFieldName, sink, fieldData);
3937
- return sink;
3938
- }
3939
- const fieldType = getFieldType$M(sel);
3940
- if (fieldType === undefined) {
3941
- // This field's type is unknown to us. This breaks normalization.
3942
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
3943
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
3944
- }
3945
- else if (fieldType.isArray) {
3946
- const arraySink = [];
3947
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
3948
- reader.enterPath(i);
3949
- selectType$s(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
3950
- reader.exitPath();
3951
- }
3952
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
3953
- }
3954
- else {
3955
- selectType$s(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
3956
- }
3957
- reader.exitPath();
3958
- return sink;
2927
+ function buildSelectionForField$s(source, reader, sel, variables, fragments) {
2928
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$r, getFieldType$M, selectType$s);
3959
2929
  }
3960
- function buildSelectionForNode$r(source, reader, parentNode, selectionNode, variables, fragments) {
3961
- const sink = {};
3962
- if (selectionNode.directives) {
3963
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
3964
- if (selectionWithDirectives === undefined) {
3965
- return;
3966
- }
3967
- selectionNode = selectionWithDirectives;
3968
- }
3969
- if (selectionNode.kind === "InlineFragment") {
3970
- if (isFragmentApplicable$s(selectionNode, source.data.__typename)) {
3971
- // Get selections out of the inline fragment
3972
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
3973
- // Call into field handling with selections
3974
- Object.assign(sink, buildSelectionForNode$r(source, reader, parentNode, fragmentSelection, variables, fragments));
3975
- });
3976
- }
3977
- }
3978
- if (selectionNode.kind === "FragmentSpread") {
3979
- const namedFragment = fragments[selectionNode.name.value];
3980
- if (namedFragment && isFragmentApplicable$s(namedFragment, source.data.__typename)) {
3981
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
3982
- // Call into field handling with selections
3983
- Object.assign(sink, buildSelectionForNode$r(source, reader, parentNode, fragmentSelection, variables, fragments));
3984
- });
3985
- }
3986
- }
3987
- if (selectionNode.kind === "Field") {
3988
- Object.assign(sink, buildSelectionForField$r(source, reader, selectionNode, variables));
3989
- }
3990
- return sink;
2930
+ function buildSelectionForNode$s(source, reader, parentNode, selectionNode, variables, fragments) {
2931
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$s, buildSelectionForField$s);
3991
2932
  }
3992
2933
  function select$B(field, variables, fragments) {
3993
2934
  return (source, reader) => {
3994
2935
  var _a;
3995
2936
  const sink = {};
3996
2937
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
3997
- const builtSelection = buildSelectionForNode$r(source, reader, field, sel, variables, fragments);
2938
+ const builtSelection = buildSelectionForNode$s(source, reader, field, sel, variables, fragments);
3998
2939
  if (builtSelection !== undefined) {
3999
2940
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
4000
2941
  Object.keys(builtSelection).forEach((key, value) => {
@@ -4136,79 +3077,18 @@ function selectType$r(typename, sel, fieldData, reader, key, sink, variables, fr
4136
3077
  }
4137
3078
  return sink;
4138
3079
  }
4139
- function buildSelectionForField$q(source, reader, sel, variables, fragments) {
4140
- const sink = {};
4141
- const fieldData = getFieldData$q(source, sel, variables);
4142
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
4143
- reader.enterPath(requestedFieldName);
4144
- if (fieldData === undefined) {
4145
- reader.markMissing();
4146
- reader.exitPath();
4147
- return;
4148
- }
4149
- if (fieldData === null) {
4150
- reader.assignScalar(requestedFieldName, sink, fieldData);
4151
- return sink;
4152
- }
4153
- const fieldType = getFieldType$L(sel);
4154
- if (fieldType === undefined) {
4155
- // This field's type is unknown to us. This breaks normalization.
4156
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
4157
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
4158
- }
4159
- else if (fieldType.isArray) {
4160
- const arraySink = [];
4161
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
4162
- reader.enterPath(i);
4163
- selectType$r(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
4164
- reader.exitPath();
4165
- }
4166
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
4167
- }
4168
- else {
4169
- selectType$r(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
4170
- }
4171
- reader.exitPath();
4172
- return sink;
3080
+ function buildSelectionForField$r(source, reader, sel, variables, fragments) {
3081
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$q, getFieldType$L, selectType$r);
4173
3082
  }
4174
- function buildSelectionForNode$q(source, reader, parentNode, selectionNode, variables, fragments) {
4175
- const sink = {};
4176
- if (selectionNode.directives) {
4177
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
4178
- if (selectionWithDirectives === undefined) {
4179
- return;
4180
- }
4181
- selectionNode = selectionWithDirectives;
4182
- }
4183
- if (selectionNode.kind === "InlineFragment") {
4184
- if (isFragmentApplicable$r(selectionNode, source.data.__typename)) {
4185
- // Get selections out of the inline fragment
4186
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
4187
- // Call into field handling with selections
4188
- Object.assign(sink, buildSelectionForNode$q(source, reader, parentNode, fragmentSelection, variables, fragments));
4189
- });
4190
- }
4191
- }
4192
- if (selectionNode.kind === "FragmentSpread") {
4193
- const namedFragment = fragments[selectionNode.name.value];
4194
- if (namedFragment && isFragmentApplicable$r(namedFragment, source.data.__typename)) {
4195
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
4196
- // Call into field handling with selections
4197
- Object.assign(sink, buildSelectionForNode$q(source, reader, parentNode, fragmentSelection, variables, fragments));
4198
- });
4199
- }
4200
- }
4201
- if (selectionNode.kind === "Field") {
4202
- Object.assign(sink, buildSelectionForField$q(source, reader, selectionNode, variables));
4203
- }
4204
- return sink;
3083
+ function buildSelectionForNode$r(source, reader, parentNode, selectionNode, variables, fragments) {
3084
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$r, buildSelectionForField$r);
4205
3085
  }
4206
3086
  function select$A(field, variables, fragments) {
4207
3087
  return (source, reader) => {
4208
3088
  var _a;
4209
3089
  const sink = {};
4210
3090
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
4211
- const builtSelection = buildSelectionForNode$q(source, reader, field, sel, variables, fragments);
3091
+ const builtSelection = buildSelectionForNode$r(source, reader, field, sel, variables, fragments);
4212
3092
  if (builtSelection !== undefined) {
4213
3093
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
4214
3094
  Object.keys(builtSelection).forEach((key, value) => {
@@ -4338,91 +3218,30 @@ function selectType$q(typename, sel, fieldData, reader, key, sink, variables, fr
4338
3218
  reader.assignScalar(key, sink, fieldData);
4339
3219
  return sink;
4340
3220
  }
4341
- switch (typename) {
4342
- case 'String': {
4343
- reader.assignScalar(key, sink, fieldData);
4344
- break;
4345
- }
4346
- case 'Currency': {
4347
- reader.assignScalar(key, sink, fieldData);
4348
- break;
4349
- }
4350
- }
4351
- return sink;
4352
- }
4353
- function buildSelectionForField$p(source, reader, sel, variables, fragments) {
4354
- const sink = {};
4355
- const fieldData = getFieldData$p(source, sel, variables);
4356
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
4357
- reader.enterPath(requestedFieldName);
4358
- if (fieldData === undefined) {
4359
- reader.markMissing();
4360
- reader.exitPath();
4361
- return;
4362
- }
4363
- if (fieldData === null) {
4364
- reader.assignScalar(requestedFieldName, sink, fieldData);
4365
- return sink;
4366
- }
4367
- const fieldType = getFieldType$K(sel);
4368
- if (fieldType === undefined) {
4369
- // This field's type is unknown to us. This breaks normalization.
4370
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
4371
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
4372
- }
4373
- else if (fieldType.isArray) {
4374
- const arraySink = [];
4375
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
4376
- reader.enterPath(i);
4377
- selectType$q(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
4378
- reader.exitPath();
4379
- }
4380
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
4381
- }
4382
- else {
4383
- selectType$q(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
4384
- }
4385
- reader.exitPath();
4386
- return sink;
4387
- }
4388
- function buildSelectionForNode$p(source, reader, parentNode, selectionNode, variables, fragments) {
4389
- const sink = {};
4390
- if (selectionNode.directives) {
4391
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
4392
- if (selectionWithDirectives === undefined) {
4393
- return;
4394
- }
4395
- selectionNode = selectionWithDirectives;
4396
- }
4397
- if (selectionNode.kind === "InlineFragment") {
4398
- if (isFragmentApplicable$q(selectionNode, source.data.__typename)) {
4399
- // Get selections out of the inline fragment
4400
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
4401
- // Call into field handling with selections
4402
- Object.assign(sink, buildSelectionForNode$p(source, reader, parentNode, fragmentSelection, variables, fragments));
4403
- });
4404
- }
4405
- }
4406
- if (selectionNode.kind === "FragmentSpread") {
4407
- const namedFragment = fragments[selectionNode.name.value];
4408
- if (namedFragment && isFragmentApplicable$q(namedFragment, source.data.__typename)) {
4409
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
4410
- // Call into field handling with selections
4411
- Object.assign(sink, buildSelectionForNode$p(source, reader, parentNode, fragmentSelection, variables, fragments));
4412
- });
3221
+ switch (typename) {
3222
+ case 'String': {
3223
+ reader.assignScalar(key, sink, fieldData);
3224
+ break;
3225
+ }
3226
+ case 'Currency': {
3227
+ reader.assignScalar(key, sink, fieldData);
3228
+ break;
4413
3229
  }
4414
- }
4415
- if (selectionNode.kind === "Field") {
4416
- Object.assign(sink, buildSelectionForField$p(source, reader, selectionNode, variables));
4417
3230
  }
4418
3231
  return sink;
4419
3232
  }
3233
+ function buildSelectionForField$q(source, reader, sel, variables, fragments) {
3234
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$p, getFieldType$K, selectType$q);
3235
+ }
3236
+ function buildSelectionForNode$q(source, reader, parentNode, selectionNode, variables, fragments) {
3237
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$q, buildSelectionForField$q);
3238
+ }
4420
3239
  function select$z(field, variables, fragments) {
4421
3240
  return (source, reader) => {
4422
3241
  var _a;
4423
3242
  const sink = {};
4424
3243
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
4425
- const builtSelection = buildSelectionForNode$p(source, reader, field, sel, variables, fragments);
3244
+ const builtSelection = buildSelectionForNode$q(source, reader, field, sel, variables, fragments);
4426
3245
  if (builtSelection !== undefined) {
4427
3246
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
4428
3247
  Object.keys(builtSelection).forEach((key, value) => {
@@ -4570,79 +3389,18 @@ function selectType$p(typename, sel, fieldData, reader, key, sink, variables, fr
4570
3389
  }
4571
3390
  return sink;
4572
3391
  }
4573
- function buildSelectionForField$o(source, reader, sel, variables, fragments) {
4574
- const sink = {};
4575
- const fieldData = getFieldData$o(source, sel, variables);
4576
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
4577
- reader.enterPath(requestedFieldName);
4578
- if (fieldData === undefined) {
4579
- reader.markMissing();
4580
- reader.exitPath();
4581
- return;
4582
- }
4583
- if (fieldData === null) {
4584
- reader.assignScalar(requestedFieldName, sink, fieldData);
4585
- return sink;
4586
- }
4587
- const fieldType = getFieldType$J(sel);
4588
- if (fieldType === undefined) {
4589
- // This field's type is unknown to us. This breaks normalization.
4590
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
4591
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
4592
- }
4593
- else if (fieldType.isArray) {
4594
- const arraySink = [];
4595
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
4596
- reader.enterPath(i);
4597
- selectType$p(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
4598
- reader.exitPath();
4599
- }
4600
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
4601
- }
4602
- else {
4603
- selectType$p(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
4604
- }
4605
- reader.exitPath();
4606
- return sink;
3392
+ function buildSelectionForField$p(source, reader, sel, variables, fragments) {
3393
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$o, getFieldType$J, selectType$p);
4607
3394
  }
4608
- function buildSelectionForNode$o(source, reader, parentNode, selectionNode, variables, fragments) {
4609
- const sink = {};
4610
- if (selectionNode.directives) {
4611
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
4612
- if (selectionWithDirectives === undefined) {
4613
- return;
4614
- }
4615
- selectionNode = selectionWithDirectives;
4616
- }
4617
- if (selectionNode.kind === "InlineFragment") {
4618
- if (isFragmentApplicable$p(selectionNode, source.data.__typename)) {
4619
- // Get selections out of the inline fragment
4620
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
4621
- // Call into field handling with selections
4622
- Object.assign(sink, buildSelectionForNode$o(source, reader, parentNode, fragmentSelection, variables, fragments));
4623
- });
4624
- }
4625
- }
4626
- if (selectionNode.kind === "FragmentSpread") {
4627
- const namedFragment = fragments[selectionNode.name.value];
4628
- if (namedFragment && isFragmentApplicable$p(namedFragment, source.data.__typename)) {
4629
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
4630
- // Call into field handling with selections
4631
- Object.assign(sink, buildSelectionForNode$o(source, reader, parentNode, fragmentSelection, variables, fragments));
4632
- });
4633
- }
4634
- }
4635
- if (selectionNode.kind === "Field") {
4636
- Object.assign(sink, buildSelectionForField$o(source, reader, selectionNode, variables));
4637
- }
4638
- return sink;
3395
+ function buildSelectionForNode$p(source, reader, parentNode, selectionNode, variables, fragments) {
3396
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$p, buildSelectionForField$p);
4639
3397
  }
4640
3398
  function select$y(field, variables, fragments) {
4641
3399
  return (source, reader) => {
4642
3400
  var _a;
4643
3401
  const sink = {};
4644
3402
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
4645
- const builtSelection = buildSelectionForNode$o(source, reader, field, sel, variables, fragments);
3403
+ const builtSelection = buildSelectionForNode$p(source, reader, field, sel, variables, fragments);
4646
3404
  if (builtSelection !== undefined) {
4647
3405
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
4648
3406
  Object.keys(builtSelection).forEach((key, value) => {
@@ -4784,79 +3542,18 @@ function selectType$o(typename, sel, fieldData, reader, key, sink, variables, fr
4784
3542
  }
4785
3543
  return sink;
4786
3544
  }
4787
- function buildSelectionForField$n(source, reader, sel, variables, fragments) {
4788
- const sink = {};
4789
- const fieldData = getFieldData$n(source, sel, variables);
4790
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
4791
- reader.enterPath(requestedFieldName);
4792
- if (fieldData === undefined) {
4793
- reader.markMissing();
4794
- reader.exitPath();
4795
- return;
4796
- }
4797
- if (fieldData === null) {
4798
- reader.assignScalar(requestedFieldName, sink, fieldData);
4799
- return sink;
4800
- }
4801
- const fieldType = getFieldType$I(sel);
4802
- if (fieldType === undefined) {
4803
- // This field's type is unknown to us. This breaks normalization.
4804
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
4805
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
4806
- }
4807
- else if (fieldType.isArray) {
4808
- const arraySink = [];
4809
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
4810
- reader.enterPath(i);
4811
- selectType$o(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
4812
- reader.exitPath();
4813
- }
4814
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
4815
- }
4816
- else {
4817
- selectType$o(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
4818
- }
4819
- reader.exitPath();
4820
- return sink;
3545
+ function buildSelectionForField$o(source, reader, sel, variables, fragments) {
3546
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$n, getFieldType$I, selectType$o);
4821
3547
  }
4822
- function buildSelectionForNode$n(source, reader, parentNode, selectionNode, variables, fragments) {
4823
- const sink = {};
4824
- if (selectionNode.directives) {
4825
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
4826
- if (selectionWithDirectives === undefined) {
4827
- return;
4828
- }
4829
- selectionNode = selectionWithDirectives;
4830
- }
4831
- if (selectionNode.kind === "InlineFragment") {
4832
- if (isFragmentApplicable$o(selectionNode, source.data.__typename)) {
4833
- // Get selections out of the inline fragment
4834
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
4835
- // Call into field handling with selections
4836
- Object.assign(sink, buildSelectionForNode$n(source, reader, parentNode, fragmentSelection, variables, fragments));
4837
- });
4838
- }
4839
- }
4840
- if (selectionNode.kind === "FragmentSpread") {
4841
- const namedFragment = fragments[selectionNode.name.value];
4842
- if (namedFragment && isFragmentApplicable$o(namedFragment, source.data.__typename)) {
4843
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
4844
- // Call into field handling with selections
4845
- Object.assign(sink, buildSelectionForNode$n(source, reader, parentNode, fragmentSelection, variables, fragments));
4846
- });
4847
- }
4848
- }
4849
- if (selectionNode.kind === "Field") {
4850
- Object.assign(sink, buildSelectionForField$n(source, reader, selectionNode, variables));
4851
- }
4852
- return sink;
3548
+ function buildSelectionForNode$o(source, reader, parentNode, selectionNode, variables, fragments) {
3549
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$o, buildSelectionForField$o);
4853
3550
  }
4854
3551
  function select$x(field, variables, fragments) {
4855
3552
  return (source, reader) => {
4856
3553
  var _a;
4857
3554
  const sink = {};
4858
3555
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
4859
- const builtSelection = buildSelectionForNode$n(source, reader, field, sel, variables, fragments);
3556
+ const builtSelection = buildSelectionForNode$o(source, reader, field, sel, variables, fragments);
4860
3557
  if (builtSelection !== undefined) {
4861
3558
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
4862
3559
  Object.keys(builtSelection).forEach((key, value) => {
@@ -4998,79 +3695,18 @@ function selectType$n(typename, sel, fieldData, reader, key, sink, variables, fr
4998
3695
  }
4999
3696
  return sink;
5000
3697
  }
5001
- function buildSelectionForField$m(source, reader, sel, variables, fragments) {
5002
- const sink = {};
5003
- const fieldData = getFieldData$m(source, sel, variables);
5004
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
5005
- reader.enterPath(requestedFieldName);
5006
- if (fieldData === undefined) {
5007
- reader.markMissing();
5008
- reader.exitPath();
5009
- return;
5010
- }
5011
- if (fieldData === null) {
5012
- reader.assignScalar(requestedFieldName, sink, fieldData);
5013
- return sink;
5014
- }
5015
- const fieldType = getFieldType$H(sel);
5016
- if (fieldType === undefined) {
5017
- // This field's type is unknown to us. This breaks normalization.
5018
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
5019
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
5020
- }
5021
- else if (fieldType.isArray) {
5022
- const arraySink = [];
5023
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
5024
- reader.enterPath(i);
5025
- selectType$n(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
5026
- reader.exitPath();
5027
- }
5028
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
5029
- }
5030
- else {
5031
- selectType$n(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
5032
- }
5033
- reader.exitPath();
5034
- return sink;
3698
+ function buildSelectionForField$n(source, reader, sel, variables, fragments) {
3699
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$m, getFieldType$H, selectType$n);
5035
3700
  }
5036
- function buildSelectionForNode$m(source, reader, parentNode, selectionNode, variables, fragments) {
5037
- const sink = {};
5038
- if (selectionNode.directives) {
5039
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
5040
- if (selectionWithDirectives === undefined) {
5041
- return;
5042
- }
5043
- selectionNode = selectionWithDirectives;
5044
- }
5045
- if (selectionNode.kind === "InlineFragment") {
5046
- if (isFragmentApplicable$n(selectionNode, source.data.__typename)) {
5047
- // Get selections out of the inline fragment
5048
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
5049
- // Call into field handling with selections
5050
- Object.assign(sink, buildSelectionForNode$m(source, reader, parentNode, fragmentSelection, variables, fragments));
5051
- });
5052
- }
5053
- }
5054
- if (selectionNode.kind === "FragmentSpread") {
5055
- const namedFragment = fragments[selectionNode.name.value];
5056
- if (namedFragment && isFragmentApplicable$n(namedFragment, source.data.__typename)) {
5057
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
5058
- // Call into field handling with selections
5059
- Object.assign(sink, buildSelectionForNode$m(source, reader, parentNode, fragmentSelection, variables, fragments));
5060
- });
5061
- }
5062
- }
5063
- if (selectionNode.kind === "Field") {
5064
- Object.assign(sink, buildSelectionForField$m(source, reader, selectionNode, variables));
5065
- }
5066
- return sink;
3701
+ function buildSelectionForNode$n(source, reader, parentNode, selectionNode, variables, fragments) {
3702
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$n, buildSelectionForField$n);
5067
3703
  }
5068
3704
  function select$w(field, variables, fragments) {
5069
3705
  return (source, reader) => {
5070
3706
  var _a;
5071
3707
  const sink = {};
5072
3708
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
5073
- const builtSelection = buildSelectionForNode$m(source, reader, field, sel, variables, fragments);
3709
+ const builtSelection = buildSelectionForNode$n(source, reader, field, sel, variables, fragments);
5074
3710
  if (builtSelection !== undefined) {
5075
3711
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
5076
3712
  Object.keys(builtSelection).forEach((key, value) => {
@@ -5208,89 +3844,28 @@ function selectType$m(typename, sel, fieldData, reader, key, sink, variables, fr
5208
3844
  }
5209
3845
  switch (typename) {
5210
3846
  case 'String': {
5211
- reader.assignScalar(key, sink, fieldData);
5212
- break;
5213
- }
5214
- case 'MultiPicklist': {
5215
- reader.assignScalar(key, sink, fieldData);
5216
- break;
5217
- }
5218
- }
5219
- return sink;
5220
- }
5221
- function buildSelectionForField$l(source, reader, sel, variables, fragments) {
5222
- const sink = {};
5223
- const fieldData = getFieldData$l(source, sel, variables);
5224
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
5225
- reader.enterPath(requestedFieldName);
5226
- if (fieldData === undefined) {
5227
- reader.markMissing();
5228
- reader.exitPath();
5229
- return;
5230
- }
5231
- if (fieldData === null) {
5232
- reader.assignScalar(requestedFieldName, sink, fieldData);
5233
- return sink;
5234
- }
5235
- const fieldType = getFieldType$G(sel);
5236
- if (fieldType === undefined) {
5237
- // This field's type is unknown to us. This breaks normalization.
5238
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
5239
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
5240
- }
5241
- else if (fieldType.isArray) {
5242
- const arraySink = [];
5243
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
5244
- reader.enterPath(i);
5245
- selectType$m(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
5246
- reader.exitPath();
5247
- }
5248
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
5249
- }
5250
- else {
5251
- selectType$m(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
5252
- }
5253
- reader.exitPath();
5254
- return sink;
5255
- }
5256
- function buildSelectionForNode$l(source, reader, parentNode, selectionNode, variables, fragments) {
5257
- const sink = {};
5258
- if (selectionNode.directives) {
5259
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
5260
- if (selectionWithDirectives === undefined) {
5261
- return;
5262
- }
5263
- selectionNode = selectionWithDirectives;
5264
- }
5265
- if (selectionNode.kind === "InlineFragment") {
5266
- if (isFragmentApplicable$m(selectionNode, source.data.__typename)) {
5267
- // Get selections out of the inline fragment
5268
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
5269
- // Call into field handling with selections
5270
- Object.assign(sink, buildSelectionForNode$l(source, reader, parentNode, fragmentSelection, variables, fragments));
5271
- });
3847
+ reader.assignScalar(key, sink, fieldData);
3848
+ break;
5272
3849
  }
5273
- }
5274
- if (selectionNode.kind === "FragmentSpread") {
5275
- const namedFragment = fragments[selectionNode.name.value];
5276
- if (namedFragment && isFragmentApplicable$m(namedFragment, source.data.__typename)) {
5277
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
5278
- // Call into field handling with selections
5279
- Object.assign(sink, buildSelectionForNode$l(source, reader, parentNode, fragmentSelection, variables, fragments));
5280
- });
3850
+ case 'MultiPicklist': {
3851
+ reader.assignScalar(key, sink, fieldData);
3852
+ break;
5281
3853
  }
5282
3854
  }
5283
- if (selectionNode.kind === "Field") {
5284
- Object.assign(sink, buildSelectionForField$l(source, reader, selectionNode, variables));
5285
- }
5286
3855
  return sink;
5287
3856
  }
3857
+ function buildSelectionForField$m(source, reader, sel, variables, fragments) {
3858
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$l, getFieldType$G, selectType$m);
3859
+ }
3860
+ function buildSelectionForNode$m(source, reader, parentNode, selectionNode, variables, fragments) {
3861
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$m, buildSelectionForField$m);
3862
+ }
5288
3863
  function select$v(field, variables, fragments) {
5289
3864
  return (source, reader) => {
5290
3865
  var _a;
5291
3866
  const sink = {};
5292
3867
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
5293
- const builtSelection = buildSelectionForNode$l(source, reader, field, sel, variables, fragments);
3868
+ const builtSelection = buildSelectionForNode$m(source, reader, field, sel, variables, fragments);
5294
3869
  if (builtSelection !== undefined) {
5295
3870
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
5296
3871
  Object.keys(builtSelection).forEach((key, value) => {
@@ -5438,79 +4013,18 @@ function selectType$l(typename, sel, fieldData, reader, key, sink, variables, fr
5438
4013
  }
5439
4014
  return sink;
5440
4015
  }
5441
- function buildSelectionForField$k(source, reader, sel, variables, fragments) {
5442
- const sink = {};
5443
- const fieldData = getFieldData$k(source, sel, variables);
5444
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
5445
- reader.enterPath(requestedFieldName);
5446
- if (fieldData === undefined) {
5447
- reader.markMissing();
5448
- reader.exitPath();
5449
- return;
5450
- }
5451
- if (fieldData === null) {
5452
- reader.assignScalar(requestedFieldName, sink, fieldData);
5453
- return sink;
5454
- }
5455
- const fieldType = getFieldType$F(sel);
5456
- if (fieldType === undefined) {
5457
- // This field's type is unknown to us. This breaks normalization.
5458
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
5459
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
5460
- }
5461
- else if (fieldType.isArray) {
5462
- const arraySink = [];
5463
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
5464
- reader.enterPath(i);
5465
- selectType$l(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
5466
- reader.exitPath();
5467
- }
5468
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
5469
- }
5470
- else {
5471
- selectType$l(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
5472
- }
5473
- reader.exitPath();
5474
- return sink;
4016
+ function buildSelectionForField$l(source, reader, sel, variables, fragments) {
4017
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$k, getFieldType$F, selectType$l);
5475
4018
  }
5476
- function buildSelectionForNode$k(source, reader, parentNode, selectionNode, variables, fragments) {
5477
- const sink = {};
5478
- if (selectionNode.directives) {
5479
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
5480
- if (selectionWithDirectives === undefined) {
5481
- return;
5482
- }
5483
- selectionNode = selectionWithDirectives;
5484
- }
5485
- if (selectionNode.kind === "InlineFragment") {
5486
- if (isFragmentApplicable$l(selectionNode, source.data.__typename)) {
5487
- // Get selections out of the inline fragment
5488
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
5489
- // Call into field handling with selections
5490
- Object.assign(sink, buildSelectionForNode$k(source, reader, parentNode, fragmentSelection, variables, fragments));
5491
- });
5492
- }
5493
- }
5494
- if (selectionNode.kind === "FragmentSpread") {
5495
- const namedFragment = fragments[selectionNode.name.value];
5496
- if (namedFragment && isFragmentApplicable$l(namedFragment, source.data.__typename)) {
5497
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
5498
- // Call into field handling with selections
5499
- Object.assign(sink, buildSelectionForNode$k(source, reader, parentNode, fragmentSelection, variables, fragments));
5500
- });
5501
- }
5502
- }
5503
- if (selectionNode.kind === "Field") {
5504
- Object.assign(sink, buildSelectionForField$k(source, reader, selectionNode, variables));
5505
- }
5506
- return sink;
4019
+ function buildSelectionForNode$l(source, reader, parentNode, selectionNode, variables, fragments) {
4020
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$l, buildSelectionForField$l);
5507
4021
  }
5508
4022
  function select$u(field, variables, fragments) {
5509
4023
  return (source, reader) => {
5510
4024
  var _a;
5511
4025
  const sink = {};
5512
4026
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
5513
- const builtSelection = buildSelectionForNode$k(source, reader, field, sel, variables, fragments);
4027
+ const builtSelection = buildSelectionForNode$l(source, reader, field, sel, variables, fragments);
5514
4028
  if (builtSelection !== undefined) {
5515
4029
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
5516
4030
  Object.keys(builtSelection).forEach((key, value) => {
@@ -5652,79 +4166,18 @@ function selectType$k(typename, sel, fieldData, reader, key, sink, variables, fr
5652
4166
  }
5653
4167
  return sink;
5654
4168
  }
5655
- function buildSelectionForField$j(source, reader, sel, variables, fragments) {
5656
- const sink = {};
5657
- const fieldData = getFieldData$j(source, sel, variables);
5658
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
5659
- reader.enterPath(requestedFieldName);
5660
- if (fieldData === undefined) {
5661
- reader.markMissing();
5662
- reader.exitPath();
5663
- return;
5664
- }
5665
- if (fieldData === null) {
5666
- reader.assignScalar(requestedFieldName, sink, fieldData);
5667
- return sink;
5668
- }
5669
- const fieldType = getFieldType$E(sel);
5670
- if (fieldType === undefined) {
5671
- // This field's type is unknown to us. This breaks normalization.
5672
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
5673
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
5674
- }
5675
- else if (fieldType.isArray) {
5676
- const arraySink = [];
5677
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
5678
- reader.enterPath(i);
5679
- selectType$k(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
5680
- reader.exitPath();
5681
- }
5682
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
5683
- }
5684
- else {
5685
- selectType$k(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
5686
- }
5687
- reader.exitPath();
5688
- return sink;
4169
+ function buildSelectionForField$k(source, reader, sel, variables, fragments) {
4170
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$j, getFieldType$E, selectType$k);
5689
4171
  }
5690
- function buildSelectionForNode$j(source, reader, parentNode, selectionNode, variables, fragments) {
5691
- const sink = {};
5692
- if (selectionNode.directives) {
5693
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
5694
- if (selectionWithDirectives === undefined) {
5695
- return;
5696
- }
5697
- selectionNode = selectionWithDirectives;
5698
- }
5699
- if (selectionNode.kind === "InlineFragment") {
5700
- if (isFragmentApplicable$k(selectionNode, source.data.__typename)) {
5701
- // Get selections out of the inline fragment
5702
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
5703
- // Call into field handling with selections
5704
- Object.assign(sink, buildSelectionForNode$j(source, reader, parentNode, fragmentSelection, variables, fragments));
5705
- });
5706
- }
5707
- }
5708
- if (selectionNode.kind === "FragmentSpread") {
5709
- const namedFragment = fragments[selectionNode.name.value];
5710
- if (namedFragment && isFragmentApplicable$k(namedFragment, source.data.__typename)) {
5711
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
5712
- // Call into field handling with selections
5713
- Object.assign(sink, buildSelectionForNode$j(source, reader, parentNode, fragmentSelection, variables, fragments));
5714
- });
5715
- }
5716
- }
5717
- if (selectionNode.kind === "Field") {
5718
- Object.assign(sink, buildSelectionForField$j(source, reader, selectionNode, variables));
5719
- }
5720
- return sink;
4172
+ function buildSelectionForNode$k(source, reader, parentNode, selectionNode, variables, fragments) {
4173
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$k, buildSelectionForField$k);
5721
4174
  }
5722
4175
  function select$t(field, variables, fragments) {
5723
4176
  return (source, reader) => {
5724
4177
  var _a;
5725
4178
  const sink = {};
5726
4179
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
5727
- const builtSelection = buildSelectionForNode$j(source, reader, field, sel, variables, fragments);
4180
+ const builtSelection = buildSelectionForNode$k(source, reader, field, sel, variables, fragments);
5728
4181
  if (builtSelection !== undefined) {
5729
4182
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
5730
4183
  Object.keys(builtSelection).forEach((key, value) => {
@@ -6725,79 +5178,18 @@ function selectType$i(typename, sel, fieldData, reader, key, sink, variables, fr
6725
5178
  }
6726
5179
  return sink;
6727
5180
  }
6728
- function buildSelectionForField$i(source, reader, sel, variables, fragments) {
6729
- const sink = {};
6730
- const fieldData = getFieldData$h(source, sel, variables);
6731
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
6732
- reader.enterPath(requestedFieldName);
6733
- if (fieldData === undefined) {
6734
- reader.markMissing();
6735
- reader.exitPath();
6736
- return;
6737
- }
6738
- if (fieldData === null) {
6739
- reader.assignScalar(requestedFieldName, sink, fieldData);
6740
- return sink;
6741
- }
6742
- const fieldType = getFieldType$B(sel);
6743
- if (fieldType === undefined) {
6744
- // This field's type is unknown to us. This breaks normalization.
6745
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
6746
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
6747
- }
6748
- else if (fieldType.isArray) {
6749
- const arraySink = [];
6750
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
6751
- reader.enterPath(i);
6752
- selectType$i(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
6753
- reader.exitPath();
6754
- }
6755
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
6756
- }
6757
- else {
6758
- selectType$i(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
6759
- }
6760
- reader.exitPath();
6761
- return sink;
5181
+ function buildSelectionForField$j(source, reader, sel, variables, fragments) {
5182
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$h, getFieldType$B, selectType$i);
6762
5183
  }
6763
- function buildSelectionForNode$i(source, reader, parentNode, selectionNode, variables, fragments) {
6764
- const sink = {};
6765
- if (selectionNode.directives) {
6766
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
6767
- if (selectionWithDirectives === undefined) {
6768
- return;
6769
- }
6770
- selectionNode = selectionWithDirectives;
6771
- }
6772
- if (selectionNode.kind === "InlineFragment") {
6773
- if (isFragmentApplicable$j(selectionNode, source.data.__typename)) {
6774
- // Get selections out of the inline fragment
6775
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
6776
- // Call into field handling with selections
6777
- Object.assign(sink, buildSelectionForNode$i(source, reader, parentNode, fragmentSelection, variables, fragments));
6778
- });
6779
- }
6780
- }
6781
- if (selectionNode.kind === "FragmentSpread") {
6782
- const namedFragment = fragments[selectionNode.name.value];
6783
- if (namedFragment && isFragmentApplicable$j(namedFragment, source.data.__typename)) {
6784
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
6785
- // Call into field handling with selections
6786
- Object.assign(sink, buildSelectionForNode$i(source, reader, parentNode, fragmentSelection, variables, fragments));
6787
- });
6788
- }
6789
- }
6790
- if (selectionNode.kind === "Field") {
6791
- Object.assign(sink, buildSelectionForField$i(source, reader, selectionNode, variables));
6792
- }
6793
- return sink;
5184
+ function buildSelectionForNode$j(source, reader, parentNode, selectionNode, variables, fragments) {
5185
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$j, buildSelectionForField$j);
6794
5186
  }
6795
5187
  function select$r(field, variables, fragments) {
6796
5188
  return (source, reader) => {
6797
5189
  var _a;
6798
5190
  const sink = {};
6799
5191
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
6800
- const builtSelection = buildSelectionForNode$i(source, reader, field, sel, variables, fragments);
5192
+ const builtSelection = buildSelectionForNode$j(source, reader, field, sel, variables, fragments);
6801
5193
  if (builtSelection !== undefined) {
6802
5194
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
6803
5195
  Object.keys(builtSelection).forEach((key, value) => {
@@ -7647,7 +6039,7 @@ function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fr
7647
6039
  }
7648
6040
  else {
7649
6041
  trimmedEdges = trimEdges(source.edges, startOffset, endOffset);
7650
- maxOffset = !listIsComplete ? findMaxOffset(metadata) : Object.keys(metadata).length - 2;
6042
+ maxOffset = findMaxOffset(metadata);
7651
6043
  const listHasEnoughItems = (endOffset - 1 <= maxOffset);
7652
6044
  if (trimmedEdges === undefined || !listHasEnoughItems) {
7653
6045
  reader.markMissingLink(fieldData.__ref);
@@ -7680,85 +6072,24 @@ function selectType$h(typename, sel, fieldData, reader, key, sink, variables, fr
7680
6072
  reader.markMissingLink(fieldData.__ref);
7681
6073
  reader.markMissing();
7682
6074
  }
7683
- break;
7684
- }
7685
- }
7686
- return sink;
7687
- }
7688
- function buildSelectionForField$h(source, reader, sel, variables, fragments) {
7689
- const sink = {};
7690
- const fieldData = getFieldData$i(source, sel, variables);
7691
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
7692
- reader.enterPath(requestedFieldName);
7693
- if (fieldData === undefined) {
7694
- reader.markMissing();
7695
- reader.exitPath();
7696
- return;
7697
- }
7698
- if (fieldData === null) {
7699
- reader.assignScalar(requestedFieldName, sink, fieldData);
7700
- return sink;
7701
- }
7702
- const fieldType = getFieldType$C(sel);
7703
- if (fieldType === undefined) {
7704
- // This field's type is unknown to us. This breaks normalization.
7705
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
7706
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
7707
- }
7708
- else if (fieldType.isArray) {
7709
- const arraySink = [];
7710
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
7711
- reader.enterPath(i);
7712
- selectType$j(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
7713
- reader.exitPath();
7714
- }
7715
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
7716
- }
7717
- else {
7718
- selectType$j(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
7719
- }
7720
- reader.exitPath();
7721
- return sink;
7722
- }
7723
- function buildSelectionForNode$h(source, reader, parentNode, selectionNode, variables, fragments) {
7724
- const sink = {};
7725
- if (selectionNode.directives) {
7726
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
7727
- if (selectionWithDirectives === undefined) {
7728
- return;
7729
- }
7730
- selectionNode = selectionWithDirectives;
7731
- }
7732
- if (selectionNode.kind === "InlineFragment") {
7733
- if (isFragmentApplicable$i(selectionNode, source.data.__typename)) {
7734
- // Get selections out of the inline fragment
7735
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
7736
- // Call into field handling with selections
7737
- Object.assign(sink, buildSelectionForNode$h(source, reader, parentNode, fragmentSelection, variables, fragments));
7738
- });
7739
- }
7740
- }
7741
- if (selectionNode.kind === "FragmentSpread") {
7742
- const namedFragment = fragments[selectionNode.name.value];
7743
- if (namedFragment && isFragmentApplicable$i(namedFragment, source.data.__typename)) {
7744
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
7745
- // Call into field handling with selections
7746
- Object.assign(sink, buildSelectionForNode$h(source, reader, parentNode, fragmentSelection, variables, fragments));
7747
- });
6075
+ break;
7748
6076
  }
7749
6077
  }
7750
- if (selectionNode.kind === "Field") {
7751
- Object.assign(sink, buildSelectionForField$h(source, reader, selectionNode, variables, fragments));
7752
- }
7753
6078
  return sink;
7754
6079
  }
6080
+ function buildSelectionForField$i(source, reader, sel, variables, fragments) {
6081
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$i, getFieldType$C, selectType$j);
6082
+ }
6083
+ function buildSelectionForNode$i(source, reader, parentNode, selectionNode, variables, fragments) {
6084
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$i, buildSelectionForField$i);
6085
+ }
7755
6086
  function select$q(field, variables, fragments) {
7756
6087
  return (source, reader) => {
7757
6088
  var _a;
7758
6089
  const sink = {};
7759
6090
  source = attachMappedData(source, reader);
7760
6091
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
7761
- const builtSelection = buildSelectionForNode$h(source, reader, field, sel, variables, fragments);
6092
+ const builtSelection = buildSelectionForNode$i(source, reader, field, sel, variables, fragments);
7762
6093
  if (builtSelection !== undefined) {
7763
6094
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
7764
6095
  Object.keys(builtSelection).forEach((key, value) => {
@@ -8694,79 +7025,18 @@ function selectType$g(typename, sel, fieldData, reader, key, sink, variables, fr
8694
7025
  }
8695
7026
  return sink;
8696
7027
  }
8697
- function buildSelectionForField$g(source, reader, sel, variables, fragments) {
8698
- const sink = {};
8699
- const fieldData = getFieldData$g(source, sel, variables);
8700
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
8701
- reader.enterPath(requestedFieldName);
8702
- if (fieldData === undefined) {
8703
- reader.markMissing();
8704
- reader.exitPath();
8705
- return;
8706
- }
8707
- if (fieldData === null) {
8708
- reader.assignScalar(requestedFieldName, sink, fieldData);
8709
- return sink;
8710
- }
8711
- const fieldType = getFieldType$A(sel);
8712
- if (fieldType === undefined) {
8713
- // This field's type is unknown to us. This breaks normalization.
8714
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
8715
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
8716
- }
8717
- else if (fieldType.isArray) {
8718
- const arraySink = [];
8719
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
8720
- reader.enterPath(i);
8721
- selectType$g(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
8722
- reader.exitPath();
8723
- }
8724
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
8725
- }
8726
- else {
8727
- selectType$g(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
8728
- }
8729
- reader.exitPath();
8730
- return sink;
7028
+ function buildSelectionForField$h(source, reader, sel, variables, fragments) {
7029
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$g, getFieldType$A, selectType$g);
8731
7030
  }
8732
- function buildSelectionForNode$g(source, reader, parentNode, selectionNode, variables, fragments) {
8733
- const sink = {};
8734
- if (selectionNode.directives) {
8735
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
8736
- if (selectionWithDirectives === undefined) {
8737
- return;
8738
- }
8739
- selectionNode = selectionWithDirectives;
8740
- }
8741
- if (selectionNode.kind === "InlineFragment") {
8742
- if (isFragmentApplicable$h(selectionNode, source.data.__typename)) {
8743
- // Get selections out of the inline fragment
8744
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
8745
- // Call into field handling with selections
8746
- Object.assign(sink, buildSelectionForNode$g(source, reader, parentNode, fragmentSelection, variables, fragments));
8747
- });
8748
- }
8749
- }
8750
- if (selectionNode.kind === "FragmentSpread") {
8751
- const namedFragment = fragments[selectionNode.name.value];
8752
- if (namedFragment && isFragmentApplicable$h(namedFragment, source.data.__typename)) {
8753
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
8754
- // Call into field handling with selections
8755
- Object.assign(sink, buildSelectionForNode$g(source, reader, parentNode, fragmentSelection, variables, fragments));
8756
- });
8757
- }
8758
- }
8759
- if (selectionNode.kind === "Field") {
8760
- Object.assign(sink, buildSelectionForField$g(source, reader, selectionNode, variables, fragments));
8761
- }
8762
- return sink;
7031
+ function buildSelectionForNode$h(source, reader, parentNode, selectionNode, variables, fragments) {
7032
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$h, buildSelectionForField$h);
8763
7033
  }
8764
7034
  function select$p(field, variables, fragments) {
8765
7035
  return (source, reader) => {
8766
7036
  var _a;
8767
7037
  const sink = {};
8768
7038
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
8769
- const builtSelection = buildSelectionForNode$g(source, reader, field, sel, variables, fragments);
7039
+ const builtSelection = buildSelectionForNode$h(source, reader, field, sel, variables, fragments);
8770
7040
  if (builtSelection !== undefined) {
8771
7041
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
8772
7042
  Object.keys(builtSelection).forEach((key, value) => {
@@ -9053,81 +7323,18 @@ function selectType$f(typename, sel, fieldData, reader, key, sink, variables, fr
9053
7323
  }
9054
7324
  return sink;
9055
7325
  }
9056
- function buildSelectionForField$f(source, reader, sel, variables, fragments) {
9057
- const sink = {};
9058
- const fieldData = getFieldData$f(source, sel, variables);
9059
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
9060
- if (requestedFieldName === 'pageInfo')
9061
- return;
9062
- reader.enterPath(requestedFieldName);
9063
- if (fieldData === undefined) {
9064
- reader.markMissing();
9065
- reader.exitPath();
9066
- return;
9067
- }
9068
- if (fieldData === null) {
9069
- reader.assignScalar(requestedFieldName, sink, fieldData);
9070
- return sink;
9071
- }
9072
- const fieldType = getFieldType$z(sel);
9073
- if (fieldType === undefined) {
9074
- // This field's type is unknown to us. This breaks normalization.
9075
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
9076
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
9077
- }
9078
- else if (fieldType.isArray) {
9079
- const arraySink = [];
9080
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
9081
- reader.enterPath(i);
9082
- selectType$f(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
9083
- reader.exitPath();
9084
- }
9085
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
9086
- }
9087
- else {
9088
- selectType$f(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
9089
- }
9090
- reader.exitPath();
9091
- return sink;
7326
+ function buildSelectionForField$g(source, reader, sel, variables, fragments) {
7327
+ return buildSelectionForField(source, reader, sel, variables, fragments, true, getFieldData$f, getFieldType$z, selectType$f);
9092
7328
  }
9093
- function buildSelectionForNode$f(source, reader, parentNode, selectionNode, variables, fragments) {
9094
- const sink = {};
9095
- if (selectionNode.directives) {
9096
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
9097
- if (selectionWithDirectives === undefined) {
9098
- return;
9099
- }
9100
- selectionNode = selectionWithDirectives;
9101
- }
9102
- if (selectionNode.kind === "InlineFragment") {
9103
- if (isFragmentApplicable$g(selectionNode, source.data.__typename)) {
9104
- // Get selections out of the inline fragment
9105
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
9106
- // Call into field handling with selections
9107
- Object.assign(sink, buildSelectionForNode$f(source, reader, parentNode, fragmentSelection, variables, fragments));
9108
- });
9109
- }
9110
- }
9111
- if (selectionNode.kind === "FragmentSpread") {
9112
- const namedFragment = fragments[selectionNode.name.value];
9113
- if (namedFragment && isFragmentApplicable$g(namedFragment, source.data.__typename)) {
9114
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
9115
- // Call into field handling with selections
9116
- Object.assign(sink, buildSelectionForNode$f(source, reader, parentNode, fragmentSelection, variables, fragments));
9117
- });
9118
- }
9119
- }
9120
- if (selectionNode.kind === "Field") {
9121
- Object.assign(sink, buildSelectionForField$f(source, reader, selectionNode, variables, fragments));
9122
- }
9123
- return sink;
7329
+ function buildSelectionForNode$g(source, reader, parentNode, selectionNode, variables, fragments) {
7330
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$g, buildSelectionForField$g);
9124
7331
  }
9125
7332
  function select$o(field, variables, fragments) {
9126
7333
  return (source, reader) => {
9127
7334
  var _a;
9128
7335
  const sink = {};
9129
7336
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
9130
- const builtSelection = buildSelectionForNode$f(source, reader, field, sel, variables, fragments);
7337
+ const builtSelection = buildSelectionForNode$g(source, reader, field, sel, variables, fragments);
9131
7338
  if (builtSelection !== undefined) {
9132
7339
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
9133
7340
  Object.keys(builtSelection).forEach((key, value) => {
@@ -9385,7 +7592,7 @@ function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fr
9385
7592
  }
9386
7593
  else {
9387
7594
  trimmedEdges = trimEdges(source.edges, startOffset, endOffset);
9388
- maxOffset = !listIsComplete ? findMaxOffset(metadata) : Object.keys(metadata).length - 2;
7595
+ maxOffset = findMaxOffset(metadata);
9389
7596
  const listHasEnoughItems = (endOffset - 1 <= maxOffset);
9390
7597
  if (trimmedEdges === undefined || !listHasEnoughItems) {
9391
7598
  reader.markMissingLink(fieldData.__ref);
@@ -9423,79 +7630,18 @@ function selectType$e(typename, sel, fieldData, reader, key, sink, variables, fr
9423
7630
  }
9424
7631
  return sink;
9425
7632
  }
9426
- function buildSelectionForField$e(source, reader, sel, variables, fragments) {
9427
- const sink = {};
9428
- const fieldData = getFieldData$e(source, sel, variables);
9429
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
9430
- reader.enterPath(requestedFieldName);
9431
- if (fieldData === undefined) {
9432
- reader.markMissing();
9433
- reader.exitPath();
9434
- return;
9435
- }
9436
- if (fieldData === null) {
9437
- reader.assignScalar(requestedFieldName, sink, fieldData);
9438
- return sink;
9439
- }
9440
- const fieldType = getFieldType$y(sel);
9441
- if (fieldType === undefined) {
9442
- // This field's type is unknown to us. This breaks normalization.
9443
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
9444
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
9445
- }
9446
- else if (fieldType.isArray) {
9447
- const arraySink = [];
9448
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
9449
- reader.enterPath(i);
9450
- selectType$e(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
9451
- reader.exitPath();
9452
- }
9453
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
9454
- }
9455
- else {
9456
- selectType$e(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
9457
- }
9458
- reader.exitPath();
9459
- return sink;
7633
+ function buildSelectionForField$f(source, reader, sel, variables, fragments) {
7634
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$e, getFieldType$y, selectType$e);
9460
7635
  }
9461
- function buildSelectionForNode$e(source, reader, parentNode, selectionNode, variables, fragments) {
9462
- const sink = {};
9463
- if (selectionNode.directives) {
9464
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
9465
- if (selectionWithDirectives === undefined) {
9466
- return;
9467
- }
9468
- selectionNode = selectionWithDirectives;
9469
- }
9470
- if (selectionNode.kind === "InlineFragment") {
9471
- if (isFragmentApplicable$f(selectionNode, source.data.__typename)) {
9472
- // Get selections out of the inline fragment
9473
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
9474
- // Call into field handling with selections
9475
- Object.assign(sink, buildSelectionForNode$e(source, reader, parentNode, fragmentSelection, variables, fragments));
9476
- });
9477
- }
9478
- }
9479
- if (selectionNode.kind === "FragmentSpread") {
9480
- const namedFragment = fragments[selectionNode.name.value];
9481
- if (namedFragment && isFragmentApplicable$f(namedFragment, source.data.__typename)) {
9482
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
9483
- // Call into field handling with selections
9484
- Object.assign(sink, buildSelectionForNode$e(source, reader, parentNode, fragmentSelection, variables, fragments));
9485
- });
9486
- }
9487
- }
9488
- if (selectionNode.kind === "Field") {
9489
- Object.assign(sink, buildSelectionForField$e(source, reader, selectionNode, variables, fragments));
9490
- }
9491
- return sink;
7636
+ function buildSelectionForNode$f(source, reader, parentNode, selectionNode, variables, fragments) {
7637
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$f, buildSelectionForField$f);
9492
7638
  }
9493
7639
  function select$n(field, variables, fragments) {
9494
7640
  return (source, reader) => {
9495
7641
  var _a;
9496
7642
  const sink = {};
9497
7643
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
9498
- const builtSelection = buildSelectionForNode$e(source, reader, field, sel, variables, fragments);
7644
+ const builtSelection = buildSelectionForNode$f(source, reader, field, sel, variables, fragments);
9499
7645
  if (builtSelection !== undefined) {
9500
7646
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
9501
7647
  Object.keys(builtSelection).forEach((key, value) => {
@@ -9698,93 +7844,32 @@ function selectType$d(typename, sel, fieldData, reader, key, sink, variables, fr
9698
7844
  },
9699
7845
  variables: {}
9700
7846
  });
9701
- reader.markSeenId(fieldData.__ref);
9702
- if (objectInfoResolvedLink.data !== undefined) {
9703
- const result = select$f(sel, variables, fragments)(objectInfoResolvedLink.data, reader); // Should probably
9704
- reader.assignNonScalar(sink, key, result);
9705
- }
9706
- else {
9707
- reader.markMissingLink(fieldData.__ref);
9708
- reader.markMissing();
9709
- }
9710
- break;
9711
- }
9712
- }
9713
- return sink;
9714
- }
9715
- function buildSelectionForField$d(source, reader, sel, variables, fragments) {
9716
- const sink = {};
9717
- const fieldData = getFieldData$d(source, sel, variables);
9718
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
9719
- reader.enterPath(requestedFieldName);
9720
- if (fieldData === undefined) {
9721
- reader.markMissing();
9722
- reader.exitPath();
9723
- return;
9724
- }
9725
- if (fieldData === null) {
9726
- reader.assignScalar(requestedFieldName, sink, fieldData);
9727
- return sink;
9728
- }
9729
- const fieldType = getFieldType$x(sel);
9730
- if (fieldType === undefined) {
9731
- // This field's type is unknown to us. This breaks normalization.
9732
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
9733
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
9734
- }
9735
- else if (fieldType.isArray) {
9736
- const arraySink = [];
9737
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
9738
- reader.enterPath(i);
9739
- selectType$d(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
9740
- reader.exitPath();
9741
- }
9742
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
9743
- }
9744
- else {
9745
- selectType$d(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
9746
- }
9747
- reader.exitPath();
9748
- return sink;
9749
- }
9750
- function buildSelectionForNode$d(source, reader, parentNode, selectionNode, variables, fragments) {
9751
- const sink = {};
9752
- if (selectionNode.directives) {
9753
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
9754
- if (selectionWithDirectives === undefined) {
9755
- return;
9756
- }
9757
- selectionNode = selectionWithDirectives;
9758
- }
9759
- if (selectionNode.kind === "InlineFragment") {
9760
- if (isFragmentApplicable$e(selectionNode, source.data.__typename)) {
9761
- // Get selections out of the inline fragment
9762
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
9763
- // Call into field handling with selections
9764
- Object.assign(sink, buildSelectionForNode$d(source, reader, parentNode, fragmentSelection, variables, fragments));
9765
- });
9766
- }
9767
- }
9768
- if (selectionNode.kind === "FragmentSpread") {
9769
- const namedFragment = fragments[selectionNode.name.value];
9770
- if (namedFragment && isFragmentApplicable$e(namedFragment, source.data.__typename)) {
9771
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
9772
- // Call into field handling with selections
9773
- Object.assign(sink, buildSelectionForNode$d(source, reader, parentNode, fragmentSelection, variables, fragments));
9774
- });
7847
+ reader.markSeenId(fieldData.__ref);
7848
+ if (objectInfoResolvedLink.data !== undefined) {
7849
+ const result = select$f(sel, variables, fragments)(objectInfoResolvedLink.data, reader); // Should probably
7850
+ reader.assignNonScalar(sink, key, result);
7851
+ }
7852
+ else {
7853
+ reader.markMissingLink(fieldData.__ref);
7854
+ reader.markMissing();
7855
+ }
7856
+ break;
9775
7857
  }
9776
7858
  }
9777
- if (selectionNode.kind === "Field") {
9778
- Object.assign(sink, buildSelectionForField$d(source, reader, selectionNode, variables, fragments));
9779
- }
9780
7859
  return sink;
9781
7860
  }
7861
+ function buildSelectionForField$e(source, reader, sel, variables, fragments) {
7862
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$d, getFieldType$x, selectType$d);
7863
+ }
7864
+ function buildSelectionForNode$e(source, reader, parentNode, selectionNode, variables, fragments) {
7865
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$e, buildSelectionForField$e);
7866
+ }
9782
7867
  function select$m(field, variables, fragments) {
9783
7868
  return (source, reader) => {
9784
7869
  var _a;
9785
7870
  const sink = {};
9786
7871
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
9787
- const builtSelection = buildSelectionForNode$d(source, reader, field, sel, variables, fragments);
7872
+ const builtSelection = buildSelectionForNode$e(source, reader, field, sel, variables, fragments);
9788
7873
  if (builtSelection !== undefined) {
9789
7874
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
9790
7875
  Object.keys(builtSelection).forEach((key, value) => {
@@ -9995,79 +8080,18 @@ function selectType$c(typename, sel, fieldData, reader, key, sink, variables, fr
9995
8080
  }
9996
8081
  return sink;
9997
8082
  }
9998
- function buildSelectionForField$c(source, reader, sel, variables, fragments) {
9999
- const sink = {};
10000
- const fieldData = getFieldData$c(source, sel, variables);
10001
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
10002
- reader.enterPath(requestedFieldName);
10003
- if (fieldData === undefined) {
10004
- reader.markMissing();
10005
- reader.exitPath();
10006
- return;
10007
- }
10008
- if (fieldData === null) {
10009
- reader.assignScalar(requestedFieldName, sink, fieldData);
10010
- return sink;
10011
- }
10012
- const fieldType = getFieldType$w(sel);
10013
- if (fieldType === undefined) {
10014
- // This field's type is unknown to us. This breaks normalization.
10015
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
10016
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
10017
- }
10018
- else if (fieldType.isArray) {
10019
- const arraySink = [];
10020
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
10021
- reader.enterPath(i);
10022
- selectType$c(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
10023
- reader.exitPath();
10024
- }
10025
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
10026
- }
10027
- else {
10028
- selectType$c(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
10029
- }
10030
- reader.exitPath();
10031
- return sink;
8083
+ function buildSelectionForField$d(source, reader, sel, variables, fragments) {
8084
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$c, getFieldType$w, selectType$c);
10032
8085
  }
10033
- function buildSelectionForNode$c(source, reader, parentNode, selectionNode, variables, fragments) {
10034
- const sink = {};
10035
- if (selectionNode.directives) {
10036
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
10037
- if (selectionWithDirectives === undefined) {
10038
- return;
10039
- }
10040
- selectionNode = selectionWithDirectives;
10041
- }
10042
- if (selectionNode.kind === "InlineFragment") {
10043
- if (isFragmentApplicable$d(selectionNode, source.data.__typename)) {
10044
- // Get selections out of the inline fragment
10045
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
10046
- // Call into field handling with selections
10047
- Object.assign(sink, buildSelectionForNode$c(source, reader, parentNode, fragmentSelection, variables, fragments));
10048
- });
10049
- }
10050
- }
10051
- if (selectionNode.kind === "FragmentSpread") {
10052
- const namedFragment = fragments[selectionNode.name.value];
10053
- if (namedFragment && isFragmentApplicable$d(namedFragment, source.data.__typename)) {
10054
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
10055
- // Call into field handling with selections
10056
- Object.assign(sink, buildSelectionForNode$c(source, reader, parentNode, fragmentSelection, variables, fragments));
10057
- });
10058
- }
10059
- }
10060
- if (selectionNode.kind === "Field") {
10061
- Object.assign(sink, buildSelectionForField$c(source, reader, selectionNode, variables));
10062
- }
10063
- return sink;
8086
+ function buildSelectionForNode$d(source, reader, parentNode, selectionNode, variables, fragments) {
8087
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$d, buildSelectionForField$d);
10064
8088
  }
10065
8089
  function select$l(field, variables, fragments) {
10066
8090
  return (source, reader) => {
10067
8091
  var _a;
10068
8092
  const sink = {};
10069
8093
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
10070
- const builtSelection = buildSelectionForNode$c(source, reader, field, sel, variables, fragments);
8094
+ const builtSelection = buildSelectionForNode$d(source, reader, field, sel, variables, fragments);
10071
8095
  if (builtSelection !== undefined) {
10072
8096
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
10073
8097
  Object.keys(builtSelection).forEach((key, value) => {
@@ -10217,79 +8241,18 @@ function selectType$b(typename, sel, fieldData, reader, key, sink, variables, fr
10217
8241
  }
10218
8242
  return sink;
10219
8243
  }
10220
- function buildSelectionForField$b(source, reader, sel, variables, fragments) {
10221
- const sink = {};
10222
- const fieldData = getFieldData$b(source, sel, variables);
10223
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
10224
- reader.enterPath(requestedFieldName);
10225
- if (fieldData === undefined) {
10226
- reader.markMissing();
10227
- reader.exitPath();
10228
- return;
10229
- }
10230
- if (fieldData === null) {
10231
- reader.assignScalar(requestedFieldName, sink, fieldData);
10232
- return sink;
10233
- }
10234
- const fieldType = getFieldType$v(sel);
10235
- if (fieldType === undefined) {
10236
- // This field's type is unknown to us. This breaks normalization.
10237
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
10238
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
10239
- }
10240
- else if (fieldType.isArray) {
10241
- const arraySink = [];
10242
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
10243
- reader.enterPath(i);
10244
- selectType$b(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
10245
- reader.exitPath();
10246
- }
10247
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
10248
- }
10249
- else {
10250
- selectType$b(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
10251
- }
10252
- reader.exitPath();
10253
- return sink;
8244
+ function buildSelectionForField$c(source, reader, sel, variables, fragments) {
8245
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$b, getFieldType$v, selectType$b);
10254
8246
  }
10255
- function buildSelectionForNode$b(source, reader, parentNode, selectionNode, variables, fragments) {
10256
- const sink = {};
10257
- if (selectionNode.directives) {
10258
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
10259
- if (selectionWithDirectives === undefined) {
10260
- return;
10261
- }
10262
- selectionNode = selectionWithDirectives;
10263
- }
10264
- if (selectionNode.kind === "InlineFragment") {
10265
- if (isFragmentApplicable$c(selectionNode, source.data.__typename)) {
10266
- // Get selections out of the inline fragment
10267
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
10268
- // Call into field handling with selections
10269
- Object.assign(sink, buildSelectionForNode$b(source, reader, parentNode, fragmentSelection, variables, fragments));
10270
- });
10271
- }
10272
- }
10273
- if (selectionNode.kind === "FragmentSpread") {
10274
- const namedFragment = fragments[selectionNode.name.value];
10275
- if (namedFragment && isFragmentApplicable$c(namedFragment, source.data.__typename)) {
10276
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
10277
- // Call into field handling with selections
10278
- Object.assign(sink, buildSelectionForNode$b(source, reader, parentNode, fragmentSelection, variables, fragments));
10279
- });
10280
- }
10281
- }
10282
- if (selectionNode.kind === "Field") {
10283
- Object.assign(sink, buildSelectionForField$b(source, reader, selectionNode, variables));
10284
- }
10285
- return sink;
8247
+ function buildSelectionForNode$c(source, reader, parentNode, selectionNode, variables, fragments) {
8248
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$c, buildSelectionForField$c);
10286
8249
  }
10287
8250
  function select$k(field, variables, fragments) {
10288
8251
  return (source, reader) => {
10289
8252
  var _a;
10290
8253
  const sink = {};
10291
8254
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
10292
- const builtSelection = buildSelectionForNode$b(source, reader, field, sel, variables, fragments);
8255
+ const builtSelection = buildSelectionForNode$c(source, reader, field, sel, variables, fragments);
10293
8256
  if (builtSelection !== undefined) {
10294
8257
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
10295
8258
  Object.keys(builtSelection).forEach((key, value) => {
@@ -10467,79 +8430,18 @@ function selectType$a(typename, sel, fieldData, reader, key, sink, variables, fr
10467
8430
  }
10468
8431
  return sink;
10469
8432
  }
10470
- function buildSelectionForField$a(source, reader, sel, variables, fragments) {
10471
- const sink = {};
10472
- const fieldData = getFieldData$a(source, sel, variables);
10473
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
10474
- reader.enterPath(requestedFieldName);
10475
- if (fieldData === undefined) {
10476
- reader.markMissing();
10477
- reader.exitPath();
10478
- return;
10479
- }
10480
- if (fieldData === null) {
10481
- reader.assignScalar(requestedFieldName, sink, fieldData);
10482
- return sink;
10483
- }
10484
- const fieldType = getFieldType$u(sel);
10485
- if (fieldType === undefined) {
10486
- // This field's type is unknown to us. This breaks normalization.
10487
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
10488
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
10489
- }
10490
- else if (fieldType.isArray) {
10491
- const arraySink = [];
10492
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
10493
- reader.enterPath(i);
10494
- selectType$a(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
10495
- reader.exitPath();
10496
- }
10497
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
10498
- }
10499
- else {
10500
- selectType$a(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
10501
- }
10502
- reader.exitPath();
10503
- return sink;
8433
+ function buildSelectionForField$b(source, reader, sel, variables, fragments) {
8434
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$a, getFieldType$u, selectType$a);
10504
8435
  }
10505
- function buildSelectionForNode$a(source, reader, parentNode, selectionNode, variables, fragments) {
10506
- const sink = {};
10507
- if (selectionNode.directives) {
10508
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
10509
- if (selectionWithDirectives === undefined) {
10510
- return;
10511
- }
10512
- selectionNode = selectionWithDirectives;
10513
- }
10514
- if (selectionNode.kind === "InlineFragment") {
10515
- if (isFragmentApplicable$b(selectionNode, source.data.__typename)) {
10516
- // Get selections out of the inline fragment
10517
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
10518
- // Call into field handling with selections
10519
- Object.assign(sink, buildSelectionForNode$a(source, reader, parentNode, fragmentSelection, variables, fragments));
10520
- });
10521
- }
10522
- }
10523
- if (selectionNode.kind === "FragmentSpread") {
10524
- const namedFragment = fragments[selectionNode.name.value];
10525
- if (namedFragment && isFragmentApplicable$b(namedFragment, source.data.__typename)) {
10526
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
10527
- // Call into field handling with selections
10528
- Object.assign(sink, buildSelectionForNode$a(source, reader, parentNode, fragmentSelection, variables, fragments));
10529
- });
10530
- }
10531
- }
10532
- if (selectionNode.kind === "Field") {
10533
- Object.assign(sink, buildSelectionForField$a(source, reader, selectionNode, variables, fragments));
10534
- }
10535
- return sink;
8436
+ function buildSelectionForNode$b(source, reader, parentNode, selectionNode, variables, fragments) {
8437
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$b, buildSelectionForField$b);
10536
8438
  }
10537
8439
  function select$j(field, variables, fragments) {
10538
8440
  return (source, reader) => {
10539
8441
  var _a;
10540
8442
  const sink = {};
10541
8443
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
10542
- const builtSelection = buildSelectionForNode$a(source, reader, field, sel, variables, fragments);
8444
+ const builtSelection = buildSelectionForNode$b(source, reader, field, sel, variables, fragments);
10543
8445
  if (builtSelection !== undefined) {
10544
8446
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
10545
8447
  Object.keys(builtSelection).forEach((key, value) => {
@@ -10792,79 +8694,18 @@ function selectType$9(typename, sel, fieldData, reader, key, sink, variables, fr
10792
8694
  }
10793
8695
  return sink;
10794
8696
  }
10795
- function buildSelectionForField$9(source, reader, sel, variables, fragments) {
10796
- const sink = {};
10797
- const fieldData = getFieldData$9(source, sel, variables);
10798
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
10799
- reader.enterPath(requestedFieldName);
10800
- if (fieldData === undefined) {
10801
- reader.markMissing();
10802
- reader.exitPath();
10803
- return;
10804
- }
10805
- if (fieldData === null) {
10806
- reader.assignScalar(requestedFieldName, sink, fieldData);
10807
- return sink;
10808
- }
10809
- const fieldType = getFieldType$t(sel);
10810
- if (fieldType === undefined) {
10811
- // This field's type is unknown to us. This breaks normalization.
10812
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
10813
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
10814
- }
10815
- else if (fieldType.isArray) {
10816
- const arraySink = [];
10817
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
10818
- reader.enterPath(i);
10819
- selectType$9(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
10820
- reader.exitPath();
10821
- }
10822
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
10823
- }
10824
- else {
10825
- selectType$9(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
10826
- }
10827
- reader.exitPath();
10828
- return sink;
8697
+ function buildSelectionForField$a(source, reader, sel, variables, fragments) {
8698
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$9, getFieldType$t, selectType$9);
10829
8699
  }
10830
- function buildSelectionForNode$9(source, reader, parentNode, selectionNode, variables, fragments) {
10831
- const sink = {};
10832
- if (selectionNode.directives) {
10833
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
10834
- if (selectionWithDirectives === undefined) {
10835
- return;
10836
- }
10837
- selectionNode = selectionWithDirectives;
10838
- }
10839
- if (selectionNode.kind === "InlineFragment") {
10840
- if (isFragmentApplicable$a(selectionNode, source.data.__typename)) {
10841
- // Get selections out of the inline fragment
10842
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
10843
- // Call into field handling with selections
10844
- Object.assign(sink, buildSelectionForNode$9(source, reader, parentNode, fragmentSelection, variables, fragments));
10845
- });
10846
- }
10847
- }
10848
- if (selectionNode.kind === "FragmentSpread") {
10849
- const namedFragment = fragments[selectionNode.name.value];
10850
- if (namedFragment && isFragmentApplicable$a(namedFragment, source.data.__typename)) {
10851
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
10852
- // Call into field handling with selections
10853
- Object.assign(sink, buildSelectionForNode$9(source, reader, parentNode, fragmentSelection, variables, fragments));
10854
- });
10855
- }
10856
- }
10857
- if (selectionNode.kind === "Field") {
10858
- Object.assign(sink, buildSelectionForField$9(source, reader, selectionNode, variables, fragments));
10859
- }
10860
- return sink;
8700
+ function buildSelectionForNode$a(source, reader, parentNode, selectionNode, variables, fragments) {
8701
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$a, buildSelectionForField$a);
10861
8702
  }
10862
8703
  function select$i(field, variables, fragments) {
10863
8704
  return (source, reader) => {
10864
8705
  var _a;
10865
8706
  const sink = {};
10866
8707
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
10867
- const builtSelection = buildSelectionForNode$9(source, reader, field, sel, variables, fragments);
8708
+ const builtSelection = buildSelectionForNode$a(source, reader, field, sel, variables, fragments);
10868
8709
  if (builtSelection !== undefined) {
10869
8710
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
10870
8711
  Object.keys(builtSelection).forEach((key, value) => {
@@ -11267,79 +9108,18 @@ function selectType$8(typename, sel, fieldData, reader, key, sink, variables, fr
11267
9108
  }
11268
9109
  return sink;
11269
9110
  }
11270
- function buildSelectionForField$8(source, reader, sel, variables, fragments) {
11271
- const sink = {};
11272
- const fieldData = getFieldData$8(source, sel, variables);
11273
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
11274
- reader.enterPath(requestedFieldName);
11275
- if (fieldData === undefined) {
11276
- reader.markMissing();
11277
- reader.exitPath();
11278
- return;
11279
- }
11280
- if (fieldData === null) {
11281
- reader.assignScalar(requestedFieldName, sink, fieldData);
11282
- return sink;
11283
- }
11284
- const fieldType = getFieldType$s(sel);
11285
- if (fieldType === undefined) {
11286
- // This field's type is unknown to us. This breaks normalization.
11287
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
11288
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
11289
- }
11290
- else if (fieldType.isArray) {
11291
- const arraySink = [];
11292
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
11293
- reader.enterPath(i);
11294
- selectType$8(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
11295
- reader.exitPath();
11296
- }
11297
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
11298
- }
11299
- else {
11300
- selectType$8(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
11301
- }
11302
- reader.exitPath();
11303
- return sink;
9111
+ function buildSelectionForField$9(source, reader, sel, variables, fragments) {
9112
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$8, getFieldType$s, selectType$8);
11304
9113
  }
11305
- function buildSelectionForNode$8(source, reader, parentNode, selectionNode, variables, fragments) {
11306
- const sink = {};
11307
- if (selectionNode.directives) {
11308
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
11309
- if (selectionWithDirectives === undefined) {
11310
- return;
11311
- }
11312
- selectionNode = selectionWithDirectives;
11313
- }
11314
- if (selectionNode.kind === "InlineFragment") {
11315
- if (isFragmentApplicable$9(selectionNode, source.data.__typename)) {
11316
- // Get selections out of the inline fragment
11317
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
11318
- // Call into field handling with selections
11319
- Object.assign(sink, buildSelectionForNode$8(source, reader, parentNode, fragmentSelection, variables, fragments));
11320
- });
11321
- }
11322
- }
11323
- if (selectionNode.kind === "FragmentSpread") {
11324
- const namedFragment = fragments[selectionNode.name.value];
11325
- if (namedFragment && isFragmentApplicable$9(namedFragment, source.data.__typename)) {
11326
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
11327
- // Call into field handling with selections
11328
- Object.assign(sink, buildSelectionForNode$8(source, reader, parentNode, fragmentSelection, variables, fragments));
11329
- });
11330
- }
11331
- }
11332
- if (selectionNode.kind === "Field") {
11333
- Object.assign(sink, buildSelectionForField$8(source, reader, selectionNode, variables));
11334
- }
11335
- return sink;
9114
+ function buildSelectionForNode$9(source, reader, parentNode, selectionNode, variables, fragments) {
9115
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$9, buildSelectionForField$9);
11336
9116
  }
11337
9117
  function select$h(field, variables, fragments) {
11338
9118
  return (source, reader) => {
11339
9119
  var _a;
11340
9120
  const sink = {};
11341
9121
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
11342
- const builtSelection = buildSelectionForNode$8(source, reader, field, sel, variables, fragments);
9122
+ const builtSelection = buildSelectionForNode$9(source, reader, field, sel, variables, fragments);
11343
9123
  if (builtSelection !== undefined) {
11344
9124
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
11345
9125
  Object.keys(builtSelection).forEach((key, value) => {
@@ -11511,79 +9291,18 @@ function selectType$7(typename, sel, fieldData, reader, key, sink, variables, fr
11511
9291
  }
11512
9292
  return sink;
11513
9293
  }
11514
- function buildSelectionForField$7(source, reader, sel, variables, fragments) {
11515
- const sink = {};
11516
- const fieldData = getFieldData$7(source, sel, variables);
11517
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
11518
- reader.enterPath(requestedFieldName);
11519
- if (fieldData === undefined) {
11520
- reader.markMissing();
11521
- reader.exitPath();
11522
- return;
11523
- }
11524
- if (fieldData === null) {
11525
- reader.assignScalar(requestedFieldName, sink, fieldData);
11526
- return sink;
11527
- }
11528
- const fieldType = getFieldType$r(sel);
11529
- if (fieldType === undefined) {
11530
- // This field's type is unknown to us. This breaks normalization.
11531
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
11532
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
11533
- }
11534
- else if (fieldType.isArray) {
11535
- const arraySink = [];
11536
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
11537
- reader.enterPath(i);
11538
- selectType$7(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
11539
- reader.exitPath();
11540
- }
11541
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
11542
- }
11543
- else {
11544
- selectType$7(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
11545
- }
11546
- reader.exitPath();
11547
- return sink;
9294
+ function buildSelectionForField$8(source, reader, sel, variables, fragments) {
9295
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$7, getFieldType$r, selectType$7);
11548
9296
  }
11549
- function buildSelectionForNode$7(source, reader, parentNode, selectionNode, variables, fragments) {
11550
- const sink = {};
11551
- if (selectionNode.directives) {
11552
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
11553
- if (selectionWithDirectives === undefined) {
11554
- return;
11555
- }
11556
- selectionNode = selectionWithDirectives;
11557
- }
11558
- if (selectionNode.kind === "InlineFragment") {
11559
- if (isFragmentApplicable$8(selectionNode, source.data.__typename)) {
11560
- // Get selections out of the inline fragment
11561
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
11562
- // Call into field handling with selections
11563
- Object.assign(sink, buildSelectionForNode$7(source, reader, parentNode, fragmentSelection, variables, fragments));
11564
- });
11565
- }
11566
- }
11567
- if (selectionNode.kind === "FragmentSpread") {
11568
- const namedFragment = fragments[selectionNode.name.value];
11569
- if (namedFragment && isFragmentApplicable$8(namedFragment, source.data.__typename)) {
11570
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
11571
- // Call into field handling with selections
11572
- Object.assign(sink, buildSelectionForNode$7(source, reader, parentNode, fragmentSelection, variables, fragments));
11573
- });
11574
- }
11575
- }
11576
- if (selectionNode.kind === "Field") {
11577
- Object.assign(sink, buildSelectionForField$7(source, reader, selectionNode, variables));
11578
- }
11579
- return sink;
9297
+ function buildSelectionForNode$8(source, reader, parentNode, selectionNode, variables, fragments) {
9298
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$8, buildSelectionForField$8);
11580
9299
  }
11581
9300
  function select$g(field, variables, fragments) {
11582
9301
  return (source, reader) => {
11583
9302
  var _a;
11584
9303
  const sink = {};
11585
9304
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
11586
- const builtSelection = buildSelectionForNode$7(source, reader, field, sel, variables, fragments);
9305
+ const builtSelection = buildSelectionForNode$8(source, reader, field, sel, variables, fragments);
11587
9306
  if (builtSelection !== undefined) {
11588
9307
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
11589
9308
  Object.keys(builtSelection).forEach((key, value) => {
@@ -11848,79 +9567,18 @@ function selectType$6(typename, sel, fieldData, reader, key, sink, variables, fr
11848
9567
  }
11849
9568
  return sink;
11850
9569
  }
11851
- function buildSelectionForField$6(source, reader, sel, variables, fragments) {
11852
- const sink = {};
11853
- const fieldData = getFieldData$6(source, sel, variables);
11854
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
11855
- reader.enterPath(requestedFieldName);
11856
- if (fieldData === undefined) {
11857
- reader.markMissing();
11858
- reader.exitPath();
11859
- return;
11860
- }
11861
- if (fieldData === null) {
11862
- reader.assignScalar(requestedFieldName, sink, fieldData);
11863
- return sink;
11864
- }
11865
- const fieldType = getFieldType$q(sel);
11866
- if (fieldType === undefined) {
11867
- // This field's type is unknown to us. This breaks normalization.
11868
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
11869
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
11870
- }
11871
- else if (fieldType.isArray) {
11872
- const arraySink = [];
11873
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
11874
- reader.enterPath(i);
11875
- selectType$6(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
11876
- reader.exitPath();
11877
- }
11878
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
11879
- }
11880
- else {
11881
- selectType$6(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
11882
- }
11883
- reader.exitPath();
11884
- return sink;
9570
+ function buildSelectionForField$7(source, reader, sel, variables, fragments) {
9571
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$6, getFieldType$q, selectType$6);
11885
9572
  }
11886
- function buildSelectionForNode$6(source, reader, parentNode, selectionNode, variables, fragments) {
11887
- const sink = {};
11888
- if (selectionNode.directives) {
11889
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
11890
- if (selectionWithDirectives === undefined) {
11891
- return;
11892
- }
11893
- selectionNode = selectionWithDirectives;
11894
- }
11895
- if (selectionNode.kind === "InlineFragment") {
11896
- if (isFragmentApplicable$7(selectionNode, source.data.__typename)) {
11897
- // Get selections out of the inline fragment
11898
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
11899
- // Call into field handling with selections
11900
- Object.assign(sink, buildSelectionForNode$6(source, reader, parentNode, fragmentSelection, variables, fragments));
11901
- });
11902
- }
11903
- }
11904
- if (selectionNode.kind === "FragmentSpread") {
11905
- const namedFragment = fragments[selectionNode.name.value];
11906
- if (namedFragment && isFragmentApplicable$7(namedFragment, source.data.__typename)) {
11907
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
11908
- // Call into field handling with selections
11909
- Object.assign(sink, buildSelectionForNode$6(source, reader, parentNode, fragmentSelection, variables, fragments));
11910
- });
11911
- }
11912
- }
11913
- if (selectionNode.kind === "Field") {
11914
- Object.assign(sink, buildSelectionForField$6(source, reader, selectionNode, variables, fragments));
11915
- }
11916
- return sink;
9573
+ function buildSelectionForNode$7(source, reader, parentNode, selectionNode, variables, fragments) {
9574
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$7, buildSelectionForField$7);
11917
9575
  }
11918
9576
  function select$f(field, variables, fragments) {
11919
9577
  return (source, reader) => {
11920
9578
  var _a;
11921
9579
  const sink = {};
11922
9580
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
11923
- const builtSelection = buildSelectionForNode$6(source, reader, field, sel, variables, fragments);
9581
+ const builtSelection = buildSelectionForNode$7(source, reader, field, sel, variables, fragments);
11924
9582
  if (builtSelection !== undefined) {
11925
9583
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
11926
9584
  Object.keys(builtSelection).forEach((key, value) => {
@@ -12325,101 +9983,40 @@ function getFieldData$5(source, sel, variables) {
12325
9983
  switch (sel.name.value) {
12326
9984
  default: {
12327
9985
  const fieldType = getFieldType$p(sel);
12328
- const fieldKey = getSerializedKeyForField(sel, variables, fieldType);
12329
- return source.data[fieldKey];
12330
- }
12331
- }
12332
- }
12333
- function selectType$5(typename, sel, fieldData, reader, key, sink, variables, fragments) {
12334
- if (fieldData === null) {
12335
- reader.assignScalar(key, sink, fieldData);
12336
- return sink;
12337
- }
12338
- switch (typename) {
12339
- case 'String': {
12340
- reader.assignScalar(key, sink, fieldData);
12341
- break;
12342
- }
12343
- case 'Boolean': {
12344
- reader.assignScalar(key, sink, fieldData);
12345
- break;
12346
- }
12347
- }
12348
- return sink;
12349
- }
12350
- function buildSelectionForField$5(source, reader, sel, variables, fragments) {
12351
- const sink = {};
12352
- const fieldData = getFieldData$5(source, sel, variables);
12353
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
12354
- reader.enterPath(requestedFieldName);
12355
- if (fieldData === undefined) {
12356
- reader.markMissing();
12357
- reader.exitPath();
12358
- return;
12359
- }
12360
- if (fieldData === null) {
12361
- reader.assignScalar(requestedFieldName, sink, fieldData);
12362
- return sink;
12363
- }
12364
- const fieldType = getFieldType$p(sel);
12365
- if (fieldType === undefined) {
12366
- // This field's type is unknown to us. This breaks normalization.
12367
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
12368
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
12369
- }
12370
- else if (fieldType.isArray) {
12371
- const arraySink = [];
12372
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
12373
- reader.enterPath(i);
12374
- selectType$5(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
12375
- reader.exitPath();
12376
- }
12377
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
12378
- }
12379
- else {
12380
- selectType$5(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
12381
- }
12382
- reader.exitPath();
12383
- return sink;
12384
- }
12385
- function buildSelectionForNode$5(source, reader, parentNode, selectionNode, variables, fragments) {
12386
- const sink = {};
12387
- if (selectionNode.directives) {
12388
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
12389
- if (selectionWithDirectives === undefined) {
12390
- return;
12391
- }
12392
- selectionNode = selectionWithDirectives;
12393
- }
12394
- if (selectionNode.kind === "InlineFragment") {
12395
- if (isFragmentApplicable$6(selectionNode, source.data.__typename)) {
12396
- // Get selections out of the inline fragment
12397
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
12398
- // Call into field handling with selections
12399
- Object.assign(sink, buildSelectionForNode$5(source, reader, parentNode, fragmentSelection, variables, fragments));
12400
- });
12401
- }
12402
- }
12403
- if (selectionNode.kind === "FragmentSpread") {
12404
- const namedFragment = fragments[selectionNode.name.value];
12405
- if (namedFragment && isFragmentApplicable$6(namedFragment, source.data.__typename)) {
12406
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
12407
- // Call into field handling with selections
12408
- Object.assign(sink, buildSelectionForNode$5(source, reader, parentNode, fragmentSelection, variables, fragments));
12409
- });
9986
+ const fieldKey = getSerializedKeyForField(sel, variables, fieldType);
9987
+ return source.data[fieldKey];
12410
9988
  }
12411
9989
  }
12412
- if (selectionNode.kind === "Field") {
12413
- Object.assign(sink, buildSelectionForField$5(source, reader, selectionNode, variables));
9990
+ }
9991
+ function selectType$5(typename, sel, fieldData, reader, key, sink, variables, fragments) {
9992
+ if (fieldData === null) {
9993
+ reader.assignScalar(key, sink, fieldData);
9994
+ return sink;
9995
+ }
9996
+ switch (typename) {
9997
+ case 'String': {
9998
+ reader.assignScalar(key, sink, fieldData);
9999
+ break;
10000
+ }
10001
+ case 'Boolean': {
10002
+ reader.assignScalar(key, sink, fieldData);
10003
+ break;
10004
+ }
12414
10005
  }
12415
10006
  return sink;
12416
10007
  }
10008
+ function buildSelectionForField$6(source, reader, sel, variables, fragments) {
10009
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$5, getFieldType$p, selectType$5);
10010
+ }
10011
+ function buildSelectionForNode$6(source, reader, parentNode, selectionNode, variables, fragments) {
10012
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$6, buildSelectionForField$6);
10013
+ }
12417
10014
  function select$e(field, variables, fragments) {
12418
10015
  return (source, reader) => {
12419
10016
  var _a;
12420
10017
  const sink = {};
12421
10018
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
12422
- const builtSelection = buildSelectionForNode$5(source, reader, field, sel, variables, fragments);
10019
+ const builtSelection = buildSelectionForNode$6(source, reader, field, sel, variables, fragments);
12423
10020
  if (builtSelection !== undefined) {
12424
10021
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
12425
10022
  Object.keys(builtSelection).forEach((key, value) => {
@@ -12585,79 +10182,18 @@ function selectType$4(typename, sel, fieldData, reader, key, sink, variables, fr
12585
10182
  }
12586
10183
  return sink;
12587
10184
  }
12588
- function buildSelectionForField$4(source, reader, sel, variables, fragments) {
12589
- const sink = {};
12590
- const fieldData = getFieldData$4(source, sel, variables);
12591
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
12592
- reader.enterPath(requestedFieldName);
12593
- if (fieldData === undefined) {
12594
- reader.markMissing();
12595
- reader.exitPath();
12596
- return;
12597
- }
12598
- if (fieldData === null) {
12599
- reader.assignScalar(requestedFieldName, sink, fieldData);
12600
- return sink;
12601
- }
12602
- const fieldType = getFieldType$o(sel);
12603
- if (fieldType === undefined) {
12604
- // This field's type is unknown to us. This breaks normalization.
12605
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
12606
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
12607
- }
12608
- else if (fieldType.isArray) {
12609
- const arraySink = [];
12610
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
12611
- reader.enterPath(i);
12612
- selectType$4(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
12613
- reader.exitPath();
12614
- }
12615
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
12616
- }
12617
- else {
12618
- selectType$4(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
12619
- }
12620
- reader.exitPath();
12621
- return sink;
10185
+ function buildSelectionForField$5(source, reader, sel, variables, fragments) {
10186
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$4, getFieldType$o, selectType$4);
12622
10187
  }
12623
- function buildSelectionForNode$4(source, reader, parentNode, selectionNode, variables, fragments) {
12624
- const sink = {};
12625
- if (selectionNode.directives) {
12626
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
12627
- if (selectionWithDirectives === undefined) {
12628
- return;
12629
- }
12630
- selectionNode = selectionWithDirectives;
12631
- }
12632
- if (selectionNode.kind === "InlineFragment") {
12633
- if (isFragmentApplicable$5(selectionNode, source.data.__typename)) {
12634
- // Get selections out of the inline fragment
12635
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
12636
- // Call into field handling with selections
12637
- Object.assign(sink, buildSelectionForNode$4(source, reader, parentNode, fragmentSelection, variables, fragments));
12638
- });
12639
- }
12640
- }
12641
- if (selectionNode.kind === "FragmentSpread") {
12642
- const namedFragment = fragments[selectionNode.name.value];
12643
- if (namedFragment && isFragmentApplicable$5(namedFragment, source.data.__typename)) {
12644
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
12645
- // Call into field handling with selections
12646
- Object.assign(sink, buildSelectionForNode$4(source, reader, parentNode, fragmentSelection, variables, fragments));
12647
- });
12648
- }
12649
- }
12650
- if (selectionNode.kind === "Field") {
12651
- Object.assign(sink, buildSelectionForField$4(source, reader, selectionNode, variables));
12652
- }
12653
- return sink;
10188
+ function buildSelectionForNode$5(source, reader, parentNode, selectionNode, variables, fragments) {
10189
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$5, buildSelectionForField$5);
12654
10190
  }
12655
10191
  function select$d(field, variables, fragments) {
12656
10192
  return (source, reader) => {
12657
10193
  var _a;
12658
10194
  const sink = {};
12659
10195
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
12660
- const builtSelection = buildSelectionForNode$4(source, reader, field, sel, variables, fragments);
10196
+ const builtSelection = buildSelectionForNode$5(source, reader, field, sel, variables, fragments);
12661
10197
  if (builtSelection !== undefined) {
12662
10198
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
12663
10199
  Object.keys(builtSelection).forEach((key, value) => {
@@ -12852,79 +10388,18 @@ function selectType$3(typename, sel, fieldData, reader, key, sink, variables, fr
12852
10388
  }
12853
10389
  return sink;
12854
10390
  }
12855
- function buildSelectionForField$3(source, reader, sel, variables, fragments) {
12856
- const sink = {};
12857
- const fieldData = getFieldData$3(source, sel, variables);
12858
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
12859
- reader.enterPath(requestedFieldName);
12860
- if (fieldData === undefined) {
12861
- reader.markMissing();
12862
- reader.exitPath();
12863
- return;
12864
- }
12865
- if (fieldData === null) {
12866
- reader.assignScalar(requestedFieldName, sink, fieldData);
12867
- return sink;
12868
- }
12869
- const fieldType = getFieldType$n(sel);
12870
- if (fieldType === undefined) {
12871
- // This field's type is unknown to us. This breaks normalization.
12872
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
12873
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
12874
- }
12875
- else if (fieldType.isArray) {
12876
- const arraySink = [];
12877
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
12878
- reader.enterPath(i);
12879
- selectType$3(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
12880
- reader.exitPath();
12881
- }
12882
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
12883
- }
12884
- else {
12885
- selectType$3(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
12886
- }
12887
- reader.exitPath();
12888
- return sink;
10391
+ function buildSelectionForField$4(source, reader, sel, variables, fragments) {
10392
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$3, getFieldType$n, selectType$3);
12889
10393
  }
12890
- function buildSelectionForNode$3(source, reader, parentNode, selectionNode, variables, fragments) {
12891
- const sink = {};
12892
- if (selectionNode.directives) {
12893
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
12894
- if (selectionWithDirectives === undefined) {
12895
- return;
12896
- }
12897
- selectionNode = selectionWithDirectives;
12898
- }
12899
- if (selectionNode.kind === "InlineFragment") {
12900
- if (isFragmentApplicable$4(selectionNode, source.data.__typename)) {
12901
- // Get selections out of the inline fragment
12902
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
12903
- // Call into field handling with selections
12904
- Object.assign(sink, buildSelectionForNode$3(source, reader, parentNode, fragmentSelection, variables, fragments));
12905
- });
12906
- }
12907
- }
12908
- if (selectionNode.kind === "FragmentSpread") {
12909
- const namedFragment = fragments[selectionNode.name.value];
12910
- if (namedFragment && isFragmentApplicable$4(namedFragment, source.data.__typename)) {
12911
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
12912
- // Call into field handling with selections
12913
- Object.assign(sink, buildSelectionForNode$3(source, reader, parentNode, fragmentSelection, variables, fragments));
12914
- });
12915
- }
12916
- }
12917
- if (selectionNode.kind === "Field") {
12918
- Object.assign(sink, buildSelectionForField$3(source, reader, selectionNode, variables, fragments));
12919
- }
12920
- return sink;
10394
+ function buildSelectionForNode$4(source, reader, parentNode, selectionNode, variables, fragments) {
10395
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$4, buildSelectionForField$4);
12921
10396
  }
12922
10397
  function select$c(field, variables, fragments) {
12923
10398
  return (source, reader) => {
12924
10399
  var _a;
12925
10400
  const sink = {};
12926
10401
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
12927
- const builtSelection = buildSelectionForNode$3(source, reader, field, sel, variables, fragments);
10402
+ const builtSelection = buildSelectionForNode$4(source, reader, field, sel, variables, fragments);
12928
10403
  if (builtSelection !== undefined) {
12929
10404
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
12930
10405
  Object.keys(builtSelection).forEach((key, value) => {
@@ -13241,79 +10716,18 @@ function selectType$2(typename, sel, fieldData, reader, key, sink, variables, fr
13241
10716
  }
13242
10717
  return sink;
13243
10718
  }
13244
- function buildSelectionForField$2(source, reader, sel, variables, fragments) {
13245
- const sink = {};
13246
- const fieldData = getFieldData$2(source, sel, variables);
13247
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
13248
- reader.enterPath(requestedFieldName);
13249
- if (fieldData === undefined) {
13250
- reader.markMissing();
13251
- reader.exitPath();
13252
- return;
13253
- }
13254
- if (fieldData === null) {
13255
- reader.assignScalar(requestedFieldName, sink, fieldData);
13256
- return sink;
13257
- }
13258
- const fieldType = getFieldType$m(sel);
13259
- if (fieldType === undefined) {
13260
- // This field's type is unknown to us. This breaks normalization.
13261
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
13262
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
13263
- }
13264
- else if (fieldType.isArray) {
13265
- const arraySink = [];
13266
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
13267
- reader.enterPath(i);
13268
- selectType$2(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
13269
- reader.exitPath();
13270
- }
13271
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
13272
- }
13273
- else {
13274
- selectType$2(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
13275
- }
13276
- reader.exitPath();
13277
- return sink;
10719
+ function buildSelectionForField$3(source, reader, sel, variables, fragments) {
10720
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$2, getFieldType$m, selectType$2);
13278
10721
  }
13279
- function buildSelectionForNode$2(source, reader, parentNode, selectionNode, variables, fragments) {
13280
- const sink = {};
13281
- if (selectionNode.directives) {
13282
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
13283
- if (selectionWithDirectives === undefined) {
13284
- return;
13285
- }
13286
- selectionNode = selectionWithDirectives;
13287
- }
13288
- if (selectionNode.kind === "InlineFragment") {
13289
- if (isFragmentApplicable$3(selectionNode, source.data.__typename)) {
13290
- // Get selections out of the inline fragment
13291
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
13292
- // Call into field handling with selections
13293
- Object.assign(sink, buildSelectionForNode$2(source, reader, parentNode, fragmentSelection, variables, fragments));
13294
- });
13295
- }
13296
- }
13297
- if (selectionNode.kind === "FragmentSpread") {
13298
- const namedFragment = fragments[selectionNode.name.value];
13299
- if (namedFragment && isFragmentApplicable$3(namedFragment, source.data.__typename)) {
13300
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
13301
- // Call into field handling with selections
13302
- Object.assign(sink, buildSelectionForNode$2(source, reader, parentNode, fragmentSelection, variables, fragments));
13303
- });
13304
- }
13305
- }
13306
- if (selectionNode.kind === "Field") {
13307
- Object.assign(sink, buildSelectionForField$2(source, reader, selectionNode, variables, fragments));
13308
- }
13309
- return sink;
10722
+ function buildSelectionForNode$3(source, reader, parentNode, selectionNode, variables, fragments) {
10723
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$3, buildSelectionForField$3);
13310
10724
  }
13311
10725
  function select$b(field, variables, fragments) {
13312
10726
  return (source, reader) => {
13313
10727
  var _a;
13314
10728
  const sink = {};
13315
10729
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
13316
- const builtSelection = buildSelectionForNode$2(source, reader, field, sel, variables, fragments);
10730
+ const builtSelection = buildSelectionForNode$3(source, reader, field, sel, variables, fragments);
13317
10731
  if (builtSelection !== undefined) {
13318
10732
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
13319
10733
  Object.keys(builtSelection).forEach((key, value) => {
@@ -13545,104 +10959,43 @@ function getFieldData$1(source, sel, variables) {
13545
10959
  default: {
13546
10960
  const fieldType = getFieldType$l(sel);
13547
10961
  const fieldKey = getSerializedKeyForField(sel, variables, fieldType);
13548
- return source.data[fieldKey];
13549
- }
13550
- }
13551
- }
13552
- function selectType$1(typename, sel, fieldData, reader, key, sink, variables, fragments) {
13553
- if (fieldData === null) {
13554
- reader.assignScalar(key, sink, fieldData);
13555
- return sink;
13556
- }
13557
- switch (typename) {
13558
- case 'String': {
13559
- reader.assignScalar(key, sink, fieldData);
13560
- break;
13561
- }
13562
- case 'Long': {
13563
- reader.assignScalar(key, sink, fieldData);
13564
- break;
13565
- }
13566
- case 'DateTime': {
13567
- reader.assignScalar(key, sink, fieldData);
13568
- break;
13569
- }
13570
- }
13571
- return sink;
13572
- }
13573
- function buildSelectionForField$1(source, reader, sel, variables, fragments) {
13574
- const sink = {};
13575
- const fieldData = getFieldData$1(source, sel, variables);
13576
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
13577
- reader.enterPath(requestedFieldName);
13578
- if (fieldData === undefined) {
13579
- reader.markMissing();
13580
- reader.exitPath();
13581
- return;
13582
- }
13583
- if (fieldData === null) {
13584
- reader.assignScalar(requestedFieldName, sink, fieldData);
13585
- return sink;
13586
- }
13587
- const fieldType = getFieldType$l(sel);
13588
- if (fieldType === undefined) {
13589
- // This field's type is unknown to us. This breaks normalization.
13590
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
13591
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
13592
- }
13593
- else if (fieldType.isArray) {
13594
- const arraySink = [];
13595
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
13596
- reader.enterPath(i);
13597
- selectType$1(fieldType.typename, sel, fieldData[i], reader, i, arraySink);
13598
- reader.exitPath();
13599
- }
13600
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
13601
- }
13602
- else {
13603
- selectType$1(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink);
10962
+ return source.data[fieldKey];
10963
+ }
13604
10964
  }
13605
- reader.exitPath();
13606
- return sink;
13607
10965
  }
13608
- function buildSelectionForNode$1(source, reader, parentNode, selectionNode, variables, fragments) {
13609
- const sink = {};
13610
- if (selectionNode.directives) {
13611
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
13612
- if (selectionWithDirectives === undefined) {
13613
- return;
13614
- }
13615
- selectionNode = selectionWithDirectives;
10966
+ function selectType$1(typename, sel, fieldData, reader, key, sink, variables, fragments) {
10967
+ if (fieldData === null) {
10968
+ reader.assignScalar(key, sink, fieldData);
10969
+ return sink;
13616
10970
  }
13617
- if (selectionNode.kind === "InlineFragment") {
13618
- if (isFragmentApplicable$2(selectionNode, source.data.__typename)) {
13619
- // Get selections out of the inline fragment
13620
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
13621
- // Call into field handling with selections
13622
- Object.assign(sink, buildSelectionForNode$1(source, reader, parentNode, fragmentSelection, variables, fragments));
13623
- });
10971
+ switch (typename) {
10972
+ case 'String': {
10973
+ reader.assignScalar(key, sink, fieldData);
10974
+ break;
13624
10975
  }
13625
- }
13626
- if (selectionNode.kind === "FragmentSpread") {
13627
- const namedFragment = fragments[selectionNode.name.value];
13628
- if (namedFragment && isFragmentApplicable$2(namedFragment, source.data.__typename)) {
13629
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
13630
- // Call into field handling with selections
13631
- Object.assign(sink, buildSelectionForNode$1(source, reader, parentNode, fragmentSelection, variables, fragments));
13632
- });
10976
+ case 'Long': {
10977
+ reader.assignScalar(key, sink, fieldData);
10978
+ break;
10979
+ }
10980
+ case 'DateTime': {
10981
+ reader.assignScalar(key, sink, fieldData);
10982
+ break;
13633
10983
  }
13634
- }
13635
- if (selectionNode.kind === "Field") {
13636
- Object.assign(sink, buildSelectionForField$1(source, reader, selectionNode, variables));
13637
10984
  }
13638
10985
  return sink;
13639
10986
  }
10987
+ function buildSelectionForField$2(source, reader, sel, variables, fragments) {
10988
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData$1, getFieldType$l, selectType$1);
10989
+ }
10990
+ function buildSelectionForNode$2(source, reader, parentNode, selectionNode, variables, fragments) {
10991
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$2, buildSelectionForField$2);
10992
+ }
13640
10993
  function select$a(field, variables, fragments) {
13641
10994
  return (source, reader) => {
13642
10995
  var _a;
13643
10996
  const sink = {};
13644
10997
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
13645
- const builtSelection = buildSelectionForNode$1(source, reader, field, sel, variables, fragments);
10998
+ const builtSelection = buildSelectionForNode$2(source, reader, field, sel, variables, fragments);
13646
10999
  if (builtSelection !== undefined) {
13647
11000
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
13648
11001
  Object.keys(builtSelection).forEach((key, value) => {
@@ -13852,79 +11205,18 @@ function selectType(typename, sel, fieldData, reader, key, sink, variables, frag
13852
11205
  }
13853
11206
  return sink;
13854
11207
  }
13855
- function buildSelectionForField(source, reader, sel, variables, fragments) {
13856
- const sink = {};
13857
- const fieldData = getFieldData(source, sel, variables);
13858
- const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
13859
- reader.enterPath(requestedFieldName);
13860
- if (fieldData === undefined) {
13861
- reader.markMissing();
13862
- reader.exitPath();
13863
- return;
13864
- }
13865
- if (fieldData === null) {
13866
- reader.assignScalar(requestedFieldName, sink, fieldData);
13867
- return sink;
13868
- }
13869
- const fieldType = getFieldType$k(sel);
13870
- if (fieldType === undefined) {
13871
- // This field's type is unknown to us. This breaks normalization.
13872
- console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
13873
- reader.assignNonScalar(sink, requestedFieldName, fieldData);
13874
- }
13875
- else if (fieldType.isArray) {
13876
- const arraySink = [];
13877
- for (let i = 0, len = fieldData.length; i < len; i += 1) {
13878
- reader.enterPath(i);
13879
- selectType(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
13880
- reader.exitPath();
13881
- }
13882
- reader.assignNonScalar(sink, requestedFieldName, arraySink);
13883
- }
13884
- else {
13885
- selectType(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
13886
- }
13887
- reader.exitPath();
13888
- return sink;
11208
+ function buildSelectionForField$1(source, reader, sel, variables, fragments) {
11209
+ return buildSelectionForField(source, reader, sel, variables, fragments, false, getFieldData, getFieldType$k, selectType);
13889
11210
  }
13890
- function buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments) {
13891
- const sink = {};
13892
- if (selectionNode.directives) {
13893
- const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
13894
- if (selectionWithDirectives === undefined) {
13895
- return;
13896
- }
13897
- selectionNode = selectionWithDirectives;
13898
- }
13899
- if (selectionNode.kind === "InlineFragment") {
13900
- if (isFragmentApplicable$1(selectionNode, source.data.__typename)) {
13901
- // Get selections out of the inline fragment
13902
- selectionNode.selectionSet.selections.forEach(fragmentSelection => {
13903
- // Call into field handling with selections
13904
- Object.assign(sink, buildSelectionForNode(source, reader, parentNode, fragmentSelection, variables, fragments));
13905
- });
13906
- }
13907
- }
13908
- if (selectionNode.kind === "FragmentSpread") {
13909
- const namedFragment = fragments[selectionNode.name.value];
13910
- if (namedFragment && isFragmentApplicable$1(namedFragment, source.data.__typename)) {
13911
- namedFragment.selectionSet.selections.forEach(fragmentSelection => {
13912
- // Call into field handling with selections
13913
- Object.assign(sink, buildSelectionForNode(source, reader, parentNode, fragmentSelection, variables, fragments));
13914
- });
13915
- }
13916
- }
13917
- if (selectionNode.kind === "Field") {
13918
- Object.assign(sink, buildSelectionForField(source, reader, selectionNode, variables, fragments));
13919
- }
13920
- return sink;
11211
+ function buildSelectionForNode$1(source, reader, parentNode, selectionNode, variables, fragments) {
11212
+ return buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable$1, buildSelectionForField$1);
13921
11213
  }
13922
11214
  function select$9(field, variables, fragments) {
13923
11215
  return (source, reader) => {
13924
11216
  var _a;
13925
11217
  const sink = {};
13926
11218
  (_a = field.selectionSet) === null || _a === void 0 ? void 0 : _a.selections.forEach((sel) => {
13927
- const builtSelection = buildSelectionForNode(source, reader, field, sel, variables, fragments);
11219
+ const builtSelection = buildSelectionForNode$1(source, reader, field, sel, variables, fragments);
13928
11220
  if (builtSelection !== undefined) {
13929
11221
  if (sel.kind === "InlineFragment" || sel.kind === "FragmentSpread") {
13930
11222
  Object.keys(builtSelection).forEach((key, value) => {
@@ -15697,6 +12989,93 @@ function getInContextFragmentType(fragment, fragmentMap) {
15697
12989
  return sharedGetFragmentType(fragment, fragmentMap);
15698
12990
  }
15699
12991
 
12992
+ function applyToSelection$6(selection, directive, variables) {
12993
+ return selection;
12994
+ }
12995
+
12996
+ function applyToSelection$5(selection, directive, variables) {
12997
+ return selection;
12998
+ }
12999
+
13000
+ function applyToSelection$4(selection, directive, variables) {
13001
+ return selection;
13002
+ }
13003
+
13004
+ function applyToSelection$3(selection, directive, variables) {
13005
+ var _a;
13006
+ const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
13007
+ if (ifArg && ifArg.value) {
13008
+ if (ifArg.value.kind === "BooleanValue") {
13009
+ return ifArg.value.value ? selection : undefined;
13010
+ }
13011
+ if (ifArg.value.kind === "Variable") {
13012
+ return variables[ifArg.value.name.value] ? selection : undefined;
13013
+ }
13014
+ }
13015
+ return selection;
13016
+ }
13017
+
13018
+ function applyToSelection$2(selection, directive, variables) {
13019
+ var _a;
13020
+ const ifArg = (_a = directive.arguments) === null || _a === void 0 ? void 0 : _a.find(argument => argument.name.value === "if");
13021
+ if (ifArg && ifArg.value) {
13022
+ if (ifArg.value.kind === "BooleanValue") {
13023
+ return ifArg.value.value ? undefined : selection;
13024
+ }
13025
+ if (ifArg.value.kind === "Variable") {
13026
+ return variables[ifArg.value.name.value] ? undefined : selection;
13027
+ }
13028
+ }
13029
+ return selection;
13030
+ }
13031
+
13032
+ function applyToSelection$1(selection, directive, variables) {
13033
+ return selection;
13034
+ }
13035
+
13036
+ function applyToSelection(selection, directive, variables) {
13037
+ return selection;
13038
+ }
13039
+
13040
+ function applyDirectivesForSelection(selection, variables) {
13041
+ let result = selection;
13042
+ if (selection && selection.directives) {
13043
+ // iterate through directives in order. Directives _can_ be stacked.
13044
+ for (var i = 0; i < selection.directives.length; i++) {
13045
+ const directive = selection.directives[i];
13046
+ switch (directive.name.value) {
13047
+ // Generate Case for each directive in the schema that supports SelectionNodes
13048
+ case ("generic"):
13049
+ result = applyToSelection$6(selection);
13050
+ break;
13051
+ case ("fieldCategory"):
13052
+ result = applyToSelection$5(selection);
13053
+ break;
13054
+ case ("category"):
13055
+ result = applyToSelection$4(selection);
13056
+ break;
13057
+ case ("include"):
13058
+ result = applyToSelection$3(selection, directive, variables);
13059
+ break;
13060
+ case ("skip"):
13061
+ result = applyToSelection$2(selection, directive, variables);
13062
+ break;
13063
+ case ("deprecated"):
13064
+ result = applyToSelection$1(selection);
13065
+ break;
13066
+ case ("specifiedBy"):
13067
+ result = applyToSelection(selection);
13068
+ break;
13069
+ }
13070
+ if (result === undefined) {
13071
+ // Selection was removed.
13072
+ break;
13073
+ }
13074
+ }
13075
+ }
13076
+ return result;
13077
+ }
13078
+
15700
13079
  function createLink(ref) {
15701
13080
  return {
15702
13081
  __ref: serializeStructuredKey(ref),
@@ -16461,6 +13840,76 @@ function isFragmentApplicable(fragmentNode, implementedInterfaces, graphqlTypeNa
16461
13840
  const doesImplementInterface = !isUntypedInlineFragment && implementedInterfaces.includes(fragmentNode.typeCondition.name.value);
16462
13841
  const typenameMatchesCondition = typename !== undefined && !isUntypedInlineFragment && typename === fragmentNode.typeCondition.name.value;
16463
13842
  return isUntypedInlineFragment || matchesTypeCondition || doesImplementInterface || typenameMatchesCondition;
13843
+ }
13844
+ function buildSelectionForNode(source, reader, parentNode, selectionNode, variables, fragments, isFragmentApplicable, buildSelectionForField) {
13845
+ const sink = {};
13846
+ if (selectionNode.directives) {
13847
+ const selectionWithDirectives = applyDirectivesForSelection(selectionNode, variables);
13848
+ if (selectionWithDirectives === undefined) {
13849
+ return;
13850
+ }
13851
+ selectionNode = selectionWithDirectives;
13852
+ }
13853
+ if (selectionNode.kind === "InlineFragment") {
13854
+ if (isFragmentApplicable(selectionNode, source.data.__typename)) {
13855
+ // Get selections out of the inline fragment
13856
+ selectionNode.selectionSet.selections.forEach(fragmentSelection => {
13857
+ // Call into field handling with selections
13858
+ Object.assign(sink, buildSelectionForNode(source, reader, parentNode, fragmentSelection, variables, fragments, isFragmentApplicable, buildSelectionForField));
13859
+ });
13860
+ }
13861
+ }
13862
+ if (selectionNode.kind === "FragmentSpread") {
13863
+ const namedFragment = fragments[selectionNode.name.value];
13864
+ if (namedFragment && isFragmentApplicable(namedFragment, source.data.__typename)) {
13865
+ namedFragment.selectionSet.selections.forEach(fragmentSelection => {
13866
+ // Call into field handling with selections
13867
+ Object.assign(sink, buildSelectionForNode(source, reader, parentNode, fragmentSelection, variables, fragments, isFragmentApplicable, buildSelectionForField));
13868
+ });
13869
+ }
13870
+ }
13871
+ if (selectionNode.kind === "Field") {
13872
+ Object.assign(sink, buildSelectionForField(source, reader, selectionNode, variables, fragments));
13873
+ }
13874
+ return sink;
13875
+ }
13876
+ function buildSelectionForField(source, reader, sel, variables, fragments, isCursorConnectionType, getFieldData, getFieldType, selectType) {
13877
+ const sink = {};
13878
+ const fieldData = getFieldData(source, sel, variables);
13879
+ const requestedFieldName = sel.alias ? sel.alias.value : sel.name.value;
13880
+ if (isCursorConnectionType && requestedFieldName === 'pageInfo') {
13881
+ return;
13882
+ }
13883
+ reader.enterPath(requestedFieldName);
13884
+ if (fieldData === undefined) {
13885
+ reader.markMissing();
13886
+ reader.exitPath();
13887
+ return;
13888
+ }
13889
+ if (fieldData === null) {
13890
+ reader.assignScalar(requestedFieldName, sink, fieldData);
13891
+ return sink;
13892
+ }
13893
+ const fieldType = getFieldType(sel);
13894
+ if (fieldType === undefined) {
13895
+ // This field's type is unknown to us. This breaks normalization.
13896
+ console.warn(`Unknown Field: ${requestedFieldName}. This field or nested fields cannot participate in normalization`);
13897
+ reader.assignNonScalar(sink, requestedFieldName, fieldData);
13898
+ }
13899
+ else if (fieldType.isArray) {
13900
+ const arraySink = [];
13901
+ for (let i = 0, len = fieldData.length; i < len; i += 1) {
13902
+ reader.enterPath(i);
13903
+ selectType(fieldType.typename, sel, fieldData[i], reader, i, arraySink, variables, fragments);
13904
+ reader.exitPath();
13905
+ }
13906
+ reader.assignNonScalar(sink, requestedFieldName, arraySink);
13907
+ }
13908
+ else {
13909
+ selectType(fieldType.typename, sel, fieldData, reader, requestedFieldName, sink, variables, fragments);
13910
+ }
13911
+ reader.exitPath();
13912
+ return sink;
16464
13913
  }
16465
13914
 
16466
13915
  const TTL = 900000;
@@ -17815,4 +15264,4 @@ register({
17815
15264
  });
17816
15265
 
17817
15266
  export { configurationForGraphQLAdapters as configuration, graphql, factory$1 as graphqlAdapterFactory, graphqlBatch, graphqlBatch_imperative, graphql_imperative };
17818
- // version: 1.114.5-f7ec91a8d
15267
+ // version: 1.114.6-f2429e60e