@apollo/client 3.4.0-rc.7 → 3.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.
- package/apollo-client.cjs.js +300 -263
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -1
- package/cache/cache.cjs.js +105 -41
- package/cache/cache.cjs.js.map +1 -1
- package/cache/core/types/DataProxy.js +1 -0
- package/cache/index.d.ts +0 -1
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +3 -1
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +3 -2
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +22 -10
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +1 -0
- package/cache/inmemory/helpers.d.ts +1 -1
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +5 -1
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +24 -3
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts +3 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +12 -7
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +23 -10
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +5 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +9 -6
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.js +1 -0
- package/cache/inmemory/writeToStore.d.ts +1 -0
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +16 -7
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -0
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +2 -4
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +7 -6
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +116 -78
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +3 -6
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +3 -3
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +13 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +137 -181
- package/core/core.cjs.js.map +1 -1
- package/core/index.d.ts +0 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -2
- package/core/index.js.map +1 -1
- package/core/types.d.ts +4 -1
- package/core/types.d.ts.map +1 -1
- package/core/types.js +1 -0
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.js +1 -0
- package/errors/errors.cjs.js +2 -0
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +3 -0
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +82 -57
- package/link/context/context.cjs.js +4 -0
- package/link/context/context.cjs.js.map +1 -1
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js +4 -0
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs.js +4 -2
- package/link/core/core.cjs.js.map +1 -1
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +3 -0
- package/link/core/index.js.map +1 -1
- package/link/core/types.js +1 -0
- package/link/http/checkFetcher.js +1 -1
- package/link/http/http.cjs.js +13 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +11 -1
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs.js.map +1 -1
- package/link/utils/utils.cjs.js +1 -1
- package/link/utils/utils.cjs.js.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +20 -20
- package/react/components/Mutation.d.ts +1 -1
- package/react/components/Query.js +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/components.cjs.js +45 -31
- package/react/components/components.cjs.js.map +1 -1
- package/react/components/types.js +1 -0
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs.js +22 -8
- package/react/context/context.cjs.js.map +1 -1
- package/react/data/OperationData.js +2 -2
- package/react/data/QueryData.d.ts +1 -2
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +65 -72
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +65 -71
- package/react/data/data.cjs.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs.js +35 -18
- package/react/hoc/hoc.cjs.js.map +1 -1
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/types.js +1 -0
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs.js +56 -10
- package/react/hooks/hooks.cjs.js.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +16 -6
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.d.ts +2 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js +18 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +10 -3
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +3 -1
- package/react/index.js.map +1 -1
- package/react/parser/index.js +4 -4
- package/react/parser/parser.cjs.js +4 -4
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -2
- package/react/react.cjs.js.map +1 -1
- package/react/ssr/ssr.cjs.js +15 -1
- package/react/ssr/ssr.cjs.js.map +1 -1
- package/react/types/types.d.ts +9 -3
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js +1 -0
- package/react/types/types.js.map +1 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -0
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +68 -17
- package/testing/testing.cjs.js.map +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +1 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/global.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +2 -2
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts +2 -0
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -0
- package/utilities/common/stringifyForDisplay.js +8 -0
- package/utilities/common/stringifyForDisplay.js.map +1 -0
- package/utilities/globals/DEV.d.ts +3 -0
- package/utilities/globals/DEV.d.ts.map +1 -0
- package/utilities/globals/DEV.js +20 -0
- package/utilities/globals/DEV.js.map +1 -0
- package/utilities/globals/graphql.d.ts +1 -1
- package/utilities/globals/graphql.d.ts.map +1 -1
- package/utilities/globals/graphql.js +3 -3
- package/utilities/globals/graphql.js.map +1 -1
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +5 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +5 -5
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +3 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +5 -1
- package/utilities/index.js.map +1 -1
- package/utilities/package.json +3 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +10 -11
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/testing/index.d.ts +1 -0
- package/utilities/testing/index.d.ts.map +1 -1
- package/utilities/testing/index.js +1 -0
- package/utilities/testing/index.js.map +1 -1
- package/utilities/testing/itAsync.d.ts +5 -8
- package/utilities/testing/itAsync.d.ts.map +1 -1
- package/utilities/testing/itAsync.js +6 -7
- package/utilities/testing/itAsync.js.map +1 -1
- package/utilities/testing/mocking/mockFetch.js +2 -2
- package/utilities/testing/mocking/mockFetch.js.map +1 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +2 -8
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js +2 -2
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js +2 -2
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/testing/withConsoleSpy.d.ts +4 -0
- package/utilities/testing/withConsoleSpy.d.ts.map +1 -0
- package/utilities/testing/withConsoleSpy.js +39 -0
- package/utilities/testing/withConsoleSpy.js.map +1 -0
- package/utilities/types/IsStrictlyAny.js +1 -0
- package/utilities/utilities.cjs.js +56 -48
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/core/Reobserver.d.ts +0 -18
- package/core/Reobserver.d.ts.map +0 -1
- package/core/Reobserver.js +0 -87
- package/core/Reobserver.js.map +0 -1
- package/utilities/globals/__DEV__.d.ts +0 -3
- package/utilities/globals/__DEV__.d.ts.map +0 -1
- package/utilities/globals/__DEV__.js +0 -32
- package/utilities/globals/__DEV__.js.map +0 -1
- package/utilities/globals/process.d.ts +0 -2
- package/utilities/globals/process.d.ts.map +0 -1
- package/utilities/globals/process.js +0 -31
- package/utilities/globals/process.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apollo/client",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "A fully-featured caching GraphQL client.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"keywords": [
|
|
@@ -51,49 +51,49 @@
|
|
|
51
51
|
"optimism": "^0.16.1",
|
|
52
52
|
"prop-types": "^15.7.2",
|
|
53
53
|
"symbol-observable": "^4.0.0",
|
|
54
|
-
"ts-invariant": "^0.
|
|
55
|
-
"tslib": "^2.
|
|
56
|
-
"zen-observable-ts": "^1.
|
|
54
|
+
"ts-invariant": "^0.9.0",
|
|
55
|
+
"tslib": "^2.3.0",
|
|
56
|
+
"zen-observable-ts": "^1.1.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@babel/parser": "7.14.
|
|
59
|
+
"@babel/parser": "7.14.8",
|
|
60
60
|
"@graphql-tools/schema": "7.1.5",
|
|
61
61
|
"@rollup/plugin-node-resolve": "11.2.1",
|
|
62
|
-
"@testing-library/react": "9.
|
|
62
|
+
"@testing-library/react": "9.5.0",
|
|
63
63
|
"@types/fast-json-stable-stringify": "2.0.0",
|
|
64
|
-
"@types/fetch-mock": "7.3.
|
|
65
|
-
"@types/glob": "7.1.
|
|
64
|
+
"@types/fetch-mock": "7.3.5",
|
|
65
|
+
"@types/glob": "7.1.4",
|
|
66
66
|
"@types/hoist-non-react-statics": "3.3.1",
|
|
67
|
-
"@types/jest": "26.0.
|
|
68
|
-
"@types/lodash": "4.14.
|
|
69
|
-
"@types/node": "
|
|
70
|
-
"@types/react": "17.0.
|
|
67
|
+
"@types/jest": "26.0.24",
|
|
68
|
+
"@types/lodash": "4.14.171",
|
|
69
|
+
"@types/node": "16.4.3",
|
|
70
|
+
"@types/react": "17.0.15",
|
|
71
71
|
"@types/react-dom": "17.0.2",
|
|
72
|
-
"@types/recompose": "0.30.
|
|
72
|
+
"@types/recompose": "0.30.8",
|
|
73
73
|
"bundlesize": "0.18.1",
|
|
74
74
|
"cross-fetch": "3.1.4",
|
|
75
75
|
"crypto-hash": "1.3.0",
|
|
76
|
-
"fetch-mock": "
|
|
76
|
+
"fetch-mock": "9.11.0",
|
|
77
77
|
"glob": "7.1.7",
|
|
78
|
-
"graphql": "15.5.
|
|
78
|
+
"graphql": "15.5.1",
|
|
79
79
|
"jest": "26.6.3",
|
|
80
80
|
"jest-fetch-mock": "3.0.3",
|
|
81
81
|
"jest-junit": "12.2.0",
|
|
82
82
|
"lodash": "4.17.21",
|
|
83
83
|
"react": "17.0.2",
|
|
84
84
|
"react-dom": "17.0.2",
|
|
85
|
-
"recast": "0.20.
|
|
85
|
+
"recast": "0.20.5",
|
|
86
86
|
"recompose": "0.30.0",
|
|
87
87
|
"resolve": "1.20.0",
|
|
88
88
|
"rimraf": "3.0.2",
|
|
89
89
|
"rollup": "2.50.5",
|
|
90
90
|
"rollup-plugin-terser": "7.0.2",
|
|
91
91
|
"rxjs": "6.6.7",
|
|
92
|
-
"subscriptions-transport-ws": "0.9.
|
|
93
|
-
"terser": "5.7.
|
|
92
|
+
"subscriptions-transport-ws": "0.9.19",
|
|
93
|
+
"terser": "5.7.1",
|
|
94
94
|
"ts-jest": "26.5.6",
|
|
95
|
-
"ts-node": "10.
|
|
96
|
-
"typescript": "3.
|
|
95
|
+
"ts-node": "10.1.0",
|
|
96
|
+
"typescript": "4.3.3",
|
|
97
97
|
"wait-for-observables": "1.0.3"
|
|
98
98
|
},
|
|
99
99
|
"publishConfig": {
|
|
@@ -4,7 +4,7 @@ import { OperationVariables } from '../../core';
|
|
|
4
4
|
import { MutationComponentOptions } from './types';
|
|
5
5
|
export declare function Mutation<TData = any, TVariables = OperationVariables>(props: MutationComponentOptions<TData, TVariables>): JSX.Element | null;
|
|
6
6
|
export declare namespace Mutation {
|
|
7
|
-
var propTypes: PropTypes.InferProps<MutationComponentOptions<any, any,
|
|
7
|
+
var propTypes: PropTypes.InferProps<MutationComponentOptions<any, any, import("../../core").DefaultContext, import("../../core").ApolloCache<any>>>;
|
|
8
8
|
}
|
|
9
9
|
export interface Mutation<TData, TVariables> {
|
|
10
10
|
propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;
|
|
@@ -4,7 +4,7 @@ import { useQuery } from "../hooks/index.js";
|
|
|
4
4
|
export function Query(props) {
|
|
5
5
|
var children = props.children, query = props.query, options = __rest(props, ["children", "query"]);
|
|
6
6
|
var result = useQuery(query, options);
|
|
7
|
-
return
|
|
7
|
+
return result ? children(result) : null;
|
|
8
8
|
}
|
|
9
9
|
Query.propTypes = {
|
|
10
10
|
client: PropTypes.object,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,UAAU,KAAK,CACnB,KAA+C;IAEvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"Query.js","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,MAAM,UAAU,KAAK,CACnB,KAA+C;IAEvC,IAAA,QAAQ,GAAwB,KAAK,SAA7B,EAAE,KAAK,GAAiB,KAAK,MAAtB,EAAK,OAAO,UAAK,KAAK,EAAvC,qBAA+B,CAAF,CAAW;IAC9C,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1C,CAAC;AAMD,KAAK,CAAC,SAAS,GAAG;IAChB,MAAM,EAAE,SAAS,CAAC,MAAM;IACxB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,MAAM;IAC7B,2BAA2B,EAAE,SAAS,CAAC,IAAI;IAC3C,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM;IAC9B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IAClC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,GAAG,EAAE,SAAS,CAAC,IAAI;IACnB,cAAc,EAAE,SAAS,CAAC,IAAI;IAC9B,iBAAiB,EAAE,SAAS,CAAC,IAAI;CACF,CAAC","sourcesContent":["import * as PropTypes from 'prop-types';\n\nimport { OperationVariables } from '../../core';\nimport { QueryComponentOptions } from './types';\nimport { useQuery } from '../hooks';\n\nexport function Query<TData = any, TVariables = OperationVariables>(\n props: QueryComponentOptions<TData, TVariables>\n) {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result) : null;\n}\n\nexport interface Query<TData, TVariables> {\n propTypes: PropTypes.InferProps<QueryComponentOptions<TData, TVariables>>;\n}\n\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool\n} as Query<any, any>[\"propTypes\"];\n"]}
|
|
@@ -6,24 +6,38 @@ var tslib = require('tslib');
|
|
|
6
6
|
var PropTypes = require('prop-types');
|
|
7
7
|
var hooks = require('../hooks');
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
n[k] = e[k];
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
n['default'] = e;
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var PropTypes__namespace = /*#__PURE__*/_interopNamespace(PropTypes);
|
|
22
|
+
|
|
9
23
|
function Query(props) {
|
|
10
24
|
var children = props.children, query = props.query, options = tslib.__rest(props, ["children", "query"]);
|
|
11
25
|
var result = hooks.useQuery(query, options);
|
|
12
|
-
return
|
|
26
|
+
return result ? children(result) : null;
|
|
13
27
|
}
|
|
14
28
|
Query.propTypes = {
|
|
15
|
-
client:
|
|
16
|
-
children:
|
|
17
|
-
fetchPolicy:
|
|
18
|
-
notifyOnNetworkStatusChange:
|
|
19
|
-
onCompleted:
|
|
20
|
-
onError:
|
|
21
|
-
pollInterval:
|
|
22
|
-
query:
|
|
23
|
-
variables:
|
|
24
|
-
ssr:
|
|
25
|
-
partialRefetch:
|
|
26
|
-
returnPartialData:
|
|
29
|
+
client: PropTypes__namespace.object,
|
|
30
|
+
children: PropTypes__namespace.func.isRequired,
|
|
31
|
+
fetchPolicy: PropTypes__namespace.string,
|
|
32
|
+
notifyOnNetworkStatusChange: PropTypes__namespace.bool,
|
|
33
|
+
onCompleted: PropTypes__namespace.func,
|
|
34
|
+
onError: PropTypes__namespace.func,
|
|
35
|
+
pollInterval: PropTypes__namespace.number,
|
|
36
|
+
query: PropTypes__namespace.object.isRequired,
|
|
37
|
+
variables: PropTypes__namespace.object,
|
|
38
|
+
ssr: PropTypes__namespace.bool,
|
|
39
|
+
partialRefetch: PropTypes__namespace.bool,
|
|
40
|
+
returnPartialData: PropTypes__namespace.bool
|
|
27
41
|
};
|
|
28
42
|
|
|
29
43
|
function Mutation(props) {
|
|
@@ -31,19 +45,19 @@ function Mutation(props) {
|
|
|
31
45
|
return props.children ? props.children(runMutation, result) : null;
|
|
32
46
|
}
|
|
33
47
|
Mutation.propTypes = {
|
|
34
|
-
mutation:
|
|
35
|
-
variables:
|
|
36
|
-
optimisticResponse:
|
|
37
|
-
refetchQueries:
|
|
38
|
-
|
|
39
|
-
|
|
48
|
+
mutation: PropTypes__namespace.object.isRequired,
|
|
49
|
+
variables: PropTypes__namespace.object,
|
|
50
|
+
optimisticResponse: PropTypes__namespace.oneOfType([PropTypes__namespace.object, PropTypes__namespace.func]),
|
|
51
|
+
refetchQueries: PropTypes__namespace.oneOfType([
|
|
52
|
+
PropTypes__namespace.arrayOf(PropTypes__namespace.oneOfType([PropTypes__namespace.string, PropTypes__namespace.object])),
|
|
53
|
+
PropTypes__namespace.func
|
|
40
54
|
]),
|
|
41
|
-
awaitRefetchQueries:
|
|
42
|
-
update:
|
|
43
|
-
children:
|
|
44
|
-
onCompleted:
|
|
45
|
-
onError:
|
|
46
|
-
fetchPolicy:
|
|
55
|
+
awaitRefetchQueries: PropTypes__namespace.bool,
|
|
56
|
+
update: PropTypes__namespace.func,
|
|
57
|
+
children: PropTypes__namespace.func.isRequired,
|
|
58
|
+
onCompleted: PropTypes__namespace.func,
|
|
59
|
+
onError: PropTypes__namespace.func,
|
|
60
|
+
fetchPolicy: PropTypes__namespace.string,
|
|
47
61
|
};
|
|
48
62
|
|
|
49
63
|
function Subscription(props) {
|
|
@@ -51,12 +65,12 @@ function Subscription(props) {
|
|
|
51
65
|
return props.children && result ? props.children(result) : null;
|
|
52
66
|
}
|
|
53
67
|
Subscription.propTypes = {
|
|
54
|
-
subscription:
|
|
55
|
-
variables:
|
|
56
|
-
children:
|
|
57
|
-
onSubscriptionData:
|
|
58
|
-
onSubscriptionComplete:
|
|
59
|
-
shouldResubscribe:
|
|
68
|
+
subscription: PropTypes__namespace.object.isRequired,
|
|
69
|
+
variables: PropTypes__namespace.object,
|
|
70
|
+
children: PropTypes__namespace.func,
|
|
71
|
+
onSubscriptionData: PropTypes__namespace.func,
|
|
72
|
+
onSubscriptionComplete: PropTypes__namespace.func,
|
|
73
|
+
shouldResubscribe: PropTypes__namespace.oneOfType([PropTypes__namespace.func, PropTypes__namespace.bool])
|
|
60
74
|
};
|
|
61
75
|
|
|
62
76
|
exports.Mutation = Mutation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.cjs.js","sources":["Query.js","Mutation.js","Subscription.js"],"sourcesContent":["import { __rest } from \"tslib\";\nimport * as PropTypes from 'prop-types';\nimport { useQuery } from '../hooks';\nexport function Query(props) {\n var children = props.children, query = props.query, options = __rest(props, [\"children\", \"query\"]);\n var result = useQuery(query, options);\n return
|
|
1
|
+
{"version":3,"file":"components.cjs.js","sources":["Query.js","Mutation.js","Subscription.js"],"sourcesContent":["import { __rest } from \"tslib\";\nimport * as PropTypes from 'prop-types';\nimport { useQuery } from '../hooks';\nexport function Query(props) {\n var children = props.children, query = props.query, options = __rest(props, [\"children\", \"query\"]);\n var result = useQuery(query, options);\n return result ? children(result) : null;\n}\nQuery.propTypes = {\n client: PropTypes.object,\n children: PropTypes.func.isRequired,\n fetchPolicy: PropTypes.string,\n notifyOnNetworkStatusChange: PropTypes.bool,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n pollInterval: PropTypes.number,\n query: PropTypes.object.isRequired,\n variables: PropTypes.object,\n ssr: PropTypes.bool,\n partialRefetch: PropTypes.bool,\n returnPartialData: PropTypes.bool\n};\n//# sourceMappingURL=Query.js.map","import * as PropTypes from 'prop-types';\nimport { useMutation } from '../hooks';\nexport function Mutation(props) {\n var _a = useMutation(props.mutation, props), runMutation = _a[0], result = _a[1];\n return props.children ? props.children(runMutation, result) : null;\n}\nMutation.propTypes = {\n mutation: PropTypes.object.isRequired,\n variables: PropTypes.object,\n optimisticResponse: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),\n refetchQueries: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.object])),\n PropTypes.func\n ]),\n awaitRefetchQueries: PropTypes.bool,\n update: PropTypes.func,\n children: PropTypes.func.isRequired,\n onCompleted: PropTypes.func,\n onError: PropTypes.func,\n fetchPolicy: PropTypes.string,\n};\n//# sourceMappingURL=Mutation.js.map","import * as PropTypes from 'prop-types';\nimport { useSubscription } from '../hooks';\nexport function Subscription(props) {\n var result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool])\n};\n//# sourceMappingURL=Subscription.js.map"],"names":["__rest","useQuery","PropTypes","useMutation","useSubscription"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAGO,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,GAAGA,YAAM,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,OAAO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S,CAAC,SAAS,CAAC,CAACA,oBAAS,CAAC,IAAI,EAAEA,oBAAS,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;;;;;;"}
|
|
@@ -5,7 +5,7 @@ export var ApolloConsumer = function (props) {
|
|
|
5
5
|
var ApolloContext = getApolloContext();
|
|
6
6
|
return React.createElement(ApolloContext.Consumer, null, function (context) {
|
|
7
7
|
__DEV__ ? invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
8
|
-
'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client,
|
|
8
|
+
'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 30);
|
|
9
9
|
return props.children(context.client);
|
|
10
10
|
});
|
|
11
11
|
};
|
|
@@ -10,7 +10,7 @@ export var ApolloProvider = function (_a) {
|
|
|
10
10
|
context = Object.assign({}, context, { client: client });
|
|
11
11
|
}
|
|
12
12
|
__DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
13
|
-
'sure you pass in your client via the "client" prop.') : invariant(context.client,
|
|
13
|
+
'sure you pass in your client via the "client" prop.') : invariant(context.client, 31);
|
|
14
14
|
return (React.createElement(ApolloContext.Provider, { value: context }, children));
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -6,22 +6,36 @@ var React = require('react');
|
|
|
6
6
|
var tsInvariant = require('ts-invariant');
|
|
7
7
|
var utilities = require('../../utilities');
|
|
8
8
|
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
n[k] = e[k];
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
n['default'] = e;
|
|
18
|
+
return Object.freeze(n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
22
|
+
|
|
9
23
|
var cache = new (utilities.canUseWeakMap ? WeakMap : Map)();
|
|
10
24
|
function getApolloContext() {
|
|
11
|
-
var context = cache.get(
|
|
25
|
+
var context = cache.get(React__namespace.createContext);
|
|
12
26
|
if (!context) {
|
|
13
|
-
context =
|
|
27
|
+
context = React__namespace.createContext({});
|
|
14
28
|
context.displayName = 'ApolloContext';
|
|
15
|
-
cache.set(
|
|
29
|
+
cache.set(React__namespace.createContext, context);
|
|
16
30
|
}
|
|
17
31
|
return context;
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
var ApolloConsumer = function (props) {
|
|
21
35
|
var ApolloContext = getApolloContext();
|
|
22
|
-
return
|
|
36
|
+
return React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
23
37
|
__DEV__ ? tsInvariant.invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
24
|
-
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client,
|
|
38
|
+
'Wrap the root component in an <ApolloProvider>.') : tsInvariant.invariant(context && context.client, 30);
|
|
25
39
|
return props.children(context.client);
|
|
26
40
|
});
|
|
27
41
|
};
|
|
@@ -29,14 +43,14 @@ var ApolloConsumer = function (props) {
|
|
|
29
43
|
var ApolloProvider = function (_a) {
|
|
30
44
|
var client = _a.client, children = _a.children;
|
|
31
45
|
var ApolloContext = getApolloContext();
|
|
32
|
-
return
|
|
46
|
+
return React__namespace.createElement(ApolloContext.Consumer, null, function (context) {
|
|
33
47
|
if (context === void 0) { context = {}; }
|
|
34
48
|
if (client && context.client !== client) {
|
|
35
49
|
context = Object.assign({}, context, { client: client });
|
|
36
50
|
}
|
|
37
51
|
__DEV__ ? tsInvariant.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
38
|
-
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client,
|
|
39
|
-
return (
|
|
52
|
+
'sure you pass in your client via the "client" prop.') : tsInvariant.invariant(context.client, 31);
|
|
53
|
+
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
40
54
|
});
|
|
41
55
|
};
|
|
42
56
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.cjs.js","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseWeakMap } from '../../utilities';\nvar cache = new (canUseWeakMap ? WeakMap : Map)();\nexport function getApolloContext() {\n var context = cache.get(React.createContext);\n if (!context) {\n context = React.createContext({});\n context.displayName = 'ApolloContext';\n cache.set(React.createContext, context);\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client,
|
|
1
|
+
{"version":3,"file":"context.cjs.js","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseWeakMap } from '../../utilities';\nvar cache = new (canUseWeakMap ? WeakMap : Map)();\nexport function getApolloContext() {\n var context = cache.get(React.createContext);\n if (!context) {\n context = React.createContext({});\n context.displayName = 'ApolloContext';\n cache.set(React.createContext, context);\n }\n return context;\n}\nexport { getApolloContext as resetApolloContext };\n//# sourceMappingURL=ApolloContext.js.map","import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloConsumer = function (props) {\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n __DEV__ ? invariant(context && context.client, 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.') : invariant(context && context.client, 30);\n return props.children(context.client);\n });\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import * as React from 'react';\nimport { invariant } from 'ts-invariant';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, children = _a.children;\n var ApolloContext = getApolloContext();\n return React.createElement(ApolloContext.Consumer, null, function (context) {\n if (context === void 0) { context = {}; }\n if (client && context.client !== client) {\n context = Object.assign({}, context, { client: client });\n }\n __DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.') : invariant(context.client, 31);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n });\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseWeakMap","React","invariant"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,KAAK,GAAG,KAAKA,uBAAa,GAAG,OAAO,GAAG,GAAG,GAAG,CAAC;AAC3C,SAAS,gBAAgB,GAAG;AACnC,IAAI,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAACC,gBAAK,CAAC,aAAa,CAAC,CAAC;AACjD,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,GAAGA,gBAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;AAC1C,QAAQ,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;AAC9C,QAAQ,KAAK,CAAC,GAAG,CAACA,gBAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAChD,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB;;ACRU,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,OAAOA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AAChF,QAAQ,OAAO,GAAGC,qBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,4DAA4D;AACnH,YAAY,iDAAiD,CAAC,GAAGA,qBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC1G,QAAQ,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9C,KAAK,CAAC,CAAC;AACP;;ACPU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACnD,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,OAAOD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AAChF,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,EAAE,EAAE,OAAO,GAAG,EAAE,CAAC,EAAE;AACjD,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE;AACjD,YAAY,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AACrE,SAAS;AACT,QAAQ,OAAO,GAAGC,qBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,wDAAwD;AACpG,YAAY,qDAAqD,CAAC,GAAGA,qBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACnG,QAAQ,QAAQD,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AAC3F,KAAK,CAAC,CAAC;AACP;;;;;;;"}
|
|
@@ -28,7 +28,7 @@ var OperationData = (function () {
|
|
|
28
28
|
(this.context && this.context.client);
|
|
29
29
|
__DEV__ ? invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
30
30
|
'Wrap the root component in an <ApolloProvider>, or pass an ' +
|
|
31
|
-
'ApolloClient instance in via options.') : invariant(!!client,
|
|
31
|
+
'ApolloClient instance in via options.') : invariant(!!client, 32);
|
|
32
32
|
var isNew = false;
|
|
33
33
|
if (client !== this.client) {
|
|
34
34
|
isNew = true;
|
|
@@ -45,7 +45,7 @@ var OperationData = (function () {
|
|
|
45
45
|
var requiredOperationName = operationName(type);
|
|
46
46
|
var usedOperationName = operationName(operation.type);
|
|
47
47
|
__DEV__ ? invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
|
|
48
|
-
(requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : invariant(operation.type === type,
|
|
48
|
+
(requiredOperationName + ", but a " + usedOperationName + " was used instead.")) : invariant(operation.type === type, 33);
|
|
49
49
|
};
|
|
50
50
|
return OperationData;
|
|
51
51
|
}());
|
|
@@ -22,14 +22,13 @@ export declare class QueryData<TData, TVariables> extends OperationData<QueryDat
|
|
|
22
22
|
getOptions(): import("../types/types").CommonOptions<QueryDataOptions<TData, TVariables>>;
|
|
23
23
|
ssrInitiated(): any;
|
|
24
24
|
private runLazyQuery;
|
|
25
|
-
private getExecuteResult;
|
|
26
25
|
private getExecuteSsrResult;
|
|
27
26
|
private prepareObservableQueryOptions;
|
|
28
27
|
private initializeObservableQuery;
|
|
29
28
|
private updateObservableQuery;
|
|
30
29
|
private startQuerySubscription;
|
|
31
30
|
private resubscribeToQuery;
|
|
32
|
-
private
|
|
31
|
+
private getExecuteResult;
|
|
33
32
|
private handleErrorOrCompleted;
|
|
34
33
|
private removeQuerySubscription;
|
|
35
34
|
private removeObservable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryData.d.ts","sourceRoot":"","sources":["../../../src/react/data/QueryData.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QueryData.d.ts","sourceRoot":"","sources":["../../../src/react/data/QueryData.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,WAAW,EACX,gBAAgB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,UAAU,CAC2B;IAE7C,OAAO,CAAC,YAAY,CAGqC;IAEzD,OAAO,CAAC,cAAc,CAK0B;IAEhD,OAAO,CAAC,eAAe,CAErB;IAEF,OAAO,CAAC,cAAc,CAEpB;IAEF,OAAO,CAAC,kBAAkB,CAS4B;IAEtD,OAAO,CAAC,qBAAqB;CAW9B"}
|
package/react/data/QueryData.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __extends } from "tslib";
|
|
2
2
|
import { equal } from '@wry/equality';
|
|
3
3
|
import { ApolloError } from "../../errors/index.js";
|
|
4
|
-
import { NetworkStatus,
|
|
4
|
+
import { NetworkStatus, } from "../../core/index.js";
|
|
5
5
|
import { DocumentType } from "../parser/index.js";
|
|
6
6
|
import { OperationData } from "./OperationData.js";
|
|
7
7
|
var QueryData = (function (_super) {
|
|
@@ -17,61 +17,9 @@ var QueryData = (function (_super) {
|
|
|
17
17
|
_this.lazyOptions = options;
|
|
18
18
|
_this.onNewData();
|
|
19
19
|
};
|
|
20
|
-
_this.getQueryResult = function () {
|
|
21
|
-
var result = _this.observableQueryFields();
|
|
22
|
-
var options = _this.getOptions();
|
|
23
|
-
if (options.skip) {
|
|
24
|
-
result = __assign(__assign({}, result), { data: undefined, error: undefined, loading: false, networkStatus: NetworkStatus.ready, called: true });
|
|
25
|
-
}
|
|
26
|
-
else if (_this.currentObservable) {
|
|
27
|
-
var currentResult = _this.currentObservable.getCurrentResult();
|
|
28
|
-
var data = currentResult.data, loading = currentResult.loading, partial = currentResult.partial, networkStatus = currentResult.networkStatus, errors = currentResult.errors;
|
|
29
|
-
var error = currentResult.error;
|
|
30
|
-
if (errors && errors.length > 0) {
|
|
31
|
-
error = new ApolloError({ graphQLErrors: errors });
|
|
32
|
-
}
|
|
33
|
-
result = __assign(__assign({}, result), { data: data,
|
|
34
|
-
loading: loading,
|
|
35
|
-
networkStatus: networkStatus,
|
|
36
|
-
error: error, called: true });
|
|
37
|
-
if (loading) {
|
|
38
|
-
}
|
|
39
|
-
else if (error) {
|
|
40
|
-
Object.assign(result, {
|
|
41
|
-
data: (_this.currentObservable.getLastResult() || {})
|
|
42
|
-
.data
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
var fetchPolicy = _this.currentObservable.options.fetchPolicy;
|
|
47
|
-
var partialRefetch = options.partialRefetch;
|
|
48
|
-
if (partialRefetch &&
|
|
49
|
-
partial &&
|
|
50
|
-
(!data || Object.keys(data).length === 0) &&
|
|
51
|
-
fetchPolicy !== 'cache-only') {
|
|
52
|
-
Object.assign(result, {
|
|
53
|
-
loading: true,
|
|
54
|
-
networkStatus: NetworkStatus.loading
|
|
55
|
-
});
|
|
56
|
-
result.refetch();
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
result.client = _this.client;
|
|
62
|
-
_this.setOptions(options, true);
|
|
63
|
-
var previousResult = _this.previous.result;
|
|
64
|
-
_this.previous.loading =
|
|
65
|
-
previousResult && previousResult.loading || false;
|
|
66
|
-
result.previousData = previousResult &&
|
|
67
|
-
(previousResult.data || previousResult.previousData);
|
|
68
|
-
_this.previous.result = result;
|
|
69
|
-
_this.currentObservable && _this.currentObservable.resetQueryStoreErrors();
|
|
70
|
-
return result;
|
|
71
|
-
};
|
|
72
20
|
_this.obsRefetch = function (variables) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.refetch(variables); };
|
|
73
|
-
_this.obsFetchMore = function (fetchMoreOptions) { return _this.currentObservable.fetchMore(fetchMoreOptions); };
|
|
74
|
-
_this.obsUpdateQuery = function (mapFn) { return _this.currentObservable.updateQuery(mapFn); };
|
|
21
|
+
_this.obsFetchMore = function (fetchMoreOptions) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.fetchMore(fetchMoreOptions); };
|
|
22
|
+
_this.obsUpdateQuery = function (mapFn) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.updateQuery(mapFn); };
|
|
75
23
|
_this.obsStartPolling = function (pollInterval) {
|
|
76
24
|
var _a;
|
|
77
25
|
(_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.startPolling(pollInterval);
|
|
@@ -80,7 +28,7 @@ var QueryData = (function (_super) {
|
|
|
80
28
|
var _a;
|
|
81
29
|
(_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.stopPolling();
|
|
82
30
|
};
|
|
83
|
-
_this.obsSubscribeToMore = function (options) { return _this.currentObservable.subscribeToMore(options); };
|
|
31
|
+
_this.obsSubscribeToMore = function (options) { var _a; return (_a = _this.currentObservable) === null || _a === void 0 ? void 0 : _a.subscribeToMore(options); };
|
|
84
32
|
_this.onNewData = onNewData;
|
|
85
33
|
return _this;
|
|
86
34
|
}
|
|
@@ -93,8 +41,6 @@ var QueryData = (function (_super) {
|
|
|
93
41
|
this.previous.query = query;
|
|
94
42
|
}
|
|
95
43
|
this.updateObservableQuery();
|
|
96
|
-
if (this.isMounted)
|
|
97
|
-
this.startQuerySubscription();
|
|
98
44
|
return this.getExecuteSsrResult() || this.getExecuteResult();
|
|
99
45
|
};
|
|
100
46
|
QueryData.prototype.executeLazy = function () {
|
|
@@ -118,12 +64,19 @@ var QueryData = (function (_super) {
|
|
|
118
64
|
return new Promise(function (resolve) { return _this.startQuerySubscription(resolve); });
|
|
119
65
|
};
|
|
120
66
|
QueryData.prototype.afterExecute = function (_a) {
|
|
121
|
-
var _b =
|
|
67
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.lazy, lazy = _c === void 0 ? false : _c;
|
|
122
68
|
this.isMounted = true;
|
|
69
|
+
var options = this.getOptions();
|
|
70
|
+
var ssrDisabled = options.ssr === false;
|
|
71
|
+
if (this.currentObservable &&
|
|
72
|
+
!ssrDisabled &&
|
|
73
|
+
!this.ssrInitiated()) {
|
|
74
|
+
this.startQuerySubscription();
|
|
75
|
+
}
|
|
123
76
|
if (!lazy || this.runLazy) {
|
|
124
77
|
this.handleErrorOrCompleted();
|
|
125
78
|
}
|
|
126
|
-
this.previousOptions =
|
|
79
|
+
this.previousOptions = options;
|
|
127
80
|
return this.unmount.bind(this);
|
|
128
81
|
};
|
|
129
82
|
QueryData.prototype.cleanup = function () {
|
|
@@ -145,12 +98,6 @@ var QueryData = (function (_super) {
|
|
|
145
98
|
QueryData.prototype.ssrInitiated = function () {
|
|
146
99
|
return this.context && this.context.renderPromises;
|
|
147
100
|
};
|
|
148
|
-
QueryData.prototype.getExecuteResult = function () {
|
|
149
|
-
var result = this.getQueryResult();
|
|
150
|
-
this.startQuerySubscription();
|
|
151
|
-
return result;
|
|
152
|
-
};
|
|
153
|
-
;
|
|
154
101
|
QueryData.prototype.getExecuteSsrResult = function () {
|
|
155
102
|
var _a = this.getOptions(), ssr = _a.ssr, skip = _a.skip;
|
|
156
103
|
var ssrDisabled = ssr === false;
|
|
@@ -161,7 +108,7 @@ var QueryData = (function (_super) {
|
|
|
161
108
|
return ssrLoading;
|
|
162
109
|
}
|
|
163
110
|
if (this.ssrInitiated()) {
|
|
164
|
-
var result = this.
|
|
111
|
+
var result = this.getExecuteResult() || ssrLoading;
|
|
165
112
|
if (result.loading && !skip) {
|
|
166
113
|
this.context.renderPromises.addQueryPromise(this, function () { return null; });
|
|
167
114
|
}
|
|
@@ -177,9 +124,6 @@ var QueryData = (function (_super) {
|
|
|
177
124
|
options.fetchPolicy === 'cache-and-network')) {
|
|
178
125
|
options.fetchPolicy = 'cache-first';
|
|
179
126
|
}
|
|
180
|
-
else if (options.nextFetchPolicy && this.currentObservable) {
|
|
181
|
-
applyNextFetchPolicy(options);
|
|
182
|
-
}
|
|
183
127
|
return __assign(__assign({}, options), { displayName: displayName, context: options.context });
|
|
184
128
|
};
|
|
185
129
|
QueryData.prototype.initializeObservableQuery = function () {
|
|
@@ -188,7 +132,7 @@ var QueryData = (function (_super) {
|
|
|
188
132
|
}
|
|
189
133
|
if (!this.currentObservable) {
|
|
190
134
|
var observableQueryOptions = this.prepareObservableQueryOptions();
|
|
191
|
-
this.previous.observableQueryOptions = __assign(__assign({}, observableQueryOptions), { children:
|
|
135
|
+
this.previous.observableQueryOptions = __assign(__assign({}, observableQueryOptions), { children: void 0 });
|
|
192
136
|
this.currentObservable = this.refreshClient().client.watchQuery(__assign({}, observableQueryOptions));
|
|
193
137
|
if (this.ssrInitiated()) {
|
|
194
138
|
this.context.renderPromises.registerSSRObservable(this.currentObservable, observableQueryOptions);
|
|
@@ -200,7 +144,7 @@ var QueryData = (function (_super) {
|
|
|
200
144
|
this.initializeObservableQuery();
|
|
201
145
|
return;
|
|
202
146
|
}
|
|
203
|
-
var newObservableQueryOptions = __assign(__assign({}, this.prepareObservableQueryOptions()), { children:
|
|
147
|
+
var newObservableQueryOptions = __assign(__assign({}, this.prepareObservableQueryOptions()), { children: void 0 });
|
|
204
148
|
if (this.getOptions().skip) {
|
|
205
149
|
this.previous.observableQueryOptions = newObservableQueryOptions;
|
|
206
150
|
return;
|
|
@@ -256,6 +200,55 @@ var QueryData = (function (_super) {
|
|
|
256
200
|
});
|
|
257
201
|
}
|
|
258
202
|
};
|
|
203
|
+
QueryData.prototype.getExecuteResult = function () {
|
|
204
|
+
var result = this.observableQueryFields();
|
|
205
|
+
var options = this.getOptions();
|
|
206
|
+
if (options.skip) {
|
|
207
|
+
result = __assign(__assign({}, result), { data: undefined, error: undefined, loading: false, networkStatus: NetworkStatus.ready, called: true });
|
|
208
|
+
}
|
|
209
|
+
else if (this.currentObservable) {
|
|
210
|
+
var currentResult = this.currentObservable.getCurrentResult();
|
|
211
|
+
var data = currentResult.data, loading = currentResult.loading, partial = currentResult.partial, networkStatus = currentResult.networkStatus, errors = currentResult.errors;
|
|
212
|
+
var error = currentResult.error;
|
|
213
|
+
if (errors && errors.length > 0) {
|
|
214
|
+
error = new ApolloError({ graphQLErrors: errors });
|
|
215
|
+
}
|
|
216
|
+
result = __assign(__assign({}, result), { data: data, loading: loading, networkStatus: networkStatus, error: error, called: true });
|
|
217
|
+
if (loading) {
|
|
218
|
+
}
|
|
219
|
+
else if (error) {
|
|
220
|
+
Object.assign(result, {
|
|
221
|
+
data: (this.currentObservable.getLastResult() || {})
|
|
222
|
+
.data
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
var fetchPolicy = this.currentObservable.options.fetchPolicy;
|
|
227
|
+
var partialRefetch = options.partialRefetch;
|
|
228
|
+
if (partialRefetch &&
|
|
229
|
+
partial &&
|
|
230
|
+
(!data || Object.keys(data).length === 0) &&
|
|
231
|
+
fetchPolicy !== 'cache-only') {
|
|
232
|
+
Object.assign(result, {
|
|
233
|
+
loading: true,
|
|
234
|
+
networkStatus: NetworkStatus.loading
|
|
235
|
+
});
|
|
236
|
+
result.refetch();
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
result.client = this.client;
|
|
242
|
+
this.setOptions(options, true);
|
|
243
|
+
var previousResult = this.previous.result;
|
|
244
|
+
this.previous.loading =
|
|
245
|
+
previousResult && previousResult.loading || false;
|
|
246
|
+
result.previousData = previousResult &&
|
|
247
|
+
(previousResult.data || previousResult.previousData);
|
|
248
|
+
this.previous.result = result;
|
|
249
|
+
this.currentObservable && this.currentObservable.resetQueryStoreErrors();
|
|
250
|
+
return result;
|
|
251
|
+
};
|
|
259
252
|
QueryData.prototype.handleErrorOrCompleted = function () {
|
|
260
253
|
if (!this.currentObservable || !this.previous.result)
|
|
261
254
|
return;
|