@apollo/client 3.4.8 → 3.4.12
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 +2 -2
- package/apollo-client.cjs.js +92 -107
- package/apollo-client.cjs.js.map +1 -1
- package/apollo-client.cjs.min.js +1 -0
- package/cache/cache.cjs.js +20 -22
- package/cache/cache.cjs.js.map +1 -1
- package/cache/index.d.ts +1 -0
- package/cache/index.d.ts.map +1 -1
- package/cache/index.js +1 -3
- package/cache/index.js.map +1 -1
- package/cache/inmemory/entityStore.js +2 -2
- package/cache/inmemory/entityStore.js.map +1 -1
- 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.map +1 -1
- package/cache/inmemory/policies.js +4 -4
- package/cache/inmemory/policies.js.map +1 -1
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +4 -4
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/cache/inmemory/writeToStore.d.ts.map +1 -1
- package/cache/inmemory/writeToStore.js +2 -2
- package/cache/inmemory/writeToStore.js.map +1 -1
- package/core/ApolloClient.d.ts.map +1 -1
- package/core/ApolloClient.js +3 -3
- 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.map +1 -1
- package/core/ObservableQuery.js +19 -6
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryManager.d.ts.map +1 -1
- package/core/QueryManager.js +10 -10
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs.js +49 -35
- package/core/core.cjs.js.map +1 -1
- package/core/index.js +1 -1
- package/core/index.js.map +1 -1
- package/errors/errors.cjs.js +1 -2
- package/errors/errors.cjs.js.map +1 -1
- package/errors/index.d.ts +1 -0
- package/errors/index.d.ts.map +1 -1
- package/errors/index.js +1 -3
- package/errors/index.js.map +1 -1
- package/invariantErrorCodes.js +56 -81
- package/link/core/ApolloLink.js +2 -2
- package/link/core/ApolloLink.js.map +1 -1
- package/link/core/core.cjs.js +4 -6
- package/link/core/core.cjs.js.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 -3
- package/link/core/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 +1 -0
- package/link/http/createHttpLink.js.map +1 -1
- package/link/http/http.cjs.js +3 -3
- package/link/http/http.cjs.js.map +1 -1
- package/link/http/index.d.ts +1 -0
- package/link/http/index.d.ts.map +1 -1
- package/link/http/index.js +1 -0
- package/link/http/index.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 -4
- package/link/persisted-queries/index.js.map +1 -1
- package/link/persisted-queries/persisted-queries.cjs.js +8 -5
- package/link/persisted-queries/persisted-queries.cjs.js.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 -0
- 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.js +3 -3
- package/link/utils/utils.cjs.js.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 +11 -11
- 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 +2 -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.js +15 -9
- package/react/context/context.cjs.js.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 -0
- package/react/context/index.js.map +1 -1
- package/react/data/OperationData.d.ts.map +1 -1
- package/react/data/OperationData.js +3 -3
- package/react/data/OperationData.js.map +1 -1
- package/react/data/QueryData.d.ts.map +1 -1
- package/react/data/QueryData.js +1 -3
- package/react/data/QueryData.js.map +1 -1
- package/react/data/data.cjs.js +6 -8
- package/react/data/data.cjs.js.map +1 -1
- package/react/data/index.d.ts +1 -0
- package/react/data/index.d.ts.map +1 -1
- package/react/data/index.js +1 -0
- package/react/data/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.js +5 -5
- package/react/hoc/hoc.cjs.js.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 -0
- package/react/hoc/index.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.js +3 -3
- package/react/hooks/hooks.cjs.js.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 -0
- package/react/hooks/index.js.map +1 -1
- package/react/hooks/useApolloClient.d.ts.map +1 -1
- package/react/hooks/useApolloClient.js +2 -2
- package/react/hooks/useApolloClient.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/hooks/utils/useAfterFastRefresh.d.ts +1 -0
- package/react/hooks/utils/useAfterFastRefresh.d.ts.map +1 -1
- package/react/hooks/utils/useAfterFastRefresh.js +1 -0
- package/react/hooks/utils/useAfterFastRefresh.js.map +1 -1
- package/react/hooks/utils/useBaseQuery.d.ts +1 -0
- package/react/hooks/utils/useBaseQuery.d.ts.map +1 -1
- package/react/hooks/utils/useBaseQuery.js +1 -0
- package/react/hooks/utils/useBaseQuery.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -3
- package/react/index.js.map +1 -1
- package/react/parser/index.d.ts.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/index.js.map +1 -1
- package/react/parser/parser.cjs.js +10 -10
- package/react/parser/parser.cjs.js.map +1 -1
- package/react/react.cjs.js +2 -3
- package/react/react.cjs.js.map +1 -1
- package/testing/index.d.ts +1 -0
- package/testing/index.d.ts.map +1 -1
- package/testing/index.js +1 -3
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs.js +3 -5
- package/testing/testing.cjs.js.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/mergeDeep.js +1 -1
- 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/{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.js +57 -0
- package/utilities/globals/globals.cjs.js.map +1 -0
- package/utilities/globals/index.d.ts +5 -2
- package/utilities/globals/index.d.ts.map +1 -1
- package/utilities/globals/index.js +8 -1
- 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 +7 -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 -5
- package/utilities/index.js.map +1 -1
- package/utilities/observables/Concast.js +1 -1
- package/utilities/observables/Concast.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/testing/mocking/mockFetch.js +1 -1
- package/utilities/testing/mocking/mockFetch.js.map +1 -1
- package/utilities/testing/mocking/mockLink.d.ts.map +1 -1
- package/utilities/testing/mocking/mockLink.js +2 -2
- package/utilities/testing/mocking/mockLink.js.map +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js +1 -1
- package/utilities/testing/mocking/mockWatchQuery.js.map +1 -1
- package/utilities/testing/observableToPromise.js +1 -1
- package/utilities/testing/observableToPromise.js.map +1 -1
- package/utilities/utilities.cjs.js +42 -74
- package/utilities/utilities.cjs.js.map +1 -1
- package/version.js +1 -1
- package/apollo-core.cjs.js +0 -5768
- package/apollo-core.cjs.js.map +0 -1
- package/apollo-core.cjs.min.js +0 -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
|
@@ -2,50 +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
|
-
|
|
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
|
-
removeTemporaryGlobals();
|
|
10
|
+
var __ = require('..');
|
|
49
11
|
|
|
50
12
|
function shouldInclude(_a, variables) {
|
|
51
13
|
var directives = _a.directives;
|
|
@@ -57,7 +19,7 @@ function shouldInclude(_a, variables) {
|
|
|
57
19
|
var evaledValue = false;
|
|
58
20
|
if (ifArgument.value.kind === 'Variable') {
|
|
59
21
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
60
|
-
__DEV__ ?
|
|
22
|
+
__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @" + directive.name.value + " directive.") : globals.invariant(evaledValue !== void 0, 39);
|
|
61
23
|
}
|
|
62
24
|
else {
|
|
63
25
|
evaledValue = ifArgument.value.value;
|
|
@@ -94,13 +56,13 @@ function getInclusionDirectives(directives) {
|
|
|
94
56
|
return;
|
|
95
57
|
var directiveArguments = directive.arguments;
|
|
96
58
|
var directiveName = directive.name.value;
|
|
97
|
-
__DEV__ ?
|
|
59
|
+
__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @" + directiveName + " directive.") : globals.invariant(directiveArguments && directiveArguments.length === 1, 40);
|
|
98
60
|
var ifArgument = directiveArguments[0];
|
|
99
|
-
__DEV__ ?
|
|
61
|
+
__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @" + directiveName + " directive.") : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 41);
|
|
100
62
|
var ifValue = ifArgument.value;
|
|
101
|
-
__DEV__ ?
|
|
102
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") :
|
|
103
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
63
|
+
__DEV__ ? globals.invariant(ifValue &&
|
|
64
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @" + directiveName + " directive must be a variable or a boolean value.") : globals.invariant(ifValue &&
|
|
65
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 42);
|
|
104
66
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
105
67
|
});
|
|
106
68
|
}
|
|
@@ -112,15 +74,15 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
112
74
|
var fragments = [];
|
|
113
75
|
document.definitions.forEach(function (definition) {
|
|
114
76
|
if (definition.kind === 'OperationDefinition') {
|
|
115
|
-
throw __DEV__ ? new
|
|
116
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new
|
|
77
|
+
throw __DEV__ ? new globals.InvariantError("Found a " + definition.operation + " operation" + (definition.name ? " named '" + definition.name.value + "'" : '') + ". " +
|
|
78
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(43);
|
|
117
79
|
}
|
|
118
80
|
if (definition.kind === 'FragmentDefinition') {
|
|
119
81
|
fragments.push(definition);
|
|
120
82
|
}
|
|
121
83
|
});
|
|
122
84
|
if (typeof actualFragmentName === 'undefined') {
|
|
123
|
-
__DEV__ ?
|
|
85
|
+
__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, 44);
|
|
124
86
|
actualFragmentName = fragments[0].name.value;
|
|
125
87
|
}
|
|
126
88
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -140,7 +102,7 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
140
102
|
],
|
|
141
103
|
},
|
|
142
104
|
}
|
|
143
|
-
], document.definitions) });
|
|
105
|
+
], document.definitions, true) });
|
|
144
106
|
return query;
|
|
145
107
|
}
|
|
146
108
|
function createFragmentMap(fragments) {
|
|
@@ -157,7 +119,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
157
119
|
return selection;
|
|
158
120
|
case 'FragmentSpread': {
|
|
159
121
|
var fragment = fragmentMap && fragmentMap[selection.name.value];
|
|
160
|
-
__DEV__ ?
|
|
122
|
+
__DEV__ ? globals.invariant(fragment, "No fragment named " + selection.name.value + ".") : globals.invariant(fragment, 45);
|
|
161
123
|
return fragment;
|
|
162
124
|
}
|
|
163
125
|
default:
|
|
@@ -239,9 +201,9 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
239
201
|
argObj[name.value] = null;
|
|
240
202
|
}
|
|
241
203
|
else {
|
|
242
|
-
throw __DEV__ ? new
|
|
204
|
+
throw __DEV__ ? new globals.InvariantError("The inline argument \"" + name.value + "\" of kind \"" + value.kind + "\"" +
|
|
243
205
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
244
|
-
'overcome this limitation.') : new
|
|
206
|
+
'overcome this limitation.') : new globals.InvariantError(54);
|
|
245
207
|
}
|
|
246
208
|
}
|
|
247
209
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -375,16 +337,16 @@ function isInlineFragment(selection) {
|
|
|
375
337
|
}
|
|
376
338
|
|
|
377
339
|
function checkDocument(doc) {
|
|
378
|
-
__DEV__ ?
|
|
340
|
+
__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', 46);
|
|
379
341
|
var operations = doc.definitions
|
|
380
342
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
381
343
|
.map(function (definition) {
|
|
382
344
|
if (definition.kind !== 'OperationDefinition') {
|
|
383
|
-
throw __DEV__ ? new
|
|
345
|
+
throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"" + definition.kind + "\"") : new globals.InvariantError(47);
|
|
384
346
|
}
|
|
385
347
|
return definition;
|
|
386
348
|
});
|
|
387
|
-
__DEV__ ?
|
|
349
|
+
__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains " + operations.length + " operations") : globals.invariant(operations.length <= 1, 48);
|
|
388
350
|
return doc;
|
|
389
351
|
}
|
|
390
352
|
function getOperationDefinition(doc) {
|
|
@@ -403,14 +365,14 @@ function getFragmentDefinitions(doc) {
|
|
|
403
365
|
}
|
|
404
366
|
function getQueryDefinition(doc) {
|
|
405
367
|
var queryDef = getOperationDefinition(doc);
|
|
406
|
-
__DEV__ ?
|
|
368
|
+
__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 49);
|
|
407
369
|
return queryDef;
|
|
408
370
|
}
|
|
409
371
|
function getFragmentDefinition(doc) {
|
|
410
|
-
__DEV__ ?
|
|
411
|
-
__DEV__ ?
|
|
372
|
+
__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', 50);
|
|
373
|
+
__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 51);
|
|
412
374
|
var fragmentDef = doc.definitions[0];
|
|
413
|
-
__DEV__ ?
|
|
375
|
+
__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 52);
|
|
414
376
|
return fragmentDef;
|
|
415
377
|
}
|
|
416
378
|
function getMainDefinition(queryDoc) {
|
|
@@ -433,7 +395,7 @@ function getMainDefinition(queryDoc) {
|
|
|
433
395
|
if (fragmentDefinition) {
|
|
434
396
|
return fragmentDefinition;
|
|
435
397
|
}
|
|
436
|
-
throw __DEV__ ? new
|
|
398
|
+
throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(53);
|
|
437
399
|
}
|
|
438
400
|
function getDefaultValues(definition) {
|
|
439
401
|
var defaultValues = Object.create(null);
|
|
@@ -576,7 +538,7 @@ var addTypenameToDocument = Object.assign(function (doc) {
|
|
|
576
538
|
field.directives.some(function (d) { return d.name.value === 'export'; })) {
|
|
577
539
|
return;
|
|
578
540
|
}
|
|
579
|
-
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections), [TYPENAME_FIELD]) });
|
|
541
|
+
return tslib.__assign(tslib.__assign({}, node), { selections: tslib.__spreadArray(tslib.__spreadArray([], selections, true), [TYPENAME_FIELD], false) });
|
|
580
542
|
},
|
|
581
543
|
},
|
|
582
544
|
});
|
|
@@ -591,7 +553,7 @@ var connectionRemoveConfig = {
|
|
|
591
553
|
if (willRemove) {
|
|
592
554
|
if (!directive.arguments ||
|
|
593
555
|
!directive.arguments.some(function (arg) { return arg.name.value === 'key'; })) {
|
|
594
|
-
__DEV__ &&
|
|
556
|
+
__DEV__ && globals.invariant.warn('Removing an @connection directive even though it does not have a key. ' +
|
|
595
557
|
'You may want to use the key parameter to specify a store key.');
|
|
596
558
|
}
|
|
597
559
|
}
|
|
@@ -755,7 +717,7 @@ var DeepMerger = (function () {
|
|
|
755
717
|
if (hasOwnProperty.call(target, sourceKey)) {
|
|
756
718
|
var targetValue = target[sourceKey];
|
|
757
719
|
if (source[sourceKey] !== targetValue) {
|
|
758
|
-
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context));
|
|
720
|
+
var result = _this.reconciler.apply(_this, tslib.__spreadArray([target, source, sourceKey], context, false));
|
|
759
721
|
if (result !== targetValue) {
|
|
760
722
|
target = _this.shallowCopyForMerge(target);
|
|
761
723
|
target[sourceKey] = result;
|
|
@@ -791,7 +753,7 @@ function concatPagination(keyArgs) {
|
|
|
791
753
|
return {
|
|
792
754
|
keyArgs: keyArgs,
|
|
793
755
|
merge: function (existing, incoming) {
|
|
794
|
-
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing), incoming) : incoming;
|
|
756
|
+
return existing ? tslib.__spreadArray(tslib.__spreadArray([], existing, true), incoming, true) : incoming;
|
|
795
757
|
},
|
|
796
758
|
};
|
|
797
759
|
}
|
|
@@ -822,7 +784,7 @@ function relayStylePagination(keyArgs) {
|
|
|
822
784
|
read: function (existing, _a) {
|
|
823
785
|
var canRead = _a.canRead, readField = _a.readField;
|
|
824
786
|
if (!existing)
|
|
825
|
-
return;
|
|
787
|
+
return existing;
|
|
826
788
|
var edges = [];
|
|
827
789
|
var firstEdgeCursor = "";
|
|
828
790
|
var lastEdgeCursor = "";
|
|
@@ -839,8 +801,13 @@ function relayStylePagination(keyArgs) {
|
|
|
839
801
|
return tslib.__assign(tslib.__assign({}, getExtras(existing)), { edges: edges, pageInfo: tslib.__assign(tslib.__assign({}, existing.pageInfo), { startCursor: startCursor || firstEdgeCursor, endCursor: endCursor || lastEdgeCursor }) });
|
|
840
802
|
},
|
|
841
803
|
merge: function (existing, incoming, _a) {
|
|
842
|
-
if (existing === void 0) { existing = makeEmptyData(); }
|
|
843
804
|
var args = _a.args, isReference = _a.isReference, readField = _a.readField;
|
|
805
|
+
if (!existing) {
|
|
806
|
+
existing = makeEmptyData();
|
|
807
|
+
}
|
|
808
|
+
if (!incoming) {
|
|
809
|
+
return existing;
|
|
810
|
+
}
|
|
844
811
|
var incomingEdges = incoming.edges ? incoming.edges.map(function (edge) {
|
|
845
812
|
if (isReference(edge = tslib.__assign({}, edge))) {
|
|
846
813
|
edge.cursor = readField("cursor", edge);
|
|
@@ -891,7 +858,7 @@ function relayStylePagination(keyArgs) {
|
|
|
891
858
|
else if (incoming.edges) {
|
|
892
859
|
prefix = [];
|
|
893
860
|
}
|
|
894
|
-
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix), incomingEdges), suffix);
|
|
861
|
+
var edges = tslib.__spreadArray(tslib.__spreadArray(tslib.__spreadArray([], prefix, true), incomingEdges, true), suffix, true);
|
|
895
862
|
var pageInfo = tslib.__assign(tslib.__assign({}, incoming.pageInfo), existing.pageInfo);
|
|
896
863
|
if (incoming.pageInfo) {
|
|
897
864
|
var _b = incoming.pageInfo, hasPreviousPage = _b.hasPreviousPage, hasNextPage = _b.hasNextPage, startCursor = _b.startCursor, endCursor = _b.endCursor, extras = tslib.__rest(_b, ["hasPreviousPage", "hasNextPage", "startCursor", "endCursor"]);
|
|
@@ -1039,7 +1006,7 @@ function fixObservableSubclass(subclass) {
|
|
|
1039
1006
|
function set(key) {
|
|
1040
1007
|
Object.defineProperty(subclass, key, { value: zenObservableTs.Observable });
|
|
1041
1008
|
}
|
|
1042
|
-
if (
|
|
1009
|
+
if (__.canUseSymbol && Symbol.species) {
|
|
1043
1010
|
set(Symbol.species);
|
|
1044
1011
|
}
|
|
1045
1012
|
set("@@species");
|
|
@@ -1073,7 +1040,7 @@ var Concast = (function (_super) {
|
|
|
1073
1040
|
var sub = _this.sub;
|
|
1074
1041
|
if (sub !== null) {
|
|
1075
1042
|
if (sub)
|
|
1076
|
-
|
|
1043
|
+
setTimeout(function () { return sub.unsubscribe(); });
|
|
1077
1044
|
_this.sub = null;
|
|
1078
1045
|
_this.latest = ["error", error];
|
|
1079
1046
|
_this.reject(error);
|
|
@@ -1188,6 +1155,8 @@ function graphQLResultHasError(result) {
|
|
|
1188
1155
|
var canUseWeakMap = typeof WeakMap === 'function' && !(typeof navigator === 'object' &&
|
|
1189
1156
|
navigator.product === 'ReactNative');
|
|
1190
1157
|
var canUseWeakSet = typeof WeakSet === 'function';
|
|
1158
|
+
var canUseSymbol = typeof Symbol === 'function' &&
|
|
1159
|
+
typeof Symbol.for === 'function';
|
|
1191
1160
|
|
|
1192
1161
|
function compact() {
|
|
1193
1162
|
var objects = [];
|
|
@@ -1222,16 +1191,16 @@ function stringifyForDisplay(value) {
|
|
|
1222
1191
|
}).split(JSON.stringify(undefId)).join("<undefined>");
|
|
1223
1192
|
}
|
|
1224
1193
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1194
|
+
exports.DEV = globals.DEV;
|
|
1195
|
+
exports.maybe = globals.maybe;
|
|
1227
1196
|
exports.Observable = zenObservableTs.Observable;
|
|
1228
1197
|
exports.Concast = Concast;
|
|
1229
|
-
exports.DEV = DEV;
|
|
1230
1198
|
exports.DeepMerger = DeepMerger;
|
|
1231
1199
|
exports.addTypenameToDocument = addTypenameToDocument;
|
|
1232
1200
|
exports.argumentsObjectFromField = argumentsObjectFromField;
|
|
1233
1201
|
exports.asyncMap = asyncMap;
|
|
1234
1202
|
exports.buildQueryFromSelectionSet = buildQueryFromSelectionSet;
|
|
1203
|
+
exports.canUseSymbol = canUseSymbol;
|
|
1235
1204
|
exports.canUseWeakMap = canUseWeakMap;
|
|
1236
1205
|
exports.canUseWeakSet = canUseWeakSet;
|
|
1237
1206
|
exports.checkDocument = checkDocument;
|
|
@@ -1265,7 +1234,6 @@ exports.isReference = isReference;
|
|
|
1265
1234
|
exports.iterateObserversSafely = iterateObserversSafely;
|
|
1266
1235
|
exports.makeReference = makeReference;
|
|
1267
1236
|
exports.makeUniqueId = makeUniqueId;
|
|
1268
|
-
exports.maybe = maybe;
|
|
1269
1237
|
exports.maybeDeepFreeze = maybeDeepFreeze;
|
|
1270
1238
|
exports.mergeDeep = mergeDeep;
|
|
1271
1239
|
exports.mergeDeepArray = mergeDeepArray;
|