houdini 1.4.0 → 1.4.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.
@@ -54567,7 +54567,18 @@ var ListManager = class {
54567
54567
  }
54568
54568
  lists = /* @__PURE__ */ new Map();
54569
54569
  listsByField = /* @__PURE__ */ new Map();
54570
- get(listName, id, allLists) {
54570
+ get(listName, id, allLists, skipMatches) {
54571
+ const lists = this.getLists(listName, id, allLists);
54572
+ if (!lists) {
54573
+ return null;
54574
+ }
54575
+ if (skipMatches) {
54576
+ return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
54577
+ } else {
54578
+ return lists;
54579
+ }
54580
+ }
54581
+ getLists(listName, id, allLists) {
54571
54582
  const matches = this.lists.get(listName);
54572
54583
  if (!matches || matches.size === 0) {
54573
54584
  return null;
@@ -54689,6 +54700,9 @@ var List = class {
54689
54700
  this.manager = manager;
54690
54701
  this.abstract = abstract;
54691
54702
  }
54703
+ get fieldRef() {
54704
+ return `${this.recordID}.${this.key}`;
54705
+ }
54692
54706
  when(when) {
54693
54707
  return this.manager.lists.get(this.name).get(this.recordID).when(when);
54694
54708
  }
@@ -55841,8 +55855,8 @@ var Cache = class {
55841
55855
  variables
55842
55856
  );
55843
55857
  }
55844
- list(name, parentID, allLists) {
55845
- const handler = this._internal_unstable.lists.get(name, parentID, allLists);
55858
+ list(name, parentID, allLists, skipMatches) {
55859
+ const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
55846
55860
  if (!handler) {
55847
55861
  throw new Error(
55848
55862
  `Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
@@ -56257,6 +56271,7 @@ var CacheInternal = class {
56257
56271
  });
56258
56272
  }
56259
56273
  }
56274
+ const processedOperations = /* @__PURE__ */ new Set();
56260
56275
  for (const operation of operations || []) {
56261
56276
  let parentID;
56262
56277
  if (operation.parentID) {
@@ -56276,7 +56291,12 @@ var CacheInternal = class {
56276
56291
  const targets = Array.isArray(value) ? value : [value];
56277
56292
  for (const target of targets) {
56278
56293
  if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
56279
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
56294
+ this.cache.list(
56295
+ operation.list,
56296
+ parentID,
56297
+ operation.target === "all",
56298
+ processedOperations
56299
+ ).when(operation.when).addToList(
56280
56300
  fieldSelection,
56281
56301
  target,
56282
56302
  variables,
@@ -56284,7 +56304,12 @@ var CacheInternal = class {
56284
56304
  layer
56285
56305
  );
56286
56306
  } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
56287
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
56307
+ this.cache.list(
56308
+ operation.list,
56309
+ parentID,
56310
+ operation.target === "all",
56311
+ processedOperations
56312
+ ).when(operation.when).toggleElement({
56288
56313
  selection: fieldSelection,
56289
56314
  data: target,
56290
56315
  variables,
@@ -56292,7 +56317,12 @@ var CacheInternal = class {
56292
56317
  layer
56293
56318
  });
56294
56319
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
56295
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
56320
+ this.cache.list(
56321
+ operation.list,
56322
+ parentID,
56323
+ operation.target === "all",
56324
+ processedOperations
56325
+ ).when(operation.when).remove(target, variables, layer);
56296
56326
  } else if (operation.action === "delete" && operation.type && target) {
56297
56327
  const targetID = this.id(operation.type, target);
56298
56328
  if (!targetID) {
@@ -56304,6 +56334,16 @@ var CacheInternal = class {
56304
56334
  this.cache.delete(targetID, layer);
56305
56335
  }
56306
56336
  }
56337
+ if (operation.list) {
56338
+ const matchingLists = this.cache.list(
56339
+ operation.list,
56340
+ parentID,
56341
+ operation.target === "all"
56342
+ );
56343
+ for (const list of matchingLists.lists) {
56344
+ processedOperations.add(list.fieldRef);
56345
+ }
56346
+ }
56307
56347
  }
56308
56348
  }
56309
56349
  return toNotify;
@@ -59619,6 +59659,46 @@ function objectNode([type, defaultValue]) {
59619
59659
  return node;
59620
59660
  }
59621
59661
  var pageInfoSelection = [
59662
+ {
59663
+ kind: graphql13.Kind.FIELD,
59664
+ name: {
59665
+ kind: graphql13.Kind.NAME,
59666
+ value: "pageInfo"
59667
+ },
59668
+ selectionSet: {
59669
+ kind: graphql13.Kind.SELECTION_SET,
59670
+ selections: [
59671
+ {
59672
+ kind: graphql13.Kind.FIELD,
59673
+ name: {
59674
+ kind: graphql13.Kind.NAME,
59675
+ value: "hasPreviousPage"
59676
+ }
59677
+ },
59678
+ {
59679
+ kind: graphql13.Kind.FIELD,
59680
+ name: {
59681
+ kind: graphql13.Kind.NAME,
59682
+ value: "hasNextPage"
59683
+ }
59684
+ },
59685
+ {
59686
+ kind: graphql13.Kind.FIELD,
59687
+ name: {
59688
+ kind: graphql13.Kind.NAME,
59689
+ value: "startCursor"
59690
+ }
59691
+ },
59692
+ {
59693
+ kind: graphql13.Kind.FIELD,
59694
+ name: {
59695
+ kind: graphql13.Kind.NAME,
59696
+ value: "endCursor"
59697
+ }
59698
+ }
59699
+ ]
59700
+ }
59701
+ },
59622
59702
  {
59623
59703
  kind: graphql13.Kind.FIELD,
59624
59704
  name: {
@@ -54564,7 +54564,18 @@ var ListManager = class {
54564
54564
  }
54565
54565
  lists = /* @__PURE__ */ new Map();
54566
54566
  listsByField = /* @__PURE__ */ new Map();
54567
- get(listName, id, allLists) {
54567
+ get(listName, id, allLists, skipMatches) {
54568
+ const lists = this.getLists(listName, id, allLists);
54569
+ if (!lists) {
54570
+ return null;
54571
+ }
54572
+ if (skipMatches) {
54573
+ return new ListCollection(lists.lists.filter((list) => !skipMatches.has(list.fieldRef)));
54574
+ } else {
54575
+ return lists;
54576
+ }
54577
+ }
54578
+ getLists(listName, id, allLists) {
54568
54579
  const matches = this.lists.get(listName);
54569
54580
  if (!matches || matches.size === 0) {
54570
54581
  return null;
@@ -54686,6 +54697,9 @@ var List = class {
54686
54697
  this.manager = manager;
54687
54698
  this.abstract = abstract;
54688
54699
  }
54700
+ get fieldRef() {
54701
+ return `${this.recordID}.${this.key}`;
54702
+ }
54689
54703
  when(when) {
54690
54704
  return this.manager.lists.get(this.name).get(this.recordID).when(when);
54691
54705
  }
@@ -55838,8 +55852,8 @@ var Cache = class {
55838
55852
  variables
55839
55853
  );
55840
55854
  }
55841
- list(name, parentID, allLists) {
55842
- const handler = this._internal_unstable.lists.get(name, parentID, allLists);
55855
+ list(name, parentID, allLists, skipMatches) {
55856
+ const handler = this._internal_unstable.lists.get(name, parentID, allLists, skipMatches);
55843
55857
  if (!handler) {
55844
55858
  throw new Error(
55845
55859
  `Cannot find list with name: ${name}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
@@ -56254,6 +56268,7 @@ var CacheInternal = class {
56254
56268
  });
56255
56269
  }
56256
56270
  }
56271
+ const processedOperations = /* @__PURE__ */ new Set();
56257
56272
  for (const operation of operations || []) {
56258
56273
  let parentID;
56259
56274
  if (operation.parentID) {
@@ -56273,7 +56288,12 @@ var CacheInternal = class {
56273
56288
  const targets = Array.isArray(value) ? value : [value];
56274
56289
  for (const target of targets) {
56275
56290
  if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
56276
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
56291
+ this.cache.list(
56292
+ operation.list,
56293
+ parentID,
56294
+ operation.target === "all",
56295
+ processedOperations
56296
+ ).when(operation.when).addToList(
56277
56297
  fieldSelection,
56278
56298
  target,
56279
56299
  variables,
@@ -56281,7 +56301,12 @@ var CacheInternal = class {
56281
56301
  layer
56282
56302
  );
56283
56303
  } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
56284
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
56304
+ this.cache.list(
56305
+ operation.list,
56306
+ parentID,
56307
+ operation.target === "all",
56308
+ processedOperations
56309
+ ).when(operation.when).toggleElement({
56285
56310
  selection: fieldSelection,
56286
56311
  data: target,
56287
56312
  variables,
@@ -56289,7 +56314,12 @@ var CacheInternal = class {
56289
56314
  layer
56290
56315
  });
56291
56316
  } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
56292
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
56317
+ this.cache.list(
56318
+ operation.list,
56319
+ parentID,
56320
+ operation.target === "all",
56321
+ processedOperations
56322
+ ).when(operation.when).remove(target, variables, layer);
56293
56323
  } else if (operation.action === "delete" && operation.type && target) {
56294
56324
  const targetID = this.id(operation.type, target);
56295
56325
  if (!targetID) {
@@ -56301,6 +56331,16 @@ var CacheInternal = class {
56301
56331
  this.cache.delete(targetID, layer);
56302
56332
  }
56303
56333
  }
56334
+ if (operation.list) {
56335
+ const matchingLists = this.cache.list(
56336
+ operation.list,
56337
+ parentID,
56338
+ operation.target === "all"
56339
+ );
56340
+ for (const list of matchingLists.lists) {
56341
+ processedOperations.add(list.fieldRef);
56342
+ }
56343
+ }
56304
56344
  }
56305
56345
  }
56306
56346
  return toNotify;
@@ -59615,6 +59655,46 @@ function objectNode([type, defaultValue]) {
59615
59655
  return node;
59616
59656
  }
59617
59657
  var pageInfoSelection = [
59658
+ {
59659
+ kind: graphql13.Kind.FIELD,
59660
+ name: {
59661
+ kind: graphql13.Kind.NAME,
59662
+ value: "pageInfo"
59663
+ },
59664
+ selectionSet: {
59665
+ kind: graphql13.Kind.SELECTION_SET,
59666
+ selections: [
59667
+ {
59668
+ kind: graphql13.Kind.FIELD,
59669
+ name: {
59670
+ kind: graphql13.Kind.NAME,
59671
+ value: "hasPreviousPage"
59672
+ }
59673
+ },
59674
+ {
59675
+ kind: graphql13.Kind.FIELD,
59676
+ name: {
59677
+ kind: graphql13.Kind.NAME,
59678
+ value: "hasNextPage"
59679
+ }
59680
+ },
59681
+ {
59682
+ kind: graphql13.Kind.FIELD,
59683
+ name: {
59684
+ kind: graphql13.Kind.NAME,
59685
+ value: "startCursor"
59686
+ }
59687
+ },
59688
+ {
59689
+ kind: graphql13.Kind.FIELD,
59690
+ name: {
59691
+ kind: graphql13.Kind.NAME,
59692
+ value: "endCursor"
59693
+ }
59694
+ }
59695
+ ]
59696
+ }
59697
+ },
59618
59698
  {
59619
59699
  kind: graphql13.Kind.FIELD,
59620
59700
  name: {
@@ -1,10 +1,16 @@
1
- import type * as recast from 'recast';
1
+ import * as recast from 'recast';
2
2
  type Statement = recast.types.namedTypes.Statement;
3
3
  type Program = recast.types.namedTypes.Program;
4
+ type ExportNamedDeclaration = recast.types.namedTypes.ExportNamedDeclaration;
4
5
  type FunctionDeclaration = recast.types.namedTypes.FunctionDeclaration;
6
+ type Identifier = recast.types.namedTypes.Identifier;
5
7
  type ArrowFunctionExpression = recast.types.namedTypes.ArrowFunctionExpression;
6
8
  type FunctionExpression = recast.types.namedTypes.FunctionExpression;
9
+ type CallExpression = recast.types.namedTypes.CallExpression;
7
10
  export declare function find_insert_index(script: Program): number;
8
- export declare function find_exported_fn(body: Statement[], name: string): FunctionDeclaration | FunctionExpression | ArrowFunctionExpression | null;
11
+ export declare function find_exported_fn(body: Statement[], name: string): {
12
+ declaration: FunctionDeclaration | FunctionExpression | ArrowFunctionExpression | null | Identifier | CallExpression;
13
+ export: ExportNamedDeclaration;
14
+ } | null;
9
15
  export declare function find_exported_id(program: Program, name: string): recast.types.namedTypes.ExportNamedDeclaration | undefined;
10
16
  export {};