@isograph/react 0.0.0-main-3779371d → 0.0.0-main-adc27d88

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 (35) hide show
  1. package/dist/IsographEnvironment.d.ts +6 -1
  2. package/dist/IsographEnvironment.js +11 -1
  3. package/dist/cache.d.ts +2 -2
  4. package/dist/cache.js +66 -12
  5. package/dist/componentCache.d.ts +1 -1
  6. package/dist/componentCache.js +11 -6
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +3 -1
  9. package/dist/read.d.ts +7 -3
  10. package/dist/read.js +40 -17
  11. package/dist/useRerenderWhenEncounteredRecordChanges.d.ts +2 -0
  12. package/dist/useRerenderWhenEncounteredRecordChanges.js +14 -0
  13. package/dist/useResult.js +4 -9
  14. package/package.json +4 -4
  15. package/src/IsographEnvironment.tsx +17 -1
  16. package/src/cache.ts +78 -13
  17. package/src/componentCache.ts +24 -11
  18. package/src/index.ts +1 -0
  19. package/src/read.ts +55 -18
  20. package/src/tests/__isograph/Query/meName/entrypoint.ts +43 -0
  21. package/src/tests/__isograph/Query/meName/reader.ts +40 -0
  22. package/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts +79 -0
  23. package/src/tests/__isograph/Query/meNameSuccessor/reader.ts +67 -0
  24. package/src/tests/__isograph/Query/nodeField/entrypoint.ts +42 -0
  25. package/src/tests/__isograph/Query/nodeField/reader.ts +45 -0
  26. package/src/tests/__isograph/iso.ts +60 -0
  27. package/src/tests/garbageCollection.test.ts +130 -0
  28. package/src/tests/isograph.config.json +7 -0
  29. package/src/tests/meNameSuccessor.ts +20 -0
  30. package/src/tests/nodeQuery.ts +17 -0
  31. package/src/tests/schema.graphql +16 -0
  32. package/src/tests/tsconfig.json +21 -0
  33. package/src/useRerenderWhenEncounteredRecordChanges.ts +15 -0
  34. package/src/useResult.ts +8 -9
  35. package/tsconfig.pkg.json +2 -1
package/src/cache.ts CHANGED
@@ -10,6 +10,8 @@ import {
10
10
  StoreRecord,
11
11
  Link,
12
12
  type IsographEnvironment,
13
+ DataTypeValue,
14
+ getLink,
13
15
  } from './IsographEnvironment';
14
16
  import {
15
17
  RetainedQuery,
@@ -211,31 +213,57 @@ function normalizeData(
211
213
  encounteredIds,
212
214
  );
213
215
  if (typeof window !== 'undefined' && window.__LOG) {
214
- console.log('after normalization', { store: environment.store });
216
+ console.log('after normalization', {
217
+ store: environment.store,
218
+ encounteredIds,
219
+ });
215
220
  }
216
- callSubscriptions(environment);
221
+ callSubscriptions(environment, encounteredIds);
217
222
  return encounteredIds;
218
223
  }
219
224
 
220
225
  export function subscribe(
221
226
  environment: IsographEnvironment,
227
+ encounteredRecords: Set<DataId> | null,
222
228
  callback: () => void,
223
229
  ): () => void {
224
- environment.subscriptions.add(callback);
225
- return () => environment.subscriptions.delete(callback);
230
+ const callbackAndRecords = {
231
+ callback,
232
+ records: encounteredRecords,
233
+ };
234
+ environment.subscriptions.add(callbackAndRecords);
235
+ return () => environment.subscriptions.delete(callbackAndRecords);
226
236
  }
227
237
 
228
238
  export function onNextChange(environment: IsographEnvironment): Promise<void> {
229
239
  return new Promise((resolve) => {
230
- const unsubscribe = subscribe(environment, () => {
240
+ const unsubscribe = subscribe(environment, null, () => {
231
241
  unsubscribe();
232
242
  resolve();
233
243
  });
234
244
  });
235
245
  }
236
246
 
237
- function callSubscriptions(environment: IsographEnvironment) {
238
- environment.subscriptions.forEach((callback) => callback());
247
+ function callSubscriptions(
248
+ environment: IsographEnvironment,
249
+ recordsEncounteredWhenNormalizing: Set<DataId>,
250
+ ) {
251
+ environment.subscriptions.forEach(({ callback, records }) => {
252
+ if (records === null) {
253
+ callback();
254
+ } else if (hasOverlappingIds(recordsEncounteredWhenNormalizing, records)) {
255
+ callback();
256
+ }
257
+ });
258
+ }
259
+
260
+ function hasOverlappingIds(set1: Set<DataId>, set2: Set<DataId>): boolean {
261
+ for (const id of set1) {
262
+ if (set2.has(id)) {
263
+ return true;
264
+ }
265
+ }
266
+ return false;
239
267
  }
240
268
 
241
269
  /**
@@ -251,20 +279,22 @@ function normalizeDataIntoRecord(
251
279
  nestedRefetchQueries: RefetchQueryArtifactWrapper[],
252
280
  mutableEncounteredIds: Set<DataId>,
253
281
  ) {
254
- mutableEncounteredIds.add(targetParentRecordId);
282
+ let recordHasBeenUpdated = false;
255
283
  for (const normalizationNode of normalizationAst) {
256
284
  switch (normalizationNode.kind) {
257
285
  case 'Scalar': {
258
- normalizeScalarField(
286
+ const scalarFieldResultedInChange = normalizeScalarField(
259
287
  normalizationNode,
260
288
  networkResponseParentRecord,
261
289
  targetParentRecord,
262
290
  variables,
263
291
  );
292
+ recordHasBeenUpdated =
293
+ recordHasBeenUpdated || scalarFieldResultedInChange;
264
294
  break;
265
295
  }
266
296
  case 'Linked': {
267
- normalizeLinkedField(
297
+ const linkedFieldResultedInChange = normalizeLinkedField(
268
298
  environment,
269
299
  normalizationNode,
270
300
  networkResponseParentRecord,
@@ -274,18 +304,24 @@ function normalizeDataIntoRecord(
274
304
  nestedRefetchQueries,
275
305
  mutableEncounteredIds,
276
306
  );
307
+ recordHasBeenUpdated =
308
+ recordHasBeenUpdated || linkedFieldResultedInChange;
277
309
  break;
278
310
  }
279
311
  }
280
312
  }
313
+ if (recordHasBeenUpdated) {
314
+ mutableEncounteredIds.add(targetParentRecordId);
315
+ }
281
316
  }
282
317
 
318
+ type RecordHasBeenUpdated = boolean;
283
319
  function normalizeScalarField(
284
320
  astNode: NormalizationScalarField,
285
321
  networkResponseParentRecord: NetworkResponseObject,
286
322
  targetStoreRecord: StoreRecord,
287
323
  variables: { [index: string]: string },
288
- ) {
324
+ ): RecordHasBeenUpdated {
289
325
  const networkResponseKey = getNetworkResponseKey(astNode);
290
326
  const networkResponseData = networkResponseParentRecord[networkResponseKey];
291
327
  const parentRecordKey = getParentRecordKey(astNode, variables);
@@ -294,7 +330,9 @@ function normalizeScalarField(
294
330
  networkResponseData == null ||
295
331
  isScalarOrEmptyArray(networkResponseData)
296
332
  ) {
333
+ const existingValue = targetStoreRecord[parentRecordKey];
297
334
  targetStoreRecord[parentRecordKey] = networkResponseData;
335
+ return existingValue !== networkResponseData;
298
336
  } else {
299
337
  throw new Error('Unexpected object array when normalizing scalar');
300
338
  }
@@ -312,14 +350,15 @@ function normalizeLinkedField(
312
350
  variables: { [index: string]: string },
313
351
  nestedRefetchQueries: RefetchQueryArtifactWrapper[],
314
352
  mutableEncounteredIds: Set<DataId>,
315
- ) {
353
+ ): RecordHasBeenUpdated {
316
354
  const networkResponseKey = getNetworkResponseKey(astNode);
317
355
  const networkResponseData = networkResponseParentRecord[networkResponseKey];
318
356
  const parentRecordKey = getParentRecordKey(astNode, variables);
357
+ const existingValue = targetParentRecord[parentRecordKey];
319
358
 
320
359
  if (networkResponseData == null) {
321
360
  targetParentRecord[parentRecordKey] = null;
322
- return;
361
+ return existingValue !== null;
323
362
  }
324
363
 
325
364
  if (isScalarButNotEmptyArray(networkResponseData)) {
@@ -347,6 +386,7 @@ function normalizeLinkedField(
347
386
  dataIds.push({ __link: newStoreRecordId });
348
387
  }
349
388
  targetParentRecord[parentRecordKey] = dataIds;
389
+ return !dataIdsAreTheSame(existingValue, dataIds);
350
390
  } else {
351
391
  const newStoreRecordId = normalizeNetworkResponseObject(
352
392
  environment,
@@ -358,9 +398,34 @@ function normalizeLinkedField(
358
398
  nestedRefetchQueries,
359
399
  mutableEncounteredIds,
360
400
  );
401
+
361
402
  targetParentRecord[parentRecordKey] = {
362
403
  __link: newStoreRecordId,
363
404
  };
405
+ const link = getLink(existingValue);
406
+ return link?.__link !== newStoreRecordId;
407
+ }
408
+ }
409
+
410
+ function dataIdsAreTheSame(
411
+ existingValue: DataTypeValue,
412
+ newDataIds: Link[],
413
+ ): boolean {
414
+ if (Array.isArray(existingValue)) {
415
+ if (newDataIds.length !== existingValue.length) {
416
+ return false;
417
+ }
418
+ for (let i = 0; i < newDataIds.length; i++) {
419
+ const maybeLink = getLink(existingValue[i]);
420
+ if (maybeLink !== null) {
421
+ if (newDataIds[i].__link !== maybeLink.__link) {
422
+ return false;
423
+ }
424
+ }
425
+ }
426
+ return true;
427
+ } else {
428
+ return false;
364
429
  }
365
430
  }
366
431
 
@@ -3,10 +3,11 @@ import { RefetchQueryArtifactWrapper } from './entrypoint';
3
3
  import { IsographEnvironment, DataId } from './IsographEnvironment';
4
4
  import { readButDoNotEvaluate } from './read';
5
5
  import { ReaderArtifact } from './reader';
6
+ import { useRerenderWhenEncounteredRecordChanges } from './useRerenderWhenEncounteredRecordChanges';
6
7
 
7
8
  export function getOrCreateCachedComponent(
8
9
  environment: IsographEnvironment,
9
- root: DataId,
10
+ rootId: DataId,
10
11
  componentName: string,
11
12
  readerArtifact: ReaderArtifact<any, any>,
12
13
  variables: { [key: string]: string },
@@ -14,25 +15,37 @@ export function getOrCreateCachedComponent(
14
15
  ) {
15
16
  const cachedComponentsById = environment.componentCache;
16
17
  const stringifiedArgs = JSON.stringify(stableCopy(variables));
17
- cachedComponentsById[root] = cachedComponentsById[root] ?? {};
18
- const componentsByName = cachedComponentsById[root];
18
+ cachedComponentsById[rootId] = cachedComponentsById[rootId] ?? {};
19
+ const componentsByName = cachedComponentsById[rootId];
19
20
  componentsByName[componentName] = componentsByName[componentName] ?? {};
20
21
  const byArgs = componentsByName[componentName];
21
22
  byArgs[stringifiedArgs] =
22
23
  byArgs[stringifiedArgs] ??
23
24
  (() => {
24
25
  function Component(additionalRuntimeProps: { [key: string]: any }) {
25
- const data = readButDoNotEvaluate(environment, {
26
- kind: 'FragmentReference',
27
- readerArtifact: readerArtifact,
28
- root,
29
- variables,
30
- nestedRefetchQueries: resolverRefetchQueries,
31
- });
26
+ const { item: data, encounteredRecords } = readButDoNotEvaluate(
27
+ environment,
28
+ {
29
+ kind: 'FragmentReference',
30
+ readerArtifact: readerArtifact,
31
+ root: rootId,
32
+ variables,
33
+ nestedRefetchQueries: resolverRefetchQueries,
34
+ },
35
+ );
36
+
37
+ useRerenderWhenEncounteredRecordChanges(
38
+ environment,
39
+ encounteredRecords,
40
+ );
41
+
42
+ if (typeof window !== 'undefined' && window.__LOG) {
43
+ console.log('Component re-rendered: ' + componentName + ' ' + rootId);
44
+ }
32
45
 
33
46
  return readerArtifact.resolver(data, additionalRuntimeProps);
34
47
  }
35
- Component.displayName = `${componentName} (id: ${root}) @component`;
48
+ Component.displayName = `${componentName} (id: ${rootId}) @component`;
36
49
  return Component;
37
50
  })();
38
51
  return byArgs[stringifiedArgs];
package/src/index.ts CHANGED
@@ -58,3 +58,4 @@ export {
58
58
  ArgumentValue,
59
59
  Arguments,
60
60
  } from './util';
61
+ export { useRerenderWhenEncounteredRecordChanges } from './useRerenderWhenEncounteredRecordChanges';
package/src/read.ts CHANGED
@@ -10,35 +10,48 @@ import {
10
10
  } from './IsographEnvironment';
11
11
  import { ReaderAst } from './reader';
12
12
 
13
+ export type WithEncounteredRecords<T> = {
14
+ encounteredRecords: Set<DataId>;
15
+ item: T;
16
+ };
17
+
13
18
  export function read<TReadFromStore extends Object, TClientFieldValue>(
14
19
  environment: IsographEnvironment,
15
20
  fragmentReference: FragmentReference<TReadFromStore, TClientFieldValue>,
16
- ): TClientFieldValue {
21
+ ): WithEncounteredRecords<TClientFieldValue> {
17
22
  const variant = fragmentReference.readerArtifact.variant;
18
23
  if (variant.kind === 'Eager') {
24
+ const mutableEncounteredRecords = new Set<DataId>();
19
25
  const data = readData(
20
26
  environment,
21
27
  fragmentReference.readerArtifact.readerAst,
22
28
  fragmentReference.root,
23
29
  fragmentReference.variables ?? {},
24
30
  fragmentReference.nestedRefetchQueries,
31
+ mutableEncounteredRecords,
25
32
  );
26
33
  if (data.kind === 'MissingData') {
27
34
  throw onNextChange(environment);
28
35
  } else {
29
- // @ts-expect-error This not properly typed yet
30
- return fragmentReference.readerArtifact.resolver(data.data);
36
+ return {
37
+ encounteredRecords: mutableEncounteredRecords,
38
+ // @ts-expect-error This not properly typed yet
39
+ item: fragmentReference.readerArtifact.resolver(data.data),
40
+ };
31
41
  }
32
42
  } else if (variant.kind === 'Component') {
33
- // @ts-ignore
34
- return getOrCreateCachedComponent(
35
- environment,
36
- fragmentReference.root,
37
- variant.componentName,
38
- fragmentReference.readerArtifact,
39
- fragmentReference.variables ?? {},
40
- fragmentReference.nestedRefetchQueries,
41
- );
43
+ return {
44
+ // @ts-ignore
45
+ item: getOrCreateCachedComponent(
46
+ environment,
47
+ fragmentReference.root,
48
+ variant.componentName,
49
+ fragmentReference.readerArtifact,
50
+ fragmentReference.variables ?? {},
51
+ fragmentReference.nestedRefetchQueries,
52
+ ),
53
+ encounteredRecords: new Set(),
54
+ };
42
55
  }
43
56
  // Why can't Typescript realize that this is unreachable??
44
57
  throw new Error('This is unreachable');
@@ -47,13 +60,15 @@ export function read<TReadFromStore extends Object, TClientFieldValue>(
47
60
  export function readButDoNotEvaluate<TReadFromStore extends Object>(
48
61
  environment: IsographEnvironment,
49
62
  reference: FragmentReference<TReadFromStore, unknown>,
50
- ): TReadFromStore {
63
+ ): WithEncounteredRecords<TReadFromStore> {
64
+ const mutableEncounteredRecords = new Set<DataId>();
51
65
  const response = readData(
52
66
  environment,
53
67
  reference.readerArtifact.readerAst,
54
68
  reference.root,
55
69
  reference.variables ?? {},
56
70
  reference.nestedRefetchQueries,
71
+ mutableEncounteredRecords,
57
72
  );
58
73
  if (typeof window !== 'undefined' && window.__LOG) {
59
74
  console.log('done reading', { response });
@@ -61,7 +76,10 @@ export function readButDoNotEvaluate<TReadFromStore extends Object>(
61
76
  if (response.kind === 'MissingData') {
62
77
  throw onNextChange(environment);
63
78
  } else {
64
- return response.data;
79
+ return {
80
+ encounteredRecords: mutableEncounteredRecords,
81
+ item: response.data,
82
+ };
65
83
  }
66
84
  }
67
85
 
@@ -69,6 +87,7 @@ type ReadDataResult<TReadFromStore> =
69
87
  | {
70
88
  kind: 'Success';
71
89
  data: TReadFromStore;
90
+ encounteredRecords: Set<DataId>;
72
91
  }
73
92
  | {
74
93
  kind: 'MissingData';
@@ -82,14 +101,23 @@ function readData<TReadFromStore>(
82
101
  root: DataId,
83
102
  variables: { [index: string]: string },
84
103
  nestedRefetchQueries: RefetchQueryArtifactWrapper[],
104
+ mutableEncounteredRecords: Set<DataId>,
85
105
  ): ReadDataResult<TReadFromStore> {
106
+ mutableEncounteredRecords.add(root);
86
107
  let storeRecord = environment.store[root];
87
108
  if (storeRecord === undefined) {
88
- return { kind: 'MissingData', reason: 'No record for root ' + root };
109
+ return {
110
+ kind: 'MissingData',
111
+ reason: 'No record for root ' + root,
112
+ };
89
113
  }
90
114
 
91
115
  if (storeRecord === null) {
92
- return { kind: 'Success', data: null as any };
116
+ return {
117
+ kind: 'Success',
118
+ data: null as any,
119
+ encounteredRecords: mutableEncounteredRecords,
120
+ };
93
121
  }
94
122
 
95
123
  let target: { [index: string]: any } = {};
@@ -138,6 +166,7 @@ function readData<TReadFromStore>(
138
166
  link.__link,
139
167
  variables,
140
168
  nestedRefetchQueries,
169
+ mutableEncounteredRecords,
141
170
  );
142
171
  if (result.kind === 'MissingData') {
143
172
  return {
@@ -194,6 +223,7 @@ function readData<TReadFromStore>(
194
223
  targetId,
195
224
  variables,
196
225
  nestedRefetchQueries,
226
+ mutableEncounteredRecords,
197
227
  );
198
228
  if (data.kind === 'MissingData') {
199
229
  return {
@@ -213,6 +243,7 @@ function readData<TReadFromStore>(
213
243
  variables,
214
244
  // Refetch fields just read the id, and don't need refetch query artifacts
215
245
  [],
246
+ mutableEncounteredRecords,
216
247
  );
217
248
  if (typeof window !== 'undefined' && window.__LOG) {
218
249
  console.log('refetch field data', data, field);
@@ -253,8 +284,9 @@ function readData<TReadFromStore>(
253
284
  field.readerArtifact.readerAst,
254
285
  root,
255
286
  variables,
256
- // Refetch fields just read the id, and don't need refetch query artifacts
287
+ // Mutation don't need refetch query artifacts
257
288
  [],
289
+ mutableEncounteredRecords,
258
290
  );
259
291
  if (typeof window !== 'undefined' && window.__LOG) {
260
292
  console.log('refetch field data', data, field);
@@ -298,6 +330,7 @@ function readData<TReadFromStore>(
298
330
  root,
299
331
  variables,
300
332
  resolverRefetchQueries,
333
+ mutableEncounteredRecords,
301
334
  );
302
335
  if (data.kind === 'MissingData') {
303
336
  return {
@@ -323,7 +356,11 @@ function readData<TReadFromStore>(
323
356
  }
324
357
  }
325
358
  }
326
- return { kind: 'Success', data: target as any };
359
+ return {
360
+ kind: 'Success',
361
+ data: target as any,
362
+ encounteredRecords: mutableEncounteredRecords,
363
+ };
327
364
  }
328
365
 
329
366
  function filterVariables(
@@ -0,0 +1,43 @@
1
+ import type {IsographEntrypoint, NormalizationAst, RefetchQueryArtifactWrapper} from '@isograph/react';
2
+ import type {Query__meName__param, Query__meName__outputType} from './reader';
3
+ import readerResolver from './reader';
4
+ const nestedRefetchQueries: RefetchQueryArtifactWrapper[] = [];
5
+
6
+ const queryText = 'query meName {\
7
+ me {\
8
+ id,\
9
+ name,\
10
+ },\
11
+ }';
12
+
13
+ const normalizationAst: NormalizationAst = [
14
+ {
15
+ kind: "Linked",
16
+ fieldName: "me",
17
+ arguments: null,
18
+ selections: [
19
+ {
20
+ kind: "Scalar",
21
+ fieldName: "id",
22
+ arguments: null,
23
+ },
24
+ {
25
+ kind: "Scalar",
26
+ fieldName: "name",
27
+ arguments: null,
28
+ },
29
+ ],
30
+ },
31
+ ];
32
+ const artifact: IsographEntrypoint<
33
+ Query__meName__param,
34
+ Query__meName__outputType
35
+ > = {
36
+ kind: "Entrypoint",
37
+ queryText,
38
+ normalizationAst,
39
+ nestedRefetchQueries,
40
+ readerArtifact: readerResolver,
41
+ };
42
+
43
+ export default artifact;
@@ -0,0 +1,40 @@
1
+ import type {ReaderArtifact, ReaderAst, ExtractSecondParam} from '@isograph/react';
2
+ import { meNameField as resolver } from '../../../garbageCollection.test.ts';
3
+
4
+ // the type, when read out (either via useLazyReference or via graph)
5
+ export type Query__meName__outputType = ReturnType<typeof resolver>;
6
+
7
+ const readerAst: ReaderAst<Query__meName__param> = [
8
+ {
9
+ kind: "Linked",
10
+ fieldName: "me",
11
+ alias: null,
12
+ arguments: null,
13
+ selections: [
14
+ {
15
+ kind: "Scalar",
16
+ fieldName: "name",
17
+ alias: null,
18
+ arguments: null,
19
+ },
20
+ ],
21
+ },
22
+ ];
23
+
24
+ export type Query__meName__param = {
25
+ me: {
26
+ name: string,
27
+ },
28
+ };
29
+
30
+ const artifact: ReaderArtifact<
31
+ Query__meName__param,
32
+ Query__meName__outputType
33
+ > = {
34
+ kind: "ReaderArtifact",
35
+ resolver: resolver as any,
36
+ readerAst,
37
+ variant: { kind: "Eager" },
38
+ };
39
+
40
+ export default artifact;
@@ -0,0 +1,79 @@
1
+ import type {IsographEntrypoint, NormalizationAst, RefetchQueryArtifactWrapper} from '@isograph/react';
2
+ import type {Query__meNameSuccessor__param, Query__meNameSuccessor__outputType} from './reader';
3
+ import readerResolver from './reader';
4
+ const nestedRefetchQueries: RefetchQueryArtifactWrapper[] = [];
5
+
6
+ const queryText = 'query meNameSuccessor {\
7
+ me {\
8
+ id,\
9
+ name,\
10
+ successor {\
11
+ id,\
12
+ successor {\
13
+ id,\
14
+ name,\
15
+ },\
16
+ },\
17
+ },\
18
+ }';
19
+
20
+ const normalizationAst: NormalizationAst = [
21
+ {
22
+ kind: "Linked",
23
+ fieldName: "me",
24
+ arguments: null,
25
+ selections: [
26
+ {
27
+ kind: "Scalar",
28
+ fieldName: "id",
29
+ arguments: null,
30
+ },
31
+ {
32
+ kind: "Scalar",
33
+ fieldName: "name",
34
+ arguments: null,
35
+ },
36
+ {
37
+ kind: "Linked",
38
+ fieldName: "successor",
39
+ arguments: null,
40
+ selections: [
41
+ {
42
+ kind: "Scalar",
43
+ fieldName: "id",
44
+ arguments: null,
45
+ },
46
+ {
47
+ kind: "Linked",
48
+ fieldName: "successor",
49
+ arguments: null,
50
+ selections: [
51
+ {
52
+ kind: "Scalar",
53
+ fieldName: "id",
54
+ arguments: null,
55
+ },
56
+ {
57
+ kind: "Scalar",
58
+ fieldName: "name",
59
+ arguments: null,
60
+ },
61
+ ],
62
+ },
63
+ ],
64
+ },
65
+ ],
66
+ },
67
+ ];
68
+ const artifact: IsographEntrypoint<
69
+ Query__meNameSuccessor__param,
70
+ Query__meNameSuccessor__outputType
71
+ > = {
72
+ kind: "Entrypoint",
73
+ queryText,
74
+ normalizationAst,
75
+ nestedRefetchQueries,
76
+ readerArtifact: readerResolver,
77
+ };
78
+
79
+ export default artifact;
@@ -0,0 +1,67 @@
1
+ import type {ReaderArtifact, ReaderAst, ExtractSecondParam} from '@isograph/react';
2
+ import { meNameField as resolver } from '../../../meNameSuccessor.ts';
3
+
4
+ // the type, when read out (either via useLazyReference or via graph)
5
+ export type Query__meNameSuccessor__outputType = ReturnType<typeof resolver>;
6
+
7
+ const readerAst: ReaderAst<Query__meNameSuccessor__param> = [
8
+ {
9
+ kind: "Linked",
10
+ fieldName: "me",
11
+ alias: null,
12
+ arguments: null,
13
+ selections: [
14
+ {
15
+ kind: "Scalar",
16
+ fieldName: "name",
17
+ alias: null,
18
+ arguments: null,
19
+ },
20
+ {
21
+ kind: "Linked",
22
+ fieldName: "successor",
23
+ alias: null,
24
+ arguments: null,
25
+ selections: [
26
+ {
27
+ kind: "Linked",
28
+ fieldName: "successor",
29
+ alias: null,
30
+ arguments: null,
31
+ selections: [
32
+ {
33
+ kind: "Scalar",
34
+ fieldName: "name",
35
+ alias: null,
36
+ arguments: null,
37
+ },
38
+ ],
39
+ },
40
+ ],
41
+ },
42
+ ],
43
+ },
44
+ ];
45
+
46
+ export type Query__meNameSuccessor__param = {
47
+ me: {
48
+ name: string,
49
+ successor: ({
50
+ successor: ({
51
+ name: string,
52
+ } | null),
53
+ } | null),
54
+ },
55
+ };
56
+
57
+ const artifact: ReaderArtifact<
58
+ Query__meNameSuccessor__param,
59
+ Query__meNameSuccessor__outputType
60
+ > = {
61
+ kind: "ReaderArtifact",
62
+ resolver: resolver as any,
63
+ readerAst,
64
+ variant: { kind: "Eager" },
65
+ };
66
+
67
+ export default artifact;