@apollo/client 3.8.0-alpha.13 → 3.8.0-alpha.14
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 +195 -164
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +1 -1
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +1 -1
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +2 -2
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +4 -4
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +3 -3
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +5 -5
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -5
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +5 -5
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/policies.d.ts +7 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -1
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +6 -6
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +2 -2
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +6 -6
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +6 -6
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts +10 -9
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +1 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +9 -8
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +9 -9
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +6 -6
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +1 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +1 -1
- package/core/equalByQuery.d.ts +2 -2
- package/core/equalByQuery.d.ts.map +1 -1
- package/core/equalByQuery.js.map +1 -1
- package/core/types.d.ts +11 -11
- package/core/types.d.ts.map +1 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +6 -6
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +45 -28
- package/link/batch/batchLink.d.ts +4 -3
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +1 -1
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts +3 -2
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/context/index.d.ts +3 -2
- package/link/context/index.d.ts.map +1 -1
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -2
- package/link/core/ApolloLink.d.ts.map +1 -1
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/types.d.ts +4 -3
- package/link/core/types.d.ts.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/index.d.ts +4 -3
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -2
- package/link/http/HttpLink.d.ts.map +1 -1
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -1
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +1 -1
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +1 -1
- package/link/http/iterators/nodeStream.d.ts +1 -1
- package/link/http/iterators/nodeStream.d.ts.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts +2 -2
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/responseIterator.d.ts +1 -1
- package/link/http/responseIterator.d.ts.map +1 -1
- package/link/http/responseIterator.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.d.ts.map +1 -1
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +3 -2
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +1 -2
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.d.ts.map +1 -1
- package/link/http/selectURI.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -3
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js.map +1 -1
- package/link/remove-typename/index.d.ts +2 -0
- package/link/remove-typename/index.d.ts.map +1 -0
- package/link/remove-typename/index.js +2 -0
- package/link/remove-typename/index.js.map +1 -0
- package/link/remove-typename/package.json +8 -0
- package/link/remove-typename/remove-typename.cjs +70 -0
- package/link/remove-typename/remove-typename.cjs.map +1 -0
- package/link/remove-typename/remove-typename.cjs.native.js +70 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts +11 -0
- package/link/remove-typename/removeTypenameFromVariables.d.ts.map +1 -0
- package/link/remove-typename/removeTypenameFromVariables.js +62 -0
- package/link/remove-typename/removeTypenameFromVariables.js.map +1 -0
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.d.ts.map +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.d.ts.map +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +4 -3
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +3 -2
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js.map +1 -1
- package/link/subscriptions/index.d.ts +2 -1
- package/link/subscriptions/index.d.ts.map +1 -1
- package/link/subscriptions/index.js +2 -2
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/subscriptions/subscriptions.cjs.native.js +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.d.ts.map +1 -1
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.d.ts.map +1 -1
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.d.ts.map +1 -1
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -3
- package/link/ws/index.d.ts.map +1 -1
- package/link/ws/index.js.map +1 -1
- package/package.json +18 -15
- package/react/cache/{QuerySubscription.d.ts → QueryReference.d.ts} +12 -11
- package/react/cache/QueryReference.d.ts.map +1 -0
- package/react/cache/{QuerySubscription.js → QueryReference.js} +37 -36
- package/react/cache/QueryReference.js.map +1 -0
- package/react/cache/SuspenseCache.d.ts +5 -5
- package/react/cache/SuspenseCache.d.ts.map +1 -1
- package/react/cache/SuspenseCache.js +8 -7
- package/react/cache/SuspenseCache.js.map +1 -1
- package/react/cache/types.d.ts +2 -0
- package/react/cache/types.d.ts.map +1 -0
- package/react/cache/types.js +2 -0
- package/react/cache/types.js.map +1 -0
- package/react/components/Mutation.d.ts +2 -2
- package/react/components/Mutation.d.ts.map +1 -1
- package/react/components/Mutation.js.map +1 -1
- package/react/components/Query.d.ts +2 -2
- package/react/components/Query.d.ts.map +1 -1
- package/react/components/Query.js.map +1 -1
- package/react/components/Subscription.d.ts +2 -2
- package/react/components/Subscription.d.ts.map +1 -1
- package/react/components/Subscription.js.map +1 -1
- package/react/components/types.d.ts +4 -4
- package/react/components/types.d.ts.map +1 -1
- package/react/components/types.js.map +1 -1
- package/react/context/ApolloConsumer.d.ts +1 -1
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js.map +1 -1
- package/react/context/ApolloContext.d.ts +10 -3
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +13 -8
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +2 -2
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +8 -12
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +21 -20
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +21 -20
- package/react/context/index.d.ts +1 -1
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -1
- package/react/context/index.js.map +1 -1
- package/react/hoc/graphql.d.ts +3 -3
- package/react/hoc/graphql.d.ts.map +1 -1
- package/react/hoc/graphql.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts +2 -2
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +2 -2
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/hoc.cjs.native.js +2 -2
- package/react/hoc/mutation-hoc.d.ts +4 -4
- package/react/hoc/mutation-hoc.d.ts.map +1 -1
- package/react/hoc/mutation-hoc.js.map +1 -1
- package/react/hoc/query-hoc.d.ts +2 -2
- package/react/hoc/query-hoc.d.ts.map +1 -1
- package/react/hoc/query-hoc.js.map +1 -1
- package/react/hoc/subscription-hoc.d.ts +2 -2
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/types.d.ts +4 -4
- package/react/hoc/types.d.ts.map +1 -1
- package/react/hoc/types.js.map +1 -1
- package/react/hoc/withApollo.d.ts +1 -1
- package/react/hoc/withApollo.d.ts.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +101 -32
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +101 -32
- package/react/hooks/index.d.ts +2 -1
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +2 -1
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts +1 -1
- package/react/hooks/internal/useDeepMemo.d.ts.map +1 -1
- package/react/hooks/internal/useDeepMemo.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useBackgroundQuery.d.ts +18 -0
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -0
- package/react/hooks/useBackgroundQuery.js +71 -0
- package/react/hooks/useBackgroundQuery.js.map +1 -0
- package/react/hooks/useFragment.d.ts +12 -8
- package/react/hooks/useFragment.d.ts.map +1 -1
- package/react/hooks/useFragment.js +1 -1
- package/react/hooks/useFragment.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts +4 -4
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts +4 -4
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +1 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +3 -3
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +2 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +4 -4
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +1 -1
- package/react/hooks/useSuspenseCache.d.ts.map +1 -1
- package/react/hooks/useSuspenseCache.js +1 -1
- package/react/hooks/useSuspenseCache.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +16 -6
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js +32 -29
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/parser/index.d.ts +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +40 -37
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +40 -37
- package/react/ssr/RenderPromises.d.ts +2 -2
- package/react/ssr/RenderPromises.d.ts.map +1 -1
- package/react/ssr/RenderPromises.js.map +1 -1
- package/react/ssr/renderToStringWithData.d.ts +1 -1
- package/react/ssr/renderToStringWithData.d.ts.map +1 -1
- package/react/ssr/renderToStringWithData.js.map +1 -1
- package/react/types/types.d.ts +8 -8
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockClient.d.ts +2 -2
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +2 -1
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +2 -2
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +2 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +2 -2
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +1 -1
- package/testing/core/subscribeAndCount.d.ts.map +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +7 -6
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.d.ts.map +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/errorHandling.d.ts +1 -1
- package/utilities/common/errorHandling.d.ts.map +1 -1
- package/utilities/common/errorHandling.js.map +1 -1
- package/utilities/common/incrementalResult.d.ts +1 -1
- package/utilities/common/incrementalResult.d.ts.map +1 -1
- package/utilities/common/incrementalResult.js.map +1 -1
- package/utilities/common/omitDeep.d.ts +10 -2
- package/utilities/common/omitDeep.d.ts.map +1 -1
- package/utilities/common/omitDeep.js +22 -10
- package/utilities/common/omitDeep.js.map +1 -1
- package/utilities/common/responseIterator.d.ts +2 -2
- package/utilities/common/responseIterator.d.ts.map +1 -1
- package/utilities/common/responseIterator.js.map +1 -1
- package/utilities/common/stripTypename.d.ts +9 -1
- package/utilities/common/stripTypename.d.ts.map +1 -1
- package/utilities/common/stripTypename.js +3 -2
- package/utilities/common/stripTypename.js.map +1 -1
- package/utilities/globals/global.d.ts +6 -3
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +14 -4
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -1
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.d.ts +2 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +2 -1
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +1 -1
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.d.ts +1 -1
- package/utilities/observables/iteration.d.ts.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/DeepOmit.d.ts +1 -1
- package/utilities/types/DeepOmit.d.ts.map +1 -1
- package/utilities/types/DeepOmit.js.map +1 -1
- package/utilities/types/DeepPartial.d.ts +1 -1
- package/utilities/types/DeepPartial.d.ts.map +1 -1
- package/utilities/types/DeepPartial.js.map +1 -1
- package/utilities/utilities.cjs +54 -31
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +54 -31
- package/version.js +1 -1
- package/react/cache/QuerySubscription.d.ts.map +0 -1
- package/react/cache/QuerySubscription.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from 'prop-types';\n\nimport { OperationVariables } from '../../core';\nimport { MutationComponentOptions } from './types';\nimport { useMutation } from '../hooks';\n\nexport function Mutation<TData = any, TVariables = OperationVariables>(\n props: MutationComponentOptions<TData, TVariables>\n) {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation<TData, TVariables> {\n propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;\n}\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(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\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} as Mutation<any, any>[\"propTypes\"];\n"]}
|
|
1
|
+
{"version":3,"file":"Mutation.js","sourceRoot":"","sources":["../../../src/react/components/Mutation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,UAAU,QAAQ,CACtB,KAAkD;IAE5C,IAAA,KAAwB,WAAW,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAzD,WAAW,QAAA,EAAE,MAAM,QAAsC,CAAC;IACjE,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAMD,QAAQ,CAAC,SAAS,GAAG;IACnB,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACrC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,SAAS,CAAC,SAAS,CAAC;QAClC,SAAS,CAAC,OAAO,CACf,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,CAC1D;QACD,SAAS,CAAC,IAAI;KACf,CAAC;IACF,mBAAmB,EAAE,SAAS,CAAC,IAAI;IACnC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,UAAU;IACnC,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,OAAO,EAAE,SAAS,CAAC,IAAI;IACvB,WAAW,EAAE,SAAS,CAAC,MAAM;CACK,CAAC","sourcesContent":["import * as PropTypes from 'prop-types';\n\nimport type { OperationVariables } from '../../core';\nimport type { MutationComponentOptions } from './types';\nimport { useMutation } from '../hooks';\n\nexport function Mutation<TData = any, TVariables = OperationVariables>(\n props: MutationComponentOptions<TData, TVariables>\n) {\n const [runMutation, result] = useMutation(props.mutation, props);\n return props.children ? props.children(runMutation, result) : null;\n}\n\nexport interface Mutation<TData, TVariables> {\n propTypes: PropTypes.InferProps<MutationComponentOptions<TData, TVariables>>;\n}\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(\n PropTypes.oneOfType([PropTypes.string, PropTypes.object])\n ),\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} as Mutation<any, any>[\"propTypes\"];\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { OperationVariables } from '../../core';
|
|
4
|
-
import { QueryComponentOptions } from './types';
|
|
3
|
+
import type { OperationVariables } from '../../core';
|
|
4
|
+
import type { QueryComponentOptions } from './types';
|
|
5
5
|
export declare function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(props: QueryComponentOptions<TData, TVariables>): JSX.Element | null;
|
|
6
6
|
export declare namespace Query {
|
|
7
7
|
var propTypes: PropTypes.InferProps<QueryComponentOptions<any, any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Query.d.ts","sourceRoot":"","sources":["../../../src/react/components/Query.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD,wBAAgB,KAAK,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAC3F,KAAK,EAAE,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,sBAKhD;yBANe,KAAK;;;AAQrB,MAAM,WAAW,KAAK,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACjE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAC3E"}
|
|
@@ -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,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,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 extends OperationVariables = OperationVariables>(\n props: QueryComponentOptions<TData, TVariables>\n) {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query<TData, TVariables extends OperationVariables> {\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"]}
|
|
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,MAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,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 type { OperationVariables } from '../../core';\nimport type { QueryComponentOptions } from './types';\nimport { useQuery } from '../hooks';\n\nexport function Query<TData = any, TVariables extends OperationVariables = OperationVariables>(\n props: QueryComponentOptions<TData, TVariables>\n) {\n const { children, query, ...options } = props;\n const result = useQuery(query, options);\n return result ? children(result as any) : null;\n}\n\nexport interface Query<TData, TVariables extends OperationVariables> {\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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as PropTypes from 'prop-types';
|
|
3
|
-
import { OperationVariables } from '../../core';
|
|
4
|
-
import { SubscriptionComponentOptions } from './types';
|
|
3
|
+
import type { OperationVariables } from '../../core';
|
|
4
|
+
import type { SubscriptionComponentOptions } from './types';
|
|
5
5
|
export declare function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(props: SubscriptionComponentOptions<TData, TVariables>): JSX.Element | null;
|
|
6
6
|
export declare namespace Subscription {
|
|
7
7
|
var propTypes: PropTypes.InferProps<SubscriptionComponentOptions<any, any>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"Subscription.d.ts","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAG5D,wBAAgB,YAAY,CAAC,KAAK,GAAG,GAAG,EAAE,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,EAClG,KAAK,EAAE,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,sBAIvD;yBALe,YAAY;;;AAO5B,MAAM,WAAW,YAAY,CAAC,KAAK,EAAE,UAAU,SAAS,kBAAkB;IACxE,SAAS,EAAE,SAAS,CAAC,UAAU,CAAC,4BAA4B,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;CAClF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,YAAY,CAC1B,KAAsD;IAEtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAMD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from 'prop-types';\n\nimport { OperationVariables } from '../../core';\nimport { SubscriptionComponentOptions } from './types';\nimport { useSubscription } from '../hooks';\n\nexport function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(\n props: SubscriptionComponentOptions<TData, TVariables>\n) {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<SubscriptionComponentOptions<TData, TVariables>>;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool])\n} as Subscription<any, any>[\"propTypes\"];\n"]}
|
|
1
|
+
{"version":3,"file":"Subscription.js","sourceRoot":"","sources":["../../../src/react/components/Subscription.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AAIxC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,UAAU,YAAY,CAC1B,KAAsD;IAEtD,IAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,OAAO,KAAK,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAClE,CAAC;AAMD,YAAY,CAAC,SAAS,GAAG;IACvB,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,UAAU;IACzC,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,sBAAsB,EAAE,SAAS,CAAC,IAAI;IACtC,UAAU,EAAE,SAAS,CAAC,IAAI;IAC1B,iBAAiB,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;CAClC,CAAC","sourcesContent":["import * as PropTypes from 'prop-types';\n\nimport type { OperationVariables } from '../../core';\nimport type { SubscriptionComponentOptions } from './types';\nimport { useSubscription } from '../hooks';\n\nexport function Subscription<TData = any, TVariables extends OperationVariables = OperationVariables>(\n props: SubscriptionComponentOptions<TData, TVariables>\n) {\n const result = useSubscription(props.subscription, props);\n return props.children && result ? props.children(result) : null;\n}\n\nexport interface Subscription<TData, TVariables extends OperationVariables> {\n propTypes: PropTypes.InferProps<SubscriptionComponentOptions<TData, TVariables>>;\n}\n\nSubscription.propTypes = {\n subscription: PropTypes.object.isRequired,\n variables: PropTypes.object,\n children: PropTypes.func,\n onSubscriptionData: PropTypes.func,\n onData: PropTypes.func,\n onSubscriptionComplete: PropTypes.func,\n onComplete: PropTypes.func,\n shouldResubscribe: PropTypes.oneOfType([PropTypes.func, PropTypes.bool])\n} as Subscription<any, any>[\"propTypes\"];\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DocumentNode } from 'graphql';
|
|
3
|
-
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
4
|
-
import { OperationVariables, DefaultContext, ApolloCache } from '../../core';
|
|
5
|
-
import { QueryFunctionOptions, QueryResult, BaseMutationOptions, MutationFunction, MutationResult, BaseSubscriptionOptions, SubscriptionResult } from '../types/types';
|
|
2
|
+
import type { DocumentNode } from 'graphql';
|
|
3
|
+
import type { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
4
|
+
import type { OperationVariables, DefaultContext, ApolloCache } from '../../core';
|
|
5
|
+
import type { QueryFunctionOptions, QueryResult, BaseMutationOptions, MutationFunction, MutationResult, BaseSubscriptionOptions, SubscriptionResult } from '../types/types';
|
|
6
6
|
export interface QueryComponentOptions<TData = any, TVariables extends OperationVariables = OperationVariables> extends QueryFunctionOptions<TData, TVariables> {
|
|
7
7
|
children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;
|
|
8
8
|
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EACV,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAqB,CACpC,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,CAC1D,SAAQ,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC;IAC/C,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,EAAE,UAAU,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;IACzE,KAAK,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,wBAAwB,CACvC,KAAK,GAAG,GAAG,EACX,UAAU,GAAG,kBAAkB,EAC/B,QAAQ,GAAG,cAAc,EACzB,MAAM,SAAS,WAAW,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAClD,SAAQ,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC;IAChE,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9D,QAAQ,EAAE,CACR,cAAc,EAAE,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,EAC7D,MAAM,EAAE,cAAc,CAAC,KAAK,CAAC,KAC1B,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B,CAC3C,KAAK,GAAG,GAAG,EACX,UAAU,SAAS,kBAAkB,GAAG,kBAAkB,CAC1D,SAAQ,uBAAuB,CAAC,KAAK,EAAE,UAAU,CAAC;IAClD,YAAY,EAAE,YAAY,GAAG,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAClE,QAAQ,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CAC/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { OperationVariables, DefaultContext, ApolloCache } from '../../core';\nimport {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult\n} from '../types/types';\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends QueryFunctionOptions<TData, TVariables> {\n children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children: (\n mutateFunction: MutationFunction<TData, TVariables, TContext>,\n result: MutationResult<TData>\n ) => JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/react/components/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DocumentNode } from 'graphql';\nimport type { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport type { OperationVariables, DefaultContext, ApolloCache } from '../../core';\nimport type {\n QueryFunctionOptions,\n QueryResult,\n BaseMutationOptions,\n MutationFunction,\n MutationResult,\n BaseSubscriptionOptions,\n SubscriptionResult\n} from '../types/types';\n\nexport interface QueryComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends QueryFunctionOptions<TData, TVariables> {\n children: (result: QueryResult<TData, TVariables>) => JSX.Element | null;\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n}\n\nexport interface MutationComponentOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>\n> extends BaseMutationOptions<TData, TVariables, TContext, TCache> {\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children: (\n mutateFunction: MutationFunction<TData, TVariables, TContext>,\n result: MutationResult<TData>\n ) => JSX.Element | null;\n}\n\nexport interface SubscriptionComponentOptions<\n TData = any,\n TVariables extends OperationVariables = OperationVariables\n> extends BaseSubscriptionOptions<TData, TVariables> {\n subscription: DocumentNode | TypedDocumentNode<TData, TVariables>;\n children?: null | ((result: SubscriptionResult<TData>) => JSX.Element | null);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ApolloConsumer.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC;CACrE;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAcxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,CAAC,IAAM,cAAc,GAAkC,UAAA,KAAK;IAChE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => React.ReactChild | null;\n}\n\nexport const ApolloConsumer: React.FC<ApolloConsumerProps> = props => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.'\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"ApolloConsumer.js","sourceRoot":"","sources":["../../../src/react/context/ApolloConsumer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMnD,MAAM,CAAC,IAAM,cAAc,GAAkC,UAAA,KAAK;IAChE,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,QACpB,UAAC,OAAY;QACZ,SAAS,CACP,OAAO,IAAI,OAAO,CAAC,MAAM,EACzB,4DAA4D;YAC1D,iDAAiD,CACpD,CAAC;QACF,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC,CACsB,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport type { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\n\nexport interface ApolloConsumerProps {\n children: (client: ApolloClient<object>) => React.ReactChild | null;\n}\n\nexport const ApolloConsumer: React.FC<ApolloConsumerProps> = props => {\n const ApolloContext = getApolloContext();\n return (\n <ApolloContext.Consumer>\n {(context: any) => {\n invariant(\n context && context.client,\n 'Could not find \"client\" in the context of ApolloConsumer. ' +\n 'Wrap the root component in an <ApolloProvider>.'\n );\n return props.children(context.client);\n }}\n </ApolloContext.Consumer>\n );\n};\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ApolloClient } from '../../core';
|
|
3
|
-
import { SuspenseCache } from '../cache';
|
|
2
|
+
import type { ApolloClient } from '../../core';
|
|
3
|
+
import type { SuspenseCache } from '../cache';
|
|
4
4
|
import type { RenderPromises } from '../ssr';
|
|
5
5
|
export interface ApolloContextValue {
|
|
6
6
|
client?: ApolloClient<object>;
|
|
7
7
|
renderPromises?: RenderPromises;
|
|
8
8
|
suspenseCache?: SuspenseCache;
|
|
9
9
|
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
[contextKey]: Map<typeof React, React.Context<ApolloContextValue>>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare const contextKey: unique symbol;
|
|
10
16
|
export declare function getApolloContext(): React.Context<ApolloContextValue>;
|
|
11
|
-
export
|
|
17
|
+
export declare const resetApolloContext: typeof getApolloContext;
|
|
18
|
+
export {};
|
|
12
19
|
//# sourceMappingURL=ApolloContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ApolloContext.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAG7C,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,CAAC,UAAU,CAAC,EAAE,GAAG,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC;KACpE;CACF;AAUD,QAAA,MAAM,UAAU,EAAE,OAAO,MAEQ,CAAC;AAElC,wBAAgB,gBAAgB,IAAI,KAAK,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAsBpE;AAOD,eAAO,MAAM,kBAAkB,yBAAmB,CAAC"}
|
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { canUseSymbol } from "../../utilities/index.js";
|
|
3
|
+
import { global, invariant, __DEV__ } from "../../utilities/globals/index.js";
|
|
3
4
|
var contextKey = canUseSymbol
|
|
4
5
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
5
6
|
: '__APOLLO_CONTEXT__';
|
|
6
7
|
export function getApolloContext() {
|
|
7
|
-
|
|
8
|
+
__DEV__ ? invariant('createContext' in React, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n' +
|
|
9
|
+
'The Apollo Client functionality you are trying to use is only available in React Client Components.\n' +
|
|
10
|
+
'Please make sure to add "use client" at the top of your file.\n' +
|
|
11
|
+
'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : invariant('createContext' in React, 29);
|
|
12
|
+
var contextStorage = global[contextKey];
|
|
13
|
+
if (!contextStorage) {
|
|
14
|
+
contextStorage = global[contextKey] = new Map();
|
|
15
|
+
}
|
|
16
|
+
var context = contextStorage.get(React);
|
|
8
17
|
if (!context) {
|
|
9
|
-
|
|
10
|
-
value: context = React.createContext({}),
|
|
11
|
-
enumerable: false,
|
|
12
|
-
writable: false,
|
|
13
|
-
configurable: true,
|
|
14
|
-
});
|
|
18
|
+
context = React.createContext({});
|
|
15
19
|
context.displayName = 'ApolloContext';
|
|
20
|
+
contextStorage.set(React, context);
|
|
16
21
|
}
|
|
17
22
|
return context;
|
|
18
23
|
}
|
|
19
|
-
export
|
|
24
|
+
export var resetApolloContext = getApolloContext;
|
|
20
25
|
//# sourceMappingURL=ApolloContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ApolloContext.js","sourceRoot":"","sources":["../../../src/react/context/ApolloContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAsB5D,IAAM,UAAU,GAAkB,YAAY;IAC5C,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAClC,CAAC,CAAE,oBAA4B,CAAC;AAElC,MAAM,UAAU,gBAAgB;IAC9B,SAAS,CACP,eAAe,IAAI,KAAK,EACxB,+FAA+F;QAC7F,uGAAuG;QACvG,iEAAiE;QAEjE,sGAAsG,CACzG,CAAC;IAEF,IAAI,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,CAAC,cAAc,EAAE;QACnB,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;KACjD;IAED,IAAI,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,GAAG,KAAK,CAAC,aAAa,CAAqB,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,WAAW,GAAG,eAAe,CAAC;QACtC,cAAc,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAOD,MAAM,CAAC,IAAM,kBAAkB,GAAG,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\nimport type { ApolloClient } from '../../core';\nimport { canUseSymbol } from '../../utilities';\nimport type { SuspenseCache } from '../cache';\nimport type { RenderPromises } from '../ssr';\nimport { global, invariant } from '../../utilities/globals';\n\nexport interface ApolloContextValue {\n client?: ApolloClient<object>;\n renderPromises?: RenderPromises;\n suspenseCache?: SuspenseCache;\n}\n\ndeclare global {\n interface Window {\n [contextKey]: Map<typeof React, React.Context<ApolloContextValue>>;\n }\n}\n\n// To make sure that Apollo Client does not create more than one React context\n// per React version, we store that Context in a global Map, keyed by the\n// React version. This way, if there are multiple versions of React loaded,\n// (e.g. in a Microfrontend environment), each React version will get its own\n// Apollo context.\n// If there are multiple versions of Apollo Client though, which can happen by\n// accident, this can avoid bugs where those multiple Apollo Client versions\n// would be unable to \"see each other\", even if an ApolloProvider was present.\nconst contextKey: unique symbol = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : ('__APOLLO_CONTEXT__' as any);\n\nexport function getApolloContext(): React.Context<ApolloContextValue> {\n invariant(\n 'createContext' in React,\n 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n' +\n 'The Apollo Client functionality you are trying to use is only available in React Client Components.\\n' +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n // TODO: change to React documentation once React documentation contains information about Client Components\n 'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components'\n );\n\n let contextStorage = global[contextKey];\n if (!contextStorage) {\n contextStorage = global[contextKey] = new Map();\n }\n\n let context = contextStorage.get(React);\n if (!context) {\n context = React.createContext<ApolloContextValue>({});\n context.displayName = 'ApolloContext';\n contextStorage.set(React, context);\n }\n return context;\n}\n\n/**\n * @deprecated This function has no \"resetting\" effect since Apollo Client 3.4.12,\n * and will be removed in the next major version of Apollo Client.\n * If you want to get the Apollo Context, use `getApolloContext` instead.\n */\nexport const resetApolloContext = getApolloContext;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ApolloClient } from '../../core';
|
|
3
|
-
import { SuspenseCache } from '../cache';
|
|
2
|
+
import type { ApolloClient } from '../../core';
|
|
3
|
+
import type { SuspenseCache } from '../cache';
|
|
4
4
|
export interface ApolloProviderProps<TCache> {
|
|
5
5
|
client: ApolloClient<TCache>;
|
|
6
6
|
suspenseCache?: SuspenseCache;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ApolloProvider.d.ts","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,mBAAmB,CAAC,MAAM;IACzC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAAC,GAAG,CAAC,CA2B7D,CAAC"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
+
import { __assign } from "tslib";
|
|
1
2
|
import { invariant, __DEV__ } from "../../utilities/globals/index.js";
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { getApolloContext } from "./ApolloContext.js";
|
|
4
5
|
export var ApolloProvider = function (_a) {
|
|
5
6
|
var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
|
|
6
7
|
var ApolloContext = getApolloContext();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
__DEV__ ? invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
16
|
-
'sure you pass in your client via the "client" prop.') : invariant(context.client, 29);
|
|
17
|
-
return (React.createElement(ApolloContext.Provider, { value: context }, children));
|
|
18
|
-
}));
|
|
8
|
+
var parentContext = React.useContext(ApolloContext);
|
|
9
|
+
var context = React.useMemo(function () {
|
|
10
|
+
return __assign(__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
11
|
+
}, [parentContext, client, suspenseCache]);
|
|
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, 30);
|
|
14
|
+
return (React.createElement(ApolloContext.Provider, { value: context }, children));
|
|
19
15
|
};
|
|
20
16
|
//# sourceMappingURL=ApolloProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAIlE;QAHC,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,
|
|
1
|
+
{"version":3,"file":"ApolloProvider.js","sourceRoot":"","sources":["../../../src/react/context/ApolloProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AASnD,MAAM,CAAC,IAAM,cAAc,GAAuC,UAAC,EAIlE;QAHC,MAAM,YAAA,EACN,aAAa,mBAAA,EACb,QAAQ,cAAA;IAER,IAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAEtD,IAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC5B,6BACK,aAAa,KAChB,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EACtC,aAAa,EAAE,aAAa,IAAI,aAAa,CAAC,aAAa,IAC5D;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3C,SAAS,CACP,OAAO,CAAC,MAAM,EACd,wDAAwD;QACtD,qDAAqD,CACxD,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,IACnC,QAAQ,CACc,CAC1B,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { invariant } from '../../utilities/globals';\n\nimport * as React from 'react';\n\nimport type { ApolloClient } from '../../core';\nimport { getApolloContext } from './ApolloContext';\nimport type { SuspenseCache } from '../cache';\n\nexport interface ApolloProviderProps<TCache> {\n client: ApolloClient<TCache>;\n suspenseCache?: SuspenseCache;\n children: React.ReactNode | React.ReactNode[] | null;\n}\n\nexport const ApolloProvider: React.FC<ApolloProviderProps<any>> = ({\n client,\n suspenseCache,\n children\n}) => {\n const ApolloContext = getApolloContext();\n const parentContext = React.useContext(ApolloContext);\n\n const context = React.useMemo(() => {\n return {\n ...parentContext,\n client: client || parentContext.client,\n suspenseCache: suspenseCache || parentContext.suspenseCache\n }\n }, [parentContext, client, suspenseCache]);\n\n invariant(\n context.client,\n 'ApolloProvider was not passed a client instance. Make ' +\n 'sure you pass in your client via the \"client\" prop.'\n );\n\n return (\n <ApolloContext.Provider value={context}>\n {children}\n </ApolloContext.Provider>\n );\n};\n"]}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var globals = require('../../utilities/globals');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var utilities = require('../../utilities');
|
|
8
|
+
var tslib = require('tslib');
|
|
8
9
|
|
|
9
10
|
function _interopNamespace(e) {
|
|
10
11
|
if (e && e.__esModule) return e;
|
|
@@ -24,18 +25,23 @@ var contextKey = utilities.canUseSymbol
|
|
|
24
25
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
25
26
|
: '__APOLLO_CONTEXT__';
|
|
26
27
|
function getApolloContext() {
|
|
27
|
-
|
|
28
|
+
globals.__DEV__ ? globals.invariant('createContext' in React__namespace, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n' +
|
|
29
|
+
'The Apollo Client functionality you are trying to use is only available in React Client Components.\n' +
|
|
30
|
+
'Please make sure to add "use client" at the top of your file.\n' +
|
|
31
|
+
'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : globals.invariant('createContext' in React__namespace, 29);
|
|
32
|
+
var contextStorage = globals.global[contextKey];
|
|
33
|
+
if (!contextStorage) {
|
|
34
|
+
contextStorage = globals.global[contextKey] = new Map();
|
|
35
|
+
}
|
|
36
|
+
var context = contextStorage.get(React__namespace);
|
|
28
37
|
if (!context) {
|
|
29
|
-
|
|
30
|
-
value: context = React__namespace.createContext({}),
|
|
31
|
-
enumerable: false,
|
|
32
|
-
writable: false,
|
|
33
|
-
configurable: true,
|
|
34
|
-
});
|
|
38
|
+
context = React__namespace.createContext({});
|
|
35
39
|
context.displayName = 'ApolloContext';
|
|
40
|
+
contextStorage.set(React__namespace, context);
|
|
36
41
|
}
|
|
37
42
|
return context;
|
|
38
43
|
}
|
|
44
|
+
var resetApolloContext = getApolloContext;
|
|
39
45
|
|
|
40
46
|
var ApolloConsumer = function (props) {
|
|
41
47
|
var ApolloContext = getApolloContext();
|
|
@@ -49,22 +55,17 @@ var ApolloConsumer = function (props) {
|
|
|
49
55
|
var ApolloProvider = function (_a) {
|
|
50
56
|
var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
|
|
51
57
|
var ApolloContext = getApolloContext();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
globals.__DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
61
|
-
'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 29);
|
|
62
|
-
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
63
|
-
}));
|
|
58
|
+
var parentContext = React__namespace.useContext(ApolloContext);
|
|
59
|
+
var context = React__namespace.useMemo(function () {
|
|
60
|
+
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
61
|
+
}, [parentContext, client, suspenseCache]);
|
|
62
|
+
globals.__DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
63
|
+
'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 30);
|
|
64
|
+
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
exports.ApolloConsumer = ApolloConsumer;
|
|
67
68
|
exports.ApolloProvider = ApolloProvider;
|
|
68
69
|
exports.getApolloContext = getApolloContext;
|
|
69
|
-
exports.resetApolloContext =
|
|
70
|
+
exports.resetApolloContext = resetApolloContext;
|
|
70
71
|
//# sourceMappingURL=context.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseSymbol } from '../../utilities';\nvar contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\nexport function getApolloContext() {\n
|
|
1
|
+
{"version":3,"file":"context.cjs","sources":["ApolloContext.js","ApolloConsumer.js","ApolloProvider.js"],"sourcesContent":["import * as React from 'react';\nimport { canUseSymbol } from '../../utilities';\nimport { global, invariant, __DEV__ } from '../../utilities/globals';\nvar contextKey = canUseSymbol\n ? Symbol.for('__APOLLO_CONTEXT__')\n : '__APOLLO_CONTEXT__';\nexport function getApolloContext() {\n __DEV__ ? invariant('createContext' in React, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\\n' +\n 'The Apollo Client functionality you are trying to use is only available in React Client Components.\\n' +\n 'Please make sure to add \"use client\" at the top of your file.\\n' +\n 'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : invariant('createContext' in React, 29);\n var contextStorage = global[contextKey];\n if (!contextStorage) {\n contextStorage = global[contextKey] = new Map();\n }\n var context = contextStorage.get(React);\n if (!context) {\n context = React.createContext({});\n context.displayName = 'ApolloContext';\n contextStorage.set(React, context);\n }\n return context;\n}\nexport var resetApolloContext = getApolloContext;\n//# sourceMappingURL=ApolloContext.js.map","import { invariant, __DEV__ } from '../../utilities/globals';\nimport * as React from 'react';\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, 28);\n return props.children(context.client);\n }));\n};\n//# sourceMappingURL=ApolloConsumer.js.map","import { __assign } from \"tslib\";\nimport { invariant, __DEV__ } from '../../utilities/globals';\nimport * as React from 'react';\nimport { getApolloContext } from './ApolloContext';\nexport var ApolloProvider = function (_a) {\n var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;\n var ApolloContext = getApolloContext();\n var parentContext = React.useContext(ApolloContext);\n var context = React.useMemo(function () {\n return __assign(__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });\n }, [parentContext, client, suspenseCache]);\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, 30);\n return (React.createElement(ApolloContext.Provider, { value: context }, children));\n};\n//# sourceMappingURL=ApolloProvider.js.map"],"names":["canUseSymbol","__DEV__","invariant","React","global","__assign"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAI,UAAU,GAAGA,sBAAY;AAC7B,MAAM,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC;AACtC,MAAM,oBAAoB,CAAC;AACpB,SAAS,gBAAgB,GAAG;AACnC,IAAIC,eAAO,GAAGC,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,+FAA+F;AACjJ,QAAQ,uGAAuG;AAC/G,QAAQ,iEAAiE;AACzE,QAAQ,sGAAsG,CAAC,GAAGD,iBAAS,CAAC,eAAe,IAAIC,gBAAK,EAAE,EAAE,CAAC,CAAC;AAC1J,IAAI,IAAI,cAAc,GAAGC,cAAM,CAAC,UAAU,CAAC,CAAC;AAC5C,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB,QAAQ,cAAc,GAAGA,cAAM,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;AACxD,KAAK;AACL,IAAI,IAAI,OAAO,GAAG,cAAc,CAAC,GAAG,CAACD,gBAAK,CAAC,CAAC;AAC5C,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,cAAc,CAAC,GAAG,CAACA,gBAAK,EAAE,OAAO,CAAC,CAAC;AAC3C,KAAK;AACL,IAAI,OAAO,OAAO,CAAC;AACnB,CAAC;AACS,IAAC,kBAAkB,GAAG;;ACpBtB,IAAC,cAAc,GAAG,UAAU,KAAK,EAAE;AAC7C,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,QAAQA,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,OAAO,EAAE;AACjF,QAAQF,eAAO,GAAGC,iBAAS,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,4DAA4D;AACnH,YAAY,iDAAiD,CAAC,GAAGA,iBAAS,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,EAAE;AACR;;ACNU,IAAC,cAAc,GAAG,UAAU,EAAE,EAAE;AAC1C,IAAI,IAAI,MAAM,GAAG,EAAE,CAAC,MAAM,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC;AACrF,IAAI,IAAI,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC3C,IAAI,IAAI,aAAa,GAAGC,gBAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACxD,IAAI,IAAI,OAAO,GAAGA,gBAAK,CAAC,OAAO,CAAC,YAAY;AAC5C,QAAQ,OAAOE,cAAQ,CAACA,cAAQ,CAAC,EAAE,EAAE,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,IAAI,aAAa,CAAC,aAAa,EAAE,CAAC,CAAC;AAC9J,KAAK,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAC/C,IAAIJ,eAAO,GAAGC,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,wDAAwD;AAChG,QAAQ,qDAAqD,CAAC,GAAGA,iBAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC/F,IAAI,QAAQC,gBAAK,CAAC,aAAa,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,QAAQ,CAAC,EAAE;AACvF;;;;;;;"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var globals = require('../../utilities/globals');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var utilities = require('../../utilities');
|
|
8
|
+
var tslib = require('tslib');
|
|
8
9
|
|
|
9
10
|
function _interopNamespace(e) {
|
|
10
11
|
if (e && e.__esModule) return e;
|
|
@@ -24,18 +25,23 @@ var contextKey = utilities.canUseSymbol
|
|
|
24
25
|
? Symbol.for('__APOLLO_CONTEXT__')
|
|
25
26
|
: '__APOLLO_CONTEXT__';
|
|
26
27
|
function getApolloContext() {
|
|
27
|
-
|
|
28
|
+
globals.__DEV__ ? globals.invariant('createContext' in React__namespace, 'Invoking `getApolloContext` in an environment where `React.createContext` is not available.\n' +
|
|
29
|
+
'The Apollo Client functionality you are trying to use is only available in React Client Components.\n' +
|
|
30
|
+
'Please make sure to add "use client" at the top of your file.\n' +
|
|
31
|
+
'For more information, see https://nextjs.org/docs/getting-started/react-essentials#client-components') : globals.invariant('createContext' in React__namespace, 29);
|
|
32
|
+
var contextStorage = globals.global[contextKey];
|
|
33
|
+
if (!contextStorage) {
|
|
34
|
+
contextStorage = globals.global[contextKey] = new Map();
|
|
35
|
+
}
|
|
36
|
+
var context = contextStorage.get(React__namespace);
|
|
28
37
|
if (!context) {
|
|
29
|
-
|
|
30
|
-
value: context = React__namespace.createContext({}),
|
|
31
|
-
enumerable: false,
|
|
32
|
-
writable: false,
|
|
33
|
-
configurable: true,
|
|
34
|
-
});
|
|
38
|
+
context = React__namespace.createContext({});
|
|
35
39
|
context.displayName = 'ApolloContext';
|
|
40
|
+
contextStorage.set(React__namespace, context);
|
|
36
41
|
}
|
|
37
42
|
return context;
|
|
38
43
|
}
|
|
44
|
+
var resetApolloContext = getApolloContext;
|
|
39
45
|
|
|
40
46
|
var ApolloConsumer = function (props) {
|
|
41
47
|
var ApolloContext = getApolloContext();
|
|
@@ -49,22 +55,17 @@ var ApolloConsumer = function (props) {
|
|
|
49
55
|
var ApolloProvider = function (_a) {
|
|
50
56
|
var client = _a.client, suspenseCache = _a.suspenseCache, children = _a.children;
|
|
51
57
|
var ApolloContext = getApolloContext();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
globals.__DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
61
|
-
'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 29);
|
|
62
|
-
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
63
|
-
}));
|
|
58
|
+
var parentContext = React__namespace.useContext(ApolloContext);
|
|
59
|
+
var context = React__namespace.useMemo(function () {
|
|
60
|
+
return tslib.__assign(tslib.__assign({}, parentContext), { client: client || parentContext.client, suspenseCache: suspenseCache || parentContext.suspenseCache });
|
|
61
|
+
}, [parentContext, client, suspenseCache]);
|
|
62
|
+
globals.__DEV__ ? globals.invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
63
|
+
'sure you pass in your client via the "client" prop.') : globals.invariant(context.client, 30);
|
|
64
|
+
return (React__namespace.createElement(ApolloContext.Provider, { value: context }, children));
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
exports.ApolloConsumer = ApolloConsumer;
|
|
67
68
|
exports.ApolloProvider = ApolloProvider;
|
|
68
69
|
exports.getApolloContext = getApolloContext;
|
|
69
|
-
exports.resetApolloContext =
|
|
70
|
+
exports.resetApolloContext = resetApolloContext;
|
|
70
71
|
//# sourceMappingURL=context.cjs.map
|
package/react/context/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '../../utilities/globals';
|
|
2
2
|
export { ApolloConsumer, ApolloConsumerProps } from './ApolloConsumer';
|
|
3
|
-
export { ApolloContextValue, getApolloContext,
|
|
3
|
+
export { ApolloContextValue, getApolloContext, resetApolloContext } from './ApolloContext';
|
|
4
4
|
export { ApolloProvider, ApolloProviderProps } from './ApolloProvider';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
package/react/context/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../../utilities/globals/index.js";
|
|
2
2
|
export { ApolloConsumer } from "./ApolloConsumer.js";
|
|
3
|
-
export { getApolloContext,
|
|
3
|
+
export { getApolloContext, resetApolloContext } from "./ApolloContext.js";
|
|
4
4
|
export { ApolloProvider } from "./ApolloProvider.js";
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAEL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAEL,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAC","sourcesContent":["import '../../utilities/globals';\n\nexport { ApolloConsumer, ApolloConsumerProps } from './ApolloConsumer';\nexport {\n ApolloContextValue,\n getApolloContext,\n resetApolloContext\n} from './ApolloContext';\nexport { ApolloProvider, ApolloProviderProps } from './ApolloProvider';\n"]}
|
package/react/hoc/graphql.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DocumentNode } from 'graphql';
|
|
3
|
-
import { OperationOption, DataProps, MutateProps } from './types';
|
|
4
|
-
import { OperationVariables } from '../../core';
|
|
2
|
+
import type { DocumentNode } from 'graphql';
|
|
3
|
+
import type { OperationOption, DataProps, MutateProps } from './types';
|
|
4
|
+
import type { OperationVariables } from '../../core';
|
|
5
5
|
export declare function graphql<TProps extends TGraphQLVariables | {} = {}, TData extends object = {}, TGraphQLVariables extends OperationVariables = {}, TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> & Partial<MutateProps<TData, TGraphQLVariables>>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React.ComponentType<TProps & TChildProps>) => React.ComponentClass<TProps>;
|
|
6
6
|
//# sourceMappingURL=graphql.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAM5C,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,wBAAgB,OAAO,CACrB,MAAM,SAAS,iBAAiB,GAAG,EAAE,GAAG,EAAE,EAC1C,KAAK,SAAS,MAAM,GAAG,EAAE,EACzB,iBAAiB,SAAS,kBAAkB,GAAG,EAAE,EACjD,WAAW,SAAS,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,GACvE,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,EAEhD,QAAQ,EAAE,YAAY,EACtB,gBAAgB,GAAE,eAAe,CAC/B,MAAM,EACN,KAAK,EACL,iBAAiB,EACjB,WAAW,CACP,GACL,CACD,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,MAAM,GAAG,WAAW,CAAC,KACxD,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAUhC"}
|
package/react/hoc/graphql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,MAAM,UAAU,OAAO,CAOrB,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAIN,QAAQ,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;QAC7B,KAAK,YAAY,CAAC,QAAQ;YACxB,OAAO,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAClD,KAAK,YAAY,CAAC,YAAY;YAC5B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,KAAK,YAAY,CAAC,KAAK,CAAC;QACxB;YACE,OAAO,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;KAChD;AACH,CAAC","sourcesContent":["import { DocumentNode } from 'graphql';\n\nimport { parser, DocumentType } from '../parser';\nimport { withQuery } from './query-hoc';\nimport { withMutation } from './mutation-hoc';\nimport { withSubscription } from './subscription-hoc';\nimport { OperationOption, DataProps, MutateProps } from './types';\nimport { OperationVariables } from '../../core';\n\nexport function graphql<\n TProps extends TGraphQLVariables | {} = {},\n TData extends object = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> &\n Partial<MutateProps<TData, TGraphQLVariables>>\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n): (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n) => React.ComponentClass<TProps> {\n switch (parser(document).type) {\n case DocumentType.Mutation:\n return withMutation(document, operationOptions);\n case DocumentType.Subscription:\n return withSubscription(document, operationOptions);\n case DocumentType.Query:\n default:\n return withQuery(document, operationOptions);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../src/react/hoc/graphql.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD,MAAM,UAAU,OAAO,CAOrB,QAAsB,EACtB,gBAKM;IALN,iCAAA,EAAA,qBAKM;IAIN,QAAQ,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE;QAC7B,KAAK,YAAY,CAAC,QAAQ;YACxB,OAAO,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QAClD,KAAK,YAAY,CAAC,YAAY;YAC5B,OAAO,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACtD,KAAK,YAAY,CAAC,KAAK,CAAC;QACxB;YACE,OAAO,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;KAChD;AACH,CAAC","sourcesContent":["import type { DocumentNode } from 'graphql';\n\nimport { parser, DocumentType } from '../parser';\nimport { withQuery } from './query-hoc';\nimport { withMutation } from './mutation-hoc';\nimport { withSubscription } from './subscription-hoc';\nimport type { OperationOption, DataProps, MutateProps } from './types';\nimport type { OperationVariables } from '../../core';\n\nexport function graphql<\n TProps extends TGraphQLVariables | {} = {},\n TData extends object = {},\n TGraphQLVariables extends OperationVariables = {},\n TChildProps extends object = Partial<DataProps<TData, TGraphQLVariables>> &\n Partial<MutateProps<TData, TGraphQLVariables>>\n>(\n document: DocumentNode,\n operationOptions: OperationOption<\n TProps,\n TData,\n TGraphQLVariables,\n TChildProps\n > = {}\n): (\n WrappedComponent: React.ComponentType<TProps & TChildProps>\n) => React.ComponentClass<TProps> {\n switch (parser(document).type) {\n case DocumentType.Mutation:\n return withMutation(document, operationOptions);\n case DocumentType.Subscription:\n return withSubscription(document, operationOptions);\n case DocumentType.Query:\n default:\n return withQuery(document, operationOptions);\n }\n}\n"]}
|
package/react/hoc/hoc-utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { OperationVariables } from '../../core';
|
|
3
|
-
import { IDocumentDefinition } from '../parser';
|
|
2
|
+
import type { OperationVariables } from '../../core';
|
|
3
|
+
import type { IDocumentDefinition } from '../parser';
|
|
4
4
|
export declare const defaultMapPropsToOptions: () => {};
|
|
5
5
|
export declare const defaultMapResultToProps: <P>(props: P) => P;
|
|
6
6
|
export declare const defaultMapPropsToSkip: () => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoc-utils.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"hoc-utils.d.ts","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAErD,eAAO,MAAM,wBAAwB,UAAa,CAAC;AACnD,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,CAAkB,CAAC;AAC1E,eAAO,MAAM,qBAAqB,eAAc,CAAC;AAEjD,wBAAgB,cAAc,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,UAEzE;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAChD,SAAS,EAAE,mBAAmB,EAC9B,KAAK,EAAE,MAAM,sBAoBd;AAED,MAAM,MAAM,SAAS,CAAC,WAAW,IAAI,CACnC,GAAG,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,KACnC,IAAI,GAAG,IAAI,CAAC;AAGjB,qBAAa,WAAW,CACtB,MAAM,EACN,WAAW,EACX,MAAM,GAAG,GAAG,CACZ,SAAQ,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAChC,OAAO,EAAE,OAAO,CAAS;IAEhC,OAAO,CAAC,eAAe,CAAC,CAAoC;gBAEhD,KAAK,EAAE,MAAM;IAKzB,kBAAkB;IAUlB,kBAAkB,CAAC,GAAG,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;CAG1D"}
|
package/react/hoc/hoc-utils.js
CHANGED
|
@@ -35,7 +35,7 @@ var GraphQLBase = (function (_super) {
|
|
|
35
35
|
}
|
|
36
36
|
GraphQLBase.prototype.getWrappedInstance = function () {
|
|
37
37
|
__DEV__ ? invariant(this.withRef, "To access the wrapped instance, you need to specify " +
|
|
38
|
-
"{ withRef: true } in the options") : invariant(this.withRef,
|
|
38
|
+
"{ withRef: true } in the options") : invariant(this.withRef, 31);
|
|
39
39
|
return this.wrappedInstance;
|
|
40
40
|
};
|
|
41
41
|
GraphQLBase.prototype.setWrappedInstance = function (ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hoc-utils.js","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,IAAM,wBAAwB,GAAG,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,CAAC;AACnD,MAAM,CAAC,IAAM,uBAAuB,GAAuB,UAAA,KAAK,IAAI,OAAA,KAAK,EAAL,CAAK,CAAC;AAC1E,MAAM,CAAC,IAAM,qBAAqB,GAAG,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC;AAEjD,MAAM,UAAU,cAAc,CAAI,gBAAwC;IACxE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,SAA8B,EAC9B,KAAa;IAEb,IAAI,SAAS,GAAuB,EAAE,CAAC;IACvC,KAA+B,UAAmB,EAAnB,KAAA,SAAS,CAAC,SAAS,EAAnB,cAAmB,EAAnB,IAAmB,EAAE;QAA3C,IAAA,WAAkB,EAAhB,QAAQ,cAAA,EAAE,IAAI,UAAA;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;YAAE,SAAS;QAErD,IAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QACzC,IAAM,YAAY,GAAI,KAAa,CAAC,YAAY,CAAC,CAAC;QAElD,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,SAAS,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;YACvC,SAAS;SACV;QAGD,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE;YAC/B,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;SACrC;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAOD;IAIU,+BAA+B;IAKvC,qBAAY,KAAa;QAAzB,YACE,kBAAM,KAAK,CAAC,SAEb;QAPM,aAAO,GAAY,KAAK,CAAC;QAM9B,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;IAC/D,CAAC;IAED,wCAAkB,GAAlB;QACE,SAAS,CACP,IAAI,CAAC,OAAO,EACZ,sDAAsD;YACpD,kCAAkC,CACrC,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,wCAAkB,GAAlB,UAAmB,GAAsC;QACvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;IAC7B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3BD,CAIU,KAAK,CAAC,SAAS,GAuBxB","sourcesContent":["import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport { OperationVariables } from '../../core';\nimport { IDocumentDefinition } from '../parser';\n\nexport const defaultMapPropsToOptions = () => ({});\nexport const defaultMapResultToProps: <P>(props: P) => P = props => props;\nexport const defaultMapPropsToSkip = () => false;\n\nexport function getDisplayName<P>(WrappedComponent: React.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\n\nexport function calculateVariablesFromProps<TProps>(\n operation: IDocumentDefinition,\n props: TProps\n) {\n let variables: OperationVariables = {};\n for (let { variable, type } of operation.variables) {\n if (!variable.name || !variable.name.value) continue;\n\n const variableName = variable.name.value;\n const variableProp = (props as any)[variableName];\n\n if (typeof variableProp !== 'undefined') {\n variables[variableName] = variableProp;\n continue;\n }\n\n // Allow optional props\n if (type.kind !== 'NonNullType') {\n variables[variableName] = undefined;\n }\n }\n return variables;\n}\n\nexport type RefSetter<TChildProps> = (\n ref: React.ComponentClass<TChildProps>\n) => void | void;\n\n// base class for hocs to easily manage refs\nexport class GraphQLBase<\n TProps,\n TChildProps,\n TState = any\n> extends React.Component<TProps, TState> {\n public withRef: boolean = false;\n // wrapped instance\n private wrappedInstance?: React.ComponentClass<TChildProps>;\n\n constructor(props: TProps) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n this.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentClass<TChildProps>) {\n this.wrappedInstance = ref;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"hoc-utils.js","sourceRoot":"","sources":["../../../src/react/hoc/hoc-utils.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,CAAC,IAAM,wBAAwB,GAAG,cAAM,OAAA,CAAC,EAAE,CAAC,EAAJ,CAAI,CAAC;AACnD,MAAM,CAAC,IAAM,uBAAuB,GAAuB,UAAA,KAAK,IAAI,OAAA,KAAK,EAAL,CAAK,CAAC;AAC1E,MAAM,CAAC,IAAM,qBAAqB,GAAG,cAAM,OAAA,KAAK,EAAL,CAAK,CAAC;AAEjD,MAAM,UAAU,cAAc,CAAI,gBAAwC;IACxE,OAAO,gBAAgB,CAAC,WAAW,IAAI,gBAAgB,CAAC,IAAI,IAAI,WAAW,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,SAA8B,EAC9B,KAAa;IAEb,IAAI,SAAS,GAAuB,EAAE,CAAC;IACvC,KAA+B,UAAmB,EAAnB,KAAA,SAAS,CAAC,SAAS,EAAnB,cAAmB,EAAnB,IAAmB,EAAE;QAA3C,IAAA,WAAkB,EAAhB,QAAQ,cAAA,EAAE,IAAI,UAAA;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;YAAE,SAAS;QAErD,IAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QACzC,IAAM,YAAY,GAAI,KAAa,CAAC,YAAY,CAAC,CAAC;QAElD,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;YACvC,SAAS,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;YACvC,SAAS;SACV;QAGD,IAAI,IAAI,CAAC,IAAI,KAAK,aAAa,EAAE;YAC/B,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;SACrC;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAOD;IAIU,+BAA+B;IAKvC,qBAAY,KAAa;QAAzB,YACE,kBAAM,KAAK,CAAC,SAEb;QAPM,aAAO,GAAY,KAAK,CAAC;QAM9B,KAAI,CAAC,kBAAkB,GAAG,KAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;IAC/D,CAAC;IAED,wCAAkB,GAAlB;QACE,SAAS,CACP,IAAI,CAAC,OAAO,EACZ,sDAAsD;YACpD,kCAAkC,CACrC,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,wCAAkB,GAAlB,UAAmB,GAAsC;QACvD,IAAI,CAAC,eAAe,GAAG,GAAG,CAAC;IAC7B,CAAC;IACH,kBAAC;AAAD,CAAC,AA3BD,CAIU,KAAK,CAAC,SAAS,GAuBxB","sourcesContent":["import { invariant } from '../../utilities/globals';\nimport * as React from 'react';\nimport type { OperationVariables } from '../../core';\nimport type { IDocumentDefinition } from '../parser';\n\nexport const defaultMapPropsToOptions = () => ({});\nexport const defaultMapResultToProps: <P>(props: P) => P = props => props;\nexport const defaultMapPropsToSkip = () => false;\n\nexport function getDisplayName<P>(WrappedComponent: React.ComponentType<P>) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\n\nexport function calculateVariablesFromProps<TProps>(\n operation: IDocumentDefinition,\n props: TProps\n) {\n let variables: OperationVariables = {};\n for (let { variable, type } of operation.variables) {\n if (!variable.name || !variable.name.value) continue;\n\n const variableName = variable.name.value;\n const variableProp = (props as any)[variableName];\n\n if (typeof variableProp !== 'undefined') {\n variables[variableName] = variableProp;\n continue;\n }\n\n // Allow optional props\n if (type.kind !== 'NonNullType') {\n variables[variableName] = undefined;\n }\n }\n return variables;\n}\n\nexport type RefSetter<TChildProps> = (\n ref: React.ComponentClass<TChildProps>\n) => void | void;\n\n// base class for hocs to easily manage refs\nexport class GraphQLBase<\n TProps,\n TChildProps,\n TState = any\n> extends React.Component<TProps, TState> {\n public withRef: boolean = false;\n // wrapped instance\n private wrappedInstance?: React.ComponentClass<TChildProps>;\n\n constructor(props: TProps) {\n super(props);\n this.setWrappedInstance = this.setWrappedInstance.bind(this);\n }\n\n getWrappedInstance() {\n invariant(\n this.withRef,\n `To access the wrapped instance, you need to specify ` +\n `{ withRef: true } in the options`\n );\n\n return this.wrappedInstance;\n }\n\n setWrappedInstance(ref: React.ComponentClass<TChildProps>) {\n this.wrappedInstance = ref;\n }\n}\n"]}
|