@apollo/client 0.0.0-pr-10521-20230206180228
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/LICENSE +22 -0
- package/README.md +45 -0
- package/apollo-client.cjs +7614 -0
- package/apollo-client.cjs.map +1 -0
- package/apollo-client.min.cjs +1 -0
- package/cache/cache.cjs +2425 -0
- package/cache/cache.cjs.map +1 -0
- package/cache/cache.cjs.native.js +2425 -0
- package/cache/core/cache.d.ts +32 -0
- package/cache/core/cache.d.ts.map +1 -0
- package/cache/core/cache.js +84 -0
- package/cache/core/cache.js.map +1 -0
- package/cache/core/types/Cache.d.ts +55 -0
- package/cache/core/types/Cache.d.ts.map +1 -0
- package/cache/core/types/Cache.js +4 -0
- package/cache/core/types/Cache.js.map +1 -0
- package/cache/core/types/DataProxy.d.ts +52 -0
- package/cache/core/types/DataProxy.d.ts.map +1 -0
- package/cache/core/types/DataProxy.js +2 -0
- package/cache/core/types/DataProxy.js.map +1 -0
- package/cache/core/types/common.d.ts +47 -0
- package/cache/core/types/common.d.ts.map +1 -0
- package/cache/core/types/common.js +26 -0
- package/cache/core/types/common.js.map +1 -0
- package/cache/index.d.ts +15 -0
- package/cache/index.d.ts.map +1 -0
- package/cache/index.js +14 -0
- package/cache/index.js.map +1 -0
- package/cache/inmemory/__mocks__/optimism.d.ts +2 -0
- package/cache/inmemory/__mocks__/optimism.d.ts.map +1 -0
- package/cache/inmemory/__mocks__/optimism.js +14 -0
- package/cache/inmemory/__mocks__/optimism.js.map +1 -0
- package/cache/inmemory/entityStore.d.ts +83 -0
- package/cache/inmemory/entityStore.d.ts.map +1 -0
- package/cache/inmemory/entityStore.js +467 -0
- package/cache/inmemory/entityStore.js.map +1 -0
- package/cache/inmemory/fixPolyfills.d.ts +1 -0
- package/cache/inmemory/fixPolyfills.d.ts.map +1 -0
- package/cache/inmemory/fixPolyfills.js +1 -0
- package/cache/inmemory/fixPolyfills.js.map +1 -0
- package/cache/inmemory/fixPolyfills.native.d.ts +2 -0
- package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -0
- package/cache/inmemory/fixPolyfills.native.js +48 -0
- package/cache/inmemory/fixPolyfills.native.js.map +1 -0
- package/cache/inmemory/fragmentRegistry.d.ts +8 -0
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -0
- package/cache/inmemory/fragmentRegistry.js +113 -0
- package/cache/inmemory/fragmentRegistry.js.map +1 -0
- package/cache/inmemory/helpers.d.ts +27 -0
- package/cache/inmemory/helpers.d.ts.map +1 -0
- package/cache/inmemory/helpers.js +85 -0
- package/cache/inmemory/helpers.js.map +1 -0
- package/cache/inmemory/inMemoryCache.d.ts +52 -0
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -0
- package/cache/inmemory/inMemoryCache.js +316 -0
- package/cache/inmemory/inMemoryCache.js.map +1 -0
- package/cache/inmemory/key-extractor.d.ts +9 -0
- package/cache/inmemory/key-extractor.d.ts.map +1 -0
- package/cache/inmemory/key-extractor.js +118 -0
- package/cache/inmemory/key-extractor.js.map +1 -0
- package/cache/inmemory/object-canon.d.ts +17 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -0
- package/cache/inmemory/object-canon.js +120 -0
- package/cache/inmemory/object-canon.js.map +1 -0
- package/cache/inmemory/policies.d.ts +96 -0
- package/cache/inmemory/policies.d.ts.map +1 -0
- package/cache/inmemory/policies.js +416 -0
- package/cache/inmemory/policies.js.map +1 -0
- package/cache/inmemory/reactiveVars.d.ts +18 -0
- package/cache/inmemory/reactiveVars.d.ts.map +1 -0
- package/cache/inmemory/reactiveVars.js +65 -0
- package/cache/inmemory/reactiveVars.js.map +1 -0
- package/cache/inmemory/readFromStore.d.ts +36 -0
- package/cache/inmemory/readFromStore.d.ts.map +1 -0
- package/cache/inmemory/readFromStore.js +267 -0
- package/cache/inmemory/readFromStore.js.map +1 -0
- package/cache/inmemory/types.d.ts +81 -0
- package/cache/inmemory/types.d.ts.map +1 -0
- package/cache/inmemory/types.js +4 -0
- package/cache/inmemory/types.js.map +1 -0
- package/cache/inmemory/writeToStore.d.ts +37 -0
- package/cache/inmemory/writeToStore.d.ts.map +1 -0
- package/cache/inmemory/writeToStore.js +394 -0
- package/cache/inmemory/writeToStore.js.map +1 -0
- package/cache/package.json +8 -0
- package/config/jest/setup.d.ts +2 -0
- package/config/jest/setup.d.ts.map +1 -0
- package/config/jest/setup.js +5 -0
- package/config/jest/setup.js.map +1 -0
- package/core/ApolloClient.d.ts +76 -0
- package/core/ApolloClient.d.ts.map +1 -0
- package/core/ApolloClient.js +240 -0
- package/core/ApolloClient.js.map +1 -0
- package/core/LocalState.d.ts +69 -0
- package/core/LocalState.d.ts.map +1 -0
- package/core/LocalState.js +321 -0
- package/core/LocalState.js.map +1 -0
- package/core/ObservableQuery.d.ts +74 -0
- package/core/ObservableQuery.d.ts.map +1 -0
- package/core/ObservableQuery.js +507 -0
- package/core/ObservableQuery.js.map +1 -0
- package/core/QueryInfo.d.ts +62 -0
- package/core/QueryInfo.d.ts.map +1 -0
- package/core/QueryInfo.js +287 -0
- package/core/QueryInfo.js.map +1 -0
- package/core/QueryManager.d.ts +120 -0
- package/core/QueryManager.d.ts.map +1 -0
- package/core/QueryManager.js +890 -0
- package/core/QueryManager.js.map +1 -0
- package/core/core.cjs +2349 -0
- package/core/core.cjs.map +1 -0
- package/core/core.cjs.native.js +2349 -0
- package/core/index.d.ts +17 -0
- package/core/index.d.ts.map +1 -0
- package/core/index.js +17 -0
- package/core/index.js.map +1 -0
- package/core/networkStatus.d.ts +11 -0
- package/core/networkStatus.d.ts.map +1 -0
- package/core/networkStatus.js +14 -0
- package/core/networkStatus.js.map +1 -0
- package/core/package.json +8 -0
- package/core/types.d.ts +74 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +3 -0
- package/core/types.js.map +1 -0
- package/core/watchQueryOptions.d.ts +78 -0
- package/core/watchQueryOptions.d.ts.map +1 -0
- package/core/watchQueryOptions.js +2 -0
- package/core/watchQueryOptions.js.map +1 -0
- package/errors/errors.cjs +49 -0
- package/errors/errors.cjs.map +1 -0
- package/errors/errors.cjs.native.js +49 -0
- package/errors/index.d.ts +23 -0
- package/errors/index.d.ts.map +1 -0
- package/errors/index.js +42 -0
- package/errors/index.js.map +1 -0
- package/errors/package.json +8 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +3 -0
- package/index.js.map +1 -0
- package/invariantErrorCodes.js +339 -0
- package/link/batch/batch.cjs +159 -0
- package/link/batch/batch.cjs.map +1 -0
- package/link/batch/batch.cjs.native.js +159 -0
- package/link/batch/batchLink.d.ts +19 -0
- package/link/batch/batchLink.d.ts.map +1 -0
- package/link/batch/batchLink.js +31 -0
- package/link/batch/batchLink.js.map +1 -0
- package/link/batch/batching.d.ts +27 -0
- package/link/batch/batching.d.ts.map +1 -0
- package/link/batch/batching.js +125 -0
- package/link/batch/batching.js.map +1 -0
- package/link/batch/index.d.ts +2 -0
- package/link/batch/index.d.ts.map +1 -0
- package/link/batch/index.js +2 -0
- package/link/batch/index.js.map +1 -0
- package/link/batch/package.json +8 -0
- package/link/batch-http/batch-http.cjs +137 -0
- package/link/batch-http/batch-http.cjs.map +1 -0
- package/link/batch-http/batch-http.cjs.native.js +137 -0
- package/link/batch-http/batchHttpLink.d.ts +16 -0
- package/link/batch-http/batchHttpLink.d.ts.map +1 -0
- package/link/batch-http/batchHttpLink.js +131 -0
- package/link/batch-http/batchHttpLink.js.map +1 -0
- package/link/batch-http/index.d.ts +2 -0
- package/link/batch-http/index.d.ts.map +1 -0
- package/link/batch-http/index.js +2 -0
- package/link/batch-http/index.js.map +1 -0
- package/link/batch-http/package.json +8 -0
- package/link/context/context.cjs +38 -0
- package/link/context/context.cjs.map +1 -0
- package/link/context/context.cjs.native.js +38 -0
- package/link/context/index.d.ts +5 -0
- package/link/context/index.d.ts.map +1 -0
- package/link/context/index.js +31 -0
- package/link/context/index.js.map +1 -0
- package/link/context/package.json +8 -0
- package/link/core/ApolloLink.d.ts +16 -0
- package/link/core/ApolloLink.d.ts.map +1 -0
- package/link/core/ApolloLink.js +100 -0
- package/link/core/ApolloLink.js.map +1 -0
- package/link/core/concat.d.ts +3 -0
- package/link/core/concat.d.ts.map +1 -0
- package/link/core/concat.js +3 -0
- package/link/core/concat.js.map +1 -0
- package/link/core/core.cjs +121 -0
- package/link/core/core.cjs.map +1 -0
- package/link/core/core.cjs.native.js +121 -0
- package/link/core/empty.d.ts +3 -0
- package/link/core/empty.d.ts.map +1 -0
- package/link/core/empty.js +3 -0
- package/link/core/empty.js.map +1 -0
- package/link/core/execute.d.ts +3 -0
- package/link/core/execute.d.ts.map +1 -0
- package/link/core/execute.js +3 -0
- package/link/core/execute.js.map +1 -0
- package/link/core/from.d.ts +3 -0
- package/link/core/from.d.ts.map +1 -0
- package/link/core/from.js +3 -0
- package/link/core/from.js.map +1 -0
- package/link/core/index.d.ts +9 -0
- package/link/core/index.d.ts.map +1 -0
- package/link/core/index.js +9 -0
- package/link/core/index.js.map +1 -0
- package/link/core/package.json +8 -0
- package/link/core/split.d.ts +3 -0
- package/link/core/split.d.ts.map +1 -0
- package/link/core/split.js +3 -0
- package/link/core/split.js.map +1 -0
- package/link/core/types.d.ts +52 -0
- package/link/core/types.d.ts.map +1 -0
- package/link/core/types.js +2 -0
- package/link/core/types.js.map +1 -0
- package/link/error/error.cjs +90 -0
- package/link/error/error.cjs.map +1 -0
- package/link/error/error.cjs.native.js +90 -0
- package/link/error/index.d.ts +24 -0
- package/link/error/index.d.ts.map +1 -0
- package/link/error/index.js +83 -0
- package/link/error/index.js.map +1 -0
- package/link/error/package.json +8 -0
- package/link/http/HttpLink.d.ts +8 -0
- package/link/http/HttpLink.d.ts.map +1 -0
- package/link/http/HttpLink.js +15 -0
- package/link/http/HttpLink.js.map +1 -0
- package/link/http/checkFetcher.d.ts +2 -0
- package/link/http/checkFetcher.d.ts.map +1 -0
- package/link/http/checkFetcher.js +7 -0
- package/link/http/checkFetcher.js.map +1 -0
- package/link/http/createHttpLink.d.ts +4 -0
- package/link/http/createHttpLink.d.ts.map +1 -0
- package/link/http/createHttpLink.js +127 -0
- package/link/http/createHttpLink.js.map +1 -0
- package/link/http/createSignalIfSupported.d.ts +8 -0
- package/link/http/createSignalIfSupported.d.ts.map +1 -0
- package/link/http/createSignalIfSupported.js +8 -0
- package/link/http/createSignalIfSupported.js.map +1 -0
- package/link/http/http.cjs +593 -0
- package/link/http/http.cjs.map +1 -0
- package/link/http/http.cjs.native.js +593 -0
- package/link/http/index.d.ts +11 -0
- package/link/http/index.d.ts.map +1 -0
- package/link/http/index.js +11 -0
- package/link/http/index.js.map +1 -0
- package/link/http/iterators/async.d.ts +2 -0
- package/link/http/iterators/async.d.ts.map +1 -0
- package/link/http/iterators/async.js +14 -0
- package/link/http/iterators/async.js.map +1 -0
- package/link/http/iterators/nodeStream.d.ts +4 -0
- package/link/http/iterators/nodeStream.d.ts.map +1 -0
- package/link/http/iterators/nodeStream.js +71 -0
- package/link/http/iterators/nodeStream.js.map +1 -0
- package/link/http/iterators/promise.d.ts +2 -0
- package/link/http/iterators/promise.d.ts.map +1 -0
- package/link/http/iterators/promise.js +28 -0
- package/link/http/iterators/promise.js.map +1 -0
- package/link/http/iterators/reader.d.ts +2 -0
- package/link/http/iterators/reader.d.ts.map +1 -0
- package/link/http/iterators/reader.js +15 -0
- package/link/http/iterators/reader.js.map +1 -0
- package/link/http/package.json +8 -0
- package/link/http/parseAndCheckHttpResponse.d.ts +14 -0
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -0
- package/link/http/parseAndCheckHttpResponse.js +148 -0
- package/link/http/parseAndCheckHttpResponse.js.map +1 -0
- package/link/http/responseIterator.d.ts +3 -0
- package/link/http/responseIterator.d.ts.map +1 -0
- package/link/http/responseIterator.js +23 -0
- package/link/http/responseIterator.js.map +1 -0
- package/link/http/rewriteURIForGET.d.ts +9 -0
- package/link/http/rewriteURIForGET.d.ts.map +1 -0
- package/link/http/rewriteURIForGET.js +43 -0
- package/link/http/rewriteURIForGET.js.map +1 -0
- package/link/http/selectHttpOptionsAndBody.d.ts +57 -0
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -0
- package/link/http/selectHttpOptionsAndBody.js +78 -0
- package/link/http/selectHttpOptionsAndBody.js.map +1 -0
- package/link/http/selectURI.d.ts +3 -0
- package/link/http/selectURI.d.ts.map +1 -0
- package/link/http/selectURI.js +14 -0
- package/link/http/selectURI.js.map +1 -0
- package/link/http/serializeFetchParameter.d.ts +6 -0
- package/link/http/serializeFetchParameter.d.ts.map +1 -0
- package/link/http/serializeFetchParameter.js +14 -0
- package/link/http/serializeFetchParameter.js.map +1 -0
- package/link/persisted-queries/index.d.ts +31 -0
- package/link/persisted-queries/index.d.ts.map +1 -0
- package/link/persisted-queries/index.js +170 -0
- package/link/persisted-queries/index.js.map +1 -0
- package/link/persisted-queries/package.json +8 -0
- package/link/persisted-queries/persisted-queries.cjs +174 -0
- package/link/persisted-queries/persisted-queries.cjs.map +1 -0
- package/link/persisted-queries/persisted-queries.cjs.native.js +174 -0
- package/link/retry/delayFunction.d.ts +11 -0
- package/link/retry/delayFunction.d.ts.map +1 -0
- package/link/retry/delayFunction.js +12 -0
- package/link/retry/delayFunction.js.map +1 -0
- package/link/retry/index.d.ts +2 -0
- package/link/retry/index.d.ts.map +1 -0
- package/link/retry/index.js +2 -0
- package/link/retry/index.js.map +1 -0
- package/link/retry/package.json +8 -0
- package/link/retry/retry.cjs +170 -0
- package/link/retry/retry.cjs.map +1 -0
- package/link/retry/retry.cjs.native.js +170 -0
- package/link/retry/retryFunction.d.ts +10 -0
- package/link/retry/retryFunction.d.ts.map +1 -0
- package/link/retry/retryFunction.js +9 -0
- package/link/retry/retryFunction.js.map +1 -0
- package/link/retry/retryLink.d.ts +17 -0
- package/link/retry/retryLink.d.ts.map +1 -0
- package/link/retry/retryLink.js +145 -0
- package/link/retry/retryLink.js.map +1 -0
- package/link/schema/index.d.ts +22 -0
- package/link/schema/index.d.ts.map +1 -0
- package/link/schema/index.js +50 -0
- package/link/schema/index.js.map +1 -0
- package/link/schema/package.json +8 -0
- package/link/schema/schema.cjs +56 -0
- package/link/schema/schema.cjs.map +1 -0
- package/link/schema/schema.cjs.native.js +56 -0
- package/link/subscriptions/index.d.ts +9 -0
- package/link/subscriptions/index.d.ts.map +1 -0
- package/link/subscriptions/index.js +39 -0
- package/link/subscriptions/index.js.map +1 -0
- package/link/subscriptions/package.json +8 -0
- package/link/subscriptions/subscriptions.cjs +45 -0
- package/link/subscriptions/subscriptions.cjs.map +1 -0
- package/link/subscriptions/subscriptions.cjs.native.js +45 -0
- package/link/utils/createOperation.d.ts +3 -0
- package/link/utils/createOperation.d.ts.map +1 -0
- package/link/utils/createOperation.js +23 -0
- package/link/utils/createOperation.js.map +1 -0
- package/link/utils/fromError.d.ts +3 -0
- package/link/utils/fromError.d.ts.map +1 -0
- package/link/utils/fromError.js +7 -0
- package/link/utils/fromError.js.map +1 -0
- package/link/utils/fromPromise.d.ts +3 -0
- package/link/utils/fromPromise.d.ts.map +1 -0
- package/link/utils/fromPromise.js +12 -0
- package/link/utils/fromPromise.js.map +1 -0
- package/link/utils/index.d.ts +9 -0
- package/link/utils/index.d.ts.map +1 -0
- package/link/utils/index.js +9 -0
- package/link/utils/index.js.map +1 -0
- package/link/utils/package.json +8 -0
- package/link/utils/throwServerError.d.ts +7 -0
- package/link/utils/throwServerError.d.ts.map +1 -0
- package/link/utils/throwServerError.js +9 -0
- package/link/utils/throwServerError.js.map +1 -0
- package/link/utils/toPromise.d.ts +3 -0
- package/link/utils/toPromise.d.ts.map +1 -0
- package/link/utils/toPromise.js +19 -0
- package/link/utils/toPromise.js.map +1 -0
- package/link/utils/transformOperation.d.ts +3 -0
- package/link/utils/transformOperation.d.ts.map +1 -0
- package/link/utils/transformOperation.js +17 -0
- package/link/utils/transformOperation.js.map +1 -0
- package/link/utils/utils.cjs +115 -0
- package/link/utils/utils.cjs.map +1 -0
- package/link/utils/utils.cjs.native.js +115 -0
- package/link/utils/validateOperation.d.ts +3 -0
- package/link/utils/validateOperation.d.ts.map +1 -0
- package/link/utils/validateOperation.js +18 -0
- package/link/utils/validateOperation.js.map +1 -0
- package/link/ws/index.d.ts +17 -0
- package/link/ws/index.d.ts.map +1 -0
- package/link/ws/index.js +22 -0
- package/link/ws/index.js.map +1 -0
- package/link/ws/package.json +8 -0
- package/link/ws/ws.cjs +28 -0
- package/link/ws/ws.cjs.map +1 -0
- package/link/ws/ws.cjs.native.js +28 -0
- package/main.cjs +16 -0
- package/main.cjs.map +1 -0
- package/main.cjs.native.js +16 -0
- package/package.json +141 -0
- package/react/cache/SuspenseCache.d.ts +18 -0
- package/react/cache/SuspenseCache.d.ts.map +1 -0
- package/react/cache/SuspenseCache.js +49 -0
- package/react/cache/SuspenseCache.js.map +1 -0
- package/react/cache/index.d.ts +2 -0
- package/react/cache/index.d.ts.map +1 -0
- package/react/cache/index.js +2 -0
- package/react/cache/index.js.map +1 -0
- package/react/components/Mutation.d.ts +12 -0
- package/react/components/Mutation.d.ts.map +1 -0
- package/react/components/Mutation.js +22 -0
- package/react/components/Mutation.js.map +1 -0
- package/react/components/Query.d.ts +12 -0
- package/react/components/Query.d.ts.map +1 -0
- package/react/components/Query.js +23 -0
- package/react/components/Query.js.map +1 -0
- package/react/components/Subscription.d.ts +12 -0
- package/react/components/Subscription.d.ts.map +1 -0
- package/react/components/Subscription.js +17 -0
- package/react/components/Subscription.js.map +1 -0
- package/react/components/components.cjs +81 -0
- package/react/components/components.cjs.map +1 -0
- package/react/components/components.cjs.native.js +81 -0
- package/react/components/index.d.ts +5 -0
- package/react/components/index.d.ts.map +1 -0
- package/react/components/index.js +5 -0
- package/react/components/index.js.map +1 -0
- package/react/components/package.json +8 -0
- package/react/components/types.d.ts +18 -0
- package/react/components/types.d.ts.map +1 -0
- package/react/components/types.js +2 -0
- package/react/components/types.js.map +1 -0
- package/react/context/ApolloConsumer.d.ts +7 -0
- package/react/context/ApolloConsumer.d.ts.map +1 -0
- package/react/context/ApolloConsumer.js +12 -0
- package/react/context/ApolloConsumer.js.map +1 -0
- package/react/context/ApolloContext.d.ts +12 -0
- package/react/context/ApolloContext.d.ts.map +1 -0
- package/react/context/ApolloContext.js +20 -0
- package/react/context/ApolloContext.js.map +1 -0
- package/react/context/ApolloProvider.d.ts +10 -0
- package/react/context/ApolloProvider.d.ts.map +1 -0
- package/react/context/ApolloProvider.js +20 -0
- package/react/context/ApolloProvider.js.map +1 -0
- package/react/context/context.cjs +70 -0
- package/react/context/context.cjs.map +1 -0
- package/react/context/context.cjs.native.js +70 -0
- package/react/context/index.d.ts +5 -0
- package/react/context/index.d.ts.map +1 -0
- package/react/context/index.js +5 -0
- package/react/context/index.js.map +1 -0
- package/react/context/package.json +8 -0
- package/react/hoc/graphql.d.ts +6 -0
- package/react/hoc/graphql.d.ts.map +1 -0
- package/react/hoc/graphql.js +17 -0
- package/react/hoc/graphql.js.map +1 -0
- package/react/hoc/hoc-utils.d.ts +17 -0
- package/react/hoc/hoc-utils.d.ts.map +1 -0
- package/react/hoc/hoc-utils.js +47 -0
- package/react/hoc/hoc-utils.js.map +1 -0
- package/react/hoc/hoc.cjs +325 -0
- package/react/hoc/hoc.cjs.map +1 -0
- package/react/hoc/hoc.cjs.native.js +325 -0
- package/react/hoc/index.d.ts +8 -0
- package/react/hoc/index.d.ts.map +1 -0
- package/react/hoc/index.js +8 -0
- package/react/hoc/index.js.map +1 -0
- package/react/hoc/mutation-hoc.d.ts +7 -0
- package/react/hoc/mutation-hoc.d.ts.map +1 -0
- package/react/hoc/mutation-hoc.js +63 -0
- package/react/hoc/mutation-hoc.js.map +1 -0
- package/react/hoc/package.json +8 -0
- package/react/hoc/query-hoc.d.ts +5 -0
- package/react/hoc/query-hoc.d.ts.map +1 -0
- package/react/hoc/query-hoc.js +70 -0
- package/react/hoc/query-hoc.js.map +1 -0
- package/react/hoc/subscription-hoc.d.ts +5 -0
- package/react/hoc/subscription-hoc.d.ts.map +1 -0
- package/react/hoc/subscription-hoc.js +80 -0
- package/react/hoc/subscription-hoc.js.map +1 -0
- package/react/hoc/types.d.ts +43 -0
- package/react/hoc/types.d.ts.map +1 -0
- package/react/hoc/types.js +2 -0
- package/react/hoc/types.js.map +1 -0
- package/react/hoc/withApollo.d.ts +4 -0
- package/react/hoc/withApollo.d.ts.map +1 -0
- package/react/hoc/withApollo.js +45 -0
- package/react/hoc/withApollo.js.map +1 -0
- package/react/hooks/compareResults.d.ts +3 -0
- package/react/hooks/compareResults.d.ts.map +1 -0
- package/react/hooks/compareResults.js +63 -0
- package/react/hooks/compareResults.js.map +1 -0
- package/react/hooks/hooks.cjs +913 -0
- package/react/hooks/hooks.cjs.map +1 -0
- package/react/hooks/hooks.cjs.native.js +913 -0
- package/react/hooks/index.d.ts +10 -0
- package/react/hooks/index.d.ts.map +1 -0
- package/react/hooks/index.js +10 -0
- package/react/hooks/index.js.map +1 -0
- package/react/hooks/internal/index.d.ts +3 -0
- package/react/hooks/internal/index.d.ts.map +1 -0
- package/react/hooks/internal/index.js +3 -0
- package/react/hooks/internal/index.js.map +1 -0
- package/react/hooks/internal/useDeepMemo.d.ts +3 -0
- package/react/hooks/internal/useDeepMemo.d.ts.map +1 -0
- package/react/hooks/internal/useDeepMemo.js +10 -0
- package/react/hooks/internal/useDeepMemo.js.map +1 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts +3 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js +6 -0
- package/react/hooks/internal/useIsomorphicLayoutEffect.js.map +1 -0
- package/react/hooks/package.json +8 -0
- package/react/hooks/useApolloClient.d.ts +3 -0
- package/react/hooks/useApolloClient.d.ts.map +1 -0
- package/react/hooks/useApolloClient.js +12 -0
- package/react/hooks/useApolloClient.js.map +1 -0
- package/react/hooks/useFragment.d.ts +13 -0
- package/react/hooks/useFragment.d.ts.map +1 -0
- package/react/hooks/useFragment.js +39 -0
- package/react/hooks/useFragment.js.map +1 -0
- package/react/hooks/useLazyQuery.d.ts +6 -0
- package/react/hooks/useLazyQuery.d.ts.map +1 -0
- package/react/hooks/useLazyQuery.js +71 -0
- package/react/hooks/useLazyQuery.js.map +1 -0
- package/react/hooks/useMutation.d.ts +6 -0
- package/react/hooks/useMutation.d.ts.map +1 -0
- package/react/hooks/useMutation.js +100 -0
- package/react/hooks/useMutation.js.map +1 -0
- package/react/hooks/useQuery.d.ts +41 -0
- package/react/hooks/useQuery.d.ts.map +1 -0
- package/react/hooks/useQuery.js +302 -0
- package/react/hooks/useQuery.js.map +1 -0
- package/react/hooks/useReactiveVar.d.ts +3 -0
- package/react/hooks/useReactiveVar.d.ts.map +1 -0
- package/react/hooks/useReactiveVar.js +16 -0
- package/react/hooks/useReactiveVar.js.map +1 -0
- package/react/hooks/useSubscription.d.ts +6 -0
- package/react/hooks/useSubscription.d.ts.map +1 -0
- package/react/hooks/useSubscription.js +141 -0
- package/react/hooks/useSubscription.js.map +1 -0
- package/react/hooks/useSuspenseCache.d.ts +2 -0
- package/react/hooks/useSuspenseCache.d.ts.map +1 -0
- package/react/hooks/useSuspenseCache.js +10 -0
- package/react/hooks/useSuspenseCache.js.map +1 -0
- package/react/hooks/useSuspenseQuery.d.ts +12 -0
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -0
- package/react/hooks/useSuspenseQuery.js +181 -0
- package/react/hooks/useSuspenseQuery.js.map +1 -0
- package/react/hooks/useSyncExternalStore.d.ts +4 -0
- package/react/hooks/useSyncExternalStore.d.ts.map +1 -0
- package/react/hooks/useSyncExternalStore.js +48 -0
- package/react/hooks/useSyncExternalStore.js.map +1 -0
- package/react/index.d.ts +7 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +7 -0
- package/react/index.js.map +1 -0
- package/react/package.json +8 -0
- package/react/parser/index.d.ts +15 -0
- package/react/parser/index.d.ts.map +1 -0
- package/react/parser/index.js +94 -0
- package/react/parser/index.js.map +1 -0
- package/react/parser/package.json +8 -0
- package/react/parser/parser.cjs +103 -0
- package/react/parser/parser.cjs.map +1 -0
- package/react/parser/parser.cjs.native.js +103 -0
- package/react/react.cjs +69 -0
- package/react/react.cjs.map +1 -0
- package/react/react.cjs.native.js +69 -0
- package/react/ssr/RenderPromises.d.ts +22 -0
- package/react/ssr/RenderPromises.d.ts.map +1 -0
- package/react/ssr/RenderPromises.js +90 -0
- package/react/ssr/RenderPromises.js.map +1 -0
- package/react/ssr/getDataFromTree.d.ts +13 -0
- package/react/ssr/getDataFromTree.d.ts.map +1 -0
- package/react/ssr/getDataFromTree.js +32 -0
- package/react/ssr/getDataFromTree.js.map +1 -0
- package/react/ssr/index.d.ts +4 -0
- package/react/ssr/index.d.ts.map +1 -0
- package/react/ssr/index.js +4 -0
- package/react/ssr/index.js.map +1 -0
- package/react/ssr/package.json +8 -0
- package/react/ssr/renderToStringWithData.d.ts +3 -0
- package/react/ssr/renderToStringWithData.d.ts.map +1 -0
- package/react/ssr/renderToStringWithData.js +9 -0
- package/react/ssr/renderToStringWithData.js.map +1 -0
- package/react/ssr/ssr.cjs +151 -0
- package/react/ssr/ssr.cjs.map +1 -0
- package/react/ssr/ssr.cjs.native.js +151 -0
- package/react/types/types.d.ts +130 -0
- package/react/types/types.d.ts.map +1 -0
- package/react/types/types.js +2 -0
- package/react/types/types.js.map +1 -0
- package/testing/core/core.cjs +315 -0
- package/testing/core/core.cjs.map +1 -0
- package/testing/core/core.cjs.native.js +315 -0
- package/testing/core/index.d.ts +8 -0
- package/testing/core/index.d.ts.map +1 -0
- package/testing/core/index.js +8 -0
- package/testing/core/index.js.map +1 -0
- package/testing/core/itAsync.d.ts +6 -0
- package/testing/core/itAsync.d.ts.map +1 -0
- package/testing/core/itAsync.js +19 -0
- package/testing/core/itAsync.js.map +1 -0
- package/testing/core/mocking/mockClient.d.ts +5 -0
- package/testing/core/mocking/mockClient.d.ts.map +1 -0
- package/testing/core/mocking/mockClient.js +14 -0
- package/testing/core/mocking/mockClient.js.map +1 -0
- package/testing/core/mocking/mockFetch.d.ts +24 -0
- package/testing/core/mocking/mockFetch.d.ts.map +1 -0
- package/testing/core/mocking/mockFetch.js +83 -0
- package/testing/core/mocking/mockFetch.js.map +1 -0
- package/testing/core/mocking/mockLink.d.ts +28 -0
- package/testing/core/mocking/mockLink.d.ts.map +1 -0
- package/testing/core/mocking/mockLink.js +139 -0
- package/testing/core/mocking/mockLink.js.map +1 -0
- package/testing/core/mocking/mockQueryManager.d.ts +5 -0
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -0
- package/testing/core/mocking/mockQueryManager.js +14 -0
- package/testing/core/mocking/mockQueryManager.js.map +1 -0
- package/testing/core/mocking/mockSubscriptionLink.d.ts +24 -0
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -0
- package/testing/core/mocking/mockSubscriptionLink.js +62 -0
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -0
- package/testing/core/mocking/mockWatchQuery.d.ts +5 -0
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -0
- package/testing/core/mocking/mockWatchQuery.js +15 -0
- package/testing/core/mocking/mockWatchQuery.js.map +1 -0
- package/testing/core/observableToPromise.d.ts +15 -0
- package/testing/core/observableToPromise.d.ts.map +1 -0
- package/testing/core/observableToPromise.js +65 -0
- package/testing/core/observableToPromise.js.map +1 -0
- package/testing/core/package.json +8 -0
- package/testing/core/subscribeAndCount.d.ts +3 -0
- package/testing/core/subscribeAndCount.d.ts.map +1 -0
- package/testing/core/subscribeAndCount.js +16 -0
- package/testing/core/subscribeAndCount.js.map +1 -0
- package/testing/core/wait.d.ts +3 -0
- package/testing/core/wait.d.ts.map +1 -0
- package/testing/core/wait.js +16 -0
- package/testing/core/wait.js.map +1 -0
- package/testing/core/withConsoleSpy.d.ts +4 -0
- package/testing/core/withConsoleSpy.d.ts.map +1 -0
- package/testing/core/withConsoleSpy.js +39 -0
- package/testing/core/withConsoleSpy.js.map +1 -0
- package/testing/core/wrap.d.ts +4 -0
- package/testing/core/wrap.d.ts.map +1 -0
- package/testing/core/wrap.js +26 -0
- package/testing/core/wrap.js.map +1 -0
- package/testing/index.d.ts +4 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +4 -0
- package/testing/index.js.map +1 -0
- package/testing/package.json +8 -0
- package/testing/react/MockedProvider.d.ts +30 -0
- package/testing/react/MockedProvider.d.ts.map +1 -0
- package/testing/react/MockedProvider.js +39 -0
- package/testing/react/MockedProvider.js.map +1 -0
- package/testing/testing.cjs +109 -0
- package/testing/testing.cjs.map +1 -0
- package/testing/testing.cjs.native.js +109 -0
- package/utilities/common/arrays.d.ts +2 -0
- package/utilities/common/arrays.d.ts.map +1 -0
- package/utilities/common/arrays.js +4 -0
- package/utilities/common/arrays.js.map +1 -0
- package/utilities/common/canUse.d.ts +7 -0
- package/utilities/common/canUse.d.ts.map +1 -0
- package/utilities/common/canUse.js +11 -0
- package/utilities/common/canUse.js.map +1 -0
- package/utilities/common/cloneDeep.d.ts +2 -0
- package/utilities/common/cloneDeep.d.ts.map +1 -0
- package/utilities/common/cloneDeep.js +33 -0
- package/utilities/common/cloneDeep.js.map +1 -0
- package/utilities/common/compact.d.ts +3 -0
- package/utilities/common/compact.d.ts.map +1 -0
- package/utilities/common/compact.js +19 -0
- package/utilities/common/compact.js.map +1 -0
- package/utilities/common/errorHandling.d.ts +4 -0
- package/utilities/common/errorHandling.d.ts.map +1 -0
- package/utilities/common/errorHandling.js +21 -0
- package/utilities/common/errorHandling.js.map +1 -0
- package/utilities/common/filterInPlace.d.ts +2 -0
- package/utilities/common/filterInPlace.d.ts.map +1 -0
- package/utilities/common/filterInPlace.js +11 -0
- package/utilities/common/filterInPlace.js.map +1 -0
- package/utilities/common/incrementalResult.d.ts +6 -0
- package/utilities/common/incrementalResult.d.ts.map +1 -0
- package/utilities/common/incrementalResult.js +32 -0
- package/utilities/common/incrementalResult.js.map +1 -0
- package/utilities/common/makeUniqueId.d.ts +2 -0
- package/utilities/common/makeUniqueId.d.ts.map +1 -0
- package/utilities/common/makeUniqueId.js +7 -0
- package/utilities/common/makeUniqueId.js.map +1 -0
- package/utilities/common/maybeDeepFreeze.d.ts +2 -0
- package/utilities/common/maybeDeepFreeze.d.ts.map +1 -0
- package/utilities/common/maybeDeepFreeze.js +34 -0
- package/utilities/common/maybeDeepFreeze.js.map +1 -0
- package/utilities/common/mergeDeep.d.ts +14 -0
- package/utilities/common/mergeDeep.d.ts.map +1 -0
- package/utilities/common/mergeDeep.js +76 -0
- package/utilities/common/mergeDeep.js.map +1 -0
- package/utilities/common/mergeOptions.d.ts +5 -0
- package/utilities/common/mergeOptions.d.ts.map +1 -0
- package/utilities/common/mergeOptions.js +8 -0
- package/utilities/common/mergeOptions.js.map +1 -0
- package/utilities/common/objects.d.ts +2 -0
- package/utilities/common/objects.d.ts.map +1 -0
- package/utilities/common/objects.js +4 -0
- package/utilities/common/objects.js.map +1 -0
- package/utilities/common/responseIterator.d.ts +10 -0
- package/utilities/common/responseIterator.d.ts.map +1 -0
- package/utilities/common/responseIterator.js +21 -0
- package/utilities/common/responseIterator.js.map +1 -0
- 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 +9 -0
- package/utilities/globals/DEV.js.map +1 -0
- package/utilities/globals/fix-graphql.d.ts +2 -0
- package/utilities/globals/fix-graphql.d.ts.map +1 -0
- package/utilities/globals/fix-graphql.js +6 -0
- package/utilities/globals/fix-graphql.js.map +1 -0
- package/utilities/globals/global.d.ts +5 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/globals/global.js +6 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs +42 -0
- package/utilities/globals/globals.cjs.map +1 -0
- package/utilities/globals/globals.cjs.native.js +42 -0
- package/utilities/globals/index.d.ts +8 -0
- package/utilities/globals/index.d.ts.map +1 -0
- package/utilities/globals/index.js +10 -0
- package/utilities/globals/index.js.map +1 -0
- package/utilities/globals/maybe.d.ts +2 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/globals/maybe.js +7 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +8 -0
- package/utilities/graphql/directives.d.ts +18 -0
- package/utilities/graphql/directives.d.ts.map +1 -0
- package/utilities/graphql/directives.js +72 -0
- package/utilities/graphql/directives.js.map +1 -0
- package/utilities/graphql/fragments.d.ts +9 -0
- package/utilities/graphql/fragments.d.ts.map +1 -0
- package/utilities/graphql/fragments.js +64 -0
- package/utilities/graphql/fragments.js.map +1 -0
- package/utilities/graphql/getFromAST.d.ts +10 -0
- package/utilities/graphql/getFromAST.d.ts.map +1 -0
- package/utilities/graphql/getFromAST.js +76 -0
- package/utilities/graphql/getFromAST.js.map +1 -0
- package/utilities/graphql/storeUtils.d.ts +32 -0
- package/utilities/graphql/storeUtils.d.ts.map +1 -0
- package/utilities/graphql/storeUtils.js +208 -0
- package/utilities/graphql/storeUtils.js.map +1 -0
- package/utilities/graphql/transform.d.ts +27 -0
- package/utilities/graphql/transform.d.ts.map +1 -0
- package/utilities/graphql/transform.js +281 -0
- package/utilities/graphql/transform.js.map +1 -0
- package/utilities/index.d.ts +27 -0
- package/utilities/index.d.ts.map +1 -0
- package/utilities/index.js +27 -0
- package/utilities/index.js.map +1 -0
- package/utilities/observables/Concast.d.ts +27 -0
- package/utilities/observables/Concast.d.ts.map +1 -0
- package/utilities/observables/Concast.js +137 -0
- package/utilities/observables/Concast.js.map +1 -0
- package/utilities/observables/Observable.d.ts +5 -0
- package/utilities/observables/Observable.d.ts.map +1 -0
- package/utilities/observables/Observable.js +9 -0
- package/utilities/observables/Observable.js.map +1 -0
- package/utilities/observables/asyncMap.d.ts +3 -0
- package/utilities/observables/asyncMap.d.ts.map +1 -0
- package/utilities/observables/asyncMap.js +49 -0
- package/utilities/observables/asyncMap.js.map +1 -0
- package/utilities/observables/iteration.d.ts +3 -0
- package/utilities/observables/iteration.d.ts.map +1 -0
- package/utilities/observables/iteration.js +6 -0
- package/utilities/observables/iteration.js.map +1 -0
- package/utilities/observables/subclassing.d.ts +3 -0
- package/utilities/observables/subclassing.d.ts.map +1 -0
- package/utilities/observables/subclassing.js +13 -0
- package/utilities/observables/subclassing.js.map +1 -0
- package/utilities/package.json +8 -0
- package/utilities/policies/pagination.d.ts +28 -0
- package/utilities/policies/pagination.d.ts.map +1 -0
- package/utilities/policies/pagination.js +151 -0
- package/utilities/policies/pagination.js.map +1 -0
- package/utilities/types/IsStrictlyAny.d.ts +5 -0
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -0
- package/utilities/types/IsStrictlyAny.js +2 -0
- package/utilities/types/IsStrictlyAny.js.map +1 -0
- package/utilities/utilities.cjs +1371 -0
- package/utilities/utilities.cjs.map +1 -0
- package/utilities/utilities.cjs.native.js +1371 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +2 -0
- package/version.js.map +1 -0
|
@@ -0,0 +1,1371 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var globals = require('./globals');
|
|
6
|
+
var graphql = require('graphql');
|
|
7
|
+
var tslib = require('tslib');
|
|
8
|
+
var zenObservableTs = require('zen-observable-ts');
|
|
9
|
+
require('symbol-observable');
|
|
10
|
+
|
|
11
|
+
function shouldInclude(_a, variables) {
|
|
12
|
+
var directives = _a.directives;
|
|
13
|
+
if (!directives || !directives.length) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
return getInclusionDirectives(directives).every(function (_a) {
|
|
17
|
+
var directive = _a.directive, ifArgument = _a.ifArgument;
|
|
18
|
+
var evaledValue = false;
|
|
19
|
+
if (ifArgument.value.kind === 'Variable') {
|
|
20
|
+
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
21
|
+
globals.__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 41);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
evaledValue = ifArgument.value.value;
|
|
25
|
+
}
|
|
26
|
+
return directive.name.value === 'skip' ? !evaledValue : evaledValue;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function getDirectiveNames(root) {
|
|
30
|
+
var names = [];
|
|
31
|
+
graphql.visit(root, {
|
|
32
|
+
Directive: function (node) {
|
|
33
|
+
names.push(node.name.value);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
return names;
|
|
37
|
+
}
|
|
38
|
+
var hasAnyDirectives = function (names, root) { return hasDirectives(names, root, false); };
|
|
39
|
+
var hasAllDirectives = function (names, root) { return hasDirectives(names, root, true); };
|
|
40
|
+
function hasDirectives(names, root, all) {
|
|
41
|
+
var nameSet = new Set(names);
|
|
42
|
+
var uniqueCount = nameSet.size;
|
|
43
|
+
graphql.visit(root, {
|
|
44
|
+
Directive: function (node) {
|
|
45
|
+
if (nameSet.delete(node.name.value) &&
|
|
46
|
+
(!all || !nameSet.size)) {
|
|
47
|
+
return graphql.BREAK;
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return all ? !nameSet.size : nameSet.size < uniqueCount;
|
|
52
|
+
}
|
|
53
|
+
function hasClientExports(document) {
|
|
54
|
+
return document && hasDirectives(['client', 'export'], document, true);
|
|
55
|
+
}
|
|
56
|
+
function isInclusionDirective(_a) {
|
|
57
|
+
var value = _a.name.value;
|
|
58
|
+
return value === 'skip' || value === 'include';
|
|
59
|
+
}
|
|
60
|
+
function getInclusionDirectives(directives) {
|
|
61
|
+
var result = [];
|
|
62
|
+
if (directives && directives.length) {
|
|
63
|
+
directives.forEach(function (directive) {
|
|
64
|
+
if (!isInclusionDirective(directive))
|
|
65
|
+
return;
|
|
66
|
+
var directiveArguments = directive.arguments;
|
|
67
|
+
var directiveName = directive.name.value;
|
|
68
|
+
globals.__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 42);
|
|
69
|
+
var ifArgument = directiveArguments[0];
|
|
70
|
+
globals.__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
|
|
71
|
+
var ifValue = ifArgument.value;
|
|
72
|
+
globals.__DEV__ ? globals.invariant(ifValue &&
|
|
73
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : globals.invariant(ifValue &&
|
|
74
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
|
|
75
|
+
result.push({ directive: directive, ifArgument: ifArgument });
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getFragmentQueryDocument(document, fragmentName) {
|
|
82
|
+
var actualFragmentName = fragmentName;
|
|
83
|
+
var fragments = [];
|
|
84
|
+
document.definitions.forEach(function (definition) {
|
|
85
|
+
if (definition.kind === 'OperationDefinition') {
|
|
86
|
+
throw globals.__DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
87
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(45);
|
|
88
|
+
}
|
|
89
|
+
if (definition.kind === 'FragmentDefinition') {
|
|
90
|
+
fragments.push(definition);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
if (typeof actualFragmentName === 'undefined') {
|
|
94
|
+
globals.__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 46);
|
|
95
|
+
actualFragmentName = fragments[0].name.value;
|
|
96
|
+
}
|
|
97
|
+
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
98
|
+
{
|
|
99
|
+
kind: 'OperationDefinition',
|
|
100
|
+
operation: 'query',
|
|
101
|
+
selectionSet: {
|
|
102
|
+
kind: 'SelectionSet',
|
|
103
|
+
selections: [
|
|
104
|
+
{
|
|
105
|
+
kind: 'FragmentSpread',
|
|
106
|
+
name: {
|
|
107
|
+
kind: 'Name',
|
|
108
|
+
value: actualFragmentName,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
], document.definitions, true) });
|
|
115
|
+
return query;
|
|
116
|
+
}
|
|
117
|
+
function createFragmentMap(fragments) {
|
|
118
|
+
if (fragments === void 0) { fragments = []; }
|
|
119
|
+
var symTable = {};
|
|
120
|
+
fragments.forEach(function (fragment) {
|
|
121
|
+
symTable[fragment.name.value] = fragment;
|
|
122
|
+
});
|
|
123
|
+
return symTable;
|
|
124
|
+
}
|
|
125
|
+
function getFragmentFromSelection(selection, fragmentMap) {
|
|
126
|
+
switch (selection.kind) {
|
|
127
|
+
case 'InlineFragment':
|
|
128
|
+
return selection;
|
|
129
|
+
case 'FragmentSpread': {
|
|
130
|
+
var fragmentName = selection.name.value;
|
|
131
|
+
if (typeof fragmentMap === "function") {
|
|
132
|
+
return fragmentMap(fragmentName);
|
|
133
|
+
}
|
|
134
|
+
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
135
|
+
globals.__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 47);
|
|
136
|
+
return fragment || null;
|
|
137
|
+
}
|
|
138
|
+
default:
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isNonNullObject(obj) {
|
|
144
|
+
return obj !== null && typeof obj === 'object';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function makeReference(id) {
|
|
148
|
+
return { __ref: String(id) };
|
|
149
|
+
}
|
|
150
|
+
function isReference(obj) {
|
|
151
|
+
return Boolean(obj && typeof obj === 'object' && typeof obj.__ref === 'string');
|
|
152
|
+
}
|
|
153
|
+
function isDocumentNode(value) {
|
|
154
|
+
return (isNonNullObject(value) &&
|
|
155
|
+
value.kind === "Document" &&
|
|
156
|
+
Array.isArray(value.definitions));
|
|
157
|
+
}
|
|
158
|
+
function isStringValue(value) {
|
|
159
|
+
return value.kind === 'StringValue';
|
|
160
|
+
}
|
|
161
|
+
function isBooleanValue(value) {
|
|
162
|
+
return value.kind === 'BooleanValue';
|
|
163
|
+
}
|
|
164
|
+
function isIntValue(value) {
|
|
165
|
+
return value.kind === 'IntValue';
|
|
166
|
+
}
|
|
167
|
+
function isFloatValue(value) {
|
|
168
|
+
return value.kind === 'FloatValue';
|
|
169
|
+
}
|
|
170
|
+
function isVariable(value) {
|
|
171
|
+
return value.kind === 'Variable';
|
|
172
|
+
}
|
|
173
|
+
function isObjectValue(value) {
|
|
174
|
+
return value.kind === 'ObjectValue';
|
|
175
|
+
}
|
|
176
|
+
function isListValue(value) {
|
|
177
|
+
return value.kind === 'ListValue';
|
|
178
|
+
}
|
|
179
|
+
function isEnumValue(value) {
|
|
180
|
+
return value.kind === 'EnumValue';
|
|
181
|
+
}
|
|
182
|
+
function isNullValue(value) {
|
|
183
|
+
return value.kind === 'NullValue';
|
|
184
|
+
}
|
|
185
|
+
function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
186
|
+
if (isIntValue(value) || isFloatValue(value)) {
|
|
187
|
+
argObj[name.value] = Number(value.value);
|
|
188
|
+
}
|
|
189
|
+
else if (isBooleanValue(value) || isStringValue(value)) {
|
|
190
|
+
argObj[name.value] = value.value;
|
|
191
|
+
}
|
|
192
|
+
else if (isObjectValue(value)) {
|
|
193
|
+
var nestedArgObj_1 = {};
|
|
194
|
+
value.fields.map(function (obj) {
|
|
195
|
+
return valueToObjectRepresentation(nestedArgObj_1, obj.name, obj.value, variables);
|
|
196
|
+
});
|
|
197
|
+
argObj[name.value] = nestedArgObj_1;
|
|
198
|
+
}
|
|
199
|
+
else if (isVariable(value)) {
|
|
200
|
+
var variableValue = (variables || {})[value.name.value];
|
|
201
|
+
argObj[name.value] = variableValue;
|
|
202
|
+
}
|
|
203
|
+
else if (isListValue(value)) {
|
|
204
|
+
argObj[name.value] = value.values.map(function (listValue) {
|
|
205
|
+
var nestedArgArrayObj = {};
|
|
206
|
+
valueToObjectRepresentation(nestedArgArrayObj, name, listValue, variables);
|
|
207
|
+
return nestedArgArrayObj[name.value];
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else if (isEnumValue(value)) {
|
|
211
|
+
argObj[name.value] = value.value;
|
|
212
|
+
}
|
|
213
|
+
else if (isNullValue(value)) {
|
|
214
|
+
argObj[name.value] = null;
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
throw globals.__DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
218
|
+
'is not supported. Use variables instead of inline arguments to ' +
|
|
219
|
+
'overcome this limitation.') : new globals.InvariantError(56);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function storeKeyNameFromField(field, variables) {
|
|
223
|
+
var directivesObj = null;
|
|
224
|
+
if (field.directives) {
|
|
225
|
+
directivesObj = {};
|
|
226
|
+
field.directives.forEach(function (directive) {
|
|
227
|
+
directivesObj[directive.name.value] = {};
|
|
228
|
+
if (directive.arguments) {
|
|
229
|
+
directive.arguments.forEach(function (_a) {
|
|
230
|
+
var name = _a.name, value = _a.value;
|
|
231
|
+
return valueToObjectRepresentation(directivesObj[directive.name.value], name, value, variables);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
var argObj = null;
|
|
237
|
+
if (field.arguments && field.arguments.length) {
|
|
238
|
+
argObj = {};
|
|
239
|
+
field.arguments.forEach(function (_a) {
|
|
240
|
+
var name = _a.name, value = _a.value;
|
|
241
|
+
return valueToObjectRepresentation(argObj, name, value, variables);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return getStoreKeyName(field.name.value, argObj, directivesObj);
|
|
245
|
+
}
|
|
246
|
+
var KNOWN_DIRECTIVES = [
|
|
247
|
+
'connection',
|
|
248
|
+
'include',
|
|
249
|
+
'skip',
|
|
250
|
+
'client',
|
|
251
|
+
'rest',
|
|
252
|
+
'export',
|
|
253
|
+
];
|
|
254
|
+
var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
255
|
+
if (args &&
|
|
256
|
+
directives &&
|
|
257
|
+
directives['connection'] &&
|
|
258
|
+
directives['connection']['key']) {
|
|
259
|
+
if (directives['connection']['filter'] &&
|
|
260
|
+
directives['connection']['filter'].length > 0) {
|
|
261
|
+
var filterKeys = directives['connection']['filter']
|
|
262
|
+
? directives['connection']['filter']
|
|
263
|
+
: [];
|
|
264
|
+
filterKeys.sort();
|
|
265
|
+
var filteredArgs_1 = {};
|
|
266
|
+
filterKeys.forEach(function (key) {
|
|
267
|
+
filteredArgs_1[key] = args[key];
|
|
268
|
+
});
|
|
269
|
+
return "".concat(directives['connection']['key'], "(").concat(stringify(filteredArgs_1), ")");
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
return directives['connection']['key'];
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
var completeFieldName = fieldName;
|
|
276
|
+
if (args) {
|
|
277
|
+
var stringifiedArgs = stringify(args);
|
|
278
|
+
completeFieldName += "(".concat(stringifiedArgs, ")");
|
|
279
|
+
}
|
|
280
|
+
if (directives) {
|
|
281
|
+
Object.keys(directives).forEach(function (key) {
|
|
282
|
+
if (KNOWN_DIRECTIVES.indexOf(key) !== -1)
|
|
283
|
+
return;
|
|
284
|
+
if (directives[key] && Object.keys(directives[key]).length) {
|
|
285
|
+
completeFieldName += "@".concat(key, "(").concat(stringify(directives[key]), ")");
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
completeFieldName += "@".concat(key);
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
return completeFieldName;
|
|
293
|
+
}, {
|
|
294
|
+
setStringify: function (s) {
|
|
295
|
+
var previous = stringify;
|
|
296
|
+
stringify = s;
|
|
297
|
+
return previous;
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
var stringify = function defaultStringify(value) {
|
|
301
|
+
return JSON.stringify(value, stringifyReplacer);
|
|
302
|
+
};
|
|
303
|
+
function stringifyReplacer(_key, value) {
|
|
304
|
+
if (isNonNullObject(value) && !Array.isArray(value)) {
|
|
305
|
+
value = Object.keys(value).sort().reduce(function (copy, key) {
|
|
306
|
+
copy[key] = value[key];
|
|
307
|
+
return copy;
|
|
308
|
+
}, {});
|
|
309
|
+
}
|
|
310
|
+
return value;
|
|
311
|
+
}
|
|
312
|
+
function argumentsObjectFromField(field, variables) {
|
|
313
|
+
if (field.arguments && field.arguments.length) {
|
|
314
|
+
var argObj_1 = {};
|
|
315
|
+
field.arguments.forEach(function (_a) {
|
|
316
|
+
var name = _a.name, value = _a.value;
|
|
317
|
+
return valueToObjectRepresentation(argObj_1, name, value, variables);
|
|
318
|
+
});
|
|
319
|
+
return argObj_1;
|
|
320
|
+
}
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
function resultKeyNameFromField(field) {
|
|
324
|
+
return field.alias ? field.alias.value : field.name.value;
|
|
325
|
+
}
|
|
326
|
+
function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
327
|
+
if (typeof result.__typename === 'string') {
|
|
328
|
+
return result.__typename;
|
|
329
|
+
}
|
|
330
|
+
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
|
331
|
+
var selection = _a[_i];
|
|
332
|
+
if (isField(selection)) {
|
|
333
|
+
if (selection.name.value === '__typename') {
|
|
334
|
+
return result[resultKeyNameFromField(selection)];
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
339
|
+
if (typeof typename === 'string') {
|
|
340
|
+
return typename;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
function isField(selection) {
|
|
346
|
+
return selection.kind === 'Field';
|
|
347
|
+
}
|
|
348
|
+
function isInlineFragment(selection) {
|
|
349
|
+
return selection.kind === 'InlineFragment';
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function checkDocument(doc) {
|
|
353
|
+
globals.__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 48);
|
|
354
|
+
var operations = doc.definitions
|
|
355
|
+
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
356
|
+
.map(function (definition) {
|
|
357
|
+
if (definition.kind !== 'OperationDefinition') {
|
|
358
|
+
throw globals.__DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(49);
|
|
359
|
+
}
|
|
360
|
+
return definition;
|
|
361
|
+
});
|
|
362
|
+
globals.__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 50);
|
|
363
|
+
return doc;
|
|
364
|
+
}
|
|
365
|
+
function getOperationDefinition(doc) {
|
|
366
|
+
checkDocument(doc);
|
|
367
|
+
return doc.definitions.filter(function (definition) { return definition.kind === 'OperationDefinition'; })[0];
|
|
368
|
+
}
|
|
369
|
+
function getOperationName(doc) {
|
|
370
|
+
return (doc.definitions
|
|
371
|
+
.filter(function (definition) {
|
|
372
|
+
return definition.kind === 'OperationDefinition' && definition.name;
|
|
373
|
+
})
|
|
374
|
+
.map(function (x) { return x.name.value; })[0] || null);
|
|
375
|
+
}
|
|
376
|
+
function getFragmentDefinitions(doc) {
|
|
377
|
+
return doc.definitions.filter(function (definition) { return definition.kind === 'FragmentDefinition'; });
|
|
378
|
+
}
|
|
379
|
+
function getQueryDefinition(doc) {
|
|
380
|
+
var queryDef = getOperationDefinition(doc);
|
|
381
|
+
globals.__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 51);
|
|
382
|
+
return queryDef;
|
|
383
|
+
}
|
|
384
|
+
function getFragmentDefinition(doc) {
|
|
385
|
+
globals.__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 52);
|
|
386
|
+
globals.__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
|
|
387
|
+
var fragmentDef = doc.definitions[0];
|
|
388
|
+
globals.__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
|
|
389
|
+
return fragmentDef;
|
|
390
|
+
}
|
|
391
|
+
function getMainDefinition(queryDoc) {
|
|
392
|
+
checkDocument(queryDoc);
|
|
393
|
+
var fragmentDefinition;
|
|
394
|
+
for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {
|
|
395
|
+
var definition = _a[_i];
|
|
396
|
+
if (definition.kind === 'OperationDefinition') {
|
|
397
|
+
var operation = definition.operation;
|
|
398
|
+
if (operation === 'query' ||
|
|
399
|
+
operation === 'mutation' ||
|
|
400
|
+
operation === 'subscription') {
|
|
401
|
+
return definition;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (definition.kind === 'FragmentDefinition' && !fragmentDefinition) {
|
|
405
|
+
fragmentDefinition = definition;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
if (fragmentDefinition) {
|
|
409
|
+
return fragmentDefinition;
|
|
410
|
+
}
|
|
411
|
+
throw globals.__DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(55);
|
|
412
|
+
}
|
|
413
|
+
function getDefaultValues(definition) {
|
|
414
|
+
var defaultValues = Object.create(null);
|
|
415
|
+
var defs = definition && definition.variableDefinitions;
|
|
416
|
+
if (defs && defs.length) {
|
|
417
|
+
defs.forEach(function (def) {
|
|
418
|
+
if (def.defaultValue) {
|
|
419
|
+
valueToObjectRepresentation(defaultValues, def.variable.name, def.defaultValue);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
return defaultValues;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function filterInPlace(array, test, context) {
|
|
427
|
+
var target = 0;
|
|
428
|
+
array.forEach(function (elem, i) {
|
|
429
|
+
if (test.call(this, elem, i, array)) {
|
|
430
|
+
array[target++] = elem;
|
|
431
|
+
}
|
|
432
|
+
}, context);
|
|
433
|
+
array.length = target;
|
|
434
|
+
return array;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
var TYPENAME_FIELD = {
|
|
438
|
+
kind: 'Field',
|
|
439
|
+
name: {
|
|
440
|
+
kind: 'Name',
|
|
441
|
+
value: '__typename',
|
|
442
|
+
},
|
|
443
|
+
};
|
|
444
|
+
function isEmpty(op, fragmentMap) {
|
|
445
|
+
return !op || op.selectionSet.selections.every(function (selection) { return selection.kind === 'FragmentSpread' &&
|
|
446
|
+
isEmpty(fragmentMap[selection.name.value], fragmentMap); });
|
|
447
|
+
}
|
|
448
|
+
function nullIfDocIsEmpty(doc) {
|
|
449
|
+
return isEmpty(getOperationDefinition(doc) || getFragmentDefinition(doc), createFragmentMap(getFragmentDefinitions(doc)))
|
|
450
|
+
? null
|
|
451
|
+
: doc;
|
|
452
|
+
}
|
|
453
|
+
function getDirectiveMatcher(directives) {
|
|
454
|
+
return function directiveMatcher(directive) {
|
|
455
|
+
return directives.some(function (dir) {
|
|
456
|
+
return (dir.name && dir.name === directive.name.value) ||
|
|
457
|
+
(dir.test && dir.test(directive));
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function removeDirectivesFromDocument(directives, doc) {
|
|
462
|
+
var variablesInUse = Object.create(null);
|
|
463
|
+
var variablesToRemove = [];
|
|
464
|
+
var fragmentSpreadsInUse = Object.create(null);
|
|
465
|
+
var fragmentSpreadsToRemove = [];
|
|
466
|
+
var modifiedDoc = nullIfDocIsEmpty(graphql.visit(doc, {
|
|
467
|
+
Variable: {
|
|
468
|
+
enter: function (node, _key, parent) {
|
|
469
|
+
if (parent.kind !== 'VariableDefinition') {
|
|
470
|
+
variablesInUse[node.name.value] = true;
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
Field: {
|
|
475
|
+
enter: function (node) {
|
|
476
|
+
if (directives && node.directives) {
|
|
477
|
+
var shouldRemoveField = directives.some(function (directive) { return directive.remove; });
|
|
478
|
+
if (shouldRemoveField &&
|
|
479
|
+
node.directives &&
|
|
480
|
+
node.directives.some(getDirectiveMatcher(directives))) {
|
|
481
|
+
if (node.arguments) {
|
|
482
|
+
node.arguments.forEach(function (arg) {
|
|
483
|
+
if (arg.value.kind === 'Variable') {
|
|
484
|
+
variablesToRemove.push({
|
|
485
|
+
name: arg.value.name.value,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
if (node.selectionSet) {
|
|
491
|
+
getAllFragmentSpreadsFromSelectionSet(node.selectionSet).forEach(function (frag) {
|
|
492
|
+
fragmentSpreadsToRemove.push({
|
|
493
|
+
name: frag.name.value,
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
return null;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
},
|
|
502
|
+
FragmentSpread: {
|
|
503
|
+
enter: function (node) {
|
|
504
|
+
fragmentSpreadsInUse[node.name.value] = true;
|
|
505
|
+
},
|
|
506
|
+
},
|
|
507
|
+
Directive: {
|
|
508
|
+
enter: function (node) {
|
|
509
|
+
if (getDirectiveMatcher(directives)(node)) {
|
|
510
|
+
return null;
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
}));
|
|
515
|
+
if (modifiedDoc &&
|
|
516
|
+
filterInPlace(variablesToRemove, function (v) { return !!v.name && !variablesInUse[v.name]; }).length) {
|
|
517
|
+
modifiedDoc = removeArgumentsFromDocument(variablesToRemove, modifiedDoc);
|
|
518
|
+
}
|
|
519
|
+
if (modifiedDoc &&
|
|
520
|
+
filterInPlace(fragmentSpreadsToRemove, function (fs) { return !!fs.name && !fragmentSpreadsInUse[fs.name]; })
|
|
521
|
+
.length) {
|
|
522
|
+
modifiedDoc = removeFragmentSpreadFromDocument(fragmentSpreadsToRemove, modifiedDoc);
|
|
523
|
+
}
|
|
524
|
+
return modifiedDoc;
|
|
525
|
+
}
|
|
526
|
+
var addTypenameToDocument = Object.assign(function (doc) {
|
|
527
|
+
return graphql.visit(doc, {
|
|
528
|
+
SelectionSet: {
|
|
529
|
+
enter: function (node, _key, parent) {
|
|
530
|
+
if (parent &&
|
|
531
|
+
parent.kind === 'OperationDefinition') {
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
var selections = node.selections;
|
|
535
|
+
if (!selections) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
var skip = selections.some(function (selection) {
|
|
539
|
+
return (isField(selection) &&
|
|
540
|
+
(selection.name.value === '__typename' ||
|
|
541
|
+
selection.name.value.lastIndexOf('__', 0) === 0));
|
|
542
|
+
});
|
|
543
|
+
if (skip) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
var field = parent;
|
|
547
|
+
if (isField(field) &&
|
|
548
|
+
field.directives &&
|
|
549
|
+
field.directives.some(function (d) { return d.name.value === 'export'; })) {
|
|
550
|
+
return;
|
|
551
|
+
}
|
|
552
|
+
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
|
|
553
|
+
},
|
|
554
|
+
},
|
|
555
|
+
});
|
|
556
|
+
}, {
|
|
557
|
+
added: function (field) {
|
|
558
|
+
return field === TYPENAME_FIELD;
|
|
559
|
+
},
|
|
560
|
+
});
|
|
561
|
+
var connectionRemoveConfig = {
|
|
562
|
+
test: function (directive) {
|
|
563
|
+
var willRemove = directive.name.value === 'connection';
|
|
564
|
+
if (willRemove) {
|
|
565
|
+
if (!directive.arguments ||
|
|
566
|
+
!directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
|
|
567
|
+
globals.__DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
|
568
|
+
'You may want to use the key parameter to specify a store key.');
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
return willRemove;
|
|
572
|
+
},
|
|
573
|
+
};
|
|
574
|
+
function removeConnectionDirectiveFromDocument(doc) {
|
|
575
|
+
return removeDirectivesFromDocument([connectionRemoveConfig], checkDocument(doc));
|
|
576
|
+
}
|
|
577
|
+
function getArgumentMatcher(config) {
|
|
578
|
+
return function argumentMatcher(argument) {
|
|
579
|
+
return config.some(function (aConfig) {
|
|
580
|
+
return argument.value &&
|
|
581
|
+
argument.value.kind === 'Variable' &&
|
|
582
|
+
argument.value.name &&
|
|
583
|
+
(aConfig.name === argument.value.name.value ||
|
|
584
|
+
(aConfig.test && aConfig.test(argument)));
|
|
585
|
+
});
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
function removeArgumentsFromDocument(config, doc) {
|
|
589
|
+
var argMatcher = getArgumentMatcher(config);
|
|
590
|
+
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
591
|
+
OperationDefinition: {
|
|
592
|
+
enter: function (node) {
|
|
593
|
+
return tslib.__assign(tslib.__assign({}, node), { variableDefinitions: node.variableDefinitions ? node.variableDefinitions.filter(function (varDef) {
|
|
594
|
+
return !config.some(function (arg) { return arg.name === varDef.variable.name.value; });
|
|
595
|
+
}) : [] });
|
|
596
|
+
},
|
|
597
|
+
},
|
|
598
|
+
Field: {
|
|
599
|
+
enter: function (node) {
|
|
600
|
+
var shouldRemoveField = config.some(function (argConfig) { return argConfig.remove; });
|
|
601
|
+
if (shouldRemoveField) {
|
|
602
|
+
var argMatchCount_1 = 0;
|
|
603
|
+
if (node.arguments) {
|
|
604
|
+
node.arguments.forEach(function (arg) {
|
|
605
|
+
if (argMatcher(arg)) {
|
|
606
|
+
argMatchCount_1 += 1;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
if (argMatchCount_1 === 1) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
Argument: {
|
|
617
|
+
enter: function (node) {
|
|
618
|
+
if (argMatcher(node)) {
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
},
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
function removeFragmentSpreadFromDocument(config, doc) {
|
|
626
|
+
function enter(node) {
|
|
627
|
+
if (config.some(function (def) { return def.name === node.name.value; })) {
|
|
628
|
+
return null;
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
return nullIfDocIsEmpty(graphql.visit(doc, {
|
|
632
|
+
FragmentSpread: { enter: enter },
|
|
633
|
+
FragmentDefinition: { enter: enter },
|
|
634
|
+
}));
|
|
635
|
+
}
|
|
636
|
+
function getAllFragmentSpreadsFromSelectionSet(selectionSet) {
|
|
637
|
+
var allFragments = [];
|
|
638
|
+
selectionSet.selections.forEach(function (selection) {
|
|
639
|
+
if ((isField(selection) || isInlineFragment(selection)) &&
|
|
640
|
+
selection.selectionSet) {
|
|
641
|
+
getAllFragmentSpreadsFromSelectionSet(selection.selectionSet).forEach(function (frag) { return allFragments.push(frag); });
|
|
642
|
+
}
|
|
643
|
+
else if (selection.kind === 'FragmentSpread') {
|
|
644
|
+
allFragments.push(selection);
|
|
645
|
+
}
|
|
646
|
+
});
|
|
647
|
+
return allFragments;
|
|
648
|
+
}
|
|
649
|
+
function buildQueryFromSelectionSet(document) {
|
|
650
|
+
var definition = getMainDefinition(document);
|
|
651
|
+
var definitionOperation = definition.operation;
|
|
652
|
+
if (definitionOperation === 'query') {
|
|
653
|
+
return document;
|
|
654
|
+
}
|
|
655
|
+
var modifiedDoc = graphql.visit(document, {
|
|
656
|
+
OperationDefinition: {
|
|
657
|
+
enter: function (node) {
|
|
658
|
+
return tslib.__assign(tslib.__assign({}, node), { operation: 'query' });
|
|
659
|
+
},
|
|
660
|
+
},
|
|
661
|
+
});
|
|
662
|
+
return modifiedDoc;
|
|
663
|
+
}
|
|
664
|
+
function removeClientSetsFromDocument(document) {
|
|
665
|
+
checkDocument(document);
|
|
666
|
+
var modifiedDoc = removeDirectivesFromDocument([
|
|
667
|
+
{
|
|
668
|
+
test: function (directive) { return directive.name.value === 'client'; },
|
|
669
|
+
remove: true,
|
|
670
|
+
},
|
|
671
|
+
], document);
|
|
672
|
+
if (modifiedDoc) {
|
|
673
|
+
modifiedDoc = graphql.visit(modifiedDoc, {
|
|
674
|
+
FragmentDefinition: {
|
|
675
|
+
enter: function (node) {
|
|
676
|
+
if (node.selectionSet) {
|
|
677
|
+
var isTypenameOnly = node.selectionSet.selections.every(function (selection) {
|
|
678
|
+
return isField(selection) && selection.name.value === '__typename';
|
|
679
|
+
});
|
|
680
|
+
if (isTypenameOnly) {
|
|
681
|
+
return null;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return modifiedDoc;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
692
|
+
function mergeDeep() {
|
|
693
|
+
var sources = [];
|
|
694
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
695
|
+
sources[_i] = arguments[_i];
|
|
696
|
+
}
|
|
697
|
+
return mergeDeepArray(sources);
|
|
698
|
+
}
|
|
699
|
+
function mergeDeepArray(sources) {
|
|
700
|
+
var target = sources[0] || {};
|
|
701
|
+
var count = sources.length;
|
|
702
|
+
if (count > 1) {
|
|
703
|
+
var merger = new DeepMerger();
|
|
704
|
+
for (var i = 1; i < count; ++i) {
|
|
705
|
+
target = merger.merge(target, sources[i]);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
return target;
|
|
709
|
+
}
|
|
710
|
+
var defaultReconciler = function (target, source, property) {
|
|
711
|
+
return this.merge(target[property], source[property]);
|
|
712
|
+
};
|
|
713
|
+
var DeepMerger = (function () {
|
|
714
|
+
function DeepMerger(reconciler) {
|
|
715
|
+
if (reconciler === void 0) { reconciler = defaultReconciler; }
|
|
716
|
+
this.reconciler = reconciler;
|
|
717
|
+
this.isObject = isNonNullObject;
|
|
718
|
+
this.pastCopies = new Set();
|
|
719
|
+
}
|
|
720
|
+
DeepMerger.prototype.merge = function (target, source) {
|
|
721
|
+
var _this = this;
|
|
722
|
+
var context = [];
|
|
723
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
724
|
+
context[_i - 2] = arguments[_i];
|
|
725
|
+
}
|
|
726
|
+
if (isNonNullObject(source) && isNonNullObject(target)) {
|
|
727
|
+
Object.keys(source).forEach(function (sourceKey) {
|
|
728
|
+
if (hasOwnProperty.call(target, sourceKey)) {
|
|
729
|
+
var targetValue = target[sourceKey];
|
|
730
|
+
if (source[sourceKey] !== targetValue) {
|
|
731
|
+
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
|
|
732
|
+
if (result !== targetValue) {
|
|
733
|
+
target = _this.shallowCopyForMerge(target);
|
|
734
|
+
target[sourceKey] = result;
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
target = _this.shallowCopyForMerge(target);
|
|
740
|
+
target[sourceKey] = source[sourceKey];
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
return target;
|
|
744
|
+
}
|
|
745
|
+
return source;
|
|
746
|
+
};
|
|
747
|
+
DeepMerger.prototype.shallowCopyForMerge = function (value) {
|
|
748
|
+
if (isNonNullObject(value)) {
|
|
749
|
+
if (!this.pastCopies.has(value)) {
|
|
750
|
+
if (Array.isArray(value)) {
|
|
751
|
+
value = value.slice(0);
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
755
|
+
}
|
|
756
|
+
this.pastCopies.add(value);
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
return value;
|
|
760
|
+
};
|
|
761
|
+
return DeepMerger;
|
|
762
|
+
}());
|
|
763
|
+
|
|
764
|
+
function concatPagination(keyArgs) {
|
|
765
|
+
if (keyArgs === void 0) { keyArgs = false; }
|
|
766
|
+
return {
|
|
767
|
+
keyArgs: keyArgs,
|
|
768
|
+
merge: function (existing, incoming) {
|
|
769
|
+
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming;
|
|
770
|
+
},
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
function offsetLimitPagination(keyArgs) {
|
|
774
|
+
if (keyArgs === void 0) { keyArgs = false; }
|
|
775
|
+
return {
|
|
776
|
+
keyArgs: keyArgs,
|
|
777
|
+
merge: function (existing, incoming, _a) {
|
|
778
|
+
var args = _a.args;
|
|
779
|
+
var merged = existing ? existing.slice(0) : [];
|
|
780
|
+
if (incoming) {
|
|
781
|
+
if (args) {
|
|
782
|
+
var _b = args.offset, offset = _b === void 0 ? 0 : _b;
|
|
783
|
+
for (var i = 0; i < incoming.length; ++i) {
|
|
784
|
+
merged[offset + i] = incoming[i];
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
else {
|
|
788
|
+
merged.push.apply(merged, incoming);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return merged;
|
|
792
|
+
},
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
function relayStylePagination(keyArgs) {
|
|
796
|
+
if (keyArgs === void 0) { keyArgs = false; }
|
|
797
|
+
return {
|
|
798
|
+
keyArgs: keyArgs,
|
|
799
|
+
read: function (existing, _a) {
|
|
800
|
+
var canRead = _a.canRead, readField = _a.readField;
|
|
801
|
+
if (!existing)
|
|
802
|
+
return existing;
|
|
803
|
+
var edges = [];
|
|
804
|
+
var firstEdgeCursor = "";
|
|
805
|
+
var lastEdgeCursor = "";
|
|
806
|
+
existing.edges.forEach(function (edge) {
|
|
807
|
+
if (canRead(readField("node", edge))) {
|
|
808
|
+
edges.push(edge);
|
|
809
|
+
if (edge.cursor) {
|
|
810
|
+
firstEdgeCursor = firstEdgeCursor || edge.cursor || "";
|
|
811
|
+
lastEdgeCursor = edge.cursor || lastEdgeCursor;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
});
|
|
815
|
+
var _b = existing.pageInfo || {}, startCursor = _b.startCursor, endCursor = _b.endCursor;
|
|
816
|
+
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
|
817
|
+
},
|
|
818
|
+
merge: function (existing, incoming, _a) {
|
|
819
|
+
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
|
820
|
+
if (!existing) {
|
|
821
|
+
existing = makeEmptyData();
|
|
822
|
+
}
|
|
823
|
+
if (!incoming) {
|
|
824
|
+
return existing;
|
|
825
|
+
}
|
|
826
|
+
var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) {
|
|
827
|
+
if (isReference(edge = tslib.__assign({}, edge))) {
|
|
828
|
+
edge.cursor = readField("cursor", edge);
|
|
829
|
+
}
|
|
830
|
+
return edge;
|
|
831
|
+
}) : [];
|
|
832
|
+
if (incoming.pageInfo) {
|
|
833
|
+
var pageInfo_1 = incoming.pageInfo;
|
|
834
|
+
var startCursor = pageInfo_1.startCursor, endCursor = pageInfo_1.endCursor;
|
|
835
|
+
var firstEdge = incomingEdges[0];
|
|
836
|
+
var lastEdge = incomingEdges[incomingEdges.length - 1];
|
|
837
|
+
if (firstEdge && startCursor) {
|
|
838
|
+
firstEdge.cursor = startCursor;
|
|
839
|
+
}
|
|
840
|
+
if (lastEdge && endCursor) {
|
|
841
|
+
lastEdge.cursor = endCursor;
|
|
842
|
+
}
|
|
843
|
+
var firstCursor = firstEdge && firstEdge.cursor;
|
|
844
|
+
if (firstCursor && !startCursor) {
|
|
845
|
+
incoming = mergeDeep(incoming, {
|
|
846
|
+
pageInfo: {
|
|
847
|
+
startCursor: firstCursor,
|
|
848
|
+
},
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
var lastCursor = lastEdge && lastEdge.cursor;
|
|
852
|
+
if (lastCursor && !endCursor) {
|
|
853
|
+
incoming = mergeDeep(incoming, {
|
|
854
|
+
pageInfo: {
|
|
855
|
+
endCursor: lastCursor,
|
|
856
|
+
},
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
var prefix = existing.edges;
|
|
861
|
+
var suffix = [];
|
|
862
|
+
if (args && args.after) {
|
|
863
|
+
var index = prefix.findIndex(function (edge) { return edge.cursor === args.after; });
|
|
864
|
+
if (index >= 0) {
|
|
865
|
+
prefix = prefix.slice(0, index + 1);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
else if (args && args.before) {
|
|
869
|
+
var index = prefix.findIndex(function (edge) { return edge.cursor === args.before; });
|
|
870
|
+
suffix = index < 0 ? prefix : prefix.slice(index);
|
|
871
|
+
prefix = [];
|
|
872
|
+
}
|
|
873
|
+
else if (incoming.edges) {
|
|
874
|
+
prefix = [];
|
|
875
|
+
}
|
|
876
|
+
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true);
|
|
877
|
+
var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo);
|
|
878
|
+
if (incoming.pageInfo) {
|
|
879
|
+
var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]);
|
|
880
|
+
Object.assign(pageInfo, extras);
|
|
881
|
+
if (!prefix.length) {
|
|
882
|
+
if (void 0 !== hasPreviousPage)
|
|
883
|
+
pageInfo.hasPreviousPage = hasPreviousPage;
|
|
884
|
+
if (void 0 !== startCursor)
|
|
885
|
+
pageInfo.startCursor = startCursor;
|
|
886
|
+
}
|
|
887
|
+
if (!suffix.length) {
|
|
888
|
+
if (void 0 !== hasNextPage)
|
|
889
|
+
pageInfo.hasNextPage = hasNextPage;
|
|
890
|
+
if (void 0 !== endCursor)
|
|
891
|
+
pageInfo.endCursor = endCursor;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return tslib.__assign(tslib.__assign(tslib.__assign({}, getExtras(existing)), getExtras(incoming)), { edges: edges, pageInfo: pageInfo });
|
|
895
|
+
},
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
var getExtras = function (obj) { return tslib.__rest(obj, notExtras); };
|
|
899
|
+
var notExtras = ["edges", "pageInfo"];
|
|
900
|
+
function makeEmptyData() {
|
|
901
|
+
return {
|
|
902
|
+
edges: [],
|
|
903
|
+
pageInfo: {
|
|
904
|
+
hasPreviousPage: false,
|
|
905
|
+
hasNextPage: true,
|
|
906
|
+
startCursor: "",
|
|
907
|
+
endCursor: "",
|
|
908
|
+
},
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
var toString = Object.prototype.toString;
|
|
913
|
+
function cloneDeep(value) {
|
|
914
|
+
return cloneDeepHelper(value);
|
|
915
|
+
}
|
|
916
|
+
function cloneDeepHelper(val, seen) {
|
|
917
|
+
switch (toString.call(val)) {
|
|
918
|
+
case "[object Array]": {
|
|
919
|
+
seen = seen || new Map;
|
|
920
|
+
if (seen.has(val))
|
|
921
|
+
return seen.get(val);
|
|
922
|
+
var copy_1 = val.slice(0);
|
|
923
|
+
seen.set(val, copy_1);
|
|
924
|
+
copy_1.forEach(function (child, i) {
|
|
925
|
+
copy_1[i] = cloneDeepHelper(child, seen);
|
|
926
|
+
});
|
|
927
|
+
return copy_1;
|
|
928
|
+
}
|
|
929
|
+
case "[object Object]": {
|
|
930
|
+
seen = seen || new Map;
|
|
931
|
+
if (seen.has(val))
|
|
932
|
+
return seen.get(val);
|
|
933
|
+
var copy_2 = Object.create(Object.getPrototypeOf(val));
|
|
934
|
+
seen.set(val, copy_2);
|
|
935
|
+
Object.keys(val).forEach(function (key) {
|
|
936
|
+
copy_2[key] = cloneDeepHelper(val[key], seen);
|
|
937
|
+
});
|
|
938
|
+
return copy_2;
|
|
939
|
+
}
|
|
940
|
+
default:
|
|
941
|
+
return val;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
function deepFreeze(value) {
|
|
946
|
+
var workSet = new Set([value]);
|
|
947
|
+
workSet.forEach(function (obj) {
|
|
948
|
+
if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {
|
|
949
|
+
Object.getOwnPropertyNames(obj).forEach(function (name) {
|
|
950
|
+
if (isNonNullObject(obj[name]))
|
|
951
|
+
workSet.add(obj[name]);
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
return value;
|
|
956
|
+
}
|
|
957
|
+
function shallowFreeze(obj) {
|
|
958
|
+
if (globals.__DEV__ && !Object.isFrozen(obj)) {
|
|
959
|
+
try {
|
|
960
|
+
Object.freeze(obj);
|
|
961
|
+
}
|
|
962
|
+
catch (e) {
|
|
963
|
+
if (e instanceof TypeError)
|
|
964
|
+
return null;
|
|
965
|
+
throw e;
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
return obj;
|
|
969
|
+
}
|
|
970
|
+
function maybeDeepFreeze(obj) {
|
|
971
|
+
if (globals.__DEV__) {
|
|
972
|
+
deepFreeze(obj);
|
|
973
|
+
}
|
|
974
|
+
return obj;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
function iterateObserversSafely(observers, method, argument) {
|
|
978
|
+
var observersWithMethod = [];
|
|
979
|
+
observers.forEach(function (obs) { return obs[method] && observersWithMethod.push(obs); });
|
|
980
|
+
observersWithMethod.forEach(function (obs) { return obs[method](argument); });
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
function asyncMap(observable, mapFn, catchFn) {
|
|
984
|
+
return new zenObservableTs.Observable(function (observer) {
|
|
985
|
+
var next = observer.next, error = observer.error, complete = observer.complete;
|
|
986
|
+
var activeCallbackCount = 0;
|
|
987
|
+
var completed = false;
|
|
988
|
+
var promiseQueue = {
|
|
989
|
+
then: function (callback) {
|
|
990
|
+
return new Promise(function (resolve) { return resolve(callback()); });
|
|
991
|
+
},
|
|
992
|
+
};
|
|
993
|
+
function makeCallback(examiner, delegate) {
|
|
994
|
+
if (examiner) {
|
|
995
|
+
return function (arg) {
|
|
996
|
+
++activeCallbackCount;
|
|
997
|
+
var both = function () { return examiner(arg); };
|
|
998
|
+
promiseQueue = promiseQueue.then(both, both).then(function (result) {
|
|
999
|
+
--activeCallbackCount;
|
|
1000
|
+
next && next.call(observer, result);
|
|
1001
|
+
if (completed) {
|
|
1002
|
+
handler.complete();
|
|
1003
|
+
}
|
|
1004
|
+
}, function (error) {
|
|
1005
|
+
--activeCallbackCount;
|
|
1006
|
+
throw error;
|
|
1007
|
+
}).catch(function (caught) {
|
|
1008
|
+
error && error.call(observer, caught);
|
|
1009
|
+
});
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
else {
|
|
1013
|
+
return function (arg) { return delegate && delegate.call(observer, arg); };
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
var handler = {
|
|
1017
|
+
next: makeCallback(mapFn, next),
|
|
1018
|
+
error: makeCallback(catchFn, error),
|
|
1019
|
+
complete: function () {
|
|
1020
|
+
completed = true;
|
|
1021
|
+
if (!activeCallbackCount) {
|
|
1022
|
+
complete && complete.call(observer);
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
};
|
|
1026
|
+
var sub = observable.subscribe(handler);
|
|
1027
|
+
return function () { return sub.unsubscribe(); };
|
|
1028
|
+
});
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
var canUseWeakMap = typeof WeakMap === 'function' &&
|
|
1032
|
+
globals.maybe(function () { return navigator.product; }) !== 'ReactNative';
|
|
1033
|
+
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1034
|
+
var canUseSymbol = typeof Symbol === 'function' &&
|
|
1035
|
+
typeof Symbol.for === 'function';
|
|
1036
|
+
var canUseAsyncIteratorSymbol = canUseSymbol && Symbol.asyncIterator;
|
|
1037
|
+
var canUseDOM = typeof globals.maybe(function () { return window.document.createElement; }) === "function";
|
|
1038
|
+
var usingJSDOM = globals.maybe(function () { return navigator.userAgent.indexOf("jsdom") >= 0; }) || false;
|
|
1039
|
+
var canUseLayoutEffect = canUseDOM && !usingJSDOM;
|
|
1040
|
+
|
|
1041
|
+
function fixObservableSubclass(subclass) {
|
|
1042
|
+
function set(key) {
|
|
1043
|
+
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
|
1044
|
+
}
|
|
1045
|
+
if (canUseSymbol && Symbol.species) {
|
|
1046
|
+
set(Symbol.species);
|
|
1047
|
+
}
|
|
1048
|
+
set("@@species");
|
|
1049
|
+
return subclass;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function isPromiseLike(value) {
|
|
1053
|
+
return value && typeof value.then === "function";
|
|
1054
|
+
}
|
|
1055
|
+
var Concast = (function (_super) {
|
|
1056
|
+
tslib.__extends(Concast, _super);
|
|
1057
|
+
function Concast(sources) {
|
|
1058
|
+
var _this = _super.call(this, function (observer) {
|
|
1059
|
+
_this.addObserver(observer);
|
|
1060
|
+
return function () { return _this.removeObserver(observer); };
|
|
1061
|
+
}) || this;
|
|
1062
|
+
_this.observers = new Set();
|
|
1063
|
+
_this.promise = new Promise(function (resolve, reject) {
|
|
1064
|
+
_this.resolve = resolve;
|
|
1065
|
+
_this.reject = reject;
|
|
1066
|
+
});
|
|
1067
|
+
_this.handlers = {
|
|
1068
|
+
next: function (result) {
|
|
1069
|
+
if (_this.sub !== null) {
|
|
1070
|
+
_this.latest = ["next", result];
|
|
1071
|
+
_this.notify("next", result);
|
|
1072
|
+
iterateObserversSafely(_this.observers, "next", result);
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
error: function (error) {
|
|
1076
|
+
var sub = _this.sub;
|
|
1077
|
+
if (sub !== null) {
|
|
1078
|
+
if (sub)
|
|
1079
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
1080
|
+
_this.sub = null;
|
|
1081
|
+
_this.latest = ["error", error];
|
|
1082
|
+
_this.reject(error);
|
|
1083
|
+
_this.notify("error", error);
|
|
1084
|
+
iterateObserversSafely(_this.observers, "error", error);
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
complete: function () {
|
|
1088
|
+
var sub = _this.sub;
|
|
1089
|
+
if (sub !== null) {
|
|
1090
|
+
var value = _this.sources.shift();
|
|
1091
|
+
if (!value) {
|
|
1092
|
+
if (sub)
|
|
1093
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
1094
|
+
_this.sub = null;
|
|
1095
|
+
if (_this.latest &&
|
|
1096
|
+
_this.latest[0] === "next") {
|
|
1097
|
+
_this.resolve(_this.latest[1]);
|
|
1098
|
+
}
|
|
1099
|
+
else {
|
|
1100
|
+
_this.resolve();
|
|
1101
|
+
}
|
|
1102
|
+
_this.notify("complete");
|
|
1103
|
+
iterateObserversSafely(_this.observers, "complete");
|
|
1104
|
+
}
|
|
1105
|
+
else if (isPromiseLike(value)) {
|
|
1106
|
+
value.then(function (obs) { return _this.sub = obs.subscribe(_this.handlers); });
|
|
1107
|
+
}
|
|
1108
|
+
else {
|
|
1109
|
+
_this.sub = value.subscribe(_this.handlers);
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
},
|
|
1113
|
+
};
|
|
1114
|
+
_this.nextResultListeners = new Set();
|
|
1115
|
+
_this.cancel = function (reason) {
|
|
1116
|
+
_this.reject(reason);
|
|
1117
|
+
_this.sources = [];
|
|
1118
|
+
_this.handlers.complete();
|
|
1119
|
+
};
|
|
1120
|
+
_this.promise.catch(function (_) { });
|
|
1121
|
+
if (typeof sources === "function") {
|
|
1122
|
+
sources = [new zenObservableTs.Observable(sources)];
|
|
1123
|
+
}
|
|
1124
|
+
if (isPromiseLike(sources)) {
|
|
1125
|
+
sources.then(function (iterable) { return _this.start(iterable); }, _this.handlers.error);
|
|
1126
|
+
}
|
|
1127
|
+
else {
|
|
1128
|
+
_this.start(sources);
|
|
1129
|
+
}
|
|
1130
|
+
return _this;
|
|
1131
|
+
}
|
|
1132
|
+
Concast.prototype.start = function (sources) {
|
|
1133
|
+
if (this.sub !== void 0)
|
|
1134
|
+
return;
|
|
1135
|
+
this.sources = Array.from(sources);
|
|
1136
|
+
this.handlers.complete();
|
|
1137
|
+
};
|
|
1138
|
+
Concast.prototype.deliverLastMessage = function (observer) {
|
|
1139
|
+
if (this.latest) {
|
|
1140
|
+
var nextOrError = this.latest[0];
|
|
1141
|
+
var method = observer[nextOrError];
|
|
1142
|
+
if (method) {
|
|
1143
|
+
method.call(observer, this.latest[1]);
|
|
1144
|
+
}
|
|
1145
|
+
if (this.sub === null &&
|
|
1146
|
+
nextOrError === "next" &&
|
|
1147
|
+
observer.complete) {
|
|
1148
|
+
observer.complete();
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
};
|
|
1152
|
+
Concast.prototype.addObserver = function (observer) {
|
|
1153
|
+
if (!this.observers.has(observer)) {
|
|
1154
|
+
this.deliverLastMessage(observer);
|
|
1155
|
+
this.observers.add(observer);
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
Concast.prototype.removeObserver = function (observer) {
|
|
1159
|
+
if (this.observers.delete(observer) &&
|
|
1160
|
+
this.observers.size < 1) {
|
|
1161
|
+
this.handlers.complete();
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
Concast.prototype.notify = function (method, arg) {
|
|
1165
|
+
var nextResultListeners = this.nextResultListeners;
|
|
1166
|
+
if (nextResultListeners.size) {
|
|
1167
|
+
this.nextResultListeners = new Set;
|
|
1168
|
+
nextResultListeners.forEach(function (listener) { return listener(method, arg); });
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
Concast.prototype.beforeNext = function (callback) {
|
|
1172
|
+
var called = false;
|
|
1173
|
+
this.nextResultListeners.add(function (method, arg) {
|
|
1174
|
+
if (!called) {
|
|
1175
|
+
called = true;
|
|
1176
|
+
callback(method, arg);
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
};
|
|
1180
|
+
return Concast;
|
|
1181
|
+
}(zenObservableTs.Observable));
|
|
1182
|
+
fixObservableSubclass(Concast);
|
|
1183
|
+
|
|
1184
|
+
function isNonEmptyArray(value) {
|
|
1185
|
+
return Array.isArray(value) && value.length > 0;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
function isExecutionPatchIncrementalResult(value) {
|
|
1189
|
+
return "incremental" in value;
|
|
1190
|
+
}
|
|
1191
|
+
function isExecutionPatchInitialResult(value) {
|
|
1192
|
+
return "hasNext" in value && "data" in value;
|
|
1193
|
+
}
|
|
1194
|
+
function isExecutionPatchResult(value) {
|
|
1195
|
+
return (isExecutionPatchIncrementalResult(value) ||
|
|
1196
|
+
isExecutionPatchInitialResult(value));
|
|
1197
|
+
}
|
|
1198
|
+
function mergeIncrementalData(prevResult, result) {
|
|
1199
|
+
var mergedData = prevResult;
|
|
1200
|
+
var merger = new DeepMerger();
|
|
1201
|
+
if (isExecutionPatchIncrementalResult(result) &&
|
|
1202
|
+
isNonEmptyArray(result.incremental)) {
|
|
1203
|
+
result.incremental.forEach(function (_a) {
|
|
1204
|
+
var data = _a.data, path = _a.path;
|
|
1205
|
+
for (var i = path.length - 1; i >= 0; --i) {
|
|
1206
|
+
var key = path[i];
|
|
1207
|
+
var isNumericKey = !isNaN(+key);
|
|
1208
|
+
var parent_1 = isNumericKey ? [] : {};
|
|
1209
|
+
parent_1[key] = data;
|
|
1210
|
+
data = parent_1;
|
|
1211
|
+
}
|
|
1212
|
+
mergedData = merger.merge(mergedData, data);
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
return mergedData;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
function graphQLResultHasError(result) {
|
|
1219
|
+
var errors = getGraphQLErrorsFromResult(result);
|
|
1220
|
+
return isNonEmptyArray(errors);
|
|
1221
|
+
}
|
|
1222
|
+
function getGraphQLErrorsFromResult(result) {
|
|
1223
|
+
var graphQLErrors = isNonEmptyArray(result.errors)
|
|
1224
|
+
? result.errors.slice(0)
|
|
1225
|
+
: [];
|
|
1226
|
+
if (isExecutionPatchIncrementalResult(result) &&
|
|
1227
|
+
isNonEmptyArray(result.incremental)) {
|
|
1228
|
+
result.incremental.forEach(function (incrementalResult) {
|
|
1229
|
+
if (incrementalResult.errors) {
|
|
1230
|
+
graphQLErrors.push.apply(graphQLErrors, incrementalResult.errors);
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
return graphQLErrors;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
function compact() {
|
|
1238
|
+
var objects = [];
|
|
1239
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1240
|
+
objects[_i] = arguments[_i];
|
|
1241
|
+
}
|
|
1242
|
+
var result = Object.create(null);
|
|
1243
|
+
objects.forEach(function (obj) {
|
|
1244
|
+
if (!obj)
|
|
1245
|
+
return;
|
|
1246
|
+
Object.keys(obj).forEach(function (key) {
|
|
1247
|
+
var value = obj[key];
|
|
1248
|
+
if (value !== void 0) {
|
|
1249
|
+
result[key] = value;
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
return result;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
var prefixCounts = new Map();
|
|
1257
|
+
function makeUniqueId(prefix) {
|
|
1258
|
+
var count = prefixCounts.get(prefix) || 1;
|
|
1259
|
+
prefixCounts.set(prefix, count + 1);
|
|
1260
|
+
return "".concat(prefix, ":").concat(count, ":").concat(Math.random().toString(36).slice(2));
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
function stringifyForDisplay(value) {
|
|
1264
|
+
var undefId = makeUniqueId("stringifyForDisplay");
|
|
1265
|
+
return JSON.stringify(value, function (key, value) {
|
|
1266
|
+
return value === void 0 ? undefId : value;
|
|
1267
|
+
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
function mergeOptions(defaults, options) {
|
|
1271
|
+
return compact(defaults, options, options.variables && {
|
|
1272
|
+
variables: tslib.__assign(tslib.__assign({}, (defaults && defaults.variables)), options.variables),
|
|
1273
|
+
});
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
function isNodeResponse(value) {
|
|
1277
|
+
return !!value.body;
|
|
1278
|
+
}
|
|
1279
|
+
function isReadableStream(value) {
|
|
1280
|
+
return !!value.getReader;
|
|
1281
|
+
}
|
|
1282
|
+
function isAsyncIterableIterator(value) {
|
|
1283
|
+
return !!(canUseAsyncIteratorSymbol &&
|
|
1284
|
+
value[Symbol.asyncIterator]);
|
|
1285
|
+
}
|
|
1286
|
+
function isStreamableBlob(value) {
|
|
1287
|
+
return !!value.stream;
|
|
1288
|
+
}
|
|
1289
|
+
function isBlob(value) {
|
|
1290
|
+
return !!value.arrayBuffer;
|
|
1291
|
+
}
|
|
1292
|
+
function isNodeReadableStream(value) {
|
|
1293
|
+
return !!value.pipe;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
exports.DEV = globals.DEV;
|
|
1297
|
+
exports.maybe = globals.maybe;
|
|
1298
|
+
exports.Observable = zenObservableTs.Observable;
|
|
1299
|
+
exports.Concast = Concast;
|
|
1300
|
+
exports.DeepMerger = DeepMerger;
|
|
1301
|
+
exports.addTypenameToDocument = addTypenameToDocument;
|
|
1302
|
+
exports.argumentsObjectFromField = argumentsObjectFromField;
|
|
1303
|
+
exports.asyncMap = asyncMap;
|
|
1304
|
+
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
|
1305
|
+
exports.canUseAsyncIteratorSymbol = canUseAsyncIteratorSymbol;
|
|
1306
|
+
exports.canUseDOM = canUseDOM;
|
|
1307
|
+
exports.canUseLayoutEffect = canUseLayoutEffect;
|
|
1308
|
+
exports.canUseSymbol = canUseSymbol;
|
|
1309
|
+
exports.canUseWeakMap = canUseWeakMap;
|
|
1310
|
+
exports.canUseWeakSet = canUseWeakSet;
|
|
1311
|
+
exports.checkDocument = checkDocument;
|
|
1312
|
+
exports.cloneDeep = cloneDeep;
|
|
1313
|
+
exports.compact = compact;
|
|
1314
|
+
exports.concatPagination = concatPagination;
|
|
1315
|
+
exports.createFragmentMap = createFragmentMap;
|
|
1316
|
+
exports.fixObservableSubclass = fixObservableSubclass;
|
|
1317
|
+
exports.getDefaultValues = getDefaultValues;
|
|
1318
|
+
exports.getDirectiveNames = getDirectiveNames;
|
|
1319
|
+
exports.getFragmentDefinition = getFragmentDefinition;
|
|
1320
|
+
exports.getFragmentDefinitions = getFragmentDefinitions;
|
|
1321
|
+
exports.getFragmentFromSelection = getFragmentFromSelection;
|
|
1322
|
+
exports.getFragmentQueryDocument = getFragmentQueryDocument;
|
|
1323
|
+
exports.getGraphQLErrorsFromResult = getGraphQLErrorsFromResult;
|
|
1324
|
+
exports.getInclusionDirectives = getInclusionDirectives;
|
|
1325
|
+
exports.getMainDefinition = getMainDefinition;
|
|
1326
|
+
exports.getOperationDefinition = getOperationDefinition;
|
|
1327
|
+
exports.getOperationName = getOperationName;
|
|
1328
|
+
exports.getQueryDefinition = getQueryDefinition;
|
|
1329
|
+
exports.getStoreKeyName = getStoreKeyName;
|
|
1330
|
+
exports.getTypenameFromResult = getTypenameFromResult;
|
|
1331
|
+
exports.graphQLResultHasError = graphQLResultHasError;
|
|
1332
|
+
exports.hasAllDirectives = hasAllDirectives;
|
|
1333
|
+
exports.hasAnyDirectives = hasAnyDirectives;
|
|
1334
|
+
exports.hasClientExports = hasClientExports;
|
|
1335
|
+
exports.hasDirectives = hasDirectives;
|
|
1336
|
+
exports.isAsyncIterableIterator = isAsyncIterableIterator;
|
|
1337
|
+
exports.isBlob = isBlob;
|
|
1338
|
+
exports.isDocumentNode = isDocumentNode;
|
|
1339
|
+
exports.isExecutionPatchIncrementalResult = isExecutionPatchIncrementalResult;
|
|
1340
|
+
exports.isExecutionPatchInitialResult = isExecutionPatchInitialResult;
|
|
1341
|
+
exports.isExecutionPatchResult = isExecutionPatchResult;
|
|
1342
|
+
exports.isField = isField;
|
|
1343
|
+
exports.isInlineFragment = isInlineFragment;
|
|
1344
|
+
exports.isNodeReadableStream = isNodeReadableStream;
|
|
1345
|
+
exports.isNodeResponse = isNodeResponse;
|
|
1346
|
+
exports.isNonEmptyArray = isNonEmptyArray;
|
|
1347
|
+
exports.isNonNullObject = isNonNullObject;
|
|
1348
|
+
exports.isReadableStream = isReadableStream;
|
|
1349
|
+
exports.isReference = isReference;
|
|
1350
|
+
exports.isStreamableBlob = isStreamableBlob;
|
|
1351
|
+
exports.iterateObserversSafely = iterateObserversSafely;
|
|
1352
|
+
exports.makeReference = makeReference;
|
|
1353
|
+
exports.makeUniqueId = makeUniqueId;
|
|
1354
|
+
exports.maybeDeepFreeze = maybeDeepFreeze;
|
|
1355
|
+
exports.mergeDeep = mergeDeep;
|
|
1356
|
+
exports.mergeDeepArray = mergeDeepArray;
|
|
1357
|
+
exports.mergeIncrementalData = mergeIncrementalData;
|
|
1358
|
+
exports.mergeOptions = mergeOptions;
|
|
1359
|
+
exports.offsetLimitPagination = offsetLimitPagination;
|
|
1360
|
+
exports.relayStylePagination = relayStylePagination;
|
|
1361
|
+
exports.removeArgumentsFromDocument = removeArgumentsFromDocument;
|
|
1362
|
+
exports.removeClientSetsFromDocument = removeClientSetsFromDocument;
|
|
1363
|
+
exports.removeConnectionDirectiveFromDocument = removeConnectionDirectiveFromDocument;
|
|
1364
|
+
exports.removeDirectivesFromDocument = removeDirectivesFromDocument;
|
|
1365
|
+
exports.removeFragmentSpreadFromDocument = removeFragmentSpreadFromDocument;
|
|
1366
|
+
exports.resultKeyNameFromField = resultKeyNameFromField;
|
|
1367
|
+
exports.shouldInclude = shouldInclude;
|
|
1368
|
+
exports.storeKeyNameFromField = storeKeyNameFromField;
|
|
1369
|
+
exports.stringifyForDisplay = stringifyForDisplay;
|
|
1370
|
+
exports.valueToObjectRepresentation = valueToObjectRepresentation;
|
|
1371
|
+
//# sourceMappingURL=utilities.cjs.map
|