houdini 0.17.14 → 0.18.1

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 +442 -203
  2. package/build/cmd-esm/index.js +442 -203
  3. package/build/codegen/utils/flattenSelections.d.ts +3 -1
  4. package/build/codegen-cjs/index.js +409 -182
  5. package/build/codegen-esm/index.js +409 -182
  6. package/build/lib/config.d.ts +8 -3
  7. package/build/lib-cjs/index.js +145 -83
  8. package/build/lib-esm/index.js +145 -83
  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 +42 -25
  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 +42 -25
  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 +489 -197
  36. package/build/test-esm/index.js +489 -197
  37. package/build/vite-cjs/index.js +442 -195
  38. package/build/vite-esm/index.js +442 -195
  39. package/package.json +3 -3
  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
@@ -3345,7 +3345,7 @@ var require_definition = __commonJS({
3345
3345
  exports.assertObjectType = assertObjectType;
3346
3346
  exports.isInterfaceType = isInterfaceType6;
3347
3347
  exports.assertInterfaceType = assertInterfaceType;
3348
- exports.isUnionType = isUnionType6;
3348
+ exports.isUnionType = isUnionType7;
3349
3349
  exports.assertUnionType = assertUnionType;
3350
3350
  exports.isEnumType = isEnumType4;
3351
3351
  exports.assertEnumType = assertEnumType;
@@ -3363,7 +3363,7 @@ var require_definition = __commonJS({
3363
3363
  exports.assertLeafType = assertLeafType;
3364
3364
  exports.isCompositeType = isCompositeType;
3365
3365
  exports.assertCompositeType = assertCompositeType;
3366
- exports.isAbstractType = isAbstractType;
3366
+ exports.isAbstractType = isAbstractType2;
3367
3367
  exports.assertAbstractType = assertAbstractType;
3368
3368
  exports.GraphQLList = GraphQLList2;
3369
3369
  exports.GraphQLNonNull = GraphQLNonNull2;
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
3418
3418
  return Constructor;
3419
3419
  }
3420
3420
  function isType(type) {
3421
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isInputObjectType(type) || isListType3(type) || isNonNullType6(type);
3421
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type) || isListType3(type) || isNonNullType6(type);
3422
3422
  }
3423
3423
  function assertType(type) {
3424
3424
  if (!isType(type)) {
@@ -3453,11 +3453,11 @@ var require_definition = __commonJS({
3453
3453
  }
3454
3454
  return type;
3455
3455
  }
3456
- function isUnionType6(type) {
3456
+ function isUnionType7(type) {
3457
3457
  return (0, _instanceOf.default)(type, GraphQLUnionType);
3458
3458
  }
3459
3459
  function assertUnionType(type) {
3460
- if (!isUnionType6(type)) {
3460
+ if (!isUnionType7(type)) {
3461
3461
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Union type."));
3462
3462
  }
3463
3463
  return type;
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
3508
3508
  return type;
3509
3509
  }
3510
3510
  function isOutputType(type) {
3511
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isWrappingType(type) && isOutputType(type.ofType);
3511
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isWrappingType(type) && isOutputType(type.ofType);
3512
3512
  }
3513
3513
  function assertOutputType(type) {
3514
3514
  if (!isOutputType(type)) {
@@ -3526,7 +3526,7 @@ var require_definition = __commonJS({
3526
3526
  return type;
3527
3527
  }
3528
3528
  function isCompositeType(type) {
3529
- return isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type);
3529
+ return isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type);
3530
3530
  }
3531
3531
  function assertCompositeType(type) {
3532
3532
  if (!isCompositeType(type)) {
@@ -3534,11 +3534,11 @@ var require_definition = __commonJS({
3534
3534
  }
3535
3535
  return type;
3536
3536
  }
3537
- function isAbstractType(type) {
3538
- return isInterfaceType6(type) || isUnionType6(type);
3537
+ function isAbstractType2(type) {
3538
+ return isInterfaceType6(type) || isUnionType7(type);
3539
3539
  }
3540
3540
  function assertAbstractType(type) {
3541
- if (!isAbstractType(type)) {
3541
+ if (!isAbstractType2(type)) {
3542
3542
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL abstract type."));
3543
3543
  }
3544
3544
  return type;
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
3605
3605
  }
3606
3606
  }
3607
3607
  function isNamedType(type) {
3608
- return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType6(type) || isEnumType4(type) || isInputObjectType(type);
3608
+ return isScalarType6(type) || isObjectType2(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType4(type) || isInputObjectType(type);
3609
3609
  }
3610
3610
  function assertNamedType(type) {
3611
3611
  if (!isNamedType(type)) {
@@ -53462,6 +53462,20 @@ function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
53462
53462
  return true;
53463
53463
  }
53464
53464
 
53465
+ // src/runtime/lib/selection.ts
53466
+ function getFieldsForType(selection2, __typename) {
53467
+ let targetSelection = selection2.fields || {};
53468
+ if (selection2.abstractFields && __typename) {
53469
+ const mappedType = selection2.abstractFields.typeMap[__typename];
53470
+ if (mappedType) {
53471
+ targetSelection = selection2.abstractFields.fields[mappedType];
53472
+ } else if (selection2.abstractFields.fields[__typename]) {
53473
+ targetSelection = selection2.abstractFields.fields[__typename];
53474
+ }
53475
+ }
53476
+ return targetSelection;
53477
+ }
53478
+
53465
53479
  // src/runtime/cache/gc.ts
53466
53480
  var GarbageCollector = class {
53467
53481
  cache;
@@ -53684,23 +53698,32 @@ var List = class {
53684
53698
  let insertData = data;
53685
53699
  if (this.connection) {
53686
53700
  insertSelection = {
53687
- newEntry: {
53688
- keyRaw: this.key,
53689
- type: "Connection",
53690
- fields: {
53691
- edges: {
53692
- keyRaw: "edges",
53693
- type: "ConnectionEdge",
53694
- update: where === "first" ? "prepend" : "append",
53701
+ fields: {
53702
+ newEntry: {
53703
+ keyRaw: this.key,
53704
+ type: "Connection",
53705
+ selection: {
53695
53706
  fields: {
53696
- node: {
53697
- type: listType,
53698
- keyRaw: "node",
53699
- fields: {
53700
- ...selection2,
53701
- __typename: {
53702
- keyRaw: "__typename",
53703
- type: "String"
53707
+ edges: {
53708
+ keyRaw: "edges",
53709
+ type: "ConnectionEdge",
53710
+ update: where === "first" ? "prepend" : "append",
53711
+ selection: {
53712
+ fields: {
53713
+ node: {
53714
+ type: listType,
53715
+ keyRaw: "node",
53716
+ selection: {
53717
+ ...selection2,
53718
+ fields: {
53719
+ ...selection2.fields,
53720
+ __typename: {
53721
+ keyRaw: "__typename",
53722
+ type: "String"
53723
+ }
53724
+ }
53725
+ }
53726
+ }
53704
53727
  }
53705
53728
  }
53706
53729
  }
@@ -53716,15 +53739,20 @@ var List = class {
53716
53739
  };
53717
53740
  } else {
53718
53741
  insertSelection = {
53719
- newEntries: {
53720
- keyRaw: this.key,
53721
- type: listType,
53722
- update: where === "first" ? "prepend" : "append",
53723
- fields: {
53724
- ...selection2,
53725
- __typename: {
53726
- keyRaw: "__typename",
53727
- type: "String"
53742
+ fields: {
53743
+ newEntries: {
53744
+ keyRaw: this.key,
53745
+ type: listType,
53746
+ update: where === "first" ? "prepend" : "append",
53747
+ selection: {
53748
+ ...selection2,
53749
+ fields: {
53750
+ ...selection2.fields,
53751
+ __typename: {
53752
+ keyRaw: "__typename",
53753
+ type: "String"
53754
+ }
53755
+ }
53728
53756
  }
53729
53757
  }
53730
53758
  }
@@ -53784,7 +53812,7 @@ var List = class {
53784
53812
  const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
53785
53813
  this.cache._internal_unstable.subscriptions.remove(
53786
53814
  targetID,
53787
- this.connection ? this.selection.edges.fields : this.selection,
53815
+ this.connection ? this.selection.fields.edges.selection : this.selection,
53788
53816
  subscribers,
53789
53817
  variables
53790
53818
  );
@@ -54273,18 +54301,20 @@ var InMemorySubscriptions = class {
54273
54301
  variables,
54274
54302
  parentType
54275
54303
  }) {
54276
- for (const fieldSelection of Object.values(selection2)) {
54277
- const { keyRaw, fields, type } = fieldSelection;
54304
+ const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
54305
+ let targetSelection = getFieldsForType(selection2, __typename);
54306
+ for (const fieldSelection of Object.values(targetSelection || {})) {
54307
+ const { keyRaw, selection: innerSelection, type } = fieldSelection;
54278
54308
  const key = evaluateKey(keyRaw, variables);
54279
54309
  this.addFieldSubscription({
54280
54310
  id: parent,
54281
54311
  key,
54282
- selection: fieldSelection,
54312
+ field: fieldSelection,
54283
54313
  spec,
54284
54314
  parentType: parentType || spec.rootType,
54285
54315
  variables
54286
54316
  });
54287
- if (fields) {
54317
+ if (innerSelection) {
54288
54318
  const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
54289
54319
  parent,
54290
54320
  key
@@ -54297,7 +54327,7 @@ var InMemorySubscriptions = class {
54297
54327
  this.add({
54298
54328
  parent: child,
54299
54329
  spec,
54300
- selection: fields,
54330
+ selection: innerSelection,
54301
54331
  variables,
54302
54332
  parentType: type
54303
54333
  });
@@ -54308,7 +54338,7 @@ var InMemorySubscriptions = class {
54308
54338
  addFieldSubscription({
54309
54339
  id,
54310
54340
  key,
54311
- selection: selection2,
54341
+ field,
54312
54342
  spec,
54313
54343
  parentType,
54314
54344
  variables
@@ -54335,8 +54365,8 @@ var InMemorySubscriptions = class {
54335
54365
  const counts = this.referenceCounts[id][key];
54336
54366
  counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
54337
54367
  this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
54338
- const { fields, list, filters } = selection2;
54339
- if (fields && list) {
54368
+ const { selection: selection2, list, filters } = field;
54369
+ if (selection2 && list) {
54340
54370
  this.cache._internal_unstable.lists.add({
54341
54371
  name: list.name,
54342
54372
  connection: list.connection,
@@ -54344,7 +54374,7 @@ var InMemorySubscriptions = class {
54344
54374
  recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
54345
54375
  listType: list.type,
54346
54376
  key,
54347
- selection: fields,
54377
+ selection: selection2,
54348
54378
  filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
54349
54379
  return {
54350
54380
  ...acc,
@@ -54361,20 +54391,21 @@ var InMemorySubscriptions = class {
54361
54391
  subscribers,
54362
54392
  parentType
54363
54393
  }) {
54364
- for (const fieldSelection of Object.values(selection2)) {
54365
- const { type: linkedType, keyRaw, fields } = fieldSelection;
54394
+ let targetSelection = getFieldsForType(selection2, parentType);
54395
+ for (const fieldSelection of Object.values(targetSelection)) {
54396
+ const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
54366
54397
  const key = evaluateKey(keyRaw, variables);
54367
54398
  for (const spec of subscribers) {
54368
54399
  this.addFieldSubscription({
54369
54400
  id: parent,
54370
54401
  key,
54371
- selection: fieldSelection,
54402
+ field: fieldSelection,
54372
54403
  spec,
54373
54404
  parentType,
54374
54405
  variables
54375
54406
  });
54376
54407
  }
54377
- if (fields) {
54408
+ if (innerSelection) {
54378
54409
  const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
54379
54410
  const children = !Array.isArray(link) ? [link] : flattenList(link);
54380
54411
  for (const linkedRecord of children) {
@@ -54383,7 +54414,7 @@ var InMemorySubscriptions = class {
54383
54414
  }
54384
54415
  this.addMany({
54385
54416
  parent: linkedRecord,
54386
- selection: fields,
54417
+ selection: innerSelection,
54387
54418
  variables,
54388
54419
  subscribers,
54389
54420
  parentType: linkedType
@@ -54395,22 +54426,20 @@ var InMemorySubscriptions = class {
54395
54426
  get(id, field) {
54396
54427
  return this.subscribers[id]?.[field] || [];
54397
54428
  }
54398
- remove(id, fields, targets, variables, visited = []) {
54429
+ remove(id, selection2, targets, variables, visited = []) {
54399
54430
  visited.push(id);
54400
54431
  const linkedIDs = [];
54401
- for (const selection2 of Object.values(fields)) {
54402
- const key = evaluateKey(selection2.keyRaw, variables);
54432
+ for (const fieldSelection of Object.values(selection2.fields || {})) {
54433
+ const key = evaluateKey(fieldSelection.keyRaw, variables);
54403
54434
  this.removeSubscribers(id, key, targets);
54404
- if (!selection2.fields) {
54435
+ if (!fieldSelection.selection?.fields) {
54405
54436
  continue;
54406
54437
  }
54407
- if (selection2.list) {
54408
- }
54409
54438
  const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
54410
54439
  const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
54411
54440
  for (const link of links) {
54412
54441
  if (link !== null) {
54413
- linkedIDs.push([link, selection2.fields]);
54442
+ linkedIDs.push([link, fieldSelection.selection || {}]);
54414
54443
  }
54415
54444
  }
54416
54445
  }
@@ -54565,10 +54594,12 @@ var CacheInternal = class {
54565
54594
  this.lists = lists;
54566
54595
  this.cache = cache;
54567
54596
  this.lifetimes = lifetimes;
54597
+ this._disabled = typeof globalThis.window === "undefined";
54568
54598
  try {
54569
- this._disabled = process.env.HOUDINI_TEST !== "true";
54599
+ if (process.env.HOUDINI_TEST === "true") {
54600
+ this._disabled = false;
54601
+ }
54570
54602
  } catch {
54571
- this._disabled = typeof globalThis.window === "undefined";
54572
54603
  }
54573
54604
  }
54574
54605
  setConfig(config2) {
@@ -54588,8 +54619,9 @@ var CacheInternal = class {
54588
54619
  if (this._disabled) {
54589
54620
  return [];
54590
54621
  }
54622
+ let targetSelection = getFieldsForType(selection2, data["__typename"]);
54591
54623
  for (const [field, value] of Object.entries(data)) {
54592
- if (!selection2 || !selection2[field]) {
54624
+ if (!selection2 || !targetSelection[field]) {
54593
54625
  throw new Error(
54594
54626
  "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
54595
54627
  );
@@ -54597,11 +54629,11 @@ var CacheInternal = class {
54597
54629
  let {
54598
54630
  type: linkedType,
54599
54631
  keyRaw,
54600
- fields,
54632
+ selection: fieldSelection,
54601
54633
  operations,
54602
54634
  abstract: isAbstract,
54603
54635
  update
54604
- } = selection2[field];
54636
+ } = targetSelection[field];
54605
54637
  const key = evaluateKey(keyRaw, variables);
54606
54638
  const currentSubscribers = this.subscriptions.get(parent, key);
54607
54639
  const { value: previousValue, displayLayers } = this.storage.get(parent, key);
@@ -54609,7 +54641,7 @@ var CacheInternal = class {
54609
54641
  if (displayLayer) {
54610
54642
  this.lifetimes.resetLifetime(parent, key);
54611
54643
  }
54612
- if (!fields) {
54644
+ if (!fieldSelection) {
54613
54645
  let newValue = value;
54614
54646
  if (Array.isArray(value) && applyUpdates && update) {
54615
54647
  if (update === "append") {
@@ -54629,7 +54661,7 @@ var CacheInternal = class {
54629
54661
  }
54630
54662
  const previousLinks = flattenList([previousValue]);
54631
54663
  for (const link of previousLinks) {
54632
- this.subscriptions.remove(link, fields, currentSubscribers, variables);
54664
+ this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
54633
54665
  }
54634
54666
  layer.writeLink(parent, key, null);
54635
54667
  toNotify.push(...currentSubscribers);
@@ -54655,14 +54687,14 @@ var CacheInternal = class {
54655
54687
  if (previousValue && typeof previousValue === "string") {
54656
54688
  this.subscriptions.remove(
54657
54689
  previousValue,
54658
- fields,
54690
+ fieldSelection,
54659
54691
  currentSubscribers,
54660
54692
  variables
54661
54693
  );
54662
54694
  }
54663
54695
  this.subscriptions.addMany({
54664
54696
  parent: linkedID,
54665
- selection: fields,
54697
+ selection: fieldSelection,
54666
54698
  subscribers: currentSubscribers,
54667
54699
  variables,
54668
54700
  parentType: linkedType
@@ -54672,14 +54704,14 @@ var CacheInternal = class {
54672
54704
  if (linkedID) {
54673
54705
  this.writeSelection({
54674
54706
  root,
54675
- selection: fields,
54707
+ selection: fieldSelection,
54676
54708
  parent: linkedID,
54677
54709
  data: value,
54678
54710
  variables,
54679
54711
  toNotify,
54680
54712
  applyUpdates,
54681
54713
  layer,
54682
- forceNotify: true
54714
+ forceNotify
54683
54715
  });
54684
54716
  }
54685
54717
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
@@ -54708,7 +54740,7 @@ var CacheInternal = class {
54708
54740
  key,
54709
54741
  linkedType,
54710
54742
  variables,
54711
- fields,
54743
+ fields: fieldSelection,
54712
54744
  layer,
54713
54745
  forceNotify
54714
54746
  });
@@ -54758,7 +54790,7 @@ var CacheInternal = class {
54758
54790
  if (linkedIDs.includes(lostID) || !lostID) {
54759
54791
  continue;
54760
54792
  }
54761
- this.subscriptions.remove(lostID, fields, currentSubscribers, variables);
54793
+ this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
54762
54794
  }
54763
54795
  if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
54764
54796
  layer.writeLink(parent, key, linkedIDs);
@@ -54769,7 +54801,7 @@ var CacheInternal = class {
54769
54801
  }
54770
54802
  this.subscriptions.addMany({
54771
54803
  parent: id,
54772
- selection: fields,
54804
+ selection: fieldSelection,
54773
54805
  subscribers: currentSubscribers,
54774
54806
  variables,
54775
54807
  parentType: linkedType
@@ -54794,9 +54826,14 @@ var CacheInternal = class {
54794
54826
  }
54795
54827
  const targets = Array.isArray(value) ? value : [value];
54796
54828
  for (const target of targets) {
54797
- if (operation.action === "insert" && target instanceof Object && fields && operation.list) {
54798
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(fields, target, variables, operation.position || "last");
54799
- } else if (operation.action === "remove" && target instanceof Object && fields && operation.list) {
54829
+ if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
54830
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
54831
+ fieldSelection,
54832
+ target,
54833
+ variables,
54834
+ operation.position || "last"
54835
+ );
54836
+ } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
54800
54837
  this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
54801
54838
  } else if (operation.action === "delete" && operation.type) {
54802
54839
  if (typeof target !== "string") {
@@ -54807,8 +54844,13 @@ var CacheInternal = class {
54807
54844
  continue;
54808
54845
  }
54809
54846
  this.cache.delete(targetID);
54810
- } else if (operation.action === "toggle" && target instanceof Object && fields && operation.list) {
54811
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(fields, target, variables, operation.position || "last");
54847
+ } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
54848
+ this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
54849
+ fieldSelection,
54850
+ target,
54851
+ variables,
54852
+ operation.position || "last"
54853
+ );
54812
54854
  }
54813
54855
  }
54814
54856
  }
@@ -54828,9 +54870,12 @@ var CacheInternal = class {
54828
54870
  let hasData = false;
54829
54871
  let partial = false;
54830
54872
  let cascadeNull = false;
54831
- for (const [attributeName, { type, keyRaw, fields, nullable, list }] of Object.entries(
54832
- selection2
54833
- )) {
54873
+ const typename = this.storage.get(parent, "__typename").value;
54874
+ let targetSelection = getFieldsForType(selection2, typename);
54875
+ for (const [
54876
+ attributeName,
54877
+ { type, keyRaw, selection: fieldSelection, nullable, list }
54878
+ ] of Object.entries(targetSelection)) {
54834
54879
  const key = evaluateKey(keyRaw, variables);
54835
54880
  const { value } = this.storage.get(parent, key);
54836
54881
  let nextStep = stepsFromConnection;
@@ -54853,7 +54898,7 @@ var CacheInternal = class {
54853
54898
  if (typeof value !== "undefined") {
54854
54899
  hasData = true;
54855
54900
  }
54856
- } else if (!fields) {
54901
+ } else if (!fieldSelection) {
54857
54902
  const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
54858
54903
  if (fnUnmarshal) {
54859
54904
  target[attributeName] = fnUnmarshal(value);
@@ -54863,7 +54908,7 @@ var CacheInternal = class {
54863
54908
  hasData = true;
54864
54909
  } else if (Array.isArray(value)) {
54865
54910
  const listValue = this.hydrateNestedList({
54866
- fields,
54911
+ fields: fieldSelection,
54867
54912
  variables,
54868
54913
  linkedList: value,
54869
54914
  stepsFromConnection: nextStep
@@ -54878,7 +54923,7 @@ var CacheInternal = class {
54878
54923
  } else {
54879
54924
  const objectFields = this.getSelection({
54880
54925
  parent: value,
54881
- selection: fields,
54926
+ selection: fieldSelection,
54882
54927
  variables,
54883
54928
  stepsFromConnection: nextStep
54884
54929
  });
@@ -55707,13 +55752,17 @@ function flattenSelections({
55707
55752
  config: config2,
55708
55753
  filepath,
55709
55754
  selections,
55710
- fragmentDefinitions
55755
+ fragmentDefinitions,
55756
+ applyFragments,
55757
+ ignoreMaskDisable
55711
55758
  }) {
55712
55759
  const fields = new FieldCollection({
55713
55760
  config: config2,
55714
55761
  filepath,
55715
55762
  selections,
55716
- fragmentDefinitions
55763
+ fragmentDefinitions,
55764
+ applyFragments,
55765
+ ignoreMaskDisable: !!ignoreMaskDisable
55717
55766
  });
55718
55767
  return fields.toSelectionSet();
55719
55768
  }
@@ -55724,9 +55773,13 @@ var FieldCollection = class {
55724
55773
  fields;
55725
55774
  inlineFragments;
55726
55775
  fragmentSpreads;
55776
+ applyFragments;
55777
+ ignoreMaskDisable;
55727
55778
  constructor(args) {
55728
55779
  this.config = args.config;
55729
55780
  this.fragmentDefinitions = args.fragmentDefinitions;
55781
+ this.applyFragments = args.applyFragments;
55782
+ this.ignoreMaskDisable = args.ignoreMaskDisable;
55730
55783
  this.fields = {};
55731
55784
  this.inlineFragments = {};
55732
55785
  this.fragmentSpreads = {};
@@ -55755,31 +55808,28 @@ var FieldCollection = class {
55755
55808
  }
55756
55809
  }
55757
55810
  if (selection2.kind === "InlineFragment" && selection2.typeCondition) {
55758
- const key = selection2.typeCondition.name.value;
55759
- if (!this.inlineFragments[key]) {
55760
- this.inlineFragments[key] = {
55761
- astNode: selection2,
55762
- selection: this.empty()
55763
- };
55764
- }
55765
- for (const subselect of selection2.selectionSet?.selections || []) {
55766
- this.inlineFragments[key].selection.add(subselect);
55767
- }
55811
+ this.walkInlineFragment(selection2);
55768
55812
  return;
55769
55813
  }
55770
55814
  if (selection2.kind === "FragmentSpread") {
55771
55815
  this.fragmentSpreads[selection2.name.value] = selection2;
55772
- const houdiniDirective = selection2.directives?.find(
55773
- ({ name: name2 }) => name2.value === this.config.houdiniDirective
55816
+ let includeFragments = this.config.defaultFragmentMasking === "disable";
55817
+ const maskEnableDirective = selection2.directives?.find(
55818
+ ({ name: name2 }) => name2.value === this.config.maskEnableDirective
55774
55819
  );
55775
- const maskArgument = houdiniDirective?.arguments?.find(
55776
- ({ name: name2 }) => name2.value === "mask"
55820
+ if (maskEnableDirective) {
55821
+ includeFragments = false;
55822
+ }
55823
+ const maskDisableDirective = selection2.directives?.find(
55824
+ ({ name: name2 }) => name2.value === this.config.maskDisableDirective
55777
55825
  );
55778
- let includeFragments = this.config.disableMasking;
55779
- if (maskArgument?.value.kind === "BooleanValue") {
55780
- includeFragments = !maskArgument.value.value;
55826
+ if (maskDisableDirective) {
55827
+ includeFragments = true;
55781
55828
  }
55782
- if (!includeFragments) {
55829
+ if (this.ignoreMaskDisable) {
55830
+ includeFragments = true;
55831
+ }
55832
+ if (!includeFragments || !this.applyFragments) {
55783
55833
  return;
55784
55834
  }
55785
55835
  const definition = this.fragmentDefinitions[selection2.name.value];
@@ -55789,9 +55839,20 @@ var FieldCollection = class {
55789
55839
  message: "Could not find referenced fragment definition: " + selection2.name.value
55790
55840
  });
55791
55841
  }
55792
- for (const subselect of definition.selectionSet.selections) {
55793
- this.add(subselect);
55794
- }
55842
+ this.add({
55843
+ kind: "InlineFragment",
55844
+ typeCondition: {
55845
+ kind: "NamedType",
55846
+ name: {
55847
+ kind: "Name",
55848
+ value: definition.typeCondition.name.value
55849
+ }
55850
+ },
55851
+ selectionSet: {
55852
+ kind: "SelectionSet",
55853
+ selections: [...definition.selectionSet.selections]
55854
+ }
55855
+ });
55795
55856
  }
55796
55857
  }
55797
55858
  toSelectionSet() {
@@ -55807,12 +55868,30 @@ var FieldCollection = class {
55807
55868
  })
55808
55869
  ).concat(Object.values(this.fragmentSpreads));
55809
55870
  }
55871
+ walkInlineFragment(selection2) {
55872
+ const key = selection2.typeCondition.name.value;
55873
+ if (!this.inlineFragments[key]) {
55874
+ this.inlineFragments[key] = {
55875
+ astNode: selection2,
55876
+ selection: this.empty()
55877
+ };
55878
+ }
55879
+ for (const subselect of selection2.selectionSet.selections || []) {
55880
+ if (subselect.kind !== "InlineFragment" || !subselect.typeCondition) {
55881
+ this.inlineFragments[key].selection.add(subselect);
55882
+ continue;
55883
+ }
55884
+ this.walkInlineFragment(subselect);
55885
+ }
55886
+ }
55810
55887
  empty() {
55811
55888
  return new FieldCollection({
55812
55889
  config: this.config,
55813
55890
  fragmentDefinitions: this.fragmentDefinitions,
55814
55891
  selections: [],
55815
- filepath: this.filepath
55892
+ filepath: this.filepath,
55893
+ applyFragments: this.applyFragments,
55894
+ ignoreMaskDisable: this.ignoreMaskDisable
55816
55895
  });
55817
55896
  }
55818
55897
  };
@@ -56167,11 +56246,6 @@ function operationObject({
56167
56246
  const when = internalDirectives.find(({ name: name2 }) => name2.value === "when");
56168
56247
  const when_not = internalDirectives.find(({ name: name2 }) => name2.value === "when_not");
56169
56248
  let parentIDArg = parent?.arguments?.find((argument) => argument.name.value === "value");
56170
- if (!parentIDArg) {
56171
- parentIDArg = (append || prepend)?.arguments?.find(
56172
- ({ name: name2 }) => name2.value === config2.listDirectiveParentIDArg
56173
- );
56174
- }
56175
56249
  if (parentIDArg) {
56176
56250
  if (parentIDArg.value.kind === "StringValue") {
56177
56251
  parentID = parentIDArg.value.value;
@@ -57199,6 +57273,8 @@ function selection({
57199
57273
  markEdges
57200
57274
  }) {
57201
57275
  let object = {};
57276
+ const typeMap = {};
57277
+ const abstractTypes = [];
57202
57278
  for (const field of selections) {
57203
57279
  if (field.kind === "FragmentSpread" && includeFragments) {
57204
57280
  const fragmentDefinition = document.document.definitions.find(
@@ -57225,20 +57301,68 @@ function selection({
57225
57301
  })
57226
57302
  );
57227
57303
  } else if (field.kind === "InlineFragment") {
57228
- object = deepMerge(
57229
- filepath,
57230
- object,
57231
- selection({
57232
- config: config2,
57304
+ if (!field.typeCondition || field.typeCondition.name.value === rootType) {
57305
+ object.fields = deepMerge(
57233
57306
  filepath,
57234
- rootType: field.typeCondition?.name.value || rootType,
57235
- operations,
57236
- selections: field.selectionSet.selections,
57237
- path: path2,
57238
- includeFragments,
57239
- document
57240
- })
57241
- );
57307
+ object.fields || {},
57308
+ selection({
57309
+ config: config2,
57310
+ filepath,
57311
+ rootType: field.typeCondition?.name.value || rootType,
57312
+ operations,
57313
+ selections: field.selectionSet.selections,
57314
+ path: path2,
57315
+ includeFragments,
57316
+ document
57317
+ }).fields || {}
57318
+ );
57319
+ } else {
57320
+ if (!object.abstractFields) {
57321
+ object.abstractFields = {
57322
+ fields: {},
57323
+ typeMap: {}
57324
+ };
57325
+ }
57326
+ const parentType = config2.schema.getType(rootType);
57327
+ const typeConditionName = field.typeCondition.name.value;
57328
+ const typeCondition = config2.schema.getType(typeConditionName);
57329
+ const possibleTypes = [];
57330
+ if (!graphql10.isAbstractType(typeCondition)) {
57331
+ } else if (graphql10.isAbstractType(parentType)) {
57332
+ const possibleParentTypes = config2.schema.getPossibleTypes(parentType).map((type) => type.name);
57333
+ for (const possible of config2.schema.getPossibleTypes(typeCondition)) {
57334
+ if (possibleParentTypes.includes(possible.name)) {
57335
+ possibleTypes.push(possible.name);
57336
+ }
57337
+ }
57338
+ } else {
57339
+ possibleTypes.push(rootType);
57340
+ }
57341
+ if (possibleTypes.length > 0) {
57342
+ for (const type of possibleTypes) {
57343
+ const existing = typeMap[type];
57344
+ if (!existing || !existing.includes(type)) {
57345
+ typeMap[type] = [typeConditionName].concat(existing || []);
57346
+ }
57347
+ if (!abstractTypes.includes(typeConditionName)) {
57348
+ abstractTypes.push(typeConditionName);
57349
+ }
57350
+ }
57351
+ }
57352
+ object.abstractFields.fields = {
57353
+ ...object.abstractFields.fields,
57354
+ [field.typeCondition.name.value]: selection({
57355
+ config: config2,
57356
+ filepath,
57357
+ rootType: field.typeCondition?.name.value || rootType,
57358
+ operations,
57359
+ selections: field.selectionSet.selections,
57360
+ path: path2,
57361
+ includeFragments,
57362
+ document
57363
+ }).fields
57364
+ };
57365
+ }
57242
57366
  } else if (field.kind === "Field") {
57243
57367
  const type = config2.schema.getType(rootType);
57244
57368
  if (!type) {
@@ -57296,7 +57420,7 @@ function selection({
57296
57420
  }
57297
57421
  if (field.selectionSet) {
57298
57422
  const edgesMark = paginated && document.refetch?.method === "cursor" ? document.refetch.update : markEdges;
57299
- fieldObj.fields = selection({
57423
+ fieldObj.selection = selection({
57300
57424
  config: config2,
57301
57425
  filepath,
57302
57426
  rootType: typeName,
@@ -57320,11 +57444,49 @@ function selection({
57320
57444
  if (graphql10.isInterfaceType(fieldType) || graphql10.isUnionType(fieldType)) {
57321
57445
  fieldObj.abstract = true;
57322
57446
  }
57323
- object[attributeName] = deepMerge(
57324
- filepath,
57325
- fieldObj,
57326
- object[attributeName] || {}
57327
- );
57447
+ object.fields = {
57448
+ ...object.fields,
57449
+ [attributeName]: fieldObj
57450
+ };
57451
+ }
57452
+ }
57453
+ if (Object.keys(object.fields || {}).length > 0 && object.abstractFields && Object.keys(object.abstractFields.fields).length > 0) {
57454
+ for (const [typeName, possibles] of Object.entries(typeMap)) {
57455
+ let overlap = false;
57456
+ for (const possible of possibles) {
57457
+ if (object.abstractFields.fields[typeName]) {
57458
+ object.abstractFields.fields[typeName] = deepMerge(
57459
+ filepath,
57460
+ object.abstractFields.fields[typeName] || {},
57461
+ object.abstractFields.fields[possible]
57462
+ );
57463
+ overlap = true;
57464
+ }
57465
+ }
57466
+ if (overlap) {
57467
+ delete typeMap[typeName];
57468
+ }
57469
+ }
57470
+ for (const [type, options] of Object.entries(typeMap)) {
57471
+ if (options.length > 1) {
57472
+ object.abstractFields.fields[type] = deepMerge(
57473
+ filepath,
57474
+ ...options.map((opt) => object.abstractFields.fields[opt] || {})
57475
+ );
57476
+ delete typeMap[type];
57477
+ }
57478
+ }
57479
+ for (const [type, sel] of Object.entries(object.abstractFields?.fields || {})) {
57480
+ object.abstractFields.fields[type] = deepMerge(filepath, sel || {}, object.fields);
57481
+ }
57482
+ for (const [type, options] of Object.entries(typeMap)) {
57483
+ object.abstractFields.typeMap[type] = options[0];
57484
+ }
57485
+ const usedTypes = Object.values(object.abstractFields.typeMap);
57486
+ for (const type of abstractTypes) {
57487
+ if (!usedTypes.includes(type)) {
57488
+ delete object.abstractFields.fields[type];
57489
+ }
57328
57490
  }
57329
57491
  }
57330
57492
  return object;
@@ -57459,6 +57621,22 @@ function artifactGenerator(stats) {
57459
57621
  selectionSet = matchingFragment.selectionSet;
57460
57622
  }
57461
57623
  const inputs = operations[0]?.variableDefinitions;
57624
+ const mergedSelection = flattenSelections({
57625
+ config: config2,
57626
+ filepath: doc.filename,
57627
+ selections: selectionSet.selections,
57628
+ fragmentDefinitions: doc.document.definitions.filter(
57629
+ (definition) => definition.kind === "FragmentDefinition"
57630
+ ).reduce(
57631
+ (prev, definition) => ({
57632
+ ...prev,
57633
+ [definition.name.value]: definition
57634
+ }),
57635
+ {}
57636
+ ),
57637
+ ignoreMaskDisable: docKind === "HoudiniQuery",
57638
+ applyFragments: docKind !== "HoudiniFragment"
57639
+ });
57462
57640
  const artifact = {
57463
57641
  name: name2,
57464
57642
  kind: docKind,
@@ -57470,7 +57648,7 @@ function artifactGenerator(stats) {
57470
57648
  config: config2,
57471
57649
  filepath: doc.filename,
57472
57650
  rootType,
57473
- selections: selectionSet.selections,
57651
+ selections: mergedSelection,
57474
57652
  operations: operationsByPath(
57475
57653
  config2,
57476
57654
  doc.filename,
@@ -57766,6 +57944,17 @@ function inlineType({
57766
57944
  continue;
57767
57945
  }
57768
57946
  const possibleParents = config2.schema.getPossibleTypes(type).map((t) => t.name);
57947
+ const freeSelections = [];
57948
+ const typeSpecificSelections = {};
57949
+ for (const node of selection2.selectionSet.selections) {
57950
+ if (node.kind !== "InlineFragment") {
57951
+ freeSelections.push(node);
57952
+ } else if (node.typeCondition) {
57953
+ typeSpecificSelections[node.typeCondition.name.value] = node.selectionSet.selections;
57954
+ } else {
57955
+ freeSelections.push(...node.selectionSet.selections);
57956
+ }
57957
+ }
57769
57958
  for (const possibleType of config2.schema.getPossibleTypes(fragmentType)) {
57770
57959
  if (!possibleParents.includes(possibleType.name)) {
57771
57960
  continue;
@@ -57773,7 +57962,12 @@ function inlineType({
57773
57962
  if (!inlineFragments[possibleType.name]) {
57774
57963
  inlineFragments[possibleType.name] = [];
57775
57964
  }
57776
- inlineFragments[possibleType.name].push(...selection2.selectionSet.selections);
57965
+ inlineFragments[possibleType.name].push(...freeSelections);
57966
+ if (typeSpecificSelections[possibleType.name]) {
57967
+ inlineFragments[possibleType.name].push(
57968
+ ...typeSpecificSelections[possibleType.name]
57969
+ );
57970
+ }
57777
57971
  }
57778
57972
  } else if (selection2.kind === "InlineFragment" && !selection2.typeCondition) {
57779
57973
  selectedFields.push(...selection2.selectionSet.selections);
@@ -57785,12 +57979,7 @@ function inlineType({
57785
57979
  ...(selectedFields || []).filter(
57786
57980
  (field) => field.kind === "Field"
57787
57981
  ).map((selection2) => {
57788
- const { type: type2, field } = selectionTypeInfo(
57789
- config2.schema,
57790
- filepath,
57791
- rootObj,
57792
- selection2
57793
- );
57982
+ const { field } = selectionTypeInfo(config2.schema, filepath, rootObj, selection2);
57794
57983
  const attributeName = selection2.alias?.value || selection2.name.value;
57795
57984
  let attributeType = inlineType({
57796
57985
  config: config2,
@@ -57989,7 +58178,8 @@ async function typescriptGenerator(config2, docs) {
57989
58178
  config: config2,
57990
58179
  filepath: filename,
57991
58180
  selections: definition.selectionSet.selections,
57992
- fragmentDefinitions
58181
+ fragmentDefinitions,
58182
+ applyFragments: definition.kind === "OperationDefinition"
57993
58183
  });
57994
58184
  if (definition?.kind === "OperationDefinition") {
57995
58185
  await generateOperationTypeDefs(
@@ -58502,14 +58692,12 @@ directive @${config2.paginateDirective}(${config2.paginateNameArg}: String) on F
58502
58692
  """
58503
58693
  @${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
58504
58694
  """
58505
- directive @${config2.listPrependDirective}(
58506
- ${config2.listDirectiveParentIDArg}: ID
58507
- ) on FRAGMENT_SPREAD
58695
+ directive @${config2.listPrependDirective} on FRAGMENT_SPREAD
58508
58696
 
58509
58697
  """
58510
58698
  @${config2.listAppendDirective} is used to tell the runtime to add the result to the start of the list
58511
58699
  """
58512
- directive @${config2.listAppendDirective}(${config2.listDirectiveParentIDArg}: ID) on FRAGMENT_SPREAD
58700
+ directive @${config2.listAppendDirective} on FRAGMENT_SPREAD
58513
58701
 
58514
58702
  """
58515
58703
  @${config2.listAllListsDirective} is used to tell the runtime to add the result to all list
@@ -58543,18 +58731,19 @@ directive @${config2.argumentsDirective} on FRAGMENT_DEFINITION
58543
58731
  directive @${config2.cacheDirective}(${config2.cachePolicyArg}: CachePolicy, ${config2.cachePartialArg}: Boolean) on QUERY
58544
58732
 
58545
58733
  """
58546
- @${config2.houdiniDirective} is used to configure houdini's internal behavior
58734
+ @${config2.manualLoadDirective} is used to disable automatic fetch (no load, no auto fetch in component), you will have to do it manually.
58735
+ """
58736
+ directive @${config2.manualLoadDirective} on QUERY
58737
+
58547
58738
  """
58548
- directive @${config2.houdiniDirective}(
58549
- """
58550
- Opt-in to an automatic load function (only valid when used at queries)
58551
- """
58552
- load: Boolean! = true
58553
- """
58554
- Mask fragment fields (only valid when used at a fragment spread)
58555
- """
58556
- mask: Boolean! = ${config2.disableMasking ? "false" : "true"}
58557
- ) on QUERY | FRAGMENT_SPREAD
58739
+ @${config2.maskEnableDirective} to enable masking on fragment (overwriting the global conf)
58740
+ """
58741
+ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
58742
+
58743
+ """
58744
+ @${config2.maskDisableDirective} to disable masking on fragment (overwriting the global conf)
58745
+ """
58746
+ directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
58558
58747
  `;
58559
58748
  let currentSchema = graphql19.printSchema(config2.schema);
58560
58749
  if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
@@ -59047,26 +59236,42 @@ async function typeCheck(config2, docs) {
59047
59236
  ),
59048
59237
  targetField.selectionSet
59049
59238
  );
59050
- const missingIDFields = config2.keyFieldsForType(type.name).filter((fieldName) => !type.getFields()[fieldName]);
59051
- if (missingIDFields.length > 0) {
59052
- if (error) {
59053
- errors.push(
59054
- new HoudiniError({
59055
- filepath: filename,
59056
- message: error
59057
- })
59058
- );
59059
- } else {
59060
- errors.push(
59061
- new HoudiniError({
59062
- filepath: filename,
59063
- message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
59064
- ", "
59065
- )}.`
59066
- })
59067
- );
59239
+ let targetTypes = [type];
59240
+ if (graphql23.isUnionType(type)) {
59241
+ targetTypes = config2.schema.getPossibleTypes(type);
59242
+ } else if (graphql23.isInterfaceType(type)) {
59243
+ try {
59244
+ for (const key of config2.keyFieldsForType(type.name)) {
59245
+ if (!type.getFields()[key]) {
59246
+ throw new Error("continue");
59247
+ }
59248
+ }
59249
+ } catch {
59250
+ targetTypes = config2.schema.getPossibleTypes(type);
59251
+ }
59252
+ }
59253
+ for (const targetType of targetTypes) {
59254
+ const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
59255
+ if (missingIDFields.length > 0) {
59256
+ if (error) {
59257
+ errors.push(
59258
+ new HoudiniError({
59259
+ filepath: filename,
59260
+ message: error
59261
+ })
59262
+ );
59263
+ } else {
59264
+ errors.push(
59265
+ new HoudiniError({
59266
+ filepath: filename,
59267
+ message: `@${config2.listDirective} can only be applied to types with the necessary id fields: ${missingIDFields.join(
59268
+ ", "
59269
+ )}.`
59270
+ })
59271
+ );
59272
+ }
59273
+ return;
59068
59274
  }
59069
- return;
59070
59275
  }
59071
59276
  lists.push(listName);
59072
59277
  listTypes.push(type.name);
@@ -59096,6 +59301,7 @@ async function typeCheck(config2, docs) {
59096
59301
  fragments
59097
59302
  }),
59098
59303
  checkMutationOperation(config2),
59304
+ checkMaskDirective(config2),
59099
59305
  nodeDirectives(config2, [config2.paginateDirective]),
59100
59306
  knownArguments(config2),
59101
59307
  validateFragmentArguments(config2, filepath, fragments),
@@ -59160,10 +59366,14 @@ var validateLists = ({
59160
59366
  ]);
59161
59367
  if (directive) {
59162
59368
  let parentArg = directive.arguments?.find(
59163
- (arg) => arg.name.value === config2.listDirectiveParentIDArg
59369
+ (arg) => arg.name.value === config2.deprecatedlistDirectiveParentIDArg
59164
59370
  );
59165
59371
  if (parentArg) {
59166
- parentIdFound = true;
59372
+ ctx.reportError(
59373
+ new graphql23.GraphQLError(
59374
+ `@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
59375
+ )
59376
+ );
59167
59377
  }
59168
59378
  }
59169
59379
  if (parentIdFound) {
@@ -59559,6 +59769,28 @@ function checkMutationOperation(config2) {
59559
59769
  };
59560
59770
  };
59561
59771
  }
59772
+ function checkMaskDirective(config2) {
59773
+ return function(ctx) {
59774
+ return {
59775
+ FragmentSpread(node, _, __, ___, ancestors) {
59776
+ const maskEnableDirective = node.directives?.find(
59777
+ (c) => c.name.value === config2.maskEnableDirective
59778
+ );
59779
+ const maskDisableDirective = node.directives?.find(
59780
+ (c) => c.name.value === config2.maskDisableDirective
59781
+ );
59782
+ if (maskEnableDirective && maskDisableDirective) {
59783
+ ctx.reportError(
59784
+ new graphql23.GraphQLError(
59785
+ `You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
59786
+ )
59787
+ );
59788
+ return;
59789
+ }
59790
+ }
59791
+ };
59792
+ };
59793
+ }
59562
59794
  function getAndVerifyNodeInterface(config2) {
59563
59795
  const { schema } = config2;
59564
59796
  const nodeInterface = schema.getType("Node");
@@ -59856,12 +60088,7 @@ async function collectDocuments(config2) {
59856
60088
  }
59857
60089
  async function processJSFile(config2, contents) {
59858
60090
  const documents = [];
59859
- try {
59860
- var program = (await parseJS(contents)).script;
59861
- } catch (e) {
59862
- console.log(contents);
59863
- throw e;
59864
- }
60091
+ var program = (await parseJS(contents)).script;
59865
60092
  await find_graphql(config2, program, {
59866
60093
  tag({ tagContent }) {
59867
60094
  documents.push(tagContent);