houdini 1.2.46 → 1.2.47

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.
@@ -66262,9 +66262,12 @@ var InMemorySubscriptions = class {
66262
66262
  removeSubscribers(id, fieldName, specs) {
66263
66263
  let targets = [];
66264
66264
  const subscriber = this.subscribers.get(id);
66265
- const subscriberField = subscriber?.get(fieldName);
66265
+ if (!subscriber) {
66266
+ return;
66267
+ }
66268
+ const subscriberField = subscriber.get(fieldName);
66266
66269
  for (const spec of specs) {
66267
- const counts = subscriber?.get(fieldName)?.referenceCounts;
66270
+ const counts = subscriber.get(fieldName)?.referenceCounts;
66268
66271
  if (!counts?.has(spec.set)) {
66269
66272
  continue;
66270
66273
  }
@@ -66274,12 +66277,18 @@ var InMemorySubscriptions = class {
66274
66277
  targets.push(spec.set);
66275
66278
  counts.delete(spec.set);
66276
66279
  }
66280
+ if (counts.size === 0) {
66281
+ subscriber.delete(fieldName);
66282
+ }
66277
66283
  }
66278
66284
  if (subscriberField) {
66279
66285
  subscriberField.selections = this.get(id, fieldName).filter(
66280
66286
  ([{ set }]) => !targets.includes(set)
66281
66287
  );
66282
66288
  }
66289
+ if (subscriber.size === 0) {
66290
+ this.subscribers.delete(id);
66291
+ }
66283
66292
  }
66284
66293
  removeAllSubscribers(id, targets, visited = []) {
66285
66294
  visited.push(id);
@@ -66300,6 +66309,15 @@ var InMemorySubscriptions = class {
66300
66309
  }
66301
66310
  }
66302
66311
  }
66312
+ get size() {
66313
+ let size = 0;
66314
+ for (const [, nodeCounts] of this.subscribers) {
66315
+ for (const [, { referenceCounts }] of nodeCounts) {
66316
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
66317
+ }
66318
+ }
66319
+ return size;
66320
+ }
66303
66321
  };
66304
66322
 
66305
66323
  // src/runtime/cache/cache.ts
@@ -66348,6 +66366,9 @@ var Cache = class {
66348
66366
  };
66349
66367
  }
66350
66368
  subscribe(spec, variables = {}) {
66369
+ if (this._internal_unstable.disabled) {
66370
+ return;
66371
+ }
66351
66372
  return this._internal_unstable.subscriptions.add({
66352
66373
  parent: spec.parentID || rootID,
66353
66374
  spec,
@@ -66487,7 +66508,7 @@ var Cache = class {
66487
66508
  }
66488
66509
  };
66489
66510
  var CacheInternal = class {
66490
- _disabled = false;
66511
+ disabled = false;
66491
66512
  _config;
66492
66513
  storage;
66493
66514
  subscriptions;
@@ -66518,10 +66539,10 @@ var CacheInternal = class {
66518
66539
  this._config = config;
66519
66540
  this.componentCache = componentCache ?? {};
66520
66541
  this.createComponent = createComponent ?? (() => ({}));
66521
- this._disabled = disabled;
66542
+ this.disabled = disabled;
66522
66543
  try {
66523
66544
  if (process.env.HOUDINI_TEST === "true") {
66524
- this._disabled = false;
66545
+ this.disabled = false;
66525
66546
  }
66526
66547
  } catch {
66527
66548
  }
@@ -66543,7 +66564,7 @@ var CacheInternal = class {
66543
66564
  forceNotify,
66544
66565
  forceStale
66545
66566
  }) {
66546
- if (this._disabled) {
66567
+ if (this.disabled) {
66547
66568
  return [];
66548
66569
  }
66549
66570
  let targetSelection = getFieldsForType(
@@ -78032,12 +78053,12 @@ async function packageJSON(targetPath, frameworkInfo) {
78032
78053
  }
78033
78054
  packageJSON2.devDependencies = {
78034
78055
  ...packageJSON2.devDependencies,
78035
- houdini: "^1.2.46"
78056
+ houdini: "^1.2.47"
78036
78057
  };
78037
78058
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
78038
78059
  packageJSON2.devDependencies = {
78039
78060
  ...packageJSON2.devDependencies,
78040
- "houdini-svelte": "^1.2.46"
78061
+ "houdini-svelte": "^1.2.47"
78041
78062
  };
78042
78063
  } else {
78043
78064
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -66268,9 +66268,12 @@ var InMemorySubscriptions = class {
66268
66268
  removeSubscribers(id, fieldName, specs) {
66269
66269
  let targets = [];
66270
66270
  const subscriber = this.subscribers.get(id);
66271
- const subscriberField = subscriber?.get(fieldName);
66271
+ if (!subscriber) {
66272
+ return;
66273
+ }
66274
+ const subscriberField = subscriber.get(fieldName);
66272
66275
  for (const spec of specs) {
66273
- const counts = subscriber?.get(fieldName)?.referenceCounts;
66276
+ const counts = subscriber.get(fieldName)?.referenceCounts;
66274
66277
  if (!counts?.has(spec.set)) {
66275
66278
  continue;
66276
66279
  }
@@ -66280,12 +66283,18 @@ var InMemorySubscriptions = class {
66280
66283
  targets.push(spec.set);
66281
66284
  counts.delete(spec.set);
66282
66285
  }
66286
+ if (counts.size === 0) {
66287
+ subscriber.delete(fieldName);
66288
+ }
66283
66289
  }
66284
66290
  if (subscriberField) {
66285
66291
  subscriberField.selections = this.get(id, fieldName).filter(
66286
66292
  ([{ set }]) => !targets.includes(set)
66287
66293
  );
66288
66294
  }
66295
+ if (subscriber.size === 0) {
66296
+ this.subscribers.delete(id);
66297
+ }
66289
66298
  }
66290
66299
  removeAllSubscribers(id, targets, visited = []) {
66291
66300
  visited.push(id);
@@ -66306,6 +66315,15 @@ var InMemorySubscriptions = class {
66306
66315
  }
66307
66316
  }
66308
66317
  }
66318
+ get size() {
66319
+ let size = 0;
66320
+ for (const [, nodeCounts] of this.subscribers) {
66321
+ for (const [, { referenceCounts }] of nodeCounts) {
66322
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
66323
+ }
66324
+ }
66325
+ return size;
66326
+ }
66309
66327
  };
66310
66328
 
66311
66329
  // src/runtime/cache/cache.ts
@@ -66354,6 +66372,9 @@ var Cache = class {
66354
66372
  };
66355
66373
  }
66356
66374
  subscribe(spec, variables = {}) {
66375
+ if (this._internal_unstable.disabled) {
66376
+ return;
66377
+ }
66357
66378
  return this._internal_unstable.subscriptions.add({
66358
66379
  parent: spec.parentID || rootID,
66359
66380
  spec,
@@ -66493,7 +66514,7 @@ var Cache = class {
66493
66514
  }
66494
66515
  };
66495
66516
  var CacheInternal = class {
66496
- _disabled = false;
66517
+ disabled = false;
66497
66518
  _config;
66498
66519
  storage;
66499
66520
  subscriptions;
@@ -66524,10 +66545,10 @@ var CacheInternal = class {
66524
66545
  this._config = config;
66525
66546
  this.componentCache = componentCache ?? {};
66526
66547
  this.createComponent = createComponent ?? (() => ({}));
66527
- this._disabled = disabled;
66548
+ this.disabled = disabled;
66528
66549
  try {
66529
66550
  if (process.env.HOUDINI_TEST === "true") {
66530
- this._disabled = false;
66551
+ this.disabled = false;
66531
66552
  }
66532
66553
  } catch {
66533
66554
  }
@@ -66549,7 +66570,7 @@ var CacheInternal = class {
66549
66570
  forceNotify,
66550
66571
  forceStale
66551
66572
  }) {
66552
- if (this._disabled) {
66573
+ if (this.disabled) {
66553
66574
  return [];
66554
66575
  }
66555
66576
  let targetSelection = getFieldsForType(
@@ -78037,12 +78058,12 @@ async function packageJSON(targetPath, frameworkInfo) {
78037
78058
  }
78038
78059
  packageJSON2.devDependencies = {
78039
78060
  ...packageJSON2.devDependencies,
78040
- houdini: "^1.2.46"
78061
+ houdini: "^1.2.47"
78041
78062
  };
78042
78063
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
78043
78064
  packageJSON2.devDependencies = {
78044
78065
  ...packageJSON2.devDependencies,
78045
- "houdini-svelte": "^1.2.46"
78066
+ "houdini-svelte": "^1.2.47"
78046
78067
  };
78047
78068
  } else {
78048
78069
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -55636,9 +55636,12 @@ var InMemorySubscriptions = class {
55636
55636
  removeSubscribers(id, fieldName, specs) {
55637
55637
  let targets = [];
55638
55638
  const subscriber = this.subscribers.get(id);
55639
- const subscriberField = subscriber?.get(fieldName);
55639
+ if (!subscriber) {
55640
+ return;
55641
+ }
55642
+ const subscriberField = subscriber.get(fieldName);
55640
55643
  for (const spec of specs) {
55641
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55644
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55642
55645
  if (!counts?.has(spec.set)) {
55643
55646
  continue;
55644
55647
  }
@@ -55648,12 +55651,18 @@ var InMemorySubscriptions = class {
55648
55651
  targets.push(spec.set);
55649
55652
  counts.delete(spec.set);
55650
55653
  }
55654
+ if (counts.size === 0) {
55655
+ subscriber.delete(fieldName);
55656
+ }
55651
55657
  }
55652
55658
  if (subscriberField) {
55653
55659
  subscriberField.selections = this.get(id, fieldName).filter(
55654
55660
  ([{ set }]) => !targets.includes(set)
55655
55661
  );
55656
55662
  }
55663
+ if (subscriber.size === 0) {
55664
+ this.subscribers.delete(id);
55665
+ }
55657
55666
  }
55658
55667
  removeAllSubscribers(id, targets, visited = []) {
55659
55668
  visited.push(id);
@@ -55674,6 +55683,15 @@ var InMemorySubscriptions = class {
55674
55683
  }
55675
55684
  }
55676
55685
  }
55686
+ get size() {
55687
+ let size = 0;
55688
+ for (const [, nodeCounts] of this.subscribers) {
55689
+ for (const [, { referenceCounts }] of nodeCounts) {
55690
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55691
+ }
55692
+ }
55693
+ return size;
55694
+ }
55677
55695
  };
55678
55696
 
55679
55697
  // src/runtime/cache/cache.ts
@@ -55722,6 +55740,9 @@ var Cache = class {
55722
55740
  };
55723
55741
  }
55724
55742
  subscribe(spec, variables = {}) {
55743
+ if (this._internal_unstable.disabled) {
55744
+ return;
55745
+ }
55725
55746
  return this._internal_unstable.subscriptions.add({
55726
55747
  parent: spec.parentID || rootID,
55727
55748
  spec,
@@ -55861,7 +55882,7 @@ var Cache = class {
55861
55882
  }
55862
55883
  };
55863
55884
  var CacheInternal = class {
55864
- _disabled = false;
55885
+ disabled = false;
55865
55886
  _config;
55866
55887
  storage;
55867
55888
  subscriptions;
@@ -55892,10 +55913,10 @@ var CacheInternal = class {
55892
55913
  this._config = config;
55893
55914
  this.componentCache = componentCache ?? {};
55894
55915
  this.createComponent = createComponent ?? (() => ({}));
55895
- this._disabled = disabled;
55916
+ this.disabled = disabled;
55896
55917
  try {
55897
55918
  if (process.env.HOUDINI_TEST === "true") {
55898
- this._disabled = false;
55919
+ this.disabled = false;
55899
55920
  }
55900
55921
  } catch {
55901
55922
  }
@@ -55917,7 +55938,7 @@ var CacheInternal = class {
55917
55938
  forceNotify,
55918
55939
  forceStale
55919
55940
  }) {
55920
- if (this._disabled) {
55941
+ if (this.disabled) {
55921
55942
  return [];
55922
55943
  }
55923
55944
  let targetSelection = getFieldsForType(
@@ -55636,9 +55636,12 @@ var InMemorySubscriptions = class {
55636
55636
  removeSubscribers(id, fieldName, specs) {
55637
55637
  let targets = [];
55638
55638
  const subscriber = this.subscribers.get(id);
55639
- const subscriberField = subscriber?.get(fieldName);
55639
+ if (!subscriber) {
55640
+ return;
55641
+ }
55642
+ const subscriberField = subscriber.get(fieldName);
55640
55643
  for (const spec of specs) {
55641
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55644
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55642
55645
  if (!counts?.has(spec.set)) {
55643
55646
  continue;
55644
55647
  }
@@ -55648,12 +55651,18 @@ var InMemorySubscriptions = class {
55648
55651
  targets.push(spec.set);
55649
55652
  counts.delete(spec.set);
55650
55653
  }
55654
+ if (counts.size === 0) {
55655
+ subscriber.delete(fieldName);
55656
+ }
55651
55657
  }
55652
55658
  if (subscriberField) {
55653
55659
  subscriberField.selections = this.get(id, fieldName).filter(
55654
55660
  ([{ set }]) => !targets.includes(set)
55655
55661
  );
55656
55662
  }
55663
+ if (subscriber.size === 0) {
55664
+ this.subscribers.delete(id);
55665
+ }
55657
55666
  }
55658
55667
  removeAllSubscribers(id, targets, visited = []) {
55659
55668
  visited.push(id);
@@ -55674,6 +55683,15 @@ var InMemorySubscriptions = class {
55674
55683
  }
55675
55684
  }
55676
55685
  }
55686
+ get size() {
55687
+ let size = 0;
55688
+ for (const [, nodeCounts] of this.subscribers) {
55689
+ for (const [, { referenceCounts }] of nodeCounts) {
55690
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55691
+ }
55692
+ }
55693
+ return size;
55694
+ }
55677
55695
  };
55678
55696
 
55679
55697
  // src/runtime/cache/cache.ts
@@ -55722,6 +55740,9 @@ var Cache = class {
55722
55740
  };
55723
55741
  }
55724
55742
  subscribe(spec, variables = {}) {
55743
+ if (this._internal_unstable.disabled) {
55744
+ return;
55745
+ }
55725
55746
  return this._internal_unstable.subscriptions.add({
55726
55747
  parent: spec.parentID || rootID,
55727
55748
  spec,
@@ -55861,7 +55882,7 @@ var Cache = class {
55861
55882
  }
55862
55883
  };
55863
55884
  var CacheInternal = class {
55864
- _disabled = false;
55885
+ disabled = false;
55865
55886
  _config;
55866
55887
  storage;
55867
55888
  subscriptions;
@@ -55892,10 +55913,10 @@ var CacheInternal = class {
55892
55913
  this._config = config;
55893
55914
  this.componentCache = componentCache ?? {};
55894
55915
  this.createComponent = createComponent ?? (() => ({}));
55895
- this._disabled = disabled;
55916
+ this.disabled = disabled;
55896
55917
  try {
55897
55918
  if (process.env.HOUDINI_TEST === "true") {
55898
- this._disabled = false;
55919
+ this.disabled = false;
55899
55920
  }
55900
55921
  } catch {
55901
55922
  }
@@ -55917,7 +55938,7 @@ var CacheInternal = class {
55917
55938
  forceNotify,
55918
55939
  forceStale
55919
55940
  }) {
55920
- if (this._disabled) {
55941
+ if (this.disabled) {
55921
55942
  return [];
55922
55943
  }
55923
55944
  let targetSelection = getFieldsForType(
@@ -64654,9 +64654,12 @@ var InMemorySubscriptions = class {
64654
64654
  removeSubscribers(id, fieldName, specs) {
64655
64655
  let targets = [];
64656
64656
  const subscriber = this.subscribers.get(id);
64657
- const subscriberField = subscriber?.get(fieldName);
64657
+ if (!subscriber) {
64658
+ return;
64659
+ }
64660
+ const subscriberField = subscriber.get(fieldName);
64658
64661
  for (const spec of specs) {
64659
- const counts = subscriber?.get(fieldName)?.referenceCounts;
64662
+ const counts = subscriber.get(fieldName)?.referenceCounts;
64660
64663
  if (!counts?.has(spec.set)) {
64661
64664
  continue;
64662
64665
  }
@@ -64666,12 +64669,18 @@ var InMemorySubscriptions = class {
64666
64669
  targets.push(spec.set);
64667
64670
  counts.delete(spec.set);
64668
64671
  }
64672
+ if (counts.size === 0) {
64673
+ subscriber.delete(fieldName);
64674
+ }
64669
64675
  }
64670
64676
  if (subscriberField) {
64671
64677
  subscriberField.selections = this.get(id, fieldName).filter(
64672
64678
  ([{ set }]) => !targets.includes(set)
64673
64679
  );
64674
64680
  }
64681
+ if (subscriber.size === 0) {
64682
+ this.subscribers.delete(id);
64683
+ }
64675
64684
  }
64676
64685
  removeAllSubscribers(id, targets, visited = []) {
64677
64686
  visited.push(id);
@@ -64692,6 +64701,15 @@ var InMemorySubscriptions = class {
64692
64701
  }
64693
64702
  }
64694
64703
  }
64704
+ get size() {
64705
+ let size = 0;
64706
+ for (const [, nodeCounts] of this.subscribers) {
64707
+ for (const [, { referenceCounts }] of nodeCounts) {
64708
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
64709
+ }
64710
+ }
64711
+ return size;
64712
+ }
64695
64713
  };
64696
64714
 
64697
64715
  // src/runtime/cache/cache.ts
@@ -64740,6 +64758,9 @@ var Cache = class {
64740
64758
  };
64741
64759
  }
64742
64760
  subscribe(spec, variables = {}) {
64761
+ if (this._internal_unstable.disabled) {
64762
+ return;
64763
+ }
64743
64764
  return this._internal_unstable.subscriptions.add({
64744
64765
  parent: spec.parentID || rootID,
64745
64766
  spec,
@@ -64879,7 +64900,7 @@ var Cache = class {
64879
64900
  }
64880
64901
  };
64881
64902
  var CacheInternal = class {
64882
- _disabled = false;
64903
+ disabled = false;
64883
64904
  _config;
64884
64905
  storage;
64885
64906
  subscriptions;
@@ -64910,10 +64931,10 @@ var CacheInternal = class {
64910
64931
  this._config = config;
64911
64932
  this.componentCache = componentCache ?? {};
64912
64933
  this.createComponent = createComponent ?? (() => ({}));
64913
- this._disabled = disabled;
64934
+ this.disabled = disabled;
64914
64935
  try {
64915
64936
  if (process.env.HOUDINI_TEST === "true") {
64916
- this._disabled = false;
64937
+ this.disabled = false;
64917
64938
  }
64918
64939
  } catch {
64919
64940
  }
@@ -64935,7 +64956,7 @@ var CacheInternal = class {
64935
64956
  forceNotify,
64936
64957
  forceStale
64937
64958
  }) {
64938
- if (this._disabled) {
64959
+ if (this.disabled) {
64939
64960
  return [];
64940
64961
  }
64941
64962
  let targetSelection = getFieldsForType(
@@ -65798,7 +65819,7 @@ var cachePolicy = ({
65798
65819
  serverSideFallback = true
65799
65820
  }) => () => {
65800
65821
  return {
65801
- network(ctx, { initialValue, next, resolve: resolve2, marshalVariables: marshalVariables2 }) {
65822
+ beforeNetwork(ctx, { initialValue, next, resolve: resolve2, marshalVariables: marshalVariables2 }) {
65802
65823
  const { policy, artifact } = ctx;
65803
65824
  let useCache = false;
65804
65825
  if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
@@ -66192,7 +66213,7 @@ var defaultErrorFn = async (errors) => new Error(errors.map((error) => error.mes
66192
66213
 
66193
66214
  // src/runtime/client/plugins/fetchParams.ts
66194
66215
  var fetchParams = (fn = () => ({})) => () => ({
66195
- beforeNetwork(ctx, { next, marshalVariables: marshalVariables2 }) {
66216
+ start(ctx, { next, marshalVariables: marshalVariables2 }) {
66196
66217
  next({
66197
66218
  ...ctx,
66198
66219
  fetchParams: fn({
@@ -67997,7 +68018,9 @@ function find_match(config, manifest, current, allowNull = true) {
67997
68018
  if (!match && !allowNull) {
67998
68019
  throw new Error("404");
67999
68020
  }
68000
- let variables = {};
68021
+ let variables = {
68022
+ ...matchVariables
68023
+ };
68001
68024
  for (const document of Object.values(match?.documents ?? {})) {
68002
68025
  for (const [variable, { type }] of Object.entries(document.variables)) {
68003
68026
  if (matchVariables?.[variable]) {
@@ -64570,9 +64570,12 @@ var InMemorySubscriptions = class {
64570
64570
  removeSubscribers(id, fieldName, specs) {
64571
64571
  let targets = [];
64572
64572
  const subscriber = this.subscribers.get(id);
64573
- const subscriberField = subscriber?.get(fieldName);
64573
+ if (!subscriber) {
64574
+ return;
64575
+ }
64576
+ const subscriberField = subscriber.get(fieldName);
64574
64577
  for (const spec of specs) {
64575
- const counts = subscriber?.get(fieldName)?.referenceCounts;
64578
+ const counts = subscriber.get(fieldName)?.referenceCounts;
64576
64579
  if (!counts?.has(spec.set)) {
64577
64580
  continue;
64578
64581
  }
@@ -64582,12 +64585,18 @@ var InMemorySubscriptions = class {
64582
64585
  targets.push(spec.set);
64583
64586
  counts.delete(spec.set);
64584
64587
  }
64588
+ if (counts.size === 0) {
64589
+ subscriber.delete(fieldName);
64590
+ }
64585
64591
  }
64586
64592
  if (subscriberField) {
64587
64593
  subscriberField.selections = this.get(id, fieldName).filter(
64588
64594
  ([{ set }]) => !targets.includes(set)
64589
64595
  );
64590
64596
  }
64597
+ if (subscriber.size === 0) {
64598
+ this.subscribers.delete(id);
64599
+ }
64591
64600
  }
64592
64601
  removeAllSubscribers(id, targets, visited = []) {
64593
64602
  visited.push(id);
@@ -64608,6 +64617,15 @@ var InMemorySubscriptions = class {
64608
64617
  }
64609
64618
  }
64610
64619
  }
64620
+ get size() {
64621
+ let size = 0;
64622
+ for (const [, nodeCounts] of this.subscribers) {
64623
+ for (const [, { referenceCounts }] of nodeCounts) {
64624
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
64625
+ }
64626
+ }
64627
+ return size;
64628
+ }
64611
64629
  };
64612
64630
 
64613
64631
  // src/runtime/cache/cache.ts
@@ -64656,6 +64674,9 @@ var Cache = class {
64656
64674
  };
64657
64675
  }
64658
64676
  subscribe(spec, variables = {}) {
64677
+ if (this._internal_unstable.disabled) {
64678
+ return;
64679
+ }
64659
64680
  return this._internal_unstable.subscriptions.add({
64660
64681
  parent: spec.parentID || rootID,
64661
64682
  spec,
@@ -64795,7 +64816,7 @@ var Cache = class {
64795
64816
  }
64796
64817
  };
64797
64818
  var CacheInternal = class {
64798
- _disabled = false;
64819
+ disabled = false;
64799
64820
  _config;
64800
64821
  storage;
64801
64822
  subscriptions;
@@ -64826,10 +64847,10 @@ var CacheInternal = class {
64826
64847
  this._config = config;
64827
64848
  this.componentCache = componentCache ?? {};
64828
64849
  this.createComponent = createComponent ?? (() => ({}));
64829
- this._disabled = disabled;
64850
+ this.disabled = disabled;
64830
64851
  try {
64831
64852
  if (process.env.HOUDINI_TEST === "true") {
64832
- this._disabled = false;
64853
+ this.disabled = false;
64833
64854
  }
64834
64855
  } catch {
64835
64856
  }
@@ -64851,7 +64872,7 @@ var CacheInternal = class {
64851
64872
  forceNotify,
64852
64873
  forceStale
64853
64874
  }) {
64854
- if (this._disabled) {
64875
+ if (this.disabled) {
64855
64876
  return [];
64856
64877
  }
64857
64878
  let targetSelection = getFieldsForType(
@@ -65714,7 +65735,7 @@ var cachePolicy = ({
65714
65735
  serverSideFallback = true
65715
65736
  }) => () => {
65716
65737
  return {
65717
- network(ctx, { initialValue, next, resolve: resolve2, marshalVariables: marshalVariables2 }) {
65738
+ beforeNetwork(ctx, { initialValue, next, resolve: resolve2, marshalVariables: marshalVariables2 }) {
65718
65739
  const { policy, artifact } = ctx;
65719
65740
  let useCache = false;
65720
65741
  if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
@@ -66108,7 +66129,7 @@ var defaultErrorFn = async (errors) => new Error(errors.map((error) => error.mes
66108
66129
 
66109
66130
  // src/runtime/client/plugins/fetchParams.ts
66110
66131
  var fetchParams = (fn = () => ({})) => () => ({
66111
- beforeNetwork(ctx, { next, marshalVariables: marshalVariables2 }) {
66132
+ start(ctx, { next, marshalVariables: marshalVariables2 }) {
66112
66133
  next({
66113
66134
  ...ctx,
66114
66135
  fetchParams: fn({
@@ -67912,7 +67933,9 @@ function find_match(config, manifest, current, allowNull = true) {
67912
67933
  if (!match && !allowNull) {
67913
67934
  throw new Error("404");
67914
67935
  }
67915
- let variables = {};
67936
+ let variables = {
67937
+ ...matchVariables
67938
+ };
67916
67939
  for (const document of Object.values(match?.documents ?? {})) {
67917
67940
  for (const [variable, { type }] of Object.entries(document.variables)) {
67918
67941
  if (matchVariables?.[variable]) {
@@ -55,7 +55,7 @@ export declare class Cache {
55
55
  reset(): void;
56
56
  }
57
57
  declare class CacheInternal {
58
- private _disabled;
58
+ disabled: boolean;
59
59
  _config?: ConfigFile;
60
60
  storage: InMemoryStorage;
61
61
  subscriptions: InMemorySubscriptions;
@@ -45,4 +45,5 @@ export declare class InMemorySubscriptions {
45
45
  reset(): SubscriptionSpec[];
46
46
  private removeSubscribers;
47
47
  removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
48
+ get size(): number;
48
49
  }
@@ -55,7 +55,7 @@ export declare class Cache {
55
55
  reset(): void;
56
56
  }
57
57
  declare class CacheInternal {
58
- private _disabled;
58
+ disabled: boolean;
59
59
  _config?: ConfigFile;
60
60
  storage: InMemoryStorage;
61
61
  subscriptions: InMemorySubscriptions;
@@ -83,6 +83,9 @@ class Cache {
83
83
  };
84
84
  }
85
85
  subscribe(spec, variables = {}) {
86
+ if (this._internal_unstable.disabled) {
87
+ return;
88
+ }
86
89
  return this._internal_unstable.subscriptions.add({
87
90
  parent: spec.parentID || rootID,
88
91
  spec,
@@ -222,7 +225,7 @@ class Cache {
222
225
  }
223
226
  }
224
227
  class CacheInternal {
225
- _disabled = false;
228
+ disabled = false;
226
229
  _config;
227
230
  storage;
228
231
  subscriptions;
@@ -253,10 +256,10 @@ class CacheInternal {
253
256
  this._config = config;
254
257
  this.componentCache = componentCache ?? {};
255
258
  this.createComponent = createComponent ?? (() => ({}));
256
- this._disabled = disabled;
259
+ this.disabled = disabled;
257
260
  try {
258
261
  if (process.env.HOUDINI_TEST === "true") {
259
- this._disabled = false;
262
+ this.disabled = false;
260
263
  }
261
264
  } catch {
262
265
  }
@@ -278,7 +281,7 @@ class CacheInternal {
278
281
  forceNotify,
279
282
  forceStale
280
283
  }) {
281
- if (this._disabled) {
284
+ if (this.disabled) {
282
285
  return [];
283
286
  }
284
287
  let targetSelection = (0, import_selection.getFieldsForType)(
@@ -45,4 +45,5 @@ export declare class InMemorySubscriptions {
45
45
  reset(): SubscriptionSpec[];
46
46
  private removeSubscribers;
47
47
  removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
48
+ get size(): number;
48
49
  }
@@ -253,9 +253,12 @@ class InMemorySubscriptions {
253
253
  removeSubscribers(id, fieldName, specs) {
254
254
  let targets = [];
255
255
  const subscriber = this.subscribers.get(id);
256
- const subscriberField = subscriber?.get(fieldName);
256
+ if (!subscriber) {
257
+ return;
258
+ }
259
+ const subscriberField = subscriber.get(fieldName);
257
260
  for (const spec of specs) {
258
- const counts = subscriber?.get(fieldName)?.referenceCounts;
261
+ const counts = subscriber.get(fieldName)?.referenceCounts;
259
262
  if (!counts?.has(spec.set)) {
260
263
  continue;
261
264
  }
@@ -265,12 +268,18 @@ class InMemorySubscriptions {
265
268
  targets.push(spec.set);
266
269
  counts.delete(spec.set);
267
270
  }
271
+ if (counts.size === 0) {
272
+ subscriber.delete(fieldName);
273
+ }
268
274
  }
269
275
  if (subscriberField) {
270
276
  subscriberField.selections = this.get(id, fieldName).filter(
271
277
  ([{ set }]) => !targets.includes(set)
272
278
  );
273
279
  }
280
+ if (subscriber.size === 0) {
281
+ this.subscribers.delete(id);
282
+ }
274
283
  }
275
284
  removeAllSubscribers(id, targets, visited = []) {
276
285
  visited.push(id);
@@ -291,6 +300,15 @@ class InMemorySubscriptions {
291
300
  }
292
301
  }
293
302
  }
303
+ get size() {
304
+ let size = 0;
305
+ for (const [, nodeCounts] of this.subscribers) {
306
+ for (const [, { referenceCounts }] of nodeCounts) {
307
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
308
+ }
309
+ }
310
+ return size;
311
+ }
294
312
  }
295
313
  // Annotate the CommonJS export names for ESM import in node:
296
314
  0 && (module.exports = {
@@ -38,7 +38,7 @@ const cachePolicy = ({
38
38
  serverSideFallback = true
39
39
  }) => () => {
40
40
  return {
41
- network(ctx, { initialValue, next, resolve, marshalVariables }) {
41
+ beforeNetwork(ctx, { initialValue, next, resolve, marshalVariables }) {
42
42
  const { policy, artifact } = ctx;
43
43
  let useCache = false;
44
44
  if (enabled && (artifact.kind === import_types.ArtifactKind.Query || artifact.kind === import_types.ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
@@ -22,7 +22,7 @@ __export(fetchParams_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(fetchParams_exports);
24
24
  const fetchParams = (fn = () => ({})) => () => ({
25
- beforeNetwork(ctx, { next, marshalVariables }) {
25
+ start(ctx, { next, marshalVariables }) {
26
26
  next({
27
27
  ...ctx,
28
28
  fetchParams: fn({
@@ -41,7 +41,9 @@ function find_match(config, manifest, current, allowNull = true) {
41
41
  if (!match && !allowNull) {
42
42
  throw new Error("404");
43
43
  }
44
- let variables = {};
44
+ let variables = {
45
+ ...matchVariables
46
+ };
45
47
  for (const document of Object.values(match?.documents ?? {})) {
46
48
  for (const [variable, { type }] of Object.entries(document.variables)) {
47
49
  if (matchVariables?.[variable]) {
@@ -55,7 +55,7 @@ export declare class Cache {
55
55
  reset(): void;
56
56
  }
57
57
  declare class CacheInternal {
58
- private _disabled;
58
+ disabled: boolean;
59
59
  _config?: ConfigFile;
60
60
  storage: InMemoryStorage;
61
61
  subscriptions: InMemorySubscriptions;
@@ -55,6 +55,9 @@ class Cache {
55
55
  };
56
56
  }
57
57
  subscribe(spec, variables = {}) {
58
+ if (this._internal_unstable.disabled) {
59
+ return;
60
+ }
58
61
  return this._internal_unstable.subscriptions.add({
59
62
  parent: spec.parentID || rootID,
60
63
  spec,
@@ -194,7 +197,7 @@ class Cache {
194
197
  }
195
198
  }
196
199
  class CacheInternal {
197
- _disabled = false;
200
+ disabled = false;
198
201
  _config;
199
202
  storage;
200
203
  subscriptions;
@@ -225,10 +228,10 @@ class CacheInternal {
225
228
  this._config = config;
226
229
  this.componentCache = componentCache ?? {};
227
230
  this.createComponent = createComponent ?? (() => ({}));
228
- this._disabled = disabled;
231
+ this.disabled = disabled;
229
232
  try {
230
233
  if (process.env.HOUDINI_TEST === "true") {
231
- this._disabled = false;
234
+ this.disabled = false;
232
235
  }
233
236
  } catch {
234
237
  }
@@ -250,7 +253,7 @@ class CacheInternal {
250
253
  forceNotify,
251
254
  forceStale
252
255
  }) {
253
- if (this._disabled) {
256
+ if (this.disabled) {
254
257
  return [];
255
258
  }
256
259
  let targetSelection = getFieldsForType(
@@ -45,4 +45,5 @@ export declare class InMemorySubscriptions {
45
45
  reset(): SubscriptionSpec[];
46
46
  private removeSubscribers;
47
47
  removeAllSubscribers(id: string, targets?: SubscriptionSpec[], visited?: string[]): void;
48
+ get size(): number;
48
49
  }
@@ -230,9 +230,12 @@ class InMemorySubscriptions {
230
230
  removeSubscribers(id, fieldName, specs) {
231
231
  let targets = [];
232
232
  const subscriber = this.subscribers.get(id);
233
- const subscriberField = subscriber?.get(fieldName);
233
+ if (!subscriber) {
234
+ return;
235
+ }
236
+ const subscriberField = subscriber.get(fieldName);
234
237
  for (const spec of specs) {
235
- const counts = subscriber?.get(fieldName)?.referenceCounts;
238
+ const counts = subscriber.get(fieldName)?.referenceCounts;
236
239
  if (!counts?.has(spec.set)) {
237
240
  continue;
238
241
  }
@@ -242,12 +245,18 @@ class InMemorySubscriptions {
242
245
  targets.push(spec.set);
243
246
  counts.delete(spec.set);
244
247
  }
248
+ if (counts.size === 0) {
249
+ subscriber.delete(fieldName);
250
+ }
245
251
  }
246
252
  if (subscriberField) {
247
253
  subscriberField.selections = this.get(id, fieldName).filter(
248
254
  ([{ set }]) => !targets.includes(set)
249
255
  );
250
256
  }
257
+ if (subscriber.size === 0) {
258
+ this.subscribers.delete(id);
259
+ }
251
260
  }
252
261
  removeAllSubscribers(id, targets, visited = []) {
253
262
  visited.push(id);
@@ -268,6 +277,15 @@ class InMemorySubscriptions {
268
277
  }
269
278
  }
270
279
  }
280
+ get size() {
281
+ let size = 0;
282
+ for (const [, nodeCounts] of this.subscribers) {
283
+ for (const [, { referenceCounts }] of nodeCounts) {
284
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
285
+ }
286
+ }
287
+ return size;
288
+ }
271
289
  }
272
290
  export {
273
291
  InMemorySubscriptions
@@ -9,7 +9,7 @@ const cachePolicy = ({
9
9
  serverSideFallback = true
10
10
  }) => () => {
11
11
  return {
12
- network(ctx, { initialValue, next, resolve, marshalVariables }) {
12
+ beforeNetwork(ctx, { initialValue, next, resolve, marshalVariables }) {
13
13
  const { policy, artifact } = ctx;
14
14
  let useCache = false;
15
15
  if (enabled && (artifact.kind === ArtifactKind.Query || artifact.kind === ArtifactKind.Fragment) && !ctx.cacheParams?.disableRead) {
@@ -1,5 +1,5 @@
1
1
  const fetchParams = (fn = () => ({})) => () => ({
2
- beforeNetwork(ctx, { next, marshalVariables }) {
2
+ start(ctx, { next, marshalVariables }) {
3
3
  next({
4
4
  ...ctx,
5
5
  fetchParams: fn({
@@ -15,7 +15,9 @@ function find_match(config, manifest, current, allowNull = true) {
15
15
  if (!match && !allowNull) {
16
16
  throw new Error("404");
17
17
  }
18
- let variables = {};
18
+ let variables = {
19
+ ...matchVariables
20
+ };
19
21
  for (const document of Object.values(match?.documents ?? {})) {
20
22
  for (const [variable, { type }] of Object.entries(document.variables)) {
21
23
  if (matchVariables?.[variable]) {
@@ -55646,9 +55646,12 @@ var InMemorySubscriptions = class {
55646
55646
  removeSubscribers(id, fieldName, specs) {
55647
55647
  let targets = [];
55648
55648
  const subscriber = this.subscribers.get(id);
55649
- const subscriberField = subscriber?.get(fieldName);
55649
+ if (!subscriber) {
55650
+ return;
55651
+ }
55652
+ const subscriberField = subscriber.get(fieldName);
55650
55653
  for (const spec of specs) {
55651
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55654
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55652
55655
  if (!counts?.has(spec.set)) {
55653
55656
  continue;
55654
55657
  }
@@ -55658,12 +55661,18 @@ var InMemorySubscriptions = class {
55658
55661
  targets.push(spec.set);
55659
55662
  counts.delete(spec.set);
55660
55663
  }
55664
+ if (counts.size === 0) {
55665
+ subscriber.delete(fieldName);
55666
+ }
55661
55667
  }
55662
55668
  if (subscriberField) {
55663
55669
  subscriberField.selections = this.get(id, fieldName).filter(
55664
55670
  ([{ set }]) => !targets.includes(set)
55665
55671
  );
55666
55672
  }
55673
+ if (subscriber.size === 0) {
55674
+ this.subscribers.delete(id);
55675
+ }
55667
55676
  }
55668
55677
  removeAllSubscribers(id, targets, visited = []) {
55669
55678
  visited.push(id);
@@ -55684,6 +55693,15 @@ var InMemorySubscriptions = class {
55684
55693
  }
55685
55694
  }
55686
55695
  }
55696
+ get size() {
55697
+ let size = 0;
55698
+ for (const [, nodeCounts] of this.subscribers) {
55699
+ for (const [, { referenceCounts }] of nodeCounts) {
55700
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55701
+ }
55702
+ }
55703
+ return size;
55704
+ }
55687
55705
  };
55688
55706
 
55689
55707
  // src/runtime/cache/cache.ts
@@ -55732,6 +55750,9 @@ var Cache = class {
55732
55750
  };
55733
55751
  }
55734
55752
  subscribe(spec, variables = {}) {
55753
+ if (this._internal_unstable.disabled) {
55754
+ return;
55755
+ }
55735
55756
  return this._internal_unstable.subscriptions.add({
55736
55757
  parent: spec.parentID || rootID,
55737
55758
  spec,
@@ -55871,7 +55892,7 @@ var Cache = class {
55871
55892
  }
55872
55893
  };
55873
55894
  var CacheInternal = class {
55874
- _disabled = false;
55895
+ disabled = false;
55875
55896
  _config;
55876
55897
  storage;
55877
55898
  subscriptions;
@@ -55902,10 +55923,10 @@ var CacheInternal = class {
55902
55923
  this._config = config;
55903
55924
  this.componentCache = componentCache ?? {};
55904
55925
  this.createComponent = createComponent ?? (() => ({}));
55905
- this._disabled = disabled;
55926
+ this.disabled = disabled;
55906
55927
  try {
55907
55928
  if (process.env.HOUDINI_TEST === "true") {
55908
- this._disabled = false;
55929
+ this.disabled = false;
55909
55930
  }
55910
55931
  } catch {
55911
55932
  }
@@ -55927,7 +55948,7 @@ var CacheInternal = class {
55927
55948
  forceNotify,
55928
55949
  forceStale
55929
55950
  }) {
55930
- if (this._disabled) {
55951
+ if (this.disabled) {
55931
55952
  return [];
55932
55953
  }
55933
55954
  let targetSelection = getFieldsForType(
@@ -55643,9 +55643,12 @@ var InMemorySubscriptions = class {
55643
55643
  removeSubscribers(id, fieldName, specs) {
55644
55644
  let targets = [];
55645
55645
  const subscriber = this.subscribers.get(id);
55646
- const subscriberField = subscriber?.get(fieldName);
55646
+ if (!subscriber) {
55647
+ return;
55648
+ }
55649
+ const subscriberField = subscriber.get(fieldName);
55647
55650
  for (const spec of specs) {
55648
- const counts = subscriber?.get(fieldName)?.referenceCounts;
55651
+ const counts = subscriber.get(fieldName)?.referenceCounts;
55649
55652
  if (!counts?.has(spec.set)) {
55650
55653
  continue;
55651
55654
  }
@@ -55655,12 +55658,18 @@ var InMemorySubscriptions = class {
55655
55658
  targets.push(spec.set);
55656
55659
  counts.delete(spec.set);
55657
55660
  }
55661
+ if (counts.size === 0) {
55662
+ subscriber.delete(fieldName);
55663
+ }
55658
55664
  }
55659
55665
  if (subscriberField) {
55660
55666
  subscriberField.selections = this.get(id, fieldName).filter(
55661
55667
  ([{ set }]) => !targets.includes(set)
55662
55668
  );
55663
55669
  }
55670
+ if (subscriber.size === 0) {
55671
+ this.subscribers.delete(id);
55672
+ }
55664
55673
  }
55665
55674
  removeAllSubscribers(id, targets, visited = []) {
55666
55675
  visited.push(id);
@@ -55681,6 +55690,15 @@ var InMemorySubscriptions = class {
55681
55690
  }
55682
55691
  }
55683
55692
  }
55693
+ get size() {
55694
+ let size = 0;
55695
+ for (const [, nodeCounts] of this.subscribers) {
55696
+ for (const [, { referenceCounts }] of nodeCounts) {
55697
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
55698
+ }
55699
+ }
55700
+ return size;
55701
+ }
55684
55702
  };
55685
55703
 
55686
55704
  // src/runtime/cache/cache.ts
@@ -55729,6 +55747,9 @@ var Cache = class {
55729
55747
  };
55730
55748
  }
55731
55749
  subscribe(spec, variables = {}) {
55750
+ if (this._internal_unstable.disabled) {
55751
+ return;
55752
+ }
55732
55753
  return this._internal_unstable.subscriptions.add({
55733
55754
  parent: spec.parentID || rootID,
55734
55755
  spec,
@@ -55868,7 +55889,7 @@ var Cache = class {
55868
55889
  }
55869
55890
  };
55870
55891
  var CacheInternal = class {
55871
- _disabled = false;
55892
+ disabled = false;
55872
55893
  _config;
55873
55894
  storage;
55874
55895
  subscriptions;
@@ -55899,10 +55920,10 @@ var CacheInternal = class {
55899
55920
  this._config = config;
55900
55921
  this.componentCache = componentCache ?? {};
55901
55922
  this.createComponent = createComponent ?? (() => ({}));
55902
- this._disabled = disabled;
55923
+ this.disabled = disabled;
55903
55924
  try {
55904
55925
  if (process.env.HOUDINI_TEST === "true") {
55905
- this._disabled = false;
55926
+ this.disabled = false;
55906
55927
  }
55907
55928
  } catch {
55908
55929
  }
@@ -55924,7 +55945,7 @@ var CacheInternal = class {
55924
55945
  forceNotify,
55925
55946
  forceStale
55926
55947
  }) {
55927
- if (this._disabled) {
55948
+ if (this.disabled) {
55928
55949
  return [];
55929
55950
  }
55930
55951
  let targetSelection = getFieldsForType(
@@ -67402,9 +67402,12 @@ var InMemorySubscriptions = class {
67402
67402
  removeSubscribers(id, fieldName, specs) {
67403
67403
  let targets = [];
67404
67404
  const subscriber = this.subscribers.get(id);
67405
- const subscriberField = subscriber?.get(fieldName);
67405
+ if (!subscriber) {
67406
+ return;
67407
+ }
67408
+ const subscriberField = subscriber.get(fieldName);
67406
67409
  for (const spec of specs) {
67407
- const counts = subscriber?.get(fieldName)?.referenceCounts;
67410
+ const counts = subscriber.get(fieldName)?.referenceCounts;
67408
67411
  if (!counts?.has(spec.set)) {
67409
67412
  continue;
67410
67413
  }
@@ -67414,12 +67417,18 @@ var InMemorySubscriptions = class {
67414
67417
  targets.push(spec.set);
67415
67418
  counts.delete(spec.set);
67416
67419
  }
67420
+ if (counts.size === 0) {
67421
+ subscriber.delete(fieldName);
67422
+ }
67417
67423
  }
67418
67424
  if (subscriberField) {
67419
67425
  subscriberField.selections = this.get(id, fieldName).filter(
67420
67426
  ([{ set }]) => !targets.includes(set)
67421
67427
  );
67422
67428
  }
67429
+ if (subscriber.size === 0) {
67430
+ this.subscribers.delete(id);
67431
+ }
67423
67432
  }
67424
67433
  removeAllSubscribers(id, targets, visited = []) {
67425
67434
  visited.push(id);
@@ -67440,6 +67449,15 @@ var InMemorySubscriptions = class {
67440
67449
  }
67441
67450
  }
67442
67451
  }
67452
+ get size() {
67453
+ let size = 0;
67454
+ for (const [, nodeCounts] of this.subscribers) {
67455
+ for (const [, { referenceCounts }] of nodeCounts) {
67456
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
67457
+ }
67458
+ }
67459
+ return size;
67460
+ }
67443
67461
  };
67444
67462
 
67445
67463
  // src/runtime/cache/cache.ts
@@ -67488,6 +67506,9 @@ var Cache = class {
67488
67506
  };
67489
67507
  }
67490
67508
  subscribe(spec, variables = {}) {
67509
+ if (this._internal_unstable.disabled) {
67510
+ return;
67511
+ }
67491
67512
  return this._internal_unstable.subscriptions.add({
67492
67513
  parent: spec.parentID || rootID,
67493
67514
  spec,
@@ -67627,7 +67648,7 @@ var Cache = class {
67627
67648
  }
67628
67649
  };
67629
67650
  var CacheInternal = class {
67630
- _disabled = false;
67651
+ disabled = false;
67631
67652
  _config;
67632
67653
  storage;
67633
67654
  subscriptions;
@@ -67658,10 +67679,10 @@ var CacheInternal = class {
67658
67679
  this._config = config2;
67659
67680
  this.componentCache = componentCache ?? {};
67660
67681
  this.createComponent = createComponent ?? (() => ({}));
67661
- this._disabled = disabled;
67682
+ this.disabled = disabled;
67662
67683
  try {
67663
67684
  if (process.env.HOUDINI_TEST === "true") {
67664
- this._disabled = false;
67685
+ this.disabled = false;
67665
67686
  }
67666
67687
  } catch {
67667
67688
  }
@@ -67683,7 +67704,7 @@ var CacheInternal = class {
67683
67704
  forceNotify,
67684
67705
  forceStale
67685
67706
  }) {
67686
- if (this._disabled) {
67707
+ if (this.disabled) {
67687
67708
  return [];
67688
67709
  }
67689
67710
  let targetSelection = getFieldsForType(
@@ -67396,9 +67396,12 @@ var InMemorySubscriptions = class {
67396
67396
  removeSubscribers(id, fieldName, specs) {
67397
67397
  let targets = [];
67398
67398
  const subscriber = this.subscribers.get(id);
67399
- const subscriberField = subscriber?.get(fieldName);
67399
+ if (!subscriber) {
67400
+ return;
67401
+ }
67402
+ const subscriberField = subscriber.get(fieldName);
67400
67403
  for (const spec of specs) {
67401
- const counts = subscriber?.get(fieldName)?.referenceCounts;
67404
+ const counts = subscriber.get(fieldName)?.referenceCounts;
67402
67405
  if (!counts?.has(spec.set)) {
67403
67406
  continue;
67404
67407
  }
@@ -67408,12 +67411,18 @@ var InMemorySubscriptions = class {
67408
67411
  targets.push(spec.set);
67409
67412
  counts.delete(spec.set);
67410
67413
  }
67414
+ if (counts.size === 0) {
67415
+ subscriber.delete(fieldName);
67416
+ }
67411
67417
  }
67412
67418
  if (subscriberField) {
67413
67419
  subscriberField.selections = this.get(id, fieldName).filter(
67414
67420
  ([{ set }]) => !targets.includes(set)
67415
67421
  );
67416
67422
  }
67423
+ if (subscriber.size === 0) {
67424
+ this.subscribers.delete(id);
67425
+ }
67417
67426
  }
67418
67427
  removeAllSubscribers(id, targets, visited = []) {
67419
67428
  visited.push(id);
@@ -67434,6 +67443,15 @@ var InMemorySubscriptions = class {
67434
67443
  }
67435
67444
  }
67436
67445
  }
67446
+ get size() {
67447
+ let size = 0;
67448
+ for (const [, nodeCounts] of this.subscribers) {
67449
+ for (const [, { referenceCounts }] of nodeCounts) {
67450
+ size += [...referenceCounts.values()].reduce((size2, count) => size2 + count, 0);
67451
+ }
67452
+ }
67453
+ return size;
67454
+ }
67437
67455
  };
67438
67456
 
67439
67457
  // src/runtime/cache/cache.ts
@@ -67482,6 +67500,9 @@ var Cache = class {
67482
67500
  };
67483
67501
  }
67484
67502
  subscribe(spec, variables = {}) {
67503
+ if (this._internal_unstable.disabled) {
67504
+ return;
67505
+ }
67485
67506
  return this._internal_unstable.subscriptions.add({
67486
67507
  parent: spec.parentID || rootID,
67487
67508
  spec,
@@ -67621,7 +67642,7 @@ var Cache = class {
67621
67642
  }
67622
67643
  };
67623
67644
  var CacheInternal = class {
67624
- _disabled = false;
67645
+ disabled = false;
67625
67646
  _config;
67626
67647
  storage;
67627
67648
  subscriptions;
@@ -67652,10 +67673,10 @@ var CacheInternal = class {
67652
67673
  this._config = config2;
67653
67674
  this.componentCache = componentCache ?? {};
67654
67675
  this.createComponent = createComponent ?? (() => ({}));
67655
- this._disabled = disabled;
67676
+ this.disabled = disabled;
67656
67677
  try {
67657
67678
  if (process.env.HOUDINI_TEST === "true") {
67658
- this._disabled = false;
67679
+ this.disabled = false;
67659
67680
  }
67660
67681
  } catch {
67661
67682
  }
@@ -67677,7 +67698,7 @@ var CacheInternal = class {
67677
67698
  forceNotify,
67678
67699
  forceStale
67679
67700
  }) {
67680
- if (this._disabled) {
67701
+ if (this.disabled) {
67681
67702
  return [];
67682
67703
  }
67683
67704
  let targetSelection = getFieldsForType(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.46",
3
+ "version": "1.2.47",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",