@apollo/client 3.8.1 → 3.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apollo-client.cjs +708 -575
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +253 -191
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +253 -191
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +10 -7
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +3 -3
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js +0 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.d.ts +6 -6
- package/cache/core/types/DataProxy.d.ts.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +3 -3
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +20 -20
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +13 -13
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +6 -6
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +38 -30
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/fixPolyfills.native.d.ts.map +1 -1
- package/cache/inmemory/fixPolyfills.native.js +10 -9
- package/cache/inmemory/fixPolyfills.native.js.map +1 -1
- package/cache/inmemory/fragmentRegistry.d.ts.map +1 -1
- package/cache/inmemory/fragmentRegistry.js +6 -4
- package/cache/inmemory/fragmentRegistry.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +6 -6
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +16 -14
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +9 -9
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +29 -33
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts.map +1 -1
- package/cache/inmemory/key-extractor.js +55 -49
- package/cache/inmemory/key-extractor.js.map +1 -1
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +5 -5
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +6 -6
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +74 -45
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/reactiveVars.d.ts +1 -1
- package/cache/inmemory/reactiveVars.d.ts.map +1 -1
- package/cache/inmemory/reactiveVars.js +5 -5
- package/cache/inmemory/reactiveVars.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +7 -7
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +21 -17
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +7 -7
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js +0 -2
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts +7 -7
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +40 -30
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/config/jest/setup.d.ts +2 -2
- package/config/jest/setup.js +5 -5
- package/config/jest/setup.js.map +1 -1
- package/core/ApolloClient.d.ts +12 -11
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +75 -57
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts +6 -6
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +17 -16
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +12 -10
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +57 -38
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +11 -11
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +28 -34
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +10 -10
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +117 -93
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +266 -206
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +266 -206
- package/core/networkStatus.js.map +1 -1
- package/core/types.d.ts +13 -13
- package/core/types.d.ts.map +1 -1
- package/core/types.js +0 -1
- package/core/types.js.map +1 -1
- package/core/watchQueryOptions.d.ts +11 -11
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/dev/dev.cjs +44 -40
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +44 -40
- package/errors/errors.cjs +7 -5
- package/errors/errors.cjs.map +1 -1
- package/errors/errors.cjs.native.js +7 -5
- package/errors/index.d.ts +4 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +9 -7
- package/errors/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/invariantErrorCodes.d.ts.map +1 -1
- package/invariantErrorCodes.js +36 -36
- package/invariantErrorCodes.js.map +1 -1
- package/link/batch/batch.cjs +4 -4
- package/link/batch/batch.cjs.map +1 -1
- package/link/batch/batch.cjs.native.js +4 -4
- package/link/batch/batchLink.d.ts +6 -6
- package/link/batch/batchLink.d.ts.map +1 -1
- package/link/batch/batchLink.js +4 -4
- package/link/batch/batchLink.js.map +1 -1
- package/link/batch/batching.d.ts +2 -2
- package/link/batch/batching.d.ts.map +1 -1
- package/link/batch/batching.js +4 -4
- package/link/batch/batching.js.map +1 -1
- package/link/batch/index.d.ts +1 -1
- package/link/batch/index.js +1 -1
- package/link/batch/index.js.map +1 -1
- package/link/batch-http/batch-http.cjs +13 -11
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batch-http.cjs.native.js +13 -11
- package/link/batch-http/batchHttpLink.d.ts +6 -6
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +17 -15
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/batch-http/index.d.ts +1 -1
- package/link/batch-http/index.js +1 -1
- package/link/batch-http/index.js.map +1 -1
- package/link/context/context.cjs.map +1 -1
- package/link/context/index.d.ts +3 -3
- package/link/context/index.js +2 -2
- package/link/context/index.js.map +1 -1
- package/link/core/ApolloLink.d.ts +3 -3
- package/link/core/ApolloLink.js +4 -4
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/concat.d.ts +1 -1
- package/link/core/concat.js +1 -1
- package/link/core/concat.js.map +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/core/core.cjs.native.js +1 -1
- package/link/core/empty.d.ts +1 -1
- package/link/core/empty.js +1 -1
- package/link/core/empty.js.map +1 -1
- package/link/core/execute.d.ts +1 -1
- package/link/core/execute.js +1 -1
- package/link/core/execute.js.map +1 -1
- package/link/core/from.d.ts +1 -1
- package/link/core/from.js +1 -1
- package/link/core/from.js.map +1 -1
- package/link/core/index.d.ts +8 -8
- package/link/core/index.js +8 -8
- package/link/core/index.js.map +1 -1
- package/link/core/split.d.ts +1 -1
- package/link/core/split.js +1 -1
- package/link/core/split.js.map +1 -1
- package/link/core/types.js.map +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/index.d.ts +5 -5
- package/link/error/index.js +2 -2
- package/link/error/index.js.map +1 -1
- package/link/http/HttpLink.d.ts +3 -3
- package/link/http/HttpLink.js +2 -2
- package/link/http/HttpLink.js.map +1 -1
- package/link/http/checkFetcher.d.ts +1 -1
- package/link/http/checkFetcher.d.ts.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +2 -2
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +27 -26
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/createSignalIfSupported.js +1 -1
- package/link/http/createSignalIfSupported.js.map +1 -1
- package/link/http/http.cjs +39 -35
- package/link/http/http.cjs.map +1 -1
- package/link/http/http.cjs.native.js +39 -35
- package/link/http/index.d.ts +13 -13
- package/link/http/index.js +10 -10
- package/link/http/index.js.map +1 -1
- package/link/http/iterators/nodeStream.d.ts.map +1 -1
- package/link/http/iterators/nodeStream.js.map +1 -1
- package/link/http/parseAndCheckHttpResponse.d.ts.map +1 -1
- package/link/http/parseAndCheckHttpResponse.js +2 -2
- package/link/http/parseAndCheckHttpResponse.js.map +1 -1
- package/link/http/rewriteURIForGET.d.ts +1 -1
- package/link/http/rewriteURIForGET.js +12 -12
- package/link/http/rewriteURIForGET.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +5 -5
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +8 -7
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/selectURI.d.ts +1 -1
- package/link/http/selectURI.js +2 -2
- package/link/http/selectURI.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +4 -4
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +26 -25
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +22 -17
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.native.js +22 -17
- package/link/retry/delayFunction.d.ts +1 -1
- package/link/retry/delayFunction.js.map +1 -1
- package/link/retry/index.d.ts +1 -1
- package/link/retry/index.js +1 -1
- package/link/retry/index.js.map +1 -1
- package/link/retry/retry.cjs +2 -2
- package/link/retry/retry.cjs.map +1 -1
- package/link/retry/retry.cjs.native.js +2 -2
- package/link/retry/retryFunction.d.ts +1 -1
- package/link/retry/retryFunction.js.map +1 -1
- package/link/retry/retryLink.d.ts +5 -5
- package/link/retry/retryLink.d.ts.map +1 -1
- package/link/retry/retryLink.js +6 -6
- package/link/retry/retryLink.js.map +1 -1
- package/link/schema/index.d.ts +4 -4
- package/link/schema/index.d.ts.map +1 -1
- package/link/schema/index.js +13 -8
- package/link/schema/index.js.map +1 -1
- package/link/schema/schema.cjs +10 -5
- package/link/schema/schema.cjs.map +1 -1
- package/link/schema/schema.cjs.native.js +10 -5
- package/link/subscriptions/index.js +1 -1
- package/link/subscriptions/index.js.map +1 -1
- package/link/subscriptions/subscriptions.cjs.map +1 -1
- package/link/utils/createOperation.d.ts +1 -1
- package/link/utils/createOperation.js +3 -3
- package/link/utils/createOperation.js.map +1 -1
- package/link/utils/filterOperationVariables.d.ts +1 -1
- package/link/utils/filterOperationVariables.js +2 -2
- package/link/utils/filterOperationVariables.js.map +1 -1
- package/link/utils/fromError.d.ts +1 -1
- package/link/utils/fromError.js +1 -1
- package/link/utils/fromError.js.map +1 -1
- package/link/utils/fromPromise.d.ts +1 -1
- package/link/utils/fromPromise.js +1 -1
- package/link/utils/fromPromise.js.map +1 -1
- package/link/utils/index.d.ts +10 -10
- package/link/utils/index.js +9 -9
- package/link/utils/index.js.map +1 -1
- package/link/utils/throwServerError.js +1 -1
- package/link/utils/throwServerError.js.map +1 -1
- package/link/utils/toPromise.d.ts +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/transformOperation.d.ts +1 -1
- package/link/utils/transformOperation.js +3 -3
- package/link/utils/transformOperation.js.map +1 -1
- package/link/utils/utils.cjs +12 -12
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/utils.cjs.native.js +12 -12
- package/link/utils/validateOperation.d.ts +1 -1
- package/link/utils/validateOperation.js +6 -6
- package/link/utils/validateOperation.js.map +1 -1
- package/link/ws/index.d.ts +5 -5
- package/link/ws/index.js +2 -2
- package/link/ws/index.js.map +1 -1
- package/link/ws/ws.cjs.map +1 -1
- package/package.json +22 -22
- package/react/cache/QueryReference.d.ts +1 -1
- package/react/cache/QueryReference.d.ts.map +1 -1
- package/react/cache/QueryReference.js +2 -0
- package/react/cache/QueryReference.js.map +1 -1
- package/react/hooks/constants.js +1 -1
- package/react/hooks/constants.js.map +1 -1
- package/react/hooks/hooks.cjs +10 -21
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +10 -21
- package/react/hooks/useBackgroundQuery.d.ts +1 -1
- package/react/hooks/useBackgroundQuery.d.ts.map +1 -1
- package/react/hooks/useBackgroundQuery.js.map +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -8
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useReactiveVar.d.ts.map +1 -1
- package/react/hooks/useReactiveVar.js +7 -12
- package/react/hooks/useReactiveVar.js.map +1 -1
- package/react/hooks/useReadQuery.d.ts +1 -1
- package/react/hooks/useReadQuery.d.ts.map +1 -1
- package/react/hooks/useReadQuery.js +1 -1
- package/react/hooks/useReadQuery.js.map +1 -1
- package/react/hooks/useSuspenseQuery.d.ts +1 -1
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -1
- package/react/hooks/useSuspenseQuery.js.map +1 -1
- package/react/react.cjs +2 -0
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +2 -0
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +37 -28
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +37 -28
- package/testing/core/itAsync.d.ts.map +1 -1
- package/testing/core/itAsync.js +8 -4
- package/testing/core/itAsync.js.map +1 -1
- package/testing/core/mocking/mockClient.d.ts +3 -3
- package/testing/core/mocking/mockClient.d.ts.map +1 -1
- package/testing/core/mocking/mockClient.js +6 -4
- package/testing/core/mocking/mockClient.js.map +1 -1
- package/testing/core/mocking/mockFetch.d.ts +1 -1
- package/testing/core/mocking/mockFetch.d.ts.map +1 -1
- package/testing/core/mocking/mockFetch.js +3 -3
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.d.ts +3 -3
- package/testing/core/mocking/mockLink.d.ts.map +1 -1
- package/testing/core/mocking/mockLink.js +24 -23
- package/testing/core/mocking/mockLink.js.map +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts +2 -2
- package/testing/core/mocking/mockQueryManager.js +3 -3
- package/testing/core/mocking/mockQueryManager.js.map +1 -1
- package/testing/core/mocking/mockSubscriptionLink.d.ts +3 -3
- package/testing/core/mocking/mockSubscriptionLink.js +4 -4
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts +2 -2
- package/testing/core/mocking/mockWatchQuery.js +2 -2
- package/testing/core/mocking/mockWatchQuery.js.map +1 -1
- package/testing/core/observableToPromise.d.ts +3 -3
- package/testing/core/observableToPromise.d.ts.map +1 -1
- package/testing/core/observableToPromise.js +8 -4
- package/testing/core/observableToPromise.js.map +1 -1
- package/testing/core/subscribeAndCount.d.ts +1 -1
- package/testing/core/subscribeAndCount.d.ts.map +1 -1
- package/testing/core/subscribeAndCount.js +5 -3
- package/testing/core/subscribeAndCount.js.map +1 -1
- package/testing/core/wait.js.map +1 -1
- package/testing/core/withConsoleSpy.d.ts.map +1 -1
- package/testing/core/withConsoleSpy.js.map +1 -1
- package/testing/core/wrap.d.ts.map +1 -1
- package/testing/core/wrap.js +14 -12
- package/testing/core/wrap.js.map +1 -1
- package/testing/index.d.ts +4 -4
- package/testing/index.js +3 -3
- package/testing/index.js.map +1 -1
- package/testing/react/MockedProvider.d.ts +7 -7
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +10 -11
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +3 -5
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +3 -5
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +4 -5
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/cloneDeep.js +2 -2
- package/utilities/common/cloneDeep.js.map +1 -1
- package/utilities/common/compact.d.ts +1 -1
- package/utilities/common/compact.js.map +1 -1
- package/utilities/common/filterInPlace.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +1 -1
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +3 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/common/mergeOptions.d.ts.map +1 -1
- package/utilities/common/mergeOptions.js.map +1 -1
- package/utilities/common/objects.js +2 -2
- package/utilities/common/objects.js.map +1 -1
- package/utilities/common/stringifyForDisplay.d.ts.map +1 -1
- package/utilities/common/stringifyForDisplay.js +3 -1
- package/utilities/common/stringifyForDisplay.js.map +1 -1
- package/utilities/globals/global.d.ts.map +1 -1
- package/utilities/globals/global.js +3 -1
- package/utilities/globals/global.js.map +1 -1
- package/utilities/globals/globals.cjs +8 -4
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +8 -4
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/globals/index.js.map +1 -1
- package/utilities/globals/invariantWrappers.js +1 -1
- package/utilities/globals/invariantWrappers.js.map +1 -1
- package/utilities/globals/maybe.d.ts.map +1 -1
- package/utilities/globals/maybe.js.map +1 -1
- package/utilities/graphql/directives.d.ts +1 -1
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +17 -13
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +12 -12
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts +1 -1
- package/utilities/graphql/getFromAST.js +16 -16
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts +2 -2
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +36 -34
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +48 -32
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/observables/Concast.d.ts.map +1 -1
- package/utilities/observables/Concast.js +5 -9
- package/utilities/observables/Concast.js.map +1 -1
- package/utilities/observables/Observable.d.ts +4 -4
- package/utilities/observables/Observable.d.ts.map +1 -1
- package/utilities/observables/Observable.js +6 -4
- package/utilities/observables/Observable.js.map +1 -1
- package/utilities/observables/asyncMap.d.ts.map +1 -1
- package/utilities/observables/asyncMap.js +5 -2
- package/utilities/observables/asyncMap.js.map +1 -1
- package/utilities/observables/iteration.js.map +1 -1
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -7
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/types/IsStrictlyAny.d.ts +2 -2
- package/utilities/types/IsStrictlyAny.d.ts.map +1 -1
- package/utilities/types/IsStrictlyAny.js.map +1 -1
- package/utilities/utilities.cjs +147 -121
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +147 -121
- package/version.js +1 -1
- package/version.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invariantWrappers.js","sourceRoot":"","sources":["../../../src/utilities/globals/invariantWrappers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,IAAI,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,MAAM,MAAM,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O,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,yBAAyB,GAC1B,CAAC","sourcesContent":["import { invariant as originalInvariant, InvariantError } from \"ts-invariant\";\nimport { version } from \"../../version.js\";\nimport global from \"./global.js\";\nimport type { ErrorCodes } from \"../../invariantErrorCodes.js\";\nimport { stringifyForDisplay } from \"../common/stringifyForDisplay.js\";\n\nfunction wrap(fn: (msg?: string, ...args: any[]) => void) {\n return function (message: string | number, ...args: any[]) {\n fn(typeof message === \"number\" ? getErrorMsg(message) : message, ...args);\n };\n}\n\ntype LogFunction = {\n /**\n * Logs a `$level` message if the user used `ts-invariant`'s `setVerbosity` to set\n * a verbosity level of `$level` or lower. (defaults to `\"log\"`).\n *\n * The user will either be presented with a link to the documentation for the message,\n * or they can use the `loadDevMessages` to add the message strings to the bundle.\n * The documentation will display the message without argument substitution.\n * Instead, the arguments will be printed on the console after the link.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n *\n * String substitutions like %s, %o, %d or %f are supported.\n */\n (message?: any, ...optionalParams: unknown[]): void;\n};\n\ntype WrappedInvariant = {\n /**\n * Throws and InvariantError with the given message if the condition is false.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n *\n * The user will either be presented with a link to the documentation for the message,\n * or they can use the `loadErrorMessages` to add the message strings to the bundle.\n * The documentation will display the message with the arguments substituted.\n *\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\n (\n condition: any,\n message?: string | number,\n ...optionalParams: unknown[]\n ): asserts condition;\n\n debug: LogFunction;\n log: LogFunction;\n warn: LogFunction;\n error: LogFunction;\n};\nconst invariant: WrappedInvariant = Object.assign(\n function invariant(\n condition: any,\n message?: string | number,\n ...args: unknown[]\n ): asserts condition {\n if (!condition) {\n originalInvariant(condition, getErrorMsg(message, args));\n }\n },\n {\n debug: wrap(originalInvariant.debug),\n log: wrap(originalInvariant.log),\n warn: wrap(originalInvariant.warn),\n error: wrap(originalInvariant.error),\n }\n);\n\n/**\n * Returns an InvariantError.\n *\n * `message` can only be a string, a concatenation of strings, or a ternary statement\n * that results in a string. This will be enforced on build, where the message will\n * be replaced with a message number.\n * String substitutions with %s are supported and will also return\n * pretty-stringified objects.\n * Excess `optionalParams` will be swallowed.\n */\nfunction newInvariantError(\n message?: string | number,\n ...optionalParams: unknown[]\n) {\n return new InvariantError(getErrorMsg(message, optionalParams));\n}\n\nconst ApolloErrorMessageHandler = Symbol.for(\n \"ApolloErrorMessageHandler_\" + version\n);\ndeclare global {\n interface Window {\n [ApolloErrorMessageHandler]?: {\n (message: string | number, args: unknown[]): string | undefined;\n } & ErrorCodes;\n }\n}\n\nfunction getErrorMsg(message?: string | number, messageArgs: unknown[] = []) {\n if (!message) return;\n const args = messageArgs.map((arg) =>\n typeof arg == \"string\" ? arg : stringifyForDisplay(arg, 2).slice(0, 1000)\n );\n return (\n (global[ApolloErrorMessageHandler] &&\n global[ApolloErrorMessageHandler](message, args)) ||\n `An error occurred! For more details, see the full error text at https://go.apollo.dev/c/err#${encodeURIComponent(\n JSON.stringify({\n version,\n message,\n args,\n })\n )}`\n );\n}\n\nexport {\n invariant,\n InvariantError,\n newInvariantError,\n ApolloErrorMessageHandler,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe.d.ts","sourceRoot":"","sources":["../../../src/utilities/globals/maybe.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"maybe.d.ts","sourceRoot":"","sources":["../../../src/utilities/globals/maybe.ts"],"names":[],"mappings":"AAAA,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAItD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe.js","sourceRoot":"","sources":["../../../src/utilities/globals/maybe.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAI,KAAc;IACrC,IAAI;
|
|
1
|
+
{"version":3,"file":"maybe.js","sourceRoot":"","sources":["../../../src/utilities/globals/maybe.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,KAAK,CAAI,KAAc;IACrC,IAAI;QACF,OAAO,KAAK,EAAE,CAAC;KAChB;IAAC,WAAM,GAAE;AACZ,CAAC","sourcesContent":["export function maybe<T>(thunk: () => T): T | undefined {\n try {\n return thunk();\n } catch {}\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SelectionNode, DirectiveNode, DocumentNode, ArgumentNode, ASTNode } from
|
|
1
|
+
import type { SelectionNode, DirectiveNode, DocumentNode, ArgumentNode, ASTNode } from "graphql";
|
|
2
2
|
export type DirectiveInfo = {
|
|
3
3
|
[fieldName: string]: {
|
|
4
4
|
[argName: string]: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/directives.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEZ,OAAO,
|
|
1
|
+
{"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/directives.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EAGb,aAAa,EACb,YAAY,EACZ,YAAY,EAEZ,OAAO,EACR,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,aAAa,GAAG;IAC1B,CAAC,SAAS,EAAE,MAAM,GAAG;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CACjD,CAAC;AAEF,wBAAgB,aAAa,CAC3B,EAAE,UAAU,EAAE,EAAE,aAAa,EAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,OAAO,CAqBT;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,YAU9C;AAED,eAAO,MAAM,gBAAgB,UAAW,MAAM,EAAE,QAAQ,OAAO,YAC5B,CAAC;AAEpC,eAAO,MAAM,gBAAgB,UAAW,MAAM,EAAE,QAAQ,OAAO,YAC7B,CAAC;AAEnC,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,WAe1E;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,YAAY,WAEtD;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC;IACtC,SAAS,EAAE,aAAa,CAAC;IACzB,UAAU,EAAE,YAAY,CAAC;CAC1B,CAAC,CAAC;AAMH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,aAAa,CAAC,GACvC,mBAAmB,CAsCrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { invariant } from
|
|
2
|
-
import { visit, BREAK
|
|
1
|
+
import { invariant } from "../globals/index.js";
|
|
2
|
+
import { visit, BREAK } from "graphql";
|
|
3
3
|
export function shouldInclude(_a, variables) {
|
|
4
4
|
var directives = _a.directives;
|
|
5
5
|
if (!directives || !directives.length) {
|
|
@@ -8,14 +8,15 @@ export function shouldInclude(_a, variables) {
|
|
|
8
8
|
return getInclusionDirectives(directives).every(function (_a) {
|
|
9
9
|
var directive = _a.directive, ifArgument = _a.ifArgument;
|
|
10
10
|
var evaledValue = false;
|
|
11
|
-
if (ifArgument.value.kind ===
|
|
12
|
-
evaledValue =
|
|
11
|
+
if (ifArgument.value.kind === "Variable") {
|
|
12
|
+
evaledValue =
|
|
13
|
+
variables && variables[ifArgument.value.name.value];
|
|
13
14
|
invariant(evaledValue !== void 0, 64, directive.name.value);
|
|
14
15
|
}
|
|
15
16
|
else {
|
|
16
17
|
evaledValue = ifArgument.value.value;
|
|
17
18
|
}
|
|
18
|
-
return directive.name.value ===
|
|
19
|
+
return directive.name.value === "skip" ? !evaledValue : evaledValue;
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
export function getDirectiveNames(root) {
|
|
@@ -27,15 +28,18 @@ export function getDirectiveNames(root) {
|
|
|
27
28
|
});
|
|
28
29
|
return names;
|
|
29
30
|
}
|
|
30
|
-
export var hasAnyDirectives = function (names, root) {
|
|
31
|
-
|
|
31
|
+
export var hasAnyDirectives = function (names, root) {
|
|
32
|
+
return hasDirectives(names, root, false);
|
|
33
|
+
};
|
|
34
|
+
export var hasAllDirectives = function (names, root) {
|
|
35
|
+
return hasDirectives(names, root, true);
|
|
36
|
+
};
|
|
32
37
|
export function hasDirectives(names, root, all) {
|
|
33
38
|
var nameSet = new Set(names);
|
|
34
39
|
var uniqueCount = nameSet.size;
|
|
35
40
|
visit(root, {
|
|
36
41
|
Directive: function (node) {
|
|
37
|
-
if (nameSet.delete(node.name.value) &&
|
|
38
|
-
(!all || !nameSet.size)) {
|
|
42
|
+
if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {
|
|
39
43
|
return BREAK;
|
|
40
44
|
}
|
|
41
45
|
},
|
|
@@ -43,11 +47,11 @@ export function hasDirectives(names, root, all) {
|
|
|
43
47
|
return all ? !nameSet.size : nameSet.size < uniqueCount;
|
|
44
48
|
}
|
|
45
49
|
export function hasClientExports(document) {
|
|
46
|
-
return document && hasDirectives([
|
|
50
|
+
return document && hasDirectives(["client", "export"], document, true);
|
|
47
51
|
}
|
|
48
52
|
function isInclusionDirective(_a) {
|
|
49
53
|
var value = _a.name.value;
|
|
50
|
-
return value ===
|
|
54
|
+
return value === "skip" || value === "include";
|
|
51
55
|
}
|
|
52
56
|
export function getInclusionDirectives(directives) {
|
|
53
57
|
var result = [];
|
|
@@ -59,10 +63,10 @@ export function getInclusionDirectives(directives) {
|
|
|
59
63
|
var directiveName = directive.name.value;
|
|
60
64
|
invariant(directiveArguments && directiveArguments.length === 1, 65, directiveName);
|
|
61
65
|
var ifArgument = directiveArguments[0];
|
|
62
|
-
invariant(ifArgument.name && ifArgument.name.value ===
|
|
66
|
+
invariant(ifArgument.name && ifArgument.name.value === "if", 66, directiveName);
|
|
63
67
|
var ifValue = ifArgument.value;
|
|
64
68
|
invariant(ifValue &&
|
|
65
|
-
(ifValue.kind ===
|
|
69
|
+
(ifValue.kind === "Variable" || ifValue.kind === "BooleanValue"), 67, directiveName);
|
|
66
70
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
67
71
|
});
|
|
68
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../../src/utilities/graphql/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"directives.js","sourceRoot":"","sources":["../../../src/utilities/graphql/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAchD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAMvC,MAAM,UAAU,aAAa,CAC3B,EAA6B,EAC7B,SAA+B;QAD7B,UAAU,gBAAA;IAGZ,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IACD,OAAO,sBAAsB,CAAC,UAAU,CAAC,CAAC,KAAK,CAC7C,UAAC,EAAyB;YAAvB,SAAS,eAAA,EAAE,UAAU,gBAAA;QACtB,IAAI,WAAW,GAAY,KAAK,CAAC;QACjC,IAAI,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;YACxC,WAAW;gBACT,SAAS,IAAI,SAAS,CAAE,UAAU,CAAC,KAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACxE,SAAS,CACP,W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AAc,CAAC,EAClE,uEAAuE,EACvE,aAAa,CACd,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,EAAE,SAAS,WAAA,EAAE,UAAU,YAAA,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { invariant } from \"../globals/index.js\";\n\n// Provides the methods that allow QueryManager to handle the `skip` and\n// `include` directives within GraphQL.\nimport type {\n SelectionNode,\n VariableNode,\n BooleanValueNode,\n DirectiveNode,\n DocumentNode,\n ArgumentNode,\n ValueNode,\n ASTNode,\n} from \"graphql\";\nimport { visit, BREAK } from \"graphql\";\n\nexport type DirectiveInfo = {\n [fieldName: string]: { [argName: string]: any };\n};\n\nexport function shouldInclude(\n { directives }: SelectionNode,\n variables?: Record<string, any>\n): boolean {\n if (!directives || !directives.length) {\n return true;\n }\n return getInclusionDirectives(directives).every(\n ({ directive, ifArgument }) => {\n let evaledValue: boolean = false;\n if (ifArgument.value.kind === \"Variable\") {\n evaledValue =\n variables && variables[(ifArgument.value as VariableNode).name.value];\n invariant(\n evaledValue !== void 0,\n `Invalid variable referenced in @%s directive.`,\n directive.name.value\n );\n } else {\n evaledValue = (ifArgument.value as BooleanValueNode).value;\n }\n return directive.name.value === \"skip\" ? !evaledValue : evaledValue;\n }\n );\n}\n\nexport function getDirectiveNames(root: ASTNode) {\n const names: string[] = [];\n\n visit(root, {\n Directive(node: DirectiveNode) {\n names.push(node.name.value);\n },\n });\n\n return names;\n}\n\nexport const hasAnyDirectives = (names: string[], root: ASTNode) =>\n hasDirectives(names, root, false);\n\nexport const hasAllDirectives = (names: string[], root: ASTNode) =>\n hasDirectives(names, root, true);\n\nexport function hasDirectives(names: string[], root: ASTNode, all?: boolean) {\n const nameSet = new Set(names);\n const uniqueCount = nameSet.size;\n\n visit(root, {\n Directive(node) {\n if (nameSet.delete(node.name.value) && (!all || !nameSet.size)) {\n return BREAK;\n }\n },\n });\n\n // If we found all the names, nameSet will be empty. If we only care about\n // finding some of them, the < condition is sufficient.\n return all ? !nameSet.size : nameSet.size < uniqueCount;\n}\n\nexport function hasClientExports(document: DocumentNode) {\n return document && hasDirectives([\"client\", \"export\"], document, true);\n}\n\nexport type InclusionDirectives = Array<{\n directive: DirectiveNode;\n ifArgument: ArgumentNode;\n}>;\n\nfunction isInclusionDirective({ name: { value } }: DirectiveNode): boolean {\n return value === \"skip\" || value === \"include\";\n}\n\nexport function getInclusionDirectives(\n directives: ReadonlyArray<DirectiveNode>\n): InclusionDirectives {\n const result: InclusionDirectives = [];\n\n if (directives && directives.length) {\n directives.forEach((directive) => {\n if (!isInclusionDirective(directive)) return;\n\n const directiveArguments = directive.arguments;\n const directiveName = directive.name.value;\n\n invariant(\n directiveArguments && directiveArguments.length === 1,\n `Incorrect number of arguments for the @%s directive.`,\n directiveName\n );\n\n const ifArgument = directiveArguments![0];\n invariant(\n ifArgument.name && ifArgument.name.value === \"if\",\n `Invalid argument for the @%s directive.`,\n directiveName\n );\n\n const ifValue: ValueNode = ifArgument.value;\n\n // means it has to be a variable value if this is a valid @skip or @include directive\n invariant(\n ifValue &&\n (ifValue.kind === \"Variable\" || ifValue.kind === \"BooleanValue\"),\n `Argument for the @%s directive must be a variable or a boolean value.`,\n directiveName\n );\n\n result.push({ directive, ifArgument });\n });\n }\n\n return result;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocumentNode, FragmentDefinitionNode, InlineFragmentNode, SelectionNode } from
|
|
1
|
+
import type { DocumentNode, FragmentDefinitionNode, InlineFragmentNode, SelectionNode } from "graphql";
|
|
2
2
|
export declare function getFragmentQueryDocument(document: DocumentNode, fragmentName?: string): DocumentNode;
|
|
3
3
|
export interface FragmentMap {
|
|
4
4
|
[fragmentName: string]: FragmentDefinitionNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACd,MAAM,SAAS,CAAC;AA2BjB,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAED,MAAM,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACd,MAAM,SAAS,CAAC;AA2BjB,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,YAAY,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,YAAY,CA+Dd;AAKD,MAAM,WAAW,WAAW;IAC1B,CAAC,YAAY,EAAE,MAAM,GAAG,sBAAsB,CAAC;CAChD;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,YAAY,EAAE,MAAM,KACjB,sBAAsB,GAAG,IAAI,CAAC;AAInC,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,sBAAsB,EAAO,GACvC,WAAW,CAMb;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,aAAa,EACxB,WAAW,CAAC,EAAE,WAAW,GAAG,mBAAmB,GAC9C,kBAAkB,GAAG,sBAAsB,GAAG,IAAI,CAgBpD"}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { __assign, __spreadArray } from "tslib";
|
|
2
|
-
import { invariant, newInvariantError } from
|
|
2
|
+
import { invariant, newInvariantError } from "../globals/index.js";
|
|
3
3
|
export function getFragmentQueryDocument(document, fragmentName) {
|
|
4
4
|
var actualFragmentName = fragmentName;
|
|
5
5
|
var fragments = [];
|
|
6
6
|
document.definitions.forEach(function (definition) {
|
|
7
|
-
if (definition.kind ===
|
|
7
|
+
if (definition.kind === "OperationDefinition") {
|
|
8
8
|
throw newInvariantError(
|
|
9
9
|
68,
|
|
10
10
|
definition.operation,
|
|
11
|
-
definition.name ? " named '".concat(definition.name.value, "'") :
|
|
11
|
+
definition.name ? " named '".concat(definition.name.value, "'") : ""
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
|
-
if (definition.kind ===
|
|
14
|
+
if (definition.kind === "FragmentDefinition") {
|
|
15
15
|
fragments.push(definition);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
if (typeof actualFragmentName ===
|
|
18
|
+
if (typeof actualFragmentName === "undefined") {
|
|
19
19
|
invariant(fragments.length === 1, 69, fragments.length);
|
|
20
20
|
actualFragmentName = fragments[0].name.value;
|
|
21
21
|
}
|
|
22
22
|
var query = __assign(__assign({}, document), { definitions: __spreadArray([
|
|
23
23
|
{
|
|
24
|
-
kind:
|
|
25
|
-
operation:
|
|
24
|
+
kind: "OperationDefinition",
|
|
25
|
+
operation: "query",
|
|
26
26
|
selectionSet: {
|
|
27
|
-
kind:
|
|
27
|
+
kind: "SelectionSet",
|
|
28
28
|
selections: [
|
|
29
29
|
{
|
|
30
|
-
kind:
|
|
30
|
+
kind: "FragmentSpread",
|
|
31
31
|
name: {
|
|
32
|
-
kind:
|
|
32
|
+
kind: "Name",
|
|
33
33
|
value: actualFragmentName,
|
|
34
34
|
},
|
|
35
35
|
},
|
|
@@ -49,9 +49,9 @@ export function createFragmentMap(fragments) {
|
|
|
49
49
|
}
|
|
50
50
|
export function getFragmentFromSelection(selection, fragmentMap) {
|
|
51
51
|
switch (selection.kind) {
|
|
52
|
-
case
|
|
52
|
+
case "InlineFragment":
|
|
53
53
|
return selection;
|
|
54
|
-
case
|
|
54
|
+
case "FragmentSpread": {
|
|
55
55
|
var fragmentName = selection.name.value;
|
|
56
56
|
if (typeof fragmentMap === "function") {
|
|
57
57
|
return fragmentMap(fragmentName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkCnE,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../src/utilities/graphql/fragments.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAkCnE,MAAM,UAAU,wBAAwB,CACtC,QAAsB,EACtB,YAAqB;IAErB,IAAI,kBAAkB,GAAG,YAAY,CAAC;IAKtC,IAAM,SAAS,GAAkC,EAAE,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAC,UAAU;QAGtC,IAAI,UAAU,CAAC,IAAI,KAAK,qBAAqB,EAAE;YAC7C,MAAM,iBAAiB,CACrB,0BAA0B;gBACxB,yFAAyF,EAC3F,UAAU,CAAC,SAAS,EACpB,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAW,UAAU,CAAC,IAAI,CAAC,KAAK,MAAG,CAAC,CAAC,CAAC,EAAE,CAC3D,CAAC;SACH;QAGD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,EAAE;YAC5C,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAC5B;IACH,CAAC,CAAC,CAAC;IAIH,IAAI,OAAO,kBAAkB,KAAK,WAAW,EAAE;QAC7C,SAAS,CACP,SAAS,CAAC,MAAM,KAAK,CAAC,EACtB,2FAA6F,EAC7F,SAAS,CAAC,MAAM,CACjB,CAAC;QACF,kBAAkB,GAAG,SAAS,CAA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CAAC;KACf;AACH,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n FragmentDefinitionNode,\n InlineFragmentNode,\n SelectionNode,\n} from \"graphql\";\n\n// TODO(brian): A hack until this issue is resolved (https://github.com/graphql/graphql-js/issues/3356)\ntype Kind = any;\ntype OperationTypeNode = any;\n/**\n * Returns a query document which adds a single query operation that only\n * spreads the target fragment inside of it.\n *\n * So for example a document of:\n *\n * ```graphql\n * fragment foo on Foo { a b c }\n * ```\n *\n * Turns into:\n *\n * ```graphql\n * { ...foo }\n *\n * fragment foo on Foo { a b c }\n * ```\n *\n * The target fragment will either be the only fragment in the document, or a\n * fragment specified by the provided `fragmentName`. If there is more than one\n * fragment, but a `fragmentName` was not defined then an error will be thrown.\n */\nexport function getFragmentQueryDocument(\n document: DocumentNode,\n fragmentName?: string\n): DocumentNode {\n let actualFragmentName = fragmentName;\n\n // Build an array of all our fragment definitions that will be used for\n // validations. We also do some validations on the other definitions in the\n // document while building this list.\n const fragments: Array<FragmentDefinitionNode> = [];\n document.definitions.forEach((definition) => {\n // Throw an error if we encounter an operation definition because we will\n // define our own operation definition later on.\n if (definition.kind === \"OperationDefinition\") {\n throw newInvariantError(\n `Found a %s operation%s. ` +\n \"No operations are allowed when using a fragment as a query. Only fragments are allowed.\",\n definition.operation,\n definition.name ? ` named '${definition.name.value}'` : \"\"\n );\n }\n // Add our definition to the fragments array if it is a fragment\n // definition.\n if (definition.kind === \"FragmentDefinition\") {\n fragments.push(definition);\n }\n });\n\n // If the user did not give us a fragment name then let us try to get a\n // name from a single fragment in the definition.\n if (typeof actualFragmentName === \"undefined\") {\n invariant(\n fragments.length === 1,\n `Found %s fragments. \\`fragmentName\\` must be provided when there is not exactly 1 fragment.`,\n fragments.length\n );\n actualFragmentName = fragments[0].name.value;\n }\n\n // Generate a query document with an operation that simply spreads the\n // fragment inside of it.\n const query: DocumentNode = {\n ...document,\n definitions: [\n {\n kind: \"OperationDefinition\" as Kind,\n // OperationTypeNode is an enum\n operation: \"query\" as OperationTypeNode,\n selectionSet: {\n kind: \"SelectionSet\" as Kind,\n selections: [\n {\n kind: \"FragmentSpread\" as Kind,\n name: {\n kind: \"Name\" as Kind,\n value: actualFragmentName,\n },\n },\n ],\n },\n },\n ...document.definitions,\n ],\n };\n\n return query;\n}\n\n/**\n * This is an interface that describes a map from fragment names to fragment definitions.\n */\nexport interface FragmentMap {\n [fragmentName: string]: FragmentDefinitionNode;\n}\n\nexport type FragmentMapFunction = (\n fragmentName: string\n) => FragmentDefinitionNode | null;\n\n// Utility function that takes a list of fragment definitions and makes a hash out of them\n// that maps the name of the fragment to the fragment definition.\nexport function createFragmentMap(\n fragments: FragmentDefinitionNode[] = []\n): FragmentMap {\n const symTable: FragmentMap = {};\n fragments.forEach((fragment) => {\n symTable[fragment.name.value] = fragment;\n });\n return symTable;\n}\n\nexport function getFragmentFromSelection(\n selection: SelectionNode,\n fragmentMap?: FragmentMap | FragmentMapFunction\n): InlineFragmentNode | FragmentDefinitionNode | null {\n switch (selection.kind) {\n case \"InlineFragment\":\n return selection;\n case \"FragmentSpread\": {\n const fragmentName = selection.name.value;\n if (typeof fragmentMap === \"function\") {\n return fragmentMap(fragmentName);\n }\n const fragment = fragmentMap && fragmentMap[fragmentName];\n invariant(fragment, `No fragment named %s`, fragmentName);\n return fragment || null;\n }\n default:\n return null;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from
|
|
1
|
+
import type { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from "graphql";
|
|
2
2
|
export declare function checkDocument(doc: DocumentNode): DocumentNode;
|
|
3
3
|
export declare function getOperationDefinition(doc: DocumentNode): OperationDefinitionNode | undefined;
|
|
4
4
|
export declare function getOperationName(doc: DocumentNode): string | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { invariant, newInvariantError } from
|
|
2
|
-
import { valueToObjectRepresentation } from
|
|
1
|
+
import { invariant, newInvariantError } from "../globals/index.js";
|
|
2
|
+
import { valueToObjectRepresentation } from "./storeUtils.js";
|
|
3
3
|
export function checkDocument(doc) {
|
|
4
|
-
invariant(doc && doc.kind ===
|
|
4
|
+
invariant(doc && doc.kind === "Document", 71);
|
|
5
5
|
var operations = doc.definitions
|
|
6
|
-
.filter(function (d) { return d.kind !==
|
|
6
|
+
.filter(function (d) { return d.kind !== "FragmentDefinition"; })
|
|
7
7
|
.map(function (definition) {
|
|
8
|
-
if (definition.kind !==
|
|
8
|
+
if (definition.kind !== "OperationDefinition") {
|
|
9
9
|
throw newInvariantError(72, definition.kind);
|
|
10
10
|
}
|
|
11
11
|
return definition;
|
|
@@ -16,31 +16,31 @@ export function checkDocument(doc) {
|
|
|
16
16
|
export function getOperationDefinition(doc) {
|
|
17
17
|
checkDocument(doc);
|
|
18
18
|
return doc.definitions.filter(function (definition) {
|
|
19
|
-
return definition.kind ===
|
|
19
|
+
return definition.kind === "OperationDefinition";
|
|
20
20
|
})[0];
|
|
21
21
|
}
|
|
22
22
|
export function getOperationName(doc) {
|
|
23
23
|
return (doc.definitions
|
|
24
24
|
.filter(function (definition) {
|
|
25
|
-
return definition.kind ===
|
|
25
|
+
return definition.kind === "OperationDefinition" && !!definition.name;
|
|
26
26
|
})
|
|
27
27
|
.map(function (x) { return x.name.value; })[0] || null);
|
|
28
28
|
}
|
|
29
29
|
export function getFragmentDefinitions(doc) {
|
|
30
30
|
return doc.definitions.filter(function (definition) {
|
|
31
|
-
return definition.kind ===
|
|
31
|
+
return definition.kind === "FragmentDefinition";
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
export function getQueryDefinition(doc) {
|
|
35
35
|
var queryDef = getOperationDefinition(doc);
|
|
36
|
-
invariant(queryDef && queryDef.operation ===
|
|
36
|
+
invariant(queryDef && queryDef.operation === "query", 74);
|
|
37
37
|
return queryDef;
|
|
38
38
|
}
|
|
39
39
|
export function getFragmentDefinition(doc) {
|
|
40
|
-
invariant(doc.kind ===
|
|
40
|
+
invariant(doc.kind === "Document", 75);
|
|
41
41
|
invariant(doc.definitions.length <= 1, 76);
|
|
42
42
|
var fragmentDef = doc.definitions[0];
|
|
43
|
-
invariant(fragmentDef.kind ===
|
|
43
|
+
invariant(fragmentDef.kind === "FragmentDefinition", 77);
|
|
44
44
|
return fragmentDef;
|
|
45
45
|
}
|
|
46
46
|
export function getMainDefinition(queryDoc) {
|
|
@@ -48,15 +48,15 @@ export function getMainDefinition(queryDoc) {
|
|
|
48
48
|
var fragmentDefinition;
|
|
49
49
|
for (var _i = 0, _a = queryDoc.definitions; _i < _a.length; _i++) {
|
|
50
50
|
var definition = _a[_i];
|
|
51
|
-
if (definition.kind ===
|
|
51
|
+
if (definition.kind === "OperationDefinition") {
|
|
52
52
|
var operation = definition.operation;
|
|
53
|
-
if (operation ===
|
|
54
|
-
operation ===
|
|
55
|
-
operation ===
|
|
53
|
+
if (operation === "query" ||
|
|
54
|
+
operation === "mutation" ||
|
|
55
|
+
operation === "subscription") {
|
|
56
56
|
return definition;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
if (definition.kind ===
|
|
59
|
+
if (definition.kind === "FragmentDefinition" && !fragmentDefinition) {
|
|
60
60
|
fragmentDefinition = definition;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFromAST.js","sourceRoot":"","sources":["../../../src/utilities/graphql/getFromAST.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AASnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAO9D,MAAM,UAAU,aAAa,CAAC,GAAiB;IAC7C,SAAS,CACP,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAC9B,0JAC2E,CAC5E,CAAC;IAEF,IAAM,UAAU,GAAG,GAAG,CAAC,WAAW;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BAAqB,EAAE;YAC7C,IAAM,SAAS,GAAI,UAAsC,CAAC,SAAS,CAAC;YACpE,IACE,SAAS,KAAK,OAAO;gBACrB,SAAS,KAAK,UAAU;gBACxB,SAAS,KAAK,cAAc,EAC5B;gBACA,OAAO,UAAqC,CAAC;aAC9C;SACF;QACD,IAAI,UAAU,CAAC,IAAI,KAAK,oBAAoB,IAAI,CAAC,kBAAkB,EAAE;YAGnE,kBAAkB,GAAG,UAAoC,CAAC;SAC3D;KACF;IAED,IAAI,kBAAkB,EAAE;QACtB,OAAO,kBAAkB,CAAC;KAC3B;IAED,MAAM,iBAAiB,CACrB,sFAAsF,CACvF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,UAA+C;IAE/C,IAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAM,IAAI,GAAG,UAAU,IAAI,UAAU,CAAC,mBAAmB,CAAC;IAC1D,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE;QACvB,IAAI,CAAC,OAAO,CAAC,UAAC,GAAG;YACf,IAAI,GAAG,CAAC,YAAY,EAAE;gBACpB,2BAA2B,CACzB,aAAa,EACb,GAAG,CAAC,QAAQ,CAAC,IAAI,EACjB,GAAG,CAAC,YAAyB,CAC9B,CAAC;aACH;QACH,CAAC,CAAC,CAAC;KACJ;IACD,OAAO,aAAa,CAAC;AACvB,CAAC","sourcesContent":["import { invariant, newInvariantError } from \"../globals/index.js\";\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n FragmentDefinitionNode,\n ValueNode,\n} from \"graphql\";\n\nimport { valueToObjectRepresentation } from \"./storeUtils.js\";\n\ntype OperationDefinitionWithName = OperationDefinitionNode & {\n name: NonNullable<OperationDefinitionNode[\"name\"]>;\n};\n\n// Checks the document for errors and throws an exception if there is an error.\nexport function checkDocument(doc: DocumentNode) {\n invariant(\n doc && doc.kind === \"Document\",\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`\n );\n\n const operations = doc.definitions\n .filter((d) => d.kind !== \"FragmentDefinition\")\n .map((definition) => {\n if (definition.kind !== \"OperationDefinition\") {\n throw newInvariantError(\n `Schema type definitions not allowed in queries. Found: \"%s\"`,\n definition.kind\n );\n }\n return definition;\n });\n\n invariant(\n operations.length <= 1,\n `Ambiguous GraphQL document: contains %s operations`,\n operations.length\n );\n\n return doc;\n}\n\nexport function getOperationDefinition(\n doc: DocumentNode\n): OperationDefinitionNode | undefined {\n checkDocument(doc);\n return doc.definitions.filter(\n (definition): definition is OperationDefinitionNode =>\n definition.kind === \"OperationDefinition\"\n )[0];\n}\n\nexport function getOperationName(doc: DocumentNode): string | null {\n return (\n doc.definitions\n .filter(\n (definition): definition is OperationDefinitionWithName =>\n definition.kind === \"OperationDefinition\" && !!definition.name\n )\n .map((x) => x.name.value)[0] || null\n );\n}\n\n// Returns the FragmentDefinitions from a particular document as an array\nexport function getFragmentDefinitions(\n doc: DocumentNode\n): FragmentDefinitionNode[] {\n return doc.definitions.filter(\n (definition): definition is FragmentDefinitionNode =>\n definition.kind === \"FragmentDefinition\"\n );\n}\n\nexport function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode {\n const queryDef = getOperationDefinition(doc)!;\n\n invariant(\n queryDef && queryDef.operation === \"query\",\n \"Must contain a query definition.\"\n );\n\n return queryDef;\n}\n\nexport function getFragmentDefinition(\n doc: DocumentNode\n): FragmentDefinitionNode {\n invariant(\n doc.kind === \"Document\",\n `Expecting a parsed GraphQL document. Perhaps you need to wrap the query \\\nstring in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql`\n );\n\n invariant(\n doc.definitions.length <= 1,\n \"Fragment must have exactly one definition.\"\n );\n\n const fragmentDef = doc.definitions[0] as FragmentDefinitionNode;\n\n invariant(\n fragmentDef.kind === \"FragmentDefinition\",\n \"Must be a fragment definition.\"\n );\n\n return fragmentDef as FragmentDefinitionNode;\n}\n\n/**\n * Returns the first operation definition found in this document.\n * If no operation definition is found, the first fragment definition will be returned.\n * If no definitions are found, an error will be thrown.\n */\nexport function getMainDefinition(\n queryDoc: DocumentNode\n): OperationDefinitionNode | FragmentDefinitionNode {\n checkDocument(queryDoc);\n\n let fragmentDefinition;\n\n for (let definition of queryDoc.definitions) {\n if (definition.kind === \"OperationDefinition\") {\n const operation = (definition as OperationDefinitionNode).operation;\n if (\n operation === \"query\" ||\n operation === \"mutation\" ||\n operation === \"subscription\"\n ) {\n return definition as OperationDefinitionNode;\n }\n }\n if (definition.kind === \"FragmentDefinition\" && !fragmentDefinition) {\n // we do this because we want to allow multiple fragment definitions\n // to precede an operation definition.\n fragmentDefinition = definition as FragmentDefinitionNode;\n }\n }\n\n if (fragmentDefinition) {\n return fragmentDefinition;\n }\n\n throw newInvariantError(\n \"Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.\"\n );\n}\n\nexport function getDefaultValues(\n definition: OperationDefinitionNode | undefined\n): Record<string, any> {\n const defaultValues = Object.create(null);\n const defs = definition && definition.variableDefinitions;\n if (defs && defs.length) {\n defs.forEach((def) => {\n if (def.defaultValue) {\n valueToObjectRepresentation(\n defaultValues,\n def.variable.name,\n def.defaultValue as ValueNode\n );\n }\n });\n }\n return defaultValues;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DirectiveNode, FieldNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode, SelectionSetNode, DocumentNode } from
|
|
2
|
-
import type { FragmentMap } from
|
|
1
|
+
import type { DirectiveNode, FieldNode, VariableNode, InlineFragmentNode, ValueNode, SelectionNode, NameNode, SelectionSetNode, DocumentNode } from "graphql";
|
|
2
|
+
import type { FragmentMap } from "./fragments.js";
|
|
3
3
|
export interface Reference {
|
|
4
4
|
readonly __ref: string;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/storeUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EAST,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EAEb,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"storeUtils.d.ts","sourceRoot":"","sources":["../../../src/utilities/graphql/storeUtils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EAST,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,YAAY,EAEb,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAEnD;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,SAAS,CAItD;AAED,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,SAAS,GACT,SAAS,EAAE,GACX,IAAI,GACJ,SAAS,GACT,IAAI,GACJ,MAAM,CAAC;AAEX,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,cAAc,EAAE,MAAM,GAAG,UAAU,CAAC;CACtC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,YAAY,CAMhE;AAsCD,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,GAAG,EACX,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,MAAM,QAuCnB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA6BR;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,aAAa,EAAE,MAAM,GAAG;QACvB,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;KACxB,CAAC;CACH,CAAC;AAYF,eAAO,MAAM,eAAe,eAEb,MAAM,SACV,OAAO,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,eACpB,UAAU,KACtB,MAAM;oBAmDS,gBAAgB,WAUa,GAAG,KAAG,MAAM;CAJ5D,CAAC;AAIF,QAAA,IAAI,SAAS,UAAoC,GAAG,KAAG,MAEtD,CAAC;AAiBF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,SAAS,GAAG,aAAa,EAChC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC9B,MAAM,GAAG,IAAI,CASf;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAE/D;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,YAAY,EAAE,gBAAgB,EAC9B,WAAW,CAAC,EAAE,WAAW,GACxB,MAAM,GAAG,SAAS,CA4BpB;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,aAAa,GAAG,SAAS,IAAI,SAAS,CAExE;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,aAAa,GACvB,SAAS,IAAI,kBAAkB,CAEjC;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,YAAY,KAAK,GAAG,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { newInvariantError } from
|
|
2
|
-
import { isNonNullObject } from
|
|
3
|
-
import { getFragmentFromSelection } from
|
|
1
|
+
import { newInvariantError } from "../globals/index.js";
|
|
2
|
+
import { isNonNullObject } from "../common/objects.js";
|
|
3
|
+
import { getFragmentFromSelection } from "./fragments.js";
|
|
4
4
|
export function makeReference(id) {
|
|
5
5
|
return { __ref: String(id) };
|
|
6
6
|
}
|
|
7
7
|
export function isReference(obj) {
|
|
8
|
-
return Boolean(obj && typeof obj ===
|
|
8
|
+
return Boolean(obj && typeof obj === "object" && typeof obj.__ref === "string");
|
|
9
9
|
}
|
|
10
10
|
export function isDocumentNode(value) {
|
|
11
11
|
return (isNonNullObject(value) &&
|
|
@@ -13,31 +13,31 @@ export function isDocumentNode(value) {
|
|
|
13
13
|
Array.isArray(value.definitions));
|
|
14
14
|
}
|
|
15
15
|
function isStringValue(value) {
|
|
16
|
-
return value.kind ===
|
|
16
|
+
return value.kind === "StringValue";
|
|
17
17
|
}
|
|
18
18
|
function isBooleanValue(value) {
|
|
19
|
-
return value.kind ===
|
|
19
|
+
return value.kind === "BooleanValue";
|
|
20
20
|
}
|
|
21
21
|
function isIntValue(value) {
|
|
22
|
-
return value.kind ===
|
|
22
|
+
return value.kind === "IntValue";
|
|
23
23
|
}
|
|
24
24
|
function isFloatValue(value) {
|
|
25
|
-
return value.kind ===
|
|
25
|
+
return value.kind === "FloatValue";
|
|
26
26
|
}
|
|
27
27
|
function isVariable(value) {
|
|
28
|
-
return value.kind ===
|
|
28
|
+
return value.kind === "Variable";
|
|
29
29
|
}
|
|
30
30
|
function isObjectValue(value) {
|
|
31
|
-
return value.kind ===
|
|
31
|
+
return value.kind === "ObjectValue";
|
|
32
32
|
}
|
|
33
33
|
function isListValue(value) {
|
|
34
|
-
return value.kind ===
|
|
34
|
+
return value.kind === "ListValue";
|
|
35
35
|
}
|
|
36
36
|
function isEnumValue(value) {
|
|
37
|
-
return value.kind ===
|
|
37
|
+
return value.kind === "EnumValue";
|
|
38
38
|
}
|
|
39
39
|
function isNullValue(value) {
|
|
40
|
-
return value.kind ===
|
|
40
|
+
return value.kind === "NullValue";
|
|
41
41
|
}
|
|
42
42
|
export function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
43
43
|
if (isIntValue(value) || isFloatValue(value)) {
|
|
@@ -99,33 +99,33 @@ export function storeKeyNameFromField(field, variables) {
|
|
|
99
99
|
return getStoreKeyName(field.name.value, argObj, directivesObj);
|
|
100
100
|
}
|
|
101
101
|
var KNOWN_DIRECTIVES = [
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
"connection",
|
|
103
|
+
"include",
|
|
104
|
+
"skip",
|
|
105
|
+
"client",
|
|
106
|
+
"rest",
|
|
107
|
+
"export",
|
|
108
|
+
"nonreactive",
|
|
109
109
|
];
|
|
110
110
|
export var getStoreKeyName = Object.assign(function (fieldName, args, directives) {
|
|
111
111
|
if (args &&
|
|
112
112
|
directives &&
|
|
113
|
-
directives[
|
|
114
|
-
directives[
|
|
115
|
-
if (directives[
|
|
116
|
-
directives[
|
|
117
|
-
var filterKeys = directives[
|
|
118
|
-
? directives[
|
|
113
|
+
directives["connection"] &&
|
|
114
|
+
directives["connection"]["key"]) {
|
|
115
|
+
if (directives["connection"]["filter"] &&
|
|
116
|
+
directives["connection"]["filter"].length > 0) {
|
|
117
|
+
var filterKeys = directives["connection"]["filter"]
|
|
118
|
+
? directives["connection"]["filter"]
|
|
119
119
|
: [];
|
|
120
120
|
filterKeys.sort();
|
|
121
121
|
var filteredArgs_1 = {};
|
|
122
122
|
filterKeys.forEach(function (key) {
|
|
123
123
|
filteredArgs_1[key] = args[key];
|
|
124
124
|
});
|
|
125
|
-
return "".concat(directives[
|
|
125
|
+
return "".concat(directives["connection"]["key"], "(").concat(stringify(filteredArgs_1), ")");
|
|
126
126
|
}
|
|
127
127
|
else {
|
|
128
|
-
return directives[
|
|
128
|
+
return directives["connection"]["key"];
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
var completeFieldName = fieldName;
|
|
@@ -158,7 +158,9 @@ var stringify = function defaultStringify(value) {
|
|
|
158
158
|
};
|
|
159
159
|
function stringifyReplacer(_key, value) {
|
|
160
160
|
if (isNonNullObject(value) && !Array.isArray(value)) {
|
|
161
|
-
value = Object.keys(value)
|
|
161
|
+
value = Object.keys(value)
|
|
162
|
+
.sort()
|
|
163
|
+
.reduce(function (copy, key) {
|
|
162
164
|
copy[key] = value[key];
|
|
163
165
|
return copy;
|
|
164
166
|
}, {});
|
|
@@ -184,7 +186,7 @@ export function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
|
184
186
|
for (var _i = 0, _a = selectionSet.selections; _i < _a.length; _i++) {
|
|
185
187
|
var selection = _a[_i];
|
|
186
188
|
if (isField(selection)) {
|
|
187
|
-
if (selection.name.value ===
|
|
189
|
+
if (selection.name.value === "__typename") {
|
|
188
190
|
return result[resultKeyNameFromField(selection)];
|
|
189
191
|
}
|
|
190
192
|
}
|
|
@@ -195,23 +197,23 @@ export function getTypenameFromResult(result, selectionSet, fragmentMap) {
|
|
|
195
197
|
fragments = [selection];
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
|
-
if (typeof result.__typename ===
|
|
200
|
+
if (typeof result.__typename === "string") {
|
|
199
201
|
return result.__typename;
|
|
200
202
|
}
|
|
201
203
|
if (fragments) {
|
|
202
204
|
for (var _b = 0, fragments_1 = fragments; _b < fragments_1.length; _b++) {
|
|
203
205
|
var selection = fragments_1[_b];
|
|
204
206
|
var typename = getTypenameFromResult(result, getFragmentFromSelection(selection, fragmentMap).selectionSet, fragmentMap);
|
|
205
|
-
if (typeof typename ===
|
|
207
|
+
if (typeof typename === "string") {
|
|
206
208
|
return typename;
|
|
207
209
|
}
|
|
208
210
|
}
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
export function isField(selection) {
|
|
212
|
-
return selection.kind ===
|
|
214
|
+
return selection.kind === "Field";
|
|
213
215
|
}
|
|
214
216
|
export function isInlineFragment(selection) {
|
|
215
|
-
return selection.kind ===
|
|
217
|
+
return selection.kind === "InlineFragment";
|
|
216
218
|
}
|
|
217
219
|
//# sourceMappingURL=storeUtils.js.map
|