@apollo/client 3.7.2 → 3.8.0-alpha.0
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 +250 -30
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/config/jest/setup.d.ts +1 -1
- package/config/jest/setup.d.ts.map +1 -1
- package/config/jest/setup.js +1 -0
- package/config/jest/setup.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +3 -2
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts.map +1 -1
- package/core/QueryInfo.js +6 -2
- package/core/QueryInfo.js.map +1 -1
- package/core/core.cjs +10 -5
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +10 -5
- package/core/watchQueryOptions.d.ts +1 -0
- package/core/watchQueryOptions.d.ts.map +1 -1
- package/core/watchQueryOptions.js.map +1 -1
- package/invariantErrorCodes.js +35 -23
- package/package.json +17 -3
- package/react/cache/SuspenseCache.d.ts +18 -0
- package/react/cache/SuspenseCache.d.ts.map +1 -0
- package/react/cache/SuspenseCache.js +49 -0
- package/react/cache/SuspenseCache.js.map +1 -0
- package/react/cache/index.d.ts +2 -0
- package/react/cache/index.d.ts.map +1 -0
- package/react/cache/index.js +2 -0
- package/react/cache/index.js.map +1 -0
- package/react/context/ApolloContext.d.ts +2 -0
- package/react/context/ApolloContext.d.ts.map +1 -1
- package/react/context/ApolloContext.js.map +1 -1
- package/react/context/ApolloProvider.d.ts +2 -0
- package/react/context/ApolloProvider.d.ts.map +1 -1
- package/react/context/ApolloProvider.js +4 -1
- package/react/context/ApolloProvider.js.map +1 -1
- package/react/context/context.cjs +4 -1
- package/react/context/context.cjs.map +1 -1
- package/react/context/context.cjs.native.js +4 -1
- package/react/hooks/compareResults.d.ts +3 -0
- package/react/hooks/compareResults.d.ts.map +1 -0
- package/react/hooks/compareResults.js +63 -0
- package/react/hooks/compareResults.js.map +1 -0
- package/react/hooks/hooks.cjs +167 -3
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +167 -3
- 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/internal/index.d.ts +2 -0
- package/react/hooks/internal/index.d.ts.map +1 -0
- package/react/hooks/internal/index.js +2 -0
- package/react/hooks/internal/index.js.map +1 -0
- package/react/hooks/internal/useDeepMemo.d.ts +3 -0
- package/react/hooks/internal/useDeepMemo.d.ts.map +1 -0
- package/react/hooks/internal/useDeepMemo.js +10 -0
- package/react/hooks/internal/useDeepMemo.js.map +1 -0
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +5 -3
- package/react/hooks/useQuery.js.map +1 -1
- package/react/hooks/useSuspenseCache.d.ts +2 -0
- package/react/hooks/useSuspenseCache.d.ts.map +1 -0
- package/react/hooks/useSuspenseCache.js +10 -0
- package/react/hooks/useSuspenseCache.js.map +1 -0
- package/react/hooks/useSuspenseQuery.d.ts +10 -0
- package/react/hooks/useSuspenseQuery.d.ts.map +1 -0
- package/react/hooks/useSuspenseQuery.js +157 -0
- package/react/hooks/useSuspenseQuery.js.map +1 -0
- package/react/index.d.ts +1 -0
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/parser/index.js +5 -5
- package/react/parser/parser.cjs +5 -5
- package/react/parser/parser.cjs.map +1 -1
- package/react/parser/parser.cjs.native.js +5 -5
- package/react/react.cjs +49 -2
- package/react/react.cjs.map +1 -1
- package/react/react.cjs.native.js +49 -2
- package/react/types/types.d.ts +9 -1
- package/react/types/types.d.ts.map +1 -1
- package/react/types/types.js.map +1 -1
- package/testing/core/core.cjs +1 -1
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +1 -1
- package/testing/core/mocking/mockLink.js +1 -1
- package/testing/react/MockedProvider.d.ts +3 -0
- package/testing/react/MockedProvider.d.ts.map +1 -1
- package/testing/react/MockedProvider.js +8 -3
- package/testing/react/MockedProvider.js.map +1 -1
- package/testing/testing.cjs +54 -3
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +54 -3
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +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/utilities.cjs +16 -16
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +16 -16
- package/version.js +1 -1
package/testing/testing.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.cjs","sources":["react/MockedProvider.js"],"sourcesContent":["import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { InMemoryCache as Cache } from '../../cache';\nimport { ApolloProvider } from '../../react/context';\nimport { MockLink } from '../core';\nvar MockedProvider = (function (_super) {\n __extends(MockedProvider, _super);\n function MockedProvider(props) {\n var _this = _super.call(this, props) || this;\n var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link;\n var client = new ApolloClient({\n cache: cache || new Cache({ addTypename: addTypename }),\n defaultOptions: defaultOptions,\n link: link || new MockLink(mocks || [], addTypename),\n resolvers: resolvers,\n });\n _this.state = {
|
|
1
|
+
{"version":3,"file":"testing.cjs","sources":["../react/cache/SuspenseCache.js","react/MockedProvider.js"],"sourcesContent":["import { canonicalStringify } from '../../cache';\nvar SuspenseCache = (function () {\n function SuspenseCache() {\n this.queries = new Map();\n }\n SuspenseCache.prototype.add = function (query, variables, _a) {\n var promise = _a.promise, observable = _a.observable;\n var variablesKey = this.getVariablesKey(variables);\n var map = this.queries.get(query) || new Map();\n var entry = {\n observable: observable,\n fulfilled: false,\n promise: promise\n .catch(function () {\n })\n .finally(function () {\n entry.fulfilled = true;\n }),\n };\n map.set(variablesKey, entry);\n this.queries.set(query, map);\n return entry;\n };\n SuspenseCache.prototype.lookup = function (query, variables) {\n var _a;\n return (_a = this.queries\n .get(query)) === null || _a === void 0 ? void 0 : _a.get(this.getVariablesKey(variables));\n };\n SuspenseCache.prototype.remove = function (query, variables) {\n var map = this.queries.get(query);\n if (!map) {\n return;\n }\n var key = this.getVariablesKey(variables);\n var entry = map.get(key);\n if (entry && !entry.observable.hasObservers()) {\n map.delete(key);\n }\n if (map.size === 0) {\n this.queries.delete(query);\n }\n };\n SuspenseCache.prototype.getVariablesKey = function (variables) {\n return canonicalStringify(variables || Object.create(null));\n };\n return SuspenseCache;\n}());\nexport { SuspenseCache };\n//# sourceMappingURL=SuspenseCache.js.map","import { __assign, __extends } from \"tslib\";\nimport * as React from 'react';\nimport { ApolloClient } from '../../core';\nimport { InMemoryCache as Cache } from '../../cache';\nimport { ApolloProvider } from '../../react/context';\nimport { SuspenseCache } from '../../react/cache';\nimport { MockLink } from '../core';\nvar MockedProvider = (function (_super) {\n __extends(MockedProvider, _super);\n function MockedProvider(props) {\n var _this = _super.call(this, props) || this;\n var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache = _a.cache, resolvers = _a.resolvers, link = _a.link, suspenseCache = _a.suspenseCache;\n var client = new ApolloClient({\n cache: cache || new Cache({ addTypename: addTypename }),\n defaultOptions: defaultOptions,\n link: link || new MockLink(mocks || [], addTypename),\n resolvers: resolvers,\n });\n _this.state = {\n client: client,\n suspenseCache: suspenseCache || new SuspenseCache()\n };\n return _this;\n }\n MockedProvider.prototype.render = function () {\n var _a = this.props, children = _a.children, childProps = _a.childProps;\n var _b = this.state, client = _b.client, suspenseCache = _b.suspenseCache;\n return React.isValidElement(children) ? (React.createElement(ApolloProvider, { client: client, suspenseCache: suspenseCache }, React.cloneElement(React.Children.only(children), __assign({}, childProps)))) : null;\n };\n MockedProvider.prototype.componentWillUnmount = function () {\n this.state.client.stop();\n };\n MockedProvider.defaultProps = {\n addTypename: true\n };\n return MockedProvider;\n}(React.Component));\nexport { MockedProvider };\n//# sourceMappingURL=MockedProvider.js.map"],"names":["canonicalStringify","__extends","cache","ApolloClient","Cache","MockLink","React","ApolloProvider","__assign"],"mappings":"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"}
|
|
@@ -24,23 +24,74 @@ function _interopNamespace(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
+
var SuspenseCache = (function () {
|
|
28
|
+
function SuspenseCache() {
|
|
29
|
+
this.queries = new Map();
|
|
30
|
+
}
|
|
31
|
+
SuspenseCache.prototype.add = function (query, variables, _a) {
|
|
32
|
+
var promise = _a.promise, observable = _a.observable;
|
|
33
|
+
var variablesKey = this.getVariablesKey(variables);
|
|
34
|
+
var map = this.queries.get(query) || new Map();
|
|
35
|
+
var entry = {
|
|
36
|
+
observable: observable,
|
|
37
|
+
fulfilled: false,
|
|
38
|
+
promise: promise
|
|
39
|
+
.catch(function () {
|
|
40
|
+
})
|
|
41
|
+
.finally(function () {
|
|
42
|
+
entry.fulfilled = true;
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
map.set(variablesKey, entry);
|
|
46
|
+
this.queries.set(query, map);
|
|
47
|
+
return entry;
|
|
48
|
+
};
|
|
49
|
+
SuspenseCache.prototype.lookup = function (query, variables) {
|
|
50
|
+
var _a;
|
|
51
|
+
return (_a = this.queries
|
|
52
|
+
.get(query)) === null || _a === void 0 ? void 0 : _a.get(this.getVariablesKey(variables));
|
|
53
|
+
};
|
|
54
|
+
SuspenseCache.prototype.remove = function (query, variables) {
|
|
55
|
+
var map = this.queries.get(query);
|
|
56
|
+
if (!map) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var key = this.getVariablesKey(variables);
|
|
60
|
+
var entry = map.get(key);
|
|
61
|
+
if (entry && !entry.observable.hasObservers()) {
|
|
62
|
+
map.delete(key);
|
|
63
|
+
}
|
|
64
|
+
if (map.size === 0) {
|
|
65
|
+
this.queries.delete(query);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
SuspenseCache.prototype.getVariablesKey = function (variables) {
|
|
69
|
+
return cache.canonicalStringify(variables || Object.create(null));
|
|
70
|
+
};
|
|
71
|
+
return SuspenseCache;
|
|
72
|
+
}());
|
|
73
|
+
|
|
27
74
|
var MockedProvider = (function (_super) {
|
|
28
75
|
tslib.__extends(MockedProvider, _super);
|
|
29
76
|
function MockedProvider(props) {
|
|
30
77
|
var _this = _super.call(this, props) || this;
|
|
31
|
-
var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache$1 = _a.cache, resolvers = _a.resolvers, link = _a.link;
|
|
78
|
+
var _a = _this.props, mocks = _a.mocks, addTypename = _a.addTypename, defaultOptions = _a.defaultOptions, cache$1 = _a.cache, resolvers = _a.resolvers, link = _a.link, suspenseCache = _a.suspenseCache;
|
|
32
79
|
var client = new core$1.ApolloClient({
|
|
33
80
|
cache: cache$1 || new cache.InMemoryCache({ addTypename: addTypename }),
|
|
34
81
|
defaultOptions: defaultOptions,
|
|
35
82
|
link: link || new core.MockLink(mocks || [], addTypename),
|
|
36
83
|
resolvers: resolvers,
|
|
37
84
|
});
|
|
38
|
-
_this.state = {
|
|
85
|
+
_this.state = {
|
|
86
|
+
client: client,
|
|
87
|
+
suspenseCache: suspenseCache || new SuspenseCache()
|
|
88
|
+
};
|
|
39
89
|
return _this;
|
|
40
90
|
}
|
|
41
91
|
MockedProvider.prototype.render = function () {
|
|
42
92
|
var _a = this.props, children = _a.children, childProps = _a.childProps;
|
|
43
|
-
|
|
93
|
+
var _b = this.state, client = _b.client, suspenseCache = _b.suspenseCache;
|
|
94
|
+
return React__namespace.isValidElement(children) ? (React__namespace.createElement(context.ApolloProvider, { client: client, suspenseCache: suspenseCache }, React__namespace.cloneElement(React__namespace.Children.only(children), tslib.__assign({}, childProps)))) : null;
|
|
44
95
|
};
|
|
45
96
|
MockedProvider.prototype.componentWillUnmount = function () {
|
|
46
97
|
this.state.client.stop();
|
|
@@ -42,7 +42,7 @@ function removeTemporaryGlobals() {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function checkDEV() {
|
|
45
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV,
|
|
45
|
+
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 40);
|
|
46
46
|
}
|
|
47
47
|
removeTemporaryGlobals();
|
|
48
48
|
checkDEV();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.cjs","sources":["maybe.js","global.js","DEV.js","fix-graphql.js","index.js"],"sourcesContent":["export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) ||\n maybe(function () { return maybe.constructor(\"return this\")(); }));\n//# sourceMappingURL=global.js.map","import global from \"./global\";\nimport { maybe } from \"./maybe\";\nvar __ = \"__\";\nvar GLOBAL_KEY = [__, __].join(\"DEV\");\nfunction getDEV() {\n try {\n return Boolean(__DEV__);\n }\n catch (_a) {\n Object.defineProperty(global, GLOBAL_KEY, {\n value: maybe(function () { return process.env.NODE_ENV; }) !== \"production\",\n enumerable: false,\n configurable: true,\n writable: true,\n });\n return global[GLOBAL_KEY];\n }\n}\nexport default getDEV();\n//# sourceMappingURL=DEV.js.map","import { remove } from 'ts-invariant/process';\nimport { Source } from 'graphql';\nexport function removeTemporaryGlobals() {\n return typeof Source === \"function\" ? remove() : remove();\n}\n//# sourceMappingURL=fix-graphql.js.map","import { invariant, InvariantError } from \"ts-invariant\";\nimport DEV from \"./DEV\";\nexport { DEV };\nexport function checkDEV() {\n __DEV__ ? invariant(\"boolean\" === typeof DEV, DEV) : invariant(\"boolean\" === typeof DEV,
|
|
1
|
+
{"version":3,"file":"globals.cjs","sources":["maybe.js","global.js","DEV.js","fix-graphql.js","index.js"],"sourcesContent":["export function maybe(thunk) {\n try {\n return thunk();\n }\n catch (_a) { }\n}\n//# sourceMappingURL=maybe.js.map","import { maybe } from \"./maybe\";\nexport default (maybe(function () { return globalThis; }) ||\n maybe(function () { return window; }) ||\n maybe(function () { return self; }) ||\n maybe(function () { return global; }) ||\n maybe(function () { return maybe.constructor(\"return this\")(); }));\n//# sourceMappingURL=global.js.map","import global from \"./global\";\nimport { maybe } from \"./maybe\";\nvar __ = \"__\";\nvar GLOBAL_KEY = [__, __].join(\"DEV\");\nfunction getDEV() {\n try {\n return Boolean(__DEV__);\n }\n catch (_a) {\n Object.defineProperty(global, GLOBAL_KEY, {\n value: maybe(function () { return process.env.NODE_ENV; }) !== \"production\",\n enumerable: false,\n configurable: true,\n writable: true,\n });\n return global[GLOBAL_KEY];\n }\n}\nexport default getDEV();\n//# sourceMappingURL=DEV.js.map","import { remove } from 'ts-invariant/process';\nimport { Source } from 'graphql';\nexport function removeTemporaryGlobals() {\n return typeof Source === \"function\" ? remove() : remove();\n}\n//# sourceMappingURL=fix-graphql.js.map","import { invariant, InvariantError } from \"ts-invariant\";\nimport DEV from \"./DEV\";\nexport { DEV };\nexport function checkDEV() {\n __DEV__ ? invariant(\"boolean\" === typeof DEV, DEV) : invariant(\"boolean\" === typeof DEV, 40);\n}\nimport { removeTemporaryGlobals } from \"./fix-graphql\";\nremoveTemporaryGlobals();\nexport { maybe } from \"./maybe\";\nexport { default as global } from \"./global\";\nexport { invariant, InvariantError };\ncheckDEV();\n//# sourceMappingURL=index.js.map"],"names":["global","Source","remove","invariant"],"mappings":";;;;;;;;AAAO,SAAS,KAAK,CAAC,KAAK,EAAE;AAC7B,IAAI,IAAI;AACR,QAAQ,OAAO,KAAK,EAAE,CAAC;AACvB,KAAK;AACL,IAAI,OAAO,EAAE,EAAE,GAAG;AAClB;;ACJA,eAAe,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,UAAU,CAAC,EAAE,CAAC;AACzD,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AACzC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,EAAE,CAAC;AACvC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,MAAM,CAAC,EAAE,CAAC;AACzC,IAAI,KAAK,CAAC,YAAY,EAAE,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC;;ACHrE,IAAI,EAAE,GAAG,IAAI,CAAC;AACd,IAAI,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACtC,SAAS,MAAM,GAAG;AAClB,IAAI,IAAI;AACR,QAAQ,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC;AAChC,KAAK;AACL,IAAI,OAAO,EAAE,EAAE;AACf,QAAQ,MAAM,CAAC,cAAc,CAACA,QAAM,EAAE,UAAU,EAAE;AAClD,YAAY,KAAK,EAAE,KAAK,CAAC,YAAY,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,YAAY;AACvF,YAAY,UAAU,EAAE,KAAK;AAC7B,YAAY,YAAY,EAAE,IAAI;AAC9B,YAAY,QAAQ,EAAE,IAAI;AAC1B,SAAS,CAAC,CAAC;AACX,QAAQ,OAAOA,QAAM,CAAC,UAAU,CAAC,CAAC;AAClC,KAAK;AACL,CAAC;AACD,UAAe,MAAM,EAAE;;AChBhB,SAAS,sBAAsB,GAAG;AACzC,IAAI,OAAO,OAAOC,cAAM,KAAK,UAAU,GAAGC,gBAAM,EAAE,GAAGA,gBAAM,EAAE,CAAC;AAC9D;;ACDO,SAAS,QAAQ,GAAG;AAC3B,IAAI,OAAO,GAAGC,qBAAS,CAAC,SAAS,KAAK,OAAO,GAAG,EAAE,GAAG,CAAC,GAAGA,qBAAS,CAAC,SAAS,KAAK,OAAO,GAAG,EAAE,EAAE,CAAC,CAAC;AACjG,CAAC;AAED,sBAAsB,EAAE,CAAC;AAIzB,QAAQ,EAAE;;;;;;;;;"}
|
|
@@ -42,7 +42,7 @@ function removeTemporaryGlobals() {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function checkDEV() {
|
|
45
|
-
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV,
|
|
45
|
+
__DEV__ ? tsInvariant.invariant("boolean" === typeof DEV, DEV) : tsInvariant.invariant("boolean" === typeof DEV, 40);
|
|
46
46
|
}
|
|
47
47
|
removeTemporaryGlobals();
|
|
48
48
|
checkDEV();
|
|
@@ -2,7 +2,7 @@ import { invariant, InvariantError } from "ts-invariant";
|
|
|
2
2
|
import DEV from "./DEV.js";
|
|
3
3
|
export { DEV };
|
|
4
4
|
export function checkDEV() {
|
|
5
|
-
__DEV__ ? invariant("boolean" === typeof DEV, DEV) : invariant("boolean" === typeof DEV,
|
|
5
|
+
__DEV__ ? invariant("boolean" === typeof DEV, DEV) : invariant("boolean" === typeof DEV, 40);
|
|
6
6
|
}
|
|
7
7
|
import { removeTemporaryGlobals } from "./fix-graphql.js";
|
|
8
8
|
removeTemporaryGlobals();
|
|
@@ -10,7 +10,7 @@ export function shouldInclude(_a, variables) {
|
|
|
10
10
|
var evaledValue = false;
|
|
11
11
|
if (ifArgument.value.kind === 'Variable') {
|
|
12
12
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
13
|
-
__DEV__ ? invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : invariant(evaledValue !== void 0,
|
|
13
|
+
__DEV__ ? invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : invariant(evaledValue !== void 0, 41);
|
|
14
14
|
}
|
|
15
15
|
else {
|
|
16
16
|
evaledValue = ifArgument.value.value;
|
|
@@ -57,13 +57,13 @@ export function getInclusionDirectives(directives) {
|
|
|
57
57
|
return;
|
|
58
58
|
var directiveArguments = directive.arguments;
|
|
59
59
|
var directiveName = directive.name.value;
|
|
60
|
-
__DEV__ ? invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : invariant(directiveArguments && directiveArguments.length === 1,
|
|
60
|
+
__DEV__ ? invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : invariant(directiveArguments && directiveArguments.length === 1, 42);
|
|
61
61
|
var ifArgument = directiveArguments[0];
|
|
62
|
-
__DEV__ ? invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
62
|
+
__DEV__ ? invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
|
|
63
63
|
var ifValue = ifArgument.value;
|
|
64
64
|
__DEV__ ? invariant(ifValue &&
|
|
65
65
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : invariant(ifValue &&
|
|
66
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
66
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
|
|
67
67
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -6,14 +6,14 @@ export function getFragmentQueryDocument(document, fragmentName) {
|
|
|
6
6
|
document.definitions.forEach(function (definition) {
|
|
7
7
|
if (definition.kind === 'OperationDefinition') {
|
|
8
8
|
throw __DEV__ ? new InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
9
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new InvariantError(
|
|
9
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new InvariantError(45);
|
|
10
10
|
}
|
|
11
11
|
if (definition.kind === 'FragmentDefinition') {
|
|
12
12
|
fragments.push(definition);
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
if (typeof actualFragmentName === 'undefined') {
|
|
16
|
-
__DEV__ ? invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : invariant(fragments.length === 1,
|
|
16
|
+
__DEV__ ? invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : invariant(fragments.length === 1, 46);
|
|
17
17
|
actualFragmentName = fragments[0].name.value;
|
|
18
18
|
}
|
|
19
19
|
var query = __assign(__assign({}, document), { definitions: __spreadArray([
|
|
@@ -54,7 +54,7 @@ export function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
54
54
|
return fragmentMap(fragmentName);
|
|
55
55
|
}
|
|
56
56
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
57
|
-
__DEV__ ? invariant(fragment, "No fragment named ".concat(fragmentName)) : invariant(fragment,
|
|
57
|
+
__DEV__ ? invariant(fragment, "No fragment named ".concat(fragmentName)) : invariant(fragment, 47);
|
|
58
58
|
return fragment || null;
|
|
59
59
|
}
|
|
60
60
|
default:
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { invariant, InvariantError } from "../globals/index.js";
|
|
2
2
|
import { valueToObjectRepresentation } from "./storeUtils.js";
|
|
3
3
|
export function checkDocument(doc) {
|
|
4
|
-
__DEV__ ? 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") : invariant(doc && doc.kind === 'Document',
|
|
4
|
+
__DEV__ ? 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") : invariant(doc && doc.kind === 'Document', 48);
|
|
5
5
|
var operations = doc.definitions
|
|
6
6
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
7
7
|
.map(function (definition) {
|
|
8
8
|
if (definition.kind !== 'OperationDefinition') {
|
|
9
|
-
throw __DEV__ ? new InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new InvariantError(
|
|
9
|
+
throw __DEV__ ? new InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new InvariantError(49);
|
|
10
10
|
}
|
|
11
11
|
return definition;
|
|
12
12
|
});
|
|
13
|
-
__DEV__ ? invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : invariant(operations.length <= 1,
|
|
13
|
+
__DEV__ ? invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : invariant(operations.length <= 1, 50);
|
|
14
14
|
return doc;
|
|
15
15
|
}
|
|
16
16
|
export function getOperationDefinition(doc) {
|
|
@@ -29,14 +29,14 @@ export function getFragmentDefinitions(doc) {
|
|
|
29
29
|
}
|
|
30
30
|
export function getQueryDefinition(doc) {
|
|
31
31
|
var queryDef = getOperationDefinition(doc);
|
|
32
|
-
__DEV__ ? invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : invariant(queryDef && queryDef.operation === 'query',
|
|
32
|
+
__DEV__ ? invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : invariant(queryDef && queryDef.operation === 'query', 51);
|
|
33
33
|
return queryDef;
|
|
34
34
|
}
|
|
35
35
|
export function getFragmentDefinition(doc) {
|
|
36
|
-
__DEV__ ? 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") : invariant(doc.kind === 'Document',
|
|
37
|
-
__DEV__ ? invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : invariant(doc.definitions.length <= 1,
|
|
36
|
+
__DEV__ ? 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") : invariant(doc.kind === 'Document', 52);
|
|
37
|
+
__DEV__ ? invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : invariant(doc.definitions.length <= 1, 53);
|
|
38
38
|
var fragmentDef = doc.definitions[0];
|
|
39
|
-
__DEV__ ? invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
39
|
+
__DEV__ ? invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : invariant(fragmentDef.kind === 'FragmentDefinition', 54);
|
|
40
40
|
return fragmentDef;
|
|
41
41
|
}
|
|
42
42
|
export function getMainDefinition(queryDoc) {
|
|
@@ -59,7 +59,7 @@ export function getMainDefinition(queryDoc) {
|
|
|
59
59
|
if (fragmentDefinition) {
|
|
60
60
|
return fragmentDefinition;
|
|
61
61
|
}
|
|
62
|
-
throw __DEV__ ? new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new InvariantError(
|
|
62
|
+
throw __DEV__ ? new InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new InvariantError(55);
|
|
63
63
|
}
|
|
64
64
|
export function getDefaultValues(definition) {
|
|
65
65
|
var defaultValues = Object.create(null);
|
|
@@ -73,7 +73,7 @@ export function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
73
73
|
else {
|
|
74
74
|
throw __DEV__ ? new InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
75
75
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
76
|
-
'overcome this limitation.') : new InvariantError(
|
|
76
|
+
'overcome this limitation.') : new InvariantError(56);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
export function storeKeyNameFromField(field, variables) {
|
package/utilities/utilities.cjs
CHANGED
|
@@ -18,7 +18,7 @@ function shouldInclude(_a, variables) {
|
|
|
18
18
|
var evaledValue = false;
|
|
19
19
|
if (ifArgument.value.kind === 'Variable') {
|
|
20
20
|
evaledValue = variables && variables[ifArgument.value.name.value];
|
|
21
|
-
__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0,
|
|
21
|
+
__DEV__ ? globals.invariant(evaledValue !== void 0, "Invalid variable referenced in @".concat(directive.name.value, " directive.")) : globals.invariant(evaledValue !== void 0, 41);
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
evaledValue = ifArgument.value.value;
|
|
@@ -65,13 +65,13 @@ function getInclusionDirectives(directives) {
|
|
|
65
65
|
return;
|
|
66
66
|
var directiveArguments = directive.arguments;
|
|
67
67
|
var directiveName = directive.name.value;
|
|
68
|
-
__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1,
|
|
68
|
+
__DEV__ ? globals.invariant(directiveArguments && directiveArguments.length === 1, "Incorrect number of arguments for the @".concat(directiveName, " directive.")) : globals.invariant(directiveArguments && directiveArguments.length === 1, 42);
|
|
69
69
|
var ifArgument = directiveArguments[0];
|
|
70
|
-
__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if',
|
|
70
|
+
__DEV__ ? globals.invariant(ifArgument.name && ifArgument.name.value === 'if', "Invalid argument for the @".concat(directiveName, " directive.")) : globals.invariant(ifArgument.name && ifArgument.name.value === 'if', 43);
|
|
71
71
|
var ifValue = ifArgument.value;
|
|
72
72
|
__DEV__ ? globals.invariant(ifValue &&
|
|
73
73
|
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), "Argument for the @".concat(directiveName, " directive must be a variable or a boolean value.")) : globals.invariant(ifValue &&
|
|
74
|
-
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'),
|
|
74
|
+
(ifValue.kind === 'Variable' || ifValue.kind === 'BooleanValue'), 44);
|
|
75
75
|
result.push({ directive: directive, ifArgument: ifArgument });
|
|
76
76
|
});
|
|
77
77
|
}
|
|
@@ -84,14 +84,14 @@ function getFragmentQueryDocument(document, fragmentName) {
|
|
|
84
84
|
document.definitions.forEach(function (definition) {
|
|
85
85
|
if (definition.kind === 'OperationDefinition') {
|
|
86
86
|
throw __DEV__ ? new globals.InvariantError("Found a ".concat(definition.operation, " operation").concat(definition.name ? " named '".concat(definition.name.value, "'") : '', ". ") +
|
|
87
|
-
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(
|
|
87
|
+
'No operations are allowed when using a fragment as a query. Only fragments are allowed.') : new globals.InvariantError(45);
|
|
88
88
|
}
|
|
89
89
|
if (definition.kind === 'FragmentDefinition') {
|
|
90
90
|
fragments.push(definition);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
if (typeof actualFragmentName === 'undefined') {
|
|
94
|
-
__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1,
|
|
94
|
+
__DEV__ ? globals.invariant(fragments.length === 1, "Found ".concat(fragments.length, " fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")) : globals.invariant(fragments.length === 1, 46);
|
|
95
95
|
actualFragmentName = fragments[0].name.value;
|
|
96
96
|
}
|
|
97
97
|
var query = tslib.__assign(tslib.__assign({}, document), { definitions: tslib.__spreadArray([
|
|
@@ -132,7 +132,7 @@ function getFragmentFromSelection(selection, fragmentMap) {
|
|
|
132
132
|
return fragmentMap(fragmentName);
|
|
133
133
|
}
|
|
134
134
|
var fragment = fragmentMap && fragmentMap[fragmentName];
|
|
135
|
-
__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment,
|
|
135
|
+
__DEV__ ? globals.invariant(fragment, "No fragment named ".concat(fragmentName)) : globals.invariant(fragment, 47);
|
|
136
136
|
return fragment || null;
|
|
137
137
|
}
|
|
138
138
|
default:
|
|
@@ -216,7 +216,7 @@ function valueToObjectRepresentation(argObj, name, value, variables) {
|
|
|
216
216
|
else {
|
|
217
217
|
throw __DEV__ ? new globals.InvariantError("The inline argument \"".concat(name.value, "\" of kind \"").concat(value.kind, "\"") +
|
|
218
218
|
'is not supported. Use variables instead of inline arguments to ' +
|
|
219
|
-
'overcome this limitation.') : new globals.InvariantError(
|
|
219
|
+
'overcome this limitation.') : new globals.InvariantError(56);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
function storeKeyNameFromField(field, variables) {
|
|
@@ -350,16 +350,16 @@ function isInlineFragment(selection) {
|
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
function checkDocument(doc) {
|
|
353
|
-
__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',
|
|
353
|
+
__DEV__ ? globals.invariant(doc && doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc && doc.kind === 'Document', 48);
|
|
354
354
|
var operations = doc.definitions
|
|
355
355
|
.filter(function (d) { return d.kind !== 'FragmentDefinition'; })
|
|
356
356
|
.map(function (definition) {
|
|
357
357
|
if (definition.kind !== 'OperationDefinition') {
|
|
358
|
-
throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(
|
|
358
|
+
throw __DEV__ ? new globals.InvariantError("Schema type definitions not allowed in queries. Found: \"".concat(definition.kind, "\"")) : new globals.InvariantError(49);
|
|
359
359
|
}
|
|
360
360
|
return definition;
|
|
361
361
|
});
|
|
362
|
-
__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1,
|
|
362
|
+
__DEV__ ? globals.invariant(operations.length <= 1, "Ambiguous GraphQL document: contains ".concat(operations.length, " operations")) : globals.invariant(operations.length <= 1, 50);
|
|
363
363
|
return doc;
|
|
364
364
|
}
|
|
365
365
|
function getOperationDefinition(doc) {
|
|
@@ -378,14 +378,14 @@ function getFragmentDefinitions(doc) {
|
|
|
378
378
|
}
|
|
379
379
|
function getQueryDefinition(doc) {
|
|
380
380
|
var queryDef = getOperationDefinition(doc);
|
|
381
|
-
__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query',
|
|
381
|
+
__DEV__ ? globals.invariant(queryDef && queryDef.operation === 'query', 'Must contain a query definition.') : globals.invariant(queryDef && queryDef.operation === 'query', 51);
|
|
382
382
|
return queryDef;
|
|
383
383
|
}
|
|
384
384
|
function getFragmentDefinition(doc) {
|
|
385
|
-
__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',
|
|
386
|
-
__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1,
|
|
385
|
+
__DEV__ ? globals.invariant(doc.kind === 'Document', "Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a \"gql\" tag? http://docs.apollostack.com/apollo-client/core.html#gql") : globals.invariant(doc.kind === 'Document', 52);
|
|
386
|
+
__DEV__ ? globals.invariant(doc.definitions.length <= 1, 'Fragment must have exactly one definition.') : globals.invariant(doc.definitions.length <= 1, 53);
|
|
387
387
|
var fragmentDef = doc.definitions[0];
|
|
388
|
-
__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition',
|
|
388
|
+
__DEV__ ? globals.invariant(fragmentDef.kind === 'FragmentDefinition', 'Must be a fragment definition.') : globals.invariant(fragmentDef.kind === 'FragmentDefinition', 54);
|
|
389
389
|
return fragmentDef;
|
|
390
390
|
}
|
|
391
391
|
function getMainDefinition(queryDoc) {
|
|
@@ -408,7 +408,7 @@ function getMainDefinition(queryDoc) {
|
|
|
408
408
|
if (fragmentDefinition) {
|
|
409
409
|
return fragmentDefinition;
|
|
410
410
|
}
|
|
411
|
-
throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(
|
|
411
|
+
throw __DEV__ ? new globals.InvariantError('Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment.') : new globals.InvariantError(55);
|
|
412
412
|
}
|
|
413
413
|
function getDefaultValues(definition) {
|
|
414
414
|
var defaultValues = Object.create(null);
|