houdini 0.17.13 → 0.18.0

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.
Files changed (57) hide show
  1. package/build/cmd-cjs/index.js +438 -201
  2. package/build/cmd-esm/index.js +438 -201
  3. package/build/codegen/utils/flattenSelections.d.ts +3 -1
  4. package/build/codegen-cjs/index.js +405 -180
  5. package/build/codegen-esm/index.js +405 -180
  6. package/build/lib/config.d.ts +8 -3
  7. package/build/lib-cjs/index.js +141 -81
  8. package/build/lib-esm/index.js +141 -81
  9. package/build/runtime/cache/subscription.d.ts +3 -3
  10. package/build/runtime/lib/config.d.ts +2 -1
  11. package/build/runtime/lib/scalars.d.ts +2 -2
  12. package/build/runtime/lib/selection.d.ts +2 -0
  13. package/build/runtime/lib/types.d.ts +26 -16
  14. package/build/runtime-cjs/cache/cache.js +38 -23
  15. package/build/runtime-cjs/cache/lists.js +40 -26
  16. package/build/runtime-cjs/cache/subscription.d.ts +3 -3
  17. package/build/runtime-cjs/cache/subscription.js +23 -21
  18. package/build/runtime-cjs/lib/config.d.ts +2 -1
  19. package/build/runtime-cjs/lib/scalars.d.ts +2 -2
  20. package/build/runtime-cjs/lib/scalars.js +9 -6
  21. package/build/runtime-cjs/lib/selection.d.ts +2 -0
  22. package/build/runtime-cjs/lib/selection.js +39 -0
  23. package/build/runtime-cjs/lib/types.d.ts +26 -16
  24. package/build/runtime-esm/cache/cache.js +38 -23
  25. package/build/runtime-esm/cache/lists.js +40 -26
  26. package/build/runtime-esm/cache/subscription.d.ts +3 -3
  27. package/build/runtime-esm/cache/subscription.js +23 -21
  28. package/build/runtime-esm/lib/config.d.ts +2 -1
  29. package/build/runtime-esm/lib/scalars.d.ts +2 -2
  30. package/build/runtime-esm/lib/scalars.js +9 -6
  31. package/build/runtime-esm/lib/selection.d.ts +2 -0
  32. package/build/runtime-esm/lib/selection.js +15 -0
  33. package/build/runtime-esm/lib/types.d.ts +26 -16
  34. package/build/test/index.d.ts +1 -2
  35. package/build/test-cjs/index.js +485 -195
  36. package/build/test-esm/index.js +485 -195
  37. package/build/vite-cjs/index.js +438 -193
  38. package/build/vite-esm/index.js +438 -193
  39. package/package.json +2 -2
  40. package/build/runtime-cjs/cache/tests/availability.test.js +0 -357
  41. package/build/runtime-cjs/cache/tests/gc.test.js +0 -271
  42. package/build/runtime-cjs/cache/tests/keys.test.js +0 -34
  43. package/build/runtime-cjs/cache/tests/list.test.js +0 -3390
  44. package/build/runtime-cjs/cache/tests/readwrite.test.js +0 -1076
  45. package/build/runtime-cjs/cache/tests/scalars.test.js +0 -181
  46. package/build/runtime-cjs/cache/tests/storage.test.js +0 -280
  47. package/build/runtime-cjs/cache/tests/subscriptions.test.js +0 -1469
  48. package/build/runtime-cjs/lib/scalars.test.js +0 -736
  49. package/build/runtime-esm/cache/tests/availability.test.js +0 -356
  50. package/build/runtime-esm/cache/tests/gc.test.js +0 -270
  51. package/build/runtime-esm/cache/tests/keys.test.js +0 -33
  52. package/build/runtime-esm/cache/tests/list.test.js +0 -3389
  53. package/build/runtime-esm/cache/tests/readwrite.test.js +0 -1075
  54. package/build/runtime-esm/cache/tests/scalars.test.js +0 -180
  55. package/build/runtime-esm/cache/tests/storage.test.js +0 -279
  56. package/build/runtime-esm/cache/tests/subscriptions.test.js +0 -1468
  57. package/build/runtime-esm/lib/scalars.test.js +0 -735
@@ -3350,7 +3350,7 @@ var require_definition = __commonJS({
3350
3350
  exports.assertObjectType = assertObjectType;
3351
3351
  exports.isInterfaceType = isInterfaceType6;
3352
3352
  exports.assertInterfaceType = assertInterfaceType;
3353
- exports.isUnionType = isUnionType6;
3353
+ exports.isUnionType = isUnionType7;
3354
3354
  exports.assertUnionType = assertUnionType;
3355
3355
  exports.isEnumType = isEnumType4;
3356
3356
  exports.assertEnumType = assertEnumType;
@@ -3368,7 +3368,7 @@ var require_definition = __commonJS({
3368
3368
  exports.assertLeafType = assertLeafType;
3369
3369
  exports.isCompositeType = isCompositeType;
3370
3370
  exports.assertCompositeType = assertCompositeType;
3371
- exports.isAbstractType = isAbstractType;
3371
+ exports.isAbstractType = isAbstractType2;
3372
3372
  exports.assertAbstractType = assertAbstractType;
3373
3373
  exports.GraphQLList = GraphQLList2;
3374
3374
  exports.GraphQLNonNull = GraphQLNonNull2;
@@ -3423,7 +3423,7 @@ var require_definition = __commonJS({
3423
3423
  return Constructor;
3424
3424
  }
3425
3425
  function isType(type) {
3426
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isInputObjectType(type) || isListType3(type) || isNonNullType6(type);
3426
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type) || isListType3(type) || isNonNullType6(type);
3427
3427
  }
3428
3428
  function assertType(type) {
3429
3429
  if (!isType(type)) {
@@ -3458,11 +3458,11 @@ var require_definition = __commonJS({
3458
3458
  }
3459
3459
  return type;
3460
3460
  }
3461
- function isUnionType6(type) {
3461
+ function isUnionType7(type) {
3462
3462
  return (0, _instanceOf.default)(type, GraphQLUnionType);
3463
3463
  }
3464
3464
  function assertUnionType(type) {
3465
- if (!isUnionType6(type)) {
3465
+ if (!isUnionType7(type)) {
3466
3466
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Union type."));
3467
3467
  }
3468
3468
  return type;
@@ -3513,7 +3513,7 @@ var require_definition = __commonJS({
3513
3513
  return type;
3514
3514
  }
3515
3515
  function isOutputType(type) {
3516
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isWrappingType(type) && isOutputType(type.ofType);
3516
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isWrappingType(type) && isOutputType(type.ofType);
3517
3517
  }
3518
3518
  function assertOutputType(type) {
3519
3519
  if (!isOutputType(type)) {
@@ -3531,7 +3531,7 @@ var require_definition = __commonJS({
3531
3531
  return type;
3532
3532
  }
3533
3533
  function isCompositeType(type) {
3534
- return isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type);
3534
+ return isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type);
3535
3535
  }
3536
3536
  function assertCompositeType(type) {
3537
3537
  if (!isCompositeType(type)) {
@@ -3539,11 +3539,11 @@ var require_definition = __commonJS({
3539
3539
  }
3540
3540
  return type;
3541
3541
  }
3542
- function isAbstractType(type) {
3543
- return isInterfaceType6(type) || isUnionType6(type);
3542
+ function isAbstractType2(type) {
3543
+ return isInterfaceType6(type) || isUnionType7(type);
3544
3544
  }
3545
3545
  function assertAbstractType(type) {
3546
- if (!isAbstractType(type)) {
3546
+ if (!isAbstractType2(type)) {
3547
3547
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
3548
3548
  }
3549
3549
  return type;
@@ -3610,7 +3610,7 @@ var require_definition = __commonJS({
3610
3610
  }
3611
3611
  }
3612
3612
  function isNamedType(type) {
3613
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isInputObjectType(type);
3613
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type);
3614
3614
  }
3615
3615
  function assertNamedType(type) {
3616
3616
  if (!isNamedType(type)) {
@@ -53461,6 +53461,20 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
53461
53461
  return true;
53462
53462
  }
53463
53463
 
53464
+ // src/runtime/lib/selection.ts
53465
+ function getFieldsForType(selection2, __typename) {
53466
+ let targetSelection = selection2.fields || {};
53467
+ if (selection2.abstractFields && __typename) {
53468
+ const mappedType = selection2.abstractFields.typeMap[__typename];
53469
+ if (mappedType) {
53470
+ targetSelection = selection2.abstractFields.fields[mappedType];
53471
+ } else if (selection2.abstractFields.fields[__typename]) {
53472
+ targetSelection = selection2.abstractFields.fields[__typename];
53473
+ }
53474
+ }
53475
+ return targetSelection;
53476
+ }
53477
+
53464
53478
  // src/runtime/cache/gc.ts
53465
53479
  var GarbageCollector = class {
53466
53480
  cache;
@@ -53683,23 +53697,32 @@ var List = class {
53683
53697
  let insertData = data;
53684
53698
  if (this.connection) {
53685
53699
  insertSelection = {
53686
- newEntry: {
53687
- keyRaw: this.key,
53688
- type: "Connection",
53689
- fields: {
53690
- edges: {
53691
- keyRaw: "edges",
53692
- type: "ConnectionEdge",
53693
- update: where === "first" ? "prepend" : "append",
53700
+ fields: {
53701
+ newEntry: {
53702
+ keyRaw: this.key,
53703
+ type: "Connection",
53704
+ selection: {
53694
53705
  fields: {
53695
- node: {
53696
- type: listType,
53697
- keyRaw: "node",
53698
- fields: {
53699
- ...selection2,
53700
- __typename: {
53701
- keyRaw: "__typename",
53702
- type: "String"
53706
+ edges: {
53707
+ keyRaw: "edges",
53708
+ type: "ConnectionEdge",
53709
+ update: where === "first" ? "prepend" : "append",
53710
+ selection: {
53711
+ fields: {
53712
+ node: {
53713
+ type: listType,
53714
+ keyRaw: "node",
53715
+ selection: {
53716
+ ...selection2,
53717
+ fields: {
53718
+ ...selection2.fields,
53719
+ __typename: {
53720
+ keyRaw: "__typename",
53721
+ type: "String"
53722
+ }
53723
+ }
53724
+ }
53725
+ }
53703
53726
  }
53704
53727
  }
53705
53728
  }
@@ -53715,15 +53738,20 @@ var List = class {
53715
53738
  };
53716
53739
  } else {
53717
53740
  insertSelection = {
53718
- newEntries: {
53719
- keyRaw: this.key,
53720
- type: listType,
53721
- update: where === "first" ? "prepend" : "append",
53722
- fields: {
53723
- ...selection2,
53724
- __typename: {
53725
- keyRaw: "__typename",
53726
- type: "String"
53741
+ fields: {
53742
+ newEntries: {
53743
+ keyRaw: this.key,
53744
+ type: listType,
53745
+ update: where === "first" ? "prepend" : "append",
53746
+ selection: {
53747
+ ...selection2,
53748
+ fields: {
53749
+ ...selection2.fields,
53750
+ __typename: {
53751
+ keyRaw: "__typename",
53752
+ type: "String"
53753
+ }
53754
+ }
53727
53755
  }
53728
53756
  }
53729
53757
  }
@@ -53783,7 +53811,7 @@ var List = class {
53783
53811
  const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
53784
53812
  this.cache._internal_unstable.subscriptions.remove(
53785
53813
  targetID,
53786
- this.connection ? this.selection.edges.fields : this.selection,
53814
+ this.connection ? this.selection.fields.edges.selection : this.selection,
53787
53815
  subscribers,
53788
53816
  variables
53789
53817
  );
@@ -54272,18 +54300,20 @@ var InMemorySubscriptions = class {
54272
54300
  variables,
54273
54301
  parentType
54274
54302
  }) {
54275
- for (const fieldSelection of Object.values(selection2)) {
54276
- const { keyRaw, fields, type } = fieldSelection;
54303
+ const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
54304
+ let targetSelection = getFieldsForType(selection2, __typename);
54305
+ for (const fieldSelection of Object.values(targetSelection || {})) {
54306
+ const { keyRaw, selection: innerSelection, type } = fieldSelection;
54277
54307
  const key = evaluateKey(keyRaw, variables);
54278
54308
  this.addFieldSubscription({
54279
54309
  id: parent,
54280
54310
  key,
54281
- selection: fieldSelection,
54311
+ field: fieldSelection,
54282
54312
  spec,
54283
54313
  parentType: parentType || spec.rootType,
54284
54314
  variables
54285
54315
  });
54286
- if (fields) {
54316
+ if (innerSelection) {
54287
54317
  const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
54288
54318
  parent,
54289
54319
  key
@@ -54296,7 +54326,7 @@ var InMemorySubscriptions = class {
54296
54326
  this.add({
54297
54327
  parent: child,
54298
54328
  spec,
54299
- selection: fields,
54329
+ selection: innerSelection,
54300
54330
  variables,
54301
54331
  parentType: type
54302
54332
  });
@@ -54307,7 +54337,7 @@ var InMemorySubscriptions = class {
54307
54337
  addFieldSubscription({
54308
54338
  id,
54309
54339
  key,
54310
- selection: selection2,
54340
+ field,
54311
54341
  spec,
54312
54342
  parentType,
54313
54343
  variables
@@ -54334,8 +54364,8 @@ var InMemorySubscriptions = class {
54334
54364
  const counts = this.referenceCounts[id][key];
54335
54365
  counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
54336
54366
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
54337
- const { fields, list, filters } = selection2;
54338
- if (fields && list) {
54367
+ const { selection: selection2, list, filters } = field;
54368
+ if (selection2 && list) {
54339
54369
  this.cache._internal_unstable.lists.add({
54340
54370
  name: list.name,
54341
54371
  connection: list.connection,
@@ -54343,7 +54373,7 @@ var InMemorySubscriptions = class {
54343
54373
  recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
54344
54374
  listType: list.type,
54345
54375
  key,
54346
- selection: fields,
54376
+ selection: selection2,
54347
54377
  filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
54348
54378
  return {
54349
54379
  ...acc,
@@ -54360,20 +54390,21 @@ var InMemorySubscriptions = class {
54360
54390
  subscribers,
54361
54391
  parentType
54362
54392
  }) {
54363
- for (const fieldSelection of Object.values(selection2)) {
54364
- const { type: linkedType, keyRaw, fields } = fieldSelection;
54393
+ let targetSelection = getFieldsForType(selection2, parentType);
54394
+ for (const fieldSelection of Object.values(targetSelection)) {
54395
+ const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
54365
54396
  const key = evaluateKey(keyRaw, variables);
54366
54397
  for (const spec of subscribers) {
54367
54398
  this.addFieldSubscription({
54368
54399
  id: parent,
54369
54400
  key,
54370
- selection: fieldSelection,
54401
+ field: fieldSelection,
54371
54402
  spec,
54372
54403
  parentType,
54373
54404
  variables
54374
54405
  });
54375
54406
  }
54376
- if (fields) {
54407
+ if (innerSelection) {
54377
54408
  const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
54378
54409
  const children = !Array.isArray(link) ? [link] : flattenList(link);
54379
54410
  for (const linkedRecord of children) {
@@ -54382,7 +54413,7 @@ var InMemorySubscriptions = class {
54382
54413
  }
54383
54414
  this.addMany({
54384
54415
  parent: linkedRecord,
54385
- selection: fields,
54416
+ selection: innerSelection,
54386
54417
  variables,
54387
54418
  subscribers,
54388
54419
  parentType: linkedType
@@ -54394,22 +54425,20 @@ var InMemorySubscriptions = class {
54394
54425
  get(id, field) {
54395
54426
  return this.subscribers[id]?.[field] || [];
54396
54427
  }
54397
- remove(id, fields, targets, variables, visited = []) {
54428
+ remove(id, selection2, targets, variables, visited = []) {
54398
54429
  visited.push(id);
54399
54430
  const linkedIDs = [];
54400
- for (const selection2 of Object.values(fields)) {
54401
- const key = evaluateKey(selection2.keyRaw, variables);
54431
+ for (const fieldSelection of Object.values(selection2.fields || {})) {
54432
+ const key = evaluateKey(fieldSelection.keyRaw, variables);
54402
54433
  this.removeSubscribers(id, key, targets);
54403
- if (!selection2.fields) {
54434
+ if (!fieldSelection.selection?.fields) {
54404
54435
  continue;
54405
54436
  }
54406
- if (selection2.list) {
54407
- }
54408
54437
  const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
54409
54438
  const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
54410
54439
  for (const link of links) {
54411
54440
  if (link !== null) {
54412
- linkedIDs.push([link, selection2.fields]);
54441
+ linkedIDs.push([link, fieldSelection.selection || {}]);
54413
54442
  }
54414
54443
  }
54415
54444
  }
@@ -54587,8 +54616,9 @@ var CacheInternal = class {
54587
54616
  if (this._disabled) {
54588
54617
  return [];
54589
54618
  }
54619
+ let targetSelection = getFieldsForType(selection2, data["__typename"]);
54590
54620
  for (const [field, value] of Object.entries(data)) {
54591
- if (!selection2 || !selection2[field]) {
54621
+ if (!selection2 || !targetSelection[field]) {
54592
54622
  throw new Error(
54593
54623
  "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
54594
54624
  );
@@ -54596,11 +54626,11 @@ var CacheInternal = class {
54596
54626
  let {
54597
54627
  type: linkedType,
54598
54628
  keyRaw,
54599
- fields,
54629
+ selection: fieldSelection,
54600
54630
  operations,
54601
54631
  abstract: isAbstract,
54602
54632
  update
54603
- } = selection2[field];
54633
+ } = targetSelection[field];
54604
54634
  const key = evaluateKey(keyRaw, variables);
54605
54635
  const currentSubscribers = this.subscriptions.get(parent, key);
54606
54636
  const { value: previousValue, displayLayers } = this.storage.get(parent, key);
@@ -54608,7 +54638,7 @@ var CacheInternal = class {
54608
54638
  if (displayLayer) {
54609
54639
  this.lifetimes.resetLifetime(parent, key);
54610
54640
  }
54611
- if (!fields) {
54641
+ if (!fieldSelection) {
54612
54642
  let newValue = value;
54613
54643
  if (Array.isArray(value) && applyUpdates && update) {
54614
54644
  if (update === "append") {
@@ -54628,7 +54658,7 @@ var CacheInternal = class {
54628
54658
  }
54629
54659
  const previousLinks = flattenList([previousValue]);
54630
54660
  for (const link of previousLinks) {
54631
- this.subscriptions.remove(link, fields, currentSubscribers, variables);
54661
+ this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
54632
54662
  }
54633
54663
  layer.writeLink(parent, key, null);
54634
54664
  toNotify.push(...currentSubscribers);
@@ -54654,14 +54684,14 @@ var CacheInternal = class {
54654
54684
  if (previousValue && typeof previousValue === "string") {
54655
54685
  this.subscriptions.remove(
54656
54686
  previousValue,
54657
- fields,
54687
+ fieldSelection,
54658
54688
  currentSubscribers,
54659
54689
  variables
54660
54690
  );
54661
54691
  }
54662
54692
  this.subscriptions.addMany({
54663
54693
  parent: linkedID,
54664
- selection: fields,
54694
+ selection: fieldSelection,
54665
54695
  subscribers: currentSubscribers,
54666
54696
  variables,
54667
54697
  parentType: linkedType
@@ -54671,14 +54701,14 @@ var CacheInternal = class {
54671
54701
  if (linkedID) {
54672
54702
  this.writeSelection({
54673
54703
  root,
54674
- selection: fields,
54704
+ selection: fieldSelection,
54675
54705
  parent: linkedID,
54676
54706
  data: value,
54677
54707
  variables,
54678
54708
  toNotify,
54679
54709
  applyUpdates,
54680
54710
  layer,
54681
- forceNotify: true
54711
+ forceNotify
54682
54712
  });
54683
54713
  }
54684
54714
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
@@ -54707,7 +54737,7 @@ var CacheInternal = class {
54707
54737
  key,
54708
54738
  linkedType,
54709
54739
  variables,
54710
- fields,
54740
+ fields: fieldSelection,
54711
54741
  layer,
54712
54742
  forceNotify
54713
54743
  });
@@ -54757,7 +54787,7 @@ var CacheInternal = class {
54757
54787
  if (linkedIDs.includes(lostID) || !lostID) {
54758
54788
  continue;
54759
54789
  }
54760
- this.subscriptions.remove(lostID, fields, currentSubscribers, variables);
54790
+ this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
54761
54791
  }
54762
54792
  if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
54763
54793
  layer.writeLink(parent, key, linkedIDs);
@@ -54768,7 +54798,7 @@ var CacheInternal = class {
54768
54798
  }
54769
54799
  this.subscriptions.addMany({
54770
54800
  parent: id,
54771
- selection: fields,
54801
+ selection: fieldSelection,
54772
54802
  subscribers: currentSubscribers,
54773
54803
  variables,
54774
54804
  parentType: linkedType
@@ -54793,9 +54823,14 @@ var CacheInternal = class {
54793
54823
  }
54794
54824
  const targets = Array.isArray(value) ? value : [value];
54795
54825
  for (const target of targets) {
54796
- if (operation.action === "insert" && target instanceof Object && fields && operation.list) {
54797
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(fields, target, variables, operation.position || "last");
54798
- } else if (operation.action === "remove" && target instanceof Object && fields && operation.list) {
54826
+ if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
54827
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
54828
+ fieldSelection,
54829
+ target,
54830
+ variables,
54831
+ operation.position || "last"
54832
+ );
54833
+ } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
54799
54834
  this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
54800
54835
  } else if (operation.action === "delete" && operation.type) {
54801
54836
  if (typeof target !== "string") {
@@ -54806,8 +54841,13 @@ var CacheInternal = class {
54806
54841
  continue;
54807
54842
  }
54808
54843
  this.cache.delete(targetID);
54809
- } else if (operation.action === "toggle" && target instanceof Object && fields && operation.list) {
54810
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(fields, target, variables, operation.position || "last");
54844
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
54845
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
54846
+ fieldSelection,
54847
+ target,
54848
+ variables,
54849
+ operation.position || "last"
54850
+ );
54811
54851
  }
54812
54852
  }
54813
54853
  }
@@ -54827,9 +54867,12 @@ var CacheInternal = class {
54827
54867
  let hasData = false;
54828
54868
  let partial = false;
54829
54869
  let cascadeNull = false;
54830
- for (const [attributeName, { type, keyRaw, fields, nullable, list }] of Object.entries(
54831
- selection2
54832
- )) {
54870
+ const typename = this.storage.get(parent, "__typename").value;
54871
+ let targetSelection = getFieldsForType(selection2, typename);
54872
+ for (const [
54873
+ attributeName,
54874
+ { type, keyRaw, selection: fieldSelection, nullable, list }
54875
+ ] of Object.entries(targetSelection)) {
54833
54876
  const key = evaluateKey(keyRaw, variables);
54834
54877
  const { value } = this.storage.get(parent, key);
54835
54878
  let nextStep = stepsFromConnection;
@@ -54852,7 +54895,7 @@ var CacheInternal = class {
54852
54895
  if (typeof value !== "undefined") {
54853
54896
  hasData = true;
54854
54897
  }
54855
- } else if (!fields) {
54898
+ } else if (!fieldSelection) {
54856
54899
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
54857
54900
  if (fnUnmarshal) {
54858
54901
  target[attributeName] = fnUnmarshal(value);
@@ -54862,7 +54905,7 @@ var CacheInternal = class {
54862
54905
  hasData = true;
54863
54906
  } else if (Array.isArray(value)) {
54864
54907
  const listValue = this.hydrateNestedList({
54865
- fields,
54908
+ fields: fieldSelection,
54866
54909
  variables,
54867
54910
  linkedList: value,
54868
54911
  stepsFromConnection: nextStep
@@ -54877,7 +54920,7 @@ var CacheInternal = class {
54877
54920
  } else {
54878
54921
  const objectFields = this.getSelection({
54879
54922
  parent: value,
54880
- selection: fields,
54923
+ selection: fieldSelection,
54881
54924
  variables,
54882
54925
  stepsFromConnection: nextStep
54883
54926
  });
@@ -55705,13 +55748,17 @@ function flattenSelections({
55705
55748
  config: config2,
55706
55749
  filepath,
55707
55750
  selections,
55708
- fragmentDefinitions
55751
+ fragmentDefinitions,
55752
+ applyFragments,
55753
+ ignoreMaskDisable
55709
55754
  }) {
55710
55755
  const fields = new FieldCollection({
55711
55756
  config: config2,
55712
55757
  filepath,
55713
55758
  selections,
55714
- fragmentDefinitions
55759
+ fragmentDefinitions,
55760
+ applyFragments,
55761
+ ignoreMaskDisable: !!ignoreMaskDisable
55715
55762
  });
55716
55763
  return fields.toSelectionSet();
55717
55764
  }
@@ -55722,9 +55769,13 @@ var FieldCollection = class {
55722
55769
  fields;
55723
55770
  inlineFragments;
55724
55771
  fragmentSpreads;
55772
+ applyFragments;
55773
+ ignoreMaskDisable;
55725
55774
  constructor(args) {
55726
55775
  this.config = args.config;
55727
55776
  this.fragmentDefinitions = args.fragmentDefinitions;
55777
+ this.applyFragments = args.applyFragments;
55778
+ this.ignoreMaskDisable = args.ignoreMaskDisable;
55728
55779
  this.fields = {};
55729
55780
  this.inlineFragments = {};
55730
55781
  this.fragmentSpreads = {};
@@ -55753,31 +55804,28 @@ var FieldCollection = class {
55753
55804
  }
55754
55805
  }
55755
55806
  if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
55756
- const key = selection2.typeCondition.name.value;
55757
- if (!this.inlineFragments[key]) {
55758
- this.inlineFragments[key] = {
55759
- astNode: selection2,
55760
- selection: this.empty()
55761
- };
55762
- }
55763
- for (const subselect of selection2.selectionSet?.selections || []) {
55764
- this.inlineFragments[key].selection.add(subselect);
55765
- }
55807
+ this.walkInlineFragment(selection2);
55766
55808
  return;
55767
55809
  }
55768
55810
  if (selection2.kind === "FragmentSpread") {
55769
55811
  this.fragmentSpreads[selection2.name.value] = selection2;
55770
- const houdiniDirective = selection2.directives?.find(
55771
- ({ name: name2 }) => name2.value === this.config.houdiniDirective
55812
+ let includeFragments = this.config.defaultFragmentMasking === "disable";
55813
+ const maskEnableDirective = selection2.directives?.find(
55814
+ ({ name: name2 }) => name2.value === this.config.maskEnableDirective
55772
55815
  );
55773
- const maskArgument = houdiniDirective?.arguments?.find(
55774
- ({ name: name2 }) => name2.value === "mask"
55816
+ if (maskEnableDirective) {
55817
+ includeFragments = false;
55818
+ }
55819
+ const maskDisableDirective = selection2.directives?.find(
55820
+ ({ name: name2 }) => name2.value === this.config.maskDisableDirective
55775
55821
  );
55776
- let includeFragments = this.config.disableMasking;
55777
- if (maskArgument?.value.kind === "BooleanValue") {
55778
- includeFragments = !maskArgument.value.value;
55822
+ if (maskDisableDirective) {
55823
+ includeFragments = true;
55824
+ }
55825
+ if (this.ignoreMaskDisable) {
55826
+ includeFragments = true;
55779
55827
  }
55780
- if (!includeFragments) {
55828
+ if (!includeFragments || !this.applyFragments) {
55781
55829
  return;
55782
55830
  }
55783
55831
  const definition = this.fragmentDefinitions[selection2.name.value];
@@ -55787,9 +55835,20 @@ var FieldCollection = class {
55787
55835
  message: "Could not find referenced fragment definition: " + selection2.name.value
55788
55836
  });
55789
55837
  }
55790
- for (const subselect of definition.selectionSet.selections) {
55791
- this.add(subselect);
55792
- }
55838
+ this.add({
55839
+ kind: "InlineFragment",
55840
+ typeCondition: {
55841
+ kind: "NamedType",
55842
+ name: {
55843
+ kind: "Name",
55844
+ value: definition.typeCondition.name.value
55845
+ }
55846
+ },
55847
+ selectionSet: {
55848
+ kind: "SelectionSet",
55849
+ selections: [...definition.selectionSet.selections]
55850
+ }
55851
+ });
55793
55852
  }
55794
55853
  }
55795
55854
  toSelectionSet() {
@@ -55805,12 +55864,30 @@ var FieldCollection = class {
55805
55864
  })
55806
55865
  ).concat(Object.values(this.fragmentSpreads));
55807
55866
  }
55867
+ walkInlineFragment(selection2) {
55868
+ const key = selection2.typeCondition.name.value;
55869
+ if (!this.inlineFragments[key]) {
55870
+ this.inlineFragments[key] = {
55871
+ astNode: selection2,
55872
+ selection: this.empty()
55873
+ };
55874
+ }
55875
+ for (const subselect of selection2.selectionSet.selections || []) {
55876
+ if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
55877
+ this.inlineFragments[key].selection.add(subselect);
55878
+ continue;
55879
+ }
55880
+ this.walkInlineFragment(subselect);
55881
+ }
55882
+ }
55808
55883
  empty() {
55809
55884
  return new FieldCollection({
55810
55885
  config: this.config,
55811
55886
  fragmentDefinitions: this.fragmentDefinitions,
55812
55887
  selections: [],
55813
- filepath: this.filepath
55888
+ filepath: this.filepath,
55889
+ applyFragments: this.applyFragments,
55890
+ ignoreMaskDisable: this.ignoreMaskDisable
55814
55891
  });
55815
55892
  }
55816
55893
  };
@@ -56165,11 +56242,6 @@ function operationObject({
56165
56242
  const when = internalDirectives.find(({ name: name2 }) => name2.value === "when");
56166
56243
  const when_not = internalDirectives.find(({ name: name2 }) => name2.value === "when_not");
56167
56244
  let parentIDArg = parent?.arguments?.find((argument) => argument.name.value === "value");
56168
- if (!parentIDArg) {
56169
- parentIDArg = (append || prepend)?.arguments?.find(
56170
- ({ name: name2 }) => name2.value === config2.listDirectiveParentIDArg
56171
- );
56172
- }
56173
56245
  if (parentIDArg) {
56174
56246
  if (parentIDArg.value.kind === "StringValue") {
56175
56247
  parentID = parentIDArg.value.value;
@@ -57197,6 +57269,8 @@ function selection({
57197
57269
  markEdges
57198
57270
  }) {
57199
57271
  let object = {};
57272
+ const typeMap = {};
57273
+ const abstractTypes = [];
57200
57274
  for (const field of selections) {
57201
57275
  if (field.kind === "FragmentSpread" && includeFragments) {
57202
57276
  const fragmentDefinition = document.document.definitions.find(
@@ -57223,20 +57297,68 @@ function selection({
57223
57297
  })
57224
57298
  );
57225
57299
  } else if (field.kind === "InlineFragment") {
57226
- object = deepMerge(
57227
- filepath,
57228
- object,
57229
- selection({
57230
- config: config2,
57300
+ if (!field.typeCondition || field.typeCondition.name.value === rootType) {
57301
+ object.fields = deepMerge(
57231
57302
  filepath,
57232
- rootType: field.typeCondition?.name.value || rootType,
57233
- operations,
57234
- selections: field.selectionSet.selections,
57235
- path: path2,
57236
- includeFragments,
57237
- document
57238
- })
57239
- );
57303
+ object.fields || {},
57304
+ selection({
57305
+ config: config2,
57306
+ filepath,
57307
+ rootType: field.typeCondition?.name.value || rootType,
57308
+ operations,
57309
+ selections: field.selectionSet.selections,
57310
+ path: path2,
57311
+ includeFragments,
57312
+ document
57313
+ }).fields || {}
57314
+ );
57315
+ } else {
57316
+ if (!object.abstractFields) {
57317
+ object.abstractFields = {
57318
+ fields: {},
57319
+ typeMap: {}
57320
+ };
57321
+ }
57322
+ const parentType = config2.schema.getType(rootType);
57323
+ const typeConditionName = field.typeCondition.name.value;
57324
+ const typeCondition = config2.schema.getType(typeConditionName);
57325
+ const possibleTypes = [];
57326
+ if (!graphql10.isAbstractType(typeCondition)) {
57327
+ } else if (graphql10.isAbstractType(parentType)) {
57328
+ const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
57329
+ for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
57330
+ if (possibleParentTypes.includes(possible.name)) {
57331
+ possibleTypes.push(possible.name);
57332
+ }
57333
+ }
57334
+ } else {
57335
+ possibleTypes.push(rootType);
57336
+ }
57337
+ if (possibleTypes.length > 0) {
57338
+ for (const type of possibleTypes) {
57339
+ const existing = typeMap[type];
57340
+ if (!existing || !existing.includes(type)) {
57341
+ typeMap[type] = [typeConditionName].concat(existing || []);
57342
+ }
57343
+ if (!abstractTypes.includes(typeConditionName)) {
57344
+ abstractTypes.push(typeConditionName);
57345
+ }
57346
+ }
57347
+ }
57348
+ object.abstractFields.fields = {
57349
+ ...object.abstractFields.fields,
57350
+ [field.typeCondition.name.value]: selection({
57351
+ config: config2,
57352
+ filepath,
57353
+ rootType: field.typeCondition?.name.value || rootType,
57354
+ operations,
57355
+ selections: field.selectionSet.selections,
57356
+ path: path2,
57357
+ includeFragments,
57358
+ document
57359
+ }).fields
57360
+ };
57361
+ }
57240
57362
  } else if (field.kind === "Field") {
57241
57363
  const type = config2.schema.getType(rootType);
57242
57364
  if (!type) {
@@ -57294,7 +57416,7 @@ function selection({
57294
57416
  }
57295
57417
  if (field.selectionSet) {
57296
57418
  const edgesMark = paginated && document.refetch?.method === "cursor" ? document.refetch.update : markEdges;
57297
- fieldObj.fields = selection({
57419
+ fieldObj.selection = selection({
57298
57420
  config: config2,
57299
57421
  filepath,
57300
57422
  rootType: typeName,
@@ -57318,11 +57440,49 @@ function selection({
57318
57440
  if (graphql10.isInterfaceType(fieldType) || graphql10.isUnionType(fieldType)) {
57319
57441
  fieldObj.abstract = true;
57320
57442
  }
57321
- object[attributeName] = deepMerge(
57322
- filepath,
57323
- fieldObj,
57324
- object[attributeName] || {}
57325
- );
57443
+ object.fields = {
57444
+ ...object.fields,
57445
+ [attributeName]: fieldObj
57446
+ };
57447
+ }
57448
+ }
57449
+ if (Object.keys(object.fields || {}).length > 0 && object.abstractFields && Object.keys(object.abstractFields.fields).length > 0) {
57450
+ for (const [typeName, possibles] of Object.entries(typeMap)) {
57451
+ let overlap = false;
57452
+ for (const possible of possibles) {
57453
+ if (object.abstractFields.fields[typeName]) {
57454
+ object.abstractFields.fields[typeName] = deepMerge(
57455
+ filepath,
57456
+ object.abstractFields.fields[typeName] || {},
57457
+ object.abstractFields.fields[possible]
57458
+ );
57459
+ overlap = true;
57460
+ }
57461
+ }
57462
+ if (overlap) {
57463
+ delete typeMap[typeName];
57464
+ }
57465
+ }
57466
+ for (const [type, options] of Object.entries(typeMap)) {
57467
+ if (options.length > 1) {
57468
+ object.abstractFields.fields[type] = deepMerge(
57469
+ filepath,
57470
+ ...options.map((opt) => object.abstractFields.fields[opt] || {})
57471
+ );
57472
+ delete typeMap[type];
57473
+ }
57474
+ }
57475
+ for (const [type, sel] of Object.entries(object.abstractFields?.fields || {})) {
57476
+ object.abstractFields.fields[type] = deepMerge(filepath, sel || {}, object.fields);
57477
+ }
57478
+ for (const [type, options] of Object.entries(typeMap)) {
57479
+ object.abstractFields.typeMap[type] = options[0];
57480
+ }
57481
+ const usedTypes = Object.values(object.abstractFields.typeMap);
57482
+ for (const type of abstractTypes) {
57483
+ if (!usedTypes.includes(type)) {
57484
+ delete object.abstractFields.fields[type];
57485
+ }
57326
57486
  }
57327
57487
  }
57328
57488
  return object;
@@ -57457,6 +57617,22 @@ function artifactGenerator(stats) {
57457
57617
  selectionSet = matchingFragment.selectionSet;
57458
57618
  }
57459
57619
  const inputs = operations[0]?.variableDefinitions;
57620
+ const mergedSelection = flattenSelections({
57621
+ config: config2,
57622
+ filepath: doc.filename,
57623
+ selections: selectionSet.selections,
57624
+ fragmentDefinitions: doc.document.definitions.filter(
57625
+ (definition) => definition.kind === "FragmentDefinition"
57626
+ ).reduce(
57627
+ (prev, definition) => ({
57628
+ ...prev,
57629
+ [definition.name.value]: definition
57630
+ }),
57631
+ {}
57632
+ ),
57633
+ ignoreMaskDisable: docKind === "HoudiniQuery",
57634
+ applyFragments: docKind !== "HoudiniFragment"
57635
+ });
57460
57636
  const artifact = {
57461
57637
  name: name2,
57462
57638
  kind: docKind,
@@ -57468,7 +57644,7 @@ function artifactGenerator(stats) {
57468
57644
  config: config2,
57469
57645
  filepath: doc.filename,
57470
57646
  rootType,
57471
- selections: selectionSet.selections,
57647
+ selections: mergedSelection,
57472
57648
  operations: operationsByPath(
57473
57649
  config2,
57474
57650
  doc.filename,
@@ -57764,6 +57940,17 @@ function inlineType({
57764
57940
  continue;
57765
57941
  }
57766
57942
  const possibleParents = config2.schema.getPossibleTypes(type).map((t) => t.name);
57943
+ const freeSelections = [];
57944
+ const typeSpecificSelections = {};
57945
+ for (const node of selection2.selectionSet.selections) {
57946
+ if (node.kind !== "InlineFragment") {
57947
+ freeSelections.push(node);
57948
+ } else if (node.typeCondition) {
57949
+ typeSpecificSelections[node.typeCondition.name.value] = node.selectionSet.selections;
57950
+ } else {
57951
+ freeSelections.push(...node.selectionSet.selections);
57952
+ }
57953
+ }
57767
57954
  for (const possibleType of config2.schema.getPossibleTypes(fragmentType)) {
57768
57955
  if (!possibleParents.includes(possibleType.name)) {
57769
57956
  continue;
@@ -57771,7 +57958,12 @@ function inlineType({
57771
57958
  if (!inlineFragments[possibleType.name]) {
57772
57959
  inlineFragments[possibleType.name] = [];
57773
57960
  }
57774
- inlineFragments[possibleType.name].push(...selection2.selectionSet.selections);
57961
+ inlineFragments[possibleType.name].push(...freeSelections);
57962
+ if (typeSpecificSelections[possibleType.name]) {
57963
+ inlineFragments[possibleType.name].push(
57964
+ ...typeSpecificSelections[possibleType.name]
57965
+ );
57966
+ }
57775
57967
  }
57776
57968
  } else if (selection2.kind === "InlineFragment" && !selection2.typeCondition) {
57777
57969
  selectedFields.push(...selection2.selectionSet.selections);
@@ -57783,12 +57975,7 @@ function inlineType({
57783
57975
  ...(selectedFields || []).filter(
57784
57976
  (field) => field.kind === "Field"
57785
57977
  ).map((selection2) => {
57786
- const { type: type2, field } = selectionTypeInfo(
57787
- config2.schema,
57788
- filepath,
57789
- rootObj,
57790
- selection2
57791
- );
57978
+ const { field } = selectionTypeInfo(config2.schema, filepath, rootObj, selection2);
57792
57979
  const attributeName = selection2.alias?.value || selection2.name.value;
57793
57980
  let attributeType = inlineType({
57794
57981
  config: config2,
@@ -57987,7 +58174,8 @@ async function typescriptGenerator(config2, docs) {
57987
58174
  config: config2,
57988
58175
  filepath: filename,
57989
58176
  selections: definition.selectionSet.selections,
57990
- fragmentDefinitions
58177
+ fragmentDefinitions,
58178
+ applyFragments: definition.kind === "OperationDefinition"
57991
58179
  });
57992
58180
  if (definition?.kind === "OperationDefinition") {
57993
58181
  await generateOperationTypeDefs(
@@ -58500,14 +58688,12 @@ directive @${config2.paginateDirective}(${config2.paginateNameArg}: String) on F
58500
58688
  """
58501
58689
  @${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
58502
58690
  """
58503
- directive @${config2.listPrependDirective}(
58504
- ${config2.listDirectiveParentIDArg}: ID
58505
- ) on FRAGMENT_SPREAD
58691
+ directive @${config2.listPrependDirective} on FRAGMENT_SPREAD
58506
58692
 
58507
58693
  """
58508
58694
  @${config2.listAppendDirective} is used to tell the runtime to add the result to the start of the list
58509
58695
  """
58510
- directive @${config2.listAppendDirective}(${config2.listDirectiveParentIDArg}: ID) on FRAGMENT_SPREAD
58696
+ directive @${config2.listAppendDirective} on FRAGMENT_SPREAD
58511
58697
 
58512
58698
  """
58513
58699
  @${config2.listAllListsDirective} is used to tell the runtime to add the result to all list
@@ -58541,18 +58727,19 @@ directive @${config2.argumentsDirective} on FRAGMENT_DEFINITION
58541
58727
  directive @${config2.cacheDirective}(${config2.cachePolicyArg}: CachePolicy, ${config2.cachePartialArg}: Boolean) on QUERY
58542
58728
 
58543
58729
  """
58544
- @${config2.houdiniDirective} is used to configure houdini's internal behavior
58730
+ @${config2.manualLoadDirective} is used to disable automatic fetch (no load, no auto fetch in component), you will have to do it manually.
58731
+ """
58732
+ directive @${config2.manualLoadDirective} on QUERY
58733
+
58734
+ """
58735
+ @${config2.maskEnableDirective} to enable masking on fragment (overwriting the global conf)
58736
+ """
58737
+ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
58738
+
58545
58739
  """
58546
- directive @${config2.houdiniDirective}(
58547
- """
58548
- Opt-in to an automatic load function (only valid when used at queries)
58549
- """
58550
- load: Boolean! = true
58551
- """
58552
- Mask fragment fields (only valid when used at a fragment spread)
58553
- """
58554
- mask: Boolean! = ${config2.disableMasking ? "false" : "true"}
58555
- ) on QUERY | FRAGMENT_SPREAD
58740
+ @${config2.maskDisableDirective} to disable masking on fragment (overwriting the global conf)
58741
+ """
58742
+ directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
58556
58743
  `;
58557
58744
  let currentSchema = graphql19.printSchema(config2.schema);
58558
58745
  if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
@@ -59045,26 +59232,42 @@ async function typeCheck(config2, docs) {
59045
59232
  ),
59046
59233
  targetField.selectionSet
59047
59234
  );
59048
- const missingIDFields = config2.keyFieldsForType(type.name).filter((fieldName) => !type.getFields()[fieldName]);
59049
- if (missingIDFields.length > 0) {
59050
- if (error) {
59051
- errors.push(
59052
- new HoudiniError({
59053
- filepath: filename,
59054
- message: error
59055
- })
59056
- );
59057
- } else {
59058
- errors.push(
59059
- new HoudiniError({
59060
- filepath: filename,
59061
- message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
59062
- ", "
59063
- )}.`
59064
- })
59065
- );
59235
+ let targetTypes = [type];
59236
+ if (graphql23.isUnionType(type)) {
59237
+ targetTypes = config2.schema.getPossibleTypes(type);
59238
+ } else if (graphql23.isInterfaceType(type)) {
59239
+ try {
59240
+ for (const key of config2.keyFieldsForType(type.name)) {
59241
+ if (!type.getFields()[key]) {
59242
+ throw new Error("continue");
59243
+ }
59244
+ }
59245
+ } catch {
59246
+ targetTypes = config2.schema.getPossibleTypes(type);
59247
+ }
59248
+ }
59249
+ for (const targetType of targetTypes) {
59250
+ const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
59251
+ if (missingIDFields.length > 0) {
59252
+ if (error) {
59253
+ errors.push(
59254
+ new HoudiniError({
59255
+ filepath: filename,
59256
+ message: error
59257
+ })
59258
+ );
59259
+ } else {
59260
+ errors.push(
59261
+ new HoudiniError({
59262
+ filepath: filename,
59263
+ message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
59264
+ ", "
59265
+ )}.`
59266
+ })
59267
+ );
59268
+ }
59269
+ return;
59066
59270
  }
59067
- return;
59068
59271
  }
59069
59272
  lists.push(listName);
59070
59273
  listTypes.push(type.name);
@@ -59094,6 +59297,7 @@ async function typeCheck(config2, docs) {
59094
59297
  fragments
59095
59298
  }),
59096
59299
  checkMutationOperation(config2),
59300
+ checkMaskDirective(config2),
59097
59301
  nodeDirectives(config2, [config2.paginateDirective]),
59098
59302
  knownArguments(config2),
59099
59303
  validateFragmentArguments(config2, filepath, fragments),
@@ -59158,10 +59362,14 @@ var validateLists = ({
59158
59362
  ]);
59159
59363
  if (directive) {
59160
59364
  let parentArg = directive.arguments?.find(
59161
- (arg) => arg.name.value === config2.listDirectiveParentIDArg
59365
+ (arg) => arg.name.value === config2.deprecatedlistDirectiveParentIDArg
59162
59366
  );
59163
59367
  if (parentArg) {
59164
- parentIdFound = true;
59368
+ ctx.reportError(
59369
+ new graphql23.GraphQLError(
59370
+ `@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
59371
+ )
59372
+ );
59165
59373
  }
59166
59374
  }
59167
59375
  if (parentIdFound) {
@@ -59557,6 +59765,28 @@ function checkMutationOperation(config2) {
59557
59765
  };
59558
59766
  };
59559
59767
  }
59768
+ function checkMaskDirective(config2) {
59769
+ return function(ctx) {
59770
+ return {
59771
+ FragmentSpread(node, _, __, ___, ancestors) {
59772
+ const maskEnableDirective = node.directives?.find(
59773
+ (c) => c.name.value === config2.maskEnableDirective
59774
+ );
59775
+ const maskDisableDirective = node.directives?.find(
59776
+ (c) => c.name.value === config2.maskDisableDirective
59777
+ );
59778
+ if (maskEnableDirective && maskDisableDirective) {
59779
+ ctx.reportError(
59780
+ new graphql23.GraphQLError(
59781
+ `You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
59782
+ )
59783
+ );
59784
+ return;
59785
+ }
59786
+ }
59787
+ };
59788
+ };
59789
+ }
59560
59790
  function getAndVerifyNodeInterface(config2) {
59561
59791
  const { schema } = config2;
59562
59792
  const nodeInterface = schema.getType("Node");
@@ -59854,12 +60084,7 @@ async function collectDocuments(config2) {
59854
60084
  }
59855
60085
  async function processJSFile(config2, contents) {
59856
60086
  const documents = [];
59857
- try {
59858
- var program = (await parseJS(contents)).script;
59859
- } catch (e) {
59860
- console.log(contents);
59861
- throw e;
59862
- }
60087
+ var program = (await parseJS(contents)).script;
59863
60088
  await find_graphql(config2, program, {
59864
60089
  tag({ tagContent }) {
59865
60090
  documents.push(tagContent);