houdini 1.0.0-next.3 → 1.0.0-next.5

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 (89) hide show
  1. package/build/cmd-cjs/index.js +1254 -1062
  2. package/build/cmd-esm/index.js +1254 -1062
  3. package/build/codegen/generators/artifacts/selection.d.ts +3 -3
  4. package/build/codegen/generators/artifacts/utils.d.ts +0 -1
  5. package/build/codegen-cjs/index.js +847 -717
  6. package/build/codegen-esm/index.js +847 -717
  7. package/build/lib/config.d.ts +10 -90
  8. package/build/lib/deepMerge.d.ts +1 -0
  9. package/build/lib/graphql.d.ts +5 -2
  10. package/build/lib/index.d.ts +2 -0
  11. package/build/lib/pipeline.d.ts +1 -1
  12. package/build/lib/plugin.d.ts +2 -0
  13. package/build/lib/types.d.ts +250 -2
  14. package/build/lib-cjs/index.js +351 -162
  15. package/build/lib-esm/index.js +349 -162
  16. package/build/runtime/cache/cache.d.ts +23 -6
  17. package/build/runtime/cache/staleManager.d.ts +30 -0
  18. package/build/runtime/cache/subscription.d.ts +2 -1
  19. package/build/runtime/client/documentStore.d.ts +1 -1
  20. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  21. package/build/runtime/client/plugins/subscription.d.ts +1 -2
  22. package/build/runtime/lib/config.d.ts +4 -0
  23. package/build/runtime/lib/index.d.ts +1 -0
  24. package/build/runtime/lib/key.d.ts +6 -0
  25. package/build/runtime/lib/types.d.ts +4 -5
  26. package/build/runtime/public/cache.d.ts +8 -1
  27. package/build/runtime/public/record.d.ts +11 -1
  28. package/build/runtime/public/tests/test.d.ts +9 -10
  29. package/build/runtime-cjs/cache/cache.d.ts +23 -6
  30. package/build/runtime-cjs/cache/cache.js +95 -21
  31. package/build/runtime-cjs/cache/gc.js +9 -0
  32. package/build/runtime-cjs/cache/lists.js +3 -3
  33. package/build/runtime-cjs/cache/staleManager.d.ts +30 -0
  34. package/build/runtime-cjs/cache/staleManager.js +95 -0
  35. package/build/runtime-cjs/cache/subscription.d.ts +2 -1
  36. package/build/runtime-cjs/cache/subscription.js +6 -3
  37. package/build/runtime-cjs/client/documentStore.d.ts +1 -1
  38. package/build/runtime-cjs/client/documentStore.js +1 -0
  39. package/build/runtime-cjs/client/plugins/cache.js +5 -3
  40. package/build/runtime-cjs/client/plugins/fetch.js +1 -0
  41. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  42. package/build/runtime-cjs/client/plugins/fetchParams.js +6 -1
  43. package/build/runtime-cjs/client/plugins/query.js +1 -1
  44. package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -2
  45. package/build/runtime-cjs/client/plugins/subscription.js +2 -0
  46. package/build/runtime-cjs/lib/config.d.ts +4 -0
  47. package/build/runtime-cjs/lib/index.d.ts +1 -0
  48. package/build/runtime-cjs/lib/index.js +1 -0
  49. package/build/runtime-cjs/lib/key.d.ts +6 -0
  50. package/build/runtime-cjs/lib/key.js +41 -0
  51. package/build/runtime-cjs/lib/types.d.ts +4 -5
  52. package/build/runtime-cjs/public/cache.d.ts +8 -1
  53. package/build/runtime-cjs/public/cache.js +3 -0
  54. package/build/runtime-cjs/public/record.d.ts +11 -1
  55. package/build/runtime-cjs/public/record.js +8 -1
  56. package/build/runtime-cjs/public/tests/test.d.ts +9 -10
  57. package/build/runtime-esm/cache/cache.d.ts +23 -6
  58. package/build/runtime-esm/cache/cache.js +96 -22
  59. package/build/runtime-esm/cache/gc.js +9 -0
  60. package/build/runtime-esm/cache/lists.js +3 -3
  61. package/build/runtime-esm/cache/staleManager.d.ts +30 -0
  62. package/build/runtime-esm/cache/staleManager.js +71 -0
  63. package/build/runtime-esm/cache/subscription.d.ts +2 -1
  64. package/build/runtime-esm/cache/subscription.js +6 -3
  65. package/build/runtime-esm/client/documentStore.d.ts +1 -1
  66. package/build/runtime-esm/client/documentStore.js +1 -0
  67. package/build/runtime-esm/client/plugins/cache.js +5 -3
  68. package/build/runtime-esm/client/plugins/fetch.js +1 -0
  69. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  70. package/build/runtime-esm/client/plugins/fetchParams.js +6 -1
  71. package/build/runtime-esm/client/plugins/query.js +1 -1
  72. package/build/runtime-esm/client/plugins/subscription.d.ts +1 -2
  73. package/build/runtime-esm/client/plugins/subscription.js +2 -0
  74. package/build/runtime-esm/lib/config.d.ts +4 -0
  75. package/build/runtime-esm/lib/index.d.ts +1 -0
  76. package/build/runtime-esm/lib/index.js +1 -0
  77. package/build/runtime-esm/lib/key.d.ts +6 -0
  78. package/build/runtime-esm/lib/key.js +17 -0
  79. package/build/runtime-esm/lib/types.d.ts +4 -5
  80. package/build/runtime-esm/public/cache.d.ts +8 -1
  81. package/build/runtime-esm/public/cache.js +3 -0
  82. package/build/runtime-esm/public/record.d.ts +11 -1
  83. package/build/runtime-esm/public/record.js +8 -1
  84. package/build/runtime-esm/public/tests/test.d.ts +9 -10
  85. package/build/test-cjs/index.js +930 -788
  86. package/build/test-esm/index.js +930 -788
  87. package/build/vite-cjs/index.js +1232 -1039
  88. package/build/vite-esm/index.js +1232 -1039
  89. package/package.json +3 -2
@@ -4,9 +4,10 @@ import { GarbageCollector } from './gc';
4
4
  import type { ListCollection } from './lists';
5
5
  import { ListManager } from './lists';
6
6
  import { SchemaManager } from './schema';
7
+ import { StaleManager } from './staleManager';
7
8
  import type { Layer, LayerID } from './storage';
8
9
  import { InMemoryStorage } from './storage';
9
- import { type FieldSelection, InMemorySubscriptions } from './subscription';
10
+ import { InMemorySubscriptions, type FieldSelection } from './subscription';
10
11
  export declare class Cache {
11
12
  _internal_unstable: CacheInternal;
12
13
  constructor(config?: ConfigFile);
@@ -18,19 +19,30 @@ export declare class Cache {
18
19
  variables?: {};
19
20
  parent?: string;
20
21
  layer?: LayerID | null;
21
- applyUpdates?: boolean;
22
+ applyUpdates?: string[];
22
23
  notifySubscribers?: SubscriptionSpec[];
23
24
  forceNotify?: boolean;
25
+ forceStale?: boolean;
24
26
  }): SubscriptionSpec[];
25
27
  read(...args: Parameters<CacheInternal['getSelection']>): {
26
28
  data: GraphQLObject | null;
27
29
  partial: boolean;
30
+ stale: boolean;
28
31
  };
29
32
  subscribe(spec: SubscriptionSpec, variables?: {}): void;
30
33
  unsubscribe(spec: SubscriptionSpec, variables?: {}): void;
31
34
  list(name: string, parentID?: string, allLists?: boolean): ListCollection;
32
35
  delete(id: string): void;
33
36
  setConfig(config: ConfigFile): void;
37
+ markTypeStale(type?: string, options?: {
38
+ field?: string;
39
+ when?: {};
40
+ }): void;
41
+ markRecordStale(id: string, options: {
42
+ field?: string;
43
+ when?: {};
44
+ }): void;
45
+ getFieldTime(id: string, field: string): number | null | undefined;
34
46
  }
35
47
  declare class CacheInternal {
36
48
  private _disabled;
@@ -40,17 +52,19 @@ declare class CacheInternal {
40
52
  lists: ListManager;
41
53
  cache: Cache;
42
54
  lifetimes: GarbageCollector;
55
+ staleManager: StaleManager;
43
56
  schema: SchemaManager;
44
- constructor({ storage, subscriptions, lists, cache, lifetimes, schema, }: {
57
+ constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, }: {
45
58
  storage: InMemoryStorage;
46
59
  subscriptions: InMemorySubscriptions;
47
60
  lists: ListManager;
48
61
  cache: Cache;
49
62
  lifetimes: GarbageCollector;
63
+ staleManager: StaleManager;
50
64
  schema: SchemaManager;
51
65
  });
52
66
  setConfig(config: ConfigFile): void;
53
- writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, }: {
67
+ writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, forceStale, }: {
54
68
  data: {
55
69
  [key: string]: GraphQLValue;
56
70
  };
@@ -62,8 +76,9 @@ declare class CacheInternal {
62
76
  root?: string;
63
77
  layer: Layer;
64
78
  toNotify?: FieldSelection[];
65
- applyUpdates?: boolean;
79
+ applyUpdates?: string[];
66
80
  forceNotify?: boolean;
81
+ forceStale?: boolean;
67
82
  }): FieldSelection[];
68
83
  getSelection({ selection, parent, variables, stepsFromConnection, }: {
69
84
  selection: SubscriptionSelection;
@@ -73,6 +88,7 @@ declare class CacheInternal {
73
88
  }): {
74
89
  data: GraphQLObject | null;
75
90
  partial: boolean;
91
+ stale: boolean;
76
92
  hasData: boolean;
77
93
  };
78
94
  id(type: string, data: {} | null): string | null;
@@ -87,6 +103,7 @@ declare class CacheInternal {
87
103
  }): {
88
104
  data: LinkedList<GraphQLValue>;
89
105
  partial: boolean;
106
+ stale: boolean;
90
107
  hasData: boolean;
91
108
  };
92
109
  extractNestedListIDs({ value, abstract, recordID, key, linkedType, fields, variables, applyUpdates, specs, layer, forceNotify, }: {
@@ -97,7 +114,7 @@ declare class CacheInternal {
97
114
  abstract: boolean;
98
115
  variables: {};
99
116
  specs: FieldSelection[];
100
- applyUpdates: boolean;
117
+ applyUpdates?: string[];
101
118
  fields: SubscriptionSelection;
102
119
  layer: Layer;
103
120
  forceNotify?: boolean;
@@ -0,0 +1,30 @@
1
+ import type { Cache } from './cache';
2
+ export declare class StaleManager {
3
+ #private;
4
+ cache: Cache;
5
+ private fieldsTime;
6
+ constructor(cache: Cache);
7
+ /**
8
+ * get the FieldTime info
9
+ * @param id User:1
10
+ * @param field firstName
11
+ */
12
+ getFieldTime(id: string, field: string): number | undefined | null;
13
+ /**
14
+ * set the date to a field
15
+ * @param id User:1
16
+ * @param field firstName
17
+ */
18
+ setFieldTimeToNow(id: string, field: string): void;
19
+ /**
20
+ * set null to a field (stale)
21
+ * @param id User:1
22
+ * @param field firstName
23
+ */
24
+ markFieldStale(id: string, field: string): void;
25
+ markAllStale(): void;
26
+ markRecordStale(id: string): void;
27
+ markTypeStale(type: string): void;
28
+ markTypeFieldStale(type: string, field: string, when?: {}): void;
29
+ delete(id: string, field: string): void;
30
+ }
@@ -19,10 +19,11 @@ export declare class InMemorySubscriptions {
19
19
  [key: string]: GraphQLValue;
20
20
  };
21
21
  }): void;
22
- addFieldSubscription({ id, key, selection, }: {
22
+ addFieldSubscription({ id, key, selection, type, }: {
23
23
  id: string;
24
24
  key: string;
25
25
  selection: FieldSelection;
26
+ type: string;
26
27
  }): void;
27
28
  registerList({ list, id, key, parentType, selection, filters, variables, }: {
28
29
  list: Required<Required<SubscriptionSelection>['fields'][string]>['list'];
@@ -53,7 +53,7 @@ export type ClientPluginContext = {
53
53
  forceNotify?: boolean;
54
54
  disableWrite?: boolean;
55
55
  disableRead?: boolean;
56
- applyUpdates?: boolean;
56
+ applyUpdates?: string[];
57
57
  };
58
58
  stuff: App.Stuff;
59
59
  };
@@ -5,5 +5,5 @@ export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
5
5
  export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
6
6
  text: string;
7
7
  hash: string;
8
- artifact: DocumentArtifact;
8
+ document: DocumentArtifact;
9
9
  };
@@ -1,4 +1,3 @@
1
- import type { GraphQLObject } from '../../lib/types';
2
1
  import type { ClientPluginContext } from '../documentStore';
3
2
  export declare function subscriptionPlugin(factory: SubscriptionHandler): import("../documentStore").ClientPlugin;
4
3
  export type SubscriptionHandler = (ctx: ClientPluginContext) => {
@@ -7,7 +6,7 @@ export type SubscriptionHandler = (ctx: ClientPluginContext) => {
7
6
  variables?: {};
8
7
  }, handlers: {
9
8
  next: (payload: {
10
- data?: GraphQLObject;
9
+ data?: {} | null;
11
10
  errors?: readonly {
12
11
  message: string;
13
12
  }[];
@@ -55,6 +55,10 @@ export type ConfigFile = {
55
55
  * Specifies whether or not the cache should always use partial data. For more information: https://www.houdinigraphql.com/guides/caching-data#partial-data
56
56
  */
57
57
  defaultPartial?: boolean;
58
+ /**
59
+ * Specifies after how long a data goes stale in miliseconds. (default: `undefined`)
60
+ */
61
+ defaultLifetime?: number;
58
62
  /**
59
63
  * Specifies whether mutations should append or prepend list. For more information: https://www.houdinigraphql.com/api/graphql (default: `append`)
60
64
  */
@@ -5,3 +5,4 @@ export * from './log';
5
5
  export * from './scalars';
6
6
  export * from './types';
7
7
  export * from './store';
8
+ export * from './key';
@@ -0,0 +1,6 @@
1
+ export declare const computeKey: ({ field, args }: {
2
+ field: string;
3
+ args?: {
4
+ [key: string]: any;
5
+ } | undefined;
6
+ }) => string;
@@ -71,7 +71,6 @@ export type BaseCompiledDocument = {
71
71
  rootType: string;
72
72
  input?: InputObject;
73
73
  refetch?: {
74
- update: RefetchUpdateMode;
75
74
  path: string[];
76
75
  method: 'cursor' | 'offset';
77
76
  pageSize: number;
@@ -79,9 +78,9 @@ export type BaseCompiledDocument = {
79
78
  embedded: boolean;
80
79
  targetType: string;
81
80
  paginated: boolean;
82
- direction?: 'forward' | 'backwards';
81
+ direction: 'forward' | 'backward' | 'both';
83
82
  };
84
- pluginsData?: Record<string, any>;
83
+ plugin_data?: Record<string, any>;
85
84
  };
86
85
  export type HoudiniFetchContext = {
87
86
  variables: () => {};
@@ -135,7 +134,7 @@ export type SubscriptionSelection = {
135
134
  connection: boolean;
136
135
  type: string;
137
136
  };
138
- update?: RefetchUpdateMode;
137
+ updates?: string[];
139
138
  filters?: {
140
139
  [key: string]: {
141
140
  kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
@@ -165,7 +164,6 @@ export type SubscriptionSpec = {
165
164
  export type FetchQueryResult<_Data> = {
166
165
  result: RequestPayload<_Data | null>;
167
166
  source: DataSource | null;
168
- partial: boolean;
169
167
  };
170
168
  export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
171
169
  data: _Data | null;
@@ -174,6 +172,7 @@ export type QueryResult<_Data = GraphQLObject, _Input = Record<string, any>> = {
174
172
  }[] | null;
175
173
  fetching: boolean;
176
174
  partial: boolean;
175
+ stale: boolean;
177
176
  source: DataSource | null;
178
177
  variables: _Input | null;
179
178
  };
@@ -2,7 +2,7 @@ import type { Cache as _Cache } from '../cache/cache';
2
2
  import { type QueryArtifact } from '../lib';
3
3
  import { ListCollection } from './list';
4
4
  import { Record } from './record';
5
- import type { CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue, TypeNames, ValidLists } from './types';
5
+ import type { ArgType, CacheTypeDef, IDFields, QueryInput, QueryList, QueryValue, TypeFieldNames, TypeNames, ValidLists } from './types';
6
6
  export declare class Cache<Def extends CacheTypeDef> {
7
7
  _internal_unstable: _Cache;
8
8
  constructor(cache: _Cache);
@@ -29,4 +29,11 @@ export declare class Cache<Def extends CacheTypeDef> {
29
29
  data: QueryValue<QueryList<Def>, _Query>;
30
30
  variables?: QueryInput<QueryList<Def>, _Query>;
31
31
  }): void;
32
+ /**
33
+ * Mark some elements of the cache stale.
34
+ */
35
+ markStale<_Type extends TypeNames<Def>, _Field extends TypeFieldNames<Def, _Type>>(type?: _Type, options?: {
36
+ field?: _Field;
37
+ when?: ArgType<Def, _Type, _Field>;
38
+ }): void;
32
39
  }
@@ -1,6 +1,6 @@
1
1
  import type { FragmentArtifact } from '../lib/types';
2
2
  import type { Cache } from './cache';
3
- import type { CacheTypeDef, FragmentList, FragmentValue, FragmentVariables, ValidTypes } from './types';
3
+ import type { ArgType, CacheTypeDef, FragmentList, FragmentValue, FragmentVariables, TypeFieldNames, ValidTypes } from './types';
4
4
  export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<Def>> {
5
5
  #private;
6
6
  type: string;
@@ -26,6 +26,16 @@ export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<De
26
26
  fragment: _Fragment;
27
27
  data: FragmentValue<FragmentList<Def, Type>, _Fragment>;
28
28
  variables?: FragmentVariables<FragmentList<Def, Type>, _Fragment>;
29
+ forceStale?: boolean;
29
30
  }): void;
30
31
  delete(): void;
32
+ /**
33
+ * Mark some elements of the record stale in the cache.
34
+ * @param field
35
+ * @param when
36
+ */
37
+ markStale<Field extends TypeFieldNames<Def, Type>>({ field, when, }?: {
38
+ field?: Field;
39
+ when?: ArgType<Def, Type, Field>;
40
+ }): void;
31
41
  }
@@ -1,7 +1,7 @@
1
1
  import { type SubscriptionSelection, type FragmentArtifact, type QueryArtifact } from '../../lib';
2
2
  import { Cache } from '../cache';
3
3
  import type { Record } from '../record';
4
- type CacheTypeDef = {
4
+ export type CacheTypeDefTest = {
5
5
  types: {
6
6
  __ROOT__: {
7
7
  idFields: {};
@@ -16,23 +16,23 @@ type CacheTypeDef = {
16
16
  args: never;
17
17
  };
18
18
  viewer: {
19
- type: Record<CacheTypeDef, 'User'> | null;
19
+ type: Record<CacheTypeDefTest, 'User'> | null;
20
20
  args: never;
21
21
  };
22
22
  pets: {
23
- type: (Record<CacheTypeDef, 'Cat'> | Record<CacheTypeDef, 'User'>)[];
23
+ type: (Record<CacheTypeDefTest, 'Cat'> | Record<CacheTypeDefTest, 'User'>)[];
24
24
  args: never;
25
25
  };
26
26
  listOfLists: {
27
- type: ((Record<CacheTypeDef, 'Cat'> | Record<CacheTypeDef, 'User'> | null | (null | Record<CacheTypeDef, 'User'>)[])[] | Record<CacheTypeDef, 'Cat'> | Record<CacheTypeDef, 'User'> | null)[];
27
+ type: ((Record<CacheTypeDefTest, 'Cat'> | Record<CacheTypeDefTest, 'User'> | null | (null | Record<CacheTypeDefTest, 'User'>)[])[] | Record<CacheTypeDefTest, 'Cat'> | Record<CacheTypeDefTest, 'User'> | null)[];
28
28
  args: never;
29
29
  };
30
30
  users: {
31
- type: Record<CacheTypeDef, 'User'>[] | null;
31
+ type: Record<CacheTypeDefTest, 'User'>[] | null;
32
32
  args: never;
33
33
  };
34
34
  pet: {
35
- type: Record<CacheTypeDef, 'Cat'> | Record<CacheTypeDef, 'User'>;
35
+ type: Record<CacheTypeDefTest, 'Cat'> | Record<CacheTypeDefTest, 'User'>;
36
36
  args: never;
37
37
  };
38
38
  };
@@ -60,7 +60,7 @@ type CacheTypeDef = {
60
60
  args: never;
61
61
  };
62
62
  parent: {
63
- type: Record<CacheTypeDef, 'User'>;
63
+ type: Record<CacheTypeDefTest, 'User'>;
64
64
  args: never;
65
65
  };
66
66
  id: {
@@ -84,7 +84,7 @@ type CacheTypeDef = {
84
84
  args: never;
85
85
  };
86
86
  parent: {
87
- type: Record<CacheTypeDef, 'User'> | null;
87
+ type: Record<CacheTypeDefTest, 'User'> | null;
88
88
  args: never;
89
89
  };
90
90
  id: {
@@ -147,11 +147,10 @@ type CacheTypeDef = {
147
147
  };
148
148
  };
149
149
  };
150
- export declare const testCache: () => Cache<CacheTypeDef>;
150
+ export declare const testCache: () => Cache<CacheTypeDefTest>;
151
151
  export declare const testFragment: (selection: SubscriptionSelection) => {
152
152
  artifact: FragmentArtifact;
153
153
  };
154
154
  export declare const testQuery: (selection: SubscriptionSelection) => {
155
155
  artifact: QueryArtifact;
156
156
  };
157
- export {};
@@ -4,9 +4,10 @@ import { GarbageCollector } from './gc';
4
4
  import type { ListCollection } from './lists';
5
5
  import { ListManager } from './lists';
6
6
  import { SchemaManager } from './schema';
7
+ import { StaleManager } from './staleManager';
7
8
  import type { Layer, LayerID } from './storage';
8
9
  import { InMemoryStorage } from './storage';
9
- import { type FieldSelection, InMemorySubscriptions } from './subscription';
10
+ import { InMemorySubscriptions, type FieldSelection } from './subscription';
10
11
  export declare class Cache {
11
12
  _internal_unstable: CacheInternal;
12
13
  constructor(config?: ConfigFile);
@@ -18,19 +19,30 @@ export declare class Cache {
18
19
  variables?: {};
19
20
  parent?: string;
20
21
  layer?: LayerID | null;
21
- applyUpdates?: boolean;
22
+ applyUpdates?: string[];
22
23
  notifySubscribers?: SubscriptionSpec[];
23
24
  forceNotify?: boolean;
25
+ forceStale?: boolean;
24
26
  }): SubscriptionSpec[];
25
27
  read(...args: Parameters<CacheInternal['getSelection']>): {
26
28
  data: GraphQLObject | null;
27
29
  partial: boolean;
30
+ stale: boolean;
28
31
  };
29
32
  subscribe(spec: SubscriptionSpec, variables?: {}): void;
30
33
  unsubscribe(spec: SubscriptionSpec, variables?: {}): void;
31
34
  list(name: string, parentID?: string, allLists?: boolean): ListCollection;
32
35
  delete(id: string): void;
33
36
  setConfig(config: ConfigFile): void;
37
+ markTypeStale(type?: string, options?: {
38
+ field?: string;
39
+ when?: {};
40
+ }): void;
41
+ markRecordStale(id: string, options: {
42
+ field?: string;
43
+ when?: {};
44
+ }): void;
45
+ getFieldTime(id: string, field: string): number | null | undefined;
34
46
  }
35
47
  declare class CacheInternal {
36
48
  private _disabled;
@@ -40,17 +52,19 @@ declare class CacheInternal {
40
52
  lists: ListManager;
41
53
  cache: Cache;
42
54
  lifetimes: GarbageCollector;
55
+ staleManager: StaleManager;
43
56
  schema: SchemaManager;
44
- constructor({ storage, subscriptions, lists, cache, lifetimes, schema, }: {
57
+ constructor({ storage, subscriptions, lists, cache, lifetimes, staleManager, schema, }: {
45
58
  storage: InMemoryStorage;
46
59
  subscriptions: InMemorySubscriptions;
47
60
  lists: ListManager;
48
61
  cache: Cache;
49
62
  lifetimes: GarbageCollector;
63
+ staleManager: StaleManager;
50
64
  schema: SchemaManager;
51
65
  });
52
66
  setConfig(config: ConfigFile): void;
53
- writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, }: {
67
+ writeSelection({ data, selection, variables, parent, applyUpdates, layer, toNotify, forceNotify, forceStale, }: {
54
68
  data: {
55
69
  [key: string]: GraphQLValue;
56
70
  };
@@ -62,8 +76,9 @@ declare class CacheInternal {
62
76
  root?: string;
63
77
  layer: Layer;
64
78
  toNotify?: FieldSelection[];
65
- applyUpdates?: boolean;
79
+ applyUpdates?: string[];
66
80
  forceNotify?: boolean;
81
+ forceStale?: boolean;
67
82
  }): FieldSelection[];
68
83
  getSelection({ selection, parent, variables, stepsFromConnection, }: {
69
84
  selection: SubscriptionSelection;
@@ -73,6 +88,7 @@ declare class CacheInternal {
73
88
  }): {
74
89
  data: GraphQLObject | null;
75
90
  partial: boolean;
91
+ stale: boolean;
76
92
  hasData: boolean;
77
93
  };
78
94
  id(type: string, data: {} | null): string | null;
@@ -87,6 +103,7 @@ declare class CacheInternal {
87
103
  }): {
88
104
  data: LinkedList<GraphQLValue>;
89
105
  partial: boolean;
106
+ stale: boolean;
90
107
  hasData: boolean;
91
108
  };
92
109
  extractNestedListIDs({ value, abstract, recordID, key, linkedType, fields, variables, applyUpdates, specs, layer, forceNotify, }: {
@@ -97,7 +114,7 @@ declare class CacheInternal {
97
114
  abstract: boolean;
98
115
  variables: {};
99
116
  specs: FieldSelection[];
100
- applyUpdates: boolean;
117
+ applyUpdates?: string[];
101
118
  fields: SubscriptionSelection;
102
119
  layer: Layer;
103
120
  forceNotify?: boolean;