@apollo/client 3.5.0-beta.13 → 3.5.0-beta.17
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 +216 -160
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -0
- package/cache/cache.cjs +132 -101
- package/cache/cache.cjs.map +1 -1
- package/cache/core/cache.d.ts +4 -4
- package/cache/core/cache.d.ts.map +1 -1
- package/cache/core/cache.js +24 -13
- package/cache/core/cache.js.map +1 -1
- package/cache/core/types/Cache.d.ts +10 -10
- package/cache/core/types/Cache.d.ts.map +1 -1
- package/cache/core/types/Cache.js.map +1 -1
- package/cache/core/types/DataProxy.js.map +1 -1
- package/cache/core/types/common.d.ts +8 -5
- package/cache/core/types/common.d.ts.map +1 -1
- package/cache/core/types/common.js +6 -11
- package/cache/core/types/common.js.map +1 -1
- package/cache/index.d.ts +3 -3
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +2 -2
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.d.ts +1 -1
- package/cache/inmemory/entityStore.d.ts.map +1 -1
- package/cache/inmemory/entityStore.js +3 -3
- package/cache/inmemory/entityStore.js.map +1 -1
- package/cache/inmemory/helpers.d.ts +10 -1
- package/cache/inmemory/helpers.d.ts.map +1 -1
- package/cache/inmemory/helpers.js +31 -1
- package/cache/inmemory/helpers.js.map +1 -1
- package/cache/inmemory/inMemoryCache.d.ts +6 -12
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +13 -17
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/policies.d.ts +1 -2
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +1 -18
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts +3 -2
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +60 -45
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/types.d.ts +8 -1
- package/cache/inmemory/types.d.ts.map +1 -1
- package/cache/inmemory/types.js.map +1 -1
- package/cache/inmemory/writeToStore.js +1 -1
- package/core/ApolloClient.js +2 -2
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.js +1 -1
- package/core/ObservableQuery.d.ts +2 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +3 -3
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +2 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -9
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +19 -18
- package/core/core.cjs.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/invariantErrorCodes.js +48 -61
- package/link/core/ApolloLink.js +1 -1
- package/link/core/core.cjs +1 -1
- package/link/core/core.cjs.map +1 -1
- package/link/http/checkFetcher.js +1 -1
- package/link/http/http.cjs +2 -2
- package/link/http/http.cjs.map +1 -1
- package/link/http/serializeFetchParameter.js +1 -1
- package/link/persisted-queries/index.js +2 -2
- package/link/persisted-queries/persisted-queries.cjs +2 -2
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/utils/utils.cjs +1 -1
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/validateOperation.js +1 -1
- package/package.json +9 -9
- package/react/context/ApolloConsumer.js +1 -1
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js +11 -5
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.js +1 -1
- package/react/context/context.cjs +12 -6
- package/react/context/context.cjs.map +1 -1
- package/react/hoc/hoc-utils.js +1 -1
- package/react/hoc/hoc.cjs +10 -7
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/subscription-hoc.d.ts.map +1 -1
- package/react/hoc/subscription-hoc.js +8 -5
- package/react/hoc/subscription-hoc.js.map +1 -1
- package/react/hoc/withApollo.js +1 -1
- package/react/hooks/hooks.cjs +1 -1
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/useApolloClient.js +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +2 -0
- package/utilities/common/canUse.js.map +1 -1
- package/utilities/common/maybeDeepFreeze.d.ts.map +1 -1
- package/utilities/common/maybeDeepFreeze.js +14 -3
- package/utilities/common/maybeDeepFreeze.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +6 -1
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/index.js +1 -1
- package/utilities/graphql/directives.js +4 -4
- package/utilities/graphql/fragments.js +3 -3
- package/utilities/graphql/getFromAST.js +8 -8
- package/utilities/graphql/storeUtils.js +1 -1
- package/utilities/observables/subclassing.d.ts.map +1 -1
- package/utilities/observables/subclassing.js +2 -1
- package/utilities/observables/subclassing.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 +7 -2
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +51 -27
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: any;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to true.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n lastFetchPolicy: WatchQueryFetchPolicy,\n ) => WatchQueryFetchPolicy);\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: any;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has succesfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the intitial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"watchQueryOptions.js","sourceRoot":"","sources":["../../src/core/watchQueryOptions.ts"],"names":[],"mappings":"","sourcesContent":["import { DocumentNode } from 'graphql';\nimport { TypedDocumentNode } from '@graphql-typed-document-node/core';\n\nimport { FetchResult } from '../link/core';\nimport {\n DefaultContext,\n MutationQueryReducersMap,\n OperationVariables,\n MutationUpdaterFunction,\n OnQueryUpdated,\n InternalRefetchQueriesInclude,\n} from './types';\nimport { ApolloCache } from '../cache';\n\n/**\n * fetchPolicy determines where the client may return a result from. The options are:\n * - cache-first (default): return result from cache. Only fetch from network if cached result is not available.\n * - cache-and-network: return result from cache first (if it exists), then return network result once it's available.\n * - cache-only: return result from cache if available, fail otherwise.\n * - no-cache: return result from network, fail if network call doesn't succeed, don't save to cache\n * - network-only: return result from network, fail if network call doesn't succeed, save to cache\n * - standby: only for queries that aren't actively watched, but should be available for refetch and updateQueries.\n */\nexport type FetchPolicy =\n | 'cache-first'\n | 'network-only'\n | 'cache-only'\n | 'no-cache'\n | 'standby';\n\nexport type WatchQueryFetchPolicy = FetchPolicy | 'cache-and-network';\n\nexport type MutationFetchPolicy = Extract<\n FetchPolicy,\n | 'network-only' // default behavior (mutation results written to cache)\n | 'no-cache' // alternate behavior (results not written to cache)\n>;\n\nexport type RefetchWritePolicy = \"merge\" | \"overwrite\";\n\n/**\n * errorPolicy determines the level of events for errors in the execution result. The options are:\n * - none (default): any errors from the request are treated like runtime errors and the observable is stopped (XXX this is default to lower breaking changes going from AC 1.0 => 2.0)\n * - ignore: errors from the request do not stop the observable, but also don't call `next`\n * - all: errors are treated like data and will notify observables\n */\nexport type ErrorPolicy = 'none' | 'ignore' | 'all';\n\n/**\n * Query options.\n */\nexport interface QueryOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document that consists of a single query to be sent down to the\n * server.\n */\n // TODO REFACTOR: rename this to document. Didn't do it yet because it's in a\n // lot of tests.\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * A map going from variable name to variable value, where the variables are used\n * within the GraphQL query.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this query\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context to be passed to link execution chain\n */\n context?: any;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this query\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * The time interval (in milliseconds) on which this query should be\n * refetched from the server.\n */\n pollInterval?: number;\n\n /**\n * Whether or not updates to the network status should trigger next on the observer of this query\n */\n notifyOnNetworkStatusChange?: boolean;\n\n /**\n * Allow returning incomplete data from the cache when a larger query cannot\n * be fully satisfied by the cache, instead of returning nothing.\n */\n returnPartialData?: boolean;\n\n /**\n * If `true`, perform a query `refetch` if the query result is marked as\n * being partial, and the returned data is reset to an empty Object by the\n * Apollo Client `QueryManager` (due to a cache miss).\n */\n partialRefetch?: boolean;\n\n /**\n * Whether to canonize cache results before returning them. Canonization\n * takes some extra time, but it speeds up future deep equality comparisons.\n * Defaults to false.\n */\n canonizeResults?: boolean;\n}\n\n/**\n * Watched query options.\n */\nexport interface WatchQueryOptions<TVariables = OperationVariables, TData = any>\n extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {\n /**\n * Specifies the {@link FetchPolicy} to be used for this query.\n */\n fetchPolicy?: WatchQueryFetchPolicy;\n /**\n * Specifies the {@link FetchPolicy} to be used after this query has completed.\n */\n nextFetchPolicy?: WatchQueryFetchPolicy | ((\n this: WatchQueryOptions<TVariables, TData>,\n lastFetchPolicy: WatchQueryFetchPolicy,\n ) => WatchQueryFetchPolicy);\n /**\n * Specifies whether a {@link NetworkStatus.refetch} operation should merge\n * incoming field data with existing data, or overwrite the existing data.\n * Overwriting is probably preferable, but merging is currently the default\n * behavior, for backwards compatibility with Apollo Client 3.x.\n */\n refetchWritePolicy?: RefetchWritePolicy;\n}\n\nexport interface FetchMoreQueryOptions<TVariables, TData = any> {\n query?: DocumentNode | TypedDocumentNode<TData, TVariables>;\n variables?: Partial<TVariables>;\n context?: any;\n}\n\nexport type UpdateQueryFn<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = (\n previousQueryResult: TData,\n options: {\n subscriptionData: { data: TSubscriptionData };\n variables?: TSubscriptionVariables;\n },\n) => TData;\n\nexport type SubscribeToMoreOptions<\n TData = any,\n TSubscriptionVariables = OperationVariables,\n TSubscriptionData = TData\n> = {\n document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;\n variables?: TSubscriptionVariables;\n updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;\n onError?: (error: Error) => void;\n context?: DefaultContext;\n};\n\nexport interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single subscription inside of it.\n */\n query: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * An object that maps from the name of a variable as used in the subscription\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * Specifies the {@link FetchPolicy} to be used for this subscription.\n */\n fetchPolicy?: FetchPolicy;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * Context object to be passed through the link execution chain.\n */\n context?: DefaultContext;\n}\n\nexport interface MutationBaseOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> {\n /**\n * An object that represents the result of this mutation that will be\n * optimistically stored before the server has actually returned a result.\n * This is most often used for optimistic UI, where we want to be able to see\n * the result of a mutation immediately, and update the UI later if any errors\n * appear.\n */\n optimisticResponse?: TData | ((vars: TVariables) => TData);\n\n /**\n * A {@link MutationQueryReducersMap}, which is map from query names to\n * mutation query reducers. Briefly, this map defines how to incorporate the\n * results of the mutation into the results of queries that are currently\n * being watched by your application.\n */\n updateQueries?: MutationQueryReducersMap<TData>;\n\n /**\n * A list of query names which will be refetched once this mutation has\n * returned. This is often used if you have a set of queries which may be\n * affected by a mutation and will have to update. Rather than writing a\n * mutation query reducer (i.e. `updateQueries`) for this, you can simply\n * refetch the queries that will be affected and achieve a consistent store\n * once these queries return.\n */\n refetchQueries?:\n | ((result: FetchResult<TData>) => InternalRefetchQueriesInclude)\n | InternalRefetchQueriesInclude;\n\n /**\n * By default, `refetchQueries` does not wait for the refetched queries to\n * be completed, before resolving the mutation `Promise`. This ensures that\n * query refetching does not hold up mutation response handling (query\n * refetching is handled asynchronously). Set `awaitRefetchQueries` to\n * `true` if you would like to wait for the refetched queries to complete,\n * before the mutation can be marked as resolved.\n */\n awaitRefetchQueries?: boolean;\n\n /**\n * A function which provides an {@link ApolloCache} instance, and the result\n * of the mutation, to allow the user to update the store based on the\n * results of the mutation.\n *\n * This function will be called twice over the lifecycle of a mutation. Once\n * at the very beginning if an `optimisticResponse` was provided. The writes\n * created from the optimistic data will be rolled back before the second time\n * this function is called which is when the mutation has successfully\n * resolved. At that point `update` will be called with the *actual* mutation\n * result and those writes will not be rolled back.\n *\n * Note that since this function is intended to be used to update the\n * store, it cannot be used with a `no-cache` fetch policy. If you're\n * interested in performing some action after a mutation has completed,\n * and you don't need to update the store, use the Promise returned from\n * `client.mutate` instead.\n */\n update?: MutationUpdaterFunction<TData, TVariables, TContext, TCache>;\n\n /**\n * A function that will be called for each ObservableQuery affected by\n * this mutation, after the mutation has completed.\n */\n onQueryUpdated?: OnQueryUpdated<any>;\n\n /**\n * Specifies the {@link ErrorPolicy} to be used for this operation\n */\n errorPolicy?: ErrorPolicy;\n\n /**\n * An object that maps from the name of a variable as used in the mutation\n * GraphQL document to that variable's value.\n */\n variables?: TVariables;\n\n /**\n * The context to be passed to the link execution chain. This context will\n * only be used with this mutation. It will not be used with\n * `refetchQueries`. Refetched queries use the context they were\n * initialized with (since the initial context is stored as part of the\n * `ObservableQuery` instance). If a specific context is needed when\n * refetching queries, make sure it is configured (via the\n * [query `context` option](https://www.apollographql.com/docs/react/api/apollo-client#ApolloClient.query))\n * when the query is first initialized/run.\n */\n context?: TContext;\n}\n\nexport interface MutationOptions<\n TData = any,\n TVariables = OperationVariables,\n TContext = DefaultContext,\n TCache extends ApolloCache<any> = ApolloCache<any>,\n> extends MutationBaseOptions<TData, TVariables, TContext, TCache> {\n /**\n * A GraphQL document, often created with `gql` from the `graphql-tag`\n * package, that contains a single mutation inside of it.\n */\n mutation: DocumentNode | TypedDocumentNode<TData, TVariables>;\n\n /**\n * Specifies the {@link MutationFetchPolicy} to be used for this query.\n * Mutations support only 'network-only' and 'no-cache' fetchPolicy strings.\n * If fetchPolicy is not provided, it defaults to 'network-only'.\n */\n fetchPolicy?: MutationFetchPolicy;\n\n /**\n * To avoid retaining sensitive information from mutation root field\n * arguments, Apollo Client v3.4+ automatically clears any `ROOT_MUTATION`\n * fields from the cache after each mutation finishes. If you need this\n * information to remain in the cache, you can prevent the removal by passing\n * `keepRootFields: true` to the mutation. `ROOT_MUTATION` result data are\n * also passed to the mutation `update` function, so we recommend obtaining\n * the results that way, rather than using this option, if possible.\n */\n keepRootFields?: boolean;\n}\n"]}
|
package/invariantErrorCodes.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// consult the @apollo/client/invariantErrorCodes.js file specific to
|
|
6
6
|
// your @apollo/client version. This file is not meant to be imported.
|
|
7
7
|
{
|
|
8
|
-
"@apollo/client version": "3.5.0-beta.
|
|
8
|
+
"@apollo/client version": "3.5.0-beta.17",
|
|
9
9
|
|
|
10
10
|
1: {
|
|
11
11
|
file: "@apollo/client/cache/inmemory/entityStore.js",
|
|
@@ -28,29 +28,16 @@
|
|
|
28
28
|
},
|
|
29
29
|
|
|
30
30
|
5: {
|
|
31
|
-
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
32
|
-
node: new InvariantError("Dangling reference to missing " + objectOrReference.__ref + " object")
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
6: {
|
|
36
|
-
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
37
|
-
|
|
38
|
-
node: new InvariantError("Can't find field '" + selection.name.value + "' on " + (isReference(objectOrReference)
|
|
39
|
-
? objectOrReference.__ref + " object"
|
|
40
|
-
: "object " + JSON.stringify(objectOrReference, null, 2)))
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
7: {
|
|
44
31
|
file: "@apollo/client/cache/inmemory/readFromStore.js",
|
|
45
32
|
node: invariant(!isReference(value), "Missing selection set for object of type " + getTypenameFromStoreObject(store, value) + " returned for query field " + field.name.value)
|
|
46
33
|
},
|
|
47
34
|
|
|
48
|
-
|
|
35
|
+
6: {
|
|
49
36
|
file: "@apollo/client/cache/inmemory/writeToStore.js",
|
|
50
37
|
node: new InvariantError("Could not identify object " + JSON.stringify(result))
|
|
51
38
|
},
|
|
52
39
|
|
|
53
|
-
|
|
40
|
+
7: {
|
|
54
41
|
file: "@apollo/client/core/ApolloClient.js",
|
|
55
42
|
|
|
56
43
|
node: new InvariantError("To initialize Apollo Client, you must specify a 'cache' property " +
|
|
@@ -58,7 +45,7 @@
|
|
|
58
45
|
"For more information, please visit: https://go.apollo.dev/c/docs")
|
|
59
46
|
},
|
|
60
47
|
|
|
61
|
-
|
|
48
|
+
8: {
|
|
62
49
|
file: "@apollo/client/core/ApolloClient.js",
|
|
63
50
|
|
|
64
51
|
node: invariant(options.fetchPolicy !== 'cache-and-network', 'The cache-and-network fetchPolicy does not work with client.query, because ' +
|
|
@@ -67,76 +54,76 @@
|
|
|
67
54
|
'using a different fetchPolicy, such as cache-first or network-only.')
|
|
68
55
|
},
|
|
69
56
|
|
|
70
|
-
|
|
57
|
+
9: {
|
|
71
58
|
file: "@apollo/client/core/LocalState.js",
|
|
72
59
|
node: invariant(fragment, "No fragment named " + selection.name.value)
|
|
73
60
|
},
|
|
74
61
|
|
|
75
|
-
|
|
62
|
+
10: {
|
|
76
63
|
file: "@apollo/client/core/ObservableQuery.js",
|
|
77
64
|
node: invariant(pollInterval, 'Attempted to start a polling query without a polling interval.')
|
|
78
65
|
},
|
|
79
66
|
|
|
80
|
-
|
|
67
|
+
11: {
|
|
81
68
|
file: "@apollo/client/core/QueryManager.js",
|
|
82
69
|
node: new InvariantError('QueryManager stopped while query was in flight')
|
|
83
70
|
},
|
|
84
71
|
|
|
85
|
-
|
|
72
|
+
12: {
|
|
86
73
|
file: "@apollo/client/core/QueryManager.js",
|
|
87
74
|
node: invariant(mutation, 'mutation option is required. You must specify your GraphQL document in the mutation option.')
|
|
88
75
|
},
|
|
89
76
|
|
|
90
|
-
|
|
77
|
+
13: {
|
|
91
78
|
file: "@apollo/client/core/QueryManager.js",
|
|
92
79
|
|
|
93
80
|
node: invariant(fetchPolicy === 'network-only' ||
|
|
94
81
|
fetchPolicy === 'no-cache', "Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write.")
|
|
95
82
|
},
|
|
96
83
|
|
|
97
|
-
|
|
84
|
+
14: {
|
|
98
85
|
file: "@apollo/client/core/QueryManager.js",
|
|
99
86
|
|
|
100
87
|
node: invariant(options.query, 'query option is required. You must specify your GraphQL document ' +
|
|
101
88
|
'in the query option.')
|
|
102
89
|
},
|
|
103
90
|
|
|
104
|
-
|
|
91
|
+
15: {
|
|
105
92
|
file: "@apollo/client/core/QueryManager.js",
|
|
106
93
|
node: invariant(options.query.kind === 'Document', 'You must wrap the query string in a "gql" tag.')
|
|
107
94
|
},
|
|
108
95
|
|
|
109
|
-
|
|
96
|
+
16: {
|
|
110
97
|
file: "@apollo/client/core/QueryManager.js",
|
|
111
98
|
node: invariant(!options.returnPartialData, 'returnPartialData option only supported on watchQuery.')
|
|
112
99
|
},
|
|
113
100
|
|
|
114
|
-
|
|
101
|
+
17: {
|
|
115
102
|
file: "@apollo/client/core/QueryManager.js",
|
|
116
103
|
node: invariant(!options.pollInterval, 'pollInterval option only supported on watchQuery.')
|
|
117
104
|
},
|
|
118
105
|
|
|
119
|
-
|
|
106
|
+
18: {
|
|
120
107
|
file: "@apollo/client/core/QueryManager.js",
|
|
121
108
|
node: new InvariantError('Store reset while query was in flight (not completed in link chain)')
|
|
122
109
|
},
|
|
123
110
|
|
|
124
|
-
|
|
111
|
+
19: {
|
|
125
112
|
file: "@apollo/client/link/core/ApolloLink.js",
|
|
126
113
|
node: new InvariantError('request is not implemented')
|
|
127
114
|
},
|
|
128
115
|
|
|
129
|
-
|
|
116
|
+
20: {
|
|
130
117
|
file: "@apollo/client/link/http/checkFetcher.js",
|
|
131
118
|
node: new InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ")
|
|
132
119
|
},
|
|
133
120
|
|
|
134
|
-
|
|
121
|
+
21: {
|
|
135
122
|
file: "@apollo/client/link/http/serializeFetchParameter.js",
|
|
136
123
|
node: new InvariantError("Network request failed. " + label + " is not serializable: " + e.message)
|
|
137
124
|
},
|
|
138
125
|
|
|
139
|
-
|
|
126
|
+
22: {
|
|
140
127
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
141
128
|
|
|
142
129
|
node: invariant(options && (typeof options.sha256 === 'function' ||
|
|
@@ -145,45 +132,45 @@
|
|
|
145
132
|
'parameter.')
|
|
146
133
|
},
|
|
147
134
|
|
|
148
|
-
|
|
135
|
+
23: {
|
|
149
136
|
file: "@apollo/client/link/persisted-queries/index.js",
|
|
150
137
|
node: invariant(forward, 'PersistedQueryLink cannot be the last link in the chain.')
|
|
151
138
|
},
|
|
152
139
|
|
|
153
|
-
|
|
140
|
+
24: {
|
|
154
141
|
file: "@apollo/client/link/utils/validateOperation.js",
|
|
155
142
|
node: new InvariantError("illegal argument: " + key)
|
|
156
143
|
},
|
|
157
144
|
|
|
158
|
-
|
|
145
|
+
25: {
|
|
159
146
|
file: "@apollo/client/react/context/ApolloConsumer.js",
|
|
160
147
|
|
|
161
148
|
node: invariant(context && context.client, 'Could not find "client" in the context of ApolloConsumer. ' +
|
|
162
149
|
'Wrap the root component in an <ApolloProvider>.')
|
|
163
150
|
},
|
|
164
151
|
|
|
165
|
-
|
|
152
|
+
26: {
|
|
166
153
|
file: "@apollo/client/react/context/ApolloProvider.js",
|
|
167
154
|
|
|
168
155
|
node: invariant(context.client, 'ApolloProvider was not passed a client instance. Make ' +
|
|
169
156
|
'sure you pass in your client via the "client" prop.')
|
|
170
157
|
},
|
|
171
158
|
|
|
172
|
-
|
|
159
|
+
27: {
|
|
173
160
|
file: "@apollo/client/react/hoc/hoc-utils.js",
|
|
174
161
|
|
|
175
162
|
node: invariant(this.withRef, "To access the wrapped instance, you need to specify " +
|
|
176
163
|
"{ withRef: true } in the options")
|
|
177
164
|
},
|
|
178
165
|
|
|
179
|
-
|
|
166
|
+
28: {
|
|
180
167
|
file: "@apollo/client/react/hoc/withApollo.js",
|
|
181
168
|
|
|
182
169
|
node: invariant(operationOptions.withRef, "To access the wrapped instance, you need to specify " +
|
|
183
170
|
"{ withRef: true } in the options")
|
|
184
171
|
},
|
|
185
172
|
|
|
186
|
-
|
|
173
|
+
29: {
|
|
187
174
|
file: "@apollo/client/react/hooks/useApolloClient.js",
|
|
188
175
|
|
|
189
176
|
node: invariant(!!client, 'Could not find "client" in the context or passed in as an option. ' +
|
|
@@ -191,7 +178,7 @@
|
|
|
191
178
|
'ApolloClient instance in via options.')
|
|
192
179
|
},
|
|
193
180
|
|
|
194
|
-
|
|
181
|
+
30: {
|
|
195
182
|
file: "@apollo/client/react/parser/index.js",
|
|
196
183
|
|
|
197
184
|
node: invariant(!!document && !!document.kind, "Argument of " + document + " passed to parser was not a valid GraphQL " +
|
|
@@ -199,7 +186,7 @@
|
|
|
199
186
|
"to convert your operation into a document")
|
|
200
187
|
},
|
|
201
188
|
|
|
202
|
-
|
|
189
|
+
31: {
|
|
203
190
|
file: "@apollo/client/react/parser/index.js",
|
|
204
191
|
|
|
205
192
|
node: invariant(!fragments.length ||
|
|
@@ -207,7 +194,7 @@
|
|
|
207
194
|
"You must include a query, subscription or mutation as well")
|
|
208
195
|
},
|
|
209
196
|
|
|
210
|
-
|
|
197
|
+
32: {
|
|
211
198
|
file: "@apollo/client/react/parser/index.js",
|
|
212
199
|
|
|
213
200
|
node: invariant(queries.length + mutations.length + subscriptions.length <= 1, "react-apollo only supports a query, subscription, or a mutation per HOC. " +
|
|
@@ -216,7 +203,7 @@
|
|
|
216
203
|
"You can use 'compose' to join multiple operation types to a component")
|
|
217
204
|
},
|
|
218
205
|
|
|
219
|
-
|
|
206
|
+
33: {
|
|
220
207
|
file: "@apollo/client/react/parser/index.js",
|
|
221
208
|
|
|
222
209
|
node: invariant(definitions.length === 1, "react-apollo only supports one definition per HOC. " + document + " had " +
|
|
@@ -224,103 +211,103 @@
|
|
|
224
211
|
"You can use 'compose' to join multiple operation types to a component")
|
|
225
212
|
},
|
|
226
213
|
|
|
227
|
-
|
|
214
|
+
34: {
|
|
228
215
|
file: "@apollo/client/react/parser/index.js",
|
|
229
216
|
|
|
230
217
|
node: invariant(operation.type === type, "Running a " + requiredOperationName + " requires a graphql " +
|
|
231
218
|
(requiredOperationName + ", but a " + usedOperationName + " was used instead."))
|
|
232
219
|
},
|
|
233
220
|
|
|
234
|
-
|
|
221
|
+
35: {
|
|
235
222
|
file: "@apollo/client/testing/core/mocking/mockLink.js",
|
|
236
223
|
node: invariant(queryWithoutConnection, "query is required")
|
|
237
224
|
},
|
|
238
225
|
|
|
239
|
-
|
|
226
|
+
36: {
|
|
240
227
|
file: "@apollo/client/utilities/globals/index.js",
|
|
241
228
|
node: invariant("boolean" === typeof DEV, DEV)
|
|
242
229
|
},
|
|
243
230
|
|
|
244
|
-
|
|
231
|
+
37: {
|
|
245
232
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
246
233
|
node: invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.")
|
|
247
234
|
},
|
|
248
235
|
|
|
249
|
-
|
|
236
|
+
38: {
|
|
250
237
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
251
238
|
node: invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.")
|
|
252
239
|
},
|
|
253
240
|
|
|
254
|
-
|
|
241
|
+
39: {
|
|
255
242
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
256
243
|
node: invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.")
|
|
257
244
|
},
|
|
258
245
|
|
|
259
|
-
|
|
246
|
+
40: {
|
|
260
247
|
file: "@apollo/client/utilities/graphql/directives.js",
|
|
261
248
|
|
|
262
249
|
node: invariant(ifValue &&
|
|
263
250
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.")
|
|
264
251
|
},
|
|
265
252
|
|
|
266
|
-
|
|
253
|
+
41: {
|
|
267
254
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
268
255
|
|
|
269
256
|
node: new InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
270
257
|
'No operations are allowed when using a fragment as a query. Only fragments are allowed.')
|
|
271
258
|
},
|
|
272
259
|
|
|
273
|
-
|
|
260
|
+
42: {
|
|
274
261
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
275
262
|
node: invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")
|
|
276
263
|
},
|
|
277
264
|
|
|
278
|
-
|
|
265
|
+
43: {
|
|
279
266
|
file: "@apollo/client/utilities/graphql/fragments.js",
|
|
280
267
|
node: invariant(fragment, "No fragment named " + selection.name.value + ".")
|
|
281
268
|
},
|
|
282
269
|
|
|
283
|
-
|
|
270
|
+
44: {
|
|
284
271
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
285
272
|
node: 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")
|
|
286
273
|
},
|
|
287
274
|
|
|
288
|
-
|
|
275
|
+
45: {
|
|
289
276
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
290
277
|
node: new InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"")
|
|
291
278
|
},
|
|
292
279
|
|
|
293
|
-
|
|
280
|
+
46: {
|
|
294
281
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
295
282
|
node: invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations")
|
|
296
283
|
},
|
|
297
284
|
|
|
298
|
-
|
|
285
|
+
47: {
|
|
299
286
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
300
287
|
node: invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.')
|
|
301
288
|
},
|
|
302
289
|
|
|
303
|
-
|
|
290
|
+
48: {
|
|
304
291
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
305
292
|
node: 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")
|
|
306
293
|
},
|
|
307
294
|
|
|
308
|
-
|
|
295
|
+
49: {
|
|
309
296
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
310
297
|
node: invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.')
|
|
311
298
|
},
|
|
312
299
|
|
|
313
|
-
|
|
300
|
+
50: {
|
|
314
301
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
315
302
|
node: invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.')
|
|
316
303
|
},
|
|
317
304
|
|
|
318
|
-
|
|
305
|
+
51: {
|
|
319
306
|
file: "@apollo/client/utilities/graphql/getFromAST.js",
|
|
320
307
|
node: new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.')
|
|
321
308
|
},
|
|
322
309
|
|
|
323
|
-
|
|
310
|
+
52: {
|
|
324
311
|
file: "@apollo/client/utilities/graphql/storeUtils.js",
|
|
325
312
|
|
|
326
313
|
node: new InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
package/link/core/ApolloLink.js
CHANGED
|
@@ -81,7 +81,7 @@ var ApolloLink = (function () {
|
|
|
81
81
|
return ApolloLink.concat(this, next);
|
|
82
82
|
};
|
|
83
83
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
84
|
-
throw __DEV__ ? new InvariantError('request is not implemented') : new InvariantError(
|
|
84
|
+
throw __DEV__ ? new InvariantError('request is not implemented') : new InvariantError(19);
|
|
85
85
|
};
|
|
86
86
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
87
87
|
if (observer && observer.error) {
|
package/link/core/core.cjs
CHANGED
|
@@ -86,7 +86,7 @@ var ApolloLink = (function () {
|
|
|
86
86
|
return ApolloLink.concat(this, next);
|
|
87
87
|
};
|
|
88
88
|
ApolloLink.prototype.request = function (operation, forward) {
|
|
89
|
-
throw __DEV__ ? new globals.InvariantError('request is not implemented') : new globals.InvariantError(
|
|
89
|
+
throw __DEV__ ? new globals.InvariantError('request is not implemented') : new globals.InvariantError(19);
|
|
90
90
|
};
|
|
91
91
|
ApolloLink.prototype.onError = function (error, observer) {
|
|
92
92
|
if (observer && observer.error) {
|
package/link/core/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { InvariantError, invariant } from '../../utilities/globals';\nimport { Observable } from '../../utilities';\nimport { validateOperation, createOperation, transformOperation, } from '../utils';\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar LinkError = (function (_super) {\n __extends(LinkError, _super);\n function LinkError(message, link) {\n var _this = _super.call(this, message) || this;\n _this.link = link;\n return _this;\n }\n return LinkError;\n}(Error));\nvar ApolloLink = (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(function (operation) {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n __DEV__ && invariant.warn(new LinkError(\"You are calling concat on a terminating link, which will have no effect\", firstLink));\n return firstLink;\n }\n var nextLink = toLink(second);\n if (isTerminating(nextLink)) {\n return new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw __DEV__ ? new InvariantError('request is not implemented') : new InvariantError(
|
|
1
|
+
{"version":3,"file":"core.cjs","sources":["ApolloLink.js","empty.js","from.js","split.js","concat.js","execute.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { InvariantError, invariant } from '../../utilities/globals';\nimport { Observable } from '../../utilities';\nimport { validateOperation, createOperation, transformOperation, } from '../utils';\nfunction passthrough(op, forward) {\n return (forward ? forward(op) : Observable.of());\n}\nfunction toLink(handler) {\n return typeof handler === 'function' ? new ApolloLink(handler) : handler;\n}\nfunction isTerminating(link) {\n return link.request.length <= 1;\n}\nvar LinkError = (function (_super) {\n __extends(LinkError, _super);\n function LinkError(message, link) {\n var _this = _super.call(this, message) || this;\n _this.link = link;\n return _this;\n }\n return LinkError;\n}(Error));\nvar ApolloLink = (function () {\n function ApolloLink(request) {\n if (request)\n this.request = request;\n }\n ApolloLink.empty = function () {\n return new ApolloLink(function () { return Observable.of(); });\n };\n ApolloLink.from = function (links) {\n if (links.length === 0)\n return ApolloLink.empty();\n return links.map(toLink).reduce(function (x, y) { return x.concat(y); });\n };\n ApolloLink.split = function (test, left, right) {\n var leftLink = toLink(left);\n var rightLink = toLink(right || new ApolloLink(passthrough));\n if (isTerminating(leftLink) && isTerminating(rightLink)) {\n return new ApolloLink(function (operation) {\n return test(operation)\n ? leftLink.request(operation) || Observable.of()\n : rightLink.request(operation) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return test(operation)\n ? leftLink.request(operation, forward) || Observable.of()\n : rightLink.request(operation, forward) || Observable.of();\n });\n }\n };\n ApolloLink.execute = function (link, operation) {\n return (link.request(createOperation(operation.context, transformOperation(validateOperation(operation)))) || Observable.of());\n };\n ApolloLink.concat = function (first, second) {\n var firstLink = toLink(first);\n if (isTerminating(firstLink)) {\n __DEV__ && invariant.warn(new LinkError(\"You are calling concat on a terminating link, which will have no effect\", firstLink));\n return firstLink;\n }\n var nextLink = toLink(second);\n if (isTerminating(nextLink)) {\n return new ApolloLink(function (operation) {\n return firstLink.request(operation, function (op) { return nextLink.request(op) || Observable.of(); }) || Observable.of();\n });\n }\n else {\n return new ApolloLink(function (operation, forward) {\n return (firstLink.request(operation, function (op) {\n return nextLink.request(op, forward) || Observable.of();\n }) || Observable.of());\n });\n }\n };\n ApolloLink.prototype.split = function (test, left, right) {\n return this.concat(ApolloLink.split(test, left, right || new ApolloLink(passthrough)));\n };\n ApolloLink.prototype.concat = function (next) {\n return ApolloLink.concat(this, next);\n };\n ApolloLink.prototype.request = function (operation, forward) {\n throw __DEV__ ? new InvariantError('request is not implemented') : new InvariantError(19);\n };\n ApolloLink.prototype.onError = function (error, observer) {\n if (observer && observer.error) {\n observer.error(error);\n return false;\n }\n throw error;\n };\n ApolloLink.prototype.setOnError = function (fn) {\n this.onError = fn;\n return this;\n };\n return ApolloLink;\n}());\nexport { ApolloLink };\n//# sourceMappingURL=ApolloLink.js.map","import { ApolloLink } from './ApolloLink';\nexport var empty = ApolloLink.empty;\n//# sourceMappingURL=empty.js.map","import { ApolloLink } from './ApolloLink';\nexport var from = ApolloLink.from;\n//# sourceMappingURL=from.js.map","import { ApolloLink } from './ApolloLink';\nexport var split = ApolloLink.split;\n//# sourceMappingURL=split.js.map","import { ApolloLink } from './ApolloLink';\nexport var concat = ApolloLink.concat;\n//# sourceMappingURL=concat.js.map","import { ApolloLink } from './ApolloLink';\nexport var execute = ApolloLink.execute;\n//# sourceMappingURL=execute.js.map"],"names":["Observable","__extends","createOperation","transformOperation","validateOperation","invariant","InvariantError"],"mappings":";;;;;;;;;AAIA,SAAS,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE;AAClC,IAAI,QAAQ,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,GAAGA,oBAAU,CAAC,EAAE,EAAE,EAAE;AACrD,CAAC;AACD,SAAS,MAAM,CAAC,OAAO,EAAE;AACzB,IAAI,OAAO,OAAO,OAAO,KAAK,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;AAC7E,CAAC;AACD,SAAS,aAAa,CAAC,IAAI,EAAE;AAC7B,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;AACpC,CAAC;AACD,IAAI,SAAS,IAAI,UAAU,MAAM,EAAE;AACnC,IAAIC,eAAS,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AACjC,IAAI,SAAS,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE;AACtC,QAAQ,IAAI,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC;AACvD,QAAQ,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;AAC1B,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK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,CAAC,EAAE,CAAC,CAAC;AAClG,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,KAAK,EAAE,QAAQ,EAAE;AAC9D,QAAQ,IAAI,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE;AACxC,YAAY,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAClC,YAAY,OAAO,KAAK,CAAC;AACzB,SAAS;AACT,QAAQ,MAAM,KAAK,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,UAAU,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,EAAE,EAAE;AACpD,QAAQ,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;AAC1B,QAAQ,OAAO,IAAI,CAAC;AACpB,KAAK,CAAC;AACN,IAAI,OAAO,UAAU,CAAC;AACtB,CAAC,EAAE;;AChGO,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,IAAI,GAAG,UAAU,CAAC;;ACAnB,IAAC,KAAK,GAAG,UAAU,CAAC;;ACApB,IAAC,MAAM,GAAG,UAAU,CAAC;;ACArB,IAAC,OAAO,GAAG,UAAU,CAAC;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InvariantError } from "../../utilities/globals/index.js";
|
|
2
2
|
export var checkFetcher = function (fetcher) {
|
|
3
3
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
4
|
-
throw __DEV__ ? new InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new InvariantError(
|
|
4
|
+
throw __DEV__ ? new InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new InvariantError(20);
|
|
5
5
|
}
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=checkFetcher.js.map
|
package/link/http/http.cjs
CHANGED
|
@@ -47,7 +47,7 @@ var serializeFetchParameter = function (p, label) {
|
|
|
47
47
|
serialized = JSON.stringify(p);
|
|
48
48
|
}
|
|
49
49
|
catch (e) {
|
|
50
|
-
var parseError = __DEV__ ? new globals.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new globals.InvariantError(
|
|
50
|
+
var parseError = __DEV__ ? new globals.InvariantError("Network request failed. " + label + " is not serializable: " + e.message) : new globals.InvariantError(21);
|
|
51
51
|
parseError.parseError = e;
|
|
52
52
|
throw parseError;
|
|
53
53
|
}
|
|
@@ -108,7 +108,7 @@ function headersToLowerCase(headers) {
|
|
|
108
108
|
|
|
109
109
|
var checkFetcher = function (fetcher) {
|
|
110
110
|
if (!fetcher && typeof fetch === 'undefined') {
|
|
111
|
-
throw __DEV__ ? new globals.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new globals.InvariantError(
|
|
111
|
+
throw __DEV__ ? new globals.InvariantError("\n\"fetch\" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:\n\nimport fetch from 'cross-fetch';\nimport { ApolloClient, HttpLink } from '@apollo/client';\nconst client = new ApolloClient({\n link: new HttpLink({ uri: '/graphql', fetch })\n});\n ") : new globals.InvariantError(20);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
|