@apollo/client 3.5.0-beta.9 → 3.5.0-rc.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/README.md +10 -8
- package/apollo-client.cjs +875 -753
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -0
- package/cache/cache.cjs +715 -607
- package/cache/cache.cjs.map +1 -1
- package/cache/core/cache.d.ts +5 -5
- 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 +13 -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 +4 -3
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +3 -4
- 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 +4 -4
- 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 +7 -13
- package/cache/inmemory/inMemoryCache.d.ts.map +1 -1
- package/cache/inmemory/inMemoryCache.js +20 -19
- package/cache/inmemory/inMemoryCache.js.map +1 -1
- package/cache/inmemory/key-extractor.d.ts +9 -0
- package/cache/inmemory/key-extractor.d.ts.map +1 -0
- package/cache/inmemory/key-extractor.js +118 -0
- package/cache/inmemory/key-extractor.js.map +1 -0
- package/cache/inmemory/object-canon.d.ts +1 -0
- package/cache/inmemory/object-canon.d.ts.map +1 -1
- package/cache/inmemory/object-canon.js +1 -0
- package/cache/inmemory/object-canon.js.map +1 -1
- package/cache/inmemory/policies.d.ts +13 -10
- package/cache/inmemory/policies.d.ts.map +1 -1
- package/cache/inmemory/policies.js +48 -175
- 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.d.ts +8 -3
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +164 -93
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +9 -5
- package/core/ApolloClient.js.map +1 -1
- package/core/LocalState.d.ts.map +1 -1
- package/core/LocalState.js +2 -2
- package/core/LocalState.js.map +1 -1
- package/core/ObservableQuery.d.ts +2 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +15 -9
- 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 +2 -3
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +17 -19
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +60 -53
- package/core/core.cjs.map +1 -1
- package/core/index.d.ts.map +1 -1
- package/core/index.js +1 -2
- package/core/index.js.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/errors/errors.cjs +1 -1
- package/errors/errors.cjs.map +1 -1
- package/errors/index.d.ts +4 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -2
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +56 -69
- package/link/batch-http/batch-http.cjs +2 -2
- package/link/batch-http/batch-http.cjs.map +1 -1
- package/link/batch-http/batchHttpLink.d.ts.map +1 -1
- package/link/batch-http/batchHttpLink.js +3 -3
- package/link/batch-http/batchHttpLink.js.map +1 -1
- package/link/core/ApolloLink.js +2 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs +4 -6
- package/link/core/core.cjs.map +1 -1
- package/link/core/index.d.ts +1 -0
- package/link/core/index.d.ts.map +1 -1
- package/link/core/index.js +1 -2
- package/link/core/index.js.map +1 -1
- package/link/error/error.cjs +1 -1
- package/link/error/error.cjs.map +1 -1
- package/link/error/index.d.ts +5 -6
- package/link/error/index.d.ts.map +1 -1
- package/link/error/index.js +1 -1
- package/link/error/index.js.map +1 -1
- package/link/http/checkFetcher.js +2 -2
- package/link/http/checkFetcher.js.map +1 -1
- package/link/http/createHttpLink.d.ts +1 -0
- package/link/http/createHttpLink.d.ts.map +1 -1
- package/link/http/createHttpLink.js +4 -3
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs +12 -12
- package/link/http/http.cjs.map +1 -1
- package/link/http/index.d.ts +2 -1
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +2 -3
- package/link/http/index.js.map +1 -1
- package/link/http/selectHttpOptionsAndBody.d.ts +7 -1
- package/link/http/selectHttpOptionsAndBody.d.ts.map +1 -1
- package/link/http/selectHttpOptionsAndBody.js +6 -4
- package/link/http/selectHttpOptionsAndBody.js.map +1 -1
- package/link/http/serializeFetchParameter.d.ts +1 -1
- package/link/http/serializeFetchParameter.d.ts.map +1 -1
- package/link/http/serializeFetchParameter.js +2 -2
- package/link/http/serializeFetchParameter.js.map +1 -1
- package/link/persisted-queries/index.d.ts +1 -1
- package/link/persisted-queries/index.d.ts.map +1 -1
- package/link/persisted-queries/index.js +4 -6
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs +9 -7
- package/link/persisted-queries/persisted-queries.cjs.map +1 -1
- package/link/utils/index.d.ts +1 -0
- package/link/utils/index.d.ts.map +1 -1
- package/link/utils/index.js +1 -2
- package/link/utils/index.js.map +1 -1
- package/link/utils/toPromise.d.ts.map +1 -1
- package/link/utils/toPromise.js +1 -1
- package/link/utils/toPromise.js.map +1 -1
- package/link/utils/utils.cjs +3 -5
- package/link/utils/utils.cjs.map +1 -1
- package/link/utils/validateOperation.d.ts.map +1 -1
- package/link/utils/validateOperation.js +2 -2
- package/link/utils/validateOperation.js.map +1 -1
- package/package.json +17 -18
- package/react/context/ApolloConsumer.d.ts.map +1 -1
- package/react/context/ApolloConsumer.js +2 -2
- package/react/context/ApolloConsumer.js.map +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.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +2 -2
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +16 -12
- package/react/context/context.cjs.map +1 -1
- package/react/context/index.d.ts +1 -0
- package/react/context/index.d.ts.map +1 -1
- package/react/context/index.js +1 -2
- package/react/context/index.js.map +1 -1
- package/react/hoc/hoc-utils.d.ts.map +1 -1
- package/react/hoc/hoc-utils.js +2 -2
- package/react/hoc/hoc-utils.js.map +1 -1
- package/react/hoc/hoc.cjs +13 -13
- package/react/hoc/hoc.cjs.map +1 -1
- package/react/hoc/index.d.ts +1 -0
- package/react/hoc/index.d.ts.map +1 -1
- package/react/hoc/index.js +1 -2
- package/react/hoc/index.js.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.d.ts.map +1 -1
- package/react/hoc/withApollo.js +2 -2
- package/react/hoc/withApollo.js.map +1 -1
- package/react/hooks/hooks.cjs +25 -10
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/index.d.ts +1 -0
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/index.js +1 -2
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.js.map +1 -1
- package/react/hooks/useLazyQuery.d.ts.map +1 -1
- package/react/hooks/useLazyQuery.js +19 -4
- package/react/hooks/useLazyQuery.js.map +1 -1
- package/react/hooks/useMutation.d.ts.map +1 -1
- package/react/hooks/useMutation.js +4 -1
- package/react/hooks/useMutation.js.map +1 -1
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +1 -1
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSubscription.d.ts +1 -0
- package/react/hooks/useSubscription.d.ts.map +1 -1
- package/react/hooks/useSubscription.js +1 -0
- package/react/hooks/useSubscription.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -2
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +6 -8
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs +12 -14
- package/react/parser/parser.cjs.map +1 -1
- package/react/react.cjs +2 -2
- package/react/react.cjs.map +1 -1
- package/react/types/types.d.ts +2 -1
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +288 -0
- package/testing/core/core.cjs.map +1 -0
- package/{utilities/testing → testing/core}/index.d.ts +0 -1
- package/testing/core/index.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/index.js +0 -1
- package/testing/core/index.js.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.d.ts +0 -0
- package/testing/core/itAsync.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/itAsync.js +0 -0
- package/testing/core/itAsync.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.d.ts +0 -0
- package/testing/core/mocking/mockClient.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockClient.js +0 -0
- package/testing/core/mocking/mockClient.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.d.ts +0 -0
- package/testing/core/mocking/mockFetch.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockFetch.js +1 -1
- package/testing/core/mocking/mockFetch.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.d.ts +0 -0
- package/testing/core/mocking/mockLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockLink.js +3 -3
- package/testing/core/mocking/mockLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.d.ts +1 -1
- package/testing/core/mocking/mockQueryManager.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockQueryManager.js +1 -1
- package/testing/core/mocking/mockQueryManager.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.d.ts +0 -0
- package/testing/core/mocking/mockSubscriptionLink.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockSubscriptionLink.js +1 -1
- package/testing/core/mocking/mockSubscriptionLink.js.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.d.ts +1 -1
- package/testing/core/mocking/mockWatchQuery.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/mocking/mockWatchQuery.js +1 -1
- package/testing/core/mocking/mockWatchQuery.js.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.d.ts +2 -3
- package/testing/core/observableToPromise.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/observableToPromise.js +1 -1
- package/testing/core/observableToPromise.js.map +1 -0
- package/testing/core/package.json +8 -0
- package/testing/core/subscribeAndCount.d.ts +4 -0
- package/testing/core/subscribeAndCount.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/subscribeAndCount.js +1 -1
- package/testing/core/subscribeAndCount.js.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.d.ts +0 -0
- package/testing/core/withConsoleSpy.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/withConsoleSpy.js +0 -0
- package/testing/core/withConsoleSpy.js.map +1 -0
- package/{utilities/testing → testing/core}/wrap.d.ts +0 -0
- package/testing/core/wrap.d.ts.map +1 -0
- package/{utilities/testing → testing/core}/wrap.js +0 -0
- package/testing/core/wrap.js.map +1 -0
- package/testing/index.d.ts +3 -1
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +3 -3
- package/testing/index.js.map +1 -1
- package/{utilities/testing/mocking → testing/react}/MockedProvider.d.ts +5 -5
- package/testing/react/MockedProvider.d.ts.map +1 -0
- package/{utilities/testing/mocking → testing/react}/MockedProvider.js +4 -4
- package/testing/react/MockedProvider.js.map +1 -0
- package/testing/testing.cjs +6 -332
- package/testing/testing.cjs.map +1 -1
- package/utilities/common/canUse.d.ts +1 -0
- package/utilities/common/canUse.d.ts.map +1 -1
- package/utilities/common/canUse.js +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 +7 -2
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/globals/DEV.js +2 -2
- package/utilities/globals/DEV.js.map +1 -1
- package/utilities/globals/{graphql.d.ts → fix-graphql.d.ts} +1 -1
- package/utilities/globals/fix-graphql.d.ts.map +1 -0
- package/utilities/globals/fix-graphql.js +6 -0
- package/utilities/globals/fix-graphql.js.map +1 -0
- package/utilities/{common → globals}/global.d.ts +0 -0
- package/utilities/globals/global.d.ts.map +1 -0
- package/utilities/{common → globals}/global.js +0 -0
- package/utilities/globals/global.js.map +1 -0
- package/utilities/globals/globals.cjs +56 -0
- package/utilities/globals/globals.cjs.map +1 -0
- package/utilities/globals/index.d.ts +4 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +7 -4
- package/utilities/globals/index.js.map +1 -1
- package/utilities/{common → globals}/maybe.d.ts +0 -0
- package/utilities/globals/maybe.d.ts.map +1 -0
- package/utilities/{common → globals}/maybe.js +0 -0
- package/utilities/globals/maybe.js.map +1 -0
- package/utilities/globals/package.json +8 -0
- package/utilities/graphql/directives.d.ts.map +1 -1
- package/utilities/graphql/directives.js +5 -5
- package/utilities/graphql/directives.js.map +1 -1
- package/utilities/graphql/fragments.d.ts.map +1 -1
- package/utilities/graphql/fragments.js +5 -5
- package/utilities/graphql/fragments.js.map +1 -1
- package/utilities/graphql/getFromAST.d.ts.map +1 -1
- package/utilities/graphql/getFromAST.js +9 -9
- package/utilities/graphql/getFromAST.js.map +1 -1
- package/utilities/graphql/storeUtils.d.ts.map +1 -1
- package/utilities/graphql/storeUtils.js +2 -2
- package/utilities/graphql/storeUtils.js.map +1 -1
- package/utilities/graphql/transform.d.ts.map +1 -1
- package/utilities/graphql/transform.js +2 -2
- package/utilities/graphql/transform.js.map +1 -1
- package/utilities/index.d.ts +1 -3
- package/utilities/index.d.ts.map +1 -1
- package/utilities/index.js +1 -4
- package/utilities/index.js.map +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/package.json +1 -3
- package/utilities/policies/pagination.d.ts +1 -1
- package/utilities/policies/pagination.d.ts.map +1 -1
- package/utilities/policies/pagination.js +9 -4
- package/utilities/policies/pagination.js.map +1 -1
- package/utilities/utilities.cjs +64 -85
- package/utilities/utilities.cjs.map +1 -1
- package/version.js +1 -1
- package/utilities/common/global.d.ts.map +0 -1
- package/utilities/common/global.js.map +0 -1
- package/utilities/common/maybe.d.ts.map +0 -1
- package/utilities/common/maybe.js.map +0 -1
- package/utilities/globals/graphql.d.ts.map +0 -1
- package/utilities/globals/graphql.js +0 -7
- package/utilities/globals/graphql.js.map +0 -1
- package/utilities/testing/index.d.ts.map +0 -1
- package/utilities/testing/index.js.map +0 -1
- package/utilities/testing/itAsync.d.ts.map +0 -1
- package/utilities/testing/itAsync.js.map +0 -1
- package/utilities/testing/mocking/MockedProvider.d.ts.map +0 -1
- package/utilities/testing/mocking/MockedProvider.js.map +0 -1
- package/utilities/testing/mocking/mockClient.d.ts.map +0 -1
- package/utilities/testing/mocking/mockClient.js.map +0 -1
- package/utilities/testing/mocking/mockFetch.d.ts.map +0 -1
- package/utilities/testing/mocking/mockFetch.js.map +0 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockLink.js.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.d.ts.map +0 -1
- package/utilities/testing/mocking/mockQueryManager.js.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.d.ts.map +0 -1
- package/utilities/testing/mocking/mockSubscriptionLink.js.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.d.ts.map +0 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +0 -1
- package/utilities/testing/observableToPromise.d.ts.map +0 -1
- package/utilities/testing/observableToPromise.js.map +0 -1
- package/utilities/testing/subscribeAndCount.d.ts +0 -5
- package/utilities/testing/subscribeAndCount.d.ts.map +0 -1
- package/utilities/testing/subscribeAndCount.js.map +0 -1
- package/utilities/testing/withConsoleSpy.d.ts.map +0 -1
- package/utilities/testing/withConsoleSpy.js.map +0 -1
- package/utilities/testing/wrap.d.ts.map +0 -1
- package/utilities/testing/wrap.js.map +0 -1
package/utilities/utilities.cjs
CHANGED
|
@@ -2,54 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var process$1 = require('ts-invariant/process');
|
|
5
|
+
var globals = require('./globals');
|
|
7
6
|
var graphql = require('graphql');
|
|
8
7
|
var tslib = require('tslib');
|
|
9
8
|
var zenObservableTs = require('zen-observable-ts');
|
|
10
9
|
require('symbol-observable');
|
|
11
10
|
|
|
12
|
-
function maybe(thunk) {
|
|
13
|
-
try {
|
|
14
|
-
return thunk();
|
|
15
|
-
}
|
|
16
|
-
catch (_a) { }
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
var global$1 = (maybe(function () { return globalThis; }) ||
|
|
20
|
-
maybe(function () { return window; }) ||
|
|
21
|
-
maybe(function () { return self; }) ||
|
|
22
|
-
maybe(function () { return global; }) ||
|
|
23
|
-
maybe(function () { return Function("return this")(); }));
|
|
24
|
-
|
|
25
|
-
var __ = "__";
|
|
26
|
-
var GLOBAL_KEY = [__, __].join("DEV");
|
|
27
|
-
function getDEV() {
|
|
28
|
-
try {
|
|
29
|
-
return Boolean(__DEV__);
|
|
30
|
-
}
|
|
31
|
-
catch (_a) {
|
|
32
|
-
Object.defineProperty(global$1, GLOBAL_KEY, {
|
|
33
|
-
value: maybe(function () { return process.env.NODE_ENV; }) !== "production",
|
|
34
|
-
enumerable: false,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
});
|
|
38
|
-
return global$1[GLOBAL_KEY];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
var DEV = getDEV();
|
|
42
|
-
|
|
43
|
-
function removeTemporaryGlobals() {
|
|
44
|
-
graphql.isType(null);
|
|
45
|
-
return process$1.remove();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function checkDEV() {
|
|
49
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 37);
|
|
50
|
-
}
|
|
51
|
-
removeTemporaryGlobals();
|
|
52
|
-
|
|
53
11
|
function shouldInclude(_a, variables) {
|
|
54
12
|
var directives = _a.directives;
|
|
55
13
|
if (!directives || !directives.length) {
|
|
@@ -60,7 +18,7 @@ function shouldInclude(_a, variables) {
|
|
|
60
18
|
var evaledValue = false;
|
|
61
19
|
if (ifArgument.value.kind === 'Variable') {
|
|
62
20
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
63
|
-
__DEV__ ?
|
|
21
|
+
__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : globals.invariant(evaledValue !== void 0, 37);
|
|
64
22
|
}
|
|
65
23
|
else {
|
|
66
24
|
evaledValue = ifArgument.value.value;
|
|
@@ -97,13 +55,13 @@ function getInclusionDirectives(directives) {
|
|
|
97
55
|
return;
|
|
98
56
|
var directiveArguments = directive.arguments;
|
|
99
57
|
var directiveName = directive.name.value;
|
|
100
|
-
__DEV__ ?
|
|
58
|
+
__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : globals.invariant(directiveArguments && directiveArguments.length === 1, 38);
|
|
101
59
|
var ifArgument = directiveArguments[0];
|
|
102
|
-
__DEV__ ?
|
|
60
|
+
__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 39);
|
|
103
61
|
var ifValue = ifArgument.value;
|
|
104
|
-
__DEV__ ?
|
|
105
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") :
|
|
106
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
62
|
+
__DEV__ ? globals.invariant(ifValue &&
|
|
63
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : globals.invariant(ifValue &&
|
|
64
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 40);
|
|
107
65
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
108
66
|
});
|
|
109
67
|
}
|
|
@@ -115,15 +73,15 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
115
73
|
var fragments = [];
|
|
116
74
|
document.definitions.forEach(function (definition) {
|
|
117
75
|
if (definition.kind === 'OperationDefinition') {
|
|
118
|
-
throw __DEV__ ? new
|
|
119
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new
|
|
76
|
+
throw __DEV__ ? new globals.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
77
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(41);
|
|
120
78
|
}
|
|
121
79
|
if (definition.kind === 'FragmentDefinition') {
|
|
122
80
|
fragments.push(definition);
|
|
123
81
|
}
|
|
124
82
|
});
|
|
125
83
|
if (typeof actualFragmentName === 'undefined') {
|
|
126
|
-
__DEV__ ?
|
|
84
|
+
__DEV__ ? globals.invariant(fragments.length === 1, "Found " + fragments.length + " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.") : globals.invariant(fragments.length === 1, 42);
|
|
127
85
|
actualFragmentName = fragments[0].name.value;
|
|
128
86
|
}
|
|
129
87
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -143,7 +101,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
143
101
|
],
|
|
144
102
|
},
|
|
145
103
|
}
|
|
146
|
-
], document.definitions) });
|
|
104
|
+
], document.definitions, true) });
|
|
147
105
|
return query;
|
|
148
106
|
}
|
|
149
107
|
function createFragmentMap(fragments) {
|
|
@@ -160,7 +118,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
160
118
|
return selection;
|
|
161
119
|
case 'FragmentSpread': {
|
|
162
120
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
163
|
-
__DEV__ ?
|
|
121
|
+
__DEV__ ? globals.invariant(fragment, "No fragment named " + selection.name.value + ".") : globals.invariant(fragment, 43);
|
|
164
122
|
return fragment;
|
|
165
123
|
}
|
|
166
124
|
default:
|
|
@@ -242,9 +200,9 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
242
200
|
argObj[name.value] = null;
|
|
243
201
|
}
|
|
244
202
|
else {
|
|
245
|
-
throw __DEV__ ? new
|
|
203
|
+
throw __DEV__ ? new globals.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
|
246
204
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
247
|
-
'overcome this limitation.') : new
|
|
205
|
+
'overcome this limitation.') : new globals.InvariantError(52);
|
|
248
206
|
}
|
|
249
207
|
}
|
|
250
208
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -378,16 +336,16 @@ function isInlineFragment(selection) {
|
|
|
378
336
|
}
|
|
379
337
|
|
|
380
338
|
function checkDocument(doc) {
|
|
381
|
-
__DEV__ ?
|
|
339
|
+
__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 44);
|
|
382
340
|
var operations = doc.definitions
|
|
383
341
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
384
342
|
.map(function (definition) {
|
|
385
343
|
if (definition.kind !== 'OperationDefinition') {
|
|
386
|
-
throw __DEV__ ? new
|
|
344
|
+
throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new globals.InvariantError(45);
|
|
387
345
|
}
|
|
388
346
|
return definition;
|
|
389
347
|
});
|
|
390
|
-
__DEV__ ?
|
|
348
|
+
__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : globals.invariant(operations.length <= 1, 46);
|
|
391
349
|
return doc;
|
|
392
350
|
}
|
|
393
351
|
function getOperationDefinition(doc) {
|
|
@@ -406,14 +364,14 @@ function getFragmentDefinitions(doc) {
|
|
|
406
364
|
}
|
|
407
365
|
function getQueryDefinition(doc) {
|
|
408
366
|
var queryDef = getOperationDefinition(doc);
|
|
409
|
-
__DEV__ ?
|
|
367
|
+
__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 47);
|
|
410
368
|
return queryDef;
|
|
411
369
|
}
|
|
412
370
|
function getFragmentDefinition(doc) {
|
|
413
|
-
__DEV__ ?
|
|
414
|
-
__DEV__ ?
|
|
371
|
+
__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 48);
|
|
372
|
+
__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 49);
|
|
415
373
|
var fragmentDef = doc.definitions[0];
|
|
416
|
-
__DEV__ ?
|
|
374
|
+
__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 50);
|
|
417
375
|
return fragmentDef;
|
|
418
376
|
}
|
|
419
377
|
function getMainDefinition(queryDoc) {
|
|
@@ -436,7 +394,7 @@ function getMainDefinition(queryDoc) {
|
|
|
436
394
|
if (fragmentDefinition) {
|
|
437
395
|
return fragmentDefinition;
|
|
438
396
|
}
|
|
439
|
-
throw __DEV__ ? new
|
|
397
|
+
throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(51);
|
|
440
398
|
}
|
|
441
399
|
function getDefaultValues(definition) {
|
|
442
400
|
var defaultValues = Object.create(null);
|
|
@@ -579,7 +537,7 @@ var addTypenameToDocument = Object.assign(function (doc) {
|
|
|
579
537
|
field.directives.some(function (d) { return d.name.value === 'export'; })) {
|
|
580
538
|
return;
|
|
581
539
|
}
|
|
582
|
-
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections), [TYPENAME_FIELD]) });
|
|
540
|
+
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
|
|
583
541
|
},
|
|
584
542
|
},
|
|
585
543
|
});
|
|
@@ -594,7 +552,7 @@ var connectionRemoveConfig = {
|
|
|
594
552
|
if (willRemove) {
|
|
595
553
|
if (!directive.arguments ||
|
|
596
554
|
!directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
|
|
597
|
-
__DEV__ &&
|
|
555
|
+
__DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
|
598
556
|
'You may want to use the key parameter to specify a store key.');
|
|
599
557
|
}
|
|
600
558
|
}
|
|
@@ -758,7 +716,7 @@ var DeepMerger = (function () {
|
|
|
758
716
|
if (hasOwnProperty.call(target, sourceKey)) {
|
|
759
717
|
var targetValue = target[sourceKey];
|
|
760
718
|
if (source[sourceKey] !== targetValue) {
|
|
761
|
-
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
|
|
719
|
+
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
|
|
762
720
|
if (result !== targetValue) {
|
|
763
721
|
target = _this.shallowCopyForMerge(target);
|
|
764
722
|
target[sourceKey] = result;
|
|
@@ -775,7 +733,12 @@ var DeepMerger = (function () {
|
|
|
775
733
|
return source;
|
|
776
734
|
};
|
|
777
735
|
DeepMerger.prototype.shallowCopyForMerge = function (value) {
|
|
778
|
-
if (isNonNullObject(value)
|
|
736
|
+
if (isNonNullObject(value)) {
|
|
737
|
+
if (this.pastCopies.has(value)) {
|
|
738
|
+
if (!Object.isFrozen(value))
|
|
739
|
+
return value;
|
|
740
|
+
this.pastCopies.delete(value);
|
|
741
|
+
}
|
|
779
742
|
if (Array.isArray(value)) {
|
|
780
743
|
value = value.slice(0);
|
|
781
744
|
}
|
|
@@ -794,7 +757,7 @@ function concatPagination(keyArgs) {
|
|
|
794
757
|
return {
|
|
795
758
|
keyArgs: keyArgs,
|
|
796
759
|
merge: function (existing, incoming) {
|
|
797
|
-
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing), incoming) : incoming;
|
|
760
|
+
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming;
|
|
798
761
|
},
|
|
799
762
|
};
|
|
800
763
|
}
|
|
@@ -825,7 +788,7 @@ function relayStylePagination(keyArgs) {
|
|
|
825
788
|
read: function (existing, _a) {
|
|
826
789
|
var canRead = _a.canRead, readField = _a.readField;
|
|
827
790
|
if (!existing)
|
|
828
|
-
return;
|
|
791
|
+
return existing;
|
|
829
792
|
var edges = [];
|
|
830
793
|
var firstEdgeCursor = "";
|
|
831
794
|
var lastEdgeCursor = "";
|
|
@@ -842,8 +805,13 @@ function relayStylePagination(keyArgs) {
|
|
|
842
805
|
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
|
843
806
|
},
|
|
844
807
|
merge: function (existing, incoming, _a) {
|
|
845
|
-
if (existing === void 0) { existing = makeEmptyData(); }
|
|
846
808
|
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
|
809
|
+
if (!existing) {
|
|
810
|
+
existing = makeEmptyData();
|
|
811
|
+
}
|
|
812
|
+
if (!incoming) {
|
|
813
|
+
return existing;
|
|
814
|
+
}
|
|
847
815
|
var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) {
|
|
848
816
|
if (isReference(edge = tslib.__assign({}, edge))) {
|
|
849
817
|
edge.cursor = readField("cursor", edge);
|
|
@@ -894,7 +862,7 @@ function relayStylePagination(keyArgs) {
|
|
|
894
862
|
else if (incoming.edges) {
|
|
895
863
|
prefix = [];
|
|
896
864
|
}
|
|
897
|
-
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix), incomingEdges), suffix);
|
|
865
|
+
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true);
|
|
898
866
|
var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo);
|
|
899
867
|
if (incoming.pageInfo) {
|
|
900
868
|
var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]);
|
|
@@ -966,9 +934,7 @@ function cloneDeepHelper(val, seen) {
|
|
|
966
934
|
function deepFreeze(value) {
|
|
967
935
|
var workSet = new Set([value]);
|
|
968
936
|
workSet.forEach(function (obj) {
|
|
969
|
-
if (isNonNullObject(obj)) {
|
|
970
|
-
if (!Object.isFrozen(obj))
|
|
971
|
-
Object.freeze(obj);
|
|
937
|
+
if (isNonNullObject(obj) && shallowFreeze(obj) === obj) {
|
|
972
938
|
Object.getOwnPropertyNames(obj).forEach(function (name) {
|
|
973
939
|
if (isNonNullObject(obj[name]))
|
|
974
940
|
workSet.add(obj[name]);
|
|
@@ -977,6 +943,19 @@ function deepFreeze(value) {
|
|
|
977
943
|
});
|
|
978
944
|
return value;
|
|
979
945
|
}
|
|
946
|
+
function shallowFreeze(obj) {
|
|
947
|
+
if (__DEV__ && !Object.isFrozen(obj)) {
|
|
948
|
+
try {
|
|
949
|
+
Object.freeze(obj);
|
|
950
|
+
}
|
|
951
|
+
catch (e) {
|
|
952
|
+
if (e instanceof TypeError)
|
|
953
|
+
return null;
|
|
954
|
+
throw e;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return obj;
|
|
958
|
+
}
|
|
980
959
|
function maybeDeepFreeze(obj) {
|
|
981
960
|
if (__DEV__) {
|
|
982
961
|
deepFreeze(obj);
|
|
@@ -1038,11 +1017,17 @@ function asyncMap(observable, mapFn, catchFn) {
|
|
|
1038
1017
|
});
|
|
1039
1018
|
}
|
|
1040
1019
|
|
|
1020
|
+
var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
|
1021
|
+
navigator.product === 'ReactNative');
|
|
1022
|
+
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1023
|
+
var canUseSymbol = typeof Symbol === 'function' &&
|
|
1024
|
+
typeof Symbol.for === 'function';
|
|
1025
|
+
|
|
1041
1026
|
function fixObservableSubclass(subclass) {
|
|
1042
1027
|
function set(key) {
|
|
1043
1028
|
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
|
1044
1029
|
}
|
|
1045
|
-
if (
|
|
1030
|
+
if (canUseSymbol && Symbol.species) {
|
|
1046
1031
|
set(Symbol.species);
|
|
1047
1032
|
}
|
|
1048
1033
|
set("@@species");
|
|
@@ -1188,10 +1173,6 @@ function graphQLResultHasError(result) {
|
|
|
1188
1173
|
return (result.errors && result.errors.length > 0) || false;
|
|
1189
1174
|
}
|
|
1190
1175
|
|
|
1191
|
-
var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
|
1192
|
-
navigator.product === 'ReactNative');
|
|
1193
|
-
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1194
|
-
|
|
1195
1176
|
function compact() {
|
|
1196
1177
|
var objects = [];
|
|
1197
1178
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -1225,19 +1206,18 @@ function stringifyForDisplay(value) {
|
|
|
1225
1206
|
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1226
1207
|
}
|
|
1227
1208
|
|
|
1228
|
-
|
|
1229
|
-
|
|
1209
|
+
exports.DEV = globals.DEV;
|
|
1210
|
+
exports.maybe = globals.maybe;
|
|
1230
1211
|
exports.Observable = zenObservableTs.Observable;
|
|
1231
1212
|
exports.Concast = Concast;
|
|
1232
|
-
exports.DEV = DEV;
|
|
1233
1213
|
exports.DeepMerger = DeepMerger;
|
|
1234
1214
|
exports.addTypenameToDocument = addTypenameToDocument;
|
|
1235
1215
|
exports.argumentsObjectFromField = argumentsObjectFromField;
|
|
1236
1216
|
exports.asyncMap = asyncMap;
|
|
1237
1217
|
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
|
1218
|
+
exports.canUseSymbol = canUseSymbol;
|
|
1238
1219
|
exports.canUseWeakMap = canUseWeakMap;
|
|
1239
1220
|
exports.canUseWeakSet = canUseWeakSet;
|
|
1240
|
-
exports.checkDEV = checkDEV;
|
|
1241
1221
|
exports.checkDocument = checkDocument;
|
|
1242
1222
|
exports.cloneDeep = cloneDeep;
|
|
1243
1223
|
exports.compact = compact;
|
|
@@ -1269,7 +1249,6 @@ exports.isReference = isReference;
|
|
|
1269
1249
|
exports.iterateObserversSafely = iterateObserversSafely;
|
|
1270
1250
|
exports.makeReference = makeReference;
|
|
1271
1251
|
exports.makeUniqueId = makeUniqueId;
|
|
1272
|
-
exports.maybe = maybe;
|
|
1273
1252
|
exports.maybeDeepFreeze = maybeDeepFreeze;
|
|
1274
1253
|
exports.mergeDeep = mergeDeep;
|
|
1275
1254
|
exports.mergeDeepArray = mergeDeepArray;
|