@isograph/react 0.1.1 → 0.3.0
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.
- package/dist/core/FragmentReference.d.ts +25 -0
- package/dist/core/FragmentReference.d.ts.map +1 -0
- package/dist/core/FragmentReference.js +16 -0
- package/dist/core/IsographEnvironment.d.ts +89 -0
- package/dist/core/IsographEnvironment.d.ts.map +1 -0
- package/dist/core/IsographEnvironment.js +65 -0
- package/dist/core/PromiseWrapper.d.ts +28 -0
- package/dist/core/PromiseWrapper.d.ts.map +1 -0
- package/dist/core/PromiseWrapper.js +57 -0
- package/dist/core/areEqualWithDeepComparison.d.ts +5 -0
- package/dist/core/areEqualWithDeepComparison.d.ts.map +1 -0
- package/dist/core/areEqualWithDeepComparison.js +95 -0
- package/dist/core/cache.d.ts +44 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +514 -0
- package/dist/core/check.d.ts +18 -0
- package/dist/core/check.d.ts.map +1 -0
- package/dist/core/check.js +127 -0
- package/dist/core/componentCache.d.ts +5 -0
- package/dist/core/componentCache.d.ts.map +1 -0
- package/dist/core/componentCache.js +38 -0
- package/dist/core/entrypoint.d.ts +69 -0
- package/dist/core/entrypoint.d.ts.map +1 -0
- package/dist/core/entrypoint.js +7 -0
- package/dist/core/garbageCollection.d.ts +13 -0
- package/dist/core/garbageCollection.d.ts.map +1 -0
- package/dist/core/garbageCollection.js +107 -0
- package/dist/core/logging.d.ts +69 -0
- package/dist/core/logging.d.ts.map +1 -0
- package/dist/core/logging.js +19 -0
- package/dist/core/makeNetworkRequest.d.ts +9 -0
- package/dist/core/makeNetworkRequest.d.ts.map +1 -0
- package/dist/core/makeNetworkRequest.js +118 -0
- package/dist/core/read.d.ts +27 -0
- package/dist/core/read.d.ts.map +1 -0
- package/dist/core/read.js +478 -0
- package/dist/core/reader.d.ts +87 -0
- package/dist/core/reader.d.ts.map +1 -0
- package/dist/core/reader.js +2 -0
- package/dist/core/util.d.ts +19 -0
- package/dist/core/util.d.ts.map +1 -0
- package/dist/core/util.js +2 -0
- package/dist/index.d.ts +26 -120
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -306
- package/dist/loadable-hooks/useClientSideDefer.d.ts +16 -0
- package/dist/loadable-hooks/useClientSideDefer.d.ts.map +1 -0
- package/dist/loadable-hooks/useClientSideDefer.js +13 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts +34 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts.map +1 -0
- package/dist/loadable-hooks/useConnectionSpecPagination.js +160 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.d.ts +6 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.d.ts.map +1 -0
- package/dist/loadable-hooks/useImperativeExposedMutationField.js +14 -0
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts +17 -0
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts.map +1 -0
- package/dist/loadable-hooks/useImperativeLoadableField.js +14 -0
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts +27 -0
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts.map +1 -0
- package/dist/loadable-hooks/useSkipLimitPagination.js +162 -0
- package/dist/react/FragmentReader.d.ts +16 -0
- package/dist/react/FragmentReader.d.ts.map +1 -0
- package/dist/{EntrypointReader.js → react/FragmentReader.js} +7 -5
- package/dist/react/IsographEnvironmentProvider.d.ts +11 -0
- package/dist/react/IsographEnvironmentProvider.d.ts.map +1 -0
- package/dist/{IsographEnvironment.js → react/IsographEnvironmentProvider.js} +4 -22
- package/dist/react/RenderAfterCommit__DO_NOT_USE.d.ts +10 -0
- package/dist/react/RenderAfterCommit__DO_NOT_USE.d.ts.map +1 -0
- package/dist/react/RenderAfterCommit__DO_NOT_USE.js +15 -0
- package/dist/react/useImperativeReference.d.ts +12 -0
- package/dist/react/useImperativeReference.d.ts.map +1 -0
- package/dist/react/useImperativeReference.js +35 -0
- package/dist/react/useLazyReference.d.ts +10 -0
- package/dist/react/useLazyReference.d.ts.map +1 -0
- package/dist/react/useLazyReference.js +21 -0
- package/dist/react/useReadAndSubscribe.d.ts +20 -0
- package/dist/react/useReadAndSubscribe.d.ts.map +1 -0
- package/dist/react/useReadAndSubscribe.js +40 -0
- package/dist/react/useRerenderOnChange.d.ts +8 -0
- package/dist/react/useRerenderOnChange.d.ts.map +1 -0
- package/dist/react/useRerenderOnChange.js +22 -0
- package/dist/react/useResult.d.ts +9 -0
- package/dist/react/useResult.d.ts.map +1 -0
- package/dist/react/useResult.js +39 -0
- package/docs/how-useLazyReference-works.md +117 -0
- package/isograph.config.json +7 -0
- package/package.json +18 -9
- package/schema.graphql +17 -0
- package/src/core/FragmentReference.ts +49 -0
- package/src/core/IsographEnvironment.ts +192 -0
- package/src/core/PromiseWrapper.ts +86 -0
- package/src/core/areEqualWithDeepComparison.ts +112 -0
- package/src/core/cache.ts +835 -0
- package/src/core/check.ts +207 -0
- package/src/core/componentCache.ts +62 -0
- package/src/core/entrypoint.ts +106 -0
- package/src/core/garbageCollection.ts +173 -0
- package/src/core/logging.ts +116 -0
- package/src/core/makeNetworkRequest.ts +175 -0
- package/src/core/read.ts +722 -0
- package/src/core/reader.ts +160 -0
- package/src/core/util.ts +27 -0
- package/src/index.ts +99 -0
- package/src/loadable-hooks/useClientSideDefer.ts +58 -0
- package/src/loadable-hooks/useConnectionSpecPagination.ts +331 -0
- package/src/loadable-hooks/useImperativeExposedMutationField.ts +17 -0
- package/src/loadable-hooks/useImperativeLoadableField.ts +52 -0
- package/src/loadable-hooks/useSkipLimitPagination.ts +352 -0
- package/src/react/FragmentReader.tsx +43 -0
- package/src/react/IsographEnvironmentProvider.tsx +33 -0
- package/src/react/RenderAfterCommit__DO_NOT_USE.tsx +17 -0
- package/src/react/useImperativeReference.ts +68 -0
- package/src/react/useLazyReference.ts +42 -0
- package/src/react/useReadAndSubscribe.ts +81 -0
- package/src/react/useRerenderOnChange.ts +38 -0
- package/src/react/useResult.ts +73 -0
- package/src/tests/__isograph/Query/meName/entrypoint.ts +52 -0
- package/src/tests/__isograph/Query/meName/output_type.ts +3 -0
- package/src/tests/__isograph/Query/meName/param_type.ts +9 -0
- package/src/tests/__isograph/Query/meName/resolver_reader.ts +33 -0
- package/src/tests/__isograph/Query/meNameSuccessor/entrypoint.ts +90 -0
- package/src/tests/__isograph/Query/meNameSuccessor/output_type.ts +3 -0
- package/src/tests/__isograph/Query/meNameSuccessor/param_type.ts +14 -0
- package/src/tests/__isograph/Query/meNameSuccessor/resolver_reader.ts +57 -0
- package/src/tests/__isograph/Query/nodeField/entrypoint.ts +57 -0
- package/src/tests/__isograph/Query/nodeField/output_type.ts +3 -0
- package/src/tests/__isograph/Query/nodeField/param_type.ts +10 -0
- package/src/tests/__isograph/Query/nodeField/parameters_type.ts +3 -0
- package/src/tests/__isograph/Query/nodeField/resolver_reader.ts +38 -0
- package/src/tests/__isograph/Query/subquery/entrypoint.ts +67 -0
- package/src/tests/__isograph/Query/subquery/output_type.ts +3 -0
- package/src/tests/__isograph/Query/subquery/param_type.ts +12 -0
- package/src/tests/__isograph/Query/subquery/parameters_type.ts +3 -0
- package/src/tests/__isograph/Query/subquery/resolver_reader.ts +47 -0
- package/src/tests/__isograph/iso.ts +99 -0
- package/src/tests/garbageCollection.test.ts +142 -0
- package/src/tests/meNameSuccessor.ts +25 -0
- package/src/tests/nodeQuery.ts +19 -0
- package/src/tests/normalizeData.test.ts +120 -0
- package/src/tests/tsconfig.json +21 -0
- package/tsconfig.json +6 -0
- package/tsconfig.pkg.json +7 -1
- package/vitest.config.ts +20 -0
- package/dist/EntrypointReader.d.ts +0 -6
- package/dist/IsographEnvironment.d.ts +0 -56
- package/dist/PromiseWrapper.d.ts +0 -13
- package/dist/PromiseWrapper.js +0 -22
- package/dist/cache.d.ts +0 -26
- package/dist/cache.js +0 -274
- package/dist/componentCache.d.ts +0 -6
- package/dist/componentCache.js +0 -31
- package/dist/useImperativeReference.d.ts +0 -8
- package/dist/useImperativeReference.js +0 -28
- package/src/EntrypointReader.tsx +0 -20
- package/src/IsographEnvironment.tsx +0 -120
- package/src/PromiseWrapper.ts +0 -29
- package/src/cache.tsx +0 -484
- package/src/componentCache.ts +0 -41
- package/src/index.tsx +0 -617
- package/src/useImperativeReference.ts +0 -58
@@ -0,0 +1,38 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
import { subscribe } from '../core/cache';
|
3
|
+
import { WithEncounteredRecords } from '../core/read';
|
4
|
+
import { FragmentReference } from '../core/FragmentReference';
|
5
|
+
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
6
|
+
import type { ReaderAst } from '../core/reader';
|
7
|
+
|
8
|
+
// TODO add unit tests for this. Add integration tests that test
|
9
|
+
// behavior when the encounteredRecords underneath a fragment change.
|
10
|
+
export function useRerenderOnChange<
|
11
|
+
TReadFromStore extends { parameters: object; data: object },
|
12
|
+
>(
|
13
|
+
encounteredDataAndRecords: WithEncounteredRecords<TReadFromStore>,
|
14
|
+
fragmentReference: FragmentReference<any, any>,
|
15
|
+
setEncounteredDataAndRecords: (
|
16
|
+
data: WithEncounteredRecords<TReadFromStore>,
|
17
|
+
) => void,
|
18
|
+
readerAst: ReaderAst<TReadFromStore>,
|
19
|
+
) {
|
20
|
+
const environment = useIsographEnvironment();
|
21
|
+
useEffect(() => {
|
22
|
+
return subscribe(
|
23
|
+
environment,
|
24
|
+
encounteredDataAndRecords,
|
25
|
+
fragmentReference,
|
26
|
+
(newEncounteredDataAndRecords) => {
|
27
|
+
setEncounteredDataAndRecords(newEncounteredDataAndRecords);
|
28
|
+
},
|
29
|
+
readerAst,
|
30
|
+
);
|
31
|
+
// Note: this is an empty array on purpose:
|
32
|
+
// - the fragment reference is stable for the life of the component
|
33
|
+
// - ownership of encounteredDataAndRecords is transferred into the
|
34
|
+
// environment
|
35
|
+
// - though maybe we need to include setEncounteredDataAndRecords in
|
36
|
+
// the dependency array
|
37
|
+
}, []);
|
38
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
2
|
+
import { FragmentReference } from '../core/FragmentReference';
|
3
|
+
import { getOrCreateCachedComponent } from '../core/componentCache';
|
4
|
+
import { useReadAndSubscribe } from './useReadAndSubscribe';
|
5
|
+
import {
|
6
|
+
getNetworkRequestOptionsWithDefaults,
|
7
|
+
NetworkRequestReaderOptions,
|
8
|
+
} from '../core/read';
|
9
|
+
import {
|
10
|
+
getPromiseState,
|
11
|
+
PromiseWrapper,
|
12
|
+
readPromise,
|
13
|
+
} from '../core/PromiseWrapper';
|
14
|
+
|
15
|
+
export function useResult<
|
16
|
+
TReadFromStore extends { parameters: object; data: object },
|
17
|
+
TClientFieldValue,
|
18
|
+
>(
|
19
|
+
fragmentReference: FragmentReference<TReadFromStore, TClientFieldValue>,
|
20
|
+
partialNetworkRequestOptions?: Partial<NetworkRequestReaderOptions> | void,
|
21
|
+
): TClientFieldValue {
|
22
|
+
const environment = useIsographEnvironment();
|
23
|
+
const networkRequestOptions = getNetworkRequestOptionsWithDefaults(
|
24
|
+
partialNetworkRequestOptions,
|
25
|
+
);
|
26
|
+
|
27
|
+
maybeUnwrapNetworkRequest(
|
28
|
+
fragmentReference.networkRequest,
|
29
|
+
networkRequestOptions,
|
30
|
+
);
|
31
|
+
const readerWithRefetchQueries = readPromise(
|
32
|
+
fragmentReference.readerWithRefetchQueries,
|
33
|
+
);
|
34
|
+
|
35
|
+
switch (readerWithRefetchQueries.readerArtifact.kind) {
|
36
|
+
case 'ComponentReaderArtifact': {
|
37
|
+
// @ts-expect-error
|
38
|
+
return getOrCreateCachedComponent(
|
39
|
+
environment,
|
40
|
+
readerWithRefetchQueries.readerArtifact.componentName,
|
41
|
+
fragmentReference,
|
42
|
+
networkRequestOptions,
|
43
|
+
);
|
44
|
+
}
|
45
|
+
case 'EagerReaderArtifact': {
|
46
|
+
const data = useReadAndSubscribe(
|
47
|
+
fragmentReference,
|
48
|
+
networkRequestOptions,
|
49
|
+
readerWithRefetchQueries.readerArtifact.readerAst,
|
50
|
+
);
|
51
|
+
const param = {
|
52
|
+
data: data,
|
53
|
+
parameters: fragmentReference.variables,
|
54
|
+
};
|
55
|
+
return readerWithRefetchQueries.readerArtifact.resolver(param);
|
56
|
+
}
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
export function maybeUnwrapNetworkRequest(
|
61
|
+
networkRequest: PromiseWrapper<void, any>,
|
62
|
+
networkRequestOptions: NetworkRequestReaderOptions,
|
63
|
+
) {
|
64
|
+
const state = getPromiseState(networkRequest);
|
65
|
+
if (state.kind === 'Err' && networkRequestOptions.throwOnNetworkError) {
|
66
|
+
throw state.error;
|
67
|
+
} else if (
|
68
|
+
state.kind === 'Pending' &&
|
69
|
+
networkRequestOptions.suspendIfInFlight
|
70
|
+
) {
|
71
|
+
throw state.promise;
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import type {IsographEntrypoint, NormalizationAst, RefetchQueryNormalizationArtifactWrapper} from '@isograph/react';
|
2
|
+
import {Query__meName__param} from './param_type';
|
3
|
+
import {Query__meName__output_type} from './output_type';
|
4
|
+
import readerResolver from './resolver_reader';
|
5
|
+
const nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[] = [];
|
6
|
+
|
7
|
+
const queryText = 'query meName {\
|
8
|
+
me {\
|
9
|
+
id,\
|
10
|
+
name,\
|
11
|
+
},\
|
12
|
+
}';
|
13
|
+
|
14
|
+
const normalizationAst: NormalizationAst = [
|
15
|
+
{
|
16
|
+
kind: "Linked",
|
17
|
+
fieldName: "me",
|
18
|
+
arguments: null,
|
19
|
+
concreteType: "Economist",
|
20
|
+
selections: [
|
21
|
+
{
|
22
|
+
kind: "Scalar",
|
23
|
+
fieldName: "id",
|
24
|
+
arguments: null,
|
25
|
+
},
|
26
|
+
{
|
27
|
+
kind: "Scalar",
|
28
|
+
fieldName: "name",
|
29
|
+
arguments: null,
|
30
|
+
},
|
31
|
+
],
|
32
|
+
},
|
33
|
+
];
|
34
|
+
const artifact: IsographEntrypoint<
|
35
|
+
Query__meName__param,
|
36
|
+
Query__meName__output_type
|
37
|
+
> = {
|
38
|
+
kind: "Entrypoint",
|
39
|
+
networkRequestInfo: {
|
40
|
+
kind: "NetworkRequestInfo",
|
41
|
+
queryText,
|
42
|
+
normalizationAst,
|
43
|
+
},
|
44
|
+
concreteType: "Query",
|
45
|
+
readerWithRefetchQueries: {
|
46
|
+
kind: "ReaderWithRefetchQueries",
|
47
|
+
nestedRefetchQueries,
|
48
|
+
readerArtifact: readerResolver,
|
49
|
+
},
|
50
|
+
};
|
51
|
+
|
52
|
+
export default artifact;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { EagerReaderArtifact, ReaderAst } from '@isograph/react';
|
2
|
+
import { Query__meName__param } from './param_type';
|
3
|
+
import { Query__meName__output_type } from './output_type';
|
4
|
+
import { meNameField as resolver } from '../../../garbageCollection.test';
|
5
|
+
|
6
|
+
const readerAst: ReaderAst<Query__meName__param> = [
|
7
|
+
{
|
8
|
+
kind: "Linked",
|
9
|
+
fieldName: "me",
|
10
|
+
alias: null,
|
11
|
+
arguments: null,
|
12
|
+
condition: null,
|
13
|
+
selections: [
|
14
|
+
{
|
15
|
+
kind: "Scalar",
|
16
|
+
fieldName: "name",
|
17
|
+
alias: null,
|
18
|
+
arguments: null,
|
19
|
+
},
|
20
|
+
],
|
21
|
+
},
|
22
|
+
];
|
23
|
+
|
24
|
+
const artifact: EagerReaderArtifact<
|
25
|
+
Query__meName__param,
|
26
|
+
Query__meName__output_type
|
27
|
+
> = {
|
28
|
+
kind: "EagerReaderArtifact",
|
29
|
+
resolver,
|
30
|
+
readerAst,
|
31
|
+
};
|
32
|
+
|
33
|
+
export default artifact;
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import type {IsographEntrypoint, NormalizationAst, RefetchQueryNormalizationArtifactWrapper} from '@isograph/react';
|
2
|
+
import {Query__meNameSuccessor__param} from './param_type';
|
3
|
+
import {Query__meNameSuccessor__output_type} from './output_type';
|
4
|
+
import readerResolver from './resolver_reader';
|
5
|
+
const nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[] = [];
|
6
|
+
|
7
|
+
const queryText = 'query meNameSuccessor {\
|
8
|
+
me {\
|
9
|
+
id,\
|
10
|
+
name,\
|
11
|
+
successor {\
|
12
|
+
id,\
|
13
|
+
successor {\
|
14
|
+
id,\
|
15
|
+
name,\
|
16
|
+
},\
|
17
|
+
},\
|
18
|
+
},\
|
19
|
+
}';
|
20
|
+
|
21
|
+
const normalizationAst: NormalizationAst = [
|
22
|
+
{
|
23
|
+
kind: "Linked",
|
24
|
+
fieldName: "me",
|
25
|
+
arguments: null,
|
26
|
+
concreteType: "Economist",
|
27
|
+
selections: [
|
28
|
+
{
|
29
|
+
kind: "Scalar",
|
30
|
+
fieldName: "id",
|
31
|
+
arguments: null,
|
32
|
+
},
|
33
|
+
{
|
34
|
+
kind: "Scalar",
|
35
|
+
fieldName: "name",
|
36
|
+
arguments: null,
|
37
|
+
},
|
38
|
+
{
|
39
|
+
kind: "Linked",
|
40
|
+
fieldName: "successor",
|
41
|
+
arguments: null,
|
42
|
+
concreteType: "Economist",
|
43
|
+
selections: [
|
44
|
+
{
|
45
|
+
kind: "Scalar",
|
46
|
+
fieldName: "id",
|
47
|
+
arguments: null,
|
48
|
+
},
|
49
|
+
{
|
50
|
+
kind: "Linked",
|
51
|
+
fieldName: "successor",
|
52
|
+
arguments: null,
|
53
|
+
concreteType: "Economist",
|
54
|
+
selections: [
|
55
|
+
{
|
56
|
+
kind: "Scalar",
|
57
|
+
fieldName: "id",
|
58
|
+
arguments: null,
|
59
|
+
},
|
60
|
+
{
|
61
|
+
kind: "Scalar",
|
62
|
+
fieldName: "name",
|
63
|
+
arguments: null,
|
64
|
+
},
|
65
|
+
],
|
66
|
+
},
|
67
|
+
],
|
68
|
+
},
|
69
|
+
],
|
70
|
+
},
|
71
|
+
];
|
72
|
+
const artifact: IsographEntrypoint<
|
73
|
+
Query__meNameSuccessor__param,
|
74
|
+
Query__meNameSuccessor__output_type
|
75
|
+
> = {
|
76
|
+
kind: "Entrypoint",
|
77
|
+
networkRequestInfo: {
|
78
|
+
kind: "NetworkRequestInfo",
|
79
|
+
queryText,
|
80
|
+
normalizationAst,
|
81
|
+
},
|
82
|
+
concreteType: "Query",
|
83
|
+
readerWithRefetchQueries: {
|
84
|
+
kind: "ReaderWithRefetchQueries",
|
85
|
+
nestedRefetchQueries,
|
86
|
+
readerArtifact: readerResolver,
|
87
|
+
},
|
88
|
+
};
|
89
|
+
|
90
|
+
export default artifact;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
export type Query__meNameSuccessor__param = {
|
3
|
+
readonly data: {
|
4
|
+
readonly me: {
|
5
|
+
readonly name: string,
|
6
|
+
readonly successor: ({
|
7
|
+
readonly successor: ({
|
8
|
+
readonly name: string,
|
9
|
+
} | null),
|
10
|
+
} | null),
|
11
|
+
},
|
12
|
+
},
|
13
|
+
readonly parameters: Record<PropertyKey, never>,
|
14
|
+
};
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import type { EagerReaderArtifact, ReaderAst } from '@isograph/react';
|
2
|
+
import { Query__meNameSuccessor__param } from './param_type';
|
3
|
+
import { Query__meNameSuccessor__output_type } from './output_type';
|
4
|
+
import { meNameField as resolver } from '../../../meNameSuccessor';
|
5
|
+
|
6
|
+
const readerAst: ReaderAst<Query__meNameSuccessor__param> = [
|
7
|
+
{
|
8
|
+
kind: "Linked",
|
9
|
+
fieldName: "me",
|
10
|
+
alias: null,
|
11
|
+
arguments: null,
|
12
|
+
condition: 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
|
+
condition: null,
|
26
|
+
selections: [
|
27
|
+
{
|
28
|
+
kind: "Linked",
|
29
|
+
fieldName: "successor",
|
30
|
+
alias: null,
|
31
|
+
arguments: null,
|
32
|
+
condition: null,
|
33
|
+
selections: [
|
34
|
+
{
|
35
|
+
kind: "Scalar",
|
36
|
+
fieldName: "name",
|
37
|
+
alias: null,
|
38
|
+
arguments: null,
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
],
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
];
|
47
|
+
|
48
|
+
const artifact: EagerReaderArtifact<
|
49
|
+
Query__meNameSuccessor__param,
|
50
|
+
Query__meNameSuccessor__output_type
|
51
|
+
> = {
|
52
|
+
kind: "EagerReaderArtifact",
|
53
|
+
resolver,
|
54
|
+
readerAst,
|
55
|
+
};
|
56
|
+
|
57
|
+
export default artifact;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import type {IsographEntrypoint, NormalizationAst, RefetchQueryNormalizationArtifactWrapper} from '@isograph/react';
|
2
|
+
import {Query__nodeField__param} from './param_type';
|
3
|
+
import {Query__nodeField__output_type} from './output_type';
|
4
|
+
import readerResolver from './resolver_reader';
|
5
|
+
const nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[] = [];
|
6
|
+
|
7
|
+
const queryText = 'query nodeField ($id: ID!) {\
|
8
|
+
node____id___v_id: node(id: $id) {\
|
9
|
+
__typename,\
|
10
|
+
id,\
|
11
|
+
},\
|
12
|
+
}';
|
13
|
+
|
14
|
+
const normalizationAst: NormalizationAst = [
|
15
|
+
{
|
16
|
+
kind: "Linked",
|
17
|
+
fieldName: "node",
|
18
|
+
arguments: [
|
19
|
+
[
|
20
|
+
"id",
|
21
|
+
{ kind: "Variable", name: "id" },
|
22
|
+
],
|
23
|
+
],
|
24
|
+
concreteType: null,
|
25
|
+
selections: [
|
26
|
+
{
|
27
|
+
kind: "Scalar",
|
28
|
+
fieldName: "__typename",
|
29
|
+
arguments: null,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
kind: "Scalar",
|
33
|
+
fieldName: "id",
|
34
|
+
arguments: null,
|
35
|
+
},
|
36
|
+
],
|
37
|
+
},
|
38
|
+
];
|
39
|
+
const artifact: IsographEntrypoint<
|
40
|
+
Query__nodeField__param,
|
41
|
+
Query__nodeField__output_type
|
42
|
+
> = {
|
43
|
+
kind: "Entrypoint",
|
44
|
+
networkRequestInfo: {
|
45
|
+
kind: "NetworkRequestInfo",
|
46
|
+
queryText,
|
47
|
+
normalizationAst,
|
48
|
+
},
|
49
|
+
concreteType: "Query",
|
50
|
+
readerWithRefetchQueries: {
|
51
|
+
kind: "ReaderWithRefetchQueries",
|
52
|
+
nestedRefetchQueries,
|
53
|
+
readerArtifact: readerResolver,
|
54
|
+
},
|
55
|
+
};
|
56
|
+
|
57
|
+
export default artifact;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { EagerReaderArtifact, ReaderAst } from '@isograph/react';
|
2
|
+
import { Query__nodeField__param } from './param_type';
|
3
|
+
import { Query__nodeField__output_type } from './output_type';
|
4
|
+
import { nodeField as resolver } from '../../../nodeQuery';
|
5
|
+
|
6
|
+
const readerAst: ReaderAst<Query__nodeField__param> = [
|
7
|
+
{
|
8
|
+
kind: "Linked",
|
9
|
+
fieldName: "node",
|
10
|
+
alias: null,
|
11
|
+
arguments: [
|
12
|
+
[
|
13
|
+
"id",
|
14
|
+
{ kind: "Variable", name: "id" },
|
15
|
+
],
|
16
|
+
],
|
17
|
+
condition: null,
|
18
|
+
selections: [
|
19
|
+
{
|
20
|
+
kind: "Scalar",
|
21
|
+
fieldName: "id",
|
22
|
+
alias: null,
|
23
|
+
arguments: null,
|
24
|
+
},
|
25
|
+
],
|
26
|
+
},
|
27
|
+
];
|
28
|
+
|
29
|
+
const artifact: EagerReaderArtifact<
|
30
|
+
Query__nodeField__param,
|
31
|
+
Query__nodeField__output_type
|
32
|
+
> = {
|
33
|
+
kind: "EagerReaderArtifact",
|
34
|
+
resolver,
|
35
|
+
readerAst,
|
36
|
+
};
|
37
|
+
|
38
|
+
export default artifact;
|
@@ -0,0 +1,67 @@
|
|
1
|
+
import type {IsographEntrypoint, NormalizationAst, RefetchQueryNormalizationArtifactWrapper} from '@isograph/react';
|
2
|
+
import {Query__subquery__param} from './param_type';
|
3
|
+
import {Query__subquery__output_type} from './output_type';
|
4
|
+
import readerResolver from './resolver_reader';
|
5
|
+
const nestedRefetchQueries: RefetchQueryNormalizationArtifactWrapper[] = [];
|
6
|
+
|
7
|
+
const queryText = 'query subquery ($id: ID!) {\
|
8
|
+
query {\
|
9
|
+
node____id___v_id: node(id: $id) {\
|
10
|
+
__typename,\
|
11
|
+
id,\
|
12
|
+
},\
|
13
|
+
},\
|
14
|
+
}';
|
15
|
+
|
16
|
+
const normalizationAst: NormalizationAst = [
|
17
|
+
{
|
18
|
+
kind: "Linked",
|
19
|
+
fieldName: "query",
|
20
|
+
arguments: null,
|
21
|
+
concreteType: "Query",
|
22
|
+
selections: [
|
23
|
+
{
|
24
|
+
kind: "Linked",
|
25
|
+
fieldName: "node",
|
26
|
+
arguments: [
|
27
|
+
[
|
28
|
+
"id",
|
29
|
+
{ kind: "Variable", name: "id" },
|
30
|
+
],
|
31
|
+
],
|
32
|
+
concreteType: null,
|
33
|
+
selections: [
|
34
|
+
{
|
35
|
+
kind: "Scalar",
|
36
|
+
fieldName: "__typename",
|
37
|
+
arguments: null,
|
38
|
+
},
|
39
|
+
{
|
40
|
+
kind: "Scalar",
|
41
|
+
fieldName: "id",
|
42
|
+
arguments: null,
|
43
|
+
},
|
44
|
+
],
|
45
|
+
},
|
46
|
+
],
|
47
|
+
},
|
48
|
+
];
|
49
|
+
const artifact: IsographEntrypoint<
|
50
|
+
Query__subquery__param,
|
51
|
+
Query__subquery__output_type
|
52
|
+
> = {
|
53
|
+
kind: "Entrypoint",
|
54
|
+
networkRequestInfo: {
|
55
|
+
kind: "NetworkRequestInfo",
|
56
|
+
queryText,
|
57
|
+
normalizationAst,
|
58
|
+
},
|
59
|
+
concreteType: "Query",
|
60
|
+
readerWithRefetchQueries: {
|
61
|
+
kind: "ReaderWithRefetchQueries",
|
62
|
+
nestedRefetchQueries,
|
63
|
+
readerArtifact: readerResolver,
|
64
|
+
},
|
65
|
+
};
|
66
|
+
|
67
|
+
export default artifact;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import type { Query__subquery__parameters } from './parameters_type';
|
2
|
+
|
3
|
+
export type Query__subquery__param = {
|
4
|
+
readonly data: {
|
5
|
+
readonly query: {
|
6
|
+
readonly node: ({
|
7
|
+
readonly id: string,
|
8
|
+
} | null),
|
9
|
+
},
|
10
|
+
},
|
11
|
+
readonly parameters: Query__subquery__parameters,
|
12
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type { EagerReaderArtifact, ReaderAst } from '@isograph/react';
|
2
|
+
import { Query__subquery__param } from './param_type';
|
3
|
+
import { Query__subquery__output_type } from './output_type';
|
4
|
+
import { subquery as resolver } from '../../../normalizeData.test';
|
5
|
+
|
6
|
+
const readerAst: ReaderAst<Query__subquery__param> = [
|
7
|
+
{
|
8
|
+
kind: "Linked",
|
9
|
+
fieldName: "query",
|
10
|
+
alias: null,
|
11
|
+
arguments: null,
|
12
|
+
condition: null,
|
13
|
+
selections: [
|
14
|
+
{
|
15
|
+
kind: "Linked",
|
16
|
+
fieldName: "node",
|
17
|
+
alias: null,
|
18
|
+
arguments: [
|
19
|
+
[
|
20
|
+
"id",
|
21
|
+
{ kind: "Variable", name: "id" },
|
22
|
+
],
|
23
|
+
],
|
24
|
+
condition: null,
|
25
|
+
selections: [
|
26
|
+
{
|
27
|
+
kind: "Scalar",
|
28
|
+
fieldName: "id",
|
29
|
+
alias: null,
|
30
|
+
arguments: null,
|
31
|
+
},
|
32
|
+
],
|
33
|
+
},
|
34
|
+
],
|
35
|
+
},
|
36
|
+
];
|
37
|
+
|
38
|
+
const artifact: EagerReaderArtifact<
|
39
|
+
Query__subquery__param,
|
40
|
+
Query__subquery__output_type
|
41
|
+
> = {
|
42
|
+
kind: "EagerReaderArtifact",
|
43
|
+
resolver,
|
44
|
+
readerAst,
|
45
|
+
};
|
46
|
+
|
47
|
+
export default artifact;
|